Browse Source

装车新规代码提交

dist.1.3.0
汤建军 7 months ago
parent
commit
d3de307ef1
  1. 2
      blade-service-api/logpm-distribution-api/src/main/java/com/logpm/distribution/vo/app/DistributionAppDetailVO.java
  2. 35
      blade-service-api/logpm-distribution-api/src/main/java/com/logpm/distribution/vo/app/DistributionAppNewDeliveryListVO.java
  3. 60
      blade-service-api/logpm-distribution-api/src/main/java/com/logpm/distribution/vo/app/DistributionAppNewReservationVO.java
  4. 13
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/api/DistributionDeliveryAppController.java
  5. 33
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/api/DistributionSignforAppController.java
  6. 9
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionDeliveryInfoMapper.java
  7. 92
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionDeliveryInfoMapper.xml
  8. 9
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionDeliveryListMapper.java
  9. 42
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionDeliveryListMapper.xml
  10. 45
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionSignforMapper.java
  11. 334
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionSignforMapper.xml
  12. 7
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/IDistributionDeliveryListService.java
  13. 17
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/IDistributionSignforService.java
  14. 12
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionDeliveryInfoServiceImpl.java
  15. 43
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionDeliveryListServiceImpl.java
  16. 390
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionSignforServiceImpl.java

2
blade-service-api/logpm-distribution-api/src/main/java/com/logpm/distribution/vo/app/DistributionAppDetailVO.java

