FormPanel.js 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438
  1. Ext.define('saas.view.purchase.purchaseIn.FormPanel', {
  2. extend: 'saas.view.core.form.FormPanel',
  3. xtype: 'purchase-purchasein-formpanel',
  4. controller: 'purchase-purchasein-formpanel',
  5. viewModel: 'purchase-purchasein-formpanel',
  6. viewName: 'purchase-purchasein-formpanel',
  7. caller:'PurchaseIn',
  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/purchase/prodinout/read',
  18. _saveUrl:'/api/purchase/prodinout/save',
  19. _auditUrl:'/api/purchase/prodinout/audit',
  20. _unAuditUrl:'/api/purchase/prodinout/unAudit',
  21. _deleteUrl:'/api/purchase/prodinout/delete',
  22. _turnOutUrl:'/api/purchase/prodinout/turnProdOut',
  23. initId:0,
  24. toolBtns: [{
  25. xtype: 'button',
  26. text: '转采购验退单',
  27. hidden: true,
  28. bind: {
  29. hidden: '{turnHidden}'
  30. },
  31. handler: 'turnOut'
  32. }],
  33. defaultItems: [{
  34. xtype: 'hidden',
  35. name: 'id',
  36. fieldLabel: 'id',
  37. allowBlank: true,
  38. columnWidth: 0
  39. },{
  40. xtype : "hidden",
  41. name : "pi_class",
  42. fieldLabel : "单据类型",
  43. readOnly:true,
  44. allowBlank : true,
  45. columnWidth : 0.25
  46. },{
  47. xtype : "hidden",
  48. name : "pi_vendid",
  49. fieldLabel : "供应商ID",
  50. allowBlank : true,
  51. columnWidth : 0.0
  52. },{
  53. xtype: 'hidden',
  54. name: 'pi_vendcode',
  55. fieldLabel: '供应商编号'
  56. }, {
  57. xtype: 'vendorDbfindTrigger',
  58. name: 'pi_vendname',
  59. fieldLabel: '供应商名称',
  60. allowBlank : false,
  61. },{
  62. xtype : "datefield",
  63. name : "pi_date",
  64. fieldLabel : "单据日期",
  65. allowBlank : false,
  66. columnWidth : 0.25,
  67. defaultValue: new Date()
  68. },{
  69. xtype : "textfield",
  70. name : "pi_total",
  71. fieldLabel : "总额",
  72. allowBlank : true,
  73. readOnly: true,
  74. columnWidth : 0.25
  75. }, {
  76. xtype : "hidden",
  77. name : "pi_puid",
  78. fieldLabel : "采购单id",
  79. allowBlank : true,
  80. columnWidth : 0.25
  81. },{
  82. xtype : "hidden",
  83. name : "pi_pucode",
  84. fieldLabel : "采购单号",
  85. allowBlank : true,
  86. columnWidth : 0.25
  87. }, {
  88. name : "detailGridField",
  89. xtype : "detailGridField",
  90. storeModel:'saas.model.purchase.ProdIODetail',
  91. deleteDetailUrl:'/api/purchase/prodinout/deleteDetail',
  92. detnoColumn: 'pd_pdno',
  93. columns : [
  94. {
  95. text : "id",
  96. dataIndex : "id",
  97. xtype : "numbercolumn",
  98. hidden:true
  99. },{
  100. text : "物料id",
  101. dataIndex : "pd_prodid",
  102. xtype : "numbercolumn",
  103. hidden:true
  104. },
  105. {
  106. text : "物料编号",
  107. width : 150.0,
  108. dataIndex : "pd_prodcode",
  109. xtype : "",
  110. items : null,
  111. allowBlank : false,
  112. editor : {
  113. displayField : "display",
  114. editable : true,
  115. format : "",
  116. hideTrigger : false,
  117. maxLength : 100.0,
  118. minValue : null,
  119. positiveNum : false,
  120. queryMode : "local",
  121. store : null,
  122. valueField : "value",
  123. xtype : "productMultiDbfindTrigger"
  124. }
  125. },
  126. {
  127. text : "品牌",
  128. width : 150.0,
  129. dataIndex : "pr_brand",
  130. ignore:true,
  131. renderer: function (v, m, r) {
  132. if(!v){
  133. return r.data["productDTO"]?r.data["productDTO"][m.column.dataIndex]:null;
  134. }
  135. return v;
  136. }
  137. },
  138. {
  139. text : "名称",
  140. width : 200.0,
  141. dataIndex : "pr_detail",
  142. ignore:true,
  143. renderer: function (v, m, r) {
  144. if(!v){
  145. return r.data["productDTO"]?r.data["productDTO"][m.column.dataIndex]:null;
  146. }
  147. return v;
  148. }
  149. },
  150. {
  151. text : "型号",
  152. width : 200.0,
  153. dataIndex : "pr_orispeccode",
  154. ignore:true,
  155. renderer: function (v, m, r) {
  156. if(!v){
  157. return r.data["productDTO"]?r.data["productDTO"][m.column.dataIndex]:null;
  158. }
  159. return v;
  160. }
  161. },
  162. {
  163. text: 'model映射需要',
  164. dataIndex: 'productDTO',
  165. hidden: true,
  166. },
  167. {
  168. text : "数量",
  169. dataIndex : "pd_inqty",
  170. xtype: 'numbercolumn',
  171. width : 110.0,
  172. allowBlank : false,
  173. editor : {
  174. xtype : "numberfield",
  175. decimalPrecision: 3,
  176. minValue:0
  177. },
  178. renderer : function(v) {
  179. var arr = (v + '.').split('.');
  180. var xr = (new Array(arr[1].length > 3 ? 3 : arr[1].length)).fill('0');
  181. var format = '0.' + xr.join('');
  182. return Ext.util.Format.number(v, format);
  183. },
  184. summaryType: 'sum',
  185. summaryRenderer: function(v) {
  186. var arr = (v + '.').split('.');
  187. var xr = (new Array(arr[1].length > 3 ? 3 : arr[1].length)).fill('0');
  188. var format = '0.' + xr.join('');
  189. return Ext.util.Format.number(v, format);
  190. }
  191. },{
  192. text : "单位",
  193. width : 80.0,
  194. dataIndex : "pr_unit",
  195. ignore:true,
  196. renderer: function (v, m, r) {
  197. if(!v){
  198. return r.data["productDTO"]?r.data["productDTO"][m.column.dataIndex]:null;
  199. }
  200. return v;
  201. }
  202. },{
  203. text : "单价(元)",
  204. xtype: 'numbercolumn',
  205. width : 110.0,
  206. editor : {
  207. xtype : "numberfield",
  208. decimalPrecision: 4,
  209. minValue:0
  210. },
  211. dataIndex : "pd_orderprice",
  212. width : 120.0,
  213. renderer : function(v) {
  214. var arr = (v + '.').split('.');
  215. var xr = (new Array(arr[1].length > 4 ? 4 : arr[1].length)).fill('0');
  216. var format = '0,000.' + xr.join('');
  217. return Ext.util.Format.number(v, format);
  218. },
  219. }, {
  220. text : "已转数",
  221. dataIndex : "pd_yqty",
  222. xtype: 'numbercolumn',
  223. hidden:true,
  224. editor : {
  225. xtype : "numberfield",
  226. decimalPrecision: 3,
  227. editable : false
  228. },
  229. renderer : function(v) {
  230. var arr = (v + '.').split('.');
  231. var xr = (new Array(arr[1].length > 3 ? 3 : arr[1].length)).fill('0');
  232. var format = '0.' + xr.join('');
  233. return Ext.util.Format.number(v, format);
  234. },
  235. summaryType: 'sum',
  236. summaryRenderer: function(v) {
  237. var arr = (v + '.').split('.');
  238. var xr = (new Array(arr[1].length > 3 ? 3 : arr[1].length)).fill('0');
  239. var format = '0.' + xr.join('');
  240. return Ext.util.Format.number(v, format);
  241. }
  242. },{
  243. text : "仓库id",
  244. dataIndex : "pd_whid",
  245. xtype : "numbercolumn",
  246. hidden:true
  247. },
  248. {
  249. text : "仓库编号",
  250. dataIndex : "pd_whcode",
  251. hidden:true
  252. },
  253. {
  254. text : "仓库",
  255. dataIndex : "pd_whname",
  256. width : 150.0,
  257. allowBlank : false,
  258. editor : {
  259. displayField : "display",
  260. editable : true,
  261. format : "",
  262. hideTrigger : false,
  263. maxLength : 100.0,
  264. minValue : null,
  265. positiveNum : false,
  266. queryMode : "local",
  267. store : null,
  268. valueField : "value",
  269. xtype : "warehouseDbfindTrigger"
  270. }
  271. },
  272. {
  273. xtype: 'numbercolumn',
  274. text : "税率",
  275. dataIndex : "pd_taxrate",
  276. width : 80.0,
  277. editor : {
  278. xtype : "numberfield",
  279. decimalPrecision: 0,
  280. minValue: 0,
  281. maxValue: 100
  282. },
  283. renderer : function(v) {
  284. return Ext.util.Format.number(v, '0');
  285. },
  286. },{
  287. text : "含税金额(元)",
  288. xtype: 'numbercolumn',
  289. dataIndex : "pd_ordertotal",
  290. width : 110.0,
  291. // editor : {
  292. // xtype : "numberfield",
  293. // decimalPrecision: 2,
  294. // editable : false
  295. // },
  296. renderer : function(v) {
  297. var arr = (v + '.').split('.');
  298. var xr = (new Array(arr[1].length > 2 ? 2 : arr[1].length)).fill('0');
  299. var format = '0,000.' + xr.join('');
  300. return Ext.util.Format.number(v, format);
  301. },
  302. summaryType: 'sum',
  303. summaryRenderer: function(v) {
  304. var arr = (v + '.').split('.');
  305. var xr = (new Array(arr[1].length > 2 ? 2 : arr[1].length)).fill('0');
  306. var format = '0,000.' + xr.join('');
  307. return Ext.util.Format.number(v, format);
  308. }
  309. },
  310. {
  311. text : "未税金额(元)",
  312. xtype: 'numbercolumn',
  313. dataIndex : "pd_nettotal",
  314. width : 110.0,
  315. // editor : {
  316. // xtype : "numberfield",
  317. // decimalPrecision: 2,
  318. // editable : false
  319. // },
  320. renderer : function(v) {
  321. var arr = (v + '.').split('.');
  322. var xr = (new Array(arr[1].length > 2 ? 2 : arr[1].length)).fill('0');
  323. var format = '0,000.' + xr.join('');
  324. return Ext.util.Format.number(v, format);
  325. },
  326. summaryType: 'sum',
  327. summaryRenderer: function(v) {
  328. var arr = (v + '.').split('.');
  329. var xr = (new Array(arr[1].length > 2 ? 2 : arr[1].length)).fill('0');
  330. var format = '0,000.' + xr.join('');
  331. return Ext.util.Format.number(v, format);
  332. }
  333. },
  334. {
  335. text : "采购单明细id",
  336. dataIndex : "pd_orderid",
  337. ignore:true,
  338. hidden:true
  339. },
  340. {
  341. text : "采购单号",
  342. dataIndex : "pd_ordercode",
  343. width : 150.0,
  344. ignore:true,
  345. },{
  346. text : "采购序号",
  347. dataIndex : "pd_orderdetno",
  348. xtype : "numbercolumn",
  349. width : 110.0,
  350. format: '0',
  351. ignore:true,
  352. renderer: function(v) {
  353. if(v) {
  354. return Ext.util.Format.number(v, '0');
  355. }else {
  356. return null;
  357. }
  358. }
  359. },{
  360. text : "备注",
  361. dataIndex : "pd_remark",
  362. width : 250,
  363. items : null,
  364. editor : {
  365. xtype : "textfield"
  366. },
  367. }
  368. ]
  369. },{
  370. xtype : "textfield",
  371. name : "pi_remark",
  372. fieldLabel : "备注",
  373. columnWidth : 1
  374. },
  375. {
  376. xtype : "hidden",
  377. name : "creatorId",
  378. fieldLabel : "录入人ID",
  379. readOnly:true
  380. },
  381. {
  382. xtype : "textfield",
  383. name : "creatorName",
  384. fieldLabel : "录入人",
  385. readOnly:true
  386. }, {
  387. xtype : "datefield",
  388. name : "createTime",
  389. fieldLabel : "录入日期",
  390. readOnly:true,
  391. defaultValue: new Date()
  392. },{
  393. xtype : "hidden",
  394. name : "updaterId",
  395. fieldLabel : "更新人ID",
  396. readOnly:true
  397. },{
  398. xtype : "hidden",
  399. name : "updaterName",
  400. fieldLabel : "更新人",
  401. readOnly:true
  402. }, {
  403. xtype : "hidden",
  404. name : "updateTime",
  405. fieldLabel : "更新日期",
  406. readOnly:true,
  407. defaultValue: new Date()
  408. }, {
  409. xtype : "textfield",
  410. name : "pi_auditman",
  411. fieldLabel : "审核人",
  412. readOnly:true
  413. }, {
  414. xtype : "datefield",
  415. name : "pi_auditdate",
  416. fieldLabel : "审核日期",
  417. readOnly:true
  418. }],
  419. beforeAudit:function(){
  420. var me = this,
  421. viewModel = me.getViewModel(),
  422. grid = me.down('detailGridField'),
  423. data = grid.getTrueData();
  424. Ext.Array.each(data,function(item){
  425. if(item.pd_orderprice==0){
  426. saas.util.BaseUtil.showErrorToast(item.pd_pdno+'行'+item.pd_prodcode+'物料单价为0');
  427. }
  428. });
  429. return true;
  430. }
  431. });