FormPanelController.js 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488
  1. Ext.define('saas.view.stock.make.FormPanelController', {
  2. extend: 'saas.view.core.form.FormPanelController',
  3. alias: 'controller.stock-make-formpanel',
  4. init: function (form) {
  5. var me = this;
  6. this.control({
  7. //放大镜赋值关系 以及 tpl模板
  8. 'dbfindtrigger[name=ma_whname]':{
  9. beforerender:function(f){
  10. Ext.apply(f,{
  11. dataUrl:'/api/document/warehouse/list',
  12. // dataUrl:'http://localhost:9480/warehouse/list',
  13. addXtype: 'other-warehouse',
  14. addTitle: '仓库资料',
  15. defaultCondition:"wh_statuscode='OPEN'",
  16. dbfinds:[{
  17. from:'id',to:'ma_whid',ignore:true
  18. },{
  19. from:'wh_code',to:'ma_whcode'
  20. },{
  21. from:'wh_description',to:'ma_whname'
  22. }],
  23. dbtpls:[{
  24. field:'pd_whcode',width:100
  25. },{
  26. field:'pd_whname',width:100
  27. }],
  28. dbSearchFields:[{
  29. emptyText:'输入仓库编号或名称',
  30. xtype : "textfield",
  31. name : "wh_code",
  32. allowBlank : true,
  33. columnWidth : 0.25,
  34. getCondition:function(v){
  35. return "(upper(wh_code) like '%"+v.toUpperCase()+"%' or upper(wh_description) like '%"+v.toUpperCase()+"%')";
  36. }
  37. }],
  38. dbColumns:[{
  39. "text": "仓库ID",
  40. "flex": 0,
  41. "dataIndex": "id",
  42. "width": 0,
  43. "xtype": "",
  44. "items": null
  45. },{
  46. "text": "仓库编号",
  47. "flex": 1,
  48. "dataIndex": "wh_code",
  49. "width": 100,
  50. "xtype": "",
  51. "items": null
  52. }, {
  53. "text": "仓库名称",
  54. "flex": 1,
  55. "dataIndex": "wh_description",
  56. "xtype": "",
  57. "items": null
  58. }, {
  59. "text": "仓库类型",
  60. "flex": 1,
  61. "dataIndex": "wh_type",
  62. "xtype": "",
  63. "items": null
  64. }]
  65. }) ;
  66. }
  67. },
  68. //放大镜赋值关系 以及 tpl模板
  69. 'dbfindtrigger[name=mm_whname]':{
  70. beforerender:function(f){
  71. Ext.apply(f,{
  72. dataUrl:'/api/document/warehouse/list',
  73. // dataUrl:'http://localhost:9480/warehouse/list',
  74. addXtype: 'other-warehouse',
  75. addTitle: '仓库资料',
  76. defaultCondition:"wh_statuscode='OPEN'",
  77. dbfinds:[{
  78. from:'id',to:'mm_whid',ignore:true
  79. },{
  80. from:'wh_code',to:'mm_whcode'
  81. },{
  82. from:'wh_description',to:'mm_whname'
  83. }],
  84. dbtpls:[{
  85. field:'pd_whcode',width:100
  86. },{
  87. field:'pd_whname',width:100
  88. }],
  89. dbSearchFields:[{
  90. emptyText:'输入仓库编号或名称',
  91. xtype : "textfield",
  92. name : "wh_code",
  93. allowBlank : true,
  94. columnWidth : 0.25,
  95. getCondition:function(v){
  96. return "(upper(wh_code) like '%"+v.toUpperCase()+"%' or upper(wh_description) like '%"+v.toUpperCase()+"%')";
  97. }
  98. }],
  99. dbColumns:[{
  100. "text": "仓库ID",
  101. "flex": 0,
  102. "dataIndex": "id",
  103. "width": 0,
  104. "xtype": "",
  105. "items": null
  106. },{
  107. "text": "仓库编号",
  108. "flex": 1,
  109. "dataIndex": "wh_code",
  110. "width": 100,
  111. "xtype": "",
  112. "items": null
  113. }, {
  114. "text": "仓库名称",
  115. "flex": 1,
  116. "dataIndex": "wh_description",
  117. "xtype": "",
  118. "items": null
  119. }, {
  120. "text": "仓库类型",
  121. "flex": 1,
  122. "dataIndex": "wh_type",
  123. "xtype": "",
  124. "items": null
  125. }]
  126. }) ;
  127. }
  128. },
  129. 'multidbfindtrigger[name=mm_prodcode]':{
  130. beforerender:function(f){
  131. Ext.apply(f,{
  132. //数据接口
  133. dataUrl:'/api/document/product/list',
  134. addXtype: 'document-product-formpanel',
  135. addTitle: '物料资料',
  136. //放大镜赋值设置
  137. dbfinds:[{
  138. from:'pr_code',to:'mm_prodcode'
  139. },{
  140. from:'id',to:'mm_prodid'
  141. },{
  142. from:'pr_detail',to:'pr_detail'
  143. },{
  144. from:'pr_spec',to:'pr_spec'
  145. },{
  146. from:'pr_unit',to:'pr_spec'
  147. }],
  148. //联想设置
  149. dbtpls:[{
  150. field:'pr_code',width:100
  151. },{
  152. field:'pr_detail',width:100
  153. },{
  154. field:'pr_spec',width:100
  155. }],
  156. defaultCondition:"pr_statuscode='OPEN'",
  157. //窗口字段设置
  158. dbSearchFields:[{
  159. emptyText:'输入物料编号、名称或规格',
  160. xtype : "textfield",
  161. name : "search",
  162. width: 200,
  163. getCondition: function(v) {
  164. return "(upper(pr_spec) like '%" + v.toUpperCase()+"%' or upper(pr_code) like '%"+v.toUpperCase()+"%' or upper(pr_detail) like '%"+v.toUpperCase()+"%')";
  165. },
  166. allowBlank : true,
  167. columnWidth : 0.25
  168. }],
  169. //窗口列设置
  170. dbColumns:[{
  171. "text": "物料ID",
  172. "hidden": true,
  173. "dataIndex": "id",
  174. }, {
  175. "text": "物料编号",
  176. "dataIndex": "pr_code",
  177. "width": 200,
  178. }, {
  179. "text": "物料名称",
  180. "width": 200,
  181. "dataIndex": "pr_detail",
  182. }, {
  183. "text": "规格",
  184. "dataIndex": "pr_spec",
  185. "width": 100,
  186. }, {
  187. "text": "单位",
  188. "dataIndex": "pr_spec",
  189. "width": 100,
  190. },{
  191. "text": "仓库id",
  192. "dataIndex": "pr_whid",
  193. "hidden": true,
  194. },{
  195. "text": "仓库编号",
  196. "dataIndex": "pr_whcode",
  197. "hidden": true,
  198. },{
  199. "text": "仓库",
  200. "dataIndex": "pr_whname",
  201. "width": 200,
  202. },{
  203. "text": "总库存数",
  204. "dataIndex": "po_onhand",
  205. "width": 100,
  206. align:'right'
  207. },{
  208. "text": "类型",
  209. "dataIndex": "pr_kind",
  210. "width": 100,
  211. },{
  212. "text": "型号",
  213. "dataIndex": "pr_orispeccode",
  214. "width": 100,
  215. },{
  216. "text": "品牌",
  217. "dataIndex": "pr_brand",
  218. "width": 100,
  219. },{
  220. "text": "供应商",
  221. "dataIndex": "pr_vendname",
  222. "width": 100,
  223. },{
  224. "text": "最小包装",
  225. "dataIndex": "pr_zxbzs",
  226. "width": 100,
  227. align:'right'
  228. },{
  229. "text": "L/T",
  230. "dataIndex": "pr_leadtime",
  231. "width": 100,
  232. }]
  233. }) ;
  234. }
  235. },
  236. 'dbfindtrigger[name=ma_prodcode]':{
  237. beforerender:function(f){
  238. Ext.apply(f,{
  239. //数据接口
  240. dataUrl:'/api/document/product/list',
  241. addXtype: 'document-product-formpanel',
  242. addTitle: '物料资料',
  243. //放大镜赋值设置
  244. dbfinds:[{
  245. from:'pr_code',to:'ma_prodcode'
  246. },{
  247. from:'id',to:'ma_prodid'
  248. },{
  249. from:'pr_detail',to:'ma_proddetail'
  250. },{
  251. from:'pr_spec',to:'ma_prodspec'
  252. },{
  253. from:'pr_unit',to:'ma_produnit'
  254. }],
  255. //联想设置
  256. dbtpls:[{
  257. field:'pr_code',width:100
  258. },{
  259. field:'pr_detail',width:100
  260. },{
  261. field:'pr_spec',width:100
  262. }],
  263. defaultCondition:"pr_statuscode='OPEN'",
  264. //窗口字段设置
  265. dbSearchFields:[{
  266. emptyText:'输入物料编号、名称或规格',
  267. xtype : "textfield",
  268. name : "search",
  269. width: 200,
  270. getCondition: function(v) {
  271. return "(upper(pr_spec) like '%" + v.toUpperCase()+"%' or upper(pr_code) like '%"+v.toUpperCase()+"%' or upper(pr_detail) like '%"+v.toUpperCase()+"%')";
  272. },
  273. allowBlank : true,
  274. columnWidth : 0.25
  275. }],
  276. //窗口列设置
  277. dbColumns:[{
  278. "text": "物料ID",
  279. "hidden": true,
  280. "dataIndex": "id",
  281. }, {
  282. "text": "物料编号",
  283. "dataIndex": "pr_code",
  284. "width": 200,
  285. }, {
  286. "text": "物料名称",
  287. "width": 200,
  288. "dataIndex": "pr_detail",
  289. }, {
  290. "text": "规格",
  291. "dataIndex": "pr_spec",
  292. "width": 100,
  293. }, {
  294. "text": "单位",
  295. "dataIndex": "pr_spec",
  296. "width": 100,
  297. },{
  298. "text": "仓库id",
  299. "dataIndex": "pr_whid",
  300. "hidden": true,
  301. },{
  302. "text": "仓库编号",
  303. "dataIndex": "pr_whcode",
  304. "hidden": true,
  305. },{
  306. "text": "仓库",
  307. "dataIndex": "pr_whname",
  308. "width": 200,
  309. },{
  310. "text": "总库存数",
  311. "dataIndex": "po_onhand",
  312. "width": 100,
  313. align:'right'
  314. },{
  315. "text": "类型",
  316. "dataIndex": "pr_kind",
  317. "width": 100,
  318. },{
  319. "text": "型号",
  320. "dataIndex": "pr_orispeccode",
  321. "width": 100,
  322. },{
  323. "text": "品牌",
  324. "dataIndex": "pr_brand",
  325. "width": 100,
  326. },{
  327. "text": "供应商",
  328. "dataIndex": "pr_vendname",
  329. "width": 100,
  330. },{
  331. "text": "最小包装",
  332. "dataIndex": "pr_zxbzs",
  333. "width": 100,
  334. align:'right'
  335. },{
  336. "text": "L/T",
  337. "dataIndex": "pr_leadtime",
  338. "width": 100,
  339. }]
  340. }) ;
  341. }
  342. },
  343. //从表多选放大镜赋值关系 以及 tpl模板
  344. 'multidbfindtrigger[name=pd_prodcode]':{
  345. beforerender:function(f){
  346. Ext.apply(f,{
  347. //数据接口
  348. dataUrl:'/api/document/product/list',
  349. addXtype: 'document-product-formpanel',
  350. addTitle: '物料资料',
  351. //放大镜赋值设置
  352. dbfinds:[{
  353. from:'pr_code',to:'pd_prodcode'
  354. },{
  355. from:'pr_unit',to:'pd_unit'
  356. }],
  357. //联想设置
  358. dbtpls:[{
  359. field:'pr_code',width:100
  360. },{
  361. field:'pr_detail',width:100
  362. }],
  363. defaultCondition:"pr_statuscode='OPEN'",
  364. //窗口字段设置
  365. dbSearchFields:[{
  366. emptyText:'输入物料编号、名称或规格',
  367. xtype : "textfield",
  368. name : "search",
  369. width: 200,
  370. getCondition: function(v) {
  371. return "(upper(pr_spec) like '%" + v.toUpperCase()+"%' or upper(pr_code) like '%"+v.toUpperCase()+"%' or upper(pr_detail) like '%"+v.toUpperCase()+"%')";
  372. },
  373. allowBlank : true,
  374. columnWidth : 0.25
  375. }],
  376. //窗口列设置
  377. dbColumns:[{
  378. "text": "物料ID",
  379. "hidden": true,
  380. "dataIndex": "id",
  381. }, {
  382. "text": "物料编号",
  383. "dataIndex": "pr_code",
  384. "width": 200,
  385. }, {
  386. "text": "物料名称",
  387. "width": 200,
  388. "dataIndex": "pr_detail",
  389. }, {
  390. "text": "规格",
  391. "dataIndex": "pr_spec",
  392. "width": 100,
  393. }, {
  394. "text": "单位",
  395. "dataIndex": "pr_unit",
  396. "width": 100,
  397. },{
  398. "text": "仓库id",
  399. "dataIndex": "pr_whid",
  400. "hidden": true,
  401. },{
  402. "text": "仓库编号",
  403. "dataIndex": "pr_whcode",
  404. "hidden": true,
  405. },{
  406. "text": "仓库",
  407. "dataIndex": "pr_whname",
  408. "width": 200,
  409. },{
  410. "text": "总库存数",
  411. "dataIndex": "po_onhand",
  412. "width": 100,
  413. },{
  414. "text": "类型",
  415. "dataIndex": "pr_kind",
  416. "width": 100,
  417. },{
  418. "text": "型号",
  419. "dataIndex": "pr_orispeccode",
  420. "width": 100,
  421. },{
  422. "text": "品牌",
  423. "dataIndex": "pr_brand",
  424. "width": 100,
  425. },{
  426. "text": "供应商",
  427. "dataIndex": "pr_vendname",
  428. "width": 100,
  429. },{
  430. "text": "最小包装",
  431. "dataIndex": "pr_zxbzs",
  432. "width": 100,
  433. },{
  434. "text": "L/T",
  435. "dataIndex": "pr_leadtime",
  436. "width": 100,
  437. }]
  438. }) ;
  439. }
  440. }
  441. });
  442. },
  443. price_change:function() {
  444. var me = this,
  445. viewModel = me.getViewModel(),
  446. store = viewModel.get('detail0').detailStore;
  447. var sum_qty = store.sum('mm_price');
  448. viewModel.set('ma_price',sum_qty);
  449. },
  450. turnIn: function() {
  451. var me = this,
  452. form = me.getView(),
  453. id = form.getForm().findField(form._idField);
  454. form.BaseUtil.request({
  455. url: form._turnInUrl+id.value,
  456. method: 'GET',
  457. })
  458. .then(function(localJson) {
  459. if(localJson.success){
  460. showToast('转单成功');
  461. }
  462. })
  463. .catch(function(res) {
  464. console.error(res);
  465. showToast('转单失败: ' + res.message);
  466. });
  467. }
  468. });