Index.js 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360
  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 + '/SXManager/Enums/GetInvStateList',
  22. maxHeight: 180,
  23. allowSearch: false
  24. });
  25. $('#Status').lrselect({
  26. url: top.$.rootUrl + '/SXManager/Enums/GetLocationStateList',
  27. maxHeight: 180,
  28. allowSearch: false
  29. });
  30. $('#TaskStatus').lrselect({
  31. url: top.$.rootUrl + '/SXManager/Enums/GetTaskStatusList',
  32. maxHeight: 180,
  33. allowSearch: false
  34. });
  35. //
  36. $('#lr_taskstatus').on('click', function () {
  37. var TaskNo = $('#TaskNo').val().replace(/^[' ' || ' ']*/, '').replace(/[' ' | ' ']*$/, '');
  38. if (TaskNo.length == 0) {
  39. learun.alert.error('任务号不能为空!');
  40. return false;
  41. }
  42. var status = $("#TaskStatus").lrselectGet();
  43. if (status.length == 0) {
  44. learun.alert.error('任务状态不能为空!');
  45. return false;
  46. }
  47. var url = weburl + "api/Sx/UpdateTaskState";
  48. learun.layerConfirm('是否修改任务状态!', function (res,index) {
  49. if (res) {
  50. $.ajax({
  51. type: 'post',
  52. //data: { location: postData.map((item) => item.Id) },
  53. data: JSON.stringify({
  54. "TaskNo": TaskNo,
  55. "Status": status
  56. }),
  57. dataType: 'json',
  58. contentType: "application/json;charset=utf-8",
  59. url: url,
  60. success: function (response) {
  61. //resCode 200 resMsg "成功"
  62. top.layer.close(index);
  63. learun.alert.info(response.resMsg);
  64. }
  65. });
  66. }
  67. });
  68. });
  69. //强制取消任务按钮
  70. $('#lr_cancel').on('click', function () {
  71. let CancelTaskNo = $('#CancelTaskNo').val().replace(/^[' ' || ' ']*/, '').replace(/[' ' | ' ']*$/, '');
  72. if (CancelTaskNo.length == 0) {
  73. learun.alert.error('任务号不能为空!');
  74. return false;
  75. }
  76. var url = weburl + "api/Sx/ForceCancelTask";
  77. learun.layerConfirm('是否强制取消任务!', function (res) {
  78. if (res) {
  79. $.ajax({
  80. type: 'post',
  81. //data: { location: postData.map((item) => item.Id) },
  82. data: JSON.stringify({
  83. "TaskNo": CancelTaskNo,
  84. "WareHouse": 'sxhouse'
  85. }),
  86. dataType: 'json',
  87. contentType: "application/json;charset=utf-8",
  88. url: url,
  89. success: function (response) {
  90. //resCode 200 resMsg "成功"
  91. refreshGirdData();
  92. top.layer.close(top.layer.index);
  93. learun.alert.info(response.resMsg);
  94. }
  95. });
  96. }
  97. });
  98. });
  99. //删除组盘信息
  100. $('#stock_delete').on('click', function () {
  101. var BarCode = $('#BarCode').val().replace(/^[' ' || ' ']*/, '').replace(/[' ' | ' ']*$/, '');
  102. if (BarCode.length == 0) {
  103. learun.alert.error('工字轮条码不能为空!');
  104. return false;
  105. }
  106. var url = weburl + "api/Sx/DeleteStockInfo";
  107. learun.layerConfirm('是否删除库存信息!', function (res) {
  108. if (res) {
  109. $.ajax({
  110. type: 'post',
  111. //data: { location: postData.map((item) => item.Id) },
  112. data: JSON.stringify({
  113. "Code": BarCode,
  114. "WareHouse": 'sxhouse'
  115. }),
  116. dataType: 'json',
  117. contentType: "application/json;charset=utf-8",
  118. url: url,
  119. success: function (response) {
  120. //resCode 200 resMsg "成功"
  121. refreshGirdData();
  122. top.layer.close(top.layer.index);
  123. learun.alert.info(response.resMsg);
  124. }
  125. });
  126. }
  127. });
  128. });
  129. //修改库存状态信息
  130. $('#Update_StockState').on('click', function () {
  131. var Code = $('#Code').val().replace(/^[' ' || ' ']*/, '').replace(/[' ' | ' ']*$/, '');
  132. var InvStateCode = $("#InvStateCode").lrselectGet();
  133. if (Code.length == 0) {
  134. learun.alert.error('工字轮条码不能为空!');
  135. return false;
  136. }
  137. var url = weburl + "api/Sx/UpdateStockState";
  138. learun.layerConfirm('是否确定修改库存状态!', function (res) {
  139. if (res) {
  140. $.ajax({
  141. type: 'post',
  142. //data: { location: postData.map((item) => item.Id) },
  143. data: JSON.stringify({
  144. "Code": Code,
  145. "State": InvStateCode,
  146. "WareHouse": 'sxhouse'
  147. }),
  148. dataType: 'json',
  149. contentType: "application/json;charset=utf-8",
  150. url: url,
  151. success: function (response) {
  152. //resCode 200 resMsg "成功"
  153. refreshGirdData();
  154. top.layer.close(top.layer.index);
  155. learun.alert.info(response.resMsg);
  156. }
  157. });
  158. }
  159. });
  160. });
  161. //修改货位状态
  162. $('#Update_CellState').on('click', function () {
  163. var CellCode = $('#CellCode').val().replace(/^[' ' || ' ']*/, '').replace(/[' ' | ' ']*$/, '');
  164. var Status = $("#Status").lrselectGet();
  165. if (CellCode.length == 0) {
  166. learun.alert.error('货位编码不能为空!');
  167. return false;
  168. }
  169. var url = weburl + "api/Sx/UpdateCellState";
  170. learun.layerConfirm('是否确定修改货位状态!', function (res) {
  171. if (res) {
  172. $.ajax({
  173. type: 'post',
  174. //data: { location: postData.map((item) => item.Id) },
  175. data: JSON.stringify({
  176. "Code": CellCode,
  177. "State": Status,
  178. "WareHouse": 'sxhouse'
  179. }),
  180. dataType: 'json',
  181. contentType: "application/json;charset=utf-8",
  182. url: url,
  183. success: function (response) {
  184. //resCode 200 resMsg "成功"
  185. refreshGirdData();
  186. top.layer.close(top.layer.index);
  187. learun.alert.info(response.resMsg);
  188. }
  189. });
  190. }
  191. });
  192. });
  193. //货位数据互换
  194. $('#CellDataSwap').on('click', function () {
  195. var CellFrom = $('#CellFrom').val().replace(/^[' ' || ' ']*/, '').replace(/[' ' | ' ']*$/, '');
  196. var CellTo = $('#CellTo').val().replace(/^[' ' || ' ']*/, '').replace(/[' ' | ' ']*$/, '');
  197. if (CellFrom.length == 0) {
  198. learun.alert.error('起始货位不能为空!');
  199. return false;
  200. }
  201. if (CellTo.length == 0) {
  202. learun.alert.error('目标货位不能为空!');
  203. return false;
  204. }
  205. var url = weburl + "api/Sx/DataSwapCell";
  206. learun.layerConfirm('是否确定互换数据!', function (res) {
  207. if (res) {
  208. $.ajax({
  209. type: 'post',
  210. //data: { location: postData.map((item) => item.Id) },
  211. data: JSON.stringify({
  212. "StatEquip": CellFrom,
  213. "EndEquip": CellTo,
  214. "WareHouse": 'sxhouse'
  215. }),
  216. dataType: 'json',
  217. contentType: "application/json;charset=utf-8",
  218. url: url,
  219. success: function (response) {
  220. //resCode 200 resMsg "成功"
  221. refreshGirdData();
  222. top.layer.close(top.layer.index);
  223. learun.alert.info(response.resMsg);
  224. }
  225. });
  226. }
  227. });
  228. });
  229. $('#btnwmstask').on('click', function () {
  230. var wmstaskNo = $('#wmstasknum').val().replace(/^[' ' || ' ']*/, '').replace(/[' ' | ' ']*$/, '');
  231. if (wmstaskNo.length == 0) {
  232. learun.alert.error('WMS任务号不能为空!');
  233. return false;
  234. }
  235. var url = weburl + "api/Sx/CompleteTask";
  236. learun.layerConfirm('是否确定完成WMS任务!', function (res) {
  237. if (res) {
  238. $.ajax({
  239. type: 'post',
  240. //data: { location: postData.map((item) => item.Id) },
  241. data: JSON.stringify({
  242. "taskNum": parseInt(wmstaskNo),
  243. "operationType": 2,
  244. "wcsUpdateName": "1",
  245. "memo1": "",
  246. "memo2": ""
  247. }),
  248. dataType: 'json',
  249. contentType: "application/json;charset=utf-8",
  250. url: url,
  251. success: function (response) {
  252. //resCode 200 resMsg "成功"
  253. //refreshGirdData();
  254. top.layer.close(top.layer.index);
  255. learun.alert.info(response.resMsg);
  256. }
  257. });
  258. }
  259. });
  260. });
  261. $('#btntorsbindrel').on('click', function () {
  262. var hwtorsbindrel = $('#torsbindrel').val().replace(/^[' ' || ' ']*/, '').replace(/[' ' | ' ']*$/, '');
  263. if (hwtorsbindrel.length == 0) {
  264. learun.alert.error('工字轮号不能为空!');
  265. return false;
  266. }
  267. var url = weburl + "api/Sx/DeleteTorsBind";
  268. learun.layerConfirm('是否确定删除绑定关系!', function (res) {
  269. if (res) {
  270. $.ajax({
  271. type: 'post',
  272. //data: { location: postData.map((item) => item.Id) },
  273. data: JSON.stringify({
  274. "code": hwtorsbindrel,
  275. "cell": "",
  276. "WareHouse": 'sxhouse',
  277. "memo1": "",
  278. "memo2": ""
  279. }),
  280. dataType: 'json',
  281. contentType: "application/json;charset=utf-8",
  282. url: url,
  283. success: function (response) {
  284. //resCode 200 resMsg "成功"
  285. //refreshGirdData();
  286. top.layer.close(top.layer.index);
  287. learun.alert.info(response.resMsg);
  288. }
  289. });
  290. }
  291. });
  292. });
  293. $('#btnprehwclear').on('click', function () {
  294. var hwprehwclear = $('#prehwclear').val().replace(/^[' ' || ' ']*/, '').replace(/[' ' | ' ']*$/, '');
  295. if (hwprehwclear.length == 0) {
  296. learun.alert.error('工字轮号不能为空!');
  297. return false;
  298. }
  299. var url = weburl + "api/Sx/DeleteHwPre";
  300. learun.layerConfirm('是否确定解锁工字轮!', function (res) {
  301. if (res) {
  302. $.ajax({
  303. type: 'post',
  304. //data: { location: postData.map((item) => item.Id) },
  305. data: JSON.stringify({
  306. "code": hwprehwclear,
  307. "cell": "",
  308. "WareHouse": 'sxhouse',
  309. "memo1": "",
  310. "memo2": ""
  311. }),
  312. dataType: 'json',
  313. contentType: "application/json;charset=utf-8",
  314. url: url,
  315. success: function (response) {
  316. //resCode 200 resMsg "成功"
  317. //refreshGirdData();
  318. top.layer.close(top.layer.index);
  319. learun.alert.info(response.resMsg);
  320. }
  321. });
  322. }
  323. });
  324. });
  325. },
  326. search: function (param) {
  327. $('#gridtable').jfGridSet('reload', param);
  328. }
  329. };
  330. refreshGirdData = function () {
  331. $('#gridtable').jfGridSet('reload');
  332. };
  333. page.init();
  334. }