Merge remote-tracking branch 'origin/dev' into dev

This commit is contained in:
zhangzhiguo 2024-12-27 09:19:05 +08:00
commit b6adb20b87
8 changed files with 163 additions and 101 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,108 +13,19 @@ 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;
/**
* 单据界面插件
* 支出合同结算供应商变更插件
* 合同结算公共插件插件
*/
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

@ -107,6 +107,26 @@ public class EcContractFromPlugin extends AbstractBillPlugIn implements Plugin {
dataEntity.set("zcgj_hshtdj", ofamount);
// this.getModel().setValue("zcgj_hshtdj", ofamount);
this.getView().updateView();
} else if (name.equals("zcgj_bnyjhshte")) {
Object zcgjbnyjbhshte = this.getModel().getValue("zcgj_bnyjhshte");
if (zcgjbnyjbhshte != null) {
ofamount = new BigDecimal(zcgjbnyjbhshte.toString());
}
amount = ofamount.divide(pRate, 6, BigDecimal.ROUND_HALF_UP);
rate = ofamount.subtract(amount);
dataEntity.set("zcgj_bnyjbhshte", amount);
dataEntity.set("zcgj_bnyjse", rate);
this.getView().updateView();
} else if (name.equals("zcgj_bnyjbhshte")) {
Object zcgjbnyjhshte = this.getModel().getValue("zcgj_bnyjbhshte");
if (zcgjbnyjhshte != null) {
amount = new BigDecimal(zcgjbnyjhshte.toString());
}
ofamount = amount.multiply(pRate);
rate = ofamount.subtract(amount);
dataEntity.set("zcgj_bnyjhshte", ofamount);
dataEntity.set("zcgj_bnyjse", rate);
this.getView().updateView();
}
}

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,68 @@
package zcgj.zcdev.zcdev.pr.plugin.form;
import kd.bos.dataentity.entity.DynamicObject;
import kd.bos.dataentity.entity.DynamicObjectCollection;
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);
}
Object projectorg = this.getModel().getValue("projectorg");
if (projectorg !=null) {
DynamicObject projectOrg = (DynamicObject) projectorg;
DynamicObjectCollection entryEntity = this.getModel().getEntryEntity("unitproject");
for (int i = 0; i < entryEntity.size(); i++) {
this.getModel().setValue("responsibleorg",projectOrg,i);
}
}
}
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(false);
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 {

View File

@ -1,6 +1,8 @@
package zcgj.zcdev.zcdev.pr.plugin.workflow;
import kd.bos.dataentity.entity.DynamicObject;
import kd.bos.logging.Log;
import kd.bos.logging.LogFactory;
import kd.bos.servicehelper.BusinessDataServiceHelper;
import kd.bos.workflow.api.AgentExecution;
import kd.bos.workflow.engine.extitf.IWorkflowPlugin;
@ -12,12 +14,13 @@ import java.util.List;
* 支出合同动态设置某个节点审批人
*/
public class DynamicSetPMApprovalFlowPlugin implements IWorkflowPlugin {
private static final Log log = LogFactory.getLog(DynamicSetPMApprovalFlowPlugin.class);
//根据经理制定当前节点的审批人
@Override
public List<Long> calcUserIds(AgentExecution execution) {
List<Long> ApproversIdList = new ArrayList<>();
// List<Long> ApproversIdList = new ArrayList<>();
List<Long> currentApprover = execution.getCurrentApprover();
// 获取单据id
String pkId = execution.getBusinessKey();
String entityNumber = execution.getEntityNumber();
@ -27,8 +30,9 @@ public class DynamicSetPMApprovalFlowPlugin implements IWorkflowPlugin {
DynamicObject projectInfo = BusinessDataServiceHelper.loadSingle(project.getLong("id"), "ec_project");
DynamicObject zcgjManger = projectInfo.getDynamicObject("zcgj_pm");
long userId = zcgjManger.getLong("id");
ApproversIdList.add(userId);
log.info("经理审批人id为"+userId+zcgjManger.getString("name"));
currentApprover.add(userId);
// 返回审批人的id集合
return ApproversIdList;
return currentApprover;
}
}