@ -57,7 +57,7 @@ public class DistributionAppDetailVO implements Serializable {
private String typeName;
private List<DistributionAppReservationVO> customList;
private List<DistributionAppNewReservationVO> customList;
private List<DistributionAppStockArticleVO> distributionAppStockArticleVOS;

35
blade-service-api/logpm-distribution-api/src/main/java/com/logpm/distribution/vo/app/ReservationAppDetailVO.java → blade-service-api/logpm-distribution-api/src/main/java/com/logpm/distribution/vo/app/DistributionAppNewDeliveryListVO.java

@ -16,11 +16,9 @@
*/
package com.logpm.distribution.vo.app;
import com.logpm.distribution.vo.DisStockListDetailVO;
import lombok.Data;
import java.io.Serializable;
import java.util.List;
/**
* 配送管理 App视图实体类
@ -29,30 +27,41 @@ import java.util.List;
* @since 2023-06-16
*/
@Data
public class ReservationAppDetailVO implements Serializable {
public class DistributionAppNewDeliveryListVO implements Serializable {
private static final long serialVersionUID = 1L;
private Long id;
private Long id ;
private String consignee;
private String trainNumber;
private String vehicleName;
private String driverName;
private String deliveryStatusName;
private String isLoad;
private String typeName;
private String isStartName;
private String consignee;
private String isStock;
private String stockupArea;
private Integer loadingNub;
private String taskTime;
private Integer orderNum;
private Integer customersNumber;
private Integer planNum;
private Integer orderNumber;
private Integer deliveryNumber;
private List<DisStockListDetailVO> disStockListDetailVOS ;
private Integer inventoryNub;
private List<DistributionAppStockArticleVO> distributionAppZeroStockArticleVOS ;
private Integer scannedNumber;
private Integer signforNumber;
private List<DistributionAppStockArticleVO> distributionAppStockArticleVOS ;

60
blade-service-api/logpm-distribution-api/src/main/java/com/logpm/distribution/vo/app/DistributionAppNewReservationVO.java

@ -0,0 +1,60 @@
/*
* Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* Neither the name of the dreamlu.net developer nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
* Author: Chill 庄骞 (smallchill@163.com)
*/
package com.logpm.distribution.vo.app;
import com.logpm.distribution.entity.DisStockListDetailEntity;
import com.logpm.distribution.entity.DistributionReservationEntity;
import com.logpm.distribution.vo.DisStockListDetailVO;
import com.logpm.distribution.vo.DistributionParcelListVO;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
/**
* 预约列表 App视图实体类
*
* @author TJJ
* @since 2023-06-12
*/
@Data
public class DistributionAppNewReservationVO implements Serializable {
private static final long serialVersionUID = 1L;
private Long id;
private String consignee;
private String phone;
private String address;
private String remarks;
private String stockupArea;
private String isStock;
private Integer planNumber;
private Integer orderNumber;
private Integer trayNumber;
private Integer loadingQuantity;
private Integer signforQuantity;
private List<DistributionAppStockArticleVO> orderList = new ArrayList<>();
private List<DistributionAppStockArticleVO> zeroOrderList = new ArrayList<>();
private List<DisStockListDetailVO> inventoryList = new ArrayList<>();
}

13
blade-service/logpm-distribution/src/main/java/com/logpm/distribution/api/DistributionDeliveryAppController.java

@ -60,8 +60,8 @@ public class DistributionDeliveryAppController {
@GetMapping("/newPage")
@ApiOperationSupport(order = 1)
@ApiOperation(value = "列表", notes = "DistributionAppDeliveryListDTO")
public R newPage(DistributionAppDeliveryListDTO distributionDeliveryList, Query query) {
R r= distributionDeliveryListService.selectDistributionAppDeliveryListNewPage(Condition.getPage(query), distributionDeliveryList);
public R newPage(DistributionAppDeliveryListDTO distributionDeliveryList) {
R r= distributionDeliveryListService.selectDistributionAppDeliveryListNewPage(distributionDeliveryList);
return r;
}
@ -94,7 +94,7 @@ public class DistributionDeliveryAppController {
@ApiOperationSupport(order = 3)
@ApiOperation(value = "详情", notes = "传入DistributionDeliveryListDTO")
public R newDetail(DistributionAppDeliveryListDTO distributionDeliveryList) {
R r= distributionDeliveryListService.getNewAppDeliveryreservationListPage(distributionDeliveryList);
R r= distributionDeliveryListService.getNewAppDeliveryreservationList(distributionDeliveryList);
return r;
}
@ -147,10 +147,10 @@ public class DistributionDeliveryAppController {
/**
* 配送 查看订单
*/
@GetMapping("/newOrder")
@GetMapping("/newCustomDetail")
@ApiOperationSupport(order = 4)
@ApiOperation(value = "查看订单", notes = "DistributionAppDeliveryListDTO")
public R newOrder(DistributionAppDeliveryListDTO distributionAppDeliveryListDTO) {
public R newCustomDetail(DistributionAppDeliveryListDTO distributionAppDeliveryListDTO) {
R r= distributionDeliveryInfoService.selectDistributionNewAppDeliveryorder(distributionAppDeliveryListDTO);
return r;
}
@ -308,9 +308,6 @@ public class DistributionDeliveryAppController {
@ApiOperationSupport(order = 7)
@ApiOperation(value = "取消发车", notes = "传入DistrilbutionloadingscanDTO")
public R cancelStart(@Valid @RequestBody DistrilbutionloadingscanDTO distrilbutionloadingscanDTO) {
if (null == distrilbutionloadingscanDTO.getDeliveryId() || null == distrilbutionloadingscanDTO.getLoadingId()){
return R.fail("参数不全");
}
return distributionDeliveryListService.cancelStart(distrilbutionloadingscanDTO);
}

33
blade-service/logpm-distribution/src/main/java/com/logpm/distribution/api/DistributionSignforAppController.java

@ -64,6 +64,17 @@ public class DistributionSignforAppController {
return R.data(pages);
}
/**
* 签收管理 列表
*/
@GetMapping("/newPage")
@ApiOperationSupport(order = 1)
@ApiOperation(value = "列表", notes = "DistributionAppDeliveryListDTO")
public R newPage(DistributionAppDeliveryListDTO distributionDeliveryList) {
R r = distributionSignforService.selectDistributionNewAppDeliveryListPage(distributionDeliveryList);
return r;
}
/**
* 签收管理 客户列表
*/
@ -75,6 +86,17 @@ public class DistributionSignforAppController {
return R.data(pages);
}
/**
* 签收管理 客户列表
*/
@GetMapping("/newCustom")
@ApiOperationSupport(order = 5)
@ApiOperation(value = "列表", notes = "DistributionAppDeliveryListDTO")
public R newCustom(DistributionAppDeliveryListDTO distributionDeliveryList) {
R r = distributionSignforService.selectNewAppDeliveryCustom(distributionDeliveryList);
return r;
}
/**
* 签收管理 订单列表
@ -87,6 +109,17 @@ public class DistributionSignforAppController {
return R.data(pages);
}
/**
* 签收管理 客户列表
*/
@GetMapping("/newCustomDetail")
@ApiOperationSupport(order = 5)
@ApiOperation(value = "列表", notes = "DistributionAppDeliveryListDTO")
public R newCustomDetail(DistributionAppDeliveryListDTO distributionAppDeliveryListDTO) {
R r = distributionSignforService.selectNewAppDeliveryCustomDetail(distributionAppDeliveryListDTO);
return r;
}
/**
* 签收 客户查看库存品
*/

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

@ -27,9 +27,9 @@ import com.logpm.distribution.excel.DistributionDeliveryInfoExcel;
import com.logpm.distribution.vo.DistributionDeliveryInfoVO;
import com.logpm.distribution.vo.DistributionStockArticleVO;
import com.logpm.distribution.vo.DistributionStockListVO;
import com.logpm.distribution.vo.app.DistributionAppNewReservationVO;
import com.logpm.distribution.vo.app.DistributionAppReservationVO;
import com.logpm.distribution.vo.app.DistributionAppStockArticleVO;
import com.logpm.distribution.vo.app.ReservationAppDetailVO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
@ -189,11 +189,12 @@ public interface DistributionDeliveryInfoMapper extends BaseMapper<DistributionD
* @param id
* @return
*/
List<DistributionAppReservationVO> selectNewAppcustomListPage(@Param("deliveryId")Long id);
List<DistributionAppNewReservationVO> selectNewAppcustomList(@Param("deliveryId")Long id);
/**
* 查询PDA客户装车详情
* 查询单个客户详情
* @param reservationId
* @return
*/
ReservationAppDetailVO selectAppReservationDistributionDetail(@Param("reservationId")Long reservationId);
DistributionAppNewReservationVO selectNewAppcustom(@Param("reservationId")Long reservationId);
}

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

@ -909,12 +909,15 @@ FROM
lds.is_deleted = 0 and lds.delivery_id = #{id} and ldr.reservation_status != 40 AND (ldr.reservation_num + ldr.reservation_stock_list_num) > 0
</where>
</select>
<select id="selectNewAppcustomListPage"
resultType="com.logpm.distribution.vo.app.DistributionAppReservationVO">
<select id="selectNewAppcustomList"
resultType="com.logpm.distribution.vo.app.DistributionAppNewReservationVO">
SELECT
ldr.id id,
GROUP_CONCAT( DISTINCT CONCAT( ldr.receiving_unit, '(', ldr.consignee ), ')' ) AS consignee,
COALESCE ( ldr.reservation_num + ldr.reservation_stock_list_num, 0 ) reservationNum,
ldr.delivery_phone AS phone,
ldr.delivery_address AS address,
ldr.remarks AS remarks,
COALESCE ( ldr.reservation_num + ldr.reservation_stock_list_num, 0 ) planNumber,
(
SELECT COALESCE
( COUNT( 1 ), 0 )
@ -923,84 +926,65 @@ FROM
WHERE
ldrs.reservation_id = ldr.id
AND ldrs.stock_article_status IN ( 1, 3 )
) ordNub,
IFNULL(( SELECT SUM( loaded_nub ) FROM logpm_distribution_loadscan WHERE reservation_id = lds.reservation_id AND is_deleted = 0 AND scan_status != 1 ), 0 ) + IFNULL(( SELECT SUM( loaded_nub ) FROM logpm_distribution_loadscaninvn WHERE reservation_id = lds.reservation_id AND scan_status != 1 AND is_deleted = 0 ), 0 ) AS loadingNub,
) orderNumber,
IFNULL(( SELECT SUM( loaded_nub ) FROM logpm_distribution_loadscan WHERE reservation_id = lds.reservation_id AND is_deleted = 0 AND scan_status != 1 ), 0 ) + IFNULL(( SELECT SUM( loaded_nub ) FROM logpm_distribution_loadscaninvn WHERE reservation_id = lds.reservation_id AND scan_status != 1 AND is_deleted = 0 ), 0 ) AS loadingQuantity,
IFNULL(( SELECT SUM( loaded_nub ) FROM logpm_distribution_loadscan WHERE reservation_id = lds.reservation_id AND is_deleted = 0 AND scan_status != 1 AND signfor_state = 2), 0 ) + IFNULL(( SELECT SUM( loaded_nub ) FROM logpm_distribution_loadscaninvn WHERE reservation_id = lds.reservation_id AND scan_status != 1 AND is_deleted = 0 AND signfor_state = 2 ), 0 ) AS signforQuantity,
( SELECT IFNULL( GROUP_CONCAT( stockup_area ), '无备货区' ) FROM logpm_distribution_stock WHERE reservation_id = ldr.id AND is_deleted = 0 ) AS stockupArea,
IF
((
ldr.reservation_num + ldr.reservation_stock_list_num
) = IFNULL((
SELECT
SUM( loaded_nub )
FROM
logpm_distribution_loadscan
WHERE
reservation_id = lds.reservation_id
AND is_deleted = 0
AND scan_status != 1
AND is_abnormal_loading = 1
),
0
) + IFNULL(( SELECT SUM( loaded_nub ) FROM logpm_distribution_loadscaninvn WHERE reservation_id = lds.reservation_id AND scan_status != 1 AND is_deleted = 0 ), 0 ),
'是',
'否'
) AS Isload,
IF
((
ldr.reservation_num + ldr.reservation_stock_list_num
) = (SELECT IFNULL(SUM(stock_quantity),0) FROM logpm_distribution_stock WHERE reservation_id = ldr.id),
'是',
'否'
) AS Isstock
) AS isStock
FROM
logpm_distribution_signfor AS lds
LEFT JOIN logpm_distribution_reservation AS ldr ON lds.reservation_id = ldr.id
WHERE
lds.delivery_id = #{deliveryId}
lds.delivery_id =#{deliveryId}
AND lds.is_deleted = 0
AND ldr.is_deleted = 0
AND ldr.id IS NOT NULL
AND ldr.reservation_num + ldr.reservation_stock_list_num > 0
AND ldr.reservation_status != '40'
GROUP BY
ldr.id
</select>
<select id="selectAppReservationDistributionDetail"
resultType="com.logpm.distribution.vo.app.ReservationAppDetailVO">
<select id="selectNewAppcustom" resultType="com.logpm.distribution.vo.app.DistributionAppNewReservationVO">
SELECT
id,
CONCAT(ldr.receiving_unit,'(',ldr.consignee,')') AS consignee,
IF
((
ldr.reservation_num + ldr.reservation_stock_list_num
) = IFNULL((
SELECT
SUM( loaded_nub )
ldr.id id,
GROUP_CONCAT( DISTINCT CONCAT( ldr.receiving_unit, '(', ldr.consignee ), ')' ) AS consignee,
ldr.delivery_phone AS phone,
ldr.delivery_address AS address,
ldr.remarks AS remarks,
COALESCE ( ldr.reservation_num + ldr.reservation_stock_list_num, 0 ) planNumber,
(
SELECT COALESCE
( COUNT( 1 ), 0 )
FROM
logpm_distribution_loadscan
logpm_distribution_reservation_stockarticle ldrs
WHERE
reservation_id = ldr.id
AND is_deleted = 0
AND scan_status != 1
AND is_abnormal_loading = 1
),
0
) + IFNULL(( SELECT SUM( loaded_nub ) FROM logpm_distribution_loadscaninvn WHERE reservation_id = ldr.id AND scan_status != 1 AND is_deleted = 0 ), 0 ),
'是',
'否'
) AS isLoad,
ldrs.reservation_id = ldr.id
AND ldrs.stock_article_status IN ( 1, 3 )
) orderNumber,
IFNULL(( SELECT SUM( loaded_nub ) FROM logpm_distribution_loadscan WHERE reservation_id = lds.reservation_id AND is_deleted = 0 AND scan_status != 1 ), 0 ) + IFNULL(( SELECT SUM( loaded_nub ) FROM logpm_distribution_loadscaninvn WHERE reservation_id = lds.reservation_id AND scan_status != 1 AND is_deleted = 0 ), 0 ) AS loadingQuantity,
IFNULL(( SELECT SUM( loaded_nub ) FROM logpm_distribution_loadscan WHERE reservation_id = lds.reservation_id AND is_deleted = 0 AND scan_status != 1 AND signfor_state = 2), 0 ) + IFNULL(( SELECT SUM( loaded_nub ) FROM logpm_distribution_loadscaninvn WHERE reservation_id = lds.reservation_id AND scan_status != 1 AND is_deleted = 0 AND signfor_state = 2 ), 0 ) AS signforQuantity,
( SELECT IFNULL( GROUP_CONCAT( stockup_area ), '无备货区' ) FROM logpm_distribution_stock WHERE reservation_id = ldr.id AND is_deleted = 0 ) AS stockupArea,
IF
((
ldr.reservation_num + ldr.reservation_stock_list_num
) = (SELECT IFNULL(SUM(stock_quantity),0) FROM logpm_distribution_stock WHERE reservation_id = ldr.id),
'是',
'否'
) AS isStock,
IFNULL(( SELECT SUM( loaded_nub ) FROM logpm_distribution_loadscan WHERE reservation_id = ldr.id AND is_deleted = 0 AND scan_status != 1 ), 0 ) + IFNULL(( SELECT SUM( loaded_nub ) FROM logpm_distribution_loadscaninvn WHERE reservation_id = ldr.id AND scan_status != 1 AND is_deleted = 0 ), 0 ) AS loadingNub,
(ldr.reservation_num + ldr.reservation_stock_list_num) AS planNum,
IFNULL((SELECT COUNT(1) FROM logpm_distribution_reservation_stockarticle WHERE reservation_id = ldr.id AND is_deleted = 0 AND stock_article_status != 2),0 ) AS orderNum
) AS isStock
FROM
logpm_distribution_reservation AS ldr
logpm_distribution_signfor AS lds
LEFT JOIN logpm_distribution_reservation AS ldr ON lds.reservation_id = ldr.id
WHERE
ldr.id =#{reservationId} AND ldr.reservation_status != 40 AND ldr.is_deleted = 0
ldr.id = #{reservationId}
AND lds.is_deleted = 0
AND ldr.is_deleted = 0
AND ldr.id IS NOT NULL
AND ldr.reservation_status != '40'
</select>
</mapper>

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

@ -26,10 +26,7 @@ import com.logpm.distribution.dto.app.DistributionAppDeliveryListDTO;
import com.logpm.distribution.entity.*;
import com.logpm.distribution.excel.DistributionDeliveryListExcel;
import com.logpm.distribution.vo.*;
import com.logpm.distribution.vo.app.DistributionAppDeliveryListVO;
import com.logpm.distribution.vo.app.DistributionAppDetailVO;
import com.logpm.distribution.vo.app.DistributionAppParcelListVO;
import com.logpm.distribution.vo.app.DistributionAppStockArticleVO;
import com.logpm.distribution.vo.app.*;
import com.logpm.oldproject.dto.SignPushDataDTO;
import org.apache.ibatis.annotations.Param;
import org.springblade.common.model.PackageData;
@ -507,7 +504,7 @@ public interface DistributionDeliveryListMapper extends BaseMapper<DistributionD
* @param deliveryIds
* @return
*/
List<DistributionAppDeliveryListVO> selectDistributionNewAppDeliveryListPage(@Param("param")DistributionAppDeliveryListDTO distributionDeliveryList,@Param("deliveryIds") List<Long> deliveryIds);
List<DistributionAppNewDeliveryListVO> selectDistributionNewAppDeliveryListPage(@Param("param")DistributionAppDeliveryListDTO distributionDeliveryList, @Param("deliveryIds") List<Long> deliveryIds);
/**
@ -598,6 +595,6 @@ public interface DistributionDeliveryListMapper extends BaseMapper<DistributionD
* @param distributionDeliveryList
* @return
*/
List<Long> selectDeliveyId(DistributionAppDeliveryListDTO distributionDeliveryList);
List<Long> selectDeliveyId(@Param("param") DistributionAppDeliveryListDTO distributionDeliveryList);
}

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

@ -2256,19 +2256,9 @@
SELECT DISTINCT
lddl.id id,
lddl.train_number trainNumber,
ldds.departure_time departureTime,
lddl.type type,
lddl.kind kind,
lddl.vehicle_name vehicleName,
lddl.driver_name driverName,
lddl.vehicle_id vehicleId,
lddl.driver_id driverId,
lddl.delivery_status deliveryStatus,
lddl.preparation_time preparationTime,
lddl.create_time createTime,
lddl.customers_number customersNumber,
lddl.price price,
lddl.added_services_id addedServicesId,
(
SELECT COALESCE
( COUNT(*), 0 )
@ -2291,24 +2281,6 @@
lds.delivery_id = lddl.id
AND ldr.reservation_status != '40'
) deliveryNumber,
lddl.loading_team_id loadingTeamId,
(
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,
lddl.lead_time leadTime,
lddl.order_id orderId,
lddl.fee fee,
lddl.loading_time loadingTime,
lddl.note_number noteNumber,
lddl.source source,
lddl.task_time taskTime,
(
SELECT COALESCE
( sum( ldr.reservation_stock_list_num ), 0 )
@ -2354,13 +2326,20 @@
WHEN '2' THEN '配送中'
ELSE
'已完成'
END deliStatusName,
END deliveryStatusName,
CASE lddl.type
WHEN '1' THEN '商配'
ELSE
'市配'
END typeName,
lddl.is_start
CASE lddl.is_start
WHEN '10' THEN '待发车'
WHEN '20' THEN '部分发车'
WHEN '30' THEN '已发车'
ELSE
'未知'
END isStartName,
lddl.task_time AS taskTime
FROM
logpm_distribution_delivery_list lddl
LEFT JOIN logpm_distribution_delivery_self ldds ON lddl.id = ldds.delivery_id
@ -2697,8 +2676,7 @@
FROM
logpm_distribution_delivery_list AS lddl
WHERE
ldds.is_deleted = 0
AND lddl.is_deleted = 0
lddl.is_deleted = 0
<if test="param.trainNumber != null and param.trainNumber != ''">
AND lddl.train_number LIKE CONCAT('%', #{param.trainNumber}, '%')
</if>

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

@ -25,9 +25,7 @@ import com.logpm.distribution.dto.app.DistributionAppDeliveryListDTO;
import com.logpm.distribution.entity.DistributionParcelListEntity;
import com.logpm.distribution.entity.DistributionReservationEntity;
import com.logpm.distribution.entity.DistributionSignforEntity;
import com.logpm.distribution.excel.DistributionSignforExcel;
import com.logpm.distribution.excel.DistributionSignforInventoryExcel;
import com.logpm.distribution.excel.DistributionSignforOwnExcel;
import com.logpm.distribution.vo.*;
import com.logpm.distribution.vo.app.*;
import com.logpm.oldproject.dto.SignPushDataUnitDTO;
@ -418,4 +416,47 @@ public interface DistributionSignforMapper extends BaseMapper<DistributionSignfo
* @return
*/
List<WaybillLogDTO> getWaybillSignforData(@Param("reservationId")Long reservationId,@Param("userId")Long userId,@Param("userName")String userName);
/**
* 查询PDA签收信息
* @param distributionDeliveryList
* @param deliveryIds
* @return
*/
List<DistributionAppNewDeliveryListVO> selectDistributionNewAppDeliveryListPage(@Param("param")DistributionAppDeliveryListDTO distributionDeliveryList, @Param("deliveryIds") List<Long> deliveryIds);
/**
* 查询
* @param distributionDeliveryList
* @return
*/
List<Long> selectDeliveyId(@Param("param") DistributionAppDeliveryListDTO distributionDeliveryList);
/**
* 查询签收PDA详情
* @param id
* @return
*/
DistributionAppDetailVO selectNewAppDistributionDetail(@Param("deliveryId")Long id);
/**
* 查询配送车次下客户信息
* @param id
* @return
*/
List<DistributionAppNewReservationVO> selectNewAppCustomList(@Param("deliveryId")Long id);
/**
* 查询配送客户详情
* @param id
* @return
*/
DistributionAppNewReservationVO selectNewAppCustom(@Param("reservationId")Long reservationId);
/**
* 查询签收库存盘包件
* @param reservationId
* @return
*/
List<DisStockListDetailVO> selectAppDeliveryInventoryPackage(@Param("reservationId")Long reservationId);
}

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

@ -901,7 +901,8 @@
LEFT JOIN logpm_basicdata_material lbm ON ldsl.material_id = lbm.id
<where>
ldsld.is_deleted = 0
AND ldsld.reservation_id = #{param.reservationId}
AND ldsld.reservation_id = #{reservationId}
AND ldsld.stock_package_status != 2
</where>
</select>
<select id="selectListbyink" resultType="com.logpm.distribution.vo.app.DistributionAppStockArticleVO">
@ -1864,4 +1865,335 @@
GROUP BY
t.waybillNo
</select>
<select id="selectDistributionNewAppDeliveryListPage"
resultType="com.logpm.distribution.vo.app.DistributionAppNewDeliveryListVO">
SELECT DISTINCT
lddl.id id,
lddl.train_number trainNumber,
lddl.vehicle_name vehicleName,
lddl.driver_name driverName,
lddl.customers_number customersNumber,
(
SELECT COALESCE
( COUNT(*), 0 )
FROM
logpm_distribution_signfor lds
LEFT JOIN logpm_distribution_reservation ldr ON lds.reservation_id = ldr.id
AND ldr.reservation_status != '40'
LEFT JOIN logpm_distribution_reservation_stockarticle ldrs ON ldrs.reservation_id = ldr.id
AND ldrs.stock_article_status IN ( 1, 3 )
WHERE
lds.delivery_id = lddl.id
) orderNumber,
(
SELECT COALESCE
( sum( ldr.reservation_num ), 0 )
FROM
logpm_distribution_signfor lds
JOIN logpm_distribution_reservation ldr ON lds.reservation_id = ldr.id
WHERE
lds.delivery_id = lddl.id
AND ldr.reservation_status != '40'
) deliveryNumber,
(
SELECT COALESCE
( sum( ldr.reservation_stock_list_num ), 0 )
FROM
logpm_distribution_signfor lds
JOIN logpm_distribution_reservation ldr ON lds.reservation_id = ldr.id
AND ldr.reservation_status != '40'
WHERE
lds.delivery_id = lddl.id
) inventoryNub,
((
SELECT
IFNUll( sum( loaded_nub ), 0 )
FROM
logpm_distribution_loadscan
WHERE
delivery_id = lddl.id
AND is_deleted = 0
AND scan_status != 1
) + ( SELECT IFNUll( sum( loaded_nub ), 0 ) FROM logpm_distribution_loadscaninvn WHERE delivery_id = lddl.id AND is_deleted = 0 AND scan_status != 1 )
) AS scannedNumber,
((
SELECT
IFNUll( sum( loaded_nub ), 0 )
FROM
logpm_distribution_loadscan
WHERE
delivery_id = lddl.id
AND is_deleted = 0
AND scan_status != 1
AND signfor_state = 2
) + ( SELECT IFNUll( sum( loaded_nub ), 0 ) FROM logpm_distribution_loadscaninvn WHERE delivery_id = lddl.id AND is_deleted = 0 AND scan_status != 1 AND signfor_state = 2)
) AS signforNumber,
(
SELECT
group_concat(
CONCAT( ldr.mall_name, '(', 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 )
AND ldr.reservation_status != '40'
) consignee,
(
SELECT
IFNULL( GROUP_CONCAT( stockup_area ), '无数据' )
FROM
logpm_distribution_stock
WHERE
reservation_id IN ( SELECT reservation_id FROM logpm_distribution_signfor lds WHERE lds.delivery_id = lddl.id )
AND is_deleted = 0
) AS stockupArea,
CASE lddl.delivery_status
WHEN '1' THEN '待配送'
WHEN '2' THEN '配送中'
ELSE
'已完成'
END deliveryStatusName,
CASE lddl.type
WHEN '1' THEN '商配'
ELSE
'市配'
END typeName,
CASE lddl.is_start
WHEN '10' THEN '待发车'
WHEN '20' THEN '部分发车'
WHEN '30' THEN '已发车'
ELSE
'未知'
END isStartName,
lddl.task_time AS taskTime
FROM
logpm_distribution_delivery_list lddl
LEFT JOIN logpm_distribution_delivery_self ldds ON lddl.id = ldds.delivery_id
WHERE
lddl.is_deleted = 0 AND lddl.warehouse_id = #{param.warehouseId}
<if test="deliveryIds != null ">
and lddl.id in
<foreach collection = "deliveryIds" item="item" open="(" close=")" separator=",">
#{item}
</foreach>
</if>
GROUP BY
lddl.id
ORDER BY
lddl.create_time DESC
</select>
<select id="selectDeliveyId" resultType="java.lang.Long">
SELECT
lddl.id
FROM
logpm_distribution_delivery_list AS lddl
WHERE
lddl.is_deleted = 0
<if test="param.trainNumber != null and param.trainNumber != ''">
AND lddl.train_number LIKE CONCAT('%', #{param.trainNumber}, '%')
</if>
AND DATE_FORMAT( lddl.task_time, '%y%m%d' ) BETWEEN DATE_FORMAT( #{param.taskTime_start}, '%y%m%d' ) AND DATE_FORMAT( #{param.taskTime_end}, '%y%m%d' )
AND lddl.warehouse_id = #{param.warehouseId}
</select>
<select id="selectNewAppDistributionDetail"
resultType="com.logpm.distribution.vo.app.DistributionAppDetailVO">
SELECT DISTINCT
lddl.id id,
lddl.train_number trainNumber,
lddl.kind kind,
lddl.vehicle_name vehicleName,
lddl.driver_name driverName,
(
SELECT COALESCE
( COUNT(1), 0 )
FROM
logpm_distribution_signfor lds
LEFT JOIN logpm_distribution_reservation ldr ON lds.reservation_id = ldr.id
AND ldr.reservation_status != '40'
LEFT JOIN logpm_distribution_reservation_stockarticle ldrs ON ldrs.reservation_id = ldr.id
AND ldrs.stock_article_status IN ( 1, 3 )
WHERE
lds.delivery_id = lddl.id
AND lds.is_deleted = 0
) orderNumber,
(
SELECT COALESCE
( sum( ldr.reservation_num +ldr.reservation_stock_list_num ), 0 )
FROM
logpm_distribution_signfor lds
JOIN logpm_distribution_reservation ldr ON lds.reservation_id = ldr.id
WHERE
lds.delivery_id = lddl.id
AND ldr.reservation_status != '40'
AND lds.is_deleted = 0
) deliveryNumber,
(
SELECT COALESCE
( sum( ldr.reservation_stock_list_num ), 0 )
FROM
logpm_distribution_signfor lds
JOIN logpm_distribution_reservation ldr ON lds.reservation_id = ldr.id
AND ldr.reservation_status != '40'
WHERE
lds.delivery_id = lddl.id
) inventoryNub,
((
SELECT
IFNUll( sum( loaded_nub ), 0 )
FROM
logpm_distribution_loadscan
WHERE
delivery_id = lddl.id
AND is_deleted = 0
AND scan_status != 1
) + ( SELECT IFNUll( sum( loaded_nub ), 0 ) FROM logpm_distribution_loadscaninvn WHERE delivery_id = lddl.id AND is_deleted = 0 AND scan_status != 1 )
) AS scannedNumber,
((
SELECT
IFNUll( sum( loaded_nub ), 0 )
FROM
logpm_distribution_loadscan
WHERE
delivery_id = lddl.id
AND is_deleted = 0
AND scan_status != 1
AND signfor_state = 2
) + ( SELECT IFNUll( sum( loaded_nub ), 0 ) FROM logpm_distribution_loadscaninvn WHERE delivery_id = lddl.id AND is_deleted = 0 AND scan_status != 1 AND signfor_state = 2 )
) AS signforNumber,
CASE lddl.delivery_status
WHEN '1' THEN '待配送'
WHEN '2' THEN '配送中'
ELSE
'已完成'
END deliStatusName,
CASE lddl.type
WHEN '1' THEN '商配'
ELSE
'市配'
END typeName,
CASE lddl.is_start
WHEN '10' THEN '待发车'
WHEN '20' THEN '部分发车'
WHEN '30' THEN '已发车'
ELSE
'未知'
END isStartName
FROM
logpm_distribution_delivery_list lddl
LEFT JOIN logpm_distribution_delivery_self ldds ON lddl.id = ldds.delivery_id
WHERE
lddl.is_deleted = 0
AND lddl.id = #{deliveryId}
</select>
<select id="selectNewAppCustomList"
resultType="com.logpm.distribution.vo.app.DistributionAppNewReservationVO">
SELECT
ldr.id id,
GROUP_CONCAT( DISTINCT CONCAT( ldr.receiving_unit, '(', ldr.consignee ), ')' ) AS consignee,
ldr.delivery_phone AS phone,
ldr.delivery_address AS address,
ldr.remarks AS remarks,
COALESCE ( ldr.reservation_num + ldr.reservation_stock_list_num, 0 ) planNumber,
(
SELECT COALESCE
( COUNT( 1 ), 0 )
FROM
logpm_distribution_reservation_stockarticle ldrs
WHERE
ldrs.reservation_id = ldr.id
AND ldrs.stock_article_status IN ( 1, 3 )
) orderNumber,
IFNULL(( SELECT SUM( loaded_nub ) FROM logpm_distribution_loadscan WHERE reservation_id = lds.reservation_id AND is_deleted = 0 AND scan_status != 1 ), 0 ) + IFNULL(( SELECT SUM( loaded_nub ) FROM logpm_distribution_loadscaninvn WHERE reservation_id = lds.reservation_id AND scan_status != 1 AND is_deleted = 0 ), 0 ) AS loadingQuantity,
IFNULL(( SELECT SUM( loaded_nub ) FROM logpm_distribution_loadscan WHERE reservation_id = lds.reservation_id AND is_deleted = 0 AND scan_status != 1 AND signfor_state = 2), 0 ) + IFNULL(( SELECT SUM( loaded_nub ) FROM logpm_distribution_loadscaninvn WHERE reservation_id = lds.reservation_id AND scan_status != 1 AND is_deleted = 0 AND signfor_state = 2 ), 0 ) AS signforQuantity,
( SELECT IFNULL( GROUP_CONCAT( stockup_area ), '无备货区' ) FROM logpm_distribution_stock WHERE reservation_id = ldr.id AND is_deleted = 0 ) AS stockupArea,
IF
((
ldr.reservation_num + ldr.reservation_stock_list_num
) = (SELECT IFNULL(SUM(stock_quantity),0) FROM logpm_distribution_stock WHERE reservation_id = ldr.id),
'是',
'否'
) AS isStock
FROM
logpm_distribution_signfor AS lds
LEFT JOIN logpm_distribution_reservation AS ldr ON lds.reservation_id = ldr.id
WHERE
lds.delivery_id =#{deliveryId}
AND lds.is_deleted = 0
AND ldr.is_deleted = 0
AND ldr.id IS NOT NULL
AND ldr.reservation_status != '40'
GROUP BY
ldr.id
</select>
<select id="selectNewAppCustom" resultType="com.logpm.distribution.vo.app.DistributionAppNewReservationVO">
SELECT
ldr.id id,
GROUP_CONCAT( DISTINCT CONCAT( ldr.receiving_unit, '(', ldr.consignee ), ')' ) AS consignee,
ldr.delivery_phone AS phone,
ldr.delivery_address AS address,
ldr.remarks AS remarks,
COALESCE ( ldr.reservation_num + ldr.reservation_stock_list_num, 0 ) planNumber,
(
SELECT COALESCE
( COUNT( 1 ), 0 )
FROM
logpm_distribution_reservation_stockarticle ldrs
WHERE
ldrs.reservation_id = ldr.id
AND ldrs.stock_article_status IN ( 1, 3 )
) orderNumber,
IFNULL(( SELECT SUM( loaded_nub ) FROM logpm_distribution_loadscan WHERE reservation_id = lds.reservation_id AND is_deleted = 0 AND scan_status != 1 ), 0 ) + IFNULL(( SELECT SUM( loaded_nub ) FROM logpm_distribution_loadscaninvn WHERE reservation_id = lds.reservation_id AND scan_status != 1 AND is_deleted = 0 ), 0 ) AS loadingQuantity,
IFNULL(( SELECT SUM( loaded_nub ) FROM logpm_distribution_loadscan WHERE reservation_id = lds.reservation_id AND is_deleted = 0 AND scan_status != 1 AND signfor_state = 2), 0 ) + IFNULL(( SELECT SUM( loaded_nub ) FROM logpm_distribution_loadscaninvn WHERE reservation_id = lds.reservation_id AND scan_status != 1 AND is_deleted = 0 AND signfor_state = 2 ), 0 ) AS signforQuantity,
( SELECT IFNULL( GROUP_CONCAT( stockup_area ), '无备货区' ) FROM logpm_distribution_stock WHERE reservation_id = ldr.id AND is_deleted = 0 ) AS stockupArea,
IF
((
ldr.reservation_num + ldr.reservation_stock_list_num
) = (SELECT IFNULL(SUM(stock_quantity),0) FROM logpm_distribution_stock WHERE reservation_id = ldr.id),
'是',
'否'
) AS isStock
FROM
logpm_distribution_signfor AS lds
LEFT JOIN logpm_distribution_reservation AS ldr ON lds.reservation_id = ldr.id
WHERE
ldr.id = #{reservationId}
AND lds.is_deleted = 0
AND ldr.is_deleted = 0
AND ldr.id IS NOT NULL
AND ldr.reservation_status != '40'
</select>
<select id="selectAppDeliveryInventoryPackage" resultType="com.logpm.distribution.vo.DisStockListDetailVO">
SELECT
ldsl.id id,
ldsl.sku sku,
ldsld.stock_locking_status sku,
CASE ldsld.stock_signfo_status
WHEN '10' THEN '待签收'
WHEN '20' THEN '已签收'
ELSE
'未知'
END signingStatusName,
CASE ldsld.stock_locking_status
WHEN '10' THEN '待装车'
WHEN '20' THEN '已装车'
ELSE
'未知'
END loadingStatusName,
ldsl.cargo_number cargoNumber,
ldsl.description_goods descriptionGoods,
lbm.specification cargoNorms,
lbm.logpm_unit cargoUnit,
ldsld.stock_package_code AS orderPackageCode
FROM
logpm_dis_stock_list_detail AS ldsld
LEFT JOIN logpm_distribution_stock_list AS ldsl ON ldsld.stock_list_id = ldsl.id
LEFT JOIN logpm_distribution_loadscaninvn ldl ON ldsl.id = ldl.inventory_id AND ldsld.id =
ldl.inventory_package_id
LEFT JOIN logpm_basicdata_material lbm ON ldsl.material_id = lbm.id
where
ldsld.is_deleted = 0
AND ldsld.reservation_id = #{reservationId}
AND ldsld.stock_package_status != 2
</select>
</mapper>

7
blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/IDistributionDeliveryListService.java

@ -141,7 +141,10 @@ public interface IDistributionDeliveryListService extends BaseService<Distributi
* @param distributionDeliveryList
* @return
*/
R selectDistributionAppDeliveryListNewPage(IPage<Object> page, DistributionAppDeliveryListDTO distributionDeliveryList);
R selectDistributionAppDeliveryListNewPage(DistributionAppDeliveryListDTO distributionDeliveryList);
Boolean judgeIsDriver(BladeUser user);
/**
* App-配送管理 详情
*/
@ -502,7 +505,7 @@ public interface IDistributionDeliveryListService extends BaseService<Distributi
* @param distributionDeliveryList
* @return
*/
R getNewAppDeliveryreservationListPage(DistributionAppDeliveryListDTO distributionDeliveryList);
R getNewAppDeliveryreservationList(DistributionAppDeliveryListDTO distributionDeliveryList);
/**
* 配送详情

17
blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/IDistributionSignforService.java

@ -383,4 +383,21 @@ public interface IDistributionSignforService extends BaseService<DistributionSig
* @return
*/
R newSignfor(DistrilbutionAppsignforDTO distrilbutionloadingscanDTO);
/**
* 查询签收列表数据
* @param distributionDeliveryList
* @return
*/
R selectDistributionNewAppDeliveryListPage(DistributionAppDeliveryListDTO distributionDeliveryList);
/**
* 查询客户详情
* @param distributionDeliveryList
* @return
*/
R selectNewAppDeliveryCustom(DistributionAppDeliveryListDTO distributionDeliveryList);
R selectNewAppDeliveryCustomDetail(DistributionAppDeliveryListDTO distributionAppDeliveryListDTO);
}

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

@ -30,9 +30,9 @@ import com.logpm.distribution.excel.DistributionDeliveryInfoExcel;
import com.logpm.distribution.mapper.*;
import com.logpm.distribution.service.*;
import com.logpm.distribution.vo.*;
import com.logpm.distribution.vo.app.DistributionAppNewReservationVO;
import com.logpm.distribution.vo.app.DistributionAppParcelListVO;
import com.logpm.distribution.vo.app.DistributionAppStockArticleVO;
import com.logpm.distribution.vo.app.ReservationAppDetailVO;
import com.logpm.distribution.wrapper.DistributionDisStockListWrapper;
import com.logpm.distribution.wrapper.DistributionParcelListWrapper;
import lombok.AllArgsConstructor;
@ -717,7 +717,7 @@ public class DistributionDeliveryInfoServiceImpl extends BaseServiceImpl<Distrib
BasicdataWarehouseEntity myCurrentWarehouse = basicdataWarehouseClient.getMyCurrentWarehouse();
//查询预约信息
Long reservationId = Long.parseLong(distributionAppDeliveryListDTO.getReservationId());
ReservationAppDetailVO reservationAppDetailVO = baseMapper.selectAppReservationDistributionDetail(reservationId);
DistributionAppNewReservationVO reservationAppDetailVO = baseMapper.selectNewAppcustom(reservationId);
if (Objects.isNull(reservationAppDetailVO)) {
log.error(method + "查询预约计划失败:{}", distributionAppDeliveryListDTO.getReservationId());
return R.fail("参数错误,联系管理员");
@ -828,7 +828,7 @@ public class DistributionDeliveryInfoServiceImpl extends BaseServiceImpl<Distrib
distributionAppStockArticleVOS.add(appStockArticleVO);
});
}
reservationAppDetailVO.setDistributionAppStockArticleVOS(distributionAppStockArticleVOS);
reservationAppDetailVO.setOrderList(distributionAppStockArticleVOS);
}
//零担
@ -899,7 +899,7 @@ public class DistributionDeliveryInfoServiceImpl extends BaseServiceImpl<Distrib
orderInfo.remove(distributionAppZeroStockArticleVO.getId());
}
}
reservationAppDetailVO.setDistributionAppZeroStockArticleVOS(distributionAppZeroStockArticleVOS);
reservationAppDetailVO.setZeroOrderList(distributionAppZeroStockArticleVOS);
}
@ -934,8 +934,10 @@ public class DistributionDeliveryInfoServiceImpl extends BaseServiceImpl<Distrib
sd.setCargoNumber(distributionStockListEntity.getCargoNumber());
}
});
reservationAppDetailVO.setDisStockListDetailVOS(disStockListDetailVOS);
reservationAppDetailVO.setInventoryList(disStockListDetailVOS);
}
//查询库存品
return R.data(reservationAppDetailVO);
}
}

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

