Browse Source

增值服务项计算收费

master
汤建军 9 months ago
parent
commit
52bb78efd4
  1. 5
      blade-service-api/logpm-basicdata-api/src/main/java/com/logpm/basicdata/entity/BasicdataFactoryCategoryEntity.java
  2. 8
      blade-service-api/logpm-basicdata-api/src/main/java/com/logpm/basicdata/feign/IBasicdataClientClient.java
  3. 26
      blade-service-api/logpm-basicdata-api/src/main/java/com/logpm/basicdata/feign/IBasicdataFactoryCategoryClient.java
  4. 48
      blade-service-api/logpm-distribution-api/src/main/java/com/logpm/distribution/entity/DistributionAddvaluePackageEntity.java
  5. 2
      blade-service-api/logpm-distribution-api/src/main/java/com/logpm/distribution/vo/DistributionAddvaluePackageVO.java
  6. 5
      blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/feign/BasicdataClientClient.java
  7. 34
      blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/feign/BasicdataFactoryCategoryEntityClient.java
  8. 9
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/controller/DistributionSignforController.java
  9. 6
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/dto/DistributionAddvaluePackageDTO.java
  10. 403
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionAddvalueMapper.xml
  11. 929
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionReservationMapper.xml
  12. 378
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionAddvalueServiceImpl.java
  13. 15
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionDeliveryListServiceImpl.java
  14. 123
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionSignforServiceImpl.java
  15. 25
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistrilbutionBillLadingServiceImpl.java
  16. 9
      blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/service/IWarehouseRetentionScanService.java

5
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;
}

8
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<BasicdataClientEntity> getClientByName(String consigneeUnit);
/**
* 查询多个ID客户信息
* @param clientIds
* @return
*/
@GetMapping(API_PREFIX+"/findEntityByIds")
List<BasicdataClientEntity> findEntityByIds(@RequestParam List<Long> clientIds);
}

26
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);
}

48
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;
}

2
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;
}

5
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.<BasicdataClientEntity>query().lambda().eq(BasicdataClientEntity::getClientName,consigneeUnit));
}
@Override
public List<BasicdataClientEntity> findEntityByIds(List<Long> clientIds) {
return basicdataClientService.listByIds(clientIds);
}
}

34
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.<BasicdataFactoryCategoryEntity>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.<BasicdataFactoryCategoryEntity>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.<BasicdataFactoryCategoryEntity>query().lambda()
.isNull(BasicdataFactoryCategoryEntity::getMaterielName)
.isNull(BasicdataFactoryCategoryEntity::getSeconds)
.isNull(BasicdataFactoryCategoryEntity::getThirds)
.eq(BasicdataFactoryCategoryEntity::getFirsts,entity3.getFirsts())
);
}
}

