Browse Source

Merge remote-tracking branch 'origin/dev' into dev

training
pref_mail@163.com 2 years ago
parent
commit
27255a3db7
  1. 47
      blade-biz-common/src/main/java/org/springblade/common/constant/reservation/ReservationInventoryStatusConstant.java
  2. 2
      blade-service-api/logpm-distribution-api/src/main/java/com/logpm/distribution/entity/DistributionParcelListEntity.java
  3. 2
      blade-service-api/logpm-distribution-api/src/main/java/com/logpm/distribution/entity/DistributionReservationStocklistEntity.java
  4. 15
      blade-service-api/logpm-distribution-api/src/main/java/com/logpm/distribution/vo/app/DistributionAppDeliveryListVO.java
  5. 6
      blade-service-api/logpm-distribution-api/src/main/java/com/logpm/distribution/vo/app/DistributionAppStockArticleVO.java
  6. 29
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/controller/DistributionStockArticleController.java
  7. 6
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionDeliveryInfoMapper.xml
  8. 10
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionDeliveryListMapper.xml
  9. 2
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionParcelListMapper.java
  10. 4
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionReservationPackageMapper.java
  11. 14
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionReservationPackageMapper.xml
  12. 8
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionReservationStocklistMapper.java
  13. 15
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionReservationStocklistMapper.xml
  14. 228
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionSignforMapper.xml
  15. 3
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/IDistributionReservationPackageService.java
  16. 8
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/IDistributionStockArticleService.java
  17. 13
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionDeliveryListServiceImpl.java
  18. 12
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionReservationPackageServiceImpl.java
  19. 430
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionReservationServiceImpl.java
  20. 19
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionSignforServiceImpl.java
  21. 18
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionStockArticleServiceImpl.java
  22. 1
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/wrapper/DistributionParcelListWrapper.java
  23. 34
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/wrapper/DistributionStockListWrapper.java

47
blade-biz-common/src/main/java/org/springblade/common/constant/reservation/ReservationInventoryStatusConstant.java

@ -0,0 +1,47 @@
package org.springblade.common.constant.reservation;
/**
* 预约单状态枚举
* 对应码表
* resvervation_status
* @author pref
*/
public enum ReservationInventoryStatusConstant {
zhengchang("正常","1"),
quxiao("取消","2"),
zengjia("增加","3");
/**
* 状态
*/
private String name;
/**
*
*/
private String value;
private ReservationInventoryStatusConstant(String name, String value) {
this.name = name;
this.value = value;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getValue() {
return value;
}
public void setValue(String value) {
this.value = value;
}
}

2
blade-service-api/logpm-distribution-api/src/main/java/com/logpm/distribution/entity/DistributionParcelListEntity.java

@ -85,7 +85,7 @@ public class DistributionParcelListEntity extends TenantEntity {
* 包条码 * 包条码
*/ */
@ApiModelProperty(value = "包条码") @ApiModelProperty(value = "包条码")
@TableField("order_package_code") // @TableField("order_package_code")
private String orderPackageCode; private String orderPackageCode;
@ApiModelProperty(value = "货区信息") @ApiModelProperty(value = "货区信息")

2
blade-service-api/logpm-distribution-api/src/main/java/com/logpm/distribution/entity/DistributionReservationStocklistEntity.java

@ -68,7 +68,7 @@ public class DistributionReservationStocklistEntity extends TenantEntity {
* 库存品状态 1-正常2-取消 * 库存品状态 1-正常2-取消
*/ */
@ApiModelProperty(value = "库存品状态 ;1-正常、2-取消") @ApiModelProperty(value = "库存品状态 ;1-正常、2-取消")
private Integer stockListStatus; private String stockListStatus;
/** /**
* 预留1 * 预留1
*/ */

15
blade-service-api/logpm-distribution-api/src/main/java/com/logpm/distribution/vo/app/DistributionAppDeliveryListVO.java

@ -92,6 +92,21 @@ public class DistributionAppDeliveryListVO extends DistributionDeliveryListEntit
*/ */
@ApiModelProperty(value = "是否备货(1-没有,2-备货)") @ApiModelProperty(value = "是否备货(1-没有,2-备货)")
private String isstock; private String isstock;
/**
* 电话
*/
@ApiModelProperty(value = "电话")
private String deliveryPhone;
/**
* 名称
*/
@ApiModelProperty(value = "名称")
private String consignee;
/**
* 地址
*/
@ApiModelProperty(value = "地址")
private String deliveryAddress;

6
blade-service-api/logpm-distribution-api/src/main/java/com/logpm/distribution/vo/app/DistributionAppStockArticleVO.java

@ -40,6 +40,12 @@ public class DistributionAppStockArticleVO extends DistributionStockArticleEntit
*/ */
@ApiModelProperty(value = "扫描数") @ApiModelProperty(value = "扫描数")
private Integer loadingNub; private Integer loadingNub;
/**
* 订单ID
*/
@ApiModelProperty(value = "订单ID")
private Long stockArticleId;
/** /**
* 签收数 * 签收数
*/ */

29
blade-service/logpm-distribution/src/main/java/com/logpm/distribution/controller/DistributionStockArticleController.java

@ -111,6 +111,35 @@ public class DistributionStockArticleController extends BladeController {
IPage<DistributionStockArticleEntity> pages = distributionStockArticleService.page(Condition.getPage(query), queryWrapper); IPage<DistributionStockArticleEntity> pages = distributionStockArticleService.page(Condition.getPage(query), queryWrapper);
return R.data(DistributionStockArticleWrapper.build().pageVO(pages)); return R.data(DistributionStockArticleWrapper.build().pageVO(pages));
} /**
* 配送在库订单 分页
*/
@GetMapping("/selectStockArticleInfoList")
@ApiOperationSupport(order = 2)
@ApiOperation(value = "分页", notes = "传入distributionStockArticle")
public R<IPage<DistributionStockArticleVO>> selectStockArticleInfoList(@ApiIgnore @RequestParam Map<String, Object> distributionStockArticle, Query query) {
Object o = distributionStockArticle.get("orderSelfNumbering");
distributionStockArticle.remove("orderSelfNumbering");
Object o2 = distributionStockArticle.get("startDate");
Object o1 = distributionStockArticle.get("entDate");
Object d = distributionStockArticle.get("id");
distributionStockArticle.remove("id");
distributionStockArticle.remove("startDate");
distributionStockArticle.remove("entDate");
QueryWrapper<DistributionStockArticleEntity> queryWrapper = Condition.getQueryWrapper(distributionStockArticle, DistributionStockArticleEntity.class);
if(Func.isNotEmpty(o)){
queryWrapper.in("order_self_numbering",String.valueOf(o).split(","));
}
if(ObjectUtil.isNotEmpty(d)){
queryWrapper.in("id",String.valueOf(d).split(","));
}
if(ObjectUtil.isNotEmpty(o2)){
queryWrapper.between("warehouse_entry_time",o2,o1);
}
IPage<DistributionStockArticleEntity> pages = distributionStockArticleService.page(Condition.getPage(query), queryWrapper);
IPage<DistributionStockArticleVO> distributionStockArticleVOIPage = distributionStockArticleService.handlePackage(DistributionStockArticleWrapper.build().pageVO(pages));
return R.data(distributionStockArticleVOIPage);
} }

6
blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionDeliveryInfoMapper.xml

@ -91,7 +91,7 @@
logpm_distribution_signfor lds logpm_distribution_signfor lds
JOIN logpm_distribution_reservation ldr ON ldr.id = lds.reservation_id JOIN logpm_distribution_reservation ldr ON ldr.id = lds.reservation_id
<where> <where>
lds.is_deleted = 0 and lds.delivery_id = #{id} lds.is_deleted = 0 and lds.delivery_id = #{id} and ldr.reservation_status != 40
</where> </where>
</select> </select>
<select id="selectDistributionDeliverywrapInfoPage" resultType="com.logpm.distribution.vo.DistributionDeliveryInfoVO"> <select id="selectDistributionDeliverywrapInfoPage" resultType="com.logpm.distribution.vo.DistributionDeliveryInfoVO">
@ -207,6 +207,10 @@
<select id="selectDistributionDeliveryOrderPage" resultType="com.logpm.distribution.vo.DistributionStockArticleVO"> <select id="selectDistributionDeliveryOrderPage" resultType="com.logpm.distribution.vo.DistributionStockArticleVO">
SELECT SELECT
distinct ldsa.order_code orderCode, distinct ldsa.order_code orderCode,
ldsa.consignee_unit,
ldsa.consignee_person,
ldsa.consignee_address,
ldsa.consignee_mobile,
ldsa.description_goods descriptionGoods, ldsa.description_goods descriptionGoods,
( (

10
blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionDeliveryListMapper.xml

@ -628,7 +628,15 @@
join logpm_distribution_reservation ldr on lds.reservation_id =ldr.id join logpm_distribution_reservation ldr on lds.reservation_id =ldr.id
WHERE lds.delivery_id = lddl.id) inventoryNub, WHERE lds.delivery_id = lddl.id) inventoryNub,
(SELECT COALESCE(sum(lds.loaded_number+lds.loadedin_number), 0) FROM logpm_distribution_signfor lds WHERE (SELECT COALESCE(sum(lds.loaded_number+lds.loadedin_number), 0) FROM logpm_distribution_signfor lds WHERE
lddl.id = lds.delivery_id) scannedNumber lddl.id = lds.delivery_id) scannedNumber,
(
select GROUP_CONCAT(ldr.consignee)
from logpm_distribution_reservation ldr
where ldr.id in
(select lds.reservation_id
from logpm_distribution_signfor lds
where lds.delivery_id = lddl.id )
) consignee
FROM FROM
logpm_distribution_delivery_list lddl logpm_distribution_delivery_list lddl
left join logpm_distribution_delivery_self ldds on lddl.id =ldds.delivery_id left join logpm_distribution_delivery_self ldds on lddl.id =ldds.delivery_id

2
blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionParcelListMapper.java

@ -70,7 +70,7 @@ public interface DistributionParcelListMapper extends BaseMapper<DistributionPar
* @param id * @param id
* @return * @return
*/ */
Page<DistributionParcelListEntity> getPageVOList(Page<DistributionParcelListVO> objectPage, Long id); List<DistributionParcelListEntity> getPageVOList( Long id);
List<DistributionParcelListBaseVO> getStockDataBase(@Param("param") DistributionParcelListEntity parcelListEntity); List<DistributionParcelListBaseVO> getStockDataBase(@Param("param") DistributionParcelListEntity parcelListEntity);
} }

4
blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionReservationPackageMapper.java

@ -101,7 +101,7 @@ public interface DistributionReservationPackageMapper extends BaseMapper<Distrib
* @param id1 * @param id1
* @return * @return
*/ */
Page<DistributionParcelListEntity> selectPackageVOList(Page<Object> objectPage,@Param("reservationId") Long id,@Param("stockArticleId") Long id1); List<DistributionParcelListEntity> selectPackageVOList(@Param("reservationId") Long id,@Param("stockArticleId") Long id1);
/** /**
* *
@ -125,4 +125,6 @@ public interface DistributionReservationPackageMapper extends BaseMapper<Distrib
* @return * @return
*/ */
int selectPackageNum(@Param("stockArticleId") Long id); int selectPackageNum(@Param("stockArticleId") Long id);
List<DistributionAppParcelListVO> getPackDetail(@Param("param") DistributionReservationPackageDTO packageDTO);
} }

14
blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionReservationPackageMapper.xml

@ -198,10 +198,9 @@ WHERE
logpm_distribution_reservation_package AS ldrp logpm_distribution_reservation_package AS ldrp
INNER JOIN logpm_distribution_parcel_list AS ldpl ON ldrp.parce_list_id = ldpl.id INNER JOIN logpm_distribution_parcel_list AS ldpl ON ldrp.parce_list_id = ldpl.id
<where> <where>
ldpl.packet_bar_status != 2 ldrp.packet_bar_status != 2
<if test="reservationId != '' and reservationId != null"> <if test="reservationId != '' and reservationId != null">
and ldrp.reservation_id =#{reservationId} and ldrp.reservation_id =#{reservationId}
</if> </if>
<if test="stockArticleId != '' and stockArticleId != null"> <if test="stockArticleId != '' and stockArticleId != null">
and ldrp.stock_article_id =#{stockArticleId} and ldrp.stock_article_id =#{stockArticleId}
@ -232,6 +231,7 @@ WHERE
packet_bar_status packet_bar_status
FROM logpm_distribution_reservation_package FROM logpm_distribution_reservation_package
<where> <where>
packet_bar_status != 2
<if test="reservationId != '' and reservationId != null"> <if test="reservationId != '' and reservationId != null">
and reservation_id =#{reservationId} and reservation_id =#{reservationId}
</if> </if>
@ -249,5 +249,15 @@ WHERE
</if> </if>
</where> </where>
</select> </select>
<select id="getPackDetail" resultType="com.logpm.distribution.vo.app.DistributionAppParcelListVO">
select ldsa.order_code orderCode,ldpl.material_name materialName,ldrp.packet_bar_code packetBarCode,
(select COUNT(*) from logpm_distribution_loadscan ldl where ldl.package_id = ldrp.parce_list_id and ldl.scan_status != 1) scanStatus ,
(select COUNT(*) from logpm_distribution_loadscan ldl where ldl.package_id = ldrp.parce_list_id and ldl.scan_status != 1 and ldl.signfor_state = 2) signforState
from logpm_distribution_reservation_package ldrp
LEFT JOIN logpm_distribution_stock_article ldsa on ldrp.stock_article_id = ldsa.id
LEFT JOIN logpm_distribution_parcel_list ldpl on ldrp.parce_list_id = ldpl.id
where ldrp.packet_bar_status in (1,3) and ldrp.reservation_id = #{param.reservationId} and ldrp.stock_article_id = #{param.stockArticleId}
</select>
</mapper> </mapper>

8
blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionReservationStocklistMapper.java

@ -18,6 +18,7 @@ package com.logpm.distribution.mapper;
import com.logpm.distribution.entity.DistributionParcelListEntity; import com.logpm.distribution.entity.DistributionParcelListEntity;
import com.logpm.distribution.entity.DistributionReservationStocklistEntity; import com.logpm.distribution.entity.DistributionReservationStocklistEntity;
import com.logpm.distribution.entity.DistributionStockListEntity;
import com.logpm.distribution.vo.DistributionReservationStocklistVO; import com.logpm.distribution.vo.DistributionReservationStocklistVO;
import com.logpm.distribution.excel.DistributionReservationStocklistExcel; import com.logpm.distribution.excel.DistributionReservationStocklistExcel;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
@ -71,4 +72,11 @@ public interface DistributionReservationStocklistMapper extends BaseMapper<Distr
* @return * @return
*/ */
List<DistributionParcelListEntity> selectReservationPackageNum(@Param("reservationId")Long id,@Param("stockArticleId") Long stockArticleId); List<DistributionParcelListEntity> selectReservationPackageNum(@Param("reservationId")Long id,@Param("stockArticleId") Long stockArticleId);
/**
* 查询预约下的有效库存品
* @param id
* @return
*/
List<DistributionStockListEntity> selectInventory(@Param("reservationId") Long id);
} }

15
blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionReservationStocklistMapper.xml

@ -102,5 +102,18 @@
</if> </if>
</where> </where>
</select> </select>
<select id="selectInventory" resultType="com.logpm.distribution.entity.DistributionStockListEntity">
SELECT
ldsl.*,
ldrs.reservation_num
FROM
logpm_distribution_reservation_stocklist AS ldrs
INNER JOIN logpm_distribution_stock_list AS ldsl ON ldrs.stocklist_id = ldsl.id
<where>
ldrs.stock_list_status != 2
<if test="reservationId != '' and reservationId != null">
and ldrs.reservation_id = #{reservationId}
</if>
</where>
</select>
</mapper> </mapper>

228
blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionSignforMapper.xml

