Browse Source

装车新规代码提交

dist.1.3.0
汤建军 4 months ago
parent
commit
4e1677b530
  1. 14
      blade-service-api/logpm-distribution-api/src/main/java/com/logpm/distribution/vo/app/DistributionAppDetailVO.java
  2. 17
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/api/DistributionDeliveryAppController.java
  3. 7
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/dto/app/DistrilbutionloadingscanDTO.java
  4. 22
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionDeliveryListMapper.xml
  5. 16
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionSignforMapper.xml
  6. 8
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/IDistributionDeliveryListService.java
  7. 168
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionDeliveryListServiceImpl.java
  8. 5
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionSignforServiceImpl.java

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

@ -38,24 +38,28 @@ public class DistributionAppDetailVO implements Serializable {
private String trainNumber;
private Integer kind;
private String vehicleName;
private String driverName;
private Integer orderNumber;
private Integer deliveryNumber;
private Integer planNumber;
private Integer inventoryNub;
private Integer scannedNumber;
private Integer loadingNumber;
private Integer signforNumber;
private String deliStatusName;
private String deliveryStatusName;
private String typeName;
private String isStartName;
private String taskTime;
private List<DistributionAppNewReservationVO> customList;

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

@ -217,6 +217,23 @@ public class DistributionDeliveryAppController {
return msg;
}
/**
* 配送管理 装车扫描
*/
@PostMapping("/newCancelLoadingscan")
@ApiOperationSupport(order = 6)
@ApiOperation(value = "装车扫描", notes = "传入DistrilbutionloadingscanDTO")
public R newCancelLoadingscan(@Valid @RequestBody DistrilbutionloadingscanDTO distrilbutionloadingscanDTO) {
R msg = null;
try{
msg = distributionDeliveryListService.newCancelLoadingscan(distrilbutionloadingscanDTO);
}catch (Exception e){
msg = R.fail(e.getMessage());
log.error(e.getMessage());
}
return msg;
}
/**
* 零担装车
*/

7
blade-service/logpm-distribution/src/main/java/com/logpm/distribution/dto/app/DistrilbutionloadingscanDTO.java

@ -72,6 +72,13 @@ public class DistrilbutionloadingscanDTO {
// @NotEmpty(message = "车辆信息Id不能为空")
private String loadingId;
/**
* 包件ID批量
*/
@ApiModelProperty(value = "包件ID批量")
// @NotEmpty(message = "车辆信息Id不能为空")
private String packageIds;
// /**
// *司机姓名
// */

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

@ -2252,7 +2252,7 @@
</select>
<select id="selectDistributionNewAppDeliveryListPage"
resultType="com.logpm.distribution.vo.app.DistributionAppDeliveryListVO">
resultType="com.logpm.distribution.vo.app.DistributionAppNewDeliveryListVO">
SELECT DISTINCT
lddl.id id,
lddl.train_number trainNumber,
@ -2361,7 +2361,6 @@
SELECT DISTINCT
lddl.id id,
lddl.train_number trainNumber,
lddl.kind kind,
lddl.vehicle_name vehicleName,
lddl.driver_name driverName,
(
@ -2387,7 +2386,7 @@
lds.delivery_id = lddl.id
AND ldr.reservation_status != '40'
AND lds.is_deleted = 0
) deliveryNumber,
) planNumber,
(
SELECT COALESCE
( sum( ldr.reservation_stock_list_num ), 0 )
@ -2408,19 +2407,28 @@
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,
) AS loadingNumber,
CASE lddl.delivery_status
WHEN '1' THEN '待配送'
WHEN '2' THEN '配送中'
WHEN '3' THEN '已完成'
ELSE
'已完成'
'未知'
END deliStatusName,
CASE lddl.type
WHEN '1' THEN '商配'
WHEN '2' 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

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

@ -2000,7 +2000,6 @@
SELECT DISTINCT
lddl.id id,
lddl.train_number trainNumber,
lddl.kind kind,
lddl.vehicle_name vehicleName,
lddl.driver_name driverName,
(
@ -2026,7 +2025,7 @@
lds.delivery_id = lddl.id
AND ldr.reservation_status != '40'
AND lds.is_deleted = 0
) deliveryNumber,
) planNumber,
(
SELECT COALESCE
( sum( ldr.reservation_stock_list_num ), 0 )
@ -2047,7 +2046,7 @@
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,
) AS loadingNumber,
((
SELECT
IFNUll( sum( loaded_nub ), 0 )
@ -2063,13 +2062,15 @@
CASE lddl.delivery_status
WHEN '1' THEN '待配送'
WHEN '2' THEN '配送中'
WHEN '3' THEN '已完成'
ELSE
'已完成'
END deliStatusName,
'未知'
END deliveryStatusName,
CASE lddl.type
WHEN '1' THEN '商配'
WHEN '2' THEN '市配'
ELSE
'市配'
'未知'
END typeName,
CASE lddl.is_start
WHEN '10' THEN '待发车'
@ -2077,7 +2078,8 @@
WHEN '30' THEN '已发车'
ELSE
'未知'
END isStartName
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

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

@ -137,7 +137,6 @@ public interface IDistributionDeliveryListService extends BaseService<Distributi
IPage<DistributionAppDeliveryListVO> selectDistributionAppDeliveryListPage(IPage<DistributionAppDeliveryListVO> page, DistributionAppDeliveryListDTO distributionAppDeliveryListDTO);
/**
* PDA查询当前司机配送列表
* @param page
* @param distributionDeliveryList
* @return
*/
@ -528,6 +527,13 @@ public interface IDistributionDeliveryListService extends BaseService<Distributi
*/
R newAbnormalLoading(DistrilbutionloadingscanDTO distrilbutionloadingscanDTO);
/**
* 取消装车
* @param distrilbutionloadingscanDTO
* @return
*/
R newCancelLoadingscan(DistrilbutionloadingscanDTO distrilbutionloadingscanDTO);
/**

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

@ -1109,7 +1109,6 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl<Distrib
}
private NodeFanoutMsg<DistributionLoadVO> buildNodeFanoutMsgByPackage(DistributionDeliveryListEntity distributionDeliveryListEntity, List<DistributionLoadscanEntity> pushNodeList) {
NodeFanoutMsg<DistributionLoadVO> nodeFanoutMsg = new NodeFanoutMsg();
nodeFanoutMsg.setBizOperation(BizOperationEnums.ADD);
@ -3592,7 +3591,6 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl<Distrib
}
@NotNull
private DistributionTaskVO getDistributionTaskVO(DistributionDeliveryListEntity distributionDeliveryListEntity) {
DistributionTaskVO distributionTaskVO = new DistributionTaskVO();
@ -3610,7 +3608,6 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl<Distrib
}
private boolean checkList(List<DistributionReservationPackageEntity> list, Long id, Long stockArticleId, String orderPackageCode) {
return list.stream().anyMatch(e -> e.getStockArticleId().equals(stockArticleId) && e.getPacketBarCode().equals(orderPackageCode) && e.getReservationId().equals(id));
@ -4721,6 +4718,7 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl<Distrib
/**
* 发车日志记录
*
* @param distributionDeliveryListEntity
* @param user
* @param myCurrentWarehouse
@ -6236,7 +6234,6 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl<Distrib
}
return Resp.scanSuccess("装车成功", str.toString());
}
@ -6276,8 +6273,6 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl<Distrib
distributionLoadVO.setTrainNumber(distributionDeliveryListEntity.getTrainNumber());
List<PackageData> data = new ArrayList<>();
for (DistributionLoadscanEntity distributionLoadscanEntity : pushNodeList) {
@ -9258,6 +9253,166 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl<Distrib
return Resp.scanSuccess("操作成功", "异常" + abnormalTotal + "件");
}
@Override
public R newCancelLoadingscan(DistrilbutionloadingscanDTO distrilbutionloadingscanDTO) {
String method = "######################DistributionDeliveryServiceImpl.newCancelLoadingscan";
if (Objects.isNull(distrilbutionloadingscanDTO.getBarcode())) {
log.error(method + "参数缺失Barcode");
return Resp.fail("参数缺失,请联系管理员");
}
if (Objects.isNull(distrilbutionloadingscanDTO.getDeliveryId())) {
log.error(method + "参数缺失DeliveryId");
return Resp.fail("参数缺失,请联系管理员");
}
if (Objects.isNull(distrilbutionloadingscanDTO.getReservationId())) {
log.error(method + "参数缺失ReservationId");
return Resp.fail("参数缺失,请联系管理员");
}
if (Objects.isNull(distrilbutionloadingscanDTO.getType())) {
log.error(method + "参数缺失Type");
return Resp.fail("参数缺失,请联系管理员");
}
BasicdataWarehouseEntity myCurrentWarehouse = warehouseClient.getMyCurrentWarehouse();
if (Objects.isNull(myCurrentWarehouse)) {
log.error(method + "参数缺失Type()");
return R.fail(403, "未授权!!!");
}
Long deliveryId = distrilbutionloadingscanDTO.getDeliveryId();
Long reservationId = distrilbutionloadingscanDTO.getReservationId();
DistributionDeliveryListEntity deliveryListEntity = this.getById(distrilbutionloadingscanDTO.getDeliveryId());
if (Objects.isNull(deliveryListEntity)) {
log.error(method + "查询配送失败,deliveryId:{}", deliveryId);
return Resp.fail("配送信息错误,请联系管理员");
}
if (!DeliveryStartStatusConstant.daifache.getValue().equals(deliveryListEntity.getIsStart())) {
return Resp.scanFail("当前车次已发车", "当前车次已发车");
}
DistributionReservationEntity reservationEntity = distributionReservationService.getById(reservationId);
if (Objects.isNull(deliveryListEntity)) {
log.error(method + "查询预约失败,reservationId:{}", reservationId);
return Resp.fail("预约计划错误,请联系管理员");
}
switch (distrilbutionloadingscanDTO.getType()) {
case 1:
//订制品
if (Objects.isNull(distrilbutionloadingscanDTO.getPackageIds())) {
log.error(method + "参数缺失PackageIds()");
return Resp.fail("参数缺失,请联系管理员");
}
List<Long> ids = Func.toLongList(distrilbutionloadingscanDTO.getPackageIds());
//校验包件是否存在签收包件
List<DistributionParcelListEntity> parcelListEntities = distributionParcelListService.list(Wrappers.<DistributionParcelListEntity>query().lambda()
.in(DistributionParcelListEntity::getId, ids)
.eq(DistributionParcelListEntity::getWarehouseId, myCurrentWarehouse.getId())
);
if (parcelListEntities.isEmpty()) {
log.error(method + "查询包件失败:packageIds:{}", ids);
return Resp.scanFail("包件数据错误,请联系管理员", "包件数据错误,请联系管理员");
}
boolean isSignfor = parcelListEntities.stream().anyMatch(f -> OrderPackageStatusConstant.yiqianshou.getValue().equals(f.getOrderPackageStatus()));
if (isSignfor) {
//存在签收包件 无法继续进行取消操作
String errorOrderPackageCode = parcelListEntities.stream().filter(f -> OrderPackageStatusConstant.yiqianshou.getValue().equals(f.getOrderPackageStatus())).map(DistributionParcelListEntity::getOrderPackageCode).collect(Collectors.joining(","));
return Resp.fail("操作失败," + errorOrderPackageCode + "已签收");
}
boolean isLoading = parcelListEntities.stream().anyMatch(f -> OrderPackageLoadingStatusConstant.weizhuancghe.getValue().equals(f.getOrderPackageLoadingStatus()));
if (isLoading) {
//存在签收包件 无法继续进行取消操作
String errorOrderPackageCode = parcelListEntities.stream().filter(f -> OrderPackageLoadingStatusConstant.weizhuancghe.getValue().equals(f.getOrderPackageLoadingStatus())).map(DistributionParcelListEntity::getOrderPackageCode).collect(Collectors.joining(","));
return Resp.fail("操作失败," + errorOrderPackageCode + "未装车");
}
//进行装车取消
distributionLoadscanService.remove(Wrappers.<DistributionLoadscanEntity>update().lambda()
.eq(DistributionLoadscanEntity::getDeliveryId, deliveryId)
.eq(DistributionLoadscanEntity::getReservationId, reservationId)
.in(DistributionLoadscanEntity::getPackageId, ids)
);
//包件状态维护
distributionParcelListService.update(Wrappers.<DistributionParcelListEntity>update().lambda()
.in(DistributionParcelListEntity::getId, ids)
.set(DistributionParcelListEntity::getOrderPackageLoadingStatus, OrderPackageLoadingStatusConstant.weizhuancghe.getValue())
);
//维护订单
String orderCode = parcelListEntities.stream().map(DistributionParcelListEntity::getOrderCode).collect(Collectors.joining(","));
distributionStockArticleService.maintenanceOrderInfo(orderCode, myCurrentWarehouse.getId());
//增加日志
List<JSONObject> cancelPackageLogList = handleCancelPackagelog(parcelListEntities, myCurrentWarehouse, deliveryListEntity.getTrainNumber(), reservationEntity.getReservationCode());
if (!cancelPackageLogList.isEmpty()) {
trunklinePackageTrackLogClient.addPackageTrackLog(cancelPackageLogList);
}
//扣减装车数量
distributionSignforMapper.deductionLoadingPacjageNum(reservationId,deliveryId,parcelListEntities.size());
break;
case 2:
//零担
break;
case 3:
if (Objects.isNull(distrilbutionloadingscanDTO.getPackageIds())) {
log.error(method + "参数缺失PackageIds()");
return Resp.fail("参数缺失,请联系管理员");
}
List<Long> inventoryPackageIds = Func.toLongList(distrilbutionloadingscanDTO.getPackageIds());
//查询库存品包件信息
List<DisStockListDetailEntity> disStockListDetailEntities = disStockListDetailService.listByIds(inventoryPackageIds);
if (!disStockListDetailEntities.isEmpty()) {
log.error(method + "查询库存品包件失败:inventoryPackageIds:{}", inventoryPackageIds);
return Resp.scanFail("库存品包件数据错误,请联系管理员", "库存品包件数据错误,请联系管理员");
}
//查询是否存在签收
boolean inventoryIsSignfor = disStockListDetailEntities.stream().anyMatch(f -> InventorySigningStatusConstant.yiqianshou.getValue().equals(f.getStockSignfoStatus()));
if (inventoryIsSignfor) {
String errorInventoryCode = disStockListDetailEntities.stream()
.filter(f -> InventorySigningStatusConstant.yiqianshou.getValue()
.equals(f.getStockSignfoStatus())).map(DisStockListDetailEntity::getStockPackageCode)
.collect(Collectors.joining(","));
return Resp.fail("操作失败," + errorInventoryCode + "已签收");
}
boolean inventoryIsLoading= disStockListDetailEntities.stream().anyMatch(f -> InventoryLoadingStatusConstant.weizhuangche.getValue().equals(f.getStockLockingStatus()));
if (inventoryIsLoading) {
String errorInventoryCode = disStockListDetailEntities.stream()
.filter(f -> InventoryLoadingStatusConstant.weizhuangche.getValue().equals(f.getStockLockingStatus())).map(DisStockListDetailEntity::getStockPackageCode)
.collect(Collectors.joining(","));
return Resp.fail("操作失败," + errorInventoryCode + "未装车");
}
//进行装车取消
distributionLoadscaninvnService.remove(Wrappers.<DistributionLoadscaninvnEntity>update().lambda()
.eq(DistributionLoadscaninvnEntity::getDeliveryId,deliveryId)
.eq(DistributionLoadscaninvnEntity::getReservationId,reservationId)
.in(DistributionLoadscaninvnEntity::getInventoryPackageId,inventoryPackageIds)
.set(DistributionLoadscaninvnEntity::getScanStatus,LoadingStatusConstant.quxiao.getValue())
);
//维护库存品包件状态
disStockListDetailService.update(Wrappers.<DisStockListDetailEntity>update().lambda()
.in(DisStockListDetailEntity::getId,inventoryPackageIds)
.set(DisStockListDetailEntity::getStockLockingStatus,InventoryLoadingStatusConstant.weizhuangche.getValue())
);
//装车数量扣减
distributionSignforMapper.deductionLoadingPacjageNum(reservationId,deliveryId,inventoryPackageIds.size());
//库存品
break;
default:
log.error(method + "未知Type:{}", distrilbutionloadingscanDTO.getType());
return Resp.scanFail("操作失败", "操作失败");
}
//维护预约计划
distributionReservationService.maintenanceReservationInfo(reservationId);
//维护配送计划
this.maintenanceDeliveryInfo(deliveryId);
return Resp.scanSuccess("操作成功","操作成功");
}
private List<JSONObject> handleCancelPackagelog(List<DistributionParcelListEntity> parcelListEntities, BasicdataWarehouseEntity warehouse, String trainNumber, String reservationCode) {
List<JSONObject> packageLogList = new ArrayList<>();
String content = "包件在" + warehouse.getName() + "由" + AuthUtil.getNickName() + "取消装车,配送车次号:" + trainNumber + "预约任务号:" + reservationCode;
for (DistributionParcelListEntity parcelListEntity : parcelListEntities) {
JSONObject trunklinePackageTrackLog = handleLogJSONObject(warehouse, AuthUtil.getUser(), parcelListEntity.getOrderPackageCode(), content, WorkNodeEnums.DISTRIBUTION_CANCEL_LOADING.getCode());
packageLogList.add(trunklinePackageTrackLog);
}
return packageLogList;
}
private void updateZeroLoadingEntity(DistributionLoadscanEntity loadscanEntity, DistributionParcelNumberDTO parcelListDTO, BasicdataWarehouseEntity myCurrentWarehouse, Map<Long, DistributionParcelNumberEntity> zeroPackageMap) {
//维护零担出库数量
DistributionParcelNumberEntity parcelNumberEntity = zeroPackageMap.get(parcelListDTO.getParcelListId());
@ -9388,6 +9543,7 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl<Distrib
loadscanEntity.setDeliveryId(deliveryListEntity.getId());
loadscanEntity.setOrderId(parcelListEntity.getStockArticleId());
loadscanEntity.setScanTime(now);
loadscanEntity.setIsZero(Integer.parseInt(IsOrNoConstant.no.getValue()));
loadscanEntity.setScanUser(user.getNickName());
loadscanEntity.setLoadingId(distributionDeliverySelfEntity.getId() + "");
loadscanEntity.setIsAbnormalLoading(1);

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

@ -5641,7 +5641,6 @@ public class DistributionSignforServiceImpl extends BaseServiceImpl<Distribution
trunklinePackageTrackLog = handleLogJSONObject(myCurrentWarehouse, AuthUtil.getUser(), parcelListEntity.getOrderPackageCode(), content, WorkNodeEnums.DISTRIBUTION_ABNORMAL_SIGN_FOR.getCode(), distributionDeliveryListEntity.getTrainNumber(), parcelListEntity.getWarehouseEntryTimeEnd());
//distributionAsyncService.sendFactory(parcelListEntity, loadscanEntity.getSigningTime(), reservationEntity.getId(), reservationEntity.getReservationCode(), myCurrentWarehouse.getName(), user.getNickName());
sendNodeWorkDataBroadcast(parcelListEntity, reservationEntity, loadscanEntity.getSigningTime(), myCurrentWarehouse);
} else {
loadscanEntities.setMsg("司机一键签收数据补录");
if (!loadscanEntities.getSignforState().equals(LoadScanSigningStatusConstant.yiqianshou.getValue())) {
@ -5662,10 +5661,8 @@ public class DistributionSignforServiceImpl extends BaseServiceImpl<Distribution
// distributionAsyncService.sendFactory(parcelListEntity, loadscanEntities.getSigningTime(), reservationEntity.getId(), reservationEntity.getReservationCode(), myCurrentWarehouse.getName(), user.getNickName());
// 节点作业推送
sendNodeWorkDataBroadcast(parcelListEntity, reservationEntity, loadscanEntities.getSigningTime(), myCurrentWarehouse);
}
}
trunklinePackageTrackLog.put("workNode", WorkNodeEnums.DISTRIBUTION_SIGN_FOR.getCode());
trunklinePackageTrackLog.put("content", content);
aaa.add(trunklinePackageTrackLog);
@ -7433,7 +7430,7 @@ public class DistributionSignforServiceImpl extends BaseServiceImpl<Distribution
List<JSONObject> aaa = new ArrayList<>();
DistributionReservationPackageEntity planPackage = distributionReservationPackageService.getPlanPackageByReservationAndCode(reservationId,barcode);
if (Objects.isNull(planPackage)){
if (!Objects.isNull(planPackage)){
List<DistributionLoadscanAbnormalEntity> abnormalEntities = distributionLoadscanAbnormalService.list(Wrappers.<DistributionLoadscanAbnormalEntity>query().lambda()
.eq(DistributionLoadscanAbnormalEntity::getPackageCode, barcode)
.eq(DistributionLoadscanAbnormalEntity::getGoodsType, 1)

Loading…
Cancel
Save