FormPanel.js 12 KB

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