Merge remote-tracking branch 'origin/dev' into dev
This commit is contained in:
commit
f45404050d
|
@ -29,6 +29,8 @@ public class TravelItineraryTimeValidatorSubOp extends AbstractOperationServiceP
|
||||||
e.getFieldKeys().add("tripentry");//行程信息分录
|
e.getFieldKeys().add("tripentry");//行程信息分录
|
||||||
e.getFieldKeys().add("startdate");//行程开始时间
|
e.getFieldKeys().add("startdate");//行程开始时间
|
||||||
e.getFieldKeys().add("enddate");//行程结束时间
|
e.getFieldKeys().add("enddate");//行程结束时间
|
||||||
|
e.getFieldKeys().add("from");//出发地
|
||||||
|
e.getFieldKeys().add("to");//目的地
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -49,26 +51,76 @@ public class TravelItineraryTimeValidatorSubOp extends AbstractOperationServiceP
|
||||||
if (OrgCheckUtils.isKS(companyId)) {
|
if (OrgCheckUtils.isKS(companyId)) {
|
||||||
//仅针对矿山下组织下的逻辑
|
//仅针对矿山下组织下的逻辑
|
||||||
DynamicObjectCollection tripEntryCollection = dataEntity.getDynamicObjectCollection("tripentry");//行程信息
|
DynamicObjectCollection tripEntryCollection = dataEntity.getDynamicObjectCollection("tripentry");//行程信息
|
||||||
Set<Date> startDateSet = new HashSet<>();
|
Set<Date> startDateSet = new HashSet<>();//开始时间
|
||||||
Set<Date> endDateSet = new HashSet<>();
|
Set<Date> endDateSet = new HashSet<>();//结束时间
|
||||||
|
Set<String> fromStartCombinationSet = new HashSet<>(); // 出发地+开始时间组合
|
||||||
|
Set<String> toEndCombinationSet = new HashSet<>(); // 目的地+结束时间组合
|
||||||
|
Set<String> matchedFromStartCombinations = new HashSet<>();
|
||||||
|
Set<String> matchedToEndCombinations = new HashSet<>();
|
||||||
for (DynamicObject tripEntry : tripEntryCollection) {
|
for (DynamicObject tripEntry : tripEntryCollection) {
|
||||||
Date startDate = tripEntry.getDate("startdate");//开始日期
|
Date startDate = tripEntry.getDate("startdate");//开始日期
|
||||||
Date endDate = tripEntry.getDate("enddate");//结束日期
|
Date endDate = tripEntry.getDate("enddate");//结束日期
|
||||||
// 校验开始日期是否重复
|
DynamicObject from = tripEntry.getDynamicObject("from");//出发地
|
||||||
if (startDate != null) {
|
DynamicObject to = tripEntry.getDynamicObject("to");//目的地
|
||||||
if (startDateSet.contains(startDate)) {
|
|
||||||
this.addFatalErrorMessage(extendedDataEntity, "存在相同的行程开始日期,请检查行程信息!");
|
// 构建组合键
|
||||||
|
String fromStartKey = null;
|
||||||
|
String toEndKey = null;
|
||||||
|
|
||||||
|
if (from != null && startDate != null) {
|
||||||
|
Long fromId = from.getLong("id");
|
||||||
|
fromStartKey = fromId + "_" + startDate.getTime();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (to != null && endDate != null) {
|
||||||
|
Long toId = to.getLong("id");
|
||||||
|
toEndKey = toId + "_" + endDate.getTime();
|
||||||
|
}
|
||||||
|
|
||||||
|
// 检查是否存在"出发地+开始时间"与"目的地+结束时间"相同的组合
|
||||||
|
if (fromStartKey != null && toEndKey != null && fromStartKey.equals(toEndKey)) {
|
||||||
|
matchedFromStartCombinations.add(fromStartKey);
|
||||||
|
matchedToEndCombinations.add(toEndKey);
|
||||||
|
}
|
||||||
|
|
||||||
|
// // 分别校验开始日期是否重复
|
||||||
|
// if (startDate != null) {
|
||||||
|
// if (startDateSet.contains(startDate)) {
|
||||||
|
// this.addFatalErrorMessage(extendedDataEntity, "存在相同的行程开始日期,请检查行程信息!");
|
||||||
|
// return;
|
||||||
|
// }
|
||||||
|
// startDateSet.add(startDate);
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// // 分别校验结束日期是否重复
|
||||||
|
// if (endDate != null) {
|
||||||
|
// if (endDateSet.contains(endDate)) {
|
||||||
|
// this.addFatalErrorMessage(extendedDataEntity, "存在相同的行程结束日期,请检查行程信息!");
|
||||||
|
// return;
|
||||||
|
// }
|
||||||
|
// endDateSet.add(endDate);
|
||||||
|
// }
|
||||||
|
|
||||||
|
// 校验出发地+开始时间组合是否重复(排除与目的地+结束时间相同的组合)
|
||||||
|
if (fromStartKey != null) {
|
||||||
|
// 如果这个组合在matchedFromStartCombinations中,则允许重复
|
||||||
|
if (fromStartCombinationSet.contains(fromStartKey)
|
||||||
|
&& !matchedFromStartCombinations.contains(fromStartKey)) {
|
||||||
|
this.addFatalErrorMessage(extendedDataEntity, "存在相同的出发地和开始时间组合,请检查行程信息!");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
startDateSet.add(startDate);
|
fromStartCombinationSet.add(fromStartKey);
|
||||||
}
|
}
|
||||||
// 校验结束日期是否重复
|
|
||||||
if (endDate != null) {
|
// 校验目的地+结束时间组合是否重复(排除与出发地+开始时间相同的组合)
|
||||||
if (endDateSet.contains(endDate)) {
|
if (toEndKey != null) {
|
||||||
this.addFatalErrorMessage(extendedDataEntity, "存在相同的行程结束日期,请检查行程信息!");
|
// 如果这个组合在matchedToEndCombinations中,则允许重复
|
||||||
|
if (toEndCombinationSet.contains(toEndKey)
|
||||||
|
&& !matchedToEndCombinations.contains(toEndKey)) {
|
||||||
|
this.addFatalErrorMessage(extendedDataEntity, "存在相同的目的地和结束时间组合,请检查行程信息!");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
endDateSet.add(endDate);
|
toEndCombinationSet.add(toEndKey);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
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.DynamicObject;
|
||||||
|
import kd.bos.dataentity.entity.DynamicObjectCollection;
|
||||||
|
import kd.bos.dataentity.metadata.dynamicobject.DynamicObjectType;
|
||||||
import kd.bos.dataentity.utils.StringUtils;
|
import kd.bos.dataentity.utils.StringUtils;
|
||||||
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;
|
||||||
|
@ -49,6 +51,7 @@ public class ContractSettleBillPlugin extends ContractSettleCommonEditPlugin{
|
||||||
DynamicObject contract = (DynamicObject)changeData.getNewValue();
|
DynamicObject contract = (DynamicObject)changeData.getNewValue();
|
||||||
this.clearUnitproject();
|
this.clearUnitproject();
|
||||||
this.contractChanged(contract);
|
this.contractChanged(contract);
|
||||||
|
this.clearOrNewProcessAlloc();//清除或者新增工序分摊分录
|
||||||
} else if (StringUtils.equals(name, "period")) {
|
} else if (StringUtils.equals(name, "period")) {
|
||||||
this.periodChanged(changeData);
|
this.periodChanged(changeData);
|
||||||
} else if (!StringUtils.equals(name, "begindate") && !StringUtils.equals(name, "enddate")) {
|
} else if (!StringUtils.equals(name, "begindate") && !StringUtils.equals(name, "enddate")) {
|
||||||
|
@ -168,4 +171,43 @@ public class ContractSettleBillPlugin extends ContractSettleCommonEditPlugin{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void clearOrNewProcessAlloc() {
|
||||||
|
DynamicObjectCollection payItemDetailEntryCollection = this.getModel().getDataEntity(true).getDynamicObjectCollection("payitemdetailentry");//合同支付项明细
|
||||||
|
DynamicObjectCollection itemEntryCollection = this.getModel().getDataEntity(true).getDynamicObjectCollection("itementry");//支付项分录
|
||||||
|
if (itemEntryCollection.size() == 0) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (payItemDetailEntryCollection.size() > 0) {
|
||||||
|
for (DynamicObject payItemDetailEntry : payItemDetailEntryCollection) {
|
||||||
|
|
||||||
|
DynamicObject itemEntry = itemEntryCollection.get(0);
|
||||||
|
DynamicObjectCollection processAllocEntityCollection = itemEntry.getDynamicObjectCollection("zcgj_processallocatentity");//工序分摊
|
||||||
|
DynamicObjectType processAllocEntityType = processAllocEntityCollection.getDynamicObjectType();
|
||||||
|
|
||||||
|
long referBillId = payItemDetailEntry.getLong("referbillid");//关联单据id
|
||||||
|
DynamicObject EcOutContractMeasure = BusinessDataServiceHelper.loadSingle(referBillId, "ec_outcontractmeasure");//支出合同计量
|
||||||
|
if (EcOutContractMeasure != null) {
|
||||||
|
DynamicObjectCollection ListModelEntryCollection = EcOutContractMeasure.getDynamicObjectCollection("listmodelentry");//模板分录
|
||||||
|
for (DynamicObject ListModelEntry : ListModelEntryCollection) {
|
||||||
|
DynamicObjectCollection listEntryCollection = ListModelEntry.getDynamicObjectCollection("listentry");//清单分录
|
||||||
|
for (DynamicObject listEntry : listEntryCollection) {
|
||||||
|
DynamicObject newProcessAllocEntity = new DynamicObject(processAllocEntityType);
|
||||||
|
newProcessAllocEntity.set("zcgj_pa_process", listEntry.get("listcbs"));//工序-成本分解结构
|
||||||
|
newProcessAllocEntity.set("zcgj_pa_amount", listEntry.get("thisoftaxmount"));//价税合计-本期计量含税金额
|
||||||
|
newProcessAllocEntity.set("zcgj_amountnotax", listEntry.get("thisamount"));//不含税金额-本期计量金额
|
||||||
|
newProcessAllocEntity.set("zcgj_rateval", listEntry.get("entrytaxrate"));//税率(%)-税率(%)
|
||||||
|
newProcessAllocEntity.set("zcgj_taxamt", listEntry.get("thistax"));//税额-本期税额
|
||||||
|
newProcessAllocEntity.set("zcgj_pa_remark", listEntry.get("desc"));//费用说明-说明
|
||||||
|
processAllocEntityCollection.add(newProcessAllocEntity);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
this.getView().updateView("zcgj_processallocatentity");//工序分摊
|
||||||
|
} else {
|
||||||
|
itemEntryCollection.clear();
|
||||||
|
this.getView().updateView("itementry");//支付项分录
|
||||||
|
this.getView().updateView("zcgj_processallocatentity");//工序分摊分录
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
|
@ -0,0 +1,91 @@
|
||||||
|
package zcgj.zcdev.zcdev.pr.plugin.form;
|
||||||
|
|
||||||
|
import kd.bos.dataentity.entity.DynamicObject;
|
||||||
|
import kd.bos.dataentity.entity.DynamicObjectCollection;
|
||||||
|
import kd.bos.dataentity.metadata.dynamicobject.DynamicObjectType;
|
||||||
|
import kd.bos.entity.datamodel.RowDataEntity;
|
||||||
|
import kd.bos.entity.datamodel.events.AfterAddRowEventArgs;
|
||||||
|
import kd.bos.entity.datamodel.events.PropertyChangedArgs;
|
||||||
|
import kd.bos.form.control.events.ItemClickEvent;
|
||||||
|
import kd.bos.form.plugin.AbstractFormPlugin;
|
||||||
|
import kd.bos.servicehelper.BusinessDataServiceHelper;
|
||||||
|
|
||||||
|
import java.util.EventObject;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* 使用插件注册位置:支出合同结算表单插件
|
||||||
|
* 说明:新增合同支付项明细后将对应不同分录拆分至工序分摊中
|
||||||
|
*/
|
||||||
|
public class CostAllocatorBillPlugin extends AbstractFormPlugin {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void registerListener(EventObject e) {
|
||||||
|
super.registerListener(e);
|
||||||
|
this.addItemClickListeners("payitemdetaitoolap");//合同支付项明细工具栏
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void itemClick(ItemClickEvent evt) {
|
||||||
|
super.itemClick(evt);
|
||||||
|
String itemKey = evt.getItemKey();
|
||||||
|
if (itemKey.equals("advconbaritemap3")) {
|
||||||
|
//合同支付项明细删除按钮
|
||||||
|
DynamicObjectCollection payItemDetailEntryCollection = this.getModel().getDataEntity(true).getDynamicObjectCollection("payitemdetailentry");//合同支付项明细
|
||||||
|
DynamicObjectCollection itemEntryCollection = this.getModel().getDataEntity(true).getDynamicObjectCollection("itementry");//支付项分录
|
||||||
|
if (itemEntryCollection.size() == 0) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (payItemDetailEntryCollection.size() > 0) {
|
||||||
|
for (DynamicObject payItemDetailEntry : payItemDetailEntryCollection) {
|
||||||
|
|
||||||
|
DynamicObject itemEntry = itemEntryCollection.get(0);
|
||||||
|
DynamicObjectCollection processAllocEntityCollection = itemEntry.getDynamicObjectCollection("zcgj_processallocatentity");//工序分摊
|
||||||
|
processAllocEntityCollection.clear();
|
||||||
|
DynamicObjectType processAllocEntityType = processAllocEntityCollection.getDynamicObjectType();
|
||||||
|
|
||||||
|
long referBillId = payItemDetailEntry.getLong("referbillid");//关联单据id
|
||||||
|
DynamicObject EcOutContractMeasure = BusinessDataServiceHelper.loadSingle(referBillId, "ec_outcontractmeasure");//支出合同计量
|
||||||
|
if (EcOutContractMeasure != null) {
|
||||||
|
DynamicObjectCollection ListModelEntryCollection = EcOutContractMeasure.getDynamicObjectCollection("listmodelentry");//模板分录
|
||||||
|
for (DynamicObject ListModelEntry : ListModelEntryCollection) {
|
||||||
|
DynamicObjectCollection listEntryCollection = ListModelEntry.getDynamicObjectCollection("listentry");//清单分录
|
||||||
|
for (DynamicObject listEntry : listEntryCollection) {
|
||||||
|
DynamicObject newProcessAllocEntity = new DynamicObject(processAllocEntityType);
|
||||||
|
newProcessAllocEntity.set("zcgj_pa_process", listEntry.get("listcbs"));//工序-成本分解结构
|
||||||
|
newProcessAllocEntity.set("zcgj_pa_amount", listEntry.get("thisoftaxmount"));//价税合计-本期计量含税金额
|
||||||
|
newProcessAllocEntity.set("zcgj_amountnotax", listEntry.get("thisamount"));//不含税金额-本期计量金额
|
||||||
|
newProcessAllocEntity.set("zcgj_rateval", listEntry.get("entrytaxrate"));//税率(%)-税率(%)
|
||||||
|
newProcessAllocEntity.set("zcgj_taxamt", listEntry.get("thistax"));//税额-本期税额
|
||||||
|
newProcessAllocEntity.set("zcgj_pa_remark", listEntry.get("desc"));//费用说明-说明
|
||||||
|
processAllocEntityCollection.add(newProcessAllocEntity);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
this.getView().updateView("zcgj_processallocatentity");//工序分摊
|
||||||
|
} else {
|
||||||
|
DynamicObjectCollection processAllocEntityCollection = itemEntryCollection.get(0).getDynamicObjectCollection("zcgj_processallocatentity");//工序分摊分录
|
||||||
|
processAllocEntityCollection.clear();
|
||||||
|
this.getView().updateView("itementry");//支付项分录
|
||||||
|
this.getView().updateView("zcgj_processallocatentity");//工序分摊分录
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void afterAddRow(AfterAddRowEventArgs e) {
|
||||||
|
super.afterAddRow(e);
|
||||||
|
// RowDataEntity[] rowDataEntities = e.getRowDataEntities();
|
||||||
|
// System.out.println();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void propertyChanged(PropertyChangedArgs e) {
|
||||||
|
super.propertyChanged(e);
|
||||||
|
String name = e.getProperty().getName();
|
||||||
|
// if ("totalsettleoftaxamount".equals(name)) {
|
||||||
|
// //关联单据
|
||||||
|
// System.out.println();
|
||||||
|
// }
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue