diff --git a/buildpackage/src/main/java/com/hzya/frame/plugin/lets/ofsvo/QueryOfsSoSaleOutVo.java b/buildpackage/src/main/java/com/hzya/frame/plugin/lets/ofsvo/QueryOfsSoSaleOutVo.java index 68d3d2f9..09b3196b 100644 --- a/buildpackage/src/main/java/com/hzya/frame/plugin/lets/ofsvo/QueryOfsSoSaleOutVo.java +++ b/buildpackage/src/main/java/com/hzya/frame/plugin/lets/ofsvo/QueryOfsSoSaleOutVo.java @@ -41,4 +41,13 @@ public class QueryOfsSoSaleOutVo { private String storeCode; + //交易成功时间开始 + private String tradeSuccessAt_start; + + //交易成功时间结束 + private String tradeSuccessAt_end; + + //交易成功状态 + private String sourceOrderStatus; + } diff --git a/buildpackage/src/main/java/com/hzya/frame/plugin/lets/plugin/outsourc/ConsignmachiningInOrderReturn.java b/buildpackage/src/main/java/com/hzya/frame/plugin/lets/plugin/outsourc/ConsignmachiningInOrderReturn.java new file mode 100644 index 00000000..823d13b1 --- /dev/null +++ b/buildpackage/src/main/java/com/hzya/frame/plugin/lets/plugin/outsourc/ConsignmachiningInOrderReturn.java @@ -0,0 +1,767 @@ +//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("0001A110000000000U3D"); +// 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/outsourc/ConsignmachiningInReturn.java b/buildpackage/src/main/java/com/hzya/frame/plugin/lets/plugin/outsourc/ConsignmachiningInReturn.java index 2e8e9045..f161677c 100644 --- a/buildpackage/src/main/java/com/hzya/frame/plugin/lets/plugin/outsourc/ConsignmachiningInReturn.java +++ b/buildpackage/src/main/java/com/hzya/frame/plugin/lets/plugin/outsourc/ConsignmachiningInReturn.java @@ -1,482 +1,739 @@ -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.ofspoorder.OfsPoOrderData; -import com.hzya.frame.ttxofs.dto.ofspoorder.OfsPoOrderDetails; -import com.hzya.frame.ttxofs.dto.ofspoorder.OfsPoOrderHeader; -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.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日 15:34:34 - * @Filename:ConsignmachiningIn - */ -public class ConsignmachiningInReturn extends PluginBaseEntity { - - Logger logger = LoggerFactory.getLogger(ConsignmachiningInReturn.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; - +//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.ofspoorder.OfsPoOrderData; +//import com.hzya.frame.ttxofs.dto.ofspoorder.OfsPoOrderDetails; +//import com.hzya.frame.ttxofs.dto.ofspoorder.OfsPoOrderHeader; +//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.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日 15:34:34 +// * @Filename:ConsignmachiningIn +// */ +//public class ConsignmachiningInReturn extends PluginBaseEntity { +// +// Logger logger = LoggerFactory.getLogger(ConsignmachiningInReturn.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; +// // @Autowired // private IScOrderDao iScOrderDao; - +// // @Autowired // private IScOrderBDao iScOrderBDao; - - @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("0001A110000000000U3D"); - 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 - */ +// +// @Autowired +// private IBdStordocDao iBdStordocDao; +// +// @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 returnGoodHeaderDetailsDataDtoArrayList) throws Exception { +// if (returnGoodHeaderDetailsDataDtoArrayList != null && returnGoodHeaderDetailsDataDtoArrayList.size() > 0) { +// try { +// // 查询基本档案 +// List returnOrderHeaderDtos = queryBasicArchives(returnGoodHeaderDetailsDataDtoArrayList); +// // 查询采购收发类别 +// 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采退订单 +// ScOrderEntity scOrderEntity = returnOrderHeaderDto.getScOrderEntity();//U8C委外订单 +// BdCorpEntity bdCorpEntity = returnOrderHeaderDto.getBdCorpEntity();//公司 +// BdCalbodyEntity bdCalbodyEntity = returnOrderHeaderDto.getBdCalbodyEntity();//库存组织 +// BdStordocEntity bdStordocEntity = returnOrderHeaderDto.getBdStordocEntity();//仓库 +// +// // 代理委外入库业务流程 +// BdBusitypeEntity bdBusitypeEntity = u8cOperationFlow(bdCorpEntity.getPkCorp()); +// +// //委外入库表头 +// ConsignmachiningInHeadDto poOrderParentDto = new ConsignmachiningInHeadDto(); +// poOrderParentDto.setPk_corp(bdCorpEntity.getPkCorp()); +// poOrderParentDto.setCoperatorid("0001A110000000000U3D"); +// 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++) { +// DetailsDto detailsDto = 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++) { +// HeaderDetailsDto headerDetailsDto = returnGoodHeaderDetailsDataDtoList.get(i); +// HeaderDto header = headerDetailsDto.getHeader(); +// List details = headerDetailsDto.getDetails(); +// +// //2024年8月27日 17:14:47 查询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月27日 17:14:51 查询U8C委外订单,如果这一步报错,后续的逻辑就没有必要执行了 +// String ofsId = ofsWithdrawalHead.getId(); +// Assert.notNull(ofsId, "通过接口查询到OFS采退订单,但是没有采退订单主键(id),业务逻辑无法完成"); +// ScOrderEntity scOrderEntity = queryScOrder(ofsId); +// +// //2024年8月27日 17:14:57 根据U8C委外订单id,查询U8C委外订单表体明细行 +// List scOrderBEntityList = queryScOrderDetail(scOrderEntity.getCorderid()); +// +// //2024年8月27日 17:15:02 委外入库公司,取委外订单上的公司,已经和妮姐确认,没有必要通过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月27日 17:15:09 收货库存组织,应该是通过收货公司查询得出收货库存组织,目前收货公司和采购公司保持一致,那么就以采购公司带出!这个逻辑已经和佳妮确认 +// 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()); +// } +// +// ReturnOrderHeaderDto returnOrderHeaderDto = new ReturnOrderHeaderDto(); +// returnOrderHeaderDto.setPurchaseReturnOrder(purchaseReturnOrder); +// returnOrderHeaderDto.setScOrderEntity(scOrderEntity); +// returnOrderHeaderDto.setScOrderBEntityList(scOrderBEntityList); +// returnOrderHeaderDto.setBdCorpEntity(bdCorpEntityList.get(0)); +// returnOrderHeaderDto.setBdCalbodyEntity(bdCalbodyEntities.get(0)); +// returnOrderHeaderDto.setBdStordocEntity(bdStordocEntityList.get(0)); +// returnOrderHeaderDto.setDetails(details); +// +// BeanUtil.copyPropertiesV2(header, returnOrderHeaderDto); +// consignmachiningInSonDtoArrayList.add(returnOrderHeaderDto); +// } +// //成功 +// } 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; +//// } +// +// /** +// * 匹配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; +// } +// +// /** +// * 查询委外订单表头对象 +// * +// * @param ofsPoOrderId OFS采退订单主键 +// * @author liuyang +// */ // private ScOrderEntity queryScOrder(String ofsPoOrderId) { -// Assert.notNull(ofsPoOrderId, "ofsPoOrderId不能为空!"); -// Assert.state(!"".equals(ofsPoOrderId.trim()), "ofsPoOrderId不能为空"); +// Assert.notNull(ofsPoOrderId, "OFS采退订单主键不能为空!"); +// Assert.state(!"".equals(ofsPoOrderId.trim()), "OFS采退订单主键不能为空!"); // // ScOrderEntity scOrderEntity = new ScOrderEntity(); +// scOrderEntity.setVdef17(ProfilesActiveConstant.sourceSystem1); // scOrderEntity.setVdef20(ofsPoOrderId); // scOrderEntity.setDr("0"); // scOrderEntity.setDataSourceCode("lets_u8c"); @@ -488,13 +745,13 @@ public class ConsignmachiningInReturn extends PluginBaseEntity { // } // return scOrderEntityList.get(0); // } - - /** - * 2024年8月25日 14:11:31 查询U8C委外订单明细 - * - * @param corderid 委外订单表头主键 - * @author liuyang - */ +// +// /** +// * 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), "委外订单表头主键不能为空!"); @@ -510,13 +767,13 @@ public class ConsignmachiningInReturn extends PluginBaseEntity { // } // return scOrderBEntityList; // } - - /** - * 2024年8月6日 10:59:03 查询U8C业务流程 - * - * @param pkCorp 公司主键 - * @author liuyang - */ +// +// /** +// * 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()), "公司主键不能为空!"); @@ -527,16 +784,16 @@ public class ConsignmachiningInReturn extends PluginBaseEntity { // Assert.notNull(bdBusitypeEntity, "根据业务流程名称({})没有查询到业务流程", processName); // return bdBusitypeEntity; // } - - /** - * 匹配U8C采购订单明细行 - * 通过O采购入库单明细行,得到采购订单明细行,最后查找到U8C采购订单明细行 - * - * @param stockinB OFS采购入库单明细行 - * @param ofsPoOrderData OFS采购订单 - * @param scOrderBEntityList U8C委外订单明细行 - * @author liuyang - */ +// +// /** +// * 匹配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不能为空"); @@ -567,201 +824,4 @@ public class ConsignmachiningInReturn extends PluginBaseEntity { // 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; - } -} +//} diff --git a/buildpackage/src/main/java/com/hzya/frame/plugin/lets/plugin/purchase/ProxyPurchaseReturn.java b/buildpackage/src/main/java/com/hzya/frame/plugin/lets/plugin/purchase/ProxyPurchaseReturn.java index 8db08ad9..56bd3f96 100644 --- a/buildpackage/src/main/java/com/hzya/frame/plugin/lets/plugin/purchase/ProxyPurchaseReturn.java +++ b/buildpackage/src/main/java/com/hzya/frame/plugin/lets/plugin/purchase/ProxyPurchaseReturn.java @@ -345,7 +345,7 @@ public class ProxyPurchaseReturn extends PluginBaseEntity { //2024年8月20日 16:02:21 已经和妮姐、万万确认,采购公司和收货公司目前是一致的,暂时不用区分取数逻辑 BdInvmandocEntity bdInvmandocEntity = queryInventoryMan(detailsDto, bdCorpEntity.getPkCorp()); String receivedQty = detailsDto.getShipQty();//实发数量 - String fulfillAmount = ofsPoOrderDetail.getFulfillAmount();//实际进价 + String fulfillAmount = ofsPoOrderDetail.getDiscountPrice();//实际进价 //原币含税单价 BigDecimal noriginalcurprice = null; diff --git a/buildpackage/src/main/java/com/hzya/frame/plugin/lets/plugin/sales/SoSaleOutPluginInitializerToB.java b/buildpackage/src/main/java/com/hzya/frame/plugin/lets/plugin/sales/SoSaleOutPluginInitializerToB.java index 01301424..671bf7f2 100644 --- a/buildpackage/src/main/java/com/hzya/frame/plugin/lets/plugin/sales/SoSaleOutPluginInitializerToB.java +++ b/buildpackage/src/main/java/com/hzya/frame/plugin/lets/plugin/sales/SoSaleOutPluginInitializerToB.java @@ -55,6 +55,9 @@ public class SoSaleOutPluginInitializerToB extends PluginBaseEntity { @Autowired private IBdInvbasdocDao iBdInvbasdocDao; + @Autowired + private ISoSaleDao iSoSaleDao; + @Override public void initialize() { logger.info(getPluginLabel() + "執行初始化方法initialize()"); @@ -138,26 +141,32 @@ public class SoSaleOutPluginInitializerToB extends PluginBaseEntity { @Autowired private OfsStandardUtil ofsStandardUtil; + @Autowired + private RdclUtil rdclUtil; + /** - * 按指定时间拉取 + * 库存同步,按指定时间拉取 * * @author liuyang */ - public void startImplement(String dateStr, String summaryOrderNumber) { - String threadNameStr = StrUtil.format("OFS销售出库(TOB)同步U8C销售订单 同步日期:{} 汇总维度:{}", dateStr, summaryOrderNumber); + public void startImplementByStockTime(String startTime, String endTime) { + String threadNameStr = StrUtil.format("OFS销售出库(TOB)同步U8C销售订单开始 同步日期:{} 汇总维度:{}", startTime, endTime); logger.info(threadNameStr); Thread thread = new Thread(new Runnable() { @Override public void run() { try { - CalculateDateVo calculateDateVo = DateStrUtil.calculateCalculateEntireDayPeriod(dateStr); + Assert.notNull(startTime, "出库开始时间不能为空"); + Assert.notNull(endTime, "出库结束时间不能为空"); + +// CalculateDateVo calculateDateVo = DateStrUtil.calculateCalculateEntireDayPeriod(dateStr); String tobShop = shopTobOrToCUtil.getCommaShop("TOB"); List headerDetailsDtoList = new ArrayList<>(); QueryOfsSoSaleOutVo queryOfsSoSaleOutVo = new QueryOfsSoSaleOutVo(); - queryOfsSoSaleOutVo.setShipAt_start(calculateDateVo.getStart_time()); - queryOfsSoSaleOutVo.setShipAt_end(calculateDateVo.getEnd_time()); + queryOfsSoSaleOutVo.setShipAt_start(startTime); + queryOfsSoSaleOutVo.setShipAt_end(endTime); queryOfsSoSaleOutVo.setClientCode("LETS"); queryOfsSoSaleOutVo.setInternalInstructionType("SALES"); // queryOfsSoSaleOutVo.setCompanyCode("SHLZ"); @@ -169,12 +178,12 @@ public class SoSaleOutPluginInitializerToB extends PluginBaseEntity { ofsStandardUtil.queryOfsSaleOrder(queryOfsSoSaleOutVo, headerDetailsDtoList, 1L, "ofs.shipment.search"); logger.info("数据返回行数:{}", headerDetailsDtoList.size()); if (headerDetailsDtoList.size() > 0) { - getSet(headerDetailsDtoList); + getSetStock(headerDetailsDtoList); } else { logger.info("没有查询到任何数据!不需要同步"); } } catch (Exception e) { - logger.error("startImplement方法抛出异常", e); + logger.error("startImplementByStockTime方法抛出异常", e); } } }, threadNameStr); @@ -184,29 +193,85 @@ public class SoSaleOutPluginInitializerToB extends PluginBaseEntity { } catch (Exception e) { logger.error("thread.join()异常", e); } + String threadNameEnd = StrUtil.format("OFS销售出库(TOB)同步U8C销售订单结束 同步日期:{} 汇总维度:{}", startTime, endTime); + logger.info(threadNameEnd); } + /** + * 交易成功同步,按指定时间拉取 + * + * @author liuyang + */ + public void startImplementByTranTime(String startTime, String endTime) { + String threadNameStrStart = StrUtil.format("OFS销售出库(TOB交易成功)同步U8C销售发票 开始 开始时间:{} 结束时间:{}", startTime, endTime); + logger.info(threadNameStrStart); + + Thread thread = new Thread(new Runnable() { + @Override + public void run() { + try { + Assert.notNull(startTime, "交易开始时间不能为空"); + Assert.notNull(endTime, "交易结束时间不能为空"); + + String tobShop = shopTobOrToCUtil.getCommaShop("TOB"); + + List headerDetailsDtoList = new ArrayList<>(); + QueryOfsSoSaleOutVo queryOfsSoSaleOutVo = new QueryOfsSoSaleOutVo(); + queryOfsSoSaleOutVo.setShipAt_start(startTime); + queryOfsSoSaleOutVo.setShipAt_end(endTime); + //TODO 测试 +// queryOfsSoSaleOutVo.setTradeSuccessAt_start(startTime); +// queryOfsSoSaleOutVo.setTradeSuccessAt_end(endTime); + queryOfsSoSaleOutVo.setClientCode("LETS"); + queryOfsSoSaleOutVo.setInternalInstructionType("SALES"); +// queryOfsSoSaleOutVo.setSourceOrderStatus("TRADE_FINISHED");//交易成功状态 +// queryOfsSoSaleOutVo.setStatus(900L); + queryOfsSoSaleOutVo.setPageNo(1L); + queryOfsSoSaleOutVo.setPageSize(50L); + queryOfsSoSaleOutVo.setStoreCode(tobShop); + ofsStandardUtil.queryOfsSaleOrder(queryOfsSoSaleOutVo, headerDetailsDtoList, 1L, "ofs.shipment.search"); + logger.info("数据返回行数:{}", headerDetailsDtoList.size()); + if (headerDetailsDtoList.size() > 0) { + getSetStockTran(headerDetailsDtoList); + } else { + logger.info("没有查询到任何数据!不需要同步"); + } + } catch (Exception e) { + logger.error("startImplementByTranTime方法抛出异常", e); + } + } + }, threadNameStrStart); + thread.start(); + try { + thread.join(); + } catch (Exception e) { + logger.error("thread.join()异常", e); + } + String threadNameStrEnd = StrUtil.format("OFS销售出库(TOB交易成功)同步U8C销售发票 结束 开始时间:{} 结束时间:{}", startTime, endTime); + logger.info(threadNameStrEnd); + } /** * 根据出库单单号拉取 * * @author liuyang */ - public void startImplement(String code) { - String threadNameStr = StrUtil.format("OFS销售出库(TOB)同步U8C销售订单 出库单单号:{}", code); - logger.info(threadNameStr); + public void startImplementByCode(String code) { + String threadNameStrStart = StrUtil.format("OFS销售出库(TOB)同步U8C销售订单 出库单单号:{}", code); + logger.info(threadNameStrStart); Thread thread = new Thread(new Runnable() { @Override public void run() { try { + Assert.notNull(code, "出库单单不能为空"); String tobShop = shopTobOrToCUtil.getCommaShop("TOB"); List headerDetailsDtoList = new ArrayList<>(); QueryOfsSoSaleOutVo queryOfsSoSaleOutVo = new QueryOfsSoSaleOutVo(); queryOfsSoSaleOutVo.setClientCode("LETS"); queryOfsSoSaleOutVo.setInternalInstructionType("SALES"); -// queryOfsSoSaleOutVo.setStatus(900L); + queryOfsSoSaleOutVo.setStatus(900L); queryOfsSoSaleOutVo.setPageNo(1L); queryOfsSoSaleOutVo.setPageSize(50L); queryOfsSoSaleOutVo.setStoreCode(tobShop); @@ -214,30 +279,47 @@ public class SoSaleOutPluginInitializerToB extends PluginBaseEntity { ofsStandardUtil.queryOfsSaleOrder(queryOfsSoSaleOutVo, headerDetailsDtoList, 1L, "ofs.shipment.search"); logger.info("根据单据号查询:数据返回行数:{}", headerDetailsDtoList.size()); if (headerDetailsDtoList.size() > 0) { - getSet(headerDetailsDtoList); + getSetStock(headerDetailsDtoList); } else { logger.info("没有查询到任何数据!不需要同步"); } } catch (Exception e) { - logger.error("startImplement方法抛出异常", e); + logger.error("startImplementByCode方法抛出异常", e); } } - }, threadNameStr); + }, threadNameStrStart); thread.start(); try { thread.join(); } catch (Exception e) { logger.error("thread.join()异常", e); } + String threadNameStrEnd = StrUtil.format("OFS销售出库(TOB)同步U8C销售订单 出库单单号:{}", code); + logger.info(threadNameStrEnd); } - private void getSet(List headerDetailsDtoList) throws Exception { + /** + * 出库完成 + */ + private void getSetStock(List headerDetailsDtoList) throws Exception { //保存到mysql batchInsert(headerDetailsDtoList); //过滤成功的数据 List headerDetailsDtos = filterData(headerDetailsDtoList); //执行推送主逻辑 - implement(headerDetailsDtos); + implementStock(headerDetailsDtos); + } + + /** + * 交易成功 + */ + private void getSetStockTran(List headerDetailsDtoList) throws Exception { + //保存到mysql + batchInsert(headerDetailsDtoList); + //过滤成功的数据 + List headerDetailsDtos = filterData(headerDetailsDtoList); + //执行主推送逻辑 + implementSuccessfulTrade(headerDetailsDtos); } /** @@ -330,15 +412,20 @@ public class SoSaleOutPluginInitializerToB extends PluginBaseEntity { * @param headerDetailsDtos 查询得到的O出库单对象 * @author liuyang */ - private void implement(List headerDetailsDtos) throws Exception { + private void implementStock(List headerDetailsDtos) throws Exception { + if (headerDetailsDtos != null) { + logger.info("TOB销售业务库存同步:{}行需要进行数据转换", headerDetailsDtos.size()); + } if (headerDetailsDtos != null && headerDetailsDtos.size() > 0) { try { - // 查询基本档案 - List orderOutTobHeaderDtos = queryBasicArchives(headerDetailsDtos); - // 查询U8C业务流程 - BdBusitypeEntity bdBusitypeEntity = u8cOperationFlow(); - try { + // 查询基本档案 + List orderOutTobHeaderDtos = queryBasicArchives(headerDetailsDtos); + // 查询U8C业务流程 + BdBusitypeEntity bdBusitypeEntity = u8cOperationFlow(); + // 查询销售收发类别 + BdRdclEntity bdRdclEntity = rdclUtil.queryRdClObject("201"); + for (int i = 0; i < orderOutTobHeaderDtos.size(); i++) { OrderOutTobHeaderDto orderOutTobHeaderDto = orderOutTobHeaderDtos.get(i); HeaderDto header = orderOutTobHeaderDto.getHeader(); @@ -399,6 +486,10 @@ public class SoSaleOutPluginInitializerToB extends PluginBaseEntity { saleorderRequestParentDto.setPk_defdoc1(shopArchives.getPkDefdoc()); saleorderRequestParentDto.setVdef1(shopArchives.getDocname()); + //收发类别 + saleorderRequestParentDto.setPk_defdoc3(bdRdclEntity.getPkRdcl()); + saleorderRequestParentDto.setVdef3(bdRdclEntity.getRdname()); + saleorderRequestDto.setParentvo(saleorderRequestParentDto); List saleorderRequestChildrenDtoList = new ArrayList<>(); @@ -442,9 +533,9 @@ public class SoSaleOutPluginInitializerToB extends PluginBaseEntity { } //判断是否为赠品 - String isblargessflag = "N"; + Boolean isblargessflag = false; if (noriginalcursummny.longValue() == 0) { - isblargessflag = "Y"; + isblargessflag = true; } SaleorderRequestChildrenDto saleorderRequestChildrenDto = new SaleorderRequestChildrenDto(); @@ -520,6 +611,31 @@ public class SoSaleOutPluginInitializerToB extends PluginBaseEntity { } } + /** + * 2024年7月31日 10:34:09 + * 生成业务日期,以交易成功时间作为业务日期 + * + * @author liuyang + */ + private String createSuccessFulTradeDate(OrderOutTobHeaderDto orderOutTobHeaderDto) { + if (orderOutTobHeaderDto != null && orderOutTobHeaderDto.getHeader() != null && orderOutTobHeaderDto.getHeader().getTradeSuccessAt() != null) { + HeaderDto header = orderOutTobHeaderDto.getHeader(); + String shipAt = header.getTradeSuccessAt(); + String businessFormat = null; + try { + Date dbill = DateUtil.parse(shipAt); + businessFormat = DateUtil.format(dbill, "yyyy-MM-dd"); + } catch (Exception e) { + logger.error("tradeSuccessAt业务日期生成失败", e); + } + return businessFormat; + } else { + logger.error("生成出库日期失败,或者tradeSuccessAt为空! json:{}", JSON.toJSON(orderOutTobHeaderDto)); + Assert.state(false, "生成出库日期失败,或者tradeSuccessAt为空! json:{}", JSON.toJSON(orderOutTobHeaderDto)); + return null; + } + } + /** * 档案转换 * @@ -882,7 +998,6 @@ public class SoSaleOutPluginInitializerToB extends PluginBaseEntity { return JSON.parseObject(resultData, SoSaleResultRootDto.class); } } catch (Exception e) { -// e.printStackTrace(); logger.error("解析返回参数失败的错误", e); //如果解析失败,记录原因,但是不能影响结果的记录 } @@ -894,17 +1009,17 @@ public class SoSaleOutPluginInitializerToB extends PluginBaseEntity { * * @author liuyang */ - public SaleOrderMessageDto getOfsOrder(QueryOfsSoSaleOutVo queryOfsSoSaleOutVo, Long pageNo) throws Exception { - Long pageSize = 200L; - queryOfsSoSaleOutVo.setPageNo(pageNo); - queryOfsSoSaleOutVo.setPageSize(pageSize); - - InterfaceParamDto interfaceParamDto = new InterfaceParamDto(); - interfaceParamDto.setApi("ofs.salesOrder.search"); - interfaceParamDto.setData(JSON.toJSONString(queryOfsSoSaleOutVo)); - SaleOrderMessageDto saleOrderMessageDto = (SaleOrderMessageDto) ofsUnifiedService.unified(interfaceParamDto); - return saleOrderMessageDto; - } +// public SaleOrderMessageDto getOfsOrder(QueryOfsSoSaleOutVo queryOfsSoSaleOutVo, Long pageNo) throws Exception { +// Long pageSize = 200L; +// queryOfsSoSaleOutVo.setPageNo(pageNo); +// queryOfsSoSaleOutVo.setPageSize(pageSize); +// +// InterfaceParamDto interfaceParamDto = new InterfaceParamDto(); +// interfaceParamDto.setApi("ofs.salesOrder.search"); +// interfaceParamDto.setData(JSON.toJSONString(queryOfsSoSaleOutVo)); +// SaleOrderMessageDto saleOrderMessageDto = (SaleOrderMessageDto) ofsUnifiedService.unified(interfaceParamDto); +// return saleOrderMessageDto; +// } /** * 2024年8月15日 17:08:42 @@ -921,4 +1036,364 @@ public class SoSaleOutPluginInitializerToB extends PluginBaseEntity { logger.info("createPrimaryKeyAndBusinessDateAndBusinessType方法存在false!"); } } + + /** + * 档案转换(销售发票) + * + * @author liuyang + */ + private List queryBasicArchivesSaleinvoice(List headerDetailsDtoList) { + List orderOutTobHeaderDtoArrayList = new ArrayList<>(); + + if (headerDetailsDtoList != null && headerDetailsDtoList.size() > 0) { + try { + for (int i = 0; i < headerDetailsDtoList.size(); i++) { + HeaderDetailsDto headerDetailsDto = headerDetailsDtoList.get(i); + HeaderDto header = headerDetailsDto.getHeader(); + List details = headerDetailsDto.getDetails(); + + //根据OFS销售出库单,查询得到OFS销售订单 + SaleOrderMessageDto saleOrderMessageDto = null; + try { + saleOrderMessageDto = afterSalesOrderUtil.getOfsOrder(header.getRefOrderCode()); + } catch (Exception e) { + logger.error("查询销售订单错误,失败原因:{}", e.getMessage()); + Assert.state(false, "查询销售订单错误,失败原因:{}", e.getMessage()); + } + if (saleOrderMessageDto == null) { + Assert.state(false, "根据单号:{},没有匹配到销售订单,系统业务无法完成", header.getRefOrderCode()); + } + + com.hzya.frame.ttxofs.dto.ofssalesordersearch.HeaderDto header1 = saleOrderMessageDto.getData().get(0).getHeader(); + String memberId = header1.getMemberId(); + Assert.notNull(memberId, "TOB销售订单(OFS)表头会员id不能为空,否则无法匹配U8C客商档案!"); + Assert.state(!"".equals(memberId.trim()), "TOB销售订单(OFS)表头会员id不能为空,否则无法匹配U8C客商档案!"); + + //2024年8月28日 11:01:07 查询对应的U8C销售订单 + SoSaleEntity soSaleEntity = new SoSaleEntity(); + soSaleEntity.setDr(0L); + soSaleEntity.setDataSourceCode("lets_u8c"); + soSaleEntity.setVdef19(header.getCode()); + soSaleEntity.setVdef20(header.getId()); + List soSaleEntityList = iSoSaleDao.query(soSaleEntity); + if (soSaleEntityList == null || soSaleEntityList.size() == 0) { + Assert.state(false, "根据O出库单主键:{} 单号:{} 无法匹配到U8C销售订单(传到U8C可能失败了!)", header.getId(), header.getCode()); + } else if (soSaleEntityList.size() >= 2) { + Assert.state(false, "根据O出库单主键:{} 单号:{} 匹配到{}个U8C销售订单", header.getId(), header.getCode(), soSaleEntityList.size()); + } + + // 销售公司、发货公司 +// header.setCompanyCode("SHLZ"); + 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()); + } + + // 发货库存组织 + 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(), bdCorpEntityList.get(0).getUnitname()); + } else if (bdStordocEntityList.size() >= 2) { + Assert.state(false, "根据O仓库编码+U8C发货库存组织主键,匹配到U8C仓库多个 仓库编码:{} 组织机构主键:{} 公司名称:{}", facilityCode, bdCalbodyEntities.get(0).getPkCalbody(), bdCorpEntityList.get(0).getUnitname()); + } + + //销售组织 + //2024年8月13日 10:35:05 已经和佳妮在微信确认,U8C销售公司编码与U8C销售组织编码保持一致,因此通过销售公司编码匹配 + BdSalestruEntity bdSalestruEntity = new BdSalestruEntity(); + bdSalestruEntity.setDr(0); + bdSalestruEntity.setDataSourceCode("lets_u8c"); + bdSalestruEntity.setVsalestrucode(bdCorpEntityList.get(0).getUnitcode()); + List bdSalestruEntityList = iBdSalestruDao.query(bdSalestruEntity); + if (bdSalestruEntityList.size() == 0) { + Assert.state(false, "根据U8C销售公司编码:{},无法匹配到U8C销售组织", bdCorpEntityList.get(0).getUnitcode()); + } else if (bdSalestruEntityList.size() >= 2) { + Assert.state(false, "根据U8C销售公司编码:{},无法匹配到U8C销售组织", bdCorpEntityList.get(0).getUnitcode()); + } + + //业务部门 + //2024年8月14日 10:38:37 已经和佳妮确认 + String deptName = "其他部门"; + BdDeptdocEntity bdDeptdocEntity = new BdDeptdocEntity(); + bdDeptdocEntity.setDataSourceCode("lets_u8c"); + bdDeptdocEntity.setDr(0); + bdDeptdocEntity.setDeptname(deptName); + bdDeptdocEntity.setPkCorp(bdCorpEntityList.get(0).getPkCorp()); + List bdDeptdocEntityList = iBdDeptdocDao.query(bdDeptdocEntity); + if (bdDeptdocEntityList.size() == 0) { + Assert.state(false, "根据部门名称:{} 公司id:{},无法匹配到U8C销售组织", deptName, bdCorpEntityList.get(0).getPkCorp()); + } else if (bdDeptdocEntityList.size() >= 2) { + Assert.state(false, "根据部门名称:{} 公司id:{},匹配到U8C销售组织{}个", deptName, bdCorpEntityList.get(0).getPkCorp()); + } + + //客商基本档案 + //查询OFS对应的销售订单,得到会员id +// QueryOfsSoSaleOutVo queryOfsSoSaleOutVo = new QueryOfsSoSaleOutVo(); +// queryOfsSoSaleOutVo.setCode(); +// SaleOrderMessageDto ofsOrder = getOfsOrder(queryOfsSoSaleOutVo, 1L); + +// String custName = "天猫intoyou旗舰店-自营"; + BdCubasdocEntity bdCubasdocEntity = new BdCubasdocEntity(); + bdCubasdocEntity.setDataSourceCode("lets_u8c"); + bdCubasdocEntity.setDr(0L); + bdCubasdocEntity.setDef1(memberId); + List bdCubasdocEntityList = iBdCubasdocDao.query(bdCubasdocEntity); + if (bdCubasdocEntityList == null || bdCubasdocEntityList.size() == 0) { + Assert.state(false, "根据OFS会员id{},无法查询到U8C客商基本档案", memberId); + } else if (bdCubasdocEntityList.size() >= 2) { + Assert.state(false, "根据OFS会员id{},查询到U8C多个客商基本档案", memberId); + } + + //客商管理档案 + BdCumandocEntity bdCumandocEntity1 = new BdCumandocEntity(); + bdCumandocEntity1.setDataSourceCode("lets_u8c"); + bdCumandocEntity1.setDr(0L); + bdCumandocEntity1.setPkCorp(bdCorpEntityList.get(0).getPkCorp()); + bdCumandocEntity1.setCustflags(ProfilesActiveConstant.CUSTOMER); + bdCumandocEntity1.setPkCubasdoc(bdCubasdocEntityList.get(0).getPkCubasdoc()); + List bdCumandocEntityList = iBdCumandocDao.query(bdCumandocEntity1); + if (bdCumandocEntityList == null || bdCumandocEntityList.size() == 0) { + Assert.state(false, "根据客商基本档案主键{},没有办法查询到客商管理档案", bdCubasdocEntityList.get(0).getPkCubasdoc()); + } + + //查找平台 +// String platformZdyId = "0001A210000000000JUD"; +// String sourcePlatformCode = header.getSourcePlatformCode(); +// BdDefdocEntity bdDefdocEntity = new BdDefdocEntity(); +// bdDefdocEntity.setPkDefdoclist(platformZdyId); +// bdDefdocEntity.setDr(0); +// bdDefdocEntity.setDataSourceCode("lets_u8c"); +// bdDefdocEntity.setDoccode(sourcePlatformCode); +// List bdDefdocEntityList = iBdDefdocDao.query(bdDefdocEntity); +// if (bdDefdocEntityList.size() == 0) { +// Assert.state(false, "根据O平台编码{},无法匹配到U8C平台自定义档案 自定义档案主键:{}", sourcePlatformCode, platformZdyId); +// } else if (bdDefdocEntityList.size() >= 2) { +// Assert.state(false, "根据O平台编码{},无法匹配到U8C平台自定义档案 自定义档案主键:{}", sourcePlatformCode, platformZdyId); +// } + + //查询U8C店铺档案 +// String platformZdyId2 = "0001A210000000000XZX"; +// String ofsStoreCode = header.getStoreCode(); +// BdDefdocEntity bdDefdocEntity2 = new BdDefdocEntity(); +// bdDefdocEntity2.setPkDefdoclist(platformZdyId2); +// bdDefdocEntity2.setDr(0); +// bdDefdocEntity2.setDataSourceCode("lets_u8c"); +// bdDefdocEntity2.setDoccode(ofsStoreCode); +// List bdDefdocEntityList2 = iBdDefdocDao.query(bdDefdocEntity2); +// if (bdDefdocEntityList2.size() == 0) { +// Assert.state(false, "根据O店铺编码{},无法匹配到U8C店铺自定义档案 自定义档案主键:{}", ofsStoreCode, platformZdyId); +// } else if (bdDefdocEntityList2.size() >= 2) { +// Assert.state(false, "根据O店铺编码{},无法匹配到U8C店铺自定义档案 自定义档案主键:{}", ofsStoreCode, platformZdyId); +// } + //业务流程 + + + OrderOutTobHeaderDto orderOutTobHeaderDto = new OrderOutTobHeaderDto(); + orderOutTobHeaderDto.setBdCorpEntity(bdCorpEntityList.get(0)); + orderOutTobHeaderDto.setBdCalbodyEntity(bdCalbodyEntities.get(0)); + orderOutTobHeaderDto.setBdStordocEntity(bdStordocEntityList.get(0)); + orderOutTobHeaderDto.setBdSalestruEntity(bdSalestruEntityList.get(0)); + orderOutTobHeaderDto.setBdDeptdocEntity(bdDeptdocEntityList.get(0)); + orderOutTobHeaderDto.setBdCumandocEntity(bdCumandocEntityList.get(0)); + orderOutTobHeaderDto.setBdCubasdocEntity(bdCubasdocEntityList.get(0)); + orderOutTobHeaderDto.setDeliverGoodsCorp(bdCorpEntityList.get(0)); +// orderOutTobHeaderDto.setPlatformArchives(bdDefdocEntityList.get(0)); +// orderOutTobHeaderDto.setShopArchives(bdDefdocEntityList2.get(0)); + orderOutTobHeaderDto.setSaleOrderMessageDto(saleOrderMessageDto); + orderOutTobHeaderDto.setSoSaleEntity(soSaleEntityList.get(0)); + + orderOutTobHeaderDto.setHeader(header); + orderOutTobHeaderDto.setDetails(details); + + BeanUtil.copyPropertiesV2(header, orderOutTobHeaderDto); + orderOutTobHeaderDtoArrayList.add(orderOutTobHeaderDto); + } + //成功 + } catch (Exception e) { + logger.error("OFS销售出库单关联查询U8C档案失败", e); + //失败 + } + } else { + logger.info("queryBasicArchives方法对应的headerDetailsDtoList.size为0"); + } + return orderOutTobHeaderDtoArrayList; + } + + /** + * TOB交易成功的销售出库单,关联原销售出库单,生成销售发票 + * + * @author liuyang + */ + private void implementSuccessfulTrade(List headerDetailsDtoList) throws Exception { + if (headerDetailsDtoList != null) { + logger.info("TOB销售业务交易成功同步:{}行需要进行数据转换", headerDetailsDtoList.size()); + } + if (headerDetailsDtoList != null && headerDetailsDtoList.size() > 0) { + //查询基本档案 + List orderOutTobHeaderDtos = queryBasicArchivesSaleinvoice(headerDetailsDtoList); + //查询U8C业务流程 + BdBusitypeEntity bdBusitypeEntity = u8cOperationFlow(); + + logger.info("TOB销售业务交易成功同步,档案转换成功对应的数量:{}行需要进行数据转换", orderOutTobHeaderDtos.size()); + logger.info("TOB销售发票业务流程编码:{}", bdBusitypeEntity.getBusicode()); + for (int i = 0; i < orderOutTobHeaderDtos.size(); i++) { + try { + OrderOutTobHeaderDto orderOutTobHeaderDto = orderOutTobHeaderDtos.get(i); + HeaderDto header = orderOutTobHeaderDto.getHeader(); + List details = orderOutTobHeaderDto.getDetails(); + + //销售公司、发货公司 + BdCorpEntity bdCorpEntity = orderOutTobHeaderDto.getBdCorpEntity(); + //发货库存组织 + BdCalbodyEntity bdCalbodyEntity = orderOutTobHeaderDto.getBdCalbodyEntity(); + //入库参数 + BdStordocEntity bdStordocEntity = orderOutTobHeaderDto.getBdStordocEntity(); + //销售组织 + BdSalestruEntity bdSalestruEntity = orderOutTobHeaderDto.getBdSalestruEntity(); + //业务部门 + BdDeptdocEntity bdDeptdocEntity = orderOutTobHeaderDto.getBdDeptdocEntity(); + //客商基本档案 + BdCubasdocEntity bdCubasdocEntity = orderOutTobHeaderDto.getBdCubasdocEntity(); + //客商管理档案 + BdCumandocEntity bdCumandocEntity = orderOutTobHeaderDto.getBdCumandocEntity(); + //发货公司 + BdCorpEntity deliverGoodsCorp = orderOutTobHeaderDto.getDeliverGoodsCorp(); + //平台档案 + BdDefdocEntity platformArchives = orderOutTobHeaderDto.getPlatformArchives(); + //生成业务日期 + String successfulTradeDate = createSuccessFulTradeDate(orderOutTobHeaderDto); + //店铺 + BdDefdocEntity shopArchives = orderOutTobHeaderDto.getShopArchives(); + //U8C销售订单 + SoSaleEntity soSaleEntity = orderOutTobHeaderDto.getSoSaleEntity(); + + SalesInvoiceHeadDto salesInvoiceHeadDto = new SalesInvoiceHeadDto(); + salesInvoiceHeadDto.setCbiztype(bdBusitypeEntity.getPkBusitype()); + salesInvoiceHeadDto.setCcalbodyid(bdCalbodyEntity.getPkCalbody()); + salesInvoiceHeadDto.setCoperatorid("0001A110000000000U3D");//制单人 + salesInvoiceHeadDto.setCreceiptcorpid(bdCumandocEntity.getPkCumandoc()); + salesInvoiceHeadDto.setCsalecorpid(bdSalestruEntity.getCsalestruid()); + salesInvoiceHeadDto.setPk_corp(bdCorpEntity.getPkCorp()); + salesInvoiceHeadDto.setDbilldate(successfulTradeDate); + salesInvoiceHeadDto.setFinvoicetype("1");//不传默认为1 + salesInvoiceHeadDto.setVdef17(ProfilesActiveConstant.sourceSystem1); + salesInvoiceHeadDto.setVdef19(header.getCode()); + salesInvoiceHeadDto.setVdef20(header.getId()); + + List salesInvoiceBodyDtoList = new ArrayList<>(); + for (int j = 0; j < details.size(); j++) { + DetailsDto detailsDto = details.get(j); + //存货管理档案:取发货公司的存货管理档案 + BdInvmandocEntity bdInvmandocEntity = queryInventoryMan(detailsDto, bdCalbodyEntity.getPkCorp()); + //存货基础档案 + BdInvbasdocEntity bdInvbasdocEntity = queryStockBasicArchives(bdInvmandocEntity.getPkInvmandoc(), deliverGoodsCorp.getPkCorp()); + //根据存货基础档案编码,查询当前存货的税率 + BdTaxitemsEntity bdTaxitemsEntity1 = queryBdTaxitems(bdInvbasdocEntity.getInvcode()); + + BigDecimal noriginalcurtaxprice = null;//含税单价 + try { + noriginalcurtaxprice = new BigDecimal(detailsDto.getTotalPayAmount()).divide(new BigDecimal(detailsDto.getShipQty()), 20, BigDecimal.ROUND_HALF_UP).setScale(4, BigDecimal.ROUND_HALF_UP); + } catch (Exception e) { + logger.error("含税单价金额计算失败!", e); + } + + Boolean isblargessflag = false; + if (noriginalcurtaxprice == null) { + isblargessflag = true; + } + + SalesInvoiceBodyDto salesInvoiceBodyDto = new SalesInvoiceBodyDto(); + salesInvoiceBodyDto.setCinventoryid(bdInvmandocEntity.getPkInvmandoc()); + salesInvoiceBodyDto.setCupreceipttype("4C"); + salesInvoiceBodyDto.setCupsourcebillcode(soSaleEntity.getVreceiptcode()); + salesInvoiceBodyDto.setNnumber(detailsDto.getShipQty()); + salesInvoiceBodyDto.setNoriginalcurtaxprice(noriginalcurtaxprice.stripTrailingZeros().toPlainString());//含税单价 + salesInvoiceBodyDto.setNtaxrate(new BigDecimal(bdTaxitemsEntity1.getTaxratio()).stripTrailingZeros().toPlainString());//税率 + salesInvoiceBodyDto.setBlargessflag(isblargessflag); + salesInvoiceBodyDtoList.add(salesInvoiceBodyDto); + } + SalesInvoiceDto salesInvoiceDto = new SalesInvoiceDto(); + salesInvoiceDto.setParentvo(salesInvoiceHeadDto); + salesInvoiceDto.setChildrenvo(salesInvoiceBodyDtoList); + + List salesInvoiceDtoList = new ArrayList<>(); + salesInvoiceDtoList.add(salesInvoiceDto); + + Map> stringListMap = new HashMap<>(); + stringListMap.put("billvos", salesInvoiceDtoList); + + //推送到U8C + SoSaleResultRootDto soSaleResultRootDto = sendU8CTOCSoSaleinvoiceB(JSON.toJSONString(stringListMap)); + //成功 + } catch (Exception e) { + logger.error("OTOB的销售发票传输失败,抛出异常", e); + //失败 + } + } + } + } + + /** + * 2024年8月28日 11:57:58 + * 推送U8C销售发票 + * + * @author liuyang + */ + public SoSaleResultRootDto sendU8CTOCSoSaleinvoiceB(String param) throws Exception { + long startLong = System.currentTimeMillis(); + logger.info("TOB销售发票推送开始,推送参数:" + 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", "8000370057")//头信息,多个头信息多次调用此方法即可 + .header("publicKey", "ZJYAWb7lhAUTYqekPkU+uHJv1/ObJxb7dT7sD8HPRDGAgyhCe7eDIk+3zDUT+v578prj")//头信息,多个头信息多次调用此方法即可 + .header("secretKey", "fviZnLBsQUAGF8w8FSOdJi7XlIm/XAZclMxRagDLfTyJFlvnIBF3w66Hrpfzs8cYj3JzOP8MtA1LSGvL+2BWG8c/o7DKi92S4mr3zcGearA=")//头信息,多个头信息多次调用此方法即可 + .body(param)//表单内容 + .timeout(20000)//超时,毫秒 + .execute().body(); + logger.info("TOB销售发票结束,返回参数:" + result); + long endLong = System.currentTimeMillis(); + logger.info("TOB销售发票接口请求耗时:" + (endLong - startLong)); + + JSONObject jsonObject = JSON.parseObject(result); + result = String.valueOf(jsonObject.get("attribute")); + + boolean isSuccess = false; + SoSaleResultRootDto soSaleResultRootDto = null; + if (result != null && !"".equals(result)) { + ReusltStrDto reusltStrDto = JSON.parseObject(result, ReusltStrDto.class); + if ("success".equals(reusltStrDto.getStatus())) { + soSaleResultRootDto = resultDataHandle(reusltStrDto.getData()); + isSuccess = true; + } + } + if (!isSuccess) { + Assert.state(false, "TOB业务O出库单推送U8C销售发票失败 接口返回结果:{}", result); + } + return soSaleResultRootDto; + } } 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 559836ce..ea514b8b 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 @@ -108,6 +108,9 @@ public class SoSaleOutPluginInitializerToC extends PluginBaseEntity { @Autowired private OfsStandardUtil ofsStandardUtil; + @Autowired + private RdclUtil rdclUtil; + /** * 按指定时间拉取 * @@ -353,6 +356,7 @@ public class SoSaleOutPluginInitializerToC extends PluginBaseEntity { * @author liuyang */ private void implement(List headerDetailsDtos) throws Exception { + logger.info("TOC销售业务:{}行需要进行数据转换", headerDetailsDtos.size()); if (headerDetailsDtos != null && headerDetailsDtos.size() > 0) { try { // 查询基本档案 @@ -361,6 +365,8 @@ public class SoSaleOutPluginInitializerToC extends PluginBaseEntity { Map> summaryDimensionMap = groupSummary(sonDetailsDtoList); // 查询U8C业务流程 BdBusitypeEntity bdBusitypeEntity = u8cOperationFlow(); + // 查询销售收发类别 + BdRdclEntity bdRdclEntity = rdclUtil.queryRdClObject("202"); if (bdBusitypeEntity != null && summaryDimensionMap != null) { Iterator>> iterator = summaryDimensionMap.entrySet().iterator(); @@ -417,6 +423,10 @@ public class SoSaleOutPluginInitializerToC extends PluginBaseEntity { saleorderRequestParentDto.setPk_defdoc1(shopArchives.getPkDefdoc()); saleorderRequestParentDto.setVdef1(shopArchives.getDocname()); + //收发类别 + saleorderRequestParentDto.setPk_defdoc3(bdRdclEntity.getPkRdcl()); + saleorderRequestParentDto.setVdef3(bdRdclEntity.getRdname()); + //TODO 2024年8月8日 17:17:58 店铺档案自定义项1,先不传,后续维护好之后再传! saleorderRequestDto.setParentvo(saleorderRequestParentDto); @@ -454,9 +464,9 @@ public class SoSaleOutPluginInitializerToC extends PluginBaseEntity { } //判断是否为赠品 - String isblargessflag = "N"; + Boolean isblargessflag = false; if (noriginalcursummny.longValue() == 0) { - isblargessflag = "Y"; + isblargessflag = true; } SaleorderRequestChildrenDto saleorderRequestChildrenDto = new SaleorderRequestChildrenDto(); diff --git a/buildpackage/src/main/java/com/hzya/frame/plugin/lets/plugin/sales/SoSaleReturnPluginInitializerToB.java b/buildpackage/src/main/java/com/hzya/frame/plugin/lets/plugin/sales/SoSaleReturnPluginInitializerToB.java index bdaf4074..d6cdb4e6 100644 --- a/buildpackage/src/main/java/com/hzya/frame/plugin/lets/plugin/sales/SoSaleReturnPluginInitializerToB.java +++ b/buildpackage/src/main/java/com/hzya/frame/plugin/lets/plugin/sales/SoSaleReturnPluginInitializerToB.java @@ -23,6 +23,8 @@ import com.hzya.frame.plugin.lets.u8cdto.*; import com.hzya.frame.plugin.lets.util.*; import com.hzya.frame.split.SplitListByCountUtil; import com.hzya.frame.ttxofs.dto.InterfaceParamDto; +import com.hzya.frame.ttxofs.dto.ofssalesordersearch.DetailsDto; +import com.hzya.frame.ttxofs.dto.ofssalesordersearch.HeaderDetailsDto; import com.hzya.frame.ttxofs.dto.ofssalesordersearch.HeaderDto; import com.hzya.frame.ttxofs.dto.ofssalesordersearch.SaleOrderMessageDto; import com.hzya.frame.ttxofs.dto.stock.StockinOrderSearchResponse; @@ -137,28 +139,34 @@ public class SoSaleReturnPluginInitializerToB extends PluginBaseEntity { @Autowired private OfsStandardUtil ofsStandardUtil; + @Autowired + private RdclUtil rdclUtil; + + @Autowired + private ISoSaleDao iSoSaleDao; + /** - * 按指定时间拉取 + * 库存同步,按指定时间拉取 * * @author liuyang */ - public void startImplement(String dateStr, String summaryOrderNumber) { - String threadNameStr = StrUtil.format("OFS售后入库(TOB)同步U8C销售订单 同步日期:{} 汇总维度:{}", dateStr, summaryOrderNumber); - logger.info(threadNameStr); + public void startImplementByStockTime(String startTime, String endTime) { + String threadNameStrStart = StrUtil.format("OFS售后入库(TOB)同步U8C销售订单(库存同步) 开始时间:{} 结束时间:{}", startTime, endTime); + logger.info(threadNameStrStart); Thread thread = new Thread(new Runnable() { @Override public void run() { try { //生成一个时间范围 - StartAndEndVo startAndEndVo = offsetTimeTime.offsetTime(); +// StartAndEndVo startAndEndVo = offsetTimeTime.offsetTime(); //2024年8月19日 15:47:51 查询出U8C里标记的店铺TOB属性 String tobShop = shopTobOrToCUtil.getCommaShop("TOB"); List returnGoodHeaderDetailsDataDtoArrayList = new ArrayList<>(); QueryOfsSoSaleOutVo queryOfsSoSaleOutVo = new QueryOfsSoSaleOutVo(); - queryOfsSoSaleOutVo.setClosedAt_start(startAndEndVo.getStart_time()); - queryOfsSoSaleOutVo.setClosedAt_end(startAndEndVo.getEnd_time()); + queryOfsSoSaleOutVo.setClosedAt_start(startTime); + queryOfsSoSaleOutVo.setClosedAt_end(endTime); queryOfsSoSaleOutVo.setClientCode("LETS"); queryOfsSoSaleOutVo.setPageNo(1L); queryOfsSoSaleOutVo.setPageSize(50L); @@ -168,7 +176,7 @@ public class SoSaleReturnPluginInitializerToB extends PluginBaseEntity { ofsStandardUtil.queryOfsReturnGoods(queryOfsSoSaleOutVo, returnGoodHeaderDetailsDataDtoArrayList, 1L, "ofs.receipt.search"); logger.info("数据返回行数:{}", returnGoodHeaderDetailsDataDtoArrayList.size()); if (returnGoodHeaderDetailsDataDtoArrayList.size() > 0) { - getSet(returnGoodHeaderDetailsDataDtoArrayList); + getSetStock(returnGoodHeaderDetailsDataDtoArrayList); } else { logger.info("没有查询到任何数据!不需要同步"); } @@ -176,23 +184,25 @@ public class SoSaleReturnPluginInitializerToB extends PluginBaseEntity { logger.error("startImplement方法抛出异常", e); } } - }, threadNameStr); + }, threadNameStrStart); thread.start(); try { thread.join(); } catch (Exception e) { logger.error("thread.join()异常", e); } + String threadNameStrEnd = StrUtil.format("OFS售后入库(TOB)同步U8C销售订单(库存同步) 开始时间:{} 结束时间:{}", startTime, endTime); + logger.info(threadNameStrEnd); } /** - * 按指定时间拉取 + * 根据售后入库单单号拉取 * * @author liuyang */ public void startImplement(String code) { - String threadNameStr = StrUtil.format("OFS售后入库(TOB)同步U8C销售订单 售后入库单号:{}", code); - logger.info(threadNameStr); + String threadNameStrStart = StrUtil.format("OFS售后入库(TOB)同步U8C销售订单(库存同步) 售后入库单号:{}", code); + logger.info(threadNameStrStart); Thread thread = new Thread(new Runnable() { @Override @@ -216,7 +226,7 @@ public class SoSaleReturnPluginInitializerToB extends PluginBaseEntity { ofsStandardUtil.queryOfsReturnGoods(queryOfsSoSaleOutVo, returnGoodHeaderDetailsDataDtoArrayList, 1L, "ofs.receipt.search"); logger.info("数据返回行数:{}", returnGoodHeaderDetailsDataDtoArrayList.size()); if (returnGoodHeaderDetailsDataDtoArrayList.size() > 0) { - getSet(returnGoodHeaderDetailsDataDtoArrayList); + getSetStock(returnGoodHeaderDetailsDataDtoArrayList); } else { logger.info("没有查询到任何数据!不需要同步"); } @@ -224,13 +234,15 @@ public class SoSaleReturnPluginInitializerToB extends PluginBaseEntity { logger.error("startImplement方法抛出异常", e); } } - }, threadNameStr); + }, threadNameStrStart); thread.start(); try { thread.join(); } catch (Exception e) { logger.error("thread.join()异常", e); } + String threadNameStrEnd = StrUtil.format("OFS售后入库(TOB)同步U8C销售订单(库存同步) 售后入库单号:{}", code); + logger.info(threadNameStrEnd); } /** @@ -238,13 +250,13 @@ public class SoSaleReturnPluginInitializerToB extends PluginBaseEntity { * * @author liuyang */ - private void getSet(List returnGoodHeaderDetailsDataDtoArrayList) throws Exception { + private void getSetStock(List returnGoodHeaderDetailsDataDtoArrayList) throws Exception { //保存到mysql batchInsert(returnGoodHeaderDetailsDataDtoArrayList); //过滤成功的数据 List stockinOrderList = filterData(returnGoodHeaderDetailsDataDtoArrayList); //执行推送主逻辑 - implement(stockinOrderList); + implementStock(stockinOrderList); } /** @@ -318,13 +330,18 @@ public class SoSaleReturnPluginInitializerToB extends PluginBaseEntity { * @param returnGoodHeaderDetailsDataDtoList 查询得到的O出库单对象 * @author liuyang */ - private void implement(List returnGoodHeaderDetailsDataDtoList) throws Exception { + private void implementStock(List returnGoodHeaderDetailsDataDtoList) throws Exception { + if (returnGoodHeaderDetailsDataDtoList != null) { + logger.info("TOB退货业务出库成功:{}行需要进行数据转换", returnGoodHeaderDetailsDataDtoList.size()); + } if (returnGoodHeaderDetailsDataDtoList != null && returnGoodHeaderDetailsDataDtoList.size() > 0) { try { // 查询基本档案 - List orderToBHeaderDtos = queryBasicArchives(returnGoodHeaderDetailsDataDtoList); + List orderToBHeaderDtos = queryBasicArchivesStock(returnGoodHeaderDetailsDataDtoList); // 查询U8C业务流程 BdBusitypeEntity bdBusitypeEntity = u8cOperationFlow(); + // 查询销售收发类别 + BdRdclEntity bdRdclEntity = rdclUtil.queryRdClObject("201"); try { for (int i = 0; i < orderToBHeaderDtos.size(); i++) { @@ -354,6 +371,8 @@ public class SoSaleReturnPluginInitializerToB extends PluginBaseEntity { BdDefdocEntity shopArchives = orderOutTobHeaderDto.getShopArchives(); //生成业务日期 String generateBusinessDate = createGenerateBusinessDate(orderOutTobHeaderDto); + //OFS售后订单 + SaleOrderMessageDto saleOrderMessageDto = orderOutTobHeaderDto.getSaleOrderMessageDto(); SaleorderRequestDto saleorderRequestDto = new SaleorderRequestDto(); SaleorderRequestParentDto saleorderRequestParentDto = new SaleorderRequestParentDto(); @@ -382,6 +401,10 @@ public class SoSaleReturnPluginInitializerToB extends PluginBaseEntity { saleorderRequestParentDto.setPk_defdoc1(shopArchives.getPkDefdoc()); saleorderRequestParentDto.setVdef1(shopArchives.getDocname()); + //收发类别 + saleorderRequestParentDto.setPk_defdoc3(bdRdclEntity.getPkRdcl()); + saleorderRequestParentDto.setVdef3(bdRdclEntity.getRdname()); + saleorderRequestDto.setParentvo(saleorderRequestParentDto); List saleorderRequestChildrenDtoList = new ArrayList<>(); @@ -396,6 +419,8 @@ public class SoSaleReturnPluginInitializerToB extends PluginBaseEntity { BdInvbasdocEntity bdInvbasdocEntity = queryStockBasicArchives(bdInvmandocEntity.getPkInvmandoc(), deliverGoodsCorp.getPkCorp()); //根据存货基础档案编码,查询当前存货的税率 BdTaxitemsEntity bdTaxitemsEntity1 = queryBdTaxitems(bdInvbasdocEntity.getInvcode()); + //对应的售后入库单,主要是取这个价格 + DetailsDto afterSalesOrder = findAfterSalesOrder(stockinB, saleOrderMessageDto); String tax = "0." + new BigDecimal(bdTaxitemsEntity1.getTaxratio()).stripTrailingZeros().toPlainString(); @@ -414,7 +439,7 @@ public class SoSaleReturnPluginInitializerToB extends PluginBaseEntity { Assert.notNull(stockinB.getTotalAmount(), "退货入库单总金额不能为空 明细行对象:{}", JSON.toJSONString(stockinB)); Assert.notNull(stockinB.getReceivedQty(), "实收数量不能为空 明细行对象:{}", JSON.toJSONString(stockinB)); - noriginalcurtaxprice = new BigDecimal(stockinB.getTotalAmount()).divide(new BigDecimal(stockinB.getReceivedQty()), 20, BigDecimal.ROUND_HALF_UP).setScale(4, BigDecimal.ROUND_HALF_UP); + noriginalcurtaxprice = new BigDecimal(afterSalesOrder.getTotalAmount()).divide(new BigDecimal(stockinB.getReceivedQty()), 20, BigDecimal.ROUND_HALF_UP).setScale(4, BigDecimal.ROUND_HALF_UP); noriginalcurprice = noriginalcurtaxprice.divide(new BigDecimal(1).add(new BigDecimal(tax)), 20, BigDecimal.ROUND_HALF_UP).setScale(4, BigDecimal.ROUND_HALF_UP); noriginalcurmny = noriginalcurprice.multiply(new BigDecimal(stockinB.getReceivedQty())).setScale(2, BigDecimal.ROUND_HALF_UP); noriginalcursummny = noriginalcurtaxprice.multiply(new BigDecimal(stockinB.getReceivedQty())).setScale(2, BigDecimal.ROUND_HALF_UP); @@ -425,9 +450,9 @@ public class SoSaleReturnPluginInitializerToB extends PluginBaseEntity { } //判断是否为赠品 - String isblargessflag = "N"; + Boolean isblargessflag = false; if (noriginalcursummny.longValue() == 0) { - isblargessflag = "Y"; + isblargessflag = true; } SaleorderRequestChildrenDto saleorderRequestChildrenDto = new SaleorderRequestChildrenDto(); @@ -501,13 +526,15 @@ public class SoSaleReturnPluginInitializerToB extends PluginBaseEntity { } /** - * 档案转换 + * 库存同步,档案转换 * * @author liuyang */ - private List queryBasicArchives(List returnGoodHeaderDetailsDataDtoList) { + private List queryBasicArchivesStock(List returnGoodHeaderDetailsDataDtoList) { + if (returnGoodHeaderDetailsDataDtoList != null) { + logger.info("库存同步:需要把OFS档案转换为U8C档案的O数据条数:{}", returnGoodHeaderDetailsDataDtoList.size()); + } List orderToBHeaderDtoArrayList = new ArrayList<>(); - if (returnGoodHeaderDetailsDataDtoList != null && returnGoodHeaderDetailsDataDtoList.size() > 0) { try { for (int i = 0; i < returnGoodHeaderDetailsDataDtoList.size(); i++) { @@ -685,6 +712,206 @@ public class SoSaleReturnPluginInitializerToB extends PluginBaseEntity { return orderToBHeaderDtoArrayList; } + /** + * 交易成功档案查询,档案转换 + * + * @author liuyang + */ + private List queryBasicArchivesTran(List returnGoodHeaderDetailsDataDtoList) { + if (returnGoodHeaderDetailsDataDtoList != null) { + logger.info("确认收入:需要把OFS档案转换为U8C档案的O数据条数:{}", returnGoodHeaderDetailsDataDtoList.size()); + } + List orderToBHeaderDtoArrayList = 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(); + + //查询售后订单 + SaleOrderMessageDto saleOrderMessageDto = null; + try { + saleOrderMessageDto = afterSalesOrderUtil.queryAfterSalesOrder(header); + } catch (Exception e) { + logger.error("查询出售后订单错误,失败原因:{}", e.getMessage()); + Assert.state(false, "查询出售后订单错误,失败原因:{}", e.getMessage()); + } + + if (saleOrderMessageDto == null) { + Assert.state(false, "没有匹配到售后订单,系统业务无法完成"); + } + HeaderDto header1 = saleOrderMessageDto.getData().get(0).getHeader(); + String memberId = header1.getMemberId(); + Assert.notNull(memberId, "TOB销售订单(OFS)表头会员id不能为空,否则无法匹配U8C客商档案!"); + Assert.state(!"".equals(memberId.trim()), "TOB销售订单(OFS)表头会员id不能为空,否则无法匹配U8C客商档案!"); + + // 销售公司、发货公司 + 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()); + } + + // 发货库存组织 + 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()); + } + + //销售组织 + //2024年8月13日 10:35:05 已经和佳妮在微信确认,U8C销售公司编码与U8C销售组织编码保持一致,因此通过销售公司编码匹配 + BdSalestruEntity bdSalestruEntity = new BdSalestruEntity(); + bdSalestruEntity.setDr(0); + bdSalestruEntity.setDataSourceCode("lets_u8c"); + bdSalestruEntity.setVsalestrucode(bdCorpEntityList.get(0).getUnitcode()); + List bdSalestruEntityList = iBdSalestruDao.query(bdSalestruEntity); + if (bdSalestruEntityList.size() == 0) { + Assert.state(false, "根据U8C销售公司编码:{},无法匹配到U8C销售组织", bdCorpEntityList.get(0).getUnitcode()); + } else if (bdSalestruEntityList.size() >= 2) { + Assert.state(false, "根据U8C销售公司编码:{},无法匹配到U8C销售组织", bdCorpEntityList.get(0).getUnitcode()); + } + + //业务部门 + //2024年8月14日 10:38:37 已经和佳妮确认 + String deptName = "其他部门"; + BdDeptdocEntity bdDeptdocEntity = new BdDeptdocEntity(); + bdDeptdocEntity.setDataSourceCode("lets_u8c"); + bdDeptdocEntity.setDr(0); + bdDeptdocEntity.setDeptname(deptName); + bdDeptdocEntity.setPkCorp(bdCorpEntityList.get(0).getPkCorp()); + List bdDeptdocEntityList = iBdDeptdocDao.query(bdDeptdocEntity); + if (bdDeptdocEntityList.size() == 0) { + Assert.state(false, "根据部门名称:{} 公司id:{},无法匹配到U8C销售组织", deptName, bdCorpEntityList.get(0).getPkCorp()); + } else if (bdDeptdocEntityList.size() >= 2) { + Assert.state(false, "根据部门名称:{} 公司id:{},匹配到U8C销售组织{}个", deptName, bdCorpEntityList.get(0).getPkCorp()); + } + + //客商基本档案 + BdCubasdocEntity bdCubasdocEntity = new BdCubasdocEntity(); + bdCubasdocEntity.setDataSourceCode("lets_u8c"); + bdCubasdocEntity.setDr(0L); + bdCubasdocEntity.setDef1(memberId); + List bdCubasdocEntityList = iBdCubasdocDao.query(bdCubasdocEntity); + if (bdCubasdocEntityList == null || bdCubasdocEntityList.size() == 0) { + Assert.state(false, "根据OFS会员id{},无法查询到U8C客商基本档案", memberId); + } else if (bdCubasdocEntityList.size() >= 2) { + Assert.state(false, "根据OFS会员id{},无法查询到U8C客商基本档案", memberId); + } + + //客商管理档案 + BdCumandocEntity bdCumandocEntity1 = new BdCumandocEntity(); + bdCumandocEntity1.setDataSourceCode("lets_u8c"); + bdCumandocEntity1.setDr(0L); + bdCumandocEntity1.setPkCorp(bdCorpEntityList.get(0).getPkCorp()); + bdCumandocEntity1.setPkCubasdoc(bdCubasdocEntityList.get(0).getPkCubasdoc()); + bdCumandocEntity1.setCustflags(ProfilesActiveConstant.CUSTOMER); + List bdCumandocEntityList = iBdCumandocDao.query(bdCumandocEntity1); + if (bdCumandocEntityList == null || bdCumandocEntityList.size() == 0) { + Assert.state(false, "根据客商基本档案主键{},没有办法查询到客商管理档案", bdCubasdocEntityList.get(0).getPkCubasdoc()); + } + + //查找平台 + String platformZdyId = "0001A210000000000JUD"; + String sourcePlatformCode = header.getSourcePlatformCode(); + BdDefdocEntity bdDefdocEntity = new BdDefdocEntity(); + bdDefdocEntity.setPkDefdoclist(platformZdyId); + bdDefdocEntity.setDr(0); + bdDefdocEntity.setDataSourceCode("lets_u8c"); + bdDefdocEntity.setDoccode(sourcePlatformCode); + List bdDefdocEntityList = iBdDefdocDao.query(bdDefdocEntity); + if (bdDefdocEntityList.size() == 0) { + Assert.state(false, "根据O平台编码{},无法匹配到U8C平台自定义档案 自定义档案主键:{}", sourcePlatformCode, platformZdyId); + } else if (bdDefdocEntityList.size() >= 2) { + Assert.state(false, "根据O平台编码{},无法匹配到U8C平台自定义档案 自定义档案主键:{}", sourcePlatformCode, platformZdyId); + } + + //查询U8C店铺档案 + String platformZdyId2 = "0001A210000000000XZX"; + String ofsStoreCode = header.getStoreCode(); + BdDefdocEntity bdDefdocEntity2 = new BdDefdocEntity(); + bdDefdocEntity2.setPkDefdoclist(platformZdyId2); + bdDefdocEntity2.setDr(0); + bdDefdocEntity2.setDataSourceCode("lets_u8c"); + bdDefdocEntity2.setDoccode(ofsStoreCode); + List bdDefdocEntityList2 = iBdDefdocDao.query(bdDefdocEntity2); + if (bdDefdocEntityList2.size() == 0) { + Assert.state(false, "根据O店铺编码{},无法匹配到U8C店铺自定义档案 自定义档案主键:{}", ofsStoreCode, platformZdyId); + } else if (bdDefdocEntityList2.size() >= 2) { + Assert.state(false, "根据O店铺编码{},无法匹配到U8C店铺自定义档案 自定义档案主键:{}", ofsStoreCode, platformZdyId); + } + + //2024年8月28日 11:01:07 查询对应的U8C销售订单 + SoSaleEntity soSaleEntity = new SoSaleEntity(); + soSaleEntity.setDr(0L); + soSaleEntity.setDataSourceCode("lets_u8c"); + soSaleEntity.setVdef19(header.getCode()); + soSaleEntity.setVdef20(header.getId()); + List soSaleEntityList = iSoSaleDao.query(soSaleEntity); + if (soSaleEntityList == null || soSaleEntityList.size() == 0) { + Assert.state(false, "根据O出库单主键:{} 单号:{} 无法匹配到U8C销售订单(传到U8C可能失败了!)", header.getId(), header.getCode()); + } else if (soSaleEntityList.size() >= 2) { + Assert.state(false, "根据O出库单主键:{} 单号:{} 匹配到{}个U8C销售订单", header.getId(), header.getCode(), soSaleEntityList.size()); + } + + OrderToBHeaderDto orderOutTobHeaderDto = new OrderToBHeaderDto(); + orderOutTobHeaderDto.setBdCorpEntity(bdCorpEntityList.get(0)); + orderOutTobHeaderDto.setBdCalbodyEntity(bdCalbodyEntities.get(0)); + orderOutTobHeaderDto.setBdStordocEntity(bdStordocEntityList.get(0)); + orderOutTobHeaderDto.setBdSalestruEntity(bdSalestruEntityList.get(0)); + orderOutTobHeaderDto.setBdDeptdocEntity(bdDeptdocEntityList.get(0)); + orderOutTobHeaderDto.setBdCumandocEntity(bdCumandocEntityList.get(0)); + orderOutTobHeaderDto.setBdCubasdocEntity(bdCubasdocEntityList.get(0)); + orderOutTobHeaderDto.setDeliverGoodsCorp(bdCorpEntityList.get(0)); + orderOutTobHeaderDto.setPlatformArchives(bdDefdocEntityList.get(0)); + orderOutTobHeaderDto.setShopArchives(bdDefdocEntityList2.get(0)); + orderOutTobHeaderDto.setSaleOrderMessageDto(saleOrderMessageDto); + orderOutTobHeaderDto.setSoSaleEntity(soSaleEntityList.get(0)); + + orderOutTobHeaderDto.setHeader(header); + orderOutTobHeaderDto.setDetails(details); + + orderToBHeaderDtoArrayList.add(orderOutTobHeaderDto); + } + //成功 + } catch (Exception e) { + logger.error("OFS销售出库单关联查询U8C档案失败", e); + //失败 + } + } else { + logger.info("queryBasicArchives方法对应的returnGoodHeaderDetailsDataDtoList.size为0"); + } + return orderToBHeaderDtoArrayList; + } + /** * bean copy * 2024年8月15日 14:19:36 @@ -757,9 +984,6 @@ public class SoSaleReturnPluginInitializerToB extends PluginBaseEntity { Assert.notNull(detailsDto.getSkuCode(), "O存货商家编码不能为空"); Assert.notNull(pkCorp, "发货公司主键不能为空"); - //TODO 测试 - detailsDto.setSkuCode("6973391730617"); - BdInvmandocEntity bdInvmandocEntity = new BdInvmandocEntity(); bdInvmandocEntity.setInvcode(detailsDto.getSkuCode()); bdInvmandocEntity.setPkCorp(pkCorp); @@ -884,4 +1108,218 @@ public class SoSaleReturnPluginInitializerToB extends PluginBaseEntity { tocofsReturngoodsDetailedEntity.setBusinessType("TOB_RETURN");//业务类型 } } + + /** + * 交易成功,代码同步逻辑 + * + * @param returnGoodHeaderDetailsDataDtoList 查询得到的O出库单对象 + * @author liuyang + */ + private void implementSuccessfulTrade(List returnGoodHeaderDetailsDataDtoList) throws Exception { + if (returnGoodHeaderDetailsDataDtoList != null) { + logger.info("TOB退货业务交易成功:{}行需要进行数据转换", returnGoodHeaderDetailsDataDtoList.size()); + } + if (returnGoodHeaderDetailsDataDtoList != null && returnGoodHeaderDetailsDataDtoList.size() > 0) { + try { + // 查询基本档案 + List orderToBHeaderDtos = queryBasicArchivesTran(returnGoodHeaderDetailsDataDtoList); + // 查询U8C业务流程 + BdBusitypeEntity bdBusitypeEntity = u8cOperationFlow(); + // 查询销售收发类别 + BdRdclEntity bdRdclEntity = rdclUtil.queryRdClObject("201"); + + for (int i = 0; i < orderToBHeaderDtos.size(); i++) { + OrderToBHeaderDto orderOutTobHeaderDto = orderToBHeaderDtos.get(i); + StockinOrderSearchResponse.StockinOrder.StockinH header = orderOutTobHeaderDto.getHeader(); + List details = orderOutTobHeaderDto.getDetails(); + + //销售公司、发货公司 + BdCorpEntity bdCorpEntity = orderOutTobHeaderDto.getBdCorpEntity(); + //发货库存组织 + BdCalbodyEntity bdCalbodyEntity = orderOutTobHeaderDto.getBdCalbodyEntity(); + //入库参数 + BdStordocEntity bdStordocEntity = orderOutTobHeaderDto.getBdStordocEntity(); + //销售组织 + BdSalestruEntity bdSalestruEntity = orderOutTobHeaderDto.getBdSalestruEntity(); + //业务部门 + BdDeptdocEntity bdDeptdocEntity = orderOutTobHeaderDto.getBdDeptdocEntity(); + //客商基本档案 + BdCubasdocEntity bdCubasdocEntity = orderOutTobHeaderDto.getBdCubasdocEntity(); + //客商管理档案 + BdCumandocEntity bdCumandocEntity = orderOutTobHeaderDto.getBdCumandocEntity(); + //发货公司 + BdCorpEntity deliverGoodsCorp = orderOutTobHeaderDto.getDeliverGoodsCorp(); + //平台档案 + BdDefdocEntity platformArchives = orderOutTobHeaderDto.getPlatformArchives(); + //生成业务日期 + String successfulTradeDate = createSuccessFulTradeDate(orderOutTobHeaderDto); + //店铺 + BdDefdocEntity shopArchives = orderOutTobHeaderDto.getShopArchives(); + //U8C销售订单 + SoSaleEntity soSaleEntity = orderOutTobHeaderDto.getSoSaleEntity(); + //OFS售后订单 + SaleOrderMessageDto saleOrderMessageDto = orderOutTobHeaderDto.getSaleOrderMessageDto(); + + SalesInvoiceHeadDto salesInvoiceHeadDto = new SalesInvoiceHeadDto(); + salesInvoiceHeadDto.setCbiztype(bdBusitypeEntity.getPkBusitype()); + salesInvoiceHeadDto.setCcalbodyid(bdCalbodyEntity.getPkCalbody()); + salesInvoiceHeadDto.setCoperatorid("0001A110000000000U3D");//制单人 + salesInvoiceHeadDto.setCreceiptcorpid(bdCumandocEntity.getPkCumandoc()); + salesInvoiceHeadDto.setCsalecorpid(bdSalestruEntity.getCsalestruid()); + salesInvoiceHeadDto.setPk_corp(bdCorpEntity.getPkCorp()); + salesInvoiceHeadDto.setDbilldate(successfulTradeDate); + salesInvoiceHeadDto.setFinvoicetype("1");//不传默认为1 + salesInvoiceHeadDto.setVdef17(ProfilesActiveConstant.sourceSystem1); + salesInvoiceHeadDto.setVdef19(header.getCode()); + salesInvoiceHeadDto.setVdef20(header.getId()); + + List salesInvoiceBodyDtoList = new ArrayList<>(); + for (int j = 0; j < details.size(); j++) { + StockinOrderSearchResponse.StockinOrder.StockinB stockinB = details.get(j); + //存货管理档案:取发货公司的存货管理档案 + BdInvmandocEntity bdInvmandocEntity = queryInventoryMan(stockinB, bdCalbodyEntity.getPkCorp()); + //存货基础档案 + BdInvbasdocEntity bdInvbasdocEntity = queryStockBasicArchives(bdInvmandocEntity.getPkInvmandoc(), deliverGoodsCorp.getPkCorp()); + //根据存货基础档案编码,查询当前存货的税率 + BdTaxitemsEntity bdTaxitemsEntity1 = queryBdTaxitems(bdInvbasdocEntity.getInvcode()); + //对应的售后入库单,主要是取这个价格 + DetailsDto afterSalesOrder = findAfterSalesOrder(stockinB, saleOrderMessageDto); + + BigDecimal noriginalcurtaxprice = null;//含税单价 + try { + noriginalcurtaxprice = new BigDecimal(afterSalesOrder.getTotalAmount()).divide(new BigDecimal(stockinB.getReceivedQty()), 20, BigDecimal.ROUND_HALF_UP).setScale(4, BigDecimal.ROUND_HALF_UP); + } catch (Exception e) { + logger.error("含税单价金额计算失败!", e); + } + + Boolean isblargessflag = false; + if (noriginalcurtaxprice == null) { + isblargessflag = true; + } + + SalesInvoiceBodyDto salesInvoiceBodyDto = new SalesInvoiceBodyDto(); + salesInvoiceBodyDto.setCinventoryid(bdInvmandocEntity.getPkInvmandoc()); + salesInvoiceBodyDto.setCupreceipttype("4C"); + salesInvoiceBodyDto.setCupsourcebillcode(soSaleEntity.getVreceiptcode()); + salesInvoiceBodyDto.setNnumber("-" + stockinB.getReceivedQty()); + salesInvoiceBodyDto.setNoriginalcurtaxprice(noriginalcurtaxprice.stripTrailingZeros().toPlainString());//含税单价 + salesInvoiceBodyDto.setNtaxrate(new BigDecimal(bdTaxitemsEntity1.getTaxratio()).stripTrailingZeros().toPlainString());//税率 + salesInvoiceBodyDto.setBlargessflag(isblargessflag); + salesInvoiceBodyDtoList.add(salesInvoiceBodyDto); + } + SalesInvoiceDto salesInvoiceDto = new SalesInvoiceDto(); + salesInvoiceDto.setParentvo(salesInvoiceHeadDto); + salesInvoiceDto.setChildrenvo(salesInvoiceBodyDtoList); + + List salesInvoiceDtoList = new ArrayList<>(); + salesInvoiceDtoList.add(salesInvoiceDto); + + Map> stringListMap = new HashMap<>(); + stringListMap.put("billvos", salesInvoiceDtoList); + + //推送到U8C生成销售发票 + SoSaleResultRootDto soSaleResultRootDto = sendU8CTOCSoSaleinvoiceB(JSON.toJSONString(stringListMap)); + //成功 + } + } catch (Exception e) { + logger.error("TOB外层转换逻辑抛出异常", e); + // 记录失败 + } + } + } + + /** + * 2024年8月28日 17:17:33 + * 生成业务日期,以交易成功时间作为业务日期 + * + * @author liuyang + */ + private String createSuccessFulTradeDate(OrderToBHeaderDto orderOutTobHeaderDto) { + if (orderOutTobHeaderDto != null && orderOutTobHeaderDto.getHeader() != null && orderOutTobHeaderDto.getHeader().getTradeSuccessAt() != null) { + StockinOrderSearchResponse.StockinOrder.StockinH header = orderOutTobHeaderDto.getHeader(); + String shipAt = header.getTradeSuccessAt(); + String businessFormat = null; + try { + Date dbill = DateUtil.parse(shipAt); + businessFormat = DateUtil.format(dbill, "yyyy-MM-dd"); + } catch (Exception e) { + logger.error("tradeSuccessAt业务日期生成失败", e); + } + return businessFormat; + } else { + logger.error("生成出库日期失败,或者tradeSuccessAt为空! json:{}", JSON.toJSON(orderOutTobHeaderDto)); + Assert.state(false, "生成出库日期失败,或者tradeSuccessAt为空! json:{}", JSON.toJSON(orderOutTobHeaderDto)); + return null; + } + } + + /** + * 2024年8月28日 11:57:58 + * 推送U8C销售发票 + * + * @author liuyang + */ + public SoSaleResultRootDto sendU8CTOCSoSaleinvoiceB(String param) throws Exception { + long startLong = System.currentTimeMillis(); + logger.info("TOB销售发票推送开始,推送参数:" + 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", "8000370057")//头信息,多个头信息多次调用此方法即可 + .header("publicKey", "ZJYAWb7lhAUTYqekPkU+uHJv1/ObJxb7dT7sD8HPRDGAgyhCe7eDIk+3zDUT+v578prj")//头信息,多个头信息多次调用此方法即可 + .header("secretKey", "fviZnLBsQUAGF8w8FSOdJi7XlIm/XAZclMxRagDLfTyJFlvnIBF3w66Hrpfzs8cYj3JzOP8MtA1LSGvL+2BWG8c/o7DKi92S4mr3zcGearA=")//头信息,多个头信息多次调用此方法即可 + .body(param)//表单内容 + .timeout(20000)//超时,毫秒 + .execute().body(); + logger.info("TOB销售发票结束,返回参数:" + result); + long endLong = System.currentTimeMillis(); + logger.info("TOB销售发票接口请求耗时:" + (endLong - startLong)); + + JSONObject jsonObject = JSON.parseObject(result); + result = String.valueOf(jsonObject.get("attribute")); + + boolean isSuccess = false; + SoSaleResultRootDto soSaleResultRootDto = null; + if (result != null && !"".equals(result)) { + ReusltStrDto reusltStrDto = JSON.parseObject(result, ReusltStrDto.class); + if ("success".equals(reusltStrDto.getStatus())) { + soSaleResultRootDto = resultDataHandle(reusltStrDto.getData()); + isSuccess = true; + } + } + if (!isSuccess) { + Assert.state(false, "TOB业务O出库单推送U8C销售发票失败 接口返回结果:{}", result); + } + return soSaleResultRootDto; + } + + /** + * 通过售后入库单明细行,查找售后订单明细行 + * + * @param stockinB 售后订单明细行 + * @param saleOrderMessageDto OFS售后订单 + * @author liuyang + */ + private DetailsDto findAfterSalesOrder(StockinOrderSearchResponse.StockinOrder.StockinB stockinB, SaleOrderMessageDto saleOrderMessageDto) { + Assert.notNull(stockinB, "stockinB不能为空!"); + Assert.notNull(saleOrderMessageDto, "saleOrderMessageDto不能为空!"); + + Assert.notNull(saleOrderMessageDto.getData(), "售后入库单对应的data属性不能为空!"); + List data = saleOrderMessageDto.getData(); + if (data == null || data.size() == 0) { + Assert.state(false, "售后入库单data属性,size不能为0!"); + } + if (!(data.get(0).getHeader() != null && data.get(0).getDetails() != null)) { + Assert.state(false, "售后入库单header属性不能为空!"); + } + HeaderDto header1 = data.get(0).getHeader(); + List details = data.get(0).getDetails(); + + for (int i = 0; i < details.size(); i++) { + DetailsDto detailsDto = details.get(i); + if (detailsDto.getId().equals(stockinB.getRefOrderDetailId())) { + return detailsDto; + } + } + Assert.state(false, "通过售后入库单号({})无法匹配到售后订单", stockinB.getId()); + return null; + } } \ No newline at end of file diff --git a/buildpackage/src/main/java/com/hzya/frame/plugin/lets/plugin/sales/SoSaleReturnPluginInitializerToC.java b/buildpackage/src/main/java/com/hzya/frame/plugin/lets/plugin/sales/SoSaleReturnPluginInitializerToC.java index bcc2ca4d..f844774a 100644 --- a/buildpackage/src/main/java/com/hzya/frame/plugin/lets/plugin/sales/SoSaleReturnPluginInitializerToC.java +++ b/buildpackage/src/main/java/com/hzya/frame/plugin/lets/plugin/sales/SoSaleReturnPluginInitializerToC.java @@ -19,11 +19,6 @@ import com.hzya.frame.plugin.lets.resultvo.CalculateDateVo; import com.hzya.frame.plugin.lets.u8cdto.*; import com.hzya.frame.plugin.lets.util.*; import com.hzya.frame.split.SplitListByCountUtil; -import com.hzya.frame.ttxofs.dto.InterfaceParamDto; -import com.hzya.frame.ttxofs.dto.returngoodsearch.RertunGoodsRootBean; -import com.hzya.frame.ttxofs.dto.returngoodsearch.ReturnGoodHeaderDetailsDataDto; -import com.hzya.frame.ttxofs.dto.returngoodsearch.ReturnGoodSearchDetailsDto; -import com.hzya.frame.ttxofs.dto.returngoodsearch.ReturnGoodSearchHeaderDto; import com.hzya.frame.ttxofs.dto.stock.StockinOrderSearchResponse; import com.hzya.frame.ttxofs.service.OfsUnifiedService; import com.hzya.frame.web.entity.JsonResultEntity; @@ -37,7 +32,7 @@ import java.util.concurrent.locks.ReentrantLock; import java.util.stream.Collectors; /** - * OFS售后入库单(TOC)生成U8C红字销售订单 + * OFS售后入库单(TOC)生成U8C红字销售订单、交易成功关联原单 * * @author makejava * @since 2023-08-16 15:49:55 @@ -108,6 +103,9 @@ public class SoSaleReturnPluginInitializerToC extends PluginBaseEntity { @Autowired private OfsStandardUtil ofsStandardUtil; + @Autowired + private RdclUtil rdclUtil; + /** * 按指定时间拉取 * @@ -357,6 +355,7 @@ public class SoSaleReturnPluginInitializerToC extends PluginBaseEntity { * @author liuyang */ private void implement(List returnGoodHeaderDetailsDataDtoList1) throws Exception { + logger.info("TOC退货业务:{}行需要进行数据转换", returnGoodHeaderDetailsDataDtoList1.size()); if (returnGoodHeaderDetailsDataDtoList1 != null && returnGoodHeaderDetailsDataDtoList1.size() > 0) { try { // 查询基本档案 @@ -365,6 +364,8 @@ public class SoSaleReturnPluginInitializerToC extends PluginBaseEntity { Map> summaryDimensionMap = groupSummary(goodsRertunSonDetailsDtos); // 查询U8C业务流程 BdBusitypeEntity bdBusitypeEntity = u8cOperationFlow(); + // 查询销售收发类别 + BdRdclEntity bdRdclEntity = rdclUtil.queryRdClObject("202"); if (bdBusitypeEntity != null && summaryDimensionMap != null) { Iterator>> iterator = summaryDimensionMap.entrySet().iterator(); @@ -415,6 +416,10 @@ public class SoSaleReturnPluginInitializerToC extends PluginBaseEntity { saleorderRequestParentDto.setVdef2(platformArchives.getDocname()); saleorderRequestParentDto.setVdef17(ProfilesActiveConstant.sourceSystem1);//来源系统 + //收发类别 + saleorderRequestParentDto.setPk_defdoc3(bdRdclEntity.getPkRdcl()); + saleorderRequestParentDto.setVdef3(bdRdclEntity.getRdname()); + //TODO 2024年8月8日 17:17:58 店铺档案自定义项1,先不传,后续维护好之后再传! saleorderRequestDto.setParentvo(saleorderRequestParentDto); @@ -453,9 +458,9 @@ public class SoSaleReturnPluginInitializerToC extends PluginBaseEntity { } //判断是否为赠品 - String isblargessflag = "N"; + Boolean isblargessflag = false; if (noriginalcursummny.longValue() == 0) { - isblargessflag = "Y"; + isblargessflag = true; } SaleorderRequestChildrenDto saleorderRequestChildrenDto = new SaleorderRequestChildrenDto(); diff --git a/buildpackage/src/main/java/com/hzya/frame/plugin/lets/u8cdto/OrderOutTobHeaderDto.java b/buildpackage/src/main/java/com/hzya/frame/plugin/lets/u8cdto/OrderOutTobHeaderDto.java index 0cb642fd..8738abdb 100644 --- a/buildpackage/src/main/java/com/hzya/frame/plugin/lets/u8cdto/OrderOutTobHeaderDto.java +++ b/buildpackage/src/main/java/com/hzya/frame/plugin/lets/u8cdto/OrderOutTobHeaderDto.java @@ -81,4 +81,9 @@ public class OrderOutTobHeaderDto extends HeaderDetailsDto { * OFS销售订单 */ private SaleOrderMessageDto saleOrderMessageDto; + + /** + * U8C销售订单 + */ + private SoSaleEntity soSaleEntity; } \ No newline at end of file diff --git a/buildpackage/src/main/java/com/hzya/frame/plugin/lets/u8cdto/OrderToBHeaderDto.java b/buildpackage/src/main/java/com/hzya/frame/plugin/lets/u8cdto/OrderToBHeaderDto.java index 5344b07e..bbd92c63 100644 --- a/buildpackage/src/main/java/com/hzya/frame/plugin/lets/u8cdto/OrderToBHeaderDto.java +++ b/buildpackage/src/main/java/com/hzya/frame/plugin/lets/u8cdto/OrderToBHeaderDto.java @@ -97,4 +97,9 @@ public class OrderToBHeaderDto { * 售后订单 */ private SaleOrderMessageDto saleOrderMessageDto; + + /** + * U8C销售订单 + */ + private SoSaleEntity soSaleEntity; } \ No newline at end of file diff --git a/buildpackage/src/main/java/com/hzya/frame/plugin/lets/u8cdto/ReturnOrderHeaderDto.java b/buildpackage/src/main/java/com/hzya/frame/plugin/lets/u8cdto/ReturnOrderHeaderDto.java index 1ce0b66f..7923c8f5 100644 --- a/buildpackage/src/main/java/com/hzya/frame/plugin/lets/u8cdto/ReturnOrderHeaderDto.java +++ b/buildpackage/src/main/java/com/hzya/frame/plugin/lets/u8cdto/ReturnOrderHeaderDto.java @@ -2,6 +2,7 @@ package com.hzya.frame.plugin.lets.u8cdto; import com.hzya.frame.plugin.lets.entity.*; import com.hzya.frame.ttxofs.dto.ofspurchasereturnorder.PurchaseReturnOrder; +import com.hzya.frame.ttxofs.dto.ofspurchasereturnorder.PurchaseReturnOrderDetails; import com.hzya.frame.ttxofs.dto.ofssaleorderoutsearch.DetailsDto; import com.hzya.frame.ttxofs.dto.ofssaleorderoutsearch.HeaderDto; import lombok.Data; @@ -19,39 +20,34 @@ import java.util.List; @Data public class ReturnOrderHeaderDto extends HeaderDto { /** - * OFS采购订单 + * OFS采退订单 */ private PurchaseReturnOrder purchaseReturnOrder; /** - * 委外订单公司 + * U8C委外订单 + */ + private ScOrderEntity scOrderEntity; + + /** + * U8C委外订单明细行 + */ + private List scOrderBEntityList; + + /** + * 公司 */ private BdCorpEntity bdCorpEntity; /** - * 库存组织 + * 收货库存组织 */ private BdCalbodyEntity bdCalbodyEntity; /** - * 供应商基本档案 + * 入库仓库 */ - private BdCubasdocEntity bdCubasdocEntity; - - /** - * 供应商管理档案 - */ - private BdCumandocEntity bdCumandocEntity; - - /** - * 采购组织 - */ - private BdPurorgEntity bdPurorgEntity; - - /** - * 业务流程 - */ - private BdBusitypeEntity bdBusitypeEntity; + private BdStordocEntity bdStordocEntity; /** * OFS采退出库单明细行 diff --git a/buildpackage/src/main/java/com/hzya/frame/plugin/lets/u8cdto/SaleorderRequestChildrenDto.java b/buildpackage/src/main/java/com/hzya/frame/plugin/lets/u8cdto/SaleorderRequestChildrenDto.java index c94bd363..1a024f07 100644 --- a/buildpackage/src/main/java/com/hzya/frame/plugin/lets/u8cdto/SaleorderRequestChildrenDto.java +++ b/buildpackage/src/main/java/com/hzya/frame/plugin/lets/u8cdto/SaleorderRequestChildrenDto.java @@ -1,7 +1,10 @@ package com.hzya.frame.plugin.lets.u8cdto; +import lombok.Data; + +@Data public class SaleorderRequestChildrenDto { - public String blargessflag; + public Boolean blargessflag; public String cadvisecalbodyid; public String cbatchid; public String cbodywarehouseid; @@ -105,741 +108,5 @@ public class SaleorderRequestChildrenDto { * 存货编码:这个字段不需要传递到openapi接口 */ public String cinventorycode; - - public String getCinventorycode() { - return cinventorycode; - } - - public void setCinventorycode(String cinventorycode) { - this.cinventorycode = cinventorycode; - } - - public String getVdef1Code() { - return vdef1Code; - } - - public void setVdef1Code(String vdef1Code) { - this.vdef1Code = vdef1Code; - } - - public String getCbodywarehousecode() { - return cbodywarehousecode; - } - - public void setCbodywarehousecode(String cbodywarehousecode) { - this.cbodywarehousecode = cbodywarehousecode; - } - - public String getBlargessflag() { - return blargessflag; - } - - public void setBlargessflag(String blargessflag) { - this.blargessflag = blargessflag; - } - - public String getCadvisecalbodyid() { - return cadvisecalbodyid; - } - - public void setCadvisecalbodyid(String cadvisecalbodyid) { - this.cadvisecalbodyid = cadvisecalbodyid; - } - - public String getCbatchid() { - return cbatchid; - } - - public void setCbatchid(String cbatchid) { - this.cbatchid = cbatchid; - } - - public String getCbodywarehouseid() { - return cbodywarehouseid; - } - - public void setCbodywarehouseid(String cbodywarehouseid) { - this.cbodywarehouseid = cbodywarehouseid; - } - - public String getCconsigncorpid() { - return cconsigncorpid; - } - - public void setCconsigncorpid(String cconsigncorpid) { - this.cconsigncorpid = cconsigncorpid; - } - - public String getCcurrencytypeid() { - return ccurrencytypeid; - } - - public void setCcurrencytypeid(String ccurrencytypeid) { - this.ccurrencytypeid = ccurrencytypeid; - } - - public String getCinventoryid() { - return cinventoryid; - } - - public void setCinventoryid(String cinventoryid) { - this.cinventoryid = cinventoryid; - } - - public String getCpackunitid() { - return cpackunitid; - } - - public void setCpackunitid(String cpackunitid) { - this.cpackunitid = cpackunitid; - } - - public String getCprojectid() { - return cprojectid; - } - - public void setCprojectid(String cprojectid) { - this.cprojectid = cprojectid; - } - - public String getCrecaddrnode() { - return crecaddrnode; - } - - public void setCrecaddrnode(String crecaddrnode) { - this.crecaddrnode = crecaddrnode; - } - - public String getCreccalbodyid() { - return creccalbodyid; - } - - public void setCreccalbodyid(String creccalbodyid) { - this.creccalbodyid = creccalbodyid; - } - - public String getCreceiptareaid() { - return creceiptareaid; - } - - public void setCreceiptareaid(String creceiptareaid) { - this.creceiptareaid = creceiptareaid; - } - - public String getCreceiptcorpid() { - return creceiptcorpid; - } - - public void setCreceiptcorpid(String creceiptcorpid) { - this.creceiptcorpid = creceiptcorpid; - } - - public String getCreceipttype() { - return creceipttype; - } - - public void setCreceipttype(String creceipttype) { - this.creceipttype = creceipttype; - } - - public String getCrecwareid() { - return crecwareid; - } - - public void setCrecwareid(String crecwareid) { - this.crecwareid = crecwareid; - } - - public String getCrowno() { - return crowno; - } - - public void setCrowno(String crowno) { - this.crowno = crowno; - } - - public String getCsourcebillbodyid() { - return csourcebillbodyid; - } - - public void setCsourcebillbodyid(String csourcebillbodyid) { - this.csourcebillbodyid = csourcebillbodyid; - } - - public String getCsourcebillcode() { - return csourcebillcode; - } - - public void setCsourcebillcode(String csourcebillcode) { - this.csourcebillcode = csourcebillcode; - } - - public String getCsourcebillid() { - return csourcebillid; - } - - public void setCsourcebillid(String csourcebillid) { - this.csourcebillid = csourcebillid; - } - - public String getDconsigndate() { - return dconsigndate; - } - - public void setDconsigndate(String dconsigndate) { - this.dconsigndate = dconsigndate; - } - - public String getDdeliverdate() { - return ddeliverdate; - } - - public void setDdeliverdate(String ddeliverdate) { - this.ddeliverdate = ddeliverdate; - } - - public String getFrownote() { - return frownote; - } - - public void setFrownote(String frownote) { - this.frownote = frownote; - } - - public String getNestbalancenumber() { - return nestbalancenumber; - } - - public void setNestbalancenumber(String nestbalancenumber) { - this.nestbalancenumber = nestbalancenumber; - } - - public String getNexchangeotobrate() { - return nexchangeotobrate; - } - - public void setNexchangeotobrate(String nexchangeotobrate) { - this.nexchangeotobrate = nexchangeotobrate; - } - - public String getNitemdiscountrate() { - return nitemdiscountrate; - } - - public void setNitemdiscountrate(String nitemdiscountrate) { - this.nitemdiscountrate = nitemdiscountrate; - } - - public String getNnumber() { - return nnumber; - } - - public void setNnumber(String nnumber) { - this.nnumber = nnumber; - } - - public String getNoriginalcurdiscountmny() { - return noriginalcurdiscountmny; - } - - public void setNoriginalcurdiscountmny(String noriginalcurdiscountmny) { - this.noriginalcurdiscountmny = noriginalcurdiscountmny; - } - - public String getNoriginalcurmny() { - return noriginalcurmny; - } - - public void setNoriginalcurmny(String noriginalcurmny) { - this.noriginalcurmny = noriginalcurmny; - } - - public String getNoriginalcurnetprice() { - return noriginalcurnetprice; - } - - public void setNoriginalcurnetprice(String noriginalcurnetprice) { - this.noriginalcurnetprice = noriginalcurnetprice; - } - - public String getNoriginalcurprice() { - return noriginalcurprice; - } - - public void setNoriginalcurprice(String noriginalcurprice) { - this.noriginalcurprice = noriginalcurprice; - } - - public String getNoriginalcursummny() { - return noriginalcursummny; - } - - public void setNoriginalcursummny(String noriginalcursummny) { - this.noriginalcursummny = noriginalcursummny; - } - - public String getNoriginalcurtaxmny() { - return noriginalcurtaxmny; - } - - public void setNoriginalcurtaxmny(String noriginalcurtaxmny) { - this.noriginalcurtaxmny = noriginalcurtaxmny; - } - - public String getNoriginalcurtaxnetprice() { - return noriginalcurtaxnetprice; - } - - public void setNoriginalcurtaxnetprice(String noriginalcurtaxnetprice) { - this.noriginalcurtaxnetprice = noriginalcurtaxnetprice; - } - - public String getNoriginalcurtaxprice() { - return noriginalcurtaxprice; - } - - public void setNoriginalcurtaxprice(String noriginalcurtaxprice) { - this.noriginalcurtaxprice = noriginalcurtaxprice; - } - - public String getNpacknumber() { - return npacknumber; - } - - public void setNpacknumber(String npacknumber) { - this.npacknumber = npacknumber; - } - - public String getNtaxrate() { - return ntaxrate; - } - - public void setNtaxrate(String ntaxrate) { - this.ntaxrate = ntaxrate; - } - - public String getNtotalbalancenumber() { - return ntotalbalancenumber; - } - - public void setNtotalbalancenumber(String ntotalbalancenumber) { - this.ntotalbalancenumber = ntotalbalancenumber; - } - - public String getNtotalinventorynumber() { - return ntotalinventorynumber; - } - - public void setNtotalinventorynumber(String ntotalinventorynumber) { - this.ntotalinventorynumber = ntotalinventorynumber; - } - - public String getNtotalinvoicenumber() { - return ntotalinvoicenumber; - } - - public void setNtotalinvoicenumber(String ntotalinvoicenumber) { - this.ntotalinvoicenumber = ntotalinvoicenumber; - } - - public String getNtotalreceivenumber() { - return ntotalreceivenumber; - } - - public void setNtotalreceivenumber(String ntotalreceivenumber) { - this.ntotalreceivenumber = ntotalreceivenumber; - } - - public String getNtotlbalcostnum() { - return ntotlbalcostnum; - } - - public void setNtotlbalcostnum(String ntotlbalcostnum) { - this.ntotlbalcostnum = ntotlbalcostnum; - } - - public String getPk_defdoc1() { - return pk_defdoc1; - } - - public void setPk_defdoc1(String pk_defdoc1) { - this.pk_defdoc1 = pk_defdoc1; - } - - public String getPk_defdoc10() { - return pk_defdoc10; - } - - public void setPk_defdoc10(String pk_defdoc10) { - this.pk_defdoc10 = pk_defdoc10; - } - - public String getPk_defdoc11() { - return pk_defdoc11; - } - - public void setPk_defdoc11(String pk_defdoc11) { - this.pk_defdoc11 = pk_defdoc11; - } - - public String getPk_defdoc12() { - return pk_defdoc12; - } - - public void setPk_defdoc12(String pk_defdoc12) { - this.pk_defdoc12 = pk_defdoc12; - } - - public String getPk_defdoc13() { - return pk_defdoc13; - } - - public void setPk_defdoc13(String pk_defdoc13) { - this.pk_defdoc13 = pk_defdoc13; - } - - public String getPk_defdoc14() { - return pk_defdoc14; - } - - public void setPk_defdoc14(String pk_defdoc14) { - this.pk_defdoc14 = pk_defdoc14; - } - - public String getPk_defdoc15() { - return pk_defdoc15; - } - - public void setPk_defdoc15(String pk_defdoc15) { - this.pk_defdoc15 = pk_defdoc15; - } - - public String getPk_defdoc16() { - return pk_defdoc16; - } - - public void setPk_defdoc16(String pk_defdoc16) { - this.pk_defdoc16 = pk_defdoc16; - } - - public String getPk_defdoc17() { - return pk_defdoc17; - } - - public void setPk_defdoc17(String pk_defdoc17) { - this.pk_defdoc17 = pk_defdoc17; - } - - public String getPk_defdoc18() { - return pk_defdoc18; - } - - public void setPk_defdoc18(String pk_defdoc18) { - this.pk_defdoc18 = pk_defdoc18; - } - - public String getPk_defdoc19() { - return pk_defdoc19; - } - - public void setPk_defdoc19(String pk_defdoc19) { - this.pk_defdoc19 = pk_defdoc19; - } - - public String getPk_defdoc2() { - return pk_defdoc2; - } - - public void setPk_defdoc2(String pk_defdoc2) { - this.pk_defdoc2 = pk_defdoc2; - } - - public String getPk_defdoc20() { - return pk_defdoc20; - } - - public void setPk_defdoc20(String pk_defdoc20) { - this.pk_defdoc20 = pk_defdoc20; - } - - public String getPk_defdoc3() { - return pk_defdoc3; - } - - public void setPk_defdoc3(String pk_defdoc3) { - this.pk_defdoc3 = pk_defdoc3; - } - - public String getPk_defdoc4() { - return pk_defdoc4; - } - - public void setPk_defdoc4(String pk_defdoc4) { - this.pk_defdoc4 = pk_defdoc4; - } - - public String getPk_defdoc5() { - return pk_defdoc5; - } - - public void setPk_defdoc5(String pk_defdoc5) { - this.pk_defdoc5 = pk_defdoc5; - } - - public String getPk_defdoc6() { - return pk_defdoc6; - } - - public void setPk_defdoc6(String pk_defdoc6) { - this.pk_defdoc6 = pk_defdoc6; - } - - public String getPk_defdoc7() { - return pk_defdoc7; - } - - public void setPk_defdoc7(String pk_defdoc7) { - this.pk_defdoc7 = pk_defdoc7; - } - - public String getPk_defdoc8() { - return pk_defdoc8; - } - - public void setPk_defdoc8(String pk_defdoc8) { - this.pk_defdoc8 = pk_defdoc8; - } - - public String getPk_defdoc9() { - return pk_defdoc9; - } - - public void setPk_defdoc9(String pk_defdoc9) { - this.pk_defdoc9 = pk_defdoc9; - } - - public String getVdef1() { - return vdef1; - } - - public void setVdef1(String vdef1) { - this.vdef1 = vdef1; - } - - public String getVdef10() { - return vdef10; - } - - public void setVdef10(String vdef10) { - this.vdef10 = vdef10; - } - - public String getVdef11() { - return vdef11; - } - - public void setVdef11(String vdef11) { - this.vdef11 = vdef11; - } - - public String getVdef12() { - return vdef12; - } - - public void setVdef12(String vdef12) { - this.vdef12 = vdef12; - } - - public String getVdef13() { - return vdef13; - } - - public void setVdef13(String vdef13) { - this.vdef13 = vdef13; - } - - public String getVdef14() { - return vdef14; - } - - public void setVdef14(String vdef14) { - this.vdef14 = vdef14; - } - - public String getVdef15() { - return vdef15; - } - - public void setVdef15(String vdef15) { - this.vdef15 = vdef15; - } - - public String getVdef16() { - return vdef16; - } - - public void setVdef16(String vdef16) { - this.vdef16 = vdef16; - } - - public String getVdef17() { - return vdef17; - } - - public void setVdef17(String vdef17) { - this.vdef17 = vdef17; - } - - public String getVdef18() { - return vdef18; - } - - public void setVdef18(String vdef18) { - this.vdef18 = vdef18; - } - - public String getVdef19() { - return vdef19; - } - - public void setVdef19(String vdef19) { - this.vdef19 = vdef19; - } - - public String getVdef2() { - return vdef2; - } - - public void setVdef2(String vdef2) { - this.vdef2 = vdef2; - } - - public String getVdef20() { - return vdef20; - } - - public void setVdef20(String vdef20) { - this.vdef20 = vdef20; - } - - public String getVdef3() { - return vdef3; - } - - public void setVdef3(String vdef3) { - this.vdef3 = vdef3; - } - - public String getVdef4() { - return vdef4; - } - - public void setVdef4(String vdef4) { - this.vdef4 = vdef4; - } - - public String getVdef5() { - return vdef5; - } - - public void setVdef5(String vdef5) { - this.vdef5 = vdef5; - } - - public String getVdef6() { - return vdef6; - } - - public void setVdef6(String vdef6) { - this.vdef6 = vdef6; - } - - public String getVdef7() { - return vdef7; - } - - public void setVdef7(String vdef7) { - this.vdef7 = vdef7; - } - - public String getVdef8() { - return vdef8; - } - - public void setVdef8(String vdef8) { - this.vdef8 = vdef8; - } - - public String getVdef9() { - return vdef9; - } - - public void setVdef9(String vdef9) { - this.vdef9 = vdef9; - } - - public String getVfree1() { - return vfree1; - } - - public void setVfree1(String vfree1) { - this.vfree1 = vfree1; - } - - public String getVfree2() { - return vfree2; - } - - public void setVfree2(String vfree2) { - this.vfree2 = vfree2; - } - - public String getVfree3() { - return vfree3; - } - - public void setVfree3(String vfree3) { - this.vfree3 = vfree3; - } - - public String getVfree4() { - return vfree4; - } - - public void setVfree4(String vfree4) { - this.vfree4 = vfree4; - } - - public String getVfree5() { - return vfree5; - } - - public void setVfree5(String vfree5) { - this.vfree5 = vfree5; - } - - public String getVostatus() { - return vostatus; - } - - public void setVostatus(String vostatus) { - this.vostatus = vostatus; - } - - public String getVreceiveaddress() { - return vreceiveaddress; - } - - public void setVreceiveaddress(String vreceiveaddress) { - this.vreceiveaddress = vreceiveaddress; - } - - public String getVsourcerowno() { - return vsourcerowno; - } - - public void setVsourcerowno(String vsourcerowno) { - this.vsourcerowno = vsourcerowno; - } } diff --git a/buildpackage/src/main/java/com/hzya/frame/plugin/lets/u8cdto/SalesInvoiceBodyDto.java b/buildpackage/src/main/java/com/hzya/frame/plugin/lets/u8cdto/SalesInvoiceBodyDto.java new file mode 100644 index 00000000..cbfd0a6a --- /dev/null +++ b/buildpackage/src/main/java/com/hzya/frame/plugin/lets/u8cdto/SalesInvoiceBodyDto.java @@ -0,0 +1,39 @@ +package com.hzya.frame.plugin.lets.u8cdto; + +import lombok.Data; + +/** + * @Author:liuyang + * @Package:com.hzya.frame.plugin.lets.u8cdto + * @Project:kangarooDataCenterV3 + * @name:SalesInvoiceBody + * @Date:2024/8/28 11:11 + * @Filename:SalesInvoiceBody + */ +@Data +public class SalesInvoiceBodyDto { + private Boolean blargessflag; + private String cinventoryid; + private String cpackunitid; + private String cprojectid; + private String cquoteunitid; + private String crowno; + private String cupreceipttype; + private String cupsourcebillcode; + private String ddeliverdate; + private String frownote; + private String nitemdiscountrate; + private String nnumber; + private String noriginalcurmny; + private String noriginalcurnetprice; + private String noriginalcurprice; + private String noriginalcursummny; + private String noriginalcurtaxnetprice; + private String noriginalcurtaxprice; + private String npacknumber; + private String ntaxrate; + private String pk_defdoc1; + private String vdef1; + private String vfree1; + private String vsourcerowno; +} diff --git a/buildpackage/src/main/java/com/hzya/frame/plugin/lets/u8cdto/SalesInvoiceDto.java b/buildpackage/src/main/java/com/hzya/frame/plugin/lets/u8cdto/SalesInvoiceDto.java new file mode 100644 index 00000000..93c446ed --- /dev/null +++ b/buildpackage/src/main/java/com/hzya/frame/plugin/lets/u8cdto/SalesInvoiceDto.java @@ -0,0 +1,19 @@ +package com.hzya.frame.plugin.lets.u8cdto; + +import lombok.Data; + +import java.util.List; + +/** + * @Author:liuyang + * @Package:com.hzya.frame.plugin.lets.u8cdto + * @Project:kangarooDataCenterV3 + * @name:SalesInvoiceDto + * @Date:2024/8/28 11:18 + * @Filename:SalesInvoiceDto + */ +@Data +public class SalesInvoiceDto { + private SalesInvoiceHeadDto parentvo; + private List childrenvo; +} diff --git a/buildpackage/src/main/java/com/hzya/frame/plugin/lets/u8cdto/SalesInvoiceHeadDto.java b/buildpackage/src/main/java/com/hzya/frame/plugin/lets/u8cdto/SalesInvoiceHeadDto.java new file mode 100644 index 00000000..65d9b64d --- /dev/null +++ b/buildpackage/src/main/java/com/hzya/frame/plugin/lets/u8cdto/SalesInvoiceHeadDto.java @@ -0,0 +1,35 @@ +package com.hzya.frame.plugin.lets.u8cdto; + +import lombok.Data; + +/** + * @Author:liuyang + * @Package:com.hzya.frame.plugin.lets.u8cdto + * @Project:kangarooDataCenterV3 + * @name:SalesInvoiceHead + * @Date:2024/8/28 11:10 + * @Filename:SalesInvoiceHead + */ +@Data +public class SalesInvoiceHeadDto { + private String cbiztype; + private String ccalbodyid; + private String ccurrencyid; + private String cdeptid; + private String cemployeeid; + private String coperatorid; + private String creceiptcorpid; + private String csalecorpid; + private String cwarehouseid; + private String dbilldate; + private String finvoicetype; + private String ndiscountrate; + private String pk_corp; + private String pk_defdoc1; + private String vdef1; + private String vdef17; + private String vdef19; + private String vdef20; + private String vnote; + private String vreceiptcode; +} \ No newline at end of file diff --git a/buildpackage/src/main/resources/cfgHome/plugin/lets/spring/spring-lets-plugin.xml b/buildpackage/src/main/resources/cfgHome/plugin/lets/spring/spring-lets-plugin.xml index f074f1bc..f2ca1556 100644 --- a/buildpackage/src/main/resources/cfgHome/plugin/lets/spring/spring-lets-plugin.xml +++ b/buildpackage/src/main/resources/cfgHome/plugin/lets/spring/spring-lets-plugin.xml @@ -27,8 +27,8 @@ - - + + diff --git a/buildpackage/src/test/java/com/hzya/frame/plugin/lets/plugin/outsourc/ConsignmachiningInReturnTest.java b/buildpackage/src/test/java/com/hzya/frame/plugin/lets/plugin/outsourc/ConsignmachiningInReturnTest.java index 740367c1..5d90441e 100644 --- a/buildpackage/src/test/java/com/hzya/frame/plugin/lets/plugin/outsourc/ConsignmachiningInReturnTest.java +++ b/buildpackage/src/test/java/com/hzya/frame/plugin/lets/plugin/outsourc/ConsignmachiningInReturnTest.java @@ -21,17 +21,17 @@ import static org.junit.Assert.*; @SpringBootTest(classes = WebappApplication.class) public class ConsignmachiningInReturnTest { - @Autowired - private ConsignmachiningInReturn consignmachiningInReturn; +// @Autowired +// private ConsignmachiningInReturn consignmachiningInReturn; - @Test - public void startImplement() { - try { - consignmachiningInReturn.startImplement("LETS-SH2024082700000006"); - } catch (Exception e) { - e.printStackTrace(); - } - } +// @Test +// public void startImplement() { +// try { +// consignmachiningInReturn.startImplement("LETS-SH2024082700000006"); +// } catch (Exception e) { +// e.printStackTrace(); +// } +// } // @Test // public void testStartImplement() { diff --git a/buildpackage/src/test/java/com/hzya/frame/plugin/lets/plugin/sales/SoSaleOutPluginInitializerToBTest.java b/buildpackage/src/test/java/com/hzya/frame/plugin/lets/plugin/sales/SoSaleOutPluginInitializerToBTest.java index e1b02c62..27325a31 100644 --- a/buildpackage/src/test/java/com/hzya/frame/plugin/lets/plugin/sales/SoSaleOutPluginInitializerToBTest.java +++ b/buildpackage/src/test/java/com/hzya/frame/plugin/lets/plugin/sales/SoSaleOutPluginInitializerToBTest.java @@ -32,9 +32,9 @@ public class SoSaleOutPluginInitializerToBTest { @Test public void startImplement() { // soSaleOutPluginInitializerToB.startImplement(null, null); -// soSaleOutPluginInitializerToB.startImplement("LETS-SH2024082200000004"); +// soSaleOutPluginInitializerToB.startImplementByCode("LETS-SH2024082800000008"); - soSaleOutPluginInitializerToB.startImplement("2024-04-28", null); +// soSaleOutPluginInitializerToB.startImplement("2024-04-28", null); // try { // SaleOrderMessageDto ofsOrder = afterSalesOrderUtil.getOfsOrder("LETS-SO2024081600000050"); @@ -42,5 +42,7 @@ public class SoSaleOutPluginInitializerToBTest { // } catch (Exception e) { // e.printStackTrace(); // } + + soSaleOutPluginInitializerToB.startImplementByTranTime("2024-08-28 15:28:06", "2024-08-28 15:28:08"); } } \ No newline at end of file diff --git a/service/src/main/java/com/hzya/frame/ttxofs/dto/ofssaleorderoutsearch/HeaderDto.java b/service/src/main/java/com/hzya/frame/ttxofs/dto/ofssaleorderoutsearch/HeaderDto.java index 461dbd04..ae98f10a 100755 --- a/service/src/main/java/com/hzya/frame/ttxofs/dto/ofssaleorderoutsearch/HeaderDto.java +++ b/service/src/main/java/com/hzya/frame/ttxofs/dto/ofssaleorderoutsearch/HeaderDto.java @@ -1,5 +1,8 @@ package com.hzya.frame.ttxofs.dto.ofssaleorderoutsearch; +import lombok.Data; + +@Data public class HeaderDto { private String id; @@ -62,6 +65,7 @@ public class HeaderDto { private String shipToStateName; private String shipToCityName; private String shipToDistrictName; + private String tradeSuccessAt; /** * 发货日期 @@ -72,500 +76,4 @@ public class HeaderDto { * 出库类型 */ private String shipmentType; - - public String getShipmentType() { - return shipmentType; - } - - public void setShipmentType(String shipmentType) { - this.shipmentType = shipmentType; - } - - public String getShipAt() { - return shipAt; - } - - public void setShipAt(String shipAt) { - this.shipAt = shipAt; - } - - public String getId() { - return id; - } - - public void setId(String id) { - this.id = id; - } - - public String getClientCode() { - return clientCode; - } - - public void setClientCode(String clientCode) { - this.clientCode = clientCode; - } - - public String getCompanyCode() { - return companyCode; - } - - public void setCompanyCode(String companyCode) { - this.companyCode = companyCode; - } - - public String getStoreCode() { - return storeCode; - } - - public void setStoreCode(String storeCode) { - this.storeCode = storeCode; - } - - public String getFacilityCode() { - return facilityCode; - } - - public void setFacilityCode(String facilityCode) { - this.facilityCode = facilityCode; - } - - public String getCode() { - return code; - } - - public void setCode(String code) { - this.code = code; - } - - public String getRefOrderId() { - return refOrderId; - } - - public void setRefOrderId(String refOrderId) { - this.refOrderId = refOrderId; - } - - public String getRefOrderCode() { - return refOrderCode; - } - - public void setRefOrderCode(String refOrderCode) { - this.refOrderCode = refOrderCode; - } - - public String getRefOrderType() { - return refOrderType; - } - - public void setRefOrderType(String refOrderType) { - this.refOrderType = refOrderType; - } - - public String getStatus() { - return status; - } - - public void setStatus(String status) { - this.status = status; - } - - public String getConsolidated() { - return consolidated; - } - - public void setConsolidated(String consolidated) { - this.consolidated = consolidated; - } - - public String getInternalInstructionType() { - return internalInstructionType; - } - - public void setInternalInstructionType(String internalInstructionType) { - this.internalInstructionType = internalInstructionType; - } - - public String getBizChannel() { - return bizChannel; - } - - public void setBizChannel(String bizChannel) { - this.bizChannel = bizChannel; - } - - public String getSourcePlatformCode() { - return sourcePlatformCode; - } - - public void setSourcePlatformCode(String sourcePlatformCode) { - this.sourcePlatformCode = sourcePlatformCode; - } - - public String getProcessType() { - return processType; - } - - public void setProcessType(String processType) { - this.processType = processType; - } - - public String getSourceOrderId() { - return sourceOrderId; - } - - public void setSourceOrderId(String sourceOrderId) { - this.sourceOrderId = sourceOrderId; - } - - public String getSourceOrderCode() { - return sourceOrderCode; - } - - public void setSourceOrderCode(String sourceOrderCode) { - this.sourceOrderCode = sourceOrderCode; - } - - public String getSourceUserAccount() { - return sourceUserAccount; - } - - public void setSourceUserAccount(String sourceUserAccount) { - this.sourceUserAccount = sourceUserAccount; - } - - public String getShipToAttentionTo() { - return shipToAttentionTo; - } - - public void setShipToAttentionTo(String shipToAttentionTo) { - this.shipToAttentionTo = shipToAttentionTo; - } - - public String getShipToAddress() { - return shipToAddress; - } - - public void setShipToAddress(String shipToAddress) { - this.shipToAddress = shipToAddress; - } - - public String getShipToCountry() { - return shipToCountry; - } - - public void setShipToCountry(String shipToCountry) { - this.shipToCountry = shipToCountry; - } - - public String getShipToState() { - return shipToState; - } - - public void setShipToState(String shipToState) { - this.shipToState = shipToState; - } - - public String getShipToCity() { - return shipToCity; - } - - public void setShipToCity(String shipToCity) { - this.shipToCity = shipToCity; - } - - public String getShipToDistrict() { - return shipToDistrict; - } - - public void setShipToDistrict(String shipToDistrict) { - this.shipToDistrict = shipToDistrict; - } - - public String getShipToMobile() { - return shipToMobile; - } - - public void setShipToMobile(String shipToMobile) { - this.shipToMobile = shipToMobile; - } - - public String getTotalLines() { - return totalLines; - } - - public void setTotalLines(String totalLines) { - this.totalLines = totalLines; - } - - public String getTotalQty() { - return totalQty; - } - - public void setTotalQty(String totalQty) { - this.totalQty = totalQty; - } - - public String getTotalContainers() { - return totalContainers; - } - - public void setTotalContainers(String totalContainers) { - this.totalContainers = totalContainers; - } - - public String getTotalCases() { - return totalCases; - } - - public void setTotalCases(String totalCases) { - this.totalCases = totalCases; - } - - public String getTotalWeight() { - return totalWeight; - } - - public void setTotalWeight(String totalWeight) { - this.totalWeight = totalWeight; - } - - public String getTotalVolume() { - return totalVolume; - } - - public void setTotalVolume(String totalVolume) { - this.totalVolume = totalVolume; - } - - public String getTotalVolumeWeight() { - return totalVolumeWeight; - } - - public void setTotalVolumeWeight(String totalVolumeWeight) { - this.totalVolumeWeight = totalVolumeWeight; - } - - public String getWeightUM() { - return weightUM; - } - - public void setWeightUM(String weightUM) { - this.weightUM = weightUM; - } - - public String getVolumeUM() { - return volumeUM; - } - - public void setVolumeUM(String volumeUM) { - this.volumeUM = volumeUM; - } - - public String getTotalAmount() { - return totalAmount; - } - - public void setTotalAmount(String totalAmount) { - this.totalAmount = totalAmount; - } - - public String getTotalPayAmount() { - return totalPayAmount; - } - - public void setTotalPayAmount(String totalPayAmount) { - this.totalPayAmount = totalPayAmount; - } - - public String getPostageAmount() { - return postageAmount; - } - - public void setPostageAmount(String postageAmount) { - this.postageAmount = postageAmount; - } - - public String getItemTotalAmount() { - return itemTotalAmount; - } - - public void setItemTotalAmount(String itemTotalAmount) { - this.itemTotalAmount = itemTotalAmount; - } - - public String getCarrierCode() { - return carrierCode; - } - - public void setCarrierCode(String carrierCode) { - this.carrierCode = carrierCode; - } - - public String getPaymentStatus() { - return paymentStatus; - } - - public void setPaymentStatus(String paymentStatus) { - this.paymentStatus = paymentStatus; - } - - public String getCodRequired() { - return codRequired; - } - - public void setCodRequired(String codRequired) { - this.codRequired = codRequired; - } - - public String getInvoiceRequired() { - return invoiceRequired; - } - - public void setInvoiceRequired(String invoiceRequired) { - this.invoiceRequired = invoiceRequired; - } - - public String getPaidAt() { - return paidAt; - } - - public void setPaidAt(String paidAt) { - this.paidAt = paidAt; - } - - public String getShipFromAttentionTo() { - return shipFromAttentionTo; - } - - public void setShipFromAttentionTo(String shipFromAttentionTo) { - this.shipFromAttentionTo = shipFromAttentionTo; - } - - public String getShipFromAddress() { - return shipFromAddress; - } - - public void setShipFromAddress(String shipFromAddress) { - this.shipFromAddress = shipFromAddress; - } - - public String getShipFromDistrict() { - return shipFromDistrict; - } - - public void setShipFromDistrict(String shipFromDistrict) { - this.shipFromDistrict = shipFromDistrict; - } - - public String getShipFromCity() { - return shipFromCity; - } - - public void setShipFromCity(String shipFromCity) { - this.shipFromCity = shipFromCity; - } - - public String getShipFromState() { - return shipFromState; - } - - public void setShipFromState(String shipFromState) { - this.shipFromState = shipFromState; - } - - public String getShipFromCountry() { - return shipFromCountry; - } - - public void setShipFromCountry(String shipFromCountry) { - this.shipFromCountry = shipFromCountry; - } - - public String getShipFromPostalCode() { - return shipFromPostalCode; - } - - public void setShipFromPostalCode(String shipFromPostalCode) { - this.shipFromPostalCode = shipFromPostalCode; - } - - public String getShipFromPhone() { - return shipFromPhone; - } - - public void setShipFromPhone(String shipFromPhone) { - this.shipFromPhone = shipFromPhone; - } - - public String getShipFromMobile() { - return shipFromMobile; - } - - public void setShipFromMobile(String shipFromMobile) { - this.shipFromMobile = shipFromMobile; - } - - public String getShipFromFax() { - return shipFromFax; - } - - public void setShipFromFax(String shipFromFax) { - this.shipFromFax = shipFromFax; - } - - public String getShipFromEmail() { - return shipFromEmail; - } - - public void setShipFromEmail(String shipFromEmail) { - this.shipFromEmail = shipFromEmail; - } - - public String getCodAmount() { - return codAmount; - } - - public void setCodAmount(String codAmount) { - this.codAmount = codAmount; - } - - public String getTax() { - return tax; - } - - public void setTax(String tax) { - this.tax = tax; - } - - public String getTaxPaid() { - return taxPaid; - } - - public void setTaxPaid(String taxPaid) { - this.taxPaid = taxPaid; - } - - public String getShipToStateName() { - return shipToStateName; - } - - public void setShipToStateName(String shipToStateName) { - this.shipToStateName = shipToStateName; - } - - public String getShipToCityName() { - return shipToCityName; - } - - public void setShipToCityName(String shipToCityName) { - this.shipToCityName = shipToCityName; - } - - public String getShipToDistrictName() { - return shipToDistrictName; - } - - public void setShipToDistrictName(String shipToDistrictName) { - this.shipToDistrictName = shipToDistrictName; - } } \ No newline at end of file diff --git a/service/src/main/java/com/hzya/frame/ttxofs/dto/ofssalesordersearch/DetailsDto.java b/service/src/main/java/com/hzya/frame/ttxofs/dto/ofssalesordersearch/DetailsDto.java index a35e5689..12e613bb 100755 --- a/service/src/main/java/com/hzya/frame/ttxofs/dto/ofssalesordersearch/DetailsDto.java +++ b/service/src/main/java/com/hzya/frame/ttxofs/dto/ofssalesordersearch/DetailsDto.java @@ -3,12 +3,15 @@ */ package com.hzya.frame.ttxofs.dto.ofssalesordersearch; +import lombok.Data; + /** * Auto-generated: 2024-07-30 11:32:10 * * @author bejson.com (i@bejson.com) * @website http://www.bejson.com/java2pojo/ */ +@Data public class DetailsDto { private String clientCode; @@ -54,348 +57,5 @@ public class DetailsDto { private String isMappingSku; private String inventoryId; private String shipAt; - - public String getClientCode() { - return clientCode; - } - - public void setClientCode(String clientCode) { - this.clientCode = clientCode; - } - - public String getCompanyCode() { - return companyCode; - } - - public void setCompanyCode(String companyCode) { - this.companyCode = companyCode; - } - - public String getStoreCode() { - return storeCode; - } - - public void setStoreCode(String storeCode) { - this.storeCode = storeCode; - } - - public String getFacilityCode() { - return facilityCode; - } - - public void setFacilityCode(String facilityCode) { - this.facilityCode = facilityCode; - } - - public String getId() { - return id; - } - - public void setId(String id) { - this.id = id; - } - - public String getSalesOrderId() { - return salesOrderId; - } - - public void setSalesOrderId(String salesOrderId) { - this.salesOrderId = salesOrderId; - } - - public String getSalesOrderCode() { - return salesOrderCode; - } - - public void setSalesOrderCode(String salesOrderCode) { - this.salesOrderCode = salesOrderCode; - } - - public String getSkuCode() { - return skuCode; - } - - public void setSkuCode(String skuCode) { - this.skuCode = skuCode; - } - - public String getSkuName() { - return skuName; - } - - public void setSkuName(String skuName) { - this.skuName = skuName; - } - - public String getSkuBarCode() { - return skuBarCode; - } - - public void setSkuBarCode(String skuBarCode) { - this.skuBarCode = skuBarCode; - } - - public String getSourceOrderCode() { - return sourceOrderCode; - } - - public void setSourceOrderCode(String sourceOrderCode) { - this.sourceOrderCode = sourceOrderCode; - } - - public String getOriginalDetailId() { - return originalDetailId; - } - - public void setOriginalDetailId(String originalDetailId) { - this.originalDetailId = originalDetailId; - } - - public String getRequestQty() { - return requestQty; - } - - public void setRequestQty(String requestQty) { - this.requestQty = requestQty; - } - - public String getShipQty() { - return shipQty; - } - - public void setShipQty(String shipQty) { - this.shipQty = shipQty; - } - - public String getShortQty() { - return shortQty; - } - - public void setShortQty(String shortQty) { - this.shortQty = shortQty; - } - - public String getReturnQty() { - return returnQty; - } - - public void setReturnQty(String returnQty) { - this.returnQty = returnQty; - } - - public String getAllocatedQty() { - return allocatedQty; - } - - public void setAllocatedQty(String allocatedQty) { - this.allocatedQty = allocatedQty; - } - - public String getQuantityUM() { - return quantityUM; - } - - public void setQuantityUM(String quantityUM) { - this.quantityUM = quantityUM; - } - - public String getListPrice() { - return listPrice; - } - - public void setListPrice(String listPrice) { - this.listPrice = listPrice; - } - - public String getNetPrice() { - return netPrice; - } - - public void setNetPrice(String netPrice) { - this.netPrice = netPrice; - } - - public String getMsrPrice() { - return msrPrice; - } - - public void setMsrPrice(String msrPrice) { - this.msrPrice = msrPrice; - } - - public String getItemTotalAmount() { - return itemTotalAmount; - } - - public void setItemTotalAmount(String itemTotalAmount) { - this.itemTotalAmount = itemTotalAmount; - } - - public String getTotalPayAmount() { - return totalPayAmount; - } - - public void setTotalPayAmount(String totalPayAmount) { - this.totalPayAmount = totalPayAmount; - } - - public String getInventorySts() { - return inventorySts; - } - - public void setInventorySts(String inventorySts) { - this.inventorySts = inventorySts; - } - - public String getTotalWeight() { - return totalWeight; - } - - public void setTotalWeight(String totalWeight) { - this.totalWeight = totalWeight; - } - - public String getTotalVolume() { - return totalVolume; - } - - public void setTotalVolume(String totalVolume) { - this.totalVolume = totalVolume; - } - - public String getTotalVolumeWeight() { - return totalVolumeWeight; - } - - public void setTotalVolumeWeight(String totalVolumeWeight) { - this.totalVolumeWeight = totalVolumeWeight; - } - - public String getWeightUM() { - return weightUM; - } - - public void setWeightUM(String weightUM) { - this.weightUM = weightUM; - } - - public String getVolumeUM() { - return volumeUM; - } - - public void setVolumeUM(String volumeUM) { - this.volumeUM = volumeUM; - } - - public String getBonusPoStrings() { - return bonusPoStrings; - } - - public void setBonusPoStrings(String bonusPoStrings) { - this.bonusPoStrings = bonusPoStrings; - } - - public String getIsGift() { - return isGift; - } - - public void setIsGift(String isGift) { - this.isGift = isGift; - } - - public String getBomType() { - return bomType; - } - - public void setBomType(String bomType) { - this.bomType = bomType; - } - - public String getBomQty() { - return bomQty; - } - - public void setBomQty(String bomQty) { - this.bomQty = bomQty; - } - - public String getCreated() { - return created; - } - - public void setCreated(String created) { - this.created = created; - } - - public String getCreatedBy() { - return createdBy; - } - - public void setCreatedBy(String createdBy) { - this.createdBy = createdBy; - } - - public String getLastUpStringd() { - return lastUpStringd; - } - - public void setLastUpStringd(String lastUpStringd) { - this.lastUpStringd = lastUpStringd; - } - - public String getLastUpStringdBy() { - return lastUpStringdBy; - } - - public void setLastUpStringdBy(String lastUpStringdBy) { - this.lastUpStringdBy = lastUpStringdBy; - } - - public String getIsDeliverySync() { - return isDeliverySync; - } - - public void setIsDeliverySync(String isDeliverySync) { - this.isDeliverySync = isDeliverySync; - } - - public String getPayPrice() { - return payPrice; - } - - public void setPayPrice(String payPrice) { - this.payPrice = payPrice; - } - - public String getDiscountAmount() { - return discountAmount; - } - - public void setDiscountAmount(String discountAmount) { - this.discountAmount = discountAmount; - } - - public String getIsMappingSku() { - return isMappingSku; - } - - public void setIsMappingSku(String isMappingSku) { - this.isMappingSku = isMappingSku; - } - - public String getInventoryId() { - return inventoryId; - } - - public void setInventoryId(String inventoryId) { - this.inventoryId = inventoryId; - } - - public String getShipAt() { - return shipAt; - } - - public void setShipAt(String shipAt) { - this.shipAt = shipAt; - } + private String totalAmount; } \ No newline at end of file diff --git a/service/src/main/java/com/hzya/frame/ttxofs/dto/stock/StockinOrderSearchResponse.java b/service/src/main/java/com/hzya/frame/ttxofs/dto/stock/StockinOrderSearchResponse.java index 8f349b95..838d4bf5 100644 --- a/service/src/main/java/com/hzya/frame/ttxofs/dto/stock/StockinOrderSearchResponse.java +++ b/service/src/main/java/com/hzya/frame/ttxofs/dto/stock/StockinOrderSearchResponse.java @@ -65,6 +65,7 @@ public class StockinOrderSearchResponse extends ReturnMessageBasics { private String shipFromCode; private String shipFromAddressCode; private String shipAt; + private String tradeSuccessAt; } @Data