queryWmsInAbnormal.js 8.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265
  1. define(function (require) {
  2. return function () {
  3. var $grid1, $grid2, $form;
  4. var widgets = {
  5. // 搜索企业
  6. selectCorpWidget: {
  7. url: '/app/wms/widget/selectOrgCorp.js',
  8. bind: {
  9. corpId: 'corpId',
  10. corpName: 'corpName'
  11. },
  12. widgetPrompt: "供应商名称"
  13. },
  14. };
  15. function enterQueryGrid1(e) {
  16. if (e.keyCode === 13) {
  17. var tmp = $(this).val();
  18. $form.formSet({queryProperties: tmp});
  19. queryGrid1();
  20. }
  21. }
  22. // 查询列表
  23. function queryGrid1() {
  24. var queryUrl = '/wms/wmsIn/selectAbnormalList';// 自行替换此参数
  25. $grid1.jqGrid("clearGridData");
  26. var queryForm = $form.formGet();
  27. $grid1.reload({
  28. mtype: 'POST',
  29. url: api(queryUrl),
  30. queryParams: queryForm
  31. }, true);
  32. if ($grid2 != undefined) {
  33. $grid2.jqGrid("clearGridData");
  34. }
  35. }
  36. function queryGrid2(rowid) {
  37. var row = $grid1.rowData(rowid);
  38. if (!row) {
  39. $.yvan.msg('请先选择一行数据');
  40. return;
  41. }
  42. var queryUrl = '/wms/wmsIn/selectAbnormalMatList';// 自行替换此参数
  43. var queryData = {inId: row.inId};// 多个参数自行新增
  44. $grid2.reload({
  45. mtype: 'POST',
  46. url: api(queryUrl),
  47. queryParams: queryData
  48. });
  49. }
  50. // 搜索按钮
  51. var queryToolbarTitle = '收货异常查询';// 自行替换此参数
  52. var queryToolbar = {
  53. xtype: 'toolbar', title: queryToolbarTitle, items: [
  54. {
  55. text: '查询', iconCls: 'fa fa-search', onClick: function () {
  56. queryGrid1();
  57. }
  58. }, {
  59. text: '重置', iconCls: 'fa fa-refresh', onClick: function () {
  60. $form.formClear();
  61. queryGrid1();
  62. }
  63. }, {
  64. text: '关闭', iconCls: 'fa fa-times-circle', onClick: function () {
  65. App.closeMe(this);
  66. }
  67. }
  68. ]
  69. };
  70. // 搜索条件
  71. var queryFormPrompt = '收货单号/到货单号/收货人';// 自行替换此参数
  72. var queryForm = {
  73. onRender: function () {
  74. $form = $(this);
  75. },
  76. xtype: 'form',
  77. items: [[
  78. {
  79. xtype: 'textbox',
  80. label: '检索条件',
  81. name: 'queryProperties',
  82. prompt: queryFormPrompt,
  83. labelWidth: 'auto',
  84. events: {keydown: enterQueryGrid1},
  85. },
  86. {
  87. xtype: 'yvselect', label: '入库类型', name: 'inType', labelWidth: 'auto', width: 180, value: '',
  88. data: $.yvan.sysDict('inType').combowithAll(),
  89. onChange: function () {
  90. queryGrid1();
  91. }
  92. },
  93. {xtype: 'hidden', name: 'corpId'},
  94. {
  95. xtype: 'searchbox', label: '供应商', name: 'corpName', labelWidth: 'auto', width: 280, prompt: '供应商名称',
  96. widget: widgets.selectCorpWidget,
  97. onChange: function (data) {
  98. queryGrid1();
  99. }
  100. },
  101. {
  102. xtype: 'datebox', label: '收货日期', name: 'pubTimeStart', labelWidth: 'auto', width: 220,
  103. onChange: function () {
  104. var pubTimeStart = $form.formGet().pubTimeStart;
  105. var pubTimeEnd = $form.formGet().pubTimeEnd;
  106. var pubTimeStart = new Date(pubTimeStart.replace("-", "/"));
  107. var pubTimeEnd = new Date(pubTimeEnd.replace("-", "/"));
  108. if (pubTimeStart > pubTimeEnd) {
  109. $.yvan.msg('起始日期必须小于起止日期');
  110. return;
  111. }
  112. queryGrid1();
  113. }
  114. }, {
  115. xtype: 'datebox', label: '-', name: 'pubTimeEnd', labelWidth: 'auto', width: 180,
  116. onChange: function (data) {
  117. var pubTimeStart = $form.formGet().pubTimeStart;
  118. var pubTimeEnd = $form.formGet().pubTimeEnd;
  119. var pubTimeStart = new Date(pubTimeStart.replace("-", "/"));
  120. var pubTimeEnd = new Date(pubTimeEnd.replace("-", "/"));
  121. if (pubTimeStart > pubTimeEnd) {
  122. $.yvan.msg('起止日期必须大于起始日期');
  123. return;
  124. }
  125. queryGrid1();
  126. }
  127. },
  128. ]]
  129. };
  130. // 列表1增删改查按钮
  131. var gridToolbarTitle1 = '异常收货单列表';// 自行替换此参数
  132. var gridToolbar1 = {
  133. xtype: 'toolbar',
  134. title: gridToolbarTitle1,
  135. items: []
  136. };
  137. // 列表2增删改查按钮
  138. var gridToolbarTitle2 = '物资列表';// 自行替换此参数
  139. var gridToolbar2 = {
  140. xtype: 'toolbar',
  141. title: gridToolbarTitle2,
  142. };
  143. return {
  144. north: {
  145. height: 90,
  146. split: true,
  147. border: false,
  148. items: [
  149. queryToolbar,
  150. queryForm
  151. ]
  152. },
  153. center: {
  154. width: "55%",
  155. split: true,
  156. items: {
  157. onRender: function () {
  158. $grid1 = $(this);
  159. queryGrid1();
  160. },
  161. xtype: 'grid',
  162. toolbar: gridToolbar1,
  163. idField: 'inapId',
  164. columns: [[
  165. {title: '对应收货单ID', field: 'inId', hidden: true},
  166. {title: '到货单ID', field: 'inapId', hidden: true},
  167. {title: '收货单', field: 'billCode', align: "center"},
  168. {title: '到货单', field: 'billCodeInApply', align: "center"},
  169. {title: '入库类型', field: 'inType', hidden: true},
  170. {
  171. title: '入库类型', field: 'inTypeCN', align: "center", formatter: function (value, data) {
  172. return $.fn.fmatter.inTypeSrc(data.rowData.inType);
  173. }
  174. },
  175. {title: '异常物资项', field: 'matNum', align: "right"},
  176. {title: '计划金额', field: 'planMoney', formatter: $.fn.fmatter.formatCurrency, align: 'right'},
  177. {title: '到货时间', field: 'arrivalTime', formatter: $.fn.fmatter.tsymd, hidden: true},
  178. {title: '收货时间', field: 'receiveTime', formatter: $.fn.fmatter.tsymd},
  179. {title: '收货人', field: 'receiveUserName'},
  180. {title: '供应商', field: 'corpName'},
  181. {title: '供应商单号', field: 'corpOrder'},
  182. {title: '供应商物流单号', field: 'corpTrackNo'},
  183. ]],
  184. onSelectRow: function (rowid) {
  185. queryGrid2(rowid);
  186. },
  187. loadComplete: function () {
  188. if ($grid1) {
  189. var num = $grid1.records(); //获取当前数据量
  190. if (num <= 0) {
  191. if ($grid2) {
  192. //清空表格数据
  193. $grid2.clearData();
  194. }
  195. }
  196. }
  197. },
  198. }
  199. },
  200. south: {
  201. height: '45%',
  202. border: false,
  203. items: {
  204. onRender: function () {
  205. $grid2 = $(this);
  206. },
  207. xtype: 'grid',
  208. toolbar: gridToolbar2,
  209. idField: 'billmatId',
  210. columns: [[
  211. {title: '单据明细据流水', field: 'billmatId', hidden: true},
  212. {title: '物资ID', field: 'matId', hidden: true},
  213. {title: '物资编码', field: 'matBar', width: 140},
  214. {title: '物资名称', field: 'matName', width: 100},
  215. {title: '图号/型号', field: 'matCode', width: 140},
  216. {title: '物资分类', field: 'matType', align: 'center', formatter: $.fn.fmatter.matType, width: 80},
  217. {title: '计划价(元)', field: 'planPrice', formatter: $.fn.fmatter.formatCurrency, align: 'right'},
  218. {title: '计划金额', field: 'planMoney', formatter: $.fn.fmatter.formatCurrency, align: 'right'},
  219. {title: '物资状态', field: 'matQc', formatter: $.fn.fmatter.matQc, align: 'center'},
  220. {
  221. title: '采购数量', field: 'cgAmount', align: 'right', formatter: $.fn.fmatter.formatNumberBigDecimal,
  222. formatter: function (value) {
  223. if (value == undefined || value == null) {
  224. return value = 0;
  225. } else {
  226. return parseFloat(value);
  227. }
  228. }
  229. },
  230. {title: '采购单位', field: 'planUnitName', align: 'center'},// 需要在format.js文件中设置此方法
  231. {
  232. title: '收货数量', field: 'corpAmount', align: 'right', formatter: $.fn.fmatter.formatNumberBigDecimal,
  233. formatter: function (value) {
  234. if (value == undefined || value == null) {
  235. return value = 0;
  236. } else {
  237. return parseFloat(value);
  238. }
  239. }
  240. },
  241. {title: '收货单位', field: 'corpUnitName', align: 'center'},// 需要在format.js文件中设置此方法
  242. {
  243. title: '单位换算后收货数量',
  244. field: 'matAmount',
  245. align: 'right',
  246. formatter: $.fn.fmatter.formatNumberBigDecimal,
  247. hidden: true
  248. },
  249. {title: '收货说明', field: 'remark'},
  250. ]]
  251. }
  252. }
  253. };
  254. };
  255. });