FormPanel.js 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420
  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: "hidden",
  70. name: "pi_puid",
  71. fieldLabel: "采购单id",
  72. allowBlank: true,
  73. columnWidth: 0.25
  74. }, {
  75. xtype: "hidden",
  76. name: "pi_pucode",
  77. fieldLabel: "采购单号",
  78. allowBlank: true,
  79. columnWidth: 0.25
  80. }, {
  81. name: "detailGridField",
  82. xtype: "detailGridField",
  83. storeModel: 'saas.model.purchase.ProdInDetail',
  84. deleteDetailUrl: '/api/purchase/prodinout/deleteDetail',
  85. detnoColumn: 'pd_pdno',
  86. columns: [{
  87. text: "id",
  88. dataIndex: "id",
  89. xtype: "numbercolumn",
  90. hidden: true
  91. }, {
  92. text: "物料id",
  93. dataIndex: "pd_prodid",
  94. xtype: "numbercolumn",
  95. hidden: true
  96. }, {
  97. text: "物料编号",
  98. width: 150.0,
  99. dataIndex: "pd_prodcode",
  100. xtype: "",
  101. items: null,
  102. allowBlank: false,
  103. editor: {
  104. displayField: "display",
  105. editable: true,
  106. format: "",
  107. hideTrigger: false,
  108. maxLength: 100.0,
  109. minValue: null,
  110. positiveNum: false,
  111. queryMode: "local",
  112. store: null,
  113. valueField: "value",
  114. xtype: "productMultiDbfindTrigger"
  115. }
  116. }, {
  117. text: "品牌",
  118. width: 100.0,
  119. dataIndex: "pr_brand",
  120. ignore: true,
  121. renderer: function (v, m, r) {
  122. if (!v) {
  123. return r.data["productDTO"] ? r.data["productDTO"][m.column.dataIndex] : null;
  124. }
  125. return v;
  126. }
  127. }, {
  128. text: "物料名称",
  129. width: 150.0,
  130. dataIndex: "pr_detail",
  131. ignore: true,
  132. renderer: function (v, m, r) {
  133. if (!v) {
  134. return r.data["productDTO"] ? r.data["productDTO"][m.column.dataIndex] : null;
  135. }
  136. return v;
  137. }
  138. }, {
  139. text: "型号",
  140. width: 200.0,
  141. dataIndex: "pr_orispeccode",
  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. text: "规格",
  151. width: 200,
  152. dataIndex: "pr_spec",
  153. ignore: true,
  154. renderer: function (v, m, r) {
  155. if (!v) {
  156. return r.data["productDTO"] ? r.data["productDTO"][m.column.dataIndex] : null;
  157. }
  158. return v;
  159. }
  160. }, {
  161. text: 'model映射需要',
  162. dataIndex: 'productDTO',
  163. hidden: true,
  164. }, {
  165. text: "仓库id",
  166. dataIndex: "pd_whid",
  167. xtype: "numbercolumn",
  168. hidden: true
  169. }, {
  170. text: "仓库编号",
  171. dataIndex: "pd_whcode",
  172. hidden: true
  173. }, {
  174. text: "仓库",
  175. dataIndex: "pd_whname",
  176. width: 80.0,
  177. allowBlank: false,
  178. editor: {
  179. displayField: "display",
  180. editable: true,
  181. format: "",
  182. hideTrigger: false,
  183. maxLength: 100.0,
  184. minValue: null,
  185. positiveNum: false,
  186. queryMode: "local",
  187. store: null,
  188. valueField: "value",
  189. xtype: "warehouseDbfindTrigger"
  190. }
  191. }, {
  192. text: "数量",
  193. dataIndex: "pd_inqty",
  194. xtype: 'numbercolumn',
  195. width: 110.0,
  196. allowBlank: false,
  197. editor: {
  198. xtype: "numberfield",
  199. decimalPrecision: 3,
  200. minValue: 0
  201. },
  202. renderer: function (v) {
  203. return saas.util.BaseUtil.numberFormat(v, 3, false);
  204. },
  205. summaryType: 'sum',
  206. summaryRenderer: function (v) {
  207. return saas.util.BaseUtil.numberFormat(v, 3, false);
  208. }
  209. }, {
  210. text: "单位",
  211. width: 65.0,
  212. dataIndex: "pr_unit",
  213. ignore: true,
  214. renderer: function (v, m, r) {
  215. if (!v) {
  216. return r.data["productDTO"] ? r.data["productDTO"][m.column.dataIndex] : null;
  217. }
  218. return v;
  219. }
  220. }, {
  221. text: "单价(元)",
  222. xtype: 'numbercolumn',
  223. width: 120,
  224. editor: {
  225. xtype: "numberfield",
  226. decimalPrecision: 4,
  227. minValue: 0
  228. },
  229. dataIndex: "pd_netprice",
  230. width: 120,
  231. renderer: function (v) {
  232. return saas.util.BaseUtil.numberFormat(v, 4, true);
  233. },
  234. }, {
  235. text: "含税单价(元)",
  236. xtype: 'numbercolumn',
  237. width: 120,
  238. editor: {
  239. xtype: "numberfield",
  240. decimalPrecision: 4,
  241. minValue: 0
  242. },
  243. dataIndex: "pd_orderprice",
  244. width: 120.0,
  245. renderer: function (v) {
  246. return saas.util.BaseUtil.numberFormat(v, 4, true);
  247. },
  248. listeners: {
  249. edit: function (value, grid) {
  250. var r = grid.getSelection()[0],
  251. pd_taxrate = r.get('pd_taxrate');
  252. var v = value / (1 + pd_taxrate / 100);
  253. r.set('pd_netprice', Number(saas.util.BaseUtil.numberFormat(v, 4, false)));
  254. }
  255. }
  256. }, {
  257. text: "金额(元)",
  258. xtype: 'numbercolumn',
  259. dataIndex: "pd_nettotal",
  260. width: 120,
  261. renderer: function (v) {
  262. return saas.util.BaseUtil.numberFormat(v, 2, true);
  263. },
  264. summaryType: 'sum',
  265. summaryRenderer: function (v) {
  266. return saas.util.BaseUtil.numberFormat(v, 2, true);
  267. }
  268. }, {
  269. xtype: 'numbercolumn',
  270. text: "税率(%)",
  271. dataIndex: "pd_taxrate",
  272. width: 80,
  273. editor: {
  274. xtype: "numberfield",
  275. decimalPrecision: 0,
  276. minValue: 0,
  277. maxValue: 100
  278. },
  279. renderer: function (v) {
  280. return saas.util.BaseUtil.numberFormat(v, 2, false);
  281. },
  282. }, {
  283. text: "税额(元)",
  284. xtype: 'numbercolumn',
  285. dataIndex: "pd_taxamount",
  286. width: 120,
  287. renderer: function (v) {
  288. return saas.util.BaseUtil.numberFormat(v, 2, true);
  289. },
  290. summaryType: 'sum',
  291. summaryRenderer: function (v) {
  292. return saas.util.BaseUtil.numberFormat(v, 2, true);
  293. }
  294. }, {
  295. text: "价税合计(元)",
  296. xtype: 'numbercolumn',
  297. dataIndex: "pd_ordertotal",
  298. width: 120,
  299. renderer: function (v) {
  300. return saas.util.BaseUtil.numberFormat(v, 2, true);
  301. },
  302. summaryType: 'sum',
  303. summaryRenderer: function (v) {
  304. return saas.util.BaseUtil.numberFormat(v, 2, true);
  305. }
  306. }, {
  307. text: "关联采购单号",
  308. dataIndex: "pd_ordercode",
  309. width: 150.0,
  310. ignore: true,
  311. }, {
  312. text: "备注",
  313. dataIndex: "pd_remark",
  314. width: 250,
  315. items: null,
  316. editor: {
  317. xtype: "textfield"
  318. }
  319. }]
  320. }, {
  321. xtype: "textfield",
  322. name: "pi_remark",
  323. fieldLabel: "备注",
  324. columnWidth: 1
  325. }, {
  326. xtype: "textfield",
  327. name: "pi_currency",
  328. fieldLabel: "币别",
  329. readOnly: true,
  330. defaultValue: 'RMB'
  331. }, {
  332. xtype: "numberfield",
  333. name: "pi_nettotal",
  334. fieldLabel: "金额(元)",
  335. readOnly: true,
  336. thousandSeparator: ',',
  337. columnWidth: 0.25
  338. }, {
  339. xtype: "numberfield",
  340. name: "pi_total",
  341. fieldLabel: "价税合计(元)",
  342. readOnly: true,
  343. thousandSeparator: ',',
  344. columnWidth: 0.25
  345. }, {
  346. xtype: "hidden",
  347. name: "pi_buyercode",
  348. fieldLabel: "采购员编号"
  349. }, {
  350. xtype: "employeeDbfindTrigger",
  351. name: "pi_buyername",
  352. fieldLabel: "采购员",
  353. columnWidth: 0.25
  354. }, {
  355. xtype: "hidden",
  356. name: "pi_buyerid",
  357. fieldLabel: "采购员ID"
  358. }, {
  359. xtype: "hidden",
  360. name: "creatorId",
  361. fieldLabel: "录入人ID",
  362. readOnly: true
  363. }, {
  364. xtype: "textfield",
  365. name: "creatorName",
  366. fieldLabel: "录入人",
  367. readOnly: true
  368. }, {
  369. xtype: "datefield",
  370. name: "createTime",
  371. fieldLabel: "录入日期",
  372. readOnly: true,
  373. defaultValue: new Date()
  374. }, {
  375. xtype: "hidden",
  376. name: "updaterId",
  377. fieldLabel: "更新人ID",
  378. readOnly: true
  379. }, {
  380. xtype: "hidden",
  381. name: "updaterName",
  382. fieldLabel: "更新人",
  383. readOnly: true
  384. }, {
  385. xtype: "hidden",
  386. name: "updateTime",
  387. fieldLabel: "更新日期",
  388. readOnly: true,
  389. defaultValue: new Date()
  390. }, {
  391. xtype: "textfield",
  392. name: "pi_auditman",
  393. fieldLabel: "审核人",
  394. readOnly: true
  395. }, {
  396. xtype: "datefield",
  397. name: "pi_auditdate",
  398. fieldLabel: "审核日期",
  399. readOnly: true
  400. }],
  401. beforeAudit: function () {
  402. var me = this,
  403. viewModel = me.getViewModel(),
  404. grid = me.down('detailGridField'),
  405. data = grid.getTrueData();
  406. Ext.Array.each(data, function (item) {
  407. if (item.pd_orderprice == 0) {
  408. saas.util.BaseUtil.showErrorToast(item.pd_pdno + '行' + item.pd_prodcode + '物料单价为0');
  409. }
  410. });
  411. return true;
  412. }
  413. });