纽威
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.

443 lines
17 KiB

  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 OverLoadLocationCode = $.request("OverLoadLocationCode");
  16. var LocationCode1 = OverLoadLocationCode.split(',')[0];
  17. var LocationCode2 = OverLoadLocationCode.split(',')[1];
  18. var WarehouseName = decodeURI($.request("WarehouseName"));
  19. var WarehouseArea = $.request("WarehouseArea");
  20. //var WarehouseName = decodeURI($.getUrlParam("WarehouseName"));
  21. var LocationCode = $.request("LocationCode");
  22. var LocationName = decodeURI($.request("LocationName"));
  23. //var expArrivalDate = $
  24. $(function () {
  25. debugger;
  26. InitControl();
  27. InitControl1();
  28. //InitControl2();
  29. if (ID != "") {
  30. //$("#sel_Warehouse").children('option:selected').val(WarehouseName)
  31. $("#sel_Warehouse").val([WarehouseName]).trigger("change");
  32. $("#LocationCode1").val(LocationCode1);
  33. $("#LocationCode2").val(LocationCode2);
  34. $("#WarehouseName").val(WarehouseName);
  35. $("#WarehouseArea").val(WarehouseArea);
  36. var s = LocationName;
  37. var str = LocationCode.split('-');
  38. for (var i = 1; i <= str.length; i++) {
  39. if (i == 1)
  40. $("#Qu").val(str[1]);
  41. if (i == 2)
  42. $("#Pai").val(str[2]);
  43. if (i == 3)
  44. $("#Jia").val(str[3]);
  45. if (i == 4)
  46. $("#Ceng").val(str[4]);
  47. if (i == 5)
  48. $("#Ge").val(str[5]);
  49. }
  50. }
  51. $("#sel_Warehouse").change(function () {
  52. debugger;
  53. var Was = $("#sel_Warehouse").children('option:selected').val();
  54. $("#WarehouseName").val(Was);
  55. //$("#WarehouseArea").val(Was);
  56. //var VenCode = $("#sel_VenCode").children('option:selected').val();
  57. });
  58. $("#sel_LocationCode1").change(function () {
  59. debugger;
  60. var Was = $("#sel_LocationCode1").children('option:selected').val();
  61. $("#sel_LocationCode1").val(Was);
  62. });
  63. $("#sel_LocationCode2").change(function () {
  64. debugger;
  65. var Was = $("#sel_LocationCode2").children('option:selected').val();
  66. $("#sel_LocationCode2").val(Was);
  67. });
  68. });
  69. $.getUrlParam = function (name) {
  70. var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)");
  71. var r = window.location.search.substr(1).match(reg);
  72. if (r != null) return unescape(r[2]); return null;
  73. }
  74. ;
  75. function InitControl() {
  76. debugger;
  77. var $VenCode = $("#sel_Warehouse");
  78. $VenCode.select2({
  79. allowClear: true,
  80. escapeMarkup: function (m) {
  81. return m;
  82. }
  83. });
  84. $.ajax({
  85. url: "/WMS/BasicSettings/GetWarehouse" + "?" + Math.random(),
  86. dataType: "json",
  87. async: false,
  88. success: function (data) {
  89. $.each(data, function (index, item) {
  90. $VenCode.append("<option value='" + item.WarehouseName + "'>" + item.WarehouseCode + "</option>");
  91. });
  92. }
  93. });
  94. }
  95. function InitControl1() {
  96. debugger;
  97. var $VenCode = $("#sel_LocationCode1");
  98. $VenCode.select2({
  99. allowClear: true,
  100. escapeMarkup: function (m) {
  101. return m;
  102. }
  103. });
  104. var $VenCode1 = $("#sel_LocationCode2");
  105. $VenCode1.select2({
  106. allowClear: true,
  107. escapeMarkup: function (m) {
  108. return m;
  109. }
  110. });
  111. $.ajax({
  112. url: "/WMS/BasicSettings/GetLocationCode" + "?" + Math.random(),
  113. dataType: "json",
  114. async: false,
  115. success: function (data) {
  116. $.each(data, function (index, item) {
  117. $VenCode.append("<option value='" + item.LocationCode + "'>" + item.LocationCode + "</option>");
  118. $VenCode1.append("<option value='" + item.LocationCode + "'>" + item.LocationCode + "</option>");
  119. });
  120. }
  121. });
  122. }
  123. function InitControl2() {
  124. debugger;
  125. var $VenCode = $("#sel_LocationCode2");
  126. $VenCode.select2({
  127. allowClear: true,
  128. escapeMarkup: function (m) {
  129. return m;
  130. }
  131. });
  132. $.ajax({
  133. url: "/WMS/BasicSettings/GetLocationCode" + "?" + Math.random(),
  134. dataType: "json",
  135. async: false,
  136. success: function (data) {
  137. $.each(data, function (index, item) {
  138. $VenCode.append("<option value='" + item.LocationCode + "'>" + item.LocationCode + "</option>");
  139. });
  140. }
  141. });
  142. }
  143. ////新增条码
  144. //function btnCreate() {
  145. // var STNO = $("#STNO").text();
  146. // Vendor = $("#sel_VenCode").find("option:selected").val();
  147. // if (STNO == "") {
  148. // $.modalAlertNew("WMS00059");
  149. // return;
  150. // }
  151. // var expArrivalDate = $("#ExpArivalDate").val();
  152. // if (expArrivalDate == '' || expArrivalDate == null) {
  153. // $.modalAlertNew("WMS00060");
  154. // return;
  155. // }
  156. // $.modalOpen2({
  157. // id: "Form",
  158. // title: "条码信息",
  159. // url: "/SRM/ASNSelect/Index?STNO=" + STNO + "&Vendor=" + Vendor + "&" + Math.random(),
  160. // width: "800px",
  161. // height: "500px",
  162. // callBack: function (iframeId) {
  163. // top.frames[iframeId].submitForm();
  164. // }
  165. // });
  166. //}
  167. ////新增箱号
  168. //function btnAddCartonNo() {
  169. // var STNO = $("#STNO").text();
  170. // Vendor = $("#sel_VenCode").find("option:selected").val();
  171. // if (STNO == "") {
  172. // $.modalAlertNew("WMS00059");
  173. // return;
  174. // }
  175. // var expArrivalDate = $("#ExpArivalDate").val();
  176. // if (expArrivalDate == '' || expArrivalDate == null) {
  177. // $.modalAlertNew("WMS00060");
  178. // return;
  179. // }
  180. // $.modalOpen2({
  181. // id: "Form",
  182. // title: "箱号信息",
  183. // url: "/SRM/ASNCartonSelect/Index?STNO=" + STNO + "&Vendor=" + Vendor + "&" + Math.random(),
  184. // width: "800px",
  185. // height: "500px",
  186. // callBack: function (iframeId) {
  187. // top.frames[iframeId].submitForm();
  188. // }
  189. // });
  190. //}
  191. //刷新
  192. function reloadData() {
  193. STNO = $("#STNO").text();
  194. var queryJson = {
  195. STNO: STNO,
  196. }
  197. $("#gridList").jqGrid('setGridParam', {
  198. postData: { queryJson: JSON.stringify(queryJson) },
  199. }).trigger('reloadGrid');
  200. }
  201. ////删除条码
  202. //function btn_delete() {
  203. // var objArr = "";
  204. // var objList = $("#gridList").jqGrid('getGridParam', 'selarrrow');
  205. // if (objList.length == 0) {
  206. // $.modalAlertNew("WMS00061");
  207. // return;
  208. // }
  209. // for (var i = 0; i < objList.length; i++) {
  210. // var rowId = objList[i];
  211. // var rowData = $("#gridList").jqGrid('getRowData', rowId);
  212. // objArr += "'" + rowData.ASNDETAILID + "',";
  213. // }
  214. // $.deleteForm({
  215. // url: "/SRM/ASNAdd/DeleteInfo" + "?" + Math.random(),
  216. // param: { keyValue: JSON.stringify(objArr) },
  217. // success: function () {
  218. // reloadData();
  219. // }
  220. // })
  221. //}
  222. //新增超托库位
  223. function submitForm() {
  224. debugger;
  225. var StackCode = "";
  226. var StackName = "";
  227. var Warehouse = "";
  228. var WarehouseName = "";
  229. var WarehouseArea = "";
  230. var Qu = $("#Qu").val();
  231. var Pai = $("#Pai").val();
  232. var Jia = $("#Jia").val();
  233. var Ceng = $("#Ceng").val();
  234. var Ge = $("#Ge").val();
  235. var OverLocationCode1 = $("#sel_LocationCode1").find("option:selected").text();
  236. var OverLocationCode2 = $("#sel_LocationCode2").find("option:selected").text();
  237. if (OverLocationCode1 == "")
  238. {
  239. OverLocationCode1 = LocationCode1;
  240. }
  241. if (OverLocationCode2 == "")
  242. {
  243. OverLocationCode2 = LocationCode2;
  244. }
  245. if (Qu == "" && Pai == "" && Jia == "" && Ceng == "" && Ge == "" ) {
  246. $.modalAlertNew("WMS00062");
  247. return;
  248. }
  249. if (cutStringToSecondOccurrence(OverLocationCode1, '-') != cutStringToSecondOccurrence(OverLocationCode2, '-')) {
  250. $.modalAlertNew("WMS00119");
  251. return;
  252. }
  253. var StackCode = $("#sel_Warehouse").find("option:selected").text();
  254. var StackName = $("#sel_Warehouse").find("option:selected").text() + "仓库";
  255. if (Qu!="") {
  256. StackCode = StackCode+"-" + Qu;
  257. StackName = StackName+Qu + "区域";
  258. }
  259. if (Pai!="") {
  260. StackCode += "-" + Pai;
  261. StackName += Pai + "区";
  262. }
  263. if (Jia!="") {
  264. StackCode += "-" + Jia;
  265. StackName += Jia + "货架";
  266. }
  267. if (Ceng!="") {
  268. StackCode += "-" + Ceng;
  269. StackName += Ceng + "层";
  270. }
  271. if (Ge!="") {
  272. StackCode += "-" + Ge;
  273. StackName += Ge + "列";
  274. }
  275. var objArr = {
  276. ID:ID,
  277. StackCode:StackCode,
  278. StackName: StackName,
  279. Qu: $("#Qu").val(),
  280. Pai: $("#Pai").val(),
  281. Jia: $("#Jia").val(),
  282. Ceng: $("#Ceng").val(),
  283. Ge: $("#Ge").val(),
  284. Warehouse: $("#sel_Warehouse").find("option:selected").text(),
  285. LocationCode1: OverLocationCode1,
  286. LocationCode2: OverLocationCode2,
  287. WarehouseName: $("#WarehouseName").val(),
  288. WarehouseArea: $("#WarehouseArea").val()
  289. }
  290. if (ID != "") {
  291. $.submitForm({
  292. url: "/WMS/BasicSettings/UpdateOverLoadStack" + "?" + Math.random(),
  293. param: { keyValue: JSON.stringify(objArr) },
  294. success: function () {
  295. $.currentWindow().$("#gridList").trigger("reloadGrid");
  296. }
  297. })
  298. } else {
  299. $.submitForm({
  300. url: "/WMS/BasicSettings/InsertOverLoadStack" + "?" + Math.random(),
  301. param: { keyValue: JSON.stringify(objArr) },
  302. success: function () {
  303. $.currentWindow().$("#gridList").trigger("reloadGrid");
  304. }
  305. })
  306. }
  307. //字符串截取方法,截取第二次特定字符之前的字符串
  308. function cutStringToSecondOccurrence(str, char) {
  309. let firstIndex = str.indexOf(char);
  310. // 如果未找到指定字符,则返回原字符串if (firstIndex == -l) return str;
  311. let secondIndex = str.indexOf(char, firstIndex + 1);
  312. if (secondIndex == -1)
  313. return str.substring(0, firstIndex); // 如果只找到一次指定字符
  314. return str.substring(0, secondIndex); // 返回截取到第二次出现指定字符的位置的字符串
  315. }
  316. }
  317. </script>
  318. <form id="form1">
  319. <div style="padding-top: 20px; margin-right: 20px;">
  320. <table class="form">
  321. <tr>
  322. <th class="formTitle">库房编号:</th>
  323. <td style="width:165px">
  324. <select id="sel_Warehouse" name="sel_Warehouse" class="form-control select2" style="width: 500px" placeholder="库房编号"></select>
  325. <input type="hidden" id="hidetext" />
  326. </td>
  327. </tr>
  328. <tr>
  329. <th class="formTitle">库房名称:</th>
  330. <td class="formValue">
  331. <input id="WarehouseName" name="WarehouseName" type="text" class="form-control required" style="width: 300px;" maxlength="10" onclick="WdatePicker({ dateFmt: 'yyyy-MM-dd' })" placeholder="库房名称" />
  332. </td>
  333. </tr>
  334. <tr>
  335. <th class="formTitle">&nbsp;窄巷道待入库区域:</th>
  336. <td class="formValue">
  337. <input id="WarehouseArea" name="WarehouseArea" type="text" class="form-control required" style="width: 300px;" maxlength="10" onclick="WdatePicker({ dateFmt: 'yyyy-MM-dd' })" placeholder="窄巷道待入库区域" />
  338. </td>
  339. </tr>
  340. <tr>
  341. <th class="formTitle">库位编号:</th>
  342. <td class="formValue">
  343. <input id="Qu" name="Qu" type="text" class="form-control required" style="width:150px;" maxlength="10" placeholder="区域" />
  344. </td>
  345. @*<td id="ISO">-</td>*@
  346. <td class="formValue">
  347. <input id="Pai" name="Pai" type="text" class="form-control required" style="width: 80px;" maxlength="10" placeholder="区" />
  348. </td>
  349. @*<td style="width:30px">-</td>*@
  350. <td class="formValue">
  351. <input id="Jia" name="Jia" type="text" class="form-control required" style="width: 80px;" maxlength="10" placeholder="货架" />
  352. </td>
  353. @*<td style="width:30px">-</td>*@
  354. <td class="formValue">
  355. <input id="Ceng" name="Ceng" type="text" class="form-control required" style="width: 80px;" maxlength="10" placeholder="层" />
  356. </td>
  357. @*<td style="width:30px">-</td>*@
  358. <td class="formValue">
  359. <input id="Ge" name="Ge" type="text" class="form-control required" style="width: 80px;" maxlength="10" placeholder="列" />
  360. </td>
  361. </tr>
  362. <tr>
  363. <th class="formTitle">库位1:</th>
  364. <td class="formValue">
  365. <input id="LocationCode1" name="LocationCode1" type="text" class="form-control required" style="width: 150px; " maxlength="10" onclick="WdatePicker({ dateFmt: 'yyyy-MM-dd' })" disabled="disabled" />
  366. </td>
  367. </tr>
  368. <tr>
  369. <td ></td>
  370. <td class="formValue">
  371. <select id="sel_LocationCode1" name="sel_LocationCode1" class="form-control select2" placeholder="库位1"></select>
  372. <input type="hidden" id="hidetext" />
  373. </td>
  374. </tr>
  375. <tr>
  376. <th class="formTitle">库位2:</th>
  377. <td class="formValue">
  378. <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" />
  379. </td>
  380. </tr>
  381. <tr>
  382. <td></td>
  383. <td class="formValue">
  384. <select id="sel_LocationCode2" name="sel_LocationCode2" class="form-control select2" style="width: 500px" placeholder="库位2"></select>
  385. <input type="hidden" id="hidetext" />
  386. </td>
  387. </tr>
  388. <!--<tr>
  389. <th class="formTitle">库位2编号:</th>
  390. <td class="formValue">
  391. <input id="Qu1" name="Qu1" type="text" class="form-control required" style="width:80px;" maxlength="10" placeholder="区域" />
  392. </td>-->
  393. @*<td id="ISO">-</td>*@
  394. <!--<td class="formValue">
  395. <input id="Pai1" name="Pai1" type="text" class="form-control required" style="width: 80px;" maxlength="10" placeholder="区" />
  396. </td>-->
  397. @*<td style="width:30px">-</td>*@
  398. <!--<td class="formValue">
  399. <input id="Jia1" name="Jia1" type="text" class="form-control required" style="width: 80px;" maxlength="10" placeholder="货架" />
  400. </td>-->
  401. @*<td style="width:30px">-</td>*@
  402. <!--<td class="formValue">
  403. <input id="Ceng1" name="Ceng1" type="text" class="form-control required" style="width: 80px;" maxlength="10" placeholder="层" />
  404. </td>-->
  405. @*<td style="width:30px">-</td>*@
  406. <!--<td class="formValue">
  407. <input id="Ge1" name="Ge1" type="text" class="form-control required" style="width: 80px;" maxlength="10" placeholder="列" />
  408. </td>
  409. </tr>-->
  410. @*<tr>
  411. <th class="formTitle">格式:</th>
  412. <td class="formValue">
  413. <span>&nbsp;区域</span>
  414. </td>
  415. <td class="formValue">
  416. <span>&nbsp;区</span>
  417. </td>
  418. <td class="formValue">
  419. <span>&nbsp;货架</span>
  420. </td>
  421. <td class="formValue">
  422. <span>&nbsp;层</span>
  423. </td>
  424. <td class="formValue">
  425. <span>&nbsp;列</span>
  426. </td>
  427. </tr>*@
  428. </table>
  429. </div>
  430. </form>