Browse Source

推送库存品包件、零担推送BUG修复

dist.1.3.0
汤建军 5 months ago
parent
commit
f254818c8c
  1. 33
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionSignforMapper.java
  2. 140
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionSignforMapper.xml
  3. 186
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionSignforServiceImpl.java

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

@ -379,4 +379,37 @@ public interface DistributionSignforMapper extends BaseMapper<DistributionSignfo
void deductionLoadingAndSignforPacjageNum(@Param("reservationId")Long reservationId,@Param("deliveryId") Long deliveryId,@Param("loadingNum") int loadingNum,@Param("signforNum") int signforNum);
/**
* 查询推送库存品装车包件
* @param reservationId
* @param deliveryId
* @return
*/
List<SignPushDataUnitDTO> selectPushOldInventoryPackageLoading(@Param("reservationId")Long reservationId,@Param("deliveryId") Long deliveryId);
/**
* 查询推送库存品签收包件
* @param reservationId
* @param deliveryId
* @return
*/
List<SignPushDataUnitDTO> selectPushOldInventoryPackageSigning(@Param("reservationId")Long reservationId,@Param("deliveryId") Long deliveryId);
/**
* 查询推送单个库存品装车包件
* @param reservationId
* @param deliveryId
* @return
*/
List<SignPushDataUnitDTO> selectPushOldSingleInventoryPackageLoading(@Param("reservationId")Long reservationId,@Param("deliveryId") Long deliveryId,@Param("orderPackageCode") String orderPackageCode);
/**
* 查询推送单个库存品签收包件
* @param reservationId
* @param deliveryId
* @return
*/
List<SignPushDataUnitDTO> selectPushOldSingleInventoryPackageSigning(@Param("reservationId")Long reservationId,@Param("deliveryId") Long deliveryId,@Param("orderPackageCode") String orderPackageCode);
}

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

@ -1266,7 +1266,7 @@
lddl.train_number AS transNo,
ldpl.waybill_number AS waybillNo,
ldpl.order_code AS orderSelfNum,
IFNULL(ldpl.order_package_code ,'')AS unitNo,
IFNULL(ldpl.order_package_code ,ldpl.order_code)AS unitNo,
ldpl.quantity AS num,
ldl.signfor_state AS type,
ldl.scan_time AS operateTime,
@ -1298,7 +1298,7 @@
lddl.train_number AS transNo,
ldpl.waybill_number AS waybillNo,
ldpl.order_code AS orderSelfNum,
IFNULL(ldpl.order_package_code ,'')AS unitNo,
IFNULL(ldpl.order_package_code ,ldpl.order_code)AS unitNo,
ldpl.quantity AS num,
ldl.signfor_state AS type,
ldl.signing_time AS operateTime,
@ -1658,4 +1658,140 @@
WHERE
lds.id = #{id} AND lds.is_deleted = 0
</select>
<select id="selectPushOldInventoryPackageLoading"
resultType="com.logpm.oldproject.dto.SignPushDataUnitDTO">
SELECT
ldpl.id AS id,
if(lww.old_id is null,lww.id,lww.old_id) AS warehouseId,
lddl.id AS distributionId,
lddl.train_number AS transNo,
ldpl.waybill_number AS waybillNo,
ldpl.order_code AS orderSelfNum,
IFNULL(ldpl.order_package_code ,'')AS unitNo,
ldpl.quantity AS num,
ldl.signfor_state AS type,
ldl.scan_time AS operateTime,
ldl.create_user AS administratorsId,
IF
( ldl.id IS NOT NULL, 1, ldl.id ) AS is_loading,
1 is_out,
IF(ldpl.conditions = 1, 0 ,ldpl.conditions) AS goods_type,
ldl.received_quantity AS signNum,
5 AS broke_state
FROM
logpm_distribution_loadscaninvn AS ldl
INNER JOIN logpm_distribution_delivery_list AS lddl ON lddl.id = ldl.delivery_id
AND lddl.is_deleted = 0
INNER JOIN logpm_distribution_parcel_list AS ldpl ON ldl.order_package_code = ldpl.order_package_code AND ldpl.warehouse_id = ldl.warehouse_id
AND ldpl.is_deleted = 0
LEFT JOIN logpm_warehouse_warehouse AS lww ON ldpl.warehouse_id = lww.id
WHERE
ldl.reservation_id = #{reservationId}
AND ldl.delivery_id = #{deliveryId}
AND ldl.scan_status != 1
AND ldl.is_deleted = 0
</select>
<select id="selectPushOldInventoryPackageSigning"
resultType="com.logpm.oldproject.dto.SignPushDataUnitDTO">
SELECT
ldpl.id AS id,
if(lww.old_id is null,lww.id,lww.old_id) AS warehouseId,
lddl.id AS distributionId,
lddl.train_number AS transNo,
ldpl.waybill_number AS waybillNo,
ldpl.order_code AS orderSelfNum,
IFNULL(ldpl.order_package_code ,ldpl.order_code)AS unitNo,
ldpl.quantity AS num,
ldl.signfor_state AS type,
ldl.signing_time AS operateTime,
ldl.signing_user_id AS administratorsId,
IF
( ldl.id IS NOT NULL, 1, ldl.id ) AS is_loading,
1 is_out,
IF(ldpl.conditions = 1, 0 ,ldpl.conditions) AS goods_type,
ldl.received_quantity AS signNum,
5 AS broke_state
FROM
logpm_distribution_loadscaninvn AS ldl
INNER JOIN logpm_distribution_delivery_list AS lddl ON lddl.id = ldl.delivery_id
AND lddl.is_deleted = 0
INNER JOIN logpm_distribution_parcel_list AS ldpl ON ldl.order_package_code = ldpl.order_package_code AND ldpl.warehouse_id = ldl.warehouse_id
AND ldpl.is_deleted = 0
LEFT JOIN logpm_warehouse_warehouse AS lww ON ldpl.warehouse_id = lww.id
WHERE
ldl.reservation_id = #{reservationId}
AND ldl.delivery_id = #{deliveryId}
AND ldl.scan_status != 1
AND ldl.is_deleted = 0
AND ldl.signfor_state = 2
</select>
<select id="selectPushOldSingleInventoryPackageSigning"
resultType="com.logpm.oldproject.dto.SignPushDataUnitDTO">
SELECT
ldpl.id AS id,
if(lww.old_id is null,lww.id,lww.old_id) AS warehouseId,
lddl.id AS distributionId,
lddl.train_number AS transNo,
ldpl.waybill_number AS waybillNo,
ldpl.order_code AS orderSelfNum,
IFNULL(ldpl.order_package_code ,'')AS unitNo,
ldpl.quantity AS num,
ldl.signfor_state AS type,
ldl.scan_time AS operateTime,
ldl.create_user AS administratorsId,
IF
( ldl.id IS NOT NULL, 1, ldl.id ) AS is_loading,
1 is_out,
IF(ldpl.conditions = 1, 0 ,ldpl.conditions) AS goods_type,
ldl.received_quantity AS signNum,
5 AS broke_state
FROM
logpm_distribution_loadscaninvn AS ldl
INNER JOIN logpm_distribution_delivery_list AS lddl ON lddl.id = ldl.delivery_id
AND lddl.is_deleted = 0
INNER JOIN logpm_distribution_parcel_list AS ldpl ON ldl.order_package_code = ldpl.order_package_code AND ldpl.warehouse_id = ldl.warehouse_id
AND ldpl.is_deleted = 0
LEFT JOIN logpm_warehouse_warehouse AS lww ON ldpl.warehouse_id = lww.id
WHERE
ldl.reservation_id = #{reservationId}
AND ldl.delivery_id = #{deliveryId}
AND ldl.order_package_code = #{orderPackageCode}
AND ldl.scan_status != 1
AND ldl.is_deleted = 0
</select>
<select id="selectPushOldSingleInventoryPackageSigning"
resultType="com.logpm.oldproject.dto.SignPushDataUnitDTO">
SELECT
ldpl.id AS id,
if(lww.old_id is null,lww.id,lww.old_id) AS warehouseId,
lddl.id AS distributionId,
lddl.train_number AS transNo,
ldpl.waybill_number AS waybillNo,
ldpl.order_code AS orderSelfNum,
IFNULL(ldpl.order_package_code ,ldpl.order_code)AS unitNo,
ldpl.quantity AS num,
ldl.signfor_state AS type,
ldl.signing_time AS operateTime,
ldl.signing_user_id AS administratorsId,
IF
( ldl.id IS NOT NULL, 1, ldl.id ) AS is_loading,
1 is_out,
IF(ldpl.conditions = 1, 0 ,ldpl.conditions) AS goods_type,
ldl.received_quantity AS signNum,
5 AS broke_state
FROM
logpm_distribution_loadscaninvn AS ldl
INNER JOIN logpm_distribution_delivery_list AS lddl ON lddl.id = ldl.delivery_id
AND lddl.is_deleted = 0
INNER JOIN logpm_distribution_parcel_list AS ldpl ON ldl.order_package_code = ldpl.order_package_code AND ldpl.warehouse_id = ldl.warehouse_id
AND ldpl.is_deleted = 0
LEFT JOIN logpm_warehouse_warehouse AS lww ON ldpl.warehouse_id = lww.id
WHERE
ldl.reservation_id = #{reservationId}
AND ldl.delivery_id = #{deliveryId}
AND ldl.order_package_code = #{orderPackageCode}
AND ldl.scan_status != 1
AND ldl.is_deleted = 0
AND ldl.signfor_state = 2
</select>
</mapper>

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

@ -6562,27 +6562,26 @@ public class DistributionSignforServiceImpl extends BaseServiceImpl<Distribution
signPushDataUnitDTOS.addAll(pushOldPackageLoading);
}
if (Func.isNotEmpty(pushOldPackageSigning)) {
pushOldPackageLoading = handleSignPushDataUnitDTOList(pushOldPackageSigning);
pushOldPackageSigning = handleSignPushDataUnitDTOList(pushOldPackageSigning);
buildNameAndPhone(pushOldPackageSigning);
signPushDataUnitDTOS.addAll(pushOldPackageSigning);
}
}
// if (distributionReservationEntity.getReservationStockListNum() > 0) {
//
// //查询库存品扫描签收
// List<SignPushDataUnitDTO> loadingPushOldInventory = distributionSignforMapper.selectLoadingPushOldInventory(distributionSignforEntity.getReservationId(), distributionSignforEntity.getDeliveryId());
// List<SignPushDataUnitDTO> signingPushOldInventory = distributionSignforMapper.selectSigningPushOldInventory(distributionSignforEntity.getReservationId(), distributionSignforEntity.getDeliveryId());
// if (Func.isNotEmpty(loadingPushOldInventory)) {
// buildNameAndPhone(loadingPushOldInventory);
// signPushDataUnitDTOS.addAll(loadingPushOldInventory);
// }
//
// if (Func.isNotEmpty(signingPushOldInventory)) {
// buildNameAndPhone(signingPushOldInventory);
// signPushDataUnitDTOS.addAll(signingPushOldInventory);
// }
// }
if (distributionReservationEntity.getReservationStockListNum() > 0) {
//查询是否存在转的库存品
List<SignPushDataUnitDTO> pushOldInventoryPackageLoading = distributionSignforMapper.selectPushOldInventoryPackageLoading(distributionSignforEntity.getReservationId(), distributionSignforEntity.getDeliveryId());
List<SignPushDataUnitDTO> pushOldInventoryPackageSigning = distributionSignforMapper.selectPushOldInventoryPackageSigning(distributionSignforEntity.getReservationId(), distributionSignforEntity.getDeliveryId());
if (Func.isNotEmpty(pushOldInventoryPackageLoading)) {
buildNameAndPhone(pushOldInventoryPackageLoading);
signPushDataUnitDTOS.addAll(pushOldInventoryPackageLoading);
}
if (Func.isNotEmpty(pushOldInventoryPackageSigning)) {
buildNameAndPhone(pushOldInventoryPackageSigning);
signPushDataUnitDTOS.addAll(pushOldInventoryPackageSigning);
}
}
//查询签收图片
List<DistributionSignPrintVO> distributionSignPrintVOS = distributionSignforMapper.selectSignImgsUrl(distributionReservationEntity.getId());
@ -6806,24 +6805,153 @@ public class DistributionSignforServiceImpl extends BaseServiceImpl<Distribution
@Override
public Map<String, Object> clerkInventoryCheckPushData(String orderPackageCode) {
//查询此包件
List<DistributionLoadscaninvnEntity> loadscaninvnEntityList = distributionLoadscaninvnService.list(Wrappers.<DistributionLoadscaninvnEntity>query().lambda()
.eq(DistributionLoadscaninvnEntity::getOrderPackageCode, orderPackageCode)
.ne(DistributionLoadscaninvnEntity::getScanStatus, LoadingStatusConstant.quxiao.getValue())
);
if (!loadscaninvnEntityList.isEmpty()) {
//未进行装车
}
if (loadscaninvnEntityList.size()>1) {
//存在多个记录
}
DistributionLoadscaninvnEntity loadscaninvnEntity = loadscaninvnEntityList.get(0);
Map<String,Object> resultMap = new HashMap<>();
try {
//查询此包件
List<DistributionLoadscaninvnEntity> loadscaninvnEntityList = distributionLoadscaninvnService.list(Wrappers.<DistributionLoadscaninvnEntity>query().lambda()
.eq(DistributionLoadscaninvnEntity::getOrderPackageCode, orderPackageCode)
.ne(DistributionLoadscaninvnEntity::getScanStatus, LoadingStatusConstant.quxiao.getValue())
);
if (!loadscaninvnEntityList.isEmpty()) {
//未进行装车
resultMap.put("result", false);
resultMap.put("msg", orderPackageCode+"没有装车扫描记录");
return resultMap;
}
if (loadscaninvnEntityList.size()>1) {
//存在多个记录
resultMap.put("result", false);
resultMap.put("msg", orderPackageCode+"存在多个装车扫描记录");
return resultMap;
}
DistributionLoadscaninvnEntity loadscaninvnEntity = loadscaninvnEntityList.get(0);
//查询signfor
DistributionSignforEntity signforEntity = this.getOne(Wrappers.<DistributionSignforEntity>query().lambda()
.eq(DistributionSignforEntity::getReservationId, loadscaninvnEntity.getReservationId())
);
if (Func.isEmpty(signforEntity)) {
//存在多个记录
resultMap.put("result", false);
resultMap.put("msg", orderPackageCode+"查询signfor数据错误,id:"+loadscaninvnEntity.getReservationId());
return resultMap;
}
// 得到配送计划
DistributionDeliveryListEntity distributionDeliveryListEntity = distributionDeliveryListMapper.selectById(loadscaninvnEntity.getDeliveryId());
if (ObjectUtil.isEmpty(distributionDeliveryListEntity)) {
log.info(">>>>>>>>>>> clerkCheckPushDataHandler distributionDeliveryListEntity {}", distributionDeliveryListEntity);
resultMap.put("result", false);
resultMap.put("msg", "没有配送计划 distributionDeliveryListEntity");
return resultMap;
}
// 得到配送客户
DistributionReservationEntity distributionReservationEntity = distributionReservationMapper.selectById(loadscaninvnEntity.getReservationId());
if (ObjectUtil.isEmpty(distributionReservationEntity)) {
log.info(">>>>>>>>>>>> clerkCheckPushDataHandler distributionReservationEntity {}", distributionReservationEntity);
resultMap.put("result", false);
resultMap.put("msg", "没有配送客户 distributionReservationEntity");
return resultMap;
}
return null;
//组合配送信息
SignPushDataDTO delivery = distributionDeliveryListMapper.selectPushOldDelivery(loadscaninvnEntity.getReservationId(), loadscaninvnEntity.getDeliveryId());
WarehouseEntity warehouseEntity = warehouseClient.findByName(distributionReservationEntity.getWarehouseName());
if (ObjectUtils.isNotNull(warehouseEntity)) {
// 需要增加老系统的仓库ID
delivery.setWarehouseId(Long.parseLong(warehouseEntity.getId() + ""));
delivery.setWarehouseName(warehouseEntity.getTitle());
}
//还需要配送的出库人、配送人、操作人信息
if (Func.isNotEmpty(delivery)) {
if ("1".equals(delivery.getKind())) {
//自主配送
DistributionDeliverySelfEntity distributionDeliverySelfEntity = distributionDeliverySelfMapper.selectOne(Wrappers.<DistributionDeliverySelfEntity>query().lambda()
.eq(DistributionDeliverySelfEntity::getDeliveryId, delivery.getId())
.eq(DistributionDeliverySelfEntity::getIsMaster, 2)
);
if (Func.isNotEmpty(distributionDeliverySelfEntity)) {
delivery.setOutId(Long.parseLong(distributionDeliverySelfEntity.getDriverId()));
delivery.setOutName(distributionDeliverySelfEntity.getDriverName());
delivery.setOutPhone(distributionDeliverySelfEntity.getDriverPhone());
}
} else {
//外协
DistributionDeliveryTripartiteEntity distributionDeliveryTripartiteEntity = distributionDeliveryTripartiteMapper.selectOne(Wrappers.<DistributionDeliveryTripartiteEntity>query().lambda().eq(DistributionDeliveryTripartiteEntity::getDeliveryId, delivery.getId()));
if (Func.isNotEmpty(distributionDeliveryTripartiteEntity)) {
delivery.setOutName(distributionDeliveryTripartiteEntity.getDriverName());
delivery.setOutPhone(distributionDeliveryTripartiteEntity.getDriverPhone());
}
}
R<User> userR = userClient.userInfoById(delivery.getAdministratorsId());
if (Func.isNotEmpty(userR)) {
User user = userR.getData();
delivery.setAdministratorsName(user.getName());
delivery.setAdministratorsPhone(user.getPhone());
}
DistributionStockupEntity distributionStockupEntity = distributionReservationMapper.selectStockup(loadscaninvnEntity.getReservationId());
if (Func.isNotEmpty(distributionStockupEntity)) {
if (distributionStockupEntity.getAssignStatus().equals(StockAssignStatusConstant.yizhipai.getValue())) {
delivery.setOutToId(distributionStockupEntity.getStockupUserId());
delivery.setOutToName(distributionStockupEntity.getStockupUser());
}
}
//查询客户信息
List<SignPushDataContactDTO> customer = distributionReservationMapper.selectPushOldCustomer(loadscaninvnEntity.getReservationId());
if (Func.isNotEmpty(customer)) {
//查询客户订单
List<SignPushDataUnitDTO> signPushDataUnitDTOS = new ArrayList<>();
if (distributionReservationEntity.getReservationStockListNum() > 0) {
//查询包件扫描签收
//查询包件扫描签收
List<SignPushDataUnitDTO> pushOldInventoryPackageLoading = distributionSignforMapper.selectPushOldSingleInventoryPackageLoading(loadscaninvnEntity.getReservationId(), loadscaninvnEntity.getDeliveryId(),orderPackageCode);
List<SignPushDataUnitDTO> pushOldInventoryPackageSigning = distributionSignforMapper.selectPushOldSingleInventoryPackageSigning(loadscaninvnEntity.getReservationId(), loadscaninvnEntity.getDeliveryId(),orderPackageCode);
if (Func.isNotEmpty(pushOldInventoryPackageLoading)) {
buildNameAndPhone(pushOldInventoryPackageLoading);
signPushDataUnitDTOS.addAll(pushOldInventoryPackageLoading);
}
if (Func.isNotEmpty(pushOldInventoryPackageSigning)) {
buildNameAndPhone(pushOldInventoryPackageSigning);
signPushDataUnitDTOS.addAll(pushOldInventoryPackageSigning);
}
}
//查询签收图片
List<DistributionSignPrintVO> distributionSignPrintVOS = distributionSignforMapper.selectSignImgsUrl(distributionReservationEntity.getId());
if (Func.isNotEmpty(signPushDataUnitDTOS)) {
SignPushDataContactDTO signPushDataContactDTO = customer.get(0);
signPushDataContactDTO.setSignPushDataUnitDTOs(signPushDataUnitDTOS);
if (Func.isNotEmpty(distributionSignPrintVOS)) {
String urls = distributionSignPrintVOS.stream().map(DistributionSignPrintVO::getUrlRoute).collect(Collectors.joining(","));
signPushDataContactDTO.setImage(urls);
}
if (Func.isNotEmpty(signforEntity.getClerkSignRemarks())) {
signPushDataContactDTO.setContact(signforEntity.getClerkSignRemarks());
}
}
buildReservationNameAndPhone(customer);
//完成客户信息添加
delivery.setSignPushDataContactDTOs(customer);
}
}
log.info(">>>> clerkCheckPushData SignPushDataDTO :{}", delivery);
resultMap = oldSystemDataPushClient.pushOldSystemSignInfo(delivery);
return resultMap;
}catch (Exception e) {
resultMap.put("result", false);
resultMap.put("msg", "数据准备错误"+e.getMessage());
log.error(">>>>> 推送老系统签收信息报错", e);
}
resultMap.put("result", false);
resultMap.put("msg", "未知错误");
return resultMap;
}
private void buildNameAndPhone(List<SignPushDataUnitDTO> pushOldPackageSigning) {

Loading…
Cancel
Save