FormPanelController.js 23 KB

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