test(outsourc): 添加委外加工类型采购入库单接口测试

- 在 ConsignmachiningCinfurmIn.java 和 ConsignmachiningIn.java 中添加测试注释
- 确认 O正式环境单据拉取和推送至 U8C 系统的字段完整性
- 与业务方通过电话和微信确认单据信息无误
This commit is contained in:
liuy 2025-03-11 17:15:07 +08:00
parent 5937b648b7
commit a8f79105d1
11 changed files with 1305 additions and 146 deletions

View File

@ -23,8 +23,6 @@ import com.hzya.frame.ttxofs.dto.ofsReceiptConfirmSearch.OFSReceiptConfirmSearch
import com.hzya.frame.ttxofs.dto.ofspoorder.OfsPoOrderData; import com.hzya.frame.ttxofs.dto.ofspoorder.OfsPoOrderData;
import com.hzya.frame.ttxofs.dto.ofspoorder.OfsPoOrderDetails; import com.hzya.frame.ttxofs.dto.ofspoorder.OfsPoOrderDetails;
import com.hzya.frame.ttxofs.dto.ofspoorder.OfsPoOrderHeader; import com.hzya.frame.ttxofs.dto.ofspoorder.OfsPoOrderHeader;
import com.hzya.frame.ttxofs.dto.ofswareconfirma.OfsWareConfirmaDetails;
import com.hzya.frame.ttxofs.dto.ofswareconfirma.OfsWareConfirmaHeader;
import com.hzya.frame.ttxofs.dto.stock.StockinOrderSearchResponse; import com.hzya.frame.ttxofs.dto.stock.StockinOrderSearchResponse;
import com.hzya.frame.web.entity.BaseResult; import com.hzya.frame.web.entity.BaseResult;
import com.hzya.frame.web.entity.JsonResultEntity; import com.hzya.frame.web.entity.JsonResultEntity;
@ -40,6 +38,9 @@ import java.util.stream.Collectors;
/** /**
* O采购入库确认单(委外加工类型)->U8C委外入库单(存在多笔的情况) * O采购入库确认单(委外加工类型)->U8C委外入库单(存在多笔的情况)
* <p>
* 2025 3 11 15:57:47
* 接入 O 正式环境拉取 O 单据我已经和妮姐电话+微信文字确认推送到 U8C 的委外入库单红蓝字没有少字段的的情况U8C 单据符合委外业务要求
* *
* @Authorliuyang * @Authorliuyang
* @Packagecom.hzya.frame.plugin.lets.plugin.outsourc * @Packagecom.hzya.frame.plugin.lets.plugin.outsourc

View File

@ -39,6 +39,8 @@ import java.util.stream.Collectors;
/** /**
* O采购入库单(委外加工类型)->U8C委外订单 * O采购入库单(委外加工类型)->U8C委外订单
* 2025 3 11 15:59:19
* 拉去 O 正式环境的采购入库单测试已经和妮姐通过电话+微信文字确认推送到 U8C 的委外订单没有出现字段少传的情况符合委外业务要求
* *
* @Authorliuyang * @Authorliuyang
* @Packagecom.hzya.frame.plugin.lets.plugin.outsourc * @Packagecom.hzya.frame.plugin.lets.plugin.outsourc

View File

@ -18,14 +18,9 @@ import com.hzya.frame.plugin.lets.u8cdto.*;
import com.hzya.frame.plugin.lets.util.*; import com.hzya.frame.plugin.lets.util.*;
import com.hzya.frame.split.SplitListByCountUtil; import com.hzya.frame.split.SplitListByCountUtil;
import com.hzya.frame.sysnew.integtationTaskLivingDetails.entity.IntegrationTaskLivingDetailsEntity; import com.hzya.frame.sysnew.integtationTaskLivingDetails.entity.IntegrationTaskLivingDetailsEntity;
import com.hzya.frame.ttxofs.dto.InterfaceParamDto;
import com.hzya.frame.ttxofs.dto.ofspoorder.OfsPoOrderBean;
import com.hzya.frame.ttxofs.dto.ofspoorder.OfsPoOrderData; import com.hzya.frame.ttxofs.dto.ofspoorder.OfsPoOrderData;
import com.hzya.frame.ttxofs.dto.ofspoorder.OfsPoOrderDetails; import com.hzya.frame.ttxofs.dto.ofspoorder.OfsPoOrderDetails;
import com.hzya.frame.ttxofs.dto.ofspoorder.OfsPoOrderHeader; import com.hzya.frame.ttxofs.dto.ofspoorder.OfsPoOrderHeader;
import com.hzya.frame.ttxofs.dto.ofssaleorderoutsearch.HeaderDetailsDto;
import com.hzya.frame.ttxofs.dto.ofssaleorderoutsearch.HeaderDto;
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.BaseResult; import com.hzya.frame.web.entity.BaseResult;
import com.hzya.frame.web.entity.JsonResultEntity; import com.hzya.frame.web.entity.JsonResultEntity;
@ -40,8 +35,10 @@ import java.util.function.Predicate;
import java.util.stream.Collectors; import java.util.stream.Collectors;
/** /**
* 代理品牌采购业务代理品牌采购OFS采购订单生成U8C采购订单 * 代理成品采购业务代理成品采购OFS采购订单生成U8C采购订单
* 不需要根据业务流程自动生成U8C采购入库单 * <p>
* 2025 3 11 17:10:10
* 和妮姐微信确认推送到 U8C 的采购订单符合要求没有字段漏的
* *
* @Authorliuyang * @Authorliuyang
* @Packagecom.hzya.frame.plugin.lets.plugin.purchase * @Packagecom.hzya.frame.plugin.lets.plugin.purchase
@ -126,12 +123,12 @@ public class ProxyPurchaseWarehousOrder extends PluginBaseEntity {
@Override @Override
public String getPluginName() { public String getPluginName() {
return "OFS采购订单生成U8C采购订单(代理)"; return "OFS采购订单生成U8C采购订单(代理、成品)";
} }
@Override @Override
public String getPluginLabel() { public String getPluginLabel() {
return "OFS采购订单生成U8C采购订单(代理)"; return "OFS采购订单生成U8C采购订单(代理、成品)";
} }
@Override @Override
@ -566,7 +563,7 @@ public class ProxyPurchaseWarehousOrder extends PluginBaseEntity {
if (childrenvo != null) { if (childrenvo != null) {
vordercode = parentvo.getVordercode(); vordercode = parentvo.getVordercode();
} }
logger.info("推送U8C代理采购订单采购U8C采购订单主键{} 采购公司编码:{} 采购公司名称:{} U8C采购订单编码{}", corderid, bdCorpEntity.getUnitcode(), bdCorpEntity.getUnitname(), vordercode); logger.info("推送U8C代理、成品采购订单采购U8C采购订单主键{} 采购公司编码:{} 采购公司名称:{} U8C采购订单编码{}", corderid, bdCorpEntity.getUnitcode(), bdCorpEntity.getUnitname(), vordercode);
// 成功记录日志 // 成功记录日志
IntegrationTaskLivingDetailsEntity integrationTaskLivingDetailsEntity = new IntegrationTaskLivingDetailsEntity(); IntegrationTaskLivingDetailsEntity integrationTaskLivingDetailsEntity = new IntegrationTaskLivingDetailsEntity();
@ -582,7 +579,7 @@ public class ProxyPurchaseWarehousOrder extends PluginBaseEntity {
integrationTaskLivingDetailsEntity.setNewSystemPrimary(corderid);//下游单据主键 integrationTaskLivingDetailsEntity.setNewSystemPrimary(corderid);//下游单据主键
saveOrUpdateBusinessLogUtil.saveOrUpdate(integrationTaskLivingDetailsEntity); saveOrUpdateBusinessLogUtil.saveOrUpdate(integrationTaskLivingDetailsEntity);
} catch (Exception e) { } catch (Exception e) {
logger.error("推送U8C代理采购订单采购失败", e); logger.error("推送U8C代理、成品采购订单采购失败", e);
// 失败记录日志 // 失败记录日志
String message = e.getMessage(); String message = e.getMessage();
@ -778,7 +775,7 @@ public class ProxyPurchaseWarehousOrder extends PluginBaseEntity {
} }
//成功 //成功
} catch (Exception e) { } catch (Exception e) {
logger.error("代理采购入库单档案转换失败", e); logger.error("代理、成品采购入库单档案转换失败", e);
//失败 //失败
} }
} else { } else {
@ -912,7 +909,7 @@ public class ProxyPurchaseWarehousOrder extends PluginBaseEntity {
*/ */
public PoOrderHeadBodyDto sendU8CPoOrder(String param) throws Exception { public PoOrderHeadBodyDto sendU8CPoOrder(String param) throws Exception {
long startLong = System.currentTimeMillis(); long startLong = System.currentTimeMillis();
logger.info("代理采购推送开始,推送参数:" + param + ",U8C_URL:" + OverallConstant.getOverAllValue("u8c_url")); logger.info("代理、成品采购推送开始,推送参数:" + param + ",U8C_URL:" + OverallConstant.getOverAllValue("u8c_url"));
String apiCode = "8000370004"; String apiCode = "8000370004";
String result = HttpRequest.post(OverallConstant.getOverAllValue("u8c_url")).header("appId", OverallConstant.getOverAllValue("appId"))//头信息多个头信息多次调用此方法即可 String result = HttpRequest.post(OverallConstant.getOverAllValue("u8c_url")).header("appId", OverallConstant.getOverAllValue("appId"))//头信息多个头信息多次调用此方法即可
.header("usercode", OverallConstant.getOverAllValue("u8cApiUsercodePK")).header("password", OverallConstant.getOverAllValue("u8cApiPasswordPK")).header("system", OverallConstant.getOverAllValue("u8cApiSystemPK")).header("trantype", OverallConstant.getOverAllValue("u8cApiTrantypePK")).header("apiCode", apiCode)//头信息多个头信息多次调用此方法即可 .header("usercode", OverallConstant.getOverAllValue("u8cApiUsercodePK")).header("password", OverallConstant.getOverAllValue("u8cApiPasswordPK")).header("system", OverallConstant.getOverAllValue("u8cApiSystemPK")).header("trantype", OverallConstant.getOverAllValue("u8cApiTrantypePK")).header("apiCode", apiCode)//头信息多个头信息多次调用此方法即可
@ -921,7 +918,7 @@ public class ProxyPurchaseWarehousOrder extends PluginBaseEntity {
.body(param)//表单内容 .body(param)//表单内容
.timeout(600000)//超时毫秒 .timeout(600000)//超时毫秒
.execute().body(); .execute().body();
logger.info("代理采购推送结束,返回参数:" + result); logger.info("代理、成品采购推送结束,返回参数:" + result);
long endLong = System.currentTimeMillis(); long endLong = System.currentTimeMillis();
logger.info("U8C采购订单接口请求耗时" + (endLong - startLong)); logger.info("U8C采购订单接口请求耗时" + (endLong - startLong));
@ -943,7 +940,7 @@ public class ProxyPurchaseWarehousOrder extends PluginBaseEntity {
} }
} }
if (!isSuccess) { if (!isSuccess) {
Assert.state(false, "代理采购业务推送U8C采购订单失败 接口返回结果:{}", result); Assert.state(false, "代理、成品采购业务推送U8C采购订单失败 接口返回结果:{}", result);
} }
return poOrderHeadBodyDto; return poOrderHeadBodyDto;
} }

View File

@ -18,6 +18,7 @@ import com.hzya.frame.plugin.lets.u8cdto.*;
import com.hzya.frame.plugin.lets.util.*; import com.hzya.frame.plugin.lets.util.*;
import com.hzya.frame.split.SplitListByCountUtil; import com.hzya.frame.split.SplitListByCountUtil;
import com.hzya.frame.sysnew.integtationTaskLivingDetails.entity.IntegrationTaskLivingDetailsEntity; import com.hzya.frame.sysnew.integtationTaskLivingDetails.entity.IntegrationTaskLivingDetailsEntity;
import com.hzya.frame.ttxofs.dto.ofsReceiptConfirmSearch.OFSReceiptConfirmSearchResponse;
import com.hzya.frame.ttxofs.dto.ofspoorder.OfsPoOrderData; import com.hzya.frame.ttxofs.dto.ofspoorder.OfsPoOrderData;
import com.hzya.frame.ttxofs.dto.ofspoorder.OfsPoOrderDetails; import com.hzya.frame.ttxofs.dto.ofspoorder.OfsPoOrderDetails;
import com.hzya.frame.ttxofs.dto.ofspoorder.OfsPoOrderHeader; import com.hzya.frame.ttxofs.dto.ofspoorder.OfsPoOrderHeader;
@ -37,6 +38,12 @@ import java.util.stream.Collectors;
/** /**
* 代理品牌采购业务代理品牌采购OFS采购入库单生成U8C采购入库单(关联原采购订单) * 代理品牌采购业务代理品牌采购OFS采购入库单生成U8C采购入库单(关联原采购订单)
* <p>
* 2025 3 11 14:49:52
* 调整为
* OFS采购入库确认单(成品代理)生成U8C采购入库单(关联原采购订单)
* 2025 3 11 17:11:30
* 和妮姐确认过了推送到 U8C 采购入库单符合业务要求没有字段缺失
* *
* @Authorliuyang * @Authorliuyang
* @Packagecom.hzya.frame.plugin.lets.plugin.purchase * @Packagecom.hzya.frame.plugin.lets.plugin.purchase
@ -127,12 +134,12 @@ public class ProxyPurchaseWarehousWarehouse extends PluginBaseEntity {
@Override @Override
public String getPluginName() { public String getPluginName() {
return "OFS采购入库单生成U8C采购入库单(代理品牌)"; return "OFS采购入库确认单(成品、代理)生成U8C采购入库单(关联原采购订单)";
} }
@Override @Override
public String getPluginLabel() { public String getPluginLabel() {
return "OFS采购入库单生成U8C采购入库单(代理品牌)"; return "OFS采购入库确认单(成品、代理)生成U8C采购入库单(关联原采购订单)";
} }
@Override @Override
@ -207,31 +214,31 @@ public class ProxyPurchaseWarehousWarehouse extends PluginBaseEntity {
*/ */
public void startImplementByTime(String startTime, String endTime) { public void startImplementByTime(String startTime, String endTime) {
long startMillis = System.currentTimeMillis(); long startMillis = System.currentTimeMillis();
String threadNameStrStart = StrUtil.format("开始(代理采购OFS采购入库单生成U8C采购订单 开始时间:{} 结束时间:{}", startTime, endTime); String threadNameStrStart = StrUtil.format("开始(代理、成品采购OFS采购入库单生成U8C采购订单 开始时间:{} 结束时间:{}", startTime, endTime);
logger.info(threadNameStrStart); logger.info(threadNameStrStart);
Thread thread = new Thread(new Runnable() { Thread thread = new Thread(new Runnable() {
@Override @Override
public void run() { public void run() {
try { try {
List<StockinOrderSearchResponse.StockinOrder> returnGoodHeaderDetailsDataDtoArrayList = new ArrayList<>(); List<OFSReceiptConfirmSearchResponse.Order> ofsWareConfirmaDataArrayList = new ArrayList<>();
QueryOfsSoSaleOutVo queryOfsSoSaleOutVo = new QueryOfsSoSaleOutVo(); QueryOfsSoSaleOutVo queryOfsSoSaleOutVo = new QueryOfsSoSaleOutVo();
queryOfsSoSaleOutVo.setClosedAt_start(startTime); queryOfsSoSaleOutVo.setReceivedAt_start(startTime);
queryOfsSoSaleOutVo.setClosedAt_end(endTime); queryOfsSoSaleOutVo.setReceivedAt_end(endTime);
queryOfsSoSaleOutVo.setClientCode("LETS"); queryOfsSoSaleOutVo.setClientCode("LETS");
queryOfsSoSaleOutVo.setPageNo(1L); queryOfsSoSaleOutVo.setPageNo(1L);
queryOfsSoSaleOutVo.setPageSize(50L); queryOfsSoSaleOutVo.setPageSize(50L);
queryOfsSoSaleOutVo.setInternalInstructionType("PURCHASE"); queryOfsSoSaleOutVo.setInternalInstructionType("PURCHASE");
queryOfsSoSaleOutVo.setStatus(900L); queryOfsSoSaleOutVo.setStatus(900L);
ofsStandardUtil.queryOfsReturnGoods(queryOfsSoSaleOutVo, returnGoodHeaderDetailsDataDtoArrayList, 1L, "ofs.receipt.search"); ofsStandardUtil.queryOfsWarehouseConfirOrder(queryOfsSoSaleOutVo, ofsWareConfirmaDataArrayList, 1L, "ofs.receipt.confirm.search");
logger.info("插件:{} O接口返回行数{} 时间段:{} {}", getPluginName(), returnGoodHeaderDetailsDataDtoArrayList.size(), startTime, endTime); logger.info("插件:{} O接口返回行数{} 时间段:{} {}", getPluginName(), ofsWareConfirmaDataArrayList.size(), startTime, endTime);
printOfsDocCode(returnGoodHeaderDetailsDataDtoArrayList, startTime, endTime); printOfsDocCode(ofsWareConfirmaDataArrayList, startTime, endTime);
if (returnGoodHeaderDetailsDataDtoArrayList.size() > 0) { if (ofsWareConfirmaDataArrayList.size() > 0) {
returnGoodHeaderDetailsDataDtoArrayList.removeIf(new Predicate<StockinOrderSearchResponse.StockinOrder>() { ofsWareConfirmaDataArrayList.removeIf(new Predicate<OFSReceiptConfirmSearchResponse.Order>() {
@Override @Override
public boolean test(StockinOrderSearchResponse.StockinOrder headerDetailsDto) { public boolean test(OFSReceiptConfirmSearchResponse.Order headerDetailsDto) {
StockinOrderSearchResponse.StockinOrder.StockinH header = headerDetailsDto.getHeader(); OFSReceiptConfirmSearchResponse.Header header = headerDetailsDto.getHeader();
if (header != null && header.getCompanyCode() != null) { if (header != null && header.getCompanyCode() != null) {
if (ProfilesActiveConstant.FILTER_COMPANY.contains(header.getCompanyCode().trim())) { if (ProfilesActiveConstant.FILTER_COMPANY.contains(header.getCompanyCode().trim())) {
return true; return true;
@ -240,7 +247,7 @@ public class ProxyPurchaseWarehousWarehouse extends PluginBaseEntity {
return false; return false;
} }
}); });
getSet(returnGoodHeaderDetailsDataDtoArrayList); getSet(ofsWareConfirmaDataArrayList);
} else { } else {
logger.info("没有查询到任何数据!不需要同步"); logger.info("没有查询到任何数据!不需要同步");
} }
@ -256,7 +263,7 @@ public class ProxyPurchaseWarehousWarehouse extends PluginBaseEntity {
logger.error("thread.join()异常", e); logger.error("thread.join()异常", e);
} }
long endMillis = System.currentTimeMillis(); long endMillis = System.currentTimeMillis();
String threadNameStrEnd = StrUtil.format("结束(代理采购OFS采购入库单生成U8C采购订单 开始时间:{} 结束时间:{} 耗时:{}", startTime, endTime, (endMillis - startMillis)); String threadNameStrEnd = StrUtil.format("结束(代理、产品采购OFS采购入库单生成U8C采购订单 开始时间:{} 结束时间:{} 耗时:{}", startTime, endTime, (endMillis - startMillis));
logger.info(threadNameStrEnd); logger.info(threadNameStrEnd);
} }
@ -267,28 +274,30 @@ public class ProxyPurchaseWarehousWarehouse extends PluginBaseEntity {
*/ */
public void startImplementByCode(String code) { public void startImplementByCode(String code) {
long startTime = System.currentTimeMillis(); long startTime = System.currentTimeMillis();
String threadNameStrStart = StrUtil.format("(代理品牌采购OFS采购入库单生成U8C采购订单开始 采购入库单号:{}", code); String threadNameStrStart = StrUtil.format("(代理、成品采购OFS采购入库确认单生成U8C采购入库单开始 采购入库确认单号:{}", code);
logger.info(threadNameStrStart); logger.info(threadNameStrStart);
Thread thread = new Thread(new Runnable() { Thread thread = new Thread(new Runnable() {
@Override @Override
public void run() { public void run() {
try { try {
List<StockinOrderSearchResponse.StockinOrder> returnGoodHeaderDetailsDataDtoArrayList = new ArrayList<>(); List<OFSReceiptConfirmSearchResponse.Order> ofsWareConfirmaDataArrayList = new ArrayList<>();
QueryOfsSoSaleOutVo queryOfsSoSaleOutVo = new QueryOfsSoSaleOutVo(); QueryOfsSoSaleOutVo queryOfsSoSaleOutVo = new QueryOfsSoSaleOutVo();
queryOfsSoSaleOutVo.setClientCode("LETS"); queryOfsSoSaleOutVo.setClientCode("LETS");
queryOfsSoSaleOutVo.setPageNo(1L); queryOfsSoSaleOutVo.setPageNo(1L);
queryOfsSoSaleOutVo.setPageSize(50L); queryOfsSoSaleOutVo.setPageSize(50L);
queryOfsSoSaleOutVo.setCode(code);
queryOfsSoSaleOutVo.setInternalInstructionType("PURCHASE"); queryOfsSoSaleOutVo.setInternalInstructionType("PURCHASE");
queryOfsSoSaleOutVo.setStatus(900L); queryOfsSoSaleOutVo.setCode(code);
ofsStandardUtil.queryOfsReturnGoods(queryOfsSoSaleOutVo, returnGoodHeaderDetailsDataDtoArrayList, 1L, "ofs.receipt.search"); // queryOfsSoSaleOutVo.setStatus(900L);
logger.info("数据返回行数:{}", returnGoodHeaderDetailsDataDtoArrayList.size()); ofsStandardUtil.queryOfsWarehouseConfirOrder(queryOfsSoSaleOutVo, ofsWareConfirmaDataArrayList, 1L, "ofs.receipt.confirm.search");
if (returnGoodHeaderDetailsDataDtoArrayList.size() > 0) { logger.info("插件:{} O接口返回行数{} 编码:{}", getPluginName(), ofsWareConfirmaDataArrayList.size(), code);
returnGoodHeaderDetailsDataDtoArrayList.removeIf(new Predicate<StockinOrderSearchResponse.StockinOrder>() { printOfsDocCode(ofsWareConfirmaDataArrayList, code);
if (ofsWareConfirmaDataArrayList.size() > 0) {
ofsWareConfirmaDataArrayList.removeIf(new Predicate<OFSReceiptConfirmSearchResponse.Order>() {
@Override @Override
public boolean test(StockinOrderSearchResponse.StockinOrder headerDetailsDto) { public boolean test(OFSReceiptConfirmSearchResponse.Order headerDetailsDto) {
StockinOrderSearchResponse.StockinOrder.StockinH header = headerDetailsDto.getHeader(); OFSReceiptConfirmSearchResponse.Header header = headerDetailsDto.getHeader();
if (header != null && header.getCompanyCode() != null) { if (header != null && header.getCompanyCode() != null) {
if (ProfilesActiveConstant.FILTER_COMPANY.contains(header.getCompanyCode().trim())) { if (ProfilesActiveConstant.FILTER_COMPANY.contains(header.getCompanyCode().trim())) {
return true; return true;
@ -297,7 +306,7 @@ public class ProxyPurchaseWarehousWarehouse extends PluginBaseEntity {
return false; return false;
} }
}); });
getSet(returnGoodHeaderDetailsDataDtoArrayList); getSet(ofsWareConfirmaDataArrayList);
} else { } else {
logger.info("没有查询到任何数据!不需要同步"); logger.info("没有查询到任何数据!不需要同步");
} }
@ -313,7 +322,7 @@ public class ProxyPurchaseWarehousWarehouse extends PluginBaseEntity {
logger.error("thread.join()异常", e); logger.error("thread.join()异常", e);
} }
long endTime = System.currentTimeMillis(); long endTime = System.currentTimeMillis();
String threadNameStrEnd = StrUtil.format("(代理品牌采购OFS采购入库单生成U8C采购订单结束 采购入库单号:{} 耗时:{}", code, (endTime - startTime)); String threadNameStrEnd = StrUtil.format("(代理、成品采购OFS采购入库确认单生成U8C采购入库单结束 采购入库确认单号:{} 耗时:{}", code, (endTime - startTime));
logger.info(threadNameStrEnd); logger.info(threadNameStrEnd);
} }
@ -352,16 +361,16 @@ public class ProxyPurchaseWarehousWarehouse extends PluginBaseEntity {
/** /**
* 环境预配置 * 环境预配置
* *
* @param returnGoodHeaderDetailsDataDtoArrayList 采购入库 * @param ofsReceiptConfirmSearchResponse 采购入库确认
* @author liuyang * @author liuyang
*/ */
private void getSet(List<StockinOrderSearchResponse.StockinOrder> returnGoodHeaderDetailsDataDtoArrayList) throws Exception { private void getSet(List<OFSReceiptConfirmSearchResponse.Order> ofsReceiptConfirmSearchResponse) throws Exception {
LOCK1.lock(); LOCK1.lock();
try { try {
//过滤成功的数据 //过滤成功的数据
List<StockinOrderSearchResponse.StockinOrder> stockinOrderList = filterData(returnGoodHeaderDetailsDataDtoArrayList); List<OFSReceiptConfirmSearchResponse.Order> orders = filterData(ofsReceiptConfirmSearchResponse);
//执行推送主逻辑 //执行推送主逻辑
implement(stockinOrderList); implement(orders);
} catch (Exception e) { } catch (Exception e) {
logger.error("getSet抛出异常", e); logger.error("getSet抛出异常", e);
} finally { } finally {
@ -374,36 +383,36 @@ public class ProxyPurchaseWarehousWarehouse extends PluginBaseEntity {
* *
* @author liuyang * @author liuyang
*/ */
private List<StockinOrderSearchResponse.StockinOrder> filterData(List<StockinOrderSearchResponse.StockinOrder> returnGoodHeaderDetailsDataDtoArrayList) { private List<OFSReceiptConfirmSearchResponse.Order> filterData(List<OFSReceiptConfirmSearchResponse.Order> returnGoodHeaderDetailsDataDtoArrayList) {
List<StockinOrderSearchResponse.StockinOrder> headerDetailsDtoList1 = new ArrayList<>(); List<OFSReceiptConfirmSearchResponse.Order> headerDetailsDtoList1 = new ArrayList<>();
//查询得到已经成功的日志成功或者已处理 //查询得到已经成功的日志成功或者已处理
List<IntegrationTaskLivingDetailsEntity> successIntegrationTaskLivingDetails = new ArrayList<>(); List<IntegrationTaskLivingDetailsEntity> successIntegrationTaskLivingDetails = new ArrayList<>();
try { try {
if (returnGoodHeaderDetailsDataDtoArrayList != null && returnGoodHeaderDetailsDataDtoArrayList.size() > 0) { if (returnGoodHeaderDetailsDataDtoArrayList != null && returnGoodHeaderDetailsDataDtoArrayList.size() > 0) {
//每100个开始拆分 //每100个开始拆分
List<List<StockinOrderSearchResponse.StockinOrder>> splitListByCount = SplitListByCountUtil.splitListByCount(returnGoodHeaderDetailsDataDtoArrayList, 100); List<List<OFSReceiptConfirmSearchResponse.Order>> lists = SplitListByCountUtil.splitListByCount(returnGoodHeaderDetailsDataDtoArrayList, 100);
for (int i = 0; i < splitListByCount.size(); i++) { for (int i = 0; i < lists.size(); i++) {
List<StockinOrderSearchResponse.StockinOrder> stockinOrderList = splitListByCount.get(i); List<OFSReceiptConfirmSearchResponse.Order> orders = lists.get(i);
String primaryKey = fieldConcaten(stockinOrderList); String primaryKey = fieldConcaten(orders);
List<IntegrationTaskLivingDetailsEntity> integrationTaskLivingDetailsEntities = integrationTaskLivingDetailsUtil.queryIntegrationTaskLivingDetails(primaryKey, getPluginId()); List<IntegrationTaskLivingDetailsEntity> integrationTaskLivingDetailsEntities = integrationTaskLivingDetailsUtil.queryIntegrationTaskLivingDetails(primaryKey, getPluginId());
successIntegrationTaskLivingDetails.addAll(integrationTaskLivingDetailsEntities); successIntegrationTaskLivingDetails.addAll(integrationTaskLivingDetailsEntities);
} }
for (int i = 0; i < returnGoodHeaderDetailsDataDtoArrayList.size(); i++) { for (int i = 0; i < returnGoodHeaderDetailsDataDtoArrayList.size(); i++) {
StockinOrderSearchResponse.StockinOrder stockinOrder = returnGoodHeaderDetailsDataDtoArrayList.get(i); OFSReceiptConfirmSearchResponse.Order order = returnGoodHeaderDetailsDataDtoArrayList.get(i);
StockinOrderSearchResponse.StockinOrder.StockinH header = stockinOrder.getHeader(); OFSReceiptConfirmSearchResponse.Header header = order.getHeader();
List<StockinOrderSearchResponse.StockinOrder.StockinB> details = stockinOrder.getDetails(); List<OFSReceiptConfirmSearchResponse.Detail> details = order.getDetails();
boolean isExi = false; boolean isExi = false;
for (int j = 0; j < successIntegrationTaskLivingDetails.size(); j++) { for (int j = 0; j < successIntegrationTaskLivingDetails.size(); j++) {
IntegrationTaskLivingDetailsEntity integrationTaskLivingDetailsEntity = successIntegrationTaskLivingDetails.get(j); IntegrationTaskLivingDetailsEntity integrationTaskLivingDetailsEntity = successIntegrationTaskLivingDetails.get(j);
if (integrationTaskLivingDetailsEntity.getRootAppPk().equals(header.getId())) { if (integrationTaskLivingDetailsEntity.getRootAppPk() != null && integrationTaskLivingDetailsEntity.getRootAppPk().equals(header.getId())) {
isExi = true; isExi = true;
} }
} }
if (!isExi) { if (!isExi) {
headerDetailsDtoList1.add(stockinOrder); headerDetailsDtoList1.add(order);
} }
} }
} }
@ -415,15 +424,14 @@ public class ProxyPurchaseWarehousWarehouse extends PluginBaseEntity {
/** /**
* 字段拼接 * 字段拼接
*
* @author liuyang
*/ */
private String fieldConcaten(List<StockinOrderSearchResponse.StockinOrder> stockinOrderList) { private String fieldConcaten(List<OFSReceiptConfirmSearchResponse.Order> stockinOrderList) {
if (stockinOrderList != null && stockinOrderList.size() > 0) { if (stockinOrderList != null && stockinOrderList.size() > 0) {
StringBuilder result = new StringBuilder(); StringBuilder result = new StringBuilder();
for (StockinOrderSearchResponse.StockinOrder obj : stockinOrderList) { for (OFSReceiptConfirmSearchResponse.Order obj : stockinOrderList) {
StockinOrderSearchResponse.StockinOrder.StockinH header = obj.getHeader(); OFSReceiptConfirmSearchResponse.Header header = obj.getHeader();
// if (result.length() > 0) {
// result.append(",");
// }
result.append("'").append(header.getId()).append("'").append(","); result.append("'").append(header.getId()).append("'").append(",");
} }
return result.substring(0, result.length() - 1); return result.substring(0, result.length() - 1);
@ -436,11 +444,11 @@ public class ProxyPurchaseWarehousWarehouse extends PluginBaseEntity {
* *
* @author liuyang * @author liuyang
*/ */
private void implement(List<StockinOrderSearchResponse.StockinOrder> returnGoodHeaderDetailsDataDtoList) throws Exception { private void implement(List<OFSReceiptConfirmSearchResponse.Order> orderList) throws Exception {
if (returnGoodHeaderDetailsDataDtoList != null && returnGoodHeaderDetailsDataDtoList.size() > 0) { if (orderList != null && orderList.size() > 0) {
try { try {
// 查询基本档案 // 查询基本档案
List<PoOrderSonDto> poOrderSonDtos = queryBasicArchives(returnGoodHeaderDetailsDataDtoList); List<PoOrderSonDto> poOrderSonDtos = queryBasicArchives(orderList);
// 代理品牌采购业务流程 // 代理品牌采购业务流程
// BdBusitypeEntity bdBusitypeEntity = u8cOperationFlow(); // BdBusitypeEntity bdBusitypeEntity = u8cOperationFlow();
// 查询采购收发类别 // 查询采购收发类别
@ -449,7 +457,7 @@ public class ProxyPurchaseWarehousWarehouse extends PluginBaseEntity {
if (poOrderSonDtos != null && poOrderSonDtos.size() > 0) { if (poOrderSonDtos != null && poOrderSonDtos.size() > 0) {
for (int i = 0; i < poOrderSonDtos.size(); i++) { for (int i = 0; i < poOrderSonDtos.size(); i++) {
PoOrderSonDto poOrderSonDto = poOrderSonDtos.get(i); PoOrderSonDto poOrderSonDto = poOrderSonDtos.get(i);
List<StockinOrderSearchResponse.StockinOrder.StockinB> details = poOrderSonDto.getDetails(); List<OFSReceiptConfirmSearchResponse.Detail> details = poOrderSonDto.getDetails();
String generateBusinessDate = null; String generateBusinessDate = null;
try { try {
@ -502,24 +510,33 @@ public class ProxyPurchaseWarehousWarehouse extends PluginBaseEntity {
List<PurchaseReceiptBodyDto> purchaseReceiptBodyDtos = new ArrayList<>(); List<PurchaseReceiptBodyDto> purchaseReceiptBodyDtos = new ArrayList<>();
for (int j = 0; j < details.size(); j++) { for (int j = 0; j < details.size(); j++) {
StockinOrderSearchResponse.StockinOrder.StockinB stockinB = details.get(j); OFSReceiptConfirmSearchResponse.Detail detail = details.get(j);
//OFS采购订单明细行 //OFS采购订单明细行
OfsPoOrderDetails ofsPoOrderDetail = findOfsPoOrderDetail(ofsPoOrderDataDetails, stockinB); OfsPoOrderDetails ofsPoOrderDetail = findOfsPoOrderDetail(ofsPoOrderDataDetails, detail);
//U8C采购订单明细行 //U8C采购订单明细行
PoOrderBEntity poOrderBEntity = findPoOrderBEntity(stockinB, poOrderBEntityList); PoOrderBEntity poOrderBEntity = findPoOrderBEntity(detail, poOrderBEntityList);
//2024年8月20日 16:02:21 已经和妮姐万万确认采购公司和收货公司目前是一致的暂时不用区分取数逻辑 //2024年8月20日 16:02:21 已经和妮姐万万确认采购公司和收货公司目前是一致的暂时不用区分取数逻辑
BdInvmandocEntity bdInvmandocEntity = queryInventoryMan(stockinB, bdCorpEntity.getPkCorp()); BdInvmandocEntity bdInvmandocEntity = queryInventoryMan(detail, bdCorpEntity.getPkCorp());
String receivedQty = stockinB.getReceivedQty();//实收数量
String discountPrice = ofsPoOrderDetail.getDiscountPrice();//实际进价 //实收数量
String receivedQty = detail.getReceivedQty();
if (receivedQty == null || "".equals(receivedQty)) {
Assert.state(false, "实收数量不能为空!");
}
//实际进价
String discountPrice = ofsPoOrderDetail.getDiscountPrice();
if (discountPrice == null || "".equals(discountPrice)) {
Assert.state(false, "实际进价不能为空!");
}
//含税单价 //含税单价
BigDecimal noriginalcurprice = null; BigDecimal noriginalcurprice = null;
//含税金额=含税单价*数量 //含税金额=含税单价*数量
BigDecimal ntaxmny = null; BigDecimal ntaxmny = null;
try { try {
noriginalcurprice = new BigDecimal(discountPrice); noriginalcurprice = new BigDecimal(discountPrice).setScale(4, BigDecimal.ROUND_HALF_UP);
ntaxmny = noriginalcurprice.multiply(new BigDecimal(receivedQty)).setScale(2, BigDecimal.ROUND_HALF_UP); ntaxmny = noriginalcurprice.multiply(new BigDecimal(receivedQty)).setScale(2, BigDecimal.ROUND_HALF_UP);
} catch (Exception e) { } catch (Exception e) {
logger.error("计算采购入库单原币含税单价失败", e); logger.error("计算采购入库单原币含税单价失败", e);
@ -581,7 +598,7 @@ public class ProxyPurchaseWarehousWarehouse extends PluginBaseEntity {
cgeneralhid = parentvo.getCgeneralhid(); cgeneralhid = parentvo.getCgeneralhid();
vbillcode = parentvo.getVbillcode(); vbillcode = parentvo.getVbillcode();
} }
logger.info("推送U8C代理采购入库单成功U8C采购订单主键{} U8C采购订单编码{}", cgeneralhid, vbillcode); logger.info("推送U8C代理、成品采购入库单成功U8C采购订单主键{} U8C采购订单编码{}", cgeneralhid, vbillcode);
// 成功记录日志 // 成功记录日志
IntegrationTaskLivingDetailsEntity integrationTaskLivingDetailsEntity = new IntegrationTaskLivingDetailsEntity(); IntegrationTaskLivingDetailsEntity integrationTaskLivingDetailsEntity = new IntegrationTaskLivingDetailsEntity();
@ -597,7 +614,7 @@ public class ProxyPurchaseWarehousWarehouse extends PluginBaseEntity {
integrationTaskLivingDetailsEntity.setNewSystemPrimary(cgeneralhid);//下游单据主键 integrationTaskLivingDetailsEntity.setNewSystemPrimary(cgeneralhid);//下游单据主键
saveOrUpdateBusinessLogUtil.saveOrUpdate(integrationTaskLivingDetailsEntity); saveOrUpdateBusinessLogUtil.saveOrUpdate(integrationTaskLivingDetailsEntity);
} catch (Exception e) { } catch (Exception e) {
logger.error("推送U8C代理采购入库单失败", e); logger.error("推送U8C代理、成品采购入库单失败", e);
// 失败记录日志 // 失败记录日志
String message = e.getMessage(); String message = e.getMessage();
@ -628,21 +645,23 @@ public class ProxyPurchaseWarehousWarehouse extends PluginBaseEntity {
/** /**
* 档案转换 * 档案转换
* *
* @param returnGoodHeaderDetailsDataDtoList 查询OFS采购入库确认单
* @author liuyang * @author liuyang
*/ */
private List<PoOrderSonDto> queryBasicArchives(List<StockinOrderSearchResponse.StockinOrder> returnGoodHeaderDetailsDataDtoList) { private List<PoOrderSonDto> queryBasicArchives(List<OFSReceiptConfirmSearchResponse.Order> returnGoodHeaderDetailsDataDtoList) {
List<PoOrderSonDto> poOrderSonDtoArrayList = new ArrayList<>(); List<PoOrderSonDto> poOrderSonDtoArrayList = new ArrayList<>();
if (returnGoodHeaderDetailsDataDtoList != null && returnGoodHeaderDetailsDataDtoList.size() > 0) { if (returnGoodHeaderDetailsDataDtoList != null && returnGoodHeaderDetailsDataDtoList.size() > 0) {
try { try {
for (int i = 0; i < returnGoodHeaderDetailsDataDtoList.size(); i++) { for (int i = 0; i < returnGoodHeaderDetailsDataDtoList.size(); i++) {
StockinOrderSearchResponse.StockinOrder stockinOrder = returnGoodHeaderDetailsDataDtoList.get(i); OFSReceiptConfirmSearchResponse.Order order = returnGoodHeaderDetailsDataDtoList.get(i);
StockinOrderSearchResponse.StockinOrder.StockinH header = stockinOrder.getHeader(); OFSReceiptConfirmSearchResponse.Header header = order.getHeader();
List<StockinOrderSearchResponse.StockinOrder.StockinB> details = stockinOrder.getDetails(); List<OFSReceiptConfirmSearchResponse.Detail> details = order.getDetails();
String generateBusinessDate = null; String generateBusinessDate = null;
try { try {
generateBusinessDate = createGenerateBusinessDate(stockinOrder); //生成业务日期
generateBusinessDate = createGenerateBusinessDate(header);
//查询OFS采购订单 //查询OFS采购订单
OfsPoOrderData ofsPoOrderData = ofsStandardUtil.queryOfsPoOrder(header.getRefOrderCode()); OfsPoOrderData ofsPoOrderData = ofsStandardUtil.queryOfsPoOrder(header.getRefOrderCode());
@ -651,6 +670,8 @@ public class ProxyPurchaseWarehousWarehouse extends PluginBaseEntity {
if (!checkResult) { if (!checkResult) {
continue; continue;
} }
OfsPoOrderHeader header1 = ofsPoOrderData.getHeader();
List<OfsPoOrderDetails> details1 = ofsPoOrderData.getDetails();
//采购公司 //采购公司
String companyCode = header.getCompanyCode(); String companyCode = header.getCompanyCode();
@ -698,7 +719,7 @@ public class ProxyPurchaseWarehousWarehouse extends PluginBaseEntity {
//客商基本档案(供应商类型) //客商基本档案(供应商类型)
//2024年8月20日 14:47:55 丽知商城OFS 供应商客商档案传递到U8C的客商 //2024年8月20日 14:47:55 丽知商城OFS 供应商客商档案传递到U8C的客商
//其中自定义项1作为原系统编码因此统一传到自定义项一已经和大家确认好了没有关系的放心大胆传吧宝贝 //其中自定义项1作为原系统编码因此统一传到自定义项一已经和大家确认好了没有关系的放心大胆传吧宝贝
String shipFromCode = header.getShipFromCode(); String shipFromCode = header1.getVendorCode();
//测试 //测试
// shipFromCode = "dy-off"; // shipFromCode = "dy-off";
Assert.notNull(shipFromCode, "O供应商编码不能为空没有办法完成业务逻辑请配置供应商编码(采购)"); Assert.notNull(shipFromCode, "O供应商编码不能为空没有办法完成业务逻辑请配置供应商编码(采购)");
@ -805,7 +826,7 @@ public class ProxyPurchaseWarehousWarehouse extends PluginBaseEntity {
//失败 //失败
IntegrationTaskLivingDetailsEntity integrationTaskLivingDetailsEntity = new IntegrationTaskLivingDetailsEntity(); IntegrationTaskLivingDetailsEntity integrationTaskLivingDetailsEntity = new IntegrationTaskLivingDetailsEntity();
integrationTaskLivingDetailsEntity.setNewState(ProfilesActiveConstant.LOG_STATUS_N); integrationTaskLivingDetailsEntity.setNewState(ProfilesActiveConstant.LOG_STATUS_N);
integrationTaskLivingDetailsEntity.setRootAppNewData(JSON.toJSONString(stockinOrder));//原始数据json integrationTaskLivingDetailsEntity.setRootAppNewData(JSON.toJSONString(order));//原始数据json
integrationTaskLivingDetailsEntity.setNewTransmitInfo(JSON.toJSONString(message));//返回结果 integrationTaskLivingDetailsEntity.setNewTransmitInfo(JSON.toJSONString(message));//返回结果
integrationTaskLivingDetailsEntity.setNewPushDate(new Date()); integrationTaskLivingDetailsEntity.setNewPushDate(new Date());
integrationTaskLivingDetailsEntity.setBusinessDate(generateBusinessDate); integrationTaskLivingDetailsEntity.setBusinessDate(generateBusinessDate);
@ -817,7 +838,7 @@ public class ProxyPurchaseWarehousWarehouse extends PluginBaseEntity {
} }
//成功 //成功
} catch (Exception e) { } catch (Exception e) {
logger.error("代理采购入库单档案转换失败", e); logger.error("代理、成品采购入库单档案转换失败", e);
//失败 //失败
} }
} else { } else {
@ -831,35 +852,35 @@ public class ProxyPurchaseWarehousWarehouse extends PluginBaseEntity {
* *
* @author liuyang * @author liuyang
*/ */
private BdBusitypeEntity u8cOperationFlow() throws Exception { // private BdBusitypeEntity u8cOperationFlow() throws Exception {
//查询业务流程 // //查询业务流程
//2024年8月6日 11:33:07 具体的业务流程名称还需要实施提供 // //2024年8月6日 11:33:07 具体的业务流程名称还需要实施提供
String processName = "渠道品牌采购"; // String processName = "渠道品牌采购";
BdBusitypeEntity bdBusitypeEntity = queryBdBusitypeUtil.queryBdBusitype(processName); // BdBusitypeEntity bdBusitypeEntity = queryBdBusitypeUtil.queryBdBusitype(processName);
Assert.notNull(bdBusitypeEntity, "根据业务流程名称({})没有查询到业务流程", processName); // Assert.notNull(bdBusitypeEntity, "根据业务流程名称({})没有查询到业务流程", processName);
return bdBusitypeEntity; // return bdBusitypeEntity;
} // }
/** /**
* 2024年8月20日 15:46:10 * 2024年8月20日 15:46:10
* 生成业务日期以发货时间作为业务日期 * 生成业务日期已入库确认时间为准
* *
* @author liuyang * @author liuyang
*/ */
private String createGenerateBusinessDate(PoOrderSonDto poOrderSonDto) { private String createGenerateBusinessDate(OFSReceiptConfirmSearchResponse.Header header) {
if (poOrderSonDto != null && poOrderSonDto.getClosedAt() != null) { if (header != null && header.getReceivedAt() != null) {
String closedAt = poOrderSonDto.getClosedAt(); String receivedAt = header.getReceivedAt();
String businessFormat = null; String businessFormat = null;
try { try {
Date dbill = DateUtil.parse(closedAt); Date dbill = DateUtil.parse(receivedAt);
businessFormat = DateUtil.format(dbill, "yyyy-MM-dd"); businessFormat = DateUtil.format(dbill, "yyyy-MM-dd");
} catch (Exception e) { } catch (Exception e) {
logger.error("业务日期生成失败", e); logger.error("业务日期生成失败", e);
} }
return businessFormat; return businessFormat;
} else { } else {
logger.error("closedAt为空! json{}", JSON.toJSON(poOrderSonDto)); logger.error("receivedAt为空! json{}", JSON.toJSON(header));
Assert.state(false, "closedAt为空! json{}", JSON.toJSON(poOrderSonDto)); Assert.state(false, "receivedAt为空! json{}", JSON.toJSON(header));
return null; return null;
} }
} }
@ -870,33 +891,33 @@ public class ProxyPurchaseWarehousWarehouse extends PluginBaseEntity {
* *
* @author liuyang * @author liuyang
*/ */
private String createGenerateBusinessDate(StockinOrderSearchResponse.StockinOrder stockinOrder) { // private String createGenerateBusinessDate(StockinOrderSearchResponse.StockinOrder stockinOrder) {
if (stockinOrder != null) { // if (stockinOrder != null) {
StockinOrderSearchResponse.StockinOrder.StockinH header = stockinOrder.getHeader(); // StockinOrderSearchResponse.StockinOrder.StockinH header = stockinOrder.getHeader();
String closedAt = header.getClosedAt(); // String closedAt = header.getClosedAt();
String businessFormat = null; // String businessFormat = null;
try { // try {
Date dbill = DateUtil.parse(closedAt); // Date dbill = DateUtil.parse(closedAt);
businessFormat = DateUtil.format(dbill, "yyyy-MM-dd"); // businessFormat = DateUtil.format(dbill, "yyyy-MM-dd");
} catch (Exception e) { // } catch (Exception e) {
logger.error("业务日期生成失败", e); // logger.error("业务日期生成失败", e);
} // }
return businessFormat; // return businessFormat;
} else { // } else {
logger.error("生成采购订单入库日期失败或者shipAt为空! json{}", JSON.toJSON(stockinOrder)); // logger.error("生成采购订单入库日期失败或者shipAt为空! json{}", JSON.toJSON(stockinOrder));
Assert.state(false, "生成采购订单入库日期失败或者shipAt为空! json{}", JSON.toJSON(stockinOrder)); // Assert.state(false, "生成采购订单入库日期失败或者shipAt为空! json{}", JSON.toJSON(stockinOrder));
return null; // return null;
} // }
} // }
/** /**
* 查询存货管理档案 * 查询存货管理档案
* *
* @param pkCorp 发货公司主键 * @param pkCorp 发货公司主键
* @param stockinB 采购入库单明细行 * @param stockinB 采购入库确认单明细行
* @author liuyang * @author liuyang
*/ */
private BdInvmandocEntity queryInventoryMan(StockinOrderSearchResponse.StockinOrder.StockinB stockinB, String pkCorp) throws Exception { private BdInvmandocEntity queryInventoryMan(OFSReceiptConfirmSearchResponse.Detail stockinB, String pkCorp) throws Exception {
Assert.notNull(stockinB, "sonDetailsDto不能为空"); Assert.notNull(stockinB, "sonDetailsDto不能为空");
Assert.notNull(stockinB.getSkuCode(), "O存货商家编码不能为空"); Assert.notNull(stockinB.getSkuCode(), "O存货商家编码不能为空");
Assert.notNull(pkCorp, "发货公司主键不能为空"); Assert.notNull(pkCorp, "发货公司主键不能为空");
@ -919,16 +940,19 @@ public class ProxyPurchaseWarehousWarehouse extends PluginBaseEntity {
* 2024年8月20日 17:42:15 * 2024年8月20日 17:42:15
* 应该通过明细行主键匹配但是只能根据sku匹配目前的实现逻辑 * 应该通过明细行主键匹配但是只能根据sku匹配目前的实现逻辑
* 查找OFS采购订单明细行主要是为了带出实付金额通过实付金额/实收数量=含税单价 * 查找OFS采购订单明细行主要是为了带出实付金额通过实付金额/实收数量=含税单价
* 2025 3 11 15:38:43
* 最新调整为采购入库确认单明细行 关联 采购订单明细行
* *
* @param ofsPoOrderDataDetails OFS采购订单明细行所有对象 * @param ofsPoOrderDataDetails OFS采购订单明细行所有对象
* @param stockinB OFS采购入库单明细行对象 * @param stockinB OFS采购入库确认单明细行对象
* @author liuyang * @author liuyang
*/ */
private OfsPoOrderDetails findOfsPoOrderDetail(List<OfsPoOrderDetails> ofsPoOrderDataDetails, StockinOrderSearchResponse.StockinOrder.StockinB stockinB) { private OfsPoOrderDetails findOfsPoOrderDetail(List<OfsPoOrderDetails> ofsPoOrderDataDetails, OFSReceiptConfirmSearchResponse.Detail stockinB) throws Exception {
if (ofsPoOrderDataDetails != null && ofsPoOrderDataDetails.size() > 0 && stockinB != null) { if (ofsPoOrderDataDetails != null && ofsPoOrderDataDetails.size() > 0 && stockinB != null) {
// 2024年8月20日 23:33:11 先使用sku验证然后O接口更新明细id使用明细id匹配 // 2024年8月20日 23:33:11 先使用sku验证然后O接口更新明细id使用明细id匹配
// 2024年8月20日 23:36:04 使用sku匹配在某种角度来说是错误的 // 2024年8月20日 23:36:04 使用sku匹配在某种角度来说是错误的
// 2024年8月21日 14:23:02 O接口已经返回明细行主键根据这个匹配 // 2024年8月21日 14:23:02 O接口已经返回明细行主键根据这个匹配
// 2025 3 11 15:40:27 根据 OFS 入库确认单明细行的采购订单明细行 id得到采购订单明细行
for (int i = 0; i < ofsPoOrderDataDetails.size(); i++) { for (int i = 0; i < ofsPoOrderDataDetails.size(); i++) {
Assert.notNull(ofsPoOrderDataDetails.get(i).getId(), "采购订单明细行主键不能为空!"); Assert.notNull(ofsPoOrderDataDetails.get(i).getId(), "采购订单明细行主键不能为空!");
Assert.notNull(stockinB.getRefOrderDetailId(), "采购入库单明细行对应的关联采购订单的明细行主键不能为空!"); Assert.notNull(stockinB.getRefOrderDetailId(), "采购入库单明细行对应的关联采购订单的明细行主键不能为空!");
@ -952,7 +976,7 @@ public class ProxyPurchaseWarehousWarehouse extends PluginBaseEntity {
*/ */
public PoOrderResultDto sendU8CPoOrder(String param) throws Exception { public PoOrderResultDto sendU8CPoOrder(String param) throws Exception {
long startLong = System.currentTimeMillis(); long startLong = System.currentTimeMillis();
logger.info("代理采购入库推送开始,推送参数:" + param + ",U8C_URL:" + OverallConstant.getOverAllValue("u8c_url")); logger.info("代理、成品采购入库推送开始,推送参数:" + param + ",U8C_URL:" + OverallConstant.getOverAllValue("u8c_url"));
String apiCode = "8000370035"; String apiCode = "8000370035";
String result = HttpRequest.post(OverallConstant.getOverAllValue("u8c_url")).header("appId", OverallConstant.getOverAllValue("appId"))//头信息多个头信息多次调用此方法即可 String result = HttpRequest.post(OverallConstant.getOverAllValue("u8c_url")).header("appId", OverallConstant.getOverAllValue("appId"))//头信息多个头信息多次调用此方法即可
.header("usercode", OverallConstant.getOverAllValue("u8cApiUsercodePK")).header("password", OverallConstant.getOverAllValue("u8cApiPasswordPK")).header("system", OverallConstant.getOverAllValue("u8cApiSystemPK")).header("trantype", OverallConstant.getOverAllValue("u8cApiTrantypePK")).header("apiCode", apiCode)//头信息多个头信息多次调用此方法即可 .header("usercode", OverallConstant.getOverAllValue("u8cApiUsercodePK")).header("password", OverallConstant.getOverAllValue("u8cApiPasswordPK")).header("system", OverallConstant.getOverAllValue("u8cApiSystemPK")).header("trantype", OverallConstant.getOverAllValue("u8cApiTrantypePK")).header("apiCode", apiCode)//头信息多个头信息多次调用此方法即可
@ -961,7 +985,7 @@ public class ProxyPurchaseWarehousWarehouse extends PluginBaseEntity {
.body(param)//表单内容 .body(param)//表单内容
.timeout(600000)//超时毫秒 .timeout(600000)//超时毫秒
.execute().body(); .execute().body();
logger.info("代理采购入库推送结束,返回参数:" + result); logger.info("代理、成品采购入库推送结束,返回参数:" + result);
long endLong = System.currentTimeMillis(); long endLong = System.currentTimeMillis();
logger.info("U8C采购入库接口请求耗时" + (endLong - startLong)); logger.info("U8C采购入库接口请求耗时" + (endLong - startLong));
@ -983,7 +1007,7 @@ public class ProxyPurchaseWarehousWarehouse extends PluginBaseEntity {
} }
} }
if (!isSuccess) { if (!isSuccess) {
Assert.state(false, "代理采购业务推送U8C采购订单失败 接口返回结果:{}", result); Assert.state(false, "代理、成品采购业务推送U8C采购订单失败 接口返回结果:{}", result);
} }
return poOrderResultDto; return poOrderResultDto;
} }
@ -1039,15 +1063,17 @@ public class ProxyPurchaseWarehousWarehouse extends PluginBaseEntity {
/** /**
* 查找U8C表体明细行 * 查找U8C表体明细行
* *
* @param stockinB O采购入库确认单明细行
* @param poOrderBEntityList U8C采购订单表体明细行
* @author liuyang * @author liuyang
*/ */
private PoOrderBEntity findPoOrderBEntity(StockinOrderSearchResponse.StockinOrder.StockinB stockinB, List<PoOrderBEntity> poOrderBEntityList) throws Exception { private PoOrderBEntity findPoOrderBEntity(OFSReceiptConfirmSearchResponse.Detail stockinB, List<PoOrderBEntity> poOrderBEntityList) throws Exception {
Assert.notNull(stockinB, "stockinB不能为空"); Assert.notNull(stockinB, "stockinB不能为空");
Assert.notNull(poOrderBEntityList, "poOrderBEntityList不能为空"); Assert.notNull(poOrderBEntityList, "poOrderBEntityList不能为空");
for (int i = 0; i < poOrderBEntityList.size(); i++) { for (int i = 0; i < poOrderBEntityList.size(); i++) {
PoOrderBEntity poOrderBEntity = poOrderBEntityList.get(i); PoOrderBEntity poOrderBEntity = poOrderBEntityList.get(i);
if (poOrderBEntity.getVdef20() != null) { if (poOrderBEntity != null && poOrderBEntity.getVdef20() != null) {
if (poOrderBEntity.getVdef20().equals(stockinB.getRefOrderDetailId())) { if (poOrderBEntity.getVdef20().equals(stockinB.getRefOrderDetailId())) {
return poOrderBEntity; return poOrderBEntity;
} }
@ -1058,11 +1084,13 @@ public class ProxyPurchaseWarehousWarehouse extends PluginBaseEntity {
} }
/** /**
* 打印OFS单号 * 打印OFS拉取到的
* *
* @author liuyang * @param returnGoodHeaderDetailsDataDtoArrayList 拉取到的入库确认单封装
* @param startTime 开始时间
* @param endTime 结束时间
*/ */
private void printOfsDocCode(List<StockinOrderSearchResponse.StockinOrder> returnGoodHeaderDetailsDataDtoArrayList, String startTime, String endTime) { private void printOfsDocCode(List<OFSReceiptConfirmSearchResponse.Order> returnGoodHeaderDetailsDataDtoArrayList, String startTime, String endTime) {
Assert.notNull(returnGoodHeaderDetailsDataDtoArrayList, "returnGoodHeaderDetailsDataDtoArrayList不能为空"); Assert.notNull(returnGoodHeaderDetailsDataDtoArrayList, "returnGoodHeaderDetailsDataDtoArrayList不能为空");
Assert.notNull(startTime, "startTime不能为空"); Assert.notNull(startTime, "startTime不能为空");
Assert.notNull(endTime, "endTime不能为空"); Assert.notNull(endTime, "endTime不能为空");
@ -1075,6 +1103,8 @@ public class ProxyPurchaseWarehousWarehouse extends PluginBaseEntity {
stringBuffer.append("开始时间:"); stringBuffer.append("开始时间:");
stringBuffer.append(startTime); stringBuffer.append(startTime);
stringBuffer.append(" ");
stringBuffer.append("结束时间:"); stringBuffer.append("结束时间:");
stringBuffer.append(endTime); stringBuffer.append(endTime);
stringBuffer.append(" "); stringBuffer.append(" ");
@ -1087,4 +1117,33 @@ public class ProxyPurchaseWarehousWarehouse extends PluginBaseEntity {
logger.error("插件:{},打印拉取到的单据号出错", getPluginName(), e); logger.error("插件:{},打印拉取到的单据号出错", getPluginName(), e);
} }
} }
/**
* 打印OFS拉取到的单据号
*
* @param returnGoodHeaderDetailsDataDtoArrayList 拉取到的入库确认单封装
* @param code OFS采购入库确认单单据号
*/
private void printOfsDocCode(List<OFSReceiptConfirmSearchResponse.Order> returnGoodHeaderDetailsDataDtoArrayList, String code) {
Assert.notNull(returnGoodHeaderDetailsDataDtoArrayList, "returnGoodHeaderDetailsDataDtoArrayList不能为空");
Assert.notNull(code, "startTime不能为空");
try {
StringBuffer stringBuffer = new StringBuffer();
stringBuffer.append("插件:");
stringBuffer.append(getPluginName());
stringBuffer.append(" ");
stringBuffer.append("OFS单据号");
stringBuffer.append(code);
stringBuffer.append(" ");
stringBuffer.append("获取到的单号:");
String codes = returnGoodHeaderDetailsDataDtoArrayList.stream().map(returnGoodHeaderDetailsDataDto -> returnGoodHeaderDetailsDataDto.getHeader().getCode()).collect(Collectors.joining(","));
stringBuffer.append(codes);
logger.info(stringBuffer.toString());
} catch (Exception e) {
logger.error("插件:{},打印拉取到的单据号出错", getPluginName(), e);
}
}
} }

View File

@ -1,6 +1,7 @@
package com.hzya.frame.plugin.lets.u8cdto; package com.hzya.frame.plugin.lets.u8cdto;
import com.hzya.frame.plugin.lets.entity.*; import com.hzya.frame.plugin.lets.entity.*;
import com.hzya.frame.ttxofs.dto.ofsReceiptConfirmSearch.OFSReceiptConfirmSearchResponse;
import com.hzya.frame.ttxofs.dto.ofspoorder.OfsPoOrderData; import com.hzya.frame.ttxofs.dto.ofspoorder.OfsPoOrderData;
import com.hzya.frame.ttxofs.dto.stock.StockinOrderSearchResponse; import com.hzya.frame.ttxofs.dto.stock.StockinOrderSearchResponse;
import lombok.Data; import lombok.Data;
@ -16,7 +17,7 @@ import java.util.List;
* @FilenamePoOrderSonDto * @FilenamePoOrderSonDto
*/ */
@Data @Data
public class PoOrderSonDto extends StockinOrderSearchResponse.StockinOrder.StockinH { public class PoOrderSonDto extends OFSReceiptConfirmSearchResponse.Header {
/** /**
* 采购公司 * 采购公司
*/ */
@ -45,7 +46,7 @@ public class PoOrderSonDto extends StockinOrderSearchResponse.StockinOrder.Stock
/** /**
* 明细行 * 明细行
*/ */
private List<StockinOrderSearchResponse.StockinOrder.StockinB> details; private List<OFSReceiptConfirmSearchResponse.Detail> details;
/** /**
* OFS采购订单 * OFS采购订单

View File

@ -27,9 +27,8 @@ public class ProxyPurchaseWarehousOrderTest {
@Test @Test
public void startImplementByCode() { public void startImplementByCode() {
try { try {
// proxyPurchaseWarehousOrder.startImplementByCode("LETS-PO2025010200000001"); proxyPurchaseWarehousOrder.startImplementByCode("LETS-PO2025030400000134");
// proxyPurchaseWarehousOrder.startImplementByTime("2025-01-21 17:38:26", "2025-01-21 17:38:26");
proxyPurchaseWarehousOrder.startImplementByTime("2025-01-21 17:38:26", "2025-01-21 17:38:26");
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
} }

View File

@ -19,8 +19,8 @@ import org.springframework.test.context.junit4.SpringRunner;
@SpringBootTest(classes = WebappApplication.class) @SpringBootTest(classes = WebappApplication.class)
public class ProxyPurchaseWarehousTest { public class ProxyPurchaseWarehousTest {
@Autowired // @Autowired
private ProxyPurchaseWarehousWarehouse proxyPurchaseWarehous; // private ProxyPurchaseWarehousWarehouse proxyPurchaseWarehous;
@Test @Test
public void startImplement() { public void startImplement() {

View File

@ -26,6 +26,6 @@ public class ProxyPurchaseWarehousWarehouseTest {
@Test @Test
public void startImplementByCode() { public void startImplementByCode() {
proxyPurchaseWarehousWarehouse.startImplementByCode("LETS-RE2025030700002906"); proxyPurchaseWarehousWarehouse.startImplementByCode("LETS-RE2025030400002125-confirm");
} }
} }

View File

@ -67,4 +67,13 @@ public class OfsStandardUtilTest {
e.printStackTrace(); e.printStackTrace();
} }
} }
@Test
public void testQueryOfsPoOrder() {
try {
ofsStandardUtil.queryOfsPoOrder("LETS-PO2025030300000001");
} catch (Exception e) {
e.printStackTrace();
}
}
} }

View File

@ -22,7 +22,7 @@ public class OFSReceiptConfirmSearchResponse extends ReturnMessageBasics {
} }
@Data @Data
public class Header { public static class Header {
/** /**
* id * id
*/ */
@ -170,8 +170,7 @@ public class OFSReceiptConfirmSearchResponse extends ReturnMessageBasics {
} }
@Data @Data
public class Detail { public static class Detail {
/** /**
* id * id
*/ */
@ -373,6 +372,4 @@ public class OFSReceiptConfirmSearchResponse extends ReturnMessageBasics {
*/ */
private String registerCode; private String registerCode;
} }
} }