feat(plugin): 新增 TOC退货计算公式及优惠金额保存功能
- 在 TocofsReturngoodsDetailedEntity 中添加计算应收、计算公式等字段 - 修改批量插入或更新 SQL,支持新字段- 优化销售出库插件初始化器,增加计算公式和优惠金额保存逻辑 - 更新测试用例,验证新功能
This commit is contained in:
parent
643a4df394
commit
942897faa6
|
@ -879,10 +879,10 @@
|
||||||
|
|
||||||
<!-- 批量新增或者修改,TOC退货-库存-->
|
<!-- 批量新增或者修改,TOC退货-库存-->
|
||||||
<insert id="entityInsertOrUpdateBatchByTocRerturnStock" keyProperty="id" useGeneratedKeys="true">
|
<insert id="entityInsertOrUpdateBatchByTocRerturnStock" keyProperty="id" useGeneratedKeys="true">
|
||||||
insert into tocofs_returngoods_detailed(id,newPushDate3,newTransmitInfo3,newState3,newSystemNumber3,newSystemPrimary3)
|
insert into tocofs_returngoods_detailed(id,newPushDate3,newTransmitInfo3,newState3,newSystemNumber3,newSystemPrimary3,def7,def8,def9,def10,def11,def12)
|
||||||
values
|
values
|
||||||
<foreach collection="list" item="entity" separator=",">
|
<foreach collection="list" item="entity" separator=",">
|
||||||
(#{entity.id},#{entity.newpushdate3},#{entity.newtransmitinfo3},#{entity.newstate3},#{entity.newsystemnumber3},#{entity.newsystemprimary3})
|
(#{entity.id},#{entity.newpushdate3},#{entity.newtransmitinfo3},#{entity.newstate3},#{entity.newsystemnumber3},#{entity.newsystemprimary3},#{entity.def7},#{entity.def8},#{entity.def9},#{entity.def10},#{entity.def11},#{entity.def12})
|
||||||
</foreach>
|
</foreach>
|
||||||
on duplicate key update
|
on duplicate key update
|
||||||
id = values(id),
|
id = values(id),
|
||||||
|
@ -890,15 +890,21 @@
|
||||||
newTransmitInfo3 = values(newTransmitInfo3),
|
newTransmitInfo3 = values(newTransmitInfo3),
|
||||||
newState3 = values(newState3),
|
newState3 = values(newState3),
|
||||||
newSystemNumber3 = values(newSystemNumber3),
|
newSystemNumber3 = values(newSystemNumber3),
|
||||||
newSystemPrimary3 = values(newSystemPrimary3)
|
newSystemPrimary3 = values(newSystemPrimary3),
|
||||||
|
def7 = values(def7),
|
||||||
|
def8 = values(def8),
|
||||||
|
def9 = values(def9),
|
||||||
|
def10 = values(def10),
|
||||||
|
def11 = values(def11),
|
||||||
|
def12 = values(def12)
|
||||||
</insert>
|
</insert>
|
||||||
|
|
||||||
<!-- 批量新增或者修改,TOC退货-确认收入-->
|
<!-- 批量新增或者修改,TOC退货-确认收入-->
|
||||||
<insert id="entityInsertOrUpdateBatchByTocRerturnTran" keyProperty="id" useGeneratedKeys="true">
|
<insert id="entityInsertOrUpdateBatchByTocRerturnTran" keyProperty="id" useGeneratedKeys="true">
|
||||||
insert into tocofs_returngoods_detailed(id,newPushDate4,newTransmitInfo4,newState4,newSystemNumber4,newSystemPrimary4)
|
insert into tocofs_returngoods_detailed(id,newPushDate4,newTransmitInfo4,newState4,newSystemNumber4,newSystemPrimary4,def7,def8,def9,def10,def11,def12)
|
||||||
values
|
values
|
||||||
<foreach collection="list" item="entity" separator=",">
|
<foreach collection="list" item="entity" separator=",">
|
||||||
(#{entity.id},#{entity.newpushdate4},#{entity.newtransmitinfo4},#{entity.newstate4},#{entity.newsystemnumber4},#{entity.newsystemprimary4})
|
(#{entity.id},#{entity.newpushdate4},#{entity.newtransmitinfo4},#{entity.newstate4},#{entity.newsystemnumber4},#{entity.newsystemprimary4},#{entity.def7},#{entity.def8},#{entity.def9},#{entity.def10},#{entity.def11},#{entity.def12})
|
||||||
</foreach>
|
</foreach>
|
||||||
on duplicate key update
|
on duplicate key update
|
||||||
id = values(id),
|
id = values(id),
|
||||||
|
@ -906,7 +912,13 @@
|
||||||
newTransmitInfo4 = values(newTransmitInfo4),
|
newTransmitInfo4 = values(newTransmitInfo4),
|
||||||
newState4 = values(newState4),
|
newState4 = values(newState4),
|
||||||
newSystemNumber4 = values(newSystemNumber4),
|
newSystemNumber4 = values(newSystemNumber4),
|
||||||
newSystemPrimary4 = values(newSystemPrimary4)
|
newSystemPrimary4 = values(newSystemPrimary4),
|
||||||
|
def7 = values(def7),
|
||||||
|
def8 = values(def8),
|
||||||
|
def9 = values(def9),
|
||||||
|
def10 = values(def10),
|
||||||
|
def11 = values(def11),
|
||||||
|
def12 = values(def12)
|
||||||
</insert>
|
</insert>
|
||||||
|
|
||||||
<!-- 批量新增或者修改,TOB退货-库存-->
|
<!-- 批量新增或者修改,TOB退货-库存-->
|
||||||
|
|
|
@ -3165,7 +3165,7 @@ public class SoSaleOutPluginInitializerToC extends PluginBaseEntity {
|
||||||
if (poOrderBEntity != null) {
|
if (poOrderBEntity != null) {
|
||||||
String norgtaxprice = poOrderBEntity.getNorgtaxprice();
|
String norgtaxprice = poOrderBEntity.getNorgtaxprice();
|
||||||
Assert.notNull(norgtaxprice, "U8C采购订单明细行存在「原币含税单价」为空");
|
Assert.notNull(norgtaxprice, "U8C采购订单明细行存在「原币含税单价」为空");
|
||||||
if (!"0".equals(new BigDecimal(norgtaxprice).stripTrailingZeros().toPlainString())) {
|
if (norgtaxprice != null && !"0".equals(new BigDecimal(norgtaxprice).stripTrailingZeros().toPlainString())) {
|
||||||
String format = StrUtil.format("{}*{}", norgtaxprice, sonDetailsDto.getShipQty());
|
String format = StrUtil.format("{}*{}", norgtaxprice, sonDetailsDto.getShipQty());
|
||||||
calculationFormulaStr.append(format);
|
calculationFormulaStr.append(format);
|
||||||
BigDecimal totalPayAmountBigDecimal = new BigDecimal(norgtaxprice).multiply(new BigDecimal(sonDetailsDto.getShipQty())).setScale(2, BigDecimal.ROUND_HALF_UP);
|
BigDecimal totalPayAmountBigDecimal = new BigDecimal(norgtaxprice).multiply(new BigDecimal(sonDetailsDto.getShipQty())).setScale(2, BigDecimal.ROUND_HALF_UP);
|
||||||
|
|
|
@ -133,10 +133,9 @@ public class SoSaleReturnPluginInitializerToC extends PluginBaseEntity {
|
||||||
if (ProfilesActiveConstant.LETS_PROFILES_ACTIVE.equals(PROD_FILED)) {
|
if (ProfilesActiveConstant.LETS_PROFILES_ACTIVE.equals(PROD_FILED)) {
|
||||||
//默认被定时器执行,每天晚上凌晨0点5分
|
//默认被定时器执行,每天晚上凌晨0点5分
|
||||||
//暂定先同步TOC销售库存、再推送TOC销售确认收入
|
//暂定先同步TOC销售库存、再推送TOC销售确认收入
|
||||||
//TODO 暂时注释掉
|
List<StartAndEndVo> startAndEndVos = calculateCalculateEntireDayPeriod(null);
|
||||||
// List<StartAndEndVo> startAndEndVos = calculateCalculateEntireDayPeriod(null);
|
startImplementStockByTime(startAndEndVos.get(0).getStart_time(), startAndEndVos.get(0).getEnd_time());
|
||||||
// startImplementStockByTime(startAndEndVos.get(0).getStart_time(), startAndEndVos.get(0).getEnd_time());
|
startImplementByTradeTime(startAndEndVos.get(0).getStart_time(), startAndEndVos.get(0).getEnd_time());
|
||||||
// startImplementByTradeTime(startAndEndVos.get(0).getStart_time(), startAndEndVos.get(0).getEnd_time());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
@ -1500,30 +1499,43 @@ public class SoSaleReturnPluginInitializerToC extends PluginBaseEntity {
|
||||||
BigDecimal groupShipQty = new BigDecimal("0");
|
BigDecimal groupShipQty = new BigDecimal("0");
|
||||||
|
|
||||||
for (int i = 0; i < sonDetailsDtoList.size(); i++) {
|
for (int i = 0; i < sonDetailsDtoList.size(); i++) {
|
||||||
GoodsRertunSonDetailsDto goodsRertunSonDetailsDto = sonDetailsDtoList.get(i);
|
GoodsRertunSonDetailsDto goodsRertunSonDetailsDto = sonDetailsDtoList.get(i);//O售后入库单明细行
|
||||||
StockinOrderSearchResponse.StockinOrder.StockinH header = goodsRertunSonDetailsDto.getHeader();//O售后入库单表头
|
StockinOrderSearchResponse.StockinOrder.StockinH header = goodsRertunSonDetailsDto.getHeader();//O售后入库单表头
|
||||||
|
|
||||||
RerturnGoodsOrderSearchData rerturnGoodsOrderSearchData = header.getRerturnGoodsOrderSearchData();//OFS售后订单
|
RerturnGoodsOrderSearchData rerturnGoodsOrderSearchData = header.getRerturnGoodsOrderSearchData();//OFS售后订单
|
||||||
|
RerturnGoodsOrderSearchHeader header1 = rerturnGoodsOrderSearchData.getHeader();//OFS售后订单表头对象
|
||||||
|
List<RerturnGoodsOrderSearchDetails> details = rerturnGoodsOrderSearchData.getDetails();//OFS售后订单表体对象
|
||||||
|
|
||||||
//存货管理档案
|
//存货管理档案
|
||||||
BdInvmandocEntity bdInvmandocEntity = goodsRertunSonDetailsDto.getBdInvmandocEntity();
|
BdInvmandocEntity bdInvmandocEntity = goodsRertunSonDetailsDto.getBdInvmandocEntity();
|
||||||
|
//根据OFS售后入库单明细行,查找匹配OFS售后订单明细行
|
||||||
|
RerturnGoodsOrderSearchDetails ofsOrderDetail = findOfsOrderDetail(details, goodsRertunSonDetailsDto);
|
||||||
|
|
||||||
//取对应的售后订单明细,主要是取这个价格
|
//取对应的售后订单明细,主要是取这个价格
|
||||||
String totalAmount = getFloorPrice(isCheckShopChoose, bdInvmandocEntity, header, goodsRertunSonDetailsDto, mapList);
|
StringBuffer calculationFormulaStr = new StringBuffer();
|
||||||
|
String totalAmount = getFloorPrice(isCheckShopChoose, bdInvmandocEntity, header, goodsRertunSonDetailsDto, mapList, calculationFormulaStr);
|
||||||
if (totalAmount == null) {
|
if (totalAmount == null) {
|
||||||
|
calculationFormulaStr.append("取O实退金额:");
|
||||||
//取O实退金额
|
//取O实退金额
|
||||||
// RerturnGoodsOrderSearchDetails afterSalesOrder = findAfterSalesOrderV2(goodsRertunSonDetailsDto, rerturnGoodsOrderSearchData);
|
// RerturnGoodsOrderSearchDetails afterSalesOrder = findAfterSalesOrderV2(goodsRertunSonDetailsDto, rerturnGoodsOrderSearchData);
|
||||||
// totalAmount = afterSalesOrder.getTotalAmount();
|
// totalAmount = afterSalesOrder.getTotalAmount();
|
||||||
totalAmount = accumulatedDiscounts(goodsRertunSonDetailsDto, rerturnGoodsOrderSearchData);
|
totalAmount = accumulatedDiscounts(goodsRertunSonDetailsDto, rerturnGoodsOrderSearchData, calculationFormulaStr);
|
||||||
}
|
}
|
||||||
|
|
||||||
//实付金额/实发数量
|
|
||||||
Assert.notNull(totalAmount, "实退金额不能为空 明细行主键:{}", goodsRertunSonDetailsDto.getId());
|
Assert.notNull(totalAmount, "实退金额不能为空 明细行主键:{}", goodsRertunSonDetailsDto.getId());
|
||||||
Assert.notNull(goodsRertunSonDetailsDto.getReceivedQty(), "实收数量不能为空 明细行主键:{}", goodsRertunSonDetailsDto.getId());
|
Assert.notNull(goodsRertunSonDetailsDto.getReceivedQty(), "实收数量不能为空 明细行主键:{}", goodsRertunSonDetailsDto.getId());
|
||||||
|
|
||||||
BigDecimal totalPayAmountBigDecimal = new BigDecimal(totalAmount);
|
BigDecimal totalPayAmountBigDecimal = new BigDecimal(totalAmount);
|
||||||
BigDecimal shipQtyBigDecimal = new BigDecimal(goodsRertunSonDetailsDto.getReceivedQty());
|
BigDecimal shipQtyBigDecimal = new BigDecimal(goodsRertunSonDetailsDto.getReceivedQty());
|
||||||
|
|
||||||
groupTotalPayAmount = groupTotalPayAmount.add(totalPayAmountBigDecimal);
|
groupTotalPayAmount = groupTotalPayAmount.add(totalPayAmountBigDecimal);
|
||||||
groupShipQty = groupShipQty.add(shipQtyBigDecimal);
|
groupShipQty = groupShipQty.add(shipQtyBigDecimal);
|
||||||
|
|
||||||
|
goodsRertunSonDetailsDto.setCalculateAccountsReceivable(totalAmount);
|
||||||
|
goodsRertunSonDetailsDto.setCalculationFormula(calculationFormulaStr.toString());
|
||||||
|
goodsRertunSonDetailsDto.setPlatformDiscounts(ofsOrderDetail.getPlatformDiscounts());
|
||||||
|
goodsRertunSonDetailsDto.setMerchantDiscounts(ofsOrderDetail.getMerchantDiscounts());
|
||||||
|
goodsRertunSonDetailsDto.setExpertDiscounts(ofsOrderDetail.getExpertDiscounts());
|
||||||
|
goodsRertunSonDetailsDto.setPayDiscounts(ofsOrderDetail.getPayDiscounts());
|
||||||
}
|
}
|
||||||
GoodsRertunSonDetailsDto goodsRertunSonDetailsDto = sonDetailsDtoList.get(0);
|
GoodsRertunSonDetailsDto goodsRertunSonDetailsDto = sonDetailsDtoList.get(0);
|
||||||
goodsRertunSonDetailsDto.setGroupShipQty(groupShipQty);
|
goodsRertunSonDetailsDto.setGroupShipQty(groupShipQty);
|
||||||
|
@ -2064,6 +2076,12 @@ public class SoSaleReturnPluginInitializerToC extends PluginBaseEntity {
|
||||||
tocofsReturngoodsDetailedEntity.setNewpushdate3(getNewDateStr());
|
tocofsReturngoodsDetailedEntity.setNewpushdate3(getNewDateStr());
|
||||||
tocofsReturngoodsDetailedEntity.setNewtransmitinfo3(finalNewTransmitInfo);
|
tocofsReturngoodsDetailedEntity.setNewtransmitinfo3(finalNewTransmitInfo);
|
||||||
tocofsReturngoodsDetailedEntity.setNewstate3(newstate);
|
tocofsReturngoodsDetailedEntity.setNewstate3(newstate);
|
||||||
|
tocofsReturngoodsDetailedEntity.setDef7(goodsRertunSonDetailsDto.getCalculateAccountsReceivable());
|
||||||
|
tocofsReturngoodsDetailedEntity.setDef8(goodsRertunSonDetailsDto.getCalculationFormula());
|
||||||
|
tocofsReturngoodsDetailedEntity.setDef9(goodsRertunSonDetailsDto.getPlatformDiscounts());
|
||||||
|
tocofsReturngoodsDetailedEntity.setDef10(goodsRertunSonDetailsDto.getPayDiscounts());
|
||||||
|
tocofsReturngoodsDetailedEntity.setDef11(goodsRertunSonDetailsDto.getExpertDiscounts());
|
||||||
|
tocofsReturngoodsDetailedEntity.setDef12(goodsRertunSonDetailsDto.getMerchantDiscounts());
|
||||||
if (successY.equals(newstate)) {
|
if (successY.equals(newstate)) {
|
||||||
tocofsReturngoodsDetailedEntity.setNewsystemnumber3(newsystemnumber);
|
tocofsReturngoodsDetailedEntity.setNewsystemnumber3(newsystemnumber);
|
||||||
tocofsReturngoodsDetailedEntity.setNewsystemprimary3(newsystemprimary);
|
tocofsReturngoodsDetailedEntity.setNewsystemprimary3(newsystemprimary);
|
||||||
|
@ -2119,6 +2137,12 @@ public class SoSaleReturnPluginInitializerToC extends PluginBaseEntity {
|
||||||
tocofsReturngoodsDetailedEntity.setNewpushdate4(getNewDateStr());
|
tocofsReturngoodsDetailedEntity.setNewpushdate4(getNewDateStr());
|
||||||
tocofsReturngoodsDetailedEntity.setNewtransmitinfo4(finalNewTransmitInfo);
|
tocofsReturngoodsDetailedEntity.setNewtransmitinfo4(finalNewTransmitInfo);
|
||||||
tocofsReturngoodsDetailedEntity.setNewstate4(newstate);
|
tocofsReturngoodsDetailedEntity.setNewstate4(newstate);
|
||||||
|
tocofsReturngoodsDetailedEntity.setDef7(goodsRertunSonDetailsDto.getCalculateAccountsReceivable());
|
||||||
|
tocofsReturngoodsDetailedEntity.setDef8(goodsRertunSonDetailsDto.getCalculationFormula());
|
||||||
|
tocofsReturngoodsDetailedEntity.setDef9(goodsRertunSonDetailsDto.getPlatformDiscounts());
|
||||||
|
tocofsReturngoodsDetailedEntity.setDef10(goodsRertunSonDetailsDto.getPayDiscounts());
|
||||||
|
tocofsReturngoodsDetailedEntity.setDef11(goodsRertunSonDetailsDto.getExpertDiscounts());
|
||||||
|
tocofsReturngoodsDetailedEntity.setDef12(goodsRertunSonDetailsDto.getMerchantDiscounts());
|
||||||
if (successY.equals(newstate)) {
|
if (successY.equals(newstate)) {
|
||||||
tocofsReturngoodsDetailedEntity.setNewsystemnumber4(newsystemnumber);
|
tocofsReturngoodsDetailedEntity.setNewsystemnumber4(newsystemnumber);
|
||||||
tocofsReturngoodsDetailedEntity.setNewsystemprimary4(newsystemprimary);
|
tocofsReturngoodsDetailedEntity.setNewsystemprimary4(newsystemprimary);
|
||||||
|
@ -2128,7 +2152,7 @@ public class SoSaleReturnPluginInitializerToC extends PluginBaseEntity {
|
||||||
|
|
||||||
//以50行为一个批次,推送到Mysql
|
//以50行为一个批次,推送到Mysql
|
||||||
if (tocofsReturngoodsDetailedEntityArrayList.size() > 0) {
|
if (tocofsReturngoodsDetailedEntityArrayList.size() > 0) {
|
||||||
List<List<TocofsReturngoodsDetailedEntity>> splitListByCount = SplitListByCountUtil.splitListByCount(tocofsReturngoodsDetailedEntityArrayList, 50);
|
List<List<TocofsReturngoodsDetailedEntity>> splitListByCount = SplitListByCountUtil.splitListByCount(tocofsReturngoodsDetailedEntityArrayList, 200);
|
||||||
for (int i = 0; i < splitListByCount.size(); i++) {
|
for (int i = 0; i < splitListByCount.size(); i++) {
|
||||||
List<TocofsReturngoodsDetailedEntity> tocofsReturngoodsDetailedEntities = splitListByCount.get(i);
|
List<TocofsReturngoodsDetailedEntity> tocofsReturngoodsDetailedEntities = splitListByCount.get(i);
|
||||||
iTocofsReturngoodsDetailedDao.entityInsertOrUpdateBatchByTocRerturnTran(tocofsReturngoodsDetailedEntities);
|
iTocofsReturngoodsDetailedDao.entityInsertOrUpdateBatchByTocRerturnTran(tocofsReturngoodsDetailedEntities);
|
||||||
|
@ -2519,13 +2543,15 @@ public class SoSaleReturnPluginInitializerToC extends PluginBaseEntity {
|
||||||
* @param mapList 索引为0结存价为1采购价
|
* @param mapList 索引为0结存价为1采购价
|
||||||
* @author liuyang
|
* @author liuyang
|
||||||
*/
|
*/
|
||||||
private String getFloorPrice(Boolean isCheckShopChoose, BdInvmandocEntity bdInvmandocEntity, StockinOrderSearchResponse.StockinOrder.StockinH header, GoodsRertunSonDetailsDto sonDetailsDto, List<Map> mapList) throws Exception {
|
private String getFloorPrice(Boolean isCheckShopChoose, BdInvmandocEntity bdInvmandocEntity, StockinOrderSearchResponse.StockinOrder.StockinH header, GoodsRertunSonDetailsDto sonDetailsDto, List<Map> mapList, StringBuffer calculationFormulaStr) 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(sonDetailsDto, "detailsDto不能为空");
|
Assert.notNull(sonDetailsDto, "detailsDto不能为空");
|
||||||
Assert.notNull(mapList, "mapList不能为空");
|
Assert.notNull(mapList, "mapList不能为空");
|
||||||
|
Assert.notNull(calculationFormulaStr, "calculationFormulaStr不能为空");
|
||||||
|
|
||||||
|
//此处只能为金额
|
||||||
String totalPayAmount = null;
|
String totalPayAmount = null;
|
||||||
if (isCheckShopChoose) {
|
if (isCheckShopChoose) {
|
||||||
IaPeriodaccountEntity iaPeriodaccountEntity1 = null;
|
IaPeriodaccountEntity iaPeriodaccountEntity1 = null;
|
||||||
|
@ -2536,6 +2562,7 @@ public class SoSaleReturnPluginInitializerToC extends PluginBaseEntity {
|
||||||
if (iaPeriodaccountEntity1 != null) {
|
if (iaPeriodaccountEntity1 != null) {
|
||||||
//取结存价
|
//取结存价
|
||||||
logger.info("店铺:{} 取O结存价", header.getStoreCode());
|
logger.info("店铺:{} 取O结存价", header.getStoreCode());
|
||||||
|
calculationFormulaStr.append("取结存价:");
|
||||||
|
|
||||||
//结存金额
|
//结存金额
|
||||||
String nabmny = iaPeriodaccountEntity1.getNabmny();
|
String nabmny = iaPeriodaccountEntity1.getNabmny();
|
||||||
|
@ -2552,16 +2579,20 @@ public class SoSaleReturnPluginInitializerToC extends PluginBaseEntity {
|
||||||
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())) {
|
||||||
//得到结存单价
|
String format = StrUtil.format("{}/{}*{}", nabmnyBigDecimal.stripTrailingZeros().toPlainString(), nabnumBigDecimal.stripTrailingZeros().toPlainString(), sonDetailsDto.getReceivedQty());
|
||||||
BigDecimal bigDecimal = nabmnyBigDecimal.divide(nabnumBigDecimal, 20, BigDecimal.ROUND_HALF_UP).setScale(4, BigDecimal.ROUND_HALF_UP);
|
calculationFormulaStr.append(format);
|
||||||
totalPayAmount = bigDecimal.stripTrailingZeros().toPlainString();
|
BigDecimal bigDecimal = nabmnyBigDecimal.divide(nabnumBigDecimal, 20, BigDecimal.ROUND_HALF_UP);
|
||||||
|
BigDecimal totalPayAmountBigDecimal = bigDecimal.multiply(new BigDecimal(sonDetailsDto.getReceivedQty())).setScale(2, BigDecimal.ROUND_HALF_UP);
|
||||||
|
totalPayAmount = totalPayAmountBigDecimal.stripTrailingZeros().toPlainString();
|
||||||
} else {
|
} else {
|
||||||
//如果结存金额为或者数量为0,则设置为0
|
//如果结存金额为或者数量为0,则设置为0
|
||||||
|
calculationFormulaStr.append("0");
|
||||||
totalPayAmount = "0";
|
totalPayAmount = "0";
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
//取采购价
|
//取采购价
|
||||||
logger.info("店铺:{} 取O采购价", header.getStoreCode());
|
logger.info("店铺:{} 取O采购价", header.getStoreCode());
|
||||||
|
calculationFormulaStr.append("取采购价:");
|
||||||
PoOrderBEntity poOrderBEntity = null;
|
PoOrderBEntity poOrderBEntity = null;
|
||||||
if (mapList != null && mapList.size() > 0) {
|
if (mapList != null && mapList.size() > 0) {
|
||||||
Map<String, PoOrderBEntity> poOrderBEntityList = (Map<String, PoOrderBEntity>) mapList.get(1);
|
Map<String, PoOrderBEntity> poOrderBEntityList = (Map<String, PoOrderBEntity>) mapList.get(1);
|
||||||
|
@ -2571,11 +2602,16 @@ public class SoSaleReturnPluginInitializerToC extends PluginBaseEntity {
|
||||||
}
|
}
|
||||||
if (poOrderBEntity != null) {
|
if (poOrderBEntity != null) {
|
||||||
String norgtaxprice = poOrderBEntity.getNorgtaxprice();
|
String norgtaxprice = poOrderBEntity.getNorgtaxprice();
|
||||||
if ("0".equals(new BigDecimal(norgtaxprice).stripTrailingZeros().toPlainString())) {
|
Assert.notNull(norgtaxprice, "U8C采购订单明细行存在「原币含税单价」为空");
|
||||||
|
if (norgtaxprice != null && !"0".equals(new BigDecimal(norgtaxprice).stripTrailingZeros().toPlainString())) {
|
||||||
|
String format = StrUtil.format("{}*{}", norgtaxprice, sonDetailsDto.getReceivedQty());
|
||||||
|
calculationFormulaStr.append(format);
|
||||||
|
BigDecimal totalPayAmountBigDecimal = new BigDecimal(norgtaxprice).multiply(new BigDecimal(sonDetailsDto.getReceivedQty())).setScale(2, BigDecimal.ROUND_HALF_UP);
|
||||||
|
totalPayAmount = totalPayAmountBigDecimal.stripTrailingZeros().toPlainString();
|
||||||
|
} else {
|
||||||
//如果采购单价都为0,那么金额也为0
|
//如果采购单价都为0,那么金额也为0
|
||||||
totalPayAmount = "0";
|
totalPayAmount = "0";
|
||||||
} else {
|
calculationFormulaStr.append("0");
|
||||||
totalPayAmount = norgtaxprice;
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
Assert.state(false, "店铺:{} 存货管理档案主键:{} 既没有结存价、也没有采购价!", header.getStoreCode(), bdInvmandocEntity.getPkInvmandoc());
|
Assert.state(false, "店铺:{} 存货管理档案主键:{} 既没有结存价、也没有采购价!", header.getStoreCode(), bdInvmandocEntity.getPkInvmandoc());
|
||||||
|
@ -2590,11 +2626,13 @@ public class SoSaleReturnPluginInitializerToC extends PluginBaseEntity {
|
||||||
*
|
*
|
||||||
* @param goodsRertunSonDetailsDto OFS售后入库单明细行
|
* @param goodsRertunSonDetailsDto OFS售后入库单明细行
|
||||||
* @param rerturnGoodsOrderSearchData OFS售后订单
|
* @param rerturnGoodsOrderSearchData OFS售后订单
|
||||||
|
* @param calculationFormulaStr 计算公式
|
||||||
* @author liuyang
|
* @author liuyang
|
||||||
*/
|
*/
|
||||||
private String accumulatedDiscounts(GoodsRertunSonDetailsDto goodsRertunSonDetailsDto, RerturnGoodsOrderSearchData rerturnGoodsOrderSearchData) throws Exception {
|
private String accumulatedDiscounts(GoodsRertunSonDetailsDto goodsRertunSonDetailsDto, RerturnGoodsOrderSearchData rerturnGoodsOrderSearchData, StringBuffer calculationFormulaStr) throws Exception {
|
||||||
Assert.notNull(goodsRertunSonDetailsDto, "goodsRertunSonDetailsDto OFS售后入库单明细行不能为空!");
|
Assert.notNull(goodsRertunSonDetailsDto, "goodsRertunSonDetailsDto OFS售后入库单明细行不能为空!");
|
||||||
Assert.notNull(rerturnGoodsOrderSearchData, "rerturnGoodsOrderSearchData OFS售后订单不能为空!");
|
Assert.notNull(rerturnGoodsOrderSearchData, "rerturnGoodsOrderSearchData OFS售后订单不能为空!");
|
||||||
|
Assert.notNull(calculationFormulaStr, "calculationFormulaStr不能为空!");
|
||||||
|
|
||||||
//O售后入库单表头
|
//O售后入库单表头
|
||||||
StockinOrderSearchResponse.StockinOrder.StockinH header1 = goodsRertunSonDetailsDto.getHeader();
|
StockinOrderSearchResponse.StockinOrder.StockinH header1 = goodsRertunSonDetailsDto.getHeader();
|
||||||
|
|
|
@ -131,4 +131,18 @@ public class GoodsRertunSonDetailsDto extends StockinOrderSearchResponse.Stockin
|
||||||
|
|
||||||
//累加商家优惠
|
//累加商家优惠
|
||||||
private BigDecimal vdef7;
|
private BigDecimal vdef7;
|
||||||
|
|
||||||
|
//把销售订单明细行对应的优惠金额保存到销售出库单明细行一份,便于存储到中台的底表
|
||||||
|
//计算应收
|
||||||
|
private String calculateAccountsReceivable;
|
||||||
|
//计算公式
|
||||||
|
private String calculationFormula;
|
||||||
|
//平台优惠
|
||||||
|
private String platformDiscounts;
|
||||||
|
//商家优惠
|
||||||
|
private String merchantDiscounts;
|
||||||
|
//达人优惠
|
||||||
|
private String expertDiscounts;
|
||||||
|
//支付优惠
|
||||||
|
private String payDiscounts;
|
||||||
}
|
}
|
|
@ -83,8 +83,8 @@ public class SoSaleOutPluginInitializerToBTest {
|
||||||
|
|
||||||
// soSaleOutPluginInitializerToB.startImplementByStockTime("2024-10-23 16:09:59", "2024-10-23 16:10:01");
|
// soSaleOutPluginInitializerToB.startImplementByStockTime("2024-10-23 16:09:59", "2024-10-23 16:10:01");
|
||||||
|
|
||||||
String aaa = "LETS-SH2024102100023018";
|
String aaa = "LETS-SH2024111900014827";
|
||||||
soSaleOutPluginInitializerToB.startImplementByCode(aaa, "tran");
|
soSaleOutPluginInitializerToB.startImplementByCode(aaa, "stock");
|
||||||
// soSaleOutPluginInitializerToB.startImplementByTranTime("2024-10-28 00:00:00", "2024-10-28 23:59:59");
|
// soSaleOutPluginInitializerToB.startImplementByTranTime("2024-10-28 00:00:00", "2024-10-28 23:59:59");
|
||||||
|
|
||||||
// soSaleOutPluginInitializerToB.startImplementByStockTime("2024-10-31 14:48:41", "2024-10-31 14:48:41");
|
// soSaleOutPluginInitializerToB.startImplementByStockTime("2024-10-31 14:48:41", "2024-10-31 14:48:41");
|
||||||
|
|
Loading…
Reference in New Issue