9
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");
}
}
/**

6
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;
}

403
blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionAddvalueMapper.xml

@ -25,25 +25,25 @@
<result column="fee" property="fee"/>
</resultMap>
<select id="addvalueInfo" resultType="com.logpm.distribution.vo.DistributionAddvalueVO">
SELECT DISTINCT
lda.addvalue_id,
group_concat(DISTINCT ldad.fee) AS fee,
group_concat(DISTINCT ldad.num) AS num,
group_concat(DISTINCT ldad.id) AS addvalueDetailId,
group_concat(DISTINCT ldad.flool_num) AS floolNum,
group_concat(DISTINCT ldad.distance) AS distance,
group_concat( ldap.id SEPARATOR ',' ) AS packageListIds
FROM
logpm_distribution_addvalue lda
INNER JOIN logpm_distribution_addvalue_detail ldad ON lda.id = ldad.addvalue_id
INNER JOIN logpm_distribution_addvalue_package ldap ON ldad.id = ldap.addvalue_detail_id
WHERE lda.ref_id = #{reservationId}
GROUP BY
lda.id
SELECT DISTINCT
lda.addvalue_id,
group_concat(DISTINCT ldad.fee) AS fee,
group_concat(DISTINCT ldad.num) AS num,
group_concat(DISTINCT ldad.id) AS addvalueDetailId,
group_concat(DISTINCT ldad.flool_num) AS floolNum,
group_concat(DISTINCT ldad.distance) AS distance,
group_concat( ldap.id SEPARATOR ',' ) AS packageListIds
FROM
logpm_distribution_addvalue lda
INNER JOIN logpm_distribution_addvalue_detail ldad ON lda.id = ldad.addvalue_id
INNER JOIN logpm_distribution_addvalue_package ldap ON ldad.id = ldap.addvalue_detail_id
WHERE lda.ref_id = #{reservationId}
GROUP BY
lda.id
</select>
<delete id="deleteAddvalue">
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}
</delete>
@ -57,219 +57,236 @@
</select>
<select id="selectReservationAddvalue" resultType="com.logpm.distribution.vo.DistributionAddvalueVO">
SELECT
ldad.fee AS fee,
ldad.num AS num,
ldad.flool_num AS floolNum,
ldad.distance AS distance,
lda.addvalue_id AS addvalueId,
ldad.id AS addvalueDetailId,
GROUP_CONCAT(ldap.package_id) AS packageListIds,
ldad.record_type AS isAll
ldad.fee AS fee,
ldad.num AS num,
ldad.flool_num AS floolNum,
ldad.distance AS distance,
lda.addvalue_id AS addvalueId,
ldad.id AS addvalueDetailId,
GROUP_CONCAT(ldap.package_id) AS packageListIds,
ldad.record_type AS isAll
FROM
logpm_distribution_addvalue AS lda
INNER JOIN logpm_distribution_addvalue_detail AS ldad ON lda.id = ldad.addvalue_id
INNER JOIN logpm_distribution_addvalue_package AS ldap ON ldad.id = ldap.addvalue_detail_id
WHERE
lda.ref_id = #{reservationId} and lda.addvalue_id = #{addvalueType}
GROUP BY ldad.fee,ldad.num,ldad.flool_num,ldad.distance,ldad.id
logpm_distribution_addvalue AS lda
INNER JOIN logpm_distribution_addvalue_detail AS ldad ON lda.id = ldad.addvalue_id
INNER JOIN logpm_distribution_addvalue_package AS ldap ON ldad.id = ldap.addvalue_detail_id
WHERE
lda.ref_id = #{reservationId} and lda.addvalue_id = #{addvalueType}
GROUP BY ldad.fee,ldad.num,ldad.flool_num,ldad.distance,ldad.id
</select>
<select id="getAddvalueBySignfor" resultType="com.logpm.distribution.vo.DistributionAddvalueVO">
SELECT DISTINCT
lda.addvalue_id,
group_concat(DISTINCT ldad.fee) AS fee,
group_concat(DISTINCT ldad.num) AS num,
group_concat(DISTINCT ldad.id) AS addvalueDetailId,
group_concat(DISTINCT ldad.flool_num) AS floolNum,
group_concat(DISTINCT ldad.distance) AS distance,
group_concat( ldap.package_id SEPARATOR ',' ) AS packageListIds
FROM
logpm_distribution_signfor AS lds
INNER JOIN logpm_distribution_addvalue lda ON lds.reservation_id = lda.ref_id
INNER JOIN logpm_distribution_addvalue_detail ldad ON lda.id = ldad.addvalue_id
INNER JOIN logpm_distribution_addvalue_package ldap ON ldad.id = ldap.addvalue_detail_id
WHERE lds.id = #{par.signforId} and lda.addvalue_id = #{par.addvalueId}
GROUP BY
lda.id
SELECT DISTINCT
lda.addvalue_id,
group_concat(DISTINCT ldad.fee) AS fee,
group_concat(DISTINCT ldad.num) AS num,
group_concat(DISTINCT ldad.id) AS addvalueDetailId,
group_concat(DISTINCT ldad.flool_num) AS floolNum,
group_concat(DISTINCT ldad.distance) AS distance,
group_concat( ldap.package_id SEPARATOR ',' ) AS packageListIds
FROM
logpm_distribution_signfor AS lds
LEFT JOIN logpm_distribution_addvalue lda ON lds.reservation_id = lda.ref_id
LEFT JOIN logpm_distribution_addvalue_detail ldad ON lda.id = ldad.addvalue_id
LEFT JOIN logpm_distribution_addvalue_package ldap ON ldad.id = ldap.addvalue_detail_id
WHERE lds.id = #{par.signforId} and lda.addvalue_id = #{par.addvalueId}
GROUP BY
lda.id
</select>
<select id="selectAddvaluePackageDetail"
resultType="com.logpm.distribution.vo.DistributionAddvaluePackageVO">
SELECT
ldpl.firsts AS firsts,
ldpl.second AS second,
ldpl.third_product AS third_product,
ldap.order_package_code AS order_package_code,
ldap.order_code AS order_code,
ldpl.quantity AS quantity,
ldap.id AS id,
ldap.stock_article_id AS stockArticleId,
ldap.package_id AS packageId,
lda.ref_id AS reservationId,
ldap.conditions AS conditions,
CASE
WHEN ldap.conditions =1 THEN '订制品'
WHEN ldap.conditions =2 THEN '库存品'
WHEN ldap.conditions =3 THEN '零担'
END AS packageType
SELECT
ldpl.firsts AS firsts,
ldpl.second AS second,
ldpl.third_product AS third_product,
ldap.order_package_code AS order_package_code,
ldap.order_code AS order_code,
ldpl.quantity AS quantity,
ldap.id AS id,
ldap.stock_article_id AS stockArticleId,
ldap.package_id AS packageId,
lda.ref_id AS reservationId,
ldap.conditions AS conditions,
CASE
WHEN ldap.conditions =1 THEN '订制品'
WHEN ldap.conditions =2 THEN '库存品'
WHEN ldap.conditions =3 THEN '零担'
END AS packageType
FROM
logpm_distribution_addvalue AS lda
INNER JOIN logpm_distribution_addvalue_detail AS ldad ON ldad.addvalue_id = lda.id
INNER JOIN logpm_distribution_addvalue_package AS ldap ON ldap.addvalue_detail_id = ldad.id AND ldap.conditions = 1
INNER JOIN logpm_distribution_parcel_list AS ldpl ON ldap.package_id = ldpl.id
logpm_distribution_addvalue AS lda
INNER JOIN logpm_distribution_addvalue_detail AS ldad ON ldad.addvalue_id = lda.id
INNER JOIN logpm_distribution_addvalue_package AS ldap ON ldap.addvalue_detail_id = ldad.id AND ldap.conditions
= 1
INNER JOIN logpm_distribution_parcel_list AS ldpl ON ldap.package_id = ldpl.id
WHERE
lda.addvalue_id = #{addvalueId} AND ldap.package_id = #{packageId} AND lda.ref_id = #{reservationId} AND ref_type = 1
lda.addvalue_id = #{addvalueId} AND ldap.package_id = #{packageId} AND lda.ref_id = #{reservationId} AND
ref_type = 1
</select>
<select id="selectAddvalueZeroPackageDetail"
resultType="com.logpm.distribution.vo.DistributionAddvaluePackageVO">
SELECT
ldpl.firsts AS firsts,
ldpl.second AS second,
ldpl.third_product AS third_product,
ldap.order_package_code AS order_package_code,
ldap.order_code AS order_code,
ldap.quantity AS quantity,
ldrzp.quantity AS maxQuantity,
ldap.id AS id,
ldap.stock_article_id AS stockArticleId,
ldap.package_id AS packageId,
lda.ref_id AS reservationId,
ldap.conditions AS conditions,
CASE
WHEN ldap.conditions =1 THEN '订制品'
WHEN ldap.conditions =2 THEN '库存品'
WHEN ldap.conditions =3 THEN '零担'
END AS packageType
SELECT
ldpl.firsts AS firsts,
ldpl.second AS second,
ldpl.third_product AS third_product,
ldap.order_package_code AS order_package_code,
ldap.order_code AS order_code,
ldap.quantity AS quantity,
ldrzp.quantity AS maxQuantity,
ldap.id AS id,
ldap.stock_article_id AS stockArticleId,
ldap.package_id AS packageId,
lda.ref_id AS reservationId,
ldap.conditions AS conditions,
CASE
WHEN ldap.conditions =1 THEN '订制品'
WHEN ldap.conditions =2 THEN '库存品'
WHEN ldap.conditions =3 THEN '零担'
END AS packageType
FROM
logpm_distribution_addvalue AS lda
INNER JOIN logpm_distribution_addvalue_detail AS ldad ON ldad.addvalue_id = lda.id
INNER JOIN logpm_distribution_addvalue_package AS ldap ON ldap.addvalue_detail_id = ldad.id AND ldap.conditions = 3
INNER JOIN logpm_distribution_parcel_list AS ldpl ON ldap.package_id = ldpl.id
INNER JOIN logpm_distribution_reservation_zero_package AS ldrzp ON ldrzp.parcel_list_id = ldap.package_id AND ldap.reservation_id=ldrzp.reservation_id
logpm_distribution_addvalue AS lda
INNER JOIN logpm_distribution_addvalue_detail AS ldad ON ldad.addvalue_id = lda.id
INNER JOIN logpm_distribution_addvalue_package AS ldap ON ldap.addvalue_detail_id = ldad.id AND ldap.conditions
= 3
INNER JOIN logpm_distribution_parcel_list AS ldpl ON ldap.package_id = ldpl.id
INNER JOIN logpm_distribution_reservation_zero_package AS ldrzp ON ldrzp.parcel_list_id = ldap.package_id AND
ldap.reservation_id=ldrzp.reservation_id
WHERE
lda.addvalue_id = #{addvalueId} AND ldap.package_id = #{packageId} AND lda.ref_id = #{reservationId} AND ref_type = 1
lda.addvalue_id = #{addvalueId} AND ldap.package_id = #{packageId} AND lda.ref_id = #{reservationId} AND
ref_type = 1
</select>
<select id="selectAddvalueInventoryPackageDetail"
resultType="com.logpm.distribution.vo.DistributionAddvaluePackageVO">
SELECT
ldap.stock_article_id AS inventoryId,
ldap.material_name AS materialName,
ldap.order_package_code AS orderPackageCode,
ldap.package_id AS packageId,
ldap.reservation_id AS reservationId,
ldsld.num AS quantity,
ldsl.sku AS sku,
ldsl.cargo_number AS materialNumber,
ldap.conditions AS conditions,
CASE
WHEN ldap.conditions =1 THEN '订制品'
WHEN ldap.conditions =2 THEN '库存品'
WHEN ldap.conditions =3 THEN '零担'
END AS packageType
SELECT
ldap.stock_article_id AS inventoryId,
ldap.material_name AS materialName,
ldap.order_package_code AS orderPackageCode,
ldap.package_id AS packageId,
ldap.reservation_id AS reservationId,
ldsld.num AS quantity,
ldsl.sku AS sku,
ldsl.cargo_number AS materialNumber,
ldap.conditions AS conditions,
CASE
WHEN ldap.conditions =1 THEN '订制品'
WHEN ldap.conditions =2 THEN '库存品'
WHEN ldap.conditions =3 THEN '零担'
END AS packageType
FROM
logpm_distribution_addvalue AS lda
INNER JOIN logpm_distribution_addvalue_detail AS ldad ON ldad.addvalue_id = lda.id
INNER JOIN logpm_distribution_addvalue_package AS ldap ON ldap.addvalue_detail_id = ldad.id AND ldap.conditions = 2
INNER JOIN logpm_dis_stock_list_detail AS ldsld ON ldsld.id = ldap.package_id
INNER JOIN logpm_distribution_stock_list AS ldsl ON ldsld.stock_list_id = ldsl.id
logpm_distribution_addvalue AS lda
INNER JOIN logpm_distribution_addvalue_detail AS ldad ON ldad.addvalue_id = lda.id
INNER JOIN logpm_distribution_addvalue_package AS ldap ON ldap.addvalue_detail_id = ldad.id AND ldap.conditions
= 2
INNER JOIN logpm_dis_stock_list_detail AS ldsld ON ldsld.id = ldap.package_id
INNER JOIN logpm_distribution_stock_list AS ldsl ON ldsld.stock_list_id = ldsl.id
WHERE
lda.addvalue_id = #{addvalueId} AND ldap.package_id = #{packageId} AND lda.ref_id = #{reservationId} AND ref_type = 1
lda.addvalue_id = #{addvalueId} AND ldap.package_id = #{packageId} AND lda.ref_id = #{reservationId} AND
ref_type = 1
</select>
<select id="selectAddvaluePackageVO" resultType="com.logpm.distribution.vo.DistributionAddvaluePackageVO">
SELECT
ldpl.id AS packageId,
ldpl.firsts,
ldpl.second,
ldpl.third_product,
ldpl.order_package_code,
ldpl.order_code,
ldpl.stock_article_id,
ldpl.quantity,
ldrp.reservation_id,
1 AS conditions,
'订制品' AS packageType
ldpl.id AS packageId,
ldpl.firsts,
ldpl.second,
ldpl.third_product,
ldpl.brand_name,
ldpl.order_package_code,
ldpl.order_code,
ldpl.stock_article_id,
ldpl.quantity,
ldrp.reservation_id,
1 AS conditions,
'订制品' AS packageType,
ldsa.mall_id AS clientId,
ldsa.mall_name AS clientName,
ldb.id AS brandId,
ldpl.brand_name AS brandName
FROM
logpm_distribution_reservation_package AS ldrp
INNER JOIN logpm_distribution_parcel_list AS ldpl ON ldrp.parce_list_id = ldpl.id
WHERE
ldrp.reservation_id = #{reservationId} and ldrp.stock_article_id = #{stockArticleId} and ldrp.packet_bar_status in ('1','3')
<if test="obj.orderPackageCode != null and obj.orderPackageCode != ''">
and ldpl.order_package_code =#{obj.orderPackageCode}
</if>
LEFT JOIN logpm_distribution_parcel_list AS ldpl ON ldrp.parce_list_id = ldpl.id
LEFT JOIN logpm_distribution_stock_article AS ldsa ON ldpl.stock_article_id = ldsa.id
LEFT JOIN logpm_basicdata_brand AS ldb ON ldb.brand_name = ldpl.brand_name
WHERE
ldrp.reservation_id = #{reservationId} and ldrp.stock_article_id = #{stockArticleId} and ldrp.packet_bar_status
in ('1','3')
<if test="obj.orderPackageCode != null and obj.orderPackageCode != ''">
and ldpl.order_package_code =#{obj.orderPackageCode}
</if>
</select>
<select id="selectAddvalueZeroPackageVO"
resultType="com.logpm.distribution.vo.DistributionAddvaluePackageVO">
SELECT
ldpl.id AS packageId,
ldpl.firsts,
ldpl.`second`,
ldpl.third_product,
ldpl.order_package_code,
ldpl.order_code,
ldpl.stock_article_id,
ldpl.quantity,
ldrzp.reservation_id,
ldrzp.quantity AS maxQuantity,
3 AS conditions,
'零担' AS packageType
FROM
logpm_distribution_reservation_zero_package AS ldrzp
INNER JOIN logpm_distribution_parcel_list AS ldpl ON ldrzp.parcel_list_id = ldpl.id
SELECT
ldpl.id AS packageId,
ldpl.firsts,
ldpl.`second`,
ldpl.third_product,
ldpl.order_package_code,
ldpl.order_code,
ldpl.stock_article_id,
ldpl.quantity,
ldrzp.reservation_id,
ldrzp.quantity AS maxQuantity,
3 AS conditions,
'零担' AS packageType
FROM
logpm_distribution_reservation_zero_package AS ldrzp
INNER JOIN logpm_distribution_parcel_list AS ldpl ON ldrzp.parcel_list_id = ldpl.id
</select>
<select id="selectAddvalueInventoryPackageVO"
resultType="com.logpm.distribution.vo.DistributionAddvaluePackageVO">
SELECT
ldsld.sku,
ldsld.stock_package_code AS orderPackageCode,
ldsld.reservation_id,
ldsld.stock_list_id,
ldsld.id AS packageId,
ldsld.num AS quantity,
ldsl.description_goods AS materialName,
ldsl.cargo_number AS materialCode,
2 AS conditions,
'库存品' AS packageType
FROM
logpm_dis_stock_list_detail AS ldsld
INNER JOIN logpm_distribution_stock_list AS ldsl ON ldsld.stock_list_id = ldsl.id
WHERE
ldsld.reservation_id = #{reservationId} AND ldsld.stock_package_status in ('1','3') AND ldsld.stock_list_id =#{stockListId}
<if test="obj.orderPackageCode != null and obj.orderPackageCode != ''">
AND ldsld.stock_package_code like concat ('%',#{obj.orderPackageCode},'%')
</if>
SELECT
ldsld.sku,
ldsld.stock_package_code AS orderPackageCode,
ldsld.reservation_id,
ldsld.stock_list_id,
ldsld.id AS packageId,
ldsld.num AS quantity,
ldsl.description_goods AS materialName,
ldsl.cargo_number AS materialCode,
2 AS conditions,
'库存品' AS packageType
FROM
logpm_dis_stock_list_detail AS ldsld
INNER JOIN logpm_distribution_stock_list AS ldsl ON ldsld.stock_list_id = ldsl.id
WHERE
ldsld.reservation_id = #{reservationId} AND ldsld.stock_package_status in ('1','3') AND ldsld.stock_list_id
=#{stockListId}
<if test="obj.orderPackageCode != null and obj.orderPackageCode != ''">
AND ldsld.stock_package_code like concat ('%',#{obj.orderPackageCode},'%')
</if>
</select>
<select id="selectAddvaluePackageListByAddvalueType"
resultType="com.logpm.distribution.entity.DistributionAddvaluePackageEntity">
SELECT
ldap.tenant_id,
ldap.create_user,
ldap.create_time,
ldap.update_user,
ldap.update_time,
ldap.status,
ldap.is_deleted,
ldap.create_dept,
ldap.id,
ldap.reserve1,
ldap.reserve2,
ldap.reserve3,
ldap.reserve4,
ldap.reserve5,
ldap.package_id,
ldap.conditions,
ldap.order_package_code,
ldap.order_code,
ldap.material_name,
ldap.stock_article_id,
ldap.quantity,
ldap.reservation_id,
ldap.addvalue_detail_id,
ldap.record_type
ldap.tenant_id,
ldap.create_user,
ldap.create_time,
ldap.update_user,
ldap.update_time,
ldap.status,
ldap.is_deleted,
ldap.create_dept,
ldap.id,
ldap.reserve1,
ldap.reserve2,
ldap.reserve3,
ldap.reserve4,
ldap.reserve5,
ldap.package_id,
ldap.conditions,
ldap.order_package_code,
ldap.order_code,
ldap.material_name,
ldap.stock_article_id,
ldap.quantity,
ldap.reservation_id,
ldap.addvalue_detail_id,
ldap.record_type
FROM
logpm_distribution_addvalue AS lda
INNER JOIN logpm_distribution_addvalue_detail AS ldad ON lda.id = ldad.addvalue_id
INNER JOIN logpm_distribution_addvalue_package AS ldap ON lda.ref_id = ldap.reservation_id AND ldap.addvalue_detail_id = ldad.id
logpm_distribution_addvalue AS lda
INNER JOIN logpm_distribution_addvalue_detail AS ldad ON lda.id = ldad.addvalue_id
INNER JOIN logpm_distribution_addvalue_package AS ldap ON lda.ref_id = ldap.reservation_id AND
ldap.addvalue_detail_id = ldad.id
WHERE
lda.ref_id = #{reservationId} AND lda.addvalue_id = #{addvalueType} and lda.ref_type = '1'
lda.ref_id = #{reservationId} AND lda.addvalue_id = #{addvalueType} and lda.ref_type = '1'
</select>
</mapper>

929
blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionReservationMapper.xml

File diff suppressed because it is too large Load Diff

378
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<Distributio
private final DistributionAddvalueDetailMapper distributionAddvalueDetailMapper;
private final DistributionAddvaluePackageMapper distributionAddvaluePackageMapper;
private final IDistributionLoadscanService distributionLoadscanService;
private final IBasicdataPriceClient basicdataPriceClient;
private final IBasicdataClientClient basicdataClientClient;
private final IBasicdataFactoryCategoryClient basicdataFactoryCategoryClient;
@Override
@ -125,18 +135,21 @@ public class DistributionAddvalueServiceImpl extends BaseServiceImpl<Distributio
if (Func.isNotEmpty(packageInfo) && packageInfo.size() == 1) {
DistributionParcelListEntity parcelListEntity = packageInfo.get(0);
DistributionAddvaluePackageEntity distributionAddvaluePackageEntiy = Func.copy(parcelListEntity, DistributionAddvaluePackageEntity.class);
assert distributionAddvaluePackageEntiy != null;
distributionAddvaluePackageEntiy.setConditions(1);
assert distributionAddvaluePackageEntiy != null;
distributionAddvaluePackageEntiy.setConditions(1);
distributionAddvaluePackageEntiy.setId(null);
distributionAddvaluePackageEntiy.setQuantity(parcelListEntity.getQuantity());
distributionAddvaluePackageEntiy.setPackageId(parcelListEntity.getId());
distributionAddvaluePackageEntiy.setMaterialName(parcelListEntity.getMaterialName());
distributionAddvaluePackageEntiy.setReservationId(distributionAppAddvalueDTO.getReservationId());
distributionAddvaluePackageEntiy.setStockArticleId(parcelListEntity.getStockArticleId());
distributionAddvaluePackageEntiy.setOrderPackageCode(parcelListEntity.getOrderPackageCode());
distributionAddvaluePackageEntiy.setRecordType("2");
distributionAddvaluePackageEntiy.setRecordType("1");
if (isManual.equals(2)) {
distributionAddvaluePackageEntiy.setRecordType("3");
distributionAddvaluePackageEntiy.setRecordType("1");
}
//查询包件的结算单位
return Res.scanSuccess("扫描成功", "扫描成功", distributionAddvaluePackageEntiy);
} else if (packageInfo.isEmpty()) {
//包件列表不存在,这里查询看库存品是否存在?
@ -145,17 +158,17 @@ public class DistributionAddvalueServiceImpl extends BaseServiceImpl<Distributio
DisStockListDetailEntity disStockListDetailEntity = inventoryInfo.get(0);
DistributionStockListEntity stockListEntity = distributionStockListService.getById(disStockListDetailEntity.getStockListId());
DistributionAddvaluePackageEntity distributionAddvaluePackageEntiy = Func.copy(disStockListDetailEntity, DistributionAddvaluePackageEntity.class);
assert distributionAddvaluePackageEntiy != null;
distributionAddvaluePackageEntiy.setConditions(2);
assert distributionAddvaluePackageEntiy != null;
distributionAddvaluePackageEntiy.setConditions(2);
distributionAddvaluePackageEntiy.setQuantity(disStockListDetailEntity.getNum());
distributionAddvaluePackageEntiy.setPackageId(disStockListDetailEntity.getId());
distributionAddvaluePackageEntiy.setMaterialName(stockListEntity.getDescriptionGoods());
distributionAddvaluePackageEntiy.setReservationId(distributionAppAddvalueDTO.getReservationId());
distributionAddvaluePackageEntiy.setStockArticleId(disStockListDetailEntity.getStockListId());
distributionAddvaluePackageEntiy.setOrderPackageCode(disStockListDetailEntity.getStockPackageCode());
distributionAddvaluePackageEntiy.setRecordType("2");
distributionAddvaluePackageEntiy.setRecordType("1");
if (isManual.equals(2)) {
distributionAddvaluePackageEntiy.setRecordType("3");
distributionAddvaluePackageEntiy.setRecordType("1");
}
return Res.scanSuccess("扫描成功", "扫描成功", distributionAddvaluePackageEntiy);
} else if (inventoryInfo.size() == 0) {
@ -197,8 +210,8 @@ public class DistributionAddvalueServiceImpl extends BaseServiceImpl<Distributio
public R saveAddvalueInfo(DistributionAppAddvalueDTO distributionAppAddvalueDTO) {
List<DistributionAddvaluePackageDTO> packageEntityList = distributionAppAddvalueDTO.getPackageEntityList();
List<DistributionAddvaluePackageDTO> 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.<DistributionAddvalueEntity>query().lambda()
@ -206,17 +219,17 @@ public class DistributionAddvalueServiceImpl extends BaseServiceImpl<Distributio
.eq(DistributionAddvalueEntity::getRefId, distributionAppAddvalueDTO.getReservationId())
.eq(DistributionAddvalueEntity::getRefType, 1));
if (Func.isNotEmpty(addvalueEntity)){
if (Func.isNotEmpty(addvalueEntity)) {
return Resp.scanFail("操作失败", "存在该类型增值服务项,如需更改请编辑");
}
DistributionAddvalueDetailEntity distributionAddvalueDetailEntity = new DistributionAddvalueDetailEntity();
if (Func.isEmpty(distributionAppAddvalueDTO.getNum())) {
return Resp.scanFail("添加失败", "错误的包件数量");
}else {
} else {
distributionAddvalueDetailEntity.setNum(distributionAppAddvalueDTO.getNum());
}
DistributionReservationEntity reservationEntity = distributionReservationMapper.selectById(distributionAppAddvalueDTO.getReservationId());
if (Func.isEmpty(reservationEntity)){
if (Func.isEmpty(reservationEntity)) {
return Resp.scanFail("添加失败", "客户信息错误");
}
// 上楼 超区 平移 搬运 分拣 专车
@ -270,17 +283,105 @@ public class DistributionAddvalueServiceImpl extends BaseServiceImpl<Distributio
distributionAddvalueDetailEntity.setAddvalueId(distributionAddvalueEntity.getId());
distributionAddvalueDetailEntity.setRecordType(2);
List<DistributionParcelListEntity> parcelListEntities = distributionReservationMapper.selectPackageListByReservationId(distributionAppAddvalueDTO.getReservationId());
if (parcelListEntities.size() == packageEntityList.size()){
if (parcelListEntities.size() == packageEntityList.size()) {
distributionAddvalueDetailEntity.setRecordType(1);
}
distributionAddvalueDetailService.save(distributionAddvalueDetailEntity);
List<DistributionAddvaluePackageEntity> 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<PriceDispatchAddClientVO> 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<DistributionParcelListEntity> 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<DisStockListDetailEntity> 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<DistributionParcelNumberDTO> 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.<DistributionAddvalueDetailEntity>update().lambda()
.eq(DistributionAddvalueDetailEntity::getId,distributionAddvalueDetailEntity.getId())
.set(DistributionAddvalueDetailEntity::getFee,totalFee)
);
return Resp.scanSuccess("添加成功", "添加成功");
}
@Override
@ -311,6 +412,7 @@ public class DistributionAddvalueServiceImpl extends BaseServiceImpl<Distributio
return Resp.scanFail("添加失败", "客户信息错误");
}
// 上楼 超区 平移 搬运 分拣 专车
BigDecimal totalFee = new BigDecimal(BigInteger.ZERO);
switch (distributionAppAddvalueDTO.getAddvalueType()) {
case "1":
if (Func.isEmpty(distributionAppAddvalueDTO.getFloolNum())) {
@ -318,6 +420,7 @@ public class DistributionAddvalueServiceImpl extends BaseServiceImpl<Distributio
} else {
distributionAddvalueDetailEntity.setFloolNum(distributionAppAddvalueDTO.getFloolNum());
}
break;
case "2":
if (Func.isEmpty(distributionAppAddvalueDTO.getDistance())) {
@ -325,6 +428,11 @@ public class DistributionAddvalueServiceImpl extends BaseServiceImpl<Distributio
} else {
distributionAddvalueDetailEntity.setDistance(distributionAppAddvalueDTO.getDistance());
}
if (Func.isEmpty(distributionAppAddvalueDTO.getFee())){
return Resp.scanFail("添加失败", "请输入超区费用");
}else {
totalFee.add(distributionAppAddvalueDTO.getFee());
}
break;
case "3":
if (Func.isEmpty(distributionAppAddvalueDTO.getDistance())) {
@ -333,36 +441,26 @@ public class DistributionAddvalueServiceImpl extends BaseServiceImpl<Distributio
distributionAddvalueDetailEntity.setDistance(distributionAppAddvalueDTO.getDistance());
}
break;
// case "4":
// case "5":
// if (Func.isEmpty(distributionAppAddvalueDTO.getNum())) {
// return Resp.scanFail("添加失败", "请输入件数");
// } else {
// distributionAddvalueDetailEntity.setNum(packageEntityList.stream().mapToInt(DistributionAddvaluePackageDTO::getQuantity).sum());
// }
// break;
// case "6":
// if (Func.isEmpty(distributionAppAddvalueDTO.getFee())) {
// return Resp.scanFail("添加失败", "请输入件数");
// } else {
// distributionAddvalueDetailEntity.setFee(distributionAppAddvalueDTO.getFee());
// }
// break;
// default:
// return Resp.scanFail("添加失败", "服务器正忙");
case "6":
if (Func.isEmpty(distributionAppAddvalueDTO.getFee())){
return Resp.scanFail("添加失败", "请输入专车费用");
}else {
totalFee.add(distributionAppAddvalueDTO.getFee());
}
break;
}
int total = packageEntityList.stream().mapToInt(DistributionAddvaluePackageDTO::getQuantity).sum();
if ( total == 0) {
if (total == 0) {
return Resp.scanFail("添加失败", "包件数量错误");
} else {
distributionAddvalueDetailEntity.setNum(packageEntityList.stream().mapToInt(DistributionAddvaluePackageDTO::getQuantity).sum());
}
if (Func.isEmpty(distributionAppAddvalueDTO.getFee())) {
return Resp.scanFail("添加失败", "请输入费用");
} else {
distributionAddvalueDetailEntity.setFee(distributionAppAddvalueDTO.getFee());
}
// if (Func.isEmpty(distributionAppAddvalueDTO.getFee())) {
// return Resp.scanFail("添加失败", "请输入费用");
// } else {
// distributionAddvalueDetailEntity.setFee(distributionAppAddvalueDTO.getFee());
// }
DistributionAddvalueEntity distributionAddvalueEntity = new DistributionAddvalueEntity();
distributionAddvalueEntity.setAddvalueId(distributionAppAddvalueDTO.getAddvalueType());
distributionAddvalueEntity.setCode(reservationEntity.getReservationCode());
@ -374,19 +472,42 @@ public class DistributionAddvalueServiceImpl extends BaseServiceImpl<Distributio
this.save(distributionAddvalueEntity);
distributionAddvalueDetailEntity.setAddvalueId(distributionAddvalueEntity.getId());
distributionAddvalueDetailEntity.setRecordType(2);
// List<DistributionParcelListEntity> parcelListEntities = distributionReservationMapper.selectPackageListByReservationId(distributionAppAddvalueDTO.getReservationId());
if (reservationEntity.getReservationNum() + reservationEntity.getReservationStockListNum() == packageEntityList.size()) {
distributionAddvalueDetailEntity.setRecordType(1);
}
distributionAddvalueDetailService.save(distributionAddvalueDetailEntity);
// List<DistributionParcelListEntity> parcelListEntities = distributionReservationMapper.selectPackageListByReservationId(distributionAppAddvalueDTO.getReservationId());
// if (reservationEntity.getReservationNum() + reservationEntity.getReservationStockListNum() == packageEntityList.size()) {
// distributionAddvalueDetailEntity.setRecordType(1);
// }
List<DistributionAddvaluePackageEntity> addvaluePackageEntities = new ArrayList<>();
//查询客户下此类的增值服务
List<DistributionAddvaluePackageEntity> packageEntities = distributionAddvalueMapper.selectAddvaluePackageListByAddvalueType(distributionAppAddvalueDTO.getReservationId(), distributionAppAddvalueDTO.getAddvalueType());
Map<Long, DistributionAddvaluePackageEntity> 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<PriceDispatchAddClientVO> 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<DistributionParcelListEntity> 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<Distributio
}
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<DisStockListDetailEntity> 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<Distributio
}
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<DistributionParcelNumberDTO> 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<Distributio
p.setAddvalueDetailId(distributionAddvalueDetailEntity.getId());
DistributionAddvaluePackageEntity addvaluePackageEntity = Func.copy(p, DistributionAddvaluePackageEntity.class);
if (Func.isNotEmpty(p.getZeroQuantity())){
assert addvaluePackageEntity != null;
addvaluePackageEntity.setQuantity(p.getZeroQuantity());
if (Func.isNotEmpty(p.getZeroQuantity())) {
assert addvaluePackageEntity != null;
addvaluePackageEntity.setQuantity(p.getZeroQuantity());
}
addvaluePackageEntity.setUnitPrice(unitPrice);
addvaluePackageEntity.setFee(unitPrice.multiply(new BigDecimal(p.getQuantity())));
addvaluePackageEntity.setScanUserName(AuthUtil.getNickName());
addvaluePackageEntities.add(addvaluePackageEntity);
}
});
distributionAddvaluePackageService.saveBatch(addvaluePackageEntities);
return Resp.scanSuccess("添加成功", "添加成功");
if (!addvaluePackageEntities.isEmpty()) {
addvaluePackageEntities.forEach(p ->{
totalFee.add(p.getFee());
});
distributionAddvalueDetailEntity.setFee(totalFee);
distributionAddvalueDetailService.updateById(distributionAddvalueDetailEntity);
distributionAddvaluePackageService.saveBatch(addvaluePackageEntities);
return Resp.scanSuccess("添加成功", "添加成功");
}else {
return Resp.scanFail("添加失败", "添加失败");
}
}
private BigDecimal getUnitPrice(List<PriceDispatchAddClientVO> priceDispatchAddClientVOS, BasicdataFactoryCategoryEntity factoryCategoryEntity, DistributionAppAddvalueDTO distributionAppAddvalueDTO) {
List<PriceDispatchAddClientVO> 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<Distributio
distributionAddvalueMapper.deleteAddvalue(distributionAppAddvalueDTO.getReservationId(), distributionAppAddvalueDTO.getAddvalueType());
}
packageIds.forEach(id -> {
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<Distributio
.map(DistributionAddvaluePackageEntity::getPackageId)
.collect(Collectors.toList()).contains(p))
.collect(Collectors.toList());
if (Func.isNotEmpty(zeroPackageIds)){
if (Func.isNotEmpty(zeroPackageIds)) {
increasePackage.addAll(zeroPackageIds);
}
if (increasePackage.size() == 0) {
//添加包件都已经存在在增值服务列表
return R.fail("包件已存在");
}
//查询客户信息
boolean flag = packageEntityList.stream().anyMatch(p -> 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<Long> 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<Distributio
detailEntity.setFee(distributionAppAddvalueDTO.getFee());
detailEntity.setNum(num);
distributionAddvalueDetailMapper.updateById(detailEntity);
//查询价格模板
//basicdataPriceClient.dispatchAddPrice();
//添加新的包件信息
increasePackage.forEach(ip -> {
if (Func.isNotEmpty(packageDTOMap.get(ip))) {
//新增包件
DistributionAddvaluePackageDTO distributionAddvaluePackageDTO = packageDTOMap.get(ip);
List<PriceDispatchAddClientVO> priceDispatchAddClientVOS = basicdataPriceClient.dispatchAddPrice(BasicdatPriceApiVO.builder().clientId(distributionAddvaluePackageDTO.getClientId().toString()).brandId(distributionAddvaluePackageDTO.getClientId().toString()).build());
if (!priceDispatchAddClientVOS.isEmpty()) {
//TODO 结算品类
}
//查询价格模板
DistributionAddvaluePackageEntity distributionAddvaluePackageEntity = distributionAddvaluePackageMapper.selectOne(Wrappers.<DistributionAddvaluePackageEntity>query().lambda()
.eq(DistributionAddvaluePackageEntity::getReservationId, distributionAddvaluePackageDTO.getReservationId())
.eq(DistributionAddvaluePackageEntity::getPackageId, distributionAddvaluePackageDTO.getPackageId())
@ -776,17 +1001,17 @@ public class DistributionAddvalueServiceImpl extends BaseServiceImpl<Distributio
);
if (distributionAddvaluePackageDTO.getConditions() == 3) {
if (Func.isEmpty(distributionAddvaluePackageEntity)){
if (Func.isEmpty(distributionAddvaluePackageEntity)) {
//新增零担
// DistributionAddvaluePackageEntity zeroAddvaluePackageEntity = new DistributionAddvaluePackageEntity();
if (distributionAddvaluePackageDTO.getZeroQuantity() > 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<Distributio
}
}
} else {
DistributionAddvaluePackageEntity addvaluePackageEntity = new DistributionAddvaluePackageEntity();
addvaluePackageEntity.setAddvalueDetailId(distributionAddvaluePackageDTO.getAddvalueDetailId());
addvaluePackageEntity.setStockArticleId(distributionAddvaluePackageDTO.getStockArticleId());
@ -825,6 +1051,30 @@ public class DistributionAddvalueServiceImpl extends BaseServiceImpl<Distributio
return R.status(true);
}
private String verifyClient(List<Long> clientIds, List<DistributionAddvaluePackageDTO> packageEntityList) {
if (!clientIds.isEmpty()) {
//校验客户信息
List<BasicdataClientEntity> 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<Distributio
// String addvalueType = distributionAppAddvalueDTO.getAddvalueType();
//
// distributionAddvalueDetailMapper.updateById(detailEntity);
//查询出原来的包件信息
//查询出原来的包件信息
// DistributionAddvalueVO addvalueVO = distributionAddvalueMapper.selectReservationAddvalue(distributionAppAddvalueDTO.getReservationId(), addvalueType);
// String packageListIds = addvalueVO.getPackageListIds();
// if (Func.isEmpty(packageListIds)) {

15
blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionDeliveryListServiceImpl.java

@ -5129,15 +5129,15 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl<Distrib
String allocationStr = StringUtils.join(allocationStrList, ",");
tempMap.put("货位", allocationStr);
}
//通过订单id和预约id查询对应包件的备货区信息
LambdaQueryWrapper<DistributionStockEntity> 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<DistributionStockEntity> distributionStockEntities = distributionStockMapper.selectList(lambdaQueryWrapper);
if (!distributionStockEntities.isEmpty()) {
Set<String> 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<Distrib
retentionScanVo.setWarehouseId(myCurrentWarehouse.getId());
retentionScanVo.setWarehouseName(myCurrentWarehouse.getName());
retentionScanVo.setLoadingId(distributionLoadscanEntity.getId());
retentionScanVo.setLoadingId(distributionLoadscanEntity.getId());
retentionScanVo.setLoadingId(distributionLoadscanEntity.getId());
retentionScanVos.add(retentionScanVo);
}
} else {
@ -6265,6 +6267,9 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl<Distrib
if (!retentionScanVos.isEmpty()) {
retentionScanVos.forEach(r->{
WarehouseRetentionScanEntity warehouseRetntionScanEntity = Func.copy(r, WarehouseRetentionScanEntity.class);
warehouseRetntionScanEntity.setRetentionScanUsername(AuthUtil.getNickName());
warehouseRetntionScanEntity.setRetentionScanUserId(AuthUtil.getUserId());
warehouseRetntionScanEntity.setRetentionScanTime(new Date());
warehouseRetentionScanEntities.add(warehouseRetntionScanEntity);
});
}

123
blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionSignforServiceImpl.java

@ -184,6 +184,9 @@ public class DistributionSignforServiceImpl extends BaseServiceImpl<Distribution
private IDistributionReservationPackageService distributionReservationPackageService;
@Autowired
private IDistributionReservationZeroPackageService distributionReservationZeroPackageService;
@Autowired
private IDistributionReservationStocklistService distributionReservationStocklistService;
@Autowired
private IDistributionSignPrintService iDistributionSignPrintService;
@Autowired
@ -680,7 +683,7 @@ public class DistributionSignforServiceImpl extends BaseServiceImpl<Distribution
//还需要对未装车未签收的包件进行状态的回退
boolean flag = this.judgmentSignIsHavePackage(distributionSignfor.getReservationId());
if (!flag) {
distributionAsyncService.releaseSource(distributionSignfor.getReservationId(), myCurrentWarehouse, AuthUtil.getUser(), deliveryListEntity.getTrainNumber());
this.releaseSource(distributionSignfor.getReservationId(), myCurrentWarehouse, AuthUtil.getUser(), deliveryListEntity.getTrainNumber());
}
//查看是否需要进行安装
if (reservationEntity.getIsInstall() == 2) {
@ -6713,6 +6716,121 @@ public class DistributionSignforServiceImpl extends BaseServiceImpl<Distribution
}
public void releaseSource(Long reservationId, BasicdataWarehouseEntity warehouse, BladeUser user, String trainNumber) {
String method = "##########################DistributionAsyncServiceImpl.releaseSource";
DistributionReservationEntity reservationEntity = distributionReservationMapper.selectById(reservationId);
StringBuilder builder = new StringBuilder();
if (reservationEntity.getReservationNum() > 0) {
//存在订单
List<DistributionParcelListEntity> distributionParcelListEntities = distributionReservationMapper.selectPackageListByReservationId(reservationId);
if (Func.isNotEmpty(distributionParcelListEntities)) {
List<Long> 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<JSONObject> 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<DistributionParcelNumberDTO> distributionParcelNumberDTOS = distributionReservationMapper.selectZeroPackageListByReservationId(reservationId);
if (Func.isNotEmpty(distributionParcelNumberDTOS)) {
//查询此预约单下未进行装车且签收的零担包件
List<Long> packageIds = distributionParcelNumberDTOS.stream().map(DistributionParcelNumberDTO::getParcelListId).collect(Collectors.toList());
List<DistributionLoadscanEntity> loadscanEntityList = distributionLoadscanMapper.selectList(Wrappers.<DistributionLoadscanEntity>query().lambda()
.eq(DistributionLoadscanEntity::getReservationId, reservationId)
.in(DistributionLoadscanEntity::getPackageId, packageIds)
.ne(DistributionLoadscanEntity::getScanStatus, LoadingStatusConstant.quxiao.getValue())
);
if (Func.isNotEmpty(loadscanEntityList)) {
//查看是否存在需要进行回库的零担
List<Long> 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<DisStockListDetailEntity> disStockListDetailEntities = distributionReservationMapper.selectInventoryListByReservation(reservationId);
if (Func.isNotEmpty(disStockListDetailEntities)) {
//未签收并且未装车
List<DisStockListDetailEntity> 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<Long, List<DisStockListDetailEntity>> 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<Distribution
return trunklinePackageTrackLog;
}
}

25
blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistrilbutionBillLadingServiceImpl.java

@ -410,6 +410,10 @@ public class DistrilbutionBillLadingServiceImpl extends BaseServiceImpl<Distrilb
//修改图片
List<DistributionPrintEntity> printEntityList = distributionPrintService.list(Wrappers.<DistributionPrintEntity>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<Long> collect = printEntityList.stream().map(DistributionPrintEntity::getId).collect(Collectors.toList());
@ -2373,18 +2377,23 @@ public class DistrilbutionBillLadingServiceImpl extends BaseServiceImpl<Distrilb
// distributionPrintService.deleteLogic(collect);
// }
// }
AtomicBoolean flag = new AtomicBoolean(false);
//新增
List<DistributionPrintEntity> 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();
}

9
blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/service/IWarehouseRetentionScanService.java

@ -44,7 +44,7 @@ public interface IWarehouseRetentionScanService extends IService<WarehouseRetent
* @param warehouseRetentionScanVO
* @return
*/
IPage<WarehouseRetentionScanVO> selectWarehouseRetentionRecordPage(IPage<WarehouseRetentionScanVO> page, WarehouseRetentionScanVO warehouseRetentionScanVO);
IPage<WarehouseRetentionScanVO> selectWarehouseRetentionRecordPage(IPage<WarehouseRetentionScanVO> page, WarehouseRetentionScanDTO warehouseRetentionScanVO);
/**
@ -55,6 +55,13 @@ public interface IWarehouseRetentionScanService extends IService<WarehouseRetent
*/
List<WarehouseRetentionScanExcel> exportWarehouseRetentionRecord(Wrapper<WarehouseRetentionScanEntity> queryWrapper);
/**
* 查询列表导出
* @param warehouseRetentionScan
* @return
*/
List<WarehouseRetentionScanExcel> getExportWarehouseRetentionScanList(WarehouseRetentionScanDTO warehouseRetentionScan);
// R saveRetentionList(WarehouseRetentionRecordDTO warehouseRetentionRecordEntity);
}

Loading…
Cancel
Save