纽威
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.
 
 
 
 
 

449 lines
19 KiB

@{
ViewBag.Title = "Index";
Layout = "~/Views/Shared/_Index.cshtml";
}
<script>
debugger;
var flag = '1';
var mark = '';
var Arguments = '';
$(function () {
gridList();
gridList2(flag);
$("#selShow").change(function () {
debugger;
gridList();
});
});
//function gridList() {
// document.getElementById("gridPanel").innerHTML = ' <span><strong>详细信息</strong></span> <table id="gridList"></table> ';//重置grid
// var Type = $("#selShow").val();
// var $gridList = $("#gridList");
// var queryJson = {
// POCode: $("#txt_POCode").val(),
// InvCode: $("#txt_InvCode").val(),
// }
// $gridList.dataGrid({
// url: "/WMS/PickMaterial/GetGridJson?Type=" + Type + "&" + Math.random(),
// postData: { queryJson: JSON.stringify(queryJson) },
// height: 280,
// width: $(window).width() - 500,
// colModel: [
// { label: "主键", name: "ID", hidden: true, key: true },
// { label: '单据号', name: 'Code', width: 120, align: 'left' },
// { label: '单据行号', name: 'Sequence', width: 100, align: 'left' },
// { label: '操作日期', name: 'MTIME', width: 150, align: 'left' },
// { label: '料品编码', name: 'InvCode', width: 100, align: 'left' },
// { label: '料品名称', name: 'InvName', width: 100, align: 'left' },
// { label: '料品描述', name: 'InvDesc', width: 100, align: 'left' },
// { label: '规格型号', name: 'InvStd', width: 100, align: 'left' },
// { label: '数量', name: 'Quantity', width: 100, align: 'left' },
// { label: '单位', name: 'InvUnit', width: 100, align: 'left' },
// { label: '维护人', name: 'MUSER', width: 80, align: 'left' },
// { label: '维护人名称', name: 'MUSERName', width: 80, align: 'left' },
// { label: '仓库编码', name: 'WHCode', width: 80, align: 'left' },
// { label: '仓库名称', name: 'WarehouseName', width: 80, align: 'left' },
// //{ label: '是否合并拣料', name: 'IsNew', width: 80, align: 'left' },
// ],
// shrinkToFit: false,//宽度自适应
// autowidth: true,
// gridComplete: function () {
// },
// rowNum: 10000,
// autoScroll: true,
// sortname: 'Code',
// sortorder: "desc",
// viewrecords: true,
// multiselect: true,
// });
// $("#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(),
// InvCode: $("#txt_InvCode").val(),
// }
// $gridList.jqGrid('setGridParam', {
// postData: { queryJson: JSON.stringify(queryJson) },
// }).trigger('reloadGrid');
// });
//}
function gridList() {
document.getElementById("gridPanel").innerHTML = ' <span><strong>详细信息</strong></span> <table id="gridList"></table> ';//重置grid
var Type = $("#selShow").val();
var $gridList = $("#gridList");
var queryJson = {
POCode: $("#txt_POCode").val(),
InvCode: $("#txt_InvCode").val(),
}
$gridList.dataGrid({
url: "/WMS/PickMaterial/GetGridJson?Type=" + Type + "&" + Math.random(),
postData: { queryJson: JSON.stringify(queryJson) },
height: 280,
width: $(window).width() - 500,
colModel: [
{ label: "主键", name: "ID", hidden: true, key: true },
{ label: '单据号', name: 'Code', width: 120, align: 'left' },
{ label: '操作日期', name: 'MTIME', width: 150, align: 'left' },
{ label: '维护人', name: 'MUSER', width: 80, align: 'left' },
{ label: '维护人名称', name: 'MUSERName', width: 80, align: 'left' },
{ label: '是否合并拣料', name: 'IsNew', width: 80, align: 'left' },
],
shrinkToFit: false,//宽度自适应
autowidth: true,
gridComplete: function () {
},
rowNum: 10000,
autoScroll: true,
sortname: 'Code',
sortorder: "desc",
viewrecords: true,
multiselect: true,
subGrid: true, // (1)开启子表格支持
subGridRowExpanded: function (subgrid_id, rowid) { // (2)子表格容器的id和需要展开子表格的行id,将传入此事件函数
$("#gridList").jqGrid("setSelection", rowid, false);
bindSubGrid(subgrid_id, rowid)
}
});
function bindSubGrid(subgrid_id, rowid) {
var Type = $("#selShow").val();
$("#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 Code = $("#gridList").jqGrid('getRowData', rowid).Code;
//var Sequence = $("#gridList").jqGrid('getRowData', rowid).Sequence;
// (6)创建jqGrid对象
$("#" + subgrid_table_id).dataGrid({
cellEdit: true,
url: "/WMS/PickMaterial/GetSubGridJson?Code=" + Code + "&Type=" + Type + "&" + Math.random(), // (7)子表格数据对应的url,注意传入的contact.id参数
colModel: [
{ label: '单据号', name: 'Code', width: 120, align: 'left' },
{ label: '单据行号', name: 'Sequence', width: 100, align: 'left' },
{ label: '操作日期', name: 'MTIME', width: 150, align: 'left' },
{ label: '料品编码', name: 'InvCode', width: 100, align: 'left' },
{ label: '料品名称', name: 'InvName', width: 100, align: 'left' },
{ label: '料品描述', name: 'InvDesc', width: 100, align: 'left' },
{ label: '规格型号', name: 'InvStd', width: 100, align: 'left' },
{ label: '数量', name: 'Quantity', width: 100, align: 'left' },
{ label: '单位', name: 'InvUnit', width: 100, align: 'left' },
{ label: '维护人', name: 'MUSER', width: 80, align: 'left' },
{ label: '维护人名称', name: 'MUSERName', width: 80, align: 'left' },
{ label: '仓库编码', name: 'WHCode', width: 80, align: 'left' },
{ label: '仓库名称', name: 'WarehouseName', width: 80, align: 'left' },
],
//colModel: ColModelSub,
shrinkToFit: true,//宽度自适应
//multiselect: true,
prmNames: { search: "search" },
viewrecords: true,
height: "100%",
rowNum: 20,
pager: subgrid_pager_id,
});
}
$("#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(),
InvCode: $("#txt_InvCode").val(),
}
$gridList.jqGrid('setGridParam', {
postData: { queryJson: JSON.stringify(queryJson) },
}).trigger('reloadGrid');
});
}
function gridList2(flag) {
debugger;
document.getElementById("gridPanel2").innerHTML = ' <span><strong>合并信息</strong></span> <table id="gridList2"></table>';//重置grid
var Type = $("#selShow").val();
var $gridList = $("#gridList2");
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);
if (flag=='1') {
objArr += "'" + rowData.Code+ "',";
} else {
objArr += "'" + rowData.Code + "',";
}
}
$gridList.dataGrid({
url: "/WMS/PickMaterial/GetICSMOPickMergeTemp?ID=" + objArr + "&Type=" + Type + "&flag=" + flag + "&" + Math.random(),
height: 500,
width: $(window).width() - 500,
colModel: [
{ label: "主键", name: "ID", hidden: true, key: true },
{ label: '领料合并ID', name: 'MergeID', width: 120, align: 'left' },
{ label: '单据号', name: 'Code', width: 120, align: 'left' },
{ label: '料品编码', name: 'InvCode', width: 150, align: 'left' },
{ label: '料品名称', name: 'InvName', width: 150, align: 'left' },
{ label: '规格型号', name: 'InvStd', width: 100, align: 'left' },
{ label: '应发数量', name: 'iQuantity', width: 100, align: 'left' },
{ label: '单位', name: 'InvUnit', width: 150, align: 'left' },
{ label: '仓库编码', name: 'WarehouseCode', width: 100, align: 'left' },
{ label: '库位编码', name: 'LocationCode', width: 100, align: 'left' },
{ label: '条码库存', name: 'QTY', width: 100, align: 'left' },
{ label: '条码', name: 'LotNO', width: 100, align: 'left' },
],
shrinkToFit: false,//宽度自适应
autowidth: true,
gridComplete: function () {
},
rowNum: 10000,
sortorder: "desc",
viewrecords: true,
//multiselect: true,
});
$("#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 btnMaterial() {
debugger;
var objArr = '';
var arr = [];
mark = '拣料';
flag = '1';
var objList = $("#gridList").jqGrid('getGridParam', 'selarrrow');
for (var i = 0; i < objList.length; i++) {
var rowId = objList[i];
var rowData = $("#gridList").jqGrid('getRowData', rowId);
if (rowData.IsNew == "已合并") {
$.modalAlert("该单据已合并拣料,无法重复拣料!");
return;
}
objArr += "'" + rowData.Code + "',";
objArr = objArr.slice(0, objArr.length - 1);
objArr = "" + objArr + "|";
arr.push(objArr);
}
Arguments = arr;
gridList2(flag);
}
function btnMergeMaterial() {
debugger;
mark = '合并拣料';
var sign = '';
flag = '2';
var Type = $("#selShow").val();
var obj = '';
var objArr = '';
var objList = $("#gridList").jqGrid('getGridParam', 'selarrrow');
if (objList.length < 2) {
$.modalAlert("请至少选择两条数据进行合并!");
return;
}
for (var i = 0; i < objList.length; i++) {
var rowId = objList[i];
var rowData = $("#gridList").jqGrid('getRowData', rowId);
obj += rowData.Code + ",";
objArr += "'" + rowData.Code + "',";
}
$.ajax({
url: "/WMS/PickMaterial/CheckQty" + "?" + Math.random() + "&objArr=" + objArr,
dataType: "json",
type: "post",
async: false,
success: function (data) {
sign = data.count;
}
});
if (sign == '1') {
$.modalAlert("该单据已合并拣料,无法重复拣料!");
return;
}
$.submitForm({
url: "/WMS/PickMaterial/MergeMaterial?Type=" + Type + "&" + Math.random(),
param: {
keyValue: obj
},
success: function () {
//$.currentWindow().$("#gridList").trigger("reloadGrid");
gridList2(flag);
}
})
}
function btnPrint() {
debugger;
var mold = '';
if (mark == '') {
$.modalAlert("请先拣料再进行打印!");
return;
}
if (mark == '合并拣料') {
var objArr = '';
var arr = [];
var obj_Item1 = $("#gridList2");
var rowIds_Item1 = obj_Item1.getDataIDs();
var arrayData_Item1 = new Array();
var Enables = '';
if (rowIds_Item1.length > 0) {
debugger;
for (var i = 0; i < rowIds_Item1.length; i++) {
var RowData_Item1 = obj_Item1.getRowData(rowIds_Item1[0]);
objArr += "'" + RowData_Item1.MergeID + "',";
objArr = objArr.slice(0, objArr.length - 1);
objArr = "" + objArr + "|";
arr.push(objArr);
}
Arguments = arr;
mold = 'HBJL00001';
}
}
if (mark == '拣料') {
mold = 'JL00001';
}
$.modalOpen({
id: "PrintLot",
title: "打印",
url: "/WMS/Print/PrintView?Arguments=" + encodeURI(encodeURI(Arguments)) + "&mold=" + mold + "&" + Math.random(),
width: "550px",
height: "1000px",
callBack: function (iframeId) {
top.frames[iframeId].submitForm();
}
});
}
function fullscreen() {
var docElm = document.documentElement;
if (docElm.requestFullscreen) {
docElm.requestFullscreen();
} else if (docElm.mozRequestFullScreen) {
docElm.mozRequestFullScreen();
} else if (docElm.webkitRequestFullScreen) {
docElm.webkitRequestFullScreen();
} else if (docElm.msRequestFullscreen) {
docElm.msRequestFullscreen();
}
$(window).bind('resize', function () {
$("#gridList").setGridWidth($(window).width());
}).trigger('resize');
$(window).bind('resize', function () {
$("#gridList").setGridHeight($(window).height());
}).trigger('resize');
}
</script>
<div class="topPanel" style="height:60px;">
<div class="toolbar">
<div class="btn-group">
<a id="NF-Material" authorize="yes" style="margin-left:3px;" class="btn btn-primary" onclick="btnMaterial()"><i class="fa fa-pencil-square-o"></i>拣料</a>
<a id="NF-MergeMaterial" authorize="yes" style="margin-left:3px;" class="btn btn-primary" onclick="btnMergeMaterial()"><i class="fa fa-pencil-square-o"></i>合并拣料</a>
<a id="NF-Print" authorize="yes" style="margin-left:3px;" class="btn btn-primary" onclick="btnPrint()"><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>
<label>&nbsp;&nbsp;&nbsp;类型:</label>
</td>
<td>
<div class="input-group">
<select id="selShow" name="F_Target" class="form-control" style="width: 100px;">
<option value="1" selected="selected">工单备料</option>
<option value="2" selected="selected">工单领料</option>
<option value="3" selected="selected">工单材料出库</option>
<option value="4" selected="selected">委外备料</option>
<option value="5" selected="selected">委外领料</option>
<option value="6" selected="selected">委外材料出库</option>
<option value="7" selected="selected">销售发货</option>
<option value="8" selected="selected">其它出库</option>
<option value="9" selected="selected">借用</option>
<option value="10" selected="selected">物料调拨</option>
<option value="11" selected="selected">两步调出</option>
</select>
</div>
</td>
<td style="text-align:right;"><label class="lglabel" for="txt_POCode">&nbsp;&nbsp;&nbsp;单据号</label>:</td>
<td>
<div class="input-group">
<input id="txt_POCode" type="text" class="form-control" style="width: 150px;">
</div>
</td>
<td style="text-align:right;"><label class="lglabel" for="txt_InvCode">&nbsp;&nbsp;&nbsp;料品编码</label>:</td>
<td>
<div class="input-group">
<input id="txt_InvCode" type="text" class="form-control" style="width: 150px;">
</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" id="gridPanel">
<span><strong>详细信息</strong></span>
<table id="gridList"></table>
</div>
<div class="gridPanel" id="gridPanel2">
<span><strong>合并信息</strong></span>
<table id="gridList2"></table>
</div>