|
|
@{ ViewBag.Title = "Index"; Layout = "~/Views/Shared/_Form.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 _Clos = new Array(); var rfqcode = $.request("rfqcode"); var ID = $.request("ID"); $(function(){
SetCols(); if (ID=='') { $(".MOPick").css('display', 'none'); }
var Muser = '@NFine.Code.OperatorProvider.Provider.GetCurrent().UserCode' var now = new Date(); var date = now.toLocaleDateString(); $("#txtMUSER").val(Muser); $("#txtMTIME").val(date);
InitControl(); InitContro2(); InitContro3(); ClearTemp(); reloadData(); $("#sel_CodeType").change(function () { $.ajax({ url: "/DHAY/ICSAccessoriesMOApply/GetBidCode" + "?" + Math.random(), dataType: "json", async: false, success: function (data) { if (data.Code != '') { $("#Code").val(data.Code); $("#Code").attr("disabled", "disabled"); } } }); }); }) function SetCols() { $.ajax({ url: "/Print/SelectColumnName?" + Math.random(), dataType: "json", async: false, success: function (data) { var cols = new Array();
var collast = { label: '主键', name: 'ID', width: 150, align: 'left', hidden: true, key: true }; cols.push(collast); var collast = { label: 'ID', name: 'ID', width: 150, align: 'left', hidden: true }; cols.push(collast); //var collast = { // label: '查看', width: 100, align: 'left', // formatter: btnLook //}; // 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: 'WHCode', width: 100, align: 'left', hidden: true }; cols.push(collast); var collast = { label: '仓库名称', name: 'WHCodeName', width: 100, align: 'left', editable: true }; cols.push(collast); var collast = { label: '批号', name: 'Batch', width: 100, align: 'left', editable: true }; cols.push(collast); var collast = { label: '数量', name: 'Quantity', width: 100, align: 'left', editable: true, editrules: { number: true } }; cols.push(collast); var collast = { label: '工单', name: 'SourceCode', width: 100, align: 'left', editable: true, editrules: true }; cols.push(collast); var collast = { label: '备注', name: 'DetailReamrk', width: 150, align: 'left', editable: true }; 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 reloadData() { $("#gridList").dataGrid({ url: "/WMS/ProductionIssue/GetICSReturnTemporary?rfqno=" + $("#txtApplyNegCode").val() + "&" + Math.random(), //postData: { rfqno: $("#RFQNO").val() }, height: $(window).height() - 300, width: $(window).width(), cellEdit: true, colModel: _Clos, cellsubmit: "clientArray", width: "100%", //autowidth: true, rownumbers: true, viewrecords: true, ondblClickRow: function (rowid, cellname, value) { var colModel = $("#gridList").jqGrid("getGridParam", "colModel"); var cellIndex = $("#gridList").jqGrid("getGridParam", "iCol"); var cellname = colModel[cellIndex].name; if (cellname == "InvCode") { $.modalOpen({ id: "InvCodeSelect", title: "选择物料信息", url: "/DHAY/ICSCustomerSuppliedReturn/GetInvCode", width: "50%", height: "50%", callBack: function (iframeId) { debugger; var obj = top.frames[iframeId].submitForm(); $("#gridList").jqGrid('setCell', rowid, 'InvCode', obj.INVCODE, 'review-' + rowid); $("#gridList").jqGrid('setCell', rowid, 'INVNAME', obj.INVNAME, 'review-' + rowid); $("#gridList").jqGrid('setCell', rowid, 'InvStd', obj.InvStd, 'review-' + rowid); $("#gridList").jqGrid("saveCell", rowid, 1); $("#gridList").jqGrid("saveCell", rowid, 2); $("#gridList").jqGrid("saveCell", rowid, 3); $("#gridList").jqGrid("saveCell", rowid, 4); $("#gridList").jqGrid("saveCell", rowid, 5); $("#gridList").jqGrid("saveCell", rowid, 6); $("#gridList").jqGrid("saveCell", rowid, 7); $("#gridList").jqGrid("saveCell", rowid, 8); $("#gridList").jqGrid("saveCell", rowid, 9); top.frames[iframeId].Close(); }
}); } else if (cellname == "WHCodeName") { $.modalOpen({ id: "GetWHCode", title: "选择仓库", url: "/DHAY/ICSCustomerSuppliedReturn/GetWHCode", width: "50%", height: "50%", callBack: function (iframeId) { debugger; var obj = top.frames[iframeId].submitForm(); $("#gridList").jqGrid('setCell', rowid, 'WHCode', obj.WarehouseCode, 'review-' + rowid); $("#gridList").jqGrid('setCell', rowid, 'WHCodeName', obj.WarehouseName, 'review-' + rowid); $("#gridList").jqGrid("saveCell", rowid, 1); $("#gridList").jqGrid("saveCell", rowid, 2); $("#gridList").jqGrid("saveCell", rowid, 3); $("#gridList").jqGrid("saveCell", rowid, 4); $("#gridList").jqGrid("saveCell", rowid, 5); $("#gridList").jqGrid("saveCell", rowid, 6); $("#gridList").jqGrid("saveCell", rowid, 7); $("#gridList").jqGrid("saveCell", rowid, 8); $("#gridList").jqGrid("saveCell", rowid, 9); top.frames[iframeId].Close(); }
}); } else if (cellname == "Batch") { $.modalOpen({ id: "InvCodeSelect", title: "选择批次信息", url: "/DHAY/ICSCustomerSuppliedReturn/GetBatch", width: "50%", height: "50%", callBack: function (iframeId) { debugger; var obj = top.frames[iframeId].submitForm(); $("#gridList").jqGrid('setCell', rowid, 'Batch', obj.BatchCode, 'review-' + rowid); $("#gridList").jqGrid("saveCell", rowid, 1); $("#gridList").jqGrid("saveCell", rowid, 2); $("#gridList").jqGrid("saveCell", rowid, 3); $("#gridList").jqGrid("saveCell", rowid, 4); $("#gridList").jqGrid("saveCell", rowid, 5); $("#gridList").jqGrid("saveCell", rowid, 6); $("#gridList").jqGrid("saveCell", rowid, 7); $("#gridList").jqGrid("saveCell", rowid, 8); $("#gridList").jqGrid("saveCell", rowid, 9); top.frames[iframeId].Close(); }
}); }
}, }); }
function btnLook(cellvalue, options, rowObject) { return cellvalue = "<a class=\"btn btn-primary dropdown-text\" onclick=\"UpLoadClick('" + rowObject.ID + "')\">查看</a>"; }
function UpLoadClick(ID) { $.modalOpen({ id: "selectDeatil", title: "查看修改物料", url: "/WMS/ProductionIssue/SeachInventory?ID=" + ID + "&" + Math.random(), width: "1000px", height: "1000px", callBack: function (iframeId) { var obj = top.frames[iframeId].submitForm(); var rowData = $("#gridList").jqGrid('getRowData', ID); rowData.TLZID = obj.TLZID, rowData.ZJID = obj.ZJID, rowData.InvCode = obj.InvCode, rowData.InvName = obj.InvName, rowData.InvStd = obj.InvStd, rowData.InvUnit = obj.InvUnit, rowData.Quantity = obj.Quantity, rowData.IssueNegQuantity = obj.IssueQuantity, rowData.Amount = obj.Amount, rowData.ExtensionID = obj.ExtensionID, rowData.ProjectCode = obj.ProjectCode, rowData.BatchCode = obj.BatchCode, rowData.Version = obj.Version, rowData.Brand = obj.Brand, rowData.cFree1 = obj.cFree1, rowData.cFree2 = obj.cFree2, rowData.cFree3 = obj.cFree3, rowData.cFree4 = obj.cFree4, rowData.cFree5 = obj.cFree5, rowData.cFree6 = obj.cFree6, rowData.cFree7 = obj.cFree7, rowData.cFree8 = obj.cFree8, rowData.cFree9 = obj.cFree9, rowData.cFree10 = obj.cFree10 $("#gridList").jqGrid('setRowData', ID, rowData); $(".unwritten").hide(); top.frames[iframeId].Close(); } });
}
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(), WHCode: ""
};
$("#gridList").jqGrid('addRowData', obj.ID, obj, 'last'); $(".unwritten").hide(); }
function DeleteRowToLast() { debugger; var rowid = $("#gridList").jqGridRowValue().ID $("#gridList").delRowData(rowid);
}
//获取U9单据类型 function InitControl() { var $CodeType = $("#sel_CodeType"); $CodeType.select2({ allowClear: true, escapeMarkup: function (m) { return m; } }); $.ajax({ url: "/DHAY/ICSCustomerSuppliedReturn/GetU9CodeType" + "?" + Math.random(), dataType: "json", async: false, success: function (data) { $.each(data, function (index, item) { $CodeType.append("<option value='" + item.Code + "'> " + item.Name + "</option>"); }); } }); } //获取U9部门 function InitContro2() { var $Dept = $("#sel_Dept"); $Dept.select2({ allowClear: true, escapeMarkup: function (m) { return m; } }); $.ajax({ url: "/DHAY/ICSCustomerSuppliedReturn/GetU9Department" + "?" + Math.random(), dataType: "json", async: false, success: function (data) { $.each(data, function (index, item) { $Dept.append("<option value='" + item.Code + "'> " + item.Name + "</option>"); }); } }); } //获取U9客户 function InitContro3() { var $Custmer = $("#sel_Custmer"); $Custmer.select2({ allowClear: true, escapeMarkup: function (m) { return m; } }); $.ajax({ url: "/DHAY/ICSCustomerSuppliedReturn/GetU9Customer" + "?" + Math.random(), dataType: "json", async: false, success: function (data) { $.each(data, function (index, item) { $Custmer.append("<option value='" + item.Code + "'> " + item.Name + "</option>"); }); } }); }
function ClearTemp() { $.ajax({ url: "/WMS/ProductionIssue/ClearTemp?" + Math.random(), datatype: "json", async: false })
}
function submitForm() { $("#gridList").find($("td[aria-describedby='gridList_rn']")).click(); debugger; if (!$('#form1').formValid()) { return false; } var CodeType = $("#sel_CodeType").val();//单据类型 var Dept = $("#sel_Dept").val();//部门 var ApplyNegCode = $("#txtApplyNegCode").val();//在建项目 var Custmer = $("#sel_Custmer").val();//客户 var Remarks = $("#Remarks").val();//备注 var Code = $("#Code").val();//单据号 var MTIME = $("#txtMTIME").val();//单据号 var SYproject = $("#txtSYproject").val();//受益项目 var RoleEnCode = '@NFine.Code.OperatorProvider.Provider.GetCurrent().UserCode' var WorkPoint = '@NFine.Code.OperatorProvider.Provider.GetCurrent().Location' var IDlist = ""; var Details = []; SelPerson = "#SelBR_" 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 == "" || vendorRowData.Quantity == 'undefined') { $.modalAlertNew("WMS00089"); return; } /* var WHCode = $("" + SelPerson + "" + vendorRowData.ID + "").val();*/ var obj = { ID: vendorRowData.ID, Sequence: i + 1, InvCode: vendorRowData.InvCode, Quantity: vendorRowData.Quantity, WHCode: vendorRowData.WHCode, SourceCode: vendorRowData.SourceCode, DetailReamrk: vendorRowData.DetailReamrk, Batch: vendorRowData.Batch }; Details.push(obj); } var ICSASNs = { Dept: Dept, CodeType: CodeType, ApplyNegCode: ApplyNegCode, Custmer: Custmer, Remarks: Remarks, Code: Code, MTIME: MTIME, User: RoleEnCode, SYproject: SYproject, Detail: Details, } var ICSASN = []; ICSASN.push(ICSASNs); $.submitForm({
url: "/DHAY/ICSAccessoriesMOApply/SaveICSMOApply?" + Math.random(), param: { ICSASN: JSON.stringify(ICSASN) }, success: function () { $.currentWindow().$("#gridList").trigger("reloadGrid"); } }) } } function GetSelectPerson(ID, WHCode) { debugger; var str = ""; $.ajax({ url: "/DHAY/ICSCustomerSuppliedReturn/Select_ICSWHCode", 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].WarehouseCode + "'>" + data[i].WarehouseName + "</option>"); } } } });
}
</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">单据类型:</th> <td class="formValue"> <select id="sel_CodeType" name="sel_CodeType" class="form-control select2 required" style="width: 230px" placeholder="请选择单据类型..."></select> <input type="hidden" id="hidetext" /> </td> <th class="formTitle">单号:</th> <td class="formValue"> <input id="Code" type="text" readonly="readonly" class="form-control required" /> </td>
</tr> <tr> <th class="formTitle">受益部门:</th> <td class="formValue"> <select id="sel_Dept" name="sel_Dept" class="form-control select2 required" style="width: 230px" placeholder="请选择受益部门..."></select> <input type="hidden" id="hidetext" /> </td> <th class="formTitle">受益项目:</th> <td class="formValue"> <input type="text" id="txtSYproject" class="form-control" /> </td> </tr> <tr> <th class="formTitle">在建工程项目:</th> <td class="formValue"> <input type="text" id="txtApplyNegCode" class="form-control" /> </td> <th class="formTitle">客户:</th> <td class="formValue"> <select id="sel_Custmer" name="sel_Custmer" 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 type="text" id="Remarks" class="form-control" /> </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>
|