@ -510,6 +510,8 @@
lds.driver_signing driverSigning, lds.driver_signing driverSigning,
lds.Signing_status SigningStatus, lds.Signing_status SigningStatus,
lds.loaded_number loadingNub, lds.loaded_number loadingNub,
ldr.delivery_phone deliveryPhone,
ldr.delivery_address deliveryAddress,
(SELECT COALESCE(COUNT(*), 0) from logpm_distribution_reservation_stockarticle ldrs WHERE ldrs.reservation_id =ldr.id ) ordNub, (SELECT COALESCE(COUNT(*), 0) from logpm_distribution_reservation_stockarticle ldrs WHERE ldrs.reservation_id =ldr.id ) ordNub,
COALESCE(lds.received_quantity + lds.receivedin_quantity, 0) signNub COALESCE(lds.received_quantity + lds.receivedin_quantity, 0) signNub
FROM FROM
@ -520,11 +522,12 @@
AND lds.delivery_id = #{id} AND lds.delivery_id = #{id}
</select> </select>
<select id="selectord" resultType="com.logpm.distribution.vo.app.DistributionAppStockArticleVO"> <select id="selectord" resultType="com.logpm.distribution.vo.app.DistributionAppStockArticleVO">
SELECT SELECT distinct
distinct
ldsa.order_code orderCode, ldsa.order_code orderCode,
ldrs.reservation_num reservationNum, ldrs.reservation_num reservationNum,
(SELECT COALESCE(COUNT(*), 0) from logpm_distribution_loadscan ldl WHERE ldl.order_id =ldsa.id and ldl.scan_status !=1 and ldl.signfor_state =2) signforNub ldrs.stock_article_id stockArticleId,
(SELECT COALESCE(COUNT(*), 0) from logpm_distribution_loadscan ldl WHERE ldl.order_id =ldsa.id and ldl.scan_status !=1 and ldl.signfor_state =2) signforNub,
(SELECT COALESCE(COUNT(*), 0) from logpm_distribution_loadscan ldl WHERE ldl.order_id =ldsa.id and ldl.scan_status !=1 ) loadingNub
FROM FROM
logpm_distribution_reservation ldr logpm_distribution_reservation ldr
join logpm_distribution_reservation_stockarticle ldrs on ldr.id = ldrs.reservation_id join logpm_distribution_reservation_stockarticle ldrs on ldr.id = ldrs.reservation_id
@ -568,8 +571,8 @@
SELECT SELECT
DISTINCT lddl.id id, DISTINCT lddl.id id,
lddl.train_number trainNumber, lddl.train_number trainNumber,
-- lddl.warehouse_name warehouseName, <!-- lddl.warehouse_name warehouseName,
-- lddl.warehouse_id warehouseId, lddl.warehouse_id warehouseId,-->
lddl.type type, lddl.type type,
lddl.kind kind, lddl.kind kind,
lddl.vehicle_name vehicleName, lddl.vehicle_name vehicleName,
@ -580,19 +583,19 @@
join logpm_distribution_reservation ldr on lds.reservation_id =ldr.id join logpm_distribution_reservation ldr on lds.reservation_id =ldr.id
WHERE lds.delivery_id = lddl.id WHERE lds.delivery_id = lddl.id
) deliveryNumber, ) deliveryNumber,
-- lddl.vehicle_id vehicleId, <!-- lddl.vehicle_id vehicleId,
-- lddl.driver_id driverId, lddl.driver_id driverId, -->
lddl.delivery_status deliveryStatus, lddl.delivery_status deliveryStatus,
lddl.preparation_time preparationTime, lddl.preparation_time preparationTime,
-- lddl.distribution_company distributionCompany, <!-- lddl.distribution_company distributionCompany,
-- lddl.state state, lddl.state state,
-- (SELECT GROUP_CONCAT(DISTINCT ldsu.forklift_name SEPARATOR ',') FROM (SELECT GROUP_CONCAT(DISTINCT ldsu.forklift_name SEPARATOR ',') FROM
-- logpm_distribution_signfor lds logpm_distribution_signfor lds
-- join logpm_distribution_reservation ldr on lds.reservation_id =ldr.id join logpm_distribution_reservation ldr on lds.reservation_id =ldr.id
-- join logpm_distribution_stockup_info ldsi on ldr.id = ldsi.reservation_id join logpm_distribution_stockup_info ldsi on ldr.id = ldsi.reservation_id
-- join logpm_distribution_stockup ldsu on ldsu.id = ldsi.stockup_id join logpm_distribution_stockup ldsu on ldsu.id = ldsi.stockup_id
-- WHERE lds.delivery_id = lddl.id WHERE lds.delivery_id = lddl.id
-- ) forkliftName, ) forkliftName, -->
lddl.create_time createTime, lddl.create_time createTime,
(SELECT COALESCE(COUNT(*), 0) FROM logpm_distribution_signfor lds WHERE lds.delivery_id =lddl.id) customersNumber, (SELECT COALESCE(COUNT(*), 0) FROM logpm_distribution_signfor lds WHERE lds.delivery_id =lddl.id) customersNumber,
lddl.price price, lddl.price price,
@ -608,98 +611,103 @@
lddl.id = lds.delivery_id) scannedNumber, lddl.id = lds.delivery_id) scannedNumber,
(SELECT GROUP_CONCAT(DISTINCT ldsu.loader_name SEPARATOR ',') from logpm_distribution_signfor lds INNER JOIN logpm_distribution_stockup_info AS ldsi ON lds.reservation_id = ldsi.reservation_id (SELECT GROUP_CONCAT(DISTINCT ldsu.loader_name SEPARATOR ',') from logpm_distribution_signfor lds INNER JOIN logpm_distribution_stockup_info AS ldsi ON lds.reservation_id = ldsi.reservation_id
INNER JOIN logpm_distribution_stockup AS ldsu ON ldsu.id = ldsi.stockup_id WHERE lds.delivery_id = lddl.id) loadingTeamName, INNER JOIN logpm_distribution_stockup AS ldsu ON ldsu.id = ldsi.stockup_id WHERE lds.delivery_id = lddl.id) loadingTeamName,
-- (SELECT GROUP_CONCAT( lds.reservation_id SEPARATOR ',') from logpm_distribution_signfor lds WHERE lds.delivery_id = lddl.id) reservationId, <!-- (SELECT GROUP_CONCAT( lds.reservation_id SEPARATOR ',') from logpm_distribution_signfor lds WHERE lds.delivery_id = lddl.id) reservationId, -->
lddl.lead_time leadTime, lddl.lead_time leadTime,
-- lddl.order_id orderId, <!-- lddl.order_id orderId,
-- lddl.fee fee, lddl.fee fee,-->
lddl.loading_time loadingTime, lddl.loading_time loadingTime,
-- lddl.note_number noteNumber, <!-- lddl.note_number noteNumber,
-- lddl.source source, lddl.source source, -->
lddl.task_time taskTime, lddl.task_time taskTime,
-- (SELECT COALESCE (sum(ldr.reservation_stock_list_num) ,0) <!-- (SELECT COALESCE (sum(ldr.reservation_stock_list_num) ,0)
-- FROM FROM
-- logpm_distribution_signfor lds logpm_distribution_signfor lds
-- join logpm_distribution_reservation ldr on lds.reservation_id =ldr.id join logpm_distribution_reservation ldr on lds.reservation_id =ldr.id
-- WHERE lds.delivery_id = lddl.id) inventoryNub, WHERE lds.delivery_id = lddl.id) inventoryNub, -->
(SELECT COALESCE(sum(lds.receivedin_quantity+lds.received_quantity), 0) FROM logpm_distribution_signfor lds WHERE (SELECT COALESCE(sum(lds.receivedin_quantity+lds.received_quantity), 0) FROM logpm_distribution_signfor lds WHERE
lddl.id = lds.delivery_id) signNub, lddl.id = lds.delivery_id) signNub,
( (SELECT COALESCE(count(*), 0) FROM logpm_distribution_loadscan ldl WHERE ( (SELECT COALESCE(count(*), 0) FROM logpm_distribution_loadscan ldl WHERE
lddl.id = ldl.delivery_id and ldl.signfor_state =2) + lddl.id = ldl.delivery_id and ldl.signfor_state =2) +
(SELECT COALESCE(count(*), 0) FROM logpm_distribution_loadscaninvn ldl WHERE (SELECT COALESCE(count(*), 0) FROM logpm_distribution_loadscaninvn ldl WHERE
lddl.id = ldl.delivery_id and ldl.signfor_state =2) ) signNubSr lddl.id = ldl.delivery_id and ldl.signfor_state =2) ) signNubSr,
FROM ( select GROUP_CONCAT(ldr.consignee) from logpm_distribution_reservation ldr
logpm_distribution_delivery_list lddl where ldr.id in (select lds.reservation_id from logpm_distribution_signfor lds where lds.delivery_id = lddl.id )
left join logpm_distribution_delivery_self ldds on lddl.id =ldds.delivery_id ) consignee
<where> FROM
lddl.is_deleted =0 logpm_distribution_delivery_list lddl
<if test="array != null and @org.apache.commons.collections4.CollectionUtils@isNotEmpty(array)"> left join logpm_distribution_delivery_self ldds on lddl.id =ldds.delivery_id
and lddl.id in left join logpm_distribution_reservation ldr on ldr.id = lddl.reservation_id
<foreach collection="array" item="item" open="(" close=")" separator=","> <where>
#{item} lddl.is_deleted =0
</foreach> <if test="array != null and @org.apache.commons.collections4.CollectionUtils@isNotEmpty(array)">
</if> and lddl.id in
<if test="param.createTime_query!=null and param.createTime_query!=''"> <foreach collection="array" item="item" open="(" close=")" separator=",">
and date_format(lddl.create_time,'%y%m%d%') = date_format(#{param.createTime_query},'%y%m%d%') #{item}
</if> </foreach>
<if test="param.taskTime_start!=null and param.taskTime_start!=''"> </if>
and date_format(lddl.task_time,'%y%m%d%') >= date_format(#{param.taskTime_start},'%y%m%d%') and date_format(lddl.task_time,'%y%m%d%') &lt;= date_format(#{param.taskTime_end},'%y%m%d%') <if test="param.createTime_query!=null and param.createTime_query!=''">
</if> and date_format(lddl.create_time,'%y%m%d%') = date_format(#{param.createTime_query},'%y%m%d%')
</if>
<if test="param.taskTime_start!=null and param.taskTime_start!=''">
and date_format(lddl.task_time,'%y%m%d%') >= date_format(#{param.taskTime_start},'%y%m%d%') and date_format(lddl.task_time,'%y%m%d%') &lt;= date_format(#{param.taskTime_end},'%y%m%d%')
</if>
</where> </where>
</select> </select>
<select id="selectAppDeliveryInventoryPage" resultType="com.logpm.distribution.vo.app.DistributionAppStockArticleVO"> <select id="selectAppDeliveryInventoryPage" resultType="com.logpm.distribution.vo.app.DistributionAppStockArticleVO">
SELECT SELECT
distinct ldsl.id id, distinct ldsl.id id,
ldsl.sku sku, ldsl.sku sku,
ldsl.cargo_number cargoNumber, ldsl.cargo_number cargoNumber,
ldsl.description_goods descriptionGoods, ldsl.description_goods descriptionGoods,
ldl.signfor_state signforState, ldl.signfor_state signforState,
ldl.order_package_code coding, ldl.order_package_code coding,
lbm.specification specification, lbm.specification specification,
lbm.logpm_unit logpmUnit lbm.logpm_unit logpmUnit
FROM FROM
logpm_distribution_reservation ldr logpm_distribution_reservation ldr
join logpm_distribution_reservation_stocklist ldrs on ldr.id = ldrs.reservation_id join logpm_distribution_reservation_stocklist ldrs on ldr.id = ldrs.reservation_id
join logpm_distribution_stock_list ldsl on ldsl.id = ldrs.stocklist_id join logpm_distribution_stock_list ldsl on ldsl.id = ldrs.stocklist_id
LEFT JOIN logpm_distribution_loadscaninvn ldl on ldsl.id = ldl.inventory_id LEFT JOIN logpm_distribution_loadscaninvn ldl on ldsl.id = ldl.inventory_id
left join logpm_basicdata_material lbm on ldsl.material_id = lbm.id left join logpm_basicdata_material lbm on ldsl.material_id = lbm.id
<where> <where>
ldr.is_deleted = 0 ldr.is_deleted = 0
AND ldr.id = #{param.reservationId} AND ldr.id = #{param.reservationId}
</where> </where>
</select> </select>
<select id="selectListbyink" resultType="com.logpm.distribution.vo.app.DistributionAppStockArticleVO"> <select id="selectListbyink" resultType="com.logpm.distribution.vo.app.DistributionAppStockArticleVO">
SELECT SELECT
distinct ldsl.id id, distinct ldsl.id id,
ldsl.sku sku, ldsl.sku sku,
ldsl.cargo_number cargoNumber, ldsl.cargo_number cargoNumber,
ldsl.description_goods descriptionGoods, ldsl.description_goods descriptionGoods,
ldl.signfor_state signforState, ldl.signfor_state signforState,
ldl.order_package_code coding, ldl.order_package_code coding,
lbm.specification specification, lbm.specification specification,
lbm.logpm_unit logpmUnit lbm.logpm_unit logpmUnit
FROM FROM
logpm_distribution_signfor lds join logpm_distribution_signfor lds join
logpm_distribution_reservation ldr on lds.reservation_id =ldr.id logpm_distribution_reservation ldr on lds.reservation_id =ldr.id
join logpm_distribution_reservation_stocklist ldrs on ldr.id = ldrs.reservation_id join logpm_distribution_reservation_stocklist ldrs on ldr.id = ldrs.reservation_id
join logpm_distribution_stock_list ldsl on ldsl.id = ldrs.stocklist_id join logpm_distribution_stock_list ldsl on ldsl.id = ldrs.stocklist_id
LEFT JOIN logpm_distribution_loadscaninvn ldl on ldsl.id = ldl.inventory_id LEFT JOIN logpm_distribution_loadscaninvn ldl on ldsl.id = ldl.inventory_id
left join logpm_basicdata_material lbm on ldsl.material_id = lbm.id left join logpm_basicdata_material lbm on ldsl.material_id = lbm.id
where lds.delivery_id = #{id} where lds.delivery_id = #{id}
</select> </select>
<select id="selectorda" resultType="com.logpm.distribution.vo.app.DistributionAppStockArticleVO"> <select id="selectorda" resultType="com.logpm.distribution.vo.app.DistributionAppStockArticleVO">
SELECT distinct SELECT distinct
ldsa.order_code AS orderCode, ldsa.order_code AS orderCode,
ldrs.reservation_num AS reservationNum, ldrs.reservation_num AS reservationNum,
(SELECT COALESCE(COUNT(*), 0) FROM logpm_distribution_loadscan ldl WHERE ldl.order_id = ldsa.id AND ldl.scan_status != 1 AND ldl.signfor_state = 2) AS signforNub, ldrs.stock_article_id stockArticleId,
(SELECT COALESCE(COUNT(*), 0) FROM logpm_distribution_loadscan ldl WHERE ldl.order_id = ldsa.id AND ldl.scan_status != 1 AND ldl.signfor_state = 1) AS loadingNub (SELECT COALESCE(COUNT(*), 0) FROM logpm_distribution_loadscan ldl WHERE ldl.order_id = ldsa.id AND ldl.scan_status != 1 AND ldl.signfor_state = 2) AS signforNub,
FROM (SELECT COALESCE(COUNT(*), 0) FROM logpm_distribution_loadscan ldl WHERE ldl.order_id = ldsa.id AND ldl.scan_status != 1 ) AS loadingNub
logpm_distribution_reservation ldr FROM
JOIN logpm_distribution_reservation_stockarticle ldrs ON ldr.id = ldrs.reservation_id logpm_distribution_reservation ldr
JOIN logpm_distribution_stock_article ldsa ON ldsa.id = ldrs.stock_article_id JOIN logpm_distribution_reservation_stockarticle ldrs ON ldr.id = ldrs.reservation_id
<where> JOIN logpm_distribution_stock_article ldsa ON ldsa.id = ldrs.stock_article_id
ldr.is_deleted = 0 <where>
<!-- <if test="param.state != null and param.state!=''">--> ldr.is_deleted = 0
<!-- <if test="param.state != null and param.state!=''">-->
<!-- and ldsa.state = #{param.state}--> <!-- and ldsa.state = #{param.state}-->
<!-- </if>--> <!-- </if>-->
<if test="param.orderCode != null and param.orderCode!=''"> <if test="param.orderCode != null and param.orderCode!=''">
@ -724,12 +732,13 @@
SELECT distinct SELECT distinct
ldsa.order_code AS orderCode, ldsa.order_code AS orderCode,
ldrs.reservation_num AS reservationNum, ldrs.reservation_num AS reservationNum,
ldrs.stock_article_id stockArticleId,
(SELECT COALESCE(COUNT(*), 0) (SELECT COALESCE(COUNT(*), 0)
FROM logpm_distribution_loadscan ldl FROM logpm_distribution_loadscan ldl
WHERE ldl.order_id = ldsa.id WHERE ldl.order_id = ldsa.id
AND ldl.scan_status != 1 AND ldl.scan_status != 1
AND ldl.signfor_state = 2) AS signforNub, AND ldl.signfor_state = 2) AS signforNub,
(SELECT COALESCE(COUNT(*), 0) FROM logpm_distribution_loadscan ldl WHERE ldl.order_id = ldsa.id AND ldl.scan_status != 1 AND ldl.signfor_state = 1) AS loadingNub (SELECT COALESCE(COUNT(*), 0) FROM logpm_distribution_loadscan ldl WHERE ldl.order_id = ldsa.id AND ldl.scan_status != 1 ) AS loadingNub
FROM FROM
logpm_distribution_reservation ldr logpm_distribution_reservation ldr
JOIN logpm_distribution_reservation_stockarticle ldrs ON ldr.id = ldrs.reservation_id JOIN logpm_distribution_reservation_stockarticle ldrs ON ldr.id = ldrs.reservation_id
@ -755,12 +764,13 @@
SELECT distinct SELECT distinct
ldsa.order_code AS orderCode, ldsa.order_code AS orderCode,
ldrs.reservation_num AS reservationNum, ldrs.reservation_num AS reservationNum,
ldrs.stock_article_id stockArticleId,
(SELECT COALESCE(COUNT(*), 0) (SELECT COALESCE(COUNT(*), 0)
FROM logpm_distribution_loadscan ldl FROM logpm_distribution_loadscan ldl
WHERE ldl.order_id = ldsa.id WHERE ldl.order_id = ldsa.id
AND ldl.scan_status != 1 AND ldl.scan_status != 1
AND ldl.signfor_state = 2) AS signforNub, AND ldl.signfor_state = 2) AS signforNub,
(SELECT COALESCE(COUNT(*), 0) FROM logpm_distribution_loadscan ldl WHERE ldl.order_id = ldsa.id AND ldl.scan_status != 1 AND ldl.signfor_state = 1) AS loadingNub (SELECT COALESCE(COUNT(*), 0) FROM logpm_distribution_loadscan ldl WHERE ldl.order_id = ldsa.id AND ldl.scan_status != 1 ) AS loadingNub
FROM FROM
logpm_distribution_reservation ldr logpm_distribution_reservation ldr
JOIN logpm_distribution_reservation_stockarticle ldrs ON ldr.id = ldrs.reservation_id JOIN logpm_distribution_reservation_stockarticle ldrs ON ldr.id = ldrs.reservation_id

3
blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/IDistributionReservationPackageService.java

@ -17,11 +17,13 @@
package com.logpm.distribution.service; package com.logpm.distribution.service;
import com.baomidou.mybatisplus.core.conditions.Wrapper; import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.logpm.distribution.dto.DistributionReservationPackageDTO;
import com.logpm.distribution.dto.DistributionStockArticleDTO; import com.logpm.distribution.dto.DistributionStockArticleDTO;
import com.logpm.distribution.entity.DistributionReservationPackageEntity; import com.logpm.distribution.entity.DistributionReservationPackageEntity;
import com.logpm.distribution.vo.DistributionReservationPackageVO; import com.logpm.distribution.vo.DistributionReservationPackageVO;
import com.logpm.distribution.excel.DistributionReservationPackageExcel; import com.logpm.distribution.excel.DistributionReservationPackageExcel;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.logpm.distribution.vo.app.DistributionAppParcelListVO;
import org.springblade.core.mp.base.BaseService; import org.springblade.core.mp.base.BaseService;
import java.util.List; import java.util.List;
@ -58,4 +60,5 @@ public interface IDistributionReservationPackageService extends BaseService<Dist
*/ */
String judgmentStatus(DistributionStockArticleDTO distributionStockArticleDTO); String judgmentStatus(DistributionStockArticleDTO distributionStockArticleDTO);
List<DistributionAppParcelListVO> getPackDetail(DistributionReservationPackageDTO packageDTO);
} }

8
blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/IDistributionStockArticleService.java

@ -17,6 +17,7 @@
package com.logpm.distribution.service; package com.logpm.distribution.service;
import com.baomidou.mybatisplus.core.conditions.Wrapper; import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.logpm.distribution.dto.DistributionStockArticleDTO; import com.logpm.distribution.dto.DistributionStockArticleDTO;
import com.logpm.distribution.entity.DistributionStockArticleEntity; import com.logpm.distribution.entity.DistributionStockArticleEntity;
import com.logpm.distribution.vo.DistributionStockArticleVO; import com.logpm.distribution.vo.DistributionStockArticleVO;
@ -105,4 +106,11 @@ public interface IDistributionStockArticleService extends BaseService<Distributi
* @return * @return
*/ */
OrderPackgeCodeDataVO showOrderPackgeCode(Map<String, Object> params) throws Exception; OrderPackgeCodeDataVO showOrderPackgeCode(Map<String, Object> params) throws Exception;
/**
* 处理订单包件信息
* @param pageVO
* @return
*/
IPage<DistributionStockArticleVO> handlePackage( IPage<DistributionStockArticleVO> pageVO);
} }

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

