QueryPanel_1.js 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402
  1. Ext.define('make.view.make.makeDetail.QueryPanel_1', {
  2. extend: 'saas.view.core.query.QueryPanel',
  3. xtype: 'make-makedetail-querypanel-1',
  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-1',
  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": "make.creatorName", "dbfinds": [{
  51. from: 'em_name',
  52. to: 'make.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. caller: me.caller,
  200. useGridCaller: true, //使用grid的caller
  201. defaultCondition:me.defaultCondition,
  202. toolBtns: [{
  203. text: '转领料',
  204. xtype: 'button',
  205. handler: 'turnPick'
  206. }],
  207. groupField:'ma_code',
  208. groupHeaderTpl: Ext.create('Ext.XTemplate',
  209. '<div class="groupHeaderTpl" style="margin:0px 0px 0px 100px">',
  210. '<span style="width:250px">制造单号:{[values.rows[0].data.ma_code]}</span>',
  211. '<span style="width:200px">销售单号:{[values.rows[0].data.ma_salecode]}</span>',
  212. '<span style="width:280px">客户名称:{[values.rows[0].data.ma_custname]}</span>',
  213. '<span style="width:200px">产品编号:{[values.rows[0].data.ma_prcode]}</span>',
  214. '<span style="width:200px">产品型号:{[values.rows[0].data.ma_prorispeccode]}</span>',
  215. '<span style="width:140px">数量:{[saas.util.BaseUtil.numberFormat(values.rows[0].data.ma_qty,3,true)]}</span>',
  216. '<span style="width:140px">已完工数:{[saas.util.BaseUtil.numberFormat(values.rows[0].data.ma_madeqty,3,true)]}</span>',
  217. '</div>'
  218. ),
  219. onGroupClick: function(view, group, idx, e){
  220. if(e.target && e.target.nodeName == 'A'){
  221. var grid = view.up('grid'),
  222. rec = e.record,
  223. idValue = rec.get('ma_id'),
  224. codeValue = rec.get('ma_code');
  225. saas.util.BaseUtil.openTab(grid.addXtype, grid.addTitle+"("+codeValue+")", grid.addXtype + '-' + idValue, {
  226. initId: idValue
  227. });
  228. }
  229. },
  230. setBackGround:function(record){
  231. return record.get('mm_thisqty') > (record.get('po_mrponhand') || 0) ? 'x-overthisline' : '';
  232. },
  233. baseColumn: [{
  234. text: 'id',
  235. dataIndex: 'id',
  236. hidden: true,
  237. xtype: 'numbercolumn'
  238. },{
  239. text: '交货日期',
  240. dataIndex: 'ma_delivery',
  241. hidden: true,
  242. },{
  243. text: '产品名称',
  244. dataIndex: 'ma_prdetail',
  245. hidden: true,
  246. },{
  247. text: '产品规格',
  248. dataIndex: 'ma_prspec',
  249. hidden: true,
  250. },{
  251. text: '本次数量',
  252. align: 'center',
  253. dataIndex: 'mm_thisqty',
  254. xtype: 'widgetcolumn',
  255. width: 110,
  256. /* renderer : function(val, meta, record, x, y, store, view) {
  257. var data = record.data;
  258. v = data.sd_qty-data.sd_yqty;
  259. if(!val){
  260. val=v;
  261. }
  262. var maxValue=(data.sd_qty-data.sd_yqty);
  263. val =Ext.Number.from(val,maxValue);
  264. if(val> maxValue){
  265. val = maxValue;
  266. saas.util.BaseUtil.showErrorToast('请不要输入超过最大数量' + maxValue + "的值!");
  267. }
  268. record.data['this_yqty']=val;
  269. return val;
  270. }, */
  271. widget: {
  272. xtype: "numberfield",
  273. cls:'widget-number',
  274. bind: '{record.mm_thisqty}',
  275. decimalPrecision: 6,
  276. minValue: 0,
  277. listeners:{
  278. blur: function(f ,event, e){
  279. var record = f.lookupViewModel().data.record,
  280. maxVal,nowVal;
  281. if(record){
  282. if(!Ext.isEmpty(record.modified['mm_thisqty'])){ //若存在修改
  283. maxVal = record.modified['mm_thisqty'];
  284. nowVal = f.value;
  285. if(Ext.isEmpty(nowVal)){
  286. record.set('mm_thisqty', maxVal)
  287. }else if(nowVal>maxVal){
  288. record.set('mm_thisqty', maxVal)
  289. saas.util.BaseUtil.showErrorToast('请不要输入超过最大数量' + maxVal + "的值!");
  290. }
  291. }
  292. }
  293. }
  294. }
  295. }
  296. },{
  297. text: '工单序号',
  298. dataIndex: 'mm_detno',
  299. align: 'center',
  300. width: 80
  301. },{
  302. text: '良品库存',
  303. dataIndex: 'po_mrponhand',
  304. align: 'center',
  305. xtype: 'numbercolumn',
  306. width: 110,
  307. renderer : function(v, m, r) {
  308. return saas.util.BaseUtil.numberFormat(v, 6, true);
  309. },
  310. },{
  311. text: '物料编号',
  312. dataIndex: 'mm_prodcode',
  313. width: 150
  314. },{
  315. text: '物料名称',
  316. dataIndex: 'pr_detail',
  317. width: 150
  318. },{
  319. text: '物料规格',
  320. dataIndex: 'pr_desc',
  321. width: 150
  322. },{
  323. text: '单位',
  324. align: 'center',
  325. dataIndex: 'pr_unit',
  326. width: 80
  327. },{
  328. text: '单位用量',
  329. align: 'center',
  330. dataIndex: 'mm_oneuseqty',
  331. width: 80
  332. },{
  333. text: '需求数',
  334. align: 'center',
  335. dataIndex: 'ma_qty',
  336. xtype: 'numbercolumn',
  337. width: 110,
  338. renderer : function(v, m, r) {
  339. return saas.util.BaseUtil.numberFormat(v, 6, true);
  340. },
  341. },{
  342. text: '已领数',
  343. align: 'center',
  344. dataIndex: 'mm_havegetqty',
  345. xtype: 'numbercolumn',
  346. width: 110,
  347. renderer : function(v, m, r) {
  348. return saas.util.BaseUtil.numberFormat(v, 6, true);
  349. },
  350. },{
  351. text: '已转领料数',
  352. align: 'center',
  353. dataIndex: 'mm_turngetqty',
  354. xtype: 'numbercolumn',
  355. width: 110,
  356. renderer : function(v, m, r) {
  357. return saas.util.BaseUtil.numberFormat(v, 6, true);
  358. },
  359. },{
  360. text: '未领数',
  361. align: 'center',
  362. dataIndex: 'mm_restgetqty',
  363. xtype: 'numbercolumn',
  364. width: 110,
  365. renderer : function(v, m, r) {
  366. v = r.get('mm_qty') + (r.get('mm_scrapqty')||0) - (r.get('mm_havegetqty')||0)-(r.get('mm_turngetqty')||0);
  367. return saas.util.BaseUtil.numberFormat(v, 6, true);
  368. }
  369. },{
  370. text: '制程不良数',
  371. align: 'center',
  372. dataIndex: 'mm_returnmqty',
  373. xtype: 'numbercolumn',
  374. width: 110,
  375. renderer : function(v, m, r) {
  376. return saas.util.BaseUtil.numberFormat(v, 6, true);
  377. },
  378. },{
  379. text: '报废数',
  380. align: 'center',
  381. dataIndex: 'mm_turnscrapqty',
  382. xtype: 'numbercolumn',
  383. width: 110,
  384. renderer : function(v, m, r) {
  385. return saas.util.BaseUtil.numberFormat(v, 6, true);
  386. },
  387. },{
  388. text: '备注',
  389. dataIndex: 'ma_remark',
  390. width: 100
  391. }],
  392. relativeColumn: []
  393. }
  394. });
  395. this.callParent(arguments);
  396. },
  397. });