QueryPanel_2.js 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422
  1. Ext.define('make.view.make.makeDetail.QueryPanel_2', {
  2. extend: 'saas.view.core.query.QueryPanel',
  3. xtype: 'make-makedetail-querypanel-2',
  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-2',
  24. caller: 'MakeSetPick',
  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. }, {
  83. xtype: 'textfield',
  84. name: 'pr_orispeccode',
  85. fieldLabel: '产品型号',
  86. readOnly: true,
  87. }, {
  88. xtype: "remotecombo",
  89. name: "pr_brand",
  90. fieldLabel: "厂家/品牌",
  91. storeUrl: '/api/document/productbrand/getCombo',
  92. editable: false,
  93. hiddenBtn:true
  94. },{
  95. xtype: "remotecombo",
  96. name: "ma_kind",
  97. fieldLabel: "制造类型",
  98. storeUrl:'/api/make/kind/list/make',
  99. valueField:'mk_name',
  100. displayField: 'mk_name',
  101. editable: false,
  102. hiddenBtn:true
  103. },{
  104. xtype: 'remotecombo',
  105. name: "ma_wcname",
  106. fieldLabel: "工作中心",
  107. storeUrl: '/api/document/workcenter/getCombo',
  108. editable: false,
  109. hiddenBtn:true
  110. },{
  111. xtype: 'combobox',
  112. name: 'ma_statuscode',
  113. fieldLabel: '审核状态',
  114. queryMode: 'local',
  115. displayField: 'ma_status',
  116. valueField: 'ma_statuscode',
  117. emptyText :'全部',
  118. editable:false,
  119. store: Ext.create('Ext.data.ArrayStore', {
  120. fields: ['ma_statuscode', 'ma_status'],
  121. data: [
  122. ["ALL", "全部"],
  123. ["AUDITED", "已审核"],
  124. ["UNAUDITED", "未审核"]
  125. ]
  126. }),
  127. getCondition: function(value) {
  128. if(value == 'ALL') {
  129. return '1=1';
  130. }else {
  131. return 'ma_statuscode=\'' + value + '\'';
  132. }
  133. }
  134. }, {
  135. xtype: 'employeeDbfindTrigger',
  136. name: 'creatorName',
  137. fieldLabel: '录入人',
  138. emptyText:'请输入账户名称或姓名',
  139. getCondition: function(value) {
  140. if(!value) {
  141. return '1=1';
  142. }else {
  143. return 'make.creatorName like\'%' + value + '%\'';
  144. }
  145. }
  146. },{
  147. xtype: 'condatefield',
  148. name: 'ma_planbegindate',
  149. fieldLabel: '计划开工日期',
  150. value:7,
  151. columnWidth: 1
  152. },{
  153. xtype: 'condatefield',
  154. name: 'ma_planenddate',
  155. fieldLabel: '计划完工日期',
  156. value:7,
  157. columnWidth: 1
  158. },{
  159. xtype: 'condatefield',
  160. name: 'make.createTime',
  161. fieldLabel: '录入日期',
  162. value:7,
  163. columnWidth: 1
  164. }, {
  165. xtype: 'employeeDbfindTrigger',
  166. name: 'ma_auditman',
  167. fieldLabel: '审核人',
  168. emptyText:'请输入账户名称或姓名',
  169. }],
  170. queryGridConfig: {
  171. idField: 'ma_id',
  172. codeField: 'ma_code',
  173. mainIdField:'ma_id',
  174. detailIdField:'mm_id',
  175. addTitle: '制造单',
  176. addXtype: 'make-makebase-formpanel',
  177. baseVastUrl: me.baseVastUrl,
  178. turnQtyField: 'ma_thisqty',
  179. caller: me.caller,
  180. useGridCaller: true, //使用grid的caller
  181. defaultCondition:me.defaultCondition,
  182. toolBtns: [{
  183. text: '转领料',
  184. xtype: 'button',
  185. handler: 'turnSetPick'
  186. }],
  187. baseColumn: [{
  188. text: 'id',
  189. dataIndex: 'ma_id',
  190. hidden: true,
  191. xtype: 'numbercolumn'
  192. },{
  193. text: '本次套数',
  194. align: 'center',
  195. dataIndex: 'ma_thisqty',
  196. xtype: 'widgetcolumn',
  197. width: 110,
  198. renderer : function(val, meta, record, x, y, store, view) {
  199. var data = record.data;
  200. v = data.ma_qty-data.ma_turnsetqty;
  201. if(!val){
  202. val=v;
  203. }
  204. //工单数量ma_qty -已转齐套数 ma_turnsetqty
  205. record.data['ma_thisqty'] = val;
  206. return val;
  207. },
  208. widget: {
  209. xtype: "numberfield",
  210. cls:'widget-number',
  211. bind: '{record.ma_thisqty}',
  212. decimalPrecision: 6,
  213. minValue: 0,
  214. listeners:{
  215. blur: function(f ,event, e){
  216. var record = f.lookupViewModel().data.record;
  217. if(record){
  218. var v=saas.util.NumberUtil.accSub(record.get('ma_qty'),record.get('ma_turnsetqty')),
  219. val = record.get('ma_thisqty');
  220. if(!val){
  221. val=v;
  222. }
  223. var maxValue=saas.util.NumberUtil.accSub(record.get('ma_qty'),record.get('ma_turnsetqty'));
  224. val =Ext.Number.from(val,maxValue);
  225. if(val> maxValue){
  226. val = maxValue;
  227. saas.util.BaseUtil.showErrorToast('请不要输入超过最大数量' + maxValue + "的值!");
  228. }
  229. record.set('ma_thisqty', val);
  230. //每日产能不为0时,领料天数默认为 round(本次套数/每日产能,2)
  231. var data = record.data;
  232. if(null != data.ma_prdailycapacity && data.ma_prdailycapacity >0){
  233. record.set('getDays',(data.ma_thisqty/data.ma_prdailycapacity).toFixed(2));
  234. }else{
  235. record.set('getDays',0);
  236. }
  237. }
  238. }
  239. }
  240. }
  241. },{
  242. text: '领料天数',
  243. dataIndex: 'getDays',
  244. xtype: 'widgetcolumn',
  245. renderer:function(val, meta, record, x, y, store, view) {
  246. var data = record.data;
  247. //每日产能不为0时,领料天数默认为 round(本次套数/每日产能,2)
  248. if(null != data.ma_prdailycapacity && data.ma_prdailycapacity >0){
  249. val = (data.ma_thisqty/data.ma_prdailycapacity).toFixed(2);
  250. }else{
  251. val = 0;
  252. }
  253. record.set('getDays',val);
  254. return val;
  255. },
  256. widget: {
  257. xtype: "numberfield",
  258. cls:'widget-number',
  259. bind: '{record.getDays}',
  260. decimalPrecision: 6,
  261. minValue: 0,
  262. listeners:{
  263. blur: function(f ,event, e){
  264. var record = f.lookupViewModel().data.record;
  265. if(record){
  266. //输入领料天数则自动计算本次套料(本次套料=min(floor(领料天数*每日产能,1),(工单数量-已转套料数)))
  267. if(null != data.ma_prdailycapacity && data.ma_prdailycapacity >0){
  268. var data = record.data;
  269. var dayThis = Math.floor(data.getDays*data.ma_prdailycapacity * 10) / 10;
  270. var v = saas.util.NumberUtil.accSub(data.ma_qty,data.ma_turnsetqty);
  271. if(dayThis > v){
  272. record.set('ma_thisqty', v);
  273. }else{
  274. record.set('ma_thisqty', dayThis);
  275. }
  276. }
  277. }
  278. },
  279. }
  280. }
  281. },{
  282. text: '每日产能',
  283. dataIndex: 'ma_prdailycapacity',
  284. xtype: 'numbercolumn',
  285. align: 'center',
  286. width: 110,
  287. renderer : function(val, meta, record, x, y, store, view) {
  288. return saas.util.BaseUtil.numberFormat(val, 6, true);
  289. },
  290. },{
  291. text: 'id',
  292. dataIndex: 'ma_id',
  293. hidden: true,
  294. xtype: 'numbercolumn'
  295. },{
  296. text: '工单数量',
  297. align: 'center',
  298. dataIndex: 'ma_qty',
  299. xtype: 'numbercolumn',
  300. width: 110,
  301. renderer : function(v, m, r) {
  302. return saas.util.BaseUtil.numberFormat(v, 6, true);
  303. },
  304. },{
  305. text: '已转套料数',
  306. align: 'center',
  307. dataIndex: 'ma_turnsetqty',
  308. width: 110
  309. },{
  310. text: '已领齐套数',
  311. align: 'center',
  312. dataIndex: 'ma_setqty',
  313. width: 110
  314. },{
  315. text: '销售单号',
  316. dataIndex: 'ma_salecode',
  317. width: 0
  318. }, {
  319. text: '制造单号',
  320. dataIndex: 'ma_code',
  321. width: 150
  322. }, {
  323. text: '客户名称',
  324. dataIndex: 'ma_custname',
  325. width: 150
  326. }, {
  327. text: '交货日期',
  328. align: 'center',
  329. dataIndex: 'ma_delivery',
  330. width: 100,
  331. xtype:'datecolumn'
  332. },{
  333. text: '产品编号',
  334. dataIndex: 'ma_prodcode',
  335. width: 150
  336. },{
  337. text: '产品名称',
  338. dataIndex: 'ma_prdetail',
  339. width: 150
  340. },{
  341. text: '产品型号',
  342. dataIndex: 'ma_prorispeccode',
  343. width: 150,
  344. renderer : saas.util.RenderUtil['renderer_makeprod']
  345. },{
  346. text: '已完工数',
  347. align: 'center',
  348. dataIndex: 'ma_madeqty',
  349. xtype: 'numbercolumn',
  350. width: 110,
  351. renderer : function(v, m, r) {
  352. return saas.util.BaseUtil.numberFormat(v, 6, true);
  353. },
  354. },{
  355. text: '已转完工数',
  356. align: 'center',
  357. dataIndex: 'ma_turnmadeqty',
  358. xtype: 'numbercolumn',
  359. width: 110,
  360. renderer : function(v, m, r) {
  361. return saas.util.BaseUtil.numberFormat(v, 6, true);
  362. },
  363. },{
  364. text: '可完工数',
  365. align: 'center',
  366. dataIndex: 'ma_canmadeqty',
  367. xtype: 'numbercolumn',
  368. width: 110,
  369. renderer : function(v, m, r) {
  370. return saas.util.BaseUtil.numberFormat(v, 6, true);
  371. },
  372. },{
  373. text: '制造类型',
  374. dataIndex: 'ma_kind',
  375. width: 100,
  376. },{
  377. text: '工作中心',
  378. dataIndex: 'ma_wcname',
  379. width: 100,
  380. },{
  381. text: '审核状态',
  382. dataIndex: 'ma_status',
  383. width: 100,
  384. },{
  385. text: '领料状态',
  386. dataIndex: 'ma_getstatus',
  387. width: 100,
  388. },{
  389. text: '完工状态',
  390. dataIndex: 'ma_finishstatus',
  391. width: 100,
  392. },{
  393. text: '制单人',
  394. dataIndex: 'creatorName',
  395. width: 100,
  396. },{
  397. text: '计划开工日期',
  398. dataIndex: 'ma_planbegindate',
  399. width: 130,
  400. xtype:'datecolumn'
  401. },{
  402. text: '计划完工日期',
  403. dataIndex: 'ma_planenddate',
  404. width: 130,
  405. xtype:'datecolumn'
  406. },{
  407. text: '备注',
  408. dataIndex: 'ma_remark',
  409. width: 100
  410. }],
  411. relativeColumn: []
  412. }
  413. });
  414. this.callParent(arguments);
  415. },
  416. });