From 09ec6759dcf0aa9cc33f54c39375c0c88358f2ef Mon Sep 17 00:00:00 2001 From: zhengyf Date: Tue, 13 Aug 2024 16:43:20 +0800 Subject: [PATCH 1/4] =?UTF-8?q?=E4=B8=BD=E7=9F=A5=EF=BC=9A=E6=96=B0?= =?UTF-8?q?=E5=A2=9EOFS=E8=B0=83=E6=95=B4=E5=85=A5=E5=BA=93=E5=8D=95?= =?UTF-8?q?=E6=8E=A8=E9=80=81U8C=E5=85=B6=E4=BB=96=E5=85=A5=E5=BA=93?= =?UTF-8?q?=E5=8D=95=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../plugin/lets/constant/OverallConstant.java | 4 + .../lets/ofsvo/QueryOfsGoodsRequestVO.java | 16 ++ .../ofsvo/QueryOfsStockinOrderRequestVO.java | 3 + .../ofsvo/QueryOfsTransferOrderRequestVO.java | 3 + .../adjust/AdjustInPluginInitializer.java | 230 +++++++++++++++++- .../adjust/AdjustOutPluginInitializer.java | 155 ++++++++++++ .../plugin/base/GoodsPluginInitializer.java | 21 ++ .../TransferOutPluginInitializer.java | 158 ++++++++++++ .../transfer/TransferPluginInitializer.java | 4 +- .../lets/u8cdto/GeneralBillVO_4ADto.java | 220 +---------------- .../plugin/lets/u8cdto/ReusltStrDto.java | 29 +-- .../lets/spring/spring-sowow-plugin.xml | 2 + .../plugin/lets/plugin/base/BaseTest.java | 2 +- .../lets/plugin/transfer/TransferTest.java | 19 ++ .../frame/ttxofs/basics/ApiDtoCacheMap.java | 3 + .../ofsBaseSearch/OFSGoodsSearchResponse.java | 10 + 16 files changed, 628 insertions(+), 251 deletions(-) create mode 100644 buildpackage/src/main/java/com/hzya/frame/plugin/lets/ofsvo/QueryOfsGoodsRequestVO.java create mode 100644 buildpackage/src/main/java/com/hzya/frame/plugin/lets/plugin/adjust/AdjustOutPluginInitializer.java create mode 100644 buildpackage/src/main/java/com/hzya/frame/plugin/lets/plugin/transfer/TransferOutPluginInitializer.java create mode 100644 service/src/main/java/com/hzya/frame/ttxofs/dto/ofsBaseSearch/OFSGoodsSearchResponse.java diff --git a/buildpackage/src/main/java/com/hzya/frame/plugin/lets/constant/OverallConstant.java b/buildpackage/src/main/java/com/hzya/frame/plugin/lets/constant/OverallConstant.java index 5227e992..ac63dddb 100644 --- a/buildpackage/src/main/java/com/hzya/frame/plugin/lets/constant/OverallConstant.java +++ b/buildpackage/src/main/java/com/hzya/frame/plugin/lets/constant/OverallConstant.java @@ -40,6 +40,10 @@ public class OverallConstant { //调拨 prodOverPublic.put("approveqz", "/u8cloud/api/to/transorder/saveapprove");//调拨订单保存即审批 + //其他出入库 + prodOverPublic.put("otherinqz", "/u8cloud/api/ic/otherin/save/sign");//库存其他入库保存即签字 + + prodOverPublic.put("custdocSave", "/u8cloud/api/uapbd/custdoc/insert");//客商档案新增 diff --git a/buildpackage/src/main/java/com/hzya/frame/plugin/lets/ofsvo/QueryOfsGoodsRequestVO.java b/buildpackage/src/main/java/com/hzya/frame/plugin/lets/ofsvo/QueryOfsGoodsRequestVO.java new file mode 100644 index 00000000..857c6930 --- /dev/null +++ b/buildpackage/src/main/java/com/hzya/frame/plugin/lets/ofsvo/QueryOfsGoodsRequestVO.java @@ -0,0 +1,16 @@ +package com.hzya.frame.plugin.lets.ofsvo; + +import lombok.Data; + +/** + * OFS SKU查询请求类 + */ +@Data +public class QueryOfsGoodsRequestVO { + /** 开始时间 */ + private String created_start; + /** 结束时间 */ + private String created_end; + /** 组织 */ + private String clientCode; +} 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 0c6bde26..b6d330e2 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 @@ -2,6 +2,9 @@ package com.hzya.frame.plugin.lets.ofsvo; import lombok.Data; +/** + * OFS调整入库请求类 + */ @Data public class QueryOfsStockinOrderRequestVO { /** 开始时间 */ diff --git a/buildpackage/src/main/java/com/hzya/frame/plugin/lets/ofsvo/QueryOfsTransferOrderRequestVO.java b/buildpackage/src/main/java/com/hzya/frame/plugin/lets/ofsvo/QueryOfsTransferOrderRequestVO.java index e4a7af5c..b81a334e 100644 --- a/buildpackage/src/main/java/com/hzya/frame/plugin/lets/ofsvo/QueryOfsTransferOrderRequestVO.java +++ b/buildpackage/src/main/java/com/hzya/frame/plugin/lets/ofsvo/QueryOfsTransferOrderRequestVO.java @@ -2,6 +2,9 @@ package com.hzya.frame.plugin.lets.ofsvo; import lombok.Data; +/** + * OFS调拨订单查询请求类 + */ @Data public class QueryOfsTransferOrderRequestVO { /** 开始时间 */ 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 225909ba..b011def0 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 @@ -2,13 +2,23 @@ package com.hzya.frame.plugin.lets.plugin.adjust; import cn.hutool.core.date.DateField; import cn.hutool.core.date.DateUtil; +import cn.hutool.core.lang.Assert; +import cn.hutool.json.JSONUtil; import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONObject; import com.hzya.frame.base.PluginBaseEntity; +import com.hzya.frame.plugin.lets.constant.OverallConstant; +import com.hzya.frame.plugin.lets.constant.ProfilesActiveConstant; +import com.hzya.frame.plugin.lets.dao.IBdRdclDao; +import com.hzya.frame.plugin.lets.entity.BdRdclEntity; import com.hzya.frame.plugin.lets.ofsvo.QueryOfsStockinOrderRequestVO; +import com.hzya.frame.plugin.lets.u8cdto.BillVO; +import com.hzya.frame.plugin.lets.u8cdto.GeneralBillVO_4ADto; +import com.hzya.frame.plugin.lets.u8cdto.ReusltStrDto; 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.sysnew.integtationTaskLivingDetails.entity.IntegrationTaskLivingDetailsEntity; import com.hzya.frame.ttxofs.dto.InterfaceParamDto; import com.hzya.frame.ttxofs.dto.stock.StockinOrderSearchResponse; import com.hzya.frame.ttxofs.service.OfsUnifiedService; @@ -67,6 +77,9 @@ public class AdjustInPluginInitializer extends PluginBaseEntity { @Autowired private OfsUnifiedService ofsUnifiedService; + @Autowired + private IBdRdclDao iBdRdclDao; + @Override public JsonResultEntity executeBusiness(JSONObject requestJson) throws Exception { return null; @@ -86,18 +99,26 @@ public class AdjustInPluginInitializer 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-12 00:00:00"); + queryOfsStockinOrderRequestVO.setCreated_end("2024-08-13 23:59:59"); + queryOfsStockinOrderRequestVO.setCompanyCode("SHLZ"); // 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); + List stockinOrders = queryOfsStockinOrder(queryOfsStockinOrderRequestVO); + System.out.println(stockinOrders); + if (stockinOrders.size() == 0) { + return; + } //过滤日志 + List filterStockinOrders = filterData(stockinOrders); + if (filterStockinOrders.size() == 0) { + return; + } //推送 + implement(filterStockinOrders); } catch (Exception e) { @@ -110,6 +131,30 @@ public class AdjustInPluginInitializer extends PluginBaseEntity { */ public void start(String stockinNo) { try { + + QueryOfsStockinOrderRequestVO queryOfsStockinOrderRequestVO = new QueryOfsStockinOrderRequestVO(); + queryOfsStockinOrderRequestVO.setCreated_start("2024-08-12 00:00:00"); + queryOfsStockinOrderRequestVO.setCreated_end("2024-08-13 23:59:59"); + queryOfsStockinOrderRequestVO.setCode(stockinNo); + queryOfsStockinOrderRequestVO.setCompanyCode("SHLZ"); +// queryOfsTransferOrderRequestVO.setStatus("900");//状态 500待同步 510已同步 700收货中 900入库完成 911作废 100订单池 200暂挂 400待合单 410待出库单出库 + queryOfsStockinOrderRequestVO.setPageNo(1L); + queryOfsStockinOrderRequestVO.setPageSize(500L); + List stockinOrders = queryOfsStockinOrder(queryOfsStockinOrderRequestVO); + System.out.println(stockinOrders); + + if (stockinOrders.size() == 0) { + return; + } + //过滤日志 + List filterStockinOrders = filterData(stockinOrders); + if (filterStockinOrders.size() == 0) { + return; + } + + //推送 + implement(filterStockinOrders); + } catch (Exception e) { logger.error("丽知:OFS调整入库--->U8C其它入库,start(String goodsName)方法报错:", e); } @@ -130,6 +175,158 @@ public class AdjustInPluginInitializer extends PluginBaseEntity { } } + /** + * 过滤成功日志 + * + * @return + */ + public List filterData(List stockinOrders) { + List filterStockinOrders = new ArrayList<>(); + for (StockinOrderSearchResponse.StockinOrder stockinOrder : stockinOrders) { + StockinOrderSearchResponse.StockinOrder.StockinH header = stockinOrder.getHeader(); + String rootAppPk = header.getCode(); + boolean isExis = true; + IntegrationTaskLivingDetailsEntity integrationTaskLivingDetailsEntity = new IntegrationTaskLivingDetailsEntity(); + integrationTaskLivingDetailsEntity.setRootAppPk(rootAppPk); + integrationTaskLivingDetailsEntity.setNewState(ProfilesActiveConstant.LOG_STATUS_Y); + integrationTaskLivingDetailsEntity.setPluginId(getPluginId()); + List integrationTaskLivingDetailsEntities = iIntegrationTaskLivingDetailsDao.query(integrationTaskLivingDetailsEntity); + if (integrationTaskLivingDetailsEntities == null || integrationTaskLivingDetailsEntities.size() == 0) { + isExis = false; + } + if (!isExis) { + filterStockinOrders.add(stockinOrder); + } + } + return filterStockinOrders; + } + + /** + * 推送U8C其它入库单 + * @param filterStockinOrders + */ + public void implement(List filterStockinOrders){ + for (StockinOrderSearchResponse.StockinOrder stockinOrder : filterStockinOrders) { + String mapStr = ""; + String format=""; + String response=""; + String ofsCode=""; + try{ + //主表 + StockinOrderSearchResponse.StockinOrder.StockinH ofsHeader = stockinOrder.getHeader(); + GeneralBillVO_4ADto generalBillVO_4A = new GeneralBillVO_4ADto(); + GeneralBillVO_4ADto.Parentvo parentvo = new GeneralBillVO_4ADto.Parentvo(); + + ofsCode=ofsHeader.getCode(); + + //pk_corp--公司 + parentvo.setPk_corp(ofsHeader.getCompanyCode()); + //pk_calbody--库存组织PK + parentvo.setPk_calbody(ofsHeader.getCompanyCode()); + //cwarehouseid--仓库 + parentvo.setCwarehouseid(ofsHeader.getFacilityCode()); + + //vnote--备注 + parentvo.setVnote(ofsHeader.getNote()); + //dbilldate--单据日期--oms入库时间 + Date created = ofsHeader.getCreated(); + format = DateUtil.format(created, "yyyy-MM-dd HH:mm:ss"); + parentvo.setDbilldate(format); + //coperatorid--制单人 + parentvo.setCoperatorid("tbadmin"); + //审核时间dauditdate + parentvo.setDauditdate(format); + + //cdispatcherid--收发类别,ofs过来的写死,20240813(妮姐+万万),就是调整出库,调整入库 + BdRdclEntity bdRdclEntity = new BdRdclEntity(); + bdRdclEntity.setRdname("调整入库"); + bdRdclEntity.setDr(0); + bdRdclEntity.setDataSourceCode(ProfilesActiveConstant.LETS_DATE_SOURCE); + List BdRdclEntityList = iBdRdclDao.query(bdRdclEntity); + if(BdRdclEntityList.size()==0){ + Assert.state(false,"查询U8C收发类型:调整入库失败。未查询到U8C收发类型。"); + } + String RdclCode = BdRdclEntityList.get(0).getRdcode();//收发类别编码 + parentvo.setCdispatcherid(RdclCode); + + //子表 + List childrenvo=new ArrayList<>(); + for (StockinOrderSearchResponse.StockinOrder.StockinB ofsDetail : stockinOrder.getDetails()) { + System.out.println(ofsDetail); + GeneralBillVO_4ADto.Childrenvo children = new GeneralBillVO_4ADto.Childrenvo(); + + //dbizdate业务日期 + children.setDbizdate(format); + + //存货档案id + children.setCinventoryid(ofsDetail.getSkuCode()); + + //nshouldinnum--应入数量 + children.setNshouldinnum(String.valueOf(ofsDetail.getRequestQty())); + + //nintnum--实入数量 + children.setNinnum(String.valueOf(ofsDetail.getReceivedQty())); + + childrenvo.add(children); + } + generalBillVO_4A.setParentvo(parentvo); + generalBillVO_4A.setChildrenvo(childrenvo); + String dataJson = JSONUtil.toJsonStr(generalBillVO_4A); + mapStr = "{\"GeneralBillVO_4A\":[" + dataJson + "]}"; + + //推送 + response = pushDataByU8cUtil.pushU8CByCode(OverallConstant.getOverAllValue("otherinqz"), mapStr); + System.out.println(response); + boolean isSuccess = false; + String vbillcode=""; + if (response != null && !"".equals(response)) { + ReusltStrDto reusltStrDto = JSON.parseObject(response, ReusltStrDto.class); + if ("success".equals(reusltStrDto.getStatus())) { + isSuccess = true; + String data = reusltStrDto.getData(); + GeneralBillVO_4ADto resGeneralBillVO = resultDataHandle(data); + System.out.println(resGeneralBillVO); + vbillcode = resGeneralBillVO.getParentvo().getVbillcode(); + } + } + if (!isSuccess) { + Assert.state(false, "推送U8C--> 丽知:OFS调整入库--->U8C其它入库 失败 接口返回结果:{} 接口入参:{}", response, mapStr); + } + + //成功 + IntegrationTaskLivingDetailsEntity integrationTaskLivingDetailsEntity = new IntegrationTaskLivingDetailsEntity(); + integrationTaskLivingDetailsEntity.setNewState(ProfilesActiveConstant.LOG_STATUS_Y); + integrationTaskLivingDetailsEntity.setRootAppNewData(mapStr); + integrationTaskLivingDetailsEntity.setNewTransmitInfo(response); + integrationTaskLivingDetailsEntity.setNewPushDate(new Date()); + integrationTaskLivingDetailsEntity.setBusinessDate(format); + integrationTaskLivingDetailsEntity.setRootAppPk(ofsCode); + integrationTaskLivingDetailsEntity.setRootAppBill(vbillcode);//u8c调拨订单号 + integrationTaskLivingDetailsEntity.setPluginId(getPluginId()); + saveOrUpdateBusinessLogUtil.saveOrUpdate(integrationTaskLivingDetailsEntity); + + }catch (Exception e){ + e.printStackTrace(); + logger.error("推送U8C,丽知:OFS调整入库--->U8C其它入库失败,失败原因:" + e); + + ReusltStrDto reusltStrDto = JSON.parseObject(response, ReusltStrDto.class); + + String ErrMessage ="推送U8C,丽知:OFS调整入库--->U8C其它入库失败,失败原因:"+ reusltStrDto.getErrormsg(); + //失败 + IntegrationTaskLivingDetailsEntity integrationTaskLivingDetailsEntity = new IntegrationTaskLivingDetailsEntity(); + integrationTaskLivingDetailsEntity.setNewState(ProfilesActiveConstant.LOG_STATUS_N); + integrationTaskLivingDetailsEntity.setRootAppNewData(mapStr); + integrationTaskLivingDetailsEntity.setNewTransmitInfo(ErrMessage); + integrationTaskLivingDetailsEntity.setNewPushDate(new Date()); + integrationTaskLivingDetailsEntity.setBusinessDate(format); + integrationTaskLivingDetailsEntity.setRootAppPk(ofsCode); + integrationTaskLivingDetailsEntity.setRootAppBill(null);//u8c调拨订单号 + integrationTaskLivingDetailsEntity.setPluginId(getPluginId()); + saveOrUpdateBusinessLogUtil.saveOrUpdate(integrationTaskLivingDetailsEntity); + } + } + } + public List queryOfsStockinOrder(QueryOfsStockinOrderRequestVO queryOfsStockinOrderRequestVO) throws Exception { InterfaceParamDto interfaceParamDto = new InterfaceParamDto(); @@ -139,17 +336,34 @@ public class AdjustInPluginInitializer extends PluginBaseEntity { interfaceParamDto.setData(JSON.toJSONString(queryOfsStockinOrderRequestVO)); StockinOrderSearchResponse stockinOrderSearchResponse = (StockinOrderSearchResponse) ofsUnifiedService.unified(interfaceParamDto); System.out.println(stockinOrderSearchResponse); - if(stockinOrderSearchResponse.getData()==null||stockinOrderSearchResponse.getData().size()==0){ + if (stockinOrderSearchResponse.getData() == null || stockinOrderSearchResponse.getData().size() == 0) { return null; } //过滤ADJUST调整 - List adjustList=new ArrayList<>(); + List adjustList = new ArrayList<>(); for (StockinOrderSearchResponse.StockinOrder datum : stockinOrderSearchResponse.getData()) { StockinOrderSearchResponse.StockinOrder.StockinH header = datum.getHeader(); - if("ADJUST".equals(header.getInternalInstructionType())){ + if ("ADJUST".equals(header.getInternalInstructionType())) { adjustList.add(datum); } } return adjustList; } + + + private GeneralBillVO_4ADto resultDataHandle(String resultData) { + try { + if (resultData != null && !"".equals(resultData)) { + if (resultData.contains("[")) { + resultData = resultData.substring(1, resultData.length() - 1); + } + return JSON.parseObject(resultData, GeneralBillVO_4ADto.class); + } + } catch (Exception e) { + e.printStackTrace(); + logger.error("解析返回参数失败的错误", e); + //如果解析失败,记录原因,但是不能影响结果的记录 + } + return null; + } } diff --git a/buildpackage/src/main/java/com/hzya/frame/plugin/lets/plugin/adjust/AdjustOutPluginInitializer.java b/buildpackage/src/main/java/com/hzya/frame/plugin/lets/plugin/adjust/AdjustOutPluginInitializer.java new file mode 100644 index 00000000..666426ae --- /dev/null +++ b/buildpackage/src/main/java/com/hzya/frame/plugin/lets/plugin/adjust/AdjustOutPluginInitializer.java @@ -0,0 +1,155 @@ +package com.hzya.frame.plugin.lets.plugin.adjust; + +import cn.hutool.core.date.DateField; +import cn.hutool.core.date.DateUtil; +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.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.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.util.ArrayList; +import java.util.Date; +import java.util.List; +import java.util.concurrent.locks.ReentrantLock; + +public class AdjustOutPluginInitializer extends PluginBaseEntity { + Logger logger = LoggerFactory.getLogger(AdjustOutPluginInitializer.class); + + private static final ReentrantLock LOCK = new ReentrantLock(true); + + @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.adjust.AdjustOutPluginInitializer"; + } + + @Override + public String getPluginName() { + return "丽知:OFS调整出库--->U8C其它入库"; + } + + @Override + public String getPluginLabel() { + return "丽知:OFS调整出库--->U8C其它入库"; + } + + @Override + public String getPluginType() { + return "1"; + } + + @Autowired + private IIntegrationTaskLivingDetailsDao iIntegrationTaskLivingDetailsDao; + @Autowired + private PushDataByU8cUtil pushDataByU8cUtil; + @Autowired + private SaveOrUpdateBusinessLogUtil saveOrUpdateBusinessLogUtil; + + @Autowired + private OfsUnifiedService ofsUnifiedService; + + @Override + public JsonResultEntity executeBusiness(JSONObject requestJson) throws Exception { + return null; + } + + + /** + * 默认推送 + */ + public void start() { + try { + //获取当前时间 + Date currentDate = new Date(); + Date startTime = DateUtil.offset(currentDate, DateField.MINUTE, -10); + Date endTime = DateUtil.offset(currentDate, DateField.MINUTE, -2); + 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); + System.out.println(data); + + //过滤日志 + + //推送 + + + } catch (Exception e) { + logger.error("丽知:OFS调整入库--->U8C其它入库,start()方法报错:", e); + } + } + + /** + * 按单号 + */ + public void start(String stockinNo) { + try { + } catch (Exception e) { + logger.error("丽知:OFS调整入库--->U8C其它入库,start(String goodsName)方法报错:", e); + } + + } + + /** + * 按时间区间 + */ + public void start(String startTime, String endTime) { + try { + Date business_start = DateUtil.parse(startTime); + 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"; + } catch (Exception e) { + logger.error("丽知:OFS调整入库--->U8C其它入库,start(String startTime, String endTime)方法报错:", e); + } + } + + + 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.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){ + 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; + } +} diff --git a/buildpackage/src/main/java/com/hzya/frame/plugin/lets/plugin/base/GoodsPluginInitializer.java b/buildpackage/src/main/java/com/hzya/frame/plugin/lets/plugin/base/GoodsPluginInitializer.java index 21a9935d..82fc0089 100644 --- a/buildpackage/src/main/java/com/hzya/frame/plugin/lets/plugin/base/GoodsPluginInitializer.java +++ b/buildpackage/src/main/java/com/hzya/frame/plugin/lets/plugin/base/GoodsPluginInitializer.java @@ -4,9 +4,13 @@ import cn.hutool.core.date.DateField; import cn.hutool.core.date.DateUtil; import com.alibaba.fastjson.JSONObject; import com.hzya.frame.base.PluginBaseEntity; +import com.hzya.frame.plugin.lets.ofsvo.QueryOfsGoodsRequestVO; +import com.hzya.frame.plugin.lets.ofsvo.QueryOfsTransferOrderRequestVO; 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.service.OfsUnifiedService; import com.hzya.frame.web.entity.JsonResultEntity; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -66,6 +70,9 @@ public class GoodsPluginInitializer extends PluginBaseEntity { private PushDataByU8cUtil pushDataByU8cUtil; @Autowired private SaveOrUpdateBusinessLogUtil saveOrUpdateBusinessLogUtil; + + @Autowired + private OfsUnifiedService ofsUnifiedService; @Override public JsonResultEntity executeBusiness(JSONObject requestJson) throws Exception { return null; @@ -93,6 +100,9 @@ public class GoodsPluginInitializer extends PluginBaseEntity { */ public void start(String goodsName) { try { + QueryOfsGoodsRequestVO queryOfsGoodsRequestVO = new QueryOfsGoodsRequestVO(); + + } catch (Exception e) { logger.error("丽知:丽知:OFS货品档案--->U8C货品档案,start(String goodsName)方法报错:", e); } @@ -113,6 +123,17 @@ public class GoodsPluginInitializer extends PluginBaseEntity { } } + /** + * 查询OFS SKU档案 + */ + public void queryOfsGoods(QueryOfsGoodsRequestVO queryOfsGoodsRequestVO) throws Exception { + InterfaceParamDto interfaceParamDto = new InterfaceParamDto(); + interfaceParamDto.setApi("ofs.sku.search"); + queryOfsGoodsRequestVO.setClientCode("LETS"); + 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 new file mode 100644 index 00000000..f996f624 --- /dev/null +++ b/buildpackage/src/main/java/com/hzya/frame/plugin/lets/plugin/transfer/TransferOutPluginInitializer.java @@ -0,0 +1,158 @@ +package com.hzya.frame.plugin.lets.plugin.transfer; + +import cn.hutool.core.date.DateField; +import cn.hutool.core.date.DateUtil; +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.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.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.util.ArrayList; +import java.util.Date; +import java.util.List; +import java.util.concurrent.locks.ReentrantLock; + +/** + * 丽知:OFS调拨出库订单--->U8C调拨出库单(保存签字) + */ +public class TransferOutPluginInitializer extends PluginBaseEntity { + Logger logger = LoggerFactory.getLogger(TransferOutPluginInitializer.class); + + private static final ReentrantLock LOCK = new ReentrantLock(true); + + @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.transfer.TransferOutPluginInitializer"; + } + + @Override + public String getPluginName() { + return "丽知:OFS调拨出库订单--->U8C调拨出库单(保存签字)"; + } + + @Override + public String getPluginLabel() { + return "丽知:OFS调拨出库订单--->U8C调拨出库单(保存签字)"; + } + + @Override + public String getPluginType() { + return "1"; + } + + @Autowired + private IIntegrationTaskLivingDetailsDao iIntegrationTaskLivingDetailsDao; + @Autowired + private PushDataByU8cUtil pushDataByU8cUtil; + @Autowired + private SaveOrUpdateBusinessLogUtil saveOrUpdateBusinessLogUtil; + + @Autowired + private OfsUnifiedService ofsUnifiedService; + + @Override + public JsonResultEntity executeBusiness(JSONObject requestJson) throws Exception { + return null; + } + + + /** + * 默认推送 + */ + public void start() { + try { + //获取当前时间 + Date currentDate = new Date(); + Date startTime = DateUtil.offset(currentDate, DateField.MINUTE, -10); + Date endTime = DateUtil.offset(currentDate, DateField.MINUTE, -2); + 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); + System.out.println(data); + + //过滤日志 + + //推送 + + + } catch (Exception e) { + logger.error("丽知:OFS调拨出库订单--->U8C调拨出库单(保存签字),start()方法报错:", e); + } + } + + /** + * 按单号 + */ + public void start(String stockinNo) { + try { + } catch (Exception e) { + logger.error("丽知:OFS调拨出库订单--->U8C调拨出库单(保存签字),start(String goodsName)方法报错:", e); + } + + } + + /** + * 按时间区间 + */ + public void start(String startTime, String endTime) { + try { + Date business_start = DateUtil.parse(startTime); + 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"; + } catch (Exception e) { + logger.error("丽知:OFS调拨出库订单--->U8C调拨出库单(保存签字),start(String startTime, String endTime)方法报错:", e); + } + } + + + public List queryOfsStockinOrder(QueryOfsStockinOrderRequestVO queryOfsStockinOrderRequestVO) 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){ + 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; + } +} diff --git a/buildpackage/src/main/java/com/hzya/frame/plugin/lets/plugin/transfer/TransferPluginInitializer.java b/buildpackage/src/main/java/com/hzya/frame/plugin/lets/plugin/transfer/TransferPluginInitializer.java index 2a635fe8..7cbafda1 100644 --- a/buildpackage/src/main/java/com/hzya/frame/plugin/lets/plugin/transfer/TransferPluginInitializer.java +++ b/buildpackage/src/main/java/com/hzya/frame/plugin/lets/plugin/transfer/TransferPluginInitializer.java @@ -275,7 +275,6 @@ public class TransferPluginInitializer extends PluginBaseEntity { parentvo.setCoutwhid(ofsHeader.getFacilityCode()); parentvo.setCoutwhid("01"); - //cincbid 调入组织编码 对应OFS->目标库存地点公司 parentvo.setCincbid("SHXM"); @@ -326,7 +325,6 @@ public class TransferPluginInitializer extends PluginBaseEntity { Assert.state(false, "推送U8C--> 丽知:OFS调拨订单--->U8C调拨订单(保存及签字) 失败 接口返回结果:{} 接口入参:{}", response, jsonStr); } - //成功 IntegrationTaskLivingDetailsEntity integrationTaskLivingDetailsEntity = new IntegrationTaskLivingDetailsEntity(); integrationTaskLivingDetailsEntity.setNewState(ProfilesActiveConstant.LOG_STATUS_Y); @@ -346,7 +344,7 @@ public class TransferPluginInitializer extends PluginBaseEntity { //失败 IntegrationTaskLivingDetailsEntity integrationTaskLivingDetailsEntity = new IntegrationTaskLivingDetailsEntity(); - integrationTaskLivingDetailsEntity.setNewState(ProfilesActiveConstant.LOG_STATUS_Y); + integrationTaskLivingDetailsEntity.setNewState(ProfilesActiveConstant.LOG_STATUS_N); integrationTaskLivingDetailsEntity.setRootAppNewData(mapStr); integrationTaskLivingDetailsEntity.setNewTransmitInfo(response); integrationTaskLivingDetailsEntity.setNewPushDate(new Date()); diff --git a/buildpackage/src/main/java/com/hzya/frame/plugin/lets/u8cdto/GeneralBillVO_4ADto.java b/buildpackage/src/main/java/com/hzya/frame/plugin/lets/u8cdto/GeneralBillVO_4ADto.java index 07a16983..0d77c960 100644 --- a/buildpackage/src/main/java/com/hzya/frame/plugin/lets/u8cdto/GeneralBillVO_4ADto.java +++ b/buildpackage/src/main/java/com/hzya/frame/plugin/lets/u8cdto/GeneralBillVO_4ADto.java @@ -1,23 +1,26 @@ package com.hzya.frame.plugin.lets.u8cdto; +import lombok.Data; + import java.util.List; /** * 库存其他入库单 * @author zyd */ +@Data public class GeneralBillVO_4ADto { /** * 表头 */ private Parentvo parentvo; - /** * 表体 */ private List childrenvo; - + @Data public static class Parentvo{ + private String vbillcode;// private String cwarehouseid;// private String pk_calbody;//库存组织 private String pk_corp;// @@ -30,85 +33,8 @@ public class GeneralBillVO_4ADto { private String vuserdef20;//自定义项20---》存旺店通出库单号:20240418习老师 - public String getVuserdef20() { - return vuserdef20; - } - - public void setVuserdef20(String vuserdef20) { - this.vuserdef20 = vuserdef20; - } - - public String getDauditdate() { - return dauditdate; - } - - public void setDauditdate(String dauditdate) { - this.dauditdate = dauditdate; - } - - public String getDbilldate() { - return dbilldate; - } - - public void setDbilldate(String dbilldate) { - this.dbilldate = dbilldate; - } - - public String getCoperatoridnow() { - return coperatoridnow; - } - - public void setCoperatoridnow(String coperatoridnow) { - this.coperatoridnow = coperatoridnow; - } - - public String getPk_corp() { - return pk_corp; - } - - public void setPk_corp(String pk_corp) { - this.pk_corp = pk_corp; - } - - public String getCwarehouseid() { - return cwarehouseid; - } - - public void setCwarehouseid(String cwarehouseid) { - this.cwarehouseid = cwarehouseid; - } - - public String getPk_calbody() { - return pk_calbody; - } - - public void setPk_calbody(String pk_calbody) { - this.pk_calbody = pk_calbody; - } - - public String getVnote() { - return vnote; - } - - public void setVnote(String vnote) { - this.vnote = vnote; - } - - public String getCoperatorid() { - return coperatorid; - } - public void setCoperatorid(String coperatorid) { - this.coperatorid = coperatorid; - } - - public String getCdispatcherid() { - return cdispatcherid; - } - - public void setCdispatcherid(String cdispatcherid) { - this.cdispatcherid = cdispatcherid; - } } + @Data public static class Childrenvo{ private String cinventoryid;//存货id private String castunitid; @@ -138,141 +64,7 @@ public class GeneralBillVO_4ADto { */ private String csourcebillbid; - public String getDbizdate() { - return dbizdate; - } - - public void setDbizdate(String dbizdate) { - this.dbizdate = dbizdate; - } - - public String getNshouldinnum() { - return nshouldinnum; - } - - public void setNshouldinnum(String nshouldinnum) { - this.nshouldinnum = nshouldinnum; - } - - public String getVsourcerowno() { - return vsourcerowno; - } - - public void setVsourcerowno(String vsourcerowno) { - this.vsourcerowno = vsourcerowno; - } - - public String getCsourcebillhid() { - return csourcebillhid; - } - - public void setCsourcebillhid(String csourcebillhid) { - this.csourcebillhid = csourcebillhid; - } - - public String getCsourcebillbid() { - return csourcebillbid; - } - - public void setCsourcebillbid(String csourcebillbid) { - this.csourcebillbid = csourcebillbid; - } - - public String getVsourcebillcode() { - return vsourcebillcode; - } - - public void setVsourcebillcode(String vsourcebillcode) { - this.vsourcebillcode = vsourcebillcode; - } - - public String getVbatchcode() { - return vbatchcode; - } - - public void setVbatchcode(String vbatchcode) { - this.vbatchcode = vbatchcode; - } - - public String getCinventoryid() { - return cinventoryid; - } - - public void setCinventoryid(String cinventoryid) { - this.cinventoryid = cinventoryid; - } - - public String getCastunitid() { - return castunitid; - } - - public void setCastunitid(String castunitid) { - this.castunitid = castunitid; - } - - public String getNinnum() { - return ninnum; - } - - public void setNinnum(String ninnum) { - this.ninnum = ninnum; - } - - public String getNprice() { - return nprice; - } - - public void setNprice(String nprice) { - this.nprice = nprice; - } - - public String getVnotebody() { - return vnotebody; - } - - public void setVnotebody(String vnotebody) { - this.vnotebody = vnotebody; - } - - public String getBonroadflag() { - return bonroadflag; - } - - public void setBonroadflag(String bonroadflag) { - this.bonroadflag = bonroadflag; - } - - public String getFlargess() { - return flargess; - } - - public void setFlargess(String flargess) { - this.flargess = flargess; - } - - public String getNshouldoutnum() { - return nshouldoutnum; - } - - public void setNshouldoutnum(String nshouldoutnum) { - this.nshouldoutnum = nshouldoutnum; - } } - public Parentvo getParentvo() { - return parentvo; - } - - public void setParentvo(Parentvo parentvo) { - this.parentvo = parentvo; - } - - public List getChildrenvo() { - return childrenvo; - } - - public void setChildrenvo(List childrenvo) { - this.childrenvo = childrenvo; - } } diff --git a/buildpackage/src/main/java/com/hzya/frame/plugin/lets/u8cdto/ReusltStrDto.java b/buildpackage/src/main/java/com/hzya/frame/plugin/lets/u8cdto/ReusltStrDto.java index 82b12679..818af13a 100644 --- a/buildpackage/src/main/java/com/hzya/frame/plugin/lets/u8cdto/ReusltStrDto.java +++ b/buildpackage/src/main/java/com/hzya/frame/plugin/lets/u8cdto/ReusltStrDto.java @@ -1,32 +1,11 @@ package com.hzya.frame.plugin.lets.u8cdto; -public class ReusltStrDto { +import lombok.Data; +@Data +public class ReusltStrDto { private String status; private String data; + private String errormsg; private String taskNumber; - - public String getStatus() { - return status; - } - - public void setStatus(String status) { - this.status = status; - } - - public String getData() { - return data; - } - - public void setData(String data) { - this.data = data; - } - - public String getTaskNumber() { - return taskNumber; - } - - public void setTaskNumber(String taskNumber) { - this.taskNumber = taskNumber; - } } 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-sowow-plugin.xml index a6ba466c..4e47ed20 100644 --- a/buildpackage/src/main/resources/cfgHome/plugin/lets/spring/spring-sowow-plugin.xml +++ b/buildpackage/src/main/resources/cfgHome/plugin/lets/spring/spring-sowow-plugin.xml @@ -17,6 +17,8 @@ + + diff --git a/buildpackage/src/test/java/com/hzya/frame/plugin/lets/plugin/base/BaseTest.java b/buildpackage/src/test/java/com/hzya/frame/plugin/lets/plugin/base/BaseTest.java index e1714116..b1bfaf23 100644 --- a/buildpackage/src/test/java/com/hzya/frame/plugin/lets/plugin/base/BaseTest.java +++ b/buildpackage/src/test/java/com/hzya/frame/plugin/lets/plugin/base/BaseTest.java @@ -23,6 +23,6 @@ public class BaseTest { @Test public void t01(){ - goodsAutoAllotPluginInitializer.start("0001A210000000000JOC"); + goodsAutoAllotPluginInitializer.start("0001A210000000000U4C"); } } 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 0cfe4c00..66f0b575 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 @@ -1,6 +1,7 @@ package com.hzya.frame.plugin.lets.plugin.transfer; import com.hzya.frame.WebappApplication; +import com.hzya.frame.plugin.lets.plugin.adjust.AdjustInPluginInitializer; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Autowired; @@ -15,6 +16,8 @@ public class TransferTest { @Autowired private TransferInPluginInitializer transferInPluginInitializer; + @Autowired + private AdjustInPluginInitializer adjustInPluginInitializer; ////////////////////////////////////////////////////////////////////////////////////调拨订单 @Test @@ -29,6 +32,7 @@ public class TransferTest { ////////////////////////////////////////////////////////////////////////////////////调拨出库单 + ////////////////////////////////////////////////////////////////////////////////////调拨入库单 @Test public void t20(){ @@ -40,4 +44,19 @@ public class TransferTest { } + + + ////////////////////////////////////////////////////////////////////////////////////调整入库单 + @Test + public void t30(){ + adjustInPluginInitializer.start(); + } + @Test + public void t31(){ + adjustInPluginInitializer.start("LETS-AH2024081300000003"); + } + + ////////////////////////////////////////////////////////////////////////////////////调整出库单 + + } diff --git a/service/src/main/java/com/hzya/frame/ttxofs/basics/ApiDtoCacheMap.java b/service/src/main/java/com/hzya/frame/ttxofs/basics/ApiDtoCacheMap.java index 7c4b86d4..f3b423db 100644 --- a/service/src/main/java/com/hzya/frame/ttxofs/basics/ApiDtoCacheMap.java +++ b/service/src/main/java/com/hzya/frame/ttxofs/basics/ApiDtoCacheMap.java @@ -27,5 +27,8 @@ public class ApiDtoCacheMap { apiDtoCacheMap.put("ofs.shipment.search", new SaleOutReturnMessageDto()); apiDtoCacheMap.put("ofs.receipt.search", new StockinOrderSearchResponse());//入库单查询 apiDtoCacheMap.put("ofs.transferOrder.search", new OFSTranseferOrderSearchResponse());//调拨订单 + + + apiDtoCacheMap.put("ofs.transferOrder.search", new OFSTranseferOrderSearchResponse());//SKU查询 } } diff --git a/service/src/main/java/com/hzya/frame/ttxofs/dto/ofsBaseSearch/OFSGoodsSearchResponse.java b/service/src/main/java/com/hzya/frame/ttxofs/dto/ofsBaseSearch/OFSGoodsSearchResponse.java new file mode 100644 index 00000000..91f871a2 --- /dev/null +++ b/service/src/main/java/com/hzya/frame/ttxofs/dto/ofsBaseSearch/OFSGoodsSearchResponse.java @@ -0,0 +1,10 @@ +package com.hzya.frame.ttxofs.dto.ofsBaseSearch; + +import lombok.Data; + +/** + * OFS SKU查询返回 + */ +@Data +public class OFSGoodsSearchResponse { +} From d5af8daf7758d5b240fcbe702556a24cd5a5d8c0 Mon Sep 17 00:00:00 2001 From: zhengyf Date: Tue, 13 Aug 2024 17:53:25 +0800 Subject: [PATCH 2/4] =?UTF-8?q?=E4=B8=BD=E7=9F=A5=EF=BC=9AOFS=E8=B0=83?= =?UTF-8?q?=E6=95=B4=E5=85=A5=E5=BA=93=E5=8D=95=E6=8E=A8=E9=80=81U8C?= =?UTF-8?q?=E5=85=B6=E4=BB=96=E5=85=A5=E5=BA=93=E5=8D=95=E8=B0=83=E6=95=B4?= =?UTF-8?q?=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../plugin/lets/plugin/adjust/AdjustInPluginInitializer.java | 1 + 1 file changed, 1 insertion(+) 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 b011def0..b8fe874f 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 @@ -233,6 +233,7 @@ public class AdjustInPluginInitializer extends PluginBaseEntity { format = DateUtil.format(created, "yyyy-MM-dd HH:mm:ss"); parentvo.setDbilldate(format); //coperatorid--制单人 + String createdBy = ofsHeader.getCreatedBy(); parentvo.setCoperatorid("tbadmin"); //审核时间dauditdate parentvo.setDauditdate(format); From a80fea45ed728440d64a4753511f8afb641b4af9 Mon Sep 17 00:00:00 2001 From: liuy <37787198+LiuyCodes@users.noreply.github.com> Date: Tue, 13 Aug 2024 18:21:50 +0800 Subject: [PATCH 3/4] =?UTF-8?q?=E6=8F=90=E4=BA=A4TOB=E4=B8=9A=E5=8A=A1?= =?UTF-8?q?=E4=BC=98=E5=8C=96=E6=B5=81=E7=A8=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../plugin/lets/constant/ExportConstant.java | 22 + .../TocofsReturngoodsDetailedEntity.java | 27 +- .../TocofsReturngoodsDetailedEntity.xml | 43 +- .../entity/TocofsSaleoutDetailedEntity.java | 29 + .../entity/TocofsSaleoutDetailedEntity.xml | 31 +- .../sales/SoSaleOutPluginInitializerToB.java | 937 ++++++++++++++++++ .../sales/SoSaleOutPluginInitializerToC.java | 7 +- .../SoSaleReturnPluginInitializerToC.java | 4 +- .../lets/u8cdto/OrderOutTobHeaderDto.java | 74 ++ .../lets/spring/spring-sowow-plugin.xml | 5 +- .../SoSaleOutPluginInitializerToBTest.java | 31 + .../ttxofs/service/OfsUnifiedService.java | 2 +- 12 files changed, 1174 insertions(+), 38 deletions(-) create mode 100644 buildpackage/src/main/java/com/hzya/frame/plugin/lets/constant/ExportConstant.java create mode 100644 buildpackage/src/main/java/com/hzya/frame/plugin/lets/plugin/sales/SoSaleOutPluginInitializerToB.java create mode 100644 buildpackage/src/main/java/com/hzya/frame/plugin/lets/u8cdto/OrderOutTobHeaderDto.java create mode 100644 buildpackage/src/test/java/com/hzya/frame/plugin/lets/plugin/sales/SoSaleOutPluginInitializerToBTest.java diff --git a/buildpackage/src/main/java/com/hzya/frame/plugin/lets/constant/ExportConstant.java b/buildpackage/src/main/java/com/hzya/frame/plugin/lets/constant/ExportConstant.java new file mode 100644 index 00000000..1d74e1bc --- /dev/null +++ b/buildpackage/src/main/java/com/hzya/frame/plugin/lets/constant/ExportConstant.java @@ -0,0 +1,22 @@ +package com.hzya.frame.plugin.lets.constant; + +import java.util.HashMap; +import java.util.Map; + +/** + * @Author:liuyang + * @Package:com.hzya.frame.plugin.lets.constant + * @Project:kangarooDataCenterV3 + * @name:ExportConstant + * @Date:2024/8/13 18:00 + * @Filename:ExportConstant + */ +public class ExportConstant { + + public static final Map exportConstant = new HashMap<>(); + + static { + exportConstant.put("xuni-intoyou-japan", "xuni-intoyou-japan"); + exportConstant.put("B2BFX20240001", "B2BFX20240001"); + } +} \ No newline at end of file diff --git a/buildpackage/src/main/java/com/hzya/frame/plugin/lets/ofs/entity/TocofsReturngoodsDetailedEntity.java b/buildpackage/src/main/java/com/hzya/frame/plugin/lets/ofs/entity/TocofsReturngoodsDetailedEntity.java index 04e4b418..90097f2c 100644 --- a/buildpackage/src/main/java/com/hzya/frame/plugin/lets/ofs/entity/TocofsReturngoodsDetailedEntity.java +++ b/buildpackage/src/main/java/com/hzya/frame/plugin/lets/ofs/entity/TocofsReturngoodsDetailedEntity.java @@ -149,10 +149,21 @@ public class TocofsReturngoodsDetailedEntity extends BaseEntity { * 业务日期 */ private String businessDate; + /** * 主表主键 */ - private String returngoodsId; +// private String returngoodsId; + + private String businessType; + + public String getBusinessType() { + return businessType; + } + + public void setBusinessType(String businessType) { + this.businessType = businessType; + } public String getReceiptId() { return receiptId; @@ -434,12 +445,12 @@ public class TocofsReturngoodsDetailedEntity extends BaseEntity { this.businessDate = businessDate; } - public String getReturngoodsId() { - return returngoodsId; - } - - public void setReturngoodsId(String returngoodsId) { - this.returngoodsId = returngoodsId; - } +// public String getReturngoodsId() { +// return returngoodsId; +// } +// +// public void setReturngoodsId(String returngoodsId) { +// this.returngoodsId = returngoodsId; +// } } \ No newline at end of file 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 d9390e4a..dfd0b4cd 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 @@ -39,8 +39,9 @@ - + + id @@ -78,9 +79,10 @@ ,new_system_number ,new_system_primary ,primary_key - ,business_date - ,returngoods_id + ,business_date + ,business_type + select @@ -120,6 +126,8 @@ and newSystemNumber = #{newSystemNumber} and newSystemPrimary = #{newSystemPrimary} and primaryKey = #{primaryKey} + and businessType = #{businessType} + and businessDate = #{businessDate} @@ -165,6 +173,8 @@ and newSystemNumber = #{newSystemNumber} and newSystemPrimary = #{newSystemPrimary} and primaryKey = #{primaryKey} + and businessType = #{businessType} + and businessDate = #{businessDate} @@ -212,6 +222,8 @@ and newSystemNumber like concat('%',#{newSystemNumber},'%') and newSystemPrimary like concat('%',#{newSystemPrimary},'%') and primaryKey like concat('%',#{primaryKey},'%') + and businessType like concat('%',#{businessType},'%') + and businessDate like concat('%',#{businessDate},'%') @@ -259,6 +271,8 @@ or newSystemNumber = #{newSystemNumber} or newSystemPrimary = #{newSystemPrimary} or primaryKey = #{primaryKey} + or businessType = #{businessType} + or businessDate = #{businessDate} @@ -348,19 +362,19 @@ - insert IGNORE into tocofs_saleout_detailed(clientCode, companyCode, facilityCode, shipmentCode, refOrderId, refOrderDetailId, refOrderCode, allocInvId, skuCode, skuName, sourceOrderCode, inventorySts, isGift, requestQty, shipQty, quantityUM, listPrice, itemTotalAmount, totalPayAmount, totalWeight, totalVolume, totalVolumeWeight, weightUM, volumeUM, created, createdBy, lastUpdated, lastUpdatedBy,newTransmitInfo,newPushDate,newState,newSystemNumber,newSystemPrimary,primaryKey) + insert IGNORE into tocofs_saleout_detailed(clientCode, companyCode, facilityCode, shipmentCode, refOrderId, refOrderDetailId, refOrderCode, allocInvId, skuCode, skuName, sourceOrderCode, inventorySts, isGift, requestQty, shipQty, quantityUM, listPrice, itemTotalAmount, totalPayAmount, totalWeight, totalVolume, totalVolumeWeight, weightUM, volumeUM, created, createdBy, lastUpdated, lastUpdatedBy,newTransmitInfo,newPushDate,newState,newSystemNumber,newSystemPrimary,primaryKey,businessType,businessDate) values - (#{entity.clientcode},#{entity.companycode},#{entity.facilitycode},#{entity.shipmentcode},#{entity.reforderid},#{entity.reforderdetailid},#{entity.refordercode},#{entity.allocinvid},#{entity.skucode},#{entity.skuname},#{entity.sourceordercode},#{entity.inventorysts},#{entity.isgift},#{entity.requestqty},#{entity.shipqty},#{entity.quantityum},#{entity.listprice},#{entity.itemtotalamount},#{entity.totalpayamount},#{entity.totalweight},#{entity.totalvolume},#{entity.totalvolumeweight},#{entity.weightum},#{entity.volumeum},#{entity.created},#{entity.createdby},#{entity.lastupdated},#{entity.lastupdatedby},#{entity.newTransmitInfo},#{entity.newPushDate},#{entity.newState},#{entity.newSystemNumber},#{entity.newSystemPrimary},#{entity.primaryKey}) + (#{entity.clientcode},#{entity.companycode},#{entity.facilitycode},#{entity.shipmentcode},#{entity.reforderid},#{entity.reforderdetailid},#{entity.refordercode},#{entity.allocinvid},#{entity.skucode},#{entity.skuname},#{entity.sourceordercode},#{entity.inventorysts},#{entity.isgift},#{entity.requestqty},#{entity.shipqty},#{entity.quantityum},#{entity.listprice},#{entity.itemtotalamount},#{entity.totalpayamount},#{entity.totalweight},#{entity.totalvolume},#{entity.totalvolumeweight},#{entity.weightum},#{entity.volumeum},#{entity.created},#{entity.createdby},#{entity.lastupdated},#{entity.lastupdatedby},#{entity.newTransmitInfo},#{entity.newPushDate},#{entity.newState},#{entity.newSystemNumber},#{entity.newSystemPrimary},#{entity.primaryKey},#{entity.businessType},#{entity.businessDate}) - insert into tocofs_saleout_detailed(clientCode, companyCode, facilityCode, shipmentCode, refOrderId, refOrderDetailId, refOrderCode, allocInvId, skuCode, skuName, sourceOrderCode, inventorySts, isGift, requestQty, shipQty, quantityUM, listPrice, itemTotalAmount, totalPayAmount, totalWeight, totalVolume, totalVolumeWeight, weightUM, volumeUM, created, createdBy, lastUpdated, lastUpdatedBy,newTransmitInfo,newPushDate,newState,newSystemNumber,newSystemPrimary,primaryKey) + insert into tocofs_saleout_detailed(clientCode, companyCode, facilityCode, shipmentCode, refOrderId, refOrderDetailId, refOrderCode, allocInvId, skuCode, skuName, sourceOrderCode, inventorySts, isGift, requestQty, shipQty, quantityUM, listPrice, itemTotalAmount, totalPayAmount, totalWeight, totalVolume, totalVolumeWeight, weightUM, volumeUM, created, createdBy, lastUpdated, lastUpdatedBy,newTransmitInfo,newPushDate,newState,newSystemNumber,newSystemPrimary,primaryKey,businessType,businessDate) values - (#{entity.clientcode},#{entity.companycode},#{entity.facilitycode},#{entity.shipmentcode},#{entity.reforderid},#{entity.reforderdetailid},#{entity.refordercode},#{entity.allocinvid},#{entity.skucode},#{entity.skuname},#{entity.sourceordercode},#{entity.inventorysts},#{entity.isgift},#{entity.requestqty},#{entity.shipqty},#{entity.quantityum},#{entity.listprice},#{entity.itemtotalamount},#{entity.totalpayamount},#{entity.totalweight},#{entity.totalvolume},#{entity.totalvolumeweight},#{entity.weightum},#{entity.volumeum},#{entity.created},#{entity.createdby},#{entity.lastupdatedby},#{entity.lastupdated},#{entity.newTransmitInfo},#{entity.newPushDate},#{entity.newState},#{entity.newSystemNumber},#{entity.newSystemPrimary},#{entity.primaryKey}) + (#{entity.clientcode},#{entity.companycode},#{entity.facilitycode},#{entity.shipmentcode},#{entity.reforderid},#{entity.reforderdetailid},#{entity.refordercode},#{entity.allocinvid},#{entity.skucode},#{entity.skuname},#{entity.sourceordercode},#{entity.inventorysts},#{entity.isgift},#{entity.requestqty},#{entity.shipqty},#{entity.quantityum},#{entity.listprice},#{entity.itemtotalamount},#{entity.totalpayamount},#{entity.totalweight},#{entity.totalvolume},#{entity.totalvolumeweight},#{entity.weightum},#{entity.volumeum},#{entity.created},#{entity.createdby},#{entity.lastupdatedby},#{entity.lastupdated},#{entity.newTransmitInfo},#{entity.newPushDate},#{entity.newState},#{entity.newSystemNumber},#{entity.newSystemPrimary},#{entity.primaryKey},#{entity.businessType},#{entity.businessDate}) on duplicate key update clientCode = values(clientCode), @@ -396,8 +410,11 @@ newState = values(newState), newSystemNumber = values(newSystemNumber), newSystemPrimary = values(newSystemPrimary), - primaryKey = values(primaryKey) + primaryKey = values(primaryKey), + businessType = values(businessType), + businessDate = values(businessDate) + update tocofs_saleout_detailed set @@ -436,6 +453,8 @@ update tocofs_saleout_detailed set newSystemNumber = #{newSystemNumber}, newSystemPrimary = #{newSystemPrimary}, primaryKey = #{primaryKey}, + businessType = #{businessType}, + businessDate = #{businessDate} where rootId = #{rootid} @@ -484,6 +503,8 @@ update tocofs_saleout_detailed set sts= 'N' ,modify_time = #{modify_time},modif and newSystemNumber = #{newSystemNumber} and newSystemPrimary = #{newSystemPrimary} and primaryKey = #{primaryKey} + and businessType = #{businessType} + and businessDate = #{businessDate} 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 new file mode 100644 index 00000000..9e8537ba --- /dev/null +++ b/buildpackage/src/main/java/com/hzya/frame/plugin/lets/plugin/sales/SoSaleOutPluginInitializerToB.java @@ -0,0 +1,937 @@ +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.ITocofsSaleoutDao; +import com.hzya.frame.plugin.lets.ofs.dao.ITocofsSaleoutDetailedDao; +import com.hzya.frame.plugin.lets.ofs.entity.TocofsSaleoutDetailedEntity; +import com.hzya.frame.plugin.lets.ofs.entity.TocofsSaleoutEntity; +import com.hzya.frame.plugin.lets.ofs.service.ITocofsSaleoutService; +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.plugin.lets.util.TocOrderBasicArchivesCacheUtil; +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.ofssaleorderoutsearch.SaleOutReturnMessageDto; +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.concurrent.locks.ReentrantLock; +import java.util.stream.Collectors; + +/** + * OFS销售出库单(TOB)生成U8C销售订单 + * + * @author makejava + * @since 2024年8月12日 15:03:51 + */ +public class SoSaleOutPluginInitializerToB extends PluginBaseEntity { + + Logger logger = LoggerFactory.getLogger(SoSaleOutPluginInitializerToB.class); + + private static final ReentrantLock LOCK = new ReentrantLock(true); + + @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.SoSaleOutPluginInitializerToB"; + } + + @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 TocOrderBasicArchivesCacheUtil basicArchivesCacheUtil; + + @Autowired + private ITocofsSaleoutDao iTocofsSaleoutDao; + + @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; + + /** + * 按指定时间拉取 + * + * @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() { + 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.setClientCode("LETS"); + // queryOfsSoSaleOutVo.setInternalInstructionType("SALES"); + queryOfsSoSaleOutVo.setCompanyCode("SHLZ"); + // queryOfsSoSaleOutVo.setStatus(900L); + queryOfsSoSaleOutVo.setPageNo(1L); + queryOfsSoSaleOutVo.setPageSize(50L); + queryOfsSoSaleOutVo.setCode("LETS-SH2024010200000004"); + queryOfsSaleOrder(queryOfsSoSaleOutVo, headerDetailsDtoList, 1L); + logger.info("数据返回行数:{}", headerDetailsDtoList.size()); + if (headerDetailsDtoList.size() > 0) { + //保存到mysql + batchInsert(headerDetailsDtoList); + //过滤成功的数据 + List headerDetailsDtos = filterData(headerDetailsDtoList); + //执行推送主逻辑 + implement(headerDetailsDtos); + } else { + logger.info("没有查询到任何数据!不需要同步"); + } + } catch (Exception e) { + logger.error("startImplement方法抛出异常", e); + } finally { + LOCK.unlock(); + } + } + }, 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 headerDetailsDtoList 数据行 + */ + private void batchInsert(List headerDetailsDtoList) throws Exception { + if (headerDetailsDtoList != null && headerDetailsDtoList.size() > 0) { + List headerDetailsDtoList1 = new ArrayList<>(); + List headerDetailsDtoList2 = new ArrayList<>(); + + for (HeaderDetailsDto index : headerDetailsDtoList) { + HeaderDto header = index.getHeader();// 主表 + List details = index.getDetails();//明细表 + + headerDetailsDtoList1.add(header); + headerDetailsDtoList2.addAll(details); + } + + //每250作为一个批次插入主表,根据主键(id)判断是否重复,如果重复的,则不进行插入 + List> ofssaleorderoutsearchList = SplitListByCountUtil.splitListByCount(headerDetailsDtoList1, 250); + for (int i = 0; i < ofssaleorderoutsearchList.size(); i++) { + List headerDtoList = ofssaleorderoutsearchList.get(i); + List tocofsSaleoutEntityList = copyHeaderDto(headerDtoList); + if (tocofsSaleoutEntityList.size() > 0) { + logger.info("TOBofsSaleoutDetailedEntities:插入底表{}个对象(表头)", tocofsSaleoutEntityList.size()); + iTocofsSaleoutDao.entityInsertBatchV2(tocofsSaleoutEntityList); + } else { + logger.info("TOBofsSaleoutEntityList:没有对象被插入表头底表"); + } + } + + //插入明细表 + List> detailsDtoList = SplitListByCountUtil.splitListByCount(headerDetailsDtoList2, 250); + for (int i = 0; i < detailsDtoList.size(); i++) { + List detailsDtos = detailsDtoList.get(i); + List tocofsSaleoutDetailedEntities = copyDetailsDto(detailsDtos); + if (tocofsSaleoutDetailedEntities.size() > 0) { + logger.info("TOBofsSaleoutDetailedEntities:插入底表{}个对象(表体)", tocofsSaleoutDetailedEntities.size()); + iTocofsSaleoutDetailedDao.entityInsertBatchV2(tocofsSaleoutDetailedEntities); + } else { + logger.info("TOBofsSaleoutDetailedEntities:没有对象被插入表头底表"); + } + } + } + } + + /** + * 查询OFS结果集 + * + * @param queryOfsSoSaleOutVo 查询参数 + * @param headerDetailsDtoList 查询结果集 + * @param pageNo 从第pageNo页开始查询 + */ + private void queryOfsSaleOrder(QueryOfsSoSaleOutVo queryOfsSoSaleOutVo, List headerDetailsDtoList, Long pageNo) throws Exception { + + Long pageSize = 200L; + queryOfsSoSaleOutVo.setPageNo(pageNo); + queryOfsSoSaleOutVo.setPageSize(pageSize); + + InterfaceParamDto interfaceParamDto = new InterfaceParamDto(); + interfaceParamDto.setApi("ofs.shipment.search"); + interfaceParamDto.setData(JSON.toJSONString(queryOfsSoSaleOutVo)); + SaleOutReturnMessageDto saleOutReturnMessageDto = (SaleOutReturnMessageDto) ofsUnifiedService.unified(interfaceParamDto); + if (saleOutReturnMessageDto != null) { + if ("false".equals(saleOutReturnMessageDto.getError()) && "0".equals(saleOutReturnMessageDto.getCode()) && "Success".equals(saleOutReturnMessageDto.getMsg())) { + List headerDetailsDtoList1 = saleOutReturnMessageDto.getData(); + if (headerDetailsDtoList1 != null && headerDetailsDtoList1.size() > 0) { + headerDetailsDtoList.addAll(headerDetailsDtoList1); + + //TODO OFS没有提供分页字段 + } + } else { + //2024年7月30日 13:47:04 查询失败 + logger.error("查询失败,失败原因:{}", JSON.toJSON(saleOutReturnMessageDto)); + } + } else { + logger.error("returnMessageBasics为空!queryOfsSoSaleOutVo对象结果:{}", JSON.toJSON(queryOfsSoSaleOutVo)); + } + } + +// public void queryOfsSaleOrder() throws Exception { +// QueryOfsSoSaleOutVo queryOfsSoSaleOutVo = new QueryOfsSoSaleOutVo(); +// queryOfsSoSaleOutVo.setCreated_start("2024-07-05 16:38:00"); +// queryOfsSoSaleOutVo.setCreated_end("2024-07-05 16:40:30"); +// queryOfsSoSaleOutVo.setClientCode("LETS"); +//// queryOfsSoSaleOutVo.setInternalInstructionType("SALES"); +// queryOfsSoSaleOutVo.setCompanyCode("SHLZ"); +//// queryOfsSoSaleOutVo.setStatus(900L); +// queryOfsSoSaleOutVo.setPageNo(1L); +// queryOfsSoSaleOutVo.setPageSize(50L); +// queryOfsSoSaleOutVo.setCode("LETS-SH2024070500000003"); +// +// InterfaceParamDto interfaceParamDto = new InterfaceParamDto(); +// interfaceParamDto.setApi("ofs.shipment.search"); +// interfaceParamDto.setData(JSON.toJSONString(queryOfsSoSaleOutVo)); +// SaleOutReturnMessageDto saleOutReturnMessageDto = (SaleOutReturnMessageDto) ofsUnifiedService.unified(interfaceParamDto); +// System.out.println(saleOutReturnMessageDto); +// } + + /** + * 代码同步逻辑 + * + * @param headerDetailsDtos 查询得到的O出库单对象 + * @author liuyang + */ + private void implement(List headerDetailsDtos) throws Exception { + if (headerDetailsDtos != null && headerDetailsDtos.size() > 0) { + try { + // 查询基本档案 + List orderOutTobHeaderDtos = queryBasicArchives(headerDetailsDtos); + // 查询U8C业务流程 + BdBusitypeEntity bdBusitypeEntity = u8cOperationFlow(); + + try { + for (int i = 0; i < orderOutTobHeaderDtos.size(); i++) { + OrderOutTobHeaderDto orderOutTobHeaderDto = orderOutTobHeaderDtos.get(i); + HeaderDto 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(); + //生成业务日期 + String generateBusinessDate = createGenerateBusinessDate(orderOutTobHeaderDto); + + SaleorderRequestDto saleorderRequestDto = new SaleorderRequestDto(); + SaleorderRequestParentDto saleorderRequestParentDto = new SaleorderRequestParentDto(); + saleorderRequestParentDto.setDbilldate(generateBusinessDate);//单据日期 + saleorderRequestParentDto.setBretinvflag("N");//退货标记 + 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.setVdef19(header.getCode()); + saleorderRequestParentDto.setVdef20(header.getId()); + + //平台 + saleorderRequestParentDto.setPk_defdoc2(platformArchives.getPkDefdoc()); + saleorderRequestParentDto.setVdef2(platformArchives.getDocname()); + + //TODO 2024年8月8日 17:17:58 店铺档案自定义项1,先不传,后续维护好之后再传! + + saleorderRequestDto.setParentvo(saleorderRequestParentDto); + + List saleorderRequestChildrenDtoList = new ArrayList<>(); + saleorderRequestDto.setChildrenvo(saleorderRequestChildrenDtoList); + + //把汇总好的出库单明细行合并成一行 + for (int j = 0; j < details.size(); j++) { + DetailsDto detailsDto = details.get(j); + //存货管理档案:取发货公司的存货管理档案 + BdInvmandocEntity bdInvmandocEntity = queryInventoryMan(detailsDto, 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 { + noriginalcurtaxprice = new BigDecimal(detailsDto.getTotalPayAmount()).divide(new BigDecimal(detailsDto.getShipQty()), 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(detailsDto.getShipQty())).setScale(2, BigDecimal.ROUND_HALF_UP); + noriginalcursummny = noriginalcurtaxprice.multiply(new BigDecimal(detailsDto.getShipQty())).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.setCbodywarehousecode(bdStordocEntity.getStorcode());//发货仓库编码:这个字段不需要给openapi接口,而是提供给下游方法使用 + saleorderRequestChildrenDto.setCconsigncorpid(deliverGoodsCorp.getPkCorp());//发货公司 + saleorderRequestChildrenDto.setCcurrencytypeid("00010000000000000001");//币种 + saleorderRequestChildrenDto.setCinventoryid(bdInvmandocEntity.getPkInvmandoc());//存货id + saleorderRequestChildrenDto.setCinventorycode(bdInvbasdocEntity.getInvcode());//存货编码 + saleorderRequestChildrenDto.setCreceiptcorpid(bdCumandocEntity.getPkCumandoc());//收货单位 + saleorderRequestChildrenDto.setDconsigndate(generateBusinessDate);//计划发货日期 + saleorderRequestChildrenDto.setDdeliverdate(generateBusinessDate);//要求收货日期 + saleorderRequestChildrenDto.setNexchangeotobrate("1.00000000");//折本汇率 + saleorderRequestChildrenDto.setNitemdiscountrate("100.000000");//单品折扣 + saleorderRequestChildrenDto.setNnumber(detailsDto.getShipQty());//数量 + 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(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; +// } + } + + /** + * 档案转换 + * + * @author liuyang + */ + private List queryBasicArchives(List headerDetailsDtoList) { + List orderOutTobHeaderDtoArrayList = new ArrayList<>(); + + if (headerDetailsDtoList != null && headerDetailsDtoList.size() > 0) { + try { + for (int i = 0; i < headerDetailsDtoList.size(); i++) { + HeaderDetailsDto headerDetailsDto = headerDetailsDtoList.get(i); + HeaderDto header = headerDetailsDto.getHeader(); + List details = headerDetailsDto.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()); + } + + //业务部门 + 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); + } + + OrderOutTobHeaderDto orderOutTobHeaderDto = new OrderOutTobHeaderDto(); + 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.setHeader(header); + orderOutTobHeaderDto.setDetails(details); + + BeanUtil.copyPropertiesV2(header, orderOutTobHeaderDto); + orderOutTobHeaderDtoArrayList.add(orderOutTobHeaderDto); + } + //成功 + } catch (Exception e) { + logger.error("OFS销售出库单关联查询U8C档案失败", e); + //失败 + } + } else { + logger.info("queryBasicArchives方法对应的headerDetailsDtoList.size为0"); + } + return orderOutTobHeaderDtoArrayList; + } + + /** + * bean copy + * 2024年7月31日 10:34:09 + */ + private List copyHeaderDto(List headerDtoList) { + List tocofsSaleoutEntityList = new ArrayList<>(); + if (headerDtoList != null && headerDtoList.size() > 0) { + for (int i = 0; i < headerDtoList.size(); i++) { + HeaderDto headerDto = headerDtoList.get(i); + TocofsSaleoutEntity tocofsSaleoutEntity = new TocofsSaleoutEntity(); +// BeanUtils.copyProperties(headerDto, tocofsSaleoutEntity); + BeanUtil.copyPropertiesV2(headerDto, tocofsSaleoutEntity); + tocofsSaleoutEntityList.add(tocofsSaleoutEntity); + } + } + return tocofsSaleoutEntityList; + } + + /** + * bean copy + * 2024年8月2日 16:04:11 + */ + private List copyDetailsDto(List detailsDtos) { + List tocofsSaleoutDetailedEntityArrayList = new ArrayList<>(); + if (detailsDtos != null && detailsDtos.size() > 0) { + for (int i = 0; i < detailsDtos.size(); i++) { + DetailsDto detailsDto = detailsDtos.get(i); + TocofsSaleoutDetailedEntity tocofsSaleoutDetailedEntity = new TocofsSaleoutDetailedEntity(); + tocofsSaleoutDetailedEntity.setBusinessType("TOB_ORDER"); +// BeanUtils.copyProperties(detailsDto, tocofsSaleoutDetailedEntity); + BeanUtil.copyPropertiesV2(detailsDto, tocofsSaleoutDetailedEntity); + tocofsSaleoutDetailedEntityArrayList.add(tocofsSaleoutDetailedEntity); + } + } + 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业务流程 + * + * @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; + } + + /** + * 检查参数是否为空 + * 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)); + } + + /** + * 查询存货管理档案 + * + * @param pkCorp 发货公司主键 + * @param detailsDto 出库单存货明细行 + * @author liuyang + */ + private BdInvmandocEntity queryInventoryMan(DetailsDto 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); + } + + /** + * 合并明细行 + * 单价计算公式: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 + * 查询基础档案,根据公司、管理档案主键查询 + * + * @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/SoSaleOutPluginInitializerToC.java b/buildpackage/src/main/java/com/hzya/frame/plugin/lets/plugin/sales/SoSaleOutPluginInitializerToC.java index ed486007..87a07455 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 @@ -455,7 +455,7 @@ public class SoSaleOutPluginInitializerToC extends PluginBaseEntity { Date dbill = DateUtil.parse(shipAt); businessFormat = DateUtil.format(dbill, "yyyy-MM-dd"); } catch (Exception e) { - e.printStackTrace(); +// e.printStackTrace(); logger.error("业务日期转换失败", e); } return businessFormat; @@ -593,6 +593,7 @@ public class SoSaleOutPluginInitializerToC extends PluginBaseEntity { for (int i = 0; i < detailsDtos.size(); i++) { com.hzya.frame.ttxofs.dto.ofssaleorderoutsearch.DetailsDto detailsDto = detailsDtos.get(i); TocofsSaleoutDetailedEntity tocofsSaleoutDetailedEntity = new TocofsSaleoutDetailedEntity(); + tocofsSaleoutDetailedEntity.setBusinessType("TOC_ORDER"); // BeanUtils.copyProperties(detailsDto, tocofsSaleoutDetailedEntity); BeanUtil.copyPropertiesV2(detailsDto, tocofsSaleoutDetailedEntity); tocofsSaleoutDetailedEntityArrayList.add(tocofsSaleoutDetailedEntity); @@ -676,7 +677,7 @@ public class SoSaleOutPluginInitializerToC extends PluginBaseEntity { private BdBusitypeEntity u8cOperationFlow() throws Exception { //查询业务流程 //2024年8月6日 11:33:07 具体的业务流程名称,还需要实施提供 - String processName = "TOC销售业务流程"; + String processName = "TOC销售"; BdBusitypeEntity bdBusitypeEntity = queryBdBusitypeUtil.queryBdBusitype(processName); Assert.notNull(bdBusitypeEntity, "根据业务流程名称({})没有查询到业务流程", processName); return bdBusitypeEntity; @@ -837,6 +838,4 @@ public class SoSaleOutPluginInitializerToC extends PluginBaseEntity { } return null; } - - } 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 8ca6f626..d2656b6c 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 @@ -365,6 +365,7 @@ public class SoSaleReturnPluginInitializerToC extends PluginBaseEntity { BigDecimal noriginalcursummny = null;//价税合计 BigDecimal noriginalcurtaxmny = null;//税额=价税合计-无税金额 try { + //TODO 这个金额取错了,需要取售后订单的退款金额 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); @@ -586,6 +587,7 @@ public class SoSaleReturnPluginInitializerToC extends PluginBaseEntity { ReturnGoodSearchDetailsDto returnGoodSearchDetailsDto = headerDetailsDtoList2.get(i); TocofsReturngoodsDetailedEntity tocofsReturngoodsDetailedEntity = new TocofsReturngoodsDetailedEntity(); + tocofsReturngoodsDetailedEntity.setBusinessType("TOC_RETURN"); BeanUtil.copyPropertiesV2(returnGoodSearchDetailsDto, tocofsReturngoodsDetailedEntity); tocofsSaleoutDetailedEntityArrayList.add(tocofsReturngoodsDetailedEntity); } @@ -670,7 +672,7 @@ public class SoSaleReturnPluginInitializerToC extends PluginBaseEntity { private BdBusitypeEntity u8cOperationFlow() throws Exception { //查询业务流程 //2024年8月6日 11:33:07 具体的业务流程名称,还需要实施提供 - String processName = "TOC销售业务流程"; + String processName = "TOC销售"; BdBusitypeEntity bdBusitypeEntity = queryBdBusitypeUtil.queryBdBusitype(processName); Assert.notNull(bdBusitypeEntity, "根据业务流程名称({})没有查询到业务流程", processName); return bdBusitypeEntity; 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 new file mode 100644 index 00000000..4b239d73 --- /dev/null +++ b/buildpackage/src/main/java/com/hzya/frame/plugin/lets/u8cdto/OrderOutTobHeaderDto.java @@ -0,0 +1,74 @@ +package com.hzya.frame.plugin.lets.u8cdto; + +import com.hzya.frame.plugin.lets.entity.*; +import com.hzya.frame.ttxofs.dto.ofssaleorderoutsearch.HeaderDetailsDto; +import lombok.Data; + +/** + * @Author:liuyang + * @Package:com.hzya.frame.plugin.lets.u8cdto + * @Project:kangarooDataCenterV3 + * @name:OrderOutTobHeaderDto + * @Date:2024/8/12 18:07 + * @Filename:OrderOutTobHeaderDto + */ +@Data +public class OrderOutTobHeaderDto extends HeaderDetailsDto { + + /** + * 表头公司(销售公司)、视为发货公司 + */ + 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; + +} \ No newline at end of file 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-sowow-plugin.xml index 4e47ed20..dc45bad9 100644 --- a/buildpackage/src/main/resources/cfgHome/plugin/lets/spring/spring-sowow-plugin.xml +++ b/buildpackage/src/main/resources/cfgHome/plugin/lets/spring/spring-sowow-plugin.xml @@ -21,4 +21,7 @@ - + + + + \ No newline at end of file diff --git a/buildpackage/src/test/java/com/hzya/frame/plugin/lets/plugin/sales/SoSaleOutPluginInitializerToBTest.java b/buildpackage/src/test/java/com/hzya/frame/plugin/lets/plugin/sales/SoSaleOutPluginInitializerToBTest.java new file mode 100644 index 00000000..49c0525e --- /dev/null +++ b/buildpackage/src/test/java/com/hzya/frame/plugin/lets/plugin/sales/SoSaleOutPluginInitializerToBTest.java @@ -0,0 +1,31 @@ +package com.hzya.frame.plugin.lets.plugin.sales; + +import com.hzya.frame.WebappApplication; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.context.junit4.SpringRunner; + +import static org.junit.Assert.*; + +/** + * @Author:liuyang + * @Package:com.hzya.frame.plugin.lets.plugin.sales + * @Project:kangarooDataCenterV3 + * @name:SoSaleOutPluginInitializerToBTest + * @Date:2024/8/13 15:59 + * @Filename:SoSaleOutPluginInitializerToBTest + */ +@RunWith(SpringRunner.class) +@SpringBootTest(classes = WebappApplication.class) +public class SoSaleOutPluginInitializerToBTest { + + @Autowired + private SoSaleOutPluginInitializerToB soSaleOutPluginInitializerToB; + + @Test + public void startImplement() { + soSaleOutPluginInitializerToB.startImplement(null, null); + } +} \ No newline at end of file diff --git a/service/src/main/java/com/hzya/frame/ttxofs/service/OfsUnifiedService.java b/service/src/main/java/com/hzya/frame/ttxofs/service/OfsUnifiedService.java index 31cbda27..ef5d7f12 100644 --- a/service/src/main/java/com/hzya/frame/ttxofs/service/OfsUnifiedService.java +++ b/service/src/main/java/com/hzya/frame/ttxofs/service/OfsUnifiedService.java @@ -15,7 +15,7 @@ import com.hzya.frame.ttxofs.dto.InterfaceParamDto; */ public interface OfsUnifiedService { /** - * OFS出库单查询 + * OFS接口入库 * * @author liuyang */ From 181ca8d7d8727b82bbd870b088cec9547e9785eb Mon Sep 17 00:00:00 2001 From: zhengyf Date: Wed, 14 Aug 2024 11:17:52 +0800 Subject: [PATCH 4/4] =?UTF-8?q?=E4=B8=BD=E7=9F=A5=EF=BC=9AOFS=E8=B0=83?= =?UTF-8?q?=E6=95=B4=E5=85=A5=E5=BA=93=E5=8D=95=E6=8E=A8=E9=80=81U8C?= =?UTF-8?q?=E5=85=B6=E4=BB=96=E5=85=A5=E5=BA=93=E5=8D=95=E8=B0=83=E6=95=B4?= =?UTF-8?q?=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../adjust/AdjustInPluginInitializer.java | 30 ++- .../lets/u8cdto/GeneralBillVO_4ADto.java | 3 +- .../lets/u8cdto/GeneralBillVO_4IDto.java | 224 +----------------- .../lets/plugin/transfer/TransferTest.java | 4 + 4 files changed, 41 insertions(+), 220 deletions(-) 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 b8fe874f..d3ef9fd9 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 @@ -99,8 +99,8 @@ public class AdjustInPluginInitializer extends PluginBaseEntity { String endTimeStr = DateUtil.format(endTime, "yyyy-MM-dd HH:mm:ss"); QueryOfsStockinOrderRequestVO queryOfsStockinOrderRequestVO = new QueryOfsStockinOrderRequestVO(); - queryOfsStockinOrderRequestVO.setCreated_start("2024-08-12 00:00:00"); - queryOfsStockinOrderRequestVO.setCreated_end("2024-08-13 23:59:59"); + queryOfsStockinOrderRequestVO.setCreated_start(startTimeStr); + queryOfsStockinOrderRequestVO.setCreated_end(endTimeStr); queryOfsStockinOrderRequestVO.setCompanyCode("SHLZ"); // queryOfsTransferOrderRequestVO.setStatus("900");//状态 500待同步 510已同步 700收货中 900入库完成 911作废 100订单池 200暂挂 400待合单 410待出库单出库 queryOfsStockinOrderRequestVO.setPageNo(1L); @@ -170,6 +170,30 @@ public class AdjustInPluginInitializer 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.setCreated_start(start); + queryOfsStockinOrderRequestVO.setCreated_end(end); + queryOfsStockinOrderRequestVO.setCompanyCode("SHOFF"); +// queryOfsTransferOrderRequestVO.setStatus("900");//状态 500待同步 510已同步 700收货中 900入库完成 911作废 100订单池 200暂挂 400待合单 410待出库单出库 + queryOfsStockinOrderRequestVO.setPageNo(1L); + queryOfsStockinOrderRequestVO.setPageSize(500L); + List stockinOrders = queryOfsStockinOrder(queryOfsStockinOrderRequestVO); + System.out.println(stockinOrders); + + if (stockinOrders.size() == 0) { + return; + } + //过滤日志 + List filterStockinOrders = filterData(stockinOrders); + if (filterStockinOrders.size() == 0) { + return; + } + + //推送 + implement(filterStockinOrders); + + } catch (Exception e) { logger.error("丽知:OFS调整入库--->U8C其它入库,start(String startTime, String endTime)方法报错:", e); } @@ -217,7 +241,9 @@ public class AdjustInPluginInitializer extends PluginBaseEntity { GeneralBillVO_4ADto generalBillVO_4A = new GeneralBillVO_4ADto(); GeneralBillVO_4ADto.Parentvo parentvo = new GeneralBillVO_4ADto.Parentvo(); + //ofs订单号,自定义项19 ofsCode=ofsHeader.getCode(); + parentvo.setVuserdef19(ofsCode); //pk_corp--公司 parentvo.setPk_corp(ofsHeader.getCompanyCode()); diff --git a/buildpackage/src/main/java/com/hzya/frame/plugin/lets/u8cdto/GeneralBillVO_4ADto.java b/buildpackage/src/main/java/com/hzya/frame/plugin/lets/u8cdto/GeneralBillVO_4ADto.java index 0d77c960..666fd09c 100644 --- a/buildpackage/src/main/java/com/hzya/frame/plugin/lets/u8cdto/GeneralBillVO_4ADto.java +++ b/buildpackage/src/main/java/com/hzya/frame/plugin/lets/u8cdto/GeneralBillVO_4ADto.java @@ -31,7 +31,8 @@ public class GeneralBillVO_4ADto { private String dbilldate;//单据日期 private String dauditdate;//签字日期 - private String vuserdef20;//自定义项20---》存旺店通出库单号:20240418习老师 + private String vuserdef19;//自定义项19--->ofs调整单号 + private String vuserdef20;//自定义项20 } @Data diff --git a/buildpackage/src/main/java/com/hzya/frame/plugin/lets/u8cdto/GeneralBillVO_4IDto.java b/buildpackage/src/main/java/com/hzya/frame/plugin/lets/u8cdto/GeneralBillVO_4IDto.java index 60153605..2199e812 100644 --- a/buildpackage/src/main/java/com/hzya/frame/plugin/lets/u8cdto/GeneralBillVO_4IDto.java +++ b/buildpackage/src/main/java/com/hzya/frame/plugin/lets/u8cdto/GeneralBillVO_4IDto.java @@ -1,11 +1,14 @@ package com.hzya.frame.plugin.lets.u8cdto; +import lombok.Data; + import java.util.List; /** * 库存其他出库单 * @author zyd */ +@Data public class GeneralBillVO_4IDto { /** * 表头 @@ -16,7 +19,7 @@ public class GeneralBillVO_4IDto { * 表体 */ private List childrenvo; - + @Data public static class Parentvo{ /** * 自动拣货标识 @@ -33,103 +36,10 @@ public class GeneralBillVO_4IDto { private String vnote; private String dauditdate;//签字日期 - private String vuserdef20;//自定义项20---》存旺店通出库单号:20240418习老师 - - public String getVuserdef20() { - return vuserdef20; - } - - public void setVuserdef20(String vuserdef20) { - this.vuserdef20 = vuserdef20; - } - - public String getDauditdate() { - return dauditdate; - } - - public void setDauditdate(String dauditdate) { - this.dauditdate = dauditdate; - } - - public String getIsautopick() { - return isautopick; - } - - public void setIsautopick(String isautopick) { - this.isautopick = isautopick; - } - - public String getVbillcode() { - return vbillcode; - } - - public void setVbillcode(String vbillcode) { - this.vbillcode = vbillcode; - } - - public String getPk_corp() { - return pk_corp; - } - - public void setPk_corp(String pk_corp) { - this.pk_corp = pk_corp; - } - - public String getClastmodiid() { - return clastmodiid; - } - - public void setClastmodiid(String clastmodiid) { - this.clastmodiid = clastmodiid; - } - - public String getDbilldate() { - return dbilldate; - } - - public void setDbilldate(String dbilldate) { - this.dbilldate = dbilldate; - } - - public String getCwarehouseid() { - return cwarehouseid; - } - - public void setCwarehouseid(String cwarehouseid) { - this.cwarehouseid = cwarehouseid; - } - - public String getPk_calbody() { - return pk_calbody; - } - - public void setPk_calbody(String pk_calbody) { - this.pk_calbody = pk_calbody; - } - - public String getVnote() { - return vnote; - } - - public void setVnote(String vnote) { - this.vnote = vnote; - } - - public String getCoperatorid() { - return coperatorid; - } - public void setCoperatorid(String coperatorid) { - this.coperatorid = coperatorid; - } - - public String getCdispatcherid() { - return cdispatcherid; - } - - public void setCdispatcherid(String cdispatcherid) { - this.cdispatcherid = cdispatcherid; - } + private String vuserdef19;//自定义项19--->ofs调整单号 + private String vuserdef20;//自定义项20 } + @Data public static class Childrenvo{ private String cinventoryid; private String castunitid; @@ -159,126 +69,6 @@ public class GeneralBillVO_4IDto { * 来源单据行id */ private String csourcebillbid; - - public String getDbizdate() { - return dbizdate; - } - - public void setDbizdate(String dbizdate) { - this.dbizdate = dbizdate; - } - - public String getCsourcebillbid() { - return csourcebillbid; - } - - public void setCsourcebillbid(String csourcebillbid) { - this.csourcebillbid = csourcebillbid; - } - - public String getCsourcebillhid() { - return csourcebillhid; - } - - public void setCsourcebillhid(String csourcebillhid) { - this.csourcebillhid = csourcebillhid; - } - - public String getVsourcerowno() { - return vsourcerowno; - } - - public void setVsourcerowno(String vsourcerowno) { - this.vsourcerowno = vsourcerowno; - } - - public String getVsourcebillcode() { - return vsourcebillcode; - } - - public void setVsourcebillcode(String vsourcebillcode) { - this.vsourcebillcode = vsourcebillcode; - } - - public String getCinventoryid() { - return cinventoryid; - } - - public void setCinventoryid(String cinventoryid) { - this.cinventoryid = cinventoryid; - } - - public String getCastunitid() { - return castunitid; - } - - public void setCastunitid(String castunitid) { - this.castunitid = castunitid; - } - - public String getNoutnum() { - return noutnum; - } - - public void setNoutnum(String noutnum) { - this.noutnum = noutnum; - } - - public String getNprice() { - return nprice; - } - - public void setNprice(String nprice) { - this.nprice = nprice; - } - - public String getVnotebody() { - return vnotebody; - } - - public void setVnotebody(String vnotebody) { - this.vnotebody = vnotebody; - } - - public String getBonroadflag() { - return bonroadflag; - } - - public void setBonroadflag(String bonroadflag) { - this.bonroadflag = bonroadflag; - } - - public String getFlargess() { - return flargess; - } - - public void setFlargess(String flargess) { - this.flargess = flargess; - } - - public String getNshouldoutnum() { - return nshouldoutnum; - } - - public void setNshouldoutnum(String nshouldoutnum) { - this.nshouldoutnum = nshouldoutnum; - } - } - - public Parentvo getParentvo() { - return parentvo; - } - - public void setParentvo(Parentvo parentvo) { - this.parentvo = parentvo; - } - - public List getChildrenvo() { - return childrenvo; - } - - public void setChildrenvo(List childrenvo) { - this.childrenvo = childrenvo; } } 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 66f0b575..8c846100 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 @@ -55,6 +55,10 @@ public class TransferTest { public void t31(){ adjustInPluginInitializer.start("LETS-AH2024081300000003"); } + @Test + public void t32(){ + adjustInPluginInitializer.start("2024-08-14","2024-08-14"); + } ////////////////////////////////////////////////////////////////////////////////////调整出库单