@ -2216,9 +2216,9 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl<Distrib
}
@Override
public R selectDistributionAppDeliveryListNewPage(IPage<Object> page, DistributionAppDeliveryListDTO distributionDeliveryList) {
public R selectDistributionAppDeliveryListNewPage(DistributionAppDeliveryListDTO distributionDeliveryList) {
String method = "######################################DistributionDeliveryListServiceImpl.selectDistributionAppDeliveryListNewPage";
List<DistributionAppDeliveryListVO> distributionAppDeliveryListVOS = new ArrayList<>();
List<DistributionAppNewDeliveryListVO> distributionAppNewDeliveryListVOS = new ArrayList<>();
//参数校验
if (Objects.isNull(distributionDeliveryList.getType())) {
@ -2262,37 +2262,25 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl<Distrib
distributionDeliveryList.setDriverId(driverArtery.getId() + "");
List<Long> deliveryIds = distributionDeliverySelfMapper.selectNewDeliveryList(distributionDeliveryList);
if (!deliveryIds.isEmpty()) {
distributionAppDeliveryListVOS = baseMapper.selectDistributionNewAppDeliveryListPage(distributionDeliveryList, deliveryIds);
distributionAppNewDeliveryListVOS = baseMapper.selectDistributionNewAppDeliveryListPage(distributionDeliveryList, deliveryIds);
} else {
return R.data(null);
}
} else {
//查询当前时间范围内的配送ID
List<Long> deliveryIds = baseMapper.selectDeliveyId(distributionDeliveryList);
distributionAppDeliveryListVOS = baseMapper.selectDistributionNewAppDeliveryListPage(distributionDeliveryList, deliveryIds);
}
// for (DistributionAppDeliveryListVO distributionAppDeliveryListVO : distributionAppDeliveryListVOS) {
// //查询是否备货
// distributionAppDeliveryListVO.setIsstock("备货未完成");
// List<DistributionStockEntity> stockEntityList = distributionStockMapper.selectList(new QueryWrapper<DistributionStockEntity>().lambda()
// .eq(DistributionStockEntity::getReservationId, distributionAppDeliveryListVO.getReservationId()));
// if (Func.isNotEmpty(stockEntityList)) {
// //配送件数
// Integer deliveryNumber = distributionAppDeliveryListVO.getDeliveryNumber();
// int sum = stockEntityList.stream().mapToInt(DistributionStockEntity::getStockQuantity).sum();
// if (sum == deliveryNumber) {
// distributionAppDeliveryListVO.setIsstock("备货完成");
// }
// }
// }
if (!deliveryIds.isEmpty()) {
distributionAppNewDeliveryListVOS = baseMapper.selectDistributionNewAppDeliveryListPage(distributionDeliveryList, deliveryIds);
}
}
} catch (Exception e) {
throw new ServiceException(String.valueOf(e));
}
return R.data(distributionAppDeliveryListVOS);
return R.data(distributionAppNewDeliveryListVOS);
}
private Boolean judgeIsDriver(BladeUser user) {
@Override
public Boolean judgeIsDriver(BladeUser user) {
boolean delivery = false;
String roleId = user.getRoleId();
String value1 = DictBizCache.getValue("role_class", "delivery_driver_new");
@ -7983,7 +7971,7 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl<Distrib
if (DeliveryStatusConstant.yiwancheng.getValue().equals(distributionDeliveryListEntity.getDeliveryStatus())) {
return Resp.scanFail("该任务已完结!", "该任务已完结!");
}
if (Integer.parseInt(IsOrNoConstant.no.getValue()) == distributionDeliveryListEntity.getIsStart()) {
if (DeliveryStartStatusConstant.daifache.getValue().equals(distributionDeliveryListEntity.getIsStart())) {
return Resp.scanFail("当前任务未发车!", "当前任务未发车!");
}
//校验当前人是否为司机
@ -8490,7 +8478,7 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl<Distrib
}
@Override
public R getNewAppDeliveryreservationListPage(DistributionAppDeliveryListDTO distributionDeliveryList) {
public R getNewAppDeliveryreservationList(DistributionAppDeliveryListDTO distributionDeliveryList) {
String method = "######################DistributionDeliveryListServiceImpl.getNewAppDeliveryreservationListPage";
if (Objects.isNull(distributionDeliveryList.getId())) {
log.error(method + "id参数缺失");
@ -8499,11 +8487,10 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl<Distrib
DistributionAppDetailVO detailVO = baseMapper.selectNewAppDistributionDetail(distributionDeliveryList.getId());
BasicdataWarehouseEntity myCurrentWarehouse = warehouseClient.getMyCurrentWarehouse();
List<DistributionAppReservationVO> customList = distributionDeliveryInfoMapper.selectNewAppcustomListPage(distributionDeliveryList.getId());
for (DistributionAppReservationVO distributionAppReservationVO : customList) {
List<DistributionAppNewReservationVO> customList = distributionDeliveryInfoMapper.selectNewAppcustomList(distributionDeliveryList.getId());
for (DistributionAppNewReservationVO distributionAppReservationVO : customList) {
int trayNum = 0;
if (!Objects.isNull(myCurrentWarehouse)) {
// List<WarehouseTrayGoodsEntity> trayList = new ArrayList<>();
//查询满足条件的托盘码
List<DistributionParcelListEntity> distributionParcelListEntities = distributionReservationMapper.selectPackageListByReservationId(distributionAppReservationVO.getId());
if (Func.isNotEmpty(distributionParcelListEntities)) {
@ -8527,7 +8514,7 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl<Distrib
}
//统计满足条件的托盘
}
distributionAppReservationVO.setTrayNum(trayNum);
distributionAppReservationVO.setTrayNumber(trayNum);
}
detailVO.setCustomList(customList);
return R.data(detailVO);

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

@ -55,6 +55,7 @@ import com.logpm.oldproject.feign.IWarehouseClient;
import com.logpm.trunkline.dto.WaybillLogDTO;
import com.logpm.trunkline.feign.ITrunklinePackageTrackLogClient;
import com.logpm.trunkline.feign.ITrunklineWaybillTrackClient;
import com.logpm.warehouse.entity.WarehouseTrayGoodsEntity;
import com.logpm.warehouse.feign.IWarehouseUpdownStockUpAreaClient;
import com.logpm.warehouse.feign.IWarehouseUpdownTypeClient;
import lombok.extern.slf4j.Slf4j;
@ -69,7 +70,6 @@ import org.springblade.common.constant.WorkNodeEnums;
import org.springblade.common.constant.billLading.BillLadingStatusConstant;
import org.springblade.common.constant.common.IsOrNoConstant;
import org.springblade.common.constant.delivery.DeliveryLoadingStatusConstant;
import org.springblade.common.constant.delivery.DeliveryStartStatusConstant;
import org.springblade.common.constant.delivery.DeliveryStatusConstant;
import org.springblade.common.constant.loading.*;
import org.springblade.common.constant.orderpackage.*;
@ -89,6 +89,7 @@ import org.springblade.common.serviceConstant.ServiceConstant;
import org.springblade.common.utils.CommonUtil;
import org.springblade.common.utils.FileUtil;
import org.springblade.common.utils.GaoDeApiUtil;
import org.springblade.core.log.exception.ServiceException;
import org.springblade.core.log.feign.ILogClient;
import org.springblade.core.log.model.LogError;
import org.springblade.core.mp.base.BaseServiceImpl;
@ -119,6 +120,9 @@ import java.io.IOException;
import java.math.BigDecimal;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.time.YearMonth;
import java.time.format.DateTimeFormatter;
import java.time.temporal.ChronoUnit;
import java.util.*;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.concurrent.atomic.AtomicReference;
@ -7346,6 +7350,8 @@ public class DistributionSignforServiceImpl extends BaseServiceImpl<Distribution
if (Objects.isNull(myCurrentWarehouse)) {
return R.fail(403, "仓库信息不能为空");
}
String now = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS").format(new Date());
Long deliveryId = distrilbutionloadingscanDTO.getDeliveryId();
Long reservationId = distrilbutionloadingscanDTO.getReservationId();
Integer type = distrilbutionloadingscanDTO.getType();
@ -7380,6 +7386,7 @@ public class DistributionSignforServiceImpl extends BaseServiceImpl<Distribution
List<Long> packageLockIds = new ArrayList<>();
List<String> orderCodes = new ArrayList<>();
List<DistributionLoadscanEntity> pushList = new ArrayList<>();
List<DistributionLoadscaninvnEntity> pushInventoryList = new ArrayList<>();
//配置项
boolean isConfig = false;
DistributionDeliverySelfEntity distributionDeliverySelfEntity = new DistributionDeliverySelfDTO();
@ -7554,7 +7561,6 @@ public class DistributionSignforServiceImpl extends BaseServiceImpl<Distribution
Integer handQuantity = 0;
Integer outboundQuantity = 0;
Integer signinQuantity = 0;
if (Func.isNotEmpty(loadingMap)) {
//存在装车数据,进行是否签收判断
List<DistributionLoadscanEntity> entityList = loadingMap.get(parcelNumberDTO.getParcelListId());
@ -7579,11 +7585,11 @@ public class DistributionSignforServiceImpl extends BaseServiceImpl<Distribution
distributionLoadscanEntity.setWarehouseName(myCurrentWarehouse.getName());
distributionLoadscanEntity.setReceivedQuantity(parcelNumberDTO.getSigningNum());
distributionLoadscanEntity.setSignforState(LoadScanSigningStatusConstant.yiqianshou.getValue());
distributionLoadscanEntity.setScanTime(simpleDateFormat.format(new Date()));
distributionLoadscanEntity.setScanTime(now);
distributionLoadscanEntity.setSigningUser(user.getNickName());
distributionLoadscanEntity.setSigningUserId(user.getUserId());
distributionLoadscanEntity.setSignforType(LoadScanSigningTypeStatusConstant.sijiqianshou.getValue());
distributionLoadscanEntity.setSigningTime(simpleDateFormat.format(new Date()));
distributionLoadscanEntity.setSigningTime(now);
distributionLoadscanEntity.setSigningUser(user.getNickName());
loadedNumber += parcelNumberDTO.getSigningNum();
receivedQuantity += parcelNumberDTO.getSigningNum();
@ -7611,7 +7617,7 @@ public class DistributionSignforServiceImpl extends BaseServiceImpl<Distribution
loadscanEntity.setScanUser(user.getNickName());
loadscanEntity.setWarehouseId(myCurrentWarehouse.getId());
loadscanEntity.setWarehouseName(myCurrentWarehouse.getName());
loadscanEntity.setScanTime(simpleDateFormat.format(new Date()));
loadscanEntity.setScanTime(now);
loadscanEntity.setSigningUser(user.getNickName());
loadscanEntity.setPackageNub(parcelNumberDTO.getSigningNum());
loadscanEntity.setLoadedNub(parcelNumberDTO.getSigningNum());
@ -7642,7 +7648,7 @@ public class DistributionSignforServiceImpl extends BaseServiceImpl<Distribution
loadscanEntity.setReceivedQuantity(parcelNumberDTO.getSigningNum());
loadscanEntity.setOneClick(2);
loadscanEntity.setOneQclick(2);
loadscanEntity.setSigningTime(simpleDateFormat.format(new Date()));
loadscanEntity.setSigningTime(now);
distributionLoadscanService.save(loadscanEntity);
pushList.add(loadscanEntity);
loadedNumber += loadscanEntity.getLoadedNub();
@ -7653,7 +7659,7 @@ public class DistributionSignforServiceImpl extends BaseServiceImpl<Distribution
outboundQuantity = distributionParcelNumberEntity.getOutboundQuantity() + parcelNumberDTO.getSigningNum();
signinQuantity = distributionParcelNumberEntity.getSigninQuantity() + parcelNumberDTO.getSigningNum();
JSONObject jsonObject = new JSONObject();
jsonObject.put("code", parcelListEntity.getOrderCode());
jsonObject.put("code", zeroParcelListEntity.getOrderCode());
jsonObject.put("warehouseId", myCurrentWarehouse.getId());
jsonObject.put("taskId", loadscanEntity.getReservationId());
jsonObject.put("type", 3);
@ -7692,6 +7698,7 @@ public class DistributionSignforServiceImpl extends BaseServiceImpl<Distribution
log.error(method + "Barcode参数缺失");
return Resp.scanFail("参数缺失,请联系管理员", "参数缺失,请联系管理员");
}
//库存品
List<DisStockListDetailEntity> detailEntities = distributionReservationMapper.selectInventoryListByReservation(distrilbutionloadingscanDTO.getReservationId());
if (detailEntities.isEmpty()) {
@ -7705,7 +7712,8 @@ public class DistributionSignforServiceImpl extends BaseServiceImpl<Distribution
if (isHaveCode) {
return Resp.scanFail("库存品未备货","库存品未备货");
}
List<DisStockListDetailEntity> inventoryPakcgaeList = detailEntities.stream().filter(f -> barcode.equals(f.getStockPackageCode())).collect(Collectors.toList());
String finalBarcode = distrilbutionloadingscanDTO.getBarcode();
List<DisStockListDetailEntity> inventoryPakcgaeList = detailEntities.stream().filter(f -> finalBarcode.equals(f.getStockPackageCode())).collect(Collectors.toList());
if (!inventoryPakcgaeList.isEmpty()) {
if (inventoryPakcgaeList.size() == 1) {
DisStockListDetailEntity disStockListDetailEntity = inventoryPakcgaeList.get(0);
@ -7714,15 +7722,96 @@ public class DistributionSignforServiceImpl extends BaseServiceImpl<Distribution
.eq(DistributionLoadscaninvnEntity::getDeliveryId, distrilbutionloadingscanDTO.getDeliveryId())
.eq(DistributionLoadscaninvnEntity::getOrderPackageCode, distrilbutionloadingscanDTO.getBarcode())
.ne(DistributionLoadscaninvnEntity::getScanStatus, 1));
if (Func.isNotEmpty(loadscaninvnEntity)) {
if (loadscaninvnEntity.getSignforState().equals(LoadScanSigningStatusConstant.yiqianshou.getValue())) {
return Resp.scanFail("重复扫描", "重复扫描");
}
// 库存品进行装车,这里需要对库存品扫描数据进行签收的状态标记
loadscaninvnEntity.setSigningUserId(user.getUserId());
loadscaninvnEntity.setSigningUser(user.getNickName());
loadscaninvnEntity.setReceivedQuantity(disStockListDetailEntity.getNum());
loadscaninvnEntity.setSignforState(LoadScanSigningStatusConstant.yiqianshou.getValue());
loadscaninvnEntity.setSigningTime(now);
loadscaninvnEntity.setOneQclick(1);
packageLockIds.add(loadscaninvnEntity.getInventoryPackageId());
distributionLoadscaninvnService.updateById(loadscaninvnEntity);
pushInventoryList.add(loadscaninvnEntity);
//维护签收数量
distributionSignforMapper.updatesignforByinvn(loadscaninvnEntity.getDeliveryId(), loadscaninvnEntity.getReservationId(), loadscaninvnEntity.getPackageNub());
//更新签收人
distributionSignforMapper.updateSignUser(loadscaninvnEntity.getDeliveryId(), loadscaninvnEntity.getReservationId(), user);
} else {
//库存品未进行装车
//这里装车的数据需要进行补录
DistributionLoadscaninvnEntity distributionLoadscaninvnEntity = new DistributionLoadscaninvnEntity();
if (Func.isNotEmpty(distributionDeliverySelfEntity.getDriverId())) {
distributionLoadscaninvnEntity.setDriverId(distributionDeliverySelfEntity.getDriverId());
}
if (Func.isNotEmpty(distributionDeliverySelfEntity.getDriverName())) {
distributionLoadscaninvnEntity.setDriverName(distributionDeliverySelfEntity.getDriverName());
}
if (Func.isNotEmpty(distributionDeliverySelfEntity.getVehicleId())) {
distributionLoadscaninvnEntity.setVehicleId(distributionDeliverySelfEntity.getVehicleId());
}
if (Func.isNotEmpty(distributionDeliverySelfEntity.getVehicleNub())) {
distributionLoadscaninvnEntity.setVehicleName(distributionDeliverySelfEntity.getVehicleNub());
}
if (Func.isNotEmpty(distributionDeliverySelfEntity.getDriverPhone())) {
distributionLoadscaninvnEntity.setDriverPhone(distributionDeliverySelfEntity.getDriverPhone());
}
distributionLoadscaninvnEntity.setLoadingId(distributionDeliverySelfEntity.getId().toString());
distributionLoadscaninvnEntity.setOrderPackageCode(disStockListDetailEntity.getStockPackageCode());
distributionLoadscaninvnEntity.setInventoryId(disStockListDetailEntity.getStockListId());
distributionLoadscaninvnEntity.setInventoryPackageId(disStockListDetailEntity.getId());
distributionLoadscaninvnEntity.setDeliveryId(distrilbutionloadingscanDTO.getDeliveryId());
distributionLoadscaninvnEntity.setReservationId(distrilbutionloadingscanDTO.getReservationId());
distributionLoadscaninvnEntity.setScanUser(user.getNickName());
distributionLoadscaninvnEntity.setScanTime(now);
distributionLoadscaninvnEntity.setPackageNub(disStockListDetailEntity.getNum());
distributionLoadscaninvnEntity.setScanStatus(LoadingStatusConstant.saomiao.getValue());
distributionLoadscaninvnEntity.setIsInsert(LoadingIsInsertConstant.bulu.getValue());
distributionLoadscaninvnEntity.setScanType("1");
distributionLoadscaninvnEntity.setType(2);
distributionLoadscaninvnEntity.setWarehouseId(myCurrentWarehouse.getId());
distributionLoadscaninvnEntity.setWarehouseName(myCurrentWarehouse.getName());
distributionLoadscaninvnEntity.setSignforState(LoadScanSigningStatusConstant.yiqianshou.getValue());
distributionLoadscaninvnEntity.setIsSignfor(1);
distributionLoadscaninvnEntity.setReceivedQuantity(disStockListDetailEntity.getNum());
distributionLoadscaninvnEntity.setOneClick(1);
distributionLoadscaninvnEntity.setOneQclick(1);
distributionLoadscaninvnEntity.setLoadedNub(1);
distributionLoadscaninvnEntity.setSigningUser(user.getNickName());
distributionLoadscaninvnEntity.setSigningUserId(user.getUserId());
distributionLoadscaninvnEntity.setSigningTime(now);
distributionLoadscaninvnService.save(distributionLoadscaninvnEntity);
pushInventoryList.add(distributionLoadscaninvnEntity);
//更新装车数量
Integer j = distributionSignforMapper.updateLoadAndsignforByinvn(distributionLoadscaninvnEntity.getDeliveryId(), distributionLoadscaninvnEntity.getReservationId(), distributionLoadscaninvnEntity.getPackageNub());
//更新签收人
Integer i = distributionSignforMapper.updateSignUser(distributionLoadscaninvnEntity.getDeliveryId(), distributionLoadscaninvnEntity.getReservationId(), AuthUtil.getUser());
//扣减库存
distributionStockListMapper.deductionQuantityStock(distributionLoadscaninvnEntity.getInventoryId(), distributionLoadscaninvnEntity.getLoadedNub());
packageLockIds.add(distributionLoadscaninvnEntity.getInventoryPackageId());
// //扣减库存
List<JSONObject> jsonObjects = new ArrayList<>();
JSONObject jsonObject = new JSONObject();
jsonObject.put("code", distributionLoadscaninvnEntity.getOrderPackageCode());
jsonObject.put("warehouseId", myCurrentWarehouse.getId());
jsonObject.put("taskId", distributionLoadscaninvnEntity.getReservationId());
jsonObject.put("type", 2);
jsonObject.put("num", 1);
jsonObject.put("remark", "签收下架");
jsonObjects.add(jsonObject);
warehouseUpdownStockUpAreaClient.downStockUpShelf(jsonObjects);
}
//进行库存品包件状态维护
disStockListDetailEntity.setStockLockingStatus(InventoryLoadingStatusConstant.yizhuangche.getValue());
disStockListDetailEntity.setStockSignfoStatus(InventorySigningStatusConstant.yiqianshou.getValue());
disStockListDetailService.updateById(disStockListDetailEntity);
}
}
break;
}
if (!packageLockIds.isEmpty()) {
List<Long> a = bladeRedis.get("warehouseId:" + myCurrentWarehouse.getId() + "trainNumber:" + deliveryListEntity.getTrainNumber() + "orderPackageCode:" + packageLockIds);
@ -7739,6 +7828,17 @@ public class DistributionSignforServiceImpl extends BaseServiceImpl<Distribution
bladeRedis.setEx("warehouseId:" + myCurrentWarehouse.getId() + "trainNumber:" + deliveryListEntity.getTrainNumber() + "orderPackageCode:" + packageLockIds, packageLockIds, 60L);
}
}
if (!pushInventoryList.isEmpty()) {
// 作业节点数据推送
NodeFanoutMsg<org.springblade.common.model.DistributionSignforVO> nodeFanoutMsg = buildDistributionSignforVOByStock(deliveryListEntity, pushInventoryList);
iDistributionNodeWorkService.signFor(nodeFanoutMsg, AuthUtil.getUser());
}
if (!pushList.isEmpty()) {
// 构建新作业节点回传
NodeFanoutMsg<org.springblade.common.model.DistributionSignforVO> nodeFanoutMsg = buildDistributionSignforVO(deliveryListEntity,reservationEntity, pushList);
iDistributionNodeWorkService.signFor(nodeFanoutMsg, AuthUtil.getUser());
}
if (!orderCodes.isEmpty()) {
String collect = orderCodes.stream().distinct().collect(Collectors.joining(","));
distributionStockArticleService.maintenanceOrderInfo(collect, myCurrentWarehouse.getId());
@ -7748,6 +7848,270 @@ public class DistributionSignforServiceImpl extends BaseServiceImpl<Distribution
return Resp.scanSuccess("签收成功", str);
}
@Override
public R selectDistributionNewAppDeliveryListPage(DistributionAppDeliveryListDTO distributionDeliveryList) {
String method = "######################################DistributionSignforServiceImpl.selectDistributionNewAppDeliveryListPage";
List<DistributionAppNewDeliveryListVO> distributionAppSignforDeliveryListVOS = new ArrayList<>();
//参数校验
if (Objects.isNull(distributionDeliveryList.getType())) {
log.error(method + "type>>参数缺失");
throw new ServiceException("参数缺失");
}
if (Objects.isNull(distributionDeliveryList.getTaskTime_start())) {
log.error(method + "TaskTime_start>>参数缺失");
throw new ServiceException("参数缺失");
}
if (Objects.isNull(distributionDeliveryList.getTaskTime_end())) {
log.error(method + "TaskTime_start>>参数缺失");
throw new ServiceException("参数缺失");
}
BasicdataWarehouseEntity myCurrentWarehouse = basicdataWarehouseClient.getMyCurrentWarehouse();
if (Objects.isNull(myCurrentWarehouse)) {
log.error(method + "TaskTime_start>>参数缺失");
throw new ServiceException("参数缺失");
}
YearMonth parse = YearMonth.parse(distributionDeliveryList.getTaskTime_start(), DateTimeFormatter.ISO_DATE);
YearMonth parse1 = YearMonth.parse(distributionDeliveryList.getTaskTime_end(), DateTimeFormatter.ISO_DATE);
long until = parse.until(parse1, ChronoUnit.MONTHS);
if (until != 0) {
log.error(method + "列表搜索时间范围大于一个月");
return Resp.fail("最大区间为一个月,请缩小搜索范围");
}
distributionDeliveryList.setWarehouseId(myCurrentWarehouse.getId());
//查询当前登录人满足的配送计划
//获取当前登录人
BladeUser user = AuthUtil.getUser();
//判断当前登录人是否为司机
Boolean delivery = distributionDeliveryListService.judgeIsDriver(user);
if (delivery) {
//查询当前登录人的配送任务
BasicdataDriverArteryEntity driverArtery = iBasicdataDriverArteryClient.getDriverArtery(user.getUserId());
if (null == driverArtery) {
log.error("没有司机的信息!!");
throw new CustomerException("没有司机的信息");
}
//查询司机的任务
distributionDeliveryList.setDriverId(driverArtery.getId() + "");
List<Long> deliveryIds = distributionDeliverySelfMapper.selectNewDeliveryList(distributionDeliveryList);
if (!deliveryIds.isEmpty()) {
distributionAppSignforDeliveryListVOS = baseMapper.selectDistributionNewAppDeliveryListPage(distributionDeliveryList, deliveryIds);
} else {
return R.data(null);
}
} else {
//查询当前时间范围内的配送ID
List<Long> deliveryIds = baseMapper.selectDeliveyId(distributionDeliveryList);
if (!deliveryIds.isEmpty()) {
distributionAppSignforDeliveryListVOS = baseMapper.selectDistributionNewAppDeliveryListPage(distributionDeliveryList, deliveryIds);
}
}
return R.data(distributionAppSignforDeliveryListVOS);
}
@Override
public R selectNewAppDeliveryCustom(DistributionAppDeliveryListDTO distributionDeliveryList) {
String method = "######################DistributionDeliveryListServiceImpl.getNewAppDeliveryreservationListPage";
if (Objects.isNull(distributionDeliveryList.getId())) {
log.error(method + "id参数缺失");
return R.fail("请求错误,请联系管理员");
}
DistributionAppDetailVO detailVO = baseMapper.selectNewAppDistributionDetail(distributionDeliveryList.getId());
List<DistributionAppNewReservationVO> customList = baseMapper.selectNewAppCustomList(distributionDeliveryList.getId());
detailVO.setCustomList(customList);
return R.data(detailVO);
}
@Override
public R selectNewAppDeliveryCustomDetail(DistributionAppDeliveryListDTO distributionAppDeliveryListDTO) {
String method = "#############################################DistributionDeliverySignforServiceImpl.selectDistributionNewAppDeliveryorder";
if (Objects.isNull(distributionAppDeliveryListDTO.getReservationId())) {
log.error(method + "reservationId参数缺失");
return R.fail("参数错误,联系管理员");
}
//查询预约信息
Long reservationId = Long.parseLong(distributionAppDeliveryListDTO.getReservationId());
DistributionAppNewReservationVO reservationAppDetailVO = baseMapper.selectNewAppCustom(reservationId);
if (Objects.isNull(reservationAppDetailVO)) {
log.error(method + "查询预约计划失败:{}", distributionAppDeliveryListDTO.getReservationId());
return R.fail("参数错误,联系管理员");
}
List<DistributionAppStockArticleVO> orderList = new ArrayList<>();
List<DistributionAppStockArticleVO> zeroOrderList = new ArrayList<>();
//查询该客户装车
List<DistributionLoadscanEntity> distributionLoadscanEntities = distributionLoadscanService.list(Wrappers.<DistributionLoadscanEntity>query().lambda()
.eq(DistributionLoadscanEntity::getReservationId, reservationId)
.ne(DistributionLoadscanEntity::getScanStatus, LoadingStatusConstant.quxiao.getValue()));
//查询计划
List<DistributionReservationStockarticleEntity> reservationStockarticleEntityList = distributionReservationStockarticleService.list(Wrappers.<DistributionReservationStockarticleEntity>query().lambda()
.eq(DistributionReservationStockarticleEntity::getReservationId, reservationId)
.ne(DistributionReservationStockarticleEntity::getStockArticleStatus, ReservationOrderStatusConstant.quxiao.getValue()));
List<Long> orderIds = new ArrayList<>();
if (Func.isNotEmpty(distributionLoadscanEntities)) {
//进行订单分类
List<Long> loadingOrderIds = distributionLoadscanEntities.stream().map(DistributionLoadscanEntity::getOrderId).collect(Collectors.toList());
orderIds.addAll(loadingOrderIds);
}
if (Func.isNotEmpty(reservationStockarticleEntityList)) {
//截取计划订单ID
List<Long> reservationOrderIds = reservationStockarticleEntityList.stream().map(DistributionReservationStockarticleEntity::getStockArticleId).collect(Collectors.toList());
orderIds.addAll(reservationOrderIds);
}
Map<Long, List<DistributionReservationStockarticleEntity>> reservationOrderMap = reservationStockarticleEntityList.stream().collect(Collectors.groupingBy(DistributionReservationStockarticleEntity::getStockArticleId));
Map<Long, List<DistributionLoadscanEntity>> loadingOrderMap = distributionLoadscanEntities.stream().collect(Collectors.groupingBy(DistributionLoadscanEntity::getOrderId));
if (Func.isNotEmpty(orderIds)) {
orderIds = orderIds.stream().distinct().collect(Collectors.toList());
List<DistributionStockArticleEntity> distributionStockArticleEntities = distributionStockArticleService.listByIds(orderIds);
List<DistributionReservationStockarticleEntity> reservationOrders = distributionReservationStockarticleService.list(Wrappers.<DistributionReservationStockarticleEntity>query().lambda()
.eq(DistributionReservationStockarticleEntity::getReservationId, reservationId)
.in(DistributionReservationStockarticleEntity::getStockArticleId, orderIds)
.ne(DistributionReservationStockarticleEntity::getStockArticleStatus, ReservationOrderStatusConstant.quxiao.getValue())
);
for (DistributionStockArticleEntity distributionStockArticleEntity : distributionStockArticleEntities) {
DistributionAppStockArticleVO distributionAppStockArticleVO = Func.copy(distributionStockArticleEntity, DistributionAppStockArticleVO.class);
assert distributionAppStockArticleVO != null;
distributionAppStockArticleVO.setLoadingNub(0);
distributionAppStockArticleVO.setSignforNub(0);
distributionAppStockArticleVO.setReservationNum(0);
//查询预约该订单计划数量
DistributionReservationStockarticleEntity reservationOrder = findReservationOrders(reservationOrders, distributionStockArticleEntity.getId());
if (Func.isNotEmpty(reservationOrder)) {
distributionAppStockArticleVO.setReservationNum(reservationOrder.getReservationNum());
}
if (distributionStockArticleEntity.getIsZero().equals(IsOrNoConstant.no.getValue())) {
//判断此订单是是否是异常装车
if (Func.isEmpty(reservationOrderMap.get(distributionStockArticleEntity.getId()))) {
//不存在计划之中的订单装车
List<DistributionLoadscanEntity> loadscanEntityList = loadingOrderMap.get(distributionStockArticleEntity.getId());
List<Long> abnormalPackageIds = loadscanEntityList.stream().map(DistributionLoadscanEntity::getPackageId).collect(Collectors.toList());
List<DistributionParcelListEntity> distributionParcelListEntities = distributionParcelListService.listByIds(abnormalPackageIds);
List<DistributionAppParcelListVO> distributionAppParcelListVOS = DistributionParcelListAppWrapper.build().listVO(distributionParcelListEntities);
distributionAppParcelListVOS.forEach(p -> {
p.setIsAbnormalLoading(1);
if (p.getOrderPackageStatus().equals(OrderPackageStatusConstant.yiqianshou.getValue())) {
p.setIsAbnnormalSigning(1);
}
});
distributionAppStockArticleVO.setDistributionAppParcelListVOS(distributionAppParcelListVOS);
//统计装车数和签收数
int abnormalLoadingNum = loadscanEntityList.stream().mapToInt(DistributionLoadscanEntity::getLoadedNub).sum();
distributionAppStockArticleVO.setLoadingNub(abnormalLoadingNum);
int abnormalSigningNum = loadscanEntityList.stream().filter(f -> f.getSignforState().equals(LoadScanSigningStatusConstant.yiqianshou.getValue())).mapToInt(DistributionLoadscanEntity::getLoadedNub).sum();
distributionAppStockArticleVO.setSignforNub(abnormalSigningNum);
distributionAppStockArticleVO.setCompletecode(5);
} else {
//存在计划需要结合计划包件进行异常包件判断
//查询此预约该订单下的包件信息
List<DistributionReservationPackageEntity> reservationPackage = distributionReservationPackageService.list(Wrappers.<DistributionReservationPackageEntity>query().lambda()
.eq(DistributionReservationPackageEntity::getReservationId, reservationId)
.eq(DistributionReservationPackageEntity::getStockArticleId, distributionStockArticleEntity.getId())
.ne(DistributionReservationPackageEntity::getPacketBarStatus, ReservationPackageStatusConstant.quxiao.getValue())
);
List<Long> packageIds = new ArrayList<>();
if (Func.isNotEmpty(reservationPackage)) {
List<Long> reservationPackageIds = reservationPackage.stream().map(DistributionReservationPackageEntity::getParceListId).collect(Collectors.toList());
packageIds.addAll(reservationPackageIds);
}
Map<Long, DistributionLoadscanEntity> collect = null;
if (Func.isNotEmpty(loadingOrderMap.get(distributionStockArticleEntity.getId()))) {
List<DistributionLoadscanEntity> loadscanEntityList = loadingOrderMap.get(distributionStockArticleEntity.getId());
List<Long> loadingPackageIds = loadscanEntityList.stream().map(DistributionLoadscanEntity::getPackageId).collect(Collectors.toList());
packageIds.addAll(loadingPackageIds);
collect = loadscanEntityList.stream().collect(Collectors.toMap(DistributionLoadscanEntity::getPackageId, Function.identity(), (k1, k2) -> k2));
int LoadingNum = loadscanEntityList.stream().mapToInt(DistributionLoadscanEntity::getLoadedNub).sum();
distributionAppStockArticleVO.setLoadingNub(LoadingNum);
int SigningNum = loadscanEntityList.stream().filter(f -> f.getSignforState().equals(LoadScanSigningStatusConstant.yiqianshou.getValue())).mapToInt(DistributionLoadscanEntity::getLoadedNub).sum();
distributionAppStockArticleVO.setSignforNub(SigningNum);
}
List<DistributionAppParcelListVO> packageVOS = new ArrayList<>();
if (Func.isNotEmpty(packageIds)) {
packageIds = packageIds.stream().distinct().collect(Collectors.toList());
List<DistributionParcelListEntity> parcelListEntitys = distributionParcelListService.listByIds(packageIds);
for (DistributionParcelListEntity parcelListEntity : parcelListEntitys) {
// DistributionParcelListEntity parcelListEntity = distributionParcelListService.getById(packageId);
DistributionAppParcelListVO distributionAppParcelListVO = DistributionParcelListAppWrapper.build().entityVO(parcelListEntity);
if (Func.isNotEmpty(collect)) {
DistributionLoadscanEntity distributionLoadscanEntity = collect.get(parcelListEntity.getId());
if (Func.isNotEmpty(distributionLoadscanEntity)) {
distributionAppParcelListVO.setMaterialName(parcelListEntity.getMaterialName());
if (distributionLoadscanEntity.getIsAbnormalLoading().equals(2)) {
//异常装车
distributionAppParcelListVO.setIsAbnormalLoadingName("异常装车");
distributionAppParcelListVO.setIsAbnormalLoading(1);
}
if (distributionLoadscanEntity.getSignforState().equals(LoadScanSigningStatusConstant.yiqianshou.getValue())) {
//签收
if (distributionLoadscanEntity.getIsAbnormalSigning().equals(2)) {
//异常签收
distributionAppParcelListVO.setIsAbnnormalSigningName("异常签收");
distributionAppParcelListVO.setIsAbnnormalSigning(1);
}
}
}
}
packageVOS.add(distributionAppParcelListVO);
}
}
distributionAppStockArticleVO.setDistributionAppParcelListVOS(packageVOS);
}
orderList.add(distributionAppStockArticleVO);
} else {
List<DistributionReservationZeroPackageEntity> reservationZeroPackageEntityList = distributionReservationZeroPackageService.list(Wrappers.<DistributionReservationZeroPackageEntity>query().lambda()
.eq(DistributionReservationZeroPackageEntity::getReservationId, reservationId)
.eq(DistributionReservationZeroPackageEntity::getStockArticleId, distributionStockArticleEntity.getId())
.ne(DistributionReservationZeroPackageEntity::getZeroPackageStatus, ReservationPackageStatusConstant.quxiao.getValue()));
if (Func.isNotEmpty(reservationZeroPackageEntityList)) {
int reservationTotal = reservationZeroPackageEntityList.stream().mapToInt(DistributionReservationZeroPackageEntity::getQuantity).sum();
distributionAppStockArticleVO.setReservationNum(reservationTotal);
List<DistributionParcelNumberVO> parcelNumberVOS = distributionReservationMapper.selectReservationZeroOrderDetail(distributionStockArticleEntity.getId(), reservationId);
distributionAppStockArticleVO.setSignforNub(0);
if (Func.isNotEmpty(parcelNumberVOS)) {
parcelNumberVOS.forEach(p -> {
DistributionLoadscanEntity loadscanEntity = distributionLoadscanService.getOne(Wrappers.<DistributionLoadscanEntity>query().lambda().eq(DistributionLoadscanEntity::getReservationId, reservationId).eq(DistributionLoadscanEntity::getOrderId, distributionStockArticleEntity.getId()).eq(DistributionLoadscanEntity::getPackageId, p.getParcelListId()).ne(DistributionLoadscanEntity::getScanStatus, LoadingStatusConstant.quxiao.getValue()));
p.setLoadingNum(0);
p.setSigningNum(0);
if (Func.isNotEmpty(loadscanEntity)) {
p.setLoadingNum(loadscanEntity.getLoadedNub());
if (loadscanEntity.getSignforState().equals(LoadScanSigningStatusConstant.yiqianshou.getValue())) {
p.setSigningNum(loadscanEntity.getReceivedQuantity());
}
}
});
distributionAppStockArticleVO.setDistributionParcelNumberVOS(parcelNumberVOS);
distributionAppStockArticleVO.setSignforNub(parcelNumberVOS.stream().mapToInt(DistributionParcelNumberVO::getSigningNum).sum());
}
}
zeroOrderList.add(distributionAppStockArticleVO);
}
}
}
List<DisStockListDetailVO> inventoryPackageList = baseMapper.selectAppDeliveryInventoryPackage(reservationId);
if (!orderList.isEmpty()) {
reservationAppDetailVO.setOrderList(orderList);
}
if (!zeroOrderList.isEmpty()) {
reservationAppDetailVO.setZeroOrderList(zeroOrderList);
}
if (!inventoryPackageList.isEmpty()) {
reservationAppDetailVO.setInventoryList(inventoryPackageList);
}
return R.data(reservationAppDetailVO);
}
/**
* 修改装车为签收数据
* @param loadscanEntity

Loading…
Cancel
Save