diff --git a/buildpackage/src/main/java/com/hzya/frame/plugin/lets/entity/OnlyAfterSalesBEntity.java b/buildpackage/src/main/java/com/hzya/frame/plugin/lets/entity/OnlyAfterSalesBEntity.java index a0c57c5e..2ccfb973 100644 --- a/buildpackage/src/main/java/com/hzya/frame/plugin/lets/entity/OnlyAfterSalesBEntity.java +++ b/buildpackage/src/main/java/com/hzya/frame/plugin/lets/entity/OnlyAfterSalesBEntity.java @@ -181,5 +181,7 @@ public class OnlyAfterSalesBEntity extends BaseEntity { private String def11; private String def12; + + private String def13; } diff --git a/buildpackage/src/main/java/com/hzya/frame/plugin/lets/entity/OnlyAfterSalesBEntity.xml b/buildpackage/src/main/java/com/hzya/frame/plugin/lets/entity/OnlyAfterSalesBEntity.xml index 00f8d8d5..8f4a8fa1 100644 --- a/buildpackage/src/main/java/com/hzya/frame/plugin/lets/entity/OnlyAfterSalesBEntity.xml +++ b/buildpackage/src/main/java/com/hzya/frame/plugin/lets/entity/OnlyAfterSalesBEntity.xml @@ -462,10 +462,10 @@ - insert into only_after_sales_b(ofsid,newPushDate,newTransmitInfo,newState,newsystemnumber,newsystemprimary,def1,def2,def3,def4,def5,def6,def7) + insert into only_after_sales_b(ofsid,newPushDate,newTransmitInfo,newState,newsystemnumber,newsystemprimary,def1,def2,def3,def4,def5,def6,def7,def13) values - (#{entity.ofsid},#{entity.newPushDate},#{entity.newTransmitInfo},#{entity.newState},#{entity.newsystemnumber},#{entity.newsystemprimary},#{entity.def1},#{entity.def2},#{entity.def3},#{entity.def4},#{entity.def5},#{entity.def6},#{entity.def7}) + (#{entity.ofsid},#{entity.newPushDate},#{entity.newTransmitInfo},#{entity.newState},#{entity.newsystemnumber},#{entity.newsystemprimary},#{entity.def1},#{entity.def2},#{entity.def3},#{entity.def4},#{entity.def5},#{entity.def6},#{entity.def7},#{entity.def13}) on duplicate key update ofsid = values(ofsid), @@ -482,15 +482,16 @@ def4 = values(def4), def5 = values(def5), def6 = values(def6), - def7 = values(def7) + def7 = values(def7), + def13 = values(def13) - insert into only_after_sales_b(ofsid,def1,def2,def3,def4,def5,def6,def7,def8,def9,def10,def11,def12) + insert into only_after_sales_b(ofsid,def1,def2,def3,def4,def5,def6,def7,def8,def9,def10,def11,def12,def13) values - (#{entity.ofsid},#{entity.def1},#{entity.def2},#{entity.def3},#{entity.def4},#{entity.def5},#{entity.def6},#{entity.def7},#{entity.def8},#{entity.def9},#{entity.def10},#{entity.def11},#{entity.def12}) + (#{entity.ofsid},#{entity.def1},#{entity.def2},#{entity.def3},#{entity.def4},#{entity.def5},#{entity.def6},#{entity.def7},#{entity.def8},#{entity.def9},#{entity.def10},#{entity.def11},#{entity.def12},#{entity.def13}) on duplicate key update ofsid = values(ofsid), @@ -507,7 +508,8 @@ def9 = values(def9), def10 = values(def10), def11 = values(def11), - def12 = values(def12) + def12 = values(def12), + def13 = values(def13) diff --git a/buildpackage/src/main/java/com/hzya/frame/plugin/lets/ofs/entity/OfsPassiveorderDetailEntity.java b/buildpackage/src/main/java/com/hzya/frame/plugin/lets/ofs/entity/OfsPassiveorderDetailEntity.java index b33d1267..e718d30a 100644 --- a/buildpackage/src/main/java/com/hzya/frame/plugin/lets/ofs/entity/OfsPassiveorderDetailEntity.java +++ b/buildpackage/src/main/java/com/hzya/frame/plugin/lets/ofs/entity/OfsPassiveorderDetailEntity.java @@ -129,6 +129,16 @@ public class OfsPassiveorderDetailEntity extends BaseEntity { // private String ofsId; + private String def11; + + public String getDef11() { + return def11; + } + + public void setDef11(String def11) { + this.def11 = def11; + } + public String getDef1() { return def1; } diff --git a/buildpackage/src/main/java/com/hzya/frame/plugin/lets/ofs/entity/OfsPassiveorderDetailEntity.xml b/buildpackage/src/main/java/com/hzya/frame/plugin/lets/ofs/entity/OfsPassiveorderDetailEntity.xml index ef977817..945eb618 100644 --- a/buildpackage/src/main/java/com/hzya/frame/plugin/lets/ofs/entity/OfsPassiveorderDetailEntity.xml +++ b/buildpackage/src/main/java/com/hzya/frame/plugin/lets/ofs/entity/OfsPassiveorderDetailEntity.xml @@ -287,10 +287,10 @@ - insert into ofs_passiveorder_detail(id,newPushDate, newTransmitInfo, newState, newsystemnumber, newsystemprimary,transactionDate,def1,def2,def3,def4,def5,def6,def7,def8,def9,def10) + insert into ofs_passiveorder_detail(id,newPushDate, newTransmitInfo, newState, newsystemnumber, newsystemprimary,transactionDate,def1,def2,def3,def4,def5,def6,def7,def8,def9,def10,def11) values - (#{entity.id},#{entity.newpushdate},#{entity.newtransmitinfo},#{entity.newstate},#{entity.newsystemnumber},#{entity.newsystemprimary},#{entity.transactionDate},#{entity.def1},#{entity.def2},#{entity.def3},#{entity.def4},#{entity.def5},#{entity.def6},#{entity.def7},#{entity.def8},#{entity.def9},#{entity.def10}) + (#{entity.id},#{entity.newpushdate},#{entity.newtransmitinfo},#{entity.newstate},#{entity.newsystemnumber},#{entity.newsystemprimary},#{entity.transactionDate},#{entity.def1},#{entity.def2},#{entity.def3},#{entity.def4},#{entity.def5},#{entity.def6},#{entity.def7},#{entity.def8},#{entity.def9},#{entity.def10},#{entity.def11}) on duplicate key update id = values(id), @@ -309,15 +309,16 @@ def7 = values(def7), def8 = values(def8), def9 = values(def9), - def10 = values(def10) + def10 = values(def10), + def11 = values(def11) - insert into ofs_passiveorder_detail(id,newPushDate2, newTransmitInfo2, newState2, newsystemnumber2, newsystemprimary2,transactionDate,def1,def2,def3,def4,def5,def6,def7,def8,def9,def10) + insert into ofs_passiveorder_detail(id,newPushDate2, newTransmitInfo2, newState2, newsystemnumber2, newsystemprimary2,transactionDate,def1,def2,def3,def4,def5,def6,def7,def8,def9,def10,def11) values - (#{entity.id},#{entity.newpushdate2},#{entity.newtransmitinfo2},#{entity.newstate2},#{entity.newsystemnumber2},#{entity.newsystemprimary2},#{entity.transactionDate},#{entity.def1},#{entity.def2},#{entity.def3},#{entity.def4},#{entity.def5},#{entity.def6},#{entity.def7},#{entity.def8},#{entity.def9},#{entity.def10}) + (#{entity.id},#{entity.newpushdate2},#{entity.newtransmitinfo2},#{entity.newstate2},#{entity.newsystemnumber2},#{entity.newsystemprimary2},#{entity.transactionDate},#{entity.def1},#{entity.def2},#{entity.def3},#{entity.def4},#{entity.def5},#{entity.def6},#{entity.def7},#{entity.def8},#{entity.def9},#{entity.def10},#{entity.def11}) on duplicate key update id = values(id), @@ -336,7 +337,8 @@ def7 = values(def7), def8 = values(def8), def9 = values(def9), - def10 = values(def10) + def10 = values(def10), + def11 = values(def11) diff --git a/buildpackage/src/main/java/com/hzya/frame/plugin/lets/ofs/entity/TocofsReturngoodsDetailedEntity.xml b/buildpackage/src/main/java/com/hzya/frame/plugin/lets/ofs/entity/TocofsReturngoodsDetailedEntity.xml index 4e6b0c6c..f3b73fc3 100644 --- a/buildpackage/src/main/java/com/hzya/frame/plugin/lets/ofs/entity/TocofsReturngoodsDetailedEntity.xml +++ b/buildpackage/src/main/java/com/hzya/frame/plugin/lets/ofs/entity/TocofsReturngoodsDetailedEntity.xml @@ -891,10 +891,10 @@ - insert into tocofs_returngoods_detailed(id,newPushDate3,newTransmitInfo3,newState3,newSystemNumber3,newSystemPrimary3,def7,def8,def9,def10,def11,def12,def24) + insert into tocofs_returngoods_detailed(id,newPushDate3,newTransmitInfo3,newState3,newSystemNumber3,newSystemPrimary3,def7,def8,def9,def10,def11,def12,def23,def24) values - (#{entity.id},#{entity.newpushdate3},#{entity.newtransmitinfo3},#{entity.newstate3},#{entity.newsystemnumber3},#{entity.newsystemprimary3},#{entity.def7},#{entity.def8},#{entity.def9},#{entity.def10},#{entity.def11},#{entity.def12},#{entity.def24}) + (#{entity.id},#{entity.newpushdate3},#{entity.newtransmitinfo3},#{entity.newstate3},#{entity.newsystemnumber3},#{entity.newsystemprimary3},#{entity.def7},#{entity.def8},#{entity.def9},#{entity.def10},#{entity.def11},#{entity.def12},#{entity.def23},#{entity.def24}) on duplicate key update id = values(id), @@ -909,15 +909,16 @@ def10 = values(def10), def11 = values(def11), def12 = values(def12), + def23 = values(def23), def24 = values(def24) - insert into tocofs_returngoods_detailed(id,newPushDate4,newTransmitInfo4,newState4,newSystemNumber4,newSystemPrimary4,def7,def8,def9,def10,def11,def12,def24) + insert into tocofs_returngoods_detailed(id,newPushDate4,newTransmitInfo4,newState4,newSystemNumber4,newSystemPrimary4,def7,def8,def9,def10,def11,def12,def23,def24) values - (#{entity.id},#{entity.newpushdate4},#{entity.newtransmitinfo4},#{entity.newstate4},#{entity.newsystemnumber4},#{entity.newsystemprimary4},#{entity.def7},#{entity.def8},#{entity.def9},#{entity.def10},#{entity.def11},#{entity.def12},#{entity.def24}) + (#{entity.id},#{entity.newpushdate4},#{entity.newtransmitinfo4},#{entity.newstate4},#{entity.newsystemnumber4},#{entity.newsystemprimary4},#{entity.def7},#{entity.def8},#{entity.def9},#{entity.def10},#{entity.def11},#{entity.def12},#{entity.def23},#{entity.def24}) on duplicate key update id = values(id), @@ -932,6 +933,7 @@ def10 = values(def10), def11 = values(def11), def12 = values(def12), + def23 = values(def23), def24 = values(def24) @@ -960,10 +962,10 @@ - insert into tocofs_returngoods_detailed(id,def13,def14,def15,def16,def17,def7,def8,def9,def10,def11,def12,def24) + insert into tocofs_returngoods_detailed(id,def13,def14,def15,def16,def17,def7,def8,def9,def10,def11,def12,def23,def24) values - (#{entity.id},#{entity.def13},#{entity.def14},#{entity.def15},#{entity.def16},#{entity.def17},#{entity.def7},#{entity.def8},#{entity.def9},#{entity.def10},#{entity.def11},#{entity.def12},#{entity.def24}) + (#{entity.id},#{entity.def13},#{entity.def14},#{entity.def15},#{entity.def16},#{entity.def17},#{entity.def7},#{entity.def8},#{entity.def9},#{entity.def10},#{entity.def11},#{entity.def12},#{entity.def23},#{entity.def24}) on duplicate key update id = values(id), @@ -980,6 +982,7 @@ def11 = values(def11), def12 = values(def12), + def23 = values(def23), def24 = values(def24) diff --git a/buildpackage/src/main/java/com/hzya/frame/plugin/lets/plugin/sales/PassiveWarehouseReceiptToC.java b/buildpackage/src/main/java/com/hzya/frame/plugin/lets/plugin/sales/PassiveWarehouseReceiptToC.java index 68ec76f9..2237ba3a 100644 --- a/buildpackage/src/main/java/com/hzya/frame/plugin/lets/plugin/sales/PassiveWarehouseReceiptToC.java +++ b/buildpackage/src/main/java/com/hzya/frame/plugin/lets/plugin/sales/PassiveWarehouseReceiptToC.java @@ -969,6 +969,12 @@ public class PassiveWarehouseReceiptToC extends PluginBaseEntity { queryAdditionUtil.additional(saleorderRequestChildrenDtoList, bdInvmandocEntity1, bdInvbasdocEntity1, negativeValue, "-1", bdTaxitemsEntity); } } + + //合并后如果数量为0,则过滤掉 + if ("0".equals(passiveStorageSonDetailsDto.getGroupShipQty().stripTrailingZeros().toPlainString())) { + continue; + } + //推送u8c List saleorderRequestDtoList = new ArrayList<>(); saleorderRequestDtoList.add(saleorderRequestDto); @@ -1289,23 +1295,23 @@ public class PassiveWarehouseReceiptToC extends PluginBaseEntity { // BdInvclEntity bdInvclEntity = queryU8CEntityUtil.queryBdInvbasdocByBdInvcl(bdInvbasdocEntity); // BdCostsubjEntity bdCostsubjEntity = queryU8CEntityUtil.queryBdCostsubj(bdInvclEntity); - String tax = new BigDecimal(bdTaxitemsEntity1.getTaxratio()).divide(new BigDecimal(100), 20, BigDecimal.ROUND_HALF_UP).setScale(2, BigDecimal.ROUND_HALF_UP).stripTrailingZeros().toPlainString(); +// String tax = new BigDecimal(bdTaxitemsEntity1.getTaxratio()).divide(new BigDecimal(100), 20, BigDecimal.ROUND_HALF_UP).setScale(2, BigDecimal.ROUND_HALF_UP).stripTrailingZeros().toPlainString(); - BigDecimal noriginalcurprice = null;//无税单价 - BigDecimal noriginalcurmny = null;//无税金额 - BigDecimal noriginalcurtaxprice = null;//含税单价 - BigDecimal noriginalcursummny = null;//价税合计 - BigDecimal noriginalcurtaxmny = null;//税额=价税合计-无税金额 - try { - noriginalcurtaxprice = passiveStorageSonDetailsDto2.getGroupTotalPayAmount().divide(passiveStorageSonDetailsDto2.getGroupShipQty(), 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); - noriginalcurmny = noriginalcurprice.multiply(passiveStorageSonDetailsDto2.getGroupShipQty()).setScale(2, BigDecimal.ROUND_HALF_UP); - noriginalcursummny = noriginalcurtaxprice.multiply(passiveStorageSonDetailsDto2.getGroupShipQty()).setScale(2, BigDecimal.ROUND_HALF_UP); - noriginalcurtaxmny = noriginalcursummny.subtract(noriginalcurmny).setScale(2, BigDecimal.ROUND_HALF_UP); - } catch (Exception e) { - logger.error("TOC退货-确认收入,金额计算错误", e); - Assert.state(false, "U8C红字销售订单,金额计算错误,原因:{}", e.getMessage()); - } +// BigDecimal noriginalcurprice = null;//无税单价 +// BigDecimal noriginalcurmny = null;//无税金额 +// BigDecimal noriginalcurtaxprice = null;//含税单价 +// BigDecimal noriginalcursummny = null;//价税合计 +// BigDecimal noriginalcurtaxmny = null;//税额=价税合计-无税金额 +// try { +// noriginalcurtaxprice = passiveStorageSonDetailsDto2.getGroupTotalPayAmount().divide(passiveStorageSonDetailsDto2.getGroupShipQty(), 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); +// noriginalcurmny = noriginalcurprice.multiply(passiveStorageSonDetailsDto2.getGroupShipQty()).setScale(2, BigDecimal.ROUND_HALF_UP); +// noriginalcursummny = noriginalcurtaxprice.multiply(passiveStorageSonDetailsDto2.getGroupShipQty()).setScale(2, BigDecimal.ROUND_HALF_UP); +// noriginalcurtaxmny = noriginalcursummny.subtract(noriginalcurmny).setScale(2, BigDecimal.ROUND_HALF_UP); +// } catch (Exception e) { +// logger.error("TOC退货-确认收入,金额计算错误", e); +// Assert.state(false, "U8C红字销售订单,金额计算错误,原因:{}", e.getMessage()); +// } // 判断是否为赠品 Boolean isblargessflag = false; @@ -1313,6 +1319,11 @@ public class PassiveWarehouseReceiptToC extends PluginBaseEntity { isblargessflag = true; } + //合并后如果数量为0,则过滤掉 + if ("0".equals(passiveStorageSonDetailsDto2.getGroupShipQty().stripTrailingZeros().toPlainString())) { + continue; + } + SaleorderRequestChildrenDto saleorderRequestChildrenDto = new SaleorderRequestChildrenDto(); saleorderRequestChildrenDto.setBlargessflag(isblargessflag);//是否赠品 saleorderRequestChildrenDto.setCadvisecalbodyid(bdCalbodyEntity.getPkCalbody());//发货库存组织 @@ -1901,7 +1912,7 @@ public class PassiveWarehouseReceiptToC extends PluginBaseEntity { //对比关联时间与交易成功时间,标记时间情况类型 markTimeInMorningEvening(passiveStorageResponseDataList); - //从已经完成各类过滤的无源入库单中提取售后订单 + //从已经完成各类过滤的无源入库单中提取售后订单、销售订单 List rerturnGoodsOrderSearchDataList = new ArrayList<>(); for (PassiveStorageResponse.Data index : passiveStorageResponseDataList) { PassiveStorageResponse.Header header = index.getHeader(); @@ -1910,7 +1921,14 @@ public class PassiveWarehouseReceiptToC extends PluginBaseEntity { //2025年8月7日15:41:09 售后订单关联无源入库单,下面有逻辑需要取到对应无源入库单的关联时间 RerturnGoodsOrderSearchHeader header1 = rerturnGoodsOrderSearchData1.getHeader(); header1.setPassiveStorageResponseData(index); + + //2025年8月15日14:38:37 关联销售订单 + HeaderDetailsDto headerDetailsDto = header.getHeaderDetailsDto(); + if (headerDetailsDto != null) { + header1.setHeaderDetailsDto(headerDetailsDto); + } } + rerturnGoodsOrderSearchDataList.add(rerturnGoodsOrderSearchData1); } @@ -3249,17 +3267,25 @@ public class PassiveWarehouseReceiptToC extends PluginBaseEntity { String newsystemnumber = errorHeaderDetailsDtoDtoV3.getNewsystemnumber(); String newsystemprimary = errorHeaderDetailsDtoDtoV3.getNewsystemprimary(); // String transactionDate = errorHeaderDetailsDtoDtoV3.getTransactionDate(); + HeaderDetailsDto headerDetailsDto = header.getHeaderDetailsDto(); //如果报错内容太长了,则仅保留400个长度,维护数据库性能,缓解资源公平使用 if (newTransmitInfo != null && !"".equals(newTransmitInfo.trim()) && newTransmitInfo.length() >= 400) { newTransmitInfo = newTransmitInfo.substring(0, 400); } + String tradeSuccessAt = null; + if (headerDetailsDto != null && headerDetailsDto.getHeader() != null) { + HeaderDto header1 = headerDetailsDto.getHeader(); + tradeSuccessAt = header1.getTradeSuccessAt(); + } + for (int j = 0; j < details.size(); j++) { PassiveStorageResponse.Details details1 = details.get(j); OfsPassiveorderDetailEntity ofsPassiveorderDetailEntity = new OfsPassiveorderDetailEntity(); ofsPassiveorderDetailEntity.setId(details1.getId()); + ofsPassiveorderDetailEntity.setDef11(tradeSuccessAt); //2025年8月7日15:49:07 这里不保存,保存到mysql底表逻辑会存储该自动 // ofsPassiveorderDetailEntity.setTransactionDate(details1.getRefundedAt()); if (sceneType.equals("stock")) { @@ -3339,6 +3365,18 @@ public class PassiveWarehouseReceiptToC extends PluginBaseEntity { String newsystemprimary = errorHeaderDetailsDtoDtoV4.getNewsystemprimary(); String storageTimeStamp = header.getStorageTimeStamp(); + String tradeSuccessAt = null; + PassiveStorageResponse.Data passiveStorageResponseData = header.getPassiveStorageResponseData(); + if (passiveStorageResponseData != null) { + PassiveStorageResponse.Header header1 = passiveStorageResponseData.getHeader(); + HeaderDetailsDto headerDetailsDto = header1.getHeaderDetailsDto(); + if (headerDetailsDto != null) { + HeaderDto header2 = headerDetailsDto.getHeader(); + tradeSuccessAt = header2.getTradeSuccessAt(); + } + } + + //如果报错内容太长了,则仅保留400个长度,维护数据库性能,缓解资源公平使用 if (newTransmitInfo != null && !"".equals(newTransmitInfo.trim()) && newTransmitInfo.length() >= 400) { newTransmitInfo = newTransmitInfo.substring(0, 400); @@ -3350,6 +3388,7 @@ public class PassiveWarehouseReceiptToC extends PluginBaseEntity { OnlyAfterSalesBEntity onlyAfterSalesBEntity = new OnlyAfterSalesBEntity(); onlyAfterSalesBEntity.setOfsid(rerturnGoodsOrderSearchDetails.getId()); onlyAfterSalesBEntity.setDef7(storageTimeStamp); + onlyAfterSalesBEntity.setDef13(tradeSuccessAt); if ("Y".equals(rerturnGoodsOrderSearchDetails.getNewState())) { onlyAfterSalesBEntity.setDef8(newPushDate); onlyAfterSalesBEntity.setDef9(newTransmitInfo); @@ -3558,8 +3597,19 @@ public class PassiveWarehouseReceiptToC extends PluginBaseEntity { for (int i = 0; i < value.size(); i++) { PassiveStorageSonDetailsDto2 passiveStorageSonDetailsDto2 = value.get(i); + String tradeSuccessAt = null; + RerturnGoodsOrderSearchHeader rerturnGoodsOrderSearchHeader = passiveStorageSonDetailsDto2.getRerturnGoodsOrderSearchHeader(); + if (rerturnGoodsOrderSearchHeader != null) { + HeaderDetailsDto headerDetailsDto = rerturnGoodsOrderSearchHeader.getHeaderDetailsDto(); + if (headerDetailsDto != null) { + HeaderDto header = headerDetailsDto.getHeader(); + tradeSuccessAt = header.getTradeSuccessAt(); + } + } + OnlyAfterSalesBEntity ofsPassiveorderDetailEntity = new OnlyAfterSalesBEntity(); ofsPassiveorderDetailEntity.setOfsid(passiveStorageSonDetailsDto2.getId()); + ofsPassiveorderDetailEntity.setDef13(tradeSuccessAt); ofsPassiveorderDetailEntity.setNewPushDate(getNewDateStr()); ofsPassiveorderDetailEntity.setNewTransmitInfo(finalNewTransmitInfo); diff --git a/buildpackage/src/main/java/com/hzya/frame/plugin/lets/plugin/sales/SoSaleReturnPluginInitializerToC.java b/buildpackage/src/main/java/com/hzya/frame/plugin/lets/plugin/sales/SoSaleReturnPluginInitializerToC.java index 87c7e5b8..884f9106 100644 --- a/buildpackage/src/main/java/com/hzya/frame/plugin/lets/plugin/sales/SoSaleReturnPluginInitializerToC.java +++ b/buildpackage/src/main/java/com/hzya/frame/plugin/lets/plugin/sales/SoSaleReturnPluginInitializerToC.java @@ -887,6 +887,11 @@ public class SoSaleReturnPluginInitializerToC extends PluginBaseEntity { isblargessflag = true; } + //合并后如果数量为0,则过滤掉 + if ("0".equals(goodsRertunSonDetailsDto.getGroupShipQty().stripTrailingZeros().toPlainString())) { + continue; + } + SaleorderRequestChildrenDto saleorderRequestChildrenDto = new SaleorderRequestChildrenDto(); saleorderRequestChildrenDto.setBlargessflag(isblargessflag);//是否赠品 saleorderRequestChildrenDto.setCadvisecalbodyid(bdCalbodyEntity.getPkCalbody());//发货库存组织 @@ -983,6 +988,7 @@ public class SoSaleReturnPluginInitializerToC extends PluginBaseEntity { queryAdditionUtil.additional(saleorderRequestChildrenDtoList, bdInvmandocEntity1, bdInvbasdocEntity1, negativeValue, "-1", bdTaxitemsEntity); } } + if (ProfilesActiveConstant.PUSH_SCENE_TYPE_1.equals(pushScenarioType) || ProfilesActiveConstant.PUSH_SCENE_TYPE_2.equals(pushScenarioType)) { //推送u8c生成红字销售订单 List saleorderRequestDtoList = new ArrayList<>(); @@ -1175,24 +1181,29 @@ public class SoSaleReturnPluginInitializerToC extends PluginBaseEntity { // BdInvclEntity bdInvclEntity = queryU8CEntityUtil.queryBdInvbasdocByBdInvcl(bdInvbasdocEntity); // BdCostsubjEntity bdCostsubjEntity = queryU8CEntityUtil.queryBdCostsubj(bdInvclEntity); - String tax = new BigDecimal(bdTaxitemsEntity1.getTaxratio()).divide(new BigDecimal(100), 20, BigDecimal.ROUND_HALF_UP).setScale(2, BigDecimal.ROUND_HALF_UP).stripTrailingZeros().toPlainString(); - - BigDecimal noriginalcurprice = null;//无税单价 - BigDecimal noriginalcurmny = null;//无税金额 - BigDecimal noriginalcurtaxprice = null;//含税单价 - BigDecimal noriginalcursummny = null;//价税合计 - BigDecimal noriginalcurtaxmny = null;//税额=价税合计-无税金额 - try { - noriginalcurtaxprice = goodsRertunSonDetailsDto.getGroupTotalPayAmount().divide(goodsRertunSonDetailsDto.getGroupShipQty(), 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); - noriginalcurmny = noriginalcurprice.multiply(goodsRertunSonDetailsDto.getGroupShipQty()).setScale(2, BigDecimal.ROUND_HALF_UP); - noriginalcursummny = noriginalcurtaxprice.multiply(goodsRertunSonDetailsDto.getGroupShipQty()).setScale(2, BigDecimal.ROUND_HALF_UP); - noriginalcurtaxmny = noriginalcursummny.subtract(noriginalcurmny).setScale(2, BigDecimal.ROUND_HALF_UP); - } catch (Exception e) { - logger.error("TOC退货-确认收入,金额计算错误", e); - Assert.state(false, "U8C红字销售订单,金额计算错误,原因:{}", e.getMessage()); + //合并后如果数量为0,则过滤掉 + if ("0".equals(goodsRertunSonDetailsDto.getGroupShipQty().stripTrailingZeros().toPlainString())) { + continue; } +// String tax = new BigDecimal(bdTaxitemsEntity1.getTaxratio()).divide(new BigDecimal(100), 20, BigDecimal.ROUND_HALF_UP).setScale(2, BigDecimal.ROUND_HALF_UP).stripTrailingZeros().toPlainString(); + +// BigDecimal noriginalcurprice = null;//无税单价 +// BigDecimal noriginalcurmny = null;//无税金额 +// BigDecimal noriginalcurtaxprice = null;//含税单价 +// BigDecimal noriginalcursummny = null;//价税合计 +// BigDecimal noriginalcurtaxmny = null;//税额=价税合计-无税金额 +// try { +// noriginalcurtaxprice = goodsRertunSonDetailsDto.getGroupTotalPayAmount().divide(goodsRertunSonDetailsDto.getGroupShipQty(), 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); +// noriginalcurmny = noriginalcurprice.multiply(goodsRertunSonDetailsDto.getGroupShipQty()).setScale(2, BigDecimal.ROUND_HALF_UP); +// noriginalcursummny = noriginalcurtaxprice.multiply(goodsRertunSonDetailsDto.getGroupShipQty()).setScale(2, BigDecimal.ROUND_HALF_UP); +// noriginalcurtaxmny = noriginalcursummny.subtract(noriginalcurmny).setScale(2, BigDecimal.ROUND_HALF_UP); +// } catch (Exception e) { +// logger.error("TOC退货-确认收入,金额计算错误", e); +// Assert.state(false, "U8C红字销售订单,金额计算错误,原因:{}", e.getMessage()); +// } + // 判断是否为赠品 Boolean isblargessflag = false; if ("0".equals(goodsRertunSonDetailsDto.getGroupTotalPayAmount().setScale(2, BigDecimal.ROUND_HALF_UP).stripTrailingZeros().toPlainString())) { @@ -1248,7 +1259,7 @@ public class SoSaleReturnPluginInitializerToC extends PluginBaseEntity { saleorderRequestChildrenDtoList.add(saleorderRequestChildrenDto); //如果合并后的金额为0,则不传到U8C - Assert.notNull(goodsRertunSonDetailsDto.getGroupTotalPayAmount(), "goodsRertunSonDetailsDto.getGroupTotalPayAmount()不能为空!"); +// Assert.notNull(goodsRertunSonDetailsDto.getGroupTotalPayAmount(), "goodsRertunSonDetailsDto.getGroupTotalPayAmount()不能为空!"); // BigDecimal groupTotalPayAmount = goodsRertunSonDetailsDto.getGroupTotalPayAmount().setScale(2, BigDecimal.ROUND_HALF_UP); // if ("0".equals(groupTotalPayAmount.stripTrailingZeros().toPlainString())) { // continue; @@ -2648,6 +2659,15 @@ public class SoSaleReturnPluginInitializerToC extends PluginBaseEntity { String newPushDate = errorHeaderDetailsDtoDtoV2.getNewPushDate(); String newTransmitInfo = errorHeaderDetailsDtoDtoV2.getNewTransmitInfo(); + //处理交易成功时间 + String tradeSuccessAt = null; + if (errorHeaderDetailsDtoDtoV2.getHeader() != null && errorHeaderDetailsDtoDtoV2.getHeader().getHeaderDetailsDto() != null) { + StockinOrderSearchResponse.StockinOrder.StockinH header1 = errorHeaderDetailsDtoDtoV2.getHeader(); + com.hzya.frame.ttxofs.dto.ofssalesordersearch.HeaderDetailsDto headerDetailsDto = header1.getHeaderDetailsDto(); + com.hzya.frame.ttxofs.dto.ofssalesordersearch.HeaderDto header2 = headerDetailsDto.getHeader(); + tradeSuccessAt = header2.getTradeSuccessAt(); + } + //如果报错内容太长了,则仅保留500个长度 if (newTransmitInfo != null && !"".equals(newTransmitInfo.trim()) && newTransmitInfo.length() >= 400) { newTransmitInfo = newTransmitInfo.substring(0, 400); @@ -2661,6 +2681,8 @@ public class SoSaleReturnPluginInitializerToC extends PluginBaseEntity { tocofsReturngoodsDetailedEntity.setId(stockinB.getId()); Assert.notNull(stockinB.getStorageTimeStamp(), "入库时间标记不能为空!"); + + tocofsReturngoodsDetailedEntity.setDef23(tradeSuccessAt); tocofsReturngoodsDetailedEntity.setDef24(stockinB.getStorageTimeStamp()); if (sceneType.equals("stock")) { tocofsReturngoodsDetailedEntity.setNewpushdate3(newPushDate); @@ -2747,6 +2769,14 @@ public class SoSaleReturnPluginInitializerToC extends PluginBaseEntity { for (int i = 0; i < sonDetailsDtoList.size(); i++) { GoodsRertunSonDetailsDto goodsRertunSonDetailsDto = sonDetailsDtoList.get(i); + String tradeSuccessAt = null; + if (goodsRertunSonDetailsDto.getReturnGoodSearchHeaderDto() != null && goodsRertunSonDetailsDto.getReturnGoodSearchHeaderDto().getHeaderDetailsDto() != null) { + StockinOrderSearchResponse.StockinOrder.StockinH returnGoodSearchHeaderDto = goodsRertunSonDetailsDto.getReturnGoodSearchHeaderDto(); + com.hzya.frame.ttxofs.dto.ofssalesordersearch.HeaderDetailsDto headerDetailsDto = returnGoodSearchHeaderDto.getHeaderDetailsDto(); + com.hzya.frame.ttxofs.dto.ofssalesordersearch.HeaderDto header = headerDetailsDto.getHeader(); + tradeSuccessAt = header.getTradeSuccessAt(); + } + TocofsReturngoodsDetailedEntity tocofsReturngoodsDetailedEntity = new TocofsReturngoodsDetailedEntity(); tocofsReturngoodsDetailedEntity.setId(goodsRertunSonDetailsDto.getId()); tocofsReturngoodsDetailedEntity.setNewpushdate3(getNewDateStr()); @@ -2762,6 +2792,7 @@ public class SoSaleReturnPluginInitializerToC extends PluginBaseEntity { tocofsReturngoodsDetailedEntity.setNewsystemnumber3(newsystemnumber); tocofsReturngoodsDetailedEntity.setNewsystemprimary3(newsystemprimary); } + tocofsReturngoodsDetailedEntity.setDef23(tradeSuccessAt); tocofsReturngoodsDetailedEntityArrayList.add(tocofsReturngoodsDetailedEntity); } @@ -2811,6 +2842,14 @@ public class SoSaleReturnPluginInitializerToC extends PluginBaseEntity { for (int i = 0; i < sonDetailsDtoList.size(); i++) { GoodsRertunSonDetailsDto goodsRertunSonDetailsDto = sonDetailsDtoList.get(i); + String tradeSuccessAt = null; + if (goodsRertunSonDetailsDto.getHeader() != null && goodsRertunSonDetailsDto.getHeader().getHeaderDetailsDto() != null) { + StockinOrderSearchResponse.StockinOrder.StockinH header = goodsRertunSonDetailsDto.getHeader(); + com.hzya.frame.ttxofs.dto.ofssalesordersearch.HeaderDetailsDto headerDetailsDto = header.getHeaderDetailsDto(); + com.hzya.frame.ttxofs.dto.ofssalesordersearch.HeaderDto header1 = headerDetailsDto.getHeader(); + tradeSuccessAt = header1.getTradeSuccessAt(); + } + TocofsReturngoodsDetailedEntity tocofsReturngoodsDetailedEntity = new TocofsReturngoodsDetailedEntity(); tocofsReturngoodsDetailedEntity.setId(goodsRertunSonDetailsDto.getId()); tocofsReturngoodsDetailedEntity.setNewpushdate4(getNewDateStr()); @@ -2826,6 +2865,7 @@ public class SoSaleReturnPluginInitializerToC extends PluginBaseEntity { tocofsReturngoodsDetailedEntity.setNewsystemnumber4(newsystemnumber); tocofsReturngoodsDetailedEntity.setNewsystemprimary4(newsystemprimary); } + tocofsReturngoodsDetailedEntity.setDef23(tradeSuccessAt); tocofsReturngoodsDetailedEntity.setDef24(storageTimeStamp); tocofsReturngoodsDetailedEntityArrayList.add(tocofsReturngoodsDetailedEntity); } @@ -2875,6 +2915,14 @@ public class SoSaleReturnPluginInitializerToC extends PluginBaseEntity { for (int i = 0; i < sonDetailsDtoList.size(); i++) { GoodsRertunSonDetailsDto goodsRertunSonDetailsDto = sonDetailsDtoList.get(i); + String tradeSuccessAt = null; + if (goodsRertunSonDetailsDto.getHeader() != null && goodsRertunSonDetailsDto.getHeader().getHeaderDetailsDto() != null) { + StockinOrderSearchResponse.StockinOrder.StockinH header = goodsRertunSonDetailsDto.getHeader(); + com.hzya.frame.ttxofs.dto.ofssalesordersearch.HeaderDetailsDto headerDetailsDto = header.getHeaderDetailsDto(); + com.hzya.frame.ttxofs.dto.ofssalesordersearch.HeaderDto header1 = headerDetailsDto.getHeader(); + tradeSuccessAt = header1.getTradeSuccessAt(); + } + TocofsReturngoodsDetailedEntity tocofsReturngoodsDetailedEntity = new TocofsReturngoodsDetailedEntity(); tocofsReturngoodsDetailedEntity.setId(goodsRertunSonDetailsDto.getId()); tocofsReturngoodsDetailedEntity.setDef13(getNewDateStr()); @@ -2887,6 +2935,7 @@ public class SoSaleReturnPluginInitializerToC extends PluginBaseEntity { tocofsReturngoodsDetailedEntity.setDef10(goodsRertunSonDetailsDto.getPayDiscounts()); tocofsReturngoodsDetailedEntity.setDef11(goodsRertunSonDetailsDto.getExpertDiscounts()); tocofsReturngoodsDetailedEntity.setDef12(goodsRertunSonDetailsDto.getMerchantDiscounts()); + tocofsReturngoodsDetailedEntity.setDef23(tradeSuccessAt); tocofsReturngoodsDetailedEntity.setDef24(storageTimeStamp); if (successY.equals(newstate)) { tocofsReturngoodsDetailedEntity.setDef16(newsystemnumber); diff --git a/buildpackage/src/test/java/com/hzya/frame/plugin/lets/plugin/sales/SoSaleReturnPluginInitializerToCTest.java b/buildpackage/src/test/java/com/hzya/frame/plugin/lets/plugin/sales/SoSaleReturnPluginInitializerToCTest.java index a7c63e5b..c95b193c 100644 --- a/buildpackage/src/test/java/com/hzya/frame/plugin/lets/plugin/sales/SoSaleReturnPluginInitializerToCTest.java +++ b/buildpackage/src/test/java/com/hzya/frame/plugin/lets/plugin/sales/SoSaleReturnPluginInitializerToCTest.java @@ -69,7 +69,7 @@ public class SoSaleReturnPluginInitializerToCTest { try { // soSaleReturnPluginInitializerToC.startImplementByTradeTime("2025-04-28 00:00:00", "2025-04-28 23:59:59", "0"); - soSaleReturnPluginInitializerToC.startImplementByCode("LETS-RE2025080200002257", "stock"); + soSaleReturnPluginInitializerToC.startImplementByCode("LETS-RE2025072800003381", "tran"); // soSaleReturnPluginInitializerToC.startImplementStockByTime("2025-01-31 00:00:00", "2025-01-31 23:59:59", "0"); diff --git a/service/src/main/java/com/hzya/frame/ttxofs/dto/returngoodordersearch/RerturnGoodsOrderSearchHeader.java b/service/src/main/java/com/hzya/frame/ttxofs/dto/returngoodordersearch/RerturnGoodsOrderSearchHeader.java index 739c85c3..58a59a63 100755 --- a/service/src/main/java/com/hzya/frame/ttxofs/dto/returngoodordersearch/RerturnGoodsOrderSearchHeader.java +++ b/service/src/main/java/com/hzya/frame/ttxofs/dto/returngoodordersearch/RerturnGoodsOrderSearchHeader.java @@ -83,4 +83,6 @@ public class RerturnGoodsOrderSearchHeader { private String storageTimeStamp;//时间类型标记 private PassiveStorageResponse.Data passiveStorageResponseData;//关联的无源入库单对象 + + private com.hzya.frame.ttxofs.dto.ofssalesordersearch.HeaderDetailsDto headerDetailsDto;//销售订单对象 } \ No newline at end of file