feat(sales): 使用参考售价替代结存价和采购价
- 在 SoSaleOutPluginInitializerToB 和 SoSaleReturnPluginInitializerToB 类中,修改了 getFloorPrice 方法 - 新增 getRefsaleprice 方法,用于获取参考售价- 计算公式中增加了取参考售价的逻辑 - 移除了取结存价和采购价的相关代码
This commit is contained in:
parent
fa91fcc0a3
commit
040ccda2fd
|
@ -790,7 +790,7 @@ public class SoSaleOutPluginInitializerToB extends PluginBaseEntity {
|
||||||
String totalPayAmount = null;
|
String totalPayAmount = null;
|
||||||
try {
|
try {
|
||||||
//判断目标金额:O实收、结存价、采购价
|
//判断目标金额:O实收、结存价、采购价
|
||||||
totalPayAmount = getFloorPrice(isCheckShopChoose, bdInvmandocEntity, header, detailsDto, calculationFormula);
|
totalPayAmount = getFloorPrice(isCheckShopChoose, bdInvmandocEntity, header, detailsDto, calculationFormula, bdInvbasdocEntity);
|
||||||
|
|
||||||
noriginalcurtaxprice = new BigDecimal(totalPayAmount).divide(new BigDecimal(detailsDto.getShipQty()), 20, BigDecimal.ROUND_HALF_UP).setScale(4, BigDecimal.ROUND_HALF_UP);
|
noriginalcurtaxprice = new BigDecimal(totalPayAmount).divide(new BigDecimal(detailsDto.getShipQty()), 20, BigDecimal.ROUND_HALF_UP).setScale(4, BigDecimal.ROUND_HALF_UP);
|
||||||
noriginalcurprice = noriginalcurtaxprice.divide(new BigDecimal(1).add(new BigDecimal(tax)), 20, BigDecimal.ROUND_HALF_UP).setScale(4, BigDecimal.ROUND_HALF_UP);
|
noriginalcurprice = noriginalcurtaxprice.divide(new BigDecimal(1).add(new BigDecimal(tax)), 20, BigDecimal.ROUND_HALF_UP).setScale(4, BigDecimal.ROUND_HALF_UP);
|
||||||
|
@ -1916,7 +1916,7 @@ public class SoSaleOutPluginInitializerToB extends PluginBaseEntity {
|
||||||
String totalPayAmount = null;
|
String totalPayAmount = null;
|
||||||
try {
|
try {
|
||||||
//综合判断对应的目标金额
|
//综合判断对应的目标金额
|
||||||
totalPayAmount = getFloorPrice(isCheckShopChoose, bdInvmandocEntity, header, detailsDto, calculationFormula);
|
totalPayAmount = getFloorPrice(isCheckShopChoose, bdInvmandocEntity, header, detailsDto, calculationFormula, bdInvbasdocEntity);
|
||||||
noriginalcurtaxprice = new BigDecimal(totalPayAmount).divide(new BigDecimal(detailsDto.getShipQty()), 20, BigDecimal.ROUND_HALF_UP).setScale(4, BigDecimal.ROUND_HALF_UP);
|
noriginalcurtaxprice = new BigDecimal(totalPayAmount).divide(new BigDecimal(detailsDto.getShipQty()), 20, BigDecimal.ROUND_HALF_UP).setScale(4, BigDecimal.ROUND_HALF_UP);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
logger.error("含税单价金额计算失败!", e);
|
logger.error("含税单价金额计算失败!", e);
|
||||||
|
@ -2666,76 +2666,80 @@ public class SoSaleOutPluginInitializerToB extends PluginBaseEntity {
|
||||||
* 获取结存金额或者采购金额
|
* 获取结存金额或者采购金额
|
||||||
*
|
*
|
||||||
* @param isCheckShopChoose true取OFS实付金额、false取结存金额或者采购价
|
* @param isCheckShopChoose true取OFS实付金额、false取结存金额或者采购价
|
||||||
* @param bdInvmandocEntity 存货基本档案
|
* @param bdInvmandocEntity 存货管理档案
|
||||||
* @param header 对应的销售出库单表头
|
* @param header 对应的销售出库单表头
|
||||||
* @param detailsDto 对应的销售出库单明细行对象
|
* @param detailsDto 对应的销售出库单明细行对象
|
||||||
|
* @param bdInvbasdocEntity 存货基本档案
|
||||||
* @author liuyang
|
* @author liuyang
|
||||||
*/
|
*/
|
||||||
private String getFloorPrice(Boolean isCheckShopChoose, BdInvmandocEntity bdInvmandocEntity, HeaderDto header, DetailsDto detailsDto, StringBuffer calculationFormula) throws Exception {
|
private String getFloorPrice(Boolean isCheckShopChoose, BdInvmandocEntity bdInvmandocEntity, HeaderDto header, DetailsDto detailsDto, StringBuffer calculationFormula, BdInvbasdocEntity bdInvbasdocEntity) throws Exception {
|
||||||
Assert.notNull(isCheckShopChoose, "isCheckShopChoose不能为空");
|
Assert.notNull(isCheckShopChoose, "isCheckShopChoose不能为空");
|
||||||
Assert.notNull(bdInvmandocEntity, "bdInvmandocEntity不能为空");
|
Assert.notNull(bdInvmandocEntity, "bdInvmandocEntity不能为空");
|
||||||
Assert.notNull(header, "header不能为空");
|
Assert.notNull(header, "header不能为空");
|
||||||
Assert.notNull(detailsDto, "detailsDto不能为空");
|
Assert.notNull(detailsDto, "detailsDto不能为空");
|
||||||
Assert.notNull(calculationFormula, "calculationFormula不能为空");
|
Assert.notNull(calculationFormula, "calculationFormula不能为空");
|
||||||
|
Assert.notNull(bdInvbasdocEntity, "bdInvbasdocEntity不能为空");
|
||||||
|
|
||||||
//这里只能是金额
|
//这里只能是金额
|
||||||
String totalPayAmount = null;
|
String totalPayAmount = null;
|
||||||
if (isCheckShopChoose) {
|
if (isCheckShopChoose) {
|
||||||
//取结存价
|
// //取结存价
|
||||||
//结存金额=U结存金额/U结存数量*O明细行实出数量
|
// //结存金额=U结存金额/U结存数量*O明细行实出数量
|
||||||
List<BdInvmandocEntity> bdInvmandocEntityArrayList = new ArrayList<>();
|
// List<BdInvmandocEntity> bdInvmandocEntityArrayList = new ArrayList<>();
|
||||||
bdInvmandocEntityArrayList.add(bdInvmandocEntity);
|
// bdInvmandocEntityArrayList.add(bdInvmandocEntity);
|
||||||
List<IaPeriodaccountEntity> iaPeriodaccountEntityList = balanceUnitPriceUtil.queryBalanceUnitPrice(bdInvmandocEntityArrayList);
|
// List<IaPeriodaccountEntity> iaPeriodaccountEntityList = balanceUnitPriceUtil.queryBalanceUnitPrice(bdInvmandocEntityArrayList);
|
||||||
if (iaPeriodaccountEntityList != null && iaPeriodaccountEntityList.size() > 0) {
|
// if (iaPeriodaccountEntityList != null && iaPeriodaccountEntityList.size() > 0) {
|
||||||
logger.info("店铺:{} 取O结存价", header.getStoreCode());
|
// logger.info("店铺:{} 取O结存价", header.getStoreCode());
|
||||||
calculationFormula.append("U结存金额");
|
// calculationFormula.append("U结存金额");
|
||||||
|
//
|
||||||
//结存金额
|
// //结存金额
|
||||||
IaPeriodaccountEntity iaPeriodaccountEntity = iaPeriodaccountEntityList.get(0);
|
// IaPeriodaccountEntity iaPeriodaccountEntity = iaPeriodaccountEntityList.get(0);
|
||||||
String nabmny = iaPeriodaccountEntity.getNabmny();
|
// String nabmny = iaPeriodaccountEntity.getNabmny();
|
||||||
if (nabmny == null || "".equals(nabmny)) {
|
// if (nabmny == null || "".equals(nabmny)) {
|
||||||
nabmny = "0";
|
// nabmny = "0";
|
||||||
}
|
// }
|
||||||
BigDecimal nabmnyBigDecimal = new BigDecimal(nabmny);
|
// BigDecimal nabmnyBigDecimal = new BigDecimal(nabmny);
|
||||||
|
//
|
||||||
//结存数量
|
// //结存数量
|
||||||
String nabnum = iaPeriodaccountEntity.getNabnum();
|
// String nabnum = iaPeriodaccountEntity.getNabnum();
|
||||||
if (nabnum == null || "".equals(nabnum)) {
|
// if (nabnum == null || "".equals(nabnum)) {
|
||||||
nabnum = "0";
|
// nabnum = "0";
|
||||||
}
|
// }
|
||||||
BigDecimal nabnumBigDecimal = new BigDecimal(nabnum);
|
// BigDecimal nabnumBigDecimal = new BigDecimal(nabnum);
|
||||||
|
//
|
||||||
if (!"0".equals(nabmnyBigDecimal.stripTrailingZeros().toPlainString()) && !"0".equals(nabnumBigDecimal.stripTrailingZeros().toPlainString())) {
|
// if (!"0".equals(nabmnyBigDecimal.stripTrailingZeros().toPlainString()) && !"0".equals(nabnumBigDecimal.stripTrailingZeros().toPlainString())) {
|
||||||
BigDecimal bigDecimal = nabmnyBigDecimal.divide(nabnumBigDecimal, 20, BigDecimal.ROUND_HALF_UP);
|
// BigDecimal bigDecimal = nabmnyBigDecimal.divide(nabnumBigDecimal, 20, BigDecimal.ROUND_HALF_UP);
|
||||||
BigDecimal totalPayAmountBigDecimal = bigDecimal.multiply(new BigDecimal(detailsDto.getShipQty())).setScale(2, BigDecimal.ROUND_HALF_UP);
|
// BigDecimal totalPayAmountBigDecimal = bigDecimal.multiply(new BigDecimal(detailsDto.getShipQty())).setScale(2, BigDecimal.ROUND_HALF_UP);
|
||||||
totalPayAmount = totalPayAmountBigDecimal.stripTrailingZeros().toPlainString();
|
// totalPayAmount = totalPayAmountBigDecimal.stripTrailingZeros().toPlainString();
|
||||||
} else {
|
// } else {
|
||||||
//如果结存金额为或者数量为0,则设置为0
|
// //如果结存金额为或者数量为0,则设置为0
|
||||||
totalPayAmount = "0";
|
// totalPayAmount = "0";
|
||||||
}
|
// }
|
||||||
} else {
|
// } else {
|
||||||
//取采购价
|
// //取采购价
|
||||||
List<BdInvmandocEntity> bdInvmandocEntityArrayList1 = new ArrayList<>();
|
// List<BdInvmandocEntity> bdInvmandocEntityArrayList1 = new ArrayList<>();
|
||||||
bdInvmandocEntityArrayList1.add(bdInvmandocEntity);
|
// bdInvmandocEntityArrayList1.add(bdInvmandocEntity);
|
||||||
List<PoOrderBEntity> poOrderBEntityList = balanceUnitPriceUtil.queryPurchaseUnitPriceByInvcodes(bdInvmandocEntityArrayList1);
|
// List<PoOrderBEntity> poOrderBEntityList = balanceUnitPriceUtil.queryPurchaseUnitPriceByInvcodes(bdInvmandocEntityArrayList1);
|
||||||
if (poOrderBEntityList != null && poOrderBEntityList.size() > 0) {
|
// if (poOrderBEntityList != null && poOrderBEntityList.size() > 0) {
|
||||||
logger.info("店铺:{} 取O采购价", header.getStoreCode());
|
// logger.info("店铺:{} 取O采购价", header.getStoreCode());
|
||||||
calculationFormula.append("U采购金额");
|
// calculationFormula.append("U采购金额");
|
||||||
String norgtaxprice = poOrderBEntityList.get(0).getNorgtaxprice();
|
// String norgtaxprice = poOrderBEntityList.get(0).getNorgtaxprice();
|
||||||
// String nordernum = poOrderBEntityList.get(0).getNordernum();
|
//// String nordernum = poOrderBEntityList.get(0).getNordernum();
|
||||||
if (!"0".equals(new BigDecimal(norgtaxprice).stripTrailingZeros().toPlainString())) {
|
// if (!"0".equals(new BigDecimal(norgtaxprice).stripTrailingZeros().toPlainString())) {
|
||||||
// BigDecimal norgtaxpriceBigDecimal = new BigDecimal(norgtaxprice);
|
//// BigDecimal norgtaxpriceBigDecimal = new BigDecimal(norgtaxprice);
|
||||||
// BigDecimal nordernumBigDecimal = new BigDecimal(nordernum);
|
//// BigDecimal nordernumBigDecimal = new BigDecimal(nordernum);
|
||||||
BigDecimal totalPayAmountBigDecimal = new BigDecimal(norgtaxprice).multiply(new BigDecimal(detailsDto.getShipQty())).setScale(2, BigDecimal.ROUND_HALF_UP);
|
// BigDecimal totalPayAmountBigDecimal = new BigDecimal(norgtaxprice).multiply(new BigDecimal(detailsDto.getShipQty())).setScale(2, BigDecimal.ROUND_HALF_UP);
|
||||||
totalPayAmount = totalPayAmountBigDecimal.stripTrailingZeros().toPlainString();
|
// totalPayAmount = totalPayAmountBigDecimal.stripTrailingZeros().toPlainString();
|
||||||
} else {
|
// } else {
|
||||||
//如果采购单价都为0,那么金额也为0
|
// //如果采购单价都为0,那么金额也为0
|
||||||
totalPayAmount = "0";
|
// totalPayAmount = "0";
|
||||||
}
|
// }
|
||||||
} else {
|
// } else {
|
||||||
Assert.state(false, "店铺:{} 存货管理档案主键:{} 既没有结存价、也没有采购价!", header.getStoreCode(), bdInvmandocEntity.getPkInvmandoc());
|
// Assert.state(false, "店铺:{} 存货管理档案主键:{} 既没有结存价、也没有采购价!", header.getStoreCode(), bdInvmandocEntity.getPkInvmandoc());
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
//取U零售价
|
||||||
|
totalPayAmount = getRefsaleprice(bdInvmandocEntity, bdInvbasdocEntity, calculationFormula, detailsDto, header);
|
||||||
} else {
|
} else {
|
||||||
logger.info("店铺:{} 取O实付金额", header.getStoreCode());
|
logger.info("店铺:{} 取O实付金额", header.getStoreCode());
|
||||||
calculationFormula.append("O实退金额");
|
calculationFormula.append("O实退金额");
|
||||||
|
@ -2771,4 +2775,38 @@ public class SoSaleOutPluginInitializerToB extends PluginBaseEntity {
|
||||||
logger.error("splicingPrintingOrderNumber方法抛出异常", e);
|
logger.error("splicingPrintingOrderNumber方法抛出异常", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取参考售价
|
||||||
|
*
|
||||||
|
* @param bdInvmandocEntity 存货管理档案
|
||||||
|
* @param bdInvbasdocEntity 存货基本档案
|
||||||
|
* @param calculationFormulaStr 计算公式
|
||||||
|
* @param detailsDto O销售出库单明细行
|
||||||
|
* @param header O销售出库单表头
|
||||||
|
* @author liuyang
|
||||||
|
*/
|
||||||
|
private String getRefsaleprice(BdInvmandocEntity bdInvmandocEntity, BdInvbasdocEntity bdInvbasdocEntity, StringBuffer calculationFormulaStr, DetailsDto detailsDto, HeaderDto header) throws Exception {
|
||||||
|
Assert.notNull(bdInvmandocEntity, "bdInvmandocEntity不能为空!");
|
||||||
|
Assert.notNull(bdInvbasdocEntity, "bdInvbasdocEntity不能为空!");
|
||||||
|
Assert.notNull(calculationFormulaStr, "calculationFormulaStr不能为空!");
|
||||||
|
Assert.notNull(detailsDto, "sonDetailsDto不能为空!");
|
||||||
|
Assert.notNull(header, "header不能为空");
|
||||||
|
|
||||||
|
//U参考售价
|
||||||
|
String refsaleprice = bdInvmandocEntity.getRefsaleprice();
|
||||||
|
Assert.notNull(refsaleprice, "存货:{} 公司:{} 不存在参考售价,请维护!", bdInvbasdocEntity.getInvname(), bdInvmandocEntity.getPkCorp());
|
||||||
|
Assert.state(!"".equals(refsaleprice.trim()), "存货:{} 公司:{} 不存在参考售价,请维护!", bdInvbasdocEntity.getInvname(), bdInvmandocEntity.getPkCorp());
|
||||||
|
|
||||||
|
//O实发数量
|
||||||
|
String shipQty = detailsDto.getShipQty();
|
||||||
|
Assert.notNull(shipQty, "O实发数量不能为空 O销售出库单编码:{} O明细行主键:{}", header.getCode(), detailsDto.getId());
|
||||||
|
Assert.state(!"".equals(shipQty.trim()), "O实发数量不能为空 O销售出库单编码:{} O明细行主键:{}", header.getCode(), detailsDto.getId());
|
||||||
|
|
||||||
|
BigDecimal amountOfMoney = new BigDecimal(refsaleprice).multiply(new BigDecimal(shipQty));
|
||||||
|
|
||||||
|
String format = StrUtil.format("取U参考售价:{}*{}", refsaleprice, shipQty);
|
||||||
|
calculationFormulaStr.append(format);
|
||||||
|
return amountOfMoney.stripTrailingZeros().toPlainString();
|
||||||
|
}
|
||||||
}
|
}
|
|
@ -789,7 +789,7 @@ public class SoSaleReturnPluginInitializerToB extends PluginBaseEntity {
|
||||||
// Assert.notNull(stockinB.getTotalAmount(), "退货入库单总金额不能为空 明细行对象:{}", JSON.toJSONString(stockinB));
|
// Assert.notNull(stockinB.getTotalAmount(), "退货入库单总金额不能为空 明细行对象:{}", JSON.toJSONString(stockinB));
|
||||||
Assert.notNull(stockinB.getReceivedQty(), "实收数量不能为空 售后订单:{} 售后订单主键:{}", header.getCode(), stockinB.getId());
|
Assert.notNull(stockinB.getReceivedQty(), "实收数量不能为空 售后订单:{} 售后订单主键:{}", header.getCode(), stockinB.getId());
|
||||||
//确定实退金额,可能为O的实退金额,也可能是结存价和采购价
|
//确定实退金额,可能为O的实退金额,也可能是结存价和采购价
|
||||||
totalAmount = getFloorPrice(isCheckShopChoose, bdInvmandocEntity, header, afterSalesOrder, calculationFormula, stockinB);
|
totalAmount = getFloorPrice(isCheckShopChoose, bdInvmandocEntity, header, afterSalesOrder, calculationFormula, stockinB, bdInvbasdocEntity);
|
||||||
|
|
||||||
noriginalcurtaxprice = new BigDecimal(totalAmount).divide(new BigDecimal(stockinB.getReceivedQty()), 20, BigDecimal.ROUND_HALF_UP).setScale(4, BigDecimal.ROUND_HALF_UP);
|
noriginalcurtaxprice = new BigDecimal(totalAmount).divide(new BigDecimal(stockinB.getReceivedQty()), 20, BigDecimal.ROUND_HALF_UP).setScale(4, BigDecimal.ROUND_HALF_UP);
|
||||||
noriginalcurprice = noriginalcurtaxprice.divide(new BigDecimal(1).add(new BigDecimal(tax)), 20, BigDecimal.ROUND_HALF_UP).setScale(4, BigDecimal.ROUND_HALF_UP);
|
noriginalcurprice = noriginalcurtaxprice.divide(new BigDecimal(1).add(new BigDecimal(tax)), 20, BigDecimal.ROUND_HALF_UP).setScale(4, BigDecimal.ROUND_HALF_UP);
|
||||||
|
@ -2529,65 +2529,68 @@ public class SoSaleReturnPluginInitializerToB extends PluginBaseEntity {
|
||||||
* @param afterSalesOrder OFS售后订单明细行
|
* @param afterSalesOrder OFS售后订单明细行
|
||||||
* @param calculationFormula 计算公式
|
* @param calculationFormula 计算公式
|
||||||
* @param stockinB OFS售后入库单明细行
|
* @param stockinB OFS售后入库单明细行
|
||||||
|
* @param bdInvbasdocEntity 存货基本档案
|
||||||
* @author liuyang
|
* @author liuyang
|
||||||
*/
|
*/
|
||||||
private String getFloorPrice(Boolean isCheckShopChoose, BdInvmandocEntity bdInvmandocEntity, StockinOrderSearchResponse.StockinOrder.StockinH header, RerturnGoodsOrderSearchDetails afterSalesOrder, StringBuffer calculationFormula, StockinOrderSearchResponse.StockinOrder.StockinB stockinB) throws Exception {
|
private String getFloorPrice(Boolean isCheckShopChoose, BdInvmandocEntity bdInvmandocEntity, StockinOrderSearchResponse.StockinOrder.StockinH header, RerturnGoodsOrderSearchDetails afterSalesOrder, StringBuffer calculationFormula, StockinOrderSearchResponse.StockinOrder.StockinB stockinB, BdInvbasdocEntity bdInvbasdocEntity) throws Exception {
|
||||||
Assert.notNull(isCheckShopChoose, "isCheckShopChoose不能为空");
|
Assert.notNull(isCheckShopChoose, "isCheckShopChoose不能为空");
|
||||||
Assert.notNull(bdInvmandocEntity, "bdInvmandocEntity不能为空");
|
Assert.notNull(bdInvmandocEntity, "bdInvmandocEntity不能为空");
|
||||||
Assert.notNull(header, "header不能为空");
|
Assert.notNull(header, "header不能为空");
|
||||||
Assert.notNull(afterSalesOrder, "afterSalesOrder不能为空");
|
Assert.notNull(afterSalesOrder, "afterSalesOrder不能为空");
|
||||||
Assert.notNull(calculationFormula, "calculationFormula不能为空");
|
Assert.notNull(calculationFormula, "calculationFormula不能为空");
|
||||||
Assert.notNull(stockinB, "stockinB不能为空");
|
Assert.notNull(stockinB, "stockinB不能为空");
|
||||||
|
Assert.notNull(bdInvbasdocEntity, "bdInvbasdocEntity不能为空");
|
||||||
|
|
||||||
//totalPayAmount只能是金额
|
//totalPayAmount只能是金额
|
||||||
String totalPayAmount = null;
|
String totalPayAmount = null;
|
||||||
if (isCheckShopChoose) {
|
if (isCheckShopChoose) {
|
||||||
//取结存
|
// //取结存
|
||||||
List<BdInvmandocEntity> bdInvmandocEntityArrayList = new ArrayList<>();
|
// List<BdInvmandocEntity> bdInvmandocEntityArrayList = new ArrayList<>();
|
||||||
bdInvmandocEntityArrayList.add(bdInvmandocEntity);
|
// bdInvmandocEntityArrayList.add(bdInvmandocEntity);
|
||||||
List<IaPeriodaccountEntity> iaPeriodaccountEntityList = balanceUnitPriceUtil.queryBalanceUnitPrice(bdInvmandocEntityArrayList);
|
// List<IaPeriodaccountEntity> iaPeriodaccountEntityList = balanceUnitPriceUtil.queryBalanceUnitPrice(bdInvmandocEntityArrayList);
|
||||||
if (iaPeriodaccountEntityList != null && iaPeriodaccountEntityList.size() > 0) {
|
// if (iaPeriodaccountEntityList != null && iaPeriodaccountEntityList.size() > 0) {
|
||||||
calculationFormula.append("U结存金额");
|
// calculationFormula.append("U结存金额");
|
||||||
//结存金额
|
// //结存金额
|
||||||
logger.info("店铺:{} 取O结存价", header.getStoreCode());
|
// logger.info("店铺:{} 取O结存价", header.getStoreCode());
|
||||||
IaPeriodaccountEntity iaPeriodaccountEntity = iaPeriodaccountEntityList.get(0);
|
// IaPeriodaccountEntity iaPeriodaccountEntity = iaPeriodaccountEntityList.get(0);
|
||||||
String nabmny = iaPeriodaccountEntity.getNabmny();
|
// String nabmny = iaPeriodaccountEntity.getNabmny();
|
||||||
if (nabmny == null || "".equals(nabmny)) {
|
// if (nabmny == null || "".equals(nabmny)) {
|
||||||
nabmny = "0";
|
// nabmny = "0";
|
||||||
}
|
// }
|
||||||
BigDecimal nabmnyBigDecimal = new BigDecimal(nabmny);
|
// BigDecimal nabmnyBigDecimal = new BigDecimal(nabmny);
|
||||||
if (!"0".equals(nabmnyBigDecimal.stripTrailingZeros().toPlainString())) {
|
// if (!"0".equals(nabmnyBigDecimal.stripTrailingZeros().toPlainString())) {
|
||||||
totalPayAmount = nabmnyBigDecimal.stripTrailingZeros().toPlainString();
|
// totalPayAmount = nabmnyBigDecimal.stripTrailingZeros().toPlainString();
|
||||||
} else {
|
// } else {
|
||||||
//如果结存金额为0,则设置为0
|
// //如果结存金额为0,则设置为0
|
||||||
totalPayAmount = "0";
|
// totalPayAmount = "0";
|
||||||
}
|
// }
|
||||||
} else {
|
// } else {
|
||||||
//取采购价
|
// //取采购价
|
||||||
List<BdInvmandocEntity> bdInvmandocEntityArrayList1 = new ArrayList<>();
|
// List<BdInvmandocEntity> bdInvmandocEntityArrayList1 = new ArrayList<>();
|
||||||
bdInvmandocEntityArrayList1.add(bdInvmandocEntity);
|
// bdInvmandocEntityArrayList1.add(bdInvmandocEntity);
|
||||||
List<PoOrderBEntity> poOrderBEntityList = balanceUnitPriceUtil.queryPurchaseUnitPriceByInvcodes(bdInvmandocEntityArrayList1);
|
// List<PoOrderBEntity> poOrderBEntityList = balanceUnitPriceUtil.queryPurchaseUnitPriceByInvcodes(bdInvmandocEntityArrayList1);
|
||||||
if (poOrderBEntityList != null && poOrderBEntityList.size() > 0) {
|
// if (poOrderBEntityList != null && poOrderBEntityList.size() > 0) {
|
||||||
calculationFormula.append("U采购金额");
|
// calculationFormula.append("U采购金额");
|
||||||
logger.info("店铺:{} 取O采购价", header.getStoreCode());
|
// logger.info("店铺:{} 取O采购价", header.getStoreCode());
|
||||||
String norgtaxprice = poOrderBEntityList.get(0).getNorgtaxprice();//原币含税单价
|
// String norgtaxprice = poOrderBEntityList.get(0).getNorgtaxprice();//原币含税单价
|
||||||
// String nordernum = poOrderBEntityList.get(0).getNordernum();//订货数量
|
//// String nordernum = poOrderBEntityList.get(0).getNordernum();//订货数量
|
||||||
if ("0".equals(new BigDecimal(norgtaxprice).stripTrailingZeros().toPlainString())) {
|
// if ("0".equals(new BigDecimal(norgtaxprice).stripTrailingZeros().toPlainString())) {
|
||||||
//如果采购单价都为0,那么金额也为0
|
// //如果采购单价都为0,那么金额也为0
|
||||||
totalPayAmount = "0";
|
// totalPayAmount = "0";
|
||||||
} else {
|
// } else {
|
||||||
//采购金额的确定=原币含税单价*O实退数量
|
// //采购金额的确定=原币含税单价*O实退数量
|
||||||
// BigDecimal norgtaxpriceBigDecimal = new BigDecimal(norgtaxprice);
|
//// BigDecimal norgtaxpriceBigDecimal = new BigDecimal(norgtaxprice);
|
||||||
// BigDecimal nordernumBigDecimal = new BigDecimal(nordernum);
|
//// BigDecimal nordernumBigDecimal = new BigDecimal(nordernum);
|
||||||
// BigDecimal multiply = norgtaxpriceBigDecimal.multiply(nordernumBigDecimal).setScale(2, BigDecimal.ROUND_HALF_UP);
|
//// BigDecimal multiply = norgtaxpriceBigDecimal.multiply(nordernumBigDecimal).setScale(2, BigDecimal.ROUND_HALF_UP);
|
||||||
// totalPayAmount = multiply.stripTrailingZeros().toPlainString();
|
//// totalPayAmount = multiply.stripTrailingZeros().toPlainString();
|
||||||
BigDecimal totalPayAmountBigDecimal = new BigDecimal(norgtaxprice).multiply(new BigDecimal(stockinB.getReceivedQty())).setScale(2, BigDecimal.ROUND_HALF_UP);
|
// BigDecimal totalPayAmountBigDecimal = new BigDecimal(norgtaxprice).multiply(new BigDecimal(stockinB.getReceivedQty())).setScale(2, BigDecimal.ROUND_HALF_UP);
|
||||||
totalPayAmount = totalPayAmountBigDecimal.stripTrailingZeros().toPlainString();
|
// totalPayAmount = totalPayAmountBigDecimal.stripTrailingZeros().toPlainString();
|
||||||
}
|
// }
|
||||||
} else {
|
// } else {
|
||||||
Assert.state(false, "店铺:{} 存货管理档案主键:{} 既没有结存价、也没有采购价!", header.getStoreCode(), bdInvmandocEntity.getPkInvmandoc());
|
// Assert.state(false, "店铺:{} 存货管理档案主键:{} 既没有结存价、也没有采购价!", header.getStoreCode(), bdInvmandocEntity.getPkInvmandoc());
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
totalPayAmount = getRefsaleprice(bdInvmandocEntity, bdInvbasdocEntity, calculationFormula, stockinB, header);
|
||||||
} else {
|
} else {
|
||||||
//O用户实退
|
//O用户实退
|
||||||
logger.info("店铺:{} 取O实付金额", header.getStoreCode());
|
logger.info("店铺:{} 取O实付金额", header.getStoreCode());
|
||||||
|
@ -2614,4 +2617,36 @@ public class SoSaleReturnPluginInitializerToB extends PluginBaseEntity {
|
||||||
logger.error("splicingPrintingOrderNumber方法抛出异常", e);
|
logger.error("splicingPrintingOrderNumber方法抛出异常", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取参考售价
|
||||||
|
*
|
||||||
|
* @param bdInvmandocEntity 存货管理档案
|
||||||
|
* @param bdInvbasdocEntity 存货基本档案
|
||||||
|
* @param calculationFormulaStr 计算公式
|
||||||
|
* @param stockinB O售后入库单明细行
|
||||||
|
* @param header O售后入库单表头
|
||||||
|
* @author liuyang
|
||||||
|
*/
|
||||||
|
private String getRefsaleprice(BdInvmandocEntity bdInvmandocEntity, BdInvbasdocEntity bdInvbasdocEntity, StringBuffer calculationFormulaStr, StockinOrderSearchResponse.StockinOrder.StockinB stockinB, StockinOrderSearchResponse.StockinOrder.StockinH header) throws Exception {
|
||||||
|
Assert.notNull(bdInvmandocEntity, "bdInvmandocEntity不能为空!");
|
||||||
|
Assert.notNull(bdInvbasdocEntity, "bdInvbasdocEntity不能为空!");
|
||||||
|
Assert.notNull(calculationFormulaStr, "calculationFormulaStr不能为空!");
|
||||||
|
Assert.notNull(stockinB, "goodsRertunSonDetailsDto不能为空!");
|
||||||
|
Assert.notNull(header, "header不能为空");
|
||||||
|
|
||||||
|
//U参考售价
|
||||||
|
String refsaleprice = bdInvmandocEntity.getRefsaleprice();
|
||||||
|
Assert.notNull(refsaleprice, "存货:{} 公司:{} 不存在参考售价,请维护!", bdInvbasdocEntity.getInvname(), bdInvmandocEntity.getPkCorp());
|
||||||
|
|
||||||
|
//O实收数量
|
||||||
|
String receivedQty = stockinB.getReceivedQty();
|
||||||
|
Assert.notNull(receivedQty, "O实收数量不能为空 O售后入库单编码:{} O明细行主键:{}", header.getCode(), stockinB.getId());
|
||||||
|
Assert.state(!"".equals(receivedQty), "O实收数量不能为空 O售后入库单编码:{} O明细行主键:{}", header.getCode(), stockinB.getId());
|
||||||
|
|
||||||
|
BigDecimal amountOfMoney = new BigDecimal(refsaleprice).multiply(new BigDecimal(receivedQty));
|
||||||
|
String format = StrUtil.format("取U参考售价:{}*{}", refsaleprice, receivedQty);
|
||||||
|
calculationFormulaStr.append(format);
|
||||||
|
return amountOfMoney.stripTrailingZeros().toPlainString();
|
||||||
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue