From 174387547170d530ad3dc5595210b43a794acdf9 Mon Sep 17 00:00:00 2001 From: liuy <37787198+LiuyCodes@users.noreply.github.com> Date: Wed, 18 Sep 2024 10:17:01 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=8A=9F=E8=83=BD=EF=BC=9A=E5=AE=9E?= =?UTF-8?q?=E7=8E=B0OFS=E9=87=87=E8=B4=AD=E5=85=A5=E5=BA=93=E5=8D=95?= =?UTF-8?q?=E7=94=9F=E6=88=90U8C=E5=A7=94=E5=A4=96=E5=8A=A0=E5=B7=A5?= =?UTF-8?q?=E5=85=A5=E5=BA=93=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 开发了一个新的插件,用于将OFS采购入库单转换并推送到U8C系统中作为委外加工入库单。该功能包括查询OFS采购入库单、匹配U8C委外订单及其明细、查询存货档案,并将数据推送至U8C接口。实现了多线程处理以提高效率,并包含详细的日志记录和异常处理机制。 --- .../plugin/outsourc/ConsignmachiningIn.txt | 675 --------------- .../ConsignmachiningInOrderReturn.txt | 767 ------------------ .../sales/SoSaleOutPluginInitializerToC.java | 4 + 3 files changed, 4 insertions(+), 1442 deletions(-) delete mode 100644 buildpackage/src/main/java/com/hzya/frame/plugin/lets/plugin/outsourc/ConsignmachiningIn.txt delete mode 100644 buildpackage/src/main/java/com/hzya/frame/plugin/lets/plugin/outsourc/ConsignmachiningInOrderReturn.txt diff --git a/buildpackage/src/main/java/com/hzya/frame/plugin/lets/plugin/outsourc/ConsignmachiningIn.txt b/buildpackage/src/main/java/com/hzya/frame/plugin/lets/plugin/outsourc/ConsignmachiningIn.txt deleted file mode 100644 index bf64a906..00000000 --- a/buildpackage/src/main/java/com/hzya/frame/plugin/lets/plugin/outsourc/ConsignmachiningIn.txt +++ /dev/null @@ -1,675 +0,0 @@ -package com.hzya.frame.plugin.lets.plugin.outsourc; - -import cn.hutool.core.date.DateUtil; -import cn.hutool.core.lang.Assert; -import cn.hutool.core.util.StrUtil; -import cn.hutool.http.HttpRequest; -import com.alibaba.fastjson.JSON; -import com.alibaba.fastjson.JSONObject; -import com.hzya.frame.base.PluginBaseEntity; -import com.hzya.frame.beanutil.BeanUtil; -import com.hzya.frame.plugin.lets.constant.ProfilesActiveConstant; -import com.hzya.frame.plugin.lets.dao.*; -import com.hzya.frame.plugin.lets.entity.*; -import com.hzya.frame.plugin.lets.ofsvo.QueryOfsSoSaleOutVo; -import com.hzya.frame.plugin.lets.u8cdto.*; -import com.hzya.frame.plugin.lets.util.OfsStandardUtil; -import com.hzya.frame.plugin.lets.util.OnlyImplementProxyOrderUtil; -import com.hzya.frame.plugin.lets.util.QueryBdBusitypeUtil; -import com.hzya.frame.plugin.lets.util.RdclUtil; -import com.hzya.frame.ttxofs.dto.ofspoorder.OfsPoOrderData; -import com.hzya.frame.ttxofs.dto.ofspoorder.OfsPoOrderDetails; -import com.hzya.frame.ttxofs.dto.ofspoorder.OfsPoOrderHeader; -import com.hzya.frame.ttxofs.dto.stock.StockinOrderSearchResponse; -import com.hzya.frame.web.entity.JsonResultEntity; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; - -import java.math.BigDecimal; -import java.util.*; - -/** - * O采购入库 -> U8C委外加工入库 - * - * @Author:liuyang - * @Package:com.hzya.frame.plugin.lets.plugin.outsourc - * @Project:kangarooDataCenterV3 - * @name:ConsignmachiningIn - * @Date:2024年8月26日 10:23:20 - * @Filename:ConsignmachiningIn - */ -public class ConsignmachiningIn extends PluginBaseEntity { - - Logger logger = LoggerFactory.getLogger(ConsignmachiningIn.class); - - @Autowired - private QueryBdBusitypeUtil queryBdBusitypeUtil; - - @Autowired - private IBdCorpDao iBdCorpDao; - - @Autowired - private IBdInvmandocDao iBdInvmandocDao; - - @Autowired - private IBdCalbodyDao iBdCalbodyDao; - - @Autowired - private IBdStordocDao iBdStordocDao; - - @Autowired - private RdclUtil rdclUtil; - - @Autowired - private OfsStandardUtil ofsStandardUtil; - - @Autowired - private IScOrderDao iScOrderDao; - - @Autowired - private IScOrderBDao iScOrderBDao; - - @Autowired - private OnlyImplementProxyOrderUtil onlyImplementProxyOrder; - - @Override - public void initialize() { - logger.info(getPluginLabel() + "執行初始化方法initialize()"); - } - - @Override - public void destroy() { - logger.info(getPluginLabel() + "執行銷毀方法destroy()"); - } - - @Override - public String getPluginId() { - return "com.hzya.frame.plugin.lets.plugin.outsourc.ConsignmachiningIn"; - } - - @Override - public String getPluginName() { - return "OFS采购入库单生成U8C委外加工入库(委外采购入库)"; - } - - @Override - public String getPluginLabel() { - return "OFS采购入库单生成U8C委外加工入库(委外采购入库)"; - } - - @Override - public String getPluginType() { - return "3"; - } - - @Override - public JsonResultEntity executeBusiness(JSONObject requestJson) throws Exception { - return null; - } - - /** - * 根据单号查询 - * - * @author liuyang - */ - public void startImplement(String startTime, String endTime) { - String threadNameStrStart = StrUtil.format("开始(委外采购)OFS采购入库单生成U8C委外加工入库 开始时间:{} 结束时间:{}", startTime, endTime); - logger.info(threadNameStrStart); - - Thread thread = new Thread(new Runnable() { - @Override - public void run() { - try { - List returnGoodHeaderDetailsDataDtoArrayList = new ArrayList<>(); - QueryOfsSoSaleOutVo queryOfsSoSaleOutVo = new QueryOfsSoSaleOutVo(); - queryOfsSoSaleOutVo.setClosedAt_start(startTime); - queryOfsSoSaleOutVo.setClosedAt_end(endTime); - queryOfsSoSaleOutVo.setClientCode("LETS"); - queryOfsSoSaleOutVo.setPageNo(1L); - queryOfsSoSaleOutVo.setPageSize(50L); - queryOfsSoSaleOutVo.setInternalInstructionType("PURCHASE"); - queryOfsSoSaleOutVo.setStatus(900L); - ofsStandardUtil.queryOfsReturnGoods(queryOfsSoSaleOutVo, returnGoodHeaderDetailsDataDtoArrayList, 1L, "ofs.receipt.search"); - logger.info("数据返回行数:{}", returnGoodHeaderDetailsDataDtoArrayList.size()); - if (returnGoodHeaderDetailsDataDtoArrayList.size() > 0) { - getSet(returnGoodHeaderDetailsDataDtoArrayList); - } else { - logger.info("没有查询到任何数据!不需要同步"); - } - } catch (Exception e) { - logger.error("startImplement方法抛出异常", e); - } - } - }, threadNameStrStart); - thread.start(); - try { - thread.join(); - } catch (Exception e) { - logger.error("thread.join()异常", e); - } - String threadNameStrEnd = StrUtil.format("结束(委外采购)OFS采购入库单生成U8C委外加工入库 开始时间:{} 结束时间:{}", startTime, endTime); - logger.info(threadNameStrEnd); - } - - /** - * 根据单号查询 - * - * @author liuyang - */ - public void startImplement(String code) { - String threadNameStrStart = StrUtil.format("开始(委外采购)OFS采购入库单生成U8C委外加工入库 OFS采购入库单号:{}", code); - logger.info(threadNameStrStart); - - Thread thread = new Thread(new Runnable() { - @Override - public void run() { - try { - List returnGoodHeaderDetailsDataDtoArrayList = new ArrayList<>(); - QueryOfsSoSaleOutVo queryOfsSoSaleOutVo = new QueryOfsSoSaleOutVo(); - queryOfsSoSaleOutVo.setClientCode("LETS"); - queryOfsSoSaleOutVo.setPageNo(1L); - queryOfsSoSaleOutVo.setPageSize(50L); - queryOfsSoSaleOutVo.setCode(code); - queryOfsSoSaleOutVo.setInternalInstructionType("PURCHASE"); - queryOfsSoSaleOutVo.setStatus(900L); - ofsStandardUtil.queryOfsReturnGoods(queryOfsSoSaleOutVo, returnGoodHeaderDetailsDataDtoArrayList, 1L, "ofs.receipt.search"); - logger.info("数据返回行数:{}", returnGoodHeaderDetailsDataDtoArrayList.size()); - if (returnGoodHeaderDetailsDataDtoArrayList.size() > 0) { - getSet(returnGoodHeaderDetailsDataDtoArrayList); - } else { - logger.info("没有查询到任何数据!不需要同步"); - } - } catch (Exception e) { - logger.error("startImplement方法抛出异常", e); - } - } - }, threadNameStrStart); - thread.start(); - try { - thread.join(); - } catch (Exception e) { - logger.error("thread.join()异常", e); - } - String threadNameStrEnd = StrUtil.format("结束(委外采购)OFS采购入库单生成U8C委外加工入库 OFS采购入库单号:{}", code); - logger.info(threadNameStrEnd); - } - - /** - * 环境预配置 - * - * @param returnGoodHeaderDetailsDataDtoArrayList 采购入库单 - * @author liuyang - */ - private void getSet(List returnGoodHeaderDetailsDataDtoArrayList) throws Exception { - //过滤成功的数据 - List stockinOrderList = filterData(returnGoodHeaderDetailsDataDtoArrayList); - //执行推送主逻辑 - implement(stockinOrderList); - } - - /** - * 过滤掉成功的数据 - * - * @author liuyang - */ - private List filterData(List returnGoodHeaderDetailsDataDtoArrayList) { - List headerDetailsDtoList1 = new ArrayList<>(); - if (returnGoodHeaderDetailsDataDtoArrayList != null && returnGoodHeaderDetailsDataDtoArrayList.size() > 0) { - //TODO 出库单明细主键,需要O返回,目前没有,已经提需求 - headerDetailsDtoList1.addAll(returnGoodHeaderDetailsDataDtoArrayList); - } - return headerDetailsDtoList1; - } - - /** - * 执行主逻辑 - * - * @author liuyang - */ - private void implement(List returnGoodHeaderDetailsDataDtoList) throws Exception { - if (returnGoodHeaderDetailsDataDtoList != null && returnGoodHeaderDetailsDataDtoList.size() > 0) { - try { - // 查询基本档案 - List consignmachiningInSonDtos = queryBasicArchives(returnGoodHeaderDetailsDataDtoList); - // 查询采购收发类别 - BdRdclEntity bdRdclEntity = rdclUtil.queryRdClObject("105"); - - if (consignmachiningInSonDtos != null && consignmachiningInSonDtos.size() > 0) { - for (int i = 0; i < consignmachiningInSonDtos.size(); i++) { - ConsignmachiningInSonDto consignmachiningInSonDto = consignmachiningInSonDtos.get(i); -// StockinOrderSearchResponse.StockinOrder.StockinH header = consignmachiningInSonDto.getHeader(); - List details = consignmachiningInSonDto.getDetails(); - - String generateBusinessDate = createGenerateBusinessDate(consignmachiningInSonDto); //生成业务日期 - OfsPoOrderData ofsPoOrderData = consignmachiningInSonDto.getOfsPoOrderData();//OFS采购订单 - ScOrderEntity scOrderEntity = consignmachiningInSonDto.getScOrderEntity();//U8C委外订单 - BdCorpEntity bdCorpEntity = consignmachiningInSonDto.getBdCorpEntity();//公司 - BdCalbodyEntity bdCalbodyEntity = consignmachiningInSonDto.getBdCalbodyEntity();//库存组织 - BdStordocEntity bdStordocEntity = consignmachiningInSonDto.getBdStordocEntity();//仓库 -// StockinOrderSearchResponse.StockinOrder.StockinH header1 = consignmachiningInSonDto.getHeader(); - List details1 = consignmachiningInSonDto.getDetails();//OFS采购入库单 - List scOrderBEntityList = consignmachiningInSonDto.getScOrderBEntityList();//U8C委外订单明细行主键 - - OfsPoOrderHeader ofsPoOrderDataHeader = ofsPoOrderData.getHeader(); - List ofsPoOrderDataDetails = ofsPoOrderData.getDetails(); - - // 代理委外入库业务流程 - BdBusitypeEntity bdBusitypeEntity = u8cOperationFlow(bdCorpEntity.getPkCorp()); - - //委外入库表头 - ConsignmachiningInHeadDto poOrderParentDto = new ConsignmachiningInHeadDto(); - poOrderParentDto.setPk_corp(bdCorpEntity.getPkCorp()); - poOrderParentDto.setCoperatorid(OverallConstant.getOverAllValue("u8cApiZdrPK")); - poOrderParentDto.setCwarehouseid(bdStordocEntity.getPkStordoc()); - poOrderParentDto.setPk_calbody(bdCalbodyEntity.getPkCalbody()); - poOrderParentDto.setCbiztype(bdBusitypeEntity.getPkBusitype()); - poOrderParentDto.setCdispatcherid(bdRdclEntity.getPkRdcl());//收发类别 - poOrderParentDto.setDbilldate(generateBusinessDate);//入库日期 - - //委外入库表头明细行 - List consignmachiningInBodyDtoArrayList = new ArrayList<>(); - for (int j = 0; j < details.size(); j++) { - StockinOrderSearchResponse.StockinOrder.StockinB stockinB = details.get(j); - //匹配U8C采购订单明细行 - ScOrderBEntity u8cPoOrderDetail = findOfsPoOrderDetailAndU8cPoOrderDetail(stockinB, ofsPoOrderData, scOrderBEntityList); - //通过O采购订单入库单明细行,联查OFS采购订单明细行 - OfsPoOrderDetails ofsPoOrderDetailRowTraget = findOfsPoOrderDetailRowTraget(stockinB, ofsPoOrderData); - //查询存货管理档案 - BdInvmandocEntity bdInvmandocEntity = queryInventoryMan(stockinB, bdCorpEntity.getPkCorp()); - - //计算含税单价 - BigDecimal noriginalcurprice = null; - String receivedQty = stockinB.getReceivedQty();//实收数量 - String fulfillAmount = ofsPoOrderDetailRowTraget.getFulfillAmount();//实收累计总金额 - try { - noriginalcurprice = new BigDecimal(fulfillAmount).divide(new BigDecimal(receivedQty), 20, BigDecimal.ROUND_HALF_UP).setScale(4, BigDecimal.ROUND_HALF_UP); - } catch (Exception e) { - logger.error("计算采购入库单原币含税单价失败", e); - Assert.state(false, "计算采购入库单原币含税单价失败 原因:{}", e.getMessage()); - } - - ConsignmachiningInBodyDto consignmachiningInBodyDto = new ConsignmachiningInBodyDto(); - consignmachiningInBodyDto.setCinventoryid(bdInvmandocEntity.getPkInvmandoc());//存货 - //TODO 测试 - consignmachiningInBodyDto.setNinnum("1"); -// consignmachiningInBodyDto.setNinnum(new BigDecimal(stockinB.getReceivedQty()).stripTrailingZeros().toPlainString());//实收数量 - consignmachiningInBodyDto.setNprice(noriginalcurprice.stripTrailingZeros().toPlainString());//单价(含税单价) - consignmachiningInBodyDto.setCsourcetype("61");//来源单据类型 - consignmachiningInBodyDto.setVsourcerowno(u8cPoOrderDetail.getCrowno());//来源单据行号 - consignmachiningInBodyDto.setVsourcebillcode(scOrderEntity.getVordercode());//来源单据号 - consignmachiningInBodyDto.setWriteofftype("按备料发料核销");//核销方式 - consignmachiningInBodyDtoArrayList.add(consignmachiningInBodyDto); - } - - List consignmachiningInHeadBodyDtoArrayList = new ArrayList<>(); - - ConsignmachiningInHeadBodyDto consignmachiningInHeadBodyDto = new ConsignmachiningInHeadBodyDto(); - consignmachiningInHeadBodyDto.setParentvo(poOrderParentDto); - consignmachiningInHeadBodyDto.setChildrenvo(consignmachiningInBodyDtoArrayList); - consignmachiningInHeadBodyDtoArrayList.add(consignmachiningInHeadBodyDto); - - Map> stringStringMap = new HashMap<>(); - stringStringMap.put("GeneralBillVO", consignmachiningInHeadBodyDtoArrayList); - //TODO 2024年8月26日 14:41:46 委外入库核销方式传不了!已经提交总部 - //TODO 2024年8月26日 14:42:19 无法超委外订单数量入库!已经提交给总部 - IcGeneralHResultDto icGeneralHResultDto = sendU8cConsignmachiningIn(JSON.toJSONString(stringStringMap)); - - String cgeneralhid = null; - String vbillcode = null; - IcGeneralHResultHeadDto parentvo = icGeneralHResultDto.getParentvo(); - List childrenvo = icGeneralHResultDto.getChildrenvo(); - if (parentvo != null) { - cgeneralhid = parentvo.getCgeneralhid(); - } - if (childrenvo != null) { - vbillcode = parentvo.getVbillcode(); - } - logger.info("推送U8C委外入库成功!委外入库单主键:{} 委外入库单编码:{}", cgeneralhid, vbillcode); - } - } else { - logger.info("poOrderSonDto.size为0!"); - } - } catch (Exception e) { - logger.error("implement方法抛出异常", e); - } - } - } - - /** - * 档案转换(OFS->U8C) - * 2024年8月23日 12:02:47 和妮姐沟通,单据流程U8C成品委外订单 -> 备料计划 -> U8C委外发料(核销) - * - * @author liuyang - */ - private List queryBasicArchives(List returnGoodHeaderDetailsDataDtoList) { - List consignmachiningInSonDtoArrayList = new ArrayList<>(); - - if (returnGoodHeaderDetailsDataDtoList != null && returnGoodHeaderDetailsDataDtoList.size() > 0) { - try { - for (int i = 0; i < returnGoodHeaderDetailsDataDtoList.size(); i++) { - StockinOrderSearchResponse.StockinOrder stockinOrder = returnGoodHeaderDetailsDataDtoList.get(i); - StockinOrderSearchResponse.StockinOrder.StockinH header = stockinOrder.getHeader(); - List details = stockinOrder.getDetails(); - - //2024年8月25日 09:54:31 查询OFS采购订单 - OfsPoOrderData ofsPoOrderData = ofsStandardUtil.queryOfsPoOrder(header.getRefOrderCode()); - Assert.notNull(ofsPoOrderData, "无法查询到委外订单(OFS采购入库单->OSF采购订单->OFS采购订单主键->U8C委外订单自定义项20)"); - OfsPoOrderHeader ofsPoOrderDataHeader = ofsPoOrderData.getHeader(); - List ofsPoOrderDataDetails = ofsPoOrderData.getDetails(); - - //如果该O采购订单对应的类型为:委外加工,则继续代码逻辑,否则就跳过代码逻辑 - boolean checkResult = onlyImplementProxyOrder.onlyImplementProxyOrder(ofsPoOrderData, "WWJG"); - if (!checkResult) { - continue; - } - - //2024年8月25日 09:42:58 查询委外订单,如果这一步报错,后续的逻辑就没有必要执行了 - String ofsId = ofsPoOrderDataHeader.getId(); - Assert.notNull(ofsId, "通过接口查询到OFS采购订单,但是没有采购订单主键,业务逻辑无法完成"); - ScOrderEntity scOrderEntity = queryScOrder(ofsId); - - //2024年8月25日 14:15:45 根据委外订单id,查询委外订单表体明细行 - List scOrderBEntityList = queryScOrderDetail(scOrderEntity.getCorderid()); - - //2024年8月25日 10:09:20 委外入库公司,取委外订单上的公司,已经和妮姐确认,没有必要通过O的公司转换,因为不存在跨组织的问题 - Assert.notNull(scOrderEntity.getPkCorp(), "O表头公司不能为空"); - BdCorpEntity bdCorpEntity = new BdCorpEntity(); - bdCorpEntity.setDr(0); - bdCorpEntity.setDataSourceCode("lets_u8c"); - bdCorpEntity.setPkCorp(scOrderEntity.getPkCorp()); - List bdCorpEntityList = iBdCorpDao.query(bdCorpEntity); - if (bdCorpEntityList.size() == 0) { - Assert.state(false, "根据委外订单公司主键:{},无法匹配到委外入库单", scOrderEntity.getPkCorp()); - } else if (bdCorpEntityList.size() >= 2) { - Assert.state(false, "根据委外订单公司主键:{},匹配到{}个委外入库单", scOrderEntity.getPkCorp(), bdCorpEntityList.size()); - } - - // 2024年8月20日 23:51:56 收货库存组织,应该是通过收货公司查询得出收货库存组织,目前收货公司和采购公司保持一致,那么就以采购公司带出!这个逻辑已经和佳妮确认 - BdCalbodyEntity bdCalbodyEntity = new BdCalbodyEntity(); - bdCalbodyEntity.setDr(0); - bdCalbodyEntity.setDataSourceCode("lets_u8c"); - bdCalbodyEntity.setPkCorp(bdCorpEntityList.get(0).getPkCorp()); - List bdCalbodyEntities = iBdCalbodyDao.query(bdCalbodyEntity); - if (bdCalbodyEntities.size() == 0) { - Assert.state(false, "根据U8C采购公司{},无法匹配到U8C发货库存组织", bdCorpEntityList.get(0).getPkCorp()); - } else if (bdCalbodyEntities.size() >= 2) { - Assert.state(false, "根据U8C采购公司{},匹配到U8C发货库存组织{}个", bdCorpEntityList.get(0).getPkCorp(), bdCalbodyEntities.size()); - } - - //入库仓库 - String facilityCode = header.getFacilityCode(); - Assert.notNull(facilityCode, "O售后入库单仓库facilityCode字段不能为空"); - BdStordocEntity bdStordocEntity = new BdStordocEntity(); - bdStordocEntity.setDr(0L); - bdStordocEntity.setDataSourceCode("lets_u8c"); - bdStordocEntity.setPkCalbody(bdCalbodyEntities.get(0).getPkCalbody()); - bdStordocEntity.setStorcode(facilityCode); - List bdStordocEntityList = iBdStordocDao.query(bdStordocEntity); - if (bdStordocEntityList.size() == 0) { - Assert.state(false, "根据O仓库编码+U8C收货库存组织主键,无法匹配到U8C仓库", facilityCode, bdCalbodyEntities.get(0).getPkCalbody()); - } else if (bdStordocEntityList.size() >= 2) { - Assert.state(false, "根据O仓库编码+U8C收货库存组织主键,匹配到U8C仓库多个", facilityCode, bdCalbodyEntities.get(0).getPkCalbody()); - } - - ConsignmachiningInSonDto consignmachiningInSonDto = new ConsignmachiningInSonDto(); - consignmachiningInSonDto.setOfsPoOrderData(ofsPoOrderData); - consignmachiningInSonDto.setScOrderEntity(scOrderEntity); - consignmachiningInSonDto.setBdCorpEntity(bdCorpEntityList.get(0)); - consignmachiningInSonDto.setBdCalbodyEntity(bdCalbodyEntities.get(0)); - consignmachiningInSonDto.setBdStordocEntity(bdStordocEntityList.get(0)); -// consignmachiningInSonDto.setHeader(header); - consignmachiningInSonDto.setScOrderBEntityList(scOrderBEntityList); - consignmachiningInSonDto.setDetails(details); - - BeanUtil.copyPropertiesV2(header, consignmachiningInSonDto); - consignmachiningInSonDtoArrayList.add(consignmachiningInSonDto); - } - //成功 - } catch (Exception e) { - logger.error("委外入库OFS档案转换", e); - //失败 - } - } else { - logger.info("queryBasicArchives对应returnGoodHeaderDetailsDataDtoList.size为0"); - } - return consignmachiningInSonDtoArrayList; - } - - /** - * 查询委外订单表头对象 - * - * @author liuyang - */ - private ScOrderEntity queryScOrder(String ofsPoOrderId) { - Assert.notNull(ofsPoOrderId, "ofsPoOrderId不能为空!"); - Assert.state(!"".equals(ofsPoOrderId.trim()), "ofsPoOrderId不能为空"); - - ScOrderEntity scOrderEntity = new ScOrderEntity(); - scOrderEntity.setVdef20(ofsPoOrderId); - scOrderEntity.setDr("0"); - scOrderEntity.setDataSourceCode("lets_u8c"); - List scOrderEntityList = iScOrderDao.query(scOrderEntity); - if (scOrderEntityList == null || scOrderEntityList.size() == 0) { - Assert.state(false, "根据O采购订单主键:{}(u委外订单自定义项20存储O采购订单主键),无法匹配到U8C委外订单", ofsPoOrderId); - } else if (scOrderEntityList.size() >= 2) { - Assert.state(false, "根据O采购订单主键:{}(u委外订单自定义项20存储O采购订单主键),匹配到{}个U8C委外订单", ofsPoOrderId, scOrderEntityList.size()); - } - return scOrderEntityList.get(0); - } - - /** - * 2024年8月25日 14:11:31 查询U8C委外订单明细 - * - * @param corderid 委外订单表头主键 - * @author liuyang - */ - private List queryScOrderDetail(String corderid) throws Exception { - Assert.notNull(corderid, "委外订单表头主键不能为空!"); - Assert.state(!"".equals(corderid), "委外订单表头主键不能为空!"); - - ScOrderBEntity scOrderBEntity = new ScOrderBEntity(); - scOrderBEntity.setCorderid(corderid); - scOrderBEntity.setDr("0"); - scOrderBEntity.setDataSourceCode("lets_u8c"); - List scOrderBEntityList = iScOrderBDao.query(scOrderBEntity); - if (scOrderBEntityList == null || scOrderBEntityList.size() == 0) { - //2024年8月25日 14:16:31 这个验证非常要必要,单据如果没有表体没有行,是很可疑的 - Assert.state(false, "根据U8C委外订单主键({})无法查询到委外订单表体明细行!", corderid); - } - return scOrderBEntityList; - } - - /** - * 2024年8月6日 10:59:03 查询U8C业务流程 - * - * @param pkCorp 公司主键 - * @author liuyang - */ - private BdBusitypeEntity u8cOperationFlow(String pkCorp) throws Exception { - Assert.notNull(pkCorp, "公司主键不能为空!"); - Assert.state(!"".equals(pkCorp.trim()), "公司主键不能为空!"); - //查询业务流程 - //2024年8月6日 11:33:07 具体的业务流程名称,还需要实施提供 - String processName = "委外加工"; - BdBusitypeEntity bdBusitypeEntity = queryBdBusitypeUtil.queryBdBusitype(processName); - Assert.notNull(bdBusitypeEntity, "根据业务流程名称({})没有查询到业务流程", processName); - return bdBusitypeEntity; - } - - /** - * 2024年8月20日 15:46:10 - * 生成业务日期,以发货时间作为业务日期 - * - * @author liuyang - */ - private String createGenerateBusinessDate(ConsignmachiningInSonDto consignmachiningInSonDto) { - //TODO 测试 - consignmachiningInSonDto.setShipAt("2024-08-19"); - if (consignmachiningInSonDto != null && consignmachiningInSonDto.getShipAt() != null) { - String shipAt = consignmachiningInSonDto.getShipAt(); - String businessFormat = null; - try { - Date dbill = DateUtil.parse(shipAt); - businessFormat = DateUtil.format(dbill, "yyyy-MM-dd"); - } catch (Exception e) { - logger.error("业务日期生成失败", e); - } - return businessFormat; - } else { - logger.error("生成采购订单入库日期失败,或者shipAt为空! json:{}", JSON.toJSON(consignmachiningInSonDto)); - Assert.state(false, "生成采购订单入库日期失败,或者shipAt为空! json:{}", JSON.toJSON(consignmachiningInSonDto)); - return null; - } - } - - /** - * 匹配U8C采购订单明细行 - * 通过O采购入库单明细行,得到采购订单明细行,最后查找到U8C采购订单明细行 - * - * @param stockinB OFS采购入库单明细行 - * @param ofsPoOrderData OFS采购订单 - * @param scOrderBEntityList U8C委外订单明细行 - * @author liuyang - */ - private ScOrderBEntity findOfsPoOrderDetailAndU8cPoOrderDetail(StockinOrderSearchResponse.StockinOrder.StockinB stockinB, OfsPoOrderData ofsPoOrderData, List scOrderBEntityList) { - Assert.notNull(stockinB, "stockinB不能为空"); - Assert.notNull(ofsPoOrderData, "ofsPoOrderData不能为空"); - Assert.notNull(scOrderBEntityList, "scOrderBEntityList删除不能为空"); - -// OfsPoOrderHeader header = ofsPoOrderData.getHeader(); - List details = ofsPoOrderData.getDetails(); - - //查找采购订单明细行 - OfsPoOrderDetails tarGetOfsPoOrderDetails = null; - for (int i = 0; i < details.size(); i++) { - OfsPoOrderDetails ofsPoOrderDetails = details.get(i); - if (ofsPoOrderDetails.getId().equals(stockinB.getRefOrderDetailId())) { - tarGetOfsPoOrderDetails = ofsPoOrderDetails; - } - } - Assert.notNull(tarGetOfsPoOrderDetails, "无法匹配到采购订单明细行! 目标主键:{}", stockinB.getRefOrderDetailId()); - - //根据采购订单明细行主键,查找U8C采购订单明细行 - for (int i = 0; i < scOrderBEntityList.size(); i++) { - ScOrderBEntity scOrderBEntity = scOrderBEntityList.get(i); - Assert.notNull(scOrderBEntity.getVdef20(), "委外订单明细行v20不能为空(明细行v20存储O采购订单明细行主键)!"); - Assert.state(!"".equals(scOrderBEntity.getVdef20()), "委外订单明细行v20不能为空(明细行v20存储O采购订单明细行主键)!"); - if (tarGetOfsPoOrderDetails.getId().equals(scOrderBEntity.getVdef20())) { - return scOrderBEntity; - } - } - Assert.state(false, "通过U8C采购订单明细行主键层层匹配到U8C采购明细失败!"); - return null; - } - - /** - * 匹配U8C采购订单明细行 - * 通过O采购入库单明细行,得到采购订单明细行,最后查找到U8C采购订单明细行 - * - * @param stockinB OFS采购入库单明细行 - * @param ofsPoOrderData OFS采购订单 - * @author liuyang - */ - private OfsPoOrderDetails findOfsPoOrderDetailRowTraget(StockinOrderSearchResponse.StockinOrder.StockinB stockinB, OfsPoOrderData ofsPoOrderData) { - Assert.notNull(stockinB, "stockinB不能为空"); - Assert.notNull(ofsPoOrderData, "ofsPoOrderData不能为空"); - - List details = ofsPoOrderData.getDetails(); - for (int i = 0; i < details.size(); i++) { - OfsPoOrderDetails ofsPoOrderDetails = details.get(i); - if (ofsPoOrderDetails.getId().equals(stockinB.getRefOrderDetailId())) { - return ofsPoOrderDetails; - } - } - Assert.state(false, "通过OFS采购入库单,无法匹配到OFS采购订单明细行! 目标主键:{}", stockinB.getRefOrderDetailId()); - return null; - } - - /** - * 查询存货管理档案 - * - * @param pkCorp 发货公司主键 - * @param stockinB 采购入库单明细行 - * @author liuyang - */ - private BdInvmandocEntity queryInventoryMan(StockinOrderSearchResponse.StockinOrder.StockinB stockinB, String pkCorp) throws Exception { - Assert.notNull(stockinB, "sonDetailsDto不能为空"); - Assert.notNull(stockinB.getSkuCode(), "O存货商家编码不能为空"); - Assert.notNull(pkCorp, "发货公司主键不能为空"); - - BdInvmandocEntity bdInvmandocEntity = new BdInvmandocEntity(); - bdInvmandocEntity.setInvcode(stockinB.getSkuCode()); - bdInvmandocEntity.setPkCorp(pkCorp); - List bdInvmandocEntity2 = iBdInvmandocDao.queryBdInvmandocByInvcodeList(bdInvmandocEntity); - if (bdInvmandocEntity2.size() == 0) { - Assert.state(false, "根据O商家编码:{} U8C发货公司主键:{}没有查询到存货管理档案", stockinB.getSkuCode(), pkCorp); - } else if (bdInvmandocEntity2.size() >= 2) { - Assert.state(false, "根据O商家编码:{} U8C发货公司主键:{}没有查询到存货管理档案", stockinB.getSkuCode(), pkCorp); - } - return bdInvmandocEntity2.get(0); - } - - /** - * 2024年8月25日 15:12:22 - * 推送U8C委外入库单 - * - * @param param 原数据json - * @author liuyang - */ - public IcGeneralHResultDto sendU8cConsignmachiningIn(String param) throws Exception { - long startLong = System.currentTimeMillis(); - logger.info("U8C委外入库推送开始,推送参数:" + param + ",U8C_URL:" + ProfilesActiveConstant.U8C_URL); - String result = HttpRequest.post(ProfilesActiveConstant.U8C_URL).header("appId", "800037")//头信息,多个头信息多次调用此方法即可 - .header("usercode", "admin").header("password", "21232f297a57a5a743894a0e4a801fc3").header("system", "lz").header("trantype", "PK").header("apiCode", "8000370056")//头信息,多个头信息多次调用此方法即可 - .header("publicKey", "ZJYAWb7lhAUTYqekPkU+uHJv1/ObJxb7dT7sD8HPRDGAgyhCe7eDIk+3zDUT+v578prj")//头信息,多个头信息多次调用此方法即可 - .header("secretKey", "fviZnLBsQUAGF8w8FSOdJi7XlIm/XAZclMxRagDLfTyJFlvnIBF3w66Hrpfzs8cYj3JzOP8MtA1LSGvL+2BWG8c/o7DKi92S4mr3zcGearA=")//头信息,多个头信息多次调用此方法即可 - .body(param)//表单内容 - .timeout(20000)//超时,毫秒 - .execute().body(); - logger.info("U8C委外入库推送结束,返回参数:" + result); - long endLong = System.currentTimeMillis(); - logger.info("U8C委外入库推送耗时:" + (endLong - startLong)); - - if (result == null) { - result = ""; - } - - JSONObject jsonObject = JSON.parseObject(result); - result = String.valueOf(jsonObject.get("attribute")); - - boolean isSuccess = false; - IcGeneralHResultDto icGeneralHResultDto = null; - if (result != null && !"".equals(result)) { - ReusltStrDto reusltStrDto = JSON.parseObject(result, ReusltStrDto.class); - if ("success".equals(reusltStrDto.getStatus())) { - icGeneralHResultDto = resultDataHandle(reusltStrDto.getData()); - isSuccess = true; - } - } - if (!isSuccess) { - Assert.state(false, "O采购入库业务推送U8C委外入库失败 接口返回结果:{}", result); - } - return icGeneralHResultDto; - } - - /** - * 返回结果解析处理,在确认了success后调用 - * - * @author liuyang - */ - private IcGeneralHResultDto resultDataHandle(String resultData) { - try { - if (resultData != null && !"".equals(resultData)) { - if (resultData.contains("[")) { - resultData = resultData.substring(1, resultData.length() - 1); - } - return JSON.parseObject(resultData, IcGeneralHResultDto.class); - } - } catch (Exception e) { - logger.error("resultDataHandle方法解析返回参数失败的错误", e); - //如果解析失败,记录原因,但是不能影响结果的记录 - } - return null; - } -} \ No newline at end of file diff --git a/buildpackage/src/main/java/com/hzya/frame/plugin/lets/plugin/outsourc/ConsignmachiningInOrderReturn.txt b/buildpackage/src/main/java/com/hzya/frame/plugin/lets/plugin/outsourc/ConsignmachiningInOrderReturn.txt deleted file mode 100644 index dc176162..00000000 --- a/buildpackage/src/main/java/com/hzya/frame/plugin/lets/plugin/outsourc/ConsignmachiningInOrderReturn.txt +++ /dev/null @@ -1,767 +0,0 @@ -//package com.hzya.frame.plugin.lets.plugin.outsourc; -// -//import cn.hutool.core.date.DateUtil; -//import cn.hutool.core.lang.Assert; -//import cn.hutool.core.util.StrUtil; -//import cn.hutool.http.HttpRequest; -//import com.alibaba.fastjson.JSON; -//import com.alibaba.fastjson.JSONObject; -//import com.hzya.frame.base.PluginBaseEntity; -//import com.hzya.frame.beanutil.BeanUtil; -//import com.hzya.frame.plugin.lets.constant.ProfilesActiveConstant; -//import com.hzya.frame.plugin.lets.dao.*; -//import com.hzya.frame.plugin.lets.entity.*; -//import com.hzya.frame.plugin.lets.ofsvo.QueryOfsSoSaleOutVo; -//import com.hzya.frame.plugin.lets.u8cdto.*; -//import com.hzya.frame.plugin.lets.util.*; -//import com.hzya.frame.ttxofs.dto.ofspurchasereturnorder.PurchaseReturnOrder; -//import com.hzya.frame.ttxofs.dto.ofspurchasereturnorder.PurchaseReturnOrderDetails; -//import com.hzya.frame.ttxofs.dto.ofspurchasereturnorder.PurchaseReturnOrderHeader; -//import com.hzya.frame.ttxofs.dto.ofssaleorderoutsearch.DetailsDto; -//import com.hzya.frame.ttxofs.dto.ofssaleorderoutsearch.HeaderDetailsDto; -//import com.hzya.frame.ttxofs.dto.ofssaleorderoutsearch.HeaderDto; -//import com.hzya.frame.web.entity.JsonResultEntity; -//import org.slf4j.Logger; -//import org.slf4j.LoggerFactory; -//import org.springframework.beans.factory.annotation.Autowired; -// -//import java.math.BigDecimal; -//import java.util.*; -// -///** -// * O采退订单 -> U8C红字委外订单 -// * -// * @Author:liuyang -// * @Package:com.hzya.frame.plugin.lets.plugin.outsourc -// * @Project:kangarooDataCenterV3 -// * @name:ConsignmachiningIn -// * @Date:2024年8月26日 15:34:34 -// * @Filename:ConsignmachiningIn -// */ -//public class ConsignmachiningInOrderReturn extends PluginBaseEntity { -// -// Logger logger = LoggerFactory.getLogger(ConsignmachiningInOrderReturn.class); -// -// @Autowired -// private QueryBdBusitypeUtil queryBdBusitypeUtil; -// -// @Autowired -// private IBdCorpDao iBdCorpDao; -// -// @Autowired -// private IBdInvmandocDao iBdInvmandocDao; -// -// @Autowired -// private IBdCalbodyDao iBdCalbodyDao; -// -// @Autowired -// private RdclUtil rdclUtil; -// -// @Autowired -// private OfsStandardUtil ofsStandardUtil; -// -// @Autowired -// private IBdCumandocDao iBdCumandocDao; -// -// @Autowired -// private IBdCubasdocDao iBdCubasdocDao; -// -// @Autowired -// private IBdPurorgDao iBdPurorgDao; -// -// @Autowired -// private OnlyImplementProxyOrderUtil onlyImplementProxyOrder; -// -// @Override -// public void initialize() { -// logger.info(getPluginLabel() + "執行初始化方法initialize()"); -// } -// -// @Override -// public void destroy() { -// logger.info(getPluginLabel() + "執行銷毀方法destroy()"); -// } -// -// @Override -// public String getPluginId() { -// return "com.hzya.frame.plugin.lets.plugin.outsourc.ConsignmachiningInReturn"; -// } -// -// @Override -// public String getPluginName() { -// return "OFS采退出库单生成U8C红字委外入库单"; -// } -// -// @Override -// public String getPluginLabel() { -// return "OFS采退出库单生成U8C红字委外入库单"; -// } -// -// @Override -// public String getPluginType() { -// return "3"; -// } -// -// @Override -// public JsonResultEntity executeBusiness(JSONObject requestJson) throws Exception { -// return null; -// } -// -// /** -// * 根据单号查询 -// * -// * @author liuyang -// */ -// public void startImplement(String startTime, String endTime) { -// String threadNameStrStart = StrUtil.format("开始(委外采退)OFS采退出库单生成U8红字C委外订单 开始时间:{} 结束时间:{}", startTime, endTime); -// logger.info(threadNameStrStart); -// -// Thread thread = new Thread(new Runnable() { -// @Override -// public void run() { -// try { -// //OFS采退出库 -// List returnGoodHeaderDetailsDataDtoArrayList = new ArrayList<>(); -// QueryOfsSoSaleOutVo queryOfsSoSaleOutVo = new QueryOfsSoSaleOutVo(); -// queryOfsSoSaleOutVo.setClosedAt_start(startTime); -// queryOfsSoSaleOutVo.setClosedAt_end(endTime); -// queryOfsSoSaleOutVo.setClientCode("LETS"); -// queryOfsSoSaleOutVo.setPageNo(1L); -// queryOfsSoSaleOutVo.setPageSize(50L); -// queryOfsSoSaleOutVo.setInternalInstructionType("PURCHASE_RETURN"); -// queryOfsSoSaleOutVo.setStatus(900L); -// ofsStandardUtil.queryOfsSaleOrder(queryOfsSoSaleOutVo, returnGoodHeaderDetailsDataDtoArrayList, 1L, "ofs.shipment.search"); -// logger.info("数据返回行数:{}", returnGoodHeaderDetailsDataDtoArrayList.size()); -// if (returnGoodHeaderDetailsDataDtoArrayList.size() > 0) { -// getSet(returnGoodHeaderDetailsDataDtoArrayList); -// } else { -// logger.info("没有查询到任何数据!不需要发起同步逻辑!!"); -// } -// } catch (Exception e) { -// logger.error("startImplement方法抛出异常", e); -// } -// } -// }, threadNameStrStart); -// thread.start(); -// try { -// thread.join(); -// } catch (Exception e) { -// logger.error("thread.join()异常", e); -// } -// String threadNameStrEnd = StrUtil.format("结束(委外采退)OFS采退出库单生成U8红字C委外订单 开始时间:{} 结束时间:{}", startTime, endTime); -// logger.info(threadNameStrEnd); -// } -// -// /** -// * 根据单号查询 -// * -// * @author liuyang -// */ -// public void startImplement(String code) { -// String threadNameStrStart = StrUtil.format("开始(委外采退)OFS采退出库单生成U8红字C委外订单 OFS采购入库单号:{}", code); -// logger.info(threadNameStrStart); -// -// Thread thread = new Thread(new Runnable() { -// @Override -// public void run() { -// try { -// List returnGoodHeaderDetailsDataDtoArrayList = new ArrayList<>(); -// QueryOfsSoSaleOutVo queryOfsSoSaleOutVo = new QueryOfsSoSaleOutVo(); -// queryOfsSoSaleOutVo.setClientCode("LETS"); -// queryOfsSoSaleOutVo.setPageNo(1L); -// queryOfsSoSaleOutVo.setPageSize(50L); -// queryOfsSoSaleOutVo.setCode(code); -// queryOfsSoSaleOutVo.setInternalInstructionType("PURCHASE_RETURN"); -// queryOfsSoSaleOutVo.setStatus(900L); -// ofsStandardUtil.queryOfsSaleOrder(queryOfsSoSaleOutVo, returnGoodHeaderDetailsDataDtoArrayList, 1L, "ofs.shipment.search"); -// logger.info("数据返回行数:{}", returnGoodHeaderDetailsDataDtoArrayList.size()); -// if (returnGoodHeaderDetailsDataDtoArrayList.size() > 0) { -// getSet(returnGoodHeaderDetailsDataDtoArrayList); -// } else { -// logger.info("没有查询到任何数据!不需要发起同步逻辑!!"); -// } -// } catch (Exception e) { -// logger.error("startImplement方法抛出异常", e); -// } -// } -// }, threadNameStrStart); -// thread.start(); -// try { -// thread.join(); -// } catch (Exception e) { -// logger.error("thread.join()异常", e); -// } -// String threadNameStrEnd = StrUtil.format("结束(委外采退)OFS采退出库单生成U8红字C委外订单 OFS采购入库单号:{}", code); -// logger.info(threadNameStrEnd); -// } -// -// /** -// * 环境预配置 -// * -// * @param returnGoodHeaderDetailsDataDtoArrayList 采退出库单 -// * @author liuyang -// */ -// private void getSet(List returnGoodHeaderDetailsDataDtoArrayList) throws Exception { -// //过滤成功的数据 -// List headerDetailsDtos = filterData(returnGoodHeaderDetailsDataDtoArrayList); -// //执行推送主逻辑 -// implement(headerDetailsDtos); -// } -// -// /** -// * 过滤掉成功的数据 -// * -// * @author liuyang -// */ -// private List filterData(List returnGoodHeaderDetailsDataDtoArrayList) { -// List headerDetailsDtoList1 = new ArrayList<>(); -// if (returnGoodHeaderDetailsDataDtoArrayList != null && returnGoodHeaderDetailsDataDtoArrayList.size() > 0) { -// //TODO 出库单明细主键,需要O返回,目前没有,已经提需求 -// headerDetailsDtoList1.addAll(returnGoodHeaderDetailsDataDtoArrayList); -// } -// return headerDetailsDtoList1; -// } -// -// /** -// * 执行主逻辑 -// * -// * @author liuyang -// */ -// private void implement(List headerDetailsDtos) throws Exception { -// if (headerDetailsDtos != null && headerDetailsDtos.size() > 0) { -// try { -// // 查询基本档案 -// List returnOrderHeaderDtos = queryBasicArchives(headerDetailsDtos); -// // 查询采购收发类别 -// BdRdclEntity bdRdclEntity = rdclUtil.queryRdClObject("105"); -// -// if (returnOrderHeaderDtos != null && returnOrderHeaderDtos.size() > 0) { -// for (int i = 0; i < returnOrderHeaderDtos.size(); i++) { -// ReturnOrderHeaderDto returnOrderHeaderDto = returnOrderHeaderDtos.get(i); -// List details = returnOrderHeaderDto.getDetails(); -// -// String generateBusinessDate = createGenerateBusinessDate(returnOrderHeaderDto); //生成业务日期 -// PurchaseReturnOrder purchaseReturnOrder = returnOrderHeaderDto.getPurchaseReturnOrder();//OFS采退订单 -// PurchaseReturnOrderHeader header = purchaseReturnOrder.getHeader(); -// List details2 = purchaseReturnOrder.getDetails(); -// BdCorpEntity bdCorpEntity = returnOrderHeaderDto.getBdCorpEntity();//公司 -// BdCalbodyEntity bdCalbodyEntity = returnOrderHeaderDto.getBdCalbodyEntity();//库存组织 -// BdCubasdocEntity bdCubasdocEntity = returnOrderHeaderDto.getBdCubasdocEntity();//供应商基本档案 -// BdCumandocEntity bdCumandocEntity = returnOrderHeaderDto.getBdCumandocEntity();//供应商管理档案 -// BdPurorgEntity bdPurorgEntity = returnOrderHeaderDto.getBdPurorgEntity();//采购组织 -// BdBusitypeEntity bdBusitypeEntity1 = returnOrderHeaderDto.getBdBusitypeEntity();//业务流程 -// List details1 = returnOrderHeaderDto.getDetails();//OFS采退出库单明细行 -// -// //委外订单 -// ScorderHeadDto scorderHeadDto = new ScorderHeadDto(); -// scorderHeadDto.setPk_corp(bdCorpEntity.getPkCorp()); -// scorderHeadDto.setCbiztype(bdBusitypeEntity1.getPkBusitype()); -// scorderHeadDto.setCoperator(OverallConstant.getOverAllValue("u8cApiZdrPK")); -// scorderHeadDto.setCpurorganization(bdPurorgEntity.getPkPurorg()); -// scorderHeadDto.setCvendormangid(bdCumandocEntity.getPkCumandoc()); -// scorderHeadDto.setCwareid(bdCalbodyEntity.getPkCalbody()); -// scorderHeadDto.setDorderdate(generateBusinessDate); -// -// scorderHeadDto.setVdef3(bdRdclEntity.getPkRdcl()); -// scorderHeadDto.setVdef17(ProfilesActiveConstant.sourceSystem1); -// scorderHeadDto.setVdef19(returnOrderHeaderDto.getCode()); -// scorderHeadDto.setVdef20(returnOrderHeaderDto.getId()); -// -// //委外入库表头明细行 -// List scorderBodyDtoArrayList = new ArrayList<>(); -// for (int j = 0; j < details.size(); j++) { -// DetailsDto detailsDto = details.get(j); -// //查询存货管理档案 -// BdInvmandocEntity bdInvmandocEntity = queryInventoryMan(detailsDto, bdCorpEntity.getPkCorp()); -// //根据存货基础档案编码,查询当前存货的税率 -// BdTaxitemsEntity bdTaxitemsEntity1 = queryBdTaxitems(bdInvmandocEntity.getInvcode()); -// //查找OFS采购订单明细行 -// PurchaseReturnOrderDetails ofsPoOrderDetail = findOfsPoOrderDetail(details2, detailsDto); -// -// String receivedQty = detailsDto.getShipQty();//实发数量 -// String fulfillAmount = ofsPoOrderDetail.getFulfillAmount();//实际进价 -// -// String tax = "0." + new BigDecimal(bdTaxitemsEntity1.getTaxratio()).stripTrailingZeros().toPlainString(); -// BigDecimal noriginalcurtaxprice = null;//含税单价 -// BigDecimal noriginalnetprice = null;//无税单价 -// try { -// noriginalcurtaxprice = new BigDecimal(fulfillAmount).divide(new BigDecimal(receivedQty), 20, BigDecimal.ROUND_HALF_UP).setScale(4, BigDecimal.ROUND_HALF_UP); -// noriginalnetprice = noriginalcurtaxprice.divide(new BigDecimal(1).add(new BigDecimal(tax)), 20, BigDecimal.ROUND_HALF_UP).setScale(4, BigDecimal.ROUND_HALF_UP); -// logger.info("O采退订单单号:{} O采购入库单单号:{} 含税单价:{} 无税单价:{} 存货编码:{} 存货名称:{}", header.getCode(), returnOrderHeaderDto.getCode(), noriginalcurtaxprice, noriginalnetprice, detailsDto.getSkuCode(), detailsDto.getSkuName()); -// } catch (Exception e) { -// logger.error("委外订单无税单价", e); -// } -// -// ScorderBodyDto scorderBodyDto = new ScorderBodyDto(); -// scorderBodyDto.setCmangid(bdInvmandocEntity.getPkInvmandoc());//加工品 -// scorderBodyDto.setNordernum("-" + new BigDecimal(detailsDto.getShipQty()).stripTrailingZeros().toPlainString());//数量 -// scorderBodyDto.setNoriginalnetprice(noriginalnetprice.stripTrailingZeros().toPlainString());//净单价(无税) -// scorderBodyDto.setDplanarrvdate(generateBusinessDate); -// scorderBodyDtoArrayList.add(scorderBodyDto); -// } -// -// List scorderDtoArrayList = new ArrayList<>(); -// ScorderDto scorderDto = new ScorderDto(); -// scorderDto.setParentvo(scorderHeadDto); -// scorderDto.setChildrenvo(scorderBodyDtoArrayList); -// scorderDtoArrayList.add(scorderDto); -// -// Map> stringStringMap = new HashMap<>(); -// stringStringMap.put("OrderVO", scorderDtoArrayList); -// -// IcGeneralHResultDto icGeneralHResultDto = sendU8cScorder(JSON.toJSONString(stringStringMap)); -// -// String cgeneralhid = null; -// String vbillcode = null; -// IcGeneralHResultHeadDto parentvo = icGeneralHResultDto.getParentvo(); -// List childrenvo = icGeneralHResultDto.getChildrenvo(); -// if (parentvo != null) { -// cgeneralhid = parentvo.getCgeneralhid(); -// } -// if (childrenvo != null) { -// vbillcode = parentvo.getVbillcode(); -// } -// logger.info("推送U8C委外订单成功!委外入库单主键:{} 委外入库单编码:{}", cgeneralhid, vbillcode); -// -// //生成委外入库单红字,引用上述的委外订单 -// -// } -// } else { -// logger.info("returnOrderHeaderDtos.size为0!"); -// } -// } catch (Exception e) { -// logger.error("implement方法抛出异常", e); -// } -// } -// } -// -// /** -// * 档案转换(OFS->U8C) -// * 2024年8月23日 12:02:47 和妮姐沟通,单据流程U8C成品委外订单 -> 备料计划 -> U8C委外发料(核销) -// * -// * @author liuyang -// */ -// private List queryBasicArchives(List headerDetailsDtos) { -// List returnOrderHeaderDtoArrayList = new ArrayList<>(); -// -// if (headerDetailsDtos != null && headerDetailsDtos.size() > 0) { -// try { -// for (int i = 0; i < headerDetailsDtos.size(); i++) { -// HeaderDetailsDto headerDetailsDto = headerDetailsDtos.get(i); -// HeaderDto header = headerDetailsDto.getHeader(); -// List details = headerDetailsDto.getDetails(); -// -// //2024年8月25日 09:54:31 查询OFS采退订单 -// PurchaseReturnOrder purchaseReturnOrder = queryPurchaseReturnOrder(header.getRefOrderCode()); -// Assert.notNull(purchaseReturnOrder, "无法查询到采退订单 refOrderCode:{}", header.getRefOrderCode()); -// PurchaseReturnOrderHeader ofsWithdrawalHead = purchaseReturnOrder.getHeader(); -// List ofsWithdrawalDetails = purchaseReturnOrder.getDetails(); -// -// //如果该O采购订单对应的类型为:委外加工,则继续代码逻辑,否则就跳过代码逻辑 -// boolean checkResult = onlyImplementProxyOrder.onlyImplementProxyOrder(purchaseReturnOrder, "WWJG"); -// if (!checkResult) { -// continue; -// } -// -// //2024年8月26日 16:08:05 委外订单对应的公司 -// String companyCode = header.getCompanyCode(); -// Assert.notNull(companyCode, "O表头货主编码不能为空"); -// BdCorpEntity bdCorpEntity = new BdCorpEntity(); -// bdCorpEntity.setDr(0); -// bdCorpEntity.setDataSourceCode("lets_u8c"); -// bdCorpEntity.setUnitcode(companyCode); -// List bdCorpEntityList = iBdCorpDao.query(bdCorpEntity); -// if (bdCorpEntityList.size() == 0) { -// Assert.state(false, "根据O货主编码{},无法匹配到U8C销售公司", companyCode); -// } else if (bdCorpEntityList.size() >= 2) { -// Assert.state(false, "根据O货主编码{},匹配到U8C销售公司{}个", companyCode, bdCorpEntityList.size()); -// } -// -// // 2024年8月26日 16:10:00 公司对应的库存组织 -// BdCalbodyEntity bdCalbodyEntity = new BdCalbodyEntity(); -// bdCalbodyEntity.setDr(0); -// bdCalbodyEntity.setDataSourceCode("lets_u8c"); -// bdCalbodyEntity.setPkCorp(bdCorpEntityList.get(0).getPkCorp()); -// List bdCalbodyEntities = iBdCalbodyDao.query(bdCalbodyEntity); -// if (bdCalbodyEntities.size() == 0) { -// Assert.state(false, "根据U8C采购公司{},无法匹配到U8C发货库存组织", bdCorpEntityList.get(0).getPkCorp()); -// } else if (bdCalbodyEntities.size() >= 2) { -// Assert.state(false, "根据U8C采购公司{},匹配到U8C发货库存组织{}个", bdCorpEntityList.get(0).getPkCorp(), bdCalbodyEntities.size()); -// } -// -// //2024年8月26日 16:11:24 供应商基本档案 -// String shipFromCode = ofsWithdrawalHead.getShipFromCode(); -// Assert.notNull(shipFromCode, "O供应商编码不能为空,没有办法完成业务逻辑,请配置供应商编码(采退)"); -// Assert.state(!"".equals(shipFromCode.trim()), "O供应商编码不能为空,没有办法完成业务逻辑,请配置供应商编码!"); -// BdCubasdocEntity bdCubasdocEntity = new BdCubasdocEntity(); -// bdCubasdocEntity.setDataSourceCode("lets_u8c"); -// bdCubasdocEntity.setDr(0L); -// bdCubasdocEntity.setDef1(shipFromCode); -// List bdCubasdocEntityList = iBdCubasdocDao.query(bdCubasdocEntity); -// if (bdCubasdocEntityList == null || bdCubasdocEntityList.size() == 0) { -// Assert.state(false, "根据OFS供应商业务编码{},无法查询到U8C客商档案信息(供应商)", shipFromCode); -// } else if (bdCubasdocEntityList.size() >= 2) { -// Assert.state(false, "根据OFS供应商业务编码{},查询到多个U8C客商档案信息(供应商)", shipFromCode); -// } -// -// //客商管理档案 -// BdCumandocEntity bdCumandocEntity1 = new BdCumandocEntity(); -// bdCumandocEntity1.setDataSourceCode("lets_u8c"); -// bdCumandocEntity1.setDr(0L); -// bdCumandocEntity1.setPkCorp(bdCorpEntityList.get(0).getPkCorp()); -// bdCumandocEntity1.setCustflags(ProfilesActiveConstant.SUPPLIER); -// bdCumandocEntity1.setPkCubasdoc(bdCubasdocEntityList.get(0).getPkCubasdoc()); -// List bdCumandocEntityList = iBdCumandocDao.query(bdCumandocEntity1); -// if (bdCumandocEntityList == null || bdCumandocEntityList.size() == 0) { -// Assert.state(false, "根据客商基本档案(供应商)主键{},无法匹配到客商管理档案", bdCubasdocEntityList.get(0).getPkCubasdoc()); -// } else if (bdCumandocEntityList.size() >= 2) { -// Assert.state(false, "根据客商基本档案(供应商)主键{},匹配到多个客商管理档案", bdCubasdocEntityList.get(0).getPkCubasdoc()); -// } -// -// // 采购组织 -// BdPurorgEntity bdPurorgEntity = new BdPurorgEntity(); -// bdPurorgEntity.setDr("0"); -// bdPurorgEntity.setDataSourceCode("lets_u8c"); -// bdPurorgEntity.setOwnercorp(bdCorpEntityList.get(0).getPkCorp()); -// List bdPurorgEntityList = iBdPurorgDao.query(bdPurorgEntity); -// if (bdPurorgEntityList.size() == 0) { -// Assert.state(false, "根据采购公司主键:{} 无法匹配到采购组织", bdCorpEntityList.get(0).getPkCorp()); -// } else if (bdPurorgEntityList.size() >= 2) { -// Assert.state(false, "根据采购公司主键:{} 匹配到多个采购组织", bdCorpEntityList.get(0).getPkCorp()); -// } -// -// //业务流程 -// String busitypeName = "委外加工"; -// BdBusitypeEntity bdBusitypeEntity = queryBdBusitypeUtil.queryBdBusitype(busitypeName, bdCalbodyEntities.get(0).getPkCorp()); -// Assert.notNull(bdBusitypeEntity, "根据业务名称{} 公司:{},无法匹配到U8C业务类型", busitypeName, bdCalbodyEntities.get(0).getPkCorp()); -// -// ReturnOrderHeaderDto returnOrderHeaderDto = new ReturnOrderHeaderDto(); -// returnOrderHeaderDto.setPurchaseReturnOrder(purchaseReturnOrder); -// returnOrderHeaderDto.setBdCorpEntity(bdCorpEntityList.get(0)); -// returnOrderHeaderDto.setBdCalbodyEntity(bdCalbodyEntities.get(0)); -// returnOrderHeaderDto.setBdCubasdocEntity(bdCubasdocEntityList.get(0)); -// returnOrderHeaderDto.setBdCumandocEntity(bdCumandocEntityList.get(0)); -// returnOrderHeaderDto.setBdPurorgEntity(bdPurorgEntityList.get(0)); -// returnOrderHeaderDto.setBdBusitypeEntity(bdBusitypeEntity); -// -// BeanUtil.copyPropertiesV2(header, returnOrderHeaderDto); -// returnOrderHeaderDtoArrayList.add(returnOrderHeaderDto); -// } -// //成功 -// } catch (Exception e) { -// logger.error("委外订单OFS档案转换", e); -// //失败 -// } -// } else { -// logger.info("queryBasicArchives对应returnGoodHeaderDetailsDataDtoList.size为0"); -// } -// return returnOrderHeaderDtoArrayList; -// } -// -// /** -// * 查询委外订单表头对象 -// * -// * @author liuyang -// */ -//// private ScOrderEntity queryScOrder(String ofsPoOrderId) { -//// Assert.notNull(ofsPoOrderId, "ofsPoOrderId不能为空!"); -//// Assert.state(!"".equals(ofsPoOrderId.trim()), "ofsPoOrderId不能为空"); -//// -//// ScOrderEntity scOrderEntity = new ScOrderEntity(); -//// scOrderEntity.setVdef20(ofsPoOrderId); -//// scOrderEntity.setDr("0"); -//// scOrderEntity.setDataSourceCode("lets_u8c"); -//// List scOrderEntityList = iScOrderDao.query(scOrderEntity); -//// if (scOrderEntityList == null || scOrderEntityList.size() == 0) { -//// Assert.state(false, "根据O采购订单主键:{}(u委外订单自定义项20存储O采购订单主键),无法匹配到U8C委外订单", ofsPoOrderId); -//// } else if (scOrderEntityList.size() >= 2) { -//// Assert.state(false, "根据O采购订单主键:{}(u委外订单自定义项20存储O采购订单主键),匹配到{}个U8C委外订单", ofsPoOrderId, scOrderEntityList.size()); -//// } -//// return scOrderEntityList.get(0); -//// } -// -// /** -// * 2024年8月25日 14:11:31 查询U8C委外订单明细 -// * -// * @param corderid 委外订单表头主键 -// * @author liuyang -// */ -//// private List queryScOrderDetail(String corderid) throws Exception { -//// Assert.notNull(corderid, "委外订单表头主键不能为空!"); -//// Assert.state(!"".equals(corderid), "委外订单表头主键不能为空!"); -//// -//// ScOrderBEntity scOrderBEntity = new ScOrderBEntity(); -//// scOrderBEntity.setCorderid(corderid); -//// scOrderBEntity.setDr("0"); -//// scOrderBEntity.setDataSourceCode("lets_u8c"); -//// List scOrderBEntityList = iScOrderBDao.query(scOrderBEntity); -//// if (scOrderBEntityList == null || scOrderBEntityList.size() == 0) { -//// //2024年8月25日 14:16:31 这个验证非常要必要,单据如果没有表体没有行,是很可疑的 -//// Assert.state(false, "根据U8C委外订单主键({})无法查询到委外订单表体明细行!", corderid); -//// } -//// return scOrderBEntityList; -//// } -// -// /** -// * 2024年8月6日 10:59:03 查询U8C业务流程 -// * -// * @param pkCorp 公司主键 -// * @author liuyang -// */ -//// private BdBusitypeEntity u8cOperationFlow(String pkCorp) throws Exception { -//// Assert.notNull(pkCorp, "公司主键不能为空!"); -//// Assert.state(!"".equals(pkCorp.trim()), "公司主键不能为空!"); -//// //查询业务流程 -//// //2024年8月6日 11:33:07 具体的业务流程名称,还需要实施提供 -//// String processName = "委外加工"; -//// BdBusitypeEntity bdBusitypeEntity = queryBdBusitypeUtil.queryBdBusitype(processName, pkCorp); -//// Assert.notNull(bdBusitypeEntity, "根据业务流程名称({})没有查询到业务流程", processName); -//// return bdBusitypeEntity; -//// } -// -// /** -// * 匹配U8C采购订单明细行 -// * 通过O采购入库单明细行,得到采购订单明细行,最后查找到U8C采购订单明细行 -// * -// * @param stockinB OFS采购入库单明细行 -// * @param ofsPoOrderData OFS采购订单 -// * @param scOrderBEntityList U8C委外订单明细行 -// * @author liuyang -// */ -//// private ScOrderBEntity findOfsPoOrderDetailAndU8cPoOrderDetail(StockinOrderSearchResponse.StockinOrder.StockinB stockinB, OfsPoOrderData ofsPoOrderData, List scOrderBEntityList) { -//// Assert.notNull(stockinB, "stockinB不能为空"); -//// Assert.notNull(ofsPoOrderData, "ofsPoOrderData不能为空"); -//// Assert.notNull(scOrderBEntityList, "scOrderBEntityList删除不能为空"); -//// -////// OfsPoOrderHeader header = ofsPoOrderData.getHeader(); -//// List details = ofsPoOrderData.getDetails(); -//// -//// //查找采购订单明细行 -//// OfsPoOrderDetails tarGetOfsPoOrderDetails = null; -//// for (int i = 0; i < details.size(); i++) { -//// OfsPoOrderDetails ofsPoOrderDetails = details.get(i); -//// if (ofsPoOrderDetails.getId().equals(stockinB.getRefOrderDetailId())) { -//// tarGetOfsPoOrderDetails = ofsPoOrderDetails; -//// } -//// } -//// Assert.notNull(tarGetOfsPoOrderDetails, "无法匹配到采购订单明细行! 目标主键:{}", stockinB.getRefOrderDetailId()); -//// -//// //根据采购订单明细行主键,查找U8C采购订单明细行 -//// for (int i = 0; i < scOrderBEntityList.size(); i++) { -//// ScOrderBEntity scOrderBEntity = scOrderBEntityList.get(i); -//// Assert.notNull(scOrderBEntity.getVdef20(), "委外订单明细行v20不能为空(明细行v20存储O采购订单明细行主键)!"); -//// Assert.state(!"".equals(scOrderBEntity.getVdef20()), "委外订单明细行v20不能为空(明细行v20存储O采购订单明细行主键)!"); -//// if (tarGetOfsPoOrderDetails.getId().equals(scOrderBEntity.getVdef20())) { -//// return scOrderBEntity; -//// } -//// } -//// Assert.state(false, "通过U8C采购订单明细行主键层层匹配到U8C采购明细失败!"); -//// return null; -//// } -// -// -// /** -// * 匹配U8C采购订单明细行 -// * 通过O采购入库单明细行,得到采购订单明细行,最后查找到U8C采购订单明细行 -// * -// * @param stockinB OFS采购入库单明细行 -// * @param ofsPoOrderData OFS采购订单 -// * @author liuyang -// */ -//// private OfsPoOrderDetails findOfsPoOrderDetailRowTraget(StockinOrderSearchResponse.StockinOrder.StockinB stockinB, OfsPoOrderData ofsPoOrderData) { -//// Assert.notNull(stockinB, "stockinB不能为空"); -//// Assert.notNull(ofsPoOrderData, "ofsPoOrderData不能为空"); -//// -//// List details = ofsPoOrderData.getDetails(); -//// for (int i = 0; i < details.size(); i++) { -//// OfsPoOrderDetails ofsPoOrderDetails = details.get(i); -//// if (ofsPoOrderDetails.getId().equals(stockinB.getRefOrderDetailId())) { -//// return ofsPoOrderDetails; -//// } -//// } -//// Assert.state(false, "通过OFS采购入库单,无法匹配到OFS采购订单明细行! 目标主键:{}", stockinB.getRefOrderDetailId()); -//// return null; -//// } -// -// /** -// * 查询存货管理档案 -// * -// * @param pkCorp 发货公司主键 -// * @param detailsDto 采购入库单明细行 -// * @author liuyang -// */ -// private BdInvmandocEntity queryInventoryMan(DetailsDto detailsDto, String pkCorp) throws Exception { -// Assert.notNull(detailsDto, "sonDetailsDto不能为空"); -// Assert.notNull(detailsDto.getSkuCode(), "O存货商家编码不能为空"); -// Assert.notNull(pkCorp, "发货公司主键不能为空"); -// -// BdInvmandocEntity bdInvmandocEntity = new BdInvmandocEntity(); -// bdInvmandocEntity.setInvcode(detailsDto.getSkuCode()); -// bdInvmandocEntity.setPkCorp(pkCorp); -// List bdInvmandocEntity2 = iBdInvmandocDao.queryBdInvmandocByInvcodeList(bdInvmandocEntity); -// if (bdInvmandocEntity2.size() == 0) { -// Assert.state(false, "根据O商家编码:{} U8C发货公司主键:{}没有查询到存货管理档案", detailsDto.getSkuCode(), pkCorp); -// } else if (bdInvmandocEntity2.size() >= 2) { -// Assert.state(false, "根据O商家编码:{} U8C发货公司主键:{}没有查询到存货管理档案", detailsDto.getSkuCode(), pkCorp); -// } -// return bdInvmandocEntity2.get(0); -// } -// -// /** -// * 2024年8月25日 15:12:22 -// * 推送U8C委外订单 -// * -// * @param param 原数据json -// * @author liuyang -// */ -// public IcGeneralHResultDto sendU8cScorder(String param) throws Exception { -// long startLong = System.currentTimeMillis(); -// logger.info("U8C委外订单推送开始,推送参数:" + param + ",U8C_URL:" + ProfilesActiveConstant.U8C_URL); -// String result = HttpRequest.post(ProfilesActiveConstant.U8C_URL).header("appId", "800037")//头信息,多个头信息多次调用此方法即可 -// .header("usercode", "admin").header("password", "21232f297a57a5a743894a0e4a801fc3").header("system", "lz").header("trantype", "PK").header("apiCode", "8000370037")//头信息,多个头信息多次调用此方法即可 -// .header("publicKey", "ZJYAWb7lhAUTYqekPkU+uHJv1/ObJxb7dT7sD8HPRDGAgyhCe7eDIk+3zDUT+v578prj")//头信息,多个头信息多次调用此方法即可 -// .header("secretKey", "fviZnLBsQUAGF8w8FSOdJi7XlIm/XAZclMxRagDLfTyJFlvnIBF3w66Hrpfzs8cYj3JzOP8MtA1LSGvL+2BWG8c/o7DKi92S4mr3zcGearA=")//头信息,多个头信息多次调用此方法即可 -// .body(param)//表单内容 -// .timeout(20000)//超时,毫秒 -// .execute().body(); -// logger.info("U8C委外订单推送结束,返回参数:" + result); -// long endLong = System.currentTimeMillis(); -// logger.info("U8C委外订单推送耗时:" + (endLong - startLong)); -// -// if (result == null) { -// result = ""; -// } -// -// JSONObject jsonObject = JSON.parseObject(result); -// result = String.valueOf(jsonObject.get("attribute")); -// -// boolean isSuccess = false; -// IcGeneralHResultDto icGeneralHResultDto = null; -// if (result != null && !"".equals(result)) { -// ReusltStrDto reusltStrDto = JSON.parseObject(result, ReusltStrDto.class); -// if ("success".equals(reusltStrDto.getStatus())) { -// icGeneralHResultDto = resultDataHandle(reusltStrDto.getData()); -// isSuccess = true; -// } -// } -// if (!isSuccess) { -// Assert.state(false, "O采购入库业务推送U8C委外订单失败 接口返回结果:{}", result); -// } -// return icGeneralHResultDto; -// } -// -// /** -// * 返回结果解析处理,在确认了success后调用 -// * -// * @author liuyang -// */ -// private IcGeneralHResultDto resultDataHandle(String resultData) { -// try { -// if (resultData != null && !"".equals(resultData)) { -// if (resultData.contains("[")) { -// resultData = resultData.substring(1, resultData.length() - 1); -// } -// return JSON.parseObject(resultData, IcGeneralHResultDto.class); -// } -// } catch (Exception e) { -// logger.error("resultDataHandle方法解析返回参数失败的错误", e); -// //如果解析失败,记录原因,但是不能影响结果的记录 -// } -// return null; -// } -// -// /** -// * 查询采退订单 -// * -// * @param code 采退订单号 -// * @author liuyang -// */ -// private PurchaseReturnOrder queryPurchaseReturnOrder(String code) throws Exception { -// List headerDetailsDtoList = new ArrayList<>(); -// QueryOfsSoSaleOutVo queryOfsSoSaleOutVo = new QueryOfsSoSaleOutVo(); -// queryOfsSoSaleOutVo.setCode(code); -// queryOfsSoSaleOutVo.setClientCode("LETS"); -// queryOfsSoSaleOutVo.setPageNo(1L); -// queryOfsSoSaleOutVo.setPageSize(50L); -// ofsStandardUtil.queryPurchaseReturnOrder(queryOfsSoSaleOutVo, headerDetailsDtoList, 1L, "ofs.purchaseReturnOrder.search"); -// if (headerDetailsDtoList.size() > 0) { -// return headerDetailsDtoList.get(0); -// } -// Assert.state(false, "根据OFS采购订单号:{}无法查询到OFS采购订单信息", code); -// return null; -// } -// -// /** -// * 2024年8月20日 15:46:10 -// * 生成业务日期,以发货时间作为业务日期 -// * -// * @author liuyang -// */ -// private String createGenerateBusinessDate(ReturnOrderHeaderDto returnOrderHeaderDto) throws Exception { -// if (returnOrderHeaderDto != null && returnOrderHeaderDto.getShipAt() != null) { -// String shipAt = returnOrderHeaderDto.getShipAt(); -// String businessFormat = null; -// try { -// Date dbill = DateUtil.parse(shipAt); -// businessFormat = DateUtil.format(dbill, "yyyy-MM-dd"); -// } catch (Exception e) { -// logger.error("业务日期生成失败!", e); -// } -// return businessFormat; -// } else { -// logger.error("生成采退出库日期失败,或者shipAt为空! json:{}", JSON.toJSON(returnOrderHeaderDto)); -// Assert.state(false, "生成采退出库日期失败,或者shipAt为空! json:{}", JSON.toJSON(returnOrderHeaderDto)); -// return null; -// } -// } -// -// /** -// * 2024年8月7日 14:58:34 -// * 查询税目档案 -// * -// * @author liuyang -// */ -// private BdTaxitemsEntity queryBdTaxitems(String invcode) { -// Assert.notNull(invcode, "存货编码不能为空"); -// BdTaxitemsEntity bdTaxitemsEntity = TocOrderBasicArchivesCacheUtil.stringBdTaxitemsEntityHashMap.get(invcode); -// Assert.notNull(bdTaxitemsEntity, "根据存货编码({}),无法匹配到税率!", invcode); -// return bdTaxitemsEntity; -// } -// -// /** -// * 2024年8月20日 16:42:14 -// * 查找对应的采购订单明细行 -// * 2024年8月20日 17:42:15 -// * 应该通过明细行主键匹配,但是只能根据sku匹配目前的实现逻辑 -// * 查找OFS采购订单明细行,主要是为了带出实付金额,通过实付金额/实收数量=含税单价 -// * -// * @param ofsPoOrderDataDetails OFS采退订单明细行所有对象 -// * @param detailsDto OFS采退入库单明细行对象 -// * @author liuyang -// */ -// private PurchaseReturnOrderDetails findOfsPoOrderDetail(List ofsPoOrderDataDetails, DetailsDto detailsDto) { -// if (ofsPoOrderDataDetails != null && ofsPoOrderDataDetails.size() > 0 && detailsDto != null) { -// for (int i = 0; i < ofsPoOrderDataDetails.size(); i++) { -// Assert.notNull(ofsPoOrderDataDetails.get(i).getId(), "采退订单明细行主键不能为空!"); -// -// Assert.notNull(detailsDto.getRefOrderDetailId(), "采退出库单明细行对应的关联采退订单的明细行主键不能为空!"); -// if (ofsPoOrderDataDetails.get(i).getId().equals(detailsDto.getRefOrderDetailId())) { -// return ofsPoOrderDataDetails.get(0); -// } -// } -// } else { -// logger.error("findOfsPoOrderDetail方法对应的ofsPoOrderDataDetails不能为空!否则业务目标无法完成!"); -// } -// Assert.state(false, "无法匹配到采退订单明细行,业务逻辑无法完成!"); -// return null; -// } -// -// /** -// * 创建U8C委外入库单,并且发起推送 -// * -// * @author liuyang -// */ -// private void startCreateU8CConsignmachining() throws Exception { -// -// } -//} diff --git a/buildpackage/src/main/java/com/hzya/frame/plugin/lets/plugin/sales/SoSaleOutPluginInitializerToC.java b/buildpackage/src/main/java/com/hzya/frame/plugin/lets/plugin/sales/SoSaleOutPluginInitializerToC.java index bde7848b..440d64a7 100644 --- a/buildpackage/src/main/java/com/hzya/frame/plugin/lets/plugin/sales/SoSaleOutPluginInitializerToC.java +++ b/buildpackage/src/main/java/com/hzya/frame/plugin/lets/plugin/sales/SoSaleOutPluginInitializerToC.java @@ -904,6 +904,8 @@ public class SoSaleOutPluginInitializerToC extends PluginBaseEntity { logger.error("外层转换逻辑抛出异常", e); // 记录失败 } + } else { + logger.error("TOC库存同步,没有需要同步的数据行!"); } } @@ -1796,6 +1798,8 @@ public class SoSaleOutPluginInitializerToC extends PluginBaseEntity { logger.error("外层转换逻辑抛出异常", e); // 记录失败 } + } else { + logger.error("确认收入部分,没有需要推送到U8C的数据行!"); } }