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 { +}