@ -1186,17 +1186,12 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl<Distrib
reservationPackageDTO.setReservationId(reservationVOS.getId()); reservationPackageDTO.setReservationId(reservationVOS.getId());
reservationPackageDTO.setStockArticleId(s.getId()); reservationPackageDTO.setStockArticleId(s.getId());
List<DistributionParcelListEntity> parcelListEntities = distributionReservationPackageMapper.getDeliveryReservationPackage(deliveryListEntity.getId(), s.getId()); List<DistributionParcelListEntity> parcelListEntities = distributionReservationPackageMapper.getDeliveryReservationPackage(deliveryListEntity.getId(), s.getId());
List<DistributionParcelListVO> distributionParcelListVOS = DistributionParcelListWrapper.build().listVO(parcelListEntities);
//查询出订单的所有包件信息 //查询出订单的所有包件信息
List<DistributionParcelListEntity> parcelListEntityList = distributionParcelListService.getBaseMapper().selectList(Wrappers.<DistributionParcelListEntity>query().lambda().eq(DistributionParcelListEntity::getStockArticleId, s.getId())); List<DistributionParcelListEntity> parcelListEntityList = distributionParcelListService.getBaseMapper().selectList(Wrappers.<DistributionParcelListEntity>query().lambda().eq(DistributionParcelListEntity::getStockArticleId, s.getId()));
ArrayList<DistributionParcelListVO> packageList = new ArrayList<>(); List<DistributionParcelListVO> parcelListVOS = DistributionParcelListWrapper.build().listVO(parcelListEntityList);
ArrayList<DistributionParcelListVO> parcelListVOS = new ArrayList<>();
parcelListEntities.forEach(p->{ s.setPackageList(distributionParcelListVOS);
packageList.add(DistributionParcelListWrapper.build().entityVO(p));
});
parcelListEntityList.forEach(a->{
parcelListVOS.add(DistributionParcelListWrapper.build().entityVO(a));
});
s.setPackageList(packageList);
s.setParcelListVOS(parcelListVOS); s.setParcelListVOS(parcelListVOS);
}); });
deliveryListVO.setStockArticleList(stockArticleVOS); deliveryListVO.setStockArticleList(stockArticleVOS);

12
blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionReservationPackageServiceImpl.java

@ -16,12 +16,14 @@
*/ */
package com.logpm.distribution.service.impl; package com.logpm.distribution.service.impl;
import com.logpm.distribution.dto.DistributionReservationPackageDTO;
import com.logpm.distribution.dto.DistributionStockArticleDTO; import com.logpm.distribution.dto.DistributionStockArticleDTO;
import com.logpm.distribution.entity.DistributionReservationPackageEntity; import com.logpm.distribution.entity.DistributionReservationPackageEntity;
import com.logpm.distribution.vo.DistributionReservationPackageVO; import com.logpm.distribution.vo.DistributionReservationPackageVO;
import com.logpm.distribution.excel.DistributionReservationPackageExcel; import com.logpm.distribution.excel.DistributionReservationPackageExcel;
import com.logpm.distribution.mapper.DistributionReservationPackageMapper; import com.logpm.distribution.mapper.DistributionReservationPackageMapper;
import com.logpm.distribution.service.IDistributionReservationPackageService; import com.logpm.distribution.service.IDistributionReservationPackageService;
import com.logpm.distribution.vo.app.DistributionAppParcelListVO;
import org.springblade.common.constant.order.OrderReservationStatusConstant; import org.springblade.common.constant.order.OrderReservationStatusConstant;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.core.conditions.Wrapper; import com.baomidou.mybatisplus.core.conditions.Wrapper;
@ -67,5 +69,15 @@ public class DistributionReservationPackageServiceImpl extends BaseServiceImpl<D
} }
/**
* 查询包件信息
* @param packageDTO
* @return
*/
@Override
public List<DistributionAppParcelListVO> getPackDetail(DistributionReservationPackageDTO packageDTO) {
return baseMapper.getPackDetail(packageDTO);
}
} }

430
blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionReservationServiceImpl.java

