|
|
@{ ViewBag.Title = "SeachInventory"; Layout = "~/Views/Shared/_Index.cshtml"; } <link href="~/Content/js/select2/select2.min.css" rel="stylesheet" /> <link href="~/Content/js/dialog/dialog.css" rel="stylesheet" /> <script src="~/Content/js/datepicker/WdatePicker.js"></script> <script src="~/Content/js/select2/select2.min.js"></script> <script> debugger; $(function () { Init(); }); function Init() { document.getElementById("gridPanel").innerHTML = ' <span><strong>详细信息</strong></span> <table id="gridList"></table> ';//重置grid var LotNo = $("#txt_LotNo").val(); $("#gridList").dataGrid({ url: "/WMS/ICSMTDOC/GetRepertory" + "?LotNo=" + LotNo + "&" + Math.random(), height: $(window).height() - 20, width: $(window).width() - 300, colModel: [ { label: '主键', name: 'ID', hidden: true, key: true }, { label: '仓库', name: 'WarehouseCode', width: 100, align: 'left' }, { label: '条码', name: 'LotNo', width: 100, 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: 'InvUnit', width: 100, align: 'left' }, { label: '总数量', name: 'Quantity', width: 100, align: 'left' }, { label: '辅计量数量', name: 'AmountRate', width: 100, align: 'left' }, ], shrinkToFit: false,//宽度自适应 autowidth: true, gridComplete: function () { }, rowNum: 10000, autoScroll: true, sortname: 'LotNO', sortorder: "desc", viewrecords: true, multiselect: true, }) };
function submitForm() { var rows = $("#gridList").jqGrid('getGridParam', 'selarrrow'); if (rows.length <= 0) { $.modalAlert("请选择至少一条数据,进行形态转换!"); return; } var InvCode = $("#txtInvCode").val(); var ExtensionID = $("#txtExtensionID").val(); var Memo = $("#txtMemo").val(); var ICSMTDOC = []; for (var i = 0; i < rows.length; i++) { var rowData = $("#gridList").jqGrid('getRowData', rows[i]); if (rowData.AmountRate=='') { var Amounts = 0; } else { var Amounts = rowData.AmountRate; } var obj = { WHCode: rowData.WarehouseCode,//仓库 LotNo: rowData.LotNo,//条码 Quantity: rowData.Quantity,//数量 Amount: Amounts,//辅计量数量 MTDOCQuantity: rowData.Quantity,//已转换数量 } ICSMTDOC.push(obj); }
$.modalConfirm("确定保存吗?", function (r) { if (r) { $.submitForm({ url: "/WMS/ICSMTDOC/CreateICSMTDOC?InvCode=" + InvCode + "&ExtensionID=" + ExtensionID + "&Memo=" + Memo + "&" + Math.random(), param: { ICSMTDOC: JSON.stringify(ICSMTDOC) }, success: function () { $.currentWindow().$("#gridList").trigger("reloadGrid"); } }) } }); };
//监听Check事件 function OncheckBox1() { if ($("#InvCodebox").is(':checked')) { $('#txtInvCode').attr("disabled", false); } else { $("#txtInvCode").attr("disabled", "disabled"); } } function OncheckBox2() { if ($("#BatchCodebox").is(':checked')) { $('#txtBatchCode').attr("disabled", false); } else { $("#txtBatchCode").attr("disabled", "disabled"); } }
function GetInventory() { $.modalOpen({ id: "GetICSInventory", title: "形态转换", url: "/WMS/ICSMTDOC/GetICSInventory?"+ Math.random(), width: "1000px", height: "1000px", callBack: function (iframeId) { var obj = top.frames[iframeId].submitForm(); $("#txtInvCode").val(obj.InvCode); top.frames[iframeId].Close(); } }) }
function GetBatchCode() { $.modalOpen({ id: "GetBatchCode", title: "形态转换", url: "/WMS/ICSMTDOC/GetBatchCode?" + Math.random(), width: "1000px", height: "1000px", callBack: function (iframeId) { var obj = top.frames[iframeId].submitForm(); $("#txtBatchCode").val(obj.BatchCode); $("#txtExtensionID").val(obj.ZYID); top.frames[iframeId].Close(); } }) }
function Close() { $.modalClose(); } function reloadData() {
}
</script> <div class="topPanel" style="height:50px"> <div class="search"> <table> <tr> <td> <label>条码:</label> </td> <td> <div class="input-group"> <input id="txt_LotNo" type="text" class="form-control" placeholder="条码" style="width: 120px;"> </div> </td> <td> <a id="Search" authorize="yes" style="margin-left:3px;" class="btn btn-primary" onclick="Init()"><i class="fa fa-pencil-square-o"></i>查询</a> </td> </tr> <tr></tr> </table> </div> </div>
<div style="margin-right: 20px;"> <table class="form"> <thead>选择转换料品</thead> <tr> <th class="formTitle">料品编码:</th> <td class="formValue"> <input id="txtInvCode" type="text" disabled="disabled" class="form-control" onclick="GetInventory()" autocomplete="off" /> </td> <td > <input id="InvCodebox" type="checkbox" onclick="OncheckBox1(this)"> </td> <th class="formTitle">批次:</th> <td class="formValue"> <input id="txtBatchCode" type="text" disabled="disabled" class="form-control" onclick="GetBatchCode()" autocomplete="off" /> <input id="txtExtensionID" type="text" style="display:none" class="form-control" /> </td> <td> <input id="BatchCodebox" type="checkbox" onclick="OncheckBox2(this)"> </td> <th class="formTitle">转换原因:</th> <td class="formValue"> <input id="txtMemo" type="text" class="form-control" /> </td> </tr> </table>
</div>
<div class="gridPanel" id="gridPanel"> <table id="gridList"></table> <div id="gridPager"></div> </div>
|