From 52bb78efd40179fd4a803354eb4d8ee113e70f1b Mon Sep 17 00:00:00 2001 From: PigBaoBei <2739175034@qq.com> Date: Tue, 16 Jul 2024 18:23:36 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=80=BC=E6=9C=8D=E5=8A=A1=E9=A1=B9?= =?UTF-8?q?=E8=AE=A1=E7=AE=97=E6=94=B6=E8=B4=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../BasicdataFactoryCategoryEntity.java | 5 + .../feign/IBasicdataClientClient.java | 8 + .../IBasicdataFactoryCategoryClient.java | 26 + .../DistributionAddvaluePackageEntity.java | 48 + .../vo/DistributionAddvaluePackageVO.java | 2 + .../feign/BasicdataClientClient.java | 5 + .../BasicdataFactoryCategoryEntityClient.java | 34 + .../DistributionSignforController.java | 9 +- .../dto/DistributionAddvaluePackageDTO.java | 6 + .../mapper/DistributionAddvalueMapper.xml | 403 ++++---- .../mapper/DistributionReservationMapper.xml | 929 +++++++++--------- .../impl/DistributionAddvalueServiceImpl.java | 378 +++++-- .../DistributionDeliveryListServiceImpl.java | 15 +- .../impl/DistributionSignforServiceImpl.java | 123 ++- .../DistrilbutionBillLadingServiceImpl.java | 25 +- .../IWarehouseRetentionScanService.java | 9 +- 16 files changed, 1302 insertions(+), 723 deletions(-) diff --git a/blade-service-api/logpm-basicdata-api/src/main/java/com/logpm/basicdata/entity/BasicdataFactoryCategoryEntity.java b/blade-service-api/logpm-basicdata-api/src/main/java/com/logpm/basicdata/entity/BasicdataFactoryCategoryEntity.java index db4de47b3..f757fc7f3 100644 --- a/blade-service-api/logpm-basicdata-api/src/main/java/com/logpm/basicdata/entity/BasicdataFactoryCategoryEntity.java +++ b/blade-service-api/logpm-basicdata-api/src/main/java/com/logpm/basicdata/entity/BasicdataFactoryCategoryEntity.java @@ -58,8 +58,13 @@ public class BasicdataFactoryCategoryEntity extends TenantEntity { @ApiModelProperty(value = "品牌名称") private String brand; + @ApiModelProperty(value = "物料名称") + private String materielName; + @ApiModelProperty(value = "品牌id") private Long brandId; + + } diff --git a/blade-service-api/logpm-basicdata-api/src/main/java/com/logpm/basicdata/feign/IBasicdataClientClient.java b/blade-service-api/logpm-basicdata-api/src/main/java/com/logpm/basicdata/feign/IBasicdataClientClient.java index e37a3a006..d0d1d8858 100644 --- a/blade-service-api/logpm-basicdata-api/src/main/java/com/logpm/basicdata/feign/IBasicdataClientClient.java +++ b/blade-service-api/logpm-basicdata-api/src/main/java/com/logpm/basicdata/feign/IBasicdataClientClient.java @@ -100,4 +100,12 @@ public interface IBasicdataClientClient { */ @GetMapping(API_PREFIX+"/getClientByName") List getClientByName(String consigneeUnit); + + /** + * 查询多个ID客户信息 + * @param clientIds + * @return + */ + @GetMapping(API_PREFIX+"/findEntityByIds") + List findEntityByIds(@RequestParam List clientIds); } diff --git a/blade-service-api/logpm-basicdata-api/src/main/java/com/logpm/basicdata/feign/IBasicdataFactoryCategoryClient.java b/blade-service-api/logpm-basicdata-api/src/main/java/com/logpm/basicdata/feign/IBasicdataFactoryCategoryClient.java index 99b66793d..f2e2c92c3 100644 --- a/blade-service-api/logpm-basicdata-api/src/main/java/com/logpm/basicdata/feign/IBasicdataFactoryCategoryClient.java +++ b/blade-service-api/logpm-basicdata-api/src/main/java/com/logpm/basicdata/feign/IBasicdataFactoryCategoryClient.java @@ -4,6 +4,8 @@ import com.logpm.basicdata.entity.BasicdataFactoryCategoryEntity; import org.springblade.common.constant.ModuleNameConstant; import org.springframework.cloud.openfeign.FeignClient; import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestParam; @FeignClient( @@ -17,4 +19,28 @@ public interface IBasicdataFactoryCategoryClient { @GetMapping(API_PREFIX+"/findEntityByAdvanceDetailIds") BasicdataFactoryCategoryEntity findEntityByAdvanceDetailIds(@RequestParam("current") Integer current, @RequestParam("size") Integer size); + /** + * 查询结算订制品结算品类 + * entity + * @return + */ + @PostMapping(API_PREFIX+"/findEntityByThreeCategory") + BasicdataFactoryCategoryEntity findEntityByThreeCategory(@RequestBody BasicdataFactoryCategoryEntity entity); + + /** + * 查询库存品结算品类 + * @param entity2 + * @return + */ + @PostMapping(API_PREFIX+"/findEntityByMaterielName") + BasicdataFactoryCategoryEntity findEntityByMaterielName(@RequestBody BasicdataFactoryCategoryEntity entity2); + + + /** + * + * @param entity3 + * @return + */ + @PostMapping(API_PREFIX+"/findEntityByCategoryName") + BasicdataFactoryCategoryEntity findEntityByCategoryName(@RequestBody BasicdataFactoryCategoryEntity entity3); } diff --git a/blade-service-api/logpm-distribution-api/src/main/java/com/logpm/distribution/entity/DistributionAddvaluePackageEntity.java b/blade-service-api/logpm-distribution-api/src/main/java/com/logpm/distribution/entity/DistributionAddvaluePackageEntity.java index 91ba6ef5b..8932e3ec5 100644 --- a/blade-service-api/logpm-distribution-api/src/main/java/com/logpm/distribution/entity/DistributionAddvaluePackageEntity.java +++ b/blade-service-api/logpm-distribution-api/src/main/java/com/logpm/distribution/entity/DistributionAddvaluePackageEntity.java @@ -20,6 +20,8 @@ import com.baomidou.mybatisplus.annotation.TableName; import lombok.Data; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; + +import java.math.BigDecimal; import java.util.Date; import com.baomidou.mybatisplus.annotation.IdType; import com.baomidou.mybatisplus.annotation.TableId; @@ -137,4 +139,50 @@ public class DistributionAddvaluePackageEntity extends TenantEntity implements S private String recordType; + /** + * 总数量 + */ + @ApiModelProperty(value = "客户ID") + private Long clientId; + + /** + * 总数量 + */ + @ApiModelProperty(value = "客户名称") + private String clientName; + + /** + * 总数量 + */ + @ApiModelProperty(value = "客户ID") + private Long brandId; + + /** + * 总数量 + */ + @ApiModelProperty(value = "客户名称") + private String brandName; + + /** + * 单价 + */ + @ApiModelProperty(value = "单价") + private BigDecimal unitPrice; + + /** + * 费用 + */ + @ApiModelProperty(value = "费用") + private BigDecimal fee; + + + /** + * 扫描操作人 + */ + @ApiModelProperty(value = "扫描操作人") + private String scanUserName; + + + + } diff --git a/blade-service-api/logpm-distribution-api/src/main/java/com/logpm/distribution/vo/DistributionAddvaluePackageVO.java b/blade-service-api/logpm-distribution-api/src/main/java/com/logpm/distribution/vo/DistributionAddvaluePackageVO.java index ef7d239ff..44488ff7c 100644 --- a/blade-service-api/logpm-distribution-api/src/main/java/com/logpm/distribution/vo/DistributionAddvaluePackageVO.java +++ b/blade-service-api/logpm-distribution-api/src/main/java/com/logpm/distribution/vo/DistributionAddvaluePackageVO.java @@ -83,4 +83,6 @@ public class DistributionAddvaluePackageVO extends DistributionAddvaluePackageEn */ private String sku; + + } diff --git a/blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/feign/BasicdataClientClient.java b/blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/feign/BasicdataClientClient.java index 6e8c83122..3d7cee748 100644 --- a/blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/feign/BasicdataClientClient.java +++ b/blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/feign/BasicdataClientClient.java @@ -136,4 +136,9 @@ public class BasicdataClientClient implements IBasicdataClientClient { return basicdataClientService.list(Wrappers.query().lambda().eq(BasicdataClientEntity::getClientName,consigneeUnit)); } + @Override + public List findEntityByIds(List clientIds) { + return basicdataClientService.listByIds(clientIds); + } + } diff --git a/blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/feign/BasicdataFactoryCategoryEntityClient.java b/blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/feign/BasicdataFactoryCategoryEntityClient.java index 3f11d92b5..ccb1c6e7b 100644 --- a/blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/feign/BasicdataFactoryCategoryEntityClient.java +++ b/blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/feign/BasicdataFactoryCategoryEntityClient.java @@ -1,11 +1,14 @@ package com.logpm.basicdata.feign; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.logpm.basicdata.entity.BasicdataFactoryCategoryEntity; import com.logpm.basicdata.service.IBasicdataFactoryCategoryService; import lombok.AllArgsConstructor; import org.springframework.web.bind.annotation.RestController; import springfox.documentation.annotations.ApiIgnore; +import java.util.concurrent.locks.Condition; + @ApiIgnore() @RestController @AllArgsConstructor @@ -17,4 +20,35 @@ public class BasicdataFactoryCategoryEntityClient implements IBasicdataFactoryCa public BasicdataFactoryCategoryEntity findEntityByAdvanceDetailIds(Integer current, Integer size) { return null; } + + @Override + public BasicdataFactoryCategoryEntity findEntityByThreeCategory(BasicdataFactoryCategoryEntity entity) { + return factoryCategoryService.getOne(Wrappers.query().lambda() + .eq(BasicdataFactoryCategoryEntity::getFirsts,entity.getFirsts()) + .eq(BasicdataFactoryCategoryEntity::getSeconds,entity.getSeconds()) + .eq(BasicdataFactoryCategoryEntity::getThirds,entity.getThirds()) + .eq(BasicdataFactoryCategoryEntity::getMaterielName,entity.getMaterielName()) + .eq(BasicdataFactoryCategoryEntity::getBrandId,entity.getBrandId()) + ); + } + + @Override + public BasicdataFactoryCategoryEntity findEntityByMaterielName(BasicdataFactoryCategoryEntity entity2) { + return factoryCategoryService.getOne(Wrappers.query().lambda() + .isNull(BasicdataFactoryCategoryEntity::getFirsts) + .isNull(BasicdataFactoryCategoryEntity::getSeconds) + .isNull(BasicdataFactoryCategoryEntity::getThirds) + .eq(BasicdataFactoryCategoryEntity::getMaterielName,entity2.getMaterielName()) + ); + } + + @Override + public BasicdataFactoryCategoryEntity findEntityByCategoryName(BasicdataFactoryCategoryEntity entity3) { + return factoryCategoryService.getOne(Wrappers.query().lambda() + .isNull(BasicdataFactoryCategoryEntity::getMaterielName) + .isNull(BasicdataFactoryCategoryEntity::getSeconds) + .isNull(BasicdataFactoryCategoryEntity::getThirds) + .eq(BasicdataFactoryCategoryEntity::getFirsts,entity3.getFirsts()) + ); + } } diff --git a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/controller/DistributionSignforController.java b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/controller/DistributionSignforController.java index 6d53f9498..3ef7ec7d2 100644 --- a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/controller/DistributionSignforController.java +++ b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/controller/DistributionSignforController.java @@ -444,7 +444,7 @@ public class DistributionSignforController extends BladeController { */ @PostMapping("/addvalueInfoList") @ApiOperationSupport(order = 7) - @ApiOperation(value = "逻辑删除", notes = "传入ids") + @ApiOperation(value = "PC查看增值服务列表", notes = "传入ids") public R addvalueInfoList(@RequestBody DistributionAddvalueDTO distributionAddvalueDTO) { R r = distributionSignforService.getAddvalueInfoList(distributionAddvalueDTO); return r; @@ -470,7 +470,12 @@ public class DistributionSignforController extends BladeController { @ApiOperationSupport(order = 7) @ApiOperation(value = "PC查看增值服务列表", notes = "传入ids") public R checkAddValuePackageList(@RequestBody DistributionAppAddvalueDTO distributionAppAddvalueDTO) { - return distributionAddvalueService.savePCAddvalueInfo(distributionAppAddvalueDTO); + try { + return distributionAddvalueService.savePCAddvalueInfo(distributionAppAddvalueDTO); + }catch (Exception e){ + e.printStackTrace(); + return R.fail("operation error"); + } } /** diff --git a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/dto/DistributionAddvaluePackageDTO.java b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/dto/DistributionAddvaluePackageDTO.java index 83065d154..e39d94d35 100644 --- a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/dto/DistributionAddvaluePackageDTO.java +++ b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/dto/DistributionAddvaluePackageDTO.java @@ -35,4 +35,10 @@ public class DistributionAddvaluePackageDTO extends DistributionAddvaluePackageE private Integer maxQuantity; + private String firsts; + + private String second; + + private String thirdProduct; + } diff --git a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionAddvalueMapper.xml b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionAddvalueMapper.xml index 26c0a9282..39794ca04 100644 --- a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionAddvalueMapper.xml +++ b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionAddvalueMapper.xml @@ -25,25 +25,25 @@ - DELETE FROM logpm_distribution_addvalue WHERE ref_id = #{reservationId} and addvalue_id = #{addvalueType} + DELETE FROM logpm_distribution_addvalue WHERE ref_id = #{reservationId} and addvalue_id = #{addvalueType} @@ -57,219 +57,236 @@ 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 70be56e9b..c86f9cee9 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 @@ -31,8 +31,8 @@ - - + + @@ -82,7 +82,8 @@ AND parcel_list_id = #{orderPackageId} - update logpm_dis_stock_list_detail SET stock_package_status = 2 WHERE reservation_id = #{reservationId} AND id=#{orderPackageId} and is_deleted = 0 + update logpm_dis_stock_list_detail SET stock_package_status = 2 WHERE reservation_id = #{reservationId} AND + id=#{orderPackageId} and is_deleted = 0 UPDATE logpm_distribution_reservation_package SET packet_bar_status = 2 ,cancel_status = 1 @@ -105,15 +106,15 @@ @@ -201,50 +202,54 @@ @@ -363,18 +370,19 @@ @@ -461,7 +469,7 @@ left join logpm_distribution_reservation_stocklist ldrs on ldrs.reservation_id = ldr.id and ldrs.is_deleted = 0 where ldr.id = #{reservationId} and ldr.is_deleted = 0 - + - SELECT ldpl.*, ldpl.quantity AS reservationNum @@ -748,12 +761,13 @@ logpm_distribution_signfor AS lds LEFT JOIN logpm_distribution_reservation AS ldr ON lds.reservation_id = ldr.id LEFT JOIN logpm_distribution_reservation_stockarticle AS ldsa ON ldr.id = ldsa.reservation_id - LEFT JOIN logpm_distribution_reservation_package AS ldrp ON ldrp.reservation_id = ldsa.reservation_id and ldrp.stock_article_id = ldsa.stock_article_id + LEFT JOIN logpm_distribution_reservation_package AS ldrp ON ldrp.reservation_id = ldsa.reservation_id and + ldrp.stock_article_id = ldsa.stock_article_id LEFT JOIN logpm_distribution_parcel_list AS ldpl ON ldrp.parce_list_id = ldpl.id - lds.delivery_id = #{deliveryId} and ldrp.packet_bar_status in ('1','3') and ldpl.id is not null + lds.delivery_id = #{deliveryId} and ldrp.packet_bar_status in ('1','3') and ldpl.id is not null - and ldrp.stock_article_id in + and ldrp.stock_article_id in #{id} @@ -820,10 +834,10 @@ ldpl.accept_warehouse_name, ldpl.order_package_delivery_status FROM - logpm_distribution_reservation_package AS ldrp - LEFT JOIN logpm_distribution_parcel_list AS ldpl ON ldpl.order_package_code = ldrp.packet_bar_code - LEFT JOIN logpm_warehouse_tray_goods AS lwtg ON ldpl.id = lwtg.association_id and lwtg.association_type = 3 - LEFT JOIN logpm_warehouse_updown_goods AS lwug ON ldpl.id = lwug.association_id and lwug.association_type = 3 + logpm_distribution_reservation_package AS ldrp + LEFT JOIN logpm_distribution_parcel_list AS ldpl ON ldpl.order_package_code = ldrp.packet_bar_code + LEFT JOIN logpm_warehouse_tray_goods AS lwtg ON ldpl.id = lwtg.association_id and lwtg.association_type = 3 + LEFT JOIN logpm_warehouse_updown_goods AS lwug ON ldpl.id = lwug.association_id and lwug.association_type = 3 and packet_bar_status != 2 @@ -855,391 +869,402 @@ - SELECT - ldpl.* + ldpl.*, + ldsa.mall_id AS mallId FROM - logpm_distribution_reservation_package AS ldrs - INNER JOIN logpm_distribution_parcel_list AS ldpl ON ldrs.parce_list_id = ldpl.id + logpm_distribution_reservation_package AS ldrs + INNER JOIN logpm_distribution_parcel_list AS ldpl ON ldrs.parce_list_id = ldpl.id + LEFT JOIN logpm_distribution_stock_article As ldsa ON ldpl.stock_artocle_id = ldsa.id WHERE - ldrs.packet_bar_status IN ('1','3') and reservation_id = #{reservationId} AND ldpl.conditions = 1 + ldrs.packet_bar_status IN ('1','3') and reservation_id = #{reservationId} AND ldpl.conditions = 1 @@ -1272,28 +1301,27 @@ select ldr.* from logpm_distribution_reservation ldr where ldr.delivery_type=2 - and ldr.reservation_status = #{distrbutionReservation.reservationStatus} + and ldr.reservation_status = #{distrbutionReservation.reservationStatus} and ldr.mall_id in - + #{item} - - - SELECT id, + SELECT id, tenant_id, create_user, create_time, @@ -1435,7 +1463,7 @@ ldsl.source_type AS sourceType, ldrs.stocklist_id AS stockListId, ldrs.reservation_num AS planNum, - -- count(ldss.id ) AS realNum, + -- count(ldss.id ) AS realNum, (SELECT COUNT(ldss.id) FROM logpm_distribution_stock AS ldss WHERE ldss.stock_list_id = ldsl.id ) AS realNum, CASE ldsl.source_type @@ -1534,8 +1562,8 @@ LEFT JOIN logpm_distribution_parcel_list AS ldpl ON ldrp.parce_list_id = ldpl.id WHERE ldrp.reservation_id = #{param.reservationId} - AND ldrp.stock_article_id = #{param.orderId} - AND ldrp.packet_bar_status != '2' + AND ldrp.stock_article_id = #{param.orderId} + AND ldrp.packet_bar_status != '2' AND ldpl.order_package_freeze_status = 10 AND ldpl.warehouse_id = #{warehouseId} @@ -1615,59 +1643,58 @@ WHERE ldsld.reservation_id = #{param.reservationId} AND ldsld.stock_package_status in ('1','3') - and ldsld.stock_package_code like concat('%',#{param.stockPackageCode},'%') + and ldsld.stock_package_code like concat('%',#{param.stockPackageCode},'%') - and ldsl.cargo_number like concat('%',#{param.cargoNumber},'%') + and ldsl.cargo_number like concat('%',#{param.cargoNumber},'%') - and ldsl.order_code like concat('%',#{param.orderCode},'%') + and ldsl.order_code like concat('%',#{param.orderCode},'%') - and ldsl.incoming_batch like concat('%',#{param.incomingBatch},'%') + and ldsl.incoming_batch like concat('%',#{param.incomingBatch},'%') - and ldsl.description_goods like concat('%',#{param.descriptionGoods},'%') + and ldsl.description_goods like concat('%',#{param.descriptionGoods},'%') - and ldsl.market_name like concat('%',#{param.marketName},'%') + and ldsl.market_name like concat('%',#{param.marketName},'%') - and ldsl.brand_name like concat('%',#{param.brandName},'%') + and ldsl.brand_name like concat('%',#{param.brandName},'%') - and ldl.driver_name like concat('%',#{param.driverName},'%') + and ldl.driver_name like concat('%',#{param.driverName},'%') - and ldl.vehicle_name like concat('%',#{param.vehicleName},'%') + and ldl.vehicle_name like concat('%',#{param.vehicleName},'%') - and ldl.scan_time like concat('%',#{param.scanTime},'%') + and ldl.scan_time like concat('%',#{param.scanTime},'%') - and ldl.scan_user like concat('%',#{param.scanUser},'%') + and ldl.scan_user like concat('%',#{param.scanUser},'%') - and ldl.signing_user like concat('%',#{param.signingUser},'%') + and ldl.signing_user like concat('%',#{param.signingUser},'%') - and ldl.signing_time like concat('%',#{param.signingTime},'%') + and ldl.signing_time like concat('%',#{param.signingTime},'%') - and ldsld.stock_status = #{param.stockStatus} + and ldsld.stock_status = #{param.stockStatus} - and ldsld.stock_locking_status = #{param.stockLockingStatus} + and ldsld.stock_locking_status = #{param.stockLockingStatus} - and ldsld.stock_signfo_status = #{param.stockSignfoStatus} + and ldsld.stock_signfo_status = #{param.stockSignfoStatus} - @@ -1765,7 +1794,8 @@ IFNULL(SUM(lds.stock_quantity),0) AS scanNum FROM logpm_distribution_reservation_stockarticle ldrs - LEFT JOIN logpm_distribution_reservation_zero_package ldrzp ON ldrs.reservation_id = ldrzp.reservation_id AND ldrs.stock_article_id = ldrzp.stock_article_id + LEFT JOIN logpm_distribution_reservation_zero_package ldrzp ON ldrs.reservation_id = ldrzp.reservation_id AND + ldrs.stock_article_id = ldrzp.stock_article_id LEFT JOIN logpm_distribution_stock_article ldsa ON ldrzp.stock_article_id = ldsa.id LEFT JOIN logpm_distribution_stock lds ON lds.parcel_list_id = ldrzp.parcel_list_id AND lds.reservation_id = ldrzp.reservation_id @@ -1782,7 +1812,7 @@ logpm_distribution_reservation_package AS ldrs LEFT JOIN logpm_distribution_parcel_list AS ldpl ON ldrs.parce_list_id = ldpl.id - ldrs.packet_bar_status IN ('1','3') AND ldpl.conditions = 1 + ldrs.packet_bar_status IN ('1','3') AND ldpl.conditions = 1 AND ldrs.reservation_id IN #{reservationId} @@ -1895,7 +1925,8 @@ resultType="com.logpm.distribution.entity.DistributionReservationEntity"> SELECT ldr.* from logpm_distribution_delivery_list lddl LEFT JOIN logpm_distribution_signfor lds on lds.delivery_id = lddl.id - LEFT JOIN logpm_distribution_reservation ldr on ldr.id= lds.reservation_id and ldr.is_deleted=0 and reservation_status!=40 + LEFT JOIN logpm_distribution_reservation ldr on ldr.id= lds.reservation_id and ldr.is_deleted=0 and + reservation_status!=40 where lddl.id=#{id} diff --git a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionAddvalueServiceImpl.java b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionAddvalueServiceImpl.java index 15a8bb978..06da8f08e 100644 --- a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionAddvalueServiceImpl.java +++ b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionAddvalueServiceImpl.java @@ -16,12 +16,18 @@ */ package com.logpm.distribution.service.impl; -import cn.hutool.db.Page; -import com.alibaba.druid.sql.visitor.functions.If; +import com.alibaba.fastjson.serializer.BigDecimalCodec; import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.logpm.basicdata.entity.BasicdataClientEntity; +import com.logpm.basicdata.entity.BasicdataFactoryCategoryEntity; +import com.logpm.basicdata.entity.BasicdataPriceEntity; +import com.logpm.basicdata.feign.IBasicdataClientClient; +import com.logpm.basicdata.feign.IBasicdataFactoryCategoryClient; +import com.logpm.basicdata.feign.IBasicdataPriceClient; +import com.logpm.basicdata.vo.BasicdatPriceApiVO; +import com.logpm.basicdata.vo.PriceDispatchAddClientVO; import com.logpm.distribution.bean.Res; import com.logpm.distribution.bean.Resp; -import com.logpm.distribution.dto.DistributionAddvalueDTO; import com.logpm.distribution.dto.DistributionAddvaluePackageDTO; import com.logpm.distribution.dto.DistributionParcelNumberDTO; import com.logpm.distribution.dto.app.DistributionAppAddvalueDTO; @@ -34,25 +40,26 @@ import com.logpm.distribution.vo.DistributionAddvalueVO; import com.logpm.distribution.vo.app.DistributionAppAddvalueVO; import lombok.AllArgsConstructor; import lombok.extern.slf4j.Slf4j; +import org.apache.logging.log4j.util.Strings; import org.springblade.common.constant.loading.LoadingStatusConstant; import org.springblade.core.mp.base.BaseServiceImpl; +import org.springblade.core.secure.utils.AuthUtil; 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 com.baomidou.mybatisplus.core.conditions.Wrapper; import com.baomidou.mybatisplus.core.metadata.IPage; -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import org.springframework.transaction.annotation.Transactional; +import java.math.BigDecimal; +import java.math.BigInteger; import java.util.ArrayList; import java.util.List; import java.util.Map; import java.util.Objects; -import java.util.concurrent.locks.Condition; +import java.util.concurrent.atomic.AtomicReference; import java.util.function.Function; import java.util.stream.Collectors; -import java.util.stream.Stream; /** * 配送增值服务表 服务实现类 @@ -75,6 +82,9 @@ public class DistributionAddvalueServiceImpl extends BaseServiceImpl packageEntityList = distributionAppAddvalueDTO.getPackageEntityList(); List packageDTOList = packageEntityList.stream().filter(p -> Func.isNotEmpty(p.getQuantity()) && p.getQuantity() > 0).collect(Collectors.toList()); - if (Func.isEmpty(packageDTOList)){ - return Resp.scanFail("操作失败","无可用包件信息"); + if (Func.isEmpty(packageDTOList)) { + return Resp.scanFail("操作失败", "无可用包件信息"); } //查询是否重复添加 DistributionAddvalueEntity addvalueEntity = distributionAddvalueMapper.selectOne(Wrappers.query().lambda() @@ -206,17 +219,17 @@ public class DistributionAddvalueServiceImpl extends BaseServiceImpl parcelListEntities = distributionReservationMapper.selectPackageListByReservationId(distributionAppAddvalueDTO.getReservationId()); - if (parcelListEntities.size() == packageEntityList.size()){ + if (parcelListEntities.size() == packageEntityList.size()) { distributionAddvalueDetailEntity.setRecordType(1); } distributionAddvalueDetailService.save(distributionAddvalueDetailEntity); List addvaluePackageEntities = new ArrayList<>(); - packageEntityList.stream().forEach(p->{p.setAddvalueDetailId(distributionAddvalueDetailEntity.getId());p.setQuantity(p.getZeroQuantity());addvaluePackageEntities.add(Func.copy(p,DistributionAddvaluePackageEntity.class));}); - distributionAddvaluePackageService.saveBatch(addvaluePackageEntities); - return Resp.scanSuccess("添加成功","添加成功"); - } + BigDecimal totalFee = new BigDecimal(BigInteger.ZERO); + packageEntityList.stream().forEach(p -> { + p.setAddvalueDetailId(distributionAddvalueDetailEntity.getId()); + p.setQuantity(p.getZeroQuantity()); + p.setScanUserName(AuthUtil.getNickName()); + DistributionAddvaluePackageEntity addvaluePackageEntity = Func.copy(p, DistributionAddvaluePackageEntity.class); + //构建增值服务包件的收入 + BigDecimal unitPrice = new BigDecimal(BigInteger.ZERO); + //查询此包件匹配的计划模板 + //获取结算单价 + List priceDispatchAddClientVOS = basicdataPriceClient.dispatchAddPrice(BasicdatPriceApiVO.builder().clientId(p.getClientId().toString()).brandId(p.getBrandId().toString()).build()); + if (Func.isEmpty(priceDispatchAddClientVOS)) { + //此客户品牌下无单价信息 + unitPrice = new BigDecimal(BigInteger.ZERO); + } + switch (p.getConditions()) { + case 1: + //查询订制品结算品类 + BasicdataFactoryCategoryEntity entity1 = new BasicdataFactoryCategoryEntity(); + entity1.setFirsts(p.getFirsts()); + entity1.setSeconds(p.getSecond()); + entity1.setThirds(p.getThirdProduct()); + entity1.setMaterielName(p.getMaterialName()); + entity1.setBrandId(p.getBrandId()); + BasicdataFactoryCategoryEntity factoryCategoryEntity1 = basicdataFactoryCategoryClient.findEntityByThreeCategory(entity1); + if (Func.isEmpty(factoryCategoryEntity1)){ + unitPrice = new BigDecimal(BigInteger.ZERO); + } + if (!Func.isEmpty(priceDispatchAddClientVOS)&&Func.isNotEmpty(factoryCategoryEntity1)){ + //获取单价 + unitPrice = getUnitPrice(priceDispatchAddClientVOS,factoryCategoryEntity1,distributionAppAddvalueDTO); + } + //判定该包件是否属于该客户 + List parcelListEntityList = distributionReservationMapper.selectPackageListByReservationId(distributionAppAddvalueDTO.getReservationId()); +// boolean packageFlag = parcelListEntities.stream().allMatch(pack -> !Func.equals(pack.getId(), p.getPackageId())); + boolean packageFlag = parcelListEntityList.stream().map(DistributionParcelListEntity::getId).collect(Collectors.toList()).contains(p.getPackageId()); + if (!packageFlag) { + throw new RuntimeException("不属于该客户包件"); + } + break; + case 2: + BasicdataFactoryCategoryEntity entity2 = new BasicdataFactoryCategoryEntity(); + entity2.setMaterielName(p.getMaterialName()); + BasicdataFactoryCategoryEntity factoryCategoryEntity2 = basicdataFactoryCategoryClient.findEntityByMaterielName(entity2); + if (Func.isEmpty(factoryCategoryEntity2)){ + unitPrice = new BigDecimal(BigInteger.ZERO); + } + if (!Func.isEmpty(priceDispatchAddClientVOS)&&Func.isNotEmpty(factoryCategoryEntity2)){ + //获取单价 + unitPrice = getUnitPrice(priceDispatchAddClientVOS,factoryCategoryEntity2,distributionAppAddvalueDTO); + } + List detailEntities = distributionReservationMapper.selectInventoryListByReservation(distributionAppAddvalueDTO.getReservationId()); +// boolean inventoryPackageFlag = detailEntities.stream().allMatch(pack -> !Func.equals(pack.getId(), p.getPackageId())); + boolean inventoryPackageFlag = detailEntities.stream().map(DisStockListDetailEntity::getId).collect(Collectors.toList()).contains(p.getPackageId()); + if (!inventoryPackageFlag) { + throw new RuntimeException("不属于该客户包件"); + } + break; + case 3: + BasicdataFactoryCategoryEntity entity3 = new BasicdataFactoryCategoryEntity(); + entity3.setMaterielName(p.getMaterialName()); + BasicdataFactoryCategoryEntity factoryCategoryEntity3 = basicdataFactoryCategoryClient.findEntityByCategoryName(entity3); + if (Func.isEmpty(factoryCategoryEntity3)){ + unitPrice = new BigDecimal(BigInteger.ZERO); + } + if (!Func.isEmpty(priceDispatchAddClientVOS)&&Func.isNotEmpty(factoryCategoryEntity3)){ + //获取单价 + unitPrice = getUnitPrice(priceDispatchAddClientVOS,factoryCategoryEntity3,distributionAppAddvalueDTO); + } + List distributionParcelNumberDTOS = distributionReservationMapper.selectZeroPackageListByReservationId(distributionAppAddvalueDTO.getReservationId()); +// boolean zeroPackageFlag = distributionParcelNumberDTOS.stream().allMatch(pack -> !Func.equals(pack.getId(), p.getPackageId())); + boolean zeroPackageFlag = distributionParcelNumberDTOS.stream().map(DistributionParcelNumberDTO::getId).collect(Collectors.toList()).contains(p.getPackageId()); + if (!zeroPackageFlag) { + throw new RuntimeException("不属于该客户包件"); + } + break; + } + addvaluePackageEntity.setScanUserName(AuthUtil.getNickName()); + addvaluePackageEntity.setUnitPrice(unitPrice); + //计算收入 + addvaluePackageEntity.setFee(unitPrice.multiply(BigDecimal.valueOf(p.getQuantity()))); + addvaluePackageEntities.add(addvaluePackageEntity); + totalFee.add(addvaluePackageEntity.getFee()); + }); + distributionAddvaluePackageService.saveBatch(addvaluePackageEntities); + //最后进行该增值服务项的费用统计 + distributionAddvalueDetailService.update(Wrappers.update().lambda() + .eq(DistributionAddvalueDetailEntity::getId,distributionAddvalueDetailEntity.getId()) + .set(DistributionAddvalueDetailEntity::getFee,totalFee) + ); + return Resp.scanSuccess("添加成功", "添加成功"); + } @Override @@ -311,6 +412,7 @@ public class DistributionAddvalueServiceImpl extends BaseServiceImpl parcelListEntities = distributionReservationMapper.selectPackageListByReservationId(distributionAppAddvalueDTO.getReservationId()); - if (reservationEntity.getReservationNum() + reservationEntity.getReservationStockListNum() == packageEntityList.size()) { - distributionAddvalueDetailEntity.setRecordType(1); - } distributionAddvalueDetailService.save(distributionAddvalueDetailEntity); +// List parcelListEntities = distributionReservationMapper.selectPackageListByReservationId(distributionAppAddvalueDTO.getReservationId()); +// if (reservationEntity.getReservationNum() + reservationEntity.getReservationStockListNum() == packageEntityList.size()) { +// distributionAddvalueDetailEntity.setRecordType(1); +// } List addvaluePackageEntities = new ArrayList<>(); + //查询客户下此类的增值服务 List packageEntities = distributionAddvalueMapper.selectAddvaluePackageListByAddvalueType(distributionAppAddvalueDTO.getReservationId(), distributionAppAddvalueDTO.getAddvalueType()); Map addvaluePackageEntityMap = packageEntities.stream().collect(Collectors.toMap(DistributionAddvaluePackageEntity::getPackageId, Function.identity(), (k1, k2) -> k2)); packageDTOList.stream().forEach(p -> { if (Func.isEmpty(addvaluePackageEntityMap.get(p.getPackageId()))) { Integer conditions = p.getConditions(); + BigDecimal unitPrice = null; + //获取结算单价 + List priceDispatchAddClientVOS = basicdataPriceClient.dispatchAddPrice(BasicdatPriceApiVO.builder().clientId(p.getClientId().toString()).brandId(p.getBrandId().toString()).build()); + if (Func.isEmpty(priceDispatchAddClientVOS)) { + //此客户品牌下无单价信息 + unitPrice = new BigDecimal(BigInteger.ZERO); + } switch (conditions) { case 1: + //查询订制品结算品类 + BasicdataFactoryCategoryEntity entity1 = new BasicdataFactoryCategoryEntity(); + entity1.setFirsts(p.getFirsts()); + entity1.setSeconds(p.getSecond()); + entity1.setThirds(p.getThirdProduct()); + entity1.setMaterielName(p.getMaterialName()); + entity1.setBrandId(p.getBrandId()); + BasicdataFactoryCategoryEntity factoryCategoryEntity1 = basicdataFactoryCategoryClient.findEntityByThreeCategory(entity1); + if (Func.isEmpty(factoryCategoryEntity1)){ + unitPrice = new BigDecimal(BigInteger.ZERO); + } + if (!Func.isEmpty(priceDispatchAddClientVOS)&&Func.isNotEmpty(factoryCategoryEntity1)){ + //获取单价 + unitPrice = getUnitPrice(priceDispatchAddClientVOS,factoryCategoryEntity1,distributionAppAddvalueDTO); + } //判定该包件是否属于该客户 List parcelListEntities = distributionReservationMapper.selectPackageListByReservationId(distributionAppAddvalueDTO.getReservationId()); // boolean packageFlag = parcelListEntities.stream().allMatch(pack -> !Func.equals(pack.getId(), p.getPackageId())); @@ -396,6 +517,16 @@ public class DistributionAddvalueServiceImpl extends BaseServiceImpl detailEntities = distributionReservationMapper.selectInventoryListByReservation(distributionAppAddvalueDTO.getReservationId()); // boolean inventoryPackageFlag = detailEntities.stream().allMatch(pack -> !Func.equals(pack.getId(), p.getPackageId())); boolean inventoryPackageFlag = detailEntities.stream().map(DisStockListDetailEntity::getId).collect(Collectors.toList()).contains(p.getPackageId()); @@ -404,6 +535,16 @@ public class DistributionAddvalueServiceImpl extends BaseServiceImpl distributionParcelNumberDTOS = distributionReservationMapper.selectZeroPackageListByReservationId(distributionAppAddvalueDTO.getReservationId()); // boolean zeroPackageFlag = distributionParcelNumberDTOS.stream().allMatch(pack -> !Func.equals(pack.getId(), p.getPackageId())); boolean zeroPackageFlag = distributionParcelNumberDTOS.stream().map(DistributionParcelNumberDTO::getId).collect(Collectors.toList()).contains(p.getPackageId()); @@ -415,15 +556,75 @@ public class DistributionAddvalueServiceImpl extends BaseServiceImpl{ + totalFee.add(p.getFee()); + }); + distributionAddvalueDetailEntity.setFee(totalFee); + distributionAddvalueDetailService.updateById(distributionAddvalueDetailEntity); + distributionAddvaluePackageService.saveBatch(addvaluePackageEntities); + return Resp.scanSuccess("添加成功", "添加成功"); + }else { + return Resp.scanFail("添加失败", "添加失败"); + } + + } + + private BigDecimal getUnitPrice(List priceDispatchAddClientVOS, BasicdataFactoryCategoryEntity factoryCategoryEntity, DistributionAppAddvalueDTO distributionAppAddvalueDTO) { + + List collect = priceDispatchAddClientVOS.stream().filter(f -> f.getCategoryId().equals(factoryCategoryEntity.getId())).collect(Collectors.toList()); + BigDecimal unitPrice = null; + if (!collect.isEmpty()){ + if (collect.size() > 1){ + log.info("存在多个相同分类的单价CategoryId:{}",factoryCategoryEntity.getId()); + } + PriceDispatchAddClientVO priceDispatchAddClientVO = collect.get(0); + + switch (distributionAppAddvalueDTO.getAddvalueType()){ + case "1": + //获取上楼费用 + //比对是否超过了楼层 + if (priceDispatchAddClientVO.getDispatchStairsCarryingCharge() >= distributionAppAddvalueDTO.getFloolNum()) { + unitPrice = new BigDecimal(BigInteger.ZERO); + }else { + unitPrice = BigDecimal.valueOf(priceDispatchAddClientVO.getUpstairsDeliveryPrice()); + } + break; + case "2": + //获取超区公里数单价 + unitPrice = new BigDecimal(BigInteger.ZERO); + break; + case "3": + //获取平移单价 + unitPrice = BigDecimal.valueOf(priceDispatchAddClientVO.getRelocationPrice()); + break; + case "4": + //获取搬运单价 + unitPrice = BigDecimal.valueOf(priceDispatchAddClientVO.getHandlingPrice()); + break; + case "5": + //获取搬运单价 + unitPrice = BigDecimal.valueOf(priceDispatchAddClientVO.getSortPrice()); + break; + default: + log.info(">>>>>>>>>>>>>>对应客户未进行单价维护:{}",priceDispatchAddClientVO.getCategoryId()); + unitPrice = new BigDecimal(BigInteger.ZERO); + break; + } + }else { + return BigDecimal.ZERO; + } + return unitPrice; } @Override @@ -678,7 +879,7 @@ public class DistributionAddvalueServiceImpl extends BaseServiceImpl { - distributionAddvaluePackageMapper.deleteAddvaluePackageByDetailId(distributionAppAddvalueDTO.getReservationId(), id,distributionAppAddvalueDTO.getAddvalueDetailId()); + distributionAddvaluePackageMapper.deleteAddvaluePackageByDetailId(distributionAppAddvalueDTO.getReservationId(), id, distributionAppAddvalueDTO.getAddvalueDetailId()); }); } else { log.error("###########该包件不存在增值服务项包件列表中"); @@ -708,15 +909,27 @@ public class DistributionAddvalueServiceImpl extends BaseServiceImpl p.getClientId() != null); + if (flag) { + String str = packageEntityList.stream().filter(p -> p.getClientId() != null).map(DistributionAddvaluePackageDTO::getOrderPackageCode).collect(Collectors.joining(",")); + return R.fail(str + "无客户信息"); + } + List clientIds = packageEntityList.stream().map(DistributionAddvaluePackageDTO::getClientId).distinct().collect(Collectors.toList()); + String string = verifyClient(clientIds, packageEntityList); + if (Strings.isBlank(string)) { + log.info("计算成本失败>>>>>>>>>:{}", string); + } if (increasePackage.size() > 0) { + //统计该项增值服务包件数量 int num = detailEntity.getNum() + increasePackage.size(); detailEntity.setNum(num); @@ -763,11 +976,23 @@ public class DistributionAddvalueServiceImpl extends BaseServiceImpl { + + if (Func.isNotEmpty(packageDTOMap.get(ip))) { //新增包件 DistributionAddvaluePackageDTO distributionAddvaluePackageDTO = packageDTOMap.get(ip); + List priceDispatchAddClientVOS = basicdataPriceClient.dispatchAddPrice(BasicdatPriceApiVO.builder().clientId(distributionAddvaluePackageDTO.getClientId().toString()).brandId(distributionAddvaluePackageDTO.getClientId().toString()).build()); + if (!priceDispatchAddClientVOS.isEmpty()) { + //TODO 结算品类 + } + //查询价格模板 DistributionAddvaluePackageEntity distributionAddvaluePackageEntity = distributionAddvaluePackageMapper.selectOne(Wrappers.query().lambda() .eq(DistributionAddvaluePackageEntity::getReservationId, distributionAddvaluePackageDTO.getReservationId()) .eq(DistributionAddvaluePackageEntity::getPackageId, distributionAddvaluePackageDTO.getPackageId()) @@ -776,17 +1001,17 @@ public class DistributionAddvalueServiceImpl extends BaseServiceImpl 0){ + if (distributionAddvaluePackageDTO.getZeroQuantity() > 0) { DistributionAddvaluePackageEntity zeroAddvaluePackageEntity = Func.copy(distributionAddvaluePackageDTO, DistributionAddvaluePackageEntity.class); distributionAddvaluePackageEntity.setQuantity(distributionAddvaluePackageDTO.getZeroQuantity()); distributionAddvaluePackageService.updateById(zeroAddvaluePackageEntity); - }else { + } else { log.error("###############零担品类录入数量0:{}", distributionAddvaluePackageDTO.getPackageId()); } - }else { + } else { if (distributionAddvaluePackageDTO.getZeroQuantity() > 0) { distributionAddvaluePackageEntity.setQuantity(distributionAddvaluePackageDTO.getZeroQuantity()); distributionAddvaluePackageService.updateById(distributionAddvaluePackageEntity); @@ -795,6 +1020,7 @@ public class DistributionAddvalueServiceImpl extends BaseServiceImpl clientIds, List packageEntityList) { + if (!clientIds.isEmpty()) { + //校验客户信息 + List basicdataClientEntityList = basicdataClientClient.findEntityByIds(clientIds); + if (!basicdataClientEntityList.isEmpty()) { + //校验客户数量是否和统计一致,否则存在异常客户信息 + if (!Objects.equals(clientIds.size(), basicdataClientEntityList.size())) { + String collect = clientIds.stream().filter(f -> !basicdataClientEntityList.stream().map(BasicdataClientEntity::getId).collect(Collectors.toList()).contains(f)).map(String::valueOf).collect(Collectors.joining(",")); + log.error("客户信息异常,客户ID:{}", collect); + String unorderPackageCode = packageEntityList.stream() + .filter(f -> clientIds.stream().filter(m -> !basicdataClientEntityList.stream() + .map(BasicdataClientEntity::getId) + .collect(Collectors.toList()) + .contains(m)) + .collect(Collectors.toList()) + .contains(f.getClientId())) + .map(DistributionAddvaluePackageDTO::getOrderPackageCode) + .collect(Collectors.joining(",")); + return unorderPackageCode + "客户信息异常"; + } + } + } + return null; + } // if (Func.isEmpty(detailEntity)) { @@ -835,7 +1085,7 @@ public class DistributionAddvalueServiceImpl extends BaseServiceImpl lambdaQueryWrapper = new LambdaQueryWrapper<>(); - lambdaQueryWrapper.eq(DistributionStockEntity::getBillLadingId, distrilbutionBillLadingEntity.getId()) - .in(DistributionStockEntity::getParcelListId, orderPackageIds); + lambdaQueryWrapper.eq(DistributionStockEntity::getBillLadingId, distrilbutionBillLadingEntity.getId()); + if (!orderPackageIds.isEmpty()) { + lambdaQueryWrapper.in(DistributionStockEntity::getParcelListId, orderPackageIds); + } + //通过订单id和预约id查询对应包件的备货区信息 List distributionStockEntities = distributionStockMapper.selectList(lambdaQueryWrapper); if (!distributionStockEntities.isEmpty()) { Set stockupAreaStrList = distributionStockEntities.stream().map(DistributionStockEntity::getStockupArea).collect(Collectors.toSet()); - String stockupAreaStr = StringUtils.join(stockupAreaStrList, ","); tempMap.put("备货区", stockupAreaStr); } @@ -6198,6 +6198,8 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl{ WarehouseRetentionScanEntity warehouseRetntionScanEntity = Func.copy(r, WarehouseRetentionScanEntity.class); + warehouseRetntionScanEntity.setRetentionScanUsername(AuthUtil.getNickName()); + warehouseRetntionScanEntity.setRetentionScanUserId(AuthUtil.getUserId()); + warehouseRetntionScanEntity.setRetentionScanTime(new Date()); warehouseRetentionScanEntities.add(warehouseRetntionScanEntity); }); } diff --git a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionSignforServiceImpl.java b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionSignforServiceImpl.java index 5afeff5fa..c09fb6260 100644 --- a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionSignforServiceImpl.java +++ b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionSignforServiceImpl.java @@ -184,6 +184,9 @@ public class DistributionSignforServiceImpl extends BaseServiceImpl 0) { + //存在订单 + List distributionParcelListEntities = distributionReservationMapper.selectPackageListByReservationId(reservationId); + if (Func.isNotEmpty(distributionParcelListEntities)) { + + List packageIds = distributionParcelListEntities.stream() + .filter(p -> p.getOrderPackageLoadingStatus().equals(OrderPackageLoadingStatusConstant.weizhuancghe.getValue()) && !p.getOrderPackageStatus().equals(OrderPackageStatusConstant.yiqianshou.getValue())) + .map(DistributionParcelListEntity::getId) + .collect(Collectors.toList()); + + if (Func.isNotEmpty(packageIds)) { + //对包件进行批量的修改 + //将这些包件恢复到初始状态 + int row = distributionParcelListMapper.updateOrderPackageInceptionStatus(packageIds); + } + //维护这些进行包件对应的订单 + String orderCodes = distributionParcelListEntities.stream() + .filter(p -> p.getOrderPackageLoadingStatus().equals(OrderPackageLoadingStatusConstant.weizhuancghe.getValue()) + && !p.getOrderPackageStatus().equals(OrderPackageStatusConstant.yiqianshou.getValue())) + .map(DistributionParcelListEntity::getOrderCode) + .distinct().collect(Collectors.joining(",")); + log.info(method + "维护订制品订单:{}", orderCodes); + builder.append(orderCodes); + + log.info(">>>>>> updatePackageDeliveryStatus,{}, {}", reservationId, packageIds); + if (!packageIds.isEmpty() && reservationId != null) { + //完成对该客户下此包件任务的取消 + int row = distributionReservationMapper.updatePackageDeliveryStatus(reservationId, packageIds); + + } + List aaa = new ArrayList<>(); + distributionParcelListEntities.forEach(k -> { + if (k.getOrderPackageLoadingStatus().equals(OrderPackageLoadingStatusConstant.yizhuangche.getValue()) + && k.getOrderPackageStatus().equals(OrderPackageStatusConstant.yiqianshou.getValue())) { + String content = "包件在" + warehouse.getName() + "由" + user.getNickName() + "完成复核,配送车次号:" + trainNumber + "预约任务号:" + reservationEntity.getReservationCode(); + JSONObject js = handleLogJSONObject(warehouse, AuthUtil.getUser(), k.getOrderPackageCode(), content, WorkNodeEnums.CLERK_REVIEW.getCode(),trainNumber,new Date()); + aaa.add(js); + } else { + String content = "包件在" + warehouse.getName() + "由" + user.getNickName() + "复核取消计划无操作包件,配送车次号:" + trainNumber + "预约任务号:" + reservationEntity.getReservationCode(); + JSONObject js = handleLogJSONObject(warehouse, AuthUtil.getUser(), k.getOrderPackageCode(), content, WorkNodeEnums.CANCEL_DISTRIBUTION.getCode(),trainNumber,new Date()); + aaa.add(js); + } + }); + if (!aaa.isEmpty()) { + trunklinePackageTrackLogClient.addPackageTrackLog(aaa); + } + + } + List distributionParcelNumberDTOS = distributionReservationMapper.selectZeroPackageListByReservationId(reservationId); + if (Func.isNotEmpty(distributionParcelNumberDTOS)) { + //查询此预约单下未进行装车且签收的零担包件 + List packageIds = distributionParcelNumberDTOS.stream().map(DistributionParcelNumberDTO::getParcelListId).collect(Collectors.toList()); + List loadscanEntityList = distributionLoadscanMapper.selectList(Wrappers.query().lambda() + .eq(DistributionLoadscanEntity::getReservationId, reservationId) + .in(DistributionLoadscanEntity::getPackageId, packageIds) + .ne(DistributionLoadscanEntity::getScanStatus, LoadingStatusConstant.quxiao.getValue()) + ); + if (Func.isNotEmpty(loadscanEntityList)) { + //查看是否存在需要进行回库的零担 + List collect = loadscanEntityList.stream().filter(f -> !packageIds.contains(f.getPackageId())).map(DistributionLoadscanEntity::getPackageId).collect(Collectors.toList()); + if (Func.isNotEmpty(collect)) { + String orderCode = distributionParcelNumberDTOS.stream().filter(f -> collect.contains(f.getParcelListId())).map(DistributionParcelNumberDTO::getOrderCode).collect(Collectors.joining(",")); + log.info(method + "维护零担订单:{}", orderCode); + builder.append(orderCode); + //这些单子就是需要进行状态回退的零担包件 + distributionReservationZeroPackageService.recoverZeroPackage(reservationId, collect); + } + } else { + //计划数量全部回退 + String orderCode = distributionParcelNumberDTOS.stream().map(DistributionParcelNumberDTO::getOrderCode).distinct().collect(Collectors.joining(",")); + log.info(method + "维护零担订单:{}", orderCode); + builder.append(orderCode); + distributionReservationZeroPackageService.recoverZeroPackage(reservationId, packageIds); + } + } + distributionStockArticleService.maintenanceOrderInfo(builder.toString(), warehouse.getId()); + distributionReservationStockarticleService.maintenanceReservationStockArticle(reservationId, warehouse.getId()); + + } + //存在库存品信息 + if (reservationEntity.getReservationStockListNum() > 0) { + //进行库存品的资源释放 + List disStockListDetailEntities = distributionReservationMapper.selectInventoryListByReservation(reservationId); + if (Func.isNotEmpty(disStockListDetailEntities)) { + //未签收并且未装车 + List inventoryList = disStockListDetailEntities.stream().filter(inven -> inven.getStockLockingStatus().equals(InventoryLoadingStatusConstant.weizhuangche.getValue()) && inven.getStockLockingStatus().equals(InventorySigningStatusConstant.weiqianshou.getValue())).collect(Collectors.toList()); + if (Func.isNotEmpty(inventoryList)) { + Map> stockListMap = inventoryList.stream().collect(Collectors.groupingBy(DisStockListDetailEntity::getStockListId)); + stockListMap.forEach((k, v) -> { + //扣减对应批次库存品的冻结数量 + distributionStockListMapper.decreaseStockListQuantityOccupied(k, v.size()); + //维护对应的客户库存品的 + for (DisStockListDetailEntity disStockListDetailEntity : v) { + //取消对应的库存品包件信息 + disStockListDetailEntity.setStockPackageStatus(ReservationPackageStatusConstant.quxiao.getValue()); + disStockListDetailService.updateById(disStockListDetailEntity); + } + }); + } + } + + //维护对应的库存品计划状态 + distributionReservationStocklistService.maintenanceReservationStockList(reservationId); + + } + + } + + + + private JSONObject handleLogJSONObject(BasicdataWarehouseEntity warehouse, BladeUser user, String orderPackageCode, String content, Integer node, String trainNumber, Date warehouseEntryTimeEnd) { JSONObject trunklinePackageTrackLog = new JSONObject(); trunklinePackageTrackLog.put("tenantId", user.getTenantId()); @@ -6734,4 +6852,7 @@ public class DistributionSignforServiceImpl extends BaseServiceImpl printEntityList = distributionPrintService.list(Wrappers.query().lambda().eq(DistributionPrintEntity::getBillLadingId, distrilbutionBillLading.getId())); if (!printEntityList.isEmpty()) { + boolean blobFlag = printEntityList.stream().anyMatch(p -> p.getSite().contains("blob")); + if (blobFlag) { + throw new RuntimeException("图片上传失败!!!"); + } if (distrilbutionBillLading.getMark()) { //要删除 List collect = printEntityList.stream().map(DistributionPrintEntity::getId).collect(Collectors.toList()); @@ -2373,18 +2377,23 @@ public class DistrilbutionBillLadingServiceImpl extends BaseServiceImpl list2 = new ArrayList<>(); distrilbutionBillLadingDTO.getPrintList().forEach(print -> { - DistributionPrintEntity distributionPrintEntity = new DistributionPrintEntity(); - distributionPrintEntity.setBillLadingId(distrilbutionBillLadingDTO.getId()); - distributionPrintEntity.setGenre(Integer.parseInt(print.getState())); - distributionPrintEntity.setSite(print.getUrl()); - distributionPrintEntity.setSiteName(print.getName()); - list2.add(distributionPrintEntity); + if (!print.getUrl().contains("blob")){ + DistributionPrintEntity distributionPrintEntity = new DistributionPrintEntity(); + distributionPrintEntity.setBillLadingId(distrilbutionBillLadingDTO.getId()); + distributionPrintEntity.setGenre(Integer.parseInt(print.getState())); + distributionPrintEntity.setSite(print.getUrl()); + distributionPrintEntity.setSiteName(print.getName()); + list2.add(distributionPrintEntity); + } }); - return distributionPrintService.saveBatch(list2); + if (!list2.isEmpty()){ + flag.set(distributionPrintService.saveBatch(list2)); + } + return flag.get(); } diff --git a/blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/service/IWarehouseRetentionScanService.java b/blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/service/IWarehouseRetentionScanService.java index 4278d6b14..1f81d27bc 100644 --- a/blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/service/IWarehouseRetentionScanService.java +++ b/blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/service/IWarehouseRetentionScanService.java @@ -44,7 +44,7 @@ public interface IWarehouseRetentionScanService extends IService selectWarehouseRetentionRecordPage(IPage page, WarehouseRetentionScanVO warehouseRetentionScanVO); + IPage selectWarehouseRetentionRecordPage(IPage page, WarehouseRetentionScanDTO warehouseRetentionScanVO); /** @@ -55,6 +55,13 @@ public interface IWarehouseRetentionScanService extends IService exportWarehouseRetentionRecord(Wrapper queryWrapper); + /** + * 查询列表导出 + * @param warehouseRetentionScan + * @return + */ + List getExportWarehouseRetentionScanList(WarehouseRetentionScanDTO warehouseRetentionScan); + // R saveRetentionList(WarehouseRetentionRecordDTO warehouseRetentionRecordEntity); }