支出合同优化项目成本分解结构必录逻辑

This commit is contained in:
xuhaihui 2026-01-07 17:05:54 +08:00
parent e434fa401e
commit ce459e1230
1 changed files with 49 additions and 0 deletions

View File

@ -16,6 +16,7 @@ import kd.bos.servicehelper.BusinessDataServiceHelper;
import kd.sdk.plugin.Plugin; import kd.sdk.plugin.Plugin;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.EventObject;
import java.util.List; import java.util.List;
/** /**
@ -28,6 +29,18 @@ public class OutContractFromPlugin extends AbstractBillPlugIn implements Plugin
private String contracttype = "contracttype";//合同类型 private String contracttype = "contracttype";//合同类型
@Override
public void afterCreateNewData(EventObject e) {
super.afterCreateNewData(e);
((FieldEdit) this.getControl("cbs")).setMustInput(shouldCbsBeRequired());//项目成本分解结构必录设置
}
@Override
public void afterBindData(EventObject e) {
super.afterBindData(e);
((FieldEdit) this.getControl("cbs")).setMustInput(shouldCbsBeRequired());//项目成本分解结构必录设置
}
@Override @Override
public void propertyChanged(PropertyChangedArgs e) { public void propertyChanged(PropertyChangedArgs e) {
super.propertyChanged(e); super.propertyChanged(e);
@ -35,6 +48,7 @@ public class OutContractFromPlugin extends AbstractBillPlugIn implements Plugin
ChangeData changeData = e.getChangeSet()[0]; ChangeData changeData = e.getChangeSet()[0];
if (changeName.equals(contracttype)) {//收入合同字段值改变 if (changeName.equals(contracttype)) {//收入合同字段值改变
//合同类型 //合同类型
((FieldEdit) this.getControl("cbs")).setMustInput(shouldCbsBeRequired());//项目成本分解结构必录设置
DynamicObject contractType = (DynamicObject)changeData.getNewValue(); DynamicObject contractType = (DynamicObject)changeData.getNewValue();
if (contractType==null){ if (contractType==null){
return; return;
@ -98,6 +112,41 @@ public class OutContractFromPlugin extends AbstractBillPlugIn implements Plugin
this.getView().setEnable(false,"isonlist"); this.getView().setEnable(false,"isonlist");
} }
} }
((FieldEdit) this.getControl("cbs")).setMustInput(shouldCbsBeRequired());//项目成本分解结构必录设置
} else if (changeName.equals("isonlist") || changeName.equals("project")) {
//基于清单项目
((FieldEdit) this.getControl("cbs")).setMustInput(shouldCbsBeRequired());//项目成本分解结构必录设置
} }
} }
/**
* 根据合同类型计价方式和基于清单状态判断cbs字段是否必填
* 条件contracttype.number 不在 ['ZCHLX02', 'wzcg01', 'sbcg', 'jjfb']
* isonlist=false zcgj_pricetype 不等于 'bdlbdj'
*/
private boolean shouldCbsBeRequired() {
DynamicObject contracttype1 = (DynamicObject) this.getModel().getValue("contracttype");
Object zcgj_pricetype = this.getModel().getValue("zcgj_pricetype");
Boolean isonlist = (Boolean) this.getModel().getValue("isonlist");
boolean shouldSetMustInput = false;
if (contracttype1 != null) {
String number = contracttype1.getString("number");
boolean isExcludedType = number.equals("ZCHLX02") || number.equals("wzcg01") ||
number.equals("sbcg") || number.equals("jjfb");
// 满足条件不是排除的类型 isonlist为false pricetype不等于bdlbdj
if (!isExcludedType && !isonlist &&
(zcgj_pricetype == null || !zcgj_pricetype.toString().equals("bdlbdj"))) {
shouldSetMustInput = true;
}
} else {
// contracttype为null的情况根据业务需求决定是否设置必填
if (!isonlist && (zcgj_pricetype == null || !zcgj_pricetype.toString().equals("bdlbdj"))) {
shouldSetMustInput = true;
}
}
return shouldSetMustInput;
}
} }