支出合同优化项目成本分解结构必录逻辑
This commit is contained in:
parent
e434fa401e
commit
ce459e1230
|
|
@ -16,6 +16,7 @@ import kd.bos.servicehelper.BusinessDataServiceHelper;
|
|||
import kd.sdk.plugin.Plugin;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.EventObject;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
|
|
@ -28,6 +29,18 @@ public class OutContractFromPlugin extends AbstractBillPlugIn implements Plugin
|
|||
|
||||
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
|
||||
public void propertyChanged(PropertyChangedArgs e) {
|
||||
super.propertyChanged(e);
|
||||
|
|
@ -35,6 +48,7 @@ public class OutContractFromPlugin extends AbstractBillPlugIn implements Plugin
|
|||
ChangeData changeData = e.getChangeSet()[0];
|
||||
if (changeName.equals(contracttype)) {//收入合同字段值改变
|
||||
//合同类型
|
||||
((FieldEdit) this.getControl("cbs")).setMustInput(shouldCbsBeRequired());//项目成本分解结构必录设置
|
||||
DynamicObject contractType = (DynamicObject)changeData.getNewValue();
|
||||
if (contractType==null){
|
||||
return;
|
||||
|
|
@ -98,6 +112,41 @@ public class OutContractFromPlugin extends AbstractBillPlugIn implements Plugin
|
|||
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;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue