Browse Source

debug 司机任务不出现2

dev-pushdata-important
pref_mail@163.com 1 year ago
parent
commit
37f1ec0399
  1. 2
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionDeliveryListMapper.xml
  2. 351
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionDeliveryListServiceImpl.java

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

@ -757,7 +757,7 @@
logpm_distribution_delivery_list lddl
left join logpm_distribution_delivery_self ldds on lddl.id =ldds.delivery_id
<where>
lddl.is_deleted =0 and lddl.warehouse_id =#{warehouseId}
lddl.is_deleted =0 and lddl.customers_number > 0 and lddl.warehouse_id =#{warehouseId}
<if test=" param.type != null and param.type != ''">and lddl.type = #{param.type}</if>
<if test="array != null and @org.apache.commons.collections4.CollectionUtils@isNotEmpty(array)">
and lddl.id in

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

@ -25,6 +25,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.logpm.aftersales.vo.AftersalesAbnormalPackageVO;
import com.logpm.basic.entity.BasicPrintTemplateEntity;
import com.logpm.basic.feign.IBasicPrintTemplateClient;
@ -577,8 +578,8 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl<Distrib
}
//查询当前扫描的包件是否进行了装车
DistributionParcelListEntity parcelList = distributionParcelListService.selectByOrderPackageCode(distrilbutionloadingscanDTO.getBarcode(), myCurrentWarehouse.getId());
if (!Objects.isNull(parcelList)){
if (OrderPackageLoadingStatusConstant.yizhuangche.getValue().equals(parcelList.getOrderPackageLoadingStatus())){
if (!Objects.isNull(parcelList)) {
if (OrderPackageLoadingStatusConstant.yizhuangche.getValue().equals(parcelList.getOrderPackageLoadingStatus())) {
return Resp.scanFail("操作失败", "包件已装车");
}
}
@ -601,8 +602,8 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl<Distrib
BeanUtils.copyProperties(distributionDeliveryTripartiteEntity, distributionDeliverySelfEntity);
}
if (distrilbutionloadingscanDTO.getType() == 1) {
if (!Objects.isNull(parcelList)){
if (OrderPackageLoadingStatusConstant.yizhuangche.getValue().equals(parcelList.getOrderPackageLoadingStatus())){
if (!Objects.isNull(parcelList)) {
if (OrderPackageLoadingStatusConstant.yizhuangche.getValue().equals(parcelList.getOrderPackageLoadingStatus())) {
return Resp.scanFail("操作失败", "包件已装车");
}
}
@ -669,14 +670,14 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl<Distrib
Integer j = distributionSignforMapper.updateloadByReservationId(loadscanEntity.getDeliveryId(), loadscanEntity.getReservationId(), loadscanEntity.getPackageNub());
Map<String,Object> map = new HashMap();
Map<String, Object> map = new HashMap();
String distrilbutionloadingscanDTOJson = JSONObject.toJSONString(distrilbutionloadingscanDTO);
map.put("distrilbutionloadingscanDTO",distrilbutionloadingscanDTOJson);
map.put("distrilbutionloadingscanDTO", distrilbutionloadingscanDTOJson);
String parcelListEntityJson = JSONObject.toJSONString(parcelListEntity);
map.put("parcelListEntity",parcelListEntityJson);
map.put("myCurrentWarehouseId",myCurrentWarehouse.getId());
map.put("parcelListEntity", parcelListEntityJson);
map.put("myCurrentWarehouseId", myCurrentWarehouse.getId());
String reservationEntityJson = JSONObject.toJSONString(reservationEntity);
map.put("reservationEntity",reservationEntityJson);
map.put("reservationEntity", reservationEntityJson);
log.info(">>>>>>>>>>>>> 进入延迟队列处理包件相关信息状态");
@ -871,7 +872,7 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl<Distrib
// String str = getLoadingMsg(distrilbutionloadingscanDTO);
Integer carLaodNum = getCarLaodNum(distrilbutionloadingscanDTO.getDeliveryId());
return Resp.scanSuccessWithData("装车成功", "装车" + carLaodNum + "件", carLaodNum);
return Resp.scanSuccessWithData("装车成功", "装车" + carLaodNum + "件", carLaodNum);
}
private void extracteOrderPackageStatus(DistrilbutionloadingscanDTO distrilbutionloadingscanDTO, DistributionParcelListEntity parcelListEntity, BasicdataWarehouseEntity myCurrentWarehouse, DistributionReservationEntity reservationEntity) {
@ -1051,7 +1052,7 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl<Distrib
@NotNull
private String getLoadingMsg(DistrilbutionloadingscanDTO distrilbutionloadingscanDTO) {
return "装车" + getCarLaodNum(distrilbutionloadingscanDTO.getDeliveryId()) + "件";
return "装车" + getCarLaodNum(distrilbutionloadingscanDTO.getDeliveryId()) + "件";
}
//------------------------------------------------------------------------------------------------------------------------------------------------------------------------
@ -1498,7 +1499,7 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl<Distrib
BasicdataWarehouseEntity myCurrentWarehouse = warehouseClient.getMyCurrentWarehouse();
if (Objects.isNull(myCurrentWarehouse)) {
return R.fail(403,"请选择仓库!!");
return R.fail(403, "请选择仓库!!");
// throw n/**/ew CustomerException(403, "仓库信息不能为空");
}
/*
@ -2196,155 +2197,157 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl<Distrib
@Override
public IPage<DistributionAppDeliveryListVO> selectDistributionAppDeliveryListPage(IPage<DistributionAppDeliveryListVO> page, DistributionAppDeliveryListDTO distributionAppDeliveryListDTO) {
//获取当前登录人
BladeUser user = AuthUtil.getUser();
String roleId = user.getRoleId();
//判断当前登录人是否为司机
List<DistributionAppDeliveryListVO> distributionAppDeliveryListVOS = new ArrayList<>();
boolean delivery = false;
String value1 = DictBizCache.getValue("role_class", "delivery_driver_new");
if (roleId.contains(value1)) delivery = true;
BasicdataWarehouseEntity myCurrentWarehouse = warehouseClient.getMyCurrentWarehouse();
try {
//获取当前登录人
BladeUser user = AuthUtil.getUser();
String roleId = user.getRoleId();
//判断当前登录人是否为司机
boolean delivery = false;
String value1 = DictBizCache.getValue("role_class", "delivery_driver_new");
if (roleId.contains(value1)) delivery = true;
BasicdataWarehouseEntity myCurrentWarehouse = warehouseClient.getMyCurrentWarehouse();
// R<String> value = dictBizClient.getValue("role_class", roleId);
if (delivery) {
//查询当前登录人的配送任务
BasicdataDriverArteryEntity driverArtery = iBasicdataDriverArteryClient.getDriverArtery(user.getUserId());
if (null == driverArtery) {
log.error("没有司机的信息!!");
return page.setRecords(distributionAppDeliveryListVOS);
}
//查询司机的任务
List<Long> deliveryIds = distributionDeliverySelfMapper.selectdeliveryList(driverArtery.getId());
if (!deliveryIds.isEmpty()) {
distributionAppDeliveryListVOS = baseMapper.selectDistributionAppDeliveryListPage(page, distributionAppDeliveryListDTO, deliveryIds, myCurrentWarehouse.getId());
if (delivery) {
//查询当前登录人的配送任务
BasicdataDriverArteryEntity driverArtery = iBasicdataDriverArteryClient.getDriverArtery(user.getUserId());
if (null == driverArtery) {
log.error("没有司机的信息!!");
return page.setRecords(distributionAppDeliveryListVOS);
}
//查询司机的任务
List<Long> deliveryIds = distributionDeliverySelfMapper.selectdeliveryList(driverArtery.getId());
if (!deliveryIds.isEmpty()) {
distributionAppDeliveryListVOS = baseMapper.selectDistributionAppDeliveryListPage(page, distributionAppDeliveryListDTO, deliveryIds, myCurrentWarehouse.getId());
} else {
return page.setRecords(distributionAppDeliveryListVOS);
}
} else {
return page.setRecords(distributionAppDeliveryListVOS);
distributionAppDeliveryListVOS = baseMapper.selectDistributionAppDeliveryListPage(page, distributionAppDeliveryListDTO, null, myCurrentWarehouse.getId());
}
} else {
distributionAppDeliveryListVOS = baseMapper.selectDistributionAppDeliveryListPage(page, distributionAppDeliveryListDTO, null, myCurrentWarehouse.getId());
}
log.info(">>>>>>>>>>>>>>>>> distributionAppDeliveryListVOS 司机配送任务列表 {}",distributionAppDeliveryListVOS);
//转换字典字段
for (DistributionAppDeliveryListVO distributionAppDeliveryListVO : distributionAppDeliveryListVOS) {
log.info(">>>>>>>>>>>>>>>>> distributionAppDeliveryListVOS 司机配送任务列表 {}", distributionAppDeliveryListVOS);
//转换字典字段
for (DistributionAppDeliveryListVO distributionAppDeliveryListVO : distributionAppDeliveryListVOS) {
distributionAppDeliveryListVO.setScannedNumber(getCarLaodNum(distributionAppDeliveryListVO.getId()));
// 调用下 查询装车件数的方法
//查询备货区
if (StringUtils.isNotBlank(distributionAppDeliveryListVO.getReservationId())) {
List<String> list = CommonUtil.stringNum(distributionAppDeliveryListVO.getReservationId());
QueryWrapper<DistributionStockupInfoEntity> queryWrapper = new QueryWrapper();
distributionAppDeliveryListVO.setScannedNumber(getCarLaodNum(distributionAppDeliveryListVO.getId()));
// 调用下 查询装车件数的方法
//查询备货区
if (StringUtils.isNotBlank(distributionAppDeliveryListVO.getReservationId())) {
List<String> list = CommonUtil.stringNum(distributionAppDeliveryListVO.getReservationId());
QueryWrapper<DistributionStockupInfoEntity> queryWrapper = new QueryWrapper();
if (list.size() > 1) {
queryWrapper.in("reservation_id", list);
} else {
queryWrapper.eq("reservation_id", distributionAppDeliveryListVO.getReservationId());
}
List<DistributionStockupInfoEntity> list1 = distributionStockupInfoService.list(queryWrapper);
if (!list1.isEmpty()) {
DistributionStockupInfoEntity distributionStockupInfoEntity = list1.get(0);
DistributionStockupEntity distributionStockupEntity = distributionStockupMapper.selectById(distributionStockupInfoEntity.getStockupId());
if (ObjectUtils.isNotNull(distributionStockupEntity)) {
distributionAppDeliveryListVO.setStockupArea(distributionStockupEntity.getStockupArea());
if (list.size() > 1) {
queryWrapper.in("reservation_id", list);
} else {
queryWrapper.eq("reservation_id", distributionAppDeliveryListVO.getReservationId());
}
List<DistributionStockupInfoEntity> list1 = distributionStockupInfoService.list(queryWrapper);
if (!list1.isEmpty()) {
DistributionStockupInfoEntity distributionStockupInfoEntity = list1.get(0);
DistributionStockupEntity distributionStockupEntity = distributionStockupMapper.selectById(distributionStockupInfoEntity.getStockupId());
if (ObjectUtils.isNotNull(distributionStockupEntity)) {
distributionAppDeliveryListVO.setStockupArea(distributionStockupEntity.getStockupArea());
} else {
distributionAppDeliveryListVO.setStockupArea("无数据");
}
} else {
distributionAppDeliveryListVO.setStockupArea("无数据");
}
}
//查询包件签收件数
Integer lad = distributionLoadscanMapper.selectCount(new QueryWrapper<DistributionLoadscanEntity>().lambda().eq(DistributionLoadscanEntity::getDeliveryId, distributionAppDeliveryListVO.getId()).eq(DistributionLoadscanEntity::getSignforState, 2)).intValue();
//查询库存品签收件数
Integer nad = distributionLoadscaninvnMapper.selectCount(new QueryWrapper<DistributionLoadscaninvnEntity>().lambda().eq(DistributionLoadscaninvnEntity::getDeliveryId, distributionAppDeliveryListVO.getId()).eq(DistributionLoadscaninvnEntity::getSignforState, 2)).intValue();
//维护计划数
List<DistributionReservationEntity> reservationEntityList = baseMapper.selectReservationByDeliveryListId(distributionAppDeliveryListVO.getId());
if (Func.isNotEmpty(reservationEntityList)) {
int packageNum = reservationEntityList.stream().mapToInt(DistributionReservationEntity::getReservationNum).sum();
int invertoryNum = reservationEntityList.stream().mapToInt(DistributionReservationEntity::getReservationStockListNum).sum();
distributionAppDeliveryListVO.setDeliveryNumber(packageNum + invertoryNum);
} else {
distributionAppDeliveryListVO.setStockupArea("无数据");
continue;
}
}
//查询包件签收件数
Integer lad = distributionLoadscanMapper.selectCount(new QueryWrapper<DistributionLoadscanEntity>().lambda().eq(DistributionLoadscanEntity::getDeliveryId, distributionAppDeliveryListVO.getId()).eq(DistributionLoadscanEntity::getSignforState, 2)).intValue();
//查询库存品签收件数
Integer nad = distributionLoadscaninvnMapper.selectCount(new QueryWrapper<DistributionLoadscaninvnEntity>().lambda().eq(DistributionLoadscaninvnEntity::getDeliveryId, distributionAppDeliveryListVO.getId()).eq(DistributionLoadscaninvnEntity::getSignforState, 2)).intValue();
//维护计划数
List<DistributionReservationEntity> reservationEntityList = baseMapper.selectReservationByDeliveryListId(distributionAppDeliveryListVO.getId());
if (Func.isNotEmpty(reservationEntityList)) {
int packageNum = reservationEntityList.stream().mapToInt(DistributionReservationEntity::getReservationNum).sum();
int invertoryNum = reservationEntityList.stream().mapToInt(DistributionReservationEntity::getReservationStockListNum).sum();
distributionAppDeliveryListVO.setDeliveryNumber(packageNum + invertoryNum);
} else {
return null;
}
distributionAppDeliveryListVO.setSignNub(lad + nad);
//查询完成客户数
Integer cusCount = baseMapper.selectCompletecusCount(distributionAppDeliveryListVO.getId());
//查询完成订单数
AtomicInteger ordCount = new AtomicInteger();
distributionAppDeliveryListVO.setSignNub(lad + nad);
//查询完成客户数
Integer cusCount = baseMapper.selectCompletecusCount(distributionAppDeliveryListVO.getId());
//查询完成订单数
AtomicInteger ordCount = new AtomicInteger();
// List<DistributionAppStockArticleVO> distributionAppStockArticleVOS = baseMapper.selectDistributionAppDeliveryOrderO(distributionAppDeliveryListVO);
List<DistributionStockArticleVO> deliveryStockArticleInfo = baseMapper.getDeliveryStockArticleInfo(distributionAppDeliveryListVO.getId());
List<DistributionStockArticleVO> deliveryStockArticleInfo = baseMapper.getDeliveryStockArticleInfo(distributionAppDeliveryListVO.getId());
// deliveryStockArticleInfo.forEach();
List<DistributionReservationEntity> distributionReservationEntities = baseMapper.selectReservationByDeliveryListId(distributionAppDeliveryListVO.getId());
distributionReservationEntities.forEach(r -> {
List<DistributionReservationStockarticleEntity> reservationStockarticleEntityList = distributionReservationMapper.selectStockArticleByReservationId(r.getId());
reservationStockarticleEntityList.forEach(rs -> {
List<DistributionLoadscanEntity> loadscanEntityList = distributionLoadscanService.list(Wrappers.<DistributionLoadscanEntity>query().lambda().eq(DistributionLoadscanEntity::getDeliveryId, distributionAppDeliveryListVO.getId()).eq(DistributionLoadscanEntity::getOrderId, rs.getStockArticleId()).eq(DistributionLoadscanEntity::getReservationId, rs.getReservationId()).ne(DistributionLoadscanEntity::getScanStatus, LoadingStatusConstant.quxiao.getValue()));
if (Func.isNotEmpty(loadscanEntityList)) {
int loadSum = loadscanEntityList.stream().mapToInt(DistributionLoadscanEntity::getLoadedNub).sum();
if (rs.getReservationNum() == loadSum) {
ordCount.getAndIncrement();
List<DistributionReservationEntity> distributionReservationEntities = baseMapper.selectReservationByDeliveryListId(distributionAppDeliveryListVO.getId());
distributionReservationEntities.forEach(r -> {
List<DistributionReservationStockarticleEntity> reservationStockarticleEntityList = distributionReservationMapper.selectStockArticleByReservationId(r.getId());
reservationStockarticleEntityList.forEach(rs -> {
List<DistributionLoadscanEntity> loadscanEntityList = distributionLoadscanService.list(Wrappers.<DistributionLoadscanEntity>query().lambda().eq(DistributionLoadscanEntity::getDeliveryId, distributionAppDeliveryListVO.getId()).eq(DistributionLoadscanEntity::getOrderId, rs.getStockArticleId()).eq(DistributionLoadscanEntity::getReservationId, rs.getReservationId()).ne(DistributionLoadscanEntity::getScanStatus, LoadingStatusConstant.quxiao.getValue()));
if (Func.isNotEmpty(loadscanEntityList)) {
int loadSum = loadscanEntityList.stream().mapToInt(DistributionLoadscanEntity::getLoadedNub).sum();
if (rs.getReservationNum() == loadSum) {
ordCount.getAndIncrement();
}
}
}
});
});
});
// distributionReservationMapper.selectPackageByReservationAndStockArticle()
// for (DistributionAppStockArticleVO distributionAppStockArticleVO : distributionAppStockArticleVOS) {
// if (distributionAppStockArticleVO.getLoadingNub() >= distributionAppStockArticleVO.getReservationNum()) {
// ordCount += 1;
// }
// }
distributionAppDeliveryListVO.setLoadCusNub(cusCount);
distributionAppDeliveryListVO.setLoadOrdNub(ordCount.get());
//查询下面的预约单
List<DistributionSignforEntity> distributionSignforEntityList = distributionSignforMapper.selectList(new QueryWrapper<DistributionSignforEntity>().lambda().eq(DistributionSignforEntity::getDeliveryId, distributionAppDeliveryListVO.getId()));
//提取id
List<Long> reList = distributionSignforEntityList.stream().map(DistributionSignforEntity::getId).collect(Collectors.toList());
distributionAppDeliveryListVO.setType_name(dictBizClient.getValue("distribution_type", distributionAppDeliveryListVO.getType()).getData());
//查询是否配车
Integer aLong = 0;
Integer aLong2 = 0;
distributionAppDeliveryListVO.setVehicleStatus_name("已配车");
distributionAppDeliveryListVO.setDeliStatus_name("配送中");
if (distributionAppDeliveryListVO.getDeliveryStatus().equals("4")) {
distributionAppDeliveryListVO.setDeliStatus_name("完成");
}
if (distributionAppDeliveryListVO.getKind().equals("1")) {
aLong = distributionDeliverySelfMapper.selectCount(new QueryWrapper<DistributionDeliverySelfEntity>().lambda().eq(DistributionDeliverySelfEntity::getDeliveryId, distributionAppDeliveryListVO.getId())).intValue();
} else {
aLong2 = distributionDeliveryTripartiteMapper.selectCount(new QueryWrapper<DistributionDeliveryTripartiteEntity>().lambda().eq(DistributionDeliveryTripartiteEntity::getDeliveryId, distributionAppDeliveryListVO.getId())).intValue();
}
if (aLong == 0 && aLong2 == 0) {
distributionAppDeliveryListVO.setVehicleStatus_name("未配车");
}
//查询是否备货
distributionAppDeliveryListVO.setIsstock("备货未完成");
List<DistributionStockEntity> stockEntityList = distributionStockMapper.selectList(new QueryWrapper<DistributionStockEntity>().lambda().eq(DistributionStockEntity::getReservationId, distributionAppDeliveryListVO.getReservationId()));
if (Func.isNotEmpty(stockEntityList)) {
Integer deliveryNumber = distributionAppDeliveryListVO.getDeliveryNumber(); //配送件数
int sum = stockEntityList.stream().mapToInt(DistributionStockEntity::getStockQuantity).sum();
if (sum == deliveryNumber) {
distributionAppDeliveryListVO.setIsstock("备货完成");
distributionAppDeliveryListVO.setLoadCusNub(cusCount);
distributionAppDeliveryListVO.setLoadOrdNub(ordCount.get());
//查询下面的预约单
List<DistributionSignforEntity> distributionSignforEntityList = distributionSignforMapper.selectList(new QueryWrapper<DistributionSignforEntity>().lambda().eq(DistributionSignforEntity::getDeliveryId, distributionAppDeliveryListVO.getId()));
//提取id
List<Long> reList = distributionSignforEntityList.stream().map(DistributionSignforEntity::getId).collect(Collectors.toList());
distributionAppDeliveryListVO.setType_name(dictBizClient.getValue("distribution_type", distributionAppDeliveryListVO.getType()).getData());
//查询是否配车
Integer aLong = 0;
Integer aLong2 = 0;
distributionAppDeliveryListVO.setVehicleStatus_name("已配车");
distributionAppDeliveryListVO.setDeliStatus_name("配送中");
if (distributionAppDeliveryListVO.getDeliveryStatus().equals("4")) {
distributionAppDeliveryListVO.setDeliStatus_name("完成");
}
}
//查询司机
List<DistributionAppDeliverySelfVO> distributionAppDeliverySelfVOS = distributionDeliverySelfMapper.selectListcustom(distributionAppDeliveryListVO.getId());
if (!distributionAppDeliverySelfVOS.isEmpty()) {
StringBuilder stringBuilder = new StringBuilder();
distributionAppDeliverySelfVOS.forEach(e -> {
if (e.getIsMaster() == 2) {
stringBuilder.append(e.getDriverName()).append("(主)");
} else {
stringBuilder.append(e.getDriverName()).append("(副)");
if (distributionAppDeliveryListVO.getKind().equals("1")) {
aLong = distributionDeliverySelfMapper.selectCount(new QueryWrapper<DistributionDeliverySelfEntity>().lambda().eq(DistributionDeliverySelfEntity::getDeliveryId, distributionAppDeliveryListVO.getId())).intValue();
} else {
aLong2 = distributionDeliveryTripartiteMapper.selectCount(new QueryWrapper<DistributionDeliveryTripartiteEntity>().lambda().eq(DistributionDeliveryTripartiteEntity::getDeliveryId, distributionAppDeliveryListVO.getId())).intValue();
}
if (aLong == 0 && aLong2 == 0) {
distributionAppDeliveryListVO.setVehicleStatus_name("未配车");
}
//查询是否备货
distributionAppDeliveryListVO.setIsstock("备货未完成");
List<DistributionStockEntity> stockEntityList = distributionStockMapper.selectList(new QueryWrapper<DistributionStockEntity>().lambda().eq(DistributionStockEntity::getReservationId, distributionAppDeliveryListVO.getReservationId()));
if (Func.isNotEmpty(stockEntityList)) {
Integer deliveryNumber = distributionAppDeliveryListVO.getDeliveryNumber(); //配送件数
int sum = stockEntityList.stream().mapToInt(DistributionStockEntity::getStockQuantity).sum();
if (sum == deliveryNumber) {
distributionAppDeliveryListVO.setIsstock("备货完成");
}
});
distributionAppDeliveryListVO.setDriverName(stringBuilder.toString());
}
//查询司机
List<DistributionAppDeliverySelfVO> distributionAppDeliverySelfVOS = distributionDeliverySelfMapper.selectListcustom(distributionAppDeliveryListVO.getId());
if (!distributionAppDeliverySelfVOS.isEmpty()) {
StringBuilder stringBuilder = new StringBuilder();
distributionAppDeliverySelfVOS.forEach(e -> {
if (e.getIsMaster() == 2) {
stringBuilder.append(e.getDriverName()).append("(主)");
} else {
stringBuilder.append(e.getDriverName()).append("(副)");
}
});
distributionAppDeliveryListVO.setDriverName(stringBuilder.toString());
}
}
} catch (Exception e) {
log.error(">>>>>>>> 司机配送装车查询 报错", e);
}
return page.setRecords(distributionAppDeliveryListVOS);
}
@Override
@ -3021,9 +3024,9 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl<Distrib
//此订单包件数量统计
AtomicInteger orderPackageNum = new AtomicInteger();
if (Func.isEmpty(oldOrder.get(s.getId()))) {
if (Func.isNotEmpty(signforEntity) && signforEntity.getSigningStatus().equals(SignforStatusConstant.yiqianshou.getValue())){
log.error("#############商配文员对已复核预约进行订单追加reservationId:{}",reservationEntity.getId());
throw new RuntimeException("收货单位:"+reservationEntity.getMallName()+"客户:"+reservationEntity.getConsignee()+"完成复核签收,无法追加订单");
if (Func.isNotEmpty(signforEntity) && signforEntity.getSigningStatus().equals(SignforStatusConstant.yiqianshou.getValue())) {
log.error("#############商配文员对已复核预约进行订单追加reservationId:{}", reservationEntity.getId());
throw new RuntimeException("收货单位:" + reservationEntity.getMallName() + "客户:" + reservationEntity.getConsignee() + "完成复核签收,无法追加订单");
}
DistributionReservationStockarticleEntity reservationStockarticleEntity = new DistributionReservationStockarticleEntity();
if (s.getIsZero().equals(IsOrNoConstant.no.getValue())) {
@ -3052,7 +3055,7 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl<Distrib
List<DistributionParcelListEntity> distributionParcelListEntities = distributionParcelListService.list(Wrappers.<DistributionParcelListEntity>query().lambda().eq(DistributionParcelListEntity::getStockArticleId, s.getId()).ne(DistributionParcelListEntity::getOrderPackageLoadingStatus, OrderPackageLoadingStatusConstant.yizhuangche.getValue()).ne(DistributionParcelListEntity::getOrderPackageReservationStatus, OrderPackageReservationStatusConstant.yiyueyue.getValue()).notIn(DistributionParcelListEntity::getOrderPackageStatus, new String[]{OrderPackageStatusConstant.yichuku.getValue(), OrderPackageStatusConstant.yiqianshou.getValue()}));
if (Func.isEmpty(distributionParcelListEntities)) {
log.error("##############添加空订单");
throw new RuntimeException(s.getOrderCode()+"无可用包件!!!");
throw new RuntimeException(s.getOrderCode() + "无可用包件!!!");
}
distributionParcelListEntities.forEach(dp -> {
if (!dp.getOrderPackageStatus().equals(OrderPackageStatusConstant.yiqianshou.getValue())) {
@ -3165,9 +3168,9 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl<Distrib
if (Func.isNotEmpty(packageListInfo)) {
packageListInfo.forEach(p -> {
if (Func.isEmpty(oldPackageList.get(p.getId()))) {
if (Func.isNotEmpty(signforEntity) && signforEntity.getSigningStatus().equals(SignforStatusConstant.yiqianshou.getValue())){
log.error("#############商配文员对已复核预约进行订单追加reservationId:{}",reservationEntity.getId());
throw new RuntimeException("收货单位:"+reservationEntity.getMallName()+"客户:"+reservationEntity.getConsignee()+"完成复核签收,无法追加订单");
if (Func.isNotEmpty(signforEntity) && signforEntity.getSigningStatus().equals(SignforStatusConstant.yiqianshou.getValue())) {
log.error("#############商配文员对已复核预约进行订单追加reservationId:{}", reservationEntity.getId());
throw new RuntimeException("收货单位:" + reservationEntity.getMallName() + "客户:" + reservationEntity.getConsignee() + "完成复核签收,无法追加订单");
}
//为该订单新增了包件
DistributionReservationPackageEntity reservationPackageEntity = new DistributionReservationPackageEntity();
@ -3187,9 +3190,9 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl<Distrib
});
//进行取消包件的数据清理
oldPackageList.forEach((a, b) -> {
if (Func.isNotEmpty(signforEntity) && signforEntity.getSigningStatus().equals(SignforStatusConstant.yiqianshou.getValue())){
log.error("#############商配文员对已复核预约进行订单追加reservationId:{}",reservationEntity.getId());
throw new RuntimeException("收货单位:"+reservationEntity.getMallName()+"客户:"+reservationEntity.getConsignee()+"完成复核签收,无法追加订单");
if (Func.isNotEmpty(signforEntity) && signforEntity.getSigningStatus().equals(SignforStatusConstant.yiqianshou.getValue())) {
log.error("#############商配文员对已复核预约进行订单追加reservationId:{}", reservationEntity.getId());
throw new RuntimeException("收货单位:" + reservationEntity.getMallName() + "客户:" + reservationEntity.getConsignee() + "完成复核签收,无法追加订单");
}
DistributionReservationPackageEntity reservationPackageEntity = b.get(0);
reservationPackageEntity.setPacketBarStatus(ReservationPackageStatusConstant.quxiao.getValue());
@ -3286,9 +3289,9 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl<Distrib
});
if (Func.isNotEmpty(oldOrder)) {
oldOrder.forEach((m, n) -> {
if (Func.isNotEmpty(signforEntity) && signforEntity.getSigningStatus().equals(SignforStatusConstant.yiqianshou.getValue())){
log.error("#############商配文员对已复核预约进行订单追加reservationId:{}",reservationEntity.getId());
throw new RuntimeException("收货单位:"+reservationEntity.getMallName()+"客户:"+reservationEntity.getConsignee()+"完成复核签收,无法追加订单");
if (Func.isNotEmpty(signforEntity) && signforEntity.getSigningStatus().equals(SignforStatusConstant.yiqianshou.getValue())) {
log.error("#############商配文员对已复核预约进行订单追加reservationId:{}", reservationEntity.getId());
throw new RuntimeException("收货单位:" + reservationEntity.getMallName() + "客户:" + reservationEntity.getConsignee() + "完成复核签收,无法追加订单");
}
DistributionReservationStockarticleEntity reservationStockarticleEntity = n.get(0);
if (reservationStockarticleEntity.getIsZero().equals(IsOrNoConstant.no.getValue())) {
@ -4170,16 +4173,16 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl<Distrib
List<Long> orderIds = reservationStockarticleEntityList.stream().filter(order -> order.getIsZero().equals(IsOrNoConstant.no.getValue())).map(DistributionReservationStockarticleEntity::getStockArticleId).collect(Collectors.toList());
if (Func.isNotEmpty(orderIds)) {
//查询该客户的非零但订单包间
IPage<DistributionParcelListEntity> parcelListEntityList = distributionReservationMapper.getReservationPackage(page,orderIds, distributionDeliveryInfoDTO);
IPage<DistributionParcelListEntity> parcelListEntityList = distributionReservationMapper.getReservationPackage(page, orderIds, distributionDeliveryInfoDTO);
parcelListVOIPage.setTotal(parcelListEntityList.getTotal());
// List<DistributionParcelListEntity> parcelListEntityList = distributionReservationMapper.getReservationPackageNew(distributionDeliveryInfoDTO);
log.info(">>>>>> parcelListEntityList {}",parcelListEntityList);
log.info(">>>>>> parcelListEntityList {}", parcelListEntityList);
List<DistributionParcelListVO> parcelListVOList = DistributionParcelListWrapper.build().listVO(parcelListEntityList.getRecords());
for (DistributionParcelListVO distributionParcelListVO : parcelListVOList) {
log.info(">>>>>> distributionParcelListVO {}",distributionParcelListVO);
log.info(">>>>>> distributionParcelListVO {}", distributionParcelListVO);
if (Func.isNotEmpty(loadingDataMap)) {
DistributionLoadscanEntity loadscanEntity = loadingDataMap.get(distributionParcelListVO.getId());
log.info(">>>>>> loadscanEntity {}",loadscanEntity);
log.info(">>>>>> loadscanEntity {}", loadscanEntity);
if (Func.isNotEmpty(loadscanEntity)) {
if (loadscanEntity.getSignforState().equals(LoadScanSigningStatusConstant.yiqianshou.getValue())) {
@ -4225,7 +4228,7 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl<Distrib
}
}
}
log.info(">>>>>> distributionParcelListVO2 {}",distributionParcelListVO);
log.info(">>>>>> distributionParcelListVO2 {}", distributionParcelListVO);
distributionParcelListVOS.add(distributionParcelListVO);
}
@ -5135,7 +5138,7 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl<Distrib
List<DistributionParcelListEntity> parcelListEntities = distributionParcelListService.list(Wrappers.<DistributionParcelListEntity>query().lambda().eq(DistributionParcelListEntity::getOrderPackageCode, distrilbutionloadingscanDTO.getBarcode()));
if (Func.isNotEmpty(parcelListEntities) && parcelListEntities.size() == 1) {
DistributionParcelListEntity parcelListEntity = parcelListEntities.get(0);
if (OrderPackageLoadingStatusConstant.yizhuangche.getValue().equals(parcelListEntity.getOrderPackageLoadingStatus())){
if (OrderPackageLoadingStatusConstant.yizhuangche.getValue().equals(parcelListEntity.getOrderPackageLoadingStatus())) {
//包件已装车
log.error("重复异常装车,:{}", parcelListEntity.getOrderPackageCode());
return Resp.scanFail("操作失败", "包件已装车");
@ -5290,13 +5293,13 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl<Distrib
DistributionReservationOrderPackageVO reservationOrderPackageVO = new DistributionReservationOrderPackageVO();
LambdaQueryWrapper<DistributionParcelListEntity> parcelListEntityLambdaQueryWrapper = Wrappers.<DistributionParcelListEntity>query().lambda()
.notIn(DistributionParcelListEntity::getOrderPackageStatus, OrderPackageStatusConstant.yiqianshou.getValue(),OrderPackageStatusConstant.yichuku.getValue())
.notIn(DistributionParcelListEntity::getOrderPackageStatus, OrderPackageStatusConstant.yiqianshou.getValue(), OrderPackageStatusConstant.yichuku.getValue())
.ne(DistributionParcelListEntity::getOrderPackageLoadingStatus, OrderPackageLoadingStatusConstant.yizhuangche.getValue())
.eq(DistributionParcelListEntity::getStockArticleId, orderId);
if (Func.isNotEmpty(reservationPackageList)){
if (Func.isNotEmpty(reservationPackageList)) {
List<Long> packageIds = reservationPackageList.stream().map(DistributionParcelListEntity::getId).collect(Collectors.toList());
if (Func.isNotEmpty(packageIds)){
parcelListEntityLambdaQueryWrapper.notIn(DistributionParcelListEntity::getId,packageIds);
if (Func.isNotEmpty(packageIds)) {
parcelListEntityLambdaQueryWrapper.notIn(DistributionParcelListEntity::getId, packageIds);
}
}
List<DistributionParcelListEntity> parcelListEntities = distributionParcelListService.list(parcelListEntityLambdaQueryWrapper);
@ -6475,7 +6478,7 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl<Distrib
//查询产品名称拼接
String productName = distributionReservationPackageService.getConcatThirdProductByOrderId(reservationId, stockArticleId);
String materialNames = distributionReservationPackageService.getConcatMaterialName(reservationId,stockArticleId);
String materialNames = distributionReservationPackageService.getConcatMaterialName(reservationId, stockArticleId);
temp.put("产品名称", productName);
//todo 单位是否需要查询物料表
@ -6767,34 +6770,34 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl<Distrib
public R cancelDelivery(Long deliveryId) {
String method = "###################DistributionDeliveryListServiceImpl执行方法cancelDelivery,";
DistributionDeliveryListEntity deliveryListEntity = this.getById(deliveryId);
if (Func.isEmpty(deliveryListEntity)){
if (Func.isEmpty(deliveryListEntity)) {
log.info(method + "参数缺失deliveryId:{}", deliveryId);
return R.fail("服务器正忙!!!");
}
List<DistributionReservationEntity> reservationEntities = distributionSignforService.selectReservationByDeliveryId(deliveryId);
if (Func.isEmpty(reservationEntities)){
log.info(method + "预约查询失败:{}", deliveryId);
if (Func.isEmpty(reservationEntities)) {
log.info(method + "预约查询失败:{}", deliveryId);
return R.fail("服务器正忙!!!");
}
String reservationCodes = reservationEntities.stream().filter(f -> !f.getLoadingStatus().equals(ReservationLoadingStatusConstant.daizhuangche.getValue())).map(DistributionReservationEntity::getReservationCode).collect(Collectors.joining(","));
if (Func.isNotEmpty(reservationCodes)){
if (Func.isNotEmpty(reservationCodes)) {
log.info(method + "存在装车数据:{}", reservationCodes);
return R.fail(reservationCodes+"存在装车包件!!!");
return R.fail(reservationCodes + "存在装车包件!!!");
}
//该配送是否存在异常装车或者异常签收数据
List<DistributionLoadscanEntity> loadscanEntityList = distributionDeliveryListService.selectAbnormalLoadingBydeliveryId(deliveryId);
if (Func.isNotEmpty(loadscanEntityList)){
if (Func.isNotEmpty(loadscanEntityList)) {
log.info(method + "存在异常装车数据:{}", deliveryId);
return R.fail(reservationCodes+"存在异常装车、签收包条!!!");
return R.fail(reservationCodes + "存在异常装车、签收包条!!!");
}
boolean flag = false;
for (DistributionReservationEntity reservationEntity : reservationEntities) {
DistributionReservationDTO reservationDTO = Func.copy(reservationEntity, DistributionReservationDTO.class);
flag = distributionReservationService.cancelReservation(reservationDTO);
if (!flag){
log.info(method + "取消预约失败:{}", deliveryId);
throw new RuntimeException("取消配送计划失败,请联系管理员");
}
flag = distributionReservationService.cancelReservation(reservationDTO);
if (!flag) {
log.info(method + "取消预约失败:{}", deliveryId);
throw new RuntimeException("取消配送计划失败,请联系管理员");
}
}
return R.status(flag);
}
@ -6802,9 +6805,9 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl<Distrib
@Override
public List<DistributionLoadscanEntity> selectAbnormalLoadingBydeliveryId(Long deliveryId) {
return distributionLoadscanService.list(Wrappers.<DistributionLoadscanEntity>query().lambda()
.eq(DistributionLoadscanEntity::getDeliveryId,deliveryId)
.eq(DistributionLoadscanEntity::getScanStatus,LoadingStatusConstant.quxiao.getValue())
.eq(DistributionLoadscanEntity::getIsAbnormalLoading,2)
.eq(DistributionLoadscanEntity::getDeliveryId, deliveryId)
.eq(DistributionLoadscanEntity::getScanStatus, LoadingStatusConstant.quxiao.getValue())
.eq(DistributionLoadscanEntity::getIsAbnormalLoading, 2)
);
}
@ -6847,10 +6850,10 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl<Distrib
List<DistributionSignforEntity> list = distributionSignforService.list(Wrappers.<DistributionSignforEntity>query().lambda()
.eq(DistributionSignforEntity::getDeliveryId, deliveryId)
);
if (!list.isEmpty()){
if (!list.isEmpty()) {
//查看所有的签收信息是否均已完成
boolean anyMatch = list.stream().allMatch(s -> s.getSigningStatus().equals(SignforStatusConstant.yiqianshou.getValue()));
if (anyMatch){
if (anyMatch) {
deliveryListEntity.setDeliveryStatus(DeliveryStatusConstant.yiwancheng.getValue());
}
}

Loading…
Cancel
Save