丽知:OFS新接口调整

This commit is contained in:
zhengyf 2024-08-15 15:33:58 +08:00
parent 4d6f96bb62
commit d69e1709eb
18 changed files with 572 additions and 49 deletions

View File

@ -42,6 +42,7 @@ public class OverallConstant {
//其他出入库
prodOverPublic.put("otherinqz", "/u8cloud/api/ic/otherin/save/sign");//库存其他入库保存即签字
prodOverPublic.put("otheroutqz", "/u8cloud/api/ic/otherout/save/sign");//库存其他出库保存即签字

View File

@ -2,15 +2,23 @@ package com.hzya.frame.plugin.lets.ofsvo;
import lombok.Data;
import java.util.Date;
/**
* OFS SKU查询请求类
*/
@Data
public class QueryOfsGoodsRequestVO {
public class QueryOfsSKURequestVO {
/** 开始时间 */
private String created_start;
/** 结束时间 */
private String created_end;
/** 组织 */
private String clientCode;
private String companyCode;
private int status;
private String code;
private int pageNo;
private int pageSize;
}

View File

@ -0,0 +1,35 @@
package com.hzya.frame.plugin.lets.ofsvo;
import lombok.Data;
/**
* OFS调整出库请求类
*/
@Data
public class QueryOfsStockoutOrderRequestVO {
/** 开始时间 */
private String created_start;
/** 结束时间 */
private String created_end;
/** 组织 */
private String clientCode;
/** 库单号 */
private String code;
/** 状态 100订单池 500待同步 510已同步 900入库完成 400待合单 700发货中 200审单中 888拦截中 999异常 650已下沉 */
private String status;
/** 出库单类型 SALES销售 EXCHANGE换货 REISSUE补发RETURN销退 PURCHASE采购 PURCHASE_RETURN采退 TRANSFER调拨 WORK_ORDER加工 OTHER其他 ADJUST调整 EXCHANGE换货 */
private String internalInstructionType;
/** 原订单类型 */
private String refOrderType;
/** 关联订单号 */
private String refOrderCode;
/** 货主 */
private String companyCode;
/** 库存地点 */
private String facilityCode;
/** 分页页数 */
private Long pageNo;
/** 每页条数 1-500,默认50 */
private Long pageSize;
}

View File

@ -2,19 +2,35 @@ 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.ofsvo.QueryOfsStockoutOrderRequestVO;
import com.hzya.frame.plugin.lets.u8cdto.GeneralBillVO_4IDto;
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.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.dto.stock.StockinOrderSearchResponse;
import com.hzya.frame.ttxofs.dto.stock.StockoutOrderSearchResponse;
import com.hzya.frame.ttxofs.service.OfsUnifiedService;
import com.hzya.frame.web.entity.JsonResultEntity;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import java.util.ArrayList;
@ -44,12 +60,12 @@ public class AdjustOutPluginInitializer extends PluginBaseEntity {
@Override
public String getPluginName() {
return "丽知OFS调整出库--->U8C其它";
return "丽知OFS调整出库--->U8C其它";
}
@Override
public String getPluginLabel() {
return "丽知OFS调整出库--->U8C其它";
return "丽知OFS调整出库--->U8C其它";
}
@Override
@ -66,6 +82,8 @@ public class AdjustOutPluginInitializer extends PluginBaseEntity {
@Autowired
private OfsUnifiedService ofsUnifiedService;
@Autowired
private IBdRdclDao iBdRdclDao;
@Override
public JsonResultEntity executeBusiness(JSONObject requestJson) throws Exception {
@ -85,33 +103,38 @@ public class AdjustOutPluginInitializer extends PluginBaseEntity {
String startTimeStr = DateUtil.format(startTime, "yyyy-MM-dd HH:mm:ss");
String endTimeStr = DateUtil.format(endTime, "yyyy-MM-dd HH:mm:ss");
QueryOfsStockinOrderRequestVO queryOfsStockinOrderRequestVO = new QueryOfsStockinOrderRequestVO();
queryOfsStockinOrderRequestVO.setCreated_start("2024-08-05 00:00:00");
queryOfsStockinOrderRequestVO.setCreated_end("2024-08-09 23:59:59");
queryOfsStockinOrderRequestVO.setCompanyCode("SHXM");
QueryOfsStockoutOrderRequestVO queryOfsStockoutOrderRequestVO = new QueryOfsStockoutOrderRequestVO();
queryOfsStockoutOrderRequestVO.setCreated_start("2024-08-08 00:00:00");
queryOfsStockoutOrderRequestVO.setCreated_end("2024-08-10 23:59:59");
queryOfsStockoutOrderRequestVO.setCompanyCode("SHXM");
// queryOfsTransferOrderRequestVO.setStatus("900");//状态 500待同步 510已同步 700收货中 900入库完成 911作废 100订单池 200暂挂 400待合单 410待出库单出库
queryOfsStockinOrderRequestVO.setPageNo(1L);
queryOfsStockinOrderRequestVO.setPageSize(500L);
List<StockinOrderSearchResponse.StockinOrder> data = queryOfsStockinOrder(queryOfsStockinOrderRequestVO);
System.out.println(data);
queryOfsStockoutOrderRequestVO.setPageNo(1L);
queryOfsStockoutOrderRequestVO.setPageSize(500L);
List<StockoutOrderSearchResponse.StockoutOrder> stockoutOrders = queryOfsStockoutOrder(queryOfsStockoutOrderRequestVO);
if (stockoutOrders == null || stockoutOrders.size() == 0) {
return;
}
//过滤日志
List<StockoutOrderSearchResponse.StockoutOrder> filterStockoutOrders = filterData(stockoutOrders);
if (filterStockoutOrders == null || filterStockoutOrders.size() == 0) {
return;
}
//推送
implement(filterStockoutOrders);
} catch (Exception e) {
logger.error("丽知OFS调整入库--->U8C其它入库,start()方法报错:", e);
logger.error("丽知OFS调整出库--->U8C其它出库,start()方法报错:", e);
}
}
/**
* 按单号
*/
public void start(String stockinNo) {
public void start(String stockoutNo) {
try {
} catch (Exception e) {
logger.error("丽知OFS调整入库--->U8C其它入库,start(String goodsName)方法报错:", e);
logger.error("丽知OFS调整出库--->U8C其它出库,start(String goodsName)方法报错:", e);
}
}
@ -126,30 +149,188 @@ public class AdjustOutPluginInitializer extends PluginBaseEntity {
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);
logger.error("丽知OFS调整出库--->U8C其它出库,start(String startTime, String endTime)方法报错:", e);
}
}
public List<StockinOrderSearchResponse.StockinOrder> queryOfsStockinOrder(QueryOfsStockinOrderRequestVO queryOfsStockinOrderRequestVO) throws Exception {
/**
* 过滤成功日志
*/
public List<StockoutOrderSearchResponse.StockoutOrder> filterData(List<StockoutOrderSearchResponse.StockoutOrder> stockoutOrders){
List<StockoutOrderSearchResponse.StockoutOrder> filterStockoutOrders=new ArrayList<>();
for (StockoutOrderSearchResponse.StockoutOrder stockoutOrder : stockoutOrders) {
StockoutOrderSearchResponse.StockoutOrder.StockoutH header = stockoutOrder.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<IntegrationTaskLivingDetailsEntity> integrationTaskLivingDetailsEntities = iIntegrationTaskLivingDetailsDao.query(integrationTaskLivingDetailsEntity);
if (integrationTaskLivingDetailsEntities == null || integrationTaskLivingDetailsEntities.size() == 0) {
isExis = false;
}
if (!isExis) {
filterStockoutOrders.add(stockoutOrder);
}
}
return filterStockoutOrders;
}
/**
* 丽知OFS调整出库--->U8C其它出库
* @param filterStockoutOrders
*/
public void implement(List<StockoutOrderSearchResponse.StockoutOrder> filterStockoutOrders){
for (StockoutOrderSearchResponse.StockoutOrder stockoutOrder : filterStockoutOrders) {
String mapStr = "";
String format="";
String response="";
String ofsCode="";
try {
GeneralBillVO_4IDto generalBillVO_4I = new GeneralBillVO_4IDto();
//主表
StockoutOrderSearchResponse.StockoutOrder.StockoutH ofsHeader = stockoutOrder.getHeader();
GeneralBillVO_4IDto.Parentvo parentvo = new GeneralBillVO_4IDto.Parentvo();
//ofs订单号自定义项19
ofsCode=ofsHeader.getCode();
parentvo.setVuserdef19(ofsCode);
//pk_corp--公司
parentvo.setPk_corp(ofsHeader.getCompanyCode());
//pk_calbody--库存组织PK
parentvo.setPk_calbody(ofsHeader.getCompanyCode());
//cwarehouseid--仓库
parentvo.setCwarehouseid(ofsHeader.getFacilityCode());
//vnote--备注
parentvo.setVnote(ofsHeader.getShipmentNote());
//dbilldate--单据日期--oms入库时间
String created1 = stockoutOrder.getDetails().get(0).getCreated();
// Date created = ofsHeader.getCreated();
// format = DateUtil.format(created, "yyyy-MM-dd HH:mm:ss");
format = created1;
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<BdRdclEntity> BdRdclEntityList = iBdRdclDao.query(bdRdclEntity);
if(BdRdclEntityList.size()==0){
Assert.state(false,"查询U8C收发类型调整出库失败。未查询到U8C收发类型。");
}
String RdclCode = BdRdclEntityList.get(0).getRdcode();//收发类别编码
parentvo.setCdispatcherid(RdclCode);
//设置自动拣货
// parentvo.setIsautopick("Y");
//子表
List<GeneralBillVO_4IDto.Childrenvo> childrenvo=new ArrayList<>();
for (StockoutOrderSearchResponse.StockoutOrder.StockoutB ofsDetail : stockoutOrder.getDetails()) {
System.out.println(ofsDetail);
GeneralBillVO_4IDto.Childrenvo children = new GeneralBillVO_4IDto.Childrenvo();
//dbizdate业务日期
children.setDbizdate(format);
//存货档案id
children.setCinventoryid(ofsDetail.getSkuCode());
//nshouldinnum--应出数量
children.setNshouldoutnum(String.valueOf(ofsDetail.getRequestQty()));
//nintnum--实出数量
children.setNoutnum(String.valueOf(ofsDetail.getShipQty()));
childrenvo.add(children);
}
generalBillVO_4I.setParentvo(parentvo);
generalBillVO_4I.setChildrenvo(childrenvo);
String dataJson = JSONUtil.toJsonStr(generalBillVO_4I);
mapStr = "{\"GeneralBillVO_4I\":[" + dataJson + "]}";
response = pushDataByU8cUtil.pushU8CByCode(OverallConstant.getOverAllValue("otheroutqz"), mapStr);
System.out.println(response);
}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();
}
}
}
public List<StockoutOrderSearchResponse.StockoutOrder> queryOfsStockoutOrder(QueryOfsStockoutOrderRequestVO queryOfsStockoutOrderRequestVO) throws Exception {
InterfaceParamDto interfaceParamDto = new InterfaceParamDto();
interfaceParamDto.setApi("ofs.receipt.search");
interfaceParamDto.setApi("ofs.shipment.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){
queryOfsStockoutOrderRequestVO.setClientCode("LETS");
interfaceParamDto.setData(JSON.toJSONString(queryOfsStockoutOrderRequestVO));
SaleOutReturnMessageDto saleOutReturnMessageDto = (SaleOutReturnMessageDto) ofsUnifiedService.unified(interfaceParamDto);
System.out.println(saleOutReturnMessageDto);
StockoutOrderSearchResponse stockoutOrderSearchResponse = SaleOutReturnMessageDto2StockoutOrderSearchResponse(saleOutReturnMessageDto);
System.out.println(stockoutOrderSearchResponse);
if(stockoutOrderSearchResponse.getData()==null||stockoutOrderSearchResponse.getData().size()==0){
return null;
}
//过滤ADJUST调整
List<StockinOrderSearchResponse.StockinOrder> adjustList=new ArrayList<>();
for (StockinOrderSearchResponse.StockinOrder datum : stockinOrderSearchResponse.getData()) {
StockinOrderSearchResponse.StockinOrder.StockinH header = datum.getHeader();
if("ADJUST".equals(header.getInternalInstructionType())){
List<StockoutOrderSearchResponse.StockoutOrder> adjustList=new ArrayList<>();
for (StockoutOrderSearchResponse.StockoutOrder datum : stockoutOrderSearchResponse.getData()) {
StockoutOrderSearchResponse.StockoutOrder.StockoutH header = datum.getHeader();
if("ADJUST".equals(header.getRefOrderType())){
adjustList.add(datum);
}
}
return adjustList;
}
/**
* 只是命名不一样为了方便区分顾转换为stockout
* @param saleOutReturnMessageDto
* @return
*/
public StockoutOrderSearchResponse SaleOutReturnMessageDto2StockoutOrderSearchResponse(SaleOutReturnMessageDto saleOutReturnMessageDto){
StockoutOrderSearchResponse stockoutOrderSearchResponse = new StockoutOrderSearchResponse();
List<StockoutOrderSearchResponse.StockoutOrder> data=new ArrayList<>();
BeanUtils.copyProperties(saleOutReturnMessageDto,stockoutOrderSearchResponse);
for (HeaderDetailsDto saleOutData : saleOutReturnMessageDto.getData()) {
HeaderDto saleOutHeader = saleOutData.getHeader();
StockoutOrderSearchResponse.StockoutOrder stockoutOrder = new StockoutOrderSearchResponse.StockoutOrder();
StockoutOrderSearchResponse.StockoutOrder.StockoutH stockoutH = new StockoutOrderSearchResponse.StockoutOrder.StockoutH();
List<StockoutOrderSearchResponse.StockoutOrder.StockoutB> stockoutBList=new ArrayList<>();
for (DetailsDto saleOutDetail : saleOutData.getDetails()) {
StockoutOrderSearchResponse.StockoutOrder.StockoutB stockoutB = new StockoutOrderSearchResponse.StockoutOrder.StockoutB();
BeanUtils.copyProperties(saleOutDetail,stockoutB);
stockoutBList.add(stockoutB);
}
BeanUtils.copyProperties(saleOutHeader,stockoutH);
stockoutOrder.setHeader(stockoutH);
stockoutOrder.setDetails(stockoutBList);
data.add(stockoutOrder);
}
stockoutOrderSearchResponse.setData(data);
System.out.println(stockoutOrderSearchResponse);
return stockoutOrderSearchResponse;
}
}

View File

@ -2,13 +2,15 @@ package com.hzya.frame.plugin.lets.plugin.base;
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.QueryOfsGoodsRequestVO;
import com.hzya.frame.plugin.lets.ofsvo.QueryOfsTransferOrderRequestVO;
import com.hzya.frame.plugin.lets.ofsvo.QueryOfsSKURequestVO;
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.basics.ReturnMessageBasics;
import com.hzya.frame.ttxofs.dto.InterfaceParamByU8CApiDto;
import com.hzya.frame.ttxofs.dto.InterfaceParamDto;
import com.hzya.frame.ttxofs.service.OfsUnifiedService;
import com.hzya.frame.web.entity.JsonResultEntity;
@ -88,8 +90,23 @@ public class GoodsPluginInitializer extends PluginBaseEntity {
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" + ".000");
String endTimeStr = DateUtil.format(endTime, "yyyy-MM-dd HH:mm:ss" + ".000");
String startTimeStr = DateUtil.format(startTime, "yyyy-MM-dd HH:mm:ss");
String endTimeStr = DateUtil.format(endTime, "yyyy-MM-dd HH:mm:ss");
QueryOfsSKURequestVO queryOfsSKURequestVO = new QueryOfsSKURequestVO();
queryOfsSKURequestVO.setCreated_start(startTimeStr);
queryOfsSKURequestVO.setCreated_end(endTimeStr);
queryOfsSKURequestVO.setCreated_start("2023-10-17 00:00:00");
queryOfsSKURequestVO.setCreated_end("2023-10-17 23:59:59");
queryOfsSKURequestVO.setCompanyCode("YX");
queryOfsSKURequestVO.setPageNo(1);
queryOfsSKURequestVO.setPageSize(500);
queryOfsSKUs(queryOfsSKURequestVO);
} catch (Exception e) {
logger.error("丽知OFS货品档案--->U8C货品档案,start()方法报错:", e);
}
@ -100,7 +117,7 @@ public class GoodsPluginInitializer extends PluginBaseEntity {
*/
public void start(String goodsName) {
try {
QueryOfsGoodsRequestVO queryOfsGoodsRequestVO = new QueryOfsGoodsRequestVO();
QueryOfsSKURequestVO queryOfsGoodsRequestVO = new QueryOfsSKURequestVO();
} catch (Exception e) {
@ -126,11 +143,12 @@ public class GoodsPluginInitializer extends PluginBaseEntity {
/**
* 查询OFS SKU档案
*/
public void queryOfsGoods(QueryOfsGoodsRequestVO queryOfsGoodsRequestVO) throws Exception {
InterfaceParamDto interfaceParamDto = new InterfaceParamDto();
public void queryOfsSKUs(QueryOfsSKURequestVO queryOfsGoodsRequestVO) throws Exception {
InterfaceParamByU8CApiDto interfaceParamDto = new InterfaceParamByU8CApiDto();
interfaceParamDto.setApi("ofs.sku.search");
queryOfsGoodsRequestVO.setClientCode("LETS");
ofsUnifiedService.unified(interfaceParamDto);
interfaceParamDto.setData(JSON.toJSONString(queryOfsGoodsRequestVO));
ReturnMessageBasics returnMessageBasics = ofsUnifiedService.unifiedByU8CApi(interfaceParamDto);
}

View File

@ -591,7 +591,7 @@ public class SoSaleOutPluginInitializerToB extends PluginBaseEntity {
bdCumandocEntity1.setDataSourceCode("lets_u8c");
bdCumandocEntity1.setDr(0L);
bdCumandocEntity1.setPkCorp(bdCorpEntityList.get(0).getPkCorp());
bdCumandocEntity1.setPkCubasdoc(bdCubasdocEntityList.get(0).getPkCubasdoc());
// bdCumandocEntity1.setPkCubasdoc(bdCubasdocEntityList.get(0).getPkCubasdoc());
List<BdCumandocEntity> bdCumandocEntityList = iBdCumandocDao.query(bdCumandocEntity1);
//查找平台

View File

@ -11,6 +11,8 @@ import org.springframework.test.context.junit4.SpringRunner;
@SpringBootTest(classes = WebappApplication.class)
public class BaseTest {
@Autowired
private GoodsPluginInitializer goodsPluginInitializer;
@Autowired
private GoodsClassPluginInitializer goodsClassPluginInitializer;
@Autowired
@ -25,4 +27,9 @@ public class BaseTest {
public void t01(){
goodsAutoAllotPluginInitializer.start("0001A210000000000U4C");
}
@Test
public void t02(){
goodsPluginInitializer.start();
}
}

View File

@ -2,6 +2,7 @@ package com.hzya.frame.plugin.lets.plugin.transfer;
import com.hzya.frame.WebappApplication;
import com.hzya.frame.plugin.lets.plugin.adjust.AdjustInPluginInitializer;
import com.hzya.frame.plugin.lets.plugin.adjust.AdjustOutPluginInitializer;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
@ -18,6 +19,8 @@ public class TransferTest {
private TransferInPluginInitializer transferInPluginInitializer;
@Autowired
private AdjustInPluginInitializer adjustInPluginInitializer;
@Autowired
private AdjustOutPluginInitializer adjustOutPluginInitializer;
////////////////////////////////////////////////////////////////////////////////////调拨订单
@Test
@ -61,6 +64,17 @@ public class TransferTest {
}
////////////////////////////////////////////////////////////////////////////////////调整出库单
@Test
public void t40(){
adjustOutPluginInitializer.start();
}
@Test
public void t41(){
adjustOutPluginInitializer.start("LETS-AH2024081300000003");
}
@Test
public void t42(){
adjustOutPluginInitializer.start("2024-08-14","2024-08-14");
}
}

View File

@ -1,5 +1,7 @@
package com.hzya.frame.ttxofs.basics;
import com.hzya.frame.ttxofs.dto.ofsBaseSearch.OFSSKUClassSearchResponse;
import com.hzya.frame.ttxofs.dto.ofsBaseSearch.OFSSKUSearchResponse;
import com.hzya.frame.ttxofs.dto.ofsTransferOrderSearch.OFSTranseferOrderSearchResponse;
import com.hzya.frame.ttxofs.dto.ofssaleorderoutsearch.SaleOutReturnMessageDto;
import com.hzya.frame.ttxofs.dto.ofssalesordersearch.SaleReturnMessageDto;
@ -29,6 +31,7 @@ public class ApiDtoCacheMap {
apiDtoCacheMap.put("ofs.transferOrder.search", new OFSTranseferOrderSearchResponse());//调拨订单
apiDtoCacheMap.put("ofs.transferOrder.search", new OFSTranseferOrderSearchResponse());//SKU查询
apiDtoCacheMap.put("ofs.sku.search", new OFSSKUSearchResponse());//OFS存货档案查询接口
apiDtoCacheMap.put("ofs.inventory.class.search", new OFSSKUClassSearchResponse());//OFS存货分类查询接口
}
}

View File

@ -0,0 +1,36 @@
package com.hzya.frame.ttxofs.dto;
import com.hzya.frame.ttxofs.basics.InterfaceBasics;
import lombok.Data;
/**
* OFS基础入参类
*
* @Authorliuyang
* @Packagecom.hzya.frame.ttxofs.basics
* @ProjectkangarooDataCenterV3
* @nameInterfaceBasics
* @Date2024/7/30 11:39
* @FilenameInterfaceBasics
*/
@Data
public class InterfaceParamByU8CApiDto extends InterfaceBasics {
private String bashHttpUrl = "http://39.98.58.229/api/edi/u8c/ofs/in";
private String api;
private String format = "json";
private String appKey = "1023142858";
private String v = "1.0";
private String sign;
private String secret = "382e4a2584027a36ac9431103";
private String timestamp;
private String data;
}

View File

@ -1,10 +0,0 @@
package com.hzya.frame.ttxofs.dto.ofsBaseSearch;
import lombok.Data;
/**
* OFS SKU查询返回
*/
@Data
public class OFSGoodsSearchResponse {
}

View File

@ -0,0 +1,11 @@
package com.hzya.frame.ttxofs.dto.ofsBaseSearch;
import com.hzya.frame.ttxofs.basics.ReturnMessageBasics;
import lombok.Data;
/**
* OFS SKU查询返回
*/
@Data
public class OFSSKUClassSearchResponse extends ReturnMessageBasics {
}

View File

@ -0,0 +1,33 @@
package com.hzya.frame.ttxofs.dto.ofsBaseSearch;
import com.hzya.frame.ttxofs.basics.ReturnMessageBasics;
import lombok.Data;
import java.util.Date;
import java.util.List;
/**
* OFS SKU查询返回
*/
@Data
public class OFSSKUSearchResponse extends ReturnMessageBasics {
private List<OFSSKU> skuList;
@Data
public static class OFSSKU{
private int id;
private String clientCode;
private String companyCode;
private String code;
private String name;
private int listPrice;
private int netPrice;
private int msrPrice;
private int buyPrice;
private int status;
private Date created;
private String createdBy;
private Date lastUpdated;
private String lastUpdatedBy;
}
}

View File

@ -6,6 +6,9 @@ import lombok.Data;
import java.util.Date;
import java.util.List;
/**
* OFS入库单查询相应类
*/
@Data
public class StockinOrderSearchResponse extends ReturnMessageBasics {
private List<StockinOrder> data;

View File

@ -0,0 +1,121 @@
package com.hzya.frame.ttxofs.dto.stock;
import com.hzya.frame.ttxofs.basics.ReturnMessageBasics;
import lombok.Data;
import java.util.Date;
import java.util.List;
/**
OFS出库单查询相应类
*/
@Data
public class StockoutOrderSearchResponse extends ReturnMessageBasics {
private List<StockoutOrder> data;
@Data
public static class StockoutOrder {
private StockoutH header;
private List<StockoutB> details;
@Data
public static class StockoutH {
private String id;
private String clientCode;
private String companyCode;
private String storeCode;
private String facilityCode;
private String code;
private String refOrderId;
private String refOrderCode;
private String refOrderType;
private String status;
private String consolidated;
private String internalInstructionType;
private String bizChannel;
private String sourcePlatformCode;
private String processType;
private String sourceOrderId;
private String sourceOrderCode;
private String sourceUserAccount;
private String shipToAttentionTo;
private String shipToAddress;
private String shipToCountry;
private String shipToState;
private String shipToCity;
private String shipToDistrict;
private String shipToMobile;
private String totalLines;
private String totalQty;
private String totalContainers;
private String totalCases;
private String totalWeight;
private String totalVolume;
private String totalVolumeWeight;
private String weightUM;
private String volumeUM;
private String totalAmount;
private String totalPayAmount;
private String postageAmount;
private String itemTotalAmount;
private String carrierCode;
private String paymentStatus;
private String codRequired;
private String invoiceRequired;
private String paidAt;
private String shipFromAttentionTo;
private String shipFromAddress;
private String shipFromDistrict;
private String shipFromCity;
private String shipFromState;
private String shipFromCountry;
private String shipFromPostalCode;
private String shipFromPhone;
private String shipFromMobile;
private String shipFromFax;
private String shipFromEmail;
private String codAmount;
private String tax;
private String taxPaid;
private String shipToStateName;
private String shipToCityName;
private String shipToDistrictName;
private String shipAt;
private String shipmentType;
private String shipmentNote;
}
@Data
public static class StockoutB {
private String clientCode;
private String companyCode;
private String facilityCode;
private String shipmentCode;
private String refOrderId;
private String refOrderDetailId;
private String refOrderCode;
private String allocInvId;
private String skuCode;
private String skuName;
private String sourceOrderCode;
private String inventorySts;
private String isGift;
private String requestQty;
private String shipQty;
private String quantityUM;
private String listPrice;
private String itemTotalAmount;
private String totalPayAmount;
private String totalWeight;
private String totalVolume;
private String totalVolumeWeight;
private String weightUM;
private String volumeUM;
private String created;
private String createdBy;
private String lastUpdated;
private String lastUpdatedBy;
}
}
}

View File

@ -1,6 +1,7 @@
package com.hzya.frame.ttxofs.service;
import com.hzya.frame.ttxofs.basics.ReturnMessageBasics;
import com.hzya.frame.ttxofs.dto.InterfaceParamByU8CApiDto;
import com.hzya.frame.ttxofs.dto.InterfaceParamDto;
/**
@ -20,4 +21,5 @@ public interface OfsUnifiedService {
* @author liuyang
*/
ReturnMessageBasics unified(InterfaceParamDto interfaceParamDto) throws Exception;
ReturnMessageBasics unifiedByU8CApi(InterfaceParamByU8CApiDto interfaceParamDto) throws Exception;
}

View File

@ -6,6 +6,7 @@ import com.alibaba.fastjson2.JSON;
import com.alibaba.fastjson2.JSONObject;
import com.hzya.frame.ttxofs.basics.ApiDtoCacheMap;
import com.hzya.frame.ttxofs.basics.ReturnMessageBasics;
import com.hzya.frame.ttxofs.dto.InterfaceParamByU8CApiDto;
import com.hzya.frame.ttxofs.dto.InterfaceParamDto;
import com.hzya.frame.ttxofs.service.OfsUnifiedService;
import com.hzya.frame.ttxofs.util.UrlTransUtil;
@ -155,4 +156,53 @@ public class OfsUnifiedServiceImpl implements OfsUnifiedService {
}
return "";
}
@Override
public ReturnMessageBasics unifiedByU8CApi(InterfaceParamByU8CApiDto interfaceParamDto) throws Exception {
//从缓存中得到实体类
interfaceParamDto.setTimestamp(String.valueOf(System.currentTimeMillis()));
ReturnMessageBasics returnMessageBasics = ApiDtoCacheMap.apiDtoCacheMap.get(interfaceParamDto.getApi());
// 创建HttpClientBuilder
HttpClientBuilder httpClientBuilder = HttpClientBuilder.create();
// HttpClient
CloseableHttpClient closeableHttpClient = httpClientBuilder.build();
String httpUrl = UrlTransUtil.urlTransByU8CApi(interfaceParamDto);
try {
Map<String, String> params = new HashMap<>();
params.put("data", interfaceParamDto.getData());
String resultStr = postParams(httpUrl, params);
if (resultStr != null && !"".equals(resultStr.trim())) {
ReturnMessageBasics returnMessageBasics1 = JSON.parseObject(resultStr, returnMessageBasics.getClass());
if ("0".equals(returnMessageBasics1.getCode()) && "false".equals(returnMessageBasics1.getError())) {
//成功
return returnMessageBasics1;
} else {
//失败
Assert.state(false, "OFS接口抛出异常 原因:{}", returnMessageBasics1.getMsg());
}
} else {
//2024年7月30日 12:06:22 接口没有返回任何解决
Assert.state(false, "OFS接口没有返回任何内容");
}
} catch (Exception e) {
//2024年7月30日 12:03:53 抛出方法的调用者
String msgError = StrUtil.format("拉取/推送失败,错误原因:{} 请求地址:{}", e.getMessage(), httpUrl);
logger.error(msgError);
Assert.state(false, msgError);
} finally {
try {
if (closeableHttpClient != null) {
closeableHttpClient.close();
}
} catch (Exception e) {
//2024年7月30日 12:04:20这里一般不会抛出异常记录错误
logger.error("执行closeableHttpClient.close();时抛出异常", e);
}
}
return null;
}
}

View File

@ -2,6 +2,7 @@ package com.hzya.frame.ttxofs.util;
import cn.hutool.core.util.StrUtil;
import com.hzya.frame.ttxofs.OfsHexUtil;
import com.hzya.frame.ttxofs.dto.InterfaceParamByU8CApiDto;
import com.hzya.frame.ttxofs.dto.InterfaceParamDto;
/**
@ -25,4 +26,13 @@ public class UrlTransUtil {
String sign = ofsHexUtil.sign(interfaceParamDto.getApi(), interfaceParamDto.getData(), interfaceParamDto.getFormat(), interfaceParamDto.getAppKey(), interfaceParamDto.getV(), interfaceParamDto.getSecret(), interfaceParamDto.getTimestamp());
return StrUtil.format(bashHttpUrl + "?api={}&format={}&appKey={}&v={}&sign={}&timestamp={}", interfaceParamDto.getApi(), interfaceParamDto.getFormat(), interfaceParamDto.getAppKey(), interfaceParamDto.getV(), sign, interfaceParamDto.getTimestamp());
}
public static String urlTransByU8CApi(InterfaceParamByU8CApiDto interfaceParamByU8CApiDto) {
String bashHttpUrl = interfaceParamByU8CApiDto.getBashHttpUrl();
//2024年8月15日
OfsHexUtil ofsHexUtil = new OfsHexUtil();
String sign = ofsHexUtil.sign(interfaceParamByU8CApiDto.getApi(), interfaceParamByU8CApiDto.getData(), interfaceParamByU8CApiDto.getFormat(), interfaceParamByU8CApiDto.getAppKey(), interfaceParamByU8CApiDto.getV(), interfaceParamByU8CApiDto.getSecret(), interfaceParamByU8CApiDto.getTimestamp());
return StrUtil.format(bashHttpUrl + "?api={}&format={}&appKey={}&v={}&sign={}&timestamp={}", interfaceParamByU8CApiDto.getApi(), interfaceParamByU8CApiDto.getFormat(), interfaceParamByU8CApiDto.getAppKey(), interfaceParamByU8CApiDto.getV(), sign, interfaceParamByU8CApiDto.getTimestamp());
}
}