FormPanel.js 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462
  1. Ext.define('make.view.make.makePick.FormPanel', {
  2. extend: 'saas.view.core.form.FormPanel',
  3. xtype: ['make-makepick-formpanel', 'makepick-formpanel'],
  4. controller: 'make-makepick-formpanel',
  5. viewModel: 'make-makepick-formpanel',
  6. viewName: 'make-makepick-formpanel',
  7. caller: 'MakePick',
  8. //字段属性
  9. _title: '生产领料单',
  10. _idField: 'id',
  11. _codeField: 'pi_inoutno',
  12. _statusField: 'pi_status',
  13. _statusCodeField: 'pi_statuscode',
  14. _auditmanField: 'pi_auditman',
  15. _auditdateField: 'pi_auditdate',
  16. _relationColumn: 'pd_piid',
  17. _readUrl: '/api/make/prodinout/read',
  18. _saveUrl: '/api/make/prodinout/save',
  19. _auditUrl: '/api/make/prodinout/audit',
  20. _unAuditUrl: '/api/make/prodinout/unAudit',
  21. _deleteUrl: '/api/make/prodinout/delete',
  22. //_turnOutUrl: '/api/make/prodinout/turnPurchaseOut',
  23. initId: 0,
  24. initComponent: function () {
  25. var currentDepart = saas.util.BaseUtil.getCurrentUserDepart();
  26. Ext.apply(this, {
  27. defaultItems: [{
  28. xtype: 'hidden',
  29. name: 'id',
  30. fieldLabel: 'id',
  31. allowBlank: true,
  32. columnWidth: 0
  33. }, {
  34. xtype: "datefield",
  35. name: "pi_date",
  36. fieldLabel: "单据日期",
  37. allowBlank: false,
  38. columnWidth: 0.25,
  39. defaultValue: new Date()
  40. }, {
  41. xtype: "hidden",
  42. name: "pi_class",
  43. fieldLabel: "单据类型",
  44. readOnly: true,
  45. allowBlank: true,
  46. defaultValue: 'MAKEPICK',
  47. columnWidth: 0.25
  48. }, {
  49. xtype: 'departDbfindTrigger',
  50. name: 'pi_departmentname',
  51. fieldLabel: '部门名称',
  52. allowBlank: false,
  53. columnWidth: 0.25,
  54. defaultValue: currentDepart.dp_name
  55. }, {
  56. xtype: 'hidden',
  57. name: 'pi_departmentcode',
  58. fieldLabel: '部门编号',
  59. allowBlank: true,
  60. defaultValue: currentDepart.dp_code
  61. },{
  62. name: "detailGridField",
  63. xtype: "detailGridField",
  64. storeModel: 'make.model.make.MakePickDetail',
  65. deleteDetailUrl: '/api/make/prodinout/deleteDetail',
  66. relativeBinds:{
  67. refFields:['pd_maid'],
  68. fields:['pd_prodcode','pr_detail']
  69. },
  70. detnoColumn: 'pd_pdno',
  71. columns: [{
  72. text: "id",
  73. dataIndex: "id",
  74. xtype: "numbercolumn",
  75. hidden: true
  76. },{
  77. text: "pd_mmid",
  78. dataIndex: "pd_mmid",
  79. xtype: "numbercolumn",
  80. hidden: true
  81. },{
  82. text: "pd_maid",
  83. dataIndex: "pd_maid",
  84. xtype: "numbercolumn",
  85. hidden: true
  86. },{
  87. text: "制造单号",
  88. dataIndex: "pd_ordercode",
  89. width: 150.0,
  90. editor: {
  91. displayField: "display",
  92. editable: true,
  93. format: "",
  94. hideTrigger: false,
  95. maxLength: 100.0,
  96. minValue: null,
  97. positiveNum: false,
  98. store: null,
  99. valueField: "value",
  100. xtype: "makeMultiDbfindTrigger",
  101. caller:'MakePick'
  102. }
  103. },{
  104. text: "工单序号",
  105. dataIndex: "pd_orderdetno",
  106. align: 'center',
  107. width: 80
  108. },{
  109. text: "工单id",
  110. dataIndex: "pd_orderid",
  111. xtype: "numbercolumn",
  112. hidden: true
  113. }, {
  114. text: "物料id",
  115. dataIndex: "pd_prodid",
  116. xtype: "numbercolumn",
  117. hidden: true
  118. }, {
  119. text: "物料编号",
  120. width: 150.0,
  121. dataIndex: "pd_prodcode",
  122. xtype: "",
  123. items: null
  124. }, {
  125. text: "物料名称",
  126. width: 150.0,
  127. dataIndex: "pr_detail",
  128. ignore: true,
  129. renderer: function (v, m, r) {
  130. if (!v) {
  131. return r.data["productDTO"] ? r.data["productDTO"][m.column.dataIndex] : null;
  132. }
  133. return v;
  134. }
  135. }, {
  136. text: "厂家/品牌",
  137. hidden:true,
  138. width: 100.0,
  139. dataIndex: "pr_brand",
  140. ignore: true,
  141. renderer: function (v, m, r) {
  142. if (!v) {
  143. return r.data["productDTO"] ? r.data["productDTO"][m.column.dataIndex] : null;
  144. }
  145. return v;
  146. }
  147. }, {
  148. text: "型号",
  149. width: 200.0,
  150. dataIndex: "pr_orispeccode",
  151. ignore: true,
  152. renderer: function (v, m, r) {
  153. var str = '';
  154. if(r.data["productDTO"] ){
  155. if(r.data["productDTO"]['pr_brand']){
  156. str += '厂家/品牌:'+ r.data["productDTO"]['pr_brand'] + '<br>';
  157. }
  158. if(r.data["productDTO"]['pr_spec']){
  159. str += '规格:' + r.data["productDTO"]['pr_spec'];
  160. }
  161. if(str) m.tdAttr = 'data-qtip="'+ str +'"';
  162. if (!v) {
  163. return r.data["productDTO"] ? r.data["productDTO"][m.column.dataIndex] : null;
  164. }
  165. }
  166. return v;
  167. }
  168. }, {
  169. text: "单位",
  170. width: 65.0,
  171. dataIndex: "pr_unit",
  172. ignore: true,
  173. renderer: function (v, m, r) {
  174. if (!v) {
  175. return r.data["productDTO"] ? r.data["productDTO"][m.column.dataIndex] : null;
  176. }
  177. return v;
  178. }
  179. },{
  180. text: "发料数量",
  181. dataIndex: "pd_outqty",
  182. xtype: 'numbercolumn',
  183. width: 110.0,
  184. allowBlank: false,
  185. editor: {
  186. xtype: "numberfield",
  187. decimalPrecision: 6,
  188. minValue: 0
  189. },
  190. renderer: function(v, m, r) {
  191. return saas.util.BaseUtil.numberFormat(v, 6, true);
  192. },
  193. summaryType: 'sum',
  194. summaryRenderer: function(v, d, f, m) {
  195. return saas.util.BaseUtil.numberFormat(v, 6, true);
  196. }
  197. }, {
  198. text: "仓库id",
  199. dataIndex: "pd_whid",
  200. xtype: "numbercolumn",
  201. hidden: true
  202. }, {
  203. text: "仓库编号",
  204. dataIndex: "pd_whcode",
  205. hidden: true
  206. }, {
  207. text: "仓库",
  208. dataIndex: "pd_whname",
  209. width: 110.0,
  210. allowBlank: false,
  211. editor: {
  212. displayField: "display",
  213. editable: true,
  214. format: "",
  215. hideTrigger: false,
  216. maxLength: 100.0,
  217. minValue: null,
  218. positiveNum: false,
  219. queryMode: "local",
  220. store: null,
  221. valueField: "value",
  222. xtype: "warehouseDbfindTrigger"
  223. }
  224. }, {
  225. text: 'model映射需要',
  226. dataIndex: 'productDTO',
  227. hidden: true,
  228. }, {
  229. text: "成本单价(元)",
  230. xtype: 'numbercolumn',
  231. width: 120,
  232. dataIndex: "pd_price",
  233. renderer: function(v, m, r) {
  234. return saas.util.BaseUtil.numberFormat(v, 8, true);
  235. }
  236. }, {
  237. text: "金额(元)",
  238. xtype: 'numbercolumn',
  239. dataIndex: "pd_total",
  240. width: 120,
  241. renderer: function(v, m, r) {
  242. return saas.util.BaseUtil.numberFixFormat(v, 2, true);
  243. },
  244. summaryType: 'sum',
  245. summaryRenderer: function(v, d, f, m) {
  246. return saas.util.BaseUtil.numberFixFormat(v, 2, true);
  247. }
  248. },{
  249. text: "应领数量",
  250. dataIndex: "mm_qty",
  251. xtype: 'numbercolumn',
  252. width: 110.0,
  253. ignore: true,
  254. renderer: function(v, m, r) {
  255. return saas.util.BaseUtil.numberFormat(v, 6, true);
  256. },
  257. summaryType: 'sum',
  258. summaryRenderer: function(v, d, f, m) {
  259. return saas.util.BaseUtil.numberFormat(v, 6, true);
  260. }
  261. },{
  262. text: "已领数量",
  263. dataIndex: "mm_havegetqty",
  264. xtype: 'numbercolumn',
  265. width: 110.0,
  266. ignore: true,
  267. renderer: function(v, m, r) {
  268. return saas.util.BaseUtil.numberFormat(v, 6, true);
  269. },
  270. summaryType: 'sum',
  271. summaryRenderer: function(v, d, f, m) {
  272. return saas.util.BaseUtil.numberFormat(v, 6, true);
  273. }
  274. }, {
  275. text: "备注",
  276. dataIndex: "pd_remark",
  277. width: 250,
  278. items: null,
  279. editor: {
  280. xtype: "textfield"
  281. }
  282. }, {
  283. text: "规格",
  284. hidden:true,
  285. width: 200,
  286. dataIndex: "pr_spec",
  287. ignore: true,
  288. renderer: function (v, m, r) {
  289. if (!v) {
  290. return r.data["productDTO"] ? r.data["productDTO"][m.column.dataIndex] : null;
  291. }
  292. return v;
  293. }
  294. }, {
  295. dataIndex: "pd_text1",
  296. text: "自定义字段1",
  297. width: 100,
  298. hidden: true,
  299. initHidden: false,
  300. editor: {
  301. xtype: "textfield"
  302. },
  303. }, {
  304. dataIndex: "pd_text2",
  305. text: "自定义字段2",
  306. width: 100,
  307. hidden: true,
  308. initHidden: false,
  309. editor: {
  310. xtype: "textfield"
  311. },
  312. }, {
  313. dataIndex: "pd_text3",
  314. text: "自定义字段3",
  315. width: 100,
  316. hidden: true,
  317. initHidden: false,
  318. editor: {
  319. xtype: "textfield"
  320. },
  321. }, {
  322. dataIndex: "pd_text4",
  323. text: "自定义字段4",
  324. width: 100,
  325. hidden: true,
  326. initHidden: false,
  327. editor: {
  328. xtype: "textfield"
  329. },
  330. }, {
  331. dataIndex: "pd_text5",
  332. text: "自定义字段5",
  333. width: 100,
  334. hidden: true,
  335. initHidden: false,
  336. editor: {
  337. xtype: "textfield"
  338. },
  339. }]
  340. }, {
  341. xtype: "textfield",
  342. name: "pi_remark",
  343. fieldLabel: "备注",
  344. columnWidth: 1
  345. }, {
  346. xtype: "datefield",
  347. name: "pi_date",
  348. fieldLabel: "单据日期",
  349. columnWidth: 0.3,
  350. hidden: true,
  351. defaultValue: new Date()
  352. }, {
  353. xtype: "hidden",
  354. name: "creatorId",
  355. fieldLabel: "录入人ID",
  356. readOnly: true
  357. }, {
  358. xtype: "textfield",
  359. name: "creatorName",
  360. fieldLabel: "录入人",
  361. readOnly: true,
  362. columnWidth: 0.3
  363. }, {
  364. xtype: "hidden",
  365. name: "createTime",
  366. fieldLabel: "录入日期",
  367. readOnly: true,
  368. defaultValue: new Date()
  369. }, {
  370. xtype: "hidden",
  371. name: "updaterId",
  372. fieldLabel: "更新人ID",
  373. readOnly: true
  374. }, {
  375. xtype: "hidden",
  376. name: "updaterName",
  377. fieldLabel: "更新人",
  378. readOnly: true
  379. }, {
  380. xtype: "hidden",
  381. name: "updateTime",
  382. fieldLabel: "更新日期",
  383. readOnly: true,
  384. defaultValue: new Date()
  385. }, {
  386. xtype: "textfield",
  387. name: "pi_auditman",
  388. fieldLabel: "审核人",
  389. columnWidth: 0.3,
  390. readOnly: true
  391. }, {
  392. xtype: "displayfield",
  393. name: "pi_costtotal",
  394. fieldLabel: "金额(元)",
  395. labelWidth:200,
  396. labelAlign : 'right',
  397. columnWidth: 0.4,
  398. thousandSeparator: ',',
  399. renderer: function (v){
  400. if(!v){
  401. v=0;
  402. }
  403. return '<p class="money-rtl"><font color="red"><B>'+saas.util.BaseUtil.numberFixFormat(v, 2, true)+'</font>'
  404. },
  405. readOnly: true
  406. }, {
  407. xtype: "hidden",
  408. name: "pi_auditdate",
  409. fieldLabel: "审核日期",
  410. readOnly: true
  411. }, {
  412. xtype: "textfield",
  413. name: "pi_text1",
  414. fieldLabel: "自定义字段1",
  415. hidden: true,
  416. initHidden: false
  417. }, {
  418. xtype: "textfield",
  419. name: "pi_text2",
  420. fieldLabel: "自定义字段2",
  421. hidden: true,
  422. initHidden: false
  423. }, {
  424. xtype: "textfield",
  425. name: "pi_text3",
  426. fieldLabel: "自定义字段3",
  427. hidden: true,
  428. initHidden: false
  429. }, {
  430. xtype: "textfield",
  431. name: "pi_text4",
  432. fieldLabel: "自定义字段4",
  433. hidden: true,
  434. initHidden: false
  435. }, {
  436. xtype: "textfield",
  437. name: "pi_text5",
  438. fieldLabel: "自定义字段5",
  439. hidden: true,
  440. initHidden: false
  441. }],
  442. });
  443. this.callParent(arguments);
  444. },
  445. // beforeAudit: function () {
  446. // var me = this,
  447. // viewModel = me.getViewModel(),
  448. // grid = me.down('detailGridField'),
  449. // data = grid.getTrueData();
  450. // Ext.Array.each(data, function (item) {
  451. // if (item.pd_price == 0) {
  452. // saas.util.BaseUtil.showSuccessToast(item.pd_pdno + '行' + item.pd_prodcode + '物料单价为0');
  453. // }
  454. // });
  455. // return true;
  456. // }
  457. });