|
|
|
@ -17,6 +17,7 @@
|
|
|
|
|
package com.logpm.distribution.service.impl; |
|
|
|
|
|
|
|
|
|
import cn.hutool.core.collection.CollUtil; |
|
|
|
|
import cn.hutool.core.convert.Convert; |
|
|
|
|
import cn.hutool.core.date.DateUtil; |
|
|
|
|
import cn.hutool.json.JSONUtil; |
|
|
|
|
import com.alibaba.fastjson.JSONObject; |
|
|
|
@ -80,7 +81,9 @@ import org.springblade.common.constant.signing.SignforStatusConstant;
|
|
|
|
|
import org.springblade.common.constant.stockup.StockAssignStatusConstant; |
|
|
|
|
import org.springblade.common.constant.stockup.StockupStatusConstant; |
|
|
|
|
import org.springblade.common.enums.BizOperationEnums; |
|
|
|
|
import org.springblade.common.enums.PackageTypeEnums; |
|
|
|
|
import org.springblade.common.exception.CustomerException; |
|
|
|
|
import org.springblade.common.model.*; |
|
|
|
|
import org.springblade.common.serviceConstant.ServiceConstant; |
|
|
|
|
import org.springblade.common.utils.CommonUtil; |
|
|
|
|
import org.springblade.common.utils.QRCodeUtil; |
|
|
|
@ -94,6 +97,7 @@ import org.springblade.core.redis.cache.BladeRedis;
|
|
|
|
|
import org.springblade.core.secure.BladeUser; |
|
|
|
|
import org.springblade.core.secure.utils.AuthUtil; |
|
|
|
|
import org.springblade.core.tool.api.R; |
|
|
|
|
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; |
|
|
|
@ -270,6 +274,9 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl<Distrib
|
|
|
|
|
@Autowired |
|
|
|
|
private IDistributionNodeWorkService distributionNodeWorkService; |
|
|
|
|
|
|
|
|
|
@Autowired |
|
|
|
|
private IBasicdataDriverArteryClient basicdataDriverArteryClient; |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public IPage<DistributionDeliveryListEntity> selectDistributionDeliveryListPage(IPage<DistributionDeliveryListEntity> page, DistributionDeliveryListDTO distributionDeliveryList) { |
|
|
|
|
//转换创建时间
|
|
|
|
@ -610,13 +617,6 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl<Distrib
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// -----------------------------------2023-09-25 签收调整----------------------------------------------------------------
|
|
|
|
|
// 首先这里需要查看该包件是否属于该配送任务
|
|
|
|
|
// 属于该配送任务需要进行是否属于该客户进行判断
|
|
|
|
|
// 如果属于该客户则进行装车扫描
|
|
|
|
|
//
|
|
|
|
|
|
|
|
|
|
//获取当前用户司机
|
|
|
|
|
DistributionDeliveryListEntity distributionDeliveryListEntity = distributionDeliveryListMapper.selectById(distrilbutionloadingscanDTO.getDeliveryId()); |
|
|
|
|
|
|
|
|
@ -645,6 +645,7 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl<Distrib
|
|
|
|
|
BeanUtils.copyProperties(distributionDeliveryTripartiteEntity, distributionDeliverySelfEntity); |
|
|
|
|
} |
|
|
|
|
List<DistributionParcelListEntity> pushList = new ArrayList<>(); |
|
|
|
|
List<DistributionLoadscanEntity> pushNodeList = new ArrayList<>(); |
|
|
|
|
if (distrilbutionloadingscanDTO.getType() == 1) { |
|
|
|
|
List<DisStockListDetailEntity> list = disStockListDetailService.list(Wrappers.<DisStockListDetailEntity>query().lambda() |
|
|
|
|
.eq(DisStockListDetailEntity::getStockPackageCode, distrilbutionloadingscanDTO.getBarcode()) |
|
|
|
@ -766,6 +767,7 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl<Distrib
|
|
|
|
|
loadscanEntity.setIsAbnormalLoading(1); |
|
|
|
|
loadscanEntity.setLoadedNub(parcelListEntity.getQuantity()); |
|
|
|
|
distributionLoadscanService.save(loadscanEntity); |
|
|
|
|
pushNodeList.add(loadscanEntity); |
|
|
|
|
//更新包件装车状态
|
|
|
|
|
packageLockIds.add(loadscanEntity.getPackageId()); |
|
|
|
|
parcelListEntity.setOrderPackageLoadingStatus(OrderPackageLoadingStatusConstant.yizhuangche.getValue()); |
|
|
|
@ -813,7 +815,6 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl<Distrib
|
|
|
|
|
|
|
|
|
|
pushList.add(parcelListEntity); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// extracteOrderPackageStatus(distrilbutionloadingscanDTO, parcelListEntity, myCurrentWarehouse, reservationEntity);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -1000,6 +1001,8 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl<Distrib
|
|
|
|
|
aaa.add(trunklinePackageTrackLog); |
|
|
|
|
orderPackageCodes.add(loadscanEntity.getOrderPackageCode()); |
|
|
|
|
pushList.add(parcelListEntity); |
|
|
|
|
pushNodeList.add(loadscanEntity); |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
JSONObject jsonObject = new JSONObject(); |
|
|
|
@ -1043,7 +1046,18 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl<Distrib
|
|
|
|
|
return Resp.scanFail("查询托盘货物失败", "查询托盘货物失败"); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(CollUtil.isNotEmpty(pushNodeList)){ |
|
|
|
|
DistributionDeliveryListEntity deliveryListEntity = distributionDeliveryListService.getById(distrilbutionloadingscanDTO.getDeliveryId()); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
NodeFanoutMsg<DistributionLoadVO> nodeFanoutMsg = buildNodeFanoutMsgByPackage(deliveryListEntity, pushNodeList); |
|
|
|
|
distributionNodeWorkService.nodeLoading(nodeFanoutMsg, AuthUtil.getUser()); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (CollUtil.isNotEmpty(pushList)) { |
|
|
|
|
|
|
|
|
|
for (DistributionParcelListEntity parcelListEntity : pushList) { |
|
|
|
|
List<Object> contents = new ArrayList<>(); |
|
|
|
|
PushData pushData = PushData.builder() |
|
|
|
@ -1061,6 +1075,7 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl<Distrib
|
|
|
|
|
log.info("推送工厂数据:{}", JSONUtil.toJsonStr(msg)); |
|
|
|
|
factoryDataMessageSender.sendNodeDataByBrand(msg); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
//添加缓存
|
|
|
|
|
if (!packageLockIds.isEmpty()) { |
|
|
|
@ -1088,6 +1103,205 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl<Distrib
|
|
|
|
|
return Resp.scanSuccessWithData("装车成功", carLaodNum + "件", carLaodNum); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private DistributionTaskVO buildDistributionTaskVO(DistributionDeliveryListEntity distributionDeliveryListEntity, Long userId) { |
|
|
|
|
|
|
|
|
|
DistributionTaskVO taskVO = new DistributionTaskVO(); |
|
|
|
|
taskVO.setId(distributionDeliveryListEntity.getId()); |
|
|
|
|
taskVO.setTrainNumber(distributionDeliveryListEntity.getTrainNumber()); |
|
|
|
|
taskVO.setKind(distributionDeliveryListEntity.getKind()); |
|
|
|
|
taskVO.setType(distributionDeliveryListEntity.getType()); |
|
|
|
|
taskVO.setDistributionCompany(distributionDeliveryListEntity.getDistributionCompany()); |
|
|
|
|
taskVO.setTaskTime(distributionDeliveryListEntity.getTaskTime()); |
|
|
|
|
|
|
|
|
|
List<PlanDriverbindCarVO> planDriverbindCarVOS = buildDeliveryCarDriverInfor(distributionDeliveryListEntity); |
|
|
|
|
taskVO.setPlanDriverbindCars(planDriverbindCarVOS); |
|
|
|
|
|
|
|
|
|
String driverName = distributionDeliveryListEntity.getDriverName(); |
|
|
|
|
String vehicleName = distributionDeliveryListEntity.getVehicleName(); |
|
|
|
|
// 如果是自主配送 需要去获取当前司机绑定的车牌
|
|
|
|
|
if ("1".equals(distributionDeliveryListEntity.getKind())) { |
|
|
|
|
BasicdataDriverArteryEntity driverArteryById = basicdataDriverArteryClient.getDriverArteryById(userId); |
|
|
|
|
if (driverArteryById != null) { |
|
|
|
|
|
|
|
|
|
for (int i = 0; i < planDriverbindCarVOS.size(); i++) { |
|
|
|
|
if (planDriverbindCarVOS.get(i).getDriverName().equals(driverArteryById.getName())) { |
|
|
|
|
driverName = planDriverbindCarVOS.get(i).getDriverName(); |
|
|
|
|
vehicleName = planDriverbindCarVOS.get(i).getCarPlate(); |
|
|
|
|
break; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
taskVO.setDriverName(driverName); |
|
|
|
|
taskVO.setVehicleName(vehicleName); |
|
|
|
|
return taskVO; |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private NodeFanoutMsg<DistributionLoadVO> buildNodeFanoutMsgByPackage(DistributionDeliveryListEntity distributionDeliveryListEntity, List<DistributionLoadscanEntity> pushNodeList) { |
|
|
|
|
NodeFanoutMsg<DistributionLoadVO> nodeFanoutMsg = new NodeFanoutMsg(); |
|
|
|
|
nodeFanoutMsg.setBizOperation(BizOperationEnums.ADD); |
|
|
|
|
nodeFanoutMsg.setNode(WorkNodeEnums.DISTRIBUTION_LOADING); |
|
|
|
|
nodeFanoutMsg.setWarehouse(distributionDeliveryListEntity.getWarehouseName()); |
|
|
|
|
nodeFanoutMsg.setWarehouseId(distributionDeliveryListEntity.getWarehouseId()); |
|
|
|
|
nodeFanoutMsg.setOperator(AuthUtil.getTenantId()); |
|
|
|
|
nodeFanoutMsg.setOperatorTime(distributionDeliveryListEntity.getUpdateTime()); |
|
|
|
|
|
|
|
|
|
// DistributionTaskVO taskVO = buildDistributionTaskVO(distributionDeliveryListEntity, AuthUtil.getUserId());
|
|
|
|
|
DistributionLoadVO distributionLoadVO = new DistributionLoadVO(); |
|
|
|
|
|
|
|
|
|
List<PlanDriverbindCarVO> planDriverbindCarVOS = buildDeliveryCarDriverInfor(distributionDeliveryListEntity); |
|
|
|
|
|
|
|
|
|
String driverName = distributionDeliveryListEntity.getDriverName(); |
|
|
|
|
String vehicleName = distributionDeliveryListEntity.getVehicleName(); |
|
|
|
|
// 如果是自主配送 需要去获取当前司机绑定的车牌
|
|
|
|
|
if ("1".equals(distributionDeliveryListEntity.getKind())) { |
|
|
|
|
BasicdataDriverArteryEntity driverArteryById = basicdataDriverArteryClient.getDriverArteryById(AuthUtil.getUserId()); |
|
|
|
|
if (driverArteryById != null) { |
|
|
|
|
|
|
|
|
|
for (int i = 0; i < planDriverbindCarVOS.size(); i++) { |
|
|
|
|
if (planDriverbindCarVOS.get(i).getDriverName().equals(driverArteryById.getName())) { |
|
|
|
|
driverName = planDriverbindCarVOS.get(i).getDriverName(); |
|
|
|
|
vehicleName = planDriverbindCarVOS.get(i).getCarPlate(); |
|
|
|
|
break; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
distributionLoadVO.setDriverName(driverName); |
|
|
|
|
distributionLoadVO.setVehicleName(vehicleName); |
|
|
|
|
|
|
|
|
|
nodeFanoutMsg.setMain(distributionLoadVO); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
List<PackageData> data = new ArrayList<>(); |
|
|
|
|
|
|
|
|
|
for (DistributionLoadscanEntity distributionParcelListEntity : pushNodeList) { |
|
|
|
|
|
|
|
|
|
PackageData packageData = new PackageData(); |
|
|
|
|
packageData.setPackageCode(distributionParcelListEntity.getOrderPackageCode()); |
|
|
|
|
packageData.setPackageType(PackageTypeEnums.CMP); |
|
|
|
|
data.add(packageData); |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
nodeFanoutMsg.setDetails(data); |
|
|
|
|
|
|
|
|
|
return nodeFanoutMsg; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private List<PlanDriverbindCarVO> buildDeliveryCarDriverInfor(DistributionDeliveryListEntity distributionDeliveryListEntity) { |
|
|
|
|
List<PlanDriverbindCarVO> jsonArray = new ArrayList<>(); |
|
|
|
|
// 自主配送
|
|
|
|
|
if ("1".equals(distributionDeliveryListEntity.getKind())) { |
|
|
|
|
LambdaQueryWrapper<DistributionDeliverySelfEntity> queryWrapper = new LambdaQueryWrapper<>(); |
|
|
|
|
queryWrapper.eq(DistributionDeliverySelfEntity::getDeliveryId, distributionDeliveryListEntity.getId()); |
|
|
|
|
List<DistributionDeliverySelfEntity> list = distributionDeliverySelfService.list(queryWrapper); |
|
|
|
|
if (list != null && !list.isEmpty()) { |
|
|
|
|
for (DistributionDeliverySelfEntity distributionDeliverySelfEntity : list) { |
|
|
|
|
|
|
|
|
|
PlanDriverbindCarVO planDriverbindCarVO = new PlanDriverbindCarVO(); |
|
|
|
|
planDriverbindCarVO.setCarPlate(distributionDeliverySelfEntity.getVehicleNub()); |
|
|
|
|
planDriverbindCarVO.setDriverName(distributionDeliverySelfEntity.getDriverName()); |
|
|
|
|
|
|
|
|
|
jsonArray.add(planDriverbindCarVO); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} else { |
|
|
|
|
LambdaQueryWrapper<DistributionDeliveryTripartiteEntity> queryWrapper = new LambdaQueryWrapper<>(); |
|
|
|
|
queryWrapper.eq(DistributionDeliveryTripartiteEntity::getDeliveryId, distributionDeliveryListEntity.getId()); |
|
|
|
|
List<DistributionDeliveryTripartiteEntity> list = distributionDeliveryTripartiteService.list(queryWrapper); |
|
|
|
|
if (list != null && !list.isEmpty()) { |
|
|
|
|
for (DistributionDeliveryTripartiteEntity distributionDeliverySelfEntity : list) { |
|
|
|
|
PlanDriverbindCarVO planDriverbindCarVO = new PlanDriverbindCarVO(); |
|
|
|
|
planDriverbindCarVO.setCarPlate(distributionDeliverySelfEntity.getVehicleNum()); |
|
|
|
|
planDriverbindCarVO.setDriverName(distributionDeliverySelfEntity.getDriverName()); |
|
|
|
|
|
|
|
|
|
jsonArray.add(planDriverbindCarVO); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
return jsonArray; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private NodeFanoutMsg<DistributionLoadVO> buildNodeFanoutMsgByStock(DistributionDeliveryListEntity distributionDeliveryListEntity, List<DistributionLoadscaninvnEntity> ts) { |
|
|
|
|
NodeFanoutMsg<DistributionLoadVO> nodeFanoutMsg = new NodeFanoutMsg(); |
|
|
|
|
nodeFanoutMsg.setBizOperation(BizOperationEnums.ADD); |
|
|
|
|
nodeFanoutMsg.setNode(WorkNodeEnums.DISTRIBUTION_LOADING); |
|
|
|
|
nodeFanoutMsg.setWarehouse(distributionDeliveryListEntity.getWarehouseName()); |
|
|
|
|
nodeFanoutMsg.setWarehouseId(distributionDeliveryListEntity.getWarehouseId()); |
|
|
|
|
nodeFanoutMsg.setOperator(AuthUtil.getTenantId()); |
|
|
|
|
nodeFanoutMsg.setOperatorTime(distributionDeliveryListEntity.getCreateTime()); |
|
|
|
|
|
|
|
|
|
// DistributionTaskVO taskVO = buildDistributionTaskVO(distributionDeliveryListEntity, AuthUtil.getUserId());
|
|
|
|
|
// nodeFanoutMsg.setMain(taskVO);
|
|
|
|
|
DistributionLoadVO distributionLoadVO = new DistributionLoadVO(); |
|
|
|
|
|
|
|
|
|
List<PlanDriverbindCarVO> planDriverbindCarVOS = buildDeliveryCarDriverInfor(distributionDeliveryListEntity); |
|
|
|
|
|
|
|
|
|
String driverName = distributionDeliveryListEntity.getDriverName(); |
|
|
|
|
String vehicleName = distributionDeliveryListEntity.getVehicleName(); |
|
|
|
|
// 如果是自主配送 需要去获取当前司机绑定的车牌
|
|
|
|
|
if ("1".equals(distributionDeliveryListEntity.getKind())) { |
|
|
|
|
BasicdataDriverArteryEntity driverArteryById = basicdataDriverArteryClient.getDriverArteryById(AuthUtil.getUserId()); |
|
|
|
|
if (driverArteryById != null) { |
|
|
|
|
|
|
|
|
|
for (int i = 0; i < planDriverbindCarVOS.size(); i++) { |
|
|
|
|
if (planDriverbindCarVOS.get(i).getDriverName().equals(driverArteryById.getName())) { |
|
|
|
|
driverName = planDriverbindCarVOS.get(i).getDriverName(); |
|
|
|
|
vehicleName = planDriverbindCarVOS.get(i).getCarPlate(); |
|
|
|
|
break; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
distributionLoadVO.setDriverName(driverName); |
|
|
|
|
distributionLoadVO.setVehicleName(vehicleName); |
|
|
|
|
nodeFanoutMsg.setMain(distributionLoadVO); |
|
|
|
|
List<PackageData> data = new ArrayList<>(); |
|
|
|
|
|
|
|
|
|
for (DistributionLoadscaninvnEntity distributionParcelListEntity : ts) { |
|
|
|
|
data.add(getPackageDataByStock(distributionParcelListEntity)); |
|
|
|
|
} |
|
|
|
|
nodeFanoutMsg.setDetails(data); |
|
|
|
|
|
|
|
|
|
return nodeFanoutMsg; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@NotNull |
|
|
|
|
private PackageData getPackageDataByStock(DistributionLoadscaninvnEntity stockEntity) { |
|
|
|
|
PackageData packageData = new PackageData(); |
|
|
|
|
// 查询出库存品信息
|
|
|
|
|
DistributionStockListEntity stockListEntity = distributionStockListService.getById(stockEntity.getInventoryId()); |
|
|
|
|
if (stockListEntity == null) { |
|
|
|
|
throw new CustomerException("库存品信息不存在"); |
|
|
|
|
} |
|
|
|
|
packageData.setBrand(stockListEntity.getBrandName()); |
|
|
|
|
packageData.setPackageCode(stockEntity.getOrderPackageCode()); |
|
|
|
|
packageData.setMallName(stockListEntity.getMallName()); |
|
|
|
|
packageData.setMaterialCode(stockListEntity.getMarketCode()); |
|
|
|
|
packageData.setMaterialName(stockListEntity.getDescriptionGoods()); |
|
|
|
|
packageData.setOrderCode(stockListEntity.getOrderCode()); |
|
|
|
|
packageData.setPackageType(PackageTypeEnums.INV); |
|
|
|
|
packageData.setNumber(1); |
|
|
|
|
return packageData; |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@NotNull |
|
|
|
|
private PackageData getPackageData(DistributionParcelListEntity parcelListEntity) { |
|
|
|
|
PackageData packageData = new PackageData(); |
|
|
|
|
packageData.setWaybillNumber(parcelListEntity.getWaybillNumber()); |
|
|
|
|
packageData.setBrand(parcelListEntity.getBrandName()); |
|
|
|
|
packageData.setPackageCode(parcelListEntity.getOrderPackageCode()); |
|
|
|
|
packageData.setMaterialCode(parcelListEntity.getMaterialCode()); |
|
|
|
|
packageData.setMaterialName(parcelListEntity.getMaterialName()); |
|
|
|
|
packageData.setNumber(1); |
|
|
|
|
packageData.setOrderCode(parcelListEntity.getOrderCode()); |
|
|
|
|
packageData.setPackageType(PackageTypeEnums.CMP); |
|
|
|
|
return packageData; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private void extracteOrderPackageStatus(DistrilbutionloadingscanDTO distrilbutionloadingscanDTO, DistributionParcelListEntity parcelListEntity, BasicdataWarehouseEntity myCurrentWarehouse, DistributionReservationEntity reservationEntity) { |
|
|
|
|
Map<String, Object> map = new HashMap<>(); |
|
|
|
|
map.put("orderPackageCode", parcelListEntity.getOrderPackageCode()); |
|
|
|
@ -1671,6 +1885,7 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl<Distrib
|
|
|
|
|
@Override |
|
|
|
|
@Transactional(isolation = Isolation.READ_COMMITTED, rollbackFor = Exception.class) |
|
|
|
|
public Resp loadinginventory(DistrilbutionloadingscanDTO distrilbutionloadingscanDTO) { |
|
|
|
|
List<DistributionLoadscaninvnEntity> ts = new ArrayList<>(); |
|
|
|
|
BasicdataWarehouseEntity myCurrentWarehouse = warehouseClient.getMyCurrentWarehouse(); |
|
|
|
|
if (Func.isEmpty(myCurrentWarehouse)) { |
|
|
|
|
return Resp.scanFail("未授权", "未授权!!!"); |
|
|
|
@ -1701,7 +1916,7 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl<Distrib
|
|
|
|
|
//这里进行扫描数据的插入和库存品包件信息出库数量维护,状态维护
|
|
|
|
|
List<DisStockListDetailEntity> list = disStockListDetailService.list(Wrappers.<DisStockListDetailEntity>query().lambda().eq(DisStockListDetailEntity::getReservationId, distrilbutionloadingscanDTO.getReservationId()).ne(DisStockListDetailEntity::getStockPackageStatus, ReservationInventoryStatusConstant.quxiao.getValue())); |
|
|
|
|
List<DisStockListDetailEntity> detailEntities = list.stream().filter(l -> Func.isNotEmpty(l.getStockPackageCode())).collect(Collectors.toList()); |
|
|
|
|
if (detailEntities.size() <= 0) { |
|
|
|
|
if (detailEntities.isEmpty()) { |
|
|
|
|
return Resp.scanFail("此码无效", "此码无效"); |
|
|
|
|
} else { |
|
|
|
|
List<DisStockListDetailEntity> disStockListDetailEntities = detailEntities.stream().filter(d -> d.getStockPackageCode().equals(barcode)).collect(Collectors.toList()); |
|
|
|
@ -1724,6 +1939,7 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl<Distrib
|
|
|
|
|
DistributionLoadscaninvnEntity distributionLoadscaninvnEntity = getDistributionLoadscaninvnEntity(distrilbutionloadingscanDTO, distributionDeliverySelfEntity, disStockListDetailEntities, myCurrentWarehouse); |
|
|
|
|
packageLockIds.add(distributionLoadscaninvnEntity.getInventoryPackageId()); |
|
|
|
|
distributionLoadscaninvnService.save(distributionLoadscaninvnEntity); |
|
|
|
|
ts.add(distributionLoadscaninvnEntity); |
|
|
|
|
//查询本车次是否第一次扫码,没有则更新上车时间
|
|
|
|
|
Integer a = distributionDeliveryListMapper.updateloadingTimeById(distributionLoadscaninvnEntity.getDeliveryId()); |
|
|
|
|
//更新签收表的装车数量
|
|
|
|
@ -1766,6 +1982,10 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl<Distrib
|
|
|
|
|
bladeRedis.setEx("warehouseId:" + myCurrentWarehouse.getId() + "trainNumber:" + distributionDeliveryListEntity.getTrainNumber() + "orderPackageCode:", packageLockIds, 60L); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
DistributionDeliveryListEntity deliveryListEntity = distributionDeliveryListService.getById(distrilbutionloadingscanDTO.getDeliveryId()); |
|
|
|
|
NodeFanoutMsg<DistributionLoadVO> nodeFanoutMsg = buildNodeFanoutMsgByStock(deliveryListEntity, ts); |
|
|
|
|
distributionNodeWorkService.nodeLoading(nodeFanoutMsg, AuthUtil.getUser()); |
|
|
|
|
String msg = getLoadingMsg(distrilbutionloadingscanDTO); |
|
|
|
|
return Resp.scanSuccess("扫描成功", msg); |
|
|
|
|
} |
|
|
|
@ -3340,7 +3560,10 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl<Distrib
|
|
|
|
|
//对修改计划下的所有包件进行维护
|
|
|
|
|
|
|
|
|
|
// 作业节点推送
|
|
|
|
|
distributionNodeWorkService.planDelivery(deliveryListEntity, AuthUtil.getUser(), BizOperationEnums.MODIFY); |
|
|
|
|
// distributionNodeWorkService.planDelivery(deliveryListEntity, AuthUtil.getUser(), BizOperationEnums.MODIFY);
|
|
|
|
|
|
|
|
|
|
NodeFanoutMsg<DistributionTaskVO> nodeFanoutMsg = buildNodeFanoutMsgForPlan(deliveryListEntity, AuthUtil.getUser(), BizOperationEnums.MODIFY); |
|
|
|
|
distributionNodeWorkService.planDelivery(nodeFanoutMsg, AuthUtil.getUser()); |
|
|
|
|
|
|
|
|
|
trunklinePackageTrackLogClient.addPackageTrackLog(logs); |
|
|
|
|
return R.status(true); |
|
|
|
@ -3348,6 +3571,88 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl<Distrib
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public NodeFanoutMsg<DistributionTaskVO> buildNodeFanoutMsgForPlan(DistributionDeliveryListEntity distributionDeliveryListEntity, BladeUser user, BizOperationEnums bizOperation){ |
|
|
|
|
NodeFanoutMsg<DistributionTaskVO> nodeFanoutMsg = new NodeFanoutMsg(); |
|
|
|
|
nodeFanoutMsg.setBizOperation(bizOperation); |
|
|
|
|
nodeFanoutMsg.setNode(WorkNodeEnums.PLAN_DELIVERY); |
|
|
|
|
nodeFanoutMsg.setWarehouse(distributionDeliveryListEntity.getWarehouseName()); |
|
|
|
|
nodeFanoutMsg.setWarehouseId(distributionDeliveryListEntity.getWarehouseId()); |
|
|
|
|
nodeFanoutMsg.setOperator(user.getTenantId()); |
|
|
|
|
nodeFanoutMsg.setOperatorTime(distributionDeliveryListEntity.getCreateTime()); |
|
|
|
|
DistributionTaskVO distributionTaskVO = getDistributionTaskVO(distributionDeliveryListEntity); |
|
|
|
|
List<PlanDriverbindCarVO> planDriverbindCarVOS = buildDeliveryCarDriverInfor(distributionDeliveryListEntity); |
|
|
|
|
distributionTaskVO.setPlanDriverbindCars(planDriverbindCarVOS); |
|
|
|
|
|
|
|
|
|
nodeFanoutMsg.setMain(distributionTaskVO); |
|
|
|
|
nodeFanoutMsg.setTenantId(AuthUtil.getTenantId()); |
|
|
|
|
Map<String, List<Map<String, Object>>> deliveryreBroadcastData = distributionDeliveryListService.getDeliveryreBroadcastData(distributionDeliveryListEntity.getId(), distributionDeliveryListEntity.getWarehouseId()); |
|
|
|
|
// 构建返回数据
|
|
|
|
|
List<PackageData> packageDataList = buildSendNodePackageData(deliveryreBroadcastData); |
|
|
|
|
nodeFanoutMsg.setDetails(packageDataList); |
|
|
|
|
return nodeFanoutMsg; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@NotNull |
|
|
|
|
private List<PackageData> buildSendNodePackageData(Map<String, List<Map<String, Object>>> deliveryreBroadcastData) { |
|
|
|
|
List<PackageData> packageDataList = new ArrayList<>(); |
|
|
|
|
// 定制品
|
|
|
|
|
List<Map<String, Object>> data = deliveryreBroadcastData.get("1"); |
|
|
|
|
if (data != null) { |
|
|
|
|
for (Map<String, Object> map : data) { |
|
|
|
|
PackageData packageData = BeanUtil.copy(map, PackageData.class); |
|
|
|
|
assert packageData != null; |
|
|
|
|
packageData.setBrand(Convert.toStr(map.get("brandName"))); |
|
|
|
|
PackageTypeEnums type = PackageTypeEnums.CMP; |
|
|
|
|
packageData.setPackageType(type); |
|
|
|
|
packageDataList.add(packageData); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
// 库存品
|
|
|
|
|
data = deliveryreBroadcastData.get("2"); |
|
|
|
|
if (data != null) { |
|
|
|
|
for (Map<String, Object> map : data) { |
|
|
|
|
PackageData packageData = BeanUtil.copy(map, PackageData.class); |
|
|
|
|
assert packageData != null; |
|
|
|
|
packageData.setBrand(Convert.toStr(map.get("brandName"))); |
|
|
|
|
PackageTypeEnums type = PackageTypeEnums.INV; |
|
|
|
|
packageData.setPackageType(type); |
|
|
|
|
packageDataList.add(packageData); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
//零担
|
|
|
|
|
data = deliveryreBroadcastData.get("3"); |
|
|
|
|
if (data != null) { |
|
|
|
|
for (Map<String, Object> map : data) { |
|
|
|
|
PackageData packageData = BeanUtil.copy(map, PackageData.class); |
|
|
|
|
assert packageData != null; |
|
|
|
|
packageData.setBrand(Convert.toStr(map.get("brandName"))); |
|
|
|
|
PackageTypeEnums type = PackageTypeEnums.LTL; |
|
|
|
|
packageData.setPackageType(type); |
|
|
|
|
packageData.setProductName(Convert.toStr(map.get("productName"))); |
|
|
|
|
packageDataList.add(packageData); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
return packageDataList; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@NotNull |
|
|
|
|
private DistributionTaskVO getDistributionTaskVO(DistributionDeliveryListEntity distributionDeliveryListEntity) { |
|
|
|
|
DistributionTaskVO distributionTaskVO = new DistributionTaskVO(); |
|
|
|
|
distributionTaskVO.setId(distributionDeliveryListEntity.getId()); |
|
|
|
|
distributionTaskVO.setTrainNumber(distributionDeliveryListEntity.getTrainNumber()); |
|
|
|
|
distributionTaskVO.setKind(distributionDeliveryListEntity.getKind()); |
|
|
|
|
distributionTaskVO.setType(distributionDeliveryListEntity.getType()); |
|
|
|
|
distributionTaskVO.setDistributionCompany(distributionDeliveryListEntity.getDistributionCompany()); |
|
|
|
|
distributionTaskVO.setTaskTime(distributionDeliveryListEntity.getTaskTime()); |
|
|
|
|
return distributionTaskVO; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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)); |
|
|
|
@ -3803,7 +4108,8 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl<Distrib
|
|
|
|
|
this.updateById(deliveryListEntity); |
|
|
|
|
|
|
|
|
|
// 作业节点推送
|
|
|
|
|
distributionNodeWorkService.planDelivery(deliveryListEntity, AuthUtil.getUser(), BizOperationEnums.MODIFY); |
|
|
|
|
NodeFanoutMsg<DistributionTaskVO> nodeFanoutMsg = buildNodeFanoutMsgForPlan(deliveryListEntity, AuthUtil.getUser(), BizOperationEnums.MODIFY); |
|
|
|
|
distributionNodeWorkService.planDelivery(nodeFanoutMsg, AuthUtil.getUser()); |
|
|
|
|
|
|
|
|
|
//进行日志记录
|
|
|
|
|
handleUpdateDistributionLog(deliveryListEntity, user, reservationDTOS, distributionReservationEntities, myCurrentWarehouse); |
|
|
|
@ -5208,6 +5514,7 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl<Distrib
|
|
|
|
|
.eq(DistributionParcelListEntity::getWarehouseId, myCurrentWarehouse.getId()) |
|
|
|
|
); |
|
|
|
|
List<String> orderPackageCodes = new ArrayList<>(); |
|
|
|
|
List<DistributionLoadscanEntity> pushNodeList = new ArrayList<>(); |
|
|
|
|
List<JSONObject> aaa = new ArrayList<>(); |
|
|
|
|
if (Func.isNotEmpty(parcelListEntities) && parcelListEntities.size() == 1) { |
|
|
|
|
DistributionParcelListEntity parcelListEntity = parcelListEntities.get(0); |
|
|
|
@ -5327,6 +5634,7 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl<Distrib
|
|
|
|
|
loadscanEntity.setLoadingId(distrilbutionloadingscanDTO.getLoadingId()); |
|
|
|
|
loadscanEntity.setIsAbnormalLoading(2); |
|
|
|
|
distributionLoadscanService.save(loadscanEntity); |
|
|
|
|
pushNodeList.add(loadscanEntity); |
|
|
|
|
distributionLoadscanAbnormalEntity.setLoadingId(loadscanEntity.getId()); |
|
|
|
|
distributionLoadscanAbnormalService.save(distributionLoadscanAbnormalEntity); |
|
|
|
|
orderPackageCodes.add(loadscanEntity.getOrderPackageCode()); |
|
|
|
@ -5403,7 +5711,11 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl<Distrib
|
|
|
|
|
|
|
|
|
|
trunklinePackageTrackLogClient.addPackageTrackLog(aaa); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 发送作业节点数据
|
|
|
|
|
if(CollUtil.isNotEmpty(pushNodeList)){ |
|
|
|
|
NodeFanoutMsg<DistributionLoadVO> nodeFanoutMsg = buildNodeFanoutMsgByPackage(deliveryListEntity, pushNodeList); |
|
|
|
|
distributionNodeWorkService.abnormalLoading(nodeFanoutMsg, AuthUtil.getUser()); |
|
|
|
|
} |
|
|
|
|
return Resp.scanSuccess("操作成功", "异常" + abnormalTotal + "件"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -5503,6 +5815,7 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl<Distrib
|
|
|
|
|
log.error("############################# 配送任务查询为空,deliveryId为:{}", distributionDeliveryListEntity); |
|
|
|
|
return Resp.scanFail("参数错误", "参数错误!!!"); |
|
|
|
|
} |
|
|
|
|
List<DistributionLoadscanEntity> pushNodeList = new ArrayList(); |
|
|
|
|
//零担订单进行装车
|
|
|
|
|
//这里需要进行判定是进行编辑还是进行的装车
|
|
|
|
|
DistributionDeliverySelfEntity distributionDeliverySelfEntity = new DistributionDeliverySelfEntity(); |
|
|
|
@ -5634,6 +5947,7 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl<Distrib
|
|
|
|
|
loadscanEntity.setLoadingId(distrilbutionloadingscanDTO.getLoadingId()); |
|
|
|
|
loadscanEntity.setIsAbnormalLoading(1); |
|
|
|
|
distributionLoadscanService.save(loadscanEntity); |
|
|
|
|
pushNodeList.add(loadscanEntity); |
|
|
|
|
//更新装车时间
|
|
|
|
|
Integer i = distributionDeliveryListMapper.updateloadingTimeById(distrilbutionloadingscanDTO.getDeliveryId()); |
|
|
|
|
//更新装车数量
|
|
|
|
@ -5698,6 +6012,7 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl<Distrib
|
|
|
|
|
loadscanEntity.setLoadingId(distrilbutionloadingscanDTO.getLoadingId()); |
|
|
|
|
loadscanEntity.setIsAbnormalLoading(1); |
|
|
|
|
distributionLoadscanService.save(loadscanEntity); |
|
|
|
|
pushNodeList.add(loadscanEntity); |
|
|
|
|
//更新装车时间
|
|
|
|
|
Integer i = distributionDeliveryListMapper.updateloadingTimeById(distrilbutionloadingscanDTO.getDeliveryId()); |
|
|
|
|
//更新装车数量
|
|
|
|
@ -5775,9 +6090,77 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl<Distrib
|
|
|
|
|
bladeRedis.setEx("warehouseId:" + myCurrentWarehouse.getId() + "trainNumber:" + distributionDeliveryListEntity.getTrainNumber() + "orderPackageCode:", packageLockIds, 60L); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if(CollUtil.isNotEmpty(pushNodeList)){ |
|
|
|
|
DistributionDeliveryListEntity deliveryListEntity = distributionDeliveryListService.getById(distrilbutionloadingscanDTO.getDeliveryId()); |
|
|
|
|
NodeFanoutMsg<DistributionLoadVO> nodeFanoutMsg = buildNodeFanoutMsgByZeroOrder(deliveryListEntity, pushNodeList); |
|
|
|
|
distributionNodeWorkService.nodeLoading(nodeFanoutMsg, AuthUtil.getUser()); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return Resp.scanSuccess("装车成功", str.toString()); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private NodeFanoutMsg<DistributionLoadVO> buildNodeFanoutMsgByZeroOrder(DistributionDeliveryListEntity distributionDeliveryListEntity, List<DistributionLoadscanEntity> pushNodeList) { |
|
|
|
|
NodeFanoutMsg<DistributionLoadVO> nodeFanoutMsg = new NodeFanoutMsg(); |
|
|
|
|
nodeFanoutMsg.setBizOperation(BizOperationEnums.ADD); |
|
|
|
|
nodeFanoutMsg.setNode(WorkNodeEnums.DISTRIBUTION_LOADING); |
|
|
|
|
nodeFanoutMsg.setWarehouse(distributionDeliveryListEntity.getWarehouseName()); |
|
|
|
|
nodeFanoutMsg.setWarehouseId(distributionDeliveryListEntity.getWarehouseId()); |
|
|
|
|
nodeFanoutMsg.setOperator(AuthUtil.getTenantId()); |
|
|
|
|
nodeFanoutMsg.setOperatorTime(distributionDeliveryListEntity.getCreateTime()); |
|
|
|
|
|
|
|
|
|
// DistributionTaskVO taskVO = buildDistributionTaskVO(distributionDeliveryListEntity, AuthUtil.getUserId());
|
|
|
|
|
|
|
|
|
|
DistributionLoadVO distributionLoadVO = new DistributionLoadVO(); |
|
|
|
|
|
|
|
|
|
List<PlanDriverbindCarVO> planDriverbindCarVOS = buildDeliveryCarDriverInfor(distributionDeliveryListEntity); |
|
|
|
|
|
|
|
|
|
String driverName = distributionDeliveryListEntity.getDriverName(); |
|
|
|
|
String vehicleName = distributionDeliveryListEntity.getVehicleName(); |
|
|
|
|
// 如果是自主配送 需要去获取当前司机绑定的车牌
|
|
|
|
|
if ("1".equals(distributionDeliveryListEntity.getKind())) { |
|
|
|
|
BasicdataDriverArteryEntity driverArteryById = basicdataDriverArteryClient.getDriverArteryById(AuthUtil.getUserId()); |
|
|
|
|
if (driverArteryById != null) { |
|
|
|
|
|
|
|
|
|
for (int i = 0; i < planDriverbindCarVOS.size(); i++) { |
|
|
|
|
if (planDriverbindCarVOS.get(i).getDriverName().equals(driverArteryById.getName())) { |
|
|
|
|
driverName = planDriverbindCarVOS.get(i).getDriverName(); |
|
|
|
|
vehicleName = planDriverbindCarVOS.get(i).getCarPlate(); |
|
|
|
|
break; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
distributionLoadVO.setDriverName(driverName); |
|
|
|
|
distributionLoadVO.setVehicleName(vehicleName); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
nodeFanoutMsg.setMain(distributionLoadVO); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
List<PackageData> data = new ArrayList<>(); |
|
|
|
|
|
|
|
|
|
for (DistributionLoadscanEntity distributionLoadscanEntity : pushNodeList) { |
|
|
|
|
|
|
|
|
|
Map<String, Object> broadcastDataByZeroOrderAndParcId = baseMapper.getBroadcastDataByZeroOrderAndParcId(distributionLoadscanEntity.getDeliveryId(), distributionLoadscanEntity.getWarehouseId(), distributionLoadscanEntity.getPackageId()); |
|
|
|
|
PackageData packageData = BeanUtil.copy(broadcastDataByZeroOrderAndParcId, PackageData.class); |
|
|
|
|
assert packageData != null; |
|
|
|
|
packageData.setBrand(Convert.toStr(broadcastDataByZeroOrderAndParcId.get("brandName"))); |
|
|
|
|
PackageTypeEnums type = PackageTypeEnums.LTL; |
|
|
|
|
packageData.setPackageType(type); |
|
|
|
|
packageData.setProductName(Convert.toStr(broadcastDataByZeroOrderAndParcId.get("productName"))); |
|
|
|
|
packageData.setNumber(distributionLoadscanEntity.getLoadedNub()); |
|
|
|
|
data.add(packageData); |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
nodeFanoutMsg.setDetails(data); |
|
|
|
|
|
|
|
|
|
return nodeFanoutMsg; |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public R retentionScan(DistrilbutionloadingscanDTO distrilbutionloadingscanDTO) { |
|
|
|
|
if (distrilbutionloadingscanDTO.getBarcode().isEmpty()) { |
|
|
|
@ -7833,25 +8216,23 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl<Distrib
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public Map<String, List<Map<String, Object>>> getDeliveryreBroadcastData(Long id, Long warehouseId) { |
|
|
|
|
Map<String, List<Map<String, Object>>> data = new HashMap<>(); |
|
|
|
|
// 定制品
|
|
|
|
|
List<Map<String, Object>> broadcastDataByArticles = baseMapper.getBroadcastDataByArticles(id, warehouseId); |
|
|
|
|
if(!broadcastDataByArticles.isEmpty()){ |
|
|
|
|
data.put("1",broadcastDataByArticles); |
|
|
|
|
if (!broadcastDataByArticles.isEmpty()) { |
|
|
|
|
data.put("1", broadcastDataByArticles); |
|
|
|
|
} |
|
|
|
|
// 库寸品
|
|
|
|
|
List<Map<String, Object>> broadcastDataByStock = baseMapper.getBroadcastDataByStock(id, warehouseId); |
|
|
|
|
if(!broadcastDataByStock.isEmpty()){ |
|
|
|
|
data.put("2",broadcastDataByStock); |
|
|
|
|
if (!broadcastDataByStock.isEmpty()) { |
|
|
|
|
data.put("2", broadcastDataByStock); |
|
|
|
|
} |
|
|
|
|
// 零担
|
|
|
|
|
List<Map<String, Object>> broadcastDataByZeroOrder = baseMapper.getBroadcastDataByZeroOrder(id, warehouseId); |
|
|
|
|
if(!broadcastDataByZeroOrder.isEmpty()){ |
|
|
|
|
data.put("3",broadcastDataByZeroOrder); |
|
|
|
|
if (!broadcastDataByZeroOrder.isEmpty()) { |
|
|
|
|
data.put("3", broadcastDataByZeroOrder); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
return data; |
|
|
|
@ -7972,7 +8353,7 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl<Distrib
|
|
|
|
|
Long warehouseId = myCurrentWarehouse.getId(); |
|
|
|
|
DistributionDeliveryListEntity deliveryListEntity = this.getById(deliveryId); |
|
|
|
|
if (Objects.isNull(deliveryListEntity)) { |
|
|
|
|
log.error(method + "配送任务异常deliveryId:{}",deliveryId); |
|
|
|
|
log.error(method + "配送任务异常deliveryId:{}", deliveryId); |
|
|
|
|
return R.fail(403, "配送任务错误!!!"); |
|
|
|
|
} |
|
|
|
|
//查询当前登录人所在计划
|
|
|
|
@ -7987,7 +8368,7 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl<Distrib
|
|
|
|
|
//日志信息收集
|
|
|
|
|
List<JSONObject> packageLogs = new ArrayList<>(); |
|
|
|
|
//查询司机信息
|
|
|
|
|
DistributionDeliverySelfEntity distributionDeliverySelfEntity = getDriver(deliveryListEntity,user,distrilbutionloadingscanDTO,isDriverFlag); |
|
|
|
|
DistributionDeliverySelfEntity distributionDeliverySelfEntity = getDriver(deliveryListEntity, user, distrilbutionloadingscanDTO, isDriverFlag); |
|
|
|
|
switch (type) { |
|
|
|
|
case 1: |
|
|
|
|
if (Objects.isNull(distrilbutionloadingscanDTO.getBarcode())) { |
|
|
|
@ -8004,7 +8385,7 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl<Distrib
|
|
|
|
|
); |
|
|
|
|
if (!list.isEmpty()) { |
|
|
|
|
return Resp.scanFail("请在库存品页面扫描此码", "请在库存品页面扫描此码"); |
|
|
|
|
}else { |
|
|
|
|
} else { |
|
|
|
|
return Resp.scanFail("系统无编码", "系统无编码"); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
@ -8023,12 +8404,12 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl<Distrib
|
|
|
|
|
Long reservationId = baseMapper.selectPackageByorderPackageCodeAndDeliveryId(orderPackageCode, deliveryId, warehouseId); |
|
|
|
|
DistributionReservationEntity reservationEntity = distributionReservationService.getById(reservationId); |
|
|
|
|
if (Objects.isNull(reservationEntity)) { |
|
|
|
|
log.error(method + "预约任务错误reservationId:{}",reservationId); |
|
|
|
|
log.error(method + "预约任务错误reservationId:{}", reservationId); |
|
|
|
|
return R.fail(403, "预约任务错误!!!"); |
|
|
|
|
} |
|
|
|
|
if (Objects.isNull(reservationId)) { |
|
|
|
|
//判定是否满足异常装车
|
|
|
|
|
Boolean isAbnormalLoadingFlag = judgeIsAbnormalLoading(deliveryId, parcelListEntity,reservationId); |
|
|
|
|
Boolean isAbnormalLoadingFlag = judgeIsAbnormalLoading(deliveryId, parcelListEntity, reservationId); |
|
|
|
|
if (isAbnormalLoadingFlag) { |
|
|
|
|
log.info("异常装车判定成功>>>>>>packageCode:{},reservationId:{}", distrilbutionloadingscanDTO.getBarcode(), distrilbutionloadingscanDTO.getReservationId()); |
|
|
|
|
return R.fail(5000, "异常装车"); |
|
|
|
@ -8036,7 +8417,7 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl<Distrib
|
|
|
|
|
return Resp.scanFail("蹿货", "蹿货"); |
|
|
|
|
} |
|
|
|
|
//正常进行装车
|
|
|
|
|
DistributionLoadscanEntity loadscanEntity = createdDistributionLoadscanEntity(deliveryListEntity,distributionDeliverySelfEntity,reservationId,parcelListEntity,myCurrentWarehouse,user); |
|
|
|
|
DistributionLoadscanEntity loadscanEntity = createdDistributionLoadscanEntity(deliveryListEntity, distributionDeliverySelfEntity, reservationId, parcelListEntity, myCurrentWarehouse, user); |
|
|
|
|
distributionLoadscanService.save(loadscanEntity); |
|
|
|
|
//更新包件装车状态
|
|
|
|
|
packageLockIds.add(parcelListEntity.getId()); |
|
|
|
@ -8069,11 +8450,11 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl<Distrib
|
|
|
|
|
pushList.add(parcelListEntity); |
|
|
|
|
break; |
|
|
|
|
case 2: |
|
|
|
|
if (Objects.isNull(distrilbutionloadingscanDTO.getReservationId())){ |
|
|
|
|
if (Objects.isNull(distrilbutionloadingscanDTO.getReservationId())) { |
|
|
|
|
log.error(method + "参数缺失ReservationId"); |
|
|
|
|
return Resp.fail("参数缺失,请联系管理员"); |
|
|
|
|
} |
|
|
|
|
if (Objects.isNull(distrilbutionloadingscanDTO.getParcelListDTOS())){ |
|
|
|
|
if (Objects.isNull(distrilbutionloadingscanDTO.getParcelListDTOS())) { |
|
|
|
|
log.error(method + "参数缺失ParcelListDTOS"); |
|
|
|
|
return Resp.fail("参数缺失,请联系管理员"); |
|
|
|
|
} |
|
|
|
@ -8130,7 +8511,7 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl<Distrib
|
|
|
|
|
if (parcelListDTO.getLoadingNum() <= reservationZeroPackageEntity.getQuantity()) { |
|
|
|
|
//零担修改装车
|
|
|
|
|
DistributionLoadscanEntity zeroLoadscanEntity = loadscanEntities.get(0); |
|
|
|
|
updateZeroLoadingEntity(zeroLoadscanEntity,parcelListDTO,myCurrentWarehouse,zeroPackageMap); |
|
|
|
|
updateZeroLoadingEntity(zeroLoadscanEntity, parcelListDTO, myCurrentWarehouse, zeroPackageMap); |
|
|
|
|
JSONObject zeroJsonObject = new JSONObject(); |
|
|
|
|
zeroJsonObject.put("code", zeroParcelListEntity.getOrderCode()); |
|
|
|
|
zeroJsonObject.put("warehouseId", myCurrentWarehouse.getId()); |
|
|
|
@ -8147,7 +8528,7 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl<Distrib
|
|
|
|
|
distributionDeliverySelfEntity, |
|
|
|
|
deliveryListEntity, |
|
|
|
|
distrilbutionloadingscanDTO.getReservationId(), |
|
|
|
|
parcelListDTO,myCurrentWarehouse, |
|
|
|
|
parcelListDTO, myCurrentWarehouse, |
|
|
|
|
user, |
|
|
|
|
zeroPackageMap); |
|
|
|
|
packageLockIds.add(parcelListDTO.getParcelListId()); |
|
|
|
@ -8168,7 +8549,7 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl<Distrib
|
|
|
|
|
distributionDeliverySelfEntity, |
|
|
|
|
deliveryListEntity, |
|
|
|
|
distrilbutionloadingscanDTO.getReservationId(), |
|
|
|
|
parcelListDTO,myCurrentWarehouse, |
|
|
|
|
parcelListDTO, myCurrentWarehouse, |
|
|
|
|
user, |
|
|
|
|
zeroPackageMap); |
|
|
|
|
packageLockIds.add(parcelListDTO.getParcelListId()); |
|
|
|
@ -8202,8 +8583,8 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl<Distrib
|
|
|
|
|
} |
|
|
|
|
String inventoryPackageCode = distrilbutionloadingscanDTO.getBarcode(); |
|
|
|
|
//查询库存品
|
|
|
|
|
reservationId = baseMapper.selectInventoryPackageByDeliveryIdAndInventoryPackageCode(deliveryId,inventoryPackageCode); |
|
|
|
|
if (Objects.nonNull(reservationId)){ |
|
|
|
|
reservationId = baseMapper.selectInventoryPackageByDeliveryIdAndInventoryPackageCode(deliveryId, inventoryPackageCode); |
|
|
|
|
if (Objects.nonNull(reservationId)) { |
|
|
|
|
parcelListEntity = distributionParcelListMapper.selectByOrderPackageCode(inventoryPackageCode, myCurrentWarehouse.getId()); |
|
|
|
|
if (!Objects.isNull(parcelListEntity)) { |
|
|
|
|
return Resp.scanFail("请在定制品页面扫描此码", "请在定制品页面扫描此码"); |
|
|
|
@ -8217,7 +8598,7 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl<Distrib
|
|
|
|
|
.ne(DisStockListDetailEntity::getStockPackageStatus, InventoryPackageStatusConstant.quxiao.getValue()) |
|
|
|
|
); |
|
|
|
|
if (invemtoryPackageList.size() > 1) { |
|
|
|
|
log.error(method+"此库存品包件在预约计划中存在多条,reservationId:{},inventoryPackageCode:{}",reservationId,inventoryPackageCode); |
|
|
|
|
log.error(method + "此库存品包件在预约计划中存在多条,reservationId:{},inventoryPackageCode:{}", reservationId, inventoryPackageCode); |
|
|
|
|
return Resp.scanFail("此包件数据错误", "此包件数据错误"); |
|
|
|
|
} |
|
|
|
|
DisStockListDetailEntity disStockListDetailEntity = invemtoryPackageList.get(0); |
|
|
|
@ -8236,10 +8617,10 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl<Distrib
|
|
|
|
|
.set(DistributionParcelListEntity::getOrderPackageStatus, OrderPackageStatusConstant.yichuku.getValue()) |
|
|
|
|
|
|
|
|
|
); |
|
|
|
|
if (update){ |
|
|
|
|
if (update) { |
|
|
|
|
//修改成功 此包件是转的
|
|
|
|
|
DistributionParcelListEntity parcelListEntity1 = distributionParcelListService.selectByOrderPackageCode(inventoryPackageCode, myCurrentWarehouse.getId()); |
|
|
|
|
if (Objects.isNull(parcelListEntity1)){ |
|
|
|
|
if (Objects.isNull(parcelListEntity1)) { |
|
|
|
|
pushList.add(parcelListEntity1); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
@ -8385,7 +8766,7 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl<Distrib
|
|
|
|
|
} |
|
|
|
|
break; |
|
|
|
|
default: |
|
|
|
|
log.error(method+"未知类型type:{}",distrilbutionloadingscanDTO.getType()); |
|
|
|
|
log.error(method + "未知类型type:{}", distrilbutionloadingscanDTO.getType()); |
|
|
|
|
break; |
|
|
|
|
} |
|
|
|
|
//添加缓存
|
|
|
|
@ -8426,11 +8807,10 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl<Distrib
|
|
|
|
|
warehouseUpdownStockUpAreaClient.downStockUpShelf(jsonObjects); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return null; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private void updateZeroLoadingEntity(DistributionLoadscanEntity loadscanEntity, DistributionParcelNumberDTO parcelListDTO, BasicdataWarehouseEntity myCurrentWarehouse,Map<Long, DistributionParcelNumberEntity> zeroPackageMap) { |
|
|
|
|
private void updateZeroLoadingEntity(DistributionLoadscanEntity loadscanEntity, DistributionParcelNumberDTO parcelListDTO, BasicdataWarehouseEntity myCurrentWarehouse, Map<Long, DistributionParcelNumberEntity> zeroPackageMap) { |
|
|
|
|
//维护零担出库数量
|
|
|
|
|
DistributionParcelNumberEntity parcelNumberEntity = zeroPackageMap.get(parcelListDTO.getParcelListId()); |
|
|
|
|
BigDecimal deliveryQuantity = new BigDecimal(parcelNumberEntity.getDeliveryQuantity()); |
|
|
|
@ -8467,7 +8847,7 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl<Distrib
|
|
|
|
|
BasicdataWarehouseEntity myCurrentWarehouse, |
|
|
|
|
BladeUser user, |
|
|
|
|
Map<Long, DistributionParcelNumberEntity> zeroPackageMap) { |
|
|
|
|
DistributionLoadscanEntity zeroLoadscanEntity = createdDistributionZeroLoadscanEntity(distributionDeliverySelfEntity,deliveryListEntity,distrilbutionloadingscanDTO.getReservationId(),parcelNumberDTO,myCurrentWarehouse,user); |
|
|
|
|
DistributionLoadscanEntity zeroLoadscanEntity = createdDistributionZeroLoadscanEntity(distributionDeliverySelfEntity, deliveryListEntity, distrilbutionloadingscanDTO.getReservationId(), parcelNumberDTO, myCurrentWarehouse, user); |
|
|
|
|
distributionLoadscanService.save(zeroLoadscanEntity); |
|
|
|
|
//更新装车时间
|
|
|
|
|
Integer i = distributionDeliveryListMapper.updateloadingTimeById(distrilbutionloadingscanDTO.getDeliveryId()); |
|
|
|
@ -8520,7 +8900,7 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl<Distrib
|
|
|
|
|
zeroLoadscanEntity.setOrderId(parcelNumberDTO.getStockArticleId()); |
|
|
|
|
zeroLoadscanEntity.setScanTime(now); |
|
|
|
|
zeroLoadscanEntity.setScanUser(user.getNickName()); |
|
|
|
|
zeroLoadscanEntity.setLoadingId(distributionDeliverySelfEntity.getId()+""); |
|
|
|
|
zeroLoadscanEntity.setLoadingId(distributionDeliverySelfEntity.getId() + ""); |
|
|
|
|
zeroLoadscanEntity.setIsAbnormalLoading(1); |
|
|
|
|
return zeroLoadscanEntity; |
|
|
|
|
} |
|
|
|
@ -8561,13 +8941,13 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl<Distrib
|
|
|
|
|
loadscanEntity.setOrderId(parcelListEntity.getStockArticleId()); |
|
|
|
|
loadscanEntity.setScanTime(now); |
|
|
|
|
loadscanEntity.setScanUser(user.getNickName()); |
|
|
|
|
loadscanEntity.setLoadingId(distributionDeliverySelfEntity.getId()+""); |
|
|
|
|
loadscanEntity.setLoadingId(distributionDeliverySelfEntity.getId() + ""); |
|
|
|
|
loadscanEntity.setIsAbnormalLoading(1); |
|
|
|
|
loadscanEntity.setLoadedNub(parcelListEntity.getQuantity()); |
|
|
|
|
return loadscanEntity; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private DistributionDeliverySelfEntity getDriver(DistributionDeliveryListEntity deliveryListEntity, BladeUser user,DistrilbutionloadingscanDTO distrilbutionloadingscanDTO,boolean isDriverFlag) { |
|
|
|
|
private DistributionDeliverySelfEntity getDriver(DistributionDeliveryListEntity deliveryListEntity, BladeUser user, DistrilbutionloadingscanDTO distrilbutionloadingscanDTO, boolean isDriverFlag) { |
|
|
|
|
DistributionDeliverySelfEntity distributionDeliverySelfEntity = new DistributionDeliverySelfEntity(); |
|
|
|
|
if ("1".equals(deliveryListEntity.getKind())) { |
|
|
|
|
if (isDriverFlag) { |
|
|
|
@ -8577,7 +8957,7 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl<Distrib
|
|
|
|
|
throw new CustomerException("没有司机的信息"); |
|
|
|
|
} |
|
|
|
|
//查询当前扫描司机是否属于当前配送任务
|
|
|
|
|
distributionDeliverySelfEntity = distributionDeliverySelfMapper.selectDriverInfoByDeliveryIdAndDriverId(driverArtery.getId(),deliveryListEntity.getId()); |
|
|
|
|
distributionDeliverySelfEntity = distributionDeliverySelfMapper.selectDriverInfoByDeliveryIdAndDriverId(driverArtery.getId(), deliveryListEntity.getId()); |
|
|
|
|
} else { |
|
|
|
|
if (Objects.isNull(distrilbutionloadingscanDTO.getDriverId())) { |
|
|
|
|
log.error("文员扫描未选择司机!!"); |
|
|
|
@ -8589,7 +8969,7 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl<Distrib
|
|
|
|
|
throw new CustomerException("没有司机的信息"); |
|
|
|
|
} |
|
|
|
|
//默认为文员进行扫描,此时需要文员选择进行帮助扫描的司机
|
|
|
|
|
distributionDeliverySelfEntity = distributionDeliverySelfMapper.selectDriverInfoByDeliveryIdAndDriverId(driverArtery.getId(),deliveryListEntity.getId()); |
|
|
|
|
distributionDeliverySelfEntity = distributionDeliverySelfMapper.selectDriverInfoByDeliveryIdAndDriverId(driverArtery.getId(), deliveryListEntity.getId()); |
|
|
|
|
} |
|
|
|
|
} else { |
|
|
|
|
DistributionDeliveryTripartiteEntity distributionDeliveryTripartiteEntity = distributionDeliveryTripartiteMapper.selectDriverInfoByDeliveryId(deliveryListEntity.getId()); |
|
|
|
@ -8603,7 +8983,7 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl<Distrib
|
|
|
|
|
return distributionDeliverySelfEntity; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private Boolean judgeIsAbnormalLoading(Long deliveryId, DistributionParcelListEntity parcelListEntity,Long reservationId) { |
|
|
|
|
private Boolean judgeIsAbnormalLoading(Long deliveryId, DistributionParcelListEntity parcelListEntity, Long reservationId) { |
|
|
|
|
List<DistributionReservationEntity> reservationEntityList = distributionDeliveryListMapper.selectReservationByDeliveryListId(deliveryId); |
|
|
|
|
if (!reservationEntityList.isEmpty()) { |
|
|
|
|
boolean shangpeiFlag = reservationEntityList.stream().allMatch(r -> r.getDeliveryType().equals(DistributionTypeConstant.shipie.getValue())); |
|
|
|
|