queryBatch.js 9.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309
  1. //物资信息查询页面
  2. define(function (require) {
  3. return function () {
  4. var $grid1, $grid2, $form;
  5. // 弹框的方式
  6. var widgets = {
  7. // 搜索分类检索
  8. selectCatalogWidget: {
  9. url: '/app/mat/widget/selectCatalog.js',
  10. bind: {
  11. matcId: 'matcId',
  12. matcName: 'matcName'
  13. },
  14. queryParams: {matcBusi: MATC_BUSI_检验, status: 1}
  15. },
  16. // 搜索供应商检索
  17. selectCorpWidget: {
  18. url: '/app/mat/widget/selectCorp.js',
  19. bind: {
  20. corpId: 'corpId',
  21. corpName: 'corpName'
  22. },
  23. queryParams: {corpType: CORP_TYPE_供应商}
  24. }
  25. };
  26. function enterQueryGrid1(e) {
  27. if (e.keyCode === 13) {
  28. var tmp = $(this).val();
  29. $form.formSet({queryProperties: tmp});
  30. queryGrid1();
  31. }
  32. }
  33. function queryGrid1() {
  34. var queryUrl = '/mat/matBatch/queryBatchView';// 自行替换此参数
  35. $grid1.jqGrid("clearGridData");
  36. var queryForm = $form.formGet();
  37. $grid1.reload({
  38. mtype: 'POST',
  39. url: api(queryUrl),
  40. queryParams: queryForm
  41. }, true);
  42. if ($grid2 != undefined && $grid2 != null) {
  43. $grid2.jqGrid("clearGridData");
  44. }
  45. }
  46. function queryGrid2() {
  47. if ($grid2 == undefined || $grid2 == null)
  48. return;
  49. var row = $grid1.rowData();
  50. if (!row) {
  51. $.yvan.msg('请先选择一行数据');
  52. return;
  53. }
  54. var queryUrl = '/stock/stockCell/queryByStockId';// 自行替换此参数
  55. var obj = $form.formGet();
  56. obj.matId = row.matId;
  57. obj.batchId = row.batchId;
  58. $grid2.reload({
  59. mtype: 'POST',
  60. url: api(queryUrl),
  61. queryParams: obj
  62. });
  63. }
  64. //获取仓库信息
  65. function getRoomList() {
  66. var _datas = [];
  67. var qd = {};
  68. // if (App.currentRoomId > 0) {
  69. // qd = {roomId: App.currentRoomId};
  70. // _datas = [];
  71. // } else {
  72. qd = {roomType: ROOM_TYPE_CK};
  73. // }
  74. $.yvan.ajax({
  75. url: api('/wms/whRoom/queryAll'),
  76. data: qd,
  77. method: 'post',
  78. async: false,
  79. success: function (data) {
  80. if (data.data) {
  81. for (var i = 0; i < data.data.length; i++) {
  82. _datas.push({
  83. "id": data.data[i].roomId,
  84. "text": data.data[i].roomName
  85. })
  86. }
  87. }
  88. }
  89. });
  90. return _datas;
  91. }
  92. // 搜索按钮
  93. var queryToolbarTitle = '批次查询';// 自行替换此参数
  94. var queryToolbar = {
  95. xtype: 'toolbar', title: queryToolbarTitle, items: [
  96. {
  97. text: '查询', iconCls: 'fa fa-search', onClick: function () {
  98. queryGrid1();
  99. }
  100. }, {
  101. text: '重置', iconCls: 'fa fa-refresh', onClick: function () {
  102. $form.formClear();
  103. queryGrid1();
  104. }
  105. }, {
  106. text: '关闭', iconCls: 'fa fa-times-circle', onClick: function () {
  107. App.closeMe(this);
  108. }
  109. }
  110. ]
  111. };
  112. // 搜索条件
  113. var queryFormPrompt = '批次号/物资编码/图号型号/物资名称';// 自行替换此参数
  114. var queryForm = {
  115. onRender: function () {
  116. $form = $(this);
  117. },
  118. xtype: 'form',
  119. items: [
  120. [
  121. {xtype: 'hidden', name: 'matcId'},
  122. {xtype: 'hidden', name: 'corpId'},
  123. {
  124. xtype: 'searchbox',
  125. label: '检验分类',
  126. name: 'matcName',
  127. labelWidth: 'auto',
  128. widget: widgets.selectCatalogWidget,
  129. onChange: function (value) {
  130. if (!isNotNullOrEmpty(value)) {
  131. $form.formSet({
  132. matcId: ''
  133. })
  134. }
  135. queryGrid1();
  136. }
  137. },
  138. {
  139. xtype: 'searchbox',
  140. label: '供应商',
  141. name: 'corpName',
  142. labelWidth: 'auto',
  143. widget: widgets.selectCorpWidget,
  144. onChange: function (value) {
  145. if (!isNotNullOrEmpty(value)) {
  146. $form.formSet({
  147. corpId: ''
  148. })
  149. }
  150. queryGrid1();
  151. }
  152. },
  153. {
  154. xtype: 'yvselect', label: '物资分类', name: 'matType', labelWidth: 'auto', width: 180,
  155. data: $.yvan.sysDict('matType').combowithAll(), value: '',
  156. onChange: function () {
  157. queryGrid1();
  158. }
  159. },
  160. ],
  161. [
  162. {
  163. xtype: 'textbox',
  164. label: '检索条件',
  165. name: 'queryProperties',
  166. prompt: queryFormPrompt,
  167. labelWidth: 'auto',
  168. width: 320,
  169. events: {keydown: enterQueryGrid1},
  170. },
  171. {
  172. xtype: 'yvselect', label: '库存状态', name: 'hasStock', data: [
  173. {id: '', text: '全部'},
  174. {id: '1', text: '有库存'},
  175. {id: '0', text: '无库存'}
  176. ],
  177. labelWidth: 'auto', width: 180,
  178. onChange: function (value) {
  179. queryGrid1();
  180. }
  181. },
  182. {
  183. xtype: 'yvselect', label: '批次状态', name: 'matQc',
  184. data: $.yvan.sysDict('matQc').combowithAll(),
  185. labelWidth: 'auto', width: 180,
  186. onChange: function (value) {
  187. queryGrid1();
  188. }
  189. },
  190. {
  191. xtype: 'yvselect', label: '仓库', name: 'roomId', labelWidth: 'auto', width: 220,
  192. data: getRoomList(),
  193. onChange: function () {
  194. queryGrid1();
  195. }
  196. },
  197. ],
  198. ]
  199. };
  200. // 列表1增删改查按钮
  201. var gridToolbarTitle1 = '批次列表';// 自行替换此参数
  202. var gridToolbar1 = {
  203. xtype: 'toolbar',
  204. title: gridToolbarTitle1,
  205. items: []
  206. };
  207. return {
  208. north: {
  209. height: 135,
  210. split: true,
  211. border: false,
  212. items: [
  213. queryToolbar,
  214. queryForm
  215. ]
  216. },
  217. center: {
  218. height: '70%',
  219. split: true,
  220. items: {
  221. onRender: function () {
  222. $grid1 = $(this);
  223. queryGrid1();
  224. },
  225. xtype: 'grid',
  226. toolbar: gridToolbar1,
  227. autoSizeColumns: true,
  228. columns:
  229. [[
  230. {title: '批次ID', field: 'batchId', hidden: true},
  231. {title: '物资ID', field: 'matId', hidden: true},
  232. {title: '批次条码', field: 'batchBar', hidden: true},
  233. {title: '批次号', field: 'batchCode', width: 200},
  234. {title: '物资编码', field: 'matBar', width: 200},
  235. {title: '图号/型号', field: 'matCode', width: 200},
  236. {title: '物资名称', field: 'matName', width: 200},
  237. {title: '物资编码属性', field: 'matAttrCode'},
  238. {title: '物资分类', field: 'matType', formatter: $.fn.fmatter.matType, width: 80},
  239. {title: '检验分类', field: 'matcName', width: 200},
  240. {title: '供应商', field: 'corpName'},
  241. {title: '购买单位', field: 'corpUnit'},
  242. {title: '购买数', field: 'corpAmount', align: 'right', formatter: $.fn.fmatter.formatNumberBigDecimal},
  243. {title: '库存数', field: 'stockAmount', align: 'right', formatter: $.fn.fmatter.formatNumberBigDecimal},
  244. {title: '生产日期', field: 'dateMade', width: 140, formatter: $.fn.fmatter.tsymd, align: 'center',},
  245. {title: '保证贮存期', field: 'saveMinDate', formatter: $.fn.fmatter.tsymd, align: "center"},
  246. {title: '最大贮存期', field: 'saveMaxDate', formatter: $.fn.fmatter.tsymd, align: "center"},
  247. {title: '入库日期', field: 'dateArrival', width: 140, formatter: $.fn.fmatter.tsymd, align: 'center',},
  248. {title: '检验员', field: 'name'},
  249. ]],
  250. onSelectRow: function (rowid) {
  251. queryGrid2();
  252. }
  253. }
  254. },
  255. south: {
  256. height: '30%',
  257. border: false,
  258. items: {
  259. xtype: 'tabs',
  260. items: [
  261. {
  262. title: '批次位置信息',
  263. lazy: true,
  264. items: {
  265. onRender: function () {
  266. $grid2 = $(this);
  267. },
  268. xtype: 'grid',
  269. autoSizeColumns: true,
  270. pagination: true,
  271. columns: [
  272. [
  273. {title: '编码属性ID', field: 'celldetId', hidden: true},
  274. {title: '货位ID', field: 'cellId', hidden: true},
  275. {title: '库存ID', field: 'stockId', hidden: true},
  276. {title: '单据ID', field: 'billId', hidden: true},
  277. {title: '库区', field: 'farmName', width: 140},
  278. {title: '仓库', field: 'roomName', width: 140},
  279. {title: '区域', field: 'workArea', width: 200, formatter: $.fn.fmatter.workArea,},
  280. {title: '货组', field: 'rowName', width: 200, align: "center"},
  281. {title: '货位类型', field: 'cellMatQc', width: 200, align: "center", formatter: $.fn.fmatter.matQc,},
  282. {title: '货位号', field: 'cellBar', width: 200, align: "center"},
  283. {
  284. title: '数量',
  285. field: 'matAmount',
  286. width: 350,
  287. align: "right",
  288. formatter: $.fn.fmatter.formatNumberBigDecimal
  289. },
  290. ]
  291. ]
  292. }
  293. },
  294. ]
  295. }
  296. }
  297. };
  298. };
  299. });