@ -30,11 +30,14 @@ import com.logpm.distribution.mapper.*;
import com.logpm.distribution.service.*; import com.logpm.distribution.service.*;
import com.logpm.distribution.vo.*; import com.logpm.distribution.vo.*;
import com.logpm.distribution.wrapper.DistributionParcelListWrapper; import com.logpm.distribution.wrapper.DistributionParcelListWrapper;
import com.logpm.distribution.wrapper.DistributionStockArticleWrapper;
import com.logpm.distribution.wrapper.DistributionStockListWrapper;
import org.springblade.common.constant.DistributionTypeConstant; import org.springblade.common.constant.DistributionTypeConstant;
import org.springblade.common.constant.delivery.DeliveryStatusConstant; import org.springblade.common.constant.delivery.DeliveryStatusConstant;
import org.springblade.common.constant.order.OrderReservationStatusConstant; import org.springblade.common.constant.order.OrderReservationStatusConstant;
import org.springblade.common.constant.orderpackage.OrderPackageFreezeStatusConstant; import org.springblade.common.constant.orderpackage.OrderPackageFreezeStatusConstant;
import org.springblade.common.constant.orderpackage.OrderPackageReservationStatusConstant; import org.springblade.common.constant.orderpackage.OrderPackageReservationStatusConstant;
import org.springblade.common.constant.orderpackage.OrderPackageStatusConstant;
import org.springblade.common.constant.orderpackage.OrderPackageStockupStatusConstant; import org.springblade.common.constant.orderpackage.OrderPackageStockupStatusConstant;
import org.springblade.common.constant.reservation.*; import org.springblade.common.constant.reservation.*;
import org.springblade.common.constant.signing.SignforStatusConstant; import org.springblade.common.constant.signing.SignforStatusConstant;
@ -508,23 +511,23 @@ public class DistributionReservationServiceImpl extends BaseServiceImpl<Distribu
//查询根据预约ID查询这些预约的备货状态 //查询根据预约ID查询这些预约的备货状态
List<DistributionReservationEntity> reservationEntityList = baseMapper.selectList(Wrappers.<DistributionReservationEntity>query().lambda().in(DistributionReservationEntity::getId, ids)); List<DistributionReservationEntity> reservationEntityList = baseMapper.selectList(Wrappers.<DistributionReservationEntity>query().lambda().in(DistributionReservationEntity::getId, ids));
boolean flag = reservationEntityList.stream().anyMatch(s -> s.getStockupStatus().equals(ReservationStockupStatusConstant.weibeihuo.getValue())); boolean flag = reservationEntityList.stream().anyMatch(s -> s.getStockupStatus().equals(ReservationStockupStatusConstant.weibeihuo.getValue()));
if (flag){ if (flag) {
if (Func.isNotEmpty(stockup.getLoaderName())){ if (Func.isNotEmpty(stockup.getLoaderName())) {
distributionStockupEntity.setLoaderName(stockup.getLoaderName()); distributionStockupEntity.setLoaderName(stockup.getLoaderName());
distributionStockupEntity.setLoaderId(stockup.getLoaderId()); distributionStockupEntity.setLoaderId(stockup.getLoaderId());
} }
if (Func.isNotEmpty(stockup.getGoodsAreaName())){ if (Func.isNotEmpty(stockup.getGoodsAreaName())) {
distributionStockupEntity.setStockupArea(stockup.getGoodsAreaName()); distributionStockupEntity.setStockupArea(stockup.getGoodsAreaName());
distributionStockupEntity.setGoodsAreaId(stockup.getGoodsAreaId()); distributionStockupEntity.setGoodsAreaId(stockup.getGoodsAreaId());
} }
if (Func.isNotEmpty(stockup.getGoodsAreaName())){ if (Func.isNotEmpty(stockup.getGoodsAreaName())) {
distributionStockupEntity.setStockupArea(stockup.getGoodsAreaName()); distributionStockupEntity.setStockupArea(stockup.getGoodsAreaName());
distributionStockupEntity.setGoodsAreaId(stockup.getGoodsAreaId()); distributionStockupEntity.setGoodsAreaId(stockup.getGoodsAreaId());
} }
if (Func.isNotEmpty(stockup.getLoadAndUnload())){ if (Func.isNotEmpty(stockup.getLoadAndUnload())) {
distributionStockupEntity.setTeamResponsibility(stockup.getLoadAndUnload()); distributionStockupEntity.setTeamResponsibility(stockup.getLoadAndUnload());
} }
if (Func.isNotEmpty(stockup.getOutboundDate())){ if (Func.isNotEmpty(stockup.getOutboundDate())) {
distributionStockupEntity.setOutboundDate(stockup.getOutboundDate()); distributionStockupEntity.setOutboundDate(stockup.getOutboundDate());
} }
BladeUser user = AuthUtil.getUser(); BladeUser user = AuthUtil.getUser();
@ -535,7 +538,7 @@ public class DistributionReservationServiceImpl extends BaseServiceImpl<Distribu
} }
for (int i = 0; i < ids.size(); i++) { for (int i = 0; i < ids.size(); i++) {
DistributionReservationEntity reservationEntity = this.getById(ids.get(i)); DistributionReservationEntity reservationEntity = this.getById(ids.get(i));
if (Func.equals(reservationEntity.getStockupStatus(),ReservationStockupStatusConstant.weibeihuo.getValue())){ if (Func.equals(reservationEntity.getStockupStatus(), ReservationStockupStatusConstant.weibeihuo.getValue())) {
//如果预约已经备货 //如果预约已经备货
DistributionStockupInfoEntity stockupInfoEntity = new DistributionStockupInfoEntity(); DistributionStockupInfoEntity stockupInfoEntity = new DistributionStockupInfoEntity();
stockupInfoEntity.setReservationId(ids.get(i)); stockupInfoEntity.setReservationId(ids.get(i));
@ -699,24 +702,15 @@ public class DistributionReservationServiceImpl extends BaseServiceImpl<Distribu
List<DistributionStockArticleVO> distrinbutionStockArticleVOS = distributionStockArticleMapper.getStockArticleByReservationId(reservationEntity.getId()); List<DistributionStockArticleVO> distrinbutionStockArticleVOS = distributionStockArticleMapper.getStockArticleByReservationId(reservationEntity.getId());
distrinbutionStockArticleVOS.forEach(s -> { distrinbutionStockArticleVOS.forEach(s -> {
//这里查询两个东西,一个是该订单在预约中所被选取的包件信息,以及该订单下所有的包件列表 //这里查询两个东西,一个是该订单在预约中所被选取的包件信息,以及该订单下所有的包件列表
Page<DistributionParcelListEntity> pageVOList = distributionParcelListMapper.getPageVOList(new Page<>(), s.getId()); List<DistributionParcelListEntity> pageVOList = distributionParcelListMapper.getPageVOList(s.getId());
s.setParcelListVOS(DistributionParcelListWrapper.build().pageVO(pageVOList).getRecords()); s.setParcelListVOS(DistributionParcelListWrapper.build().listVO(pageVOList));
//这里查询出该订单下已经被选取的包件信息 //这里查询出该订单下已经被选取的包件信息
Page<DistributionParcelListEntity> packageVOList = distributionReservationPackageMapper.selectPackageVOList(new Page<>(), reservationEntity.getId(), s.getId()); List<DistributionParcelListEntity> packageVOList = distributionReservationPackageMapper.selectPackageVOList(reservationEntity.getId(), s.getId());
s.setPackageList(DistributionParcelListWrapper.build().pageVO(packageVOList).getRecords()); s.setPackageList(DistributionParcelListWrapper.build().listVO(packageVOList));
}); });
reservationVO.setStockArticleList(distrinbutionStockArticleVOS); reservationVO.setStockArticleList(distrinbutionStockArticleVOS);
if (!Func.isEmpty(reservationStocklistEntityList)) { List<DistributionStockListEntity> stockArticleEntityList = distributionReservationStocklistMapper.selectInventory(reservationEntity.getId());
List<DistributionStockListEntity> stockArticleEntityList = new ArrayList<>(); reservationVO.setInventoryList(DistributionStockListWrapper.build().listVO(stockArticleEntityList));
reservationStocklistEntityList.forEach(a2 -> {
DistributionStockListEntity stockListEntity = distributionStockListService.getById(a2.getStocklistId());
stockListEntity.setReservationNum(a2.getReservationNum());
stockArticleEntityList.add(stockListEntity);
});
List<DistributionStockListVO> stockListVOList = Func.copy(stockArticleEntityList, DistributionStockListVO.class);
//查询出 库存信息
reservationVO.setInventoryList(stockListVOList);
}
return R.data(reservationVO); return R.data(reservationVO);
} }
@ -732,244 +726,182 @@ public class DistributionReservationServiceImpl extends BaseServiceImpl<Distribu
Long id = distributionReservationDTO.getId(); Long id = distributionReservationDTO.getId();
//这里需要查询出这个预约原来的订单、包件信息 //这里需要查询出这个预约原来的订单、包件信息
List<DistributionReservationStockarticleEntity> distributionReservationStockarticleEntities = distributionReservationStockarticleService.getBaseMapper().selectList(Wrappers.<DistributionReservationStockarticleEntity>query().lambda().eq(DistributionReservationStockarticleEntity::getReservationId, id)); List<DistributionReservationStockarticleEntity> distributionReservationStockarticleEntities = distributionReservationStockarticleService.getBaseMapper().selectList(Wrappers.<DistributionReservationStockarticleEntity>query().lambda().eq(DistributionReservationStockarticleEntity::getReservationId, id));
Map<Long, List<DistributionReservationStockarticleEntity>> reservationStockarticleMap = distributionReservationStockarticleEntities.stream().collect(Collectors.groupingBy(DistributionReservationStockarticleEntity::getStockArticleId)); Map<Long, List<DistributionReservationStockarticleEntity>> oldStockArticle = distributionReservationStockarticleEntities.stream().collect(Collectors.groupingBy(DistributionReservationStockarticleEntity::getStockArticleId));
List<DistributionStockArticleDTO> dtoStockArticleList = distributionReservationDTO.getStockArticleList(); List<DistributionStockArticleDTO> dtoStockArticleList = distributionReservationDTO.getStockArticleList();
Map<Long, List<DistributionStockArticleDTO>> newStockArticleMap = dtoStockArticleList.stream().collect(Collectors.groupingBy(DistributionStockArticleDTO::getId)); Map<Long, List<DistributionStockArticleDTO>> newStockArticle = dtoStockArticleList.stream().collect(Collectors.groupingBy(DistributionStockArticleDTO::getId));
newStockArticleMap.forEach((k,v)->{ AtomicInteger packTotal = new AtomicInteger();
if (Func.isNotEmpty(reservationStockarticleMap.get(k))){ AtomicInteger reduceTotal = new AtomicInteger();
List<DistributionStockArticleDTO> distributionStockArticleDTOS = newStockArticleMap.get(k); newStockArticle.forEach((k, v) -> {
DistributionStockArticleDTO distributionStockArticleDTO = distributionStockArticleDTOS.get(0); if (Func.isEmpty(oldStockArticle.get(k))) {
DistributionStockArticleEntity stockArticleEntity = Func.copy(distributionStockArticleDTO, DistributionStockArticleEntity.class); //这里发生了新增订单的操作
//查询出预约订单中间表数据,进行包件数量维护 DistributionStockArticleDTO distributionStockArticleDTO = v.get(0);
DistributionReservationStockarticleEntity reservationStockarticleEntity = distributionReservationStockarticleMapper.selectReservationAndStockArticleId(id,k); List<DistributionParcelListEntity> packageListInfo = distributionStockArticleDTO.getPackageListInfo();
Integer reservationNum = reservationStockarticleEntity.getReservationNum();
List<DistributionParcelListEntity> packageList = distributionStockArticleDTO.getPackageListInfo();
//这里将包件数据和原来预约的包件数据进行比对
//查询出这个预约的这个订单下的包包件预约情况
// Page<DistributionParcelListEntity> packageVOList = distributionReservationPackageMapper.selectPackageVOList(new Page<>(), id, k);
List<DistributionReservationPackageEntity> parcelListEntities = distributionReservationPackageMapper.selectPackageByReservationAndStockArticleId( id, k);
//查询出原计划的包件选取情况
Map<Long, List<DistributionReservationPackageEntity>> oldPackageListMap = parcelListEntities.stream().collect(Collectors.groupingBy(DistributionReservationPackageEntity::getParceListId));
Map<Long, List<DistributionParcelListEntity>> newPackageListMap = packageList.stream().collect(Collectors.groupingBy(DistributionParcelListEntity::getId));
//表示原来的这个订单在预约单下已经存在
//包件数量累加
AtomicInteger packageNum = new AtomicInteger(); AtomicInteger packageNum = new AtomicInteger();
newPackageListMap.forEach((p,i)->{ packageListInfo.forEach(p -> {
if (Func.isNotEmpty(oldPackageListMap.get(p))){ DistributionReservationPackageEntity reservationPackageEntity = new DistributionReservationPackageEntity();
//原计划中不存在这个包件信息,这里需要将这条包件信息进行添加 reservationPackageEntity.setStockArticleId(distributionStockArticleDTO.getId());
oldPackageListMap.remove(p); reservationPackageEntity.setPacketBarStatus(ReservationPackageStatusConstant.xinzeng.getValue());
}else { reservationPackageEntity.setPacketBarCode(p.getOrderPackageCode());
//从记录中获取不到这个包件信息,这里就需要将这个包件信息和这个预约信息进行关系的绑定 reservationPackageEntity.setParceListId(p.getId());
DistributionParcelListEntity distributionParcelListEntity = i.get(0); reservationPackageEntity.setReservationId(id);
DistributionReservationPackageEntity distributionReservationPackageEntity = new DistributionReservationPackageEntity(); distributionReservationPackageService.save(reservationPackageEntity);
distributionReservationPackageEntity.setReservationId(id); packageNum.getAndAdd(p.getQuantity());
distributionReservationPackageEntity.setStockArticleId(k); DistributionParcelListEntity parcelListEntity = distributionParcelListService.getById(p.getId());
distributionReservationPackageEntity.setPacketBarStatus(ReservationPackageStatusConstant.zhengchang.getValue()); parcelListEntity.setOrderPackageReservationStatus(OrderPackageReservationStatusConstant.yiyueyue.getValue());
distributionReservationPackageEntity.setParceListId(p); distributionParcelListService.updateById(parcelListEntity);
distributionReservationPackageService.save(distributionReservationPackageEntity); });
DistributionReservationStockarticleEntity reservationStockarticleEntity = new DistributionReservationStockarticleEntity();
reservationStockarticleEntity.setStockArticleStatus(ReservationOrderStatusConstant.zengjia.getValue());
reservationStockarticleEntity.setStockArticleCode(distributionStockArticleDTO.getStockArticleCode());
reservationStockarticleEntity.setStockArticleId(distributionStockArticleDTO.getId());
reservationStockarticleEntity.setReservationId(id);
reservationStockarticleEntity.setReservationNum(packageNum.get());
distributionReservationStockarticleService.save(reservationStockarticleEntity);
packTotal.getAndAdd(reservationStockarticleEntity.getReservationNum());
String status = distributionReservationPackageService.judgmentStatus(distributionStockArticleDTO);
DistributionStockArticleEntity stockArticleEntity = distributionStockArticleService.getById(distributionStockArticleDTO.getId());
stockArticleEntity.setReservationStatus(status);
distributionStockArticleService.updateById(stockArticleEntity);
} else {
//查询出这个订单原来在这个预约中的勾选情况
DistributionStockArticleDTO distributionStockArticleDTO = v.get(0);
List<DistributionReservationPackageEntity> packageEntityList = distributionReservationPackageMapper.selectPackageByReservationAndStockArticleId(id, k);
Map<Long, List<DistributionReservationPackageEntity>> oldPackage = packageEntityList.stream().collect(Collectors.groupingBy(DistributionReservationPackageEntity::getParceListId));
Map<Long, List<DistributionParcelListEntity>> newPackage = distributionStockArticleDTO.getPackageListInfo().stream().collect(Collectors.groupingBy(DistributionParcelListEntity::getId));
AtomicInteger packageNum = new AtomicInteger();
AtomicInteger reduceNum = new AtomicInteger();
newPackage.forEach((m, n) -> {
if (Func.isEmpty(oldPackage.get(m))) {
DistributionParcelListEntity distributionParcelListEntity = n.get(0);
//新增
DistributionReservationPackageEntity reservationPackageEntity = new DistributionReservationPackageEntity();
reservationPackageEntity.setStockArticleId(distributionStockArticleDTO.getId());
reservationPackageEntity.setPacketBarStatus(ReservationPackageStatusConstant.xinzeng.getValue());
reservationPackageEntity.setPacketBarCode(distributionParcelListEntity.getOrderPackageCode());
reservationPackageEntity.setParceListId(distributionParcelListEntity.getId());
reservationPackageEntity.setReservationId(id);
distributionReservationPackageService.save(reservationPackageEntity);
packageNum.getAndAdd(distributionParcelListEntity.getQuantity()); packageNum.getAndAdd(distributionParcelListEntity.getQuantity());
DistributionParcelListEntity parcelListEntity = distributionParcelListService.getById(distributionParcelListEntity.getId());
parcelListEntity.setOrderPackageReservationStatus(OrderPackageReservationStatusConstant.yiyueyue.getValue());
distributionParcelListService.updateById(parcelListEntity);
} else {
oldPackage.remove(m);
//移除
} }
}); });
AtomicInteger deleteNum = new AtomicInteger(); //移除包件进行取消
//这里就需要将原来记录剩下的数据进行取消操作, oldPackage.forEach((o, p) -> {
oldPackageListMap.forEach((o,q)->{ DistributionReservationPackageEntity reservationPackageEntity = p.get(0);
DistributionReservationPackageEntity distributionReservationPackageEntity = q.get(0); reservationPackageEntity.setPacketBarStatus(ReservationPackageStatusConstant.quxiao.getValue());
distributionReservationPackageEntity.setPacketBarCode(ReservationPackageStatusConstant.quxiao.getValue()); distributionReservationPackageService.updateById(reservationPackageEntity);
DistributionParcelListEntity parcelListEntity = distributionParcelListService.getById(o); //统计减少包件数量
reduceNum.getAndAdd(distributionParcelListService.getById(reservationPackageEntity.getParceListId()).getQuantity());
DistributionParcelListEntity parcelListEntity = distributionParcelListService.getById(reservationPackageEntity.getParceListId());
parcelListEntity.setOrderPackageReservationStatus(OrderPackageReservationStatusConstant.daiyuyue.getValue()); parcelListEntity.setOrderPackageReservationStatus(OrderPackageReservationStatusConstant.daiyuyue.getValue());
//将预约订单中间表的数据进行减少 distributionParcelListService.updateById(parcelListEntity);
deleteNum.getAndAdd(parcelListEntity.getQuantity());
}); });
reservationStockarticleEntity.setReservationNum(reservationNum + packageNum.get() - deleteNum.get()); //对存在订单进行维护
DistributionReservationStockarticleEntity reservationStockarticleEntity = oldStockArticle.get(k).get(0);
Integer reservationNum = reservationStockarticleEntity.getReservationNum();
reservationStockarticleEntity.setReservationNum(reservationNum + packageNum.get() - reduceNum.get());
distributionReservationStockarticleService.updateById(reservationStockarticleEntity); distributionReservationStockarticleService.updateById(reservationStockarticleEntity);
reservationStockarticleMap.remove(k); packTotal.getAndAdd(reservationStockarticleEntity.getReservationNum());
}else { oldStockArticle.remove(k);
//这里表示这个订单是新增的 String status = distributionReservationPackageService.judgmentStatus(distributionStockArticleDTO);
DistributionStockArticleDTO distributionStockArticleDTO = v.get(0); DistributionStockArticleEntity stockArticleEntity = distributionStockArticleService.getById(distributionStockArticleDTO.getId());
DistributionStockArticleEntity stockArticleEntity = Func.copy(distributionStockArticleDTO, DistributionStockArticleEntity.class); stockArticleEntity.setReservationStatus(status);
List<DistributionParcelListEntity> packageList = distributionStockArticleDTO.getPackageListInfo(); distributionStockArticleService.updateById(stockArticleEntity);
//包件数量累加 }
AtomicInteger packageCount = new AtomicInteger(); });
packageList.forEach(p->{ oldStockArticle.forEach((i, j) -> {
DistributionReservationPackageEntity distributionReservationPackageEntity = new DistributionReservationPackageEntity(); //这里就是需要进行取消的订单信息
distributionReservationPackageEntity.setReservationId(id); DistributionReservationStockarticleEntity reservationStockarticleEntity = j.get(0);
distributionReservationPackageEntity.setParceListId(p.getId()); reservationStockarticleEntity.setStockArticleStatus(ReservationOrderStatusConstant.quxiao.getValue());
distributionReservationPackageEntity.setStockArticleId(stockArticleEntity.getId()); List<DistributionReservationPackageEntity> packageEntityList = distributionReservationPackageMapper.selectPackageByReservationAndStockArticleId(id, reservationStockarticleEntity.getStockArticleId());
distributionReservationPackageEntity.setPacketBarStatus(ReservationPackageStatusConstant.zhengchang.getValue()); packageEntityList.forEach(p -> {
distributionReservationPackageService.save(distributionReservationPackageEntity); p.setPacketBarStatus(ReservationPackageStatusConstant.quxiao.getValue());
packageCount.getAndAdd(p.getQuantity()); distributionReservationPackageService.updateById(p);
}); reduceTotal.getAndAdd(distributionParcelListService.getById(p.getParceListId()).getQuantity());
DistributionReservationStockarticleEntity reservationStockarticleEntity = new DistributionReservationStockarticleEntity(); DistributionParcelListEntity parcelListEntity = distributionParcelListService.getById(p.getParceListId());
reservationStockarticleEntity.setReservationNum(packageCount.get()); parcelListEntity.setOrderPackageReservationStatus(OrderPackageReservationStatusConstant.daiyuyue.getValue());
reservationStockarticleEntity.setReservationId(id); distributionParcelListService.updateById(parcelListEntity);
reservationStockarticleEntity.setStockArticleId(k); });
reservationStockarticleEntity.setStockArticleCode(ReservationOrderStatusConstant.zhengchang.getValue()); DistributionStockArticleEntity stockArticleEntity = distributionStockArticleService.getById(i);
distributionReservationStockarticleService.save(reservationStockarticleEntity); DistributionStockArticleDTO stockArticleDTO = Func.copy(stockArticleEntity, DistributionStockArticleDTO.class);
//查询订单下的包件数量,对包件状态进行变更 String status = distributionReservationPackageService.judgmentStatus(stockArticleDTO);
List<DistributionParcelListEntity> parcelListEntityList = distributionParcelListMapper.selectList(Wrappers.<DistributionParcelListEntity>query().lambda().eq(DistributionParcelListEntity::getStockArticleId, k)); stockArticleEntity.setReservationStatus(status);
if (parcelListEntityList.size()==packageList.size()){ reservationStockarticleEntity.setStockArticleStatus(ReservationOrderStatusConstant.quxiao.getValue());
stockArticleEntity.setReservationStatus(OrderReservationStatusConstant.yiyueyue.getValue()); distributionReservationStockarticleService.updateById(reservationStockarticleEntity);
}else if (parcelListEntityList.size()>packageList.size()){ });
stockArticleEntity.setReservationStatus(OrderReservationStatusConstant.daiyuyue.getValue()); //库存品修改
}else { //查询出原来的库存品信息
log.error("订单包件数量有误"); List<DistributionReservationStocklistEntity> reservationStocklistEntities = distributionReservationStocklistService.getBaseMapper().selectList(Wrappers.<DistributionReservationStocklistEntity>query().lambda().eq(DistributionReservationStocklistEntity::getReservationId, id));
Map<Long, List<DistributionReservationStocklistEntity>> oleInventoryList = reservationStocklistEntities.stream().collect(Collectors.groupingBy(DistributionReservationStocklistEntity::getStocklistId));
List<DistributionStockListDTO> inventoryList = distributionReservationDTO.getInventoryList();
Map<Long, List<DistributionStockListDTO>> newInventoryList = inventoryList.stream().collect(Collectors.groupingBy(DistributionStockListDTO::getId));
AtomicInteger inventorTotal = new AtomicInteger();
newInventoryList.forEach((c, d) -> {
DistributionReservationStocklistEntity reservationStocklistEntity = new DistributionReservationStocklistEntity();
DistributionStockListDTO distributionStockListDTO = d.get(0);
if (Func.isEmpty(oleInventoryList.get(c))) {
//新增库存品
reservationStocklistEntity.setStocklistId(distributionStockListDTO.getId());
reservationStocklistEntity.setReservationId(id);
reservationStocklistEntity.setReservationNum(distributionStockListDTO.getReservationNum());
reservationStocklistEntity.setUnit(distributionStockListDTO.getCargoUnit());
// reservationStocklistEntity.setIsUnpackProduct(distributionStockListDTO.getUnpack());
reservationStocklistEntity.setStockListStatus(ReservationInventoryStatusConstant.zengjia.getValue());
distributionReservationStocklistService.save(reservationStocklistEntity);
//TODO 这里新增还需要对库存品的数量进行修改
DistributionStockListEntity stockListEntity = Func.copy(distributionStockListDTO, DistributionStockListEntity.class);
Integer quantityOccupied = stockListEntity.getQuantityOccupied();
stockListEntity.setQuantityOccupied(quantityOccupied + reservationStocklistEntity.getReservationNum());
distributionStockListService.updateById(stockListEntity);
} else {
DistributionReservationStocklistEntity distributionReservationStocklistEntity = oleInventoryList.get(c).get(0);
// DistributionStockListDTO distributionStockListDTO = newInventoryList.get(c).get(0);
//比对原来的库存品数量和现在的数量是否一致
if (!Func.equals(distributionStockListDTO.getReservationNum(), distributionReservationStocklistEntity.getReservationNum())) {
Integer reservationNum = distributionReservationStocklistEntity.getReservationNum();
DistributionStockListEntity stockListEntity = distributionStockListService.getById(distributionReservationStocklistEntity.getStocklistId());
Integer quantityOccupied = stockListEntity.getQuantityOccupied();
Integer total = quantityOccupied - reservationNum;
distributionReservationStocklistEntity.setReservationNum(distributionStockListDTO.getReservationNum());
distributionReservationStocklistService.updateById(distributionReservationStocklistEntity);
stockListEntity.setQuantityOccupied(total + distributionReservationStocklistEntity.getReservationNum());
distributionStockListService.updateById(stockListEntity);
//TODO 对库存品数量修改
} }
oleInventoryList.remove(c);
//比较库存品之间的数据
} }
inventorTotal.getAndAdd(distributionStockListDTO.getReservationNum());
});
//对移除的库存品进行取消操作
oleInventoryList.forEach((k, v) -> {
DistributionReservationStocklistEntity distributionReservationStocklistEntity = v.get(0);
distributionReservationStocklistEntity.setStockListStatus(ReservationInventoryStatusConstant.quxiao.getValue());
distributionReservationStocklistService.updateById(distributionReservationStocklistEntity);
//TODO 库存品数量变更
}); });
DistributionReservationEntity reservationEntity = this.getById(id);
Integer reservationNum = reservationEntity.getReservationNum();
reservationEntity.setOtherFee(distributionReservationDTO.getOtherFee());
reservationEntity.setDeliveryType(distributionReservationDTO.getDeliveryType());
//删除原有 reservationEntity.setDeliveryWay(distributionReservationDTO.getDeliveryWay());
// DistributionReservationEntity distributionReservationEntity = this.getById(distributionReservationDTO.getId()); reservationEntity.setServeType(distributionReservationDTO.getServeType());
// Func.copy(distributionReservationDTO, distributionReservationEntity); reservationEntity.setReservationNum(packTotal.get());
// QueryWrapper<DistributionReservationStockarticleEntity> q = Condition.getQueryWrapper(new HashMap<String, Object>(), DistributionReservationStockarticleEntity.class); reservationEntity.setReservationStockListNum(inventorTotal.get());
// q.lambda().eq(DistributionReservationStockarticleEntity::getReservationId, distributionReservationEntity.getId()); reservationEntity.setReservationDate(distributionReservationDTO.getReservationDate());
// QueryWrapper<DistributionReservationStocklistEntity> w = Condition.getQueryWrapper(new HashMap<String, Object>(), DistributionReservationStocklistEntity.class); reservationEntity.setPeriodOfTime(distributionReservationDTO.getPeriodOfTime());
// w.lambda().eq(DistributionReservationStocklistEntity::getReservationId, distributionReservationEntity.getId()); reservationEntity.setReplaceFee(distributionReservationDTO.getReplaceFee());
// QueryWrapper<DistributionReservationPackageEntity> o = Condition.getQueryWrapper(new HashMap<String, Object>(), DistributionReservationPackageEntity.class); // reservationEntity.setCollectFee(distributionReservationDTO.getCollectFee());
// o.lambda().eq(DistributionReservationPackageEntity::getReservationId, distributionReservationEntity.getId()); reservationEntity.setRemarks(distributionReservationDTO.getRemarks());
// //查询已有的中间表信息 reservationEntity.setIsUrgent(distributionReservationDTO.getIsUrgent());
// List<DistributionReservationStockarticleEntity> reservationStockarticleEntityList = distributionReservationStockarticleService.getBaseMapper().selectList(q); this.updateById(reservationEntity);
// List<DistributionReservationStocklistEntity> reservationStocklistEntityList = distributionReservationStocklistService.getBaseMapper().selectList(w);
// List<DistributionReservationPackageEntity> reservationPackageEntityList = distributionReservationPackageMapper.selectList(o);
// if (!Func.isEmpty(reservationStockarticleEntityList)) {
// //对已有预约信息的订单包件数量进行清理
// reservationStockarticleEntityList.forEach(s1 -> {
// //删除前需要对订单的可用数进行操作
// DistributionStockArticleEntity stockArticleEntity = distributionStockArticleService.getById(s1.getStockArticleId());
// stockArticleEntity.setAvailableQuantity(s1.getReservationNum() + stockArticleEntity.getAvailableQuantity());
// stockArticleEntity.setReservationStatus(OrderReservationStatusConstant.daiyuyue.getValue());
// distributionStockArticleService.updateById(stockArticleEntity);
// //这里对原表进行物理删除
// distributionReservationStockarticleMapper.deleteReservationStockarticle(distributionReservationDTO.getId(),s1.getId());
// });
// }
// if (!Func.isEmpty(reservationStocklistEntityList)) {
// //对已有预约信息的库存品数据进行维护
// reservationStocklistEntityList.forEach(r1 -> {
// Long stocklistId = r1.getStocklistId();
// DistributionStockListEntity stockListEntity = distributionStockListService.getById(stocklistId);
// int num = stockListEntity.getQuantityOccupied() - r1.getReservationNum();
// stockListEntity.setQuantityOccupied(num);
//// stockListEntity.setQuantityOccupied(stockListEntity.getQuantityOccupied() + r1.getReservationNum());
// //这里对原表进行物理删除
// distributionStockListService.updateById(stockListEntity);
// distributionReservationStocklistMapper.deleteReservationStocklist(distributionReservationDTO.getId());
// });
// }
// if (!Func.isEmpty(reservationPackageEntityList)) {
// //对已有预约信息的订单包件数量进行清理
// reservationPackageEntityList.forEach(p1 -> {
// DistributionParcelListEntity parcelListEntity = distributionParcelListService.getById(p1.getParceListId());
// parcelListEntity.setOrderPackageStockupStatus(OrderPackageStockupStatusConstant.daibeihuo.getValue());
// parcelListEntity.setOrderPackageReservationStatus(OrderPackageReservationStatusConstant.daiyuyue.getValue());
// //todo 这里需要将包件状态设置成未预约;备货信息设置为未备货
//// parcelListEntity.setOrderPackageReservationStatus();
// //这里对原表进行物理删除
// distributionReservationPackageMapper.deleteReservationPackage(distributionReservationDTO.getId());
// });
// }
// //包件数量累加
// AtomicInteger packageCount = new AtomicInteger();
// //计算总费用
// AtomicReference<BigDecimal> initTotal = new AtomicReference<>(BigDecimal.ZERO);
// //订单自编号拼接
// HashSet<String> hashSet = new HashSet<>();
// List<DistributionStockArticleDTO> stockArticleList = distributionReservationDTO.getStockArticleList();
// if (!Func.isEmpty(stockArticleList)) {
// //这里判断修改内容是否存在订单信息,如果存在则进行中间表数据的重新插入
// stockArticleList.forEach(s -> {
// List<DistributionParcelListEntity> packageList = s.getPackageList();
// QueryWrapper<DistributionParcelListEntity> parcelListEntityQueryWrapper = new QueryWrapper<>();
// LambdaQueryWrapper<DistributionParcelListEntity> queryWrapper = parcelListEntityQueryWrapper.lambda().eq(DistributionParcelListEntity::getStockArticleId, s.getId());
// List<DistributionParcelListEntity> parcelListEntityList = distributionParcelListService.getBaseMapper().selectList(queryWrapper);
// if (packageList.size() != parcelListEntityList.size()) {
// s.setReservationStatus(OrderReservationStatusConstant.bufenyuyue.getValue());
// } else {
// s.setReservationStatus(OrderReservationStatusConstant.yiyueyue.getValue());
// }
// AtomicInteger packageNum = new AtomicInteger();
// if (Func.isEmpty(packageList)) {
// Map<String, Object> map = new HashMap<>();
// map.put("stockArticleId", s.getId());
// QueryWrapper<DistributionParcelListEntity> qw = Condition.getQueryWrapper(map, DistributionParcelListEntity.class);
// //添加订单下的所有在库订单
// List<DistributionParcelListEntity> distributionParcelListEntities = distributionParcelListService.getBaseMapper().selectList(qw);
// distributionParcelListEntities.forEach(p -> {
// packageNum.getAndIncrement();
// DistributionReservationPackageEntity distributionReservationPackageEntity = new DistributionReservationPackageEntity();
// distributionReservationPackageEntity.setReservationId(distributionReservationDTO.getId());
// distributionReservationPackageEntity.setPacketBarCode(p.getOrderPackageCode());
// distributionReservationPackageEntity.setParceListId(p.getId());
// distributionReservationPackageEntity.setStockArticleId(s.getId());
// //维护订单下包件信息
// distributionReservationPackageService.save(distributionReservationPackageEntity);
// p.setOrderPackageReservationStatus(OrderPackageReservationStatusConstant.yiyueyue.getValue());
// distributionParcelListService.updateById(p);
// });
// //设置订单可用数为0
// s.setAvailableQuantity(0);
// } else {
// //维护选中的包件信息
// packageList.forEach(p -> {
// packageNum.getAndIncrement();
// DistributionReservationPackageEntity distributionReservationPackageEntity = new DistributionReservationPackageEntity();
// distributionReservationPackageEntity.setReservationId(distributionReservationDTO.getId());
// distributionReservationPackageEntity.setParceListId(p.getId());
// distributionReservationPackageEntity.setStockArticleId(s.getId());
// distributionReservationPackageEntity.setPacketBarCode(p.getOrderPackageCode());
// distributionReservationPackageService.save(distributionReservationPackageEntity);
// p.setOrderPackageReservationStatus(OrderPackageReservationStatusConstant.yiyueyue.getValue());
// distributionParcelListService.updateById(p);
// });
// s.setAvailableQuantity(s.getAvailableQuantity() - s.getReservationNum());
//
// }
// DistributionReservationStockarticleEntity distributionReservationStockarticleEntity = new DistributionReservationStockarticleEntity();
// //构建预约订单中间表信息
// distributionReservationStockarticleEntity.setReservationNum(packageNum.get());
// distributionReservationStockarticleEntity.setStockArticleId(s.getId());
// distributionReservationStockarticleEntity.setIsHaveData(s.getIsHaveData());
// distributionReservationStockarticleEntity.setReservationId(distributionReservationEntity.getId());
// distributionReservationStockarticleService.save(distributionReservationStockarticleEntity);
// packageCount.getAndAdd(distributionReservationStockarticleEntity.getReservationNum());
// //统计订单包件数量
// //订单到付费用
//// initTotal.getAndAccumulate(new BigDecimal(s.getCollectFee().toString()), BigDecimal::add);
//// //订单仓储费
//// initTotal.getAndAccumulate(new BigDecimal(s.getStorageFee().toString()), BigDecimal::add);
//// //协商费用
//// initTotal.getAndAccumulate(new BigDecimal(s.getRate().toString()), BigDecimal::add);
// hashSet.add(s.getOrderCode());
// });
// }
// List<DistributionStockListDTO> inventoryList = distributionReservationDTO.getInventoryList();
// AtomicInteger stockListNum = new AtomicInteger();
// if (!Func.isEmpty(inventoryList)) {
// //重新构建预约和库存之间的关系
// inventoryList.forEach(i -> {
// DistributionStockListEntity stockListEntity = distributionStockListService.getById(i.getId());
// int count = stockListEntity.getQuantityOccupied() + i.getReservationNum();
// stockListEntity.setQuantityOccupied(count);
// distributionStockListService.updateById(stockListEntity);
// DistributionReservationStocklistEntity distributionReservationStocklistEntity = new DistributionReservationStocklistEntity();
// distributionReservationStocklistEntity.setReservationId(distributionReservationEntity.getId());
// distributionReservationStocklistEntity.setReservationNum(i.getReservationNum());
// distributionReservationStocklistEntity.setStocklistId(i.getId());
// distributionReservationStocklistService.save(distributionReservationStocklistEntity);
// hashSet.add(i.getOrderCode());
// stockListNum.getAndAdd(distributionReservationStocklistEntity.getReservationNum());
// });
// }
// String orderId = String.join(",", hashSet);
// distributionReservationEntity.setFee(initTotal.get());
// distributionReservationEntity.setServeType(DistributionTypeConstant.shipie.getValue());
// distributionReservationEntity.setReservationNum(packageCount.get());
// distributionReservationEntity.setStockArticleId(orderId);
// distributionReservationEntity.setReservationStockListNum(stockListNum.get());
// distributionReservationMapper.updateById(distributionReservationEntity);
return true; return true;
} }
@ -1066,7 +998,7 @@ public class DistributionReservationServiceImpl extends BaseServiceImpl<Distribu
// TODO 计算总费用 // TODO 计算总费用
// AtomicReference<BigDecimal> initTotal = new AtomicReference<>(BigDecimal.ZERO); // AtomicReference<BigDecimal> initTotal = new AtomicReference<>(BigDecimal.ZERO);
//统计包件数量 //统计包件数量
AtomicInteger packageTotal= new AtomicInteger(); AtomicInteger packageTotal = new AtomicInteger();
v.forEach(a -> { v.forEach(a -> {
orderTotal.getAndIncrement(); orderTotal.getAndIncrement();
DistributionStockArticleEntity stockArticleEntity = Func.copy(a, DistributionStockArticleEntity.class); DistributionStockArticleEntity stockArticleEntity = Func.copy(a, DistributionStockArticleEntity.class);

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

@ -20,14 +20,17 @@ import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.logpm.basicdata.entity.BasicdataDriverArteryEntity; import com.logpm.basicdata.entity.BasicdataDriverArteryEntity;
import com.logpm.basicdata.feign.IBasicdataDriverArteryClient; import com.logpm.basicdata.feign.IBasicdataDriverArteryClient;
import com.logpm.distribution.dto.DistributionReservationPackageDTO;
import com.logpm.distribution.dto.DistributionSignforDTO; import com.logpm.distribution.dto.DistributionSignforDTO;
import com.logpm.distribution.dto.DistrilbutionAppsignforDTO; import com.logpm.distribution.dto.DistrilbutionAppsignforDTO;
import com.logpm.distribution.dto.app.DistributionAppDeliveryListDTO; import com.logpm.distribution.dto.app.DistributionAppDeliveryListDTO;
import com.logpm.distribution.entity.*; import com.logpm.distribution.entity.*;
import com.logpm.distribution.excel.DistributionSignforExcel; import com.logpm.distribution.excel.DistributionSignforExcel;
import com.logpm.distribution.mapper.*; import com.logpm.distribution.mapper.*;
import com.logpm.distribution.service.IDistributionReservationPackageService;
import com.logpm.distribution.service.IDistributionSignforService; import com.logpm.distribution.service.IDistributionSignforService;
import com.logpm.distribution.vo.DistributionSignforVO; import com.logpm.distribution.vo.DistributionSignforVO;
import com.logpm.distribution.vo.DistributionSignforsnmbVO; import com.logpm.distribution.vo.DistributionSignforsnmbVO;
@ -68,6 +71,7 @@ public class DistributionSignforServiceImpl extends BaseServiceImpl<Distribution
private final DistributionStockMapper distributionStockMapper; private final DistributionStockMapper distributionStockMapper;
private final IDictBizClient dictBizClient; private final IDictBizClient dictBizClient;
private final IBasicdataDriverArteryClient iBasicdataDriverArteryClient; private final IBasicdataDriverArteryClient iBasicdataDriverArteryClient;
private final IDistributionReservationPackageService reservationPackageService;
@Override @Override
public IPage<DistributionSignforVO> selectDistributionSignforPage(IPage<DistributionSignforVO> page, DistributionSignforVO distributionSignfor) { public IPage<DistributionSignforVO> selectDistributionSignforPage(IPage<DistributionSignforVO> page, DistributionSignforVO distributionSignfor) {
@ -352,6 +356,21 @@ public class DistributionSignforServiceImpl extends BaseServiceImpl<Distribution
selectord = baseMapper.selectordc(page, distributionDeliveryList); selectord = baseMapper.selectordc(page, distributionDeliveryList);
} }
} }
selectord.forEach( i ->{
DistributionReservationPackageDTO packageDTO = new DistributionReservationPackageDTO();
packageDTO.setReservationId(Long.parseLong(distributionDeliveryList.getReservationId()));
packageDTO.setStockArticleId(i.getStockArticleId());
List<DistributionAppParcelListVO> list = reservationPackageService.getPackDetail(packageDTO);
list.forEach( a ->{
if(a.getScanStatus() > 0){
a.setIsScan("是");
}else{
a.setIsScan("否");
}
});
i.setDistributionAppParcelListVOS(list);
});
return page.setRecords(selectord); return page.setRecords(selectord);
} }

