ProdInOut.js 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592
  1. Ext.QuickTips.init();
  2. Ext.define('erp.controller.drp.distribution.ProdInOut', {
  3. extend: 'Ext.app.Controller',
  4. requires: ['erp.util.FormUtil', 'erp.util.GridUtil', 'erp.util.BaseUtil'],
  5. views:[
  6. 'core.form.Panel','drp.distribution.ProdInOut','core.grid.Panel2','core.toolbar.Toolbar','core.form.MultiField',
  7. 'core.button.Save','core.button.Add','core.button.Submit','core.button.Print','core.button.Upload','core.button.ResAudit',
  8. 'core.button.Audit','core.button.Close','core.button.Delete','core.button.Update','core.button.DeleteDetail','core.button.ResSubmit',
  9. 'core.button.Banned','core.button.ResBanned','core.button.Post','core.button.ResPost','core.button.Query','core.button.GetPrice',
  10. 'core.button.RePrice','core.button.BussAccount','core.button.Export','core.form.FtFindField','core.form.ConDateField',
  11. 'core.button.FeeShare', 'core.button.TurnDefectOut',
  12. 'core.trigger.DbfindTrigger','core.trigger.MultiDbfindTrigger','core.trigger.TextAreaTrigger'
  13. ],
  14. init:function(){
  15. var me = this;
  16. me.FormUtil = Ext.create('erp.util.FormUtil');
  17. me.GridUtil = Ext.create('erp.util.GridUtil');
  18. me.BaseUtil = Ext.create('erp.util.BaseUtil');
  19. this.control({
  20. 'erpGridPanel2': {
  21. afterrender: function(grid){
  22. grid.plugins[0].on('beforeedit', function(args){
  23. if(args.field == "pd_inqty") {
  24. return me.isAllowUpdateQty(args.record);
  25. }
  26. });
  27. },
  28. itemclick: function(selModel, record){
  29. var bool = me.hasSource(selModel.ownerCt);
  30. if(!bool)
  31. this.GridUtil.onGridItemClick(selModel, record);
  32. }
  33. },
  34. 'erpSaveButton': {
  35. click: function(btn){
  36. var form = me.getForm(btn);
  37. if(Ext.getCmp(form.codeField).value == null || Ext.getCmp(form.codeField).value == ''){
  38. me.BaseUtil.getRandomNumber(caller, 2, form.codeField);//自动添加编号
  39. }
  40. me.save(btn);
  41. }
  42. },
  43. 'erpDeleteButton' : {
  44. afterrender: function(btn){
  45. var status = Ext.getCmp(me.getForm(btn).statuscodeField);
  46. if(status && status.value == 'DELETED'){
  47. btn.hide();
  48. }
  49. },
  50. click: function(btn){
  51. me.FormUtil.onDelete({pu_id: Number(Ext.getCmp('pi_id').value)});
  52. }
  53. },
  54. 'erpUpdateButton': {
  55. afterrender: function(btn){
  56. var status = Ext.getCmp(me.getForm(btn).statuscodeField);
  57. if(status && status.value != 'ENTERING'){
  58. btn.hide();
  59. }
  60. status = Ext.getCmp('pi_statuscode');
  61. if(status && 'POSTED' == status.value) {
  62. btn.hide();
  63. }
  64. },
  65. click: function(btn){
  66. var grid = Ext.getCmp('grid'), items = grid.store.data.items, c = Ext.getCmp('pi_inoutno').value;
  67. var piclass = Ext.getCmp('pi_class').value, whcode = Ext.getCmp('pi_whcode');
  68. Ext.Array.each(items, function(item){
  69. if(!Ext.isEmpty(item.data['pd_prodcode'])){
  70. item.set('pd_inoutno', c);
  71. item.set('pd_piclass', piclass);
  72. if(whcode && item.data['pd_whcode'] == null && item.data['pd_whcode'] == ''){
  73. item.set('pd_whcode', whcode.value);
  74. }
  75. }
  76. });
  77. me.FormUtil.onUpdate(me);
  78. }
  79. },
  80. 'erpAddButton': {
  81. click: function(){
  82. me.FormUtil.onAdd('add' + caller, '新增出入库单', "jsps/drp/distribution/prodInOut.jsp?whoami=" + caller);
  83. }
  84. },
  85. 'erpCloseButton': {
  86. click: function(btn){
  87. me.FormUtil.beforeClose(me);
  88. }
  89. },
  90. 'erpSubmitButton': {
  91. afterrender: function(btn){
  92. var status = Ext.getCmp(me.getForm(btn).statuscodeField);
  93. if(status && status.value != 'ENTERING'){
  94. btn.hide();
  95. }
  96. },
  97. click: function(btn){
  98. var grid = Ext.getCmp('grid');
  99. var items = grid.store.data.items;
  100. var bool = true;
  101. Ext.each(items, function(item){
  102. if(item.data[grid.necessaryField] != null && item.data[grid.necessaryField] != ''){
  103. if(Ext.getCmp('pd_inqty') && item.data['pd_inqty'] == null || item.data['pd_inqty'] == ''){
  104. bool = false;
  105. showError("明细第" + item.data['pd_pdno'] + "行未填写数量,不能提交");return;
  106. }
  107. }
  108. });
  109. if(bool){
  110. me.FormUtil.onSubmit(Ext.getCmp('pi_id').value);
  111. }
  112. }
  113. },
  114. 'erpResSubmitButton': {
  115. afterrender: function(btn){
  116. var status = Ext.getCmp(me.getForm(btn).statuscodeField);
  117. if(status && status.value != 'COMMITED'){
  118. btn.hide();
  119. }
  120. },
  121. click: function(btn){
  122. me.FormUtil.onResSubmit(Ext.getCmp('pi_id').value);
  123. }
  124. },
  125. 'erpAuditButton': {
  126. afterrender: function(btn){
  127. var status = Ext.getCmp(me.getForm(btn).statuscodeField);
  128. if(status && status.value != 'COMMITED'){
  129. btn.hide();
  130. }
  131. },
  132. click: function(btn){
  133. me.FormUtil.onAudit(Ext.getCmp('pi_id').value);
  134. }
  135. },
  136. 'erpResAuditButton': {
  137. afterrender: function(btn){
  138. var status = Ext.getCmp(me.getForm(btn).statuscodeField);
  139. if(status && status.value != 'AUDITED'){
  140. btn.hide();
  141. }
  142. },
  143. click: function(btn){
  144. me.FormUtil.onResAudit(Ext.getCmp('pi_id').value);
  145. }
  146. },
  147. 'erpBannedButton': {
  148. afterrender: function(btn){
  149. var status = Ext.getCmp(me.getForm(btn).statuscodeField);
  150. if(status && status.value != 'COMMITED'){
  151. btn.hide();
  152. }
  153. },
  154. click: function(btn){
  155. me.FormUtil.onBanned(Ext.getCmp('pi_id').value);
  156. }
  157. },
  158. 'erpResBannedButton': {
  159. afterrender: function(btn){
  160. var status = Ext.getCmp(me.getForm(btn).statuscodeField);
  161. if(status && status.value != 'BANNED'){
  162. btn.hide();
  163. }
  164. },
  165. click: function(btn){
  166. me.FormUtil.onResBanned(Ext.getCmp('pi_id').value);
  167. }
  168. },
  169. 'erpPrintButton': {
  170. click:function(btn){
  171. var whichKind=Ext.getCmp('pi_class').value;
  172. console.log(whichKind);
  173. var reportName = '';
  174. if(whichKind=="配货单"){
  175. reportName="sendlist_nosale";
  176. }else if(whichKind=="不良品入库单"){
  177. console.log("fds");
  178. reportName="pio_notokin";
  179. }else if(whichKind=="不良品出库单"){
  180. reportName="pio_notokout";
  181. }else if(whichKind=="其它采购入库单"){
  182. reportName="piolist_opin";
  183. }else if(whichKind=="其它采购出库单"){
  184. reportName="piolist_opout";
  185. }else if(whichKind=="分公司拨入单"){
  186. reportName="piolist_bc";
  187. }else if(whichKind=="分公司拨出单"){
  188. reportName="piolist_bc";
  189. }else if(whichKind=="其它入库单"){
  190. reportName="piolist_in";
  191. }else if(whichKind=="其它出库单"){
  192. reportName="piolist_out";
  193. }else if(whichKind=="报废单"){
  194. reportName="piolist_bf";
  195. }else if(whichKind=="退换货入库单"){
  196. reportName="pio_changein";
  197. }else if(whichKind=="退换货出库单"){
  198. reportName="pio_changeout";
  199. }else if(whichKind=="销售退货单"){
  200. reportName="retulist";
  201. }else if(whichKind=="采购验收单"){
  202. reportName="acclist";
  203. }else if(whichKind=="采购验退单"){
  204. reportName="piolist_yt";
  205. }else if(whichKind=="销售拨入单"){
  206. reportName="piolist";
  207. }else if(whichKind=="销售拨出单"){
  208. reportName="piolist_salebc";
  209. }else if(whichKind=="生产领料单"){
  210. reportName="PIOLISTM";
  211. }else if(whichKind=="生产退料单"){
  212. reportName="PIOLISTM_Back";
  213. }else if(whichKind=="完工入库单"){
  214. reportName="finish";
  215. }else if(whichKind=="结余退料单"){
  216. reportName="PIOLISTM_JY";
  217. }else if(whichKind=="拆件入库单"){
  218. reportName="chaijian";
  219. }else if(whichKind=="生产补料单"){
  220. reportName="PIOLIST_bl";
  221. }else if(whichKind=="生产耗料单"){
  222. reportName="PIOLISTM_HL";
  223. }else if(whichKind=="委外领料单"){
  224. reportName="Expiolist";
  225. }else if(whichKind=="委外退料单"){
  226. reportName="PIOLIST_wwtl";
  227. }else if(whichKind=="委外验收单"){
  228. reportName="EXPLIST_ys";
  229. }else if(whichKind=="委外验退单"){
  230. reportName="EXPLIST_yt";
  231. }else if(whichKind="生产报废单"){
  232. reportName=="MakeScrap";
  233. }
  234. var condition = '{prodinout.pi_id}=' + Ext.getCmp('pi_id').value + '';
  235. var id = Ext.getCmp('pi_id').value;
  236. me.FormUtil.onwindowsPrint(id, reportName, condition);
  237. }
  238. },
  239. 'erpPostButton': {
  240. afterrender: function(btn){
  241. var status = Ext.getCmp('pi_statuscode');
  242. if(status && status.value != 'UNPOST'){
  243. btn.hide();
  244. }
  245. },
  246. click: function(btn){
  247. me.FormUtil.onPost(Ext.getCmp('pi_id').value);
  248. }
  249. },
  250. 'erpResPostButton': {
  251. afterrender: function(btn){
  252. var status = Ext.getCmp('pi_statuscode');
  253. if(status && status.value != 'POSTED'){
  254. btn.hide();
  255. }
  256. },
  257. click: function(btn){
  258. me.FormUtil.onResPost(Ext.getCmp('pi_id').value);
  259. }
  260. },
  261. 'field[name=pi_cardcode]': {
  262. afterrender: function(f){
  263. if(f.value != null && f.value != ''){
  264. f.setReadOnly(true);
  265. f.setFieldStyle(f.fieldStyle + ';background:#f1f1f1;');
  266. }
  267. }
  268. },
  269. 'dbfindtrigger[name=pd_ordercode]': {
  270. focus: function(t){
  271. t.setHideTrigger(false);
  272. t.setReadOnly(false);
  273. if(Ext.getCmp('pi_cardcode')){
  274. var code = Ext.getCmp('pi_cardcode').value;
  275. if(code != null && code != ''){
  276. var obj = me.getCodeCondition();
  277. if(obj && obj.field){
  278. t.dbBaseCondition = obj.field + "='" + code + "'";
  279. }
  280. }
  281. }
  282. },
  283. aftertrigger: function(t){
  284. if(Ext.getCmp('pi_cardcode')){
  285. var obj = me.getCodeCondition();
  286. me.FormUtil.getFieldsValue(obj.tablename, obj.fields, obj.myfield + "='" + t.value + "'", obj.tFields);
  287. }
  288. }
  289. },
  290. 'dbfindtrigger[name=pd_orderdetno]': {
  291. focus: function(t){
  292. t.setHideTrigger(false);
  293. t.setReadOnly(false);//用disable()可以,但enable()无效
  294. var record = Ext.getCmp('grid').selModel.lastSelected;
  295. var code = record.data['pd_ordercode'];
  296. if(code == null || code == ''){
  297. showError("请先选择关联单号!");
  298. t.setHideTrigger(true);
  299. t.setReadOnly(true);
  300. } else {
  301. var field = me.getBaseCondition();
  302. if(field){
  303. t.dbBaseCondition = field + "='" + code + "'";
  304. }
  305. }
  306. }
  307. },
  308. 'multidbfindtrigger[name=pd_orderdetno]': {
  309. focus: function(t){
  310. t.setHideTrigger(false);
  311. t.setReadOnly(false);//用disable()可以,但enable()无效
  312. var record = Ext.getCmp('grid').selModel.lastSelected;
  313. var code = record.data['pd_ordercode'];
  314. if(code == null || code == ''){
  315. showError("请先选择关联单号!");
  316. t.setHideTrigger(true);
  317. t.setReadOnly(true);
  318. } else {
  319. var field = me.getBaseCondition();
  320. if(field){
  321. t.dbBaseCondition = field + "='" + code + "'";
  322. }
  323. }
  324. }
  325. },
  326. 'dbfindtrigger[name=pd_batchcode]': {
  327. focus: function(t){
  328. t.setHideTrigger(false);
  329. t.setReadOnly(false);//用disable()可以,但enable()无效
  330. var record = Ext.getCmp('grid').selModel.lastSelected;
  331. var pr = record.data['pd_prodcode'];
  332. if(pr == null || pr == ''){
  333. showError("请先选择料号!");
  334. t.setHideTrigger(true);
  335. t.setReadOnly(true);
  336. } else {
  337. var code = record.data['pd_whcode'];
  338. if(code == null || code == ''){
  339. if(Ext.getCmp('pi_whcode')) {
  340. code = Ext.getCmp('pi_whcode').value;
  341. if(code == null || code == ''){
  342. showError("请先选择仓库!");
  343. t.setHideTrigger(true);
  344. t.setReadOnly(true);
  345. } else {
  346. t.dbBaseCondition = "ba_whcode='" + code + "' AND ba_prodcode='" + pr + "'";
  347. }
  348. }
  349. } else {
  350. t.dbBaseCondition = "ba_whcode='" + code + "' AND ba_prodcode='" + pr + "'";
  351. }
  352. }
  353. }
  354. },
  355. 'field[name=pi_whcode]': {
  356. change: function(f){
  357. if(f.value != null && f.value != ''){
  358. var grid = Ext.getCmp('grid');
  359. Ext.Array.each(grid.store.data.items, function(item){
  360. if(item.data['pd_whcode'] == null || item.data['pd_whcode'] == ''){
  361. item.set('pd_whcode', f.value);
  362. }
  363. });
  364. }
  365. }
  366. },
  367. 'erpGetPriceButton': {
  368. click: function(){
  369. }
  370. }
  371. });
  372. },
  373. getForm: function(btn){
  374. return btn.ownerCt.ownerCt;
  375. },
  376. save: function(btn){
  377. var me = this;
  378. var form = me.getForm(btn);
  379. if(Ext.getCmp('Fin_Code')){
  380. Ext.getCmp('Fin_Code').setValue(Ext.getCmp(form.codeField).value);//流水号
  381. }
  382. var grid = Ext.getCmp('grid'), items = grid.store.data.items, c = Ext.getCmp('pi_inoutno').value;
  383. var piclass = Ext.getCmp('pi_class').value, whcode = Ext.getCmp('pi_whcode');
  384. Ext.Array.each(items, function(item){
  385. if(!Ext.isEmpty(item.data['pd_prodcode'])){
  386. item.set('pd_inoutno', c);
  387. item.set('pd_piclass', piclass);
  388. if(whcode && item.data['pd_whcode'] == null && item.data['pd_whcode'] == ''){
  389. item.set('pd_whcode', whcode.value);
  390. }
  391. }
  392. });
  393. me.FormUtil.beforeSave(me);
  394. },
  395. /**
  396. * pd_orderdetno的限制条件
  397. */
  398. getBaseCondition: function(){
  399. var field = null;
  400. switch (caller) {
  401. case 'ProdInOut!PurcCheckin': //采购验收单
  402. field = "pd_code";break;
  403. case 'ProdInOut!PurcCheckout': //采购验退单
  404. field = "pd_code";break;
  405. case 'ProdInOut!DrpSale': //配货单
  406. field = "sd_code";break;
  407. case 'ProdInOut!Make!Return': //生产退料单
  408. field = "mm_code";break;
  409. case 'ProdInOut!Make!Give': //生产补料单
  410. field = "mm_code";break;
  411. case 'ProdInOut!Picking': //生产领料单
  412. field = "mm_code";break;
  413. case 'ProdInOut!Make!Consume': //生产耗料单
  414. field = "mm_code";break;
  415. case 'ProdInOut!Make!Useless': //生产报废单
  416. field = "mm_code";break;
  417. case 'ProdInOut!SaleAppropriationOut': //销售拨出单
  418. field = "sd_code";break;
  419. case 'ProdInOut!SaleReturn': //销售退货单
  420. field = "sd_code";break;
  421. case 'ProdInOut!OtherOut': //其它出库单
  422. field = "sd_code";break;
  423. case 'ProdInOut!OutsidePicking': //委外领料单
  424. field = "ma_code";break;
  425. case 'ProdInOut!OutsideReturn': //委外退料单
  426. field = "mm_code";break;
  427. case 'ProdInOut!DefectIn': //不良品入库单
  428. field = "pd_code";break;
  429. case 'ProdInOut!DefectOut': //不良品入库单
  430. field = "pd_code";break;
  431. case 'ProdInOut!OutsideCheckIn': //委外验收单
  432. field = "mm_code";break;
  433. case 'ProdInOut!OSMake!Give': //委外补料单
  434. field = "mm_code";break;
  435. }
  436. return field;
  437. },
  438. /**
  439. * pd_ordercode的限制条件
  440. */
  441. getCodeCondition: function(){
  442. var field = null;
  443. var fields = '';
  444. var tablename = '';
  445. var myfield = '';
  446. var tFields = '';
  447. switch (caller) {
  448. case 'ProdInOut!PurcCheckin': //采购验收单
  449. field = "pu_vendcode";
  450. tFields = 'pi_cardid,pi_cardcode,pi_title,pi_currency,pi_rate,pi_payment,pi_transport,pi_paydate';
  451. fields = 'pu_vendid,pu_vendcode,pu_vendname,pu_currency,pu_rate,pu_payments,pu_transport,pu_suredate';
  452. tablename = 'Purchase';
  453. myfield = 'pu_code';
  454. break;
  455. case 'ProdInOut!PurcCheckout': //采购验退单
  456. field = "pu_vendcode";
  457. tFields = 'pi_cardid,pi_cardcode,pi_title,pi_currency,pi_rate,pi_payment,pi_transport,pi_paydate';
  458. fields = 'pu_vendid,pu_vendcode,pu_vendname,pu_currency,pu_rate,pu_payments,pu_transport,pu_suredate';
  459. tablename = 'Purchase';
  460. myfield = 'pu_code';
  461. break;
  462. case 'ProdInOut!DrpSale': //配货单
  463. tFields = 'pi_cardid,pi_cardcode,pi_title,pi_currency,pi_rate,pi_payment,pi_transport,pi_sellercode,pi_belongs,pi_receivecode,pi_receivename,pi_transport';
  464. fields = 'sa_custid,sa_custcode,sa_custname,sa_currency,sa_rate,sa_payments,sa_transport,sa_sellercode,sa_seller,sa_shcustcode,sa_shcustname,sa_transport';
  465. tablename = 'Sale';
  466. myfield = 'sa_code';
  467. field = "sa_custcode";
  468. break;
  469. case 'ProdInOut!AppropriationPutIn': //分公司拨入单
  470. tFields = 'pi_cardcode,pi_title';
  471. fields = 'ma_custcode,ma_custname';
  472. tablename = 'Make';
  473. myfield = 'ma_code';
  474. field = "ma_custcode";
  475. break;
  476. case 'ProdInOut!SaleAppropriationOut': //销售拨出单
  477. tFields = 'pi_cardid,pi_cardcode,pi_title,pi_currency,pi_rate,pi_payment,pi_transport';
  478. fields = 'sa_custid,sa_custcode,sa_custname,sa_currency,sa_rate,sa_payments,sa_transport';
  479. tablename = 'Sale';
  480. myfield = 'sa_code';
  481. field = "sa_custcode";
  482. break;
  483. case 'ProdInOut!SaleReturn': //销售退货单
  484. tFields = 'pi_cardid,pi_cardcode,pi_title,pi_currency,pi_rate,pi_payment,pi_transport,pi_sellercode,pi_belongs,pi_receivecode,pi_receivename,pi_transport';
  485. fields = 'sa_custid,sa_custcode,sa_custname,sa_currency,sa_rate,sa_payments,sa_transport,sa_sellercode,sa_seller,sa_shcustcode,sa_shcustname,sa_transport';
  486. tablename = 'Sale';
  487. myfield = 'sa_code';
  488. field = "sa_custcode";
  489. break;
  490. case 'ProdInOut!AppropriationPutOut': //分公司拨出单
  491. tFields = 'pi_cardcode,pi_title';
  492. fields = 'ma_custcode,ma_custname';
  493. tablename = 'Make';
  494. myfield = 'ma_code';
  495. field = "ma_custcode";
  496. break;
  497. case 'ProdInOut!DefectIn': //不良品入库单
  498. field = "pu_vendcode";
  499. tFields = 'pi_cardid,pi_cardcode,pi_title,pi_currency,pi_rate,pi_payment,pi_transport,pi_paydate';
  500. fields = 'pu_vendid,pu_vendcode,pu_vendname,pu_currency,pu_rate,pu_payments,pu_transport,pu_suredate';
  501. tablename = 'Purchase';
  502. myfield = 'pu_code';
  503. break;
  504. case 'ProdInOut!DefectOut': //不良品出库单
  505. field = "pu_vendcode";
  506. tFields = 'pi_cardid,pi_cardcode,pi_title,pi_currency,pi_rate,pi_payment,pi_transport,pi_paydate';
  507. fields = 'pu_vendid,pu_vendcode,pu_vendname,pu_currency,pu_rate,pu_payments,pu_transport,pu_suredate';
  508. tablename = 'Purchase';
  509. myfield = 'pu_code';
  510. break;
  511. case 'ProdInOut!OutsidePicking': //委外领料单
  512. field = "ma_vendcode";
  513. tFields = 'pi_cardcode,pi_title,pi_departmentcode,pi_departmentname';
  514. fields = 'ma_vendcode,ma_vendname,ma_departmentcode,ma_departmentname';
  515. tablename = 'Make';
  516. myfield = 'ma_code';
  517. break;
  518. case 'ProdInOut!OutsideReturn': //委外退料单
  519. field = "ma_vendcode";
  520. tFields = 'pi_cardcode,pi_title,pi_departmentcode,pi_departmentname';
  521. fields = 'ma_vendcode,ma_vendname,ma_departmentcode,ma_departmentname';
  522. tablename = 'Make';
  523. myfield = 'ma_code';
  524. break;
  525. case 'ProdInOut!OutsideCheckIn': //委外验收单
  526. field = "ma_vendcode";
  527. tFields = 'pi_cardcode,pi_title,pi_departmentcode,pi_departmentname';
  528. fields = 'ma_vendcode,ma_vendname,ma_departmentcode,ma_departmentname';
  529. tablename = 'Make';
  530. myfield = 'ma_code';
  531. break;
  532. case 'ProdInOut!OutesideCheckReturn': //委外验收单
  533. field = "ma_vendcode";
  534. tFields = 'pi_cardcode,pi_title,pi_departmentcode,pi_departmentname';
  535. fields = 'ma_vendcode,ma_vendname,ma_departmentcode,ma_departmentname';
  536. tablename = 'Make';
  537. myfield = 'ma_code';
  538. break;
  539. }
  540. var obj = new Object();
  541. obj.field = field;
  542. obj.fields = fields;
  543. obj.tFields = tFields;
  544. obj.tablename = tablename;
  545. obj.myfield = myfield;
  546. return obj;
  547. },
  548. /**
  549. * 有来源不能新增明细
  550. */
  551. hasSource: function(grid) {
  552. var bool = false,field = null;
  553. switch(caller) {
  554. case 'ProdInOut!DrpSale'://配货单
  555. field = 'pd_snid';
  556. break;
  557. case 'ProdInOut!PurcCheckin': //采购验收单
  558. field = 'pd_qcid';
  559. break;
  560. case 'ProdInOut!DefectIn': //不良品入库单
  561. field = 'pd_qcid';
  562. break;
  563. }
  564. if(field != null) {
  565. var s = null;
  566. grid.store.each(function(item){
  567. s = item.get(field);
  568. if(s != null && s != '' && s > 0) {
  569. bool = true;return;
  570. }
  571. });
  572. }
  573. return bool;
  574. },
  575. isAllowUpdateQty: function(record) {
  576. var bool = true;
  577. switch(caller) {
  578. case 'ProdInOut!PurcCheckin': //采购验收单
  579. if(record.get('pd_qcid') != null && record.get('pd_qcid') > 0)
  580. bool = false;
  581. break;
  582. case 'ProdInOut!DefectIn': //不良品入库单
  583. if(record.get('pd_qcid') != null && record.get('pd_qcid') > 0)
  584. bool = false;
  585. break;
  586. }
  587. return bool;
  588. }
  589. });