queryBatchRoom.js 10 KB

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