优化代码

This commit is contained in:
xiaoshi 2024-12-26 17:46:45 +08:00
parent febbc71fea
commit d592f66778
4 changed files with 44 additions and 7 deletions

View File

@ -20,7 +20,7 @@ import java.util.EventObject;
/** /**
* 单据界面插件 * 单据界面插件
* 支出合同结算供应商变更插件 * 合同结算公共插件插件
*/ */
public class ContractSettleBillPlugin extends ContractSettleCommonEditPlugin{ public class ContractSettleBillPlugin extends ContractSettleCommonEditPlugin{

View File

@ -107,6 +107,26 @@ public class EcContractFromPlugin extends AbstractBillPlugIn implements Plugin {
dataEntity.set("zcgj_hshtdj", ofamount); dataEntity.set("zcgj_hshtdj", ofamount);
// this.getModel().setValue("zcgj_hshtdj", ofamount); // this.getModel().setValue("zcgj_hshtdj", ofamount);
this.getView().updateView(); 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,5 +1,7 @@
package zcgj.zcdev.zcdev.pr.plugin.form; 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.ChangeData;
import kd.bos.entity.datamodel.events.PropertyChangedArgs; import kd.bos.entity.datamodel.events.PropertyChangedArgs;
import kd.bos.form.field.FieldEdit; import kd.bos.form.field.FieldEdit;
@ -27,7 +29,18 @@ public class ProjectEditExtUI extends ProjectEditUI {
if ("boqmode".equals(propertyName)) { if ("boqmode".equals(propertyName)) {
data = args.getChangeSet()[0]; data = args.getChangeSet()[0];
String unitProjectName = (String) data.getNewValue(); String unitProjectName = (String) data.getNewValue();
setUnitProMustInput(unitProjectName);
// 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);
}
} }
} }
@ -39,7 +52,7 @@ public class ProjectEditExtUI extends ProjectEditUI {
if ("unitproject".equals(value)) { if ("unitproject".equals(value)) {
pronumber.setMustInput(true); pronumber.setMustInput(true);
proname.setMustInput(true); proname.setMustInput(true);
// proorg.setMustInput(true); proorg.setMustInput(false);
this.getView().setEnable(true, new String[]{"unitproject", "addunitproject", "deleteunitproject"}); this.getView().setEnable(true, new String[]{"unitproject", "addunitproject", "deleteunitproject"});
this.getModel().setValue("editonunit", true); this.getModel().setValue("editonunit", true);
} else { } else {

View File

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