Commit 508d4c0e by liuyang

2024-07-17 修复收款单录入收款金额,保存提示生成收款单失败,原因:扣款金额不能大于销售开票剩余金额bug

parent ddefd6b2
......@@ -198,7 +198,7 @@ public class ServiceHGCW014 extends ServiceBase {
contractNumber.append(hgcw015.getContractNumber()).append(",");
}
for (Map m : resultRows) {
String c = m.get("settlementNumber").toString();
String c = m.get("billNumber").toString();
BigDecimal remainingAmount = new BigDecimal(m.get("thisAmount").toString());
rowMap.put(c, remainingAmount);
totalContractPriceIncluding = totalContractPriceIncluding.add(remainingAmount);
......@@ -222,7 +222,7 @@ public class ServiceHGCW014 extends ServiceBase {
Map<String, BigDecimal> rowMap = new HashMap<>();
for (Map m : resultRows) {
String c = m.get("settlementNumber").toString();
String c = m.get("billNumber").toString();
BigDecimal remainingAmount = new BigDecimal(m.get("thisAmount").toString());
rowMap.put(c, remainingAmount);
}
......
......@@ -596,13 +596,38 @@ public class HGCWTools {
DaoUtils.update("HGCW010.update", hgcw010);
}
}
public static void cutAmount(String settlementNumber, BigDecimal cutAmount) {
public static void cutAmount(String billNumber, BigDecimal cutAmount) {
AssertUtils.isNull(billNumber, "来源单号不能为空!");
// if (cutAmount.compareTo(new BigDecimal(BigInteger.ZERO)) <= 0) {
// throw new PlatException("扣款金额不能小于等于0!");
// }
List<HGCW010> results = DaoBase.getInstance().query(HGCW010.QUERY,new HashMap<String,Object>(){
{put("billNumber",billNumber);}
});
if (CollectionUtils.isEmpty(results)) {
throw new PlatException("找不到对应的销售开票记录!");
}
DecimalFormat decimalFormat = new DecimalFormat("#.000");
HGCW010 HGCW010 = results.get(0);
BigDecimal remainingAmount = new BigDecimal(decimalFormat.format(HGCW010.getRemainingAmount().subtract(cutAmount)));
if (remainingAmount.compareTo(new BigDecimal(BigInteger.ZERO)) < 0) {
throw new PlatException("扣款金额不能大于销售开票剩余金额!");
}
HGCW010.setRemainingAmount(remainingAmount);
DaoUtils.update("HGCW010.updateDeductionAmount", HGCW010);
}
public static void cutAmount(String settlementNumber, String billNumber, BigDecimal cutAmount) {
AssertUtils.isNull(settlementNumber, "来源单号不能为空!");
// if (cutAmount.compareTo(new BigDecimal(BigInteger.ZERO)) <= 0) {
// throw new PlatException("扣款金额不能小于等于0!");
// }
List<HGCW010> results = DaoBase.getInstance().query(HGCW010.QUERY,new HashMap<String,Object>(){
{put("settlementNumber",settlementNumber);}
{
put("billNumber",settlementNumber);
put("billNumber",billNumber);
}
});
if (CollectionUtils.isEmpty(results)) {
throw new PlatException("找不到对应的销售开票记录!");
......@@ -882,7 +907,7 @@ public class HGCWTools {
rows.forEach(row -> {
HGCW015 hgcw015 = new HGCW015();
hgcw015.fromMap(row);
String contractNumber = row.get("settlementNumber").toString();
String contractNumber = row.get("billNumber").toString();
String remainingAmount = row.get("thisAmount").toString();
hgcw015.setContractNumber(contractNumber);
hgcw015.setTotalContractPriceIncluding(new BigDecimal(remainingAmount));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment