收款表单插件判断分录清账状态和下推标记

This commit is contained in:
yuxueliang0813 2025-05-22 10:43:26 +08:00
parent f1f045f42f
commit 4c4ad1e7e4
1 changed files with 79 additions and 57 deletions

View File

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