收款表单插件判断分录清账状态和下推标记
This commit is contained in:
		
							parent
							
								
									f1f045f42f
								
							
						
					
					
						commit
						4c4ad1e7e4
					
				|  | @ -145,17 +145,15 @@ public class RecBillFromPlugin extends AbstractFormPlugin implements Plugin { | |||
|             if (result) { | ||||
|                 handleCustomerSplitChange(); | ||||
|             } | ||||
|         } | ||||
|         //监听分录清账状态 | ||||
|         else if (StringUtils.equals(fieldKey, RecFieldsInfo.ENTRY_CLOSING_STATUS)) { | ||||
|         } else if (StringUtils.equals(fieldKey, RecFieldsInfo.ENTRY_CLOSING_STATUS)) { | ||||
|             //监听分录清账状态,更新表头清账状态字段 | ||||
|             DynamicObjectCollection entry = this.getModel().getEntryEntity("entry"); | ||||
|             if (null != entry && entry.size() != 0) { | ||||
|                 setClosingStatus(entry); | ||||
|             } | ||||
|         } | ||||
|         //监听付款人id | ||||
|         //一次性客户/一次性供应商时设置默认值。 | ||||
|         else if (StringUtils.equals(fieldKey, "payer")) { | ||||
|         } else if (StringUtils.equals(fieldKey, "payer")) { | ||||
|             //监听付款人id | ||||
|             //一次性客户/一次性供应商时设置默认值。 | ||||
|             String type = (String) this.getModel().getValue(RecFieldsInfo.PAYER_TYPE); | ||||
|             if ("bd_customer".equals(type) || "bd_supplier".equals(type)) { | ||||
|                 Object value = this.getModel().getValue("payer"); | ||||
|  | @ -171,50 +169,65 @@ public class RecBillFromPlugin extends AbstractFormPlugin implements Plugin { | |||
|                 } | ||||
|                 this.getView().updateView(); | ||||
|             } | ||||
|         } | ||||
|         //监听业务小类 | ||||
|         else if (StringUtils.equals(fieldKey, "shjh_bizsmall")) { | ||||
| 
 | ||||
|             //付款人类型=客户 | ||||
|             String type = (String) this.getModel().getValue(RecFieldsInfo.PAYER_TYPE); | ||||
|             if ("bd_customer".equals(type)) { | ||||
|                 DynamicObject bizSmall = (DynamicObject) this.getModel().getValue("shjh_bizsmall"); | ||||
|                 if (null != bizSmall) { | ||||
|                     String string = bizSmall.getString("shjh_qzfs"); | ||||
|                     //当收款单【业务小类】清账方式字段=待判断清账 | ||||
|                     if ("dpdqz".equals(string)) { | ||||
|                         //判断收款单中的客户信息,是否在《结构性清账客户映射表》中 | ||||
|                         //判断客户是否拆分 | ||||
|                         boolean customerSplit = (boolean) this.getModel().getValue("shjh_customersplit"); | ||||
|                         if (!customerSplit) { | ||||
|                             //当客户拆分=否时,使用表头付款方入账。 | ||||
|                             Object value = this.getModel().getValue("payer"); | ||||
|                             if (null != value) { | ||||
|                                 DynamicObject customerObj = BusinessDataServiceHelper.loadSingle(value, type); | ||||
|                                 QFilter number = new QFilter("shjh_customer.number", QCP.equals, customerObj.getString("number")); | ||||
|                                 DynamicObject mappingObj = BusinessDataServiceHelper.loadSingle("shjh_jgqzcust", number.toArray()); | ||||
|                                 DynamicObjectCollection entryEntity = this.getModel().getEntryEntity("entry"); | ||||
|                                 if (null != mappingObj) { | ||||
|                                     if (null != entryEntity) { | ||||
|                                         for (int i = 0; i < entryEntity.size(); i++) { | ||||
|                                             this.getModel().setValue("shjh_needpushbill", true, i); | ||||
|                                             this.getModel().setValue("shjh_closingstatus", "B", i); | ||||
|                                         } | ||||
|                                     } | ||||
|                                 } else { | ||||
|                                     if (null != entryEntity) { | ||||
|                                         for (int i = 0; i < entryEntity.size(); i++) { | ||||
|                                             this.getModel().setValue("shjh_needpushbill", false, i); | ||||
|                                             this.getModel().setValue("shjh_closingstatus", "A", i); | ||||
|                                         } | ||||
|                                     } | ||||
|         }else if (StringUtils.equals(fieldKey, "shjh_bizsmall")) { | ||||
|             //监听业务小类 | ||||
|             //付款人类型=客户或者其他,都可以,根据业务小类的清账方式来判断 | ||||
| //            String type = (String) this.getModel().getValue(RecFieldsInfo.PAYER_TYPE); | ||||
| //            if ("bd_customer".equals(type)) { | ||||
| //            } | ||||
|             DynamicObject bizSmall = (DynamicObject) this.getModel().getValue("shjh_bizsmall"); | ||||
|             if (null != bizSmall) { | ||||
|                 String string = bizSmall.getString("shjh_qzfs");//业务小类中的清账方式 | ||||
|                 DynamicObjectCollection entryEntity = this.getModel().getEntryEntity("entry"); | ||||
|                 //当收款单【业务小类】清账方式字段=全部金蝶清账 | ||||
|                 if ("qbjdqz".equals(string)) { | ||||
|                     //判断收款单中的客户信息,是否在《结构性清账客户映射表》中 | ||||
|                     //判断客户是否拆分,客户拆分为否时,以表头付款人来判断,否则以分录上的客户来判断 | ||||
|                     boolean customerSplit = (boolean) this.getModel().getValue("shjh_customersplit"); | ||||
|                     if (!customerSplit) { | ||||
|                         //当客户拆分=否时,使用表头付款方入账。 | ||||
|                         Object value = this.getModel().getValue("payer"); | ||||
|                         for (int i = 0; i < entryEntity.size(); i++) { | ||||
|                             this.getModel().setValue("shjh_needpushbill", false, i);//不需要下推清账单 | ||||
|                             this.getModel().setValue("shjh_closingstatus", "A", i);//无需金蝶清账 | ||||
|                         } | ||||
|                         if (null != value && "bd_customer".equals(this.getModel().getValue(RecFieldsInfo.PAYER_TYPE))) { | ||||
|                             DynamicObject customerObj = BusinessDataServiceHelper.loadSingle(value, "bd_customer"); | ||||
|                             QFilter number = new QFilter("shjh_customer.number", QCP.equals, customerObj.getString("number")); | ||||
|                             DynamicObject mappingObj = BusinessDataServiceHelper.loadSingle("shjh_jgqzcust", number.toArray()); | ||||
|                             if (null != mappingObj) { | ||||
|                                 for (int i = 0; i < entryEntity.size(); i++) { | ||||
|                                     this.getModel().setValue("shjh_needpushbill", true, i);//需要下推清账单 | ||||
|                                     this.getModel().setValue("shjh_closingstatus", "B", i);//待清账 | ||||
|                                 } | ||||
|                                 this.getModel().getValue("entry"); | ||||
|                             } else { | ||||
|                                 for (int i = 0; i < entryEntity.size(); i++) { | ||||
|                                     this.getModel().setValue("shjh_needpushbill", false, i);//不需要下推清账单 | ||||
|                                     this.getModel().setValue("shjh_closingstatus", "A", i);//无需金蝶清账 | ||||
|                                 } | ||||
|                             } | ||||
|                         } | ||||
|                     }else{ | ||||
|                         //当客户拆分=是,以分录客户来判断 | ||||
|                         for (int i = 0; i < entryEntity.size(); i++) { | ||||
|                             QFilter number = new QFilter("shjh_customer.number", QCP.equals, entryEntity.get(i).getString("shjh_entrycustomer.number")); | ||||
|                             DynamicObject mappingObj = BusinessDataServiceHelper.loadSingle("shjh_jgqzcust", number.toArray()); | ||||
|                             if (null != mappingObj) { | ||||
|                                 this.getModel().setValue("shjh_needpushbill", true, i); | ||||
|                             }else{ | ||||
|                                 this.getModel().setValue("shjh_needpushbill", false, i); | ||||
|                             } | ||||
|                         } | ||||
|                     } | ||||
|                 }else{ | ||||
|                     //【业务小类】清账方式字段 != 全部金蝶清账 | ||||
|                     for (int i = 0; i < entryEntity.size(); i++) { | ||||
|                         this.getModel().setValue("shjh_needpushbill", false, i);//不需要下推清账单 | ||||
|                         this.getModel().setValue("shjh_closingstatus", "A", i);//无需金蝶清账 | ||||
|                     } | ||||
|                 } | ||||
|             } | ||||
| 
 | ||||
|             // 获取成本中心和利润中心的控件 | ||||
|             BasedataEdit shjh_costcenter = this.getView().getControl("shjh_costcenter"); | ||||
|             BasedataEdit shjh_profitcenter = this.getView().getControl("shjh_profitcenter"); | ||||
|  | @ -233,29 +246,38 @@ public class RecBillFromPlugin extends AbstractFormPlugin implements Plugin { | |||
|                 shjh_costcenter.setMustInput(false); | ||||
|                 shjh_profitcenter.setMustInput(false); | ||||
|             } | ||||
|         } | ||||
|         //监听分录客户 | ||||
|         //当客户拆分=是时,使用分录行客户入账。 | ||||
|         else if (StringUtils.equals(fieldKey, "shjh_entrycustomer")) { | ||||
| 
 | ||||
|             //结构性清账客户+业务小类,同时满足,允许下推清账明细判断 yxl 20250512 | ||||
|         }else if (StringUtils.equals(fieldKey, "shjh_entrycustomer")) { | ||||
|             //监听分录客户 | ||||
|             //当客户拆分=是时,使用分录行客户入账。 | ||||
|             //结构性清账客户+业务小类(全部金蝶清账),同时满足时,才允许下推清账明细判断 yxl 20250512 | ||||
|             DynamicObject bizSmall = (DynamicObject) this.getModel().getValue("shjh_bizsmall"); | ||||
|             boolean isdpdqz = false; | ||||
|             boolean iskdqbqz = false;//全部金蝶清账标识 | ||||
|             if (null != bizSmall) { | ||||
|                 //当收款单【业务小类】清账方式字段=待判断清账 | ||||
|                 if ("dpdqz".equals(bizSmall.getString("shjh_qzfs"))) { | ||||
|                     isdpdqz = true; | ||||
|                 //当收款单【业务小类】清账方式字段=全部金蝶清账 | ||||
|                 if ("qbjdqz".equals(bizSmall.getString("shjh_qzfs"))) { | ||||
|                     iskdqbqz = true; | ||||
|                 } | ||||
|             } | ||||
|             DynamicObjectCollection entryEntity = this.getModel().getEntryEntity("entry"); | ||||
|             if (null != entryEntity && isdpdqz) { | ||||
|             if(iskdqbqz){ | ||||
|                 //业务小类是全部金蝶清账,再判断结构性客户 | ||||
|                 for (int i = 0; i < entryEntity.size(); i++) { | ||||
|                     QFilter number = new QFilter("shjh_customer.number", QCP.equals, entryEntity.get(i).getString("shjh_entrycustomer.number")); | ||||
|                     DynamicObject mappingObj = BusinessDataServiceHelper.loadSingle("shjh_jgqzcust", number.toArray()); | ||||
|                     if (null != mappingObj) { | ||||
|                         this.getModel().setValue("shjh_needpushbill", true, i); | ||||
|                         this.getModel().setValue("shjh_needpushbill", true, i);//需要下推清账单 | ||||
|                         this.getModel().setValue("shjh_closingstatus", "B", i);//待清账 | ||||
|                     }else{ | ||||
|                         this.getModel().setValue("shjh_needpushbill", false, i);//不需要下推清账单 | ||||
|                         this.getModel().setValue("shjh_closingstatus", "A", i);//无需金蝶清账 | ||||
|                     } | ||||
|                 } | ||||
|             }else{ | ||||
|                 //业务小类不是全部金蝶清账,直接设置需要下推清账单标记为否 | ||||
|                 for (int i = 0; i < entryEntity.size(); i++) { | ||||
|                     this.getModel().setValue("shjh_needpushbill", false, i);//不需要下推清账单 | ||||
|                     this.getModel().setValue("shjh_closingstatus", "A", i);//无需金蝶清账 | ||||
|                 } | ||||
|             } | ||||
|         } | ||||
|     } | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue