|
|
@{ ViewBag.Title = "Index"; Layout = "~/Views/Shared/_Index.cshtml"; } <style> #ISO { width: 10px; } </style> <link href="~/Content/js/select2/select2.min.css" rel="stylesheet" /> <script src="~/Content/js/select2/select2.min.js"></script> <script> var ID = $.request("ID"); var Warehouse = $.request("Warehouse"); var OverLoadLocationCode = $.request("OverLoadLocationCode"); var LocationCode1 = OverLoadLocationCode.split(',')[0]; var LocationCode2 = OverLoadLocationCode.split(',')[1]; var WarehouseName = decodeURI($.request("WarehouseName")); var WarehouseArea = $.request("WarehouseArea"); //var WarehouseName = decodeURI($.getUrlParam("WarehouseName")); var LocationCode = $.request("LocationCode"); var LocationName = decodeURI($.request("LocationName")); //var expArrivalDate = $ $(function () { debugger; InitControl(); InitControl1(); //InitControl2(); if (ID != "") { //$("#sel_Warehouse").children('option:selected').val(WarehouseName) $("#sel_Warehouse").val([WarehouseName]).trigger("change"); $("#LocationCode1").val(LocationCode1); $("#LocationCode2").val(LocationCode2); $("#WarehouseName").val(WarehouseName); $("#WarehouseArea").val(WarehouseArea); var s = LocationName;
var str = LocationCode.split('-'); for (var i = 1; i <= str.length; i++) { if (i == 1) $("#Qu").val(str[1]); if (i == 2) $("#Pai").val(str[2]); if (i == 3) $("#Jia").val(str[3]); if (i == 4) $("#Ceng").val(str[4]); if (i == 5) $("#Ge").val(str[5]); } } $("#sel_Warehouse").change(function () { debugger; var Was = $("#sel_Warehouse").children('option:selected').val(); $("#WarehouseName").val(Was); //$("#WarehouseArea").val(Was); //var VenCode = $("#sel_VenCode").children('option:selected').val(); }); $("#sel_LocationCode1").change(function () { debugger; var Was = $("#sel_LocationCode1").children('option:selected').val(); $("#sel_LocationCode1").val(Was); }); $("#sel_LocationCode2").change(function () { debugger; var Was = $("#sel_LocationCode2").children('option:selected').val(); $("#sel_LocationCode2").val(Was); }); }); $.getUrlParam = function (name) { var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)"); var r = window.location.search.substr(1).match(reg); if (r != null) return unescape(r[2]); return null; } ;
function InitControl() { debugger; var $VenCode = $("#sel_Warehouse"); $VenCode.select2({ allowClear: true, escapeMarkup: function (m) { return m; } }); $.ajax({ url: "/WMS/BasicSettings/GetWarehouse" + "?" + Math.random(), dataType: "json", async: false, success: function (data) { $.each(data, function (index, item) { $VenCode.append("<option value='" + item.WarehouseName + "'>" + item.WarehouseCode + "</option>"); }); } }); }
function InitControl1() { debugger; var $VenCode = $("#sel_LocationCode1"); $VenCode.select2({ allowClear: true, escapeMarkup: function (m) { return m; } }); var $VenCode1 = $("#sel_LocationCode2"); $VenCode1.select2({ allowClear: true, escapeMarkup: function (m) { return m; } }); $.ajax({ url: "/WMS/BasicSettings/GetLocationCode" + "?" + Math.random(), dataType: "json", async: false, success: function (data) { $.each(data, function (index, item) { $VenCode.append("<option value='" + item.LocationCode + "'>" + item.LocationCode + "</option>"); $VenCode1.append("<option value='" + item.LocationCode + "'>" + item.LocationCode + "</option>"); }); } }); } function InitControl2() { debugger; var $VenCode = $("#sel_LocationCode2"); $VenCode.select2({ allowClear: true, escapeMarkup: function (m) { return m; } }); $.ajax({ url: "/WMS/BasicSettings/GetLocationCode" + "?" + Math.random(), dataType: "json", async: false, success: function (data) { $.each(data, function (index, item) { $VenCode.append("<option value='" + item.LocationCode + "'>" + item.LocationCode + "</option>"); }); } }); }
////新增条码 //function btnCreate() { // var STNO = $("#STNO").text(); // Vendor = $("#sel_VenCode").find("option:selected").val(); // if (STNO == "") { // $.modalAlertNew("WMS00059"); // return; // } // var expArrivalDate = $("#ExpArivalDate").val(); // if (expArrivalDate == '' || expArrivalDate == null) { // $.modalAlertNew("WMS00060"); // return; // } // $.modalOpen2({ // id: "Form", // title: "条码信息", // url: "/SRM/ASNSelect/Index?STNO=" + STNO + "&Vendor=" + Vendor + "&" + Math.random(), // width: "800px", // height: "500px", // callBack: function (iframeId) { // top.frames[iframeId].submitForm(); // } // }); //} ////新增箱号 //function btnAddCartonNo() { // var STNO = $("#STNO").text(); // Vendor = $("#sel_VenCode").find("option:selected").val();
// if (STNO == "") { // $.modalAlertNew("WMS00059"); // return; // } // var expArrivalDate = $("#ExpArivalDate").val(); // if (expArrivalDate == '' || expArrivalDate == null) { // $.modalAlertNew("WMS00060"); // return; // } // $.modalOpen2({ // id: "Form", // title: "箱号信息", // url: "/SRM/ASNCartonSelect/Index?STNO=" + STNO + "&Vendor=" + Vendor + "&" + Math.random(), // width: "800px", // height: "500px", // callBack: function (iframeId) { // top.frames[iframeId].submitForm(); // } // }); //} //刷新 function reloadData() { STNO = $("#STNO").text(); var queryJson = { STNO: STNO, } $("#gridList").jqGrid('setGridParam', { postData: { queryJson: JSON.stringify(queryJson) }, }).trigger('reloadGrid'); } ////删除条码 //function btn_delete() { // var objArr = ""; // var objList = $("#gridList").jqGrid('getGridParam', 'selarrrow'); // if (objList.length == 0) { // $.modalAlertNew("WMS00061"); // return; // } // for (var i = 0; i < objList.length; i++) { // var rowId = objList[i]; // var rowData = $("#gridList").jqGrid('getRowData', rowId); // objArr += "'" + rowData.ASNDETAILID + "',"; // } // $.deleteForm({ // url: "/SRM/ASNAdd/DeleteInfo" + "?" + Math.random(), // param: { keyValue: JSON.stringify(objArr) }, // success: function () { // reloadData(); // } // }) //} //新增超托库位 function submitForm() { debugger; var StackCode = ""; var StackName = ""; var Warehouse = ""; var WarehouseName = ""; var WarehouseArea = ""; var Qu = $("#Qu").val(); var Pai = $("#Pai").val(); var Jia = $("#Jia").val(); var Ceng = $("#Ceng").val(); var Ge = $("#Ge").val(); var OverLocationCode1 = $("#sel_LocationCode1").find("option:selected").text(); var OverLocationCode2 = $("#sel_LocationCode2").find("option:selected").text(); if (OverLocationCode1 == "") { OverLocationCode1 = LocationCode1; } if (OverLocationCode2 == "") { OverLocationCode2 = LocationCode2; } if (Qu == "" && Pai == "" && Jia == "" && Ceng == "" && Ge == "" ) { $.modalAlertNew("WMS00062"); return; } if (cutStringToSecondOccurrence(OverLocationCode1, '-') != cutStringToSecondOccurrence(OverLocationCode2, '-')) { $.modalAlertNew("WMS00119"); return; } var StackCode = $("#sel_Warehouse").find("option:selected").text(); var StackName = $("#sel_Warehouse").find("option:selected").text() + "仓库"; if (Qu!="") { StackCode = StackCode+"-" + Qu; StackName = StackName+Qu + "区域"; } if (Pai!="") { StackCode += "-" + Pai; StackName += Pai + "区"; } if (Jia!="") { StackCode += "-" + Jia; StackName += Jia + "货架"; } if (Ceng!="") { StackCode += "-" + Ceng; StackName += Ceng + "层"; } if (Ge!="") { StackCode += "-" + Ge; StackName += Ge + "列"; } var objArr = { ID:ID, StackCode:StackCode, StackName: StackName, Qu: $("#Qu").val(), Pai: $("#Pai").val(), Jia: $("#Jia").val(), Ceng: $("#Ceng").val(), Ge: $("#Ge").val(), Warehouse: $("#sel_Warehouse").find("option:selected").text(), LocationCode1: OverLocationCode1, LocationCode2: OverLocationCode2, WarehouseName: $("#WarehouseName").val(), WarehouseArea: $("#WarehouseArea").val() } if (ID != "") { $.submitForm({ url: "/WMS/BasicSettings/UpdateOverLoadStack" + "?" + Math.random(), param: { keyValue: JSON.stringify(objArr) }, success: function () { $.currentWindow().$("#gridList").trigger("reloadGrid"); } }) } else { $.submitForm({ url: "/WMS/BasicSettings/InsertOverLoadStack" + "?" + Math.random(), param: { keyValue: JSON.stringify(objArr) }, success: function () { $.currentWindow().$("#gridList").trigger("reloadGrid"); } }) }
//字符串截取方法,截取第二次特定字符之前的字符串 function cutStringToSecondOccurrence(str, char) { let firstIndex = str.indexOf(char); // 如果未找到指定字符,则返回原字符串if (firstIndex == -l) return str; let secondIndex = str.indexOf(char, firstIndex + 1); if (secondIndex == -1) return str.substring(0, firstIndex); // 如果只找到一次指定字符 return str.substring(0, secondIndex); // 返回截取到第二次出现指定字符的位置的字符串 } }
</script>
<form id="form1"> <div style="padding-top: 20px; margin-right: 20px;"> <table class="form"> <tr> <th class="formTitle">库房编号:</th> <td style="width:165px"> <select id="sel_Warehouse" name="sel_Warehouse" class="form-control select2" style="width: 500px" placeholder="库房编号"></select> <input type="hidden" id="hidetext" /> </td> </tr> <tr> <th class="formTitle">库房名称:</th> <td class="formValue"> <input id="WarehouseName" name="WarehouseName" type="text" class="form-control required" style="width: 300px;" maxlength="10" onclick="WdatePicker({ dateFmt: 'yyyy-MM-dd' })" placeholder="库房名称" /> </td> </tr> <tr> <th class="formTitle"> 窄巷道待入库区域:</th> <td class="formValue"> <input id="WarehouseArea" name="WarehouseArea" type="text" class="form-control required" style="width: 300px;" maxlength="10" onclick="WdatePicker({ dateFmt: 'yyyy-MM-dd' })" placeholder="窄巷道待入库区域" /> </td> </tr> <tr> <th class="formTitle">库位编号:</th> <td class="formValue"> <input id="Qu" name="Qu" type="text" class="form-control required" style="width:150px;" maxlength="10" placeholder="区域" /> </td> @*<td id="ISO">-</td>*@ <td class="formValue"> <input id="Pai" name="Pai" type="text" class="form-control required" style="width: 80px;" maxlength="10" placeholder="区" /> </td> @*<td style="width:30px">-</td>*@ <td class="formValue"> <input id="Jia" name="Jia" type="text" class="form-control required" style="width: 80px;" maxlength="10" placeholder="货架" /> </td> @*<td style="width:30px">-</td>*@ <td class="formValue"> <input id="Ceng" name="Ceng" type="text" class="form-control required" style="width: 80px;" maxlength="10" placeholder="层" /> </td> @*<td style="width:30px">-</td>*@ <td class="formValue"> <input id="Ge" name="Ge" type="text" class="form-control required" style="width: 80px;" maxlength="10" placeholder="列" /> </td> </tr> <tr> <th class="formTitle">库位1:</th> <td class="formValue"> <input id="LocationCode1" name="LocationCode1" type="text" class="form-control required" style="width: 150px; " maxlength="10" onclick="WdatePicker({ dateFmt: 'yyyy-MM-dd' })" disabled="disabled" /> </td>
</tr> <tr> <td ></td> <td class="formValue"> <select id="sel_LocationCode1" name="sel_LocationCode1" class="form-control select2" placeholder="库位1"></select> <input type="hidden" id="hidetext" /> </td> </tr> <tr> <th class="formTitle">库位2:</th> <td class="formValue"> <input id="LocationCode2" name="LocationCode2" type="text" class="form-control required" style="width: 150px !important; " maxlength="10" onclick="WdatePicker({ dateFmt: 'yyyy-MM-dd' })" disabled="disabled" /> </td> </tr> <tr> <td></td> <td class="formValue"> <select id="sel_LocationCode2" name="sel_LocationCode2" class="form-control select2" style="width: 500px" placeholder="库位2"></select> <input type="hidden" id="hidetext" /> </td> </tr> <!--<tr> <th class="formTitle">库位2编号:</th> <td class="formValue"> <input id="Qu1" name="Qu1" type="text" class="form-control required" style="width:80px;" maxlength="10" placeholder="区域" /> </td>--> @*<td id="ISO">-</td>*@ <!--<td class="formValue"> <input id="Pai1" name="Pai1" type="text" class="form-control required" style="width: 80px;" maxlength="10" placeholder="区" /> </td>--> @*<td style="width:30px">-</td>*@ <!--<td class="formValue"> <input id="Jia1" name="Jia1" type="text" class="form-control required" style="width: 80px;" maxlength="10" placeholder="货架" /> </td>--> @*<td style="width:30px">-</td>*@ <!--<td class="formValue"> <input id="Ceng1" name="Ceng1" type="text" class="form-control required" style="width: 80px;" maxlength="10" placeholder="层" /> </td>--> @*<td style="width:30px">-</td>*@ <!--<td class="formValue"> <input id="Ge1" name="Ge1" type="text" class="form-control required" style="width: 80px;" maxlength="10" placeholder="列" /> </td> </tr>--> @*<tr> <th class="formTitle">格式:</th> <td class="formValue"> <span> 区域</span> </td> <td class="formValue"> <span> 区</span> </td> <td class="formValue"> <span> 货架</span> </td> <td class="formValue"> <span> 层</span> </td> <td class="formValue"> <span> 列</span> </td> </tr>*@ </table> </div> </form>
|