|
|
@{ ViewBag.Title = "Index"; Layout = "~/Views/Shared/_Form.cshtml"; } <link href="~/Content/js/select2/select2.min.css" rel="stylesheet" /> <script src="~/Content/js/select2/select2.min.js"></script> <style> .form { margin: 25px 15px; } </style>
<script>
var WorkPoints = '@NFine.Code.OperatorProvider.Provider.GetCurrent().Location' var User = '@NFine.Code.OperatorProvider.Provider.GetCurrent().UserCode' var Times = new Date(); var Time = formatDate("YYYY-mm-dd HH:MM:SS", Times); $(function () { $("#minPackQty").keyup(function () { $(this).val($(this).val().replace(/[^0-9.]/g, '')); }).bind("paste", function () { //CTR+V事件处理 $(this).val($(this).val().replace(/[^0-9.]/g, '')); }).css("ime-mode", "disabled"); //CSS设置输入法不可用 $("#thisCreateQty").keyup(function () { $(this).val($(this).val().replace(/[^0-9.]/g, '')); }).bind("paste", function () { //CTR+V事件处理 $(this).val($(this).val().replace(/[^0-9.]/g, '')); }).css("ime-mode", "disabled"); //CSS设置输入法不可用 $("#cretePageCount").keyup(function () { $(this).val($(this).val().replace(/[^0-9.]/g, '')); }).bind("paste", function () { //CTR+V事件处理 $(this).val($(this).val().replace(/[^0-9.]/g, '')); }).css("ime-mode", "disabled"); //CSS设置输入法不可用
$("#txtMUSER").val(User); $("#txtMTIME").val(Time); $("#txtMUSER").attr("disabled", "disabled"); $("#txtMTIME").attr("disabled", "disabled"); InitControl();
$("#sel_WHCode").change(function () { debugger; if ($("#sel_WHCode").val() == "") { $.modalAlertNew("WMS00041"); return; } else { var WHCodeID = $("#sel_WHCode").val(); var a = WHCodeID.split("|"); WHCodeID = a[0]; var $QU = $("#sel_QU"); $QU.select2({ allowClear: true, escapeMarkup: function (m) { return m; } }); $.ajax({ url: "/WMS/Blitem/GetQU?WHCodeID=" + WHCodeID + "&" + Math.random(), dataType: "json", async: false, success: function (data) { $.each(data, function (index, item) { $QU.append("<option value='" + item.QUValue + "'>" + item.QUName + "</option>"); }); } }); } }); $("#sel_QU").change(function () { debugger; if ($("#sel_QU").val() == "") { $.modalAlertNew("WMS00041"); return; } else { var WHCodeID = $("#sel_WHCode").val(); var a = WHCodeID.split("|"); WHCodeID = a[0]; var Qu = $("#sel_QU").val();
var $Pai = $("#sel_Pai"); $Pai.select2({ allowClear: true, escapeMarkup: function (m) { return m; } }); $.ajax({ url: "/WMS/Blitem/GetPai?WHCodeID=" + WHCodeID + "&Qu=" + Qu + "&" + Math.random(), dataType: "json", async: false, success: function (data) { $.each(data, function (index, item) { $Pai.append("<option value='" + item.PaiValue + "'>" + item.PaiName + "</option>"); }); } }); } }); $("#sel_Pai").change(function () { debugger; if ($("#sel_Pai").val() == "") { $.modalAlertNew("WMS00041"); return; } else { var WHCodeID = $("#sel_WHCode").val(); var a = WHCodeID.split("|"); WHCodeID = a[0]; var Qu = $("#sel_QU").val(); var Pai = $("#sel_Pai").val();
var $HuoJia = $("#sel_HuoJia"); $HuoJia.select2({ allowClear: true, escapeMarkup: function (m) { return m; } }); $.ajax({ url: "/WMS/Blitem/GetHuoJia?WHCodeID=" + WHCodeID + "&Qu=" + Qu + "&Pai=" + Pai + "&" + Math.random(), dataType: "json", async: false, success: function (data) { $.each(data, function (index, item) { $HuoJia.append("<option value='" + item.HuoJiaValue + "'>" + item.HuoJiaName + "</option>"); }); } }); } }); $("#sel_HuoJia").change(function () { debugger; if ($("#sel_HuoJia").val() == "") { $.modalAlertNew("WMS00041"); return; } else { var WHCodeID = $("#sel_WHCode").val(); var a = WHCodeID.split("|"); WHCodeID = a[0]; var Qu = $("#sel_QU").val(); var Pai = $("#sel_Pai").val(); var HuoJia = $("#sel_HuoJia").val();
var $Ceng = $("#sel_Ceng"); $Ceng.select2({ allowClear: true, escapeMarkup: function (m) { return m; } }); $.ajax({ url: "/WMS/Blitem/GetCeng?WHCodeID=" + WHCodeID + "&Qu=" + Qu + "&Pai=" + Pai + "&HuoJia=" + HuoJia + "&" + Math.random(), dataType: "json", async: false, success: function (data) { $.each(data, function (index, item) { $Ceng.append("<option value='" + item.CengValue + "'>" + item.CengName + "</option>"); }); } }); } }); $("#sel_Ceng").change(function () { debugger; if ($("#sel_Ceng").val() == "") { $.modalAlertNew("WMS00041"); return; } else { var WHCodeID = $("#sel_WHCode").val(); var a = WHCodeID.split("|"); WHCodeID = a[0]; var Qu = $("#sel_QU").val(); var Pai = $("#sel_Pai").val(); var HuoJia = $("#sel_HuoJia").val(); var Ceng = $("#sel_Ceng").val();
var $Ge = $("#sel_Ge"); $Ge.select2({ allowClear: true, escapeMarkup: function (m) { return m; } }); $.ajax({ url: "/WMS/Blitem/GetGe?WHCodeID=" + WHCodeID + "&Qu=" + Qu + "&Pai=" + Pai + "&HuoJia=" + HuoJia + "&Ceng=" + Ceng + "&" + Math.random(), dataType: "json", async: false, success: function (data) { $.each(data, function (index, item) { $Ge.append("<option value='" + item.GeValue + "'>" + item.GeName + "</option>"); }); } }); } }); });
function formatDate(fomatType, date) { let ret; let valueDate = date; if (!date) valueDate = new Date() let opt = { "Y+": valueDate.getFullYear().toString(), // 年 "m+": (valueDate.getMonth() + 1).toString(), // 月 "d+": valueDate.getDate().toString(), // 日 "H+": valueDate.getHours().toString(), // 时 "M+": valueDate.getMinutes().toString(), // 分 "S+": valueDate.getSeconds().toString() // 秒 }; for (let k in opt) { ret = new RegExp("(" + k + ")").exec(fomatType); if (ret) { fomatType = fomatType.replace(ret[1], (ret[1].length == 1) ? (opt[k]) : (opt[k].padStart(ret[1].length, "0"))) }; }; return fomatType; }
function InitControl() { debugger; var $WHCode = $("#sel_WHCode"); $WHCode.select2({ allowClear: true, escapeMarkup: function (m) { return m; } }); $.ajax({ url: "/WMS/Blitem/GetWHCode?" + Math.random(), dataType: "json", async: false, success: function (data) { $.each(data, function (index, item) { $WHCode.append("<option value='" + item.ID + "'>" + item.WarehouseName + "</option>"); }); } }); }
function submitForm() { debugger; if (!$('#form1').formValid()) { return false; } var WHCode = $("#sel_WHCode").val(); if (WHCode == '') { $.modalAlertNew("WMS00041"); return; } var SelectLevel = ''; var WHCodeID = $("#sel_WHCode").val(); var a = WHCodeID.split("|"); WHCodeID = a[1]; var Qu = $("#sel_QU").val(); var Pai = $("#sel_Pai").val(); var HuoJia = $("#sel_HuoJia").val(); var Ceng = $("#sel_Ceng").val(); var Ge = $("#sel_Ge").val(); if (WHCodeID!="") { SelectLevel += WHCodeID; } else if (Qu!="") { SelectLevel += SelectLevel + '-' + Qu; } else if (Pai!="") { SelectLevel += SelectLevel + '-' + Pai; } else if (HuoJia!="") { SelectLevel += SelectLevel + '-' + HuoJia; } else if (Ceng!="") { SelectLevel += SelectLevel + '-' + Ceng; } else if (Ge!="") { SelectLevel += SelectLevel + '-' + Ge; } var Details = []; var obj = { SelectLevel: SelectLevel, }; Details.push(obj);
var Header = { User: User, MTIME: Time, WorkPoint: WorkPoints, Detail: Details, } var Parameter = []; Parameter.push(Header);
$.submitForm({ url: "/WMS/Blitem/AddICSCheck?" + Math.random(), param: { Parameter: JSON.stringify(Parameter) }, success: function () { $.currentWindow().$("#gridList").trigger("reloadGrid"); } }) }
</script>
<form id="form1"> <div style="padding-top: 20px; margin-right: 20px;"> <table class="form"> <tr> <th class="formTitle" style="width:10px">仓库:</th> <td style="width:80px"> <select id="sel_WHCode" name="sel_WHCode" class="form-control select2" style="width:80px" ></select> </td>
<th class="formTitle" style="width:10px">区:</th> <td style="width:60px" id="Qu"> <select id="sel_QU" name="sel_QU" class="form-control select2" style="width: 45px;height:20px" > </select> </td> <th class="formTitle" style="width:10px">排:</th> <td style="width:60px" id="Pai"> <select id="sel_Pai" name="sel_Pai" class="form-control select2" style="width: 45px;height:20px" ></select> </td> <th class="formTitle" style="width:10px">货架:</th> <td style="width:60px" id="HuoJia"> <select id="sel_HuoJia" name="sel_HuoJia" class="form-control select2" style="width: 45px;height:20px"></select> </td> <th class="formTitle" style="width:10px">层:</th> <td style="width:60px" id="Ceng"> <select id="sel_Ceng" name="sel_Ceng" class="form-control select2" style="width: 45px;height:20px" ></select> </td> <th class="formTitle" style="width:10px">格:</th> <td style="width:60px" id="Ge"> <select id="sel_Ge" name="sel_Ge" class="form-control select2" style="width: 45px;height:20px" ></select> </td>
</tr> <tr> <th class="formTitle">维护人:</th> <td class="formValue"> <input id="txtMUSER" name="txtMUSER" type="text" class="form-control" style="width: 160px" /> </td> </tr> <tr> <th class="formTitle">维护日期:</th> <td class="formValue"> <input id="txtMTIME" name="txtMTIME" type="text" class="form-control " style="width: 160px"/> </td> </tr> </table> </div> </form>
|