丽知:1、新增OFS调整入库(无源件入库)--->U8C红字其它出库
This commit is contained in:
parent
b4da792282
commit
c560fc9940
|
@ -0,0 +1,564 @@
|
||||||
|
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.ofsvo.QueryOfsAdjustOrderRequestVO;
|
||||||
|
import com.hzya.frame.plugin.lets.ofsvo.QueryOfsSoSaleOutVo;
|
||||||
|
import com.hzya.frame.plugin.lets.ofsvo.QueryOfsStockinOrderRequestVO;
|
||||||
|
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.ReusltStrDto;
|
||||||
|
import com.hzya.frame.plugin.lets.util.OfsStandardUtil;
|
||||||
|
import com.hzya.frame.plugin.lets.util.PushDataByU8cUtil;
|
||||||
|
import com.hzya.frame.plugin.lets.util.QueryU8CEntityUtil;
|
||||||
|
import com.hzya.frame.plugin.lets.util.SaveOrUpdateBusinessLogUtil;
|
||||||
|
import com.hzya.frame.plugin.lets.util.pushData.Attribute;
|
||||||
|
import com.hzya.frame.plugin.lets.util.pushData.PushU8CByApiCode;
|
||||||
|
import com.hzya.frame.plugin.lets.util.pushData.ZTResult;
|
||||||
|
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.ofsTransferOrderSearch.OFSAdjustOrderSearchResponse;
|
||||||
|
import com.hzya.frame.ttxofs.dto.passivestorage.PassiveStorageResponse;
|
||||||
|
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.BaseResult;
|
||||||
|
import com.hzya.frame.web.entity.JsonResultEntity;
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
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红字其它出库
|
||||||
|
* 接收(U8_RECEIPT_TYPE):无源件入库
|
||||||
|
* U8入库类型(U8_RECEIPT_TYPE)
|
||||||
|
* U8_RECEIPT_TYPE 0107 无源件入库
|
||||||
|
* <p>
|
||||||
|
* 1、调整单备注字段 对应无源入库单
|
||||||
|
* 2、根据无源入库单查询是否有售后单号,有售后单号则过滤。
|
||||||
|
*/
|
||||||
|
|
||||||
|
public class AdjustInWYJPluginInitializer extends PluginBaseEntity {
|
||||||
|
Logger logger = LoggerFactory.getLogger(AdjustInWYJPluginInitializer.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 "adjust.AdjustInPluginInitializer";
|
||||||
|
}
|
||||||
|
|
||||||
|
@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 PushU8CByApiCode pushU8CByApiCode;
|
||||||
|
@Autowired
|
||||||
|
private SaveOrUpdateBusinessLogUtil saveOrUpdateBusinessLogUtil;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private OfsUnifiedService ofsUnifiedService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private IBdRdclDao iBdRdclDao;
|
||||||
|
@Autowired
|
||||||
|
private QueryU8CEntityUtil queryU8CEntityUtil;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
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 BaseResult.getSuccessMessageEntity("插件执行成功");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 默认推送
|
||||||
|
*/
|
||||||
|
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.setClosedAt_start(startTimeStr);
|
||||||
|
queryOfsStockinOrderRequestVO.setClosedAt_end(endTimeStr);
|
||||||
|
List<StockinOrderSearchResponse.StockinOrder> stockinOrders = queryOfsStockinOrder(queryOfsStockinOrderRequestVO);
|
||||||
|
|
||||||
|
if (stockinOrders == null || stockinOrders.size() == 0) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
//过滤类型,tmdofs调整单类型在调整单藏着,不在调整入库单直接展示
|
||||||
|
List<StockinOrderSearchResponse.StockinOrder> filterTypeOrders = filterTypeAndReturn(stockinOrders);
|
||||||
|
if (filterTypeOrders == null || filterTypeOrders.size() == 0) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
//过滤日志
|
||||||
|
List<StockinOrderSearchResponse.StockinOrder> filterStockinOrders = filterData(filterTypeOrders);
|
||||||
|
if (filterStockinOrders.size() == 0) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
//推送
|
||||||
|
implement(filterStockinOrders);
|
||||||
|
|
||||||
|
|
||||||
|
} catch (Exception e) {
|
||||||
|
logger.error("丽知:OFS调整入库(无源件入库)--->U8C红字其它出库,start()方法报错:", e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 按单号
|
||||||
|
*/
|
||||||
|
public void start(String stockinNo) {
|
||||||
|
try {
|
||||||
|
|
||||||
|
QueryOfsStockinOrderRequestVO queryOfsStockinOrderRequestVO = new QueryOfsStockinOrderRequestVO();
|
||||||
|
queryOfsStockinOrderRequestVO.setCode(stockinNo);
|
||||||
|
List<StockinOrderSearchResponse.StockinOrder> stockinOrders = queryOfsStockinOrder(queryOfsStockinOrderRequestVO);
|
||||||
|
if (stockinOrders.size() == 0) {
|
||||||
|
Assert.state(false, "丽知:OFS调整入库(无源件入库)--->U8C红字其它出库:{},未查询到调整出库单", stockinNo);
|
||||||
|
}
|
||||||
|
|
||||||
|
//过滤类型,tmdofs调整单类型在调整单藏着,不在调整入库单直接展示
|
||||||
|
List<StockinOrderSearchResponse.StockinOrder> filterTypeOrders = filterTypeAndReturn(stockinOrders);
|
||||||
|
if (filterTypeOrders == null || filterTypeOrders.size() == 0) {
|
||||||
|
Assert.state(false, "丽知:OFS调整入库(无源件入库)--->U8C红字其它出库:{},入库单类型不是[无源件入库]或存在售后单号被过滤", stockinNo);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//过滤日志
|
||||||
|
List<StockinOrderSearchResponse.StockinOrder> filterStockinOrders = filterData(filterTypeOrders);
|
||||||
|
if (filterStockinOrders.size() == 0) {
|
||||||
|
Assert.state(false, "丽知:OFS调整入库(无源件入库)--->U8C红字其它出库:{},该调整出库单已被推送成功,请勿重新推送", stockinNo);
|
||||||
|
}
|
||||||
|
|
||||||
|
//推送
|
||||||
|
implement(filterStockinOrders);
|
||||||
|
|
||||||
|
} 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";
|
||||||
|
|
||||||
|
QueryOfsStockinOrderRequestVO queryOfsStockinOrderRequestVO = new QueryOfsStockinOrderRequestVO();
|
||||||
|
queryOfsStockinOrderRequestVO.setClosedAt_start(start);
|
||||||
|
queryOfsStockinOrderRequestVO.setClosedAt_end(end);
|
||||||
|
List<StockinOrderSearchResponse.StockinOrder> stockinOrders = queryOfsStockinOrder(queryOfsStockinOrderRequestVO);
|
||||||
|
|
||||||
|
if (stockinOrders.size() == 0) {
|
||||||
|
Assert.state(false, "丽知:OFS调整入库(无源件入库)--->U8C红字其它出库根据日期期间[开始时间]-[结束时间]:{}-{},未查询到调整入库单[入库完成]", startTime, endTime);
|
||||||
|
}
|
||||||
|
|
||||||
|
//过滤类型,tmdofs调整单类型在调整单藏着,不在调整入库单直接展示
|
||||||
|
List<StockinOrderSearchResponse.StockinOrder> filterTypeOrders = filterTypeAndReturn(stockinOrders);
|
||||||
|
if (filterTypeOrders == null || filterTypeOrders.size() == 0) {
|
||||||
|
Assert.state(false, "丽知:OFS调整入库(无源件入库)--->U8C红字其它出库根据日期期间[开始时间]-[结束时间]:{}-{},该调期间整入库单[入库完成],未查询到无源件入库类型", startTime, endTime);
|
||||||
|
}
|
||||||
|
|
||||||
|
//过滤日志
|
||||||
|
List<StockinOrderSearchResponse.StockinOrder> filterStockinOrders = filterData(filterTypeOrders);
|
||||||
|
if (filterStockinOrders.size() == 0) {
|
||||||
|
Assert.state(false, "丽知:OFS调整入库(无源件入库)--->U8C红字其它出库根据日期期间[开始时间]-[结束时间]:{}-{},该调期间整入库单[入库完成]已被推送成功,请勿重新推送", startTime, endTime);
|
||||||
|
}
|
||||||
|
|
||||||
|
//推送
|
||||||
|
implement(filterStockinOrders);
|
||||||
|
|
||||||
|
|
||||||
|
} catch (Exception e) {
|
||||||
|
logger.error("丽知:OFS调整入库(无源件入库)--->U8C红字其它出库,start(String startTime, String endTime)方法报错:", e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询调整单单据类型只接收无源 0107 无源件入库
|
||||||
|
*/
|
||||||
|
private List<StockinOrderSearchResponse.StockinOrder> filterTypeAndReturn(List<StockinOrderSearchResponse.StockinOrder> stockinOrders) throws Exception {
|
||||||
|
List<StockinOrderSearchResponse.StockinOrder> filterTypes = new ArrayList<>();
|
||||||
|
for (StockinOrderSearchResponse.StockinOrder stockinOrder : stockinOrders) {
|
||||||
|
StockinOrderSearchResponse.StockinOrder.StockinH ofsHeader = stockinOrder.getHeader();
|
||||||
|
try {
|
||||||
|
List<OFSAdjustOrderSearchResponse.OFSAdjustOrder> ofsAdjustOrders = queryOfsAdjustOrders(ofsHeader.getRefOrderCode());
|
||||||
|
if (ofsAdjustOrders.size() != 1) {
|
||||||
|
Assert.state(false, "根据调整入库单号:{},查询调整单:{},失败。不存在或不唯一。", ofsHeader.getCode(), ofsHeader.getRefOrderCode());
|
||||||
|
}
|
||||||
|
String u8ReceiptType = ofsAdjustOrders.get(0).getHeader().getU8ReceiptType();//调整单类型
|
||||||
|
String remark = ofsAdjustOrders.get(0).getHeader().getRemark();
|
||||||
|
System.out.println(remark);
|
||||||
|
List<PassiveStorageResponse.Data> datas = queryOfsNoSourceStockinOrder(remark);
|
||||||
|
//没查到无源入库单存到错误中
|
||||||
|
if (datas == null) {
|
||||||
|
Assert.state(false, "根据调整单备注:{},未查询到无源入库单。", remark);
|
||||||
|
}
|
||||||
|
if (datas.size() != 1) {
|
||||||
|
Assert.state(false, "根据调整单备注:{},查询到无源入库单不唯一。", remark);
|
||||||
|
|
||||||
|
}
|
||||||
|
if (datas.get(0).getHeader().getReturnOrderCode() != null) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ("0107".equals(u8ReceiptType)) {
|
||||||
|
filterTypes.add(stockinOrder);
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
String ErrMessage = e.getMessage();
|
||||||
|
//失败
|
||||||
|
IntegrationTaskLivingDetailsEntity integrationTaskLivingDetailsEntity = new IntegrationTaskLivingDetailsEntity();
|
||||||
|
integrationTaskLivingDetailsEntity.setNewState(ProfilesActiveConstant.LOG_STATUS_N);
|
||||||
|
integrationTaskLivingDetailsEntity.setRootAppNewData("调整单:" + ofsHeader.getCode());
|
||||||
|
integrationTaskLivingDetailsEntity.setNewTransmitInfo(ErrMessage);
|
||||||
|
integrationTaskLivingDetailsEntity.setNewPushDate(new Date());
|
||||||
|
integrationTaskLivingDetailsEntity.setBusinessDate(ofsHeader.getClosedAt());
|
||||||
|
integrationTaskLivingDetailsEntity.setRootAppPk(ofsHeader.getCode());
|
||||||
|
integrationTaskLivingDetailsEntity.setRootAppBill(ofsHeader.getId());
|
||||||
|
integrationTaskLivingDetailsEntity.setPluginId(getPluginId());
|
||||||
|
saveOrUpdateBusinessLogUtil.saveOrUpdate(integrationTaskLivingDetailsEntity);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return filterTypes;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 过滤成功日志
|
||||||
|
* 过滤"NMNS"\"YNS"\"HJ"
|
||||||
|
*/
|
||||||
|
public List<StockinOrderSearchResponse.StockinOrder> filterData(List<StockinOrderSearchResponse.StockinOrder> stockinOrders) {
|
||||||
|
List<StockinOrderSearchResponse.StockinOrder> filterStockinOrders = new ArrayList<>();
|
||||||
|
for (StockinOrderSearchResponse.StockinOrder stockinOrder : stockinOrders) {
|
||||||
|
StockinOrderSearchResponse.StockinOrder.StockinH header = stockinOrder.getHeader();
|
||||||
|
String filterCompanyStr = queryU8CEntityUtil.queryBdDefDocByListPk();
|
||||||
|
if (filterCompanyStr.contains(header.getCompanyCode().trim())) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
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) {
|
||||||
|
filterStockinOrders.add(stockinOrder);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return filterStockinOrders;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 推送u8c红丝其他出库单 固收发类别固定0107
|
||||||
|
*/
|
||||||
|
public void implement(List<StockinOrderSearchResponse.StockinOrder> filterStockinOrders) {
|
||||||
|
for (StockinOrderSearchResponse.StockinOrder StockinOrder : filterStockinOrders) {
|
||||||
|
String mapStr = "";
|
||||||
|
String create = "";
|
||||||
|
String modify = "";
|
||||||
|
String response = "";
|
||||||
|
String ofsCode = "";
|
||||||
|
String ofsId = "";
|
||||||
|
try {
|
||||||
|
StockinOrderSearchResponse.StockinOrder.StockinH ofsHeader = StockinOrder.getHeader();
|
||||||
|
//其他出库单
|
||||||
|
GeneralBillVO_4IDto generalBillVO_4I = new GeneralBillVO_4IDto();
|
||||||
|
//主表
|
||||||
|
GeneralBillVO_4IDto.Parentvo parentvo = new GeneralBillVO_4IDto.Parentvo();
|
||||||
|
//ofs订单号,自定义项19
|
||||||
|
ofsId = ofsHeader.getId();
|
||||||
|
ofsCode = ofsHeader.getCode();
|
||||||
|
parentvo.setVuserdef19(ofsCode);
|
||||||
|
|
||||||
|
//pk_corp--公司
|
||||||
|
String corpCode = queryU8CEntityUtil.queryBdDefDocByPkDefDocList(ofsHeader.getCompanyCode());
|
||||||
|
parentvo.setPk_corp(corpCode);
|
||||||
|
//pk_calbody--库存组织PK
|
||||||
|
parentvo.setPk_calbody(corpCode);
|
||||||
|
//cwarehouseid--仓库
|
||||||
|
parentvo.setCwarehouseid(ofsHeader.getFacilityCode());
|
||||||
|
//vnote--备注
|
||||||
|
parentvo.setVnote(ofsHeader.getNote());
|
||||||
|
//dbilldate--单据日期--oms入库时间
|
||||||
|
create = ofsHeader.getCreated();
|
||||||
|
modify = ofsHeader.getLastUpdated();
|
||||||
|
parentvo.setDbilldate(StringUtils.substring(modify, 0, 10));
|
||||||
|
//coperatorid--制单人
|
||||||
|
parentvo.setCoperatorid("tbadmin");
|
||||||
|
//审核时间dauditdate
|
||||||
|
parentvo.setDauditdate(StringUtils.substring(modify, 0, 10));
|
||||||
|
//cdispatcherid--收发类别
|
||||||
|
parentvo.setCdispatcherid("0107");
|
||||||
|
|
||||||
|
//子表
|
||||||
|
List<GeneralBillVO_4IDto.Childrenvo> childrenvo = new ArrayList<>();
|
||||||
|
for (StockinOrderSearchResponse.StockinOrder.StockinB ofsDetail : StockinOrder.getDetails()) {
|
||||||
|
GeneralBillVO_4IDto.Childrenvo children = new GeneralBillVO_4IDto.Childrenvo();
|
||||||
|
//dbizdate业务日期
|
||||||
|
children.setDbizdate(modify);
|
||||||
|
//存货档案id
|
||||||
|
children.setCinventoryid(ofsDetail.getSkuCode());
|
||||||
|
//nshouldinnum--应出数量
|
||||||
|
children.setNshouldoutnum(String.valueOf(ofsDetail.getRequestQty()));
|
||||||
|
//nintnum--实入数量,20241106妮妮姐私聊:可以改成实收是0你就不传这条明细 明细里就不传这个
|
||||||
|
if (ofsDetail.getReceivedQty() == null || "0".equals(ofsDetail.getReceivedQty())) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
children.setNoutnum(String.valueOf(ofsDetail.getReceivedQty()));
|
||||||
|
childrenvo.add(children);
|
||||||
|
}
|
||||||
|
generalBillVO_4I.setParentvo(parentvo);
|
||||||
|
generalBillVO_4I.setChildrenvo(childrenvo);
|
||||||
|
String dataJson = JSONUtil.toJsonStr(generalBillVO_4I);
|
||||||
|
mapStr = "{\"GeneralBillVO_4I\":[" + dataJson + "]}";
|
||||||
|
ZTResult ztResult = pushU8CByApiCode.pushByCode(OverallConstant.getOverAllValue("otheroutqzCode"), mapStr);
|
||||||
|
//两层判断,一层中台转发,一层u8c返回
|
||||||
|
if ("false".equals(ztResult.getFlag())) {
|
||||||
|
//转发失败
|
||||||
|
response = JSONUtil.toJsonStr(ztResult.getAttribute());
|
||||||
|
Assert.state(false, "丽知:OFS调整入库(无源件入库)--->U8C红字其它出库.中台转发失败,失败原因:{}", ztResult.getAttribute());
|
||||||
|
}
|
||||||
|
Attribute attribute = ztResult.getAttribute();
|
||||||
|
|
||||||
|
boolean isSuccess = false;
|
||||||
|
String vbillcode = "";
|
||||||
|
String vbillId = "";
|
||||||
|
if ("success".equals(attribute.getStatus())) {
|
||||||
|
isSuccess = true;
|
||||||
|
String data = attribute.getData();
|
||||||
|
GeneralBillVO_4IDto resGeneralBillVO = resultDataHandle(data);
|
||||||
|
vbillcode = resGeneralBillVO.getParentvo().getVbillcode();
|
||||||
|
vbillId = resGeneralBillVO.getParentvo().getCgeneralhid();
|
||||||
|
}
|
||||||
|
if (!isSuccess) {
|
||||||
|
Assert.state(false, "丽知:OFS调整入库(无源件入库)--->U8C红字其它出库 失败 接口返回结果:{} 接口入参:{}", attribute.getErrormsg(), mapStr);
|
||||||
|
}
|
||||||
|
//成功
|
||||||
|
IntegrationTaskLivingDetailsEntity integrationTaskLivingDetailsEntity = new IntegrationTaskLivingDetailsEntity();
|
||||||
|
integrationTaskLivingDetailsEntity.setNewState(ProfilesActiveConstant.LOG_STATUS_Y);
|
||||||
|
integrationTaskLivingDetailsEntity.setRootAppNewData(mapStr);
|
||||||
|
integrationTaskLivingDetailsEntity.setNewTransmitInfo(attribute.getData());
|
||||||
|
integrationTaskLivingDetailsEntity.setNewPushDate(new Date());
|
||||||
|
integrationTaskLivingDetailsEntity.setBusinessDate(modify);
|
||||||
|
integrationTaskLivingDetailsEntity.setRootAppPk(ofsCode);
|
||||||
|
integrationTaskLivingDetailsEntity.setRootAppBill(ofsCode);
|
||||||
|
integrationTaskLivingDetailsEntity.setNewSystemNumber(corpCode + "_" + vbillcode);//u8c其他出库单号
|
||||||
|
integrationTaskLivingDetailsEntity.setNewSystemPrimary(vbillId);//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 = "";
|
||||||
|
|
||||||
|
if (reusltStrDto != null) {
|
||||||
|
ErrMessage = reusltStrDto.getErrormsg();
|
||||||
|
} else {
|
||||||
|
ErrMessage = e.getMessage();
|
||||||
|
}
|
||||||
|
|
||||||
|
//失败
|
||||||
|
IntegrationTaskLivingDetailsEntity integrationTaskLivingDetailsEntity = new IntegrationTaskLivingDetailsEntity();
|
||||||
|
integrationTaskLivingDetailsEntity.setNewState(ProfilesActiveConstant.LOG_STATUS_N);
|
||||||
|
integrationTaskLivingDetailsEntity.setRootAppNewData(mapStr);
|
||||||
|
integrationTaskLivingDetailsEntity.setNewTransmitInfo(ErrMessage);
|
||||||
|
integrationTaskLivingDetailsEntity.setNewPushDate(new Date());
|
||||||
|
integrationTaskLivingDetailsEntity.setBusinessDate(modify);
|
||||||
|
integrationTaskLivingDetailsEntity.setRootAppPk(ofsCode);
|
||||||
|
integrationTaskLivingDetailsEntity.setRootAppBill(ofsCode);
|
||||||
|
integrationTaskLivingDetailsEntity.setPluginId(getPluginId());
|
||||||
|
saveOrUpdateBusinessLogUtil.saveOrUpdate(integrationTaskLivingDetailsEntity);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public List<StockinOrderSearchResponse.StockinOrder> queryOfsStockinOrder(QueryOfsStockinOrderRequestVO queryOfsStockinOrderRequestVO) throws Exception {
|
||||||
|
Long pageNo = 1L;
|
||||||
|
List<StockinOrderSearchResponse.StockinOrder> all = new ArrayList<>();
|
||||||
|
|
||||||
|
|
||||||
|
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");
|
||||||
|
queryOfsStockinOrderRequestVO.setStatus("900");//状态 500待同步 510已同步 700收货中 900入库完成 911作废 100订单池 200暂挂 400待合单 410待出库单出库
|
||||||
|
queryOfsStockinOrderRequestVO.setPageNo(pageNo);
|
||||||
|
queryOfsStockinOrderRequestVO.setPageSize(500L);
|
||||||
|
interfaceParamDto.setData(JSON.toJSONString(queryOfsStockinOrderRequestVO));
|
||||||
|
StockinOrderSearchResponse stockinOrderSearchResponse = (StockinOrderSearchResponse) ofsUnifiedService.unified(interfaceParamDto);
|
||||||
|
if (stockinOrderSearchResponse.getData() == null || stockinOrderSearchResponse.getData().size() == 0) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
all.addAll(stockinOrderSearchResponse.getData());
|
||||||
|
int count = stockinOrderSearchResponse.getData().size();
|
||||||
|
while (count >= 500) {//>=500,可能还有下一页。
|
||||||
|
//还有下一页
|
||||||
|
pageNo++;
|
||||||
|
queryOfsStockinOrderRequestVO.setPageNo(pageNo);
|
||||||
|
interfaceParamDto.setData(JSON.toJSONString(queryOfsStockinOrderRequestVO));
|
||||||
|
StockinOrderSearchResponse stockinOrderSearchResponse1 = (StockinOrderSearchResponse) ofsUnifiedService.unified(interfaceParamDto);
|
||||||
|
|
||||||
|
all.addAll(stockinOrderSearchResponse1.getData());
|
||||||
|
|
||||||
|
count = stockinOrderSearchResponse1.getData().size();
|
||||||
|
}
|
||||||
|
return all;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ofs调整单查询
|
||||||
|
* ofs.adjustOrder.search
|
||||||
|
*/
|
||||||
|
public List<OFSAdjustOrderSearchResponse.OFSAdjustOrder> queryOfsAdjustOrders(String ofsAdjustCode) throws Exception {
|
||||||
|
QueryOfsAdjustOrderRequestVO queryOfsAdjustOrderRequestVO = new QueryOfsAdjustOrderRequestVO();
|
||||||
|
queryOfsAdjustOrderRequestVO.setClientCode("LETS");
|
||||||
|
queryOfsAdjustOrderRequestVO.setCode(ofsAdjustCode);
|
||||||
|
queryOfsAdjustOrderRequestVO.setPageNo(1L);
|
||||||
|
queryOfsAdjustOrderRequestVO.setPageSize(500L);
|
||||||
|
|
||||||
|
InterfaceParamDto interfaceParamDto = new InterfaceParamDto();
|
||||||
|
interfaceParamDto.setApi("ofs.adjustOrder.search");
|
||||||
|
interfaceParamDto.setData(JSON.toJSONString(queryOfsAdjustOrderRequestVO));
|
||||||
|
OFSAdjustOrderSearchResponse ofsAdjustOrderSearchResponse = (OFSAdjustOrderSearchResponse) ofsUnifiedService.unified(interfaceParamDto);
|
||||||
|
List<OFSAdjustOrderSearchResponse.OFSAdjustOrder> data = ofsAdjustOrderSearchResponse.getData();
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private OfsStandardUtil ofsStandardUtil;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ofs无源入库单查询
|
||||||
|
*/
|
||||||
|
public List<PassiveStorageResponse.Data> queryOfsNoSourceStockinOrder(String remark) throws Exception {
|
||||||
|
QueryOfsSoSaleOutVo queryOfsSoSaleOutVo = new QueryOfsSoSaleOutVo();
|
||||||
|
queryOfsSoSaleOutVo.setReceiptCode(remark);
|
||||||
|
queryOfsSoSaleOutVo.setClientCode("LETS");
|
||||||
|
queryOfsSoSaleOutVo.setPageNo(1L);
|
||||||
|
queryOfsSoSaleOutVo.setPageSize(50L);
|
||||||
|
InterfaceParamDto interfaceParamDto = new InterfaceParamDto();
|
||||||
|
interfaceParamDto.setApi("ofs.passive.order.search");
|
||||||
|
interfaceParamDto.setData(JSON.toJSONString(queryOfsSoSaleOutVo));
|
||||||
|
PassiveStorageResponse res = (PassiveStorageResponse) ofsUnifiedService.unified(interfaceParamDto);
|
||||||
|
if (res.getData() == null || res.getData().size() == 0) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
List<PassiveStorageResponse.Data> data = res.getData();
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
}
|
|
@ -54,4 +54,7 @@
|
||||||
|
|
||||||
<!-- 无源入库单(TOB) -> 推送U8C 红字销售订单、红字销售发票 -->
|
<!-- 无源入库单(TOB) -> 推送U8C 红字销售订单、红字销售发票 -->
|
||||||
<bean name="passiveWarehouseReceiptToB" class="com.hzya.frame.plugin.lets.plugin.sales.PassiveWarehouseReceiptToB"/>
|
<bean name="passiveWarehouseReceiptToB" class="com.hzya.frame.plugin.lets.plugin.sales.PassiveWarehouseReceiptToB"/>
|
||||||
|
|
||||||
|
<!-- ofs调整单(无源件入库)-> U8C 红字其他出库-->
|
||||||
|
<bean name="adjustInWYJPluginInitializer" class="com.hzya.frame.plugin.lets.plugin.adjust.AdjustInWYJPluginInitializer"/>
|
||||||
</beans>
|
</beans>
|
||||||
|
|
|
@ -171,7 +171,7 @@ public class TransferTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void t90(){
|
public void t90(){
|
||||||
refundOnlyPluginInitializerToC.start("LETS-RO2025011100008183");
|
refundOnlyPluginInitializerToC.start("LETS-RO2025042100005959");
|
||||||
}
|
}
|
||||||
@Test
|
@Test
|
||||||
public void t91(){
|
public void t91(){
|
||||||
|
@ -189,4 +189,19 @@ public class TransferTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////////dingtalk
|
////////////////////////////////////////////////////////////////////////////////////dingtalk
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////////////////调整入库单(无源件)
|
||||||
|
@Autowired
|
||||||
|
private AdjustInWYJPluginInitializer adjustInWYJPluginInitializer;
|
||||||
|
@Test
|
||||||
|
public void t1200(){
|
||||||
|
adjustInWYJPluginInitializer.start("LETS-RE2025040200003009");//无售后
|
||||||
|
// adjustInWYJPluginInitializer.start("LETS-RE2025042100001235");//有售后
|
||||||
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////////////////调整入库单(无源件)
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue