纽威
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

215 lines
8.6 KiB

@{
ViewBag.Title = "Index";
Layout = "~/Views/Shared/_Index.cshtml";
}
<script>
debugger;
//var Type = $.request("Type");
var ColModelMain = [];
var ColModelSub = [];
$(function () {
gridList();
})
function gridList() {
var $gridList = $("#gridList");
var queryJson = {
POCode: $("#txt_POCode").val(),
}
$gridList.dataGrid({
url: "/WMS/Blitem/GetGridJson" + "?" + Math.random(),
postData: { queryJson: JSON.stringify(queryJson) },
height: $(window).height() - 200,
width: $(window).width() - 300,
colModel: [
{ label: "主键", name: "ID", hidden: true, key: true },
{ label: '盘点单号', name: 'CheckCode', width: 120, align: 'left' },
{ label: '盘点日期', name: 'MTIME', width: 150, align: 'left' },
{ label: '层级', name: 'SelectLevel', width: 150, align: 'left' },
{ label: '状态', name: 'Status', width: 100, align: 'left' },
{ label: '规格型号', name: 'InvStd', width: 100, align: 'left' },
{ label: '库存数量', name: 'Quantity', width: 150, align: 'left' },
{ label: '辅计量数量', name: 'Amount', width: 100, align: 'left' },
{ label: '维护人', name: 'MuserName', width: 60, align: 'left', },
],
//colModel: ColModelMain,
width: "100%",
autowidth: true,
//shrinkToFit: true,
gridComplete: function () {
},
pager: "#gridPager",
sortname: 'CheckCode',
sortorder: "desc",
viewrecords: true,
multiselect: true,
beforeSelectRow: function (rowid, e) {
$("#gridList").jqGrid('resetSelection');
return (true);
},
subGrid: true, // (1)开启子表格支持
subGridRowExpanded: function (subgrid_id, rowid) { // (2)子表格容器的id和需要展开子表格的行id,将传入此事件函数
$("#gridList").jqGrid("setSelection", rowid, false);
bindSubGrid(subgrid_id, rowid)
}
});
$("#warehouse a.btn-default").click(function () {
$("#warehouse a.btn-default").removeClass("active");
$(this).addClass("active");
$('#btn_search').trigger("click");
});
$("#btn_search").click(function () {
var warehouse = $("#warehouse a.active").attr('data-value');
var queryJson = {
POCode: $("#txt_POCode").val(),
}
$gridList.jqGrid('setGridParam', {
postData: { queryJson: JSON.stringify(queryJson) },
}).trigger('reloadGrid');
});
}
function bindSubGrid(subgrid_id, rowid) {
$("#gridList").jqGrid("setSelection", rowid, false);
var subgrid_table_id;
subgrid_table_id = subgrid_id + "_t"; // (3)根据subgrid_id定义对应的子表格的table的id
var subgrid_pager_id;
subgrid_pager_id = subgrid_id + "_pgr" // (4)根据subgrid_id定义对应的子表格的pager的id
// (5)动态添加子报表的table和pager
$("#" + subgrid_id).html("<table id='" + subgrid_table_id + "' class='scroll'></table><div id='" + subgrid_pager_id + "' class='scroll'></div>");
var ID = $("#gridList").jqGrid('getRowData', rowid).ID;
//var Sequence = $("#gridList").jqGrid('getRowData', rowid).Sequence;
// (6)创建jqGrid对象
$("#" + subgrid_table_id).dataGrid({
cellEdit: true,
url: "/WMS/Blitem/GetSubGridJson?ID=" + ID + "&" + Math.random(), // (7)子表格数据对应的url,注意传入的contact.id参数
colModel: [
{ label: "主键", name: "ID", hidden: true, key: true },
{ label: "料品编码", name: "InvCode", width: 200, align: 'left' },
{ label: '料品名称', name: 'InvName', width: 200, align: 'left' },
{ label: '条码', name: 'LotNo', width: 200, align: 'left' },
{ label: '规格型号', name: 'InvStd', width: 200, align: 'left' },
{ label: '库存数量', name: 'Quantity', width: 100, align: 'left' },
{ label: '初盘数量', name: 'PrimaryQuantity', width: 100, align: 'left' },
{ label: '初盘辅计量数量', name: 'PrimaryAmount', width: 100, align: 'left' },
{ label: '复盘数量', name: 'ReplayQuantity', width: 100, align: 'left' },
{ label: '复盘辅计量数量', name: 'ReplayAmount', width: 100, align: 'left' },
{ label: '抽盘数量', name: 'CheckQuantity', width: 100, align: 'left' },
{ label: '抽盘辅计量数量', name: 'CheckAmount', width: 100, align: 'left' },
{ label: '仓库编码', name: 'WarehouseCode', width: 100, align: 'left' },
{ label: '库位编码', name: 'LocationCode', width: 150, align: 'left' },
{
label: '删除', width: 100, align: 'left',
formatter: btnLook
},
],
//colModel: ColModelSub,
shrinkToFit: true,//宽度自适应
multiselect: true,
prmNames: { search: "search" },
viewrecords: true,
height: "100%",
rowNum: 20,
pager: subgrid_pager_id,
});
}
function btnLook(cellvalue, options, rowObject) {
return cellvalue = "<a class=\"btn btn-primary dropdown-text\" onclick=\"DeleteClick('" + rowObject.ID + "')\">删除</a>";
}
function DeleteClick(ID) {
$.deleteForm({
url: "/WMS/Blitem/DeleteICSCheckDetail?ID=" + ID + "&" + Math.random(),
//param: { keyValue: JSON.stringify(objArr) },
success: function () {
$.currentWindow().$("#gridList").trigger("reloadGrid");
}
})
}
function btnDelete() {
var objArr = '';
var objList = $("#gridList").jqGrid('getGridParam', 'selarrrow');
for (var i = 0; i < objList.length; i++) {
var rowId = objList[i];
var rowData = $("#gridList").jqGrid('getRowData', rowId);
objArr += "'" + rowData.ID + "',";
}
if (objArr == '') {
$.modalAlertNew("WMS00001");
return;
}
$.deleteForm({
url: "/WMS/Blitem/DeleteICSCheck" + "?" + Math.random(),
param: { keyValue: JSON.stringify(objArr) },
success: function () {
$.currentWindow().$("#gridList").trigger("reloadGrid");
}
})
}
function btnCreate() {
debugger;
$.modalOpen({
id: "ICSCheckAdd",
title: "生成盘点计划",
url: "/WMS/Blitem/ICSCheckAdd",
width: "1200px",
height: "900px",
callBack: function (iframeId) {
top.frames[iframeId].submitForm();
}
});
}
</script>
<div class="topPanel" style="height:60px;">
<div class="toolbar">
<div class="btn-group">
<a id="NF-Create" authorize="yes" style="margin-left:3px;" class="btn btn-primary" onclick="btnCreate()"><i class="fa fa-pencil-square-o"></i>创建盘点计划</a>
<a id="NF-Delete" authorize="yes" style="margin-left:3px;" class="btn btn-primary" onclick="btnDelete()"><i class="fa fa-pencil-square-o"></i>删除盘点计划</a>
<a class="btn btn-primary" onclick="$.reload()"><span class="glyphicon glyphicon-refresh"></span></a>
</div>
<script>$('.toolbar').authorizeButton()</script>
</div>
<div class="search">
<table>
<tr>
<td style="text-align:right;"><label class="lglabel" for="txt_POCode">单据号</label>:</td>
<td>
<div class="input-group">
<input id="txt_POCode" type="text" class="form-control" style="width: 100px;">
</div>
</td>
<td>
<span class="input-group-btn">
<button id="btn_search" type="button" class="btn btn-primary"><i class="fa fa-search"></i></button>
</span>
</td>
</tr>
</table>
</div>
</div>
<div class="gridPanel">
<table id="gridList"></table>
<div id="gridPager"></div>
</div>