Index.js 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322
  1. var refreshGirdData;
  2. var logbegin = '';
  3. var logend = '';
  4. var StartTimeBegin = '';
  5. var StartTimeend = '';
  6. var EndTimeBegin = '';
  7. var EndTimeend = '';
  8. var bootstrap = function ($, learun) {
  9. "use strict";
  10. var page = {
  11. init: function () {
  12. //page.initGird();
  13. page.bind();
  14. },
  15. bind: function () {
  16. $('#multiple_condition_query').lrMultipleQuery(function (queryJson) {
  17. // 调用后台查询
  18. // queryJson 查询条件
  19. }, 250);
  20. $('#InvStateCode').lrselect({
  21. url: top.$.rootUrl + '/HJManager/Enums/GetInvStateList',
  22. maxHeight: 180,
  23. allowSearch: false
  24. });
  25. $('#Status').lrselect({
  26. url: top.$.rootUrl + '/HJManager/Enums/GetLocationStateList',
  27. maxHeight: 180,
  28. allowSearch: false
  29. });
  30. //强制取消任务按钮
  31. $('#lr_cancel').on('click', function () {
  32. var TaskNo = $('#TaskNo').val().replace(/^[' ' || ' ']*/, '').replace(/[' ' | ' ']*$/, '');
  33. if (TaskNo.length == 0) {
  34. learun.alert.error('任务号不能为空!');
  35. return false;
  36. }
  37. var url = weburl + "api/Hj/ForceCancelTask";
  38. learun.layerConfirm('是否强制取消任务!', function (res) {
  39. if (res) {
  40. $.ajax({
  41. type: 'post',
  42. //data: { location: postData.map((item) => item.Id) },
  43. data: JSON.stringify({
  44. "TaskNo": TaskNo
  45. }),
  46. dataType: 'json',
  47. contentType: "application/json;charset=utf-8",
  48. url: url,
  49. success: function (response) {
  50. //resCode 200 resMsg "成功"
  51. refreshGirdData();
  52. top.layer.close(top.layer.index);
  53. learun.alert.info(response.resMsg);
  54. }
  55. });
  56. }
  57. });
  58. });
  59. //删除组盘信息
  60. $('#stock_delete').on('click', function () {
  61. var BarCode = $('#BarCode').val().replace(/^[' ' || ' ']*/, '').replace(/[' ' | ' ']*$/, '');
  62. if (BarCode.length == 0) {
  63. learun.alert.error('工字轮条码不能为空!');
  64. return false;
  65. }
  66. var url = weburl + "api/Hj/DeleteStockInfo";
  67. learun.layerConfirm('是否删除库存信息!', function (res) {
  68. if (res) {
  69. $.ajax({
  70. type: 'post',
  71. //data: { location: postData.map((item) => item.Id) },
  72. data: JSON.stringify({
  73. "Code": BarCode
  74. }),
  75. dataType: 'json',
  76. contentType: "application/json;charset=utf-8",
  77. url: url,
  78. success: function (response) {
  79. //resCode 200 resMsg "成功"
  80. refreshGirdData();
  81. top.layer.close(top.layer.index);
  82. learun.alert.info(response.resMsg);
  83. }
  84. });
  85. }
  86. });
  87. });
  88. //修改库存状态信息
  89. $('#Update_StockState').on('click', function () {
  90. var Code = $('#Code').val().replace(/^[' ' || ' ']*/, '').replace(/[' ' | ' ']*$/, '');
  91. var InvStateCode = $("#InvStateCode").lrselectGet();
  92. if (Code.length == 0) {
  93. learun.alert.error('工字轮条码不能为空!');
  94. return false;
  95. }
  96. var url = weburl + "api/Hj/UpdateStockState";
  97. learun.layerConfirm('是否确定修改库存状态!', function (res) {
  98. if (res) {
  99. $.ajax({
  100. type: 'post',
  101. //data: { location: postData.map((item) => item.Id) },
  102. data: JSON.stringify({
  103. "Code": Code,
  104. "State": InvStateCode
  105. }),
  106. dataType: 'json',
  107. contentType: "application/json;charset=utf-8",
  108. url: url,
  109. success: function (response) {
  110. //resCode 200 resMsg "成功"
  111. refreshGirdData();
  112. top.layer.close(top.layer.index);
  113. learun.alert.info(response.resMsg);
  114. }
  115. });
  116. }
  117. });
  118. });
  119. //修改货位状态
  120. $('#Update_CellState').on('click', function () {
  121. var CellCode = $('#CellCode').val().replace(/^[' ' || ' ']*/, '').replace(/[' ' | ' ']*$/, '');
  122. var Status = $("#Status").lrselectGet();
  123. if (CellCode.length == 0) {
  124. learun.alert.error('货位编码不能为空!');
  125. return false;
  126. }
  127. var url = weburl + "api/Hj/UpdateCellState";
  128. learun.layerConfirm('是否确定修改货位状态!', function (res) {
  129. if (res) {
  130. $.ajax({
  131. type: 'post',
  132. //data: { location: postData.map((item) => item.Id) },
  133. data: JSON.stringify({
  134. "Code": CellCode,
  135. "State": Status
  136. }),
  137. dataType: 'json',
  138. contentType: "application/json;charset=utf-8",
  139. url: url,
  140. success: function (response) {
  141. //resCode 200 resMsg "成功"
  142. refreshGirdData();
  143. top.layer.close(top.layer.index);
  144. learun.alert.info(response.resMsg);
  145. }
  146. });
  147. }
  148. });
  149. });
  150. //货位数据互换
  151. $('#CellDataSwap').on('click', function () {
  152. var CellFrom = $('#CellFrom').val().replace(/^[' ' || ' ']*/, '').replace(/[' ' | ' ']*$/, '');
  153. var CellTo = $('#CellTo').val().replace(/^[' ' || ' ']*/, '').replace(/[' ' | ' ']*$/, '');
  154. if (CellFrom.length == 0) {
  155. learun.alert.error('起始货位不能为空!');
  156. return false;
  157. }
  158. if (CellTo.length == 0) {
  159. learun.alert.error('目标货位不能为空!');
  160. return false;
  161. }
  162. var url = weburl + "api/Hj/DataSwapCell";
  163. learun.layerConfirm('是否确定互换数据!', function (res) {
  164. if (res) {
  165. $.ajax({
  166. type: 'post',
  167. //data: { location: postData.map((item) => item.Id) },
  168. data: JSON.stringify({
  169. "StatEquip": CellFrom,
  170. "EndEquip": CellTo
  171. }),
  172. dataType: 'json',
  173. contentType: "application/json;charset=utf-8",
  174. url: url,
  175. success: function (response) {
  176. //resCode 200 resMsg "成功"
  177. refreshGirdData();
  178. top.layer.close(top.layer.index);
  179. learun.alert.info(response.resMsg);
  180. }
  181. });
  182. }
  183. });
  184. });
  185. //补空轮库存
  186. $('#btnSaveEmptyStock').on('click', function () {
  187. var txtConBarcode = $('#txtConBarcode').val().replace(/^[' ' || ' ']*/, '').replace(/[' ' | ' ']*$/, '');
  188. var txtCellCode = $('#txtCellCode').val().replace(/^[' ' || ' ']*/, '').replace(/[' ' | ' ']*$/, '');
  189. if (txtConBarcode.length == 0) {
  190. learun.alert.error('工字轮号不能为空!');
  191. return false;
  192. }
  193. if (txtCellCode.length == 0) {
  194. learun.alert.error('目标货位不能为空!');
  195. return false;
  196. }
  197. var url = weburl + "api/Hj/DataBasePatch";
  198. learun.layerConfirm('是否确定提交!', function (res) {
  199. if (res) {
  200. $.ajax({
  201. type: 'post',
  202. //data: { location: postData.map((item) => item.Id) },
  203. data: JSON.stringify({
  204. "Code": txtConBarcode,
  205. "Cell": txtCellCode,
  206. "ContGrpType": 2
  207. }),
  208. dataType: 'json',
  209. contentType: "application/json;charset=utf-8",
  210. url: url,
  211. success: function (response) {
  212. //resCode 200 resMsg "成功"
  213. refreshGirdData();
  214. top.layer.close(top.layer.index);
  215. learun.alert.info(response.resMsg);
  216. }
  217. });
  218. }
  219. });
  220. });
  221. //库存转移
  222. $('#btnSaveStockTrans').on('click', function () {
  223. var txtStartCell = $('#txtStartCell').val().replace(/^[' ' || ' ']*/, '').replace(/[' ' | ' ']*$/, '');
  224. var txtEndCell = $('#txtEndCell').val().replace(/^[' ' || ' ']*/, '').replace(/[' ' | ' ']*$/, '');
  225. if (txtStartCell.length == 0) {
  226. learun.alert.error('起始货位不能为空!');
  227. return false;
  228. }
  229. if (txtEndCell.length == 0) {
  230. learun.alert.error('目标货位不能为空!');
  231. return false;
  232. }
  233. var url = weburl + "api/Hj/TransStock";
  234. learun.layerConfirm('是否确定提交!', function (res) {
  235. if (res) {
  236. $.ajax({
  237. type: 'post',
  238. //data: { location: postData.map((item) => item.Id) },
  239. data: JSON.stringify({
  240. "StatEquip": txtStartCell,
  241. "EndEquip": txtEndCell
  242. }),
  243. dataType: 'json',
  244. contentType: "application/json;charset=utf-8",
  245. url: url,
  246. success: function (response) {
  247. //resCode 200 resMsg "成功"
  248. refreshGirdData();
  249. top.layer.close(top.layer.index);
  250. learun.alert.info(response.resMsg);
  251. }
  252. });
  253. }
  254. });
  255. });
  256. $('#btnwmstask').on('click', function () {
  257. var wmstaskNo = $('#wmstasknum').val().replace(/^[' ' || ' ']*/, '').replace(/[' ' | ' ']*$/, '');
  258. if (wmstaskNo.length == 0) {
  259. learun.alert.error('WMS任务号不能为空!');
  260. return false;
  261. }
  262. var url = weburl + "api/Hj/CompleteTask";
  263. learun.layerConfirm('是否确定完成WMS任务!', function (res,index) {
  264. if (res) {
  265. $.ajax({
  266. type: 'post',
  267. //data: { location: postData.map((item) => item.Id) },
  268. data: JSON.stringify({
  269. "taskNum": parseInt(wmstaskNo),
  270. "operationType": 2,
  271. "wcsUpdateName": "1",
  272. "memo1": "",
  273. "memo2": ""
  274. }),
  275. dataType: 'json',
  276. contentType: "application/json;charset=utf-8",
  277. url: url,
  278. success: function (response) {
  279. //resCode 200 resMsg "成功"
  280. //refreshGirdData();
  281. top.layer.close(index);
  282. learun.alert.info(response.resMsg);
  283. }
  284. });
  285. }
  286. });
  287. });
  288. },
  289. search: function (param) {
  290. $('#gridtable').jfGridSet('reload', param);
  291. }
  292. };
  293. refreshGirdData = function () {
  294. $('#gridtable').jfGridSet('reload');
  295. };
  296. page.init();
  297. }