Index.js 14 KB

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