ManualChoiceOrderDtl.js 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232
  1. /*
  2. * 描 述:订单
  3. */
  4. var refreshGirdData; // 更新数据
  5. var typnum = request('ordertype');
  6. var keyValue = request('keyValue');
  7. var logbegin = '';
  8. var logend = '';
  9. var selectedRow;
  10. var bootstrap = function ($, learun) {
  11. "use strict";
  12. var page = {
  13. init: function () {
  14. page.initGrid();
  15. page.bind();
  16. },
  17. bind: function () {
  18. // 查询
  19. $('#btn_Search').on('click', function () {
  20. page.search({ ordertypenum: typnum, queryJson: JSON.stringify({ Btime: logbegin, Etime: logend, keyword: $('#txt_Keyword').val() }) });
  21. });
  22. // 刷新
  23. $('#lr_refresh').on('click', function () {
  24. location.reload();
  25. });
  26. // 自动生成出库
  27. $('#lr_autoCreateOutTask').on('click', function () {
  28. var stockData = '';
  29. var stockDataTmp = $('#gridtable').jfGridGet('rowdata');
  30. for (var i = 0, l = stockDataTmp.length; i < l; i++) {
  31. if (stockData.length == 0) {
  32. stockData = stockDataTmp[i].F_ROWNO;
  33. } else {
  34. stockData = stockData + ',' + stockDataTmp[i].F_ROWNO;
  35. }
  36. };
  37. if (learun.checkrow(keyValue)) {
  38. learun.layerConfirm('是否确认对选中项自动生成出库!', function (res) {
  39. if (res) {
  40. learun.postForm(top.$.rootUrl + '/OrderManager/Order/AutoCreateOrderDtlOutTask', { keyValue: stockData }, function () {
  41. refreshGirdData();
  42. });
  43. }
  44. });
  45. }
  46. });
  47. // 手动选择出库
  48. //$('#lr_manualCreateOutTask').on('click', function () {
  49. // selectedRow = null;
  50. // var stockData = '';
  51. // var stockDataTmp = $('#gridtable').jfGridGet('rowdata');
  52. // if (stockDataTmp.length > 1) {
  53. // var msg = "[手动选择货位]只能选中一项操作!";
  54. // learun.alert.info(msg);
  55. // //learun.alert.warning(text);
  56. // }
  57. // else {
  58. // if ($.isEmptyObject(stockDataTmp) == false) {
  59. // stockData = stockDataTmp[0].F_ROWNO;
  60. // }
  61. // if (learun.checkrow(stockData)) {
  62. // learun.layerForm({
  63. // id: 'lrgridlayerform',
  64. // title: '手动选择货位出库',
  65. // url: top.$.rootUrl + '/OrderManager/Order/ManualChoiceCellOut?keyValue=' + stockData,
  66. // width: 1600,
  67. // height: 800,
  68. // btn: ['生成出库任务', '关闭'],
  69. // callBack: function (id) {
  70. // return top[id].acceptClick(refreshGirdData);
  71. // }
  72. // });
  73. // }
  74. // }
  75. //});
  76. // 查询任务
  77. //$('#lr_queryTask').on('click', function () {
  78. // selectedRow = null;
  79. // var stockData = '';
  80. // var stockDataTmp = $('#gridtable').jfGridGet('rowdata');
  81. // if (stockDataTmp.length > 1) {
  82. // var msg = "[查询任务]只能选中一项操作!";
  83. // learun.alert.info(msg);
  84. // //learun.alert.warning(text);
  85. // }
  86. // else {
  87. // if ($.isEmptyObject(stockDataTmp) == false) {
  88. // stockData = stockDataTmp[0].F_ROWNO;
  89. // }
  90. // if (learun.checkrow(stockData)) {
  91. // learun.layerForm({
  92. // id: 'lrgridlayerform',
  93. // title: '查询任务',
  94. // url: top.$.rootUrl + '/OrderManager/Order/QueryCellOutTask?keyValue=' + stockData,
  95. // width: 1400,
  96. // height: 800,
  97. // btn: ['关闭'],
  98. // //callBack: function (id) {
  99. // // return top[id].acceptClick(refreshGirdData);
  100. // //}
  101. // });
  102. // }
  103. // }
  104. //});
  105. },
  106. initGrid: function () {
  107. $('#gridtable').jfGrid({
  108. url: top.$.rootUrl + '/OrderManager/Order/GetOrderDtlItem',
  109. headData: [
  110. {
  111. label: '操作', name: 'F_ROWNO', width: 120, align: "center",
  112. formatterAsync: function (value, row, op, $cell) {
  113. $cell.on('click', function () {
  114. learun.layerForm({
  115. id: 'lrgridlayerform1',
  116. title: '任务管理',
  117. url: top.$.rootUrl + '/OrderManager/Order/QueryCellOutTask?keyValue=' + row.F_ROWNO,
  118. width: 1400,
  119. height: 800,
  120. btn: ['关闭'],
  121. //callBack: function (id) {
  122. // return top[id].acceptClick(refreshGirdData);
  123. //}
  124. });
  125. return false;
  126. });
  127. //return '<a id=\"btn_ManualChoiceCell\" class=\"btn btn-primary btn-sm\"><i class=\"fa fa-plus\"></i>&nbsp;手动选择货位</a>';
  128. return '<span class=\"label label-info\" style=\"cursor: pointer;\"><i class=\"fa fa-plus\"></i>&nbsp;任务管理</span>';
  129. }
  130. },
  131. {
  132. label: '操作', name: 'F_ROWNO', width: 120, align: "center",
  133. formatterAsync: function (value, row, op, $cell) {
  134. $cell.on('click', function () {
  135. learun.layerForm({
  136. id: 'lrgridlayerform2',
  137. title: '手动选择货位出库',
  138. url: top.$.rootUrl + '/OrderManager/Order/ManualChoiceCellOut?keyValue=' + row.F_ROWNO,
  139. width: 1600,
  140. height: 800,
  141. btn: ['生成出库任务', '关闭'],
  142. callBack: function (id) {
  143. return top[id].acceptClick(refreshGirdData);
  144. }
  145. });
  146. return false;
  147. });
  148. //return '<a id=\"btn_ManualChoiceCell\" class=\"btn btn-primary btn-sm\"><i class=\"fa fa-plus\"></i>&nbsp;手动选择货位</a>';
  149. return '<span class=\"label label-info\" style=\"cursor: pointer;\"><i class=\"fa fa-plus\"></i>&nbsp;手动选择货位</span>';
  150. }
  151. },
  152. { label: '物料编号', name: 'F_MATNO', width: 160, align: "left" },
  153. { label: '物料名称', name: 'F_MATNAME', width: 200, align: "left" },
  154. { label: '计划量', name: 'F_FQTY', width: 100, align: "left" },
  155. { label: '已分配量', name: 'F_AQTY', width: 100, align: "left" },
  156. { label: '未分配量', name: 'F_LQTY', width: 100, align: "left" },
  157. { label: '单位编号', name: 'F_UNITNO', width: 80, align: "left" },
  158. { label: '单位名称', name: 'F_UNITNAME', width: 80, align: "left" },
  159. { label: '已扫描入库量', name: 'F_CQTY', width: 100, align: "left" },
  160. {
  161. label: '物料类型', name: 'F_MATTYPENUM', width: 80, align: "center"
  162. , formatterAsync: function (callback, value, row) {
  163. learun.clientdata.getAsync('dataItem', {
  164. Rowkey: value,
  165. GrpCode: 'EMatType',
  166. getType: 'Num',
  167. callback: function (item) {
  168. callback(item.F_NAME);
  169. }
  170. });
  171. }
  172. },
  173. {
  174. label: '物料状态', name: 'F_MATSTATENUM', width: 80, align: "center"
  175. , formatterAsync: function (callback, value, row) {
  176. learun.clientdata.getAsync('dataItem', {
  177. Rowkey: value,
  178. GrpCode: 'EMatState',
  179. getType: 'Num',
  180. callback: function (item) {
  181. callback(item.F_NAME);
  182. }
  183. });
  184. }
  185. },
  186. { label: '移动类型', name: 'F_MOVETYPE', width: 80, align: "left" },
  187. { label: '物料条码', name: 'F_MATBARCODE', width: 120, align: "left" },
  188. { label: '批次号', name: 'F_BATCHNO', width: 200, align: "left" },
  189. { label: '版本号', name: 'F_VERSION', width: 80, align: "left" },
  190. { label: '档位', name: 'F_GEAR', width: 80, align: "left" },
  191. { label: '上传量', name: 'F_UQTY', width: 100, align: "left" },
  192. { label: 'mes使用', name: 'F_SQTY', width: 100, align: "left" },
  193. { label: '工位编号', name: 'F_WORKPOSNO', width: 100, align: "left" },
  194. { label: '工位名称', name: 'F_WORKPOSNAME', width: 100, align: "left" },
  195. { label: 'AGV站点', name: 'F_AGVWORK', width: 100, align: "left" },
  196. { label: '产线编号', name: 'F_PROLINENO', width: 100, align: "left" },
  197. { label: '产线名称', name: 'F_PROLINENAME', width: 100, align: "left" },
  198. { label: '备注', name: 'F_MEMO', width: 200, align: "left" },
  199. { label: '创建用户编号', name: 'F_ADDUSERNO', width: 100, align: "left" },
  200. { label: '创建时间', name: 'F_ADDTIME', width: 200, align: "left" },
  201. { label: '编辑用户编号', name: 'F_EDITUSERNO', width: 100, align: "left" },
  202. { label: '编辑时间', name: 'F_EDITTIME', width: 200, align: "left" },
  203. { label: '生产工单', name: 'F_DEFINE01', width: 200, align: "left" },
  204. { label: '生产工单ID', name: 'F_DEFINE02', width: 200, align: "left" },
  205. { label: '成品编号', name: 'F_DEFINE03', width: 200, align: "left" },
  206. { label: '包装方式', name: 'F_PACKMETHOD', width: 200, align: "left" },
  207. { label: '成本中心', name: 'F_COST', width: 200, align: "left" }
  208. ],
  209. isShowNum: false,
  210. mainId: 'F_ROWNO',
  211. isPage: true,
  212. reloadSelected: true,
  213. isMultiselect: true,
  214. sidx: 'F_MATNO',
  215. //isEdit: true,
  216. });
  217. $('#orderno').text(keyValue);
  218. page.search({ OrderNo: keyValue });
  219. },
  220. search: function (param) {
  221. $('#gridtable').jfGridSet('reload', param);
  222. }
  223. };
  224. // 保存数据后回调刷新
  225. refreshGirdData = function () {
  226. page.search();
  227. }
  228. page.init();
  229. }