queryStockKeep.js 7.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252
  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/queryStockKeep';// 自行替换此参数
  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/queryRoomByKeep'),
  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: 280,
  121. prompt: '派工号编号',
  122. widget: widgets.selectPmgPghWidget,
  123. onChange: function (data) {
  124. queryGrid1();
  125. }
  126. },
  127. {
  128. xtype: 'yvselect', label: '需求阶段', name: 'outapType', labelWidth: 'auto', width: 180, value: '',
  129. data: $.yvan.sysDict('outapType').combowithAll(),
  130. onChange: function () {
  131. queryGrid1();
  132. }
  133. },
  134. {
  135. xtype: 'yvselect', label: '备货库区', name: 'farmId', labelWidth: 'auto', width: 200, value: '',
  136. data: getFarmList(),
  137. onChange: function () {
  138. queryGrid1();
  139. }
  140. },
  141. {
  142. xtype: 'yvselect',
  143. label: '需求单位',
  144. name: 'roomId',
  145. labelWidth: 'auto',
  146. width: 240,
  147. data: getRoomList(),
  148. onChange: function () {
  149. queryGrid1();
  150. }
  151. },
  152. {
  153. xtype: 'yvselect', label: '物资分类', name: 'matType', labelWidth: 'auto', width: 180,
  154. data: $.yvan.sysDict('matType').combowithAll(), value: '',
  155. onChange: function () {
  156. queryGrid1();
  157. }
  158. },
  159. ],
  160. [
  161. {
  162. xtype: 'textbox',
  163. label: '检索条件',
  164. name: 'queryProperties',
  165. prompt: queryFormPrompt,
  166. labelWidth: 'auto',
  167. width: 380,
  168. events: {keydown: enterQueryGrid1}
  169. },
  170. {
  171. name: 'startTime',
  172. label: '需求日期',
  173. prompt: '开始时间',
  174. xtype: 'datebox',
  175. labelWidth: 'auto',
  176. width: 210,
  177. onChange: function () {
  178. queryGrid1();
  179. }
  180. },
  181. {
  182. name: 'endTime',
  183. label: '至',
  184. prompt: '结束时间',
  185. xtype: 'datebox',
  186. labelWidth: 'auto',
  187. width: 170,
  188. onChange: function () {
  189. queryGrid1();
  190. }
  191. },
  192. ]]
  193. };
  194. // 列表1增删改查按钮
  195. var gridToolbarTitle1 = '缺件详情';// 自行替换此参数
  196. var gridToolbar1 = {
  197. xtype: 'toolbar',
  198. title: gridToolbarTitle1
  199. };
  200. return {
  201. north: {
  202. height: 140,
  203. split: true,
  204. border: false,
  205. items: [
  206. queryToolbar,
  207. queryForm
  208. ]
  209. },
  210. center: {
  211. height: '100%',
  212. split: true,
  213. items: {
  214. onRender: function () {
  215. $grid1 = $(this);
  216. queryGrid1();
  217. },
  218. xtype: 'grid',
  219. toolbar: gridToolbar1,
  220. columns:
  221. [[
  222. {title: '物资类型', field: 'matType', align: 'center', formatter: $.fn.fmatter.matType},
  223. {title: '物资编码', field: 'matBar'},
  224. {title: '图号/型号', field: 'matCode'},
  225. {title: '物资名称', field: 'matName'},
  226. {title: '物资编码属性', field: 'matAttrCode'},
  227. {title: '计量单位', field: 'unitName'},
  228. {title: '计划价', field: 'planPrice', align: 'right', formatter: $.fn.fmatter.formatCurrency},
  229. {title: '计划金额', field: 'planMoney', align: 'right', formatter: $.fn.fmatter.formatCurrency},
  230. {title: '缺件数', field: 'lackNum', align: 'right', formatter: $.fn.fmatter.formatNumberBigDecimal},
  231. {title: '需求单号', field: 'billCode'},
  232. {title: '派工号', field: 'pghCode'},
  233. {title: '需求阶段', field: 'outapType', align: 'center', formatter: $.fn.fmatter.outapType},
  234. {title: '需求单位', field: 'roomName'},
  235. {title: '备货库区', field: 'farmName'},
  236. {title: '申请人', field: 'takeUser'},
  237. {title: '需求日期', field: 'dateUse', align: 'center', formatter: $.fn.fmatter.tsymd}
  238. ]]
  239. }
  240. }
  241. };
  242. };
  243. });