Browse Source

包件配送流转节点

chenglong
汤建军 1 year ago
parent
commit
c635bba1ad
  1. 36
      blade-service-api/logpm-distribution-api/src/main/java/com/logpm/distribution/vo/DistributionParcelListNodeVO.java
  2. 57
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionParcelListMapper.java
  3. 217
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionParcelListMapper.xml
  4. 85
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionParcelListServiceImpl.java

36
blade-service-api/logpm-distribution-api/src/main/java/com/logpm/distribution/vo/DistributionParcelListNodeVO.java

@ -36,15 +36,45 @@ import java.util.List;
public class DistributionParcelListNodeVO {
//节点名称
private String nodeName;
//节点操作人
//节点时间
private Date nodeTime;
//节点修改人
//节点操作人ID
private Long nodeControlsUserId;
//节点时间
//节点操作人名称
private String nodeControlsUserName;
//仓库ID
private Long warehouseId;
//仓库名称
private String warehouseName;
//操作描述
private String description;
//数量
private Integer quantity;
//订单自编码
private String orderCode;
//包条码
private String orderPackageCode;
//库位名称
private String allocationName;
//托盘名称
private String trayName;
//车次号
private String tranNumber;

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

@ -22,10 +22,7 @@ import com.logpm.distribution.dto.DistributionParcelListDTO;
import com.logpm.distribution.dto.app.StockupDTO;
import com.logpm.distribution.entity.DistributionParcelListEntity;
import com.logpm.distribution.excel.DistributionParcelListExcel;
import com.logpm.distribution.vo.DistributionParcelListBaseVO;
import com.logpm.distribution.vo.DistributionParcelListVO;
import com.logpm.distribution.vo.DistributionStockListVO;
import com.logpm.distribution.vo.PackageStockupVO;
import com.logpm.distribution.vo.*;
import org.apache.ibatis.annotations.Param;
import java.util.ArrayList;
@ -178,4 +175,56 @@ public interface DistributionParcelListMapper extends BaseMapper<DistributionPar
* @return
*/
Integer restorePakcageByIds(@Param("packageIds")List<Long> packageIds);
/**
* 查询包件打托和上架信息
* @param orderPackageCode
* @param id
* @return
*/
List<DistributionParcelListNodeVO> selectPackageAllocationAndTray(@Param("orderPackageCode") String orderPackageCode,@Param("warehouseId") Long warehouseId);
/**
* 查询计划配送信息
* @param orderPackageCode
* @param warehouseId
* @return
*/
List<DistributionParcelListNodeVO> selectPackagePlanDelivery(@Param("orderPackageCode") String orderPackageCode,@Param("warehouseId") Long warehouseId);
/**
* 查询取消配送节点信息
* @param orderPackageCode
* @param id
* @return
*/
List<DistributionParcelListNodeVO> selectPackageCancelPlanDelivery(@Param("orderPackageCode") String orderPackageCode,@Param("warehouseId") Long warehouseId);
/**
* 查询装车节点信息
* @param orderPackageCode
* @param id
* @return
*/
List<DistributionParcelListNodeVO> selectPackageLoading(@Param("orderPackageCode") String orderPackageCode,@Param("warehouseId") Long warehouseId);
List<DistributionParcelListNodeVO> selectPackageCancelLoading(@Param("orderPackageCode") String orderPackageCode,@Param("warehouseId") Long warehouseId);
/**
* 查询包件签收节点信息
* @param orderPackageCode
* @param id
* @return
*/
DistributionParcelListNodeVO selectPackageCancelSigning(@Param("orderPackageCode") String orderPackageCode,@Param("warehouseId") Long warehouseId);
List<DistributionParcelListNodeVO> selectPackageStockUp(@Param("orderPackageCode") String orderPackageCode,@Param("warehouseId") Long warehouseId);
/**
* 查询异常审核
* @param orderPackageCode
* @param id
* @return
*/
DistributionParcelListNodeVO selectPackageExamineAbnormal(@Param("orderPackageCode") String orderPackageCode,@Param("warehouseId") Long warehouseId);
}

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

