From f2c08a520e8f82e4dc71d47bf94f2581af98134a Mon Sep 17 00:00:00 2001 From: liuy <37787198+LiuyCodes@users.noreply.github.com> Date: Thu, 15 Aug 2024 16:03:22 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E6=8F=90=E4=BA=A4core?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/hzya/frame/WarStartApplication.java | 2 +- .../plugin/lets/entity/BdTaxitemsEntity.xml | 3 + .../lets/ofsvo/QueryOfsSoSaleOutVo.java | 75 +- .../sales/SoSaleOutPluginInitializerToB.java | 197 +---- .../sales/SoSaleOutPluginInitializerToC.java | 24 +- .../SoSaleReturnPluginInitializerToB.java | 810 ++++++++++++++++++ .../SoSaleReturnPluginInitializerToC.java | 14 +- .../lets/u8cdto/OrderOutTobHeaderDto.java | 4 + .../plugin/lets/u8cdto/OrderToBHeaderDto.java | 93 ++ .../plugin/lets/u8cdto/SonDetailsDto.java | 13 + .../util/TocOrderBasicArchivesCacheUtil.java | 21 + .../util/TocReturnBasicArchivesCacheUtil.java | 21 + ...ring-sowow-dao.xml => spring-lets-dao.xml} | 0 ...owow-plugin.xml => spring-lets-plugin.xml} | 4 +- ...ow-service.xml => spring-lets-service.xml} | 0 .../frame/ttxofs/basics/InterfaceBasics.java | 2 +- .../frame/ttxofs/dto/InterfaceParamDto.java | 5 +- 17 files changed, 1048 insertions(+), 240 deletions(-) create mode 100644 buildpackage/src/main/java/com/hzya/frame/plugin/lets/plugin/sales/SoSaleReturnPluginInitializerToB.java create mode 100644 buildpackage/src/main/java/com/hzya/frame/plugin/lets/u8cdto/OrderToBHeaderDto.java rename buildpackage/src/main/resources/cfgHome/plugin/lets/spring/{spring-sowow-dao.xml => spring-lets-dao.xml} (100%) rename buildpackage/src/main/resources/cfgHome/plugin/lets/spring/{spring-sowow-plugin.xml => spring-lets-plugin.xml} (93%) rename buildpackage/src/main/resources/cfgHome/plugin/lets/spring/{spring-sowow-service.xml => spring-lets-service.xml} (100%) diff --git a/buildpackage/src/main/java/com/hzya/frame/WarStartApplication.java b/buildpackage/src/main/java/com/hzya/frame/WarStartApplication.java index fc8205ec..8dd5698c 100644 --- a/buildpackage/src/main/java/com/hzya/frame/WarStartApplication.java +++ b/buildpackage/src/main/java/com/hzya/frame/WarStartApplication.java @@ -6,7 +6,7 @@ import org.springframework.boot.web.servlet.support.SpringBootServletInitializer /*** * @Content:War启动类 继承SpringBootServletInitializer 初始化servlet 环境 * @Author 👻👻👻👻👻👻👻👻 gjh - * @Date 2022-11-29 14:27 + * @Date 2022-11-29 14:27 * @Param * @return **/ diff --git a/buildpackage/src/main/java/com/hzya/frame/plugin/lets/entity/BdTaxitemsEntity.xml b/buildpackage/src/main/java/com/hzya/frame/plugin/lets/entity/BdTaxitemsEntity.xml index 3bcc29d9..53dd9574 100644 --- a/buildpackage/src/main/java/com/hzya/frame/plugin/lets/entity/BdTaxitemsEntity.xml +++ b/buildpackage/src/main/java/com/hzya/frame/plugin/lets/entity/BdTaxitemsEntity.xml @@ -203,6 +203,9 @@ WHERE bd_invbasdoc.dr = 0 and bd_taxitems.dr = 0 + + and bd_invbasdoc.invcode = #{invcode} + \ No newline at end of file diff --git a/buildpackage/src/main/java/com/hzya/frame/plugin/lets/ofsvo/QueryOfsSoSaleOutVo.java b/buildpackage/src/main/java/com/hzya/frame/plugin/lets/ofsvo/QueryOfsSoSaleOutVo.java index cf505678..1d9e475b 100644 --- a/buildpackage/src/main/java/com/hzya/frame/plugin/lets/ofsvo/QueryOfsSoSaleOutVo.java +++ b/buildpackage/src/main/java/com/hzya/frame/plugin/lets/ofsvo/QueryOfsSoSaleOutVo.java @@ -1,5 +1,7 @@ package com.hzya.frame.plugin.lets.ofsvo; +import lombok.Data; + /** * @Author:liuyang * @Package:com.hzya.frame.plugin.lets.ofsvo @@ -8,6 +10,7 @@ package com.hzya.frame.plugin.lets.ofsvo; * @Date:2024/7/31 18:40 * @Filename:QueryOfsSoSaleOutVo */ +@Data public class QueryOfsSoSaleOutVo { private String created_start; @@ -28,75 +31,7 @@ public class QueryOfsSoSaleOutVo { private String code; - public String getCode() { - return code; - } + private String shipAt_start; - public void setCode(String code) { - this.code = code; - } - - public String getInternalInstructionType() { - return internalInstructionType; - } - - public void setInternalInstructionType(String internalInstructionType) { - this.internalInstructionType = internalInstructionType; - } - - public String getCreated_start() { - return created_start; - } - - public void setCreated_start(String created_start) { - this.created_start = created_start; - } - - public String getCreated_end() { - return created_end; - } - - public void setCreated_end(String created_end) { - this.created_end = created_end; - } - - public String getClientCode() { - return clientCode; - } - - public void setClientCode(String clientCode) { - this.clientCode = clientCode; - } - - public String getCompanyCode() { - return companyCode; - } - - public void setCompanyCode(String companyCode) { - this.companyCode = companyCode; - } - - public Long getStatus() { - return status; - } - - public void setStatus(Long status) { - this.status = status; - } - - public Long getPageNo() { - return pageNo; - } - - public void setPageNo(Long pageNo) { - this.pageNo = pageNo; - } - - public Long getPageSize() { - return pageSize; - } - - public void setPageSize(Long pageSize) { - this.pageSize = pageSize; - } + private String shipAt_end; } 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 3a9ff38d..14e81275 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 @@ -50,8 +50,6 @@ public class SoSaleOutPluginInitializerToB extends PluginBaseEntity { Logger logger = LoggerFactory.getLogger(SoSaleOutPluginInitializerToB.class); - private static final ReentrantLock LOCK = new ReentrantLock(true); - @Autowired private IBdCorpDao iBdCorpDao; @@ -102,9 +100,6 @@ public class SoSaleOutPluginInitializerToB extends PluginBaseEntity { @Autowired private IBdCalbodyDao iBdCalbodyDao; - @Autowired - private TocOrderBasicArchivesCacheUtil basicArchivesCacheUtil; - @Autowired private ITocofsSaleoutDao iTocofsSaleoutDao; @@ -120,10 +115,6 @@ public class SoSaleOutPluginInitializerToB extends PluginBaseEntity { @Autowired private IBdSalestruDao iBdSalestruDao; - private static final String NOTHING = "无"; - - private static final String ADD = "+"; - @Autowired private IBdCumandocDao iBdCumandocDao; @@ -151,15 +142,14 @@ public class SoSaleOutPluginInitializerToB extends PluginBaseEntity { Thread thread = new Thread(new Runnable() { @Override public void run() { - LOCK.lock(); try { // TODO 注意过滤TOB店铺 CalculateDateVo calculateDateVo = DateStrUtil.calculateCalculateEntireDayPeriod(dateStr); List headerDetailsDtoList = new ArrayList<>(); QueryOfsSoSaleOutVo queryOfsSoSaleOutVo = new QueryOfsSoSaleOutVo(); - queryOfsSoSaleOutVo.setCreated_start("2024-01-02 00:58:22"); - queryOfsSoSaleOutVo.setCreated_end("2024-01-02 11:58:23"); + queryOfsSoSaleOutVo.setCreated_start("2024-01-02 11:58:20"); + queryOfsSoSaleOutVo.setCreated_end("2024-01-02 11:58:22"); queryOfsSoSaleOutVo.setClientCode("LETS"); // queryOfsSoSaleOutVo.setInternalInstructionType("SALES"); queryOfsSoSaleOutVo.setCompanyCode("SHLZ"); @@ -181,8 +171,6 @@ public class SoSaleOutPluginInitializerToB extends PluginBaseEntity { } } catch (Exception e) { logger.error("startImplement方法抛出异常", e); - } finally { - LOCK.unlock(); } } }, threadNameStr); @@ -347,6 +335,8 @@ public class SoSaleOutPluginInitializerToB extends PluginBaseEntity { BdDefdocEntity platformArchives = orderOutTobHeaderDto.getPlatformArchives(); //生成业务日期 String generateBusinessDate = createGenerateBusinessDate(orderOutTobHeaderDto); + //店铺 + BdDefdocEntity shopArchives = orderOutTobHeaderDto.getShopArchives(); SaleorderRequestDto saleorderRequestDto = new SaleorderRequestDto(); SaleorderRequestParentDto saleorderRequestParentDto = new SaleorderRequestParentDto(); @@ -374,7 +364,9 @@ public class SoSaleOutPluginInitializerToB extends PluginBaseEntity { saleorderRequestParentDto.setPk_defdoc2(platformArchives.getPkDefdoc()); saleorderRequestParentDto.setVdef2(platformArchives.getDocname()); - //TODO 2024年8月8日 17:17:58 店铺档案自定义项1,先不传,后续维护好之后再传! + //店铺 + saleorderRequestParentDto.setPk_defdoc1(shopArchives.getPkDefdoc()); + saleorderRequestParentDto.setVdef1(shopArchives.getDocname()); saleorderRequestDto.setParentvo(saleorderRequestParentDto); @@ -475,24 +467,22 @@ public class SoSaleOutPluginInitializerToB extends PluginBaseEntity { * @author liuyang */ private String createGenerateBusinessDate(OrderOutTobHeaderDto orderOutTobHeaderDto) { - return "2024-08-13"; - //TODO 测试 -// if (orderOutTobHeaderDto != null && orderOutTobHeaderDto.getHeader() != null && orderOutTobHeaderDto.getHeader().getShipAt() != null) { -// HeaderDto header = orderOutTobHeaderDto.getHeader(); -// String shipAt = header.getShipAt(); -// String businessFormat = null; -// try { -// Date dbill = DateUtil.parse(shipAt); -// businessFormat = DateUtil.format(dbill, "yyyy-MM-dd"); -// } catch (Exception e) { -// logger.error("业务日期生成失败", e); -// } -// return businessFormat; -// } else { -// logger.error("生成出库日期失败,或者shipAt为空! json:{}", JSON.toJSON(orderOutTobHeaderDto)); -// Assert.state(false, "生成出库日期失败,或者shipAt为空! json:{}", JSON.toJSON(orderOutTobHeaderDto)); -// return null; -// } + if (orderOutTobHeaderDto != null && orderOutTobHeaderDto.getHeader() != null && orderOutTobHeaderDto.getHeader().getShipAt() != null) { + HeaderDto header = orderOutTobHeaderDto.getHeader(); + String shipAt = header.getShipAt(); + String businessFormat = null; + try { + Date dbill = DateUtil.parse(shipAt); + businessFormat = DateUtil.format(dbill, "yyyy-MM-dd"); + } catch (Exception e) { + logger.error("业务日期生成失败", e); + } + return businessFormat; + } else { + logger.error("生成出库日期失败,或者shipAt为空! json:{}", JSON.toJSON(orderOutTobHeaderDto)); + Assert.state(false, "生成出库日期失败,或者shipAt为空! json:{}", JSON.toJSON(orderOutTobHeaderDto)); + return null; + } } /** @@ -565,6 +555,7 @@ public class SoSaleOutPluginInitializerToB extends PluginBaseEntity { } //业务部门 + //2024年8月14日 10:38:37 已经和佳妮确认 String deptName = "其他部门"; BdDeptdocEntity bdDeptdocEntity = new BdDeptdocEntity(); bdDeptdocEntity.setDataSourceCode("lets_u8c"); @@ -609,6 +600,21 @@ public class SoSaleOutPluginInitializerToB extends PluginBaseEntity { Assert.state(false, "根据O平台编码{},无法匹配到U8C平台自定义档案 自定义档案主键:{}", sourcePlatformCode, platformZdyId); } + //查询U8C店铺档案 + String platformZdyId2 = "0001A210000000000XZX"; + String ofsStoreCode = header.getStoreCode(); + BdDefdocEntity bdDefdocEntity2 = new BdDefdocEntity(); + bdDefdocEntity2.setPkDefdoclist(platformZdyId2); + bdDefdocEntity2.setDr(0); + bdDefdocEntity2.setDataSourceCode("lets_u8c"); + bdDefdocEntity2.setDoccode(ofsStoreCode); + List bdDefdocEntityList2 = iBdDefdocDao.query(bdDefdocEntity2); + if (bdDefdocEntityList2.size() == 0) { + Assert.state(false, "根据O店铺编码{},无法匹配到U8C店铺自定义档案 自定义档案主键:{}", ofsStoreCode, platformZdyId); + } else if (bdDefdocEntityList2.size() >= 2) { + Assert.state(false, "根据O店铺编码{},无法匹配到U8C店铺自定义档案 自定义档案主键:{}", ofsStoreCode, platformZdyId); + } + OrderOutTobHeaderDto orderOutTobHeaderDto = new OrderOutTobHeaderDto(); orderOutTobHeaderDto.setBdCorpEntity(bdCorpEntityList.get(0)); orderOutTobHeaderDto.setBdCalbodyEntity(bdCalbodyEntities.get(0)); @@ -619,6 +625,7 @@ public class SoSaleOutPluginInitializerToB extends PluginBaseEntity { orderOutTobHeaderDto.setBdCubasdocEntity(bdCubasdocEntityList.get(0)); orderOutTobHeaderDto.setDeliverGoodsCorp(bdCorpEntityList.get(0)); orderOutTobHeaderDto.setPlatformArchives(bdDefdocEntityList.get(0)); + orderOutTobHeaderDto.setShopArchives(bdDefdocEntityList2.get(0)); orderOutTobHeaderDto.setHeader(header); orderOutTobHeaderDto.setDetails(details); @@ -674,73 +681,6 @@ public class SoSaleOutPluginInitializerToB extends PluginBaseEntity { return tocofsSaleoutDetailedEntityArrayList; } - /** - * 分组汇总:公司+店铺+仓库+SKU+出库类型,数量合并相加 - * - * @author liuyang - */ - private Map> groupSummary(List sonDetailsDtoList) { - if (sonDetailsDtoList != null && sonDetailsDtoList.size() > 0) { - for (int i = 0; i < sonDetailsDtoList.size(); i++) { - SonDetailsDto sonDetailsDto = sonDetailsDtoList.get(i); - //2024年8月6日 10:35:25表头对象用于带出表头相关的分组汇总信息 - HeaderDto header = sonDetailsDto.getHeader(); - - //公司 - BdCorpEntity bdCorpEntity = sonDetailsDto.getBdCorpEntity(); - //店铺(主要是店铺编码) - String storeCode = header.getStoreCode(); - //仓库 - String facilityCode = header.getFacilityCode(); - //SKU - String skuCode = sonDetailsDto.getSkuCode(); - //出库类型 - String refOrderType = header.getRefOrderType(); - - StringBuffer summaryDimensionStr = new StringBuffer(); - if (bdCorpEntity != null && bdCorpEntity.getPkCorp() != null) { - summaryDimensionStr.append(bdCorpEntity.getPkCorp()); - } else { - summaryDimensionStr.append(NOTHING); - } - summaryDimensionStr.append(ADD); - - if (storeCode != null && !"".equals(storeCode)) { - summaryDimensionStr.append(storeCode); - } else { - summaryDimensionStr.append(NOTHING); - } - summaryDimensionStr.append(ADD); - - if (facilityCode != null && !"".equals(facilityCode)) { - summaryDimensionStr.append(facilityCode); - } else { - summaryDimensionStr.append(NOTHING); - } - summaryDimensionStr.append(ADD); - - if (skuCode != null && !"".equals(skuCode)) { - summaryDimensionStr.append(skuCode); - } else { - summaryDimensionStr.append(NOTHING); - } - summaryDimensionStr.append(ADD); - - if (refOrderType != null && !"".equals(refOrderType)) { - summaryDimensionStr.append(refOrderType); - } else { - summaryDimensionStr.append(NOTHING); - } - - sonDetailsDto.setSummaryDimensionStr(summaryDimensionStr.toString()); - } - logger.info("TOB:{}个出库单对象需要汇总", sonDetailsDtoList.size()); - return sonDetailsDtoList.stream().collect(Collectors.groupingBy(SonDetailsDto::getSummaryDimensionStr)); - } - logger.info("TOB:0个对象需要汇总"); - return null; - } - /** * 2024年8月6日 10:59:03 查询U8C业务流程 * @@ -755,25 +695,6 @@ public class SoSaleOutPluginInitializerToB extends PluginBaseEntity { return bdBusitypeEntity; } - /** - * 检查参数是否为空 - * 2024年8月6日 11:40:19 保险的做法,最好还是验证一下 - * - * @author liuyang - */ - private void checkArchives(SonDetailsDto sonDetailsDto) { - Assert.notNull(sonDetailsDto, "sonDetailsDto不能为空 对象json:{}", JSON.toJSONString(sonDetailsDto)); - Assert.notNull(sonDetailsDto.getHeader(), "header对象不能为空 对象json:{}", JSON.toJSONString(sonDetailsDto)); - Assert.notNull(sonDetailsDto.getBdCorpEntity(), "表头公司不能为空 对象json:{}", JSON.toJSONString(sonDetailsDto)); - Assert.notNull(sonDetailsDto.getBdCalbodyEntity(), "发货库存组织不能为空 对象json:{}", JSON.toJSONString(sonDetailsDto)); - Assert.notNull(sonDetailsDto.getBdStordocEntity(), "发货仓库不能为空 对象json:{}", JSON.toJSONString(sonDetailsDto)); - Assert.notNull(sonDetailsDto.getBdCalbodyEntity1(), "收货库存组织不能为空 对象json:{}", JSON.toJSONString(sonDetailsDto)); - Assert.notNull(sonDetailsDto.getBdStordocEntity1(), "收货库存不能为空 对象json:{}", JSON.toJSONString(sonDetailsDto)); - Assert.notNull(sonDetailsDto.getBdSalestruEntity(), "销售组织不能为空 对象json:{}", JSON.toJSONString(sonDetailsDto)); - Assert.notNull(sonDetailsDto.getBdDeptdocEntity(), "业务部门不能为空 对象json:{}", JSON.toJSONString(sonDetailsDto)); - Assert.notNull(sonDetailsDto.getBdCumandocEntity(), "客商档案不能为空 对象json:{}", JSON.toJSONString(sonDetailsDto)); - } - /** * 查询存货管理档案 * @@ -798,40 +719,6 @@ public class SoSaleOutPluginInitializerToB extends PluginBaseEntity { return bdInvmandocEntity2.get(0); } - /** - * 合并明细行 - * 单价计算公式:sum(实付金额/实发数量) 最后除以条数 - * - * @author liuyang - */ - private SonDetailsDto groupMergeDetailedRows(List sonDetailsDtoList) throws Exception { - if (sonDetailsDtoList != null && sonDetailsDtoList.size() > 0) { - BigDecimal groupTotalPayAmount = new BigDecimal("0"); - BigDecimal groupShipQty = new BigDecimal("0"); - - for (int i = 0; i < sonDetailsDtoList.size(); i++) { - SonDetailsDto sonDetailsDto = sonDetailsDtoList.get(i); - - //实付金额/实发数量 - Assert.notNull(sonDetailsDto.getTotalPayAmount(), "实付金额不能为空 明细行对象:{}", JSON.toJSONString(sonDetailsDto)); - Assert.notNull(sonDetailsDto.getShipQty(), "实发数量不能为空 明细行对象:{}", JSON.toJSONString(sonDetailsDto)); - BigDecimal totalPayAmountBigDecimal = new BigDecimal(sonDetailsDto.getTotalPayAmount()); - BigDecimal shipQtyBigDecimal = new BigDecimal(sonDetailsDto.getShipQty()); - - groupTotalPayAmount = groupTotalPayAmount.add(totalPayAmountBigDecimal); - groupShipQty = groupShipQty.add(shipQtyBigDecimal); - } - SonDetailsDto sonDetailsDto = sonDetailsDtoList.get(0); - sonDetailsDto.setGroupShipQty(groupShipQty); - sonDetailsDto.setGroupTotalPayAmount(groupTotalPayAmount); - logger.info("{}个明细行发生了合并!", sonDetailsDtoList.size()); - return sonDetailsDto; - } else { - logger.info("sonDetailsDtoList集合是空的!"); - } - return null; - } - /** * 2024年8月7日 10:25:29 * 查询基础档案,根据公司、管理档案主键查询 @@ -851,7 +738,7 @@ public class SoSaleOutPluginInitializerToB extends PluginBaseEntity { } else if (bdInvbasdocEntity2.size() >= 2) { Assert.state(false, "根据存货管理档案主键{}和公司档案主键{}没有查询到U8C基础档案", pkInvmandoc, pkCorp); } - return bdInvbasdocEntity; + return bdInvbasdocEntity2.get(0); } /** @@ -869,7 +756,7 @@ public class SoSaleOutPluginInitializerToB extends PluginBaseEntity { if (bdTaxitemsEntityList.size() == 0) { Assert.state(false, "根据存货编码{}没有查询到U8C税目档案", invcode); } else if (bdTaxitemsEntityList.size() >= 2) { - Assert.state(false, "根据存货编码{}没有查询到U8C税目档案", invcode); + Assert.state(false, "根据存货编码{}查询到{}个U8C税目档案", invcode, bdTaxitemsEntityList.size()); } return bdTaxitemsEntityList.get(0); } diff --git a/buildpackage/src/main/java/com/hzya/frame/plugin/lets/plugin/sales/SoSaleOutPluginInitializerToC.java b/buildpackage/src/main/java/com/hzya/frame/plugin/lets/plugin/sales/SoSaleOutPluginInitializerToC.java index 4774007b..12808442 100644 --- a/buildpackage/src/main/java/com/hzya/frame/plugin/lets/plugin/sales/SoSaleOutPluginInitializerToC.java +++ b/buildpackage/src/main/java/com/hzya/frame/plugin/lets/plugin/sales/SoSaleOutPluginInitializerToC.java @@ -126,15 +126,15 @@ public class SoSaleOutPluginInitializerToC extends PluginBaseEntity { List headerDetailsDtoList = new ArrayList<>(); QueryOfsSoSaleOutVo queryOfsSoSaleOutVo = new QueryOfsSoSaleOutVo(); - queryOfsSoSaleOutVo.setCreated_start("2024-07-05 16:38:00"); - queryOfsSoSaleOutVo.setCreated_end("2024-07-05 16:40:30"); + queryOfsSoSaleOutVo.setShipAt_start("2024-07-05 16:38:00"); + queryOfsSoSaleOutVo.setShipAt_end("2024-07-05 16:50:30"); queryOfsSoSaleOutVo.setClientCode("LETS"); - // queryOfsSoSaleOutVo.setInternalInstructionType("SALES"); - queryOfsSoSaleOutVo.setCompanyCode("SHLZ"); - // queryOfsSoSaleOutVo.setStatus(900L); + queryOfsSoSaleOutVo.setInternalInstructionType("SALES"); +// queryOfsSoSaleOutVo.setCompanyCode("SHLZ"); + queryOfsSoSaleOutVo.setStatus(510L); queryOfsSoSaleOutVo.setPageNo(1L); queryOfsSoSaleOutVo.setPageSize(50L); - queryOfsSoSaleOutVo.setCode("LETS-SH2024070500000003"); +// queryOfsSoSaleOutVo.setCode("LETS-SH2024070500000003"); queryOfsSaleOrder(queryOfsSoSaleOutVo, headerDetailsDtoList, 1L); logger.info("数据返回行数:{}", headerDetailsDtoList.size()); if (headerDetailsDtoList.size() > 0) { @@ -314,6 +314,7 @@ public class SoSaleOutPluginInitializerToC extends PluginBaseEntity { BdCumandocEntity bdCumandocEntity = oldValue.get(0).getBdCumandocEntity();//客商管理档案 BdCubasdocEntity bdCubasdocEntity = oldValue.get(0).getBdCubasdocEntity();//客商基本档案 BdDefdocEntity platformArchives = oldValue.get(0).getPlatformArchives();//U8C平台档案 + BdDefdocEntity shopArchives = oldValue.get(0).getShopArchives();//U8C店铺档案 try { checkArchives(oldValue.get(0)); @@ -345,6 +346,10 @@ public class SoSaleOutPluginInitializerToC extends PluginBaseEntity { saleorderRequestParentDto.setPk_defdoc2(platformArchives.getPkDefdoc()); saleorderRequestParentDto.setVdef2(platformArchives.getDocname()); + //店铺 + saleorderRequestParentDto.setPk_defdoc1(shopArchives.getPkDefdoc()); + saleorderRequestParentDto.setVdef1(shopArchives.getDocname()); + //TODO 2024年8月8日 17:17:58 店铺档案自定义项1,先不传,后续维护好之后再传! saleorderRequestDto.setParentvo(saleorderRequestParentDto); @@ -528,7 +533,11 @@ public class SoSaleOutPluginInitializerToC extends PluginBaseEntity { //查找平台 BdDefdocEntity bdDefdocEntity = TocOrderBasicArchivesCacheUtil.stringBdDefdocEntityHashMap.get(header.getSourcePlatformCode()); - Assert.notNull(bdDefdocEntity, "根据O平台编码({})无法匹配到平台", header.getSourcePlatformCode()); + Assert.notNull(bdDefdocEntity, "根据O平台编码({})无法匹配到U8C平台自定义档案", header.getSourcePlatformCode()); + + //查找店铺 + BdDefdocEntity bdDefdocEntity1 = TocOrderBasicArchivesCacheUtil.shopDefdocEntityHashMap.get(header.getStoreCode()); + Assert.notNull(bdDefdocEntity1, "根据O店铺编码({})无法匹配到U8C店铺自定义档案", header.getStoreCode()); //字段拷贝 for (int j = 0; j < details.size(); j++) { @@ -549,6 +558,7 @@ public class SoSaleOutPluginInitializerToC extends PluginBaseEntity { sonDetailsDto.setBdCumandocEntity(bdCumandocEntity); sonDetailsDto.setBdCubasdocEntity(bdCubasdocEntity); sonDetailsDto.setPlatformArchives(bdDefdocEntity); + sonDetailsDto.setShopArchives(bdDefdocEntity1); BeanUtil.copyPropertiesV2(detailsDto, sonDetailsDto); sonDetailsDtoList.add(sonDetailsDto); 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 new file mode 100644 index 00000000..058c2820 --- /dev/null +++ b/buildpackage/src/main/java/com/hzya/frame/plugin/lets/plugin/sales/SoSaleReturnPluginInitializerToB.java @@ -0,0 +1,810 @@ +package com.hzya.frame.plugin.lets.plugin.sales; + +import cn.hutool.core.date.DateUtil; +import cn.hutool.core.lang.Assert; +import cn.hutool.core.util.StrUtil; +import cn.hutool.http.HttpRequest; +import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.JSONObject; +import com.hzya.frame.base.PluginBaseEntity; +import com.hzya.frame.beanutil.BeanUtil; +import com.hzya.frame.plugin.lets.constant.ExportConstant; +import com.hzya.frame.plugin.lets.constant.ProfilesActiveConstant; +import com.hzya.frame.plugin.lets.dao.*; +import com.hzya.frame.plugin.lets.entity.*; +import com.hzya.frame.plugin.lets.ofs.dao.ITocofsReturngoodsDao; +import com.hzya.frame.plugin.lets.ofs.dao.ITocofsReturngoodsDetailedDao; +import com.hzya.frame.plugin.lets.ofs.dao.ITocofsSaleoutDetailedDao; +import com.hzya.frame.plugin.lets.ofs.entity.TocofsReturngoodsDetailedEntity; +import com.hzya.frame.plugin.lets.ofs.entity.TocofsReturngoodsEntity; +import com.hzya.frame.plugin.lets.ofs.entity.TocofsSaleoutDetailedEntity; +import com.hzya.frame.plugin.lets.ofsvo.QueryOfsSoSaleOutVo; +import com.hzya.frame.plugin.lets.resultvo.CalculateDateVo; +import com.hzya.frame.plugin.lets.u8cdto.*; +import com.hzya.frame.plugin.lets.util.DateStrUtil; +import com.hzya.frame.plugin.lets.util.QueryBdBusitypeUtil; +import com.hzya.frame.split.SplitListByCountUtil; +import com.hzya.frame.ttxofs.dto.InterfaceParamDto; +import com.hzya.frame.ttxofs.dto.ofssaleorderoutsearch.DetailsDto; +import com.hzya.frame.ttxofs.dto.ofssaleorderoutsearch.HeaderDetailsDto; +import com.hzya.frame.ttxofs.dto.ofssaleorderoutsearch.HeaderDto; +import com.hzya.frame.ttxofs.dto.returngoodsearch.RertunGoodsRootBean; +import com.hzya.frame.ttxofs.dto.returngoodsearch.ReturnGoodHeaderDetailsDataDto; +import com.hzya.frame.ttxofs.dto.returngoodsearch.ReturnGoodSearchDetailsDto; +import com.hzya.frame.ttxofs.dto.returngoodsearch.ReturnGoodSearchHeaderDto; +import com.hzya.frame.ttxofs.service.OfsUnifiedService; +import com.hzya.frame.web.entity.JsonResultEntity; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; + +import java.math.BigDecimal; +import java.util.*; +import java.util.stream.Collectors; + +/** + * OFS售后入库单(TOB)生成U8C红字销售订单 + * + * @author makejava + * @since 2024年8月12日 15:03:51 + */ +public class SoSaleReturnPluginInitializerToB extends PluginBaseEntity { + + Logger logger = LoggerFactory.getLogger(SoSaleReturnPluginInitializerToB.class); + + @Autowired + private IBdCorpDao iBdCorpDao; + + @Autowired + private IBdInvbasdocDao iBdInvbasdocDao; + + @Override + public void initialize() { + logger.info(getPluginLabel() + "執行初始化方法initialize()"); + } + + @Override + public void destroy() { + logger.info(getPluginLabel() + "執行銷毀方法destroy()"); + } + + @Override + public String getPluginId() { + return "com.hzya.frame.plugin.lets.plugin.sales.SoSaleReturnPluginInitializerToB"; + } + + @Override + public String getPluginName() { + return "OFS售后入库单(TOB)生成U8C红字销售订单"; + } + + @Override + public String getPluginLabel() { + return "OFS售后入库单(TOB)生成U8C红字销售订单"; + } + + @Override + public String getPluginType() { + return "3"; + } + + @Override + public JsonResultEntity executeBusiness(JSONObject requestJson) throws Exception { + return null; + } + + @Autowired + private OfsUnifiedService ofsUnifiedService; + + @Autowired + private IBdTaxitemsDao iBdTaxitemsDao; + + @Autowired + private IBdCalbodyDao iBdCalbodyDao; + + @Autowired + private ITocofsSaleoutDetailedDao iTocofsSaleoutDetailedDao; + + @Autowired + private QueryBdBusitypeUtil queryBdBusitypeUtil; + + @Autowired + private IBdStordocDao iBdStordocDao; + + @Autowired + private IBdSalestruDao iBdSalestruDao; + + private static final String NOTHING = "无"; + + private static final String ADD = "+"; + + @Autowired + private IBdCumandocDao iBdCumandocDao; + + @Autowired + private IBdDeptdocDao iBdDeptdocDao; + + @Autowired + private IBdCubasdocDao iBdCubasdocDao; + + @Autowired + private IBdDefdocDao iBdDefdocDao; + + @Autowired + private IBdInvmandocDao iBdInvmandocDao; + + @Autowired + private ITocofsReturngoodsDao iTocofsReturngoodsDao; + + @Autowired + private ITocofsReturngoodsDetailedDao iTocofsReturngoodsDetailedDao; + + /** + * 按指定时间拉取 + * + * @author liuyang + */ + public void startImplement(String dateStr, String summaryOrderNumber) { + String threadNameStr = StrUtil.format("OFS售后入库(TOB)同步U8C销售订单 同步日期:{} 汇总维度:{}", dateStr, summaryOrderNumber); + logger.info(threadNameStr); + + Thread thread = new Thread(new Runnable() { + @Override + public void run() { + try { + // TODO 注意过滤TOB店铺 + CalculateDateVo calculateDateVo = DateStrUtil.calculateCalculateEntireDayPeriod(dateStr); + + List returnGoodHeaderDetailsDataDtoArrayList = new ArrayList<>(); + QueryOfsSoSaleOutVo queryOfsSoSaleOutVo = new QueryOfsSoSaleOutVo(); + queryOfsSoSaleOutVo.setCreated_start("2024-07-16 15:35:35"); + queryOfsSoSaleOutVo.setCreated_end("2024-07-16 15:35:37"); + queryOfsSoSaleOutVo.setClientCode("LETS"); + // queryOfsSoSaleOutVo.setInternalInstructionType("SALES"); + queryOfsSoSaleOutVo.setCompanyCode("SHLZ"); + // queryOfsSoSaleOutVo.setStatus(900L); + queryOfsSoSaleOutVo.setPageNo(1L); + queryOfsSoSaleOutVo.setPageSize(50L); + queryOfsSoSaleOutVo.setCode("LETS-RE2024071600000001"); + queryOfsReturnGoods(queryOfsSoSaleOutVo, returnGoodHeaderDetailsDataDtoArrayList, 1L); + logger.info("数据返回行数:{}", returnGoodHeaderDetailsDataDtoArrayList.size()); + if (returnGoodHeaderDetailsDataDtoArrayList.size() > 0) { + //保存到mysql + batchInsert(returnGoodHeaderDetailsDataDtoArrayList); + //过滤成功的数据 + List returnGoodHeaderDetailsDataDtoList = filterData(returnGoodHeaderDetailsDataDtoArrayList); + //执行推送主逻辑 + implement(returnGoodHeaderDetailsDataDtoList); + } else { + logger.info("没有查询到任何数据!不需要同步"); + } + } catch (Exception e) { + logger.error("startImplement方法抛出异常", e); + } + } + }, threadNameStr); + thread.start(); + try { + thread.join(); + } catch (Exception e) { + logger.error("thread.join()异常", e); + } + } + + /** + * 过滤掉成功的数据 + * + * @author liuyang + */ + private List filterData(List headerDetailsDtoList) { + List headerDetailsDtoList1 = new ArrayList<>(); + if (headerDetailsDtoList != null && headerDetailsDtoList.size() > 0) { + //TODO 出库单明细主键,需要O返回,目前没有,已经提需求 + headerDetailsDtoList1.addAll(headerDetailsDtoList); + } + return headerDetailsDtoList1; + } + + /** + * 保存抓取到的数据到mysql底表,如果底表里已经存在,则会忽略 + * + * @param returnGoodHeaderDetailsDataDtoArrayList 数据行 + */ + private void batchInsert(List returnGoodHeaderDetailsDataDtoArrayList) throws Exception { + if (returnGoodHeaderDetailsDataDtoArrayList != null && returnGoodHeaderDetailsDataDtoArrayList.size() > 0) { + List headerDetailsDtoList1 = new ArrayList<>(); + List headerDetailsDtoList2 = new ArrayList<>(); + + for (ReturnGoodHeaderDetailsDataDto index : returnGoodHeaderDetailsDataDtoArrayList) { + ReturnGoodSearchHeaderDto header = index.getHeader();// 主表 + List details = index.getDetails();//明细表 + + headerDetailsDtoList1.add(header); + headerDetailsDtoList2.addAll(details); + } + + //每100作为一个批次插入主表,根据主键(id)判断是否重复,如果重复的,则不进行插入 + List> lists = SplitListByCountUtil.splitListByCount(headerDetailsDtoList1, 100); + for (int i = 0; i < lists.size(); i++) { + List returnGoodSearchHeaderDtos = lists.get(i); + List tocofsReturngoodsEntities = copyHeaderDto(returnGoodSearchHeaderDtos); + if (tocofsReturngoodsEntities.size() > 0) { + logger.info("TocofsReturngoodsEntity:插入底表{}个对象(表头)", tocofsReturngoodsEntities.size()); + iTocofsReturngoodsDao.entityInsertBatchV2(tocofsReturngoodsEntities); + } else { + logger.info("TocofsReturngoodsEntity:没有对象被插入表头底表"); + } + } + + //插入明细表 + List> lists1 = SplitListByCountUtil.splitListByCount(headerDetailsDtoList2, 100); + for (int i = 0; i < lists1.size(); i++) { + List returnGoodSearchDetailsDtos = lists1.get(i); + List tocofsReturngoodsDetailedEntities = copyDetailsDto(returnGoodSearchDetailsDtos); + if (tocofsReturngoodsDetailedEntities.size() > 0) { + logger.info("TocofsReturngoodsDetailedEntity:插入底表{}个对象(表体)", tocofsReturngoodsDetailedEntities.size()); + iTocofsReturngoodsDetailedDao.entityInsertBatchV2(tocofsReturngoodsDetailedEntities); + } else { + logger.info("TocofsReturngoodsDetailedEntity:没有对象被插入表头底表"); + } + } + } + } + + /** + * 查询OFS售后退货入库单 + * + * @param queryOfsSoSaleOutVo 查询参数 + * @param headerDetailsDtoList 查询结果集 + * @param pageNo 从第pageNo页开始查询 + */ + private void queryOfsReturnGoods(QueryOfsSoSaleOutVo queryOfsSoSaleOutVo, List headerDetailsDtoList, Long pageNo) throws Exception { + Long pageSize = 200L; + queryOfsSoSaleOutVo.setPageNo(pageNo); + queryOfsSoSaleOutVo.setPageSize(pageSize); + + InterfaceParamDto interfaceParamDto = new InterfaceParamDto(); + interfaceParamDto.setApi("ofs.receipt.search"); + interfaceParamDto.setData(JSON.toJSONString(queryOfsSoSaleOutVo)); + RertunGoodsRootBean rertunGoodsRootBean = (RertunGoodsRootBean) ofsUnifiedService.unified(interfaceParamDto); + if (rertunGoodsRootBean != null) { + if ("false".equals(rertunGoodsRootBean.getError()) && "0".equals(rertunGoodsRootBean.getCode()) && "Success".equals(rertunGoodsRootBean.getMsg())) { + List returnGoodHeaderDetailsDataDtoList = rertunGoodsRootBean.getData(); + if (returnGoodHeaderDetailsDataDtoList != null && returnGoodHeaderDetailsDataDtoList.size() > 0) { + headerDetailsDtoList.addAll(returnGoodHeaderDetailsDataDtoList); + + //TODO OFS没有提供分页字段,等待开发 + } + } else { + logger.error("查询失败,失败原因:{}", JSON.toJSON(interfaceParamDto)); + } + } else { + logger.error("rertunGoodsRootBean为空!interfaceParamDto对象的结果集json:{}", JSON.toJSON(interfaceParamDto)); + } + } + + /** + * 代码同步逻辑 + * + * @param returnGoodHeaderDetailsDataDtoList 查询得到的O出库单对象 + * @author liuyang + */ + private void implement(List returnGoodHeaderDetailsDataDtoList) throws Exception { + if (returnGoodHeaderDetailsDataDtoList != null && returnGoodHeaderDetailsDataDtoList.size() > 0) { + try { + // 查询基本档案 + List orderToBHeaderDtos = queryBasicArchives(returnGoodHeaderDetailsDataDtoList); + // 查询U8C业务流程 + BdBusitypeEntity bdBusitypeEntity = u8cOperationFlow(); + + try { + for (int i = 0; i < orderToBHeaderDtos.size(); i++) { + OrderToBHeaderDto orderOutTobHeaderDto = orderToBHeaderDtos.get(i); + ReturnGoodSearchHeaderDto header = orderOutTobHeaderDto.getHeader(); + List details = orderOutTobHeaderDto.getDetails(); + + //销售公司、发货公司 + BdCorpEntity bdCorpEntity = orderOutTobHeaderDto.getBdCorpEntity(); + //发货库存组织 + BdCalbodyEntity bdCalbodyEntity = orderOutTobHeaderDto.getBdCalbodyEntity(); + //入库参数 + BdStordocEntity bdStordocEntity = orderOutTobHeaderDto.getBdStordocEntity(); + //销售组织 + BdSalestruEntity bdSalestruEntity = orderOutTobHeaderDto.getBdSalestruEntity(); + //业务部门 + BdDeptdocEntity bdDeptdocEntity = orderOutTobHeaderDto.getBdDeptdocEntity(); + //客商基本档案 + BdCubasdocEntity bdCubasdocEntity = orderOutTobHeaderDto.getBdCubasdocEntity(); + //客商基本档案 + BdCumandocEntity bdCumandocEntity = orderOutTobHeaderDto.getBdCumandocEntity(); + //发货公司 + BdCorpEntity deliverGoodsCorp = orderOutTobHeaderDto.getDeliverGoodsCorp(); + //平台档案 + BdDefdocEntity platformArchives = orderOutTobHeaderDto.getPlatformArchives(); + //U8C店铺档案 + BdDefdocEntity shopArchives = orderOutTobHeaderDto.getShopArchives(); + //生成业务日期 + String generateBusinessDate = createGenerateBusinessDate(orderOutTobHeaderDto); + + SaleorderRequestDto saleorderRequestDto = new SaleorderRequestDto(); + SaleorderRequestParentDto saleorderRequestParentDto = new SaleorderRequestParentDto(); + saleorderRequestParentDto.setDbilldate(generateBusinessDate);//单据日期 + saleorderRequestParentDto.setBretinvflag("Y");//退货标记 + saleorderRequestParentDto.setCbiztype(bdBusitypeEntity.getPkBusitype());//业务流程 + saleorderRequestParentDto.setCcalbodyid(bdCalbodyEntity.getPkCalbody());//库存组织 + saleorderRequestParentDto.setCcustomerid(bdCumandocEntity.getPkCumandoc());//客户=开票单位=收货单位=表体收货单位=收货单位 + saleorderRequestParentDto.setCdeptid(bdDeptdocEntity.getPkDeptdoc());//部门 + saleorderRequestParentDto.setCemployeeid(null);//业务员 + saleorderRequestParentDto.setCoperatorid("0001A110000000000U3D");//制单人 + saleorderRequestParentDto.setCreceiptcorpid(bdCumandocEntity.getPkCumandoc());//开票单位 + saleorderRequestParentDto.setCreceiptcustomerid(bdCumandocEntity.getPkCumandoc());//收货单位 + saleorderRequestParentDto.setCsalecorpid(bdSalestruEntity.getCsalestruid());//销售组织 + saleorderRequestParentDto.setCwarehouseid(bdStordocEntity.getPkStordoc());//仓库 + saleorderRequestParentDto.setDapprovedate(generateBusinessDate);//审核日期 + saleorderRequestParentDto.setNdiscountrate("100.000000");//整单折扣 + saleorderRequestParentDto.setPk_corp(bdCorpEntity.getPkCorp());//公司id + + //平台 + saleorderRequestParentDto.setPk_defdoc2(platformArchives.getPkDefdoc()); + saleorderRequestParentDto.setVdef2(platformArchives.getDocname()); + + //店铺 + saleorderRequestParentDto.setPk_defdoc1(shopArchives.getPkDefdoc()); + saleorderRequestParentDto.setVdef1(shopArchives.getDocname()); + + saleorderRequestDto.setParentvo(saleorderRequestParentDto); + + List saleorderRequestChildrenDtoList = new ArrayList<>(); + saleorderRequestDto.setChildrenvo(saleorderRequestChildrenDtoList); + + //把汇总好的出库单明细行合并成一行 + for (int j = 0; j < details.size(); j++) { + ReturnGoodSearchDetailsDto returnGoodSearchDetailsDto = details.get(j); + //存货管理档案:取发货公司的存货管理档案 + BdInvmandocEntity bdInvmandocEntity = queryInventoryMan(returnGoodSearchDetailsDto, bdCalbodyEntity.getPkCorp()); + //存货基础档案 + BdInvbasdocEntity bdInvbasdocEntity = queryStockBasicArchives(bdInvmandocEntity.getPkInvmandoc(), deliverGoodsCorp.getPkCorp()); + //根据存货基础档案编码,查询当前存货的税率 + BdTaxitemsEntity bdTaxitemsEntity1 = queryBdTaxitems(bdInvbasdocEntity.getInvcode()); + + String tax = "0." + new BigDecimal(bdTaxitemsEntity1.getTaxratio()).stripTrailingZeros().toPlainString(); + + // 如果是海外的店铺,则税率为零 + String exportVaue = ExportConstant.exportConstant.get(header.getStoreCode()); + if (exportVaue != null) { + tax = "0"; + } + + BigDecimal noriginalcurprice = null;//无税单价 + BigDecimal noriginalcurmny = null;//无税金额 + BigDecimal noriginalcurtaxprice = null;//含税单价 + BigDecimal noriginalcursummny = null;//价税合计 + BigDecimal noriginalcurtaxmny = null;//税额 + try { + Assert.notNull(returnGoodSearchDetailsDto.getTotalAmount(), "退货入库单总金额不能为空 明细行对象:{}", JSON.toJSONString(returnGoodSearchDetailsDto)); + Assert.notNull(returnGoodSearchDetailsDto.getReceivedQty(), "实收数量不能为空 明细行对象:{}", JSON.toJSONString(returnGoodSearchDetailsDto)); + + noriginalcurtaxprice = new BigDecimal(returnGoodSearchDetailsDto.getTotalAmount()).divide(new BigDecimal(returnGoodSearchDetailsDto.getReceivedQty()), 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(new BigDecimal(returnGoodSearchDetailsDto.getReceivedQty())).setScale(2, BigDecimal.ROUND_HALF_UP); + noriginalcursummny = noriginalcurtaxprice.multiply(new BigDecimal(returnGoodSearchDetailsDto.getReceivedQty())).setScale(2, BigDecimal.ROUND_HALF_UP); + noriginalcurtaxmny = noriginalcursummny.subtract(noriginalcurmny).setScale(2, BigDecimal.ROUND_HALF_UP); + } catch (Exception e) { + logger.error("TOB金额计算错误", e); + Assert.state(false, "TOB金额计算错误,原因:{}", e.getMessage()); + } + + //判断是否为赠品 + String isblargessflag = "N"; + if (noriginalcursummny.longValue() == 0) { + isblargessflag = "Y"; + } + + SaleorderRequestChildrenDto saleorderRequestChildrenDto = new SaleorderRequestChildrenDto(); + saleorderRequestChildrenDto.setBlargessflag(isblargessflag);//是否赠品 + saleorderRequestChildrenDto.setCadvisecalbodyid(bdCalbodyEntity.getPkCalbody());//发货库存组织 + saleorderRequestChildrenDto.setCbodywarehouseid(bdStordocEntity.getPkStordoc());//发货仓库 + saleorderRequestChildrenDto.setCconsigncorpid(deliverGoodsCorp.getPkCorp());//发货公司 + saleorderRequestChildrenDto.setCcurrencytypeid("00010000000000000001");//币种 + saleorderRequestChildrenDto.setCinventoryid(bdInvmandocEntity.getPkInvmandoc());//存货id + saleorderRequestChildrenDto.setCreceiptcorpid(bdCumandocEntity.getPkCumandoc());//收货单位 + saleorderRequestChildrenDto.setDconsigndate(generateBusinessDate);//计划发货日期 + saleorderRequestChildrenDto.setDdeliverdate(generateBusinessDate);// 要求收货日期 + saleorderRequestChildrenDto.setNexchangeotobrate("1.00000000");//折本汇率 + saleorderRequestChildrenDto.setNitemdiscountrate("100.000000");//单品折扣 + saleorderRequestChildrenDto.setNnumber("-" + returnGoodSearchDetailsDto.getReceivedQty());//数量 + saleorderRequestChildrenDto.setNoriginalcurdiscountmny("0");//折扣额 + saleorderRequestChildrenDto.setNoriginalcurmny("-" + noriginalcurmny.stripTrailingZeros().toPlainString());//无税金额 +// saleorderRequestChildrenDto.setNoriginalcurnetprice(noriginalcurprice.stripTrailingZeros().toPlainString());//无税净价 +// saleorderRequestChildrenDto.setNoriginalcurprice(noriginalcurprice.stripTrailingZeros().toPlainString());//无税单价 + saleorderRequestChildrenDto.setNoriginalcursummny("-" + noriginalcursummny.stripTrailingZeros().toPlainString());//价税合计 + saleorderRequestChildrenDto.setNoriginalcurtaxmny("-" + noriginalcurtaxmny.stripTrailingZeros().toPlainString());//税额 + saleorderRequestChildrenDto.setNoriginalcurtaxnetprice(noriginalcurtaxprice.stripTrailingZeros().toPlainString());//含税净价 + saleorderRequestChildrenDto.setNoriginalcurtaxprice(noriginalcurtaxprice.stripTrailingZeros().toPlainString());//含税单价 + saleorderRequestChildrenDto.setNtaxrate(new BigDecimal(bdTaxitemsEntity1.getTaxratio()).stripTrailingZeros().toPlainString());//税率 + saleorderRequestChildrenDtoList.add(saleorderRequestChildrenDto); + } + //记录成功 + //销售订单单据推送到u8c + List saleorderRequestDtoList = new ArrayList<>(); + saleorderRequestDtoList.add(saleorderRequestDto); + + Map> stringStringMap = new HashMap<>(); + stringStringMap.put("saleorder", saleorderRequestDtoList); + SoSaleResultRootDto soSaleResultRootDto = sendU8CTOCOrder(JSON.toJSONString(stringStringMap)); + logger.info("TOB红字销售订单编号:{} 销售公司:{}", soSaleResultRootDto.getParentvo().getVreceiptcode(), soSaleResultRootDto.getParentvo().getPk_corp()); + } + } catch (Exception e) { + logger.error("TOB业务转换成U8C对象过程中、或者单据推送到U8C出现异常!", e); + //记录失败 + } + } catch (Exception e) { + logger.error("TOB外层转换逻辑抛出异常", e); + // 记录失败 + } + } + } + + /** + * 2024年7月31日 10:34:09 + * 生成业务日期,以发货时间作为业务日期 + * + * @author liuyang + */ + private String createGenerateBusinessDate(OrderToBHeaderDto orderOutTobHeaderDto) { + if (orderOutTobHeaderDto != null && orderOutTobHeaderDto.getHeader() != null && orderOutTobHeaderDto.getHeader().getCheckInFrom() != null) { + ReturnGoodSearchHeaderDto header = orderOutTobHeaderDto.getHeader(); + String checkInFrom = header.getCheckInFrom(); + String businessFormat = null; + try { + Date dbill = DateUtil.parse(checkInFrom); + businessFormat = DateUtil.format(dbill, "yyyy-MM-dd"); + } catch (Exception e) { + logger.error("业务日期生成失败", e); + } + return businessFormat; + } else { + logger.error("生成出库日期失败,或者checkInFrom为空! json:{}", JSON.toJSON(orderOutTobHeaderDto)); + Assert.state(false, "生成出库日期失败,或者checkInFrom为空! json:{}", JSON.toJSON(orderOutTobHeaderDto)); + return null; + } + } + + /** + * 档案转换 + * + * @author liuyang + */ + private List queryBasicArchives(List returnGoodHeaderDetailsDataDtoList) { + List orderToBHeaderDtoArrayList = new ArrayList<>(); + + if (returnGoodHeaderDetailsDataDtoList != null && returnGoodHeaderDetailsDataDtoList.size() > 0) { + try { + for (int i = 0; i < returnGoodHeaderDetailsDataDtoList.size(); i++) { + ReturnGoodHeaderDetailsDataDto returnGoodHeaderDetailsDataDto = returnGoodHeaderDetailsDataDtoList.get(i); + ReturnGoodSearchHeaderDto header = returnGoodHeaderDetailsDataDto.getHeader(); + List details = returnGoodHeaderDetailsDataDto.getDetails(); + + // 销售公司、发货公司 + String companyCode = header.getCompanyCode(); + Assert.notNull(companyCode, "O表头公司不能为空"); + BdCorpEntity bdCorpEntity = new BdCorpEntity(); + bdCorpEntity.setDr(0); + bdCorpEntity.setDataSourceCode("lets_u8c"); + bdCorpEntity.setUnitcode(companyCode); + List bdCorpEntityList = iBdCorpDao.query(bdCorpEntity); + if (bdCorpEntityList.size() == 0) { + Assert.state(false, "根据O货主编码{},无法匹配到U8C销售公司", companyCode); + } else if (bdCorpEntityList.size() >= 2) { + Assert.state(false, "根据O货主编码{},匹配到U8C销售公司{}个", companyCode, bdCorpEntityList.size()); + } + + // 发货库存组织 + BdCalbodyEntity bdCalbodyEntity = new BdCalbodyEntity(); + bdCalbodyEntity.setDr(0); + bdCalbodyEntity.setDataSourceCode("lets_u8c"); + bdCalbodyEntity.setPkCorp(bdCorpEntityList.get(0).getPkCorp()); + List bdCalbodyEntities = iBdCalbodyDao.query(bdCalbodyEntity); + if (bdCalbodyEntities.size() == 0) { + Assert.state(false, "根据U8C发货公司{},无法匹配到U8C发货库存组织", bdCorpEntityList.get(0).getPkCorp()); + } else if (bdCalbodyEntities.size() >= 2) { + Assert.state(false, "根据U8C发货公司{},匹配到U8C发货库存组织{}个", bdCorpEntityList.get(0).getPkCorp(), bdCalbodyEntities.size()); + } + + // 仓库 + String facilityCode = header.getFacilityCode(); + Assert.notNull(facilityCode, "O售后入库单仓库facilityCode字段不能为空"); + BdStordocEntity bdStordocEntity = new BdStordocEntity(); + bdStordocEntity.setDr(0L); + bdStordocEntity.setDataSourceCode("lets_u8c"); + bdStordocEntity.setPkCalbody(bdCalbodyEntities.get(0).getPkCalbody()); + bdStordocEntity.setStorcode(facilityCode); + List bdStordocEntityList = iBdStordocDao.query(bdStordocEntity); + if (bdStordocEntityList.size() == 0) { + Assert.state(false, "根据O仓库编码+U8C发货库存组织主键,无法匹配到U8C仓库", facilityCode, bdCalbodyEntities.get(0).getPkCalbody()); + } else if (bdStordocEntityList.size() >= 2) { + Assert.state(false, "根据O仓库编码+U8C发货库存组织主键,匹配到U8C仓库多个", facilityCode, bdCalbodyEntities.get(0).getPkCalbody()); + } + + //销售组织 + //2024年8月13日 10:35:05 已经和佳妮在微信确认,U8C销售公司编码与U8C销售组织编码保持一致,因此通过销售公司编码匹配 + BdSalestruEntity bdSalestruEntity = new BdSalestruEntity(); + bdSalestruEntity.setDr(0); + bdSalestruEntity.setDataSourceCode("lets_u8c"); + bdSalestruEntity.setVsalestrucode(bdCorpEntityList.get(0).getUnitcode()); + List bdSalestruEntityList = iBdSalestruDao.query(bdSalestruEntity); + if (bdSalestruEntityList.size() == 0) { + Assert.state(false, "根据U8C销售公司编码:{},无法匹配到U8C销售组织", bdCorpEntityList.get(0).getUnitcode()); + } else if (bdSalestruEntityList.size() >= 2) { + Assert.state(false, "根据U8C销售公司编码:{},无法匹配到U8C销售组织", bdCorpEntityList.get(0).getUnitcode()); + } + + //业务部门 + //2024年8月14日 10:38:37 已经和佳妮确认 + String deptName = "其他部门"; + BdDeptdocEntity bdDeptdocEntity = new BdDeptdocEntity(); + bdDeptdocEntity.setDataSourceCode("lets_u8c"); + bdDeptdocEntity.setDr(0); + bdDeptdocEntity.setDeptname(deptName); + bdDeptdocEntity.setPkCorp(bdCorpEntityList.get(0).getPkCorp()); + List bdDeptdocEntityList = iBdDeptdocDao.query(bdDeptdocEntity); + if (bdDeptdocEntityList.size() == 0) { + Assert.state(false, "根据部门名称:{} 公司id:{},无法匹配到U8C销售组织", deptName, bdCorpEntityList.get(0).getPkCorp()); + } else if (bdDeptdocEntityList.size() >= 2) { + Assert.state(false, "根据部门名称:{} 公司id:{},匹配到U8C销售组织{}个", deptName, bdCorpEntityList.get(0).getPkCorp()); + } + + //客商基本档案 + String custName = "天猫intoyou旗舰店-自营"; + BdCubasdocEntity bdCubasdocEntity = new BdCubasdocEntity(); + bdCubasdocEntity.setDataSourceCode("lets_u8c"); + bdCubasdocEntity.setDr(0L); + bdCubasdocEntity.setCustname(custName); + List bdCubasdocEntityList = iBdCubasdocDao.query(bdCubasdocEntity); + + //客商管理档案 + BdCumandocEntity bdCumandocEntity1 = new BdCumandocEntity(); + bdCumandocEntity1.setDataSourceCode("lets_u8c"); + bdCumandocEntity1.setDr(0L); + bdCumandocEntity1.setPkCorp(bdCorpEntityList.get(0).getPkCorp()); + bdCumandocEntity1.setPkCubasdoc(bdCubasdocEntityList.get(0).getPkCubasdoc()); + List bdCumandocEntityList = iBdCumandocDao.query(bdCumandocEntity1); + + //查找平台 + String platformZdyId = "0001A210000000000JUD"; + String sourcePlatformCode = header.getSourcePlatformCode(); + BdDefdocEntity bdDefdocEntity = new BdDefdocEntity(); + bdDefdocEntity.setPkDefdoclist(platformZdyId); + bdDefdocEntity.setDr(0); + bdDefdocEntity.setDataSourceCode("lets_u8c"); + bdDefdocEntity.setDoccode(sourcePlatformCode); + List bdDefdocEntityList = iBdDefdocDao.query(bdDefdocEntity); + if (bdDefdocEntityList.size() == 0) { + Assert.state(false, "根据O平台编码{},无法匹配到U8C平台自定义档案 自定义档案主键:{}", sourcePlatformCode, platformZdyId); + } else if (bdDefdocEntityList.size() >= 2) { + Assert.state(false, "根据O平台编码{},无法匹配到U8C平台自定义档案 自定义档案主键:{}", sourcePlatformCode, platformZdyId); + } + + //查询U8C店铺档案 + String platformZdyId2 = "0001A210000000000XZX"; + String ofsStoreCode = header.getStoreCode(); + BdDefdocEntity bdDefdocEntity2 = new BdDefdocEntity(); + bdDefdocEntity2.setPkDefdoclist(platformZdyId2); + bdDefdocEntity2.setDr(0); + bdDefdocEntity2.setDataSourceCode("lets_u8c"); + bdDefdocEntity2.setDoccode(ofsStoreCode); + List bdDefdocEntityList2 = iBdDefdocDao.query(bdDefdocEntity2); + if (bdDefdocEntityList2.size() == 0) { + Assert.state(false, "根据O店铺编码{},无法匹配到U8C店铺自定义档案 自定义档案主键:{}", ofsStoreCode, platformZdyId); + } else if (bdDefdocEntityList2.size() >= 2) { + Assert.state(false, "根据O店铺编码{},无法匹配到U8C店铺自定义档案 自定义档案主键:{}", ofsStoreCode, platformZdyId); + } + + OrderToBHeaderDto orderOutTobHeaderDto = new OrderToBHeaderDto(); + orderOutTobHeaderDto.setBdCorpEntity(bdCorpEntityList.get(0)); + orderOutTobHeaderDto.setBdCalbodyEntity(bdCalbodyEntities.get(0)); + orderOutTobHeaderDto.setBdStordocEntity(bdStordocEntityList.get(0)); + orderOutTobHeaderDto.setBdSalestruEntity(bdSalestruEntityList.get(0)); + orderOutTobHeaderDto.setBdDeptdocEntity(bdDeptdocEntityList.get(0)); + orderOutTobHeaderDto.setBdCumandocEntity(bdCumandocEntityList.get(0)); + orderOutTobHeaderDto.setBdCubasdocEntity(bdCubasdocEntityList.get(0)); + orderOutTobHeaderDto.setDeliverGoodsCorp(bdCorpEntityList.get(0)); + orderOutTobHeaderDto.setPlatformArchives(bdDefdocEntityList.get(0)); + orderOutTobHeaderDto.setShopArchives(bdDefdocEntityList2.get(0)); + + orderOutTobHeaderDto.setHeader(header); + orderOutTobHeaderDto.setDetails(details); + + orderToBHeaderDtoArrayList.add(orderOutTobHeaderDto); + } + //成功 + } catch (Exception e) { + logger.error("OFS销售出库单关联查询U8C档案失败", e); + //失败 + } + } else { + logger.info("queryBasicArchives方法对应的returnGoodHeaderDetailsDataDtoList.size为0"); + } + return orderToBHeaderDtoArrayList; + } + + /** + * bean copy + * 2024年8月15日 14:19:36 + */ + private List copyHeaderDto(List returnGoodSearchHeaderDtos) { + List tocofsReturngoodsEntityArrayList = new ArrayList<>(); + if (returnGoodSearchHeaderDtos != null && returnGoodSearchHeaderDtos.size() > 0) { + for (int i = 0; i < returnGoodSearchHeaderDtos.size(); i++) { + ReturnGoodSearchHeaderDto headerDto = returnGoodSearchHeaderDtos.get(i); + + TocofsReturngoodsEntity tocofsReturngoodsEntity = new TocofsReturngoodsEntity(); + BeanUtil.copyPropertiesV2(headerDto, tocofsReturngoodsEntity); + tocofsReturngoodsEntityArrayList.add(tocofsReturngoodsEntity); + } + } else { + logger.info("需要复制{}个bean对象(O表头)", returnGoodSearchHeaderDtos.size()); + } + return tocofsReturngoodsEntityArrayList; + } + + /** + * bean copy + * 2024年8月15日 14:24:38 + */ + private List copyDetailsDto(List headerDetailsDtoList2) { + List tocofsSaleoutDetailedEntityArrayList = new ArrayList<>(); + if (headerDetailsDtoList2 != null && headerDetailsDtoList2.size() > 0) { + for (int i = 0; i < headerDetailsDtoList2.size(); i++) { + ReturnGoodSearchDetailsDto returnGoodSearchDetailsDto = headerDetailsDtoList2.get(i); + + TocofsReturngoodsDetailedEntity tocofsReturngoodsDetailedEntity = new TocofsReturngoodsDetailedEntity(); + tocofsReturngoodsDetailedEntity.setBusinessType("TOB_RETURN"); + BeanUtil.copyPropertiesV2(returnGoodSearchDetailsDto, tocofsReturngoodsDetailedEntity); + tocofsSaleoutDetailedEntityArrayList.add(tocofsReturngoodsDetailedEntity); + } + } else { + logger.info("需要复制{}个bean对象(O表体)", tocofsSaleoutDetailedEntityArrayList.size()); + } + return tocofsSaleoutDetailedEntityArrayList; + } + + /** + * 2024年8月6日 10:59:03 查询U8C业务流程 + * + * @author liuyang + */ + private BdBusitypeEntity u8cOperationFlow() throws Exception { + //查询业务流程 + //2024年8月6日 11:33:07 具体的业务流程名称,还需要实施提供 + String processName = "TOB销售"; + BdBusitypeEntity bdBusitypeEntity = queryBdBusitypeUtil.queryBdBusitype(processName); + Assert.notNull(bdBusitypeEntity, "根据业务流程名称({})没有查询到业务流程", processName); + return bdBusitypeEntity; + } + + /** + * 查询存货管理档案 + * + * @param pkCorp 发货公司主键 + * @param detailsDto 出库单存货明细行 + * @author liuyang + */ + private BdInvmandocEntity queryInventoryMan(ReturnGoodSearchDetailsDto detailsDto, String pkCorp) throws Exception { + Assert.notNull(detailsDto, "sonDetailsDto不能为空"); + Assert.notNull(detailsDto.getSkuCode(), "O存货商家编码不能为空"); + Assert.notNull(pkCorp, "发货公司主键不能为空"); + + BdInvmandocEntity bdInvmandocEntity = new BdInvmandocEntity(); + bdInvmandocEntity.setInvcode(detailsDto.getSkuCode()); + bdInvmandocEntity.setPkCorp(pkCorp); + List bdInvmandocEntity2 = iBdInvmandocDao.queryBdInvmandocByInvcodeList(bdInvmandocEntity); + if (bdInvmandocEntity2.size() == 0) { + Assert.state(false, "根据O商家编码:{} U8C发货公司主键:{}没有查询到存货管理档案", detailsDto.getSkuCode(), pkCorp); + } else if (bdInvmandocEntity2.size() >= 2) { + Assert.state(false, "根据O商家编码:{} U8C发货公司主键:{}没有查询到存货管理档案", detailsDto.getSkuCode(), pkCorp); + } + return bdInvmandocEntity2.get(0); + } + + /** + * 2024年8月7日 10:25:29 + * 查询基础档案,根据公司、管理档案主键查询 + * + * @author liuyang + */ + private BdInvbasdocEntity queryStockBasicArchives(String pkInvmandoc, String pkCorp) throws Exception { + Assert.notNull(pkInvmandoc, "存货管理档案不能为空"); + Assert.notNull(pkCorp, "公司档案不能为空"); + + BdInvbasdocEntity bdInvbasdocEntity = new BdInvbasdocEntity(); + bdInvbasdocEntity.setPk_invmandoc(pkInvmandoc); + bdInvbasdocEntity.setPk_corp(pkCorp); + List bdInvbasdocEntity2 = iBdInvbasdocDao.queryBdInvbasdocByPkInvmandocV2(bdInvbasdocEntity); + if (bdInvbasdocEntity2.size() == 0) { + Assert.state(false, "根据存货管理档案主键{}和公司档案主键{}没有查询到U8C基础档案", pkInvmandoc, pkCorp); + } else if (bdInvbasdocEntity2.size() >= 2) { + Assert.state(false, "根据存货管理档案主键{}和公司档案主键{}没有查询到U8C基础档案", pkInvmandoc, pkCorp); + } + return bdInvbasdocEntity; + } + + /** + * 2024年8月7日 14:58:34 + * 查询税目档案 + * + * @author liuyang + */ + private BdTaxitemsEntity queryBdTaxitems(String invcode) throws Exception { + Assert.notNull(invcode, "存货编码不能为空"); + + BdTaxitemsEntity bdTaxitemsEntity = new BdTaxitemsEntity(); + bdTaxitemsEntity.setInvcode(invcode); + List bdTaxitemsEntityList = iBdTaxitemsDao.queryBdInvbasdocByInvcodeV2(bdTaxitemsEntity); + if (bdTaxitemsEntityList.size() == 0) { + Assert.state(false, "根据存货编码{}没有查询到U8C税目档案", invcode); + } else if (bdTaxitemsEntityList.size() >= 2) { + Assert.state(false, "根据存货编码{}没有查询到U8C税目档案", invcode); + } + return bdTaxitemsEntityList.get(0); + } + + /** + * 2024年8月8日 10:54:48 + * 推送U8C销售订单方法 + * + * @author liuyang + */ + public SoSaleResultRootDto sendU8CTOCOrder(String param) { + long startLong = System.currentTimeMillis(); + logger.info("TOB推送开始,推送参数:" + param + ",U8C_URL:" + ProfilesActiveConstant.U8C_URL); + String result = HttpRequest.post(ProfilesActiveConstant.U8C_URL).header("appId", "800037")//头信息,多个头信息多次调用此方法即可 + .header("usercode", "admin").header("password", "21232f297a57a5a743894a0e4a801fc3").header("system", "lz").header("trantype", "PK").header("apiCode", "8000370006")//头信息,多个头信息多次调用此方法即可 + .header("publicKey", "ZJYAWb7lhAUTYqekPkU+uHJv1/ObJxb7dT7sD8HPRDGAgyhCe7eDIk+3zDUT+v578prj")//头信息,多个头信息多次调用此方法即可 + .header("secretKey", "fviZnLBsQUAGF8w8FSOdJi7XlIm/XAZclMxRagDLfTyJFlvnIBF3w66Hrpfzs8cYj3JzOP8MtA1LSGvL+2BWG8c/o7DKi92S4mr3zcGearA=")//头信息,多个头信息多次调用此方法即可 + .body(param)//表单内容 + .timeout(20000)//超时,毫秒 + .execute().body(); + logger.info("TOB推送结束,返回参数:" + result); + long endLong = System.currentTimeMillis(); + logger.info("TOB接口请求耗时:" + (endLong - startLong)); + + JSONObject jsonObject = JSON.parseObject(result); + result = String.valueOf(jsonObject.get("attribute")); + + boolean isSuccess = false; + SoSaleResultRootDto soSaleResultRootDto = null; + if (result != null && !"".equals(result)) { + ReusltStrDto reusltStrDto = JSON.parseObject(result, ReusltStrDto.class); + if ("success".equals(reusltStrDto.getStatus())) { + soSaleResultRootDto = resultDataHandle(reusltStrDto.getData()); + isSuccess = true; + } + } + if (!isSuccess) { + Assert.state(false, "TOB业务O出库单推送U8C销售订单失败 接口返回结果:{}", result); + } + return soSaleResultRootDto; + } + + /** + * 返回结果解析处理,在确认了success后调用 + * + * @author liuyang + */ + private SoSaleResultRootDto resultDataHandle(String resultData) { + try { + if (resultData != null && !"".equals(resultData)) { + if (resultData.contains("[")) { + resultData = resultData.substring(1, resultData.length() - 1); + } + return JSON.parseObject(resultData, SoSaleResultRootDto.class); + } + } catch (Exception e) { +// e.printStackTrace(); + logger.error("解析返回参数失败的错误", e); + //如果解析失败,记录原因,但是不能影响结果的记录 + } + return null; + } +} \ No newline at end of file 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 a2d1f8fa..bb2696e4 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 @@ -412,7 +412,7 @@ public class SoSaleReturnPluginInitializerToC extends PluginBaseEntity { Map> stringStringMap = new HashMap<>(); stringStringMap.put("saleorder", saleorderRequestDtoList); SoSaleResultRootDto soSaleResultRootDto = sendU8CTOCOrder(JSON.toJSONString(stringStringMap)); - logger.info("销售订单编号:{} 销售公司:{}", soSaleResultRootDto.getParentvo().getVreceiptcode(), soSaleResultRootDto.getParentvo().getPk_corp()); + logger.info("TOC销售订单编号:{} 销售公司:{}", soSaleResultRootDto.getParentvo().getVreceiptcode(), soSaleResultRootDto.getParentvo().getPk_corp()); //记录成功 } catch (Exception e) { logger.error("TOC退货业务转换成U8C对象过程中、或者单据推送到U8C出现异常!", e); @@ -518,8 +518,16 @@ public class SoSaleReturnPluginInitializerToC extends PluginBaseEntity { Assert.notNull(bdCumandocEntity, "无法匹配到客商档案 店铺名称:{}", "天猫intoyou旗舰店-自营"); //查找平台 - BdDefdocEntity bdDefdocEntity = TocReturnBasicArchivesCacheUtil.stringBdDefdocEntityHashMap.get(header.getSourcePlatformCode()); - Assert.notNull(bdDefdocEntity, "根据O平台编码({})无法匹配到平台", header.getSourcePlatformCode()); + String sourcePlatformCode = header.getSourcePlatformCode(); + Assert.notNull(sourcePlatformCode, "O平台编码不能为空!"); + BdDefdocEntity bdDefdocEntity = TocReturnBasicArchivesCacheUtil.stringBdDefdocEntityHashMap.get(sourcePlatformCode); + Assert.notNull(bdDefdocEntity, "根据O平台编码({})无法匹配到U8C平台档案", header.getSourcePlatformCode()); + + //查找店铺 + String storeCode = header.getStoreCode(); + Assert.notNull(storeCode, "O店铺编码不能为空!"); + BdDefdocEntity bdDefdocEntity1 = TocReturnBasicArchivesCacheUtil.shopDefdocEntityHashMap.get(storeCode); + Assert.notNull(bdDefdocEntity1, "根据O店铺编码({})无法匹配到U8C店铺档案", storeCode); //字段拷贝 for (int j = 0; j < details.size(); j++) { diff --git a/buildpackage/src/main/java/com/hzya/frame/plugin/lets/u8cdto/OrderOutTobHeaderDto.java b/buildpackage/src/main/java/com/hzya/frame/plugin/lets/u8cdto/OrderOutTobHeaderDto.java index 4b239d73..5b7e2ea4 100644 --- a/buildpackage/src/main/java/com/hzya/frame/plugin/lets/u8cdto/OrderOutTobHeaderDto.java +++ b/buildpackage/src/main/java/com/hzya/frame/plugin/lets/u8cdto/OrderOutTobHeaderDto.java @@ -71,4 +71,8 @@ public class OrderOutTobHeaderDto extends HeaderDetailsDto { */ private BdDefdocEntity platformArchives; + /** + * 店铺档案 + */ + private BdDefdocEntity shopArchives; } \ No newline at end of file diff --git a/buildpackage/src/main/java/com/hzya/frame/plugin/lets/u8cdto/OrderToBHeaderDto.java b/buildpackage/src/main/java/com/hzya/frame/plugin/lets/u8cdto/OrderToBHeaderDto.java new file mode 100644 index 00000000..02621074 --- /dev/null +++ b/buildpackage/src/main/java/com/hzya/frame/plugin/lets/u8cdto/OrderToBHeaderDto.java @@ -0,0 +1,93 @@ +package com.hzya.frame.plugin.lets.u8cdto; + +import com.hzya.frame.plugin.lets.entity.*; +import com.hzya.frame.ttxofs.dto.ofssaleorderoutsearch.DetailsDto; +import com.hzya.frame.ttxofs.dto.ofssaleorderoutsearch.HeaderDto; +import com.hzya.frame.ttxofs.dto.returngoodsearch.ReturnGoodSearchDetailsDto; +import com.hzya.frame.ttxofs.dto.returngoodsearch.ReturnGoodSearchHeaderDto; +import lombok.Data; + +import java.util.List; + +/** + * @Author:liuyang + * @Package:com.hzya.frame.plugin.lets.u8cdto + * @Project:kangarooDataCenterV3 + * @name:OrderToBHeaderDto + * @Date:2024年8月15日 14:52:34 + * @Filename:OrderToBHeaderDto + */ +@Data +public class OrderToBHeaderDto { + + /** + * 表头公司(销售公司)、视为发货公司 + */ + private BdCorpEntity bdCorpEntity; + + /** + * 发货库存组织 + */ + private BdCalbodyEntity bdCalbodyEntity; + + /** + * 入库仓库 + */ + private BdStordocEntity bdStordocEntity; + + /** + * 收货库存组织 + */ +// private BdCalbodyEntity bdCalbodyEntity1; + + /** + * 收货仓库 + */ +// private BdStordocEntity bdStordocEntity1; + + /** + * 销售组织 + */ + private BdSalestruEntity bdSalestruEntity; + + + /** + * 业务部门 + */ + private BdDeptdocEntity bdDeptdocEntity; + + /** + * 客商管理档案 + */ + private BdCumandocEntity bdCumandocEntity; + + /** + * 客商基本档案 + */ + private BdCubasdocEntity bdCubasdocEntity; + + /** + * 发货公司 + */ + private BdCorpEntity deliverGoodsCorp; + + /** + * U8C平台档案 + */ + private BdDefdocEntity platformArchives; + + /** + * 店铺档案 + */ + private BdDefdocEntity shopArchives; + + /** + * TOB售后入库单表头 + */ + private ReturnGoodSearchHeaderDto header; + + /** + * TOB售后入库单表体 + */ + private List details; +} \ No newline at end of file diff --git a/buildpackage/src/main/java/com/hzya/frame/plugin/lets/u8cdto/SonDetailsDto.java b/buildpackage/src/main/java/com/hzya/frame/plugin/lets/u8cdto/SonDetailsDto.java index c1704ea0..5b06b4a5 100644 --- a/buildpackage/src/main/java/com/hzya/frame/plugin/lets/u8cdto/SonDetailsDto.java +++ b/buildpackage/src/main/java/com/hzya/frame/plugin/lets/u8cdto/SonDetailsDto.java @@ -91,6 +91,19 @@ public class SonDetailsDto extends DetailsDto { */ private BdDefdocEntity platformArchives; + /** + * U8C店铺档案 + */ + private BdDefdocEntity shopArchives; + + public BdDefdocEntity getShopArchives() { + return shopArchives; + } + + public void setShopArchives(BdDefdocEntity shopArchives) { + this.shopArchives = shopArchives; + } + public BdDefdocEntity getPlatformArchives() { return platformArchives; } diff --git a/buildpackage/src/main/java/com/hzya/frame/plugin/lets/util/TocOrderBasicArchivesCacheUtil.java b/buildpackage/src/main/java/com/hzya/frame/plugin/lets/util/TocOrderBasicArchivesCacheUtil.java index d0710398..12343e4d 100644 --- a/buildpackage/src/main/java/com/hzya/frame/plugin/lets/util/TocOrderBasicArchivesCacheUtil.java +++ b/buildpackage/src/main/java/com/hzya/frame/plugin/lets/util/TocOrderBasicArchivesCacheUtil.java @@ -270,6 +270,25 @@ public class TocOrderBasicArchivesCacheUtil { } } + /** + * 2024年8月14日 15:17:48 缓存U8C店铺自定义档案逻辑 + */ + public static Map shopDefdocEntityHashMap = new HashMap<>(); + + private void initShopDiy() { + BdDefdocEntity bdDefdocEntity = new BdDefdocEntity(); + bdDefdocEntity.setPkDefdoclist("0001A210000000000XZX"); + bdDefdocEntity.setDr(0); + bdDefdocEntity.setDataSourceCode("lets_u8c"); + List bdDefdocEntityList = iBdDefdocDao.query(bdDefdocEntity); + if (bdDefdocEntityList != null && bdDefdocEntityList.size() > 0) { + for (int i = 0; i < bdDefdocEntityList.size(); i++) { + BdDefdocEntity bdDefdocEntity1 = bdDefdocEntityList.get(i); + shopDefdocEntityHashMap.put(bdDefdocEntity1.getDoccode(), bdDefdocEntity1); + } + } + } + /** * 清理缓存 * @@ -287,6 +306,7 @@ public class TocOrderBasicArchivesCacheUtil { stringBdTaxitemsEntityHashMap.clear(); stringBdCubasdocEntityHashMap.clear(); stringBdDefdocEntityHashMap.clear(); + shopDefdocEntityHashMap.clear(); } /** @@ -308,5 +328,6 @@ public class TocOrderBasicArchivesCacheUtil { initBdTaxitemsEntity(); initBdCubasdoc(); initSourcePlatform(); + initShopDiy(); } } \ No newline at end of file diff --git a/buildpackage/src/main/java/com/hzya/frame/plugin/lets/util/TocReturnBasicArchivesCacheUtil.java b/buildpackage/src/main/java/com/hzya/frame/plugin/lets/util/TocReturnBasicArchivesCacheUtil.java index cdd2aacc..5cd6a2f1 100644 --- a/buildpackage/src/main/java/com/hzya/frame/plugin/lets/util/TocReturnBasicArchivesCacheUtil.java +++ b/buildpackage/src/main/java/com/hzya/frame/plugin/lets/util/TocReturnBasicArchivesCacheUtil.java @@ -270,6 +270,25 @@ public class TocReturnBasicArchivesCacheUtil { } } + /** + * 2024年8月14日 15:17:48 缓存U8C店铺自定义档案逻辑 + */ + public static Map shopDefdocEntityHashMap = new HashMap<>(); + + private void initShopDiy() { + BdDefdocEntity bdDefdocEntity = new BdDefdocEntity(); + bdDefdocEntity.setPkDefdoclist("0001A210000000000XZX"); + bdDefdocEntity.setDr(0); + bdDefdocEntity.setDataSourceCode("lets_u8c"); + List bdDefdocEntityList = iBdDefdocDao.query(bdDefdocEntity); + if (bdDefdocEntityList != null && bdDefdocEntityList.size() > 0) { + for (int i = 0; i < bdDefdocEntityList.size(); i++) { + BdDefdocEntity bdDefdocEntity1 = bdDefdocEntityList.get(i); + shopDefdocEntityHashMap.put(bdDefdocEntity1.getDoccode(), bdDefdocEntity1); + } + } + } + /** * 清理缓存 * @@ -287,6 +306,7 @@ public class TocReturnBasicArchivesCacheUtil { stringBdTaxitemsEntityHashMap.clear(); stringBdCubasdocEntityHashMap.clear(); stringBdDefdocEntityHashMap.clear(); + shopDefdocEntityHashMap.clear(); } /** @@ -308,5 +328,6 @@ public class TocReturnBasicArchivesCacheUtil { initBdTaxitemsEntity(); initBdCubasdoc(); initSourcePlatform(); + initShopDiy(); } } \ No newline at end of file diff --git a/buildpackage/src/main/resources/cfgHome/plugin/lets/spring/spring-sowow-dao.xml b/buildpackage/src/main/resources/cfgHome/plugin/lets/spring/spring-lets-dao.xml similarity index 100% rename from buildpackage/src/main/resources/cfgHome/plugin/lets/spring/spring-sowow-dao.xml rename to buildpackage/src/main/resources/cfgHome/plugin/lets/spring/spring-lets-dao.xml diff --git a/buildpackage/src/main/resources/cfgHome/plugin/lets/spring/spring-sowow-plugin.xml b/buildpackage/src/main/resources/cfgHome/plugin/lets/spring/spring-lets-plugin.xml similarity index 93% rename from buildpackage/src/main/resources/cfgHome/plugin/lets/spring/spring-sowow-plugin.xml rename to buildpackage/src/main/resources/cfgHome/plugin/lets/spring/spring-lets-plugin.xml index fcc13baf..416b09f4 100644 --- a/buildpackage/src/main/resources/cfgHome/plugin/lets/spring/spring-sowow-plugin.xml +++ b/buildpackage/src/main/resources/cfgHome/plugin/lets/spring/spring-lets-plugin.xml @@ -21,6 +21,6 @@ - - + + \ No newline at end of file diff --git a/buildpackage/src/main/resources/cfgHome/plugin/lets/spring/spring-sowow-service.xml b/buildpackage/src/main/resources/cfgHome/plugin/lets/spring/spring-lets-service.xml similarity index 100% rename from buildpackage/src/main/resources/cfgHome/plugin/lets/spring/spring-sowow-service.xml rename to buildpackage/src/main/resources/cfgHome/plugin/lets/spring/spring-lets-service.xml diff --git a/service/src/main/java/com/hzya/frame/ttxofs/basics/InterfaceBasics.java b/service/src/main/java/com/hzya/frame/ttxofs/basics/InterfaceBasics.java index d806fe55..8f46e7c6 100644 --- a/service/src/main/java/com/hzya/frame/ttxofs/basics/InterfaceBasics.java +++ b/service/src/main/java/com/hzya/frame/ttxofs/basics/InterfaceBasics.java @@ -12,7 +12,7 @@ package com.hzya.frame.ttxofs.basics; */ public class InterfaceBasics { - private String bashHttpUrl = "http://39.98.58.229/api/edi/ofs/in"; + private String bashHttpUrl = "http://39.98.58.229/api/edi/u8c/ofs/in"; public String getBashHttpUrl() { return bashHttpUrl; diff --git a/service/src/main/java/com/hzya/frame/ttxofs/dto/InterfaceParamDto.java b/service/src/main/java/com/hzya/frame/ttxofs/dto/InterfaceParamDto.java index bf6dfd0a..3e80e5fb 100644 --- a/service/src/main/java/com/hzya/frame/ttxofs/dto/InterfaceParamDto.java +++ b/service/src/main/java/com/hzya/frame/ttxofs/dto/InterfaceParamDto.java @@ -19,12 +19,14 @@ public class InterfaceParamDto extends InterfaceBasics { private String format = "json"; private String appKey = "1023142858"; +// private String appKey = "2097046829"; private String v = "1.0"; private String sign; private String secret = "382e4a2584027a36ac9431103"; +// private String secret = "35282f251476a3af4f00c7b36"; private String timestamp; @@ -93,4 +95,5 @@ public class InterfaceParamDto extends InterfaceBasics { public void setData(String data) { this.data = data; } -} + +} \ No newline at end of file From 059e95de677278f7772c521071fb15c007190506 Mon Sep 17 00:00:00 2001 From: zhengyf Date: Thu, 15 Aug 2024 18:09:45 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E4=B8=BD=E7=9F=A5=EF=BC=9A=E8=B0=83?= =?UTF-8?q?=E6=8B=A8=E5=87=BA=E5=85=A5=E5=BA=93=EF=BC=8C=E8=B0=83=E6=95=B4?= =?UTF-8?q?=E5=87=BA=E5=85=A5=E5=BA=93=E6=8E=A5=E5=8F=A3=E4=BF=AE=E6=94=B9?= =?UTF-8?q?=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ofsvo/QueryOfsStockinOrderRequestVO.java | 4 ++ .../ofsvo/QueryOfsStockoutOrderRequestVO.java | 4 ++ .../adjust/AdjustInPluginInitializer.java | 12 +--- .../transfer/TransferInPluginInitializer.java | 31 ++++++++-- .../TransferOutPluginInitializer.java | 62 ++++++++++++------- .../plugin/lets/spring/spring-lets-plugin.xml | 1 + .../lets/plugin/transfer/TransferTest.java | 14 ++++- 7 files changed, 89 insertions(+), 39 deletions(-) diff --git a/buildpackage/src/main/java/com/hzya/frame/plugin/lets/ofsvo/QueryOfsStockinOrderRequestVO.java b/buildpackage/src/main/java/com/hzya/frame/plugin/lets/ofsvo/QueryOfsStockinOrderRequestVO.java index b6d330e2..954648fe 100644 --- a/buildpackage/src/main/java/com/hzya/frame/plugin/lets/ofsvo/QueryOfsStockinOrderRequestVO.java +++ b/buildpackage/src/main/java/com/hzya/frame/plugin/lets/ofsvo/QueryOfsStockinOrderRequestVO.java @@ -11,6 +11,10 @@ public class QueryOfsStockinOrderRequestVO { private String created_start; /** 结束时间 */ private String created_end; + + private String closedAt_start; + private String closedAt_end; + /** 组织 */ private String clientCode; /** 入库单号 */ diff --git a/buildpackage/src/main/java/com/hzya/frame/plugin/lets/ofsvo/QueryOfsStockoutOrderRequestVO.java b/buildpackage/src/main/java/com/hzya/frame/plugin/lets/ofsvo/QueryOfsStockoutOrderRequestVO.java index cf73c47b..153536f7 100644 --- a/buildpackage/src/main/java/com/hzya/frame/plugin/lets/ofsvo/QueryOfsStockoutOrderRequestVO.java +++ b/buildpackage/src/main/java/com/hzya/frame/plugin/lets/ofsvo/QueryOfsStockoutOrderRequestVO.java @@ -11,6 +11,10 @@ public class QueryOfsStockoutOrderRequestVO { private String created_start; /** 结束时间 */ private String created_end; + + private String closedAt_start; + private String closedAt_end; + /** 组织 */ private String clientCode; /** 库单号 */ diff --git a/buildpackage/src/main/java/com/hzya/frame/plugin/lets/plugin/adjust/AdjustInPluginInitializer.java b/buildpackage/src/main/java/com/hzya/frame/plugin/lets/plugin/adjust/AdjustInPluginInitializer.java index d3ef9fd9..9dfba63c 100644 --- a/buildpackage/src/main/java/com/hzya/frame/plugin/lets/plugin/adjust/AdjustInPluginInitializer.java +++ b/buildpackage/src/main/java/com/hzya/frame/plugin/lets/plugin/adjust/AdjustInPluginInitializer.java @@ -358,7 +358,7 @@ public class AdjustInPluginInitializer extends PluginBaseEntity { public List queryOfsStockinOrder(QueryOfsStockinOrderRequestVO queryOfsStockinOrderRequestVO) throws Exception { InterfaceParamDto interfaceParamDto = new InterfaceParamDto(); interfaceParamDto.setApi("ofs.receipt.search"); -// queryOfsStockinOrderRequestVO.setInternalInstructionType("ADJUST");//入库单类型 SALES销售 EXCHANGE换货 REISSUE补发RETURN销退 PURCHASE采购 PURCHASE_RETURN采退 TRANSFER调拨 WORK_ORDER加工 OTHER其他 ADJUST调整 EXCHANGE换货 + queryOfsStockinOrderRequestVO.setInternalInstructionType("ADJUST");//入库单类型 SALES销售 EXCHANGE换货 REISSUE补发RETURN销退 PURCHASE采购 PURCHASE_RETURN采退 TRANSFER调拨 WORK_ORDER加工 OTHER其他 ADJUST调整 EXCHANGE换货 queryOfsStockinOrderRequestVO.setClientCode("LETS"); interfaceParamDto.setData(JSON.toJSONString(queryOfsStockinOrderRequestVO)); StockinOrderSearchResponse stockinOrderSearchResponse = (StockinOrderSearchResponse) ofsUnifiedService.unified(interfaceParamDto); @@ -366,15 +366,7 @@ public class AdjustInPluginInitializer extends PluginBaseEntity { if (stockinOrderSearchResponse.getData() == null || stockinOrderSearchResponse.getData().size() == 0) { return null; } - //过滤ADJUST调整 - List adjustList = new ArrayList<>(); - for (StockinOrderSearchResponse.StockinOrder datum : stockinOrderSearchResponse.getData()) { - StockinOrderSearchResponse.StockinOrder.StockinH header = datum.getHeader(); - if ("ADJUST".equals(header.getInternalInstructionType())) { - adjustList.add(datum); - } - } - return adjustList; + return stockinOrderSearchResponse.getData(); } diff --git a/buildpackage/src/main/java/com/hzya/frame/plugin/lets/plugin/transfer/TransferInPluginInitializer.java b/buildpackage/src/main/java/com/hzya/frame/plugin/lets/plugin/transfer/TransferInPluginInitializer.java index f31ee2d0..6d14ffed 100644 --- a/buildpackage/src/main/java/com/hzya/frame/plugin/lets/plugin/transfer/TransferInPluginInitializer.java +++ b/buildpackage/src/main/java/com/hzya/frame/plugin/lets/plugin/transfer/TransferInPluginInitializer.java @@ -89,9 +89,11 @@ public class TransferInPluginInitializer extends PluginBaseEntity { String endTimeStr = DateUtil.format(endTime, "yyyy-MM-dd HH:mm:ss"); QueryOfsStockinOrderRequestVO queryOfsStockinOrderRequestVO = new QueryOfsStockinOrderRequestVO(); - queryOfsStockinOrderRequestVO.setCreated_start("2024-08-05 00:00:00"); - queryOfsStockinOrderRequestVO.setCreated_end("2024-08-09 23:59:59"); - queryOfsStockinOrderRequestVO.setCompanyCode("SHXM"); +// queryOfsStockinOrderRequestVO.setCreated_start("2024-08-05 00:00:00"); +// queryOfsStockinOrderRequestVO.setCreated_end("2024-08-09 23:59:59"); + queryOfsStockinOrderRequestVO.setClosedAt_start("2024-08-05 00:00:00"); + queryOfsStockinOrderRequestVO.setClosedAt_end("2024-08-09 23:59:59"); +// queryOfsStockinOrderRequestVO.setCompanyCode("SHXM"); // queryOfsTransferOrderRequestVO.setStatus("900");//状态 500待同步 510已同步 700收货中 900入库完成 911作废 100订单池 200暂挂 400待合单 410待出库单出库 queryOfsStockinOrderRequestVO.setPageNo(1L); queryOfsStockinOrderRequestVO.setPageSize(500L); @@ -113,6 +115,16 @@ public class TransferInPluginInitializer extends PluginBaseEntity { */ public void start(String stockinNo) { try { + + QueryOfsStockinOrderRequestVO queryOfsStockinOrderRequestVO = new QueryOfsStockinOrderRequestVO(); + queryOfsStockinOrderRequestVO.setCode(stockinNo); + queryOfsStockinOrderRequestVO.setPageNo(1L); + queryOfsStockinOrderRequestVO.setPageSize(500L); + List data = queryOfsStockinOrder(queryOfsStockinOrderRequestVO); + System.out.println(data); + + + } catch (Exception e) { logger.error("丽知:OFS调拨入库订单--->U8C调拨订单(保存签字,自动生成调拨出入库),start(String goodsName)方法报错:", e); } @@ -128,6 +140,17 @@ public class TransferInPluginInitializer extends PluginBaseEntity { Date business_end = DateUtil.parse(endTime); String start = DateUtil.format(business_start, "yyyy-MM-dd") + " 00:00:00"; String end = DateUtil.format(business_end, "yyyy-MM-dd") + " 23:59:59"; + + QueryOfsStockinOrderRequestVO queryOfsStockinOrderRequestVO = new QueryOfsStockinOrderRequestVO(); + queryOfsStockinOrderRequestVO.setClosedAt_start("2024-08-05 00:00:00"); + queryOfsStockinOrderRequestVO.setClosedAt_end("2024-08-09 23:59:59"); +// queryOfsStockinOrderRequestVO.setCompanyCode("SHXM"); +// queryOfsTransferOrderRequestVO.setStatus("900");//状态 500待同步 510已同步 700收货中 900入库完成 911作废 100订单池 200暂挂 400待合单 410待出库单出库 + queryOfsStockinOrderRequestVO.setPageNo(1L); + queryOfsStockinOrderRequestVO.setPageSize(500L); + List data = queryOfsStockinOrder(queryOfsStockinOrderRequestVO); + System.out.println(data); + } catch (Exception e) { logger.error("丽知:OFS调拨入库订单--->U8C调拨订单(保存签字,自动生成调拨出入库),start(String startTime, String endTime)方法报错:", e); } @@ -137,7 +160,7 @@ public class TransferInPluginInitializer extends PluginBaseEntity { public List queryOfsStockinOrder(QueryOfsStockinOrderRequestVO queryOfsStockinOrderRequestVO) throws Exception { InterfaceParamDto interfaceParamDto = new InterfaceParamDto(); interfaceParamDto.setApi("ofs.receipt.search"); -// queryOfsStockinOrderRequestVO.setInternalInstructionType("ADJUST");//入库单类型 SALES销售 EXCHANGE换货 REISSUE补发RETURN销退 PURCHASE采购 PURCHASE_RETURN采退 TRANSFER调拨 WORK_ORDER加工 OTHER其他 ADJUST调整 EXCHANGE换货 + queryOfsStockinOrderRequestVO.setInternalInstructionType("TRANSFER");//入库单类型 SALES销售 EXCHANGE换货 REISSUE补发RETURN销退 PURCHASE采购 PURCHASE_RETURN采退 TRANSFER调拨 WORK_ORDER加工 OTHER其他 ADJUST调整 EXCHANGE换货 queryOfsStockinOrderRequestVO.setClientCode("LETS"); interfaceParamDto.setData(JSON.toJSONString(queryOfsStockinOrderRequestVO)); StockinOrderSearchResponse stockinOrderSearchResponse = (StockinOrderSearchResponse) ofsUnifiedService.unified(interfaceParamDto); diff --git a/buildpackage/src/main/java/com/hzya/frame/plugin/lets/plugin/transfer/TransferOutPluginInitializer.java b/buildpackage/src/main/java/com/hzya/frame/plugin/lets/plugin/transfer/TransferOutPluginInitializer.java index f996f624..6cfff34c 100644 --- a/buildpackage/src/main/java/com/hzya/frame/plugin/lets/plugin/transfer/TransferOutPluginInitializer.java +++ b/buildpackage/src/main/java/com/hzya/frame/plugin/lets/plugin/transfer/TransferOutPluginInitializer.java @@ -6,11 +6,13 @@ import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONObject; import com.hzya.frame.base.PluginBaseEntity; import com.hzya.frame.plugin.lets.ofsvo.QueryOfsStockinOrderRequestVO; +import com.hzya.frame.plugin.lets.ofsvo.QueryOfsStockoutOrderRequestVO; import com.hzya.frame.plugin.lets.util.PushDataByU8cUtil; import com.hzya.frame.plugin.lets.util.SaveOrUpdateBusinessLogUtil; import com.hzya.frame.sysnew.integtationTaskLivingDetails.dao.IIntegrationTaskLivingDetailsDao; import com.hzya.frame.ttxofs.dto.InterfaceParamDto; import com.hzya.frame.ttxofs.dto.stock.StockinOrderSearchResponse; +import com.hzya.frame.ttxofs.dto.stock.StockoutOrderSearchResponse; import com.hzya.frame.ttxofs.service.OfsUnifiedService; import com.hzya.frame.web.entity.JsonResultEntity; import org.slf4j.Logger; @@ -88,14 +90,14 @@ public class TransferOutPluginInitializer extends PluginBaseEntity { String startTimeStr = DateUtil.format(startTime, "yyyy-MM-dd HH:mm:ss"); String endTimeStr = DateUtil.format(endTime, "yyyy-MM-dd HH:mm:ss"); - QueryOfsStockinOrderRequestVO queryOfsStockinOrderRequestVO = new QueryOfsStockinOrderRequestVO(); - queryOfsStockinOrderRequestVO.setCreated_start("2024-08-05 00:00:00"); - queryOfsStockinOrderRequestVO.setCreated_end("2024-08-09 23:59:59"); - queryOfsStockinOrderRequestVO.setCompanyCode("SHXM"); -// queryOfsTransferOrderRequestVO.setStatus("900");//状态 500待同步 510已同步 700收货中 900入库完成 911作废 100订单池 200暂挂 400待合单 410待出库单出库 - queryOfsStockinOrderRequestVO.setPageNo(1L); - queryOfsStockinOrderRequestVO.setPageSize(500L); - List data = queryOfsStockinOrder(queryOfsStockinOrderRequestVO); + QueryOfsStockoutOrderRequestVO queryOfsStockoutOrderRequestVO = new QueryOfsStockoutOrderRequestVO(); + queryOfsStockoutOrderRequestVO.setClosedAt_start(startTimeStr); + queryOfsStockoutOrderRequestVO.setClosedAt_end(endTimeStr); +// queryOfsStockoutOrderRequestVO.setCompanyCode("SHXM"); +// queryOfsStockoutOrderRequestVO.setStatus("900");//状态 500待同步 510已同步 700收货中 900入库完成 911作废 100订单池 200暂挂 400待合单 410待出库单出库 + queryOfsStockoutOrderRequestVO.setPageNo(1L); + queryOfsStockoutOrderRequestVO.setPageSize(500L); + List data = queryOfsStockoutOrder(queryOfsStockoutOrderRequestVO); System.out.println(data); //过滤日志 @@ -113,6 +115,15 @@ public class TransferOutPluginInitializer extends PluginBaseEntity { */ public void start(String stockinNo) { try { + QueryOfsStockoutOrderRequestVO queryOfsStockoutOrderRequestVO = new QueryOfsStockoutOrderRequestVO(); + queryOfsStockoutOrderRequestVO.setCode(stockinNo); +// queryOfsStockoutOrderRequestVO.setCompanyCode("SHXM"); +// queryOfsStockoutOrderRequestVO.setStatus("900");//状态 500待同步 510已同步 700收货中 900入库完成 911作废 100订单池 200暂挂 400待合单 410待出库单出库 + queryOfsStockoutOrderRequestVO.setPageNo(1L); + queryOfsStockoutOrderRequestVO.setPageSize(500L); + List data = queryOfsStockoutOrder(queryOfsStockoutOrderRequestVO); + System.out.println(data); + } catch (Exception e) { logger.error("丽知:OFS调拨出库订单--->U8C调拨出库单(保存签字),start(String goodsName)方法报错:", e); } @@ -128,31 +139,34 @@ public class TransferOutPluginInitializer extends PluginBaseEntity { Date business_end = DateUtil.parse(endTime); String start = DateUtil.format(business_start, "yyyy-MM-dd") + " 00:00:00"; String end = DateUtil.format(business_end, "yyyy-MM-dd") + " 23:59:59"; + + QueryOfsStockoutOrderRequestVO queryOfsStockoutOrderRequestVO = new QueryOfsStockoutOrderRequestVO(); + queryOfsStockoutOrderRequestVO.setClosedAt_start(start); + queryOfsStockoutOrderRequestVO.setClosedAt_end(end); +// queryOfsStockoutOrderRequestVO.setCompanyCode("SHXM"); +// queryOfsStockoutOrderRequestVO.setStatus("900");//状态 500待同步 510已同步 700收货中 900入库完成 911作废 100订单池 200暂挂 400待合单 410待出库单出库 + queryOfsStockoutOrderRequestVO.setPageNo(1L); + queryOfsStockoutOrderRequestVO.setPageSize(500L); + List data = queryOfsStockoutOrder(queryOfsStockoutOrderRequestVO); + System.out.println(data); + } catch (Exception e) { logger.error("丽知:OFS调拨出库订单--->U8C调拨出库单(保存签字),start(String startTime, String endTime)方法报错:", e); } } - public List queryOfsStockinOrder(QueryOfsStockinOrderRequestVO queryOfsStockinOrderRequestVO) throws Exception { + public List queryOfsStockoutOrder(QueryOfsStockoutOrderRequestVO queryOfsStockoutOrderRequestVO) throws Exception { InterfaceParamDto interfaceParamDto = new InterfaceParamDto(); interfaceParamDto.setApi("ofs.shipment.search"); - queryOfsStockinOrderRequestVO.setInternalInstructionType("TRANSFER");//入库单类型 SALES销售 EXCHANGE换货 REISSUE补发RETURN销退 PURCHASE采购 PURCHASE_RETURN采退 TRANSFER调拨 WORK_ORDER加工 OTHER其他 ADJUST调整 EXCHANGE换货 - queryOfsStockinOrderRequestVO.setClientCode("LETS"); - interfaceParamDto.setData(JSON.toJSONString(queryOfsStockinOrderRequestVO)); - StockinOrderSearchResponse stockinOrderSearchResponse = (StockinOrderSearchResponse) ofsUnifiedService.unified(interfaceParamDto); - System.out.println(stockinOrderSearchResponse); - if(stockinOrderSearchResponse.getData()==null||stockinOrderSearchResponse.getData().size()==0){ + queryOfsStockoutOrderRequestVO.setInternalInstructionType("TRANSFER");//入库单类型 SALES销售 EXCHANGE换货 REISSUE补发RETURN销退 PURCHASE采购 PURCHASE_RETURN采退 TRANSFER调拨 WORK_ORDER加工 OTHER其他 ADJUST调整 EXCHANGE换货 + queryOfsStockoutOrderRequestVO.setClientCode("LETS"); + interfaceParamDto.setData(JSON.toJSONString(queryOfsStockoutOrderRequestVO)); + StockoutOrderSearchResponse stockoutOrderSearchResponse = (StockoutOrderSearchResponse) ofsUnifiedService.unified(interfaceParamDto); + System.out.println(stockoutOrderSearchResponse); + if(stockoutOrderSearchResponse.getData()==null||stockoutOrderSearchResponse.getData().size()==0){ return null; } - //过滤ADJUST调整 - List adjustList=new ArrayList<>(); - for (StockinOrderSearchResponse.StockinOrder datum : stockinOrderSearchResponse.getData()) { - StockinOrderSearchResponse.StockinOrder.StockinH header = datum.getHeader(); - if("ADJUST".equals(header.getInternalInstructionType())){ - adjustList.add(datum); - } - } - return adjustList; + return stockoutOrderSearchResponse.getData(); } } diff --git a/buildpackage/src/main/resources/cfgHome/plugin/lets/spring/spring-lets-plugin.xml b/buildpackage/src/main/resources/cfgHome/plugin/lets/spring/spring-lets-plugin.xml index 416b09f4..9caef233 100644 --- a/buildpackage/src/main/resources/cfgHome/plugin/lets/spring/spring-lets-plugin.xml +++ b/buildpackage/src/main/resources/cfgHome/plugin/lets/spring/spring-lets-plugin.xml @@ -17,6 +17,7 @@ + diff --git a/buildpackage/src/test/java/com/hzya/frame/plugin/lets/plugin/transfer/TransferTest.java b/buildpackage/src/test/java/com/hzya/frame/plugin/lets/plugin/transfer/TransferTest.java index b1d6ff22..917452ab 100644 --- a/buildpackage/src/test/java/com/hzya/frame/plugin/lets/plugin/transfer/TransferTest.java +++ b/buildpackage/src/test/java/com/hzya/frame/plugin/lets/plugin/transfer/TransferTest.java @@ -18,6 +18,8 @@ public class TransferTest { @Autowired private TransferInPluginInitializer transferInPluginInitializer; @Autowired + private TransferOutPluginInitializer transferOutPluginInitializer; + @Autowired private AdjustInPluginInitializer adjustInPluginInitializer; @Autowired private AdjustOutPluginInitializer adjustOutPluginInitializer; @@ -36,6 +38,16 @@ public class TransferTest { ////////////////////////////////////////////////////////////////////////////////////调拨出库单 + @Test + public void t10(){ + transferOutPluginInitializer.start(); + } + + @Test + public void t11(){ + transferOutPluginInitializer.start("2024-08-06","2024-08-11"); + } + ////////////////////////////////////////////////////////////////////////////////////调拨入库单 @Test public void t20(){ @@ -43,7 +55,7 @@ public class TransferTest { } @Test public void t21(){ - transferInPluginInitializer.start("LETS-TH2024080800000003"); + transferInPluginInitializer.start("LETS-RE2024080800000002"); }