FormPanel.js 13 KB

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