queryWmsOutWpf.js 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409
  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/wmsOutWpfExcel/query';// 自行替换此参数
  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: 'pkgId', labelWidth: 'auto', width: 180, value: '',
  147. data: $.yvan.sysDict('pkgId').combowithAll(),
  148. onChange: function () {
  149. queryGrid1();
  150. }
  151. },
  152. {
  153. xtype: 'yvselect', label: '需求库区', name: 'farmId', labelWidth: 'auto', width: 200, value: '',
  154. data: getFarmList(),
  155. onChange: function () {
  156. queryGrid1();
  157. }
  158. },
  159. {
  160. xtype: 'yvselect', label: '允许混批', name: 'batchMix', labelWidth: 'auto', width: 180, value: '',
  161. data: $.yvan.sysDict('batchMix').combowithAll(),
  162. onChange: function () {
  163. queryGrid1();
  164. }
  165. },
  166. {
  167. xtype: 'yvselect', label: '物资分类', name: 'matType', labelWidth: 'auto', width: 180,
  168. data: $.yvan.sysDict('matType').combowithAll(), value: '',
  169. onChange: function () {
  170. queryGrid1();
  171. }
  172. },
  173. ],
  174. [
  175. {
  176. xtype: 'textbox',
  177. label: '检索条件',
  178. name: 'queryProperties',
  179. prompt: queryFormPrompt,
  180. labelWidth: 'auto',
  181. width: 450,
  182. events: {keydown: enterQueryGrid1}
  183. },
  184. {
  185. name: 'startTime',
  186. label: '报表新增时间',
  187. prompt: '开始时间',
  188. xtype: 'datebox',
  189. labelWidth: 'auto',
  190. width: 230,
  191. onChange: function () {
  192. queryGrid1();
  193. }
  194. },
  195. {
  196. name: 'endTime',
  197. label: '至',
  198. prompt: '结束时间',
  199. xtype: 'datebox',
  200. labelWidth: 'auto',
  201. width: 170,
  202. onChange: function () {
  203. queryGrid1();
  204. }
  205. },
  206. ]
  207. ]
  208. };
  209. // 列表1增删改查按钮
  210. var gridToolbarTitle1 = '缺件详情';// 自行替换此参数
  211. var gridToolbar1 = {
  212. xtype: 'toolbar',
  213. title: gridToolbarTitle1,
  214. items: [
  215. {
  216. text: '导出数据', iconCls: 'fa fa-cloud-upload', onClick: function () {
  217. var para = "";
  218. if ($form.formGet().pghId != "") {
  219. para = (para == "") ? "" : para + "&";
  220. para += "pghId=" + $form.formGet().pghId;
  221. }
  222. if ($form.formGet().pkgId != "") {
  223. para = (para == "") ? "" : para + "&";
  224. para += "pkgId=" + $form.formGet().pkgId;
  225. }
  226. if ($form.formGet().roomId != "") {
  227. para = (para == "") ? "" : para + "&";
  228. para += "roomId=" + $form.formGet().roomId;
  229. }
  230. if ($form.formGet().outapType != "") {
  231. para = (para == "") ? "" : para + "&";
  232. para += "outapType=" + $form.formGet().outapType;
  233. }
  234. if ($form.formGet().farmId != "") {
  235. para = (para == "") ? "" : para + "&";
  236. para += "farmId=" + $form.formGet().farmId;
  237. }
  238. if ($form.formGet().batchMix != "") {
  239. para = (para == "") ? "" : para + "&";
  240. para += "batchMix=" + $form.formGet().batchMix;
  241. }
  242. if ($form.formGet().matType != "") {
  243. para = (para == "") ? "" : para + "&";
  244. para += "matType=" + $form.formGet().matType;
  245. }
  246. if ($form.formGet().queryProperties != "") {
  247. para = (para == "") ? "" : para + "&";
  248. para += "queryProperties=" + $form.formGet().queryProperties;
  249. }
  250. if ($form.formGet().startTime != "") {
  251. para = (para == "") ? "" : para + "&";
  252. para += "startTime=" + $form.formGet().startTime;
  253. }
  254. if ($form.formGet().endTime != "") {
  255. para = (para == "") ? "" : para + "&";
  256. para += "endTime=" + $form.formGet().endTime;
  257. }
  258. para = (para == "") ? "/wms/wmsOutWpfExcel/exportWmsOutWpfExcel" : "/wms/wmsOutWpfExcel/exportWmsOutWpfExcel?" + para;
  259. $.yvan.download({
  260. method: 'get',
  261. url: api(para),
  262. fileName: "未配发项统计表" + $.yvan.getMoment().format('YYYY-MM-DD HH:mm:ss') + '.xlsx'
  263. });
  264. }
  265. },
  266. {
  267. text: '同步数据', iconCls: 'fa fa-arrow-circle-up', onClick: function () {
  268. $.yvan.confirm('确定同步数据吗?', {
  269. yes: function (index) {
  270. $.yvan.ajax({
  271. method: 'post',
  272. url: api('/wms/wmsOutWpf/insert'),
  273. success: function (data) {
  274. $.yvan.msg('操作成功');
  275. $grid1.reload();
  276. }
  277. });
  278. }
  279. });
  280. }
  281. },
  282. ]
  283. };
  284. return {
  285. north: {
  286. height: 140,
  287. split: true,
  288. border: false,
  289. items: [
  290. queryToolbar,
  291. queryForm,
  292. ]
  293. },
  294. center: {
  295. height: '100%',
  296. split: true,
  297. items: {
  298. onRender: function () {
  299. $grid1 = $(this);
  300. queryGrid1();
  301. },
  302. xtype: 'grid',
  303. toolbar: gridToolbar1,
  304. columns:
  305. [[
  306. {title: '需求单号', field: 'billCode'},
  307. {title: '派工号', field: 'pghCode'},
  308. {
  309. title: '成套类型', field: 'pkgId', align: 'center',
  310. formatter: function (value, row) {
  311. if (value == 0) {
  312. return " "
  313. } else {
  314. return $.fn.fmatter.pkgId(value)
  315. }
  316. }
  317. },
  318. {title: '需求阶段', field: 'outapType', align: 'center', formatter: $.fn.fmatter.outapType},
  319. {title: '需求车间', field: 'roomName'},
  320. {title: '库区', field: 'farmName'},
  321. {title: '取货方式', field: 'shipType', align: 'center', formatter: $.fn.fmatter.shipType},
  322. {title: '物资清册', field: 'matQingce', align: 'center', formatter: $.fn.fmatter.matQingce},
  323. {title: '物资类型', field: 'matType', align: 'center', formatter: $.fn.fmatter.matType},
  324. {title: '允许混批', field: 'batchMix', align: 'center', formatter: $.fn.fmatter.batchMix},
  325. {title: '物资编码', field: 'matBar'},
  326. {title: '图号/型号', field: 'matCode'},
  327. {title: '物资名称', field: 'matName'},
  328. {title: '物资编码属性', field: 'matAttrCode'},
  329. {
  330. title: '未配发数量',
  331. field: 'wpfAmount',
  332. align: 'right',
  333. formatter: $.fn.fmatter.formatNumberBigDecimal,
  334. },
  335. {
  336. title: '收货间待检验数量',
  337. field: 'djyAmount',
  338. align: 'right',
  339. formatter: $.fn.fmatter.formatNumberBigDecimal,
  340. },
  341. {
  342. title: '收货间检验不合格数量',
  343. field: 'jybhgAmount',
  344. align: 'right',
  345. formatter: $.fn.fmatter.formatNumberBigDecimal,
  346. },
  347. {
  348. title: '待上架数量',
  349. field: 'dsjAmount',
  350. align: 'right',
  351. formatter: $.fn.fmatter.formatNumberBigDecimal,
  352. },
  353. {
  354. title: '架上合格数量',
  355. field: 'jshgAmount',
  356. align: 'right',
  357. formatter: $.fn.fmatter.formatNumberBigDecimal,
  358. },
  359. {
  360. title: '架上超期数量',
  361. field: 'jsbhgAmount',
  362. align: 'right',
  363. formatter: $.fn.fmatter.formatNumberBigDecimal,
  364. },
  365. {
  366. title: '三期业务中数量',
  367. field: 'sqAmount',
  368. align: 'right',
  369. formatter: $.fn.fmatter.formatNumberBigDecimal,
  370. },
  371. {
  372. title: '已配发未领用数量',
  373. field: 'ypfwlyAmount',
  374. align: 'right',
  375. formatter: $.fn.fmatter.formatNumberBigDecimal,
  376. },
  377. {
  378. title: '需求数量',
  379. field: 'xqAmount',
  380. align: 'right',
  381. formatter: $.fn.fmatter.formatNumberBigDecimal,
  382. },
  383. {title: '计量单位', field: 'unitName'},
  384. {title: '计划价', field: 'planPrice', align: 'right', formatter: $.fn.fmatter.formatCurrency},
  385. {title: '计划金额', field: 'planMoney', align: 'right', formatter: $.fn.fmatter.formatCurrency},
  386. {title: '安装部位', field: 'usePart'},
  387. {title: '安装数量', field: 'useAmount', formatter: $.fn.fmatter.formatNumberBigDecimal,},
  388. {title: '工艺规程', field: 'techName'},
  389. {title: '工卡', field: 'cardTechId'},
  390. {title: '需求班组', field: 'teamName'},
  391. {title: '工作者', field: 'userWorkName'},
  392. {title: '技术员', field: 'userTechName'},
  393. {title: '需求截止时间', field: 'stockDateEnd', align: 'center'},
  394. {title: '需求通过审核时间', field: 'stockDateStart', align: 'center'},
  395. {title: '报表新增时间', field: 'timeCreate', align: 'center'},
  396. ]]
  397. }
  398. }
  399. };
  400. };
  401. });