18
blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionStockArticleServiceImpl.java

@ -57,6 +57,7 @@ import org.springblade.core.tool.utils.BeanUtil;
import org.springblade.core.tool.utils.Func; import org.springblade.core.tool.utils.Func;
import org.springblade.core.tool.utils.ObjectUtil; import org.springblade.core.tool.utils.ObjectUtil;
import org.springblade.system.cache.DictBizCache; import org.springblade.system.cache.DictBizCache;
import org.springframework.boot.actuate.autoconfigure.metrics.MetricsProperties;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import sun.misc.BASE64Encoder; import sun.misc.BASE64Encoder;
@ -355,11 +356,11 @@ public class DistributionStockArticleServiceImpl extends BaseServiceImpl<Distrib
//这里进行订单查询 //这里进行订单查询
l.forEach(id -> { l.forEach(id -> {
DistributionStockArticleEntity distributionStockArticleEntity = this.baseMapper.selectById(id); DistributionStockArticleEntity distributionStockArticleEntity = this.baseMapper.selectById(id);
// DistributionStockArticleVO distributionStockArticleVO = Func.copy(distributionStockArticleEntity, DistributionStockArticleVO.class); DistributionStockArticleVO distributionStockArticleVO = DistributionStockArticleWrapper.build().entityVO(distributionStockArticleEntity);
distributionStockArticleEntityList.add(DistributionStockArticleWrapper.build().entityVO(distributionStockArticleEntity)); List<DistributionParcelListEntity> parcelListEntityList = distributionParcelListService.getBaseMapper().selectList(Wrappers.<DistributionParcelListEntity>query().lambda().eq(DistributionParcelListEntity::getStockArticleId, distributionStockArticleEntity.getId()));
distributionStockArticleVO.setParcelListVOS(DistributionParcelListWrapper.build().listVO(parcelListEntityList));
distributionStockArticleEntityList.add(distributionStockArticleVO);
}); });
return R.data(distributionStockArticleEntityList); return R.data(distributionStockArticleEntityList);
} }
@ -551,4 +552,13 @@ public class DistributionStockArticleServiceImpl extends BaseServiceImpl<Distrib
return orderPackgeCodeDataVO; return orderPackgeCodeDataVO;
} }
@Override
public IPage<DistributionStockArticleVO> handlePackage(IPage<DistributionStockArticleVO> pageVO) {
pageVO.getRecords().forEach(s->{
List<DistributionParcelListEntity> parcelListEntityList = distributionParcelListService.getBaseMapper().selectList(Wrappers.<DistributionParcelListEntity>query().lambda().eq(DistributionParcelListEntity::getStockArticleId, s.getId()));
s.setParcelListVOS(DistributionParcelListWrapper.build().listVO(parcelListEntityList));
});
return pageVO;
}
} }

