Merge remote-tracking branch 'origin/lets' into lets
This commit is contained in:
commit
0722014555
|
@ -228,7 +228,7 @@ public class SoSaleOutPluginInitializerToC extends PluginBaseEntity {
|
|||
Assert.notNull(endTime, "查询条件,结束时间不能为空!");
|
||||
|
||||
// CalculateDateVo calculateDateVo = DateStrUtil.calculateCalculateEntireDayPeriod(dateStr);
|
||||
String tobShop = shopTobOrToCUtil.getCommaShop("TOC");
|
||||
String tocShop = shopTobOrToCUtil.getCommaShop("TOC");
|
||||
|
||||
List<com.hzya.frame.ttxofs.dto.ofssaleorderoutsearch.HeaderDetailsDto> headerDetailsDtoList = new ArrayList<>();
|
||||
QueryOfsSoSaleOutVo queryOfsSoSaleOutVo = new QueryOfsSoSaleOutVo();
|
||||
|
@ -241,7 +241,7 @@ public class SoSaleOutPluginInitializerToC extends PluginBaseEntity {
|
|||
queryOfsSoSaleOutVo.setStatus(900L);
|
||||
queryOfsSoSaleOutVo.setPageNo(1L);
|
||||
queryOfsSoSaleOutVo.setPageSize(100L);
|
||||
queryOfsSoSaleOutVo.setStoreCode(tobShop);
|
||||
queryOfsSoSaleOutVo.setStoreCode(tocShop);
|
||||
// queryOfsSoSaleOutVo.setCode("LETS-SH2024070500000003");
|
||||
ofsStandardUtil.queryOfsSaleOrder(queryOfsSoSaleOutVo, headerDetailsDtoList, 1L, "ofs.shipment.search");
|
||||
logger.info("数据返回行数:{}", headerDetailsDtoList.size());
|
||||
|
@ -322,7 +322,7 @@ public class SoSaleOutPluginInitializerToC extends PluginBaseEntity {
|
|||
Assert.notNull(code, "O出库单编码不能为空!code is null!");
|
||||
Assert.notNull(sceneType, "场景类型不能为空!");
|
||||
|
||||
String tobShop = shopTobOrToCUtil.getCommaShop("TOC");
|
||||
String tocShop = shopTobOrToCUtil.getCommaShop("TOC");
|
||||
List<com.hzya.frame.ttxofs.dto.ofssaleorderoutsearch.HeaderDetailsDto> headerDetailsDtoList = new ArrayList<>();
|
||||
QueryOfsSoSaleOutVo queryOfsSoSaleOutVo = new QueryOfsSoSaleOutVo();
|
||||
queryOfsSoSaleOutVo.setClientCode("LETS");
|
||||
|
@ -330,7 +330,7 @@ public class SoSaleOutPluginInitializerToC extends PluginBaseEntity {
|
|||
queryOfsSoSaleOutVo.setStatus(900L);
|
||||
queryOfsSoSaleOutVo.setPageNo(1L);
|
||||
queryOfsSoSaleOutVo.setPageSize(100L);
|
||||
queryOfsSoSaleOutVo.setStoreCode(tobShop);
|
||||
queryOfsSoSaleOutVo.setStoreCode(tocShop);
|
||||
queryOfsSoSaleOutVo.setCode(code);
|
||||
ofsStandardUtil.queryOfsSaleOrder(queryOfsSoSaleOutVo, headerDetailsDtoList, 1L, "ofs.shipment.search");
|
||||
logger.info("数据返回行数:{}", headerDetailsDtoList.size());
|
||||
|
@ -1094,11 +1094,6 @@ public class SoSaleOutPluginInitializerToC extends PluginBaseEntity {
|
|||
List<SaleorderRequestDto> saleorderRequestDtoList = new ArrayList<>();
|
||||
saleorderRequestDtoList.add(saleorderRequestDto);
|
||||
|
||||
//TODO 测试
|
||||
if (true) {
|
||||
continue;
|
||||
}
|
||||
|
||||
Map<String, List<SaleorderRequestDto>> stringStringMap = new HashMap<>();
|
||||
stringStringMap.put("saleorder", saleorderRequestDtoList);
|
||||
SoSaleResultRootDto soSaleResultRootDto = sendU8CTOCOrder(JSON.toJSONString(stringStringMap));
|
||||
|
@ -1708,7 +1703,21 @@ public class SoSaleOutPluginInitializerToC extends PluginBaseEntity {
|
|||
}
|
||||
Assert.notNull(totalPayAmount, "应收金额不能为空(应收金额=实付金额+达人优惠+支付优惠+平台优惠) 销售出库单编码:{} 出库单明细主键:{}", header.getCode(), sonDetailsDto.getId());
|
||||
Assert.notNull(sonDetailsDto.getShipQty(), "实发数量不能为空 销售出库单编码:{} 出库单明细主键:{}", header.getCode(), sonDetailsDto.getId());
|
||||
BigDecimal totalPayAmountBigDecimal = new BigDecimal(totalPayAmount);
|
||||
|
||||
BigDecimal totalPayAmountBigDecimal = new BigDecimal("0");
|
||||
//O实付金额=O应收金额/O请求数量*O实发数量
|
||||
if (!"0".equals(new BigDecimal(totalPayAmount).stripTrailingZeros().toPlainString())) {
|
||||
//O应收金额/O请求数量
|
||||
Assert.notNull(sonDetailsDto.getRequestQty(), "请求数量不能为空!");
|
||||
if ("0".equals(new BigDecimal(sonDetailsDto.getRequestQty()).stripTrailingZeros().toPlainString())) {
|
||||
Assert.state(false, "请求数量不能为0!");
|
||||
}
|
||||
if ("0".equals(new BigDecimal(sonDetailsDto.getShipQty()).stripTrailingZeros().toPlainString())) {
|
||||
Assert.state(false, "实发数量不能为空!");
|
||||
}
|
||||
BigDecimal divide = new BigDecimal(totalPayAmount).divide(new BigDecimal(sonDetailsDto.getRequestQty()), 20, BigDecimal.ROUND_HALF_UP);
|
||||
totalPayAmountBigDecimal = divide.multiply(new BigDecimal(sonDetailsDto.getShipQty())).setScale(2, BigDecimal.ROUND_HALF_UP);
|
||||
}
|
||||
BigDecimal shipQtyBigDecimal = new BigDecimal(sonDetailsDto.getShipQty());
|
||||
|
||||
groupTotalPayAmount = groupTotalPayAmount.add(totalPayAmountBigDecimal);
|
||||
|
|
|
@ -262,7 +262,6 @@ public class SoSaleReturnPluginInitializerToC extends PluginBaseEntity {
|
|||
List<StockinOrderSearchResponse.StockinOrder> returnGoodHeaderDetailsDataDtoList = new ArrayList<>();
|
||||
QueryOfsSoSaleOutVo queryOfsSoSaleOutVo = new QueryOfsSoSaleOutVo();
|
||||
queryOfsSoSaleOutVo.setClientCode("LETS");
|
||||
// queryOfsSoSaleOutVo.setInternalInstructionType("SALES");
|
||||
queryOfsSoSaleOutVo.setStatus(900L);
|
||||
queryOfsSoSaleOutVo.setPageNo(1L);
|
||||
queryOfsSoSaleOutVo.setPageSize(50L);
|
||||
|
@ -1034,6 +1033,7 @@ public class SoSaleReturnPluginInitializerToC extends PluginBaseEntity {
|
|||
* @author liuyang
|
||||
*/
|
||||
private String createGenerateBusinessDate(StockinOrderSearchResponse.StockinOrder.StockinH header) {
|
||||
// header.setClosedAt("2024-11-07 11:57:12");
|
||||
String code = null;
|
||||
if (header != null && header.getCode() != null) {
|
||||
code = header.getCode();
|
||||
|
@ -1114,6 +1114,14 @@ public class SoSaleReturnPluginInitializerToC extends PluginBaseEntity {
|
|||
//初始化公司档案对照关系
|
||||
Map<String, String> comparisonCompanyArchives = queryU8CEntityUtil.queryBdDefDocByPkDefDocAll();
|
||||
|
||||
//测试
|
||||
// StockinOrderSearchResponse.StockinOrder stockinOrder1 = returnGoodHeaderDetailsDataDtoList1.get(0);
|
||||
// List<StockinOrderSearchResponse.StockinOrder.StockinB> details2 = stockinOrder1.getDetails();
|
||||
// for (int i = 0; i < details2.size(); i++) {
|
||||
// StockinOrderSearchResponse.StockinOrder.StockinB stockinB = details2.get(i);
|
||||
// stockinB.setReceivedQty(stockinB.getRequestQty());
|
||||
// }
|
||||
|
||||
for (int i = 0; i < returnGoodHeaderDetailsDataDtoList1.size(); i++) {
|
||||
StockinOrderSearchResponse.StockinOrder stockinOrder = returnGoodHeaderDetailsDataDtoList1.get(i);
|
||||
StockinOrderSearchResponse.StockinOrder.StockinH header = stockinOrder.getHeader();
|
||||
|
@ -1508,8 +1516,8 @@ public class SoSaleReturnPluginInitializerToC extends PluginBaseEntity {
|
|||
}
|
||||
|
||||
//实付金额/实发数量
|
||||
Assert.notNull(totalAmount, "退货入库单总金额不能为空 明细行对象:{}", JSON.toJSONString(goodsRertunSonDetailsDto));
|
||||
Assert.notNull(goodsRertunSonDetailsDto.getReceivedQty(), "实收数量不能为空 明细行对象:{}", JSON.toJSONString(goodsRertunSonDetailsDto));
|
||||
Assert.notNull(totalAmount, "实退金额不能为空 明细行主键:{}", goodsRertunSonDetailsDto.getId());
|
||||
Assert.notNull(goodsRertunSonDetailsDto.getReceivedQty(), "实收数量不能为空 明细行主键:{}", goodsRertunSonDetailsDto.getId());
|
||||
BigDecimal totalPayAmountBigDecimal = new BigDecimal(totalAmount);
|
||||
BigDecimal shipQtyBigDecimal = new BigDecimal(goodsRertunSonDetailsDto.getReceivedQty());
|
||||
|
||||
|
@ -1755,7 +1763,7 @@ public class SoSaleReturnPluginInitializerToC extends PluginBaseEntity {
|
|||
private void findAfterSalesOrder(List<RerturnGoodsOrderSearchData> rerturnGoodsOrderSearchDataList, List<StockinOrderSearchResponse.StockinOrder> returnGoodHeaderDetailsDataDtoList1) throws Exception {
|
||||
if (rerturnGoodsOrderSearchDataList != null && rerturnGoodsOrderSearchDataList.size() > 0 && returnGoodHeaderDetailsDataDtoList1 != null && returnGoodHeaderDetailsDataDtoList1.size() > 0) {
|
||||
try {
|
||||
//如果id为空,则这里会报错,所以把id设置为""
|
||||
//key为售后订单主键,如果id为空,则这里会报错,所以把id设置为""
|
||||
rerturnGoodsOrderSearchDataList.forEach(dto -> {
|
||||
if (dto.getHeader() != null && dto.getHeader().getId() == null) {
|
||||
dto.getHeader().setId("");
|
||||
|
@ -1777,9 +1785,9 @@ public class SoSaleReturnPluginInitializerToC extends PluginBaseEntity {
|
|||
// header.setRerturnGoodsOrderSearchData(rerturnGoodsOrderSearchData);
|
||||
// }
|
||||
// }
|
||||
String id = header.getId();
|
||||
if (id != null && !"".equals(id)) {
|
||||
RerturnGoodsOrderSearchData rerturnGoodsOrderSearchData = collect.get(id);
|
||||
String refOrderId = header.getRefOrderId();
|
||||
if (refOrderId != null && !"".equals(refOrderId)) {
|
||||
RerturnGoodsOrderSearchData rerturnGoodsOrderSearchData = collect.get(refOrderId);
|
||||
if (rerturnGoodsOrderSearchData != null) {
|
||||
header.setRerturnGoodsOrderSearchData(rerturnGoodsOrderSearchData);
|
||||
}
|
||||
|
@ -2607,22 +2615,27 @@ public class SoSaleReturnPluginInitializerToC extends PluginBaseEntity {
|
|||
Assert.notNull(targetDetails, "根据OFS售后入库单细行(refOrderDetailId)无法匹配售后订单明细行", goodsRertunSonDetailsDto.getRefOrderDetailId());
|
||||
|
||||
//售后订单明细行-退货金额
|
||||
String totalAmount = targetDetails.getTotalAmount();
|
||||
String totalAmount = targetDetails.getTotalAmount();//实退金额
|
||||
Assert.notNull(totalAmount, "售后订单:{} 存货明细行:{} 退货金额不能为空!", header.getCode(), targetDetails.getSkuCode());
|
||||
Assert.state(!"".equals(totalAmount), "售后订单:{} 存货明细行:{} 退货金额不能为空!", header.getCode(), targetDetails.getSkuCode());
|
||||
//售后订单明细行-请求数量
|
||||
//实退数量存在可能为0的情况,如果用退货金额/实退数量可能会抛出异常
|
||||
String requestQty = targetDetails.getRequestQty();
|
||||
String requestQty = targetDetails.getRequestQty();//请求数量
|
||||
Assert.notNull(requestQty, "售后订单:{} 存货明细行:{} 请求数量不能为空!", header.getCode(), targetDetails.getSkuCode());
|
||||
Assert.state(!"".equals(requestQty), "售后订单:{} 存货明细行:{} 请求数量不能为空!", header.getCode(), targetDetails.getSkuCode());
|
||||
//通过退货金额/请求数量=含税单价
|
||||
BigDecimal unitPriceIncludingTax = new BigDecimal(totalAmount).divide(new BigDecimal(requestQty), 20, BigDecimal.ROUND_HALF_UP);
|
||||
//含税单价*(O售后入库单)实退数量=实退金额
|
||||
BigDecimal actualRefundAmount = unitPriceIncludingTax.multiply(new BigDecimal(requestQty)).setScale(4, BigDecimal.ROUND_HALF_UP);
|
||||
//出库对应的实退=含税单价(actualRefundAmount)*出库单实退数量
|
||||
|
||||
String receivedQty = goodsRertunSonDetailsDto.getReceivedQty();
|
||||
Assert.notNull(receivedQty, "售后入库单号:{} 售后入库单明细行主键:{} 实收数量不能为空receivedQty!", header1.getCode(), goodsRertunSonDetailsDto.getId());
|
||||
BigDecimal actualRefundAmountBigDecimal = new BigDecimal(receivedQty).multiply(actualRefundAmount).setScale(2, BigDecimal.ROUND_HALF_UP);
|
||||
Assert.notNull(receivedQty, "售后订单:{} 存货明细行:{} 请求数量不能为空!", header1.getCode(), goodsRertunSonDetailsDto.getId());
|
||||
Assert.state(!"".equals(receivedQty), header1.getCode(), goodsRertunSonDetailsDto.getId());
|
||||
if ("0".equals(new BigDecimal(receivedQty).stripTrailingZeros().toPlainString())) {
|
||||
Assert.state(false, "售后订单:{} 存货明细行:{} 实退数量不能为0!", header1.getCode(), goodsRertunSonDetailsDto.getId());
|
||||
}
|
||||
//O含税单价=通过退货金额/请求数量
|
||||
BigDecimal unitPriceIncludingTax = new BigDecimal(totalAmount).divide(new BigDecimal(requestQty), 20, BigDecimal.ROUND_HALF_UP);
|
||||
//实退金额=O含税单价*(O售后入库单)实退数量
|
||||
BigDecimal actualRefundAmount = unitPriceIncludingTax.multiply(new BigDecimal(receivedQty)).setScale(4, BigDecimal.ROUND_HALF_UP);
|
||||
//出库对应的实退=含税单价(actualRefundAmount)*出库单实退数量
|
||||
// BigDecimal actualRefundAmountBigDecimal = new BigDecimal(receivedQty).multiply(actualRefundAmount).setScale(2, BigDecimal.ROUND_HALF_UP);
|
||||
|
||||
//商家优惠:不处理!!!仅保存
|
||||
String merchantDiscounts = targetDetails.getMerchantDiscounts();
|
||||
|
@ -2639,8 +2652,8 @@ public class SoSaleReturnPluginInitializerToC extends PluginBaseEntity {
|
|||
BigDecimal payDiscountsBigDecimal = new BigDecimal("0");//支付优惠
|
||||
BigDecimal platformDiscountsBigDecimal = new BigDecimal("0");//平台优惠
|
||||
|
||||
if (actualRefundAmountBigDecimal != null) {
|
||||
totalPayAmountBigDecimal = actualRefundAmountBigDecimal;
|
||||
if (actualRefundAmount != null) {
|
||||
totalPayAmountBigDecimal = actualRefundAmount;
|
||||
}
|
||||
if (expertDiscounts != null && !"".equals(expertDiscounts)) {
|
||||
expertDiscountsBigDecimal = new BigDecimal(expertDiscounts);
|
||||
|
@ -2715,10 +2728,10 @@ public class SoSaleReturnPluginInitializerToC extends PluginBaseEntity {
|
|||
}
|
||||
}
|
||||
|
||||
sonDetailsDtoList.get(0).setVdef4(platformDiscountsBigDecimal);
|
||||
sonDetailsDtoList.get(0).setVdef5(payDiscountsBigDecimal);
|
||||
sonDetailsDtoList.get(0).setVdef6(expertDiscountsBigDecimal);
|
||||
sonDetailsDtoList.get(0).setVdef7(merchantDiscountsBigDecimal);
|
||||
sonDetailsDtoList.get(0).setVdef4(platformDiscountsBigDecimal);//平台
|
||||
sonDetailsDtoList.get(0).setVdef5(payDiscountsBigDecimal);//支付
|
||||
sonDetailsDtoList.get(0).setVdef6(expertDiscountsBigDecimal);//达人
|
||||
sonDetailsDtoList.get(0).setVdef7(merchantDiscountsBigDecimal);//商家
|
||||
}
|
||||
}
|
||||
}
|
|
@ -121,7 +121,7 @@ class SoSaleOutPluginInitializerToCTest {
|
|||
|
||||
try {
|
||||
// soSaleOutPluginInitializerToC.startImplementStockByCode("LETS-SH2024091900002878", "stock");
|
||||
soSaleOutPluginInitializerToC.startImplementStockByCode("LETS-SH2024102600009446", "stock");
|
||||
soSaleOutPluginInitializerToC.startImplementStockByCode("LETS-SH2024110300036490", "tran");
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
|
|
@ -30,7 +30,7 @@ public class SoSaleReturnPluginInitializerToCTest {
|
|||
public void startImplement() {
|
||||
// soSaleReturnPluginInitializerToC.startImplement(null, null);
|
||||
try {
|
||||
String code = "LETS-RE2024092400000148";
|
||||
String code = "LETS-RE2024110500004678";
|
||||
soSaleReturnPluginInitializerToC.startImplementByCode(code, "stock");
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
|
|
Loading…
Reference in New Issue