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

282 lines
10 KiB

3 years 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: "/WMS/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 btnCreate() {
  77. var STNO = $("#STNO").text();
  78. Vendor = $("#sel_VenCode").find("option:selected").val();
  79. if (STNO == "") {
  80. $.modalAlert("请先选择供应商!");
  81. return;
  82. }
  83. var expArrivalDate = $("#ExpArivalDate").val();
  84. if (expArrivalDate == '' || expArrivalDate == null) {
  85. $.modalAlert("请先选择预计到货时间!");
  86. return;
  87. }
  88. $.modalOpen2({
  89. id: "Form",
  90. title: "条码信息",
  91. url: "/SRM/ASNSelect/Index?STNO=" + STNO + "&Vendor=" + Vendor + "&" + Math.random(),
  92. width: "800px",
  93. height: "500px",
  94. callBack: function (iframeId) {
  95. top.frames[iframeId].submitForm();
  96. }
  97. });
  98. }
  99. //新增箱号
  100. function btnAddCartonNo() {
  101. var STNO = $("#STNO").text();
  102. Vendor = $("#sel_VenCode").find("option:selected").val();
  103. if (STNO == "") {
  104. $.modalAlert("请先选择供应商!");
  105. return;
  106. }
  107. var expArrivalDate = $("#ExpArivalDate").val();
  108. if (expArrivalDate == '' || expArrivalDate == null) {
  109. $.modalAlert("请先选择预计到货时间!");
  110. return;
  111. }
  112. $.modalOpen2({
  113. id: "Form",
  114. title: "箱号信息",
  115. url: "/SRM/ASNCartonSelect/Index?STNO=" + STNO + "&Vendor=" + Vendor + "&" + Math.random(),
  116. width: "800px",
  117. height: "500px",
  118. callBack: function (iframeId) {
  119. top.frames[iframeId].submitForm();
  120. }
  121. });
  122. }
  123. //刷新
  124. function reloadData() {
  125. STNO = $("#STNO").text();
  126. var queryJson = {
  127. STNO: STNO,
  128. }
  129. $("#gridList").jqGrid('setGridParam', {
  130. postData: { queryJson: JSON.stringify(queryJson) },
  131. }).trigger('reloadGrid');
  132. }
  133. //删除条码
  134. function btn_delete() {
  135. var objArr = "";
  136. var objList = $("#gridList").jqGrid('getGridParam', 'selarrrow');
  137. if (objList.length == 0) {
  138. $.modalAlert("请选择要删除的数据!");
  139. return;
  140. }
  141. for (var i = 0; i < objList.length; i++) {
  142. var rowId = objList[i];
  143. var rowData = $("#gridList").jqGrid('getRowData', rowId);
  144. objArr += "'" + rowData.ASNDETAILID + "',";
  145. }
  146. $.deleteForm({
  147. url: "/SRM/ASNAdd/DeleteInfo" + "?" + Math.random(),
  148. param: { keyValue: JSON.stringify(objArr) },
  149. success: function () {
  150. reloadData();
  151. }
  152. })
  153. }
  154. //新增库位
  155. function submitForm() {
  156. debugger;
  157. var StackCode = "";
  158. var StackName = "";
  159. var Warehouse = "";
  160. var WarehouseName = "";
  161. var Qu = $("#Qu").val();
  162. var Pai = $("#Pai").val();
  163. var Jia = $("#Jia").val();
  164. var Ceng = $("#Ceng").val();
  165. var Ge = $("#Ge").val();
  166. if (Qu == "" && Pai == "" && Jia == "" && Ceng == "" && Ge == "") {
  167. $.modalAlert("请输入库位编码!");
  168. return;
  169. }
  170. StackCode = $("#sel_Warehouse").find("option:selected").text();
  171. StackName = $("#sel_Warehouse").find("option:selected").text() + "仓库";
  172. if (Qu!="") {
  173. StackCode += "-" + Qu;
  174. StackName += Qu + "区";
  175. }
  176. if (Pai!="") {
  177. StackCode += "-" + Pai;
  178. StackName += Pai + "排";
  179. }
  180. if (Jia!="") {
  181. StackCode += "-" + Jia;
  182. StackName += Jia + "货架";
  183. }
  184. if (Ceng!="") {
  185. StackCode += "-" + Ceng;
  186. StackName += Ceng + "层";
  187. }
  188. if (Ge!="") {
  189. StackCode += "-" + Ge;
  190. StackName += Ge + "格";
  191. }
  192. var objArr = {
  193. ID:ID,
  194. StackCode:StackCode,
  195. StackName:StackName,
  196. Warehouse:$("#sel_Warehouse").find("option:selected").text(),
  197. WarehouseName:$("#WarehouseName").val()
  198. }
  199. if (ID != "") {
  200. $.submitForm({
  201. url: "/WMS/BasicSettings/UpdateStack" + "?" + Math.random(),
  202. param: { keyValue: JSON.stringify(objArr) },
  203. success: function () {
  204. $.currentWindow().$("#gridList").trigger("reloadGrid");
  205. }
  206. })
  207. } else {
  208. $.submitForm({
  209. url: "/WMS/BasicSettings/InsertStack" + "?" + Math.random(),
  210. param: { keyValue: JSON.stringify(objArr) },
  211. success: function () {
  212. $.currentWindow().$("#gridList").trigger("reloadGrid");
  213. }
  214. })
  215. }
  216. }
  217. </script>
  218. <form id="form1">
  219. <div style="padding-top: 20px; margin-right: 20px;">
  220. <table class="form">
  221. <tr>
  222. <th class="formTitle">库房编号:</th>
  223. <td style="width:100px">
  224. <select id="sel_Warehouse" name="sel_Warehouse" class="form-control select2" style="width: 500px" placeholder="库房编号"></select>
  225. <input type="hidden" id="hidetext" />
  226. </td>
  227. </tr>
  228. <tr>
  229. <th class="formTitle">库房名称:</th>
  230. <td class="formValue">
  231. <input id="WarehouseName" name="WarehouseName" type="text" class="form-control required" style="width: 300px;" maxlength="10" onclick="WdatePicker({ dateFmt: 'yyyy-MM-dd' })" placeholder="库房名称" />
  232. </td>
  233. </tr>
  234. <tr>
  235. <th class="formTitle">库位编号:</th>
  236. <td class="formValue">
  237. <input id="Qu" name="Qu" type="text" class="form-control required" style="width:80px;" maxlength="10" placeholder="区" />
  238. </td>
  239. @*<td id="ISO">-</td>*@
  240. <td class="formValue">
  241. <input id="Pai" name="Pai" type="text" class="form-control required" style="width: 80px;" maxlength="10" placeholder="排" />
  242. </td>
  243. @*<td style="width:30px">-</td>*@
  244. <td class="formValue">
  245. <input id="Jia" name="Jia" type="text" class="form-control required" style="width: 80px;" maxlength="10" placeholder="货架" />
  246. </td>
  247. @*<td style="width:30px">-</td>*@
  248. <td class="formValue">
  249. <input id="Ceng" name="Ceng" type="text" class="form-control required" style="width: 80px;" maxlength="10" placeholder="层" />
  250. </td>
  251. @*<td style="width:30px">-</td>*@
  252. <td class="formValue">
  253. <input id="Ge" name="Ge" type="text" class="form-control required" style="width: 80px;" maxlength="10" placeholder="格" />
  254. </td>
  255. </tr>
  256. <tr>
  257. <th class="formTitle">格式:</th>
  258. <td class="formValue">
  259. <span>&nbsp;区</span>
  260. </td>
  261. <td class="formValue">
  262. <span>&nbsp;排</span>
  263. </td>
  264. <td class="formValue">
  265. <span>&nbsp;货架</span>
  266. </td>
  267. <td class="formValue">
  268. <span>&nbsp;层</span>
  269. </td>
  270. <td class="formValue">
  271. <span>&nbsp;格</span>
  272. </td>
  273. </tr>
  274. </table>
  275. </div>
  276. </form>