优化代码 校验合同金额 多分录计量只能计量其一 资源清单过滤优化
This commit is contained in:
parent
5fe89369d6
commit
1bac3290cd
|
@ -60,17 +60,17 @@ public class ResourceFilterExtPlugin extends ResourceItemListPlugin {
|
|||
// contractType = "ck";
|
||||
// this.getPageCache().remove("firstOpen");
|
||||
if (contractType != null) {
|
||||
if (contractType.toString().equals("wzcg01")) {//物资采购
|
||||
this.getView().setVisible(true, new String[]{"flexpanelmaterial"});
|
||||
this.getView().setVisible(false, new String[]{"flexpanelsub", "flexpanellabour", "flexpanelcomposite", "flexpanelequipment", "flexpanelturnover","flexpanelother"});
|
||||
} else if (contractType.toString().equals("sbcg")) {//设备采购
|
||||
this.getView().setVisible(true, new String[]{"flexpanelequipment"});
|
||||
this.getView().setVisible(false, new String[]{"flexpanelsub", "flexpanellabour", "flexpanelcomposite", "flexpanelmaterial", "flexpanelturnover","flexpanelother"});
|
||||
}else if (contractType.toString().equals("qtcc") || contractType.toString().equals("lwlcc")|| contractType.toString().equals("ck")||
|
||||
contractType.toString().equals("zyfbcc")|| contractType.toString().equals("jjbc")) {//产出物
|
||||
this.getView().setVisible(true, new String[]{"flexpanelturnover"});
|
||||
this.getView().setVisible(false, new String[]{"flexpanelsub", "flexpanellabour", "flexpanelcomposite", "flexpanelequipment", "flexpanelmaterial","flexpanelother"});
|
||||
}
|
||||
// if (contractType.toString().equals("wzcg01")) {//物资采购
|
||||
// this.getView().setVisible(true, new String[]{"flexpanelmaterial"});
|
||||
// this.getView().setVisible(false, new String[]{"flexpanelsub", "flexpanellabour", "flexpanelcomposite", "flexpanelequipment", "flexpanelturnover","flexpanelother"});
|
||||
// } else if (contractType.toString().equals("sbcg")) {//设备采购
|
||||
// this.getView().setVisible(true, new String[]{"flexpanelequipment"});
|
||||
// this.getView().setVisible(false, new String[]{"flexpanelsub", "flexpanellabour", "flexpanelcomposite", "flexpanelmaterial", "flexpanelturnover","flexpanelother"});
|
||||
// }else if (contractType.toString().equals("qtcc") || contractType.toString().equals("lwlcc")|| contractType.toString().equals("ck")||
|
||||
// contractType.toString().equals("zyfbcc")|| contractType.toString().equals("jjbc")) {//产出物
|
||||
// this.getView().setVisible(true, new String[]{"flexpanelturnover"});
|
||||
// this.getView().setVisible(false, new String[]{"flexpanelsub", "flexpanellabour", "flexpanelcomposite", "flexpanelequipment", "flexpanelmaterial","flexpanelother"});
|
||||
// }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -26,7 +26,7 @@ public class ContractMeasurementValidator extends ContractMeasureValidator {
|
|||
int var7 = dataEntities.length;
|
||||
|
||||
DynamicObject changeListing;
|
||||
for(int var8 = 0; var8 < var7; ++var8) {
|
||||
for (int var8 = 0; var8 < var7; ++var8) {
|
||||
ExtendedDataEntity dataEntity = var6[var8];
|
||||
changeListing = dataEntity.getDataEntity();
|
||||
if (!excludeIds.contains(changeListing.getLong("id"))) {
|
||||
|
@ -34,13 +34,13 @@ public class ContractMeasurementValidator extends ContractMeasureValidator {
|
|||
DynamicObjectCollection modelEntries = changeListing.getDynamicObjectCollection("listmodelentry");
|
||||
Iterator var12 = modelEntries.iterator();
|
||||
|
||||
while(var12.hasNext()) {
|
||||
DynamicObject modelEntry = (DynamicObject)var12.next();
|
||||
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();
|
||||
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"));
|
||||
|
@ -57,8 +57,8 @@ public class ContractMeasurementValidator extends ContractMeasureValidator {
|
|||
Set<Long> changedListingIds = new HashSet(16);
|
||||
Iterator var30 = changeListings.iterator();
|
||||
|
||||
while(var30.hasNext()) {
|
||||
changeListing = (DynamicObject)var30.next();
|
||||
while (var30.hasNext()) {
|
||||
changeListing = (DynamicObject) var30.next();
|
||||
changedListingIds.add(changeListing.getLong("kapianentry.entryentity.listid"));
|
||||
}
|
||||
|
||||
|
@ -69,7 +69,7 @@ public class ContractMeasurementValidator extends ContractMeasureValidator {
|
|||
int var36 = listings.length;
|
||||
|
||||
DynamicObject measureListing;
|
||||
for(int var38 = 0; var38 < var36; ++var38) {
|
||||
for (int var38 = 0; var38 < var36; ++var38) {
|
||||
measureListing = var34[var38];
|
||||
listingQtyBalance.put(measureListing.getLong("id"), measureListing.getBigDecimal("totalqty"));
|
||||
}
|
||||
|
@ -80,11 +80,11 @@ public class ContractMeasurementValidator extends ContractMeasureValidator {
|
|||
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();
|
||||
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);
|
||||
BigDecimal qtyBalance = (BigDecimal) listingQtyBalance.getOrDefault(listingId, BigDecimal.ZERO);
|
||||
listingQtyBalance.put(listingId, qtyBalance.subtract(measureListing.getBigDecimal("listmodelentry.listentry.thisqty")));
|
||||
}
|
||||
}
|
||||
|
@ -92,20 +92,35 @@ public class ContractMeasurementValidator extends ContractMeasureValidator {
|
|||
ExtendedDataEntity[] var41 = dataEntities;
|
||||
int var42 = dataEntities.length;
|
||||
|
||||
for(int var44 = 0; var44 < var42; ++var44) {
|
||||
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();
|
||||
int isTwo = 0;
|
||||
if (modelEntries.size() > 1) {
|
||||
DynamicObject object = modelEntries.get(0);
|
||||
DynamicObjectCollection listingEntries = object.getDynamicObjectCollection("listentry");
|
||||
if (!listingEntries.isEmpty()) {
|
||||
isTwo++;
|
||||
}
|
||||
DynamicObject object1 = modelEntries.get(1);
|
||||
DynamicObjectCollection listingEntries1 = object1.getDynamicObjectCollection("listentry");
|
||||
if (!listingEntries1.isEmpty()) {
|
||||
isTwo++;
|
||||
}
|
||||
if (isTwo > 1) {
|
||||
this.addErrorMessage(dataEntity, "多清单时计量只可计量其中!请清空其中一个分录。");
|
||||
}
|
||||
}
|
||||
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();
|
||||
while (var23.hasNext()) {
|
||||
DynamicObject listingEntry = (DynamicObject) var23.next();
|
||||
DynamicObject listing = listingEntry.getDynamicObject("listing");
|
||||
if (listing != null) {
|
||||
if (repeatListingIds.contains(listing.getLong("id"))) {
|
||||
|
@ -120,8 +135,11 @@ public class ContractMeasurementValidator extends ContractMeasureValidator {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -31,6 +31,10 @@ public class InContractSettlementValidator extends InContractSettleValidator {
|
|||
if (itementry.size() == 0) {
|
||||
this.addErrorMessage(dataEntity, ResManager.loadKDString("支付合同项不能为空", "InContractSettleValidator_0", "ec-contract-opplugin", new Object[0]));
|
||||
}
|
||||
BigDecimal oftaxamount = itementry.get(0).getBigDecimal("oftaxamount");
|
||||
if (oftaxamount.compareTo(new BigDecimal(0)) > 0) {
|
||||
this.addErrorMessage(dataEntity, ResManager.loadKDString("支付合同项分录中的金额不能为空!", "InContractSettleValidator_0", "ec-contract-opplugin", new Object[0]));
|
||||
}
|
||||
DynamicObject contract = BusinessDataServiceHelper.loadSingle(dataEntity.getDataEntity().getDynamicObject("contract").getPkValue(), "ec_in_contract");
|
||||
BigDecimal totalSettleOfTaxAmount = contract.getBigDecimal("totalsettleoftaxamount");
|
||||
BigDecimal totalOfTaxAmount = contract.getBigDecimal("totaloftaxamount");
|
||||
|
|
|
@ -18,32 +18,36 @@ public class OutContractSettlementValidator extends OutContractSettleValidator {
|
|||
BigDecimal settleOfTaxAmount = dataEntity.getDataEntity().getBigDecimal("settleoftaxamount");
|
||||
DynamicObject contractTemp = dataEntity.getDataEntity().getDynamicObject("contract");
|
||||
|
||||
DynamicObjectCollection itementry = dataEntity.getDataEntity().getDynamicObjectCollection("itementry");
|
||||
if(itementry.isEmpty()) {
|
||||
this.addErrorMessage(dataEntity, ResManager.loadKDString("支付合同项不能为空", "InContractSettleValidator_0", "ec-contract-opplugin", new Object[0]));
|
||||
DynamicObjectCollection itementry = dataEntity.getDataEntity().getDynamicObjectCollection("itementry");
|
||||
if (itementry.isEmpty()) {
|
||||
this.addErrorMessage(dataEntity, ResManager.loadKDString("支付合同项不能为空", "InContractSettleValidator_0", "ec-contract-opplugin", new Object[0]));
|
||||
}
|
||||
BigDecimal oftaxamount = itementry.get(0).getBigDecimal("oftaxamount");
|
||||
if (oftaxamount.compareTo(new BigDecimal(0)) > 0) {
|
||||
this.addErrorMessage(dataEntity, ResManager.loadKDString("支付合同项分录中的金额不能为空!", "InContractSettleValidator_0", "ec-contract-opplugin", new Object[0]));
|
||||
}
|
||||
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 (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) {
|
||||
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;
|
||||
}
|
||||
return true;
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue