You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

215 lines
7.8 KiB

3 weeks ago
  1. @{
  2. ViewBag.Title = "Index";
  3. Layout = "~/Views/Shared/_Index.cshtml";
  4. }
  5. <style>
  6. #ISO {
  7. width: 10px;
  8. }
  9. </style>
  10. <link href="~/Content/js/select2/select2.min.css" rel="stylesheet" />
  11. <script src="~/Content/js/select2/select2.min.js"></script>
  12. <script>
  13. var ID = $.request("ID");
  14. var Warehouse = $.request("Warehouse");
  15. var WarehouseName = decodeURI($.request("WarehouseName"));
  16. //var WarehouseName = decodeURI($.getUrlParam("WarehouseName"));
  17. var LocationCode = $.request("LocationCode");
  18. var LocationName = decodeURI($.request("LocationName"));
  19. //var expArrivalDate = $
  20. $(function () {
  21. debugger;
  22. InitControl();
  23. if (ID != "") {
  24. //$("#sel_Warehouse").children('option:selected').val(WarehouseName)
  25. $("#sel_Warehouse").val([WarehouseName]).trigger("change");
  26. $("#WarehouseName").val(WarehouseName);
  27. var s = LocationName;
  28. var str = LocationCode.split('-');
  29. for (var i = 1; i <= str.length; i++) {
  30. if (i == 1)
  31. $("#Qu").val(str[1]);
  32. if (i == 2)
  33. $("#Pai").val(str[2]);
  34. if (i == 3)
  35. $("#Jia").val(str[3]);
  36. if (i == 4)
  37. $("#Ceng").val(str[4]);
  38. if (i == 5)
  39. $("#Ge").val(str[5]);
  40. }
  41. }
  42. $("#sel_Warehouse").change(function () {
  43. debugger;
  44. var Was = $("#sel_Warehouse").children('option:selected').val();
  45. $("#WarehouseName").val(Was);
  46. //var VenCode = $("#sel_VenCode").children('option:selected').val();
  47. });
  48. });
  49. $.getUrlParam = function (name) {
  50. var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)");
  51. var r = window.location.search.substr(1).match(reg);
  52. if (r != null) return unescape(r[2]); return null;
  53. }
  54. ;
  55. function InitControl() {
  56. debugger;
  57. var $VenCode = $("#sel_Warehouse");
  58. $VenCode.select2({
  59. allowClear: true,
  60. escapeMarkup: function (m) {
  61. return m;
  62. }
  63. });
  64. $.ajax({
  65. url: "/PNWMS/BasicSettings/GetWarehouse" + "?" + Math.random(),
  66. dataType: "json",
  67. async: false,
  68. success: function (data) {
  69. $.each(data, function (index, item) {
  70. $VenCode.append("<option value='" + item.WarehouseName + "'>" + item.WarehouseCode + "</option>");
  71. });
  72. }
  73. });
  74. }
  75. //新增库位
  76. function submitForm() {
  77. debugger;
  78. var StackCode = "";
  79. var StackName = "";
  80. var Warehouse = "";
  81. var WarehouseName = "";
  82. var Qu = $("#Qu").val();
  83. var Pai = $("#Pai").val();
  84. var Jia = $("#Jia").val();
  85. var Ceng = $("#Ceng").val();
  86. var Ge = $("#Ge").val();
  87. if (Qu == "" && Pai == "" && Jia == "" && Ceng == "" && Ge == "") {
  88. $.modalAlertNew("WMS00062");
  89. return;
  90. }
  91. StackCode = $("#sel_Warehouse").find("option:selected").text();
  92. StackName = $("#sel_Warehouse").find("option:selected").text() + "仓库";
  93. if (Qu != "") {
  94. StackCode += Qu;
  95. // StackCode += "-" + Qu;
  96. StackName += Qu + "区";
  97. }
  98. if (Pai != "") {
  99. StackCode += Pai;
  100. // StackCode += "-" + Pai;
  101. StackName += Pai + "排";
  102. }
  103. if (Jia != "") {
  104. StackCode +=Jia;
  105. // StackCode += "-" + Jia;
  106. StackName += Jia + "货架";
  107. }
  108. if (Ceng != "") {
  109. StackCode += Ceng;
  110. // StackCode += "-" + Ceng;
  111. StackName += Ceng + "层";
  112. }
  113. if (Ge != "") {
  114. StackCode += Ge;
  115. // StackCode += "-" + Ge;
  116. StackName += Ge + "格";
  117. }
  118. var objArr = {
  119. ID:ID,
  120. StackCode:StackCode,
  121. StackName: StackName,
  122. Qu : $("#Qu").val(),
  123. Pai : $("#Pai").val(),
  124. Jia : $("#Jia").val(),
  125. Ceng : $("#Ceng").val(),
  126. Ge : $("#Ge").val(),
  127. Warehouse:$("#sel_Warehouse").find("option:selected").text(),
  128. WarehouseName:$("#WarehouseName").val()
  129. }
  130. if (ID != "") {
  131. $.submitForm({
  132. url: "/PNWMS/BasicSettings/UpdateStack" + "?" + Math.random(),
  133. param: { keyValue: JSON.stringify(objArr) },
  134. success: function () {
  135. $.currentWindow().$("#gridList").trigger("reloadGrid");
  136. }
  137. })
  138. } else {
  139. $.submitForm({
  140. url: "/PNWMS/BasicSettings/InsertStack" + "?" + Math.random(),
  141. param: { keyValue: JSON.stringify(objArr) },
  142. success: function () {
  143. $.currentWindow().$("#gridList").trigger("reloadGrid");
  144. }
  145. })
  146. }
  147. }
  148. </script>
  149. <form id="form1">
  150. <div style="padding-top: 20px; margin-right: 20px;">
  151. <table class="form">
  152. <tr>
  153. <th class="formTitle">库房编号:</th>
  154. <td style="width:100px">
  155. <select id="sel_Warehouse" name="sel_Warehouse" class="form-control select2" style="width: 500px" placeholder="库房编号"></select>
  156. <input type="hidden" id="hidetext" />
  157. </td>
  158. </tr>
  159. <tr>
  160. <th class="formTitle">库房名称:</th>
  161. <td class="formValue">
  162. <input id="WarehouseName" name="WarehouseName" type="text" class="form-control required" style="width: 300px;" maxlength="10" onclick="WdatePicker({ dateFmt: 'yyyy-MM-dd' })" placeholder="库房名称" />
  163. </td>
  164. </tr>
  165. <tr>
  166. <th class="formTitle">库位编号:</th>
  167. <td class="formValue">
  168. <input id="Qu" name="Qu" type="text" class="form-control required" style="width:80px;" maxlength="10" placeholder="仓库编码" />
  169. </td>
  170. @*<td id="ISO">-</td>*@
  171. <td class="formValue">
  172. <input id="Pai" name="Pai" type="text" class="form-control required" style="width: 80px;" maxlength="10" placeholder="库区编码" />
  173. </td>
  174. @*<td style="width:30px">-</td>*@
  175. <td class="formValue">
  176. <input id="Jia" name="Jia" type="text" class="form-control required" style="width: 80px;" maxlength="10" placeholder="货架编码" />
  177. </td>
  178. @*<td style="width:30px">-</td>*@
  179. <td class="formValue">
  180. <input id="Ceng" name="Ceng" type="text" class="form-control required" style="width: 80px;" maxlength="10" placeholder="层编码" />
  181. </td>
  182. @*<td style="width:30px">-</td>*@
  183. <td class="formValue" style="display:none">
  184. <input id="Ge" name="Ge" type="text" class="form-control required" style="width: 80px;" maxlength="10" placeholder="格" />
  185. </td>
  186. </tr>
  187. <tr>
  188. <th class="formTitle">格式:</th>
  189. <td class="formValue">
  190. <span>&nbsp;区</span>
  191. </td>
  192. <td class="formValue">
  193. <span>&nbsp;排</span>
  194. </td>
  195. <td class="formValue">
  196. <span>&nbsp;货架</span>
  197. </td>
  198. <td class="formValue">
  199. <span>&nbsp;层</span>
  200. </td>
  201. <td class="formValue">
  202. <span>&nbsp;格</span>
  203. </td>
  204. </tr>
  205. </table>
  206. </div>
  207. </form>