丽知:调整出库完善.

This commit is contained in:
zhengyf 2024-08-16 11:55:24 +08:00
parent 821c26bc3a
commit b490c2e239
4 changed files with 212 additions and 47 deletions

View File

@ -23,6 +23,7 @@ import com.hzya.frame.ttxofs.dto.InterfaceParamDto;
import com.hzya.frame.ttxofs.dto.stock.StockinOrderSearchResponse; import com.hzya.frame.ttxofs.dto.stock.StockinOrderSearchResponse;
import com.hzya.frame.ttxofs.service.OfsUnifiedService; import com.hzya.frame.ttxofs.service.OfsUnifiedService;
import com.hzya.frame.web.entity.JsonResultEntity; import com.hzya.frame.web.entity.JsonResultEntity;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
@ -82,6 +83,38 @@ public class AdjustInPluginInitializer extends PluginBaseEntity {
@Override @Override
public JsonResultEntity executeBusiness(JSONObject requestJson) throws Exception { public JsonResultEntity executeBusiness(JSONObject requestJson) throws Exception {
try {
logger.info("调用:" + getPluginName() + "-插件");
String prod = "prod";
String param = String.valueOf(requestJson.get("param"));
if (requestJson != null && ProfilesActiveConstant.TYPE_DATE.equals(requestJson.get("type"))) {
//按日期
if (param != null && !"".equals(param)) {
String[] split = param.split("/");
if (!(split.length == 2)) {
Assert.state(false, "时间格式传递不正确");
}
Assert.notNull(split[0], "开始时间不能为空");
Assert.notNull(split[1], "结束时间不能为空");
start(split[0], split[1]);
}
} else if (requestJson != null && ProfilesActiveConstant.TYPE_VBILLCODE.equals(requestJson.get("type"))) {
//按单号
if (param != null && !"".equals(param)) {
start(param);
}
} else if (ProfilesActiveConstant.TYPE_DETAIL_ERROR.equals(requestJson.get("type"))) {
String integrationTaskLivingDetails = (String) requestJson.get("integration_task_living_details_id");
IntegrationTaskLivingDetailsEntity integrationTaskLivingDetailsEntity = saveOrUpdateBusinessLogUtil.queryIntegrationTaskLivingDetailsEntity(integrationTaskLivingDetails);
start(integrationTaskLivingDetailsEntity.getRootAppPk());
} else if (ProfilesActiveConstant.LETS_PROFILES_ACTIVE.equals(prod)) {
//默认
start();
}
} catch (Exception e) {
e.printStackTrace();
logger.error("executeBusiness方法抛出异常", e);
}
return null; return null;
} }
@ -101,8 +134,7 @@ public class AdjustInPluginInitializer extends PluginBaseEntity {
QueryOfsStockinOrderRequestVO queryOfsStockinOrderRequestVO = new QueryOfsStockinOrderRequestVO(); QueryOfsStockinOrderRequestVO queryOfsStockinOrderRequestVO = new QueryOfsStockinOrderRequestVO();
queryOfsStockinOrderRequestVO.setCreated_start(startTimeStr); queryOfsStockinOrderRequestVO.setCreated_start(startTimeStr);
queryOfsStockinOrderRequestVO.setCreated_end(endTimeStr); queryOfsStockinOrderRequestVO.setCreated_end(endTimeStr);
queryOfsStockinOrderRequestVO.setCompanyCode("SHLZ"); queryOfsStockinOrderRequestVO.setStatus("900");//状态 500待同步 510已同步 700收货中 900入库完成 911作废 100订单池 200暂挂 400待合单 410待出库单出库
// queryOfsTransferOrderRequestVO.setStatus("900");//状态 500待同步 510已同步 700收货中 900入库完成 911作废 100订单池 200暂挂 400待合单 410待出库单出库
queryOfsStockinOrderRequestVO.setPageNo(1L); queryOfsStockinOrderRequestVO.setPageNo(1L);
queryOfsStockinOrderRequestVO.setPageSize(500L); queryOfsStockinOrderRequestVO.setPageSize(500L);
List<StockinOrderSearchResponse.StockinOrder> stockinOrders = queryOfsStockinOrder(queryOfsStockinOrderRequestVO); List<StockinOrderSearchResponse.StockinOrder> stockinOrders = queryOfsStockinOrder(queryOfsStockinOrderRequestVO);
@ -133,23 +165,21 @@ public class AdjustInPluginInitializer extends PluginBaseEntity {
try { try {
QueryOfsStockinOrderRequestVO queryOfsStockinOrderRequestVO = new QueryOfsStockinOrderRequestVO(); 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.setCode(stockinNo);
queryOfsStockinOrderRequestVO.setCompanyCode("SHLZ"); // queryOfsStockinOrderRequestVO.setCompanyCode("SHLZ");
// queryOfsTransferOrderRequestVO.setStatus("900");//状态 500待同步 510已同步 700收货中 900入库完成 911作废 100订单池 200暂挂 400待合单 410待出库单出库 queryOfsStockinOrderRequestVO.setStatus("900");//状态 500待同步 510已同步 700收货中 900入库完成 911作废 100订单池 200暂挂 400待合单 410待出库单出库
queryOfsStockinOrderRequestVO.setPageNo(1L); queryOfsStockinOrderRequestVO.setPageNo(1L);
queryOfsStockinOrderRequestVO.setPageSize(500L); queryOfsStockinOrderRequestVO.setPageSize(500L);
List<StockinOrderSearchResponse.StockinOrder> stockinOrders = queryOfsStockinOrder(queryOfsStockinOrderRequestVO); List<StockinOrderSearchResponse.StockinOrder> stockinOrders = queryOfsStockinOrder(queryOfsStockinOrderRequestVO);
System.out.println(stockinOrders); System.out.println(stockinOrders);
if (stockinOrders.size() == 0) { if (stockinOrders.size() == 0) {
return; Assert.state(false, "丽知OFS调整入库--->U8C其它入库根据单据号[入库完成]{},未查询到调整出库单",stockinNo);
} }
//过滤日志 //过滤日志
List<StockinOrderSearchResponse.StockinOrder> filterStockinOrders = filterData(stockinOrders); List<StockinOrderSearchResponse.StockinOrder> filterStockinOrders = filterData(stockinOrders);
if (filterStockinOrders.size() == 0) { if (filterStockinOrders.size() == 0) {
return; Assert.state(false, "丽知OFS调整入库--->U8C其它入库根据单据号[入库完成]{},该调整出库单已被推送成功,请勿重新推送",stockinNo);
} }
//推送 //推送
@ -174,20 +204,19 @@ public class AdjustInPluginInitializer extends PluginBaseEntity {
QueryOfsStockinOrderRequestVO queryOfsStockinOrderRequestVO = new QueryOfsStockinOrderRequestVO(); QueryOfsStockinOrderRequestVO queryOfsStockinOrderRequestVO = new QueryOfsStockinOrderRequestVO();
queryOfsStockinOrderRequestVO.setCreated_start(start); queryOfsStockinOrderRequestVO.setCreated_start(start);
queryOfsStockinOrderRequestVO.setCreated_end(end); queryOfsStockinOrderRequestVO.setCreated_end(end);
queryOfsStockinOrderRequestVO.setCompanyCode("SHOFF"); queryOfsStockinOrderRequestVO.setStatus("900");//状态 500待同步 510已同步 700收货中 900入库完成 911作废 100订单池 200暂挂 400待合单 410待出库单出库
// queryOfsTransferOrderRequestVO.setStatus("900");//状态 500待同步 510已同步 700收货中 900入库完成 911作废 100订单池 200暂挂 400待合单 410待出库单出库
queryOfsStockinOrderRequestVO.setPageNo(1L); queryOfsStockinOrderRequestVO.setPageNo(1L);
queryOfsStockinOrderRequestVO.setPageSize(500L); queryOfsStockinOrderRequestVO.setPageSize(500L);
List<StockinOrderSearchResponse.StockinOrder> stockinOrders = queryOfsStockinOrder(queryOfsStockinOrderRequestVO); List<StockinOrderSearchResponse.StockinOrder> stockinOrders = queryOfsStockinOrder(queryOfsStockinOrderRequestVO);
System.out.println(stockinOrders); System.out.println(stockinOrders);
if (stockinOrders.size() == 0) { if (stockinOrders.size() == 0) {
return; Assert.state(false, "丽知OFS调整入库--->U8C其它入库根据日期期间[开始时间]-[结束时间]{}-{},未查询到调整入库单[入库完成]",startTime,endTime);
} }
//过滤日志 //过滤日志
List<StockinOrderSearchResponse.StockinOrder> filterStockinOrders = filterData(stockinOrders); List<StockinOrderSearchResponse.StockinOrder> filterStockinOrders = filterData(stockinOrders);
if (filterStockinOrders.size() == 0) { if (filterStockinOrders.size() == 0) {
return; Assert.state(false, "丽知OFS调整入库--->U8C其它入库根据日期期间[开始时间]-[结束时间]{}-{},该调期间整入库单[入库完成]已被推送成功,请勿重新推送",startTime,endTime);
} }
//推送 //推送
@ -257,12 +286,12 @@ public class AdjustInPluginInitializer extends PluginBaseEntity {
//dbilldate--单据日期--oms入库时间 //dbilldate--单据日期--oms入库时间
Date created = ofsHeader.getCreated(); Date created = ofsHeader.getCreated();
format = DateUtil.format(created, "yyyy-MM-dd HH:mm:ss"); format = DateUtil.format(created, "yyyy-MM-dd HH:mm:ss");
parentvo.setDbilldate(format); parentvo.setDbilldate(StringUtils.substring(format,0,10));
//coperatorid--制单人 //coperatorid--制单人
String createdBy = ofsHeader.getCreatedBy(); String createdBy = ofsHeader.getCreatedBy();
parentvo.setCoperatorid("tbadmin"); parentvo.setCoperatorid("tbadmin");
//审核时间dauditdate //审核时间dauditdate
parentvo.setDauditdate(format); parentvo.setDauditdate(StringUtils.substring(format,0,10));
//cdispatcherid--收发类别ofs过来的写死20240813妮姐+万万就是调整出库调整入库 //cdispatcherid--收发类别ofs过来的写死20240813妮姐+万万就是调整出库调整入库
BdRdclEntity bdRdclEntity = new BdRdclEntity(); BdRdclEntity bdRdclEntity = new BdRdclEntity();
@ -328,7 +357,8 @@ public class AdjustInPluginInitializer extends PluginBaseEntity {
integrationTaskLivingDetailsEntity.setNewPushDate(new Date()); integrationTaskLivingDetailsEntity.setNewPushDate(new Date());
integrationTaskLivingDetailsEntity.setBusinessDate(format); integrationTaskLivingDetailsEntity.setBusinessDate(format);
integrationTaskLivingDetailsEntity.setRootAppPk(ofsCode); integrationTaskLivingDetailsEntity.setRootAppPk(ofsCode);
integrationTaskLivingDetailsEntity.setRootAppBill(vbillcode);//u8c调拨订单号 integrationTaskLivingDetailsEntity.setRootAppBill(ofsCode);
integrationTaskLivingDetailsEntity.setRootAppBill(vbillcode);
integrationTaskLivingDetailsEntity.setPluginId(getPluginId()); integrationTaskLivingDetailsEntity.setPluginId(getPluginId());
saveOrUpdateBusinessLogUtil.saveOrUpdate(integrationTaskLivingDetailsEntity); saveOrUpdateBusinessLogUtil.saveOrUpdate(integrationTaskLivingDetailsEntity);
@ -347,7 +377,7 @@ public class AdjustInPluginInitializer extends PluginBaseEntity {
integrationTaskLivingDetailsEntity.setNewPushDate(new Date()); integrationTaskLivingDetailsEntity.setNewPushDate(new Date());
integrationTaskLivingDetailsEntity.setBusinessDate(format); integrationTaskLivingDetailsEntity.setBusinessDate(format);
integrationTaskLivingDetailsEntity.setRootAppPk(ofsCode); integrationTaskLivingDetailsEntity.setRootAppPk(ofsCode);
integrationTaskLivingDetailsEntity.setRootAppBill(null);//u8c调拨订单号 integrationTaskLivingDetailsEntity.setRootAppBill(ofsCode);
integrationTaskLivingDetailsEntity.setPluginId(getPluginId()); integrationTaskLivingDetailsEntity.setPluginId(getPluginId());
saveOrUpdateBusinessLogUtil.saveOrUpdate(integrationTaskLivingDetailsEntity); saveOrUpdateBusinessLogUtil.saveOrUpdate(integrationTaskLivingDetailsEntity);
} }

View File

@ -13,6 +13,7 @@ import com.hzya.frame.plugin.lets.dao.IBdRdclDao;
import com.hzya.frame.plugin.lets.entity.BdRdclEntity; import com.hzya.frame.plugin.lets.entity.BdRdclEntity;
import com.hzya.frame.plugin.lets.ofsvo.QueryOfsStockinOrderRequestVO; import com.hzya.frame.plugin.lets.ofsvo.QueryOfsStockinOrderRequestVO;
import com.hzya.frame.plugin.lets.ofsvo.QueryOfsStockoutOrderRequestVO; import com.hzya.frame.plugin.lets.ofsvo.QueryOfsStockoutOrderRequestVO;
import com.hzya.frame.plugin.lets.u8cdto.GeneralBillVO_4ADto;
import com.hzya.frame.plugin.lets.u8cdto.GeneralBillVO_4IDto; import com.hzya.frame.plugin.lets.u8cdto.GeneralBillVO_4IDto;
import com.hzya.frame.plugin.lets.u8cdto.ReusltStrDto; import com.hzya.frame.plugin.lets.u8cdto.ReusltStrDto;
import com.hzya.frame.plugin.lets.util.PushDataByU8cUtil; import com.hzya.frame.plugin.lets.util.PushDataByU8cUtil;
@ -27,7 +28,9 @@ import com.hzya.frame.ttxofs.dto.ofssaleorderoutsearch.SaleOutReturnMessageDto;
import com.hzya.frame.ttxofs.dto.stock.StockinOrderSearchResponse; import com.hzya.frame.ttxofs.dto.stock.StockinOrderSearchResponse;
import com.hzya.frame.ttxofs.dto.stock.StockoutOrderSearchResponse; import com.hzya.frame.ttxofs.dto.stock.StockoutOrderSearchResponse;
import com.hzya.frame.ttxofs.service.OfsUnifiedService; import com.hzya.frame.ttxofs.service.OfsUnifiedService;
import com.hzya.frame.u8c.ax.entity.Ass;
import com.hzya.frame.web.entity.JsonResultEntity; import com.hzya.frame.web.entity.JsonResultEntity;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
@ -87,6 +90,38 @@ public class AdjustOutPluginInitializer extends PluginBaseEntity {
@Override @Override
public JsonResultEntity executeBusiness(JSONObject requestJson) throws Exception { public JsonResultEntity executeBusiness(JSONObject requestJson) throws Exception {
try {
logger.info("调用:" + getPluginName() + "-插件");
String prod = "prod";
String param = String.valueOf(requestJson.get("param"));
if (requestJson != null && ProfilesActiveConstant.TYPE_DATE.equals(requestJson.get("type"))) {
//按日期
if (param != null && !"".equals(param)) {
String[] split = param.split("/");
if (!(split.length == 2)) {
Assert.state(false, "时间格式传递不正确");
}
Assert.notNull(split[0], "开始时间不能为空");
Assert.notNull(split[1], "结束时间不能为空");
start(split[0], split[1]);
}
} else if (requestJson != null && ProfilesActiveConstant.TYPE_VBILLCODE.equals(requestJson.get("type"))) {
//按单号
if (param != null && !"".equals(param)) {
start(param);
}
} else if (ProfilesActiveConstant.TYPE_DETAIL_ERROR.equals(requestJson.get("type"))) {
String integrationTaskLivingDetails = (String) requestJson.get("integration_task_living_details_id");
IntegrationTaskLivingDetailsEntity integrationTaskLivingDetailsEntity = saveOrUpdateBusinessLogUtil.queryIntegrationTaskLivingDetailsEntity(integrationTaskLivingDetails);
start(integrationTaskLivingDetailsEntity.getRootAppPk());
} else if (ProfilesActiveConstant.LETS_PROFILES_ACTIVE.equals(prod)) {
//默认
start();
}
} catch (Exception e) {
e.printStackTrace();
logger.error("executeBusiness方法抛出异常", e);
}
return null; return null;
} }
@ -104,10 +139,10 @@ public class AdjustOutPluginInitializer extends PluginBaseEntity {
String endTimeStr = DateUtil.format(endTime, "yyyy-MM-dd HH:mm:ss"); String endTimeStr = DateUtil.format(endTime, "yyyy-MM-dd HH:mm:ss");
QueryOfsStockoutOrderRequestVO queryOfsStockoutOrderRequestVO = new QueryOfsStockoutOrderRequestVO(); QueryOfsStockoutOrderRequestVO queryOfsStockoutOrderRequestVO = new QueryOfsStockoutOrderRequestVO();
queryOfsStockoutOrderRequestVO.setCreated_start("2024-08-08 00:00:00"); queryOfsStockoutOrderRequestVO.setClosedAt_start(startTimeStr);
queryOfsStockoutOrderRequestVO.setCreated_end("2024-08-10 23:59:59"); queryOfsStockoutOrderRequestVO.setClosedAt_end(endTimeStr);
queryOfsStockoutOrderRequestVO.setCompanyCode("SHXM"); // queryOfsStockoutOrderRequestVO.setCompanyCode("SHXM");
// queryOfsTransferOrderRequestVO.setStatus("900");//状态 500待同步 510已同步 700收货中 900入库完成 911作废 100订单池 200暂挂 400待合单 410待出库单出库 queryOfsStockoutOrderRequestVO.setStatus("900");//状态 500待同步 510已同步 700收货中 900入库完成 911作废 100订单池 200暂挂 400待合单 410待出库单出库
queryOfsStockoutOrderRequestVO.setPageNo(1L); queryOfsStockoutOrderRequestVO.setPageNo(1L);
queryOfsStockoutOrderRequestVO.setPageSize(500L); queryOfsStockoutOrderRequestVO.setPageSize(500L);
List<StockoutOrderSearchResponse.StockoutOrder> stockoutOrders = queryOfsStockoutOrder(queryOfsStockoutOrderRequestVO); List<StockoutOrderSearchResponse.StockoutOrder> stockoutOrders = queryOfsStockoutOrder(queryOfsStockoutOrderRequestVO);
@ -133,6 +168,25 @@ public class AdjustOutPluginInitializer extends PluginBaseEntity {
*/ */
public void start(String stockoutNo) { public void start(String stockoutNo) {
try { try {
QueryOfsStockoutOrderRequestVO queryOfsStockoutOrderRequestVO = new QueryOfsStockoutOrderRequestVO();
queryOfsStockoutOrderRequestVO.setCode(stockoutNo);
queryOfsStockoutOrderRequestVO.setStatus("900");//状态 500待同步 510已同步 700收货中 900入库完成 911作废 100订单池 200暂挂 400待合单 410待出库单出库
queryOfsStockoutOrderRequestVO.setPageNo(1L);
queryOfsStockoutOrderRequestVO.setPageSize(500L);
List<StockoutOrderSearchResponse.StockoutOrder> stockoutOrders = queryOfsStockoutOrder(queryOfsStockoutOrderRequestVO);
if (stockoutOrders == null || stockoutOrders.size() == 0) {
Assert.state(false, "丽知OFS调整出库--->U8C其它出库根据单据号[出库完成]{},未查询到调整出库单",stockoutNo);
}
//过滤日志
List<StockoutOrderSearchResponse.StockoutOrder> filterStockoutOrders = filterData(stockoutOrders);
if (filterStockoutOrders == null || filterStockoutOrders.size() == 0) {
Assert.state(false, "丽知OFS调整出库--->U8C其它出库根据单据号[出库完成]{},该调整出库单已被推送成功,请勿重新推送",stockoutNo);
}
//推送
implement(filterStockoutOrders);
} catch (Exception e) { } catch (Exception e) {
logger.error("丽知OFS调整出库--->U8C其它出库,start(String goodsName)方法报错:", e); logger.error("丽知OFS调整出库--->U8C其它出库,start(String goodsName)方法报错:", e);
} }
@ -140,7 +194,7 @@ public class AdjustOutPluginInitializer extends PluginBaseEntity {
} }
/** /**
* 按时间区间 * 按时间区间,ofs接口最大显示7天时间计算7天分段
*/ */
public void start(String startTime, String endTime) { public void start(String startTime, String endTime) {
try { try {
@ -148,6 +202,27 @@ public class AdjustOutPluginInitializer extends PluginBaseEntity {
Date business_end = DateUtil.parse(endTime); Date business_end = DateUtil.parse(endTime);
String start = DateUtil.format(business_start, "yyyy-MM-dd") + " 00:00:00"; String start = DateUtil.format(business_start, "yyyy-MM-dd") + " 00:00:00";
String end = DateUtil.format(business_end, "yyyy-MM-dd") + " 23:59:59"; String end = DateUtil.format(business_end, "yyyy-MM-dd") + " 23:59:59";
QueryOfsStockoutOrderRequestVO queryOfsStockoutOrderRequestVO = new QueryOfsStockoutOrderRequestVO();
queryOfsStockoutOrderRequestVO.setShipAt_start(start);
queryOfsStockoutOrderRequestVO.setShipAt_end(end);
queryOfsStockoutOrderRequestVO.setStatus("900");//状态 500待同步 510已同步 700收货中 900入库完成 911作废 100订单池 200暂挂 400待合单 410待出库单出库
queryOfsStockoutOrderRequestVO.setPageNo(1L);
queryOfsStockoutOrderRequestVO.setPageSize(500L);
List<StockoutOrderSearchResponse.StockoutOrder> stockoutOrders = queryOfsStockoutOrder(queryOfsStockoutOrderRequestVO);
if (stockoutOrders == null || stockoutOrders.size() == 0) {
Assert.state(false, "丽知OFS调整出库--->U8C其它出库根据日期期间[开始时间]-[结束时间]{}-{},未查询到调整出库单[出库完成]",startTime,endTime);
}
//过滤日志
List<StockoutOrderSearchResponse.StockoutOrder> filterStockoutOrders = filterData(stockoutOrders);
if (filterStockoutOrders == null || filterStockoutOrders.size() == 0) {
Assert.state(false, "丽知OFS调整出库--->U8C其它出库根据日期期间[开始时间]-[结束时间]{}-{},该调期间整出库单[出库完成]已被推送成功,请勿重新推送",startTime,endTime);
}
//推送
implement(filterStockoutOrders);
} catch (Exception e) { } catch (Exception e) {
logger.error("丽知OFS调整出库--->U8C其它出库,start(String startTime, String endTime)方法报错:", e); logger.error("丽知OFS调整出库--->U8C其它出库,start(String startTime, String endTime)方法报错:", e);
} }
@ -212,15 +287,15 @@ public class AdjustOutPluginInitializer extends PluginBaseEntity {
//vnote--备注 //vnote--备注
parentvo.setVnote(ofsHeader.getShipmentNote()); parentvo.setVnote(ofsHeader.getShipmentNote());
//dbilldate--单据日期--oms入库时间 //dbilldate--单据日期--oms入库时间
String created1 = stockoutOrder.getDetails().get(0).getCreated(); String created1 = ofsHeader.getCreated();
// Date created = ofsHeader.getCreated(); // Date created = ofsHeader.getCreated();
// format = DateUtil.format(created, "yyyy-MM-dd HH:mm:ss"); // format = DateUtil.format(created, "yyyy-MM-dd HH:mm:ss");
format = created1; format = created1;
parentvo.setDbilldate(format); parentvo.setDbilldate(StringUtils.substring(format,0,10));
//coperatorid--制单人 //coperatorid--制单人
parentvo.setCoperatorid("tbadmin"); parentvo.setCoperatorid("tbadmin");
//审核时间dauditdate //审核时间dauditdate
parentvo.setDauditdate(format); parentvo.setDauditdate(StringUtils.substring(format,0,10));
//cdispatcherid--收发类别ofs过来的写死20240813妮姐+万万就是调整出库调整入库 //cdispatcherid--收发类别ofs过来的写死20240813妮姐+万万就是调整出库调整入库
BdRdclEntity bdRdclEntity = new BdRdclEntity(); BdRdclEntity bdRdclEntity = new BdRdclEntity();
@ -265,9 +340,33 @@ public class AdjustOutPluginInitializer extends PluginBaseEntity {
mapStr = "{\"GeneralBillVO_4I\":[" + dataJson + "]}"; mapStr = "{\"GeneralBillVO_4I\":[" + dataJson + "]}";
response = pushDataByU8cUtil.pushU8CByCode(OverallConstant.getOverAllValue("otheroutqz"), mapStr); response = pushDataByU8cUtil.pushU8CByCode(OverallConstant.getOverAllValue("otheroutqz"), mapStr);
System.out.println(response); 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_4IDto 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(ofsCode);//u8c其他出库单号
// integrationTaskLivingDetailsEntity.setRootAppBill(vbillcode);//u8c其他出库单号
integrationTaskLivingDetailsEntity.setPluginId(getPluginId());
saveOrUpdateBusinessLogUtil.saveOrUpdate(integrationTaskLivingDetailsEntity);
}catch (Exception e){ }catch (Exception e){
e.printStackTrace(); e.printStackTrace();
@ -275,6 +374,20 @@ public class AdjustOutPluginInitializer extends PluginBaseEntity {
ReusltStrDto reusltStrDto = JSON.parseObject(response, ReusltStrDto.class); ReusltStrDto reusltStrDto = JSON.parseObject(response, ReusltStrDto.class);
String ErrMessage ="推送U8C丽知OFS调整入库--->U8C其它入库失败失败原因"+ reusltStrDto.getErrormsg(); 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(ofsCode);//u8c其他出库单号
// integrationTaskLivingDetailsEntity.setRootAppBill(null);//u8c其他出库单号
integrationTaskLivingDetailsEntity.setPluginId(getPluginId());
saveOrUpdateBusinessLogUtil.saveOrUpdate(integrationTaskLivingDetailsEntity);
} }
} }
@ -283,7 +396,7 @@ public class AdjustOutPluginInitializer extends PluginBaseEntity {
public List<StockoutOrderSearchResponse.StockoutOrder> queryOfsStockoutOrder(QueryOfsStockoutOrderRequestVO queryOfsStockoutOrderRequestVO) throws Exception { public List<StockoutOrderSearchResponse.StockoutOrder> queryOfsStockoutOrder(QueryOfsStockoutOrderRequestVO queryOfsStockoutOrderRequestVO) throws Exception {
InterfaceParamDto interfaceParamDto = new InterfaceParamDto(); InterfaceParamDto interfaceParamDto = new InterfaceParamDto();
interfaceParamDto.setApi("ofs.shipment.search"); interfaceParamDto.setApi("ofs.shipment.search");
// queryOfsStockinOrderRequestVO.setInternalInstructionType("ADJUST");//入库单类型 SALES销售 EXCHANGE换货 REISSUE补发RETURN销退 PURCHASE采购 PURCHASE_RETURN采退 TRANSFER调拨 WORK_ORDER加工 OTHER其他 ADJUST调整 EXCHANGE换货 queryOfsStockoutOrderRequestVO.setInternalInstructionType("ADJUST");//入库单类型 SALES销售 EXCHANGE换货 REISSUE补发RETURN销退 PURCHASE采购 PURCHASE_RETURN采退 TRANSFER调拨 WORK_ORDER加工 OTHER其他 ADJUST调整 EXCHANGE换货
queryOfsStockoutOrderRequestVO.setClientCode("LETS"); queryOfsStockoutOrderRequestVO.setClientCode("LETS");
interfaceParamDto.setData(JSON.toJSONString(queryOfsStockoutOrderRequestVO)); interfaceParamDto.setData(JSON.toJSONString(queryOfsStockoutOrderRequestVO));
SaleOutReturnMessageDto saleOutReturnMessageDto = (SaleOutReturnMessageDto) ofsUnifiedService.unified(interfaceParamDto); SaleOutReturnMessageDto saleOutReturnMessageDto = (SaleOutReturnMessageDto) ofsUnifiedService.unified(interfaceParamDto);
@ -294,15 +407,7 @@ public class AdjustOutPluginInitializer extends PluginBaseEntity {
if(stockoutOrderSearchResponse.getData()==null||stockoutOrderSearchResponse.getData().size()==0){ if(stockoutOrderSearchResponse.getData()==null||stockoutOrderSearchResponse.getData().size()==0){
return null; return null;
} }
//过滤ADJUST调整 return stockoutOrderSearchResponse.getData();
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;
} }
/** /**
@ -324,6 +429,13 @@ public class AdjustOutPluginInitializer extends PluginBaseEntity {
BeanUtils.copyProperties(saleOutDetail,stockoutB); BeanUtils.copyProperties(saleOutDetail,stockoutB);
stockoutBList.add(stockoutB); stockoutBList.add(stockoutB);
} }
//创建时间修改时间创建人修改人赋给表头
StockoutOrderSearchResponse.StockoutOrder.StockoutB stockoutB = stockoutBList.get(0);
stockoutH.setCreated(stockoutB.getCreated());
stockoutH.setCreatedBy(stockoutB.getCreatedBy());
stockoutH.setLastUpdated(stockoutB.getLastUpdated());
stockoutH.setLastUpdatedBy(stockoutB.getLastUpdatedBy());
BeanUtils.copyProperties(saleOutHeader,stockoutH); BeanUtils.copyProperties(saleOutHeader,stockoutH);
stockoutOrder.setHeader(stockoutH); stockoutOrder.setHeader(stockoutH);
stockoutOrder.setDetails(stockoutBList); stockoutOrder.setDetails(stockoutBList);
@ -333,4 +445,20 @@ public class AdjustOutPluginInitializer extends PluginBaseEntity {
System.out.println(stockoutOrderSearchResponse); System.out.println(stockoutOrderSearchResponse);
return stockoutOrderSearchResponse; return stockoutOrderSearchResponse;
} }
private GeneralBillVO_4IDto resultDataHandle(String resultData) {
try {
if (resultData != null && !"".equals(resultData)) {
if (resultData.contains("[")) {
resultData = resultData.substring(1, resultData.length() - 1);
}
return JSON.parseObject(resultData, GeneralBillVO_4IDto.class);
}
} catch (Exception e) {
e.printStackTrace();
logger.error("解析返回参数失败的错误", e);
//如果解析失败记录原因但是不能影响结果的记录
}
return null;
}
} }

View File

@ -12,24 +12,31 @@ import org.springframework.test.context.junit4.SpringRunner;
public class BaseTest { public class BaseTest {
@Autowired @Autowired
private GoodsPluginInitializer goodsPluginInitializer; private SKUPluginInitializer skuPluginInitializer;
@Autowired @Autowired
private GoodsClassPluginInitializer goodsClassPluginInitializer; private SKUClassPluginInitializer skuClassPluginInitializer;
@Autowired @Autowired
private GoodsAutoAllotPluginInitializer goodsAutoAllotPluginInitializer; private GoodsAutoAllotPluginInitializer goodsAutoAllotPluginInitializer;
////////////////////////////////////////////////////////////////////////////////////SKU
@Test @Test
public void t00(){ public void t00(){
goodsClassPluginInitializer.start("666"); skuPluginInitializer.start();
} }
////////////////////////////////////////////////////////////////////////////////////SKU自动分配
@Test @Test
public void t01(){ public void t10(){
goodsAutoAllotPluginInitializer.start("0001A210000000000U4C"); goodsAutoAllotPluginInitializer.start("0001A210000000000U4C");
} }
////////////////////////////////////////////////////////////////////////////////////SKU分类
@Test @Test
public void t02(){ public void t20(){
goodsPluginInitializer.start(); skuClassPluginInitializer.start();
} }
@Test
public void t21(){
skuClassPluginInitializer.start("2024-08-15","2024-08-16");
}
} }

View File

@ -82,11 +82,11 @@ public class TransferTest {
} }
@Test @Test
public void t41(){ public void t41(){
adjustOutPluginInitializer.start("LETS-AH2024081300000003"); adjustOutPluginInitializer.start("LETS-SH2024080900000001");
} }
@Test @Test
public void t42(){ public void t42(){
adjustOutPluginInitializer.start("2024-08-14","2024-08-14"); adjustOutPluginInitializer.start("2024-08-08","2024-08-13");
} }
} }