Merge remote-tracking branch 'origin/dev' into dev
This commit is contained in:
commit
43687bf827
|
@ -0,0 +1,74 @@
|
||||||
|
package zcgj.zcdev.zcdev.pr.plugin.form;
|
||||||
|
|
||||||
|
import kd.bos.dataentity.entity.DynamicObject;
|
||||||
|
import kd.bos.dataentity.utils.StringUtils;
|
||||||
|
import kd.bos.entity.datamodel.events.ChangeData;
|
||||||
|
import kd.bos.form.CloseCallBack;
|
||||||
|
import kd.bos.form.ShowFormHelper;
|
||||||
|
import kd.bos.list.ListShowParameter;
|
||||||
|
import kd.bos.orm.query.QFilter;
|
||||||
|
import kd.ec.contract.formplugin.ContractMeasureBillEditPlugin;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class ContractEeasurementBillPlugin extends ContractMeasureBillEditPlugin {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onThisQtyChanged(ChangeData changeData) {
|
||||||
|
BigDecimal qty = this.defaultZeroBigDecimal((BigDecimal)changeData.getNewValue());
|
||||||
|
int rowIndex = changeData.getRowIndex();
|
||||||
|
int parentRowIndex = changeData.getParentRowIndex();
|
||||||
|
BigDecimal totalqty = (BigDecimal)this.getModel().getValue("totalqty", rowIndex, parentRowIndex);
|
||||||
|
BigDecimal preQty = (BigDecimal)this.getModel().getValue("preqty", rowIndex, parentRowIndex);
|
||||||
|
BigDecimal balanceQty = totalqty.subtract(preQty);
|
||||||
|
if (qty.compareTo(balanceQty) > 0) {
|
||||||
|
// this.getView().showMessage(String.format(ResManager.loadKDString("本期计量数量不能超过%s(总数量-期初累计计量数量)。", "ContractMeasureBillEditPlugin_4", "ec-contract-formplugin", new Object[0]), balanceQty.intValue()));
|
||||||
|
// this.getModel().setValue("thisqty", BigDecimal.ZERO, rowIndex, parentRowIndex);
|
||||||
|
} else {
|
||||||
|
this.getModel().setValue("lstqty", preQty.add(qty), rowIndex, parentRowIndex);
|
||||||
|
BigDecimal taxPrice = (BigDecimal)this.getModel().getValue("curtaxprice", rowIndex, parentRowIndex);
|
||||||
|
BigDecimal amount = taxPrice.multiply(qty);
|
||||||
|
this.getModel().setValue("thisoftaxmount", amount, rowIndex, parentRowIndex);
|
||||||
|
if (this.isInContract()) {
|
||||||
|
this.countPercent(rowIndex, parentRowIndex);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void doNewListEntry() {
|
||||||
|
{
|
||||||
|
boolean inContract = this.isInContract();
|
||||||
|
String formId = inContract ? "ec_intreelisting" : "ec_outtreelisting";
|
||||||
|
ListShowParameter param = ShowFormHelper.createShowListForm(formId, true, 3, true);
|
||||||
|
List<QFilter> qFilters = param.getListFilterParameter().getQFilters();
|
||||||
|
int rowCount = this.getModel().getEntryRowCount("listentry");
|
||||||
|
List<Object> listingIds = new ArrayList();
|
||||||
|
|
||||||
|
int rowIndex;
|
||||||
|
for(rowIndex = 0; rowIndex < rowCount; ++rowIndex) {
|
||||||
|
DynamicObject listing = (DynamicObject)this.getModel().getValue("listing", rowIndex);
|
||||||
|
if (listing != null) {
|
||||||
|
// listingIds.add(listing.getPkValue());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
qFilters.add(new QFilter("id", "not in", listingIds));
|
||||||
|
rowIndex = this.getModel().getEntryCurrentRowIndex("listmodelentry");
|
||||||
|
String listModelId = (String)this.getModel().getValue("listmodelid", rowIndex);
|
||||||
|
qFilters.add(new QFilter("listingmodel", "=", StringUtils.isNotBlank(listModelId) ? Long.parseLong(listModelId) : 0L));
|
||||||
|
DynamicObject contract = (DynamicObject)this.getModel().getValue("contract");
|
||||||
|
if (contract != null) {
|
||||||
|
qFilters.add(new QFilter("contractid", "=", contract.getLong("id")));
|
||||||
|
}
|
||||||
|
|
||||||
|
param.setCustomParam("listmodelid", listModelId);
|
||||||
|
CloseCallBack callBack = new CloseCallBack(this, "newlistentry");
|
||||||
|
param.setCloseCallBack(callBack);
|
||||||
|
this.getView().showForm(param);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -23,7 +23,7 @@ public class ContractPublicBillPlugin extends AbstractBillPlugIn implements Plug
|
||||||
Object zcgj_jtnw = this.getModel().getValue("zcgj_jtnw");
|
Object zcgj_jtnw = this.getModel().getValue("zcgj_jtnw");
|
||||||
if(zcgj_jtnw!=null && zcgj_jtnw!=""){
|
if(zcgj_jtnw!=null && zcgj_jtnw!=""){
|
||||||
List<ComboItem> comboList = new ArrayList<>();
|
List<ComboItem> comboList = new ArrayList<>();
|
||||||
if(zcgj_jtnw.toString().equals("")){
|
if(zcgj_jtnw.toString().equals("jtn")){
|
||||||
comboList.add(new ComboItem(new LocaleString("中材矿山"), "1"));
|
comboList.add(new ComboItem(new LocaleString("中材矿山"), "1"));
|
||||||
comboList.add(new ComboItem(new LocaleString("中材国际"), "2"));
|
comboList.add(new ComboItem(new LocaleString("中材国际"), "2"));
|
||||||
comboList.add(new ComboItem(new LocaleString("中联水泥"), "3"));
|
comboList.add(new ComboItem(new LocaleString("中联水泥"), "3"));
|
||||||
|
|
|
@ -0,0 +1,121 @@
|
||||||
|
package zcgj.zcdev.zcdev.pr.plugin.form;
|
||||||
|
|
||||||
|
import kd.bos.dataentity.entity.DynamicObject;
|
||||||
|
import kd.bos.dataentity.utils.StringUtils;
|
||||||
|
import kd.bos.entity.datamodel.events.ChangeData;
|
||||||
|
import kd.bos.form.CloseCallBack;
|
||||||
|
import kd.bos.form.ShowFormHelper;
|
||||||
|
import kd.bos.list.ListShowParameter;
|
||||||
|
import kd.bos.orm.query.QFilter;
|
||||||
|
import kd.bos.servicehelper.BusinessDataServiceHelper;
|
||||||
|
import kd.ec.contract.formplugin.InContractMeasureBillEditPlugin;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
public class InContractMeasurementBillEditPlugin extends InContractMeasureBillEditPlugin {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onThisQtyChanged(ChangeData changeData) {
|
||||||
|
BigDecimal qty = this.defaultZeroBigDecimal((BigDecimal)changeData.getNewValue());
|
||||||
|
int rowIndex = changeData.getRowIndex();
|
||||||
|
int parentRowIndex = changeData.getParentRowIndex();
|
||||||
|
BigDecimal totalqty = (BigDecimal)this.getModel().getValue("totalqty", rowIndex, parentRowIndex);
|
||||||
|
BigDecimal preQty = (BigDecimal)this.getModel().getValue("preqty", rowIndex, parentRowIndex);
|
||||||
|
BigDecimal balanceQty = totalqty.subtract(preQty);
|
||||||
|
if (qty.compareTo(balanceQty) > 0) {
|
||||||
|
// this.getView().showMessage(String.format(ResManager.loadKDString("本期计量数量不能超过%s(总数量-期初累计计量数量)。", "ContractMeasureBillEditPlugin_4", "ec-contract-formplugin", new Object[0]), balanceQty.intValue()));
|
||||||
|
// this.getModel().setValue("thisqty", BigDecimal.ZERO, rowIndex, parentRowIndex);
|
||||||
|
} else {
|
||||||
|
this.getModel().setValue("lstqty", preQty.add(qty), rowIndex, parentRowIndex);
|
||||||
|
BigDecimal taxPrice = (BigDecimal)this.getModel().getValue("curtaxprice", rowIndex, parentRowIndex);
|
||||||
|
BigDecimal amount = taxPrice.multiply(qty);
|
||||||
|
this.getModel().setValue("thisoftaxmount", amount, rowIndex, parentRowIndex);
|
||||||
|
if (this.isInContract()) {
|
||||||
|
this.countPercent(rowIndex, parentRowIndex);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void doNewListEntry() {
|
||||||
|
{
|
||||||
|
boolean inContract = this.isInContract();
|
||||||
|
String formId = inContract ? "ec_intreelisting" : "ec_outtreelisting";
|
||||||
|
ListShowParameter param = ShowFormHelper.createShowListForm(formId, true, 3, true);
|
||||||
|
List<QFilter> qFilters = param.getListFilterParameter().getQFilters();
|
||||||
|
int rowCount = this.getModel().getEntryRowCount("listentry");
|
||||||
|
List<Object> listingIds = new ArrayList();
|
||||||
|
|
||||||
|
int rowIndex;
|
||||||
|
for(rowIndex = 0; rowIndex < rowCount; ++rowIndex) {
|
||||||
|
DynamicObject listing = (DynamicObject)this.getModel().getValue("listing", rowIndex);
|
||||||
|
if (listing != null) {
|
||||||
|
// listingIds.add(listing.getPkValue());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
qFilters.add(new QFilter("id", "not in", listingIds));
|
||||||
|
rowIndex = this.getModel().getEntryCurrentRowIndex("listmodelentry");
|
||||||
|
String listModelId = (String)this.getModel().getValue("listmodelid", rowIndex);
|
||||||
|
qFilters.add(new QFilter("listingmodel", "=", StringUtils.isNotBlank(listModelId) ? Long.parseLong(listModelId) : 0L));
|
||||||
|
DynamicObject contract = (DynamicObject)this.getModel().getValue("contract");
|
||||||
|
if (contract != null) {
|
||||||
|
qFilters.add(new QFilter("contractid", "=", contract.getLong("id")));
|
||||||
|
}
|
||||||
|
|
||||||
|
DynamicObject project = this.getModel().getDataEntity().getDynamicObject("project");
|
||||||
|
QFilter unitprojectQFilter = null;
|
||||||
|
if (project != null && "unitproject".equals(project.getString("boqmode"))) {
|
||||||
|
DynamicObject unitproject = this.getModel().getDataEntity().getDynamicObject("unitproject");
|
||||||
|
DynamicObject contOnunit = BusinessDataServiceHelper.loadSingle("ec_in_contract", "id,onunit", new QFilter[]{new QFilter("id", "=", contract.getPkValue())});
|
||||||
|
if (contOnunit != null) {
|
||||||
|
Boolean onUnit = contOnunit.getBoolean("onunit");
|
||||||
|
if (unitproject != null) {
|
||||||
|
unitprojectQFilter = new QFilter("listunitproject", "=", unitproject.getPkValue());
|
||||||
|
} else {
|
||||||
|
List unitProjectIds;
|
||||||
|
if (onUnit) {
|
||||||
|
unitProjectIds = this.getUnitprojectIds(project);
|
||||||
|
unitprojectQFilter = new QFilter("listunitproject", "in", unitProjectIds);
|
||||||
|
} else {
|
||||||
|
unitprojectQFilter = new QFilter("listunitproject", "=", 0L);
|
||||||
|
unitProjectIds = this.getUnitprojectIds(project);
|
||||||
|
unitprojectQFilter.or(new QFilter("listunitproject", "in", unitProjectIds));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (unitprojectQFilter != null) {
|
||||||
|
qFilters.add(unitprojectQFilter);
|
||||||
|
}
|
||||||
|
|
||||||
|
param.setCustomParam("listmodelid", listModelId);
|
||||||
|
CloseCallBack callBack = new CloseCallBack(this, "newlistentry");
|
||||||
|
param.setCloseCallBack(callBack);
|
||||||
|
this.getView().showForm(param);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
private List<Long> getUnitprojectIds(DynamicObject project) {
|
||||||
|
List<Long> result = null;
|
||||||
|
DynamicObject orgObj = this.getModel().getDataEntity().getDynamicObject("org");
|
||||||
|
long orgId = orgObj == null ? 0L : orgObj.getLong("id");
|
||||||
|
QFilter qFilter = new QFilter("parent", "=", project.getPkValue());
|
||||||
|
DynamicObject ecProject = BusinessDataServiceHelper.loadSingle(project.getPkValue(), "ec_project");
|
||||||
|
DynamicObject proOrg = ecProject.getDynamicObject("projectorg");
|
||||||
|
if (proOrg != null && orgId != proOrg.getLong("id")) {
|
||||||
|
qFilter.and(new QFilter("responsibleorg", "=", orgId));
|
||||||
|
}
|
||||||
|
|
||||||
|
DynamicObject[] unitprojects = BusinessDataServiceHelper.load("ec_unitproject", "id,parent", new QFilter[]{qFilter});
|
||||||
|
result = (List) Arrays.stream(unitprojects).map((o) -> {
|
||||||
|
return o.getLong("id");
|
||||||
|
}).collect(Collectors.toList());
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,129 @@
|
||||||
|
package zcgj.zcdev.zcdev.pr.plugin.operate;
|
||||||
|
|
||||||
|
import kd.bos.dataentity.entity.DynamicObject;
|
||||||
|
import kd.bos.dataentity.entity.DynamicObjectCollection;
|
||||||
|
import kd.bos.dataentity.resource.ResManager;
|
||||||
|
import kd.bos.entity.ExtendedDataEntity;
|
||||||
|
import kd.bos.orm.query.QFilter;
|
||||||
|
import kd.bos.servicehelper.BusinessDataServiceHelper;
|
||||||
|
import kd.bos.servicehelper.QueryServiceHelper;
|
||||||
|
import kd.ec.basedata.common.enums.BillStatusEnum;
|
||||||
|
import kd.ec.contract.opplugin.validator.ContractMeasureValidator;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.util.*;
|
||||||
|
|
||||||
|
public class ContractMeasurementValidator extends ContractMeasureValidator {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void validateListingQty(Set<Long> excludeIds) {
|
||||||
|
{
|
||||||
|
ExtendedDataEntity[] dataEntities = this.getDataEntities();
|
||||||
|
Set<Long> listingIds = new HashSet(16);
|
||||||
|
Set<Long> measureIds = new HashSet(16);
|
||||||
|
Set<Long> repeatListingIds = new HashSet(16);
|
||||||
|
ExtendedDataEntity[] var6 = dataEntities;
|
||||||
|
int var7 = dataEntities.length;
|
||||||
|
|
||||||
|
DynamicObject changeListing;
|
||||||
|
for(int var8 = 0; var8 < var7; ++var8) {
|
||||||
|
ExtendedDataEntity dataEntity = var6[var8];
|
||||||
|
changeListing = dataEntity.getDataEntity();
|
||||||
|
if (!excludeIds.contains(changeListing.getLong("id"))) {
|
||||||
|
measureIds.add(changeListing.getLong("id"));
|
||||||
|
DynamicObjectCollection modelEntries = changeListing.getDynamicObjectCollection("listmodelentry");
|
||||||
|
Iterator var12 = modelEntries.iterator();
|
||||||
|
|
||||||
|
while(var12.hasNext()) {
|
||||||
|
DynamicObject modelEntry = (DynamicObject)var12.next();
|
||||||
|
DynamicObjectCollection listingEntries = modelEntry.getDynamicObjectCollection("listentry");
|
||||||
|
Iterator var15 = listingEntries.iterator();
|
||||||
|
|
||||||
|
while(var15.hasNext()) {
|
||||||
|
DynamicObject listingEntry = (DynamicObject)var15.next();
|
||||||
|
DynamicObject listing = listingEntry.getDynamicObject("listing");
|
||||||
|
if (listing != null && !listingIds.add(listing.getLong("id"))) {
|
||||||
|
repeatListingIds.add(listing.getLong("id"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
listingIds.removeAll(repeatListingIds);
|
||||||
|
QFilter changeFilter = new QFilter("kapianentry.entryentity.listid", "in", listingIds);
|
||||||
|
changeFilter.and("billstatus", "=", BillStatusEnum.SUBMIT.getValue());
|
||||||
|
DynamicObjectCollection changeListings = QueryServiceHelper.query("ec_inrevision", "kapianentry.entryentity.listid", new QFilter[]{changeFilter});
|
||||||
|
Set<Long> changedListingIds = new HashSet(16);
|
||||||
|
Iterator var30 = changeListings.iterator();
|
||||||
|
|
||||||
|
while(var30.hasNext()) {
|
||||||
|
changeListing = (DynamicObject)var30.next();
|
||||||
|
changedListingIds.add(changeListing.getLong("kapianentry.entryentity.listid"));
|
||||||
|
}
|
||||||
|
|
||||||
|
QFilter listingFilter = new QFilter("id", "in", listingIds);
|
||||||
|
DynamicObject[] listings = BusinessDataServiceHelper.load("ec_intreelisting", "id,totalqty", new QFilter[]{listingFilter});
|
||||||
|
Map<Long, BigDecimal> listingQtyBalance = new HashMap(16);
|
||||||
|
DynamicObject[] var34 = listings;
|
||||||
|
int var36 = listings.length;
|
||||||
|
|
||||||
|
DynamicObject measureListing;
|
||||||
|
for(int var38 = 0; var38 < var36; ++var38) {
|
||||||
|
measureListing = var34[var38];
|
||||||
|
listingQtyBalance.put(measureListing.getLong("id"), measureListing.getBigDecimal("totalqty"));
|
||||||
|
}
|
||||||
|
|
||||||
|
QFilter filter = new QFilter("listmodelentry.listentry.listing", "in", listingIds);
|
||||||
|
filter.and("billstatus", "in", new String[]{BillStatusEnum.SUBMIT.getValue(), BillStatusEnum.AUDIT.getValue()});
|
||||||
|
filter.and("id", "not in", measureIds);
|
||||||
|
DynamicObjectCollection measureListings = QueryServiceHelper.query("ec_incontractmeasure", "listmodelentry.listentry.listing,listmodelentry.listentry.thisqty", new QFilter[]{filter});
|
||||||
|
Iterator var39 = measureListings.iterator();
|
||||||
|
|
||||||
|
while(var39.hasNext()) {
|
||||||
|
measureListing = (DynamicObject)var39.next();
|
||||||
|
long listingId = measureListing.getLong("listmodelentry.listentry.listing");
|
||||||
|
if (listingId != 0L) {
|
||||||
|
BigDecimal qtyBalance = (BigDecimal)listingQtyBalance.getOrDefault(listingId, BigDecimal.ZERO);
|
||||||
|
listingQtyBalance.put(listingId, qtyBalance.subtract(measureListing.getBigDecimal("listmodelentry.listentry.thisqty")));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
ExtendedDataEntity[] var41 = dataEntities;
|
||||||
|
int var42 = dataEntities.length;
|
||||||
|
|
||||||
|
for(int var44 = 0; var44 < var42; ++var44) {
|
||||||
|
ExtendedDataEntity dataEntity = var41[var44];
|
||||||
|
DynamicObject bill = dataEntity.getDataEntity();
|
||||||
|
if (!excludeIds.contains(bill.getLong("id"))) {
|
||||||
|
DynamicObjectCollection modelEntries = bill.getDynamicObjectCollection("listmodelentry");
|
||||||
|
Iterator var20 = modelEntries.iterator();
|
||||||
|
|
||||||
|
while(var20.hasNext()) {
|
||||||
|
DynamicObject modelEntry = (DynamicObject)var20.next();
|
||||||
|
DynamicObjectCollection listingEntries = modelEntry.getDynamicObjectCollection("listentry");
|
||||||
|
Iterator var23 = listingEntries.iterator();
|
||||||
|
|
||||||
|
while(var23.hasNext()) {
|
||||||
|
DynamicObject listingEntry = (DynamicObject)var23.next();
|
||||||
|
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")));
|
||||||
|
} 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 {
|
||||||
|
// BigDecimal thisQty = listingEntry.getBigDecimal("thisqty");
|
||||||
|
// if (thisQty != null && thisQty.compareTo(BigDecimal.ZERO) != 0 && thisQty.compareTo((BigDecimal)listingQtyBalance.getOrDefault(listing.getLong("id"), BigDecimal.ZERO)) > 0) {
|
||||||
|
// this.addErrorMessage(dataEntity, String.format(ResManager.loadKDString("清单【%s】本次计量数量已超剩余可计量数量,请修改。", "ContractMeasureValidator_4", "ec-contract-opplugin", new Object[0]), listing.getString("name")));
|
||||||
|
// }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,22 @@
|
||||||
|
package zcgj.zcdev.zcdev.pr.plugin.operate;
|
||||||
|
|
||||||
|
import kd.bos.entity.plugin.AddValidatorsEventArgs;
|
||||||
|
import kd.bos.entity.validate.AbstractValidator;
|
||||||
|
import kd.ec.contract.opplugin.ContractMeasureOp;
|
||||||
|
import kd.ec.contract.opplugin.validator.ContractMeasureValidator;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class InContractMeasurementOp extends ContractMeasureOp {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onAddValidators(AddValidatorsEventArgs e) {
|
||||||
|
super.onAddValidators(e);
|
||||||
|
List<AbstractValidator> validators = e.getValidators();
|
||||||
|
// 删除标品校验器
|
||||||
|
validators.removeIf(validator -> validator instanceof ContractMeasureValidator);
|
||||||
|
|
||||||
|
// 添加定制二开的校验器(位置放第一位,优先执行)
|
||||||
|
validators.add(0, new ContractMeasurementValidator());
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,21 @@
|
||||||
|
package zcgj.zcdev.zcdev.pr.plugin.operate;
|
||||||
|
import kd.bos.entity.plugin.AddValidatorsEventArgs;
|
||||||
|
import kd.bos.entity.validate.AbstractValidator;
|
||||||
|
import kd.ec.contract.opplugin.InContractSettleOp;
|
||||||
|
import kd.ec.contract.opplugin.validator.ContractMeasureValidator;
|
||||||
|
import kd.ec.contract.opplugin.validator.InContractSettleValidator;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class InContractSettlementOp extends InContractSettleOp {
|
||||||
|
@Override
|
||||||
|
public void onAddValidators(AddValidatorsEventArgs e) {
|
||||||
|
super.onAddValidators(e);
|
||||||
|
List<AbstractValidator> validators = e.getValidators();
|
||||||
|
// 删除标品校验器
|
||||||
|
validators.removeIf(validator -> validator instanceof InContractSettleValidator);
|
||||||
|
|
||||||
|
// 添加定制二开的校验器(位置放第一位,优先执行)
|
||||||
|
validators.add(0, new InContractSettlementValidator());
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,46 @@
|
||||||
|
package zcgj.zcdev.zcdev.pr.plugin.operate;
|
||||||
|
|
||||||
|
import kd.bos.dataentity.entity.DynamicObject;
|
||||||
|
import kd.bos.dataentity.resource.ResManager;
|
||||||
|
import kd.bos.dataentity.utils.StringUtils;
|
||||||
|
import kd.bos.entity.ExtendedDataEntity;
|
||||||
|
import kd.bos.servicehelper.BusinessDataServiceHelper;
|
||||||
|
import kd.ec.contract.opplugin.validator.InContractSettleValidator;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
|
||||||
|
public class InContractSettlementValidator extends InContractSettleValidator {
|
||||||
|
@Override
|
||||||
|
public void validate() {
|
||||||
|
{
|
||||||
|
ExtendedDataEntity[] dataEntities = this.getDataEntities();
|
||||||
|
ExtendedDataEntity[] var2 = dataEntities;
|
||||||
|
int var3 = dataEntities.length;
|
||||||
|
|
||||||
|
for(int var4 = 0; var4 < var3; ++var4) {
|
||||||
|
ExtendedDataEntity dataEntity = var2[var4];
|
||||||
|
BigDecimal settleOfTaxAmount = dataEntity.getDataEntity().getBigDecimal("settleoftaxamount");
|
||||||
|
DynamicObject contractTemp = dataEntity.getDataEntity().getDynamicObject("contract");
|
||||||
|
if (contractTemp == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
DynamicObject contract = BusinessDataServiceHelper.loadSingle(dataEntity.getDataEntity().getDynamicObject("contract").getPkValue(), "ec_in_contract");
|
||||||
|
BigDecimal totalSettleOfTaxAmount = contract.getBigDecimal("totalsettleoftaxamount");
|
||||||
|
BigDecimal totalOfTaxAmount = contract.getBigDecimal("totaloftaxamount");
|
||||||
|
DynamicObject contractType = contract.getDynamicObject("contracttype");
|
||||||
|
DynamicObject contractAttr = contractType == null ? null : contractType.getDynamicObject("contattr");
|
||||||
|
boolean validateAmount = true;
|
||||||
|
if (contractAttr != null) {
|
||||||
|
contractAttr = BusinessDataServiceHelper.loadSingle(contractAttr.getPkValue(), "ec_contattr");
|
||||||
|
validateAmount = !StringUtils.equals("09", contractAttr.getString("basictype"));
|
||||||
|
}
|
||||||
|
|
||||||
|
// if (validateAmount && settleOfTaxAmount.compareTo(totalOfTaxAmount.subtract(totalSettleOfTaxAmount)) > 0) {
|
||||||
|
// this.addErrorMessage(dataEntity, ResManager.loadKDString("本期结算价税合计不能大于合同剩余金额价税合计", "InContractSettleValidator_0", "ec-contract-opplugin", new Object[0]));
|
||||||
|
// }
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,21 @@
|
||||||
|
package zcgj.zcdev.zcdev.pr.plugin.operate;
|
||||||
|
|
||||||
|
import kd.bos.entity.plugin.AddValidatorsEventArgs;
|
||||||
|
import kd.bos.entity.validate.AbstractValidator;
|
||||||
|
import kd.ec.contract.opplugin.OutContractMeasureOp;
|
||||||
|
import kd.ec.contract.opplugin.validator.ContractMeasureValidator;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class OutContractMeasurementOp extends OutContractMeasureOp{
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onAddValidators(AddValidatorsEventArgs e) {
|
||||||
|
super.onAddValidators(e);
|
||||||
|
List<AbstractValidator> validators = e.getValidators();
|
||||||
|
// 删除标品校验器
|
||||||
|
validators.removeIf(validator -> validator instanceof ContractMeasureValidator);
|
||||||
|
|
||||||
|
// 添加定制二开的校验器(位置放第一位,优先执行)
|
||||||
|
validators.add(0, new ContractMeasurementValidator());
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,12 @@
|
||||||
|
package zcgj.zcdev.zcdev.pr.plugin.operate;
|
||||||
|
|
||||||
|
import kd.bos.entity.plugin.AddValidatorsEventArgs;
|
||||||
|
import kd.ec.contract.opplugin.OutContractSettleOp;
|
||||||
|
|
||||||
|
public class OutContractSettlementOp extends OutContractSettleOp {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onAddValidators(AddValidatorsEventArgs e) {
|
||||||
|
super.onAddValidators(e);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,42 @@
|
||||||
|
package zcgj.zcdev.zcdev.pr.plugin.operate;
|
||||||
|
|
||||||
|
import kd.bos.dataentity.entity.DynamicObject;
|
||||||
|
import kd.bos.dataentity.resource.ResManager;
|
||||||
|
import kd.bos.dataentity.utils.StringUtils;
|
||||||
|
import kd.bos.entity.ExtendedDataEntity;
|
||||||
|
import kd.bos.servicehelper.BusinessDataServiceHelper;
|
||||||
|
import kd.ec.contract.opplugin.validator.OutContractSettleValidator;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
|
||||||
|
public class OutContractSettlementValidator extends OutContractSettleValidator {
|
||||||
|
@Override
|
||||||
|
protected boolean validateSettleAmount(ExtendedDataEntity dataEntity) {
|
||||||
|
{
|
||||||
|
BigDecimal settleOfTaxAmount = dataEntity.getDataEntity().getBigDecimal("settleoftaxamount");
|
||||||
|
DynamicObject contractTemp = dataEntity.getDataEntity().getDynamicObject("contract");
|
||||||
|
if (contractTemp == null) {
|
||||||
|
this.addErrorMessage(dataEntity, ResManager.loadKDString("合同不可为空。", "OutContractSettleValidator_5", "ec-contract-opplugin", new Object[0]));
|
||||||
|
return false;
|
||||||
|
} else {
|
||||||
|
DynamicObject contract = BusinessDataServiceHelper.loadSingle(dataEntity.getDataEntity().getDynamicObject("contract").getPkValue(), "ec_out_contract");
|
||||||
|
BigDecimal totalSettleOfTaxAmount = contract.getBigDecimal("totalsettleoftaxamount");
|
||||||
|
BigDecimal totalOfTaxAmount = contract.getBigDecimal("totaloftaxamount");
|
||||||
|
DynamicObject contractType = contract.getDynamicObject("contracttype");
|
||||||
|
DynamicObject contractAttr = contractType == null ? null : contractType.getDynamicObject("contattr");
|
||||||
|
boolean validateAmount = true;
|
||||||
|
if (contractAttr != null) {
|
||||||
|
contractAttr = BusinessDataServiceHelper.loadSingle(contractAttr.getPkValue(), "ec_contattr");
|
||||||
|
validateAmount = !StringUtils.equals("09", contractAttr.getString("basictype"));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (validateAmount && settleOfTaxAmount.compareTo(totalOfTaxAmount.subtract(totalSettleOfTaxAmount)) > 0) {
|
||||||
|
// this.addErrorMessage(dataEntity, ResManager.loadKDString("本期结算价税合计不能大于合同剩余金额价税合计", "OutContractSettleValidator_0", "ec-contract-opplugin", new Object[0]));
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -43,7 +43,7 @@ public final class CosmicLauncher {
|
||||||
*/
|
*/
|
||||||
private static final String DEFAULT_COSMIT_HOME_PATH = System.getProperty("user.home").replaceAll("\\\\", "/") + "/cosmic/home";
|
private static final String DEFAULT_COSMIT_HOME_PATH = System.getProperty("user.home").replaceAll("\\\\", "/") + "/cosmic/home";
|
||||||
|
|
||||||
private static final String PROJECT_HOME = "E:/Code/zhongcaidev";
|
private static final String PROJECT_HOME = "D:/ideazcgj";
|
||||||
|
|
||||||
private static final String LOCAL_IP = "127.0.0.1";
|
private static final String LOCAL_IP = "127.0.0.1";
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue