Index.js 16 KB

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