From a8e0d79bc4b3097227f8aadcbc972e815e58775f Mon Sep 17 00:00:00 2001 From: liuy <37787198+LiuyCodes@users.noreply.github.com> Date: Thu, 22 May 2025 16:38:38 +0800 Subject: [PATCH] =?UTF-8?q?fix(sales):=20=E4=BF=AE=E5=A4=8D=E7=BA=A2?= =?UTF-8?q?=E5=AD=97=E9=94=80=E5=94=AE=E8=AE=A2=E5=8D=95=E5=92=8C=E5=8F=91?= =?UTF-8?q?=E7=A5=A8=E6=8E=A8=E9=80=81=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 在 SoSaleOutPluginInitializerToB 和 SoSaleReturnPluginInitializerToB 中增加 SKU 编码空格处理 - 在 ProxyPurchaseWarehousWarehouse 和 SoSaleReturnPluginInitializerToB 中增加实收/实退数量为 0 时的过滤逻辑 - 优化红字销售订单和发票的推送逻辑,避免重复推送 - 调整测试用例执行方式 --- .../ProxyPurchaseWarehousWarehouse.java | 2 +- .../sales/SoSaleOutPluginInitializerToB.java | 2 +- .../SoSaleReturnPluginInitializerToB.java | 94 +++++++++++-------- .../SoSaleReturnPluginInitializerToBTest.java | 4 +- 4 files changed, 59 insertions(+), 43 deletions(-) diff --git a/buildpackage/src/main/java/com/hzya/frame/plugin/lets/plugin/purchase/ProxyPurchaseWarehousWarehouse.java b/buildpackage/src/main/java/com/hzya/frame/plugin/lets/plugin/purchase/ProxyPurchaseWarehousWarehouse.java index 7f519df7..eec3bdd8 100644 --- a/buildpackage/src/main/java/com/hzya/frame/plugin/lets/plugin/purchase/ProxyPurchaseWarehousWarehouse.java +++ b/buildpackage/src/main/java/com/hzya/frame/plugin/lets/plugin/purchase/ProxyPurchaseWarehousWarehouse.java @@ -513,7 +513,7 @@ public class ProxyPurchaseWarehousWarehouse extends PluginBaseEntity { for (int j = 0; j < details.size(); j++) { OFSReceiptConfirmSearchResponse.Detail detail = details.get(j); - + if ("0".equals(new BigDecimal(detail.getReceivedQty()).stripTrailingZeros().toPlainString())) { continue; } diff --git a/buildpackage/src/main/java/com/hzya/frame/plugin/lets/plugin/sales/SoSaleOutPluginInitializerToB.java b/buildpackage/src/main/java/com/hzya/frame/plugin/lets/plugin/sales/SoSaleOutPluginInitializerToB.java index 2aa06465..b91ee1b0 100644 --- a/buildpackage/src/main/java/com/hzya/frame/plugin/lets/plugin/sales/SoSaleOutPluginInitializerToB.java +++ b/buildpackage/src/main/java/com/hzya/frame/plugin/lets/plugin/sales/SoSaleOutPluginInitializerToB.java @@ -1376,7 +1376,7 @@ public class SoSaleOutPluginInitializerToB extends PluginBaseEntity { Assert.notNull(pkCorp, "发货公司主键不能为空"); BdInvmandocEntity bdInvmandocEntity = new BdInvmandocEntity(); - bdInvmandocEntity.setInvcode(detailsDto.getSkuCode()); + bdInvmandocEntity.setInvcode(detailsDto.getSkuCode().trim()); bdInvmandocEntity.setPkCorp(pkCorp); List bdInvmandocEntity2 = iBdInvmandocDao.queryBdInvmandocByInvcodeList(bdInvmandocEntity); if (bdInvmandocEntity2.size() == 0) { diff --git a/buildpackage/src/main/java/com/hzya/frame/plugin/lets/plugin/sales/SoSaleReturnPluginInitializerToB.java b/buildpackage/src/main/java/com/hzya/frame/plugin/lets/plugin/sales/SoSaleReturnPluginInitializerToB.java index cf9c11a7..039b6c7b 100644 --- a/buildpackage/src/main/java/com/hzya/frame/plugin/lets/plugin/sales/SoSaleReturnPluginInitializerToB.java +++ b/buildpackage/src/main/java/com/hzya/frame/plugin/lets/plugin/sales/SoSaleReturnPluginInitializerToB.java @@ -835,6 +835,11 @@ public class SoSaleReturnPluginInitializerToB extends PluginBaseEntity { // BdInvclEntity bdInvclEntity = queryU8CEntityUtil.queryBdInvbasdocByBdInvcl(bdInvbasdocEntity); // BdCostsubjEntity bdCostsubjEntity = queryU8CEntityUtil.queryBdCostsubj(bdInvclEntity); + //如果实退数量=0,则过滤掉,不增加到明细列表中 + if ("0".equals(new BigDecimal(stockinB.getReceivedQty()).stripTrailingZeros().toPlainString())) { + continue; + } + // 如果是海外的店铺,则税率为零 String exportVaue = ExportConstant.exportConstant.get(header.getStoreCode()); if (exportVaue != null) { @@ -912,27 +917,29 @@ public class SoSaleReturnPluginInitializerToB extends PluginBaseEntity { saleorderRequestDtoList.add(saleorderRequestDto); synchronized (PUSH_LOCK1) { - Boolean aBoolean = checkTobOrder(header.getId(), header.getCode()); - if (!aBoolean) { - logger.error("经过SQL查询判断,在U8C(红字)销售订单不存在OFS入库单号为:{} OFS入库主键为:{}的单据,将调用U8C接口执行推送!", header.getCode(), header.getId()); - Map> stringStringMap = new HashMap<>(); - stringStringMap.put("saleorder", saleorderRequestDtoList); - SoSaleResultRootDto soSaleResultRootDto = sendU8CTOCOrder(JSON.toJSONString(stringStringMap)); - String vreceiptcode = null; - String csaleid = null; - String pk_corp = null; - if (soSaleResultRootDto != null) { - SoSaleResultHeadDto parentvo = soSaleResultRootDto.getParentvo(); - List childrenvo = soSaleResultRootDto.getChildrenvo(); - vreceiptcode = parentvo.getVreceiptcode(); - csaleid = parentvo.getCsaleid(); - pk_corp = parentvo.getPk_corp(); + if (saleorderRequestChildrenDtoList.size() > 0) { + Boolean aBoolean = checkTobOrder(header.getId(), header.getCode()); + if (!aBoolean) { + logger.error("经过SQL查询判断,在U8C(红字)销售订单不存在OFS入库单号为:{} OFS入库主键为:{}的单据,将调用U8C接口执行推送!", header.getCode(), header.getId()); + Map> stringStringMap = new HashMap<>(); + stringStringMap.put("saleorder", saleorderRequestDtoList); + SoSaleResultRootDto soSaleResultRootDto = sendU8CTOCOrder(JSON.toJSONString(stringStringMap)); + String vreceiptcode = null; + String csaleid = null; + String pk_corp = null; + if (soSaleResultRootDto != null) { + SoSaleResultHeadDto parentvo = soSaleResultRootDto.getParentvo(); + List childrenvo = soSaleResultRootDto.getChildrenvo(); + vreceiptcode = parentvo.getVreceiptcode(); + 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) { @@ -1641,9 +1648,9 @@ public class SoSaleReturnPluginInitializerToB extends PluginBaseEntity { Assert.notNull(detailsDto, "sonDetailsDto不能为空"); Assert.notNull(detailsDto.getSkuCode(), "O存货商家编码不能为空"); Assert.notNull(pkCorp, "发货公司主键不能为空"); - + BdInvmandocEntity bdInvmandocEntity = new BdInvmandocEntity(); - bdInvmandocEntity.setInvcode(detailsDto.getSkuCode()); + bdInvmandocEntity.setInvcode(detailsDto.getSkuCode().trim()); bdInvmandocEntity.setPkCorp(pkCorp); List bdInvmandocEntity2 = iBdInvmandocDao.queryBdInvmandocByInvcodeList(bdInvmandocEntity); if (bdInvmandocEntity2.size() == 0) { @@ -1924,6 +1931,11 @@ public class SoSaleReturnPluginInitializerToB extends PluginBaseEntity { // BdInvclEntity bdInvclEntity = queryU8CEntityUtil.queryBdInvbasdocByBdInvcl(bdInvbasdocEntity); // BdCostsubjEntity bdCostsubjEntity = queryU8CEntityUtil.queryBdCostsubj(bdInvclEntity); + //如果实入数量为0则过滤掉 + if ("0".equals(new BigDecimal(stockinB.getReceivedQty()).stripTrailingZeros().toPlainString())) { + continue; + } + //计算公式 StringBuffer calculationFormula = new StringBuffer(); // calculationFormula.append("O实退金额"); @@ -1980,25 +1992,27 @@ public class SoSaleReturnPluginInitializerToB extends PluginBaseEntity { //推送到U8C生成销售发票 synchronized (PUSH_LOCK2) { - Boolean aBoolean = checkTobSalesInvoice(header.getId(), header.getCode()); - if (!aBoolean) { - logger.error("经过SQL查询判断,在U8C红字销售发票中不存在OFS入库单号为:{} OFS入库主键为:{}的单据,将调用U8C接口执行推送!", header.getCode(), header.getId()); - SaleinvoiceDto saleinvoiceDto = sendU8CTOCSoSaleinvoiceB(JSON.toJSONString(stringListMap)); - String vreceiptcode = null; - String csaleid = null; - String pk_corp = null; - if (saleinvoiceDto != null && saleinvoiceDto.getParentvo() != null && saleinvoiceDto.getChildrenvo() != null) { - SaleinvoiceHeadDto parentvo = saleinvoiceDto.getParentvo(); - List childrenvo = saleinvoiceDto.getChildrenvo(); - vreceiptcode = parentvo.getVreceiptcode(); - csaleid = parentvo.getCsaleid(); - pk_corp = parentvo.getPk_corp(); + if (salesInvoiceBodyDtoList.size() > 0) { + Boolean aBoolean = checkTobSalesInvoice(header.getId(), header.getCode()); + if (!aBoolean) { + logger.error("经过SQL查询判断,在U8C红字销售发票中不存在OFS入库单号为:{} OFS入库主键为:{}的单据,将调用U8C接口执行推送!", header.getCode(), header.getId()); + SaleinvoiceDto saleinvoiceDto = sendU8CTOCSoSaleinvoiceB(JSON.toJSONString(stringListMap)); + String vreceiptcode = null; + String csaleid = null; + String pk_corp = null; + if (saleinvoiceDto != null && saleinvoiceDto.getParentvo() != null && saleinvoiceDto.getChildrenvo() != null) { + SaleinvoiceHeadDto parentvo = saleinvoiceDto.getParentvo(); + List childrenvo = saleinvoiceDto.getChildrenvo(); + vreceiptcode = parentvo.getVreceiptcode(); + 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) { diff --git a/buildpackage/src/test/java/com/hzya/frame/plugin/lets/plugin/sales/SoSaleReturnPluginInitializerToBTest.java b/buildpackage/src/test/java/com/hzya/frame/plugin/lets/plugin/sales/SoSaleReturnPluginInitializerToBTest.java index db88af47..96cc0426 100644 --- a/buildpackage/src/test/java/com/hzya/frame/plugin/lets/plugin/sales/SoSaleReturnPluginInitializerToBTest.java +++ b/buildpackage/src/test/java/com/hzya/frame/plugin/lets/plugin/sales/SoSaleReturnPluginInitializerToBTest.java @@ -37,7 +37,9 @@ public class SoSaleReturnPluginInitializerToBTest { // 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) { e.printStackTrace(); }