From 7f3a4f9f979c00ff454168900325d7bc0267a56b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=98chaoosc=E2=80=99?= <‘chaoosc@gmail.com’> Date: Sat, 21 Oct 2023 03:17:33 +0800 Subject: [PATCH 1/2] =?UTF-8?q?1.=E5=A2=9E=E5=8A=A0=E9=85=8D=E9=80=81?= =?UTF-8?q?=E5=8D=95=E5=8F=96=E6=B6=88=E4=BB=BB=E5=8A=A1=E5=90=8E=E7=9A=84?= =?UTF-8?q?=E6=8A=A5=E9=94=99=E5=88=A4=E6=96=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/impl/DistributionDeliveryListServiceImpl.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionDeliveryListServiceImpl.java b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionDeliveryListServiceImpl.java index 4a263b54a..c2aa2469a 100644 --- a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionDeliveryListServiceImpl.java +++ b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionDeliveryListServiceImpl.java @@ -3416,7 +3416,10 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl reservationVOS = distributionReservationMapper.getMarketReservationInfo(id); - deliveryListVO.setReservationInfos(DistributionReservationWrapper.build().listVO(reservationVOS)); + if(ObjectUtil.isNotEmpty(reservationVOS)){ + deliveryListVO.setReservationInfos(DistributionReservationWrapper.build().listVO(reservationVOS)); + + } return deliveryListVO; } From 931f1bb0a6d693a70c1bebd5650b9ec0b0270d1d Mon Sep 17 00:00:00 2001 From: zhenghaoyu Date: Sat, 21 Oct 2023 11:24:12 +0800 Subject: [PATCH 2/2] =?UTF-8?q?1.=E6=8B=89=E5=8F=96=E8=AE=A2=E5=8D=95?= =?UTF-8?q?=E6=95=B0=E6=8D=AE=E8=BF=98=E5=8E=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../feign/IDistributionParcelListClient.java | 3 + .../feign/DistributionParcelListClient.java | 9 + .../jobhandle/SyncOrderInfoToPlatform.java | 28 +++ .../patch/service/ISyncOrderInfoService.java | 2 + .../impl/SyncOrderInfoServiceImpl.java | 204 ++++++++++++++++++ 5 files changed, 246 insertions(+) diff --git a/blade-service-api/logpm-distribution-api/src/main/java/com/logpm/distribution/feign/IDistributionParcelListClient.java b/blade-service-api/logpm-distribution-api/src/main/java/com/logpm/distribution/feign/IDistributionParcelListClient.java index 41ecdc17f..ec567b9fe 100644 --- a/blade-service-api/logpm-distribution-api/src/main/java/com/logpm/distribution/feign/IDistributionParcelListClient.java +++ b/blade-service-api/logpm-distribution-api/src/main/java/com/logpm/distribution/feign/IDistributionParcelListClient.java @@ -99,4 +99,7 @@ public interface IDistributionParcelListClient { @PostMapping(API_PREFIX+"/addReturnId") Long addReturnId(@RequestBody DistributionParcelListEntity entity); + + @GetMapping(API_PREFIX+"/updateStockArticleIdByOrderCode") + void updateStockArticleIdByOrderCode(@RequestParam Long orderId, @RequestParam String orderCode); } diff --git a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/feign/DistributionParcelListClient.java b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/feign/DistributionParcelListClient.java index 24c629db7..1d15ec402 100644 --- a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/feign/DistributionParcelListClient.java +++ b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/feign/DistributionParcelListClient.java @@ -17,6 +17,7 @@ package com.logpm.distribution.feign; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.toolkit.ObjectUtils; import com.baomidou.mybatisplus.core.toolkit.Wrappers; @@ -163,4 +164,12 @@ public class DistributionParcelListClient implements IDistributionParcelListClie distributionParcelListService.save(entity); return entity.getId(); } + + @Override + public void updateStockArticleIdByOrderCode(Long orderId, String orderCode) { + UpdateWrapper updateWrapper = new UpdateWrapper<>(); + updateWrapper.set("stock_article_id",orderId) + .eq("order_code",orderCode); + distributionParcelListService.update(updateWrapper); + } } diff --git a/blade-service/logpm-patch/src/main/java/com/logpm/patch/jobhandle/SyncOrderInfoToPlatform.java b/blade-service/logpm-patch/src/main/java/com/logpm/patch/jobhandle/SyncOrderInfoToPlatform.java index 768ac84cc..2a496ea2f 100644 --- a/blade-service/logpm-patch/src/main/java/com/logpm/patch/jobhandle/SyncOrderInfoToPlatform.java +++ b/blade-service/logpm-patch/src/main/java/com/logpm/patch/jobhandle/SyncOrderInfoToPlatform.java @@ -14,6 +14,7 @@ import com.xxl.job.core.handler.annotation.XxlJob; import lombok.AllArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.springblade.common.exception.CustomerException; +import org.springblade.core.tool.utils.StringUtil; import org.springframework.stereotype.Component; import java.util.List; @@ -288,4 +289,31 @@ public class SyncOrderInfoToPlatform { } + @XxlJob("supplementOrderInfo") + public ReturnT supplementOrderInfo(String param) { + log.info("############supplementOrderInfo: 订单数据补充"); + if(StringUtil.isBlank(param)){ + log.info("##############supplementOrderInfo: 参数不能为空 "); + return ReturnT.FAIL; + } + + String[] split = param.split(","); + + List warehouseMappingDataEntityList = warehouseMappingDataService.getWarehouseMapping(); + if(warehouseMappingDataEntityList.isEmpty()){ + log.warn("###############syncZeroOrderInfo: 当前没有配置需要同步的仓库信息"); + return ReturnT.FAIL; + } + WarehouseMappingDataEntity warehouseMappingDataEntity = warehouseMappingDataEntityList.get(0); + Long newWarehouseId = warehouseMappingDataEntity.getNewWarehouseId(); + Integer oldWarehouseId = warehouseMappingDataEntity.getOldWarehouseId(); + for (String orderCode:split){ + + syncOrderInfoService.supplementOrderInfo(orderCode,newWarehouseId,oldWarehouseId); + + } + + return ReturnT.SUCCESS; + } + } diff --git a/blade-service/logpm-patch/src/main/java/com/logpm/patch/service/ISyncOrderInfoService.java b/blade-service/logpm-patch/src/main/java/com/logpm/patch/service/ISyncOrderInfoService.java index eecbbabc9..711e7ac67 100644 --- a/blade-service/logpm-patch/src/main/java/com/logpm/patch/service/ISyncOrderInfoService.java +++ b/blade-service/logpm-patch/src/main/java/com/logpm/patch/service/ISyncOrderInfoService.java @@ -11,4 +11,6 @@ public interface ISyncOrderInfoService { void addTrayType(Integer oldWarehouseId, Long newWarehouseId); + void supplementOrderInfo(String orderCode, Long newWarehouseId, Integer oldWarehouseId); + } diff --git a/blade-service/logpm-patch/src/main/java/com/logpm/patch/service/impl/SyncOrderInfoServiceImpl.java b/blade-service/logpm-patch/src/main/java/com/logpm/patch/service/impl/SyncOrderInfoServiceImpl.java index 9e087c711..d9c0d990f 100644 --- a/blade-service/logpm-patch/src/main/java/com/logpm/patch/service/impl/SyncOrderInfoServiceImpl.java +++ b/blade-service/logpm-patch/src/main/java/com/logpm/patch/service/impl/SyncOrderInfoServiceImpl.java @@ -243,6 +243,210 @@ public class SyncOrderInfoServiceImpl implements ISyncOrderInfoService { } + @Override + public void supplementOrderInfo(String orderCode, Long newWarehouseId, Integer oldWarehouseId) { + //通过订单号查询暂存单 + AdvanceEntity advanceEntity = advanceClient.getQueryDataOne(orderCode); + if(Objects.isNull(advanceEntity)){ + log.warn("#################saveOrderInfo: 未查询单订单信息 orderCode={}",orderCode); + throw new CustomerException(403,"未查询单订单信息"); + } + Integer advanceId = advanceEntity.getId(); + //判断新系统是否有这条订单数据 + DistributionStockArticleEntity distributionStockArticleEntity = distributionStockArticleClient.findByAdvanceId(advanceId); + + OrderCountEntity orderCountEntity = orderCountClient.getEntityByOrderCode(orderCode,oldWarehouseId); + if(Objects.isNull(orderCountEntity)){ + log.warn("#################saveOrderInfo: 未查询单订单信息 orderCode={}",orderCode); + throw new CustomerException(403,"未查询单订单信息"); + } + Integer total = orderCountEntity.getTotal(); + + WayBillEntity wayBillEntity = wayBillClient.getByWayBillByAdvanceId(advanceId); +// if(Objects.isNull(wayBillEntity)){ +// log.warn("#################saveOrderInfo: 未查询到运单信息 advanceId={}",advanceId); +// throw new CustomerException(403,"未查询到运单信息"); +// } + BasicdataWarehouseEntity basicdataWarehouseEntity = basicdataWarehouseClient.getEntityWarehouseId(newWarehouseId); + if(Objects.isNull(basicdataWarehouseEntity)){ + log.warn("#################saveOrderInfo: 未查询到仓库信息 newWarehouseId={}",newWarehouseId); + throw new CustomerException(403,"未查询到仓库信息"); + } + + + Long orderId; + + String wayBillNo = null; + if (Objects.isNull(distributionStockArticleEntity)) { + Date date = new Date(); + + distributionStockArticleEntity = new DistributionStockArticleEntity(); + distributionStockArticleEntity.setOrderCode(orderCode); + + // 其实是客户 + distributionStockArticleEntity.setMallName(advanceEntity.getDealerName()); + + + + distributionStockArticleEntity.setWarehouseEntryTime(orderCountEntity.getCreateTime()); + distributionStockArticleEntity.setWarehouseEntryTimeEnd(orderCountEntity.getLatestInTime()); + distributionStockArticleEntity.setTotalNumber(total); + distributionStockArticleEntity.setHandQuantity(orderCountEntity.getInNum()); + distributionStockArticleEntity.setTenantId(TenantNum.HUITONGCODE);// 对应租户ID +// distributionStockArticleEntity.setWaybillNumber();// 运单号 + + //判断是否齐套 查询该订单自编号下面的包件是都全部都交由汇通了 + Integer allNum = advanceDetailClient.getAllNumByOrderNo(orderCode); + if (total.equals(allNum)) { + //如果数据库中的数据和订单上的数量相等就是齐套 + distributionStockArticleEntity.setCompleteSet(1); + } else { + distributionStockArticleEntity.setCompleteSet(0); + } + log.info("############saveOrderInfo {}", basicdataWarehouseEntity); + distributionStockArticleEntity.setCreateDept(basicdataWarehouseEntity.getDepartment()); + + distributionStockArticleEntity.setConsigneeUnit(advanceEntity.getDealerName());//收货单位(经销商) + distributionStockArticleEntity.setConsigneePerson(advanceEntity.getCustomerName());//收货人 + distributionStockArticleEntity.setConsigneeAddress(advanceEntity.getCustomerRoad());//收货人地址 + distributionStockArticleEntity.setConsigneeMobile(advanceEntity.getCustomerPhone());//收货人电话 + distributionStockArticleEntity.setWarehouse(basicdataWarehouseEntity.getName()); + distributionStockArticleEntity.setWarehouseId(basicdataWarehouseEntity.getId()); + distributionStockArticleEntity.setDealerCode(advanceEntity.getDealerCode()); + distributionStockArticleEntity.setDealerName(advanceEntity.getDealerName()); + + if (ObjectUtils.isNotNull(wayBillEntity)) { + distributionStockArticleEntity.setConsigneeUnit(wayBillEntity.getTakeCompany());//收货单位(经销商) + distributionStockArticleEntity.setConsigneePerson(wayBillEntity.getTakePerson());//收货人 + distributionStockArticleEntity.setConsigneeAddress(wayBillEntity.getTakeAddress());//收货人地址 + distributionStockArticleEntity.setConsigneeMobile(wayBillEntity.getTakePhone());//收货人电话 + wayBillNo = wayBillEntity.getWaybillNo(); + distributionStockArticleEntity.setWaybillNumber(wayBillNo); + // 根据老运单上的仓库名称找寻新的仓库名称 + + // 发站 + String warehouseName = wayBillEntity.getStartSite(); + BasicdataWarehouseEntity t = basicdataWarehouseClient.findByName(warehouseName); + if(ObjectUtils.isNotNull(t)){ + distributionStockArticleEntity.setSendWarehouseName(t.getName()); + distributionStockArticleEntity.setSendWarehouseId(t.getId()); + } + + //收货仓库 + warehouseName = wayBillEntity.getWarehouseName(); + t = basicdataWarehouseClient.findByName(warehouseName); + if(ObjectUtils.isNotNull(t)){ + distributionStockArticleEntity.setAcceptWarehouseName(t.getName()); + distributionStockArticleEntity.setAcceptWarehouseId(t.getId()); + + // TODO 这里存在问题 后需要知道当前作业仓库 +// distributionStockArticleEntity.setWarehouse(t.getName()); +// distributionStockArticleEntity.setWarehouseId(t.getId()); + } + + String customerName = wayBillEntity.getTakeCompany();//客户名称 + + BasicdataClientEntity basicdataClientEntity = basicdataClientClient.findByName(customerName); + log.info("订单同步出现的客户编号{} 匹配的客户", basicdataClientEntity); + if (!Objects.isNull(basicdataClientEntity)) { + //商城 + distributionStockArticleEntity.setMallId(basicdataClientEntity.getId()); + distributionStockArticleEntity.setMallName(basicdataClientEntity.getClientName()); + distributionStockArticleEntity.setMallCode(basicdataClientEntity.getClientCode()); + + distributionStockArticleEntity.setDealerCode(basicdataClientEntity.getClientCode()); + distributionStockArticleEntity.setDealerName(basicdataClientEntity.getClientName()); + + + // todo 这里需要去查询门店 和新系统的门店ID 进行绑定 + String peisongType = getPeisongTypeByClientId(basicdataClientEntity.getId()); + log.info("订单同步peisongType {} ", peisongType); + + if (StringUtil.isNoneBlank(peisongType)) { + distributionStockArticleEntity.setTypeService(peisongType); + } + } + } + + + + //通过客户名称去查询客户的服务类型、 + distributionStockArticleEntity.setTypeService("1");//默认商配 + +// BasicdataClientEntity basicdataClientEntity = basicdataClientClient.findByName(customerName); +// log.info("订单同步出现的客户编号{} 匹配的客户", basicdataClientEntity); +// if (!Objects.isNull(basicdataClientEntity)) { +// //商城 +// distributionStockArticleEntity.setMallId(basicdataClientEntity.getId()); +// distributionStockArticleEntity.setMallName(basicdataClientEntity.getClientName()); +// distributionStockArticleEntity.setMallCode(basicdataClientEntity.getClientCode()); +// +// distributionStockArticleEntity.setDealerCode(basicdataClientEntity.getClientCode()); +// distributionStockArticleEntity.setDealerName(basicdataClientEntity.getClientName()); +// +// +// // todo 这里需要去查询门店 和新系统的门店ID 进行绑定 +// String peisongType = getPeisongTypeByClientId(basicdataClientEntity.getId()); +// log.info("订单同步peisongType {} ", peisongType); +// +// if (StringUtil.isNoneBlank(peisongType)) { +// distributionStockArticleEntity.setTypeService(peisongType); +// } +// } + + distributionStockArticleEntity.setGenre(1); + distributionStockArticleEntity.setAdvanceId(advanceId); + //--------------2023-07-06 新增字段处理 + + // 增加订单 经销商信息 和门店信息 + buildDealerAndStore(distributionStockArticleEntity, advanceEntity); + + distributionStockArticleEntity.setCreateUser(1123598821738675201L); + distributionStockArticleEntity.setSortingQuantity(orderCountEntity.getSorting()); //分拣件数 + distributionStockArticleEntity.setDeliveryQuantity(orderCountEntity.getDeliveNum()); //配送件数 + distributionStockArticleEntity.setTransferQuantity(orderCountEntity.getTransNum()); //中转件数 + distributionStockArticleEntity.setSigninQuantity(orderCountEntity.getSignNum()); //签收件数 + //1=部分入库,2=已入库,3=已出库,4=部分签收,5=待出库,6=已上架,7=已分拣,8=部分出库,9=部分装车,10=已装车,11=已签收,12=部分配送,13=已配送 + distributionStockArticleEntity.setFreezeStatus(OrderFreezeStatusConstant.weidongjie.getValue()); //冻结状态 + distributionStockArticleEntity.setReservationStatus(OrderReservationStatusConstant.daiyuyue.getValue()); //预约状态 + distributionStockArticleEntity.setStockupStatus(OrderStockupStatusConstant.daibeihuo.getValue()); //备货状态 + distributionStockArticleEntity.setGroundingStatus(OrderGroundingStatusConstant.daishangjia.getValue()); //上架状态 + + Integer status = orderCountEntity.getStatus(); + if(1 == status){ + distributionStockArticleEntity.setOrderStatus(OrderStatusConstant.bufenruku.getValue()); + }else if(2 == status){ + distributionStockArticleEntity.setOrderStatus(OrderStatusConstant.ruku.getValue()); + }else if(3 == status || 10 == status){ + distributionStockArticleEntity.setOrderStatus(OrderStatusConstant.chuku.getValue()); + }else if(4 == status){ + distributionStockArticleEntity.setOrderStatus(OrderStatusConstant.bufenqianshou.getValue()); + }else if(8 == status || 9 == status){ + distributionStockArticleEntity.setOrderStatus(OrderStatusConstant.bufenchuku.getValue()); + }else if(11 == status){ + distributionStockArticleEntity.setOrderStatus(OrderStatusConstant.qianshou.getValue()); + }else{ + distributionStockArticleEntity.setOrderStatus("100"); + } + distributionStockArticleEntity.setOrderReceiveStatus(OrderReceiveStatusConstant.yishouhuo.getValue()); + + distributionStockArticleEntity.setWarehouseEntryTime(date); + + orderId = distributionStockArticleClient.addData(distributionStockArticleEntity); + distributionStockArticleEntity.setId(orderId); + if (orderId == 0) { + log.warn("#################handleDataToPlatform: 保存订单信息失败 orderCode={}", orderCode); + throw new CustomerException(405, "保存订单信息失败"); + } + }else{ + orderId = distributionStockArticleEntity.getId(); + } + //通过订单号更新所有包件下面的关联订单id + distributionParcelListClient.updateStockArticleIdByOrderCode(orderId,orderCode); + + + } + private void saveTrayTypeInfoPackage(String orderCode,Integer oldWarehouseId,Long newWarehouseId) { //如果是订制品就先查询该订单有哪些包件打了托