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

544 lines
23 KiB

@{
ViewBag.Title = "Index";
Layout = "~/Views/Shared/_Index.cshtml";
}
<script>
debugger;
var _Clos = new Array();
var _Clos1 = new Array();
var flag = '1';
var mark = '';
var Arguments = '';
$(function () {
SetCols();
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 SetCols() {
$.ajax({
url: "/Print/SelectColumnName?" + Math.random(),
dataType: "json",
async: false,
success: function (data) {
var cols = new Array();
var collast = { label: "主键", name: "ID", hidden: true, key: true };
cols.push(collast);
var collast = { label: '单据号', name: 'Code', width: 120, align: 'left' };
cols.push(collast);
var collast = { label: '操作日期', name: 'MTIME', width: 150, align: 'left' };
cols.push(collast);
var collast = { label: '维护人', name: 'MUSER', width: 80, align: 'left' };
cols.push(collast);
var collast = { label: '维护人名称', name: 'MUSERName', width: 80, align: 'left' };
cols.push(collast);
var collast = { label: '是否合并拣料', name: 'IsNew', width: 80, align: 'left' };
cols.push(collast);
var cols1 = new Array();
var collast1 = { label: "主键", name: "ID", hidden: true, key: true };
cols1.push(collast1);
var collast1 = { label: '领料合并ID', name: 'MergeID', width: 120, align: 'left' };
cols1.push(collast1);
var collast1 = { label: '单据号', name: 'Code', width: 120, align: 'left' };
cols1.push(collast1);
var collast1 = { label: '料品编码', name: 'InvCode', width: 150, align: 'left' };
cols1.push(collast1);
var collast1 = { label: '料品名称', name: 'InvName', width: 150, align: 'left' };
cols1.push(collast1);
var collast1 = { label: '规格型号', name: 'InvStd', width: 100, align: 'left' };
cols1.push(collast1);
var collast1 = { label: '应发数量', name: 'iQuantity', width: 100, align: 'left' };
cols1.push(collast1);
var collast1 = { label: '单位', name: 'InvUnit', width: 150, align: 'left' };
cols1.push(collast1);
var collast1 = { label: '仓库编码', name: 'WarehouseCode', width: 100, align: 'left' };
cols1.push(collast1);
var collast1 = { label: '库位编码', name: 'LocationCode', width: 100, align: 'left' };
cols1.push(collast1);
var collast1 = { label: '条码库存', name: 'QTY', width: 100, align: 'left' };
cols1.push(collast1);
var collast1 = { label: '条码', name: 'LotNO', width: 100, align: 'left' };
cols1.push(collast1);
if (data != null && data.length > 0) {
DateList = data;
for (var i = 0; i < data.length; i++) {
var ColName = data[i].ColName;
var ColCode = data[i].ColCode;
var obj = new Array();
obj = {
label: ColName,
name: ColCode,
width: 80,
align: "left"
}
if (ColCode != "BatchCode")
cols.push(obj);
cols1.push(obj);
}
}
_Clos = cols;
_Clos1 = cols1;
}
});
}
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: _Clos,
//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: 'BatchCode', width: 100, align: 'left' },
{ label: '数量', name: 'Quantity', width: 100, align: 'left' },
{ label: '已发数量', name: 'IssueQuantity', 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: _Clos1,
//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 == "已合并") {
$.modalAlertNew("WMS00091");
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) {
$.modalAlertNew("WMS00092");
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') {
$.modalAlertNew("WMS00091");
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 == '') {
$.modalAlertNew("WMS00093");
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 == '拣料') {
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.Code + "',";
objArr = objArr.slice(0, objArr.length - 1);
objArr = "" + objArr + "|";
arr.push(objArr);
}
Arguments = arr;
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>