Merge remote-tracking branch 'origin/dev' into dev
This commit is contained in:
commit
58f9efd8d0
|
|
@ -0,0 +1,71 @@
|
||||||
|
package zcgj.zcdev.zcdev.pr.plugin.form;
|
||||||
|
|
||||||
|
import kd.bos.bill.AbstractBillPlugIn;
|
||||||
|
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;
|
||||||
|
import kd.bos.form.field.BasedataEdit;
|
||||||
|
import kd.bos.form.field.events.BeforeF7SelectEvent;
|
||||||
|
import kd.bos.form.field.events.BeforeF7SelectListener;
|
||||||
|
import kd.bos.list.ListShowParameter;
|
||||||
|
import kd.bos.orm.query.QCP;
|
||||||
|
import kd.bos.orm.query.QFilter;
|
||||||
|
import kd.sdk.plugin.Plugin;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.EventObject;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 项目年度成本表单插件
|
||||||
|
*/
|
||||||
|
public class AnnualProjectCostFromPlugin extends AbstractBillPlugIn implements BeforeF7SelectListener, Plugin {
|
||||||
|
@Override
|
||||||
|
public void registerListener(EventObject e) {
|
||||||
|
super.registerListener(e);
|
||||||
|
BasedataEdit zcgj_sectypef7 = (BasedataEdit) this.getControl("zcgj_sectypef7");//二级分类
|
||||||
|
zcgj_sectypef7.addBeforeF7SelectListener(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void afterCreateNewData(EventObject e) {
|
||||||
|
super.afterCreateNewData(e);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void propertyChanged(PropertyChangedArgs e) {
|
||||||
|
super.propertyChanged(e);
|
||||||
|
String key = e.getProperty().getName();
|
||||||
|
if ("zcgj_costtype".equals(key)) {
|
||||||
|
//成本大类
|
||||||
|
ChangeData changeData = e.getChangeSet()[0];
|
||||||
|
int rowIndex = changeData.getRowIndex();
|
||||||
|
Object newValue = changeData.getNewValue();
|
||||||
|
Object oldValue = changeData.getOldValue();
|
||||||
|
if (newValue == null || !newValue.equals(oldValue)) {
|
||||||
|
this.getModel().setValue("zcgj_sectypef7", null, rowIndex);//二级分类
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void beforeF7Select(BeforeF7SelectEvent arg0) {
|
||||||
|
ListShowParameter parameter = (ListShowParameter) arg0.getFormShowParameter();
|
||||||
|
int row = arg0.getRow();
|
||||||
|
String name = arg0.getProperty().getName();
|
||||||
|
if (StringUtils.equals(name, "zcgj_sectypef7")) {
|
||||||
|
//企业费用成本分摊明细分录-二级分类
|
||||||
|
Object costType = this.getModel().getValue("zcgj_costtype", row);//成本项
|
||||||
|
List<QFilter> qFilter = new ArrayList<>();
|
||||||
|
if (costType != null) {
|
||||||
|
String costTypeStr = costType.toString();
|
||||||
|
qFilter.add(new QFilter("number", QCP.like, costTypeStr.substring(0, Math.min(3, costTypeStr.length())) + "%"));
|
||||||
|
} else {
|
||||||
|
this.getView().showMessage(ResManager.loadKDString("请先选择成本项。", "EntCostSplitEditPlugin_0", "ec-ecco-formplugin", new Object[0]));
|
||||||
|
arg0.setCancel(true);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
parameter.getListFilterParameter().setQFilters(qFilter);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -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;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -65,7 +65,7 @@ public class InInvoiceUseCkOp extends AbstractOperationServicePlugIn {
|
||||||
this.addFatalErrorMessage(extendedDataEntity, String.format("当前发票已被入库单%s绑定,不允许反审核!", ecma_materialinbill.getString("billno")));
|
this.addFatalErrorMessage(extendedDataEntity, String.format("当前发票已被入库单%s绑定,不允许反审核!", ecma_materialinbill.getString("billno")));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
DynamicObject zcgj_maintenanceackbill = QueryServiceHelper.queryOne("zcgj_maintenanceackbill", "billno", new QFilter[]{filter});//入库单
|
DynamicObject zcgj_maintenanceackbill = QueryServiceHelper.queryOne("zcgj_maintenanceackbill", "billno", new QFilter[]{filter});//设备维修确认单
|
||||||
if (zcgj_maintenanceackbill != null) {
|
if (zcgj_maintenanceackbill != null) {
|
||||||
this.addFatalErrorMessage(extendedDataEntity, String.format("当前发票已被设备维修确认单%s绑定,不允许反审核!", zcgj_maintenanceackbill.getString("billno")));
|
this.addFatalErrorMessage(extendedDataEntity, String.format("当前发票已被设备维修确认单%s绑定,不允许反审核!", zcgj_maintenanceackbill.getString("billno")));
|
||||||
return;
|
return;
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,53 @@
|
||||||
|
package zcgj.zcdev.zcdev.pr.task;
|
||||||
|
|
||||||
|
import kd.bos.context.RequestContext;
|
||||||
|
import kd.bos.dataentity.entity.DynamicObject;
|
||||||
|
import kd.bos.exception.KDException;
|
||||||
|
import kd.bos.orm.query.QCP;
|
||||||
|
import kd.bos.orm.query.QFilter;
|
||||||
|
import kd.bos.schedule.executor.AbstractTask;
|
||||||
|
import kd.bos.servicehelper.BusinessDataServiceHelper;
|
||||||
|
import kd.bos.servicehelper.operation.SaveServiceHelper;
|
||||||
|
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 收入支出合同项目负责人赋值定时任务
|
||||||
|
*/
|
||||||
|
public class ContractManagerAssignerTaskPlugin extends AbstractTask {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void execute(RequestContext requestContext, Map<String, Object> map) throws KDException {
|
||||||
|
|
||||||
|
QFilter qFilter1 = new QFilter("project", QCP.not_equals, null);
|
||||||
|
DynamicObject[] ec_in_contracts = BusinessDataServiceHelper.load("ec_in_contract",
|
||||||
|
"id,project,zcgj_projectmanager", new QFilter[]{qFilter1});//收入合同
|
||||||
|
if (ec_in_contracts != null && ec_in_contracts.length > 0) {
|
||||||
|
for (DynamicObject ec_in_contract : ec_in_contracts) {
|
||||||
|
String projectNumber = ec_in_contract.getDynamicObject("project").getString("number");//收入合同-项目-项目编号
|
||||||
|
QFilter[] qFilter11 = new QFilter[]{new QFilter("billno", QCP.equals, projectNumber)};
|
||||||
|
DynamicObject ec_project = BusinessDataServiceHelper.loadSingle("ec_project", "id,zcgj_pm", qFilter11);//项目
|
||||||
|
DynamicObject zcgj_pm = ec_project.getDynamicObject("zcgj_pm");//项目-项目负责人
|
||||||
|
ec_in_contract.set("zcgj_projectmanager", zcgj_pm);//收入合同-项目负责人
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (ec_in_contracts != null) {
|
||||||
|
SaveServiceHelper.save(ec_in_contracts);
|
||||||
|
}
|
||||||
|
QFilter qFilter2 = new QFilter("project", QCP.not_equals, null);
|
||||||
|
DynamicObject[] ec_out_contracts = BusinessDataServiceHelper.load("ec_out_contract",
|
||||||
|
"id,project,zcgj_projectmanager", new QFilter[]{qFilter2});//支出合同
|
||||||
|
if (ec_out_contracts != null && ec_out_contracts.length > 0) {
|
||||||
|
for (DynamicObject ec_out_contract : ec_out_contracts) {
|
||||||
|
String projectNumber = ec_out_contract.getDynamicObject("project").getString("number");//支出合同-项目-项目编号
|
||||||
|
QFilter[] qFilter22 = new QFilter[]{new QFilter("billno", QCP.equals, projectNumber)};
|
||||||
|
DynamicObject ec_project = BusinessDataServiceHelper.loadSingle("ec_project", "id,zcgj_pm", qFilter22);//项目
|
||||||
|
DynamicObject zcgj_pm = ec_project.getDynamicObject("zcgj_pm");//项目-项目负责人
|
||||||
|
ec_out_contract.set("zcgj_projectmanager", zcgj_pm);//支出合同-项目负责人
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (ec_out_contracts != null) {
|
||||||
|
SaveServiceHelper.save(ec_out_contracts);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue