|
|
@{ ViewBag.Title = "原料来料检验"; Layout = "~/Views/Shared/_Index.cshtml";}
<script src="~/Content/js/datepicker/WdatePicker.js"></script><!--引入 element-ui 的样式,--><link rel="stylesheet" href="~/Content/element-ui/lib/theme-chalk/index.css"><script src="~/Content/vue/dist/vue.js"></script><script src="~/Content/element-ui/lib/index.js"></script>
<script src="~/Content/axios.min.js"></script><style></style><form id="form1"> <div id="app"> <div class="topPanel" style="height:160px;"> <div class="toolbar"> <div class="btn-group"> <input id="FileUp" name="FileUp" type="file" style="display:none;" accept=".csv, application/vnd.ms-excel, application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" />
@*<a id="NF-Urgent" authorize="yes" style="margin-left:3px;" class="btn btn-primary" onclick="btn_Urgent()"><i class="fa fa-pencil-square-o"></i>加急</a>*@ <a id="NF-SendCheck" authorize="yes" style="margin-left:3px;" class="btn btn-primary" onclick="btn_SendCheck()"><i class="fa fa-pencil-square-o"></i>开始检验</a> <a id="NF-ExportAll" authorize="yes" class="btn btn-primary"><i class="fa fa-download"></i>导出</a> <a class="btn btn-primary" onclick="$.reload()"><span class="glyphicon glyphicon-refresh"></span></a>
</div> <div class="btn-group" style="display:block;padding-left:2px;"> <a class="btn btn-primary" id="downPrintControl" href="~/PrintActivex.exe" style="display:none">点击下载打印组件</a> <a id="NF-ViewCheckDetail" authorize="yes" style="margin-left:3px;" class="btn btn-primary" onclick="btn_ViewCheckDetail()"><i class="fa fa-pencil-square-o"></i>检验明细</a> <a id="NF-DoJudge" authorize="yes" style="margin-left:3px;" class="btn btn-primary" onclick="btn_DoJudge()"><i class="fa fa-pencil-square-o"></i>直接判定</a> <a id="NF-RemoveCheckResult" authorize="yes" style="margin-left:3px;" class="btn btn-primary" onclick="btn_RemoveCheck()"><i class="fa fa-pencil-square-o"></i>删除检验</a> </div> <script>$('.toolbar').authorizeButton()</script> </div> <div class="search"> <table> <tr> <td class="HideItems" style="text-align:right;"><label class="lglabel HideItems" for="txt_InvCode"> 物料编码</label>:</td> <td class="HideItems"> <div class="input-group HideItems"> <input id="txt_InvCode" type="text" class="form-control HideItems" style="width: 200px;"> </div> </td> <td class="HideItems" style="text-align:right;"><label class="lglabel HideItems" for="txt_InvName"> 物料名称</label>:</td> <td class="HideItems"> <div class="input-group HideItems"> <input id="txt_InvName" type="text" class="form-control HideItems" style="width: 200px;"> </div> </td> <td class="HideItems" style="text-align:right;"><label class="lglabel HideItems" for="txt_StartDate"> 开始时间</label>:</td> <td class="HideItems"> <div class="input-group HideItems"> <input id="txt_StartDate" type="text" class="form-control HideItems" style="width:130px;" maxlength="10" onclick="WdatePicker({ dateFmt: 'yyyy-MM-dd' })"> </div> </td> <td class="HideItems" style="text-align:right;"><label class="lglabel HideItems" for="txt_EndDate"> 结束时间</label>:</td> <td class="HideItems"> <div class="input-group HideItems"> <input id="txt_EndDate" type="text" class="form-control HideItems" style="width:130px;" maxlength="10" onclick="WdatePicker({ dateFmt: 'yyyy-MM-dd' })"> </div> </td>
</tr> <tr> <td class="HideItems" style="text-align:right;"><label class="lglabel HideItems" for="txt_ASNCode"> 送货单号</label>:</td> <td class="HideItems"> <div class="input-group HideItems"> <input id="txt_ASNCode" type="text" class="form-control HideItems" style="width: 200px;"> </div> </td> @*<td class="HideItems" style="text-align:right;"><label class="lglabel HideItems" for="txt_VenCode"> 供应商编码</label>:</td> <td class="HideItems"> <div class="input-group HideItems"> <input id="txt_VenCode" type="text" class="form-control HideItems" style="width: 200px;"> </div> </td> <td class="HideItems" style="text-align:right;"><label class="lglabel HideItems" for="txt_VenName"> 供应商名称</label>:</td> <td class="HideItems"> <div class="input-group HideItems"> <input id="txt_VenName" type="text" class="form-control HideItems" style="width: 200px;"> </div> </td>*@ <td class="HideItems" style="text-align:right;"><label class="lglabel HideItems" for="txt_InvBatcgNo"> 批次</label>:</td> <td class="HideItems"> <div class="input-group HideItems"> <input id="txt_InvBatcgNo" type="text" class="form-control HideItems" style="width: 200px;"> </div> </td>
</tr> <tr> <td class="HideItems" style="text-align:right;"><label class="lglabel HideItems" for="txt_IsCheck"> 是否检验</label>:</td> <td class="HideItems"> <div class="input-group HideItems"> <select id="txt_IsCheck" class="form-control select2" style="width: 135px; height: 20px;"> <option value="">全部</option> <option value="是">是</option> <option value="否" selected>否</option> </select> </div> </td> <td class="HideItems" style="text-align:right;"><label class="lglabel HideItems" for="txt_CheckStartDate"> 初检开始</label>:</td> <td class="HideItems"> <div class="input-group HideItems"> <input id="txt_CheckStartDate" type="text" class="form-control HideItems" style="width:130px;" maxlength="10" onclick="WdatePicker({ dateFmt: 'yyyy-MM-dd' })"> </div> </td> <td class="HideItems" style="text-align:right;"><label class="lglabel HideItems" for="txt_CheckEndDate"> 初检结束</label>:</td> <td class="HideItems"> <div class="input-group HideItems"> <input id="txt_CheckEndDate" type="text" class="form-control HideItems" style="width:130px;" maxlength="10" onclick="WdatePicker({ dateFmt: 'yyyy-MM-dd' })"> </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> <tr> </tr> </table> </div> </div> <div class="gridPanel"> <table id="gridList"></table> <div id="gridPager"></div> </div> </div></form>
<script type="text/javascript">
$(function () {
var service = { isCanEditDate: false, Init: function () { var that = this; $("#txt_CheckFixtureNo").val('');
that.initControl(); that.loadGrid(); that.loadEvent(); //that.loadViewGrid();
}, initControl: function () { let that = this; let orgName = '';
let userName = '@NFine.Code.OperatorProvider.Provider.GetCurrent().UserName';
}, loadGrid: function () { var that = this;
var queryJson = { InvCode: $("#txt_InvCode").val(), InvName: $("#txt_InvName").val(), StartDate: $("#txt_StartDate").val(), EndDate: $("#txt_EndDate").val(), CheckStartDate: $("#txt_CheckStartDate").val(), CheckEndDate: $("#txt_CheckEndDate").val(), CheckCode: $("#txt_ASNCode").val(), InvBatcgNo: $("#txt_InvBatcgNo").val(), IsCheck: $("#txt_IsCheck").val(), }
var $gridList = $("#gridList"); $gridList.dataGrid({ url: "/BBWMS/IQCQuality/GetCPMaterialInStorageCheckPageList" + "?" + Math.random(), postData: { queryJson: JSON.stringify(queryJson) }, mtype: "POST", height: $(window).height() - 200, width: $(window).width() - 300, cellEdit: true, cellsubmit: "clientArray", colModel: [ { label: "主键", name: "DetailId", hidden: true, key: true }, { label: '单据类型', name: 'DocType', width: 100, hidden: true, align: 'left' }, { label: '检验ID', name: 'CheckID', width: 100, hidden: true, align: 'left' }, { label: '物料编码', name: 'InvCode', width: 100, align: 'left', frozen: true }, { label: '物料名称', name: 'InvName', width: 150, align: 'left' }, { label: '批次', name: 'InvBatcgNo', width: 100, align: 'left' }, { label: '数量', name: 'Quantity', width: 100, align: 'left' }, { label: '送检单号', name: 'CheckCode', width: 150, align: 'left' }, { label: '初检时间', name: 'CheckDate', width: 120, align: 'left' }, { label: '是否检验', name: 'IsCheck', width: 100, align: 'left' }, { label: '初判结果', name: 'Result', width: 100, align: 'left' }, { label: '文件路径', name: 'FilePath', width: 100, hidden: true, align: 'left' }, { label: '出货报告', name: 'OutReport', width: 100, align: 'left', formatter: function (cellvalue, options, rowObject) { if (cellvalue) { // console.log(rowObject.FilePath); // let filaPath = rowObject.FilePath; // return "<button id='btn_viewOutReport' type='button' class='btn btn-primary' onclick=\"btn_viewOutReport()\">" + cellvalue + "</button>"; return "<a class=\"btn btn-info dropdown-text\" onclick=\"btn_viewOutReport('" + rowObject.DetailId+"')\">" + cellvalue+"</ a>"; } else { return ""; } } }, { label: 'IQC判入仓库', name: 'WHCode', width: 150, align: 'left' }, ], shrinkToFit: true,//宽度自适应 width: "100%", autowidth: true, gridComplete: function () { //if (!that.isCanEditDate) { // var obj_Item1 = $("#gridList"); // var rowIds_Item1 = obj_Item1.getDataIDs();
// for (var i = 0; i < rowIds_Item1.length; i++) { // $("#gridList").jqGrid('setCell', rowIds_Item1[i], "PlanStartDate", '', 'not-editable-cell'); // $("#gridList").jqGrid('setCell', rowIds_Item1[i], "PlanEndDate", '', 'not-editable-cell'); // $("#gridList").jqGrid('setCell', rowIds_Item1[i], "ApsOrderDate", '', 'not-editable-cell'); // } //} }, pager: "#gridPager", sortname: 'CheckCode', sortorder: "", viewrecords: true, multiselect: true, subGrid: true, // (1)开启子表格支持 subGridRowExpanded: function (subgrid_id, rowid) { // (2)子表格容器的id和需要展开子表格的行id,将传入此事件函数 // console.log(subgrid_id, rowid); // $("#gridList").jqGrid("setSelection", rowid, false); that.bindSubGrid3(subgrid_id, rowid); } }); }, query: function () { //console.log("点击查询"); var queryJson = { InvCode: $("#txt_InvCode").val(), InvName: $("#txt_InvName").val(), StartDate: $("#txt_StartDate").val(), EndDate: $("#txt_EndDate").val(), CheckStartDate: $("#txt_CheckStartDate").val(), CheckEndDate: $("#txt_CheckEndDate").val(), CheckCode: $("#txt_ASNCode").val(), InvBatcgNo: $("#txt_InvBatcgNo").val(), IsCheck: $("#txt_IsCheck").val(), } // that.loadGrid(queryJson);
$("#gridList").jqGrid('setGridParam', { postData: { queryJson: JSON.stringify(queryJson) }, }).trigger('reloadGrid'); }, bindSubGrid3: function (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
$("#" + 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).CheckCode; var invBatcgNo = $("#gridList").jqGrid('getRowData', rowid).InvBatcgNo; var InvCode = $("#gridList").jqGrid('getRowData', rowid).InvCode;
// (6)创建jqGrid对象 $("#" + subgrid_table_id).dataGrid({ cellEdit: true, mtype: "GET", url: "/BBWMS/IQCQuality/GetCPMaterialInStorageCheckDetailList?code=" + code + "&invBatcgNo=" + invBatcgNo + "&invCode=" + InvCode+ "&" + Math.random(), // (7)子表格数据对应的url,注意传入的contact.id参数 colModel: [ { label: "主键", name: "ID", hidden: true, key: true }, { label: '送检单号', name: 'CheckCode', width: 150, align: 'left' }, { label: '物料编码', name: 'InvCode', width: 150, align: 'left' }, { label: '物料名称', name: 'InvName', width: 150, align: 'left' }, { label: '批次', name: 'InvBatcgNo', width: 150, align: 'left' }, { label: '物料条码', name: 'LotNo', width: 150, align: 'left' }, { label: '条码数量', name: 'Quantity', width: 100, align: 'left' }, { label: '箱号条码', name: 'XiangCode', width: 100, align: 'left' }, { label: '栈板条码', name: 'ZhanCode', width: 100, align: 'left' }, ], //colModel: ColModelSub, shrinkToFit: true,//宽度自适应 multiselect: true, prmNames: { search: "search" }, viewrecords: true, height: "100%", //rowNum: 20, //pager: subgrid_pager_id,
}); }, loadEvent: function () { var that = this; $("#btn_search").click(function () { that.query(); }); $("#NF-Add").click(function () { // debugger; var objList = $("#gridList").jqGrid('getGridParam', 'selarrrow');
$.modalOpen({ id: "Form", title: "新增Aql", url: "/BBWMS/IQCQuality/AqlEdit?ids=", width: "1200px", height: "800px", callBack: function (iframeId) { top.frames[iframeId].submitForm(); } });
});
$("#NF-Print").click(function () { console.log("打印条码"); // debugger; var objArr = ''; var arr = []; 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.CheckFixtureNo + "',";
} objArr = objArr.slice(0, objArr.length - 1); if (objArr == "") { $.modalAlertNew("WMS00003"); return; } objArr = "" + objArr + "|"; arr.push(objArr);
$.modalOpen({ id: "PrintLot", title: "打印", url: "/BBWMS/Print/PrintView?Arguments=" + encodeURI(encodeURI(arr)) + "&mold=JY0002&" + Math.random(), width: "550px", height: "1000px", callBack: function (iframeId) { top.frames[iframeId].submitForm(); } });
}); $("#NF-SendCheck").click(function () {
//window.open('C:\项目\智和诚\52ABP环境配置\5分钟快速启动框架.pdf') //return; var ids = $("#gridList").jqGrid('getGridParam', 'selarrrow'); //获取 多行数据 if (ids.length != 1) { $.modalMsg("请选择一条数据", "warning"); return; } let qty = 0; let asnCode = ''; debugger; for (var i = 0; i < ids.length; i++) { var rowId = ids[i]; var rowData = $("#gridList").jqGrid('getRowData', rowId); // objArr += "'" + rowData.DNQuantity + "',"; qty = rowData.Quantity; asnCode = rowData.CheckCode; //docType = rowData.DocType; let isCheck = rowData.IsCheck; if (isCheck == '是') { $.modalMsg("当前物料批号已经生成检验报告", "warning"); return; } } let obj = { ids: ids[0], };
//debugger; //if (!obj.orderDate) { // obj.orderDate = new Date().toLocaleDateString(); //} // consol.log(); $.modalOpen({ id: "Form", title: "来料检验", url: "/BBWMS/IQCQuality/CPMaterialInStorageCheckEdit?ids=" + ids[0] + "&qty=" + qty + "&asnCode=" + asnCode, width: "1920px", height: "1000px", callBack: function (iframeId) { top.frames[iframeId].submitForm(); } }); }); $("#NF-Urgent").click(function () {
var ids = $("#gridList").jqGrid('getGridParam', 'selarrrow'); //获取 多行数据 if (ids.length < 1) { $.modalMsg("请选择一条数据", "warning"); return; }
let input = []; for (var i = 0; i < ids.length; i++) { var rowId = ids[i]; var rowData = $("#gridList").jqGrid('getRowData', rowId); /* objArr += "'" + rowData.CheckFixtureNo + "',";*/ let obj = { InvCode: rowData.InvCode, InvBatcgNo: rowData.InvBatcgNo, AsnCode: rowData.ASNCode, }; input.push(obj); }
//var rowId = ids[0]; //var rowData = $("#gridList").jqGrid('getRowData', rowId);
debugger; $.ajax({ url: "/BBWMS/IQCQuality/UpdateUrgent", type: "POST", dataType: "json", async: false, data: { keyValue: JSON.stringify(input) }, success: function (data) { // // console.log(data); if (data.state == "success") { $.modalMsg("操作成功", "success"); that.query(); } else $.modalMsg(data.message, "warning"); } });
}); $("#NF-DoJudge").click(function () {
var ids = $("#gridList").jqGrid('getGridParam', 'selarrrow'); //获取 多行数据 if (ids.length != 1) { $.modalMsg("请选择一条数据", "warning"); return; }
let obj = { ids: ids[0], }; for (var i = 0; i < ids.length; i++) { var rowId = ids[i]; var rowData = $("#gridList").jqGrid('getRowData', rowId); //objArr += "'" + rowData.CheckFixtureNo + "',"; qty = rowData.DNQuantity; docType = rowData.DocType; let isCheck = rowData.IsCheck; if (isCheck == '是') { $.modalMsg("当前物料批号已经生成检验报告", "warning"); return; }
}
$.modalOpen({ id: "Form", title: "直接判定", url: "/BBWMS/IQCQuality/MaterialCheckDoJudge?ids=" + ids[0] + "&qty=" + qty + "&docType=" + docType, width: "600px", height: "300px", callBack: function (iframeId) { top.frames[iframeId].submitForm(); } }); }); $("#NF-RemoveCheckResult").click(function () {
var ids = $("#gridList").jqGrid('getGridParam', 'selarrrow'); //获取 多行数据 if (ids.length != 1) { $.modalMsg("请选择一条数据", "warning"); return; } let obj = { InvCode: '', AsnCode: '', InvBatcgNo: '', }; for (var i = 0; i < ids.length; i++) { var rowId = ids[i]; var rowData = $("#gridList").jqGrid('getRowData', rowId); obj.InvCode = rowData.InvCode; obj.AsnCode = rowData.ASNCode; obj.InvBatcgNo = rowData.InvBatcgNo; }
$.ajax({ url: "/BBWMS/IQCQuality/DeleteMatCheck", type: "POST", dataType: "json", async: false, data: { keyValue: JSON.stringify(obj) }, success: function (data) { // // console.log(data); if (data.state == "success") { $.modalMsg("操作成功", "success"); that.query(); } else $.modalMsg(data.message, "warning"); } }); }); $("#NF-Remove").click(function () {
var ids = $("#gridList").jqGrid('getGridParam', 'selarrrow'); //获取 多行数据 if (ids.length < 1) { $.modalMsg("请选择数据", "warning"); return; } let keyList = []; for (var i = 0; i < ids.length; i++) { keyList.push(ids[i]); }
//let obj = { // ids: ids[0], //};
$.ajax({ url: "/BBWMS/IQCQuality/DeleteAql", type: "POST", dataType: "json", async: false, data: { keyValue: JSON.stringify(keyList) }, success: function (data) { // // console.log(data); if (data.state == "success") { $.modalMsg("操作成功", "success"); that.query(); } else $.modalMsg(data.message, "warning"); } }); }); $("#NF-ExportAll").click(function () { let queryJson = { InvCode: $("#txt_InvCode").val(), InvName: $("#txt_InvName").val(), StartDate: $("#txt_StartDate").val(), EndDate: $("#txt_EndDate").val(), CheckStartDate: $("#txt_CheckStartDate").val(), CheckEndDate: $("#txt_CheckEndDate").val(), CheckCode: $("#txt_ASNCode").val(), InvBatcgNo: $("#txt_InvBatcgNo").val(), IsCheck: $("#txt_IsCheck").val(), }; var postData = "&InvCode=" + queryJson.InvCode + ""; postData += "&InvName=" + queryJson.InvName; postData += "&StartDate=" + queryJson.StartDate; postData += "&EndDate=" + queryJson.EndDate; postData += "&CheckStartDate=" + queryJson.CheckStartDate; postData += "&CheckEndDate=" + queryJson.CheckEndDate; postData += "&VenCode=" + queryJson.VenCode; postData += "&VenName=" + queryJson.VenName; postData += "&InvBatcgNo=" + queryJson.InvBatcgNo; postData += "&IsCheck=" + queryJson.IsCheck; postData += "&CheckCode=" + queryJson.CheckCode; postData += "&InvBatcgNo=" + queryJson.InvBatcgNo;
$.download("/BBWMS/IQCQuality/ExportAllCPMaterialInStorageCheck" + "?" + Math.random(), postData, 'post'); }); $("#FileUp").on("change", function (up) { // let that = this; var form = new FormData(document.getElementById("form1")); $.ajax({ url: "/BBWMS/CheckingFixture/UploadFile?" + Math.random(), type: "post", data: form, contentType: false, processData: false, success: function (data) { if (data == "true" || data == true) { alert("导入成功"); that.query(); } else { alert(data); } }, error: function (aa) { alert("导入失败:" + aa); } });
}); $("#btn_viewOutReport").click(function () { debugger; var ids = $("#gridList").jqGrid('getGridParam', 'selarrrow'); //获取 多行数据 if (ids.length != 1) { $.modalMsg("请选择一条数据", "warning"); return; }
let obj = { ids: ids[0], }; let fileName = ''; for (var i = 0; i < ids.length; i++) { var rowId = ids[i]; var rowData = $("#gridList").jqGrid('getRowData', rowId); fileName = rowData.OutReport; //objArr += "'" + rowData.CheckFixtureNo + "',"; //if (rowData.IQCHeaderResult) { // $.modalMsg("已经判定,不能重复操作", "warning"); // return; //} //if (rowData.SQEEngineerResult != "OK") { // $.modalMsg("只有SQE判定合格的数据可以判定", "warning"); // return; //} } debugger; axios .get('/BBWMS/IQCQuality/GetOutReportFilePath?fileName=' + fileName) .then(function (res) {
if (res.data) { console.log(res.data.message); window.open(res.data.message); } }) .catch(function (error) { // 请求失败处理 alert(error); });
}); $("#NF-ViewCheckDetail").click(function () {
debugger; var ids = $("#gridList").jqGrid('getGridParam', 'selarrrow'); //获取 多行数据 if (ids.length != 1) { $.modalMsg("请选择一条数据", "warning"); return; }
//let obj = { // ids: ids[0], //}; let checkId = ''; for (var i = 0; i < ids.length; i++) { var rowId = ids[i]; var rowData = $("#gridList").jqGrid('getRowData', rowId); checkId = rowData.CheckID; //objArr += "'" + rowData.CheckFixtureNo + "',"; //if (rowData.IQCHeaderResult) { // $.modalMsg("已经判定,不能重复操作", "warning"); // return; //} //if (rowData.SQEEngineerResult != "OK") { // $.modalMsg("只有SQE判定合格的数据可以判定", "warning"); // return; //} }
$.modalOpen({ id: "Form", title: "检验明细查看", url: "/BBWMS/IQCQuality/MaterialReJudgeView?ids=" + checkId + "&judgeRole=IQCGroupHeader", width: "1900px", height: "1000px", callBack: function (iframeId) { // top.frames[iframeId].submitForm(); } }); }); }
} service.Init();
}) function btn_viewOutReport(rowId) { debugger; let fileName = ''; var rowData = $("#gridList").jqGrid('getRowData', rowId); fileName = rowData.FilePath; if (!fileName) { return; } // debugger; axios .get('/BBWMS/IQCQuality/GetOutReportFilePath?fileName=' + fileName) .then(function (res) {
if (res.data) { console.log(res.data.message); window.open(res.data.message); } }) .catch(function (error) { // 请求失败处理 alert(error); });
}</script>
|