queryStockMiss.js 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325
  1. define(function (require) {
  2. return function () {
  3. var $grid1, $form;
  4. var widgets = {
  5. // 派工号
  6. selectPmgPghWidget: {
  7. url: '/app/wms/widget/selectPmsPgh.js',
  8. bind: {
  9. pghId: 'pghId',
  10. pghCode: 'pghCode'
  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 obj = $form.formGet();
  25. var startTime = new Date(obj.startTime.replace("-", "/"));
  26. var endTime = new Date(obj.endTime.replace("-", "/"));
  27. if (startTime > endTime) {
  28. $.yvan.msg('起止日期必须大于起始日期');
  29. return;
  30. }
  31. var queryUrl = '/wms/wmsOutPoolmat/queryStockMiss';// 自行替换此参数
  32. $grid1.jqGrid("clearGridData");
  33. var queryForm1 = $form.formGet();
  34. $grid1.reload({
  35. mtype: 'post',
  36. url: api(queryUrl),
  37. queryParams: queryForm1
  38. }, true);
  39. }
  40. //获取库区
  41. function getFarmList() {
  42. var _datas = [];
  43. _datas.push({
  44. "id": '',
  45. "text": '全部'
  46. })
  47. $.yvan.ajax({
  48. url: api('/wms/whFarm/queryAll'),
  49. data: {},
  50. method: 'post',
  51. async: false,
  52. success: function (data) {
  53. if (data.data != null && data.data != undefined) {
  54. for (var i = 0; i < data.data.length; i++) {
  55. _datas.push({
  56. "id": data.data[i].farmId,
  57. "text": data.data[i].farmName
  58. })
  59. }
  60. }
  61. }
  62. });
  63. return _datas;
  64. }
  65. //获取车间信息
  66. function getRoomList() {
  67. var _datas = [{"id": '', "text": '全部'}];
  68. $.yvan.ajax({
  69. url: api('/wms/wmsOutPoolmat/queryRoomByMiss'),
  70. method: 'post',
  71. async: false,
  72. success: function (data) {
  73. if (data.data != null && data.data != undefined) {
  74. for (var i = 0; i < data.data.length; i++) {
  75. _datas.push({
  76. "id": data.data[i].roomId,
  77. "text": data.data[i].roomName
  78. })
  79. }
  80. }
  81. }
  82. });
  83. return _datas;
  84. }
  85. // 搜索按钮
  86. var queryToolbarTitle = '缺件查询';// 自行替换此参数
  87. var queryToolbar = {
  88. xtype: 'toolbar', title: queryToolbarTitle, items: [
  89. {
  90. text: '查询', iconCls: 'fa fa-search', onClick: function () {
  91. queryGrid1();
  92. }
  93. }, {
  94. text: '重置', iconCls: 'fa fa-refresh', onClick: function () {
  95. $form.formClear();
  96. queryGrid1();
  97. }
  98. }, {
  99. text: '关闭', iconCls: 'fa fa-times-circle', onClick: function () {
  100. App.closeMe(this);
  101. }
  102. }
  103. ]
  104. };
  105. // 搜索条件
  106. var queryFormPrompt = '需求单号/派工号/物资编码/图号型号/物资名称/申请人';// 自行替换此参数
  107. var queryForm = {
  108. onRender: function () {
  109. $form = $(this);
  110. },
  111. xtype: 'form',
  112. items: [
  113. [
  114. {xtype: 'hidden', name: 'pghId'},
  115. {
  116. xtype: 'searchbox',
  117. label: '派工号',
  118. name: 'pghCode',
  119. labelWidth: 'auto',
  120. width: 250,
  121. prompt: '派工号编号',
  122. widget: widgets.selectPmgPghWidget,
  123. onChange: function (data) {
  124. queryGrid1();
  125. }
  126. },
  127. {
  128. xtype: 'yvselect',
  129. label: '需求车间',
  130. name: 'roomId',
  131. labelWidth: 'auto',
  132. width: 240,
  133. data: getRoomList(),
  134. onChange: function () {
  135. queryGrid1();
  136. }
  137. },
  138. {
  139. xtype: 'yvselect', label: '需求阶段', name: 'outapType', labelWidth: 'auto', width: 180, value: '',
  140. data: $.yvan.sysDict('outapType').combowithAll(),
  141. onChange: function () {
  142. queryGrid1();
  143. }
  144. },
  145. {
  146. xtype: 'yvselect', label: '需求库区', name: 'farmId', labelWidth: 'auto', width: 200, value: '',
  147. data: getFarmList(),
  148. onChange: function () {
  149. queryGrid1();
  150. }
  151. },
  152. {
  153. xtype: 'yvselect', label: '允许混批', name: 'batchMix', labelWidth: 'auto', width: 180, value: '',
  154. data: $.yvan.sysDict('batchMix').combowithAll(),
  155. onChange: function () {
  156. queryGrid1();
  157. }
  158. },
  159. {
  160. xtype: 'yvselect', label: '物资分类', name: 'matType', labelWidth: 'auto', width: 180,
  161. data: $.yvan.sysDict('matType').combowithAll(), value: '',
  162. onChange: function () {
  163. queryGrid1();
  164. }
  165. },
  166. ],
  167. [
  168. {
  169. xtype: 'textbox',
  170. label: '检索条件',
  171. name: 'queryProperties',
  172. prompt: queryFormPrompt,
  173. labelWidth: 'auto',
  174. width: 450,
  175. events: {keydown: enterQueryGrid1}
  176. },
  177. {
  178. name: 'startTime',
  179. label: '需求日期',
  180. prompt: '开始时间',
  181. xtype: 'datebox',
  182. labelWidth: 'auto',
  183. width: 210,
  184. onChange: function () {
  185. queryGrid1();
  186. }
  187. },
  188. {
  189. name: 'endTime',
  190. label: '至',
  191. prompt: '结束时间',
  192. xtype: 'datebox',
  193. labelWidth: 'auto',
  194. width: 170,
  195. onChange: function () {
  196. queryGrid1();
  197. }
  198. },
  199. ]
  200. ]
  201. };
  202. // 列表1增删改查按钮
  203. var gridToolbarTitle1 = '缺件详情';// 自行替换此参数
  204. var gridToolbar1 = {
  205. xtype: 'toolbar',
  206. title: gridToolbarTitle1,
  207. items: [
  208. {
  209. text: '导出数据', iconCls: 'fa fa-cloud-upload', onClick: function () {
  210. var para = "";
  211. if ($form.formGet().pghId != "") {
  212. para = (para == "") ? "" : para + "&";
  213. para += "pghId=" + $form.formGet().pghId;
  214. }
  215. if ($form.formGet().outapType != "") {
  216. para = (para == "") ? "" : para + "&";
  217. para += "outapType=" + $form.formGet().outapType;
  218. }
  219. if ($form.formGet().farmId != "") {
  220. para = (para == "") ? "" : para + "&";
  221. para += "farmId=" + $form.formGet().farmId;
  222. }
  223. if ($form.formGet().roomId != "") {
  224. para = (para == "") ? "" : para + "&";
  225. para += "roomId=" + $form.formGet().roomId;
  226. }
  227. if ($form.formGet().batchMix != "") {
  228. para = (para == "") ? "" : para + "&";
  229. para += "batchMix=" + $form.formGet().batchMix;
  230. }
  231. if ($form.formGet().matType != "") {
  232. para = (para == "") ? "" : para + "&";
  233. para += "matType=" + $form.formGet().matType;
  234. }
  235. if ($form.formGet().queryProperties != "") {
  236. para = (para == "") ? "" : para + "&";
  237. para += "queryProperties=" + $form.formGet().queryProperties;
  238. }
  239. if ($form.formGet().startTime != "") {
  240. para = (para == "") ? "" : para + "&";
  241. para += "startTime=" + $form.formGet().startTime;
  242. }
  243. if ($form.formGet().endTime != "") {
  244. para = (para == "") ? "" : para + "&";
  245. para += "endTime=" + $form.formGet().endTime;
  246. }
  247. para = (para == "") ? "/wms/wmsOutPoolmat/exportStockMissExcel" : "/wms/wmsOutPoolmat/exportStockMissExcel?" + para;
  248. $.yvan.download({
  249. method: 'get',
  250. url: api(para),
  251. fileName: "缺件项统计表" + $.yvan.getMoment().format('YYYY-MM-DD HH:mm:ss') + '.xlsx'
  252. });
  253. }
  254. },
  255. ]
  256. };
  257. return {
  258. north: {
  259. height: 140,
  260. split: true,
  261. border: false,
  262. items: [
  263. queryToolbar,
  264. queryForm,
  265. ]
  266. },
  267. center: {
  268. height: '100%',
  269. split: true,
  270. items: {
  271. onRender: function () {
  272. $grid1 = $(this);
  273. queryGrid1();
  274. },
  275. xtype: 'grid',
  276. toolbar: gridToolbar1,
  277. columns:
  278. [[
  279. {title: '物资类型', field: 'matType', align: 'center', formatter: $.fn.fmatter.matType},
  280. {title: '物资编码', field: 'matBar'},
  281. {title: '图号/型号', field: 'matCode'},
  282. {title: '物资名称', field: 'matName'},
  283. {title: '物资编码属性', field: 'matAttrCode'},
  284. {title: '计量单位', field: 'unitName'},
  285. {title: '计划价', field: 'planPrice', align: 'right', formatter: $.fn.fmatter.formatCurrency},
  286. {title: '计划金额', field: 'planMoney', align: 'right', formatter: $.fn.fmatter.formatCurrency},
  287. {title: '允许混批', field: 'batchMix', align: 'center', formatter: $.fn.fmatter.batchMix},
  288. {
  289. title: '需求数',
  290. field: 'amount',
  291. align: 'right',
  292. formatter: $.fn.fmatter.formatNumberBigDecimal,
  293. },
  294. {
  295. title: '领用数',
  296. field: 'amountTake',
  297. align: 'right',
  298. formatter: $.fn.fmatter.formatNumberBigDecimal,
  299. hidden: true,
  300. },
  301. {title: '待发数', field: 'dfAmount', align: 'right', formatter: $.fn.fmatter.formatNumberBigDecimal},
  302. {title: '库存数', field: 'stockAmount', align: 'right', formatter: $.fn.fmatter.formatNumberBigDecimal},
  303. {title: '最大批次数', field: 'batchAmount', align: 'right', formatter: $.fn.fmatter.formatNumberBigDecimal},
  304. {title: '缺件数', field: 'missAmount', align: 'right', formatter: $.fn.fmatter.formatNumberBigDecimal},
  305. {title: '需求单号', field: 'billCode'},
  306. {title: '派工号', field: 'pghCode'},
  307. {title: '需求类型', field: 'outapType', align: 'center', formatter: $.fn.fmatter.outapType},
  308. {title: '需求车间', field: 'roomName'},
  309. {title: '备货库区', field: 'farmName'},
  310. {title: '申请人', field: 'takeUser'},
  311. {title: '需求日期', field: 'dateUse', align: 'center', formatter: $.fn.fmatter.tsymd}
  312. ]]
  313. }
  314. }
  315. };
  316. };
  317. });