FormPanel.js 19 KB

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