1
blade-service/logpm-distribution/src/main/java/com/logpm/distribution/wrapper/DistributionParcelListWrapper.java

@ -7,6 +7,7 @@ import org.springblade.core.mp.support.BaseEntityWrapper;
import org.springblade.core.tool.utils.BeanUtil; import org.springblade.core.tool.utils.BeanUtil;
import org.springblade.system.cache.DictBizCache; import org.springblade.system.cache.DictBizCache;
import java.util.List;
import java.util.Objects; import java.util.Objects;
/** /**

34
blade-service/logpm-distribution/src/main/java/com/logpm/distribution/wrapper/DistributionStockListWrapper.java

@ -0,0 +1,34 @@
package com.logpm.distribution.wrapper;
import com.logpm.distribution.entity.DistributionStockArticleEntity;
import com.logpm.distribution.entity.DistributionStockListEntity;
import com.logpm.distribution.vo.DistributionStockArticleVO;
import com.logpm.distribution.vo.DistributionStockListVO;
import org.springblade.common.constant.DictBizConstant;
import org.springblade.core.mp.support.BaseEntityWrapper;
import org.springblade.core.tool.utils.BeanUtil;
import org.springblade.core.tool.utils.SpringUtil;
import org.springblade.system.cache.DictBizCache;
import org.springblade.system.feign.IUserClient;
import java.util.Date;
import java.util.Objects;
/**
* 在库订单实体VO 转换
*/
public class DistributionStockListWrapper extends BaseEntityWrapper<DistributionStockListEntity
, DistributionStockListVO> {
public static DistributionStockListWrapper build() {
return new DistributionStockListWrapper();
}
@Override
public DistributionStockListVO entityVO(DistributionStockListEntity entity) {
DistributionStockListVO distributionStockListVO = Objects.requireNonNull(BeanUtil.copy(entity, DistributionStockListVO.class));
return distributionStockListVO;
}
}
Loading…
Cancel
Save