优化代码 校验合同金额 多分录计量只能计量其一 资源清单过滤优化

This commit is contained in:
xiaoshi 2024-12-19 15:59:57 +08:00
parent 5fe89369d6
commit 1bac3290cd
4 changed files with 76 additions and 50 deletions

View File

@ -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"});
// }
}
}
}

View File

@ -98,7 +98,22 @@ public class ContractMeasurementValidator extends ContractMeasureValidator {
if (!excludeIds.contains(bill.getLong("id"))) {
DynamicObjectCollection modelEntries = bill.getDynamicObjectCollection("listmodelentry");
Iterator var20 = modelEntries.iterator();
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");
@ -120,8 +135,11 @@ public class ContractMeasurementValidator extends ContractMeasureValidator {
}
}
}
}
}
}
}

View File

@ -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");

View File

@ -22,6 +22,10 @@ public class OutContractSettlementValidator extends OutContractSettleValidator {
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;