From c1811b3dc78ea8b061de67838486dd0e1c52fa92 Mon Sep 17 00:00:00 2001 From: caoyizhong <1270296080@qq.com> Date: Wed, 19 Jul 2023 18:10:44 +0800 Subject: [PATCH 1/3] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E8=BD=AC=E5=BA=93?= =?UTF-8?q?=E5=AD=98=E5=93=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../entity/BasicdataStoreBrandEntity.java | 5 ++ .../feign/IBasicdataStoreBrandClient.java | 11 ++++ .../entity/DistributionParcelListEntity.java | 22 ++++++- .../entity/DistributionServiceLogEntity.java | 2 +- .../DistributionStockArticleEntity.java | 12 +++- .../entity/DistributionStockEntity.java | 25 +++++++ .../entity/DistributionStockListEntity.java | 26 ++++++++ .../feign/BasicdataStoreBrandClient.java | 10 +++ .../DistributionStockArticleController.java | 4 +- .../DistributionStockArticleServiceImpl.java | 66 ++++++++----------- .../excel/WarehousingEntryDetailExcel.java | 24 +++---- .../WarehouseWarehousingEntryServiceImpl.java | 22 +++++-- 12 files changed, 171 insertions(+), 58 deletions(-) diff --git a/blade-service-api/logpm-basicdata-api/src/main/java/com/logpm/basicdata/entity/BasicdataStoreBrandEntity.java b/blade-service-api/logpm-basicdata-api/src/main/java/com/logpm/basicdata/entity/BasicdataStoreBrandEntity.java index d20064544..5cb6c7c33 100644 --- a/blade-service-api/logpm-basicdata-api/src/main/java/com/logpm/basicdata/entity/BasicdataStoreBrandEntity.java +++ b/blade-service-api/logpm-basicdata-api/src/main/java/com/logpm/basicdata/entity/BasicdataStoreBrandEntity.java @@ -72,6 +72,11 @@ public class BasicdataStoreBrandEntity extends TenantEntity { */ @ApiModelProperty(value = "品牌ID") private String brandId; + /** + * 品牌名称 + */ + @ApiModelProperty(value = "品牌名称") + private String brandName; /** * 客户名称 */ diff --git a/blade-service-api/logpm-basicdata-api/src/main/java/com/logpm/basicdata/feign/IBasicdataStoreBrandClient.java b/blade-service-api/logpm-basicdata-api/src/main/java/com/logpm/basicdata/feign/IBasicdataStoreBrandClient.java index f0254091d..5c865126e 100644 --- a/blade-service-api/logpm-basicdata-api/src/main/java/com/logpm/basicdata/feign/IBasicdataStoreBrandClient.java +++ b/blade-service-api/logpm-basicdata-api/src/main/java/com/logpm/basicdata/feign/IBasicdataStoreBrandClient.java @@ -36,6 +36,7 @@ public interface IBasicdataStoreBrandClient { String API_PREFIX = "/client"; String TOP = API_PREFIX + "/top7"; + String BRANDLIST = API_PREFIX + "/brandList"; /** * 获取门店品牌中间表列表 @@ -47,4 +48,14 @@ public interface IBasicdataStoreBrandClient { @GetMapping(TOP) BladePage top(@RequestParam("current") Integer current, @RequestParam("size") Integer size); + /** + * 根据客户查询对应的品牌 + * + * @param clientId 客户 + * @param brandName 品牌 + * @return BladePage + */ + @GetMapping(BRANDLIST) + BasicdataStoreBrandEntity getBrandList(@RequestParam("clientId") Long clientId, @RequestParam("brandName") String brandName); + } diff --git a/blade-service-api/logpm-distribution-api/src/main/java/com/logpm/distribution/entity/DistributionParcelListEntity.java b/blade-service-api/logpm-distribution-api/src/main/java/com/logpm/distribution/entity/DistributionParcelListEntity.java index a128cb61d..37b09afb1 100644 --- a/blade-service-api/logpm-distribution-api/src/main/java/com/logpm/distribution/entity/DistributionParcelListEntity.java +++ b/blade-service-api/logpm-distribution-api/src/main/java/com/logpm/distribution/entity/DistributionParcelListEntity.java @@ -118,12 +118,22 @@ public class DistributionParcelListEntity extends TenantEntity { * 物料Id */ @ApiModelProperty(value = "物料ID") - private String material; + private Long material; /** * 物料名称 */ @ApiModelProperty(value = "物料名称") private String materialName; + /** + * 物料编号 + */ + @ApiModelProperty(value = "物料编号") + private String materialCode; + /** + * 物料单位 + */ + @ApiModelProperty(value = "物料单位") + private String materialUnit; /** * 数量 */ @@ -145,5 +155,15 @@ public class DistributionParcelListEntity extends TenantEntity { */ @ApiModelProperty(value = "服务号") private String serviceNumber; + /** + * 品牌ID + */ + @ApiModelProperty(value = "品牌ID") + private String brandId; + /** + * 品牌名称 + */ + @ApiModelProperty(value = "品牌名称") + private String brandName; } diff --git a/blade-service-api/logpm-distribution-api/src/main/java/com/logpm/distribution/entity/DistributionServiceLogEntity.java b/blade-service-api/logpm-distribution-api/src/main/java/com/logpm/distribution/entity/DistributionServiceLogEntity.java index 0136d66d0..f1328d395 100644 --- a/blade-service-api/logpm-distribution-api/src/main/java/com/logpm/distribution/entity/DistributionServiceLogEntity.java +++ b/blade-service-api/logpm-distribution-api/src/main/java/com/logpm/distribution/entity/DistributionServiceLogEntity.java @@ -66,7 +66,7 @@ public class DistributionServiceLogEntity extends TenantEntity { * 服务类型 */ @ApiModelProperty(value = "服务类型") - private Integer typeService; + private String typeService; /** * 费用 */ diff --git a/blade-service-api/logpm-distribution-api/src/main/java/com/logpm/distribution/entity/DistributionStockArticleEntity.java b/blade-service-api/logpm-distribution-api/src/main/java/com/logpm/distribution/entity/DistributionStockArticleEntity.java index 1b5811876..90af3bef2 100644 --- a/blade-service-api/logpm-distribution-api/src/main/java/com/logpm/distribution/entity/DistributionStockArticleEntity.java +++ b/blade-service-api/logpm-distribution-api/src/main/java/com/logpm/distribution/entity/DistributionStockArticleEntity.java @@ -124,6 +124,11 @@ public class DistributionStockArticleEntity extends TenantEntity { */ @ApiModelProperty(value = "仓库") private String warehouse; + /** + * 车次号 + */ + @ApiModelProperty(value = "车次号") + private String trainNumber; /** * 仓库ID @@ -176,7 +181,7 @@ public class DistributionStockArticleEntity extends TenantEntity { * 服务类型 */ @ApiModelProperty(value = "服务类型") - private Integer typeService; + private String typeService; /** * 顾客名字 */ @@ -399,6 +404,11 @@ public class DistributionStockArticleEntity extends TenantEntity { */ @ApiModelProperty(value = "订单码") private String stockArticleCode; + /** + * 工厂车次 + */ + @ApiModelProperty(value = "工厂车次") + private String factoryTrain; } diff --git a/blade-service-api/logpm-distribution-api/src/main/java/com/logpm/distribution/entity/DistributionStockEntity.java b/blade-service-api/logpm-distribution-api/src/main/java/com/logpm/distribution/entity/DistributionStockEntity.java index c580e5c40..8e4bf5067 100644 --- a/blade-service-api/logpm-distribution-api/src/main/java/com/logpm/distribution/entity/DistributionStockEntity.java +++ b/blade-service-api/logpm-distribution-api/src/main/java/com/logpm/distribution/entity/DistributionStockEntity.java @@ -113,6 +113,31 @@ public class DistributionStockEntity extends TenantEntity { */ @ApiModelProperty(value = "在库包件ID") private Long parcelListId; + /** + * 预约ID + */ + @ApiModelProperty(value = "预约ID") + private Long reservationId; + /** + * 预约编号 + */ + @ApiModelProperty(value = "预约编号") + private String reservationCode; + /** + * 出库类型 + */ + @ApiModelProperty(value = "出库类型") + private Long outboundType; + /** + * 配送Id + */ + @ApiModelProperty(value = "配送Id") + private Long deliveryListId; + /** + * 配送编号 + */ + @ApiModelProperty(value = "配送编号") + private Long deliveryListCode; diff --git a/blade-service-api/logpm-distribution-api/src/main/java/com/logpm/distribution/entity/DistributionStockListEntity.java b/blade-service-api/logpm-distribution-api/src/main/java/com/logpm/distribution/entity/DistributionStockListEntity.java index f220c2a0d..e3de1e05c 100644 --- a/blade-service-api/logpm-distribution-api/src/main/java/com/logpm/distribution/entity/DistributionStockListEntity.java +++ b/blade-service-api/logpm-distribution-api/src/main/java/com/logpm/distribution/entity/DistributionStockListEntity.java @@ -98,6 +98,32 @@ public class DistributionStockListEntity extends TenantEntity { */ @ApiModelProperty(value = "货物名称") private String descriptionGoods; + + /** + * 车牌 + */ + @ApiModelProperty(value = "车牌") + private String licensePlate; + /** + * 品牌名称 + */ + @ApiModelProperty(value = "品牌名称") + private String brandName; + /** + * 品牌Id + */ + @ApiModelProperty(value = "品牌ID") + private Long brandId; + /** + * 入库时间 + */ + @ApiModelProperty(value = "入库时间") + private Date warehousingTime; + /** + * 拆包数 + */ + @ApiModelProperty(value = "拆包数") + private Integer unpackingQuantity; /** * 货物编号 */ diff --git a/blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/feign/BasicdataStoreBrandClient.java b/blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/feign/BasicdataStoreBrandClient.java index f91a6ab09..d9144f17e 100644 --- a/blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/feign/BasicdataStoreBrandClient.java +++ b/blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/feign/BasicdataStoreBrandClient.java @@ -17,6 +17,7 @@ package com.logpm.basicdata.feign; import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; import lombok.AllArgsConstructor; import org.springblade.core.mp.support.BladePage; import org.springblade.core.mp.support.Condition; @@ -50,4 +51,13 @@ public class BasicdataStoreBrandClient implements IBasicdataStoreBrandClient { return BladePage.of(page); } + @Override + @GetMapping(BRANDLIST) + public BasicdataStoreBrandEntity getBrandList(Long clientId, String brandName) { + return basicdataStoreBrandService.getOne(Wrappers.query().lambda() + .eq(BasicdataStoreBrandEntity::getClientId,clientId) + .eq(BasicdataStoreBrandEntity::getBrandName,brandName) + ); + } + } diff --git a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/controller/DistributionStockArticleController.java b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/controller/DistributionStockArticleController.java index 52fc2bb71..d812f134b 100644 --- a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/controller/DistributionStockArticleController.java +++ b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/controller/DistributionStockArticleController.java @@ -90,7 +90,7 @@ public class DistributionStockArticleController extends BladeController { } IPage pages = distributionStockArticleService.page(Condition.getPage(query), queryWrapper); pages.getRecords().forEach( i ->{ - Integer typeService = i.getTypeService(); + String typeService = i.getTypeService(); //计算在库天数 // SimpleDateFormat simpleFormat = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss"); long time1 = i.getWarehouseEntryTime().getTime(); //入库 @@ -114,7 +114,7 @@ public class DistributionStockArticleController extends BladeController { R> distribution_type = dictBizClient.getList("distribution_type"); if(!Objects.isNull(typeService)){ if(Func.isNotEmpty(distribution_type.getData())){ - DictBiz dictBiz = distribution_type.getData().get(typeService-1); + DictBiz dictBiz = distribution_type.getData().get(Integer.parseInt(typeService)-1); i.setTypeName(dictBiz.getDictValue()); switch (i.getState()){ case 1: diff --git a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionStockArticleServiceImpl.java b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionStockArticleServiceImpl.java index 940f8bcd0..33ea657f8 100644 --- a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionStockArticleServiceImpl.java +++ b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionStockArticleServiceImpl.java @@ -17,15 +17,14 @@ package com.logpm.distribution.service.impl; import com.baomidou.mybatisplus.core.conditions.Wrapper; -import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.core.toolkit.ObjectUtils; import com.baomidou.mybatisplus.core.toolkit.StringUtils; import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.extension.toolkit.SqlHelper; import com.logpm.basic.feign.IBasicTenantCodeClient; import com.logpm.distribution.dto.DistributionStockArticleDTO; import com.logpm.distribution.entity.*; -import com.logpm.distribution.excel.DistributionAddvalueExcel; import com.logpm.distribution.excel.DistributionStockArticleExcel; import com.logpm.distribution.mapper.DistributionAddvalueMapper; import com.logpm.distribution.mapper.DistributionDeliveryListMapper; @@ -34,18 +33,16 @@ import com.logpm.distribution.service.*; import com.logpm.distribution.vo.DistributionStockArticleVO; import lombok.AllArgsConstructor; import lombok.extern.slf4j.Slf4j; +import org.apache.poi.ss.formula.functions.T; import org.springblade.core.mp.base.BaseServiceImpl; import org.springblade.core.tool.api.R; import org.springblade.core.tool.utils.Func; -import org.springblade.core.tool.utils.RandomType; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import java.math.BigDecimal; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; +import java.nio.charset.StandardCharsets; +import java.util.*; /** * 配送在库订单 服务实现类 @@ -247,38 +244,33 @@ public class DistributionStockArticleServiceImpl extends BaseServiceImpl Date: Wed, 19 Jul 2023 18:51:10 +0800 Subject: [PATCH 2/3] =?UTF-8?q?1.=E5=A2=9E=E5=8A=A0=E6=A2=A6=E5=A4=A9?= =?UTF-8?q?=E6=B4=BE=E8=BD=A6=E5=8D=95=E7=A1=AE=E8=AE=A4=E6=8E=A8=E9=80=81?= =?UTF-8?q?=E6=95=B0=E6=8D=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../common/constant/ModuleNameConstant.java | 2 +- .../snm/entity/MtFactoryOrderMain.java | 9 ++ .../factory/snm/feign/IMtOrderMainClinet.java | 30 ++++ .../snm/vo/MTOrderPackageRelationVO.java | 31 ++++ .../feign/IAdvanceDetailClient.java | 2 +- .../controller/FactoryCommonController.java | 42 ++++++ .../factory/comfac/dto/UnloadCarDTO.java | 20 +++ .../factory/config/RabbitMqConfiguration.java | 22 +++ .../factory/mt/dto/MtUnLoadCarNumDTO.java | 20 +++ .../factory/mt/feign/MtOrderMainClinet.java | 27 ++++ .../mt/mapper/MtFactoryOrderMainMapper.java | 5 + .../mt/mapper/MtFactoryOrderMainMapper.xml | 14 ++ .../mt/service/IMtFactoryDataService.java | 10 ++ .../service/IMtFactoryOrderMainService.java | 9 ++ .../impl/MtFactoryDataServiceImpl.java | 59 +++++++- .../impl/MtFactoryOrderMainServiceImpl.java | 12 ++ .../impl/PanFactoryDataServiceImpl.java | 1 - .../factory/receiver/UnloadCarComHandler.java | 139 ++++++++++++++++++ .../java/com/logpm/factory/TestService.java | 138 +++++++++++++++-- .../oldproject/mapper/AdvanceDetailMapper.xml | 2 +- 20 files changed, 576 insertions(+), 18 deletions(-) create mode 100644 blade-service-api/logpm-factory-api/src/main/java/com/logpm/factory/snm/feign/IMtOrderMainClinet.java create mode 100644 blade-service-api/logpm-factory-api/src/main/java/com/logpm/factory/snm/vo/MTOrderPackageRelationVO.java create mode 100644 blade-service/logpm-factory/src/main/java/com/logpm/factory/comfac/dto/UnloadCarDTO.java create mode 100644 blade-service/logpm-factory/src/main/java/com/logpm/factory/mt/dto/MtUnLoadCarNumDTO.java create mode 100644 blade-service/logpm-factory/src/main/java/com/logpm/factory/mt/feign/MtOrderMainClinet.java create mode 100644 blade-service/logpm-factory/src/main/java/com/logpm/factory/receiver/UnloadCarComHandler.java diff --git a/blade-biz-common/src/main/java/org/springblade/common/constant/ModuleNameConstant.java b/blade-biz-common/src/main/java/org/springblade/common/constant/ModuleNameConstant.java index 6741ff5f7..bbc73d67c 100644 --- a/blade-biz-common/src/main/java/org/springblade/common/constant/ModuleNameConstant.java +++ b/blade-biz-common/src/main/java/org/springblade/common/constant/ModuleNameConstant.java @@ -8,7 +8,7 @@ public interface ModuleNameConstant { /** * 如果不需要 "" */ - public static final String DEVAUTH ="-tjj"; + public static final String DEVAUTH =""; /** diff --git a/blade-service-api/logpm-factory-api/src/main/java/com/logpm/factory/snm/entity/MtFactoryOrderMain.java b/blade-service-api/logpm-factory-api/src/main/java/com/logpm/factory/snm/entity/MtFactoryOrderMain.java index 30794eb89..7d4d89487 100644 --- a/blade-service-api/logpm-factory-api/src/main/java/com/logpm/factory/snm/entity/MtFactoryOrderMain.java +++ b/blade-service-api/logpm-factory-api/src/main/java/com/logpm/factory/snm/entity/MtFactoryOrderMain.java @@ -8,6 +8,8 @@ import lombok.Data; import lombok.EqualsAndHashCode; import org.springblade.core.mp.base.BaseEntity; +import java.util.Date; + @Data @TableName("mt_factory_order_main") @ApiModel(value = "MtFactoryOrderMain对象", description = "梦天工厂订单主对象") @@ -58,4 +60,11 @@ public class MtFactoryOrderMain extends BaseEntity { @ApiModelProperty(value = "备注") private String remark; + @JsonProperty("反馈梦天状态") + @ApiModelProperty(value = "反馈梦天状态") + private Integer pushStatus; + + @JsonProperty("推送时间") + @ApiModelProperty(value = "推送时间") + private Date pushTime; } diff --git a/blade-service-api/logpm-factory-api/src/main/java/com/logpm/factory/snm/feign/IMtOrderMainClinet.java b/blade-service-api/logpm-factory-api/src/main/java/com/logpm/factory/snm/feign/IMtOrderMainClinet.java new file mode 100644 index 000000000..7773a34ec --- /dev/null +++ b/blade-service-api/logpm-factory-api/src/main/java/com/logpm/factory/snm/feign/IMtOrderMainClinet.java @@ -0,0 +1,30 @@ +package com.logpm.factory.snm.feign; + +import com.logpm.factory.snm.entity.StationlinenumEntity; +import com.logpm.factory.snm.vo.MTOrderPackageRelationVO; +import org.springblade.common.constant.ModuleNameConstant; +import org.springblade.core.tool.api.R; +import org.springframework.cloud.openfeign.FeignClient; +import org.springframework.web.bind.annotation.GetMapping; + +import java.util.List; + +@FeignClient( + value = ModuleNameConstant.APPLICATION_FACTORY_NAME +) +public interface IMtOrderMainClinet { + + + String API_PREFIX = "/mtclient"; + String TOP = API_PREFIX + "/top"; + + + /** + * 获取梦天工厂订单 包间 主订单 的关系 + * + * @return + */ + @GetMapping(TOP) + R> mtOrderPackageRelation(); + +} diff --git a/blade-service-api/logpm-factory-api/src/main/java/com/logpm/factory/snm/vo/MTOrderPackageRelationVO.java b/blade-service-api/logpm-factory-api/src/main/java/com/logpm/factory/snm/vo/MTOrderPackageRelationVO.java new file mode 100644 index 000000000..fcb223229 --- /dev/null +++ b/blade-service-api/logpm-factory-api/src/main/java/com/logpm/factory/snm/vo/MTOrderPackageRelationVO.java @@ -0,0 +1,31 @@ +package com.logpm.factory.snm.vo; + +import lombok.Data; + +import java.io.Serializable; + + +/** + * 梦天 订单 主订单 包间 关系 用于判断车次中的订单是否包含 + */ +@Data +public class MTOrderPackageRelationVO implements Serializable { + + + /** + * 包件码 + */ + private String packageCode; + /** + * 订单号 + */ + private String orderCode; + + /** + * 主订单号 + */ + private String invoiceOrderCode; + + + +} diff --git a/blade-service-api/logpm-old-project-api/src/main/java/com/logpm/oldproject/feign/IAdvanceDetailClient.java b/blade-service-api/logpm-old-project-api/src/main/java/com/logpm/oldproject/feign/IAdvanceDetailClient.java index 337f7cc91..639f43261 100644 --- a/blade-service-api/logpm-old-project-api/src/main/java/com/logpm/oldproject/feign/IAdvanceDetailClient.java +++ b/blade-service-api/logpm-old-project-api/src/main/java/com/logpm/oldproject/feign/IAdvanceDetailClient.java @@ -85,6 +85,6 @@ public interface IAdvanceDetailClient { * @param unloadCarNum * @return */ - @GetMapping(API_PREFIX + "/getOneByUnitNo") + @GetMapping(API_PREFIX + "/getByCarNum") List getByCarNum(@RequestParam String unloadCarNum); } diff --git a/blade-service/logpm-factory/src/main/java/com/logpm/factory/comfac/controller/FactoryCommonController.java b/blade-service/logpm-factory/src/main/java/com/logpm/factory/comfac/controller/FactoryCommonController.java index 517a4468c..eb062356e 100644 --- a/blade-service/logpm-factory/src/main/java/com/logpm/factory/comfac/controller/FactoryCommonController.java +++ b/blade-service/logpm-factory/src/main/java/com/logpm/factory/comfac/controller/FactoryCommonController.java @@ -5,6 +5,7 @@ import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport; import com.logpm.factory.comfac.dto.OrderInfoDTO; import com.logpm.factory.comfac.dto.OrderStatusDTO; import com.logpm.factory.comfac.dto.ReceiveInfoDTO; +import com.logpm.factory.comfac.dto.UnloadCarDTO; import com.logpm.factory.comfac.service.IFactoryCommonService; import com.logpm.factory.comfac.service.IOrderStatusLogService; import com.logpm.factory.snm.entity.OrderStatusLog; @@ -146,4 +147,45 @@ public class FactoryCommonController { } + // 卸车完成推送 + @ResponseBody + @PostMapping("/sendUnloadCarComInfo") + @ApiOperationSupport(order = 1) + @ApiOperation(value = "卸车完成推送", notes = "传入receiveInfoDTO") + public R sendUnloadCarComInfo(@RequestBody UnloadCarDTO receiveInfoDTO) { + log.info("############sendUnloadCarComInfo: 请求参数{}", receiveInfoDTO); + //处理数据 +// R r = factoryCommonService.sendReceiveInfo(receiveInfoDTO); + try{ + + //先保存原始请求数据 + OrderStatusLog orderStatusLog = new OrderStatusLog(); + orderStatusLog.setArgs(JSONObject.toJSONString(receiveInfoDTO)); + orderStatusLog.setStatus(1); + orderStatusLog.setType(5); + orderStatusLogService.save(orderStatusLog); + + Map map=new HashMap<>(); + map.put("messageId", CommonUtil.getUUID()); + map.put("logId", orderStatusLog.getId()); + map.put("messageData",receiveInfoDTO); + map.put("createTime",new Date().getTime()); + //将消息携带绑定键值 +// rabbitTemplate.convertAndSend(RabbitConstant.UNLOAD_CAR_COM_INFO_EXCHANGE, RabbitConstant.UNLOAD_CAR_COM_INFO_ROUTING, map); + + return R.success("调用成功"); + }catch (CustomerException e){ + log.error(e.message,e); + return R.fail(e.code,e.message); + }catch (Exception e){ + log.error("############sendReceiveInfo: 系统异常",e); + return R.fail(500,"############sendReceiveInfo: 系统异常"); + } + } + + + + + + } diff --git a/blade-service/logpm-factory/src/main/java/com/logpm/factory/comfac/dto/UnloadCarDTO.java b/blade-service/logpm-factory/src/main/java/com/logpm/factory/comfac/dto/UnloadCarDTO.java new file mode 100644 index 000000000..d8cab0b63 --- /dev/null +++ b/blade-service/logpm-factory/src/main/java/com/logpm/factory/comfac/dto/UnloadCarDTO.java @@ -0,0 +1,20 @@ +package com.logpm.factory.comfac.dto; + +import lombok.Data; + +import javax.validation.constraints.NotEmpty; +import java.io.Serializable; + +/** + * 卸车完成推送 + */ +@Data +public class UnloadCarDTO implements Serializable { + + @NotEmpty(message = "卸车车次号不能为空") + private String unloadCarNum; + + private String completeDate; + + +} diff --git a/blade-service/logpm-factory/src/main/java/com/logpm/factory/config/RabbitMqConfiguration.java b/blade-service/logpm-factory/src/main/java/com/logpm/factory/config/RabbitMqConfiguration.java index c07c9f387..598ea2a3a 100644 --- a/blade-service/logpm-factory/src/main/java/com/logpm/factory/config/RabbitMqConfiguration.java +++ b/blade-service/logpm-factory/src/main/java/com/logpm/factory/config/RabbitMqConfiguration.java @@ -175,5 +175,27 @@ public class RabbitMqConfiguration { } + /***/ + + @Bean + public Queue unloadCarNumQueue() { + return new Queue(RabbitConstant.UNLOAD_CAR_COM_INFO_QUEUE, true); + } + + @Bean + public CustomExchange unloadCarNumExchange() { + Map args = Maps.newHashMap(); + args.put("x-delayed-type", "direct"); + return new CustomExchange(RabbitConstant.UNLOAD_CAR_COM_INFO_EXCHANGE, "x-delayed-message", true, false, args); + } + + @Bean + public Binding unloadCarNumBinding(Queue receiveInfoQueue, CustomExchange receiveInfoExchange) { + return BindingBuilder.bind(receiveInfoQueue).to(receiveInfoExchange).with(RabbitConstant.UNLOAD_CAR_COM_INFO_ROUTING).noargs(); + } + + + + } diff --git a/blade-service/logpm-factory/src/main/java/com/logpm/factory/mt/dto/MtUnLoadCarNumDTO.java b/blade-service/logpm-factory/src/main/java/com/logpm/factory/mt/dto/MtUnLoadCarNumDTO.java new file mode 100644 index 000000000..cba11e26b --- /dev/null +++ b/blade-service/logpm-factory/src/main/java/com/logpm/factory/mt/dto/MtUnLoadCarNumDTO.java @@ -0,0 +1,20 @@ +package com.logpm.factory.mt.dto; + +import com.fasterxml.jackson.annotation.JsonProperty; +import lombok.Data; + +import java.io.Serializable; +import java.util.Date; + +@Data +public class MtUnLoadCarNumDTO implements Serializable { + + + @JsonProperty("发货单编号") + private String invoiceOrderCode; + + + @JsonProperty("确认收货时间") + private Date invoiceTime; + +} diff --git a/blade-service/logpm-factory/src/main/java/com/logpm/factory/mt/feign/MtOrderMainClinet.java b/blade-service/logpm-factory/src/main/java/com/logpm/factory/mt/feign/MtOrderMainClinet.java new file mode 100644 index 000000000..0593e28cc --- /dev/null +++ b/blade-service/logpm-factory/src/main/java/com/logpm/factory/mt/feign/MtOrderMainClinet.java @@ -0,0 +1,27 @@ +package com.logpm.factory.mt.feign; + +import com.logpm.factory.mt.service.IMtFactoryOrderMainService; +import com.logpm.factory.snm.feign.IMtOrderMainClinet; +import com.logpm.factory.snm.vo.MTOrderPackageRelationVO; +import lombok.AllArgsConstructor; +import org.springblade.core.tenant.annotation.NonDS; +import org.springblade.core.tool.api.R; +import org.springframework.web.bind.annotation.RestController; +import springfox.documentation.annotations.ApiIgnore; + +import java.util.List; + +@NonDS +@ApiIgnore +@RestController +@AllArgsConstructor +public class MtOrderMainClinet implements IMtOrderMainClinet { + + private final IMtFactoryOrderMainService mtFactoryOrderMainService; + + @Override + public R> mtOrderPackageRelation() { + List data =mtFactoryOrderMainService.mtOrderPackageRelation(); + return R.data(data); + } +} diff --git a/blade-service/logpm-factory/src/main/java/com/logpm/factory/mt/mapper/MtFactoryOrderMainMapper.java b/blade-service/logpm-factory/src/main/java/com/logpm/factory/mt/mapper/MtFactoryOrderMainMapper.java index 6788a3f90..a173a919f 100644 --- a/blade-service/logpm-factory/src/main/java/com/logpm/factory/mt/mapper/MtFactoryOrderMainMapper.java +++ b/blade-service/logpm-factory/src/main/java/com/logpm/factory/mt/mapper/MtFactoryOrderMainMapper.java @@ -2,6 +2,11 @@ package com.logpm.factory.mt.mapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.logpm.factory.snm.entity.MtFactoryOrderMain; +import com.logpm.factory.snm.vo.MTOrderPackageRelationVO; + +import java.util.List; public interface MtFactoryOrderMainMapper extends BaseMapper { + + List mtOrderPackageRelation(); } diff --git a/blade-service/logpm-factory/src/main/java/com/logpm/factory/mt/mapper/MtFactoryOrderMainMapper.xml b/blade-service/logpm-factory/src/main/java/com/logpm/factory/mt/mapper/MtFactoryOrderMainMapper.xml index 9cbe524ab..74e3a249a 100644 --- a/blade-service/logpm-factory/src/main/java/com/logpm/factory/mt/mapper/MtFactoryOrderMainMapper.xml +++ b/blade-service/logpm-factory/src/main/java/com/logpm/factory/mt/mapper/MtFactoryOrderMainMapper.xml @@ -17,4 +17,18 @@ + + + diff --git a/blade-service/logpm-factory/src/main/java/com/logpm/factory/mt/service/IMtFactoryDataService.java b/blade-service/logpm-factory/src/main/java/com/logpm/factory/mt/service/IMtFactoryDataService.java index 3012e6a76..e464e8281 100644 --- a/blade-service/logpm-factory/src/main/java/com/logpm/factory/mt/service/IMtFactoryDataService.java +++ b/blade-service/logpm-factory/src/main/java/com/logpm/factory/mt/service/IMtFactoryDataService.java @@ -8,6 +8,8 @@ import com.logpm.factory.mt.dto.MtFactoryDataDTO; import org.springblade.core.tool.api.R; import java.security.NoSuchAlgorithmException; +import java.text.ParseException; +import java.util.Date; /** * 工厂推送数据接口 @@ -21,4 +23,12 @@ public interface IMtFactoryDataService { R handleStatusData(OrderStatusDTO orderStatusDTO) throws JsonProcessingException, NoSuchAlgorithmException; R sendReceiveInfo(ReceiveInfoDTO receiveInfoDTO) throws JsonProcessingException, NoSuchAlgorithmException; + + /** + * + * @param unloadCarNum 发货单编号 + * @param data 确认收货时间 + * @return + */ + R sendUnloadCarNum(String unloadCarNum, Date data) throws ParseException, JsonProcessingException, NoSuchAlgorithmException; } diff --git a/blade-service/logpm-factory/src/main/java/com/logpm/factory/mt/service/IMtFactoryOrderMainService.java b/blade-service/logpm-factory/src/main/java/com/logpm/factory/mt/service/IMtFactoryOrderMainService.java index ed5af06df..ce9cade7e 100644 --- a/blade-service/logpm-factory/src/main/java/com/logpm/factory/mt/service/IMtFactoryOrderMainService.java +++ b/blade-service/logpm-factory/src/main/java/com/logpm/factory/mt/service/IMtFactoryOrderMainService.java @@ -1,8 +1,17 @@ package com.logpm.factory.mt.service; import com.logpm.factory.snm.entity.MtFactoryOrderMain; +import com.logpm.factory.snm.vo.MTOrderPackageRelationVO; import org.springblade.core.mp.base.BaseService; +import org.springblade.core.tool.api.R; + +import java.util.List; public interface IMtFactoryOrderMainService extends BaseService { + List mtOrderPackageRelation(); + + + + } diff --git a/blade-service/logpm-factory/src/main/java/com/logpm/factory/mt/service/impl/MtFactoryDataServiceImpl.java b/blade-service/logpm-factory/src/main/java/com/logpm/factory/mt/service/impl/MtFactoryDataServiceImpl.java index 79cd84be0..b13922124 100644 --- a/blade-service/logpm-factory/src/main/java/com/logpm/factory/mt/service/impl/MtFactoryDataServiceImpl.java +++ b/blade-service/logpm-factory/src/main/java/com/logpm/factory/mt/service/impl/MtFactoryDataServiceImpl.java @@ -38,6 +38,8 @@ import org.springframework.transaction.annotation.Transactional; import java.nio.charset.StandardCharsets; import java.security.NoSuchAlgorithmException; +import java.text.DateFormat; +import java.text.ParseException; import java.util.*; @Slf4j @@ -231,7 +233,7 @@ public class MtFactoryDataServiceImpl implements IMtFactoryDataService { * 获取梦天的工厂的数据token * @return */ - public String getMtToken() throws NoSuchAlgorithmException { + private String getMtToken() throws NoSuchAlgorithmException { String mtToken =bladeRedis.get("mt_token"); if(StringUtil.isBlank(mtToken)){ // 重新获取 @@ -348,7 +350,7 @@ public class MtFactoryDataServiceImpl implements IMtFactoryDataService { logger.info("##############handleStatusData: 推送包件状态请求参数 {}",s); //处理逻辑 - String result = HttpRequest.post(mtFactoryProperties.getUrl()+"/Auth/text") + String result = HttpRequest.post(mtFactoryProperties.getUrl()+"/ZXCFaHuoDan/ShouHuoRuKu") .header("APPKEY",mtFactoryProperties.getAppkey()) .header("Authorization",token) .header("USERID",mtFactoryProperties.getUserid()) @@ -455,7 +457,7 @@ public class MtFactoryDataServiceImpl implements IMtFactoryDataService { logger.info("##############sendReceiveInfo: 推送包件状态请求参数 {}",s); //处理逻辑 - String result = HttpRequest.post(mtFactoryProperties.getUrl()+"/Auth/text2") + String result = HttpRequest.post(mtFactoryProperties.getUrl()+"/ZXCFaHuoDan/QianShouDan") .header("APPKEY",mtFactoryProperties.getAppkey()) .header("Authorization",token) .header("USERID",mtFactoryProperties.getUserid()) @@ -482,4 +484,55 @@ public class MtFactoryDataServiceImpl implements IMtFactoryDataService { return R.success("处理签收数据完成"); } + + @Override + public R sendUnloadCarNum(String unloadCarNum, Date data) throws ParseException, JsonProcessingException, NoSuchAlgorithmException { + + + MtUnLoadCarNumDTO unLoadCarNumDTO = new MtUnLoadCarNumDTO(); + unLoadCarNumDTO.setInvoiceOrderCode(unloadCarNum); + unLoadCarNumDTO.setInvoiceTime(data); + + ObjectMapper objectMapper = new ObjectMapper(); + String s = objectMapper.writeValueAsString(unLoadCarNumDTO); + + //推送数据到梦天 + //先获取token + String token = getMtToken(); + + //请求参数 + logger.info("##############sendReceiveInfo: 推送包件状态请求参数 {}",s); + + //处理逻辑 + String result = HttpRequest.post(mtFactoryProperties.getUrl()+"/ZXCFaHuoDan/QueRenShouHuo") + .header("APPKEY",mtFactoryProperties.getAppkey()) + .header("Authorization",token) + .header("USERID",mtFactoryProperties.getUserid()) + .header("USERPWD",MD5Utils.md5Hex(mtFactoryProperties.getUserpwd().getBytes(StandardCharsets.UTF_8))) + .header("Content-Type","application/json") + .body(s).timeout(5 * 1000) + .execute().body(); + + logger.info("##############sendReceiveInfo: 车次作业确认完成 {}",result); + + //把结果字符串转为json对象 + JSONObject jsonObject = JSONObject.parseObject(result); + if(!Objects.isNull(jsonObject)){ + Integer code = jsonObject.getInteger("Result"); + String message = jsonObject.getString("Message"); + if(code.equals(0)){ + logger.info("##########sendReceiveInfo: 物流状态传递成功"); + }else{ + return Resp.fail(405,message); + } + }else{ + return Resp.fail(405,"返回格式有误:"+result); + } + + + + + return R.success("处理签收数据完成"); + + } } diff --git a/blade-service/logpm-factory/src/main/java/com/logpm/factory/mt/service/impl/MtFactoryOrderMainServiceImpl.java b/blade-service/logpm-factory/src/main/java/com/logpm/factory/mt/service/impl/MtFactoryOrderMainServiceImpl.java index 81fc033fc..b54135e21 100644 --- a/blade-service/logpm-factory/src/main/java/com/logpm/factory/mt/service/impl/MtFactoryOrderMainServiceImpl.java +++ b/blade-service/logpm-factory/src/main/java/com/logpm/factory/mt/service/impl/MtFactoryOrderMainServiceImpl.java @@ -3,13 +3,25 @@ package com.logpm.factory.mt.service.impl; import com.logpm.factory.snm.entity.MtFactoryOrderMain; import com.logpm.factory.mt.mapper.MtFactoryOrderMainMapper; import com.logpm.factory.mt.service.IMtFactoryOrderMainService; +import com.logpm.factory.snm.vo.MTOrderPackageRelationVO; import lombok.AllArgsConstructor; import org.springblade.core.mp.base.BaseServiceImpl; +import org.springblade.core.tool.api.R; import org.springframework.stereotype.Service; +import java.util.List; + @AllArgsConstructor @Service public class MtFactoryOrderMainServiceImpl extends BaseServiceImpl implements IMtFactoryOrderMainService { + private final MtFactoryOrderMainMapper mtFactoryOrderMainMapper; + + @Override + public List mtOrderPackageRelation() { + return mtFactoryOrderMainMapper.mtOrderPackageRelation(); + } + + } diff --git a/blade-service/logpm-factory/src/main/java/com/logpm/factory/pan/service/impl/PanFactoryDataServiceImpl.java b/blade-service/logpm-factory/src/main/java/com/logpm/factory/pan/service/impl/PanFactoryDataServiceImpl.java index 0bab43b4d..8b0f30e3b 100644 --- a/blade-service/logpm-factory/src/main/java/com/logpm/factory/pan/service/impl/PanFactoryDataServiceImpl.java +++ b/blade-service/logpm-factory/src/main/java/com/logpm/factory/pan/service/impl/PanFactoryDataServiceImpl.java @@ -421,7 +421,6 @@ public class PanFactoryDataServiceImpl implements IPanFactoryDataService { // 增加订单 经销商信息 和门店信息 buildDealerAndStore(distributionStockArticleEntity, advanceEntity); - distributionStockArticleEntity.setCreateUser(1123598821738675201L); id = distributionStockArticleClient.addData(distributionStockArticleEntity); diff --git a/blade-service/logpm-factory/src/main/java/com/logpm/factory/receiver/UnloadCarComHandler.java b/blade-service/logpm-factory/src/main/java/com/logpm/factory/receiver/UnloadCarComHandler.java new file mode 100644 index 000000000..ef1ac2d32 --- /dev/null +++ b/blade-service/logpm-factory/src/main/java/com/logpm/factory/receiver/UnloadCarComHandler.java @@ -0,0 +1,139 @@ +package com.logpm.factory.receiver; + +import com.baomidou.mybatisplus.extension.conditions.update.UpdateChainWrapper; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.logpm.factory.comfac.dto.OrderInfoDTO; +import com.logpm.factory.comfac.dto.UnloadCarDTO; +import com.logpm.factory.mt.service.IMtFactoryDataService; +import com.logpm.factory.mt.service.IMtFactoryOrderMainService; +import com.logpm.factory.snm.entity.MtFactoryOrderMain; +import com.logpm.factory.snm.vo.MTOrderPackageRelationVO; +import com.logpm.oldproject.entity.AdvanceDetailEntity; +import com.logpm.oldproject.feign.IAdvanceClient; +import com.logpm.oldproject.feign.IAdvanceDetailClient; +import com.rabbitmq.client.Channel; +import lombok.extern.slf4j.Slf4j; +import org.springblade.common.constant.RabbitConstant; +import org.springblade.core.tool.api.R; +import org.springframework.amqp.core.Message; +import org.springframework.amqp.rabbit.annotation.RabbitHandler; +import org.springframework.amqp.rabbit.annotation.RabbitListener; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +import java.security.NoSuchAlgorithmException; +import java.text.ParseException; +import java.text.SimpleDateFormat; +import java.util.Date; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.stream.Collectors; + +/** + * 卸车完成处理队列 + */ +@Slf4j +@RabbitListener(queues = RabbitConstant.UNLOAD_CAR_COM_INFO_QUEUE) +@Component +public class UnloadCarComHandler { + + @Autowired + private IAdvanceDetailClient advanceDetailClient; + + + @Autowired + private IMtFactoryOrderMainService mtFactoryOrderMainService; + + @Autowired + private IMtFactoryDataService mtFactoryDataService; + + + @RabbitHandler + public void unloadCarComDataHandler(Map map, Message message, Channel channel) { + + /* + 1.得到传递的车次 + 2. 需要判断这个车次是否市梦天的 + 3. 查询这个车次上的运单是否市梦天的 + + 4.查询包间对应的梦天发给我们的批次号 + */ + UnloadCarDTO unloadCarDTO = (UnloadCarDTO) map.get("messageData"); + /* + 2.通过车次查询来系统中车次绑定的运单 + 3.通过运单查询货物上的包件 + 4.需要过滤出来 只要梦天的 + */ + List carNumList = advanceDetailClient.getByCarNum(unloadCarDTO.getUnloadCarNum()); + + /** + * 安装品类进行分组 + */ + Map> carNumMapList = carNumList.stream().collect(Collectors.groupingBy(AdvanceDetailEntity::getType)); + + List mtListdata = carNumMapList.get("梦天"); + + if (mtListdata == null || mtListdata.size() == 0) { + log.info("##################{} 车次 不存在梦天的数据 无需返回", unloadCarDTO.getUnloadCarNum()); + return; + } + + // 得到车次下面梦天的包条码集合 + List mtStrs = mtListdata.stream().map(AdvanceDetailEntity::getUnitNo).collect(Collectors.toList()); + if (mtStrs == null || mtStrs.size() == 0) { + log.error("##################{} 车次 梦天的包条数据存在异常! 请联系管理员", unloadCarDTO.getUnloadCarNum()); + return; + } + + List allMtData = mtFactoryOrderMainService.mtOrderPackageRelation(); + // 对这个集合内进行分组 + Map> stringListMap = allMtData.stream().collect(Collectors.groupingBy(MTOrderPackageRelationVO::getInvoiceOrderCode)); + Set set = stringListMap.keySet(); + boolean isPush = false; + for (String s : set) { + // 得到某个工厂运输批次的集合 + List t = stringListMap.get(s); + //得到这个批次下面所有的包间 + List strs = t.stream().map(MTOrderPackageRelationVO::getPackageCode).collect(Collectors.toList()); + // 当前批次的包间 在 这个配载计划中存在一个 则进行通知 + for (String mtStr : mtStrs) { + if (strs.contains(mtStr)) { + isPush = true; + break; + } + } + if (isPush) { + break; + } + } + if (isPush) { + try { + Date data = new SimpleDateFormat().parse(unloadCarDTO.getCompleteDate()); + R r = mtFactoryDataService.sendUnloadCarNum(unloadCarDTO.getUnloadCarNum(), data); + if(r.isSuccess()){ + // 更新订单状态 + UpdateChainWrapper updateChainWrapper =new UpdateChainWrapper(MtFactoryOrderMain.class); + updateChainWrapper.set("push_status","1"); + updateChainWrapper.set("push_time",data); + updateChainWrapper.eq("invoice_order_code",unloadCarDTO.getUnloadCarNum()); + mtFactoryOrderMainService.update(updateChainWrapper); + } + + + } catch (ParseException e) { + e.printStackTrace(); + } catch (JsonProcessingException e) { + e.printStackTrace(); + } catch (NoSuchAlgorithmException e) { + e.printStackTrace(); + } + + + } + + + } + + +} diff --git a/blade-service/logpm-factory/src/test/java/com/logpm/factory/TestService.java b/blade-service/logpm-factory/src/test/java/com/logpm/factory/TestService.java index 9add403f6..a00e208aa 100644 --- a/blade-service/logpm-factory/src/test/java/com/logpm/factory/TestService.java +++ b/blade-service/logpm-factory/src/test/java/com/logpm/factory/TestService.java @@ -1,17 +1,133 @@ package com.logpm.factory; -//@ExtendWith(BladeSpringExtension.class) -//@BladeBootTest(appName = "logpm-factory", enableLoader = true) +import com.baomidou.mybatisplus.extension.conditions.update.UpdateChainWrapper; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.logpm.factory.comfac.controller.FactoryCommonController; +import com.logpm.factory.comfac.dto.UnloadCarDTO; +import com.logpm.factory.mt.service.IMtFactoryDataService; +import com.logpm.factory.mt.service.IMtFactoryOrderMainService; +import com.logpm.factory.mt.service.impl.MtFactoryDataServiceImpl; +import com.logpm.factory.snm.entity.MtFactoryOrderMain; +import com.logpm.factory.snm.vo.MTOrderPackageRelationVO; +import com.logpm.oldproject.entity.AdvanceDetailEntity; +import com.logpm.oldproject.feign.IAdvanceDetailClient; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; +import org.springblade.core.test.BladeBootTest; +import org.springblade.core.test.BladeSpringExtension; +import org.springblade.core.tool.api.R; +import org.springframework.beans.factory.annotation.Autowired; + +import java.security.NoSuchAlgorithmException; +import java.text.ParseException; +import java.text.SimpleDateFormat; +import java.util.Date; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.stream.Collectors; + +@ExtendWith(BladeSpringExtension.class) +@BladeBootTest(appName = "logpm-factory-zhy", enableLoader = true) public class TestService { -// @Autowired -// private MtFactoryDataServiceImpl mtFactoryDataService; -// @Test -// public void contextLoads() { -// -// String tolk =mtFactoryDataService.getMtToken(); -// System.out.println(tolk); -// -// } + + + + + @Autowired + private IAdvanceDetailClient advanceDetailClient; + + + @Autowired + private IMtFactoryOrderMainService mtFactoryOrderMainService; + + @Autowired + private IMtFactoryDataService mtFactoryDataService; + @Test + public void contextLoads() { + +/* + 1.得到传递的车次 + 2. 需要判断这个车次是否市梦天的 + 3. 查询这个车次上的运单是否市梦天的 + + 4.查询包间对应的梦天发给我们的批次号 + */ + UnloadCarDTO unloadCarDTO = new UnloadCarDTO(); + unloadCarDTO.setUnloadCarNum("LQGX230719001"); + unloadCarDTO.setCompleteDate("2023-07-19 16:48:45"); + + /* + 2.通过车次查询来系统中车次绑定的运单 + 3.通过运单查询货物上的包件 + 4.需要过滤出来 只要梦天的 + */ + List carNumList = advanceDetailClient.getByCarNum(unloadCarDTO.getUnloadCarNum()); + + + /** + * 安装品类进行分组 + */ + Map> carNumMapList = carNumList.stream().collect(Collectors.groupingBy(AdvanceDetailEntity::getType)); + + List mtListdata = carNumMapList.get("梦天"); + + if (mtListdata == null || mtListdata.size() == 0) { + return; + } + + // 得到车次下面梦天的包条码集合 + List mtStrs = mtListdata.stream().map(AdvanceDetailEntity::getUnitNo).collect(Collectors.toList()); + if (mtStrs == null || mtStrs.size() == 0) { + return; + } + + List allMtData = mtFactoryOrderMainService.mtOrderPackageRelation(); + // 对这个集合内进行分组 + Map> stringListMap = allMtData.stream().collect(Collectors.groupingBy(MTOrderPackageRelationVO::getInvoiceOrderCode)); + Set set = stringListMap.keySet(); + boolean isPush = false; + for (String s : set) { + // 得到某个工厂运输批次的集合 + List t = stringListMap.get(s); + //得到这个批次下面所有的包间 + List strs = t.stream().map(MTOrderPackageRelationVO::getPackageCode).collect(Collectors.toList()); + // 当前批次的包间 在 这个配载计划中存在一个 则进行通知 + for (String mtStr : mtStrs) { + if (strs.contains(mtStr)) { + isPush = true; + break; + } + } + if (isPush) { + break; + } + } + if (isPush) { + try { + + Date data = new SimpleDateFormat().parse(unloadCarDTO.getCompleteDate()); + R r = mtFactoryDataService.sendUnloadCarNum(unloadCarDTO.getUnloadCarNum(), data); + // 更新订单状态 + UpdateChainWrapper updateChainWrapper =new UpdateChainWrapper(MtFactoryOrderMain.class); + updateChainWrapper.set("push_status","1"); + updateChainWrapper.set("push_time",data); + updateChainWrapper.eq("invoice_order_code",unloadCarDTO.getUnloadCarNum()); + mtFactoryOrderMainService.update(updateChainWrapper); + + } catch (ParseException e) { + e.printStackTrace(); + } catch (JsonProcessingException e) { + e.printStackTrace(); + } catch (NoSuchAlgorithmException e) { + e.printStackTrace(); + } + + + } + + + } } diff --git a/blade-service/logpm-old-project/src/main/java/com/logpm/oldproject/mapper/AdvanceDetailMapper.xml b/blade-service/logpm-old-project/src/main/java/com/logpm/oldproject/mapper/AdvanceDetailMapper.xml index 0f8f55138..2a83de195 100644 --- a/blade-service/logpm-old-project/src/main/java/com/logpm/oldproject/mapper/AdvanceDetailMapper.xml +++ b/blade-service/logpm-old-project/src/main/java/com/logpm/oldproject/mapper/AdvanceDetailMapper.xml @@ -164,7 +164,7 @@ FROM ht_advance_detail WHERE - id IN ( + advance_id IN ( SELECT advance_id FROM From ff24a7adb71c5458ee87f3cbf2570ef26dee40ff Mon Sep 17 00:00:00 2001 From: kilo Date: Wed, 19 Jul 2023 19:01:14 +0800 Subject: [PATCH 3/3] =?UTF-8?q?=E9=A2=84=E7=BA=A6=E6=9F=A5=E7=9C=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../vo/DistributionReservationVO.java | 6 +- .../DistributionReservationController.java | 33 +++ .../mapper/DistributionReservationMapper.java | 4 + .../mapper/DistributionReservationMapper.xml | 76 ++++++ .../DistributionReservationPackageMapper.java | 16 ++ .../DistributionReservationPackageMapper.xml | 28 ++ .../IDistributionReservationService.java | 20 +- .../DistributionReservationServiceImpl.java | 245 ++++++++++-------- 8 files changed, 319 insertions(+), 109 deletions(-) diff --git a/blade-service-api/logpm-distribution-api/src/main/java/com/logpm/distribution/vo/DistributionReservationVO.java b/blade-service-api/logpm-distribution-api/src/main/java/com/logpm/distribution/vo/DistributionReservationVO.java index 28361ce9f..12dfae1a4 100644 --- a/blade-service-api/logpm-distribution-api/src/main/java/com/logpm/distribution/vo/DistributionReservationVO.java +++ b/blade-service-api/logpm-distribution-api/src/main/java/com/logpm/distribution/vo/DistributionReservationVO.java @@ -42,14 +42,12 @@ public class DistributionReservationVO extends DistributionReservationEntity { * 库存品信息列表 */ @ApiModelProperty(value = "库存品信息列表") - private List inventoryList; + private List inventoryList; /** * 订单信息列表 */ @ApiModelProperty(value = "订单信息列表") - private List stockArticleList; - - + private List stockArticleList; } diff --git a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/controller/DistributionReservationController.java b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/controller/DistributionReservationController.java index 19556b550..d1fd48d06 100644 --- a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/controller/DistributionReservationController.java +++ b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/controller/DistributionReservationController.java @@ -233,4 +233,37 @@ public class DistributionReservationController extends BladeController { boolean result = reservationService.cancelReservation(reservationDTO); return R.status(result); } + + /** + * 预约列表 详情 + */ + @GetMapping("/getReservationDetail") + @ApiOperationSupport(order = 1) + @ApiOperation(value = "详情", notes = "传入distrbutionReservation") + public R getReservationDetail(@RequestParam String id) { + R reservationVO = reservationService.getReservationDetail(id); + return R.data(reservationVO); + } + + /** + * 预约列表 详情 + */ + @GetMapping("/getReservationPackage") + @ApiOperationSupport(order = 1) + @ApiOperation(value = "详情", notes = "传入distrbutionReservation") + public R getReservationPackage(@RequestParam String reservationId,@RequestParam String id) { + R reservationPackage = reservationService.getReservationPackage(reservationId,id); + return reservationPackage; + } + + /** + * 预约列表 详情 + */ + @GetMapping("/getReservationPackageList") + @ApiOperationSupport(order = 1) + @ApiOperation(value = "详情", notes = "传入distrbutionReservation") + public R getReservationPackageList(@RequestParam String reservationId) { + R reservationPackage = reservationService.getReservationPackageList(reservationId); + return reservationPackage; + } } diff --git a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionReservationMapper.java b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionReservationMapper.java index 757245b18..eb682f242 100644 --- a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionReservationMapper.java +++ b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionReservationMapper.java @@ -20,8 +20,10 @@ import com.logpm.distribution.entity.DistributionReservationEntity; import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.conditions.Wrapper; import com.baomidou.mybatisplus.core.metadata.IPage; +import com.logpm.distribution.entity.DistributionStockArticleEntity; import com.logpm.distribution.excel.DistributionReservationExcel; import com.logpm.distribution.vo.DistributionReservationVO; +import com.logpm.distribution.vo.DistributionStockArticleVO; import org.apache.ibatis.annotations.Param; import java.util.List; @@ -54,4 +56,6 @@ public interface DistributionReservationMapper extends BaseMapper toLongList); DistributionReservationVO getReservationDetail(String reservationId); + + List getStockArticleList(@Param("id") String reservationId); } diff --git a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionReservationMapper.xml b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionReservationMapper.xml index 30a2e4f21..27b1f984d 100644 --- a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionReservationMapper.xml +++ b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionReservationMapper.xml @@ -80,5 +80,81 @@ AND reservation.reservation.id=#{reservationId} + diff --git a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionReservationPackageMapper.java b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionReservationPackageMapper.java index 63069af53..4521f87e0 100644 --- a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionReservationPackageMapper.java +++ b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionReservationPackageMapper.java @@ -16,6 +16,8 @@ */ package com.logpm.distribution.mapper; +import com.logpm.distribution.dto.DistributionReservationPackageDTO; +import com.logpm.distribution.entity.DistributionParcelListEntity; import com.logpm.distribution.entity.DistributionReservationPackageEntity; import com.logpm.distribution.vo.DistributionReservationPackageVO; import com.logpm.distribution.excel.DistributionReservationPackageExcel; @@ -57,4 +59,18 @@ public interface DistributionReservationPackageMapper extends BaseMapper getReservationPackage(@Param("po")DistributionReservationPackageDTO reservationPackageDTO); + + /** + * 查询预约单的所有包件信息 + * @param reservationId + * @return + */ + List getReservationPackageList(@Param("id")String reservationId); } diff --git a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionReservationPackageMapper.xml b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionReservationPackageMapper.xml index 09b06d0e7..8b79b5327 100644 --- a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionReservationPackageMapper.xml +++ b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionReservationPackageMapper.xml @@ -36,5 +36,33 @@ + + diff --git a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/IDistributionReservationService.java b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/IDistributionReservationService.java index bf138df4f..73af11b41 100644 --- a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/IDistributionReservationService.java +++ b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/IDistributionReservationService.java @@ -66,7 +66,7 @@ public interface IDistributionReservationService extends BaseService getReservationDetail(String reservationId); /** * 新增预约列表数据 @@ -120,10 +120,24 @@ public interface IDistributionReservationService extends BaseService deliveryBusinessTask(DistributionDeliveryAllocationDTO allocationDTO); /** - * - * @param allocationDTO + *取消预约 + * @param reservationDTO * @return */ boolean cancelReservation(DistributionReservationDTO reservationDTO); + /** + * 查询预约下的包件信息 + * @param reservationId + * @param id + * @return + */ + R getReservationPackage(String reservationId, String id); + + /** + * 查询预约单下的所有包件信息 + * @param reservationId + * @return + */ + R getReservationPackageList(String reservationId); } diff --git a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionReservationServiceImpl.java b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionReservationServiceImpl.java index c7d4d4ccd..e1075bbb3 100644 --- a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionReservationServiceImpl.java +++ b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionReservationServiceImpl.java @@ -26,7 +26,10 @@ import com.logpm.distribution.mapper.DistributionReservationPackageMapper; import com.logpm.distribution.mapper.DistributionReservationStockarticleMapper; import com.logpm.distribution.mapper.DistributionReservationStocklistMapper; import com.logpm.distribution.service.*; +import com.logpm.distribution.vo.DistributionReservationStockarticleVO; import com.logpm.distribution.vo.DistributionReservationVO; +import com.logpm.distribution.vo.DistributionStockArticleVO; +import com.logpm.distribution.vo.DistributionStockListVO; import lombok.AllArgsConstructor; import org.springblade.common.serviceConstant.ServiceConstant; import org.springblade.core.mp.support.Condition; @@ -98,10 +101,6 @@ public class DistributionReservationServiceImpl extends BaseServiceImpl selectDistrbutionReservationPage(IPage page, DistributionReservationVO distrbutionReservation) { return page.setRecords(baseMapper.selectDistrbutionReservationPage(page, distrbutionReservation)); @@ -138,9 +137,34 @@ public class DistributionReservationServiceImpl extends BaseServiceImpl getReservationDetail(String reservationId) { + if (Func.isBlank(reservationId)) { + log.error("参数异常reservationId+{" + reservationId + "}"); + return R.fail("服务器正忙!!"); + } + //创建预约对象 + //2、查询预约单下的包件信息列表 + //3、查询预约单下的库存品信息列表 + DistributionReservationEntity reservationEntity = this.getById(reservationId); + DistributionReservationVO reservationVO = Func.copy(reservationEntity, DistributionReservationVO.class); + String reservationStatus = reservationVO.getReservationStatus(); + Integer typeService = reservationVO.getTypeService(); + switch (reservationStatus) { + case "2": + reservationVO.setReservationStatus("已确定"); + break; + case "1": + reservationVO.setReservationStatus("待确定"); + break; + } + + //1、查询预约单下的订单列表信息 + List stockArticleEntityList = distributionReservationMapper.getStockArticleList(reservationId); + if (stockArticleEntityList.size() >= 1) { + reservationVO.setStockArticleList(stockArticleEntityList); + } +// DistributionReservationVO distributionReservationVO = distributionReservationMapper.getReservationDetail(reservationId); + return R.data(reservationVO); } @Override @@ -154,9 +178,9 @@ public class DistributionReservationServiceImpl extends BaseServiceImpl packageList = s.getPackageList(); - if (s.getIsHaveData().equals(ServiceConstant.ORDER_HAVE_DATA)){ - if (packageList.size() == 0){ - if (s.getIsHaveData() == 2 ){ - Map map = new HashMap<>(); - map.put("stockArticleId",s.getId()); - QueryWrapper qw = Condition.getQueryWrapper(map, DistributionParcelListEntity.class); - //添加订单下的所有在库订单的包件 - List distributionParcelListEntities = distributionParcelListService.getBaseMapper().selectList(qw); - distributionParcelListEntities.forEach(p->{ - DistributionReservationPackageEntity distributionReservationPackageEntity = new DistributionReservationPackageEntity(); - distributionReservationPackageEntity.setReservationId(reservationId); - distributionReservationPackageEntity.setParceListId(p.getId()); - distributionReservationPackageEntity.setStockArticleId(s.getId()); - distributionReservationPackageEntity.setPacketBarCode(p.getPacketBarCode()); - //维护订单下包件信息 - distributionReservationPackageService.save(distributionReservationPackageEntity); - //此时订单下的所有包件都处于预约状态,可用数为0 - packageNum.getAndIncrement(); - }); - } - s.setAvailableQuantity(0); - }else { - //维护选中的包件信息 - packageList.forEach(p->{ + if (packageList.size() == 0) { + if (s.getIsHaveData() == 2) { + Map map = new HashMap<>(); + map.put("stockArticleId", s.getId()); + QueryWrapper qw = Condition.getQueryWrapper(map, DistributionParcelListEntity.class); + //添加订单下的所有在库订单的包件 + List distributionParcelListEntities = distributionParcelListService.getBaseMapper().selectList(qw); + distributionParcelListEntities.forEach(p -> { DistributionReservationPackageEntity distributionReservationPackageEntity = new DistributionReservationPackageEntity(); distributionReservationPackageEntity.setReservationId(reservationId); distributionReservationPackageEntity.setParceListId(p.getId()); distributionReservationPackageEntity.setStockArticleId(s.getId()); - distributionReservationPackageMapper.insert(distributionReservationPackageEntity); + distributionReservationPackageEntity.setPacketBarCode(p.getPacketBarCode()); + //维护订单下包件信息 + distributionReservationPackageService.save(distributionReservationPackageEntity); + //此时订单下的所有包件都处于预约状态,可用数为0 packageNum.getAndIncrement(); }); - //设置订单可用数量为 - s.setAvailableQuantity(s.getHandQuantity() - s.getReservationNum()); } - distributionReservationStockarticleEntity.setReservationNum(packageNum.get()); - }else { - distributionReservationStockarticleEntity.setIsHaveData(ServiceConstant.ORDER_NOT_HAVE_DATA); - distributionReservationStockarticleEntity.setReservationNum(s.getTotalNumber()); + s.setAvailableQuantity(0); + } else { + //维护选中的包件信息 + packageList.forEach(p -> { + DistributionReservationPackageEntity distributionReservationPackageEntity = new DistributionReservationPackageEntity(); + distributionReservationPackageEntity.setReservationId(reservationId); + distributionReservationPackageEntity.setParceListId(p.getId()); + distributionReservationPackageEntity.setStockArticleId(s.getId()); + distributionReservationPackageMapper.insert(distributionReservationPackageEntity); + packageNum.getAndIncrement(); + }); + //设置订单可用数量为 + s.setAvailableQuantity(s.getHandQuantity() - s.getReservationNum()); } + distributionReservationStockarticleEntity.setReservationNum(packageNum.get()); //订单无数据源,不需要进行包件信息维护 //修改订单状态为已预约 s.setState(ServiceConstant.ORDER_STATE_ALREADY_RESERVATION); @@ -276,7 +295,7 @@ public class DistributionReservationServiceImpl extends BaseServiceImpl ids = Func.toLongList(reservationIds); - Map map = new HashMap<>(); + Map map = new HashMap<>(); //获取备货任务的编号 Long stockupEntityId = distributionStockupEntity.getId(); //统计包件数量 @@ -410,25 +429,25 @@ public class DistributionReservationServiceImpl extends BaseServiceImpl{ + ids.forEach(i -> { //查询备货任务 - map.put("reservationId",i); + map.put("reservationId", i); QueryWrapper qw = Condition.getQueryWrapper(map, DistributionStockupInfoEntity.class); DistributionStockupInfoEntity distributionStockupInfoEntity = distributionStockupInfoService.getOne(qw); - if (Func.isEmpty(distributionStockupInfoEntity)){ + if (Func.isEmpty(distributionStockupInfoEntity)) { //1、预约单不存在备货任务 //利用中间表建立起预约和备货表之间的关系 DistributionStockupInfoEntity stockupInfoEntity = new DistributionStockupInfoEntity(); stockupInfoEntity.setReservationId(i); stockupInfoEntity.setStockupId(stockupEntityId); distributionStockupInfoService.save(stockupInfoEntity); - }else { + } else { //TODO 这里还需要考虑一个备货任务下只有一条记录 //获取备货任务编号 Long stockupId = distributionStockupInfoEntity.getStockupId(); DistributionStockupEntity stockupEntity = distributionStockupService.getById(stockupId); //2、预约单存在备货任务还未指派 - if (Func.equals(stockupEntity.getAssignStatus(),ServiceConstant.STOCkUP_ASSIGNSTATUS_ABSENCE)){ + if (Func.equals(stockupEntity.getAssignStatus(), ServiceConstant.STOCkUP_ASSIGNSTATUS_ABSENCE)) { //对原有的备货关系进行修改 distributionStockupInfoEntity.setStockupId(stockupEntityId); distributionStockupInfoService.updateById(distributionStockupInfoEntity); @@ -464,8 +483,8 @@ public class DistributionReservationServiceImpl extends BaseServiceImpl o = Condition.getQueryWrapper(map, DistributionReservationPackageEntity.class); o.lambda().eq(DistributionReservationPackageEntity::getReservationId, reservationEntity.getId()); List reservationPackageEntityList = distributionReservationPackageService.getBaseMapper().selectList(o); - if (!Func.isEmpty(reservationStockarticleEntityList)){ - reservationStockarticleEntityList.forEach(r->{ + if (!Func.isEmpty(reservationStockarticleEntityList)) { + reservationStockarticleEntityList.forEach(r -> { //查询订单信息,完成对订单的信息修改 DistributionStockArticleEntity stockArticleEntity = distributionStockArticleService.getById(r.getStockArticleId()); //拼接订单编号 @@ -505,7 +524,7 @@ public class DistributionReservationServiceImpl extends BaseServiceImpl r.getReservationNum()){ + if (stockArticleEntity.getHandQuantity() > r.getReservationNum()) { //这里表示订单下的包件没有进行全部配送 //修改订单状态为部分配送 stockArticleEntity.setState(4); @@ -516,9 +535,9 @@ public class DistributionReservationServiceImpl extends BaseServiceImpl{ + reservationStocklistEntityList.forEach(l -> { DistributionStockListEntity stockListEntity = distributionStockListService.getById(l.getStocklistId()); stockListEntity.setQuantityStock(stockListEntity.getQuantityStock() - l.getReservationNum()); hashSet.add(stockListEntity.getOrderSelfNumbering()); @@ -539,7 +558,7 @@ public class DistributionReservationServiceImpl extends BaseServiceImpl allocationInfo = allocationDTO.getAllocationInfo(); - allocationInfo.forEach(a->{ + allocationInfo.forEach(a -> { DistributionDeliverySelfEntity distributionDeliverySelfEntity = Func.copy(a, DistributionDeliverySelfEntity.class); //设置车辆编号 distributionDeliverySelfEntity.setDeliveryId(Long.parseLong(a.getDriverId())); @@ -568,9 +587,9 @@ public class DistributionReservationServiceImpl extends BaseServiceImpl1){ - distributionDeliveryListEntity.setOrderId(orderIds.deleteCharAt(orderIds.length()-1).toString()); + distributionDeliveryListEntity.setOrderSelfNumbering(String.join(",", hashSet)); + if (orderIds.length() > 1) { + distributionDeliveryListEntity.setOrderId(orderIds.deleteCharAt(orderIds.length() - 1).toString()); } distributionDeliveryListEntity.setReservationId(reservationIds); distributionDeliveryListEntity.setDeliveryNumber(packageNum.get()); @@ -604,6 +623,7 @@ public class DistributionReservationServiceImpl extends BaseServiceImpl getReservationInfo(String reservationId) { //查询出预约信息 @@ -624,8 +644,9 @@ public class DistributionReservationServiceImpl extends BaseServiceImpl stockArticleVOList = Func.copy(stockArticleEntityList, DistributionStockArticleVO.class); //查询出 库存信息 - reservationVO.setStockArticleList(stockArticleEntityList); + reservationVO.setStockArticleList(stockArticleVOList); } if (!Func.isEmpty(reservationStocklistEntityList)) { List stockArticleEntityList = new ArrayList<>(); @@ -634,8 +655,9 @@ public class DistributionReservationServiceImpl extends BaseServiceImpl stockListVOList = Func.copy(stockArticleEntityList, DistributionStockListVO.class); //查询出 库存信息 - reservationVO.setInventoryList(stockArticleEntityList); + reservationVO.setInventoryList(stockListVOList); } return R.data(reservationVO); } @@ -677,7 +699,7 @@ public class DistributionReservationServiceImpl extends BaseServiceImpl { Long stocklistId = r1.getStocklistId(); DistributionStockListEntity stockListEntity = distributionStockListService.getById(stocklistId); - stockListEntity.setQuantityOccupied(stockListEntity.getQuantityOccupied()-r1.getReservationNum()); + stockListEntity.setQuantityOccupied(stockListEntity.getQuantityOccupied() - r1.getReservationNum()); stockListEntity.setQuantityOccupied(stockListEntity.getQuantityOccupied() + r1.getReservationNum()); //这里对原表进行物理删除 distributionStockListService.updateById(stockListEntity); @@ -703,13 +725,13 @@ public class DistributionReservationServiceImpl extends BaseServiceImpl { List packageList = s.getPackageList(); AtomicInteger packageNum = new AtomicInteger(); - if (packageList.size() == 0){ - Map map = new HashMap<>(); - map.put("stockArticleId",s.getId()); + if (packageList.size() == 0) { + Map map = new HashMap<>(); + map.put("stockArticleId", s.getId()); QueryWrapper qw = Condition.getQueryWrapper(map, DistributionParcelListEntity.class); //添加订单下的所有在库订单 List distributionParcelListEntities = distributionParcelListService.getBaseMapper().selectList(qw); - distributionParcelListEntities.forEach(p->{ + distributionParcelListEntities.forEach(p -> { packageNum.getAndIncrement(); DistributionReservationPackageEntity distributionReservationPackageEntity = new DistributionReservationPackageEntity(); distributionReservationPackageEntity.setReservationId(distributionReservationDTO.getId()); @@ -721,9 +743,9 @@ public class DistributionReservationServiceImpl extends BaseServiceImpl{ + packageList.forEach(p -> { packageNum.getAndIncrement(); DistributionReservationPackageEntity distributionReservationPackageEntity = new DistributionReservationPackageEntity(); distributionReservationPackageEntity.setReservationId(distributionReservationDTO.getId()); @@ -781,8 +803,8 @@ public class DistributionReservationServiceImpl extends BaseServiceImpl deliveryBusinessTask(DistributionDeliveryAllocationDTO allocationDTO) { - if (Func.isEmpty(allocationDTO)){ - log.error("参数异常allocationDTO+{"+allocationDTO+"}"); + if (Func.isEmpty(allocationDTO)) { + log.error("参数异常allocationDTO+{" + allocationDTO + "}"); return R.fail("服务器正忙!!!"); } //1、添加配送任务 @@ -801,7 +823,7 @@ public class DistributionReservationServiceImpl extends BaseServiceImpl distributionStockArticleDTOS = storeClient.get(""); Map> mallClient = distributionStockArticleDTOS.stream().collect(Collectors.groupingBy(DistributionStockArticleDTO::getMallName)); //3、维护订单和客户 - storeClient.forEach((k,v)->mallClient.merge(k,v,(v1,v2)->v2)); + storeClient.forEach((k, v) -> mallClient.merge(k, v, (v1, v2) -> v2)); //统计客户数 AtomicInteger clientNum = new AtomicInteger(); @@ -822,8 +844,8 @@ public class DistributionReservationServiceImpl extends BaseServiceImpl{ - if (!Func.isBlank(k)){ + mallClient.forEach((k, v) -> { + if (!Func.isBlank(k)) { ////统计客户数 //预约任务是在客户的维度上进行数据维护 DistributionReservationDTO reservation = allocationDTO.getReservation(); @@ -849,7 +871,7 @@ public class DistributionReservationServiceImpl extends BaseServiceImpl initTotal = new AtomicReference<>(BigDecimal.ZERO); //统计包件数量 AtomicInteger packageNum = new AtomicInteger(); - v.forEach(a->{ + v.forEach(a -> { orderTotal.getAndIncrement(); //TODO 这里还需要对库存品进行筛选 DistributionStockArticleEntity stockArticleEntity = Func.copy(a, DistributionStockArticleEntity.class); @@ -862,16 +884,16 @@ public class DistributionReservationServiceImpl extends BaseServiceImpl packageList = a.getPackageList(); - if (a.getPackageList().size() == 0){ - Map map = new HashMap(); + if (a.getPackageList().size() == 0) { + Map map = new HashMap(); //这里就是默认添加订单下的所有包件 - map.put("stockArticleId",stockArticleEntity.getId()); + map.put("stockArticleId", stockArticleEntity.getId()); QueryWrapper o = Condition.getQueryWrapper(map, DistributionParcelListEntity.class); // o.lambda().eq(DistributionParcelListEntity::getStockArticleId, stockArticleEntity.getId()); List parcelListEntityList = distributionParcelListService.getBaseMapper().selectList(o); - parcelListEntityList.forEach(p->{ + parcelListEntityList.forEach(p -> { packageCount.getAndIncrement(); DistributionReservationPackageEntity reservationPackageEntity = new DistributionReservationPackageEntity(); reservationPackageEntity.setReservationId(reservationEntity.getId()); @@ -880,9 +902,9 @@ public class DistributionReservationServiceImpl extends BaseServiceImpl{ + packageList.forEach(p -> { packageCount.getAndIncrement(); DistributionReservationPackageEntity reservationPackageEntity = new DistributionReservationPackageEntity(); reservationPackageEntity.setReservationId(reservationEntity.getId()); @@ -895,7 +917,7 @@ public class DistributionReservationServiceImpl extends BaseServiceImpl allocationInfo = allocationDTO.getAllocationInfo(); - allocationInfo.forEach(a->{ + allocationInfo.forEach(a -> { DistributionDeliverySelfEntity distributionDeliverySelfEntity = Func.copy(a, DistributionDeliverySelfEntity.class); //设置车辆编号 distributionDeliverySelfEntity.setDeliveryId(Long.parseLong(a.getDriverId())); @@ -952,7 +974,7 @@ public class DistributionReservationServiceImpl extends BaseServiceImpl getReservationPackage(String reservationId, String id) { + DistributionReservationPackageDTO reservationPackageDTO = new DistributionReservationPackageDTO(); + reservationPackageDTO.setReservationId(Long.parseLong(reservationId)); + reservationPackageDTO.setStockArticleId(Long.parseLong(id)); + List parcelListEntityList = distributionReservationPackageMapper.getReservationPackage(reservationPackageDTO); + return R.data(parcelListEntityList); + } + + @Override + public R getReservationPackageList(String reservationId) { + if (Func.isBlank(reservationId)) { + log.error("参数异常reservationId+{" + reservationId + "}"); + return R.fail("服务器正忙!!"); + } + List distributionParcelListEntityList = distributionReservationPackageMapper.getReservationPackageList(reservationId); + return R.data(distributionParcelListEntityList); + } }