|
|
@{ ViewBag.Title = "Index"; Layout = "~/Views/Shared/_Index.cshtml"; } <style> .ui-jqgrid .ui-jqgrid-btable tbody tr.jqgrow td { overflow: inherit; word-wrap: break-word; }
.ui-jqgrid tr.jqgrow td { white-space: normal !important; height: auto; } </style> <link href="~/Content/js/select2/select2.min.css" rel="stylesheet" /> <link href="~/Content/css/bootstrap/bootstrap-select.css" rel="stylesheet" /> <script src="~/Content/js/datepicker/WdatePicker.js"></script> <script src="~/Content/js/bootstrap/bootstrap-select.js"></script> <script src="~/Content/js/select2/select2.min.js"></script> <script src="~/Content/js/layer/layer.js"></script>
<script> debugger; var Type = $.request("Type"); var _Clos = new Array();
$(function () { SetCols(Type); //来料检验 if (Type == '1') { gridList(); } //委外来料检验 if (Type == '3') { gridList2(); } //产成品检验 if (Type == '2') { $(".HideTxt").css('display', 'none'); $("#NF-update").css('display', 'none'); gridList3(); } })
function SetCols(Type) { $.ajax({ url: "/Print/SelectColumnName?" + Math.random(), dataType: "json", async: false, success: function (data) { var cols = new Array();
//来料检验 if (Type == '1') { var collast = { label: "主键", name: "ID", hidden: true, key: true }; cols.push(collast);
var collast = { label: 'ID', name: 'ID', hidden: true }; cols.push(collast); var collast = { label: '到货ID', name: 'DHID', hidden: true }; cols.push(collast); var collast = { label: '检验ID', name: 'JYID', hidden: true }; cols.push(collast); var collast = { label: '操作', width: 120, align: 'left', formatter: btnLook }; cols.push(collast); var collast = { label: '到货单号', name: 'DNCode', width: 120, align: 'left' }; cols.push(collast); var collast = { label: '送货单号', name: 'ASNCode', width: 120, align: 'left' }; cols.push(collast); var collast = { label: '采购订单号', name: 'POCode', width: 120, align: 'left' }; cols.push(collast); var collast = { label: '条码', name: 'LotNo', width: 120, align: 'left' }; cols.push(collast); var collast = { label: '料品编码', name: 'InvCode', width: 100, align: 'left' }; cols.push(collast); var collast = { label: '物料描述', name: 'InvName', width: 100, align: 'left' }; cols.push(collast); var collast = { label: '规格型号', name: 'INVSTD', width: 100, align: 'left' }; cols.push(collast); //var collast = { label: '批次', name: 'BatchCode', width: 100, align: 'left' }; //cols.push(collast); var collast = { label: '箱号', name: 'ContainerID', width: 100, align: 'left' }; cols.push(collast); var collast = { label: '到货时间', name: 'CreateDateTime', width: 150, align: 'left' }; cols.push(collast); var collast = { label: '供应商代码', name: 'VenCode', width: 150, align: 'left' }; cols.push(collast); var collast = { label: '供应商名称', name: 'VenName', width: 150, align: 'left' }; cols.push(collast); var collast = { label: '总数量', name: 'AllNumber', width: 100, align: 'left' }; cols.push(collast); var collast = { label: '合格数量', name: 'YLOTQTY', width: 100, align: 'left', editable: true, editrules: { number: true } }; cols.push(collast); var collast = { label: '不合格数量', name: 'NLOTQTY', width: 100, align: 'left', editable: true, editrules: { number: true } }; cols.push(collast); var collast = { label: '特采数量', name: 'SpecialQTY', width: 100, align: 'left', editable: true, editrules: { number: true } }; cols.push(collast); var collast = { label: '不良代码值', name: 'BCCodeValue', hidden: true }; cols.push(collast); var collast = { label: '不良代码', name: 'BadDesc', width: 120, align: 'left', sortable: false, formatter: function (cellvalue, options, rowObject) { debugger; var html = ""; html += ' <select id="SelBC_' + rowObject.ID.toString() + '" data-live-search ="true" Title=\"""\" class="selectpicker" data-width="85px">'; html += ' </select>'; return cellvalue = html; } }; cols.push(collast); var collast = { label: '不良原因值', name: 'BRCodeValue', hidden: true }; cols.push(collast); var collast = { label: '不良原因', name: 'BadReasonDesc', width: 120, align: 'left', sortable: false, formatter: function (cellvalue, options, rowObject) { var html = ""; html += ' <select id="SelBR_' + rowObject.ID.toString() + '" data-live-search ="true" Title=\"""\" class="selectpicker" data-width="85px">'; html += ' </select>'; return cellvalue = html; } }; cols.push(collast); var collast = { label: '检验状态', name: 'TestState', width: 150, align: 'left' }; cols.push(collast); var collast = { label: '检验人', name: 'Surveyor', width: 150, align: 'left' }; cols.push(collast); var collast = { label: '检验时间', name: 'ProvingTime', width: 150, align: 'left' }; cols.push(collast); } //委外来料检验 if (Type == '3') { var collast = { label: "主键", name: "ID", hidden: true, key: true }; cols.push(collast); var collast = { label: 'ID', name: 'ID', hidden: true }; cols.push(collast); var collast = { label: '到货ID', name: 'DHID', hidden: true }; cols.push(collast); var collast = { label: '检验ID', name: 'JYID', hidden: true }; cols.push(collast); var collast = { label: '操作', width: 120, align: 'left', formatter: btnLook }; cols.push(collast); var collast = { label: '委外到货单号', name: 'DNCode', width: 120, align: 'left' }; cols.push(collast); var collast = { label: '委外送货单号', name: 'OASNCode', width: 120, align: 'left' }; cols.push(collast); var collast = { label: '委外采购订单号', name: 'OOCode', width: 120, align: 'left' }; cols.push(collast); var collast = { label: '条码', name: 'LotNo', width: 120, align: 'left' }; cols.push(collast); var collast = { label: '料品编码', name: 'InvCode', width: 100, align: 'left' }; cols.push(collast); var collast = { label: '物料描述', name: 'InvName', width: 100, align: 'left' }; cols.push(collast); var collast = { label: '规格型号', name: 'INVSTD', width: 100, align: 'left' }; cols.push(collast); //var collast = { label: '批次', name: 'BatchCode', width: 100, align: 'left' }; //cols.push(collast); var collast = { label: '箱号', name: 'ContainerID', width: 100, align: 'left' }; cols.push(collast); var collast = { label: '到货时间', name: 'CreateDateTime', width: 150, align: 'left' }; cols.push(collast); var collast = { label: '供应商代码', name: 'VenCode', width: 150, align: 'left' }; cols.push(collast); var collast = { label: '供应商名称', name: 'VenName', width: 150, align: 'left' }; cols.push(collast); var collast = { label: '总数量', name: 'AllNumber', width: 100, align: 'left' }; cols.push(collast); var collast = { label: '合格数量', name: 'YLOTQTY', width: 100, align: 'left', editable: true, editrules: { number: true } }; cols.push(collast); var collast = { label: '不合格数量', name: 'NLOTQTY', width: 100, align: 'left', editable: true, editrules: { number: true } }; cols.push(collast); var collast = { label: '特采数量', name: 'SpecialQTY', width: 100, align: 'left', editable: true, editrules: { number: true } }; cols.push(collast); var collast = { label: '不良代码值', name: 'BCCodeValue', hidden: true }; cols.push(collast); var collast = { label: '不良代码', name: 'BadDesc', width: 120, align: 'left', sortable: false, formatter: function (cellvalue, options, rowObject) { debugger; var html = ""; html += ' <select id="SelBC_' + rowObject.ID.toString() + '" data-live-search ="true" Title=\"""\" class="selectpicker" data-width="85px">'; html += ' </select>'; return cellvalue = html; } }; cols.push(collast); var collast = { label: '不良原因值', name: 'BRCodeValue', hidden: true }; cols.push(collast); var collast = { label: '不良原因', name: 'BadReasonDesc', width: 120, align: 'left', sortable: false, formatter: function (cellvalue, options, rowObject) { var html = ""; html += ' <select id="SelBR_' + rowObject.ID.toString() + '" data-live-search ="true" Title=\"""\" class="selectpicker" data-width="85px">'; html += ' </select>'; return cellvalue = html; } }; cols.push(collast); var collast = { label: '检验状态', name: 'TestState', width: 150, align: 'left' }; cols.push(collast); var collast = { label: '检验人', name: 'Surveyor', width: 150, align: 'left' }; cols.push(collast); var collast = { label: '检验时间', name: 'ProvingTime', width: 150, align: 'left' }; cols.push(collast); } //产成品检验 if (Type == '2') { var collast = { label: "主键", name: "ID", hidden: true, key: true }; cols.push(collast); var collast = { label: 'ID', name: 'ID', hidden: true }; cols.push(collast); var collast = { label: '工单ID', name: 'GDID', hidden: true }; cols.push(collast); var collast = { label: '检验ID', name: 'JYID', hidden: true }; cols.push(collast); var collast = { label: '操作', width: 120, align: 'left', formatter: btnLook }; cols.push(collast); var collast = { label: '工单单号', name: 'DNCode', width: 120, align: 'left' }; cols.push(collast); var collast = { label: '条码', name: 'LotNo', width: 120, align: 'left' }; cols.push(collast); var collast = { label: '料品编码', name: 'InvCode', width: 100, align: 'left' }; cols.push(collast); var collast = { label: '物料描述', name: 'InvName', width: 100, align: 'left' }; cols.push(collast); var collast = { label: '规格型号', name: 'INVSTD', width: 100, align: 'left' }; cols.push(collast); //var collast = { label: '批次', name: 'BatchCode', width: 100, align: 'left' }; //cols.push(collast); var collast = { label: '箱号', name: 'ContainerID', width: 100, align: 'left' }; cols.push(collast); var collast = { label: '生产时间', name: 'ProductTime', width: 150, align: 'left' }; cols.push(collast); var collast = { label: '总数量', name: 'AllNumber', width: 100, align: 'left' }; cols.push(collast); var collast = { label: '合格数量', name: 'YLOTQTY', width: 100, align: 'left', editable: true, editrules: { number: true } }; cols.push(collast); var collast = { label: '不合格数量', name: 'NLOTQTY', width: 100, align: 'left', editable: true, editrules: { number: true } }; cols.push(collast); var collast = { label: '特采数量', name: 'SpecialQTY', width: 100, align: 'left', editable: true, editrules: { number: true } }; cols.push(collast); var collast = { label: '不良代码值', name: 'BCCodeValue', hidden: true }; cols.push(collast); var collast = { label: '不良代码', name: 'BadDesc', width: 120, align: 'left', sortable: false, formatter: function (cellvalue, options, rowObject) { debugger; var html = ""; html += ' <select id="SelBC_' + rowObject.ID.toString() + '" data-live-search ="true" Title=\"""\" class="selectpicker" data-width="85px">'; html += ' </select>'; return cellvalue = html; } }; cols.push(collast); var collast = { label: '不良原因值', name: 'BRCodeValue', hidden: true }; cols.push(collast); var collast = { label: '不良原因', name: 'BadReasonDesc', width: 120, align: 'left', sortable: false, formatter: function (cellvalue, options, rowObject) { var html = ""; html += ' <select id="SelBR_' + rowObject.ID.toString() + '" data-live-search ="true" Title=\"""\" class="selectpicker" data-width="85px">'; html += ' </select>'; return cellvalue = html; } }; cols.push(collast); var collast = { label: '检验状态', name: 'TestState', width: 150, align: 'left' }; cols.push(collast); var collast = { label: '检验人', name: 'Surveyor', width: 150, align: 'left' }; cols.push(collast); var collast = { label: '检验时间', name: 'ProvingTime', width: 150, align: 'left' }; cols.push(collast); }
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" } cols.push(obj); } } _Clos = cols; } }); }
function gridList() {
var $gridList = $("#gridList"); var queryJson = { POCode: $("#txt_POCode").val(), ASNCode: $("#txt_ASNCode").val(), CaiGouCode: $("#txt_CaiGouCode").val(), VenCode: $("#txt_VenCode").val(), VenName: $("#txt_VenName").val(), InvCode: $("#txt_InvCode").val(), InvName: $("#txt_InvName").val(), BatchCode: $("#txt_BatchCode").val(), ReleaseState: $("#selShow").val(), } $gridList.dataGrid({ url: "/WMS/ICSRCVIQCs/GetICSInspection" + "?" + Math.random(), postData: { queryJson: JSON.stringify(queryJson) }, height: $(window).height() - 200, width: $(window).width() - 300, cellEdit: true, colModel: _Clos, //colModel: [ // { label: "主键", name: "ID", hidden: true, key: true }, // { label: 'ID', name: 'ID', hidden: true }, // { label: '到货ID', name: 'DHID', hidden: true }, // { label: '检验ID', name: 'JYID', hidden: true }, // { label: '到货单号', name: 'DNCode', width: 120, align: 'left' }, // { label: '送货单号', name: 'ASNCode', width: 120, align: 'left' }, // { label: '采购订单号', name: 'POCode', width: 120, align: 'left' }, // { label: '条码', name: 'LotNo', width: 120, align: 'left' }, // { label: '料品编码', name: 'InvCode', width: 100, align: 'left' }, // { label: '物料描述', name: 'InvName', width: 100, align: 'left' }, // { label: '规格型号', name: 'INVSTD', width: 100, align: 'left' }, // { label: '批次', name: 'BatchCode', width: 100, align: 'left' }, // { label: '箱号', name: 'ContainerID', width: 100, align: 'left' }, // { label: '到货时间', name: 'CreateDateTime', width: 150, align: 'left' }, // { label: '供应商代码', name: 'VenCode', width: 150, align: 'left' }, // { label: '供应商名称', name: 'VenName', width: 150, align: 'left' }, // { label: '总数量', name: 'AllNumber', width: 100, align: 'left' }, // { label: '合格数量', name: 'YLOTQTY', width: 100, align: 'left', editable: true, editrules: { number: true } }, // { label: '不合格数量', name: 'NLOTQTY', width: 100, align: 'left', editable: true, editrules: { number: true } }, // { label: '特采数量', name: 'SpecialQTY', width: 100, align: 'left', editable: true, editrules: { number: true } }, // { label: '不良代码值', name: 'BCCodeValue', hidden: true }, // { // label: '不良代码', name: 'BadDesc', width: 120, align: 'left', sortable: false, // formatter: function (cellvalue, options, rowObject) { // debugger; // var html = ""; // html += ' <select id="SelBC_' + rowObject.ID.toString() + '" data-live-search ="true" Title=\"""\" class="selectpicker" data-width="85px">'; // html += ' </select>'; // return cellvalue = html; // } // }, // { label: '不良原因值', name: 'BRCodeValue', hidden: true }, // { // label: '不良原因', name: 'BadReasonDesc', width: 120, align: 'left', sortable: false, // formatter: function (cellvalue, options, rowObject) { // var html = ""; // html += ' <select id="SelBR_' + rowObject.ID.toString() + '" data-live-search ="true" Title=\"""\" class="selectpicker" data-width="85px">'; // html += ' </select>'; // return cellvalue = html; // } // }, // { label: '检验状态', name: 'TestState', width: 150, align: 'left' }, // { label: '检验人', name: 'Surveyor', width: 150, align: 'left' }, // { label: '检验时间', name: 'ProvingTime', width: 150, align: 'left' }, //], cellsubmit: "clientArray", shrinkToFit: false,//宽度自适应 autoWidth: true, gridComplete: function () { debugger; //设置select var RowDatas = $("#gridList").jqGrid('getDataIDs'); for (var j = 0; j < RowDatas.length; j++) { var InvCode = $("#gridList").jqGrid("getCell", RowDatas[j], "InvCode"); var ID = $("#gridList").jqGrid("getCell", RowDatas[j], "ID"); var BCCodeValue = $("#gridList").jqGrid("getCell", RowDatas[j], "BCCodeValue"); var BRCodeValue = $("#gridList").jqGrid("getCell", RowDatas[j], "BRCodeValue"); GetSelectICSBadCode(InvCode, ID, BCCodeValue); GetSelectPerson(InvCode, ID, BRCodeValue); }
}, pager: "#gridPager", sortorder: "desc", sortname: 'DNCode ', viewrecords: true, multiselect: true, subGrid: false, // (1)开启子表格支持 afterSaveCell: function (rowid, cellname, value) { debugger; //总扣分数加其他扣分数 if (cellname === 'YLOTQTY') { var YLOTQTY = value; var AllNumber = $gridList.jqGrid("getCell", rowid, 'AllNumber'); var str = Math.round((parseFloat(AllNumber) - parseFloat(YLOTQTY)) * 10) / 10; $gridList.jqGrid("setCell", rowid, 'NLOTQTY', str); } if (cellname === 'NLOTQTY') { var NLOTQTY = value; var AllNumber = $gridList.jqGrid("getCell", rowid, 'AllNumber'); var str = Math.round((parseFloat(AllNumber) - parseFloat(NLOTQTY)) * 10) / 10; $gridList.jqGrid("setCell", rowid, 'YLOTQTY', str); }
},
});
$("#btn_search").click(function () { var warehouse = $("#warehouse a.active").attr('data-value'); var queryJson = { POCode: $("#txt_POCode").val(), ASNCode: $("#txt_ASNCode").val(), CaiGouCode: $("#txt_CaiGouCode").val(), VenCode: $("#txt_VenCode").val(), VenName: $("#txt_VenName").val(), InvCode: $("#txt_InvCode").val(), InvName: $("#txt_InvName").val(), BatchCode: $("#txt_BatchCode").val(), ReleaseState: $("#selShow").val(), } $gridList.jqGrid('setGridParam', { postData: { queryJson: JSON.stringify(queryJson) }, }).trigger('reloadGrid'); }); }
function gridList2() { var $gridList = $("#gridList"); var queryJson = { POCode: $("#txt_POCode").val(), ASNCode: $("#txt_ASNCode").val(), CaiGouCode: $("#txt_CaiGouCode").val(), VenCode: $("#txt_VenCode").val(), VenName: $("#txt_VenName").val(), InvCode: $("#txt_InvCode").val(), InvName: $("#txt_InvName").val(), BatchCode: $("#txt_BatchCode").val(), ReleaseState: $("#selShow").val(), } $gridList.dataGrid({ url: "/WMS/ICSRCVIQCs/GetICSInspection2" + "?" + Math.random(), postData: { queryJson: JSON.stringify(queryJson) }, height: $(window).height() - 200, width: $(window).width() - 300, cellEdit: true, colModel: _Clos, //colModel: [ // { label: "主键", name: "ID", hidden: true, key: true }, // { label: 'ID', name: 'ID', hidden: true }, // { label: '到货ID', name: 'DHID', hidden: true }, // { label: '检验ID', name: 'JYID', hidden: true }, // { label: '委外到货单号', name: 'DNCode', width: 120, align: 'left' }, // { label: '委外送货单号', name: 'OASNCode', width: 120, align: 'left' }, // { label: '委外采购订单号', name: 'OOCode', width: 120, align: 'left' }, // { label: '条码', name: 'LotNo', width: 120, align: 'left' }, // { label: '料品编码', name: 'InvCode', width: 100, align: 'left' }, // { label: '物料描述', name: 'InvName', width: 100, align: 'left' }, // { label: '规格型号', name: 'INVSTD', width: 100, align: 'left' }, // { label: '批次', name: 'BatchCode', width: 100, align: 'left' }, // { label: '箱号', name: 'ContainerID', width: 100, align: 'left' }, // { label: '到货时间', name: 'CreateDateTime', width: 150, align: 'left' }, // { label: '供应商代码', name: 'VenCode', width: 150, align: 'left' }, // { label: '供应商名称', name: 'VenName', width: 150, align: 'left' }, // { label: '总数量', name: 'AllNumber', width: 100, align: 'left' }, // { label: '合格数量', name: 'YLOTQTY', width: 100, align: 'left', editable: true, editrules: { number: true } }, // { label: '不合格数量', name: 'NLOTQTY', width: 100, align: 'left', editable: true, editrules: { number: true } }, // { label: '特采数量', name: 'SpecialQTY', width: 100, align: 'left', editable: true, editrules: { number: true } }, // { label: '不良代码值', name: 'BCCodeValue', hidden: true }, // { // label: '不良代码', name: 'BadDesc', width: 120, align: 'left', sortable: false, // formatter: function (cellvalue, options, rowObject) { // debugger; // var html = ""; // html += ' <select id="SelBC_' + rowObject.ID.toString() + '" data-live-search ="true" Title=\"""\" class="selectpicker" data-width="85px">'; // html += ' </select>'; // return cellvalue = html; // } // }, // { label: '不良原因值', name: 'BRCodeValue', hidden: true }, // { // label: '不良原因', name: 'BadReasonDesc', width: 120, align: 'left', sortable: false, // formatter: function (cellvalue, options, rowObject) { // var html = ""; // html += ' <select id="SelBR_' + rowObject.ID.toString() + '" data-live-search ="true" Title=\"""\" class="selectpicker" data-width="85px">'; // html += ' </select>'; // return cellvalue = html; // } // }, // { label: '检验状态', name: 'TestState', width: 150, align: 'left' }, // { label: '检验人', name: 'Surveyor', width: 150, align: 'left' }, // { label: '检验时间', name: 'ProvingTime', width: 150, align: 'left' },
//], cellsubmit: "clientArray", shrinkToFit: false,//宽度自适应 autoWidth: true, gridComplete: function () { debugger; //设置select var RowDatas = $("#gridList").jqGrid('getDataIDs'); for (var j = 0; j < RowDatas.length; j++) { var InvCode = $("#gridList").jqGrid("getCell", RowDatas[j], "InvCode"); var ID = $("#gridList").jqGrid("getCell", RowDatas[j], "ID"); var BCCodeValue = $("#gridList").jqGrid("getCell", RowDatas[j], "BCCodeValue"); var BRCodeValue = $("#gridList").jqGrid("getCell", RowDatas[j], "BRCodeValue"); GetSelectICSBadCode(InvCode, ID, BCCodeValue); GetSelectPerson(InvCode, ID, BRCodeValue); }
},
pager: "#gridPager", sortorder: "desc", sortname: 'DNCode ', viewrecords: true, multiselect: true, subGrid: false, // (1)开启子表格支持 afterSaveCell: function (rowid, cellname, value) { debugger; //总扣分数加其他扣分数 if (cellname === 'YLOTQTY') { var YLOTQTY = value; var AllNumber = $gridList.jqGrid("getCell", rowid, 'AllNumber'); var str = Math.round((parseFloat(AllNumber) - parseFloat(YLOTQTY)) * 10) / 10; $gridList.jqGrid("setCell", rowid, 'NLOTQTY', str); } if (cellname === 'NLOTQTY') { var NLOTQTY = value; var AllNumber = $gridList.jqGrid("getCell", rowid, 'AllNumber'); var str = Math.round((parseFloat(AllNumber) - parseFloat(NLOTQTY)) * 10) / 10; $gridList.jqGrid("setCell", rowid, 'YLOTQTY', str); } if (cellname === 'BadReasonDesc') { $gridList.jqGrid("setCell", rowid, 'BRCodeValue', value); } if (cellname === 'BadDesc') { $gridList.jqGrid("setCell", rowid, 'BCCodeValue', value); } },
}); $("#btn_search").click(function () { var warehouse = $("#warehouse a.active").attr('data-value'); var queryJson = { POCode: $("#txt_POCode").val(), ASNCode: $("#txt_ASNCode").val(), CaiGouCode: $("#txt_CaiGouCode").val(), VenCode: $("#txt_VenCode").val(), VenName: $("#txt_VenName").val(), InvCode: $("#txt_InvCode").val(), InvName: $("#txt_InvName").val(), BatchCode: $("#txt_BatchCode").val(), ReleaseState: $("#selShow").val(), } $gridList.jqGrid('setGridParam', { postData: { queryJson: JSON.stringify(queryJson) }, }).trigger('reloadGrid'); }); }
function gridList3() { var $gridList = $("#gridList"); var queryJson = { POCode: $("#txt_POCode").val(), InvCode: $("#txt_InvCode").val(), InvName: $("#txt_InvName").val(), BatchCode: $("#txt_BatchCode").val(), ReleaseState: $("#selShow").val(), } $gridList.dataGrid({ url: "/WMS/ICSRCVIQCs/GetICSInspection3" + "?" + Math.random(), postData: { queryJson: JSON.stringify(queryJson) }, height: $(window).height() - 200, width: $(window).width() - 300, cellEdit: true, colModel: _Clos, //colModel: [ // { label: "主键", name: "ID", hidden: true, key: true }, // { label: 'ID', name: 'ID', hidden: true }, // { label: '工单ID', name: 'GDID', hidden: true }, // { label: '检验ID', name: 'JYID', hidden: true }, // { label: '工单单号', name: 'DNCode', width: 120, align: 'left' }, // { label: '条码', name: 'LotNo', width: 120, align: 'left' }, // { label: '料品编码', name: 'InvCode', width: 100, align: 'left' }, // { label: '物料描述', name: 'InvName', width: 100, align: 'left' }, // { label: '规格型号', name: 'INVSTD', width: 100, align: 'left' }, // { label: '批次', name: 'BatchCode', width: 100, align: 'left' }, // { label: '箱号', name: 'ContainerID', width: 100, align: 'left' }, // { label: '生产时间', name: 'ProductTime', width: 150, align: 'left' }, // { label: '总数量', name: 'AllNumber', width: 100, align: 'left' }, // { label: '合格数量', name: 'YLOTQTY', width: 100, align: 'left', editable: true, editrules: { number: true } }, // { label: '不合格数量', name: 'NLOTQTY', width: 100, align: 'left', editable: true, editrules: { number: true } }, // { label: '特采数量', name: 'SpecialQTY', width: 100, align: 'left', editable: true, editrules: { number: true } }, // { label: '不良代码值', name: 'BCCodeValue', hidden: true }, // { // label: '不良代码', name: 'BadDesc', width: 120, align: 'left', sortable: false, // formatter: function (cellvalue, options, rowObject) { // debugger; // var html = ""; // html += ' <select id="SelBC_' + rowObject.ID.toString() + '" data-live-search ="true" Title=\"""\" class="selectpicker" data-width="85px">'; // html += ' </select>'; // return cellvalue = html; // } // }, // { label: '不良原因值', name: 'BRCodeValue', hidden: true }, // { // label: '不良原因', name: 'BadReasonDesc', width: 120, align: 'left', sortable: false, // formatter: function (cellvalue, options, rowObject) { // var html = ""; // html += ' <select id="SelBR_' + rowObject.ID.toString() + '" data-live-search ="true" Title=\"""\" class="selectpicker" data-width="85px">'; // html += ' </select>'; // return cellvalue = html; // } // }, // { label: '检验状态', name: 'TestState', width: 150, align: 'left' }, // { label: '检验人', name: 'Surveyor', width: 150, align: 'left' }, // { label: '检验时间', name: 'ProvingTime', width: 150, align: 'left' }, //], cellsubmit: "clientArray", shrinkToFit: false,//宽度自适应 autoWidth: true, gridComplete: function () { debugger; //设置select var RowDatas = $("#gridList").jqGrid('getDataIDs'); for (var j = 0; j < RowDatas.length; j++) { var InvCode = $("#gridList").jqGrid("getCell", RowDatas[j], "InvCode"); var ID = $("#gridList").jqGrid("getCell", RowDatas[j], "ID"); var BCCodeValue = $("#gridList").jqGrid("getCell", RowDatas[j], "BCCodeValue"); var BRCodeValue = $("#gridList").jqGrid("getCell", RowDatas[j], "BRCodeValue"); GetSelectICSBadCode(InvCode, ID, BCCodeValue); GetSelectPerson(InvCode, ID, BRCodeValue); } },
pager: "#gridPager", sortorder: "desc", sortname: 'DNCode ', viewrecords: true, multiselect: true, afterSaveCell: function (rowid, cellname, value) { debugger; //总扣分数加其他扣分数 if (cellname === 'YLOTQTY') { var YLOTQTY = value; var AllNumber = $gridList.jqGrid("getCell", rowid, 'AllNumber'); var str = Math.round((parseFloat(AllNumber) - parseFloat(YLOTQTY)) * 10) / 10; $gridList.jqGrid("setCell", rowid, 'NLOTQTY', str); } if (cellname === 'NLOTQTY') { var NLOTQTY = value; var AllNumber = $gridList.jqGrid("getCell", rowid, 'AllNumber'); var str = Math.round((parseFloat(AllNumber) - parseFloat(NLOTQTY)) * 10) / 10; $gridList.jqGrid("setCell", rowid, 'YLOTQTY', str); } if (cellname === 'BadReasonDesc') { $gridList.jqGrid("setCell", rowid, 'BRCodeValue', value); } if (cellname === 'BadDesc') { $gridList.jqGrid("setCell", rowid, 'BCCodeValue', value); } }, });
$("#btn_search").click(function () { var warehouse = $("#warehouse a.active").attr('data-value'); var queryJson = { POCode: $("#txt_POCode").val(), InvCode: $("#txt_InvCode").val(), InvName: $("#txt_InvName").val(), BatchCode: $("#txt_BatchCode").val(), ReleaseState: $("#selShow").val(), } $gridList.jqGrid('setGridParam', { postData: { queryJson: JSON.stringify(queryJson) }, }).trigger('reloadGrid'); });
}
//获取不良原因 function GetSelectPerson(InvCode, ID, BRCodeValue) { var str = ""; $.ajax({ url: "/WMS/ICSRCVIQCs/Select_ICSBadReason?InvCode=" + InvCode + "&" + Math.random(), dataType: "json", async: false, async: false, success: function (data) { if (data != null && data.length > 0) { $("#SelBR_" + ID + "").find("option").remove(); for (var i = 0; i < data.length; i++) { $("#SelBR_" + ID + "").append("<option value='" + data[i].BadReasonCode + "'>" + data[i].BadReasonDesc + "</option>"); } } } });
$("#SelBR_" + ID + "").selectpicker('refresh'); $("#SelBR_" + ID + "").selectpicker('val', BRCodeValue);
}
//获取不良代码 function GetSelectICSBadCode(InvCode, ID, BCCodeValue) { var str = ""; $.ajax({ url: "/WMS/ICSRCVIQCs/GetSelectICSBadCode?InvCode=" + InvCode + "&" + Math.random(), dataType: "json", async: false, async: false, success: function (data) { if (data != null && data.length > 0) { $("#SelBC_" + ID + "").find("option").remove(); for (var i = 0; i < data.length; i++) { $("#SelBC_" + ID + "").append("<option value='" + data[i].BadCode + "'>" + data[i].BadDesc + "</option>"); }
} } }); $("#SelBC_" + ID + "").selectpicker('refresh'); $("#SelBC_" + ID + "").selectpicker('val', BCCodeValue);
}
function btnSave() { debugger; var ids = $("#gridList").jqGrid('getGridParam', 'selarrrow'); //获取 多行数据 if (ids.length == 0) { $.modalAlertNew("WMS00004"); return; } var IDlist = ""; var ICSInspection = []; var flag = ''; for (var i = 0; i < ids.length; i++) { var rowData = $("#gridList").jqGrid('getRowData', ids[i]); IDlist += "'" + rowData.ID + "',";
if (rowData.NLOTQTY > 0) { if (rowData.BadDesc == '' || rowData.BadReasonDesc == '') { $.modalAlertNew("WMS00081"); return; }
} if (rowData.YLOTQTY < 0 || rowData.NLOTQTY < 0) { $.modalAlertNew("WMS00082"); return; } if (rowData.SpecialQTY > rowData.NLOTQTY) { $.modalAlertNew("WMS00083"); return; } var obj = { AllNumber: rowData.AllNumber,//总数量 YLOTQTY: rowData.YLOTQTY,//合格数量 NLOTQTY: rowData.NLOTQTY,//不合格数量 SpecialQTY: rowData.SpecialQTY,//特采数量 LotNo: rowData.LotNo,//条码 InvCode: rowData.InvCode,//物料编码 BCCode: $("#SelBC_" + rowData.ID + "").val(),//不良代码 BRCode: $("#SelBR_" + rowData.ID + "").val(),//不良原因 Type: Type, TestState: rowData.TestState, JYID: rowData.JYID } ICSInspection.push(obj); } $.modalConfirm("确定保存吗?", function (r) { if (r) { $.submitForm({ url: "/WMS/ICSRCVIQCs/CreateICSInspection" + "?" + Math.random(), param: { keyValue: IDlist, ICSInspections: JSON.stringify(ICSInspection) }, success: function () { $.currentWindow().$("#gridList").trigger("reloadGrid"); } }) } }); }
function btnLook(cellvalue, options, rowObject) { return cellvalue = "<a class=\"btn btn-info dropdown-text\" onclick=\"UpLoadClick('" + rowObject.InvCode + "','" + rowObject.JYID + "')\">查看</ a>"; } function UpLoadClick(InvCode, JYID) { debugger; if (JYID=='') { $.modalAlertNew("WMS00104"); return; } $.modalOpen({ id: "CheckInfo", title: "查看信息", url: "/WMS/ICSRCVIQCs/ICSInspectionDetail?InvCode=" + encodeURI(encodeURI(InvCode)) + "&JYID=" + encodeURI(encodeURI(JYID)) + "&" + Math.random(), width: "1000px", height: "400px", callBack: function (iframeId) { top.frames[iframeId].submitForm(); } }); }
//退回 function btnSendBack() { debugger; var ids = $("#gridList").jqGrid('getGridParam', 'selarrrow'); //获取 多行数据 if (ids.length == 0) { $.modalAlertNew("WMS00004"); return; } var IDlist = ""; var selShow = $("#selShow").val(); if (selShow != '1') { $.modalAlertNew("WMS00084"); return; } for (var i = 0; i < ids.length; i++) { var rowData = $("#gridList").jqGrid('getRowData', ids[i]); if (rowData.AllNumber == rowData.YLOTQTY) { $.modalAlertNew("WMS00085", rowData.LotNo); return; } IDlist += "'" + rowData.LotNo + "',"; } $.modalConfirm("确定退回吗?", function (r) { if (r) { $.submitForm({ url: "/WMS/ICSRCVIQCs/CreateRejection?Type=" + Type + "&" + Math.random(), param: { keyValue: IDlist }, success: function () { $.currentWindow().$("#gridList").trigger("reloadGrid"); } }) } }); }
</script>
<div class="topPanel" style="height:100px"> <div class="toolbar"> <div class="btn-group"> <a id="NF-Create" authorize="yes" class="btn btn-primary" onclick="btnSave()"><i class="fa fa-pencil-square-o"></i>保存检验结果</a> <a id="NF-update" authorize="yes" class="btn btn-primary" onclick="btnSendBack()"><i class="fa fa-pencil-square-o"></i>生成拒收单</a> @*<a id="NF-Delete" authorize="yes" class="btn btn-primary" onclick="btn_Delete()"><i class="fa fa-trash-o"></i>删除</a>*@ <a class="btn btn-primary" onclick="$.reload()"><span class="glyphicon glyphicon-refresh"></span></a> </div> </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: 105px;"> </div> </td>
<td class="HideTxt" style="text-align:right;"><label class="lglabel HideTxt" for="txt_ASNCode"> 送货单号</label>:</td> <td> <div class="input-group HideTxt"> <input id="txt_ASNCode" type="text" class="form-control HideTxt" style="width: 105px;"> </div> </td>
<td class="HideTxt" style="text-align:right;"><label class="lglabel HideTxt" for="txt_CaiGouCode"> 采购订单号</label>:</td> <td> <div class="input-group"> <input id="txt_CaiGouCode" type="text" class="form-control HideTxt" style="width: 105px;"> </div> </td> <td class="HideTxt" style="text-align:right;"><label class="lglabel" for="txt_VenCode HideTxt"> 供应商代码</label>:</td> <td> <div class="input-group HideTxt"> <input id="txt_VenCode" type="text" class="form-control HideTxt" style="width: 105px;"> </div> </td>
<td class="HideTxt" style="text-align:right;"><label class="lglabel HideTxt" for="txt_VenName"> 供应商名称</label>:</td> <td> <div class="input-group HideTxt"> <input id="txt_VenName" type="text" class="form-control HideTxt" style="width: 105px;"> </div> </td>
</tr> <tr> <td style="text-align:right;"><label class="lglabel" for="txt_InvCode"> 料品编码</label>:</td> <td> <div class="input-group"> <input id="txt_InvCode" type="text" class="form-control" style="width: 105px;"> </div> </td>
<td style="text-align:right;"><label class="lglabel" for="txt_InvName"> 物料描述</label>:</td> <td> <div class="input-group"> <input id="txt_InvName" type="text" class="form-control" style="width: 105px;"> </div> </td>
<td style="text-align:right;"><label class="lglabel" for="txt_BatchCode"> 批次号</label>:</td> <td> <div class="input-group"> <input id="txt_BatchCode" type="text" class="form-control" style="width: 105px;"> </div> </td>
<td> <label> 单据状态:</label> </td> <td> <div class="input-group"> <select id="selShow" name="F_Target" class="form-control" style="width: 105px;"> <option value="1">已检验</option> <option value="0" selected="selected">未检验</option> </select> </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>
|