优化代码 合同计量时间校验取消 合同结算锁定取消 项目增加业主全称

This commit is contained in:
xiaoshi 2024-12-25 17:04:25 +08:00
parent e08cfdc9b4
commit d1477ffbb7
6 changed files with 121 additions and 96 deletions

View File

@ -1,6 +1,7 @@
package zcgj.zcdev.zcdev.pr.plugin.form;
import kd.bos.dataentity.entity.DynamicObject;
import kd.bos.dataentity.resource.ResManager;
import kd.bos.dataentity.utils.StringUtils;
import kd.bos.entity.datamodel.events.ChangeData;
import kd.bos.entity.datamodel.events.PropertyChangedArgs;
@ -14,6 +15,7 @@ import kd.ec.contract.formplugin.ContractMeasureBillEditPlugin;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
/**
@ -78,6 +80,31 @@ public class ContractEeasurementBillPlugin extends ContractMeasureBillEditPlugin
}
}
@Override
protected void onDateChanged(ChangeData changeData, String propName) {
if (this.getPageCache().get("isperiodchanged") != null) {
this.getPageCache().remove("isperiodchanged");
} else {
Date beginDate = (Date)this.getModel().getValue("begindate");
Date endDate = (Date)this.getModel().getValue("enddate");
DynamicObject period = (DynamicObject)this.getModel().getValue("period");
if (period != null) {
Date periodBeginDate = period.getDate("begindate");
Date periodEndDate = period.getDate("enddate");
if (null != endDate && null != beginDate && beginDate.compareTo(endDate) > 0) {
this.getModel().setValue(propName, changeData.getOldValue());
this.getView().showMessage(ResManager.loadKDString("结束日期应大于等于开始日期。", "ContractMeasureBillEditPlugin_1", "ec-contract-formplugin", new Object[0]));
} else if (null != endDate && endDate.compareTo(periodEndDate) > 0) {
// this.getModel().setValue("enddate", changeData.getOldValue());
// this.getView().showMessage(ResManager.loadKDString("结束日期应小于等于期间结束日期。", "ContractMeasureBillEditPlugin_2", "ec-contract-formplugin", new Object[0]));
} else if (null != beginDate && beginDate.compareTo(periodBeginDate) < 0) {
// this.getModel().setValue("begindate", changeData.getOldValue());
// this.getView().showMessage(ResManager.loadKDString("开始日期应大于等于期间开始日期。", "ContractMeasureBillEditPlugin_3", "ec-contract-formplugin", new Object[0]));
}
}
}
}
@Override
public void propertyChanged(PropertyChangedArgs e) {
super.propertyChanged(e);

View File

@ -13,6 +13,7 @@ import kd.bos.form.control.events.BeforeItemClickEvent;
import kd.bos.orm.query.QFilter;
import kd.bos.servicehelper.BusinessDataServiceHelper;
import kd.bos.servicehelper.operation.SaveServiceHelper;
import kd.ec.contract.formplugin.settle.ContractSettleCommonEditPlugin;
import kd.sdk.plugin.Plugin;
import java.util.EventObject;
@ -21,100 +22,10 @@ import java.util.EventObject;
* 单据界面插件
* 支出合同结算供应商变更插件
*/
public class ContractSettleBillPlugin extends AbstractBillPlugIn implements Plugin {
public class ContractSettleBillPlugin extends ContractSettleCommonEditPlugin{
@Override
public void afterCreateNewData(EventObject e) {
super.afterCreateNewData(e);
// Object changetype = this.getModel().getValue("changetype");
// if(changetype!=null){
// if(changetype.toString().equals("03")){
// this.getView().setVisible(true,"zcgj_partb");
// this.getView().setVisible(true,"zcgj_otherpart");
// }else {
// this.getView().setVisible(false,"zcgj_partb");
// this.getView().setVisible(false,"zcgj_otherpart");
// }
// }
}
@Override
public void registerListener(EventObject e) {
super.registerListener(e);
// 注册按钮点击事件
// this.addClickListeners("bar_audit");
// this.addItemClickListeners("bar_audit");
// Button button = this.getView().getControl("bar_save");
// button.addClickListener(this);
}
@Override
public void beforeClick(BeforeClickEvent evt) {
super.beforeClick(evt);
}
@Override
public void click(EventObject evt) {
super.click(evt);
System.out.println();
}
@Override
public void beforeItemClick(BeforeItemClickEvent evt) {
super.beforeItemClick(evt);
Control source = (Control) evt.getSource();
String key = source.getKey();
if (StringUtils.equals("bar_audit", key)) {
// 在此添加业务逻辑
// Object changetype = this.getModel().getValue("changetype");
// if (changetype != null) {
// if (changetype.toString().equals("03")) {
// Object contract = this.getModel().getValue("contract");
// DynamicObject contractInfo = (DynamicObject) contract;
// String billName = contractInfo.getDataEntityType().getName();
// DynamicObject zcgjpartb = (DynamicObject)this.getModel().getValue("zcgj_partb");
// Object zcgjOtherpart = this.getModel().getValue("zcgj_otherpart");
// if (billName.equals("ec_out_contract_f7")) {
// QFilter f1 = new QFilter("number", "=", contractInfo.getString("number"));
// DynamicObject outContractF7 = BusinessDataServiceHelper.loadSingle("ec_out_contract_f7", new QFilter[]{f1});
// outContractF7.set("partb",zcgjpartb);
// OperationResult saveOperationResult = SaveServiceHelper.saveOperate("ec_out_contract_f7", new DynamicObject[]{outContractF7}, null);//支出合同F7实体
//
// QFilter f2 = new QFilter("billno", "=", contractInfo.getString("number"));
// DynamicObject outContract = BusinessDataServiceHelper.loadSingle("ec_out_contract", new QFilter[]{f2});
// outContract.set("partb",zcgjpartb);
// if(zcgjOtherpart!=null){
// DynamicObjectCollection otherpart = (DynamicObjectCollection) this.getModel().getValue("zcgj_otherpart");
// outContract.set("otherpart",otherpart);
// outContract.set("ismulticontract",true);
// }
// OperationResult saveOperationResult1 = SaveServiceHelper.saveOperate("ec_out_contract", new DynamicObject[]{outContractF7}, null);//支出合同实体
// System.out.println(saveOperationResult1);
// }else{
//
// }
// }
// }
evt.setCancel(true); // 取消后续处理将不会再触发click事件
}
}
@Override
public void propertyChanged(PropertyChangedArgs e) {
super.propertyChanged(e);
String name = e.getProperty().getName();
// if(name.equals("changetype")){
// Object changetype = this.getModel().getValue("changetype");
// if(changetype!=null){
// if(changetype.toString().equals("03")){
// this.getView().setVisible(true,"zcgj_partb");
// this.getView().setVisible(true,"zcgj_otherpart");
// }else {
// this.getView().setVisible(false,"zcgj_partb");
// this.getView().setVisible(false,"zcgj_otherpart");
// }
// }
// }
protected void setDateEditMinAndMaxDate() {
// super.setDateEditMinAndMaxDate();
}
}

View File

@ -1,6 +1,7 @@
package zcgj.zcdev.zcdev.pr.plugin.form;
import kd.bos.dataentity.entity.DynamicObject;
import kd.bos.form.field.BasedataEdit;
import kd.ec.contract.formplugin.ContractTreeListingPlugin;
public class ContractTreeListExtPlugin extends ContractTreeListingPlugin {
@ -11,12 +12,16 @@ public class ContractTreeListExtPlugin extends ContractTreeListingPlugin {
if(contractType != null) {
DynamicObject dynamicObject = (DynamicObject) contractType;
String number = dynamicObject.getString("number");
if(number .equals("wzcg01")||number.equals("sbcg")||number.equals("jjfb")) {
if(number.equals("wzcg01")||number.equals("sbcg")) {
this.getView().setVisible(false, new String[]{"treecbsnumber", "treecbsname","cbs"});
this.getView().setEnable(false,"isincost");
this.getModel().setValue("isincost",false);
}else if(number.equals("jjfb")){
this.getView().setEnable(false,"isincost");
this.getModel().setValue("isincost",true);
BasedataEdit basedataEdit = (BasedataEdit)this.getControl("cbs");
basedataEdit.setMustInput(false);
}
}
}
}

View File

@ -1,6 +1,7 @@
package zcgj.zcdev.zcdev.pr.plugin.form;
import kd.bos.dataentity.entity.DynamicObject;
import kd.bos.dataentity.resource.ResManager;
import kd.bos.dataentity.utils.StringUtils;
import kd.bos.entity.datamodel.events.ChangeData;
import kd.bos.entity.datamodel.events.PropertyChangedArgs;
@ -14,6 +15,7 @@ import java.math.BigDecimal;
import java.math.RoundingMode;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Date;
import java.util.List;
import java.util.stream.Collectors;
@ -119,6 +121,31 @@ public class InContractMeasurementBillEditPlugin extends InContractMeasureBillEd
return result;
}
@Override
protected void onDateChanged(ChangeData changeData, String propName) {
if (this.getPageCache().get("isperiodchanged") != null) {
this.getPageCache().remove("isperiodchanged");
} else {
Date beginDate = (Date)this.getModel().getValue("begindate");
Date endDate = (Date)this.getModel().getValue("enddate");
DynamicObject period = (DynamicObject)this.getModel().getValue("period");
if (period != null) {
Date periodBeginDate = period.getDate("begindate");
Date periodEndDate = period.getDate("enddate");
if (null != endDate && null != beginDate && beginDate.compareTo(endDate) > 0) {
this.getModel().setValue(propName, changeData.getOldValue());
this.getView().showMessage(ResManager.loadKDString("结束日期应大于等于开始日期。", "ContractMeasureBillEditPlugin_1", "ec-contract-formplugin", new Object[0]));
} else if (null != endDate && endDate.compareTo(periodEndDate) > 0) {
// this.getModel().setValue("enddate", changeData.getOldValue());
// this.getView().showMessage(ResManager.loadKDString("结束日期应小于等于期间结束日期。", "ContractMeasureBillEditPlugin_2", "ec-contract-formplugin", new Object[0]));
} else if (null != beginDate && beginDate.compareTo(periodBeginDate) < 0) {
// this.getModel().setValue("begindate", changeData.getOldValue());
// this.getView().showMessage(ResManager.loadKDString("开始日期应大于等于期间开始日期。", "ContractMeasureBillEditPlugin_3", "ec-contract-formplugin", new Object[0]));
}
}
}
}
@Override
public void propertyChanged(PropertyChangedArgs e) {
super.propertyChanged(e);

View File

@ -0,0 +1,55 @@
package zcgj.zcdev.zcdev.pr.plugin.form;
import kd.bos.entity.datamodel.events.ChangeData;
import kd.bos.entity.datamodel.events.PropertyChangedArgs;
import kd.bos.form.field.FieldEdit;
import kd.ec.contract.formplugin.ProjectEditUI;
import java.util.EventObject;
/**
* 项目编辑界面插件
*/
public class ProjectEditExtUI extends ProjectEditUI {
@Override
public void afterBindData(EventObject e) {
super.afterBindData(e);
String value = this.getModel().getDataEntity().getString("boqmode");
setUnitProMustInput(value);
}
@Override
public void propertyChanged(PropertyChangedArgs args) {
super.propertyChanged(args);
String propertyName = args.getProperty().getName();
ChangeData data;
if ("boqmode".equals(propertyName)) {
data = args.getChangeSet()[0];
String unitProjectName = (String) data.getNewValue();
setUnitProMustInput(unitProjectName);
}
}
private void setUnitProMustInput(String value) {
FieldEdit pronumber = (FieldEdit)this.getControl("unitprojectnumber");
FieldEdit proname = (FieldEdit)this.getControl("unitprojectname");
FieldEdit proorg = (FieldEdit)this.getControl("responsibleorg");
if ("unitproject".equals(value)) {
pronumber.setMustInput(true);
proname.setMustInput(true);
// proorg.setMustInput(true);
this.getView().setEnable(true, new String[]{"unitproject", "addunitproject", "deleteunitproject"});
this.getModel().setValue("editonunit", true);
} else {
pronumber.setMustInput(false);
proname.setMustInput(false);
proorg.setMustInput(false);
this.getModel().deleteEntryData("unitproject");
this.getView().setEnable(false, new String[]{"unitproject", "addunitproject", "deleteunitproject"});
this.getModel().setValue("editonunit", false);
}
}
}

View File

@ -124,7 +124,7 @@ public class ContractMeasurementValidator extends ContractMeasureValidator {
DynamicObject listing = listingEntry.getDynamicObject("listing");
if (listing != null) {
if (repeatListingIds.contains(listing.getLong("id"))) {
this.addErrorMessage(dataEntity, String.format(ResManager.loadKDString("本次操作的单据中清单【%s】存在重复请检查。", "ContractMeasureValidator_2", "ec-contract-opplugin", new Object[0]), listing.getString("name")));
// this.addErrorMessage(dataEntity, String.format(ResManager.loadKDString("本次操作的单据中清单【%s】存在重复请检查。", "ContractMeasureValidator_2", "ec-contract-opplugin", new Object[0]), listing.getString("name")));
} else if (changedListingIds.contains(listing.getLong("id"))) {
this.addErrorMessage(dataEntity, String.format(ResManager.loadKDString("清单【%s】正在变更中请检查。", "ContractMeasureValidator_3", "ec-contract-opplugin", new Object[0]), listing.getString("name")));
} else {