QueryPanel_3.js 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403
  1. Ext.define('make.view.make.makeDetail.QueryPanel_3', {
  2. extend: 'saas.view.core.query.QueryPanel',
  3. xtype: 'make-makedetail-querypanel-3',
  4. controller: 'make-makedetail-querypanel',
  5. viewModel: {
  6. extend: 'saas.view.core.query.QueryPanelModel',
  7. data: {
  8. form: {}, // 查询字段记录
  9. addEnable: false, // 显示新增按钮
  10. auditEnable: false, // 显示审核按钮
  11. printEnable: false, // 显示打印按钮
  12. importEnable: false, // 显示导入按钮
  13. exportEnable: true, // 显示导出按钮
  14. closeEnable: false, // 显示关闭按钮
  15. deleteEnable: false, // 显示删除按钮
  16. deleteDisable:false, //删除按钮是否可使用
  17. openAudit:false,//单独显示审核按钮
  18. openUnAudit:false,//单独显示反审核按钮
  19. openEnable:false, //显示开启 针对已取消列表
  20. configurable: true, // 允许列设置
  21. }
  22. },
  23. viewName: 'make-makedetail-querypanel-3',
  24. caller: 'MakeDetail',
  25. //importUploadPath: '/api/purchse/makereturn/saveToFormal',
  26. initComponent: function () {
  27. var me = this ;
  28. Ext.apply(this, {
  29. queryFormItems: [{
  30. xtype: 'condatefield',
  31. name: 'make.createTime',
  32. fieldLabel: '日期',
  33. columnWidth: 0.5,
  34. operation: 'between',
  35. },{
  36. xtype: 'multiqueryField',
  37. columnWidth: 0.4,
  38. name: 'multi_query',
  39. querys: {
  40. "MakeCode": {"field": "ma_code" ,"desc": "制造单号"},
  41. "BillCode": {"field": "ma_salecode" ,"desc": "订单号"},
  42. "Cust": {"field": "ma_custcode" ,"desc": "客户"},
  43. "Prod": {"field": "ma_prodcode", "dbfinds": [{//物料
  44. from: 'pr_code',
  45. to: 'ma_prodcode'
  46. },{
  47. from: 'pr_detail',
  48. to: 'pr_detail'
  49. }]},
  50. "Emp":{"field": "prodinout.creatorName", "dbfinds": [{
  51. from: 'em_name',
  52. to: 'prodinout.creatorName'
  53. }]},
  54. },
  55. setShowDetail: function(v){
  56. this.showDetail = false;
  57. }
  58. }],
  59. moreQueryFormItems: [{
  60. xtype: 'saledetailDbfindTrigger',
  61. name: 'ma_salecode',
  62. fieldLabel: '订单编号'
  63. },{
  64. xtype: "customerDbfindTrigger",
  65. name: "ma_custname",
  66. fieldLabel: "客户名称",
  67. },{
  68. xtype: 'condatefield',
  69. name: 'ma_delivery',
  70. fieldLabel: '交货日期',
  71. value:7,
  72. columnWidth: 1
  73. },{
  74. xtype: 'productDbfindTrigger',
  75. name: 'ma_prodcode',
  76. fieldLabel: '物料编号'
  77. },{
  78. xtype: 'textfield',
  79. name: 'pr_detail',
  80. fieldLabel: '产品名称',
  81. readOnly: true,
  82. getCondition: function(value) {
  83. if(!value) {
  84. return '1=1';
  85. }else {
  86. return 'p.pr_detail like\'%' + value + '%\'';
  87. }
  88. }
  89. }, {
  90. xtype: 'textfield',
  91. name: 'pr_orispeccode',
  92. fieldLabel: '产品型号',
  93. readOnly: true,
  94. getCondition: function(value) {
  95. if(!value) {
  96. return '1=1';
  97. }else {
  98. return 'p.pr_orispeccode like\'%' + value + '%\'';
  99. }
  100. }
  101. }, {
  102. xtype: "remotecombo",
  103. name: "pr_brand",
  104. fieldLabel: "厂家/品牌",
  105. storeUrl: '/api/document/productbrand/getCombo',
  106. editable: false,
  107. hiddenBtn:true,
  108. getCondition: function(value) {
  109. if(!value) {
  110. return '1=1';
  111. }else {
  112. return 'p.pr_brand like\'%' + value + '%\'';
  113. }
  114. }
  115. },{
  116. xtype: "remotecombo",
  117. name: "ma_kind",
  118. fieldLabel: "制造类型",
  119. storeUrl:'/api/make/kind/list/make',
  120. valueField:'mk_name',
  121. displayField: 'mk_name',
  122. editable: false,
  123. hiddenBtn:true
  124. },{
  125. xtype: 'remotecombo',
  126. name: "ma_wcname",
  127. fieldLabel: "工作中心",
  128. storeUrl: '/api/document/workcenter/getCombo',
  129. editable: false,
  130. hiddenBtn:true
  131. },{
  132. xtype: 'combobox',
  133. name: 'ma_statuscode',
  134. fieldLabel: '审核状态',
  135. queryMode: 'local',
  136. displayField: 'ma_status',
  137. valueField: 'ma_statuscode',
  138. emptyText :'全部',
  139. editable:false,
  140. store: Ext.create('Ext.data.ArrayStore', {
  141. fields: ['ma_statuscode', 'ma_status'],
  142. data: [
  143. ["ALL", "全部"],
  144. ["AUDITED", "已审核"],
  145. ["UNAUDITED", "未审核"]
  146. ]
  147. }),
  148. getCondition: function(value) {
  149. if(value == 'ALL') {
  150. return '1=1';
  151. }else {
  152. return 'ma_statuscode=\'' + value + '\'';
  153. }
  154. }
  155. }, {
  156. xtype: 'employeeDbfindTrigger',
  157. name: 'creatorName',
  158. fieldLabel: '录入人',
  159. emptyText:'请输入账户名称或姓名',
  160. getCondition: function(value) {
  161. if(!value) {
  162. return '1=1';
  163. }else {
  164. return 'make.creatorName like\'%' + value + '%\'';
  165. }
  166. }
  167. },{
  168. xtype: 'condatefield',
  169. name: 'ma_planbegindate',
  170. fieldLabel: '计划开工日期',
  171. value:7,
  172. columnWidth: 1
  173. },{
  174. xtype: 'condatefield',
  175. name: 'ma_planenddate',
  176. fieldLabel: '计划完工日期',
  177. value:7,
  178. columnWidth: 1
  179. },{
  180. xtype: 'condatefield',
  181. name: 'make.createTime',
  182. fieldLabel: '录入日期',
  183. value:7,
  184. columnWidth: 1
  185. }, {
  186. xtype: 'employeeDbfindTrigger',
  187. name: 'ma_auditman',
  188. fieldLabel: '审核人',
  189. emptyText:'请输入账户名称或姓名',
  190. }],
  191. queryGridConfig: {
  192. idField: 'ma_id',
  193. codeField: 'ma_code',
  194. mainIdField:'ma_id',
  195. detailIdField:'mm_id',
  196. addTitle: '制造单',
  197. addXtype: 'make-makebase-formpanel',
  198. baseVastUrl:me.baseVastUrl,
  199. defaultCondition: me.defaultCondition,
  200. caller: me.caller,
  201. useGridCaller :true,
  202. toolBtns: [{
  203. text: '转退料',
  204. xtype: 'button',
  205. handler: 'turnBack'
  206. },{
  207. text: '转报废',
  208. xtype: 'button',
  209. handler: 'turnScrap'
  210. }],
  211. groupField:'ma_code',
  212. groupHeaderTpl: Ext.create('Ext.XTemplate',
  213. '<div class="groupHeaderTpl" style="margin:0px 0px 0px 100px">',
  214. '<span style="width:250px">制造单号:{[values.rows[0].data.ma_code]}</span>',
  215. '<span style="width:200px">销售单号:{[values.rows[0].data.ma_salecode]}</span>',
  216. '<span style="width:280px">客户名称:{[values.rows[0].data.ma_custname]}</span>',
  217. '<span style="width:200px">产品编号:{[values.rows[0].data.ma_prcode]}</span>',
  218. '<span style="width:200px">产品型号:{[values.rows[0].data.ma_prorispeccode]}</span>',
  219. '<span style="width:140px">数量:{[values.rows[0].data.ma_qty]}</span>',
  220. '<span style="width:140px">已完工数:{[values.rows[0].data.ma_madeqty]}</span>',
  221. '</div>'
  222. ),
  223. onGroupClick: function(view, group, idx, e){
  224. if(e.target && e.target.nodeName == 'A'){
  225. var grid = view.up('grid'),
  226. rec = e.record,
  227. idValue = rec.get('ma_id'),
  228. codeValue = rec.get('ma_code');
  229. saas.util.BaseUtil.openTab(grid.addXtype, grid.addTitle+"("+codeValue+")", grid.addXtype + '-' + idValue, {
  230. initId: idValue
  231. });
  232. }
  233. },
  234. baseColumn: [{
  235. text: 'id',
  236. dataIndex: 'ma_id',
  237. hidden: true,
  238. xtype: 'numbercolumn'
  239. },{
  240. text: '交货日期',
  241. dataIndex: 'ma_delivery',
  242. hidden: true,
  243. },{
  244. text: '产品名称',
  245. dataIndex: 'ma_prdetail',
  246. hidden: true,
  247. },{
  248. text: '产品规格',
  249. dataIndex: 'ma_prspec',
  250. hidden: true,
  251. },{
  252. text: '本次数量',
  253. align: 'center',
  254. dataIndex: 'mm_thisqty',
  255. xtype: 'widgetcolumn',
  256. width: 110,
  257. /* renderer : function(val, meta, record, x, y, store, view) {
  258. var data = record.data;
  259. v = data.sd_qty-data.sd_yqty;
  260. if(!val){
  261. val=v;
  262. }
  263. var maxValue=(data.sd_qty-data.sd_yqty);
  264. val =Ext.Number.from(val,maxValue);
  265. if(val> maxValue){
  266. val = maxValue;
  267. saas.util.BaseUtil.showErrorToast('请不要输入超过最大数量' + maxValue + "的值!");
  268. }
  269. record.data['this_yqty']=val;
  270. return val;
  271. }, */
  272. widget: {
  273. xtype: "numberfield",
  274. cls:'widget-number',
  275. bind: '{record.mm_thisqty}',
  276. decimalPrecision: 6,
  277. minValue: 0,
  278. listeners:{
  279. blur: function(f ,event, e){
  280. var record = f.lookupViewModel().data.record,
  281. maxVal,nowVal;
  282. if(record){
  283. if(!Ext.isEmpty(record.modified['mm_thisqty'])){ //若存在修改
  284. maxVal = record.modified['mm_thisqty'];
  285. nowVal = f.value;
  286. if(Ext.isEmpty(nowVal)){
  287. record.set('mm_thisqty', maxVal)
  288. }else if(nowVal>maxVal){
  289. record.set('mm_thisqty', maxVal)
  290. saas.util.BaseUtil.showErrorToast('请不要输入超过最大数量' + maxVal + "的值!");
  291. }
  292. }
  293. }
  294. }
  295. }
  296. }
  297. },{
  298. text: '工单序号',
  299. dataIndex: 'mm_detno',
  300. align: 'center',
  301. width: 80
  302. },{
  303. text: '物料编号',
  304. dataIndex: 'mm_prodcode',
  305. width: 150
  306. },{
  307. text: '物料名称',
  308. dataIndex: 'pr_detail',
  309. width: 150
  310. },{
  311. text: '物料规格',
  312. dataIndex: 'pr_desc',
  313. width: 150
  314. },{
  315. text: '单位',
  316. align: 'center',
  317. dataIndex: 'pr_unit',
  318. width: 80
  319. },{
  320. text: '单位用量',
  321. align: 'center',
  322. dataIndex: 'mm_oneuseqty',
  323. width: 80
  324. },{
  325. text: '需求数',
  326. align: 'center',
  327. dataIndex: 'ma_qty',
  328. xtype: 'numbercolumn',
  329. width: 110,
  330. renderer : function(v, m, r) {
  331. return saas.util.BaseUtil.numberFormat(v, 6, true);
  332. },
  333. },{
  334. text: '已领数',
  335. align: 'center',
  336. dataIndex: 'mm_havegetqty',
  337. xtype: 'numbercolumn',
  338. width: 110,
  339. renderer : function(v, m, r) {
  340. return saas.util.BaseUtil.numberFormat(v, 6, true);
  341. },
  342. },{
  343. text: '未领数',
  344. align: 'center',
  345. dataIndex: 'mm_restgetqty',
  346. xtype: 'numbercolumn',
  347. width: 110,
  348. renderer : function(v, m, r) {
  349. v = r.get('mm_qty') + (r.get('mm_scrapqty')||0) - (r.get('mm_havegetqty')||0);
  350. return saas.util.BaseUtil.numberFormat(v, 6, true);
  351. }
  352. },{
  353. text: '制程不良数',
  354. align: 'center',
  355. dataIndex: 'mm_returnmqty',
  356. xtype: 'numbercolumn',
  357. width: 110,
  358. renderer : function(v, m, r) {
  359. return saas.util.BaseUtil.numberFormat(v, 6, true);
  360. },
  361. },{
  362. text: '已转退料数',
  363. align: 'center',
  364. dataIndex: 'mm_turnbackqty',
  365. xtype: 'numbercolumn',
  366. width: 110,
  367. renderer : function(v, m, r) {
  368. return saas.util.BaseUtil.numberFormat(v, 6, true);
  369. },
  370. },{
  371. text: '报废数',
  372. align: 'center',
  373. dataIndex: 'mm_turnscrapqty',
  374. xtype: 'numbercolumn',
  375. width: 110,
  376. renderer : function(v, m, r) {
  377. return saas.util.BaseUtil.numberFormat(v, 6, true);
  378. },
  379. },{
  380. text: '已转报废数',
  381. align: 'center',
  382. dataIndex: 'mm_turnscrapqty',
  383. xtype: 'numbercolumn',
  384. width: 110,
  385. renderer : function(v, m, r) {
  386. return saas.util.BaseUtil.numberFormat(v, 6, true);
  387. },
  388. },{
  389. text: '备注',
  390. dataIndex: 'ma_remark',
  391. width: 100
  392. }],
  393. relativeColumn: []
  394. }
  395. });
  396. this.callParent(arguments);
  397. },
  398. });