@ -1095,5 +1095,222 @@
SELECT ldpl.* FROM logpm_distribution_parcel_list ldpl
WHERE ldpl.waybill_number = #{waybillNumber}
</select>
<select id="selectPackageAllocationAndTray"
resultType="com.logpm.distribution.vo.DistributionParcelListNodeVO">
SELECT
ldpl.order_code AS orderCode,
ldpl.order_package_code AS orderPackageCode,
ldpl.warehouse AS warehouseName,
ldpl.warehouse_id AS warehouseId,
ldpl.quantity AS quantity,
ldpl.train_number AS tranNumber,
lwugl.create_time AS nodeTime,
lwugl.create_user AS nodeControlsUserId,
CASE lwugl.binding_type
WHEN 1 THEN '上架操作'
ELSE '下架操作'
END nodeName,
CASE lwugl.binding_type
WHEN 1 THEN CONCAT('上架成功,',lwga.qr_code,lwugl.remark)
ELSE
CONCAT('下架成功,',lwga.qr_code,lwugl.remark)
END description
FROM
logpm_warehouse_updown_goods_log AS lwugl
LEFT JOIN logpm_distribution_parcel_list AS ldpl ON lwugl.association_value = ldpl.order_package_code
LEFT JOIN logpm_warehouse_goods_allocation AS lwga ON lwugl.allocation_id = lwga.id
WHERE
lwugl.association_value = #{orderPackageCode} AND ldpl.warehouse_id = #{warehouseId} AND lwugl.association_type = '3'
UNION ALL
SELECT
ldpl.order_code AS orderCode,
ldpl.order_package_code AS orderPackageCode,
ldpl.warehouse AS warehouseName,
ldpl.warehouse_id AS warehouseId,
ldpl.quantity AS quantity,
ldpl.train_number AS tranNumber,
lwtgl.create_time AS nodeTime,
lwtgl.create_user AS nodeControlsUserId,
CASE lwtgl.binding_type
WHEN 1 THEN '打托操作'
ELSE '解托操作'
END nodeName,
CASE lwtgl.binding_type
WHEN 1 THEN CONCAT('打托成功,',lwt.pallet_name,lwtgl.remark)
ELSE
CONCAT('解托成功,',lwt.pallet_name,lwtgl.remark)
END description
FROM
logpm_warehouse_tray_goods_log AS lwtgl
LEFT JOIN logpm_distribution_parcel_list AS ldpl ON lwtgl.association_value = ldpl.order_package_code
LEFT JOIN logpm_warehouse_tray AS lwt ON lwtgl.tray_id = lwt.id
WHERE
lwtgl.association_value = #{orderPackageCode} AND ldpl.warehouse_id = #{warehouseId} AND lwtgl.association_type = '3'
</select>
<select id="selectPackagePlanDelivery" resultType="com.logpm.distribution.vo.DistributionParcelListNodeVO">
SELECT
ldpl.order_code AS orderCode,
ldpl.order_package_code AS orderPackageCode,
ldpl.warehouse AS warehouseName,
ldpl.warehouse_id AS warehouseId,
ldpl.quantity AS quantity,
ldpl.train_number AS tranNumber,
ldrp.create_time AS nodeTime,
ldrp.create_user AS nodeControlsUserId,
'计划配送' AS nodeName,
lwt.pallet_name,
lwga.qr_code,
CASE ldrp.packet_bar_status
WHEN '3' THEN CONCAT('计划新增配送成功,预约单:',ldr.reservation_code)
ELSE CONCAT('计划配送成功,预约单:',ldr.reservation_code)
END description
FROM
logpm_distribution_reservation_package AS ldrp
LEFT JOIN logpm_distribution_parcel_list AS ldpl ON ldrp.parce_list_id = ldpl.id
LEFT JOIN logpm_distribution_reservation AS ldr ON ldrp.reservation_id = ldr.id
LEFT JOIN logpm_warehouse_updown_goods AS lwug ON ldpl.order_package_code = lwug.association_value
LEFT JOIN logpm_warehouse_goods_allocation AS lwga ON lwug.allocation_id = lwga.id
LEFT JOIN logpm_warehouse_tray_goods AS lwtg ON ldpl.order_package_code = lwtg.association_value
LEFT JOIN logpm_warehouse_tray AS lwt ON lwtg.tray_id = lwt.id
WHERE
ldrp.packet_bar_code = #{orderPackageCode} AND ldpl.warehouse_id = #{warehouseId}
</select>
<select id="selectPackageCancelPlanDelivery"
resultType="com.logpm.distribution.vo.DistributionParcelListNodeVO">
SELECT
ldpl.order_code AS orderCode,
ldpl.order_package_code AS orderPackageCode,
ldpl.warehouse AS warehouseName,
ldpl.warehouse_id AS warehouseId,
ldpl.quantity AS quantity,
ldpl.train_number AS tranNumber,
ldrp.create_time AS nodeTime,
ldrp.create_user AS nodeControlsUserId,
'配送取消' AS nodeName,
lwt.pallet_name,
lwga.qr_code,
CASE lwrc.order_package_code
WHEN ldpl.order_package_code THEN CONCAT('计划配送取消,预约单:',ldr.reservation_code,IF(lwrc.id is not null,';司机滞留取消',lwrc.id))
ELSE
CONCAT('计划配送取消,预约单:',ldr.reservation_code,IF(ldrp.cancel_status = 1,';复核释放取消',';文员操作取消'))
END description
FROM
logpm_distribution_reservation_package AS ldrp
LEFT JOIN logpm_distribution_parcel_list AS ldpl ON ldrp.parce_list_id = ldpl.id
LEFT JOIN logpm_distribution_reservation AS ldr ON ldrp.reservation_id = ldr.id
LEFT JOIN logpm_warehouse_updown_goods AS lwug ON ldpl.order_package_code = lwug.association_value
LEFT JOIN logpm_warehouse_goods_allocation AS lwga ON lwug.allocation_id = lwga.id
LEFT JOIN logpm_warehouse_tray_goods AS lwtg ON ldpl.order_package_code = lwtg.association_value
LEFT JOIN logpm_warehouse_tray AS lwt ON lwtg.tray_id = lwt.id
LEFT JOIN logpm_warehouse_retention_scan AS lwrc ON lwrc.order_package_code = ldpl.order_package_code
WHERE
ldrp.packet_bar_code = #{orderPackageCode} AND ldpl.warehouse_id = #{warehouseId} AND ldrp.packet_bar_status = '2'
</select>
<select id="selectPackageLoading" resultType="com.logpm.distribution.vo.DistributionParcelListNodeVO">
SELECT
ldpl.order_code AS orderCode,
ldpl.order_package_code AS orderPackageCode,
ldpl.warehouse AS warehouseName,
ldpl.warehouse_id AS warehouseId,
ldpl.quantity AS quantity,
lddl.train_number AS tranNumber,
ldl.scan_time AS nodeTime,
ldl.scan_user AS nodeControlsUserName,
ldl.create_user AS nodeControlsUserId,
IF(ldla.id is not null AND ldl.scan_status = '2','异常装车','扫描装车' )AS nodeName,
CASE ldl.scan_status
WHEN '2' THEN CONCAT('扫描装车,装车方式:',IF(ldl.tray_no is not null,'托盘','包件'),IF(ldl.tray_no is null,'',ldl.tray_no))
WHEN '3' THEN CONCAT('扫描装车,装车方式:订单')
WHEN '4' THEN CONCAT('扫描装车,装车方式:批量确认')
WHEN '5' THEN CONCAT('扫描装车,装车方式:装车补录')
ELSE CONCAT('扫描装车,装车方式:',IF(ldl.tray_no is not null,'托盘','包件'),IF(ldl.tray_no is null,'',ldl.tray_no))
END description
FROM
logpm_distribution_loadscan AS ldl
LEFT JOIN logpm_distribution_parcel_list AS ldpl ON ldl.package_id = ldpl.id
LEFT JOIN logpm_distribution_delivery_list AS lddl ON ldl.delivery_id = lddl.id
LEFT JOIN logpm_distribution_loadscan_abnormal AS ldla ON ldla.package_id = ldpl.id
WHERE ldl.order_package_code = #{orderPackageCode} AND ldpl.warehouse_id = #{warehouseId}
</select>
<select id="selectPackageCancelLoading"
resultType="com.logpm.distribution.vo.DistributionParcelListNodeVO">
SELECT
ldpl.order_code AS orderCode,
ldpl.order_package_code AS orderPackageCode,
ldpl.warehouse AS warehouseName,
ldpl.warehouse_id AS warehouseId,
ldpl.quantity AS quantity,
lddl.train_number AS tranNumber,
ldl.update_time AS nodeTime,
ldl.update_user AS nodeControlsUserId,
IF(lwrs.id is not null,'滞留扫描','装车取消') AS nodeName,
IF(lwrs.id is not null,'滞留扫描成功','装车取消成功') AS description
FROM
logpm_distribution_loadscan AS ldl
LEFT JOIN logpm_distribution_parcel_list AS ldpl ON ldl.package_id = ldpl.id
LEFT JOIN logpm_distribution_delivery_list AS lddl ON ldl.delivery_id = lddl.id
LEFT JOIN logpm_warehouse_retention_scan AS lwrs ON lwrs.order_package_code = ldpl.order_package_code
WHERE ldl.order_package_code = #{orderPackageCode} AND ldpl.warehouse_id = #{warehouseId} AND ldl.scan_status = '1'
</select>
<select id="selectPackageCancelSigning"
resultType="com.logpm.distribution.vo.DistributionParcelListNodeVO">
SELECT
ldpl.order_code AS orderCode,
ldpl.order_package_code AS orderPackageCode,
ldpl.warehouse AS warehouseName,
ldpl.warehouse_id AS warehouseId,
ldpl.quantity AS quantity,
lddl.train_number AS tranNumber,
ldl.signing_time AS nodeTime,
ldl.signing_user AS nodeControlsUserName,
ldl.signing_user_id AS nodeControlsUserId,
IF(ldla.id is not null AND ldl.scan_status = '2','异常签收','扫描签收' )AS nodeName,
CONCAT('签收操作成功') AS description
FROM
logpm_distribution_loadscan AS ldl
LEFT JOIN logpm_distribution_parcel_list AS ldpl ON ldl.package_id = ldpl.id
LEFT JOIN logpm_distribution_delivery_list AS lddl ON ldl.delivery_id = lddl.id
LEFT JOIN logpm_distribution_loadscan_abnormal AS ldla ON ldla.package_id = ldpl.id
WHERE ldl.order_package_code = #{orderPackageCode} AND ldpl.warehouse_id = #{warehouseId} AND signfor_state = '2'
</select>
<select id="selectPackageStockUp" resultType="com.logpm.distribution.vo.DistributionParcelListNodeVO">
SELECT
ldpl.order_code AS orderCode,
ldpl.order_package_code AS orderPackageCode,
ldpl.warehouse AS warehouseName,
ldpl.warehouse_id AS warehouseId,
ldpl.quantity AS quantity,
ldpl.train_number AS tranNumber,
lds.create_user AS nodeControlsUserId,
lds.create_time AS nodeTime,
'备货扫描' AS nodeName,
CONCAT('备货扫描成功,',IF(ldsup.stockup_code is not null,ldsup.stockup_code,'')) AS description
FROM
logpm_distribution_stock AS lds
LEFT JOIN logpm_distribution_parcel_list AS ldpl ON lds.parcel_list_id = ldpl.id
LEFT JOIN logpm_distribution_stockup AS ldsup ON lds.stockup_id = ldsup.id
WHERE
lds.coding = #{orderPackageCode} AND ldpl.warehouse_id = #{warehouseId} AND lds.type = '1'
</select>
<select id="selectPackageExamineAbnormal"
resultType="com.logpm.distribution.vo.DistributionParcelListNodeVO">
SELECT
ldpl.order_code AS orderCode,
ldpl.order_package_code AS orderPackageCode,
ldpl.warehouse AS warehouseName,
ldpl.warehouse_id AS warehouseId,
ldpl.quantity AS quantity,
ldla.train_number AS tranNumber,
ldla.auditing_user AS nodeControlsUserName,
ldla.update_user AS nodeControlsUserId,
ldla.auditing_time AS nodeTime,
'异常审核' AS nodeName,
CONCAT('异常审核成功') AS description
FROM
logpm_distribution_loadscan_abnormal AS ldla
LEFT JOIN logpm_distribution_parcel_list AS ldpl ON ldla.package_id = ldpl.id
WHERE
ldla.package_code = #{orderPackageCode} AND ldpl.warehouse_id = #{warehouseId}
</select>
</mapper>

85
blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionParcelListServiceImpl.java

@ -37,10 +37,7 @@ import com.logpm.distribution.mapper.DistributionParcelListMapper;
import com.logpm.distribution.mapper.DistributionParcelNumberMapper;
import com.logpm.distribution.mapper.DistributionStockArticleMapper;
import com.logpm.distribution.service.*;
import com.logpm.distribution.vo.DistributionParcelListBaseVO;
import com.logpm.distribution.vo.DistributionParcelListVO;
import com.logpm.distribution.vo.DistributionParcelListZeroVO;
import com.logpm.distribution.vo.PackageStockupVO;
import com.logpm.distribution.vo.*;
import com.logpm.warehouse.entity.WarehouseUpdownGoodsEntity;
import com.logpm.warehouse.entity.WarehouseWaybillEntity;
import com.logpm.warehouse.feign.IWarehouseTrayGoodsClient;
@ -51,6 +48,7 @@ import lombok.extern.slf4j.Slf4j;
import org.springblade.common.constant.DictBizConstant;
import org.springblade.common.constant.order.OrderStockupStatusConstant;
import org.springblade.common.exception.CustomerException;
import org.springblade.common.node.PackageNode;
import org.springblade.common.utils.CommonUtil;
import org.springblade.core.log.exception.ServiceException;
import org.springblade.core.mp.base.BaseServiceImpl;
@ -60,6 +58,7 @@ import org.springblade.core.tool.utils.BeanUtil;
import org.springblade.core.tool.utils.Func;
import org.springblade.core.tool.utils.ObjectUtil;
import org.springblade.system.cache.DictBizCache;
import org.springblade.system.feign.IUserClient;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;
@ -103,6 +102,7 @@ public class DistributionParcelListServiceImpl extends BaseServiceImpl<Distribut
private final IWarehouseWaybillClient warehouseWaybillClient;
private final IBasicdataClientClient basicdataClientClient;
private final IUserClient userClient;
// private final IDistributionStockArticleService distributionStockArticleService;
@Override
@ -948,20 +948,75 @@ public class DistributionParcelListServiceImpl extends BaseServiceImpl<Distribut
log.error(method+"查询包件失败packageCode:{}",packageCode);
return R.fail("无此包件信息,请核实输入内容");
}
List<DistributionParcelListNodeVO> parcelListNodeVOS = new ArrayList<>();
//对于配送包件节点
//1、入库
//2、计划
//3、备货
//4、装车
//5、滞留
//6、异常
//7、审核
//8、签收
DistributionParcelListNodeVO distributionParcelListNodeVO = new DistributionParcelListNodeVO();
distributionParcelListNodeVO.setNodeName(PackageNode.ruku.getName());
distributionParcelListNodeVO.setNodeTime(parcelListEntity.getCreateTime());
distributionParcelListNodeVO.setNodeControlsUserName(userClient.userInfoById(parcelListEntity.getCreateUser()).getData().getName());
distributionParcelListNodeVO.setNodeControlsUserId(parcelListEntity.getCreateUser());
distributionParcelListNodeVO.setQuantity(parcelListEntity.getQuantity());
distributionParcelListNodeVO.setOrderCode(parcelListEntity.getOrderCode());
distributionParcelListNodeVO.setOrderPackageCode(parcelListEntity.getOrderPackageCode());
distributionParcelListNodeVO.setDescription("入库");
distributionParcelListNodeVO.setWarehouseName(parcelListEntity.getWarehouse());
distributionParcelListNodeVO.setWarehouseId(parcelListEntity.getWarehouseId());
distributionParcelListNodeVO.setTranNumber(parcelListEntity.getTrainNumber());
parcelListNodeVOS.add(distributionParcelListNodeVO);
//2、上下架
List<DistributionParcelListNodeVO> allocationAndTrayPackage = baseMapper.selectPackageAllocationAndTray(parcelListEntity.getOrderPackageCode(),myCurrentWarehouse.getId());
if (Func.isNotEmpty(allocationAndTrayPackage)){
parcelListNodeVOS.addAll(allocationAndTrayPackage);
}
//3、计划配送
//查询计划配送件数
List<DistributionParcelListNodeVO> planDeliveryPackage =baseMapper.selectPackagePlanDelivery(parcelListEntity.getOrderPackageCode(),myCurrentWarehouse.getId());
if (Func.isNotEmpty(planDeliveryPackage)){
parcelListNodeVOS.addAll(planDeliveryPackage);
}
//查询计划取消的包件
List<DistributionParcelListNodeVO> cancelPlanDeliveryPackage = baseMapper.selectPackageCancelPlanDelivery(parcelListEntity.getOrderPackageCode(),myCurrentWarehouse.getId());
if (Func.isNotEmpty(cancelPlanDeliveryPackage)){
parcelListNodeVOS.addAll(cancelPlanDeliveryPackage);
}
//查询备货
List<DistributionParcelListNodeVO> StockUpPackage = baseMapper.selectPackageStockUp(parcelListEntity.getOrderPackageCode(),myCurrentWarehouse.getId());
if (Func.isNotEmpty(StockUpPackage)){
parcelListNodeVOS.addAll(StockUpPackage);
}
//4、装车扫描
List<DistributionParcelListNodeVO> loadingPackage =baseMapper.selectPackageLoading(parcelListEntity.getOrderPackageCode(),myCurrentWarehouse.getId());
if (Func.isNotEmpty(loadingPackage)){
parcelListNodeVOS.addAll(loadingPackage);
}
//查询取消装车
List<DistributionParcelListNodeVO> cancelLoadingPackage =baseMapper.selectPackageCancelLoading(parcelListEntity.getOrderPackageCode(),myCurrentWarehouse.getId());
if (Func.isNotEmpty(cancelLoadingPackage)){
parcelListNodeVOS.addAll(cancelLoadingPackage);
}
//5、签收扫描
DistributionParcelListNodeVO signingPackage =baseMapper.selectPackageCancelSigning(parcelListEntity.getOrderPackageCode(),myCurrentWarehouse.getId());
if (Func.isNotEmpty(signingPackage)){
parcelListNodeVOS.add(signingPackage);
}
//查询异常审核记录
DistributionParcelListNodeVO examineAbnormalPackage =baseMapper.selectPackageExamineAbnormal(parcelListEntity.getOrderPackageCode(),myCurrentWarehouse.getId());
if (Func.isNotEmpty(examineAbnormalPackage)){
parcelListNodeVOS.add(examineAbnormalPackage);
}
List<DistributionParcelListNodeVO> listNodeVOS = null;
if (Func.isNotEmpty(parcelListNodeVOS)){
parcelListNodeVOS.forEach(p->{
if (Func.isNotEmpty(p.getNodeControlsUserId()) && Func.isEmpty(p.getNodeControlsUserName())){
p.setNodeControlsUserName(userClient.userInfoById(p.getNodeControlsUserId()).getData().getName());
}
});
listNodeVOS = parcelListNodeVOS.stream().sorted(Comparator.comparing(DistributionParcelListNodeVO::getNodeTime)).collect(Collectors.toList());
}
return null;
//6、异常审核
return R.data(listNodeVOS);
}
}

Loading…
Cancel
Save