fix(sales): 修复红字销售订单和发票推送逻辑
- 在 SoSaleOutPluginInitializerToB 和 SoSaleReturnPluginInitializerToB 中增加 SKU 编码空格处理 - 在 ProxyPurchaseWarehousWarehouse 和 SoSaleReturnPluginInitializerToB 中增加实收/实退数量为 0 时的过滤逻辑 - 优化红字销售订单和发票的推送逻辑,避免重复推送 - 调整测试用例执行方式
This commit is contained in:
parent
1e18edd0a4
commit
a8e0d79bc4
|
@ -1376,7 +1376,7 @@ public class SoSaleOutPluginInitializerToB extends PluginBaseEntity {
|
||||||
Assert.notNull(pkCorp, "发货公司主键不能为空");
|
Assert.notNull(pkCorp, "发货公司主键不能为空");
|
||||||
|
|
||||||
BdInvmandocEntity bdInvmandocEntity = new BdInvmandocEntity();
|
BdInvmandocEntity bdInvmandocEntity = new BdInvmandocEntity();
|
||||||
bdInvmandocEntity.setInvcode(detailsDto.getSkuCode());
|
bdInvmandocEntity.setInvcode(detailsDto.getSkuCode().trim());
|
||||||
bdInvmandocEntity.setPkCorp(pkCorp);
|
bdInvmandocEntity.setPkCorp(pkCorp);
|
||||||
List<BdInvmandocEntity> bdInvmandocEntity2 = iBdInvmandocDao.queryBdInvmandocByInvcodeList(bdInvmandocEntity);
|
List<BdInvmandocEntity> bdInvmandocEntity2 = iBdInvmandocDao.queryBdInvmandocByInvcodeList(bdInvmandocEntity);
|
||||||
if (bdInvmandocEntity2.size() == 0) {
|
if (bdInvmandocEntity2.size() == 0) {
|
||||||
|
|
|
@ -835,6 +835,11 @@ public class SoSaleReturnPluginInitializerToB extends PluginBaseEntity {
|
||||||
// BdInvclEntity bdInvclEntity = queryU8CEntityUtil.queryBdInvbasdocByBdInvcl(bdInvbasdocEntity);
|
// BdInvclEntity bdInvclEntity = queryU8CEntityUtil.queryBdInvbasdocByBdInvcl(bdInvbasdocEntity);
|
||||||
// BdCostsubjEntity bdCostsubjEntity = queryU8CEntityUtil.queryBdCostsubj(bdInvclEntity);
|
// BdCostsubjEntity bdCostsubjEntity = queryU8CEntityUtil.queryBdCostsubj(bdInvclEntity);
|
||||||
|
|
||||||
|
//如果实退数量=0,则过滤掉,不增加到明细列表中
|
||||||
|
if ("0".equals(new BigDecimal(stockinB.getReceivedQty()).stripTrailingZeros().toPlainString())) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
// 如果是海外的店铺,则税率为零
|
// 如果是海外的店铺,则税率为零
|
||||||
String exportVaue = ExportConstant.exportConstant.get(header.getStoreCode());
|
String exportVaue = ExportConstant.exportConstant.get(header.getStoreCode());
|
||||||
if (exportVaue != null) {
|
if (exportVaue != null) {
|
||||||
|
@ -912,27 +917,29 @@ public class SoSaleReturnPluginInitializerToB extends PluginBaseEntity {
|
||||||
saleorderRequestDtoList.add(saleorderRequestDto);
|
saleorderRequestDtoList.add(saleorderRequestDto);
|
||||||
|
|
||||||
synchronized (PUSH_LOCK1) {
|
synchronized (PUSH_LOCK1) {
|
||||||
Boolean aBoolean = checkTobOrder(header.getId(), header.getCode());
|
if (saleorderRequestChildrenDtoList.size() > 0) {
|
||||||
if (!aBoolean) {
|
Boolean aBoolean = checkTobOrder(header.getId(), header.getCode());
|
||||||
logger.error("经过SQL查询判断,在U8C(红字)销售订单不存在OFS入库单号为:{} OFS入库主键为:{}的单据,将调用U8C接口执行推送!", header.getCode(), header.getId());
|
if (!aBoolean) {
|
||||||
Map<String, List<SaleorderRequestDto>> stringStringMap = new HashMap<>();
|
logger.error("经过SQL查询判断,在U8C(红字)销售订单不存在OFS入库单号为:{} OFS入库主键为:{}的单据,将调用U8C接口执行推送!", header.getCode(), header.getId());
|
||||||
stringStringMap.put("saleorder", saleorderRequestDtoList);
|
Map<String, List<SaleorderRequestDto>> stringStringMap = new HashMap<>();
|
||||||
SoSaleResultRootDto soSaleResultRootDto = sendU8CTOCOrder(JSON.toJSONString(stringStringMap));
|
stringStringMap.put("saleorder", saleorderRequestDtoList);
|
||||||
String vreceiptcode = null;
|
SoSaleResultRootDto soSaleResultRootDto = sendU8CTOCOrder(JSON.toJSONString(stringStringMap));
|
||||||
String csaleid = null;
|
String vreceiptcode = null;
|
||||||
String pk_corp = null;
|
String csaleid = null;
|
||||||
if (soSaleResultRootDto != null) {
|
String pk_corp = null;
|
||||||
SoSaleResultHeadDto parentvo = soSaleResultRootDto.getParentvo();
|
if (soSaleResultRootDto != null) {
|
||||||
List<SoSaleResultBodyDto> childrenvo = soSaleResultRootDto.getChildrenvo();
|
SoSaleResultHeadDto parentvo = soSaleResultRootDto.getParentvo();
|
||||||
vreceiptcode = parentvo.getVreceiptcode();
|
List<SoSaleResultBodyDto> childrenvo = soSaleResultRootDto.getChildrenvo();
|
||||||
csaleid = parentvo.getCsaleid();
|
vreceiptcode = parentvo.getVreceiptcode();
|
||||||
pk_corp = parentvo.getPk_corp();
|
csaleid = parentvo.getCsaleid();
|
||||||
|
pk_corp = parentvo.getPk_corp();
|
||||||
|
}
|
||||||
|
logger.info("TOB红字销售订单编号:{} 销售订单主键:{} 销售公司:{}", vreceiptcode, csaleid, pk_corp);
|
||||||
|
//记录成功
|
||||||
|
updateSuccessOrFail1(details, "Y", "success", vreceiptcode, csaleid);
|
||||||
|
} else {
|
||||||
|
logger.error("经过SQL查询判断,在U8C(红字)销售订单存在OFS入库单号为:{} OFS入库主键为:{}的单据,为了避免造成单据重复,不推送到U8C!", header.getCode(), header.getId());
|
||||||
}
|
}
|
||||||
logger.info("TOB红字销售订单编号:{} 销售订单主键:{} 销售公司:{}", vreceiptcode, csaleid, pk_corp);
|
|
||||||
//记录成功
|
|
||||||
updateSuccessOrFail1(details, "Y", "success", vreceiptcode, csaleid);
|
|
||||||
} else {
|
|
||||||
logger.error("经过SQL查询判断,在U8C(红字)销售订单存在OFS入库单号为:{} OFS入库主键为:{}的单据,为了避免造成单据重复,不推送到U8C!", header.getCode(), header.getId());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
@ -1643,7 +1650,7 @@ public class SoSaleReturnPluginInitializerToB extends PluginBaseEntity {
|
||||||
Assert.notNull(pkCorp, "发货公司主键不能为空");
|
Assert.notNull(pkCorp, "发货公司主键不能为空");
|
||||||
|
|
||||||
BdInvmandocEntity bdInvmandocEntity = new BdInvmandocEntity();
|
BdInvmandocEntity bdInvmandocEntity = new BdInvmandocEntity();
|
||||||
bdInvmandocEntity.setInvcode(detailsDto.getSkuCode());
|
bdInvmandocEntity.setInvcode(detailsDto.getSkuCode().trim());
|
||||||
bdInvmandocEntity.setPkCorp(pkCorp);
|
bdInvmandocEntity.setPkCorp(pkCorp);
|
||||||
List<BdInvmandocEntity> bdInvmandocEntity2 = iBdInvmandocDao.queryBdInvmandocByInvcodeList(bdInvmandocEntity);
|
List<BdInvmandocEntity> bdInvmandocEntity2 = iBdInvmandocDao.queryBdInvmandocByInvcodeList(bdInvmandocEntity);
|
||||||
if (bdInvmandocEntity2.size() == 0) {
|
if (bdInvmandocEntity2.size() == 0) {
|
||||||
|
@ -1924,6 +1931,11 @@ public class SoSaleReturnPluginInitializerToB extends PluginBaseEntity {
|
||||||
// BdInvclEntity bdInvclEntity = queryU8CEntityUtil.queryBdInvbasdocByBdInvcl(bdInvbasdocEntity);
|
// BdInvclEntity bdInvclEntity = queryU8CEntityUtil.queryBdInvbasdocByBdInvcl(bdInvbasdocEntity);
|
||||||
// BdCostsubjEntity bdCostsubjEntity = queryU8CEntityUtil.queryBdCostsubj(bdInvclEntity);
|
// BdCostsubjEntity bdCostsubjEntity = queryU8CEntityUtil.queryBdCostsubj(bdInvclEntity);
|
||||||
|
|
||||||
|
//如果实入数量为0则过滤掉
|
||||||
|
if ("0".equals(new BigDecimal(stockinB.getReceivedQty()).stripTrailingZeros().toPlainString())) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
//计算公式
|
//计算公式
|
||||||
StringBuffer calculationFormula = new StringBuffer();
|
StringBuffer calculationFormula = new StringBuffer();
|
||||||
// calculationFormula.append("O实退金额");
|
// calculationFormula.append("O实退金额");
|
||||||
|
@ -1980,25 +1992,27 @@ public class SoSaleReturnPluginInitializerToB extends PluginBaseEntity {
|
||||||
|
|
||||||
//推送到U8C生成销售发票
|
//推送到U8C生成销售发票
|
||||||
synchronized (PUSH_LOCK2) {
|
synchronized (PUSH_LOCK2) {
|
||||||
Boolean aBoolean = checkTobSalesInvoice(header.getId(), header.getCode());
|
if (salesInvoiceBodyDtoList.size() > 0) {
|
||||||
if (!aBoolean) {
|
Boolean aBoolean = checkTobSalesInvoice(header.getId(), header.getCode());
|
||||||
logger.error("经过SQL查询判断,在U8C红字销售发票中不存在OFS入库单号为:{} OFS入库主键为:{}的单据,将调用U8C接口执行推送!", header.getCode(), header.getId());
|
if (!aBoolean) {
|
||||||
SaleinvoiceDto saleinvoiceDto = sendU8CTOCSoSaleinvoiceB(JSON.toJSONString(stringListMap));
|
logger.error("经过SQL查询判断,在U8C红字销售发票中不存在OFS入库单号为:{} OFS入库主键为:{}的单据,将调用U8C接口执行推送!", header.getCode(), header.getId());
|
||||||
String vreceiptcode = null;
|
SaleinvoiceDto saleinvoiceDto = sendU8CTOCSoSaleinvoiceB(JSON.toJSONString(stringListMap));
|
||||||
String csaleid = null;
|
String vreceiptcode = null;
|
||||||
String pk_corp = null;
|
String csaleid = null;
|
||||||
if (saleinvoiceDto != null && saleinvoiceDto.getParentvo() != null && saleinvoiceDto.getChildrenvo() != null) {
|
String pk_corp = null;
|
||||||
SaleinvoiceHeadDto parentvo = saleinvoiceDto.getParentvo();
|
if (saleinvoiceDto != null && saleinvoiceDto.getParentvo() != null && saleinvoiceDto.getChildrenvo() != null) {
|
||||||
List<SaleinvoiceBodyDto> childrenvo = saleinvoiceDto.getChildrenvo();
|
SaleinvoiceHeadDto parentvo = saleinvoiceDto.getParentvo();
|
||||||
vreceiptcode = parentvo.getVreceiptcode();
|
List<SaleinvoiceBodyDto> childrenvo = saleinvoiceDto.getChildrenvo();
|
||||||
csaleid = parentvo.getCsaleid();
|
vreceiptcode = parentvo.getVreceiptcode();
|
||||||
pk_corp = parentvo.getPk_corp();
|
csaleid = parentvo.getCsaleid();
|
||||||
|
pk_corp = parentvo.getPk_corp();
|
||||||
|
}
|
||||||
|
logger.info("TOB销售发票(红字)生成成功 编码:{} 主键:{} 发票公司:{}", vreceiptcode, csaleid, pk_corp);
|
||||||
|
//记录成功
|
||||||
|
updateSuccessOrFail2(details, "Y", "success", vreceiptcode, csaleid);
|
||||||
|
} else {
|
||||||
|
logger.error("经过SQL查询判断,在U8C红字销售发票中已经存在OFS入库单号为:{} OFS入库主键为:{}的单据,为了避免造成单据重复,不推送到U8C!", header.getCode(), header.getId());
|
||||||
}
|
}
|
||||||
logger.info("TOB销售发票(红字)生成成功 编码:{} 主键:{} 发票公司:{}", vreceiptcode, csaleid, pk_corp);
|
|
||||||
//记录成功
|
|
||||||
updateSuccessOrFail2(details, "Y", "success", vreceiptcode, csaleid);
|
|
||||||
} else {
|
|
||||||
logger.error("经过SQL查询判断,在U8C红字销售发票中已经存在OFS入库单号为:{} OFS入库主键为:{}的单据,为了避免造成单据重复,不推送到U8C!", header.getCode(), header.getId());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
|
|
@ -37,7 +37,9 @@ public class SoSaleReturnPluginInitializerToBTest {
|
||||||
|
|
||||||
// soSaleReturnPluginInitializerToB.startImplementByCode("LETS-RE2024112200000301", "tran");
|
// soSaleReturnPluginInitializerToB.startImplementByCode("LETS-RE2024112200000301", "tran");
|
||||||
|
|
||||||
soSaleReturnPluginInitializerToB.startImplementByStockTime("2024-11-29 00:00:00", "2024-11-30 23:59:59");
|
// soSaleReturnPluginInitializerToB.startImplementByStockTime("2024-11-29 00:00:00", "2024-11-30 23:59:59");
|
||||||
|
|
||||||
|
soSaleReturnPluginInitializerToB.startImplementByCode("LETS-RE2025042200001200", "stock");
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue