--付款单和收款单(携带生单规则分录的业务大类,业务小类,成本中心,利润中心到收款处理单头)__改成操作并且废弃表单插件逻辑,新增携带业务小类中的原因码到分录中的原因码上
s
This commit is contained in:
		
							parent
							
								
									e9d760372e
								
							
						
					
					
						commit
						28ae56f7c1
					
				|  | @ -18,8 +18,8 @@ public class CasPaybillFormPlugin extends AbstractFormPlugin { | |||
|     @Override | ||||
|     public void afterBindData(EventObject e) { | ||||
|         super.afterBindData(e); | ||||
|         //由于this,不可static | ||||
|         carryCustomer(); | ||||
|         //由于this,不可static  __逻辑迁移到单据保存操作插件 | ||||
| //        carryCustomer(); | ||||
| 
 | ||||
|     } | ||||
| 
 | ||||
|  | @ -50,6 +50,18 @@ public class CasPaybillFormPlugin extends AbstractFormPlugin { | |||
|                         DynamicObject shjhBizsmall = (DynamicObject)this.getModel().getValue("shjh_bizsmall"); | ||||
|                         if (null == shjhBizsmall) { | ||||
|                             this.getModel().setValue("shjh_bizsmall", entry.getDynamicObject("shjh_e_bizsmall")); | ||||
| 
 | ||||
|                             DynamicObjectCollection entrys = this.getModel().getEntryEntity("entry");//付款单分录 | ||||
|                             if (null != entrys) { | ||||
|                                 DynamicObject entryss = entrys.get(0);//首行(被动) | ||||
|                                 DynamicObject shjhYym = entryss.getDynamicObject("shjh_yym");//若原因码为空 | ||||
|                                 if (null == shjhYym) { | ||||
|                                     DynamicObject shjhEBizsmall = entry.getDynamicObject("shjh_e_bizsmall");//规则--业务小类 | ||||
|                                     if (null != shjhEBizsmall) { | ||||
|                                         this.getModel().setValue("shjh_yym", shjhEBizsmall.getDynamicObject("shjh_yym"),0);//规则--小类--原因码 | ||||
|                                     } | ||||
|                                 } | ||||
|                             } | ||||
|                         } | ||||
|                         DynamicObject shjhCostcenter = (DynamicObject)this.getModel().getValue("shjh_costcenter"); | ||||
|                         if (null == shjhCostcenter) { | ||||
|  |  | |||
|  | @ -36,8 +36,8 @@ public class RecBillFromPlugin extends AbstractFormPlugin implements Plugin { | |||
|     @Override | ||||
|     public void afterBindData(EventObject e) { | ||||
|         super.afterBindData(e); | ||||
|         //携带生单规则分录的业务大类,业务小类,成本中心,利润中心到收款处理单头 | ||||
|         carryCustomer(); | ||||
|         //携带生单规则分录的业务大类,业务小类,成本中心,利润中心到收款处理单头__逻辑迁移到单据保存操作插件 | ||||
| //        carryCustomer(); | ||||
|         //根据分录清账状态去默认表头的清账状态 | ||||
|         String state = (String) this.getModel().getValue(RecFieldsInfo.TOP_BILL_STATUS); | ||||
|         if ("A".equals(state)) { | ||||
|  | @ -51,50 +51,6 @@ public class RecBillFromPlugin extends AbstractFormPlugin implements Plugin { | |||
|         } | ||||
|     } | ||||
| 
 | ||||
|     private void carryCustomer() { | ||||
|         String sourcebilltype = (String) this.getModel().getValue("sourcebilltype");//源单类型:被动付款入账(bei_intelpay) | ||||
|         if (!"bei_intelrec".equals(sourcebilltype)) { | ||||
|             return; | ||||
|         } | ||||
| 
 | ||||
|         String sourcebillnumber = (String) this.getModel().getValue("sourcebillnumber");//源单编码:被动付款单号(bei_intelpay) | ||||
|         QFilter q1 = new QFilter("billno", QCP.equals, sourcebillnumber); | ||||
|         DynamicObject beiIntelpay = BusinessDataServiceHelper.loadSingle("bei_intelrec", q1.toArray()); | ||||
|         if (null != beiIntelpay) { | ||||
|             String rulename = beiIntelpay.getString("rulename");//适配规则名称 | ||||
|             //根据适配规则名称查询适配规则 (cas_recpayrule) | ||||
|             // 单据:生单/通知规则(shjh_cas_recpayrule_ext)  单据体:入账规则(entryentity) 字段:规则项名称(e_rulesname) | ||||
|             QFilter q2 = new QFilter("entryentity.e_rulesname", QCP.equals, rulename); | ||||
|             DynamicObject rule = BusinessDataServiceHelper.loadSingle("cas_recpayrule", q2.toArray()); | ||||
|             if (null != rule) { | ||||
|                 //根据适配规则携带对应分录的业务大类,业务小类,成本中心,利润中心 | ||||
|                 DynamicObjectCollection collection = rule.getDynamicObjectCollection("entryentity"); | ||||
|                 for (DynamicObject entry : collection) { | ||||
|                     if (rulename.equals(entry.getString("e_rulesname"))) { | ||||
|                         DynamicObject shjhBizbig = (DynamicObject) this.getModel().getValue("shjh_bizebig"); | ||||
|                         if (null == shjhBizbig) { | ||||
|                             this.getModel().setValue("shjh_bizebig", entry.getDynamicObject("shjh_e_bizbig")); | ||||
|                         } | ||||
|                         DynamicObject shjhBizsmall = (DynamicObject) this.getModel().getValue("shjh_bizsmall"); | ||||
|                         if (null == shjhBizsmall) { | ||||
|                             this.getModel().setValue("shjh_bizsmall", entry.getDynamicObject("shjh_e_bizsmall")); | ||||
|                         } | ||||
|                         DynamicObject shjhCostcenter = (DynamicObject) this.getModel().getValue("shjh_costcenter"); | ||||
|                         if (null == shjhCostcenter) { | ||||
|                             this.getModel().setValue("shjh_costcenter", entry.getDynamicObject("shjh_e_cc")); | ||||
|                         } | ||||
|                         DynamicObject shjhPc = (DynamicObject) this.getModel().getValue("shjh_profitcenter"); | ||||
|                         if (null == shjhPc) { | ||||
|                             this.getModel().setValue("shjh_profitcenter", entry.getDynamicObject("shjh_e_pc")); | ||||
|                         } | ||||
|                         return; | ||||
|                     } | ||||
|                 } | ||||
|             } | ||||
|         } | ||||
|     } | ||||
| 
 | ||||
| 
 | ||||
|     @Override | ||||
|     public void beforeItemClick(BeforeItemClickEvent evt) { | ||||
|         super.beforeItemClick(evt); | ||||
|  | @ -306,5 +262,46 @@ public class RecBillFromPlugin extends AbstractFormPlugin implements Plugin { | |||
|         this.getModel().setValue("shjh_qzzt", headerStatus); | ||||
|     } | ||||
| 
 | ||||
| 
 | ||||
| //    private void carryCustomer() { | ||||
| //        String sourcebilltype = (String) this.getModel().getValue("sourcebilltype");//源单类型:被动付款入账(bei_intelpay) | ||||
| //        if (!"bei_intelrec".equals(sourcebilltype)) { | ||||
| //            return; | ||||
| //        } | ||||
| // | ||||
| //        String sourcebillnumber = (String) this.getModel().getValue("sourcebillnumber");//源单编码:被动付款单号(bei_intelpay) | ||||
| //        QFilter q1 = new QFilter("billno", QCP.equals, sourcebillnumber); | ||||
| //        DynamicObject beiIntelpay = BusinessDataServiceHelper.loadSingle("bei_intelrec", q1.toArray()); | ||||
| //        if (null != beiIntelpay) { | ||||
| //            String rulename = beiIntelpay.getString("rulename");//适配规则名称 | ||||
| //            //根据适配规则名称查询适配规则 (cas_recpayrule) | ||||
| //            // 单据:生单/通知规则(shjh_cas_recpayrule_ext)  单据体:入账规则(entryentity) 字段:规则项名称(e_rulesname) | ||||
| //            QFilter q2 = new QFilter("entryentity.e_rulesname", QCP.equals, rulename); | ||||
| //            DynamicObject rule = BusinessDataServiceHelper.loadSingle("cas_recpayrule", q2.toArray()); | ||||
| //            if (null != rule) { | ||||
| //                //根据适配规则携带对应分录的业务大类,业务小类,成本中心,利润中心 | ||||
| //                DynamicObjectCollection collection = rule.getDynamicObjectCollection("entryentity"); | ||||
| //                for (DynamicObject entry : collection) { | ||||
| //                    if (rulename.equals(entry.getString("e_rulesname"))) { | ||||
| //                        DynamicObject shjhBizbig = (DynamicObject) this.getModel().getValue("shjh_bizebig"); | ||||
| //                        if (null == shjhBizbig) { | ||||
| //                            this.getModel().setValue("shjh_bizebig", entry.getDynamicObject("shjh_e_bizbig")); | ||||
| //                        } | ||||
| //                        DynamicObject shjhBizsmall = (DynamicObject) this.getModel().getValue("shjh_bizsmall"); | ||||
| //                        if (null == shjhBizsmall) { | ||||
| //                            this.getModel().setValue("shjh_bizsmall", entry.getDynamicObject("shjh_e_bizsmall")); | ||||
| //                        } | ||||
| //                        DynamicObject shjhCostcenter = (DynamicObject) this.getModel().getValue("shjh_costcenter"); | ||||
| //                        if (null == shjhCostcenter) { | ||||
| //                            this.getModel().setValue("shjh_costcenter", entry.getDynamicObject("shjh_e_cc")); | ||||
| //                        } | ||||
| //                        DynamicObject shjhPc = (DynamicObject) this.getModel().getValue("shjh_profitcenter"); | ||||
| //                        if (null == shjhPc) { | ||||
| //                            this.getModel().setValue("shjh_profitcenter", entry.getDynamicObject("shjh_e_pc")); | ||||
| //                        } | ||||
| //                        return; | ||||
| //                    } | ||||
| //                } | ||||
| //            } | ||||
| //        } | ||||
| //    } | ||||
| } | ||||
|  | @ -79,6 +79,19 @@ public class PayBillSaveOperation extends AbstractOperationServicePlugIn impleme | |||
|                         DynamicObject shjhBizsmall = (DynamicObject)bill.get("shjh_bizsmall"); | ||||
|                         if (null == shjhBizsmall) { | ||||
|                             bill.set("shjh_bizsmall", entry.getDynamicObject("shjh_e_bizsmall")); | ||||
| 
 | ||||
|                             DynamicObjectCollection entrys = bill.getDynamicObjectCollection("entry");//付款单分录 | ||||
|                             if (null != entrys) { | ||||
|                                 DynamicObject entryss = entrys.get(0);//首行(被动) | ||||
|                                 DynamicObject shjhYym = entryss.getDynamicObject("shjh_yym");//若原因码为空 | ||||
|                                 if (null == shjhYym) { | ||||
|                                     DynamicObject shjhEBizsmall = entry.getDynamicObject("shjh_e_bizsmall");//规则--业务小类 | ||||
|                                      if (null != shjhEBizsmall) { | ||||
|                                          shjhEBizsmall = BusinessDataServiceHelper.loadSingle(shjhEBizsmall.getPkValue(),"shjh_bizsmalltype"); | ||||
|                                          entryss.set("shjh_yym", shjhEBizsmall.getDynamicObject("shjh_yym"));//规则--小类--原因码 | ||||
|                                      } | ||||
|                                 } | ||||
|                             } | ||||
|                         } | ||||
|                         DynamicObject shjhCostcenter = (DynamicObject)bill.get("shjh_costcenter"); | ||||
|                         if (null == shjhCostcenter) { | ||||
|  |  | |||
|  | @ -77,6 +77,19 @@ public class RecBillSaveOperation extends AbstractOperationServicePlugIn impleme | |||
|                         DynamicObject shjhBizsmall = (DynamicObject) bill.get("shjh_bizsmall"); | ||||
|                         if (null == shjhBizsmall) { | ||||
|                             bill.set("shjh_bizsmall", entry.getDynamicObject("shjh_e_bizsmall")); | ||||
| 
 | ||||
|                             DynamicObjectCollection entrys = bill.getDynamicObjectCollection("entry");//收款单分录 | ||||
|                             if (null != entrys) { | ||||
|                                 DynamicObject entryss = entrys.get(0);//首行(被动) | ||||
|                                 DynamicObject shjhYym = entryss.getDynamicObject("shjh_yym");//若原因码为空 | ||||
|                                 if (null == shjhYym) { | ||||
|                                     DynamicObject shjhEBizsmall = entry.getDynamicObject("shjh_e_bizsmall");//规则--业务小类 | ||||
|                                     if (null != shjhEBizsmall) { | ||||
|                                         shjhEBizsmall = BusinessDataServiceHelper.loadSingle(shjhEBizsmall.getPkValue(),"shjh_bizsmalltype"); | ||||
|                                         entryss.set("shjh_yym", shjhEBizsmall.getDynamicObject("shjh_yym"));//规则--小类--原因码 | ||||
|                                     } | ||||
|                                 } | ||||
|                             } | ||||
|                         } | ||||
|                         DynamicObject shjhCostcenter = (DynamicObject) bill.get("shjh_costcenter"); | ||||
|                         if (null == shjhCostcenter) { | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue