diff --git a/buildpackage/src/main/java/com/hzya/frame/plugin/lets/entity/BdBusitypeEntity.java b/buildpackage/src/main/java/com/hzya/frame/plugin/lets/entity/BdBusitypeEntity.java index 0f3c10d6..658f2b6b 100644 --- a/buildpackage/src/main/java/com/hzya/frame/plugin/lets/entity/BdBusitypeEntity.java +++ b/buildpackage/src/main/java/com/hzya/frame/plugin/lets/entity/BdBusitypeEntity.java @@ -1,6 +1,7 @@ package com.hzya.frame.plugin.lets.entity; import com.hzya.frame.web.entity.BaseEntity; + /** * (BdBusitype)实体类 * @@ -8,30 +9,30 @@ import com.hzya.frame.web.entity.BaseEntity; * @since 2023-11-21 10:57:24 */ public class BdBusitypeEntity extends BaseEntity { - - private String busicode; - private String businame; - private Integer busiprop; - private Integer defaultgather; - private String defstr2; - private String defstr3; - private String defstr4; - private String defstr5; - private Integer dr; - private String encapsulate; - private String fktype; - private String isdapclassified; - private String isitem; - private String issrqr; - private String mnecode; - private String owetype; - private String pkBusitype; - private String pkCorp; - private String receipttype; - private String sktype; - private String ts; - private String verifyrule; - private String ystype; + + private String busicode; + private String businame; + private Integer busiprop; + private Integer defaultgather; + private String defstr2; + private String defstr3; + private String defstr4; + private String defstr5; + private Integer dr; + private String encapsulate; + private String fktype; + private String isdapclassified; + private String isitem; + private String issrqr; + private String mnecode; + private String owetype; + private String pkBusitype; + private String pkCorp; + private String receipttype; + private String sktype; + private String ts; + private String verifyrule; + private String ystype; public String getBusicode() { 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 c126ae92..6c230b14 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 @@ -13,6 +13,7 @@ import com.hzya.frame.plugin.lets.dao.*; import com.hzya.frame.plugin.lets.entity.*; import com.hzya.frame.plugin.lets.ofsvo.QueryOfsSoSaleOutVo; import com.hzya.frame.plugin.lets.u8cdto.*; +import com.hzya.frame.plugin.lets.util.OfsStandardUtil; import com.hzya.frame.plugin.lets.util.QueryBdBusitypeUtil; import com.hzya.frame.plugin.lets.util.RdclUtil; import com.hzya.frame.ttxofs.dto.InterfaceParamDto; @@ -20,6 +21,12 @@ import com.hzya.frame.ttxofs.dto.ofspoorder.OfsPoOrderBean; 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.ttxofs.service.OfsUnifiedService; import com.hzya.frame.web.entity.JsonResultEntity; @@ -77,6 +84,9 @@ public class ProxyPurchaseReturn extends PluginBaseEntity { @Autowired private RdclUtil rdclUtil; + @Autowired + private OfsStandardUtil ofsStandardUtil; + @Override public void initialize() { logger.info(getPluginLabel() + "執行初始化方法initialize()"); @@ -125,21 +135,22 @@ public class ProxyPurchaseReturn extends PluginBaseEntity { @Override public void run() { try { - List returnGoodHeaderDetailsDataDtoArrayList = new ArrayList<>(); + //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"); + queryOfsSoSaleOutVo.setInternalInstructionType("PURCHASE_RETURN"); queryOfsSoSaleOutVo.setStatus(900L); - queryOfsReturnGoods(queryOfsSoSaleOutVo, returnGoodHeaderDetailsDataDtoArrayList, 1L); + ofsStandardUtil.queryOfsSaleOrder(queryOfsSoSaleOutVo, returnGoodHeaderDetailsDataDtoArrayList, 1L, "ofs.shipment.search"); logger.info("数据返回行数:{}", returnGoodHeaderDetailsDataDtoArrayList.size()); if (returnGoodHeaderDetailsDataDtoArrayList.size() > 0) { getSet(returnGoodHeaderDetailsDataDtoArrayList); } else { - logger.info("没有查询到任何数据!不需要同步"); + logger.info("没有查询到任何数据!不需要发起同步逻辑!!"); } } catch (Exception e) { logger.error("startImplement方法抛出异常", e); @@ -169,20 +180,20 @@ public class ProxyPurchaseReturn extends PluginBaseEntity { @Override public void run() { try { - List returnGoodHeaderDetailsDataDtoArrayList = new ArrayList<>(); + List returnGoodHeaderDetailsDataDtoArrayList = new ArrayList<>(); QueryOfsSoSaleOutVo queryOfsSoSaleOutVo = new QueryOfsSoSaleOutVo(); queryOfsSoSaleOutVo.setClientCode("LETS"); queryOfsSoSaleOutVo.setPageNo(1L); queryOfsSoSaleOutVo.setPageSize(50L); queryOfsSoSaleOutVo.setCode(code); - queryOfsSoSaleOutVo.setInternalInstructionType("PURCHASE"); + queryOfsSoSaleOutVo.setInternalInstructionType("PURCHASE_RETURN"); queryOfsSoSaleOutVo.setStatus(900L); - queryOfsReturnGoods(queryOfsSoSaleOutVo, returnGoodHeaderDetailsDataDtoArrayList, 1L); + ofsStandardUtil.queryOfsSaleOrder(queryOfsSoSaleOutVo, returnGoodHeaderDetailsDataDtoArrayList, 1L, "ofs.shipment.search"); logger.info("数据返回行数:{}", returnGoodHeaderDetailsDataDtoArrayList.size()); if (returnGoodHeaderDetailsDataDtoArrayList.size() > 0) { getSet(returnGoodHeaderDetailsDataDtoArrayList); } else { - logger.info("没有查询到任何数据!不需要同步"); + logger.info("没有查询到任何数据!不需要发起同步逻辑!!"); } } catch (Exception e) { logger.error("startImplement方法抛出异常", e); @@ -195,7 +206,7 @@ public class ProxyPurchaseReturn extends PluginBaseEntity { } catch (Exception e) { logger.error("thread.join()异常", e); } - String threadNameStrEnd = StrUtil.format("开始(代理品牌采购)OFS采购入库单生成U8C采购订单 售后入库单号:{}", code); + String threadNameStrEnd = StrUtil.format("结束(代理品牌采购)OFS采购入库单生成U8C采购订单 售后入库单号:{}", code); logger.info(threadNameStrEnd); } @@ -206,42 +217,42 @@ public class ProxyPurchaseReturn extends PluginBaseEntity { * @param headerDetailsDtoList 查询结果集 * @param pageNo 从第pageNo页开始查询 */ - private void queryOfsReturnGoods(QueryOfsSoSaleOutVo queryOfsSoSaleOutVo, List headerDetailsDtoList, Long pageNo) throws Exception { - Long pageSize = 200L; - queryOfsSoSaleOutVo.setPageNo(pageNo); - queryOfsSoSaleOutVo.setPageSize(pageSize); - - InterfaceParamDto interfaceParamDto = new InterfaceParamDto(); - interfaceParamDto.setApi("ofs.receipt.search"); - interfaceParamDto.setData(JSON.toJSONString(queryOfsSoSaleOutVo)); - StockinOrderSearchResponse rertunGoodsRootBean = (StockinOrderSearchResponse) ofsUnifiedService.unified(interfaceParamDto); - if (rertunGoodsRootBean != null) { - if ("false".equals(rertunGoodsRootBean.getError()) && "0".equals(rertunGoodsRootBean.getCode()) && "Success".equals(rertunGoodsRootBean.getMsg())) { - List stockinOrderList = rertunGoodsRootBean.getData(); - if (stockinOrderList != null && stockinOrderList.size() > 0) { - headerDetailsDtoList.addAll(stockinOrderList); - - //TODO OFS没有提供分页字段,等待开发 - } - } else { - logger.error("查询失败,失败原因:{}", JSON.toJSON(interfaceParamDto)); - } - } else { - logger.error("rertunGoodsRootBean为空!interfaceParamDto对象的结果集json:{}", JSON.toJSON(interfaceParamDto)); - } - } +// private void queryOfsReturnGoods(QueryOfsSoSaleOutVo queryOfsSoSaleOutVo, List headerDetailsDtoList, Long pageNo) throws Exception { +// Long pageSize = 200L; +// queryOfsSoSaleOutVo.setPageNo(pageNo); +// queryOfsSoSaleOutVo.setPageSize(pageSize); +// +// InterfaceParamDto interfaceParamDto = new InterfaceParamDto(); +// interfaceParamDto.setApi("ofs.receipt.search"); +// interfaceParamDto.setData(JSON.toJSONString(queryOfsSoSaleOutVo)); +// StockinOrderSearchResponse rertunGoodsRootBean = (StockinOrderSearchResponse) ofsUnifiedService.unified(interfaceParamDto); +// if (rertunGoodsRootBean != null) { +// if ("false".equals(rertunGoodsRootBean.getError()) && "0".equals(rertunGoodsRootBean.getCode()) && "Success".equals(rertunGoodsRootBean.getMsg())) { +// List stockinOrderList = rertunGoodsRootBean.getData(); +// if (stockinOrderList != null && stockinOrderList.size() > 0) { +// headerDetailsDtoList.addAll(stockinOrderList); +// +// //TODO OFS没有提供分页字段,等待开发 +// } +// } else { +// logger.error("查询失败,失败原因:{}", JSON.toJSON(interfaceParamDto)); +// } +// } else { +// logger.error("rertunGoodsRootBean为空!interfaceParamDto对象的结果集json:{}", JSON.toJSON(interfaceParamDto)); +// } +// } /** * 环境预配置 * - * @param returnGoodHeaderDetailsDataDtoArrayList 采购入库单 + * @param returnGoodHeaderDetailsDataDtoArrayList 采退出库单 * @author liuyang */ - private void getSet(List returnGoodHeaderDetailsDataDtoArrayList) throws Exception { + private void getSet(List returnGoodHeaderDetailsDataDtoArrayList) throws Exception { //过滤成功的数据 - List stockinOrderList = filterData(returnGoodHeaderDetailsDataDtoArrayList); + List headerDetailsDtos = filterData(returnGoodHeaderDetailsDataDtoArrayList); //执行推送主逻辑 - implement(stockinOrderList); + implement(headerDetailsDtos); } /** @@ -249,8 +260,8 @@ public class ProxyPurchaseReturn extends PluginBaseEntity { * * @author liuyang */ - private List filterData(List returnGoodHeaderDetailsDataDtoArrayList) { - List headerDetailsDtoList1 = new ArrayList<>(); + private List filterData(List returnGoodHeaderDetailsDataDtoArrayList) { + List headerDetailsDtoList1 = new ArrayList<>(); if (returnGoodHeaderDetailsDataDtoArrayList != null && returnGoodHeaderDetailsDataDtoArrayList.size() > 0) { //TODO 出库单明细主键,需要O返回,目前没有,已经提需求 headerDetailsDtoList1.addAll(returnGoodHeaderDetailsDataDtoArrayList); @@ -263,20 +274,20 @@ public class ProxyPurchaseReturn extends PluginBaseEntity { * * @author liuyang */ - private void implement(List returnGoodHeaderDetailsDataDtoList) throws Exception { - if (returnGoodHeaderDetailsDataDtoList != null && returnGoodHeaderDetailsDataDtoList.size() > 0) { + private void implement(List headerDetailsDtos) throws Exception { + if (headerDetailsDtos != null && headerDetailsDtos.size() > 0) { try { - // 查询基本档案 - List poOrderSonDtos = queryBasicArchives(returnGoodHeaderDetailsDataDtoList); + // 转换基本档案 + List poOrderRerturnSonDtos = queryBasicArchives(headerDetailsDtos); // 代理品牌采购业务流程 BdBusitypeEntity bdBusitypeEntity = u8cOperationFlow(); // 查询采购收发类别 BdRdclEntity bdRdclEntity = rdclUtil.queryRdClObject("102"); - if (poOrderSonDtos != null && poOrderSonDtos.size() > 0) { - for (int i = 0; i < poOrderSonDtos.size(); i++) { - PoOrderSonDto poOrderSonDto = poOrderSonDtos.get(i); - List details = poOrderSonDto.getDetails(); + if (poOrderRerturnSonDtos != null && poOrderRerturnSonDtos.size() > 0) { + for (int i = 0; i < poOrderRerturnSonDtos.size(); i++) { + PoOrderRerturnSonDto poOrderSonDto = poOrderRerturnSonDtos.get(i); + List details = poOrderSonDto.getDetails(); //生成业务日期 String generateBusinessDate = createGenerateBusinessDate(poOrderSonDto); @@ -289,12 +300,13 @@ public class ProxyPurchaseReturn extends PluginBaseEntity { BdCalbodyEntity bdCalbodyEntity = poOrderSonDto.getBdCalbodyEntity();//收货库存组织 BdStordocEntity bdStordocEntity = poOrderSonDto.getBdStordocEntity();//收货仓库 - OfsPoOrderData ofsPoOrderData = poOrderSonDto.getOfsPoOrderData();//OFS采购订单 - OfsPoOrderHeader ofsPoOrderDataHeader = ofsPoOrderData.getHeader(); - List ofsPoOrderDataDetails = ofsPoOrderData.getDetails(); + PurchaseReturnOrder purchaseReturnOrder = poOrderSonDto.getPurchaseReturnOrder();//OFS采退订单 + PurchaseReturnOrderHeader header = purchaseReturnOrder.getHeader(); + List details1 = purchaseReturnOrder.getDetails(); //采购订单表头 PoOrderParentDto poOrderParentDto = new PoOrderParentDto(); + poOrderParentDto.setBreturn(true);//确认退货 poOrderParentDto.setCbiztype(bdBusitypeEntity.getPkBusitype());//业务流程 poOrderParentDto.setCdeptid(bdDeptdocEntity.getPkDeptdoc());//采购部门 poOrderParentDto.setCoperator("0001A110000000000U3D");//制单人 @@ -315,37 +327,37 @@ public class ProxyPurchaseReturn extends PluginBaseEntity { poOrderParentDto.setVdef20(poOrderSonDto.getId());//原单主键 //收发类别 -// poOrderParentDto.setPk_defdoc3(bdRdclEntity.getPkRdcl()); -// poOrderParentDto.setVdef3(bdRdclEntity.getRdname()); + poOrderParentDto.setPk_defdoc3(bdRdclEntity.getPkRdcl()); + poOrderParentDto.setVdef3(bdRdclEntity.getRdname()); //采购订单明细行 List poOrderChildrenDtoList = new ArrayList<>(); for (int j = 0; j < details.size(); j++) { - StockinOrderSearchResponse.StockinOrder.StockinB stockinB = details.get(j); - OfsPoOrderDetails ofsPoOrderDetail = findOfsPoOrderDetail(ofsPoOrderDataDetails, stockinB); + DetailsDto detailsDto = details.get(j); + PurchaseReturnOrderDetails ofsPoOrderDetail = findOfsPoOrderDetail(details1, detailsDto); //TODO 测试 - stockinB.setReceivedQty("1"); + detailsDto.setShipQty("1"); ofsPoOrderDetail.setFulfillAmount("10"); //2024年8月20日 16:02:21 已经和妮姐、万万确认,采购公司和收货公司目前是一致的,暂时不用区分取数逻辑 - BdInvmandocEntity bdInvmandocEntity = queryInventoryMan(stockinB, bdCorpEntity.getPkCorp()); - String receivedQty = stockinB.getReceivedQty();//实收数量 - String fulfillAmount = ofsPoOrderDetail.getFulfillAmount();//实收累计总金额 + BdInvmandocEntity bdInvmandocEntity = queryInventoryMan(detailsDto, bdCorpEntity.getPkCorp()); + String receivedQty = detailsDto.getShipQty();//实发数量 + String fulfillAmount = ofsPoOrderDetail.getFulfillAmount();//实际进价 //原币含税单价 BigDecimal noriginalcurprice = null; 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()); + logger.error("计算采退出库单原币含税单价失败", e); + Assert.state(false, "计算采退出库单原币含税单价失败 原因:{}", e.getMessage()); } PoOrderChildrenDto poOrderChildrenDto = new PoOrderChildrenDto(); poOrderChildrenDto.setCmangid(bdInvmandocEntity.getPkInvmandoc());//存货管理id - poOrderChildrenDto.setNordernum(receivedQty);//订货数量 + poOrderChildrenDto.setNordernum("-" + new BigDecimal(receivedQty).stripTrailingZeros().toPlainString());//订货数量 poOrderChildrenDto.setNorgtaxprice(noriginalcurprice.stripTrailingZeros().toPlainString());//原币含税单价 poOrderChildrenDto.setPk_arrvcorp(bdCorpEntity.getPkCorp());//收货公司 poOrderChildrenDto.setPk_arrvstoorg(bdCalbodyEntity.getPkCalbody());//收货库存组织 @@ -391,19 +403,20 @@ public class ProxyPurchaseReturn extends PluginBaseEntity { } /** - * 档案转换 + * 档案转换(OFS->U8C) * + * @param returnGoodHeaderDetailsDataDtoList 采退出库单 * @author liuyang */ - private List queryBasicArchives(List returnGoodHeaderDetailsDataDtoList) { - List poOrderSonDtoArrayList = new ArrayList<>(); + private List queryBasicArchives(List returnGoodHeaderDetailsDataDtoList) { + List poOrderSonDtoArrayList = 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(); + HeaderDetailsDto headerDetailsDto = returnGoodHeaderDetailsDataDtoList.get(i); + HeaderDto header = headerDetailsDto.getHeader(); + List details = headerDetailsDto.getDetails(); //采购公司 String companyCode = header.getCompanyCode(); @@ -445,11 +458,16 @@ public class ProxyPurchaseReturn extends PluginBaseEntity { Assert.state(false, "根据采购公司主键:{} 匹配到多个采购组织", bdCorpEntityList.get(0).getPkCorp()); } + //2024年8月22日 15:30:09 如果purchaseReturnOrder为null,那么在queryPurchaseReturnOrder会抛出异常,此处不需要验证purchaseReturnOrder是否为null + PurchaseReturnOrder purchaseReturnOrder = queryPurchaseReturnOrder(header.getRefOrderCode()); + PurchaseReturnOrderHeader header1 = purchaseReturnOrder.getHeader(); +// List details1 = purchaseReturnOrder.getDetails(); + //客商基本档案(供应商类型) //2024年8月20日 14:47:55 丽知商城、OFS 供应商客商档案、传递到U8C的客商, //其中自定义项1作为原系统编码,因此统一传到自定义项一,已经和大家确认好了,没有关系的,放心大胆传吧,宝贝 - String shipFromCode = header.getShipFromCode(); - Assert.notNull(shipFromCode, "O供应商编码不能为空,没有办法完成业务逻辑,请配置供应商编码"); + String shipFromCode = header1.getShipFromCode(); + Assert.notNull(shipFromCode, "O供应商编码不能为空,没有办法完成业务逻辑,请配置供应商编码(采退)"); Assert.state(!"".equals(shipFromCode.trim()), "O供应商编码不能为空,没有办法完成业务逻辑,请配置供应商编码!"); BdCubasdocEntity bdCubasdocEntity = new BdCubasdocEntity(); bdCubasdocEntity.setDataSourceCode("lets_u8c"); @@ -503,22 +521,19 @@ public class ProxyPurchaseReturn extends PluginBaseEntity { Assert.state(false, "根据O仓库编码+U8C收货库存组织主键,匹配到U8C仓库多个", facilityCode, bdCalbodyEntities.get(0).getPkCalbody()); } - //查询OFS采购订单 - OfsPoOrderData ofsPoOrderData = queryOfsPoOrder(header.getRefOrderCode()); + PoOrderRerturnSonDto poOrderRerturnSonDto = new PoOrderRerturnSonDto(); + poOrderRerturnSonDto.setBdCorpEntity(bdCorpEntityList.get(0)); + poOrderRerturnSonDto.setBdDeptdocEntity(bdDeptdocEntityList.get(0)); + poOrderRerturnSonDto.setBdPurorgEntity(bdPurorgEntityList.get(0)); + poOrderRerturnSonDto.setBdCubasdocEntity(bdCubasdocEntityList.get(0)); + poOrderRerturnSonDto.setBdCumandocEntity(bdCumandocEntityList.get(0)); + poOrderRerturnSonDto.setBdCalbodyEntity(bdCalbodyEntities.get(0)); + poOrderRerturnSonDto.setBdStordocEntity(bdStordocEntityList.get(0)); + poOrderRerturnSonDto.setDetails(details); + poOrderRerturnSonDto.setPurchaseReturnOrder(purchaseReturnOrder); - PoOrderSonDto poOrderSonDto = new PoOrderSonDto(); - poOrderSonDto.setBdCorpEntity(bdCorpEntityList.get(0)); - poOrderSonDto.setBdDeptdocEntity(bdDeptdocEntityList.get(0)); - poOrderSonDto.setBdPurorgEntity(bdPurorgEntityList.get(0)); - poOrderSonDto.setBdCubasdocEntity(bdCubasdocEntityList.get(0)); - poOrderSonDto.setBdCumandocEntity(bdCumandocEntityList.get(0)); - poOrderSonDto.setOfsPoOrderData(ofsPoOrderData); - poOrderSonDto.setBdCalbodyEntity(bdCalbodyEntities.get(0)); - poOrderSonDto.setBdStordocEntity(bdStordocEntityList.get(0)); - poOrderSonDto.setDetails(details); - - BeanUtil.copyPropertiesV2(header, poOrderSonDto); - poOrderSonDtoArrayList.add(poOrderSonDto); + BeanUtil.copyPropertiesV2(header, poOrderRerturnSonDto); + poOrderSonDtoArrayList.add(poOrderRerturnSonDto); } //成功 } catch (Exception e) { @@ -551,7 +566,7 @@ public class ProxyPurchaseReturn extends PluginBaseEntity { * * @author liuyang */ - private String createGenerateBusinessDate(PoOrderSonDto poOrderSonDto) { + private String createGenerateBusinessDate(PoOrderRerturnSonDto poOrderSonDto) { //TODO 测试 poOrderSonDto.setShipAt("2024-08-19"); if (poOrderSonDto != null && poOrderSonDto.getShipAt() != null) { @@ -565,8 +580,8 @@ public class ProxyPurchaseReturn extends PluginBaseEntity { } return businessFormat; } else { - logger.error("生成采购订单入库日期失败,或者shipAt为空! json:{}", JSON.toJSON(poOrderSonDto)); - Assert.state(false, "生成采购订单入库日期失败,或者shipAt为空! json:{}", JSON.toJSON(poOrderSonDto)); + logger.error("生成采退出库日期失败,或者shipAt为空! json:{}", JSON.toJSON(poOrderSonDto)); + Assert.state(false, "生成采退出库日期失败,或者shipAt为空! json:{}", JSON.toJSON(poOrderSonDto)); return null; } } @@ -574,23 +589,23 @@ public class ProxyPurchaseReturn extends PluginBaseEntity { /** * 查询存货管理档案 * - * @param pkCorp 发货公司主键 - * @param stockinB 采购入库单明细行 + * @param pkCorp 发货公司主键 + * @param detailsDto 采购入库单明细行 * @author liuyang */ - private BdInvmandocEntity queryInventoryMan(StockinOrderSearchResponse.StockinOrder.StockinB stockinB, String pkCorp) throws Exception { - Assert.notNull(stockinB, "sonDetailsDto不能为空"); - Assert.notNull(stockinB.getSkuCode(), "O存货商家编码不能为空"); + 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(stockinB.getSkuCode()); + bdInvmandocEntity.setInvcode(detailsDto.getSkuCode()); bdInvmandocEntity.setPkCorp(pkCorp); List bdInvmandocEntity2 = iBdInvmandocDao.queryBdInvmandocByInvcodeList(bdInvmandocEntity); if (bdInvmandocEntity2.size() == 0) { - Assert.state(false, "根据O商家编码:{} U8C发货公司主键:{}没有查询到存货管理档案", stockinB.getSkuCode(), pkCorp); + Assert.state(false, "根据O商家编码:{} U8C发货公司主键:{}没有查询到存货管理档案", detailsDto.getSkuCode(), pkCorp); } else if (bdInvmandocEntity2.size() >= 2) { - Assert.state(false, "根据O商家编码:{} U8C发货公司主键:{}没有查询到存货管理档案", stockinB.getSkuCode(), pkCorp); + Assert.state(false, "根据O商家编码:{} U8C发货公司主键:{}没有查询到存货管理档案", detailsDto.getSkuCode(), pkCorp); } return bdInvmandocEntity2.get(0); } @@ -639,26 +654,24 @@ public class ProxyPurchaseReturn extends PluginBaseEntity { * 应该通过明细行主键匹配,但是只能根据sku匹配目前的实现逻辑 * 查找OFS采购订单明细行,主要是为了带出实付金额,通过实付金额/实收数量=含税单价 * - * @param ofsPoOrderDataDetails OFS采购订单明细行所有对象 - * @param stockinB OFS采购入库单明细行对象 + * @param ofsPoOrderDataDetails OFS采退订单明细行所有对象 + * @param detailsDto OFS采退入库单明细行对象 * @author liuyang */ - private OfsPoOrderDetails findOfsPoOrderDetail(List ofsPoOrderDataDetails, StockinOrderSearchResponse.StockinOrder.StockinB stockinB) { - if (ofsPoOrderDataDetails != null && ofsPoOrderDataDetails.size() > 0 && stockinB != null) { - // 2024年8月20日 23:33:11 先使用sku验证,然后O接口更新明细id,使用明细id匹配! - // 2024年8月20日 23:36:04 使用sku匹配,在某种角度来说是错误的 - // 2024年8月21日 14:23:02 O接口已经返回明细行主键,根据这个匹配 + 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(stockinB.getRefOrderDetailId(), "采购入库单明细行对应的关联采购订单的明细行主键不能为空!"); - if (ofsPoOrderDataDetails.get(i).getId().equals(stockinB.getRefOrderDetailId())) { + 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, "无法匹配到采购订单明细行,业务逻辑无法完成,根据sku编码:{}查找,但是在采购订单中无法匹配!", stockinB.getSkuCode()); + Assert.state(false, "无法匹配到采退订单明细行,业务逻辑无法完成!"); return null; } @@ -724,4 +737,25 @@ public class ProxyPurchaseReturn extends PluginBaseEntity { } 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; + } } \ No newline at end of file diff --git a/buildpackage/src/main/java/com/hzya/frame/plugin/lets/plugin/purchase/ProxyPurchaseWarehous.java b/buildpackage/src/main/java/com/hzya/frame/plugin/lets/plugin/purchase/ProxyPurchaseWarehous.java index 87cfa0fc..b5b2e69b 100644 --- a/buildpackage/src/main/java/com/hzya/frame/plugin/lets/plugin/purchase/ProxyPurchaseWarehous.java +++ b/buildpackage/src/main/java/com/hzya/frame/plugin/lets/plugin/purchase/ProxyPurchaseWarehous.java @@ -13,6 +13,7 @@ import com.hzya.frame.plugin.lets.dao.*; import com.hzya.frame.plugin.lets.entity.*; import com.hzya.frame.plugin.lets.ofsvo.QueryOfsSoSaleOutVo; import com.hzya.frame.plugin.lets.u8cdto.*; +import com.hzya.frame.plugin.lets.util.OfsStandardUtil; import com.hzya.frame.plugin.lets.util.QueryBdBusitypeUtil; import com.hzya.frame.plugin.lets.util.RdclUtil; import com.hzya.frame.ttxofs.dto.InterfaceParamDto; @@ -77,6 +78,9 @@ public class ProxyPurchaseWarehous extends PluginBaseEntity { @Autowired private RdclUtil rdclUtil; + @Autowired + private OfsStandardUtil ofsStandardUtil; + @Override public void initialize() { logger.info(getPluginLabel() + "執行初始化方法initialize()"); @@ -132,10 +136,9 @@ public class ProxyPurchaseWarehous extends PluginBaseEntity { queryOfsSoSaleOutVo.setClientCode("LETS"); queryOfsSoSaleOutVo.setPageNo(1L); queryOfsSoSaleOutVo.setPageSize(50L); -// queryOfsSoSaleOutVo.setCode(code); queryOfsSoSaleOutVo.setInternalInstructionType("PURCHASE"); queryOfsSoSaleOutVo.setStatus(900L); - queryOfsReturnGoods(queryOfsSoSaleOutVo, returnGoodHeaderDetailsDataDtoArrayList, 1L); + ofsStandardUtil.queryOfsReturnGoods(queryOfsSoSaleOutVo, returnGoodHeaderDetailsDataDtoArrayList, 1L, "ofs.receipt.search"); logger.info("数据返回行数:{}", returnGoodHeaderDetailsDataDtoArrayList.size()); if (returnGoodHeaderDetailsDataDtoArrayList.size() > 0) { getSet(returnGoodHeaderDetailsDataDtoArrayList); @@ -163,7 +166,7 @@ public class ProxyPurchaseWarehous extends PluginBaseEntity { * @author liuyang */ public void startImplement(String code) { - String threadNameStr = StrUtil.format("(代理品牌采购)OFS采购入库单生成U8C采购订单 售后入库单号", code); + String threadNameStr = StrUtil.format("(代理品牌采购)OFS采购入库单生成U8C采购订单 采购入库单号:{}", code); logger.info(threadNameStr); Thread thread = new Thread(new Runnable() { @@ -177,8 +180,8 @@ public class ProxyPurchaseWarehous extends PluginBaseEntity { queryOfsSoSaleOutVo.setPageSize(50L); queryOfsSoSaleOutVo.setCode(code); queryOfsSoSaleOutVo.setInternalInstructionType("PURCHASE"); -// queryOfsSoSaleOutVo.setStatus(900L); - queryOfsReturnGoods(queryOfsSoSaleOutVo, returnGoodHeaderDetailsDataDtoArrayList, 1L); + queryOfsSoSaleOutVo.setStatus(900L); + ofsStandardUtil.queryOfsReturnGoods(queryOfsSoSaleOutVo, returnGoodHeaderDetailsDataDtoArrayList, 1L, "ofs.receipt.search"); logger.info("数据返回行数:{}", returnGoodHeaderDetailsDataDtoArrayList.size()); if (returnGoodHeaderDetailsDataDtoArrayList.size() > 0) { getSet(returnGoodHeaderDetailsDataDtoArrayList); @@ -205,30 +208,30 @@ public class ProxyPurchaseWarehous extends PluginBaseEntity { * @param headerDetailsDtoList 查询结果集 * @param pageNo 从第pageNo页开始查询 */ - private void queryOfsReturnGoods(QueryOfsSoSaleOutVo queryOfsSoSaleOutVo, List headerDetailsDtoList, Long pageNo) throws Exception { - Long pageSize = 200L; - queryOfsSoSaleOutVo.setPageNo(pageNo); - queryOfsSoSaleOutVo.setPageSize(pageSize); - - InterfaceParamDto interfaceParamDto = new InterfaceParamDto(); - interfaceParamDto.setApi("ofs.receipt.search"); - interfaceParamDto.setData(JSON.toJSONString(queryOfsSoSaleOutVo)); - StockinOrderSearchResponse rertunGoodsRootBean = (StockinOrderSearchResponse) ofsUnifiedService.unified(interfaceParamDto); - if (rertunGoodsRootBean != null) { - if ("false".equals(rertunGoodsRootBean.getError()) && "0".equals(rertunGoodsRootBean.getCode()) && "Success".equals(rertunGoodsRootBean.getMsg())) { - List stockinOrderList = rertunGoodsRootBean.getData(); - if (stockinOrderList != null && stockinOrderList.size() > 0) { - headerDetailsDtoList.addAll(stockinOrderList); - - //TODO OFS没有提供分页字段,等待开发 - } - } else { - logger.error("查询失败,失败原因:{}", JSON.toJSON(interfaceParamDto)); - } - } else { - logger.error("rertunGoodsRootBean为空!interfaceParamDto对象的结果集json:{}", JSON.toJSON(interfaceParamDto)); - } - } +// private void queryOfsReturnGoods(QueryOfsSoSaleOutVo queryOfsSoSaleOutVo, List headerDetailsDtoList, Long pageNo) throws Exception { +// Long pageSize = 200L; +// queryOfsSoSaleOutVo.setPageNo(pageNo); +// queryOfsSoSaleOutVo.setPageSize(pageSize); +// +// InterfaceParamDto interfaceParamDto = new InterfaceParamDto(); +// interfaceParamDto.setApi("ofs.receipt.search"); +// interfaceParamDto.setData(JSON.toJSONString(queryOfsSoSaleOutVo)); +// StockinOrderSearchResponse rertunGoodsRootBean = (StockinOrderSearchResponse) ofsUnifiedService.unified(interfaceParamDto); +// if (rertunGoodsRootBean != null) { +// if ("false".equals(rertunGoodsRootBean.getError()) && "0".equals(rertunGoodsRootBean.getCode()) && "Success".equals(rertunGoodsRootBean.getMsg())) { +// List stockinOrderList = rertunGoodsRootBean.getData(); +// if (stockinOrderList != null && stockinOrderList.size() > 0) { +// headerDetailsDtoList.addAll(stockinOrderList); +// +// //TODO OFS没有提供分页字段,等待开发 +// } +// } else { +// logger.error("查询失败,失败原因:{}", JSON.toJSON(interfaceParamDto)); +// } +// } else { +// logger.error("rertunGoodsRootBean为空!interfaceParamDto对象的结果集json:{}", JSON.toJSON(interfaceParamDto)); +// } +// } /** * 环境预配置 @@ -314,8 +317,8 @@ public class ProxyPurchaseWarehous extends PluginBaseEntity { poOrderParentDto.setVdef20(poOrderSonDto.getId());//原单主键 //收发类别 -// poOrderParentDto.setPk_defdoc3(bdRdclEntity.getPkRdcl()); -// poOrderParentDto.setVdef3(bdRdclEntity.getRdname()); + poOrderParentDto.setPk_defdoc3(bdRdclEntity.getPkRdcl()); + poOrderParentDto.setVdef3(bdRdclEntity.getRdname()); //采购订单明细行 List poOrderChildrenDtoList = new ArrayList<>(); @@ -448,8 +451,8 @@ public class ProxyPurchaseWarehous extends PluginBaseEntity { //2024年8月20日 14:47:55 丽知商城、OFS 供应商客商档案、传递到U8C的客商, //其中自定义项1作为原系统编码,因此统一传到自定义项一,已经和大家确认好了,没有关系的,放心大胆传吧,宝贝 String shipFromCode = header.getShipFromCode(); - Assert.notNull(shipFromCode, "O供应商编码不能为空,没有办法完成业务逻辑,请配置供应商编码"); - Assert.state(!"".equals(shipFromCode.trim()), "O供应商编码不能为空,没有办法完成业务逻辑,请配置供应商编码!"); + Assert.notNull(shipFromCode, "O供应商编码不能为空,没有办法完成业务逻辑,请配置供应商编码(采购)"); + Assert.state(!"".equals(shipFromCode.trim()), "O供应商编码不能为空,没有办法完成业务逻辑,请配置供应商编码(采购)!"); BdCubasdocEntity bdCubasdocEntity = new BdCubasdocEntity(); bdCubasdocEntity.setDataSourceCode("lets_u8c"); bdCubasdocEntity.setDr(0L); diff --git a/buildpackage/src/main/java/com/hzya/frame/plugin/lets/u8cdto/PoOrderParentDto.java b/buildpackage/src/main/java/com/hzya/frame/plugin/lets/u8cdto/PoOrderParentDto.java index e5a81d58..e83f7e0f 100644 --- a/buildpackage/src/main/java/com/hzya/frame/plugin/lets/u8cdto/PoOrderParentDto.java +++ b/buildpackage/src/main/java/com/hzya/frame/plugin/lets/u8cdto/PoOrderParentDto.java @@ -16,7 +16,7 @@ public class PoOrderParentDto { private String bislatest; private Boolean bisreplenish; private String bpubtoec; - private String breturn; + private Boolean breturn; private Boolean bsocooptome; private String caccountbankid; private String caccountyear; diff --git a/buildpackage/src/main/java/com/hzya/frame/plugin/lets/u8cdto/PoOrderRerturnSonDto.java b/buildpackage/src/main/java/com/hzya/frame/plugin/lets/u8cdto/PoOrderRerturnSonDto.java new file mode 100644 index 00000000..61838a0b --- /dev/null +++ b/buildpackage/src/main/java/com/hzya/frame/plugin/lets/u8cdto/PoOrderRerturnSonDto.java @@ -0,0 +1,71 @@ +package com.hzya.frame.plugin.lets.u8cdto; + +import com.hzya.frame.plugin.lets.entity.*; +//import com.hzya.frame.ttxofs.dto.ofspoorder.OfsPoOrderData; +import com.hzya.frame.ttxofs.dto.ofspurchasereturnorder.PurchaseReturnOrder; +import com.hzya.frame.ttxofs.dto.ofssaleorderoutsearch.DetailsDto; +import com.hzya.frame.ttxofs.dto.ofssaleorderoutsearch.HeaderDto; +import lombok.Data; + +import java.util.List; + +/** + * @Author:liuyang + * @Package:com.hzya.frame.plugin.lets.u8cdto + * @Project:kangarooDataCenterV3 + * @name:PoOrderSonDto + * @Date:2024/8/20 14:51 + * @Filename:PoOrderSonDto + */ +@Data +public class PoOrderRerturnSonDto extends HeaderDto { + /** + * 采购公司 + */ + private BdCorpEntity bdCorpEntity; + + /** + * 采购部门 + */ + private BdDeptdocEntity bdDeptdocEntity; + + /** + * 采购组织 + */ + private BdPurorgEntity bdPurorgEntity; + + /** + * 客商基本档案-供应商 + */ + private BdCubasdocEntity bdCubasdocEntity; + + /** + * 客商管理档案-供应商 + */ + private BdCumandocEntity bdCumandocEntity; + + /** + * 明细行 + */ + private List details; + + /** + * OFS采购订单 + */ +// private OfsPoOrderData ofsPoOrderData; + + /** + * 收货库存组织 + */ + private BdCalbodyEntity bdCalbodyEntity; + + /** + * 收货仓库 + */ + private BdStordocEntity bdStordocEntity; + + /** + * 采退订单 + */ + private PurchaseReturnOrder purchaseReturnOrder; +} diff --git a/buildpackage/src/main/java/com/hzya/frame/plugin/lets/util/OfsStandardUti.java b/buildpackage/src/main/java/com/hzya/frame/plugin/lets/util/OfsStandardUti.java new file mode 100644 index 00000000..4589c550 --- /dev/null +++ b/buildpackage/src/main/java/com/hzya/frame/plugin/lets/util/OfsStandardUti.java @@ -0,0 +1,12 @@ +package com.hzya.frame.plugin.lets.util; + +/** + * @Author:liuyang + * @Package:com.hzya.frame.plugin.lets.util + * @Project:kangarooDataCenterV3 + * @name:OfsStandardUti + * @Date:2024/8/22 15:01 + * @Filename:OfsStandardUti + */ +public class OfsStandardUti { +} diff --git a/buildpackage/src/main/java/com/hzya/frame/plugin/lets/util/OfsStandardUtil.java b/buildpackage/src/main/java/com/hzya/frame/plugin/lets/util/OfsStandardUtil.java index 5fea364a..bab4239f 100644 --- a/buildpackage/src/main/java/com/hzya/frame/plugin/lets/util/OfsStandardUtil.java +++ b/buildpackage/src/main/java/com/hzya/frame/plugin/lets/util/OfsStandardUtil.java @@ -4,6 +4,8 @@ import cn.hutool.core.lang.Assert; import com.alibaba.fastjson.JSON; import com.hzya.frame.plugin.lets.ofsvo.QueryOfsSoSaleOutVo; import com.hzya.frame.ttxofs.dto.InterfaceParamDto; +import com.hzya.frame.ttxofs.dto.ofspurchasereturnorder.PurchaseReturnOrder; +import com.hzya.frame.ttxofs.dto.ofspurchasereturnorder.PurchaseReturnOrderBean; import com.hzya.frame.ttxofs.dto.ofssaleorderoutsearch.HeaderDetailsDto; import com.hzya.frame.ttxofs.dto.ofssaleorderoutsearch.SaleOutReturnMessageDto; import com.hzya.frame.ttxofs.dto.stock.StockinOrderSearchResponse; @@ -111,4 +113,39 @@ public class OfsStandardUtil { logger.error("rertunGoodsRootBean为空!interfaceParamDto对象的结果集json:{}", JSON.toJSON(interfaceParamDto)); } } + + /** + * OFS采退订单查询 + * + * @author liuyang + */ + public void queryPurchaseReturnOrder(QueryOfsSoSaleOutVo queryOfsSoSaleOutVo, List headerDetailsDtoList, Long pageNo, String api) throws Exception { + Assert.notNull(queryOfsSoSaleOutVo, "queryOfsSoSaleOutVo不能为空!"); + Assert.notNull(headerDetailsDtoList, "headerDetailsDtoList不能为空!"); + Assert.notNull(pageNo, "pageNo不能为空!"); + Assert.notNull(api, "api不能为空!"); + + Long pageSize = 200L; + queryOfsSoSaleOutVo.setPageNo(pageNo); + queryOfsSoSaleOutVo.setPageSize(pageSize); + + InterfaceParamDto interfaceParamDto = new InterfaceParamDto(); + interfaceParamDto.setApi(api); + interfaceParamDto.setData(JSON.toJSONString(queryOfsSoSaleOutVo)); + PurchaseReturnOrderBean purchaseReturnOrderBean = (PurchaseReturnOrderBean) ofsUnifiedService.unified(interfaceParamDto); + if (purchaseReturnOrderBean != null) { + if ("false".equals(purchaseReturnOrderBean.getError()) && "0".equals(purchaseReturnOrderBean.getCode()) && "Success".equals(purchaseReturnOrderBean.getMsg())) { + List purchaseReturnOrders = purchaseReturnOrderBean.getData(); + if (purchaseReturnOrders != null && purchaseReturnOrders.size() > 0) { + headerDetailsDtoList.addAll(purchaseReturnOrders); + + //TODO OFS没有提供分页字段,等待开发 + } + } else { + logger.error("查询失败,失败原因:{}", JSON.toJSON(interfaceParamDto)); + } + } else { + logger.error("purchaseReturnOrderBean为空!interfaceParamDto对象的结果集json:{}", JSON.toJSON(interfaceParamDto)); + } + } } diff --git a/buildpackage/src/test/java/com/hzya/frame/plugin/lets/plugin/purchase/ProxyPurchaseReturnTest.java b/buildpackage/src/test/java/com/hzya/frame/plugin/lets/plugin/purchase/ProxyPurchaseReturnTest.java index ef9f0a2f..33a025d6 100644 --- a/buildpackage/src/test/java/com/hzya/frame/plugin/lets/plugin/purchase/ProxyPurchaseReturnTest.java +++ b/buildpackage/src/test/java/com/hzya/frame/plugin/lets/plugin/purchase/ProxyPurchaseReturnTest.java @@ -7,8 +7,6 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.test.context.junit4.SpringRunner; -import static org.junit.Assert.*; - /** * @Author:liuyang * @Package:com.hzya.frame.plugin.lets.plugin.purchase @@ -27,7 +25,7 @@ public class ProxyPurchaseReturnTest { @Test public void startImplement() { try { - proxyPurchaseReturn.startImplement("LETS-SH2024082000000006"); + proxyPurchaseReturn.startImplement("LETS-SH2024082200000006"); } catch (Exception e) { e.printStackTrace(); } diff --git a/buildpackage/src/test/java/com/hzya/frame/plugin/lets/util/OfsStandardUtilTest.java b/buildpackage/src/test/java/com/hzya/frame/plugin/lets/util/OfsStandardUtilTest.java new file mode 100644 index 00000000..fa7f67b5 --- /dev/null +++ b/buildpackage/src/test/java/com/hzya/frame/plugin/lets/util/OfsStandardUtilTest.java @@ -0,0 +1,52 @@ +package com.hzya.frame.plugin.lets.util; + +import com.alibaba.fastjson2.JSON; +import com.hzya.frame.WebappApplication; +import com.hzya.frame.plugin.lets.ofsvo.QueryOfsSoSaleOutVo; +import com.hzya.frame.ttxofs.dto.ofspurchasereturnorder.PurchaseReturnOrder; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.context.junit4.SpringRunner; + +import java.util.ArrayList; +import java.util.List; + +import static org.junit.Assert.*; + +/** + * 测试采退订单 + * + * @Author:liuyang + * @Package:com.hzya.frame.plugin.lets.util + * @Project:kangarooDataCenterV3 + * @name:OfsStandardUtilTest + * @Date:2024/8/22 15:01 + * @Filename:OfsStandardUtilTest + */ +@RunWith(SpringRunner.class) +@SpringBootTest(classes = WebappApplication.class) +public class OfsStandardUtilTest { + + @Autowired + private OfsStandardUtil ofsStandardUtil; + + @Test + public void queryPurchaseReturnOrder() { + try { + List headerDetailsDtoList = new ArrayList<>(); + QueryOfsSoSaleOutVo queryOfsSoSaleOutVo = new QueryOfsSoSaleOutVo(); + queryOfsSoSaleOutVo.setCode("LETS-PR2024082000000001"); + queryOfsSoSaleOutVo.setClientCode("LETS"); + queryOfsSoSaleOutVo.setPageNo(1L); + queryOfsSoSaleOutVo.setPageSize(50L); + ofsStandardUtil.queryPurchaseReturnOrder(queryOfsSoSaleOutVo, headerDetailsDtoList, 1L, "ofs.purchaseReturnOrder.search"); + if (headerDetailsDtoList != null && headerDetailsDtoList.size() > 0) { + System.out.println(JSON.toJSONString(headerDetailsDtoList)); + } + } catch (Exception e) { + e.printStackTrace(); + } + } +} \ No newline at end of file diff --git a/service/src/main/java/com/hzya/frame/ttxofs/basics/ApiDtoCacheMap.java b/service/src/main/java/com/hzya/frame/ttxofs/basics/ApiDtoCacheMap.java index 010f5da8..24f0a3d3 100644 --- a/service/src/main/java/com/hzya/frame/ttxofs/basics/ApiDtoCacheMap.java +++ b/service/src/main/java/com/hzya/frame/ttxofs/basics/ApiDtoCacheMap.java @@ -6,6 +6,7 @@ import com.hzya.frame.ttxofs.dto.ofsBaseSearch.OfsShopReturnMessageDto; import com.hzya.frame.ttxofs.dto.ofsBaseSearch.OfsSupplierReturnMessageDto; import com.hzya.frame.ttxofs.dto.ofsTransferOrderSearch.OFSTranseferOrderSearchResponse; import com.hzya.frame.ttxofs.dto.ofspoorder.OfsPoOrderBean; +import com.hzya.frame.ttxofs.dto.ofspurchasereturnorder.PurchaseReturnOrderBean; import com.hzya.frame.ttxofs.dto.ofssaleorderoutsearch.SaleOutReturnMessageDto; import com.hzya.frame.ttxofs.dto.ofssalesordersearch.SaleOrderMessageDto; import com.hzya.frame.ttxofs.dto.returngoodordersearch.RerturnGoodsOrderSearchJsonRootBean; @@ -41,7 +42,8 @@ public class ApiDtoCacheMap { apiDtoCacheMap.put("ofs.inventory.class.search", new OFSSKUClassSearchResponse());//OFS存货分类查询接口 apiDtoCacheMap.put("ofs.returnOrder.search", new RerturnGoodsOrderSearchJsonRootBean());//售后订单 - + apiDtoCacheMap.put("ofs.purchaseOrder.search", new OfsPoOrderBean());//采购订单 + apiDtoCacheMap.put("ofs.purchaseReturnOrder.search", new PurchaseReturnOrderBean());//采退订单 } } diff --git a/service/src/main/java/com/hzya/frame/ttxofs/dto/ofspurchasereturnorder/PurchaseReturnOrder.java b/service/src/main/java/com/hzya/frame/ttxofs/dto/ofspurchasereturnorder/PurchaseReturnOrder.java new file mode 100644 index 00000000..6204d610 --- /dev/null +++ b/service/src/main/java/com/hzya/frame/ttxofs/dto/ofspurchasereturnorder/PurchaseReturnOrder.java @@ -0,0 +1,9 @@ +package com.hzya.frame.ttxofs.dto.ofspurchasereturnorder; + +import java.util.List; + +@lombok.Data +public class PurchaseReturnOrder { + private PurchaseReturnOrderHeader header; + private List details; +} \ No newline at end of file diff --git a/service/src/main/java/com/hzya/frame/ttxofs/dto/ofspurchasereturnorder/PurchaseReturnOrderBean.java b/service/src/main/java/com/hzya/frame/ttxofs/dto/ofspurchasereturnorder/PurchaseReturnOrderBean.java new file mode 100644 index 00000000..1ae2d002 --- /dev/null +++ b/service/src/main/java/com/hzya/frame/ttxofs/dto/ofspurchasereturnorder/PurchaseReturnOrderBean.java @@ -0,0 +1,10 @@ +package com.hzya.frame.ttxofs.dto.ofspurchasereturnorder; + +import com.hzya.frame.ttxofs.basics.ReturnMessageBasics; + +import java.util.List; + +@lombok.Data +public class PurchaseReturnOrderBean extends ReturnMessageBasics { + private List data; +} \ No newline at end of file diff --git a/service/src/main/java/com/hzya/frame/ttxofs/dto/ofspurchasereturnorder/PurchaseReturnOrderDetails.java b/service/src/main/java/com/hzya/frame/ttxofs/dto/ofspurchasereturnorder/PurchaseReturnOrderDetails.java new file mode 100644 index 00000000..b8327489 --- /dev/null +++ b/service/src/main/java/com/hzya/frame/ttxofs/dto/ofspurchasereturnorder/PurchaseReturnOrderDetails.java @@ -0,0 +1,36 @@ +package com.hzya.frame.ttxofs.dto.ofspurchasereturnorder; + +import lombok.Data; + +@Data +public class PurchaseReturnOrderDetails { + private String clientCode; + private String id; + private String companyCode; + private String purchaseReturnOrderId; + private String purchaseReturnOrderCode; + private String sourceLineNum; + private String skuCode; + private String skuName; + private String requestQty; + private String openQty; + private String fulfillQty; + private String quantityUM; + private String buyPrice; + private String discountPrice; + private String discount; + private String totalAmount; + private String totalWeight; + private String totalVolume; + private String totalVolumeWeight; + private String fulfillAmount; + private String fulfillWeight; + private String fulfillVolume; + private String weightUM; + private String volumeUM; + private String inventorySts; + private String created; + private String createdBy; + private String lastUpdated; + private String lastUpdatedBy; +} \ No newline at end of file diff --git a/service/src/main/java/com/hzya/frame/ttxofs/dto/ofspurchasereturnorder/PurchaseReturnOrderHeader.java b/service/src/main/java/com/hzya/frame/ttxofs/dto/ofspurchasereturnorder/PurchaseReturnOrderHeader.java new file mode 100644 index 00000000..754771d8 --- /dev/null +++ b/service/src/main/java/com/hzya/frame/ttxofs/dto/ofspurchasereturnorder/PurchaseReturnOrderHeader.java @@ -0,0 +1,52 @@ +package com.hzya.frame.ttxofs.dto.ofspurchasereturnorder; + +import lombok.Data; + +@Data +public class PurchaseReturnOrderHeader { + private String id; + private String clientCode; + private String companyCode; + private String facilityCode; + private String code; + private String status; + private String refOrderCode; + private String refOrderId; + private String internalOrderType; + private String bizChannel; + private String shipFromCode; + private String vendorCode; + private String vendorName; + private String shipToAttentionTo; + private String shipToCountry; + private String shipToState; + private String shipToCity; + private String shipToDistrict; + private String shipToAddress; + private String shipToPostalCode; + private String shipToPhone; + private String shipToMobile; + private String shipToFax; + private String shipToEmail; + private String totalAmount; + private String totalLines; + private String totalQty; + private String totalWeight; + private String totalVolume; + private String totalVolumeWeight; + private String totalFulfillQty; + private String totalFulfillAmount; + private String totalFulfillWeight; + private String totalFulfillVolume; + private String weightUM; + private String volumeUM; + private String sourcePlatformCode; + private String sourceOrderId; + private String sourceOrderCode; + private String auditBy; + private String auditAt; + private String created; + private String createdBy; + private String lastUpdated; + private String lastUpdatedBy; +} \ No newline at end of file