|
|
@{ ViewBag.Title = "Index"; Layout = "~/Views/Shared/_Index.cshtml"; } <link href="~/Content/js/select2/select2.min.css" rel="stylesheet" /> <script src="~/Content/js/datepicker/WdatePicker.js"></script> <script src="~/Content/js/select2/select2.min.js"></script> <style> #Additem { margin-left: 45%; }
#AddTemitem { margin-right: 45%; } </style> <script>
var rfqcode = $.request("rfqcode"); var ID = $.request("ID"); var OApplyNegCode = $.request("OApplyNegCode"); var WHCode = $.request("WHCode"); $(function () { InitControl(); var Muser = '@NFine.Code.OperatorProvider.Provider.GetCurrent().UserCode' var now = new Date(); var date = now.toLocaleDateString(); $("#txtMUSER").val(Muser); $("#txtMTIME").val(date); $("#txtApplyNegCode").val(OApplyNegCode); $("#sel_WHCode").val([WHCode]).trigger("change"); ClearTemp(); reloadData(); })
function reloadData() { $("#gridList").dataGrid({ url: "/WMS/WeiWaiProductionIssue/GetICSMOApplyNegDetailTemp?OApplyNegCode=" + $("#txtApplyNegCode").val() + "&" + Math.random(), //postData: { rfqno: $("#RFQNO").val() }, height: $(window).height() - 200, width: $(window).width(), cellEdit: true, colModel: [
{ label: '主键', name: 'ID', width: 150, align: 'left' ,hidden: true, key: true }, { label: 'ID', name: 'ID', width: 150, align: 'left', hidden: true }, { label: '查看', width: 100, align: 'left', formatter: btnLook }, { label: '退料子ID', name: 'TLZID', width: 150, align: 'left', hidden: true }, { label: '退料单号', name: 'OApplyNegCode', width: 150, 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: 'Quantity', width: 100, align: 'left', editable: true, editrules: { number: true } }, { label: '辅计量数量', name: 'Amount', width: 150, align: 'left' }, { label: '自由项ID', name: 'ExtensionID', hidden: true }, { label: '单位', name: 'InvUnit', width: 100, align: 'left' }, { label: '已发数量', name: 'IssueNegQuantity', width: 100, align: 'left' }, { label: '已退数量', name: 'tuinum', width: 100, align: 'left' }, { label: '子件ID', name: 'ZJID', width: 100, align: 'left' }, ], cellsubmit: "clientArray", width: "100%", autowidth: true, rownumbers: true, viewrecords: true, }); }
function btnLook(cellvalue, options, rowObject) { return cellvalue = "<a class=\"btn btn-primary dropdown-text\" onclick=\"UpLoadClick('" + rowObject.ID + "','" + rowObject.TLZID + "')\">查看</a>"; }
function UpLoadClick(ID,TLZID) { debugger;
$.modalOpen({ id: "selectDeatil", title: "查看修改物料", url: "/WMS/WeiWaiProductionIssue/SeachMaterial?TLZID=" + TLZID + "&Type=" + 1 + "&TLZID=" + TLZID + "&" + Math.random(), width: "1000px", height: "1000px", callBack: function (iframeId) { top.frames[iframeId].submitForm(); top.frames[iframeId].Close(); $("#gridList").jqGrid().setGridParam({ datatype: 'json' }, { postData: { rfqno: $("#RFQNO").val() } }).trigger('reloadGrid'); } });
}
function guid() { return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) { var r = Math.random() * 16 | 0, v = c == 'x' ? r : (r & 0x3 | 0x8); return v.toString(16); }); } //最后一行新增数据 function AddRowToLast() { var obj = { ID: guid(), };
$("#gridList").jqGrid('addRowData', obj.ID, obj, 'last'); $(".unwritten").hide(); }
function DeleteRowToLast() { debugger; var rowid = $("#gridList").jqGridRowValue().ID $("#gridList").delRowData(rowid);
}
function InitControl() { var $VenCode = $("#sel_WHCode"); $VenCode.select2({ allowClear: true, escapeMarkup: function (m) { return m; } }); $.ajax({ url: "/WMS/ProductionIssue/GetWHCode" + "?" + Math.random(), dataType: "json", async: false, success: function (data) { $.each(data, function (index, item) { $VenCode.append("<option value='" + item.WarehouseCode + "'> " + item.WarehouseName + "</option>"); }); } }); }
function ClearTemp() { $.ajax({ url: "/WMS/WeiWaiProductionIssue/ClearTemp?" + Math.random(), datatype: "json", async: false })
}
function submitForm() { var WHCode = $("#sel_WHCode").val(); if (WHCode=="") { $.modalAlert("请选择仓库!"); return; } debugger;
var IDlist = ""; var RoleEnCode = '@NFine.Code.OperatorProvider.Provider.GetCurrent().UserCode' var WorkPoint = '@NFine.Code.OperatorProvider.Provider.GetCurrent().Location' var date = new Date(); var Details = []; var obj_vendor = $("#gridList"); var rowIds_vendor = obj_vendor.getDataIDs(); var arrayData_vendor = new Array(); if (rowIds_vendor.length > 0) { for (var i = 0; i < rowIds_vendor.length; i++) { var vendorRowData = obj_vendor.getRowData(rowIds_vendor[i]); if (vendorRowData.Quantity == '0' || vendorRowData.Quantity==0) { $.modalAlert("请输入数量!"); return; } var Code = vendorRowData.InvCode; var Quantity = Number(vendorRowData.Quantity); var IssueNegQuantity = Number(vendorRowData.IssueNegQuantity); var tuinum = Number(vendorRowData.tuinum); //if (IssueNegQuantity - tuinum <= 0) { // $.modalAlert("料品:'" + Code + "',已发数'" + IssueNegQuantity + "',已全部退货!"); // return; //} var obj = { Sequence: i + 1, DetailID:vendorRowData.TLZID, InvCode: vendorRowData.InvCode, Quantity: vendorRowData.Quantity, Amount: vendorRowData.Amount, SourceDetailID: vendorRowData.ZJID, ExtensionID: vendorRowData.ExtensionID, }; Details.push(obj); } var ICSASNs = { ID:ID, WHCode: WHCode, User: RoleEnCode, MTIME: date, WorkPoint: WorkPoint, Type:'1', Detail: Details, } var ICSASN = []; ICSASN.push(ICSASNs); $.submitForm({
url: "/WMS/WeiWaiProductionIssue/UpdateICSMOApplyNeg?" + Math.random(), param: { ICSASN: JSON.stringify(ICSASN) }, success: function () { $.currentWindow().$("#gridList").trigger("reloadGrid"); } }) } }
</script> <form id="form1"> <div class="topPanel" style="height:10px"> <div class="btn-group"> @*<a id="AddItemLot" style="margin-left:3px;" class="btn btn-primary" onclick="btnCreate()"><i class="fa fa-pencil-square-o"></i>添加明细</a> <a id="refresh" class="btn btn-primary" style="margin-left:3px;" onclick="reloadData()"><span class="glyphicon glyphicon-refresh"></span></a>*@ </div> </div> <div style="margin-right: 20px;"> <table class="form"> <thead>主表信息</thead> <tr> <th class="formTitle MOPick">委外退料单号:</th> <td class="formValue MOPick"> <input type="text" id="txtApplyNegCode" class="form-control" /> </td> <th class="formTitle">仓库编码:</th> <td class="formValue"> <select id="sel_WHCode" name="sel_WHCode" class="form-control select2" style="width: 230px" placeholder="请选择供应商编码..."></select> <input type="hidden" id="hidetext" /> </td>
</tr>
<tr> <th class="formTitle">维护人:</th> <td class="formValue"> <input id="txtMUSER" type="text" readonly="readonly" class="form-control" /> </td> <th class="formTitle">维护时间:</th> <td class="formValue"> <input id="txtMTIME" type="text" readonly="readonly" class="form-control" /> </td> </tr> </table>
</div> <div class="gridPanel" style="margin-left:10px"> <span><strong>子表信息</strong></span> <table id="gridList"></table> <div style="text-align:center"> <button id="AddRow" class="btn btn-primary" type="button" onclick="AddRowToLast()">添加</button> <button id="DeleteRow" type="button" class="btn btn-primary" onclick="DeleteRowToLast()">删除</button> </div> </div>
</form>
|