Browse Source

Merge branch 'fix_bug_2024-01-16' into dev

# Conflicts:
#	blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionDeliveryListServiceImpl.java
#	blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionSignforServiceImpl.java
single_db
汤建军 1 year ago
parent
commit
20ba4ad569
  1. 39
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionDeliveryListServiceImpl.java
  2. 353
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionSignforServiceImpl.java

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

@ -2622,9 +2622,9 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl<Distrib
//查询出配送任务的基本信息
DistributionDeliveryListEntity deliveryListEntity = this.getById(deliveryListDTO.getId());
Long deliveryListEntityId = deliveryListEntity.getId();
if (deliveryListEntity.getDeliveryStatus().equals(DeliveryStatusConstant.peisongzhong.getValue())) {
return R.fail("正在配送中...");
}
// if (deliveryListEntity.getDeliveryStatus().equals(DeliveryStatusConstant.peisongzhong.getValue())) {
// return R.fail("正在配送中...");
// }
if (deliveryListEntity.getDeliveryStatus().equals(DeliveryStatusConstant.yiwancheng.getValue())) {
return R.fail("配送已完成...");
}
@ -2967,16 +2967,13 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl<Distrib
//根据配送计划和运单号查询出该预约
DistributionReservationEntity reservationEntity = baseMapper.selectReservationByDeliveryListIdAndCustomer(deliveryListEntityId, k);
// DistributionReservationEntity reservationEntity = baseMapper.selectReservationByDeliveryListIdAndCustomerUnit(deliveryListEntityId, k);
// DistributionSignforEntity signforEntity = distributionSignforService.getOne(Wrappers.<DistributionSignforEntity>query().lambda()
// .eq(DistributionSignforEntity::getReservationId, reservationEntity.getId())
// .eq(DistributionSignforEntity::getDeliveryId, deliveryListEntity.getId())
// );
// if (Func.isNotEmpty(signforEntity) && signforEntity.getSigningStatus().equals(SignforStatusConstant.yiqianshou.getValue())){
// log.error("#############商配文员对已复核预约进行订单追加reservationId:{}",reservationEntity.getId());
// throw new RuntimeException("收货单位:"+reservationEntity.getMallName()+"客户:"+reservationEntity.getConsignee()+"完成复核签收,无法追加订单");
// }
// DistributionReservationEntity reservationEntity = baseMapper.selectReservationByDeliveryListIdAndCustomer(deliveryListEntityId, k);
DistributionReservationEntity reservationEntity = baseMapper.selectReservationByDeliveryListIdAndCustomerUnit(deliveryListEntityId, k);
DistributionSignforEntity signforEntity = distributionSignforService.getOne(Wrappers.<DistributionSignforEntity>query().lambda()
.eq(DistributionSignforEntity::getReservationId, reservationEntity.getId())
.eq(DistributionSignforEntity::getDeliveryId, deliveryListEntity.getId())
);
//查询出该预约下的订单信息
List<DistributionReservationStockarticleEntity> reservationStockarticleEntityList = distributionReservationStockarticleMapper.selectList(Wrappers.<DistributionReservationStockarticleEntity>query().lambda().eq(DistributionReservationStockarticleEntity::getReservationId, reservationEntity.getId()).ne(DistributionReservationStockarticleEntity::getStockArticleStatus, ReservationOrderStatusConstant.quxiao.getValue()));
@ -3023,6 +3020,10 @@ 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()+"完成复核签收,无法追加订单");
}
DistributionReservationStockarticleEntity reservationStockarticleEntity = new DistributionReservationStockarticleEntity();
if (s.getIsZero().equals(IsOrNoConstant.no.getValue())) {
//新增订单
@ -3155,6 +3156,10 @@ 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()+"完成复核签收,无法追加订单");
}
//为该订单新增了包件
DistributionReservationPackageEntity reservationPackageEntity = new DistributionReservationPackageEntity();
reservationPackageEntity.setReservationId(reservationEntity.getId());
@ -3173,6 +3178,10 @@ 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()+"完成复核签收,无法追加订单");
}
DistributionReservationPackageEntity reservationPackageEntity = b.get(0);
reservationPackageEntity.setPacketBarStatus(ReservationPackageStatusConstant.quxiao.getValue());
distributionReservationPackageService.updateById(reservationPackageEntity);
@ -3268,6 +3277,10 @@ 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()+"完成复核签收,无法追加订单");
}
DistributionReservationStockarticleEntity reservationStockarticleEntity = n.get(0);
if (reservationStockarticleEntity.getIsZero().equals(IsOrNoConstant.no.getValue())) {
List<DistributionReservationPackageEntity> reservationPackageEntityList = distributionReservationPackageMapper.selectList(Wrappers.<DistributionReservationPackageEntity>query().lambda().eq(DistributionReservationPackageEntity::getReservationId, reservationEntity.getId()).eq(DistributionReservationPackageEntity::getStockArticleId, reservationStockarticleEntity.getStockArticleId()));

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

@ -1114,210 +1114,207 @@ public class DistributionSignforServiceImpl extends BaseServiceImpl<Distribution
public R signfor(DistrilbutionAppsignforDTO distrilbutionloadingscanDTO) {
String nickName = null;
Long userId = null;
//思路: 在于一个客户下不会出现重复的包条码
BasicdataWarehouseEntity myCurrentWarehouse = basicdataWarehouseClient.getMyCurrentWarehouse();
if (Objects.isNull(myCurrentWarehouse)) {
return R.fail(403, "仓库信息不能为空");
}
try {
nickName = AuthUtil.getNickName();
userId = AuthUtil.getUserId();
} catch (Exception e) {
log.error(">>>>> 签收异常报错", e);
throw new CustomerException("当前登录信息不已失效,请重新登录");
}
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS");
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS");
// ---------------------------------2023-09-09 包件签收调整---------------------------------------------------------------
//思路: 在于一个客户下不会出现重复的包条码
BasicdataWarehouseEntity myCurrentWarehouse = basicdataWarehouseClient.getMyCurrentWarehouse();
if (Objects.isNull(myCurrentWarehouse)) {
throw new CustomerException(403, "仓库信息不能为空");
}
DistributionParcelListEntity parcelListEntity = distributionParcelListService.selectByOrderPackageCode(distrilbutionloadingscanDTO.getBarcode(), myCurrentWarehouse.getId());
if (Func.isEmpty(parcelListEntity)) {
return Resp.scanFail("包件信息不存在", "包件信息不存在");
}
DistributionReservationEntity distributionReservationEntity = distributionReservationMapper.selectById(distrilbutionloadingscanDTO.getReservationId());
if (Func.isEmpty(distributionReservationEntity)) {
log.error("########无效的预约单,reservationId:{}", distrilbutionloadingscanDTO.getReservationId());
return R.fail("服务器正忙!!");
}
List<DisStockListDetailEntity> list = disStockListDetailService.list(Wrappers.<DisStockListDetailEntity>query().lambda()
.eq(DisStockListDetailEntity::getStockPackageCode, distrilbutionloadingscanDTO.getBarcode())
.ne(DisStockListDetailEntity::getStockPackageStatus, ReservationPackageStatusConstant.quxiao.getValue())
);
if (Func.isNotEmpty(list)) {
//满足条件此码必定为库存品
//判断该库存品是否属于当前客户
List<DisStockListDetailEntity> collect = list.stream().filter(l -> l.getReservationId().equals(distrilbutionloadingscanDTO.getReservationId())).collect(Collectors.toList());
if (Func.isNotEmpty(collect)) {
return Resp.scanFail("请在库存品页面扫描此码", "请在库存品页面扫描此码");
}
return Resp.scanFail("此码不是订制品", "此码不是订制品");
}
List<DistributionParcelListEntity> parcelListEntityList = distributionReservationMapper.selectPackageListByReservationId(distrilbutionloadingscanDTO.getReservationId());
//查询该客户是否存在该包件信息
List<DistributionParcelListEntity> collect = parcelListEntityList.stream().filter(p -> p.getOrderPackageCode().equals(distrilbutionloadingscanDTO.getBarcode())).collect(Collectors.toList());
if (Func.isNotEmpty(collect) && collect.size() == 1) {
//存在则查询该包件是否进行装车
DistributionLoadscanEntity loadscanEntity = distributionLoadscanMapper.selectOne(Wrappers.<DistributionLoadscanEntity>query().lambda()
.ne(DistributionLoadscanEntity::getScanStatus, 1)
.eq(DistributionLoadscanEntity::getReservationId, distrilbutionloadingscanDTO.getReservationId())
.eq(DistributionLoadscanEntity::getDeliveryId, distrilbutionloadingscanDTO.getDeliveryId())
.eq(DistributionLoadscanEntity::getOrderPackageCode, distrilbutionloadingscanDTO.getBarcode()));
if (Func.isNotEmpty(loadscanEntity)) {
if (loadscanEntity.getSignforState().equals(2)) {
return Resp.scanFail("重复扫描", "包件已签收");
DistributionParcelListEntity parcelListEntity = distributionParcelListService.selectByOrderPackageCode(distrilbutionloadingscanDTO.getBarcode(), myCurrentWarehouse.getId());
if (Func.isEmpty(parcelListEntity)) {
return Resp.scanFail("包件信息不存在", "包件信息不存在");
}
DistributionReservationEntity distributionReservationEntity = distributionReservationMapper.selectById(distrilbutionloadingscanDTO.getReservationId());
if (Func.isEmpty(distributionReservationEntity)) {
log.error("########无效的预约单,reservationId:{}", distrilbutionloadingscanDTO.getReservationId());
return R.fail("服务器正忙!!");
}
List<DisStockListDetailEntity> list = disStockListDetailService.list(Wrappers.<DisStockListDetailEntity>query().lambda()
.eq(DisStockListDetailEntity::getStockPackageCode, distrilbutionloadingscanDTO.getBarcode())
.ne(DisStockListDetailEntity::getStockPackageStatus, ReservationPackageStatusConstant.quxiao.getValue())
);
if (Func.isNotEmpty(list)) {
//满足条件此码必定为库存品
//判断该库存品是否属于当前客户
List<DisStockListDetailEntity> collect = list.stream().filter(l -> l.getReservationId().equals(distrilbutionloadingscanDTO.getReservationId())).collect(Collectors.toList());
if (Func.isNotEmpty(collect)) {
return Resp.scanFail("请在库存品页面扫描此码", "请在库存品页面扫描此码");
}
//存在装车记录,进行修改即可
//进行签收记录数据的维护
loadscanEntity.setSigningTime(simpleDateFormat.format(new Date()));
loadscanEntity.setSignforState(2);
loadscanEntity.setReceivedQuantity(loadscanEntity.getLoadedNub());
return Resp.scanFail("此码不是订制品", "此码不是订制品");
}
List<DistributionParcelListEntity> parcelListEntityList = distributionReservationMapper.selectPackageListByReservationId(distrilbutionloadingscanDTO.getReservationId());
//查询该客户是否存在该包件信息
List<DistributionParcelListEntity> collect = parcelListEntityList.stream().filter(p -> p.getOrderPackageCode().equals(distrilbutionloadingscanDTO.getBarcode())).collect(Collectors.toList());
if (Func.isNotEmpty(collect) && collect.size() == 1) {
//存在则查询该包件是否进行装车
DistributionLoadscanEntity loadscanEntity = distributionLoadscanMapper.selectOne(Wrappers.<DistributionLoadscanEntity>query().lambda()
.ne(DistributionLoadscanEntity::getScanStatus, 1)
.eq(DistributionLoadscanEntity::getReservationId, distrilbutionloadingscanDTO.getReservationId())
.eq(DistributionLoadscanEntity::getDeliveryId, distrilbutionloadingscanDTO.getDeliveryId())
.eq(DistributionLoadscanEntity::getOrderPackageCode, distrilbutionloadingscanDTO.getBarcode()));
if (Func.isNotEmpty(loadscanEntity)) {
if (loadscanEntity.getSignforState().equals(2)) {
return Resp.scanFail("重复扫描", "包件已签收");
}
//存在装车记录,进行修改即可
//进行签收记录数据的维护
loadscanEntity.setSigningTime(simpleDateFormat.format(new Date()));
loadscanEntity.setSignforState(2);
loadscanEntity.setReceivedQuantity(loadscanEntity.getLoadedNub());
loadscanEntity.setSigningUser(nickName);
loadscanEntity.setSigningUserId(userId);
loadscanEntity.setSigningUser(nickName);
loadscanEntity.setSigningUserId(userId);
distributionLoadscanService.updateById(loadscanEntity);
//缺少一个异步维护包件签收的方法
distributionLoadscanService.updateById(loadscanEntity);
//缺少一个异步维护包件签收的方法
// distributionAsyncService.changeOrderSignforStatus(collect.get(0));
Integer j = distributionSignforMapper.updateSignforNum(loadscanEntity.getDeliveryId(), loadscanEntity.getReservationId(), loadscanEntity.getPackageNub());
//更新签收人
Integer m = distributionSignforMapper.updateSignUser(loadscanEntity.getDeliveryId(), loadscanEntity.getReservationId(), AuthUtil.getUser());
//下架解托
warehouseUpdownTypeClient.downPackageOrDelTray(loadscanEntity.getOrderPackageCode(), myCurrentWarehouse.getId());
//维护订单状态
} else {
//这里装车的数据需要进行补录
DistributionDeliveryListEntity deliveryListEntity = distributionDeliveryListMapper.selectById(distrilbutionloadingscanDTO.getDeliveryId());
DistributionDeliverySelfEntity distributionDeliverySelfEntity = new DistributionDeliverySelfDTO();
if (deliveryListEntity.getKind().equals(ServiceConstant.DELIVERLIST_KIND_SELF)) {
distributionDeliverySelfEntity = distributionDeliverySelfMapper.selectOne(new QueryWrapper<DistributionDeliverySelfEntity>().lambda()
.eq(DistributionDeliverySelfEntity::getIsMaster, ServiceConstant.IS_MASTER_YES)
.eq(DistributionDeliverySelfEntity::getDeliveryId, distrilbutionloadingscanDTO.getDeliveryId())
);
Integer j = distributionSignforMapper.updateSignforNum(loadscanEntity.getDeliveryId(), loadscanEntity.getReservationId(), loadscanEntity.getPackageNub());
//更新签收人
Integer m = distributionSignforMapper.updateSignUser(loadscanEntity.getDeliveryId(), loadscanEntity.getReservationId(), AuthUtil.getUser());
//下架解托
warehouseUpdownTypeClient.downPackageOrDelTray(loadscanEntity.getOrderPackageCode(), myCurrentWarehouse.getId());
//维护订单状态
} else {
DistributionDeliveryTripartiteEntity distributionDeliveryTripartiteEntity = distributionDeliveryTripartiteMapper.selectOne(new QueryWrapper<DistributionDeliveryTripartiteEntity>().lambda()
.eq(DistributionDeliveryTripartiteEntity::getDeliveryId, distrilbutionloadingscanDTO.getDeliveryId()));
BeanUtils.copyProperties(distributionDeliveryTripartiteEntity, distributionDeliverySelfEntity);
}
DistributionDeliveryListEntity listEntity = distributionDeliveryListMapper.selectById(distrilbutionloadingscanDTO.getDeliveryId());
if (Func.isEmpty(listEntity)) {
log.error("##########配送计划异常:{}", listEntity);
return Resp.scanFail("服务器正忙...", "服务器正忙");
}
//查询配送计划的计划司机
DistributionLoadscanEntity distributionLoadscanEntity = new DistributionLoadscanEntity();
if (StringUtils.isNotBlank(distributionDeliverySelfEntity.getDriverPhone())) {
distributionLoadscanEntity.setDriverPhone(distributionDeliverySelfEntity.getDriverPhone());
}
if (StringUtils.isNotBlank(distributionDeliverySelfEntity.getVehicleNub())) {
distributionLoadscanEntity.setVehicleName(distributionDeliverySelfEntity.getVehicleNub());
}
if (StringUtils.isNotBlank(distributionDeliverySelfEntity.getDriverId())) {
distributionLoadscanEntity.setDriverId(distributionDeliverySelfEntity.getDriverId());
}
if (Func.isNotEmpty(distributionDeliverySelfEntity.getId())) {
distributionLoadscanEntity.setLoadingId(distributionDeliverySelfEntity.getId().toString());
}
if (Func.isNotEmpty(distributionDeliverySelfEntity.getDriverName())) {
distributionLoadscanEntity.setDriverName(distributionDeliverySelfEntity.getDriverName());
//这里装车的数据需要进行补录
DistributionDeliveryListEntity deliveryListEntity = distributionDeliveryListMapper.selectById(distrilbutionloadingscanDTO.getDeliveryId());
DistributionDeliverySelfEntity distributionDeliverySelfEntity = new DistributionDeliverySelfDTO();
if (deliveryListEntity.getKind().equals(ServiceConstant.DELIVERLIST_KIND_SELF)) {
distributionDeliverySelfEntity = distributionDeliverySelfMapper.selectOne(new QueryWrapper<DistributionDeliverySelfEntity>().lambda()
.eq(DistributionDeliverySelfEntity::getIsMaster, ServiceConstant.IS_MASTER_YES)
.eq(DistributionDeliverySelfEntity::getDeliveryId, distrilbutionloadingscanDTO.getDeliveryId())
);
} else {
DistributionDeliveryTripartiteEntity distributionDeliveryTripartiteEntity = distributionDeliveryTripartiteMapper.selectOne(new QueryWrapper<DistributionDeliveryTripartiteEntity>().lambda()
.eq(DistributionDeliveryTripartiteEntity::getDeliveryId, distrilbutionloadingscanDTO.getDeliveryId()));
BeanUtils.copyProperties(distributionDeliveryTripartiteEntity, distributionDeliverySelfEntity);
}
DistributionDeliveryListEntity listEntity = distributionDeliveryListMapper.selectById(distrilbutionloadingscanDTO.getDeliveryId());
if (Func.isEmpty(listEntity)) {
log.error("##########配送计划异常:{}", listEntity);
return Resp.scanFail("服务器正忙...", "服务器正忙");
}
//查询配送计划的计划司机
DistributionLoadscanEntity distributionLoadscanEntity = new DistributionLoadscanEntity();
if (StringUtils.isNotBlank(distributionDeliverySelfEntity.getDriverPhone())) {
distributionLoadscanEntity.setDriverPhone(distributionDeliverySelfEntity.getDriverPhone());
}
if (StringUtils.isNotBlank(distributionDeliverySelfEntity.getVehicleNub())) {
distributionLoadscanEntity.setVehicleName(distributionDeliverySelfEntity.getVehicleNub());
}
if (StringUtils.isNotBlank(distributionDeliverySelfEntity.getDriverId())) {
distributionLoadscanEntity.setDriverId(distributionDeliverySelfEntity.getDriverId());
}
if (Func.isNotEmpty(distributionDeliverySelfEntity.getId())) {
distributionLoadscanEntity.setLoadingId(distributionDeliverySelfEntity.getId().toString());
}
if (Func.isNotEmpty(distributionDeliverySelfEntity.getDriverName())) {
distributionLoadscanEntity.setDriverName(distributionDeliverySelfEntity.getDriverName());
}
if (StringUtils.isNotBlank(distributionDeliverySelfEntity.getVehicleId())) {
distributionLoadscanEntity.setVehicleId(distributionDeliverySelfEntity.getVehicleId());
}
Date loadScanTime = new Date();
distributionLoadscanEntity.setScanTime(simpleDateFormat.format(loadScanTime));
distributionLoadscanEntity.setPackageId(collect.get(0).getId());
distributionLoadscanEntity.setOrderPackageCode(distrilbutionloadingscanDTO.getBarcode());
Date signingTime = new Date(System.currentTimeMillis()+(1000*60));
distributionLoadscanEntity.setSigningTime(simpleDateFormat.format(signingTime));
distributionLoadscanEntity.setReceivedQuantity(collect.get(0).getQuantity());
distributionLoadscanEntity.setReservationId(distrilbutionloadingscanDTO.getReservationId());
distributionLoadscanEntity.setIsSignfor(2);
distributionLoadscanEntity.setIsInsert(2);
distributionLoadscanEntity.setSignforState(2);
distributionLoadscanEntity.setPackageNub(collect.get(0).getQuantity());
distributionLoadscanEntity.setOrderId(collect.get(0).getStockArticleId());
distributionLoadscanEntity.setLoadedNub(collect.get(0).getQuantity());
distributionLoadscanEntity.setReservationId(distrilbutionloadingscanDTO.getReservationId());
distributionLoadscanEntity.setDeliveryId(distrilbutionloadingscanDTO.getDeliveryId());
distributionLoadscanEntity.setScanUser(AuthUtil.getUser().getNickName());
distributionLoadscanEntity.setSigningUser(AuthUtil.getUser().getNickName());
distributionLoadscanEntity.setSigningUserId(AuthUtil.getUser().getUserId());
distributionLoadscanEntity.setScanStatus(LoadingStatusConstant.buluzhuangche.getValue());
distributionLoadscanService.save(distributionLoadscanEntity);
//进行签收数量的修改
Integer i = distributionDeliveryListMapper.updateloadingTimeById(distrilbutionloadingscanDTO.getDeliveryId());
//更新装车包件数和签收包件数
Integer j = distributionSignforMapper.updateSignforByReservationId(distributionLoadscanEntity.getDeliveryId(), distributionLoadscanEntity.getReservationId(), distributionLoadscanEntity.getPackageNub());
//更新签收人
Integer m = distributionSignforMapper.updateSignUser(distributionLoadscanEntity.getDeliveryId(), distributionLoadscanEntity.getReservationId(), AuthUtil.getUser());
//包件解托下架
warehouseUpdownTypeClient.downPackageOrDelTray(collect.get(0).getOrderPackageCode(), myCurrentWarehouse.getId());
}
if (StringUtils.isNotBlank(distributionDeliverySelfEntity.getVehicleId())) {
distributionLoadscanEntity.setVehicleId(distributionDeliverySelfEntity.getVehicleId());
//修改包件状态为装车、签收
DistributionParcelListEntity updatePackage = collect.get(0);
updatePackage.setOrderPackageLoadingStatus(OrderPackageLoadingStatusConstant.yizhuangche.getValue());
updatePackage.setOrderPackageStatus(OrderPackageStatusConstant.yiqianshou.getValue());
distributionParcelListService.updateById(updatePackage);
//维护签收包件状态
distributionStockArticleService.maintenanceOrderInfo(collect.get(0).getOrderCode(),myCurrentWarehouse.getId());
//推送信息至工厂
distributionAsyncService.sendFactory(collect.get(0), simpleDateFormat.format(new Date()), distributionReservationEntity.getId(), distributionReservationEntity.getReservationCode(), myCurrentWarehouse.getName(),nickName);
} else if (Func.isEmpty(collect)) {
//这里就需要对该包件信息是否属于该配送计划进行判定。如果属于该配送计划则是串货。不是那么则需要提示是否异常签收或者返回的操作
//查询配送计划中是否存在该包件
DistributionParcelListEntity one = distributionParcelListService.getOne(Wrappers.<DistributionParcelListEntity>query().lambda()
.eq(DistributionParcelListEntity::getOrderPackageCode, distrilbutionloadingscanDTO.getBarcode())
.eq(DistributionParcelListEntity::getWarehouseId, myCurrentWarehouse.getId())
);
if (Func.isNotEmpty(one) && one.getConditions() == 2) {
log.error("#####################此包件不是定制品", one.getConditions());
return Resp.scanFail("此包件不是定制品", "此包件不是定制品");
}
Date loadScanTime = new Date();
distributionLoadscanEntity.setScanTime(simpleDateFormat.format(loadScanTime));
distributionLoadscanEntity.setPackageId(collect.get(0).getId());
distributionLoadscanEntity.setOrderPackageCode(distrilbutionloadingscanDTO.getBarcode());
Date signingTime = new Date(System.currentTimeMillis()+(1000*60));
distributionLoadscanEntity.setSigningTime(simpleDateFormat.format(signingTime));
distributionLoadscanEntity.setReceivedQuantity(collect.get(0).getQuantity());
distributionLoadscanEntity.setReservationId(distrilbutionloadingscanDTO.getReservationId());
distributionLoadscanEntity.setIsSignfor(2);
distributionLoadscanEntity.setIsInsert(2);
distributionLoadscanEntity.setSignforState(2);
distributionLoadscanEntity.setPackageNub(collect.get(0).getQuantity());
distributionLoadscanEntity.setOrderId(collect.get(0).getStockArticleId());
distributionLoadscanEntity.setLoadedNub(collect.get(0).getQuantity());
distributionLoadscanEntity.setReservationId(distrilbutionloadingscanDTO.getReservationId());
distributionLoadscanEntity.setDeliveryId(distrilbutionloadingscanDTO.getDeliveryId());
distributionLoadscanEntity.setScanUser(AuthUtil.getUser().getNickName());
distributionLoadscanEntity.setSigningUser(AuthUtil.getUser().getNickName());
distributionLoadscanEntity.setSigningUserId(AuthUtil.getUser().getUserId());
distributionLoadscanEntity.setScanStatus(LoadingStatusConstant.buluzhuangche.getValue());
distributionLoadscanService.save(distributionLoadscanEntity);
//进行签收数量的修改
Integer i = distributionDeliveryListMapper.updateloadingTimeById(distrilbutionloadingscanDTO.getDeliveryId());
//更新装车包件数和签收包件数
Integer j = distributionSignforMapper.updateSignforByReservationId(distributionLoadscanEntity.getDeliveryId(), distributionLoadscanEntity.getReservationId(), distributionLoadscanEntity.getPackageNub());
//更新签收人
Integer m = distributionSignforMapper.updateSignUser(distributionLoadscanEntity.getDeliveryId(), distributionLoadscanEntity.getReservationId(), AuthUtil.getUser());
//包件解托下架
warehouseUpdownTypeClient.downPackageOrDelTray(collect.get(0).getOrderPackageCode(), myCurrentWarehouse.getId());
}
//修改包件状态为装车、签收
DistributionParcelListEntity updatePackage = collect.get(0);
updatePackage.setOrderPackageLoadingStatus(OrderPackageLoadingStatusConstant.yizhuangche.getValue());
updatePackage.setOrderPackageStatus(OrderPackageStatusConstant.yiqianshou.getValue());
distributionParcelListService.updateById(updatePackage);
//维护签收包件状态
distributionStockArticleService.maintenanceOrderInfo(collect.get(0).getOrderCode(),myCurrentWarehouse.getId());
//推送信息至工厂
distributionAsyncService.sendFactory(collect.get(0), simpleDateFormat.format(new Date()), distributionReservationEntity.getId(), distributionReservationEntity.getReservationCode(), myCurrentWarehouse.getName(),nickName);
//TODO 这里就需要一个异步的包件状态维护方法
} else if (Func.isEmpty(collect)) {
//这里就需要对该包件信息是否属于该配送计划进行判定。如果属于该配送计划则是串货。不是那么则需要提示是否异常签收或者返回的操作
//查询配送计划中是否存在该包件
DistributionParcelListEntity one = distributionParcelListService.getOne(Wrappers.<DistributionParcelListEntity>query().lambda()
.eq(DistributionParcelListEntity::getOrderPackageCode, distrilbutionloadingscanDTO.getBarcode())
.eq(DistributionParcelListEntity::getWarehouseId, myCurrentWarehouse.getId())
);
if (Func.isNotEmpty(one) && one.getConditions() == 2) {
log.error("#####################此包件不是定制品{}", one.getConditions());
return Resp.scanFail("此包件不是定制品", "此包件不是定制品");
}
List<DistributionParcelListEntity> parcelListEntities = distributionDeliveryListMapper.selectPackageListByDeliveryListId(distrilbutionloadingscanDTO.getDeliveryId());
//该货物是否属于该计划
List<DistributionParcelListEntity> distributionParcelListEntities = parcelListEntities.stream().filter(p -> p.getOrderPackageCode().equals(distrilbutionloadingscanDTO.getBarcode())).collect(Collectors.toList());
List<DistributionParcelListEntity> parcelListEntities = distributionDeliveryListMapper.selectPackageListByDeliveryListId(distrilbutionloadingscanDTO.getDeliveryId());
//该货物是否属于该计划
List<DistributionParcelListEntity> distributionParcelListEntities = parcelListEntities.stream().filter(p -> p.getOrderPackageCode().equals(distrilbutionloadingscanDTO.getBarcode())).collect(Collectors.toList());
if (Func.isNotEmpty(distributionParcelListEntities) && distributionParcelListEntities.size() == 1) {
//这里按道理也具备签收条件,需要标注该装车记录不正常
log.error("#####################distributionParcelListEntities窜货{}", distributionParcelListEntities);
return Resp.scanFail("窜货", "窜货");
} else {
//判断该货物是否属于该客户
if (Func.isNotEmpty(distributionParcelListEntities) && distributionParcelListEntities.size() == 1) {
//这里按道理也具备签收条件,需要标注该装车记录不正常
log.error("#####################distributionParcelListEntities窜货", distributionParcelListEntities);
return Resp.scanFail("窜货", "窜货");
} else {
//判断该货物是否属于该客户
// 异常签收
// return Resp.scanFail("异常签收包件","异常签收包件");
//判断客户
boolean flag = judgmentClient(distributionReservationEntity, parcelListEntity.getStockArticleId());
if (flag) {
if (parcelListEntity.getOrderPackageStatus().equals(OrderPackageStatusConstant.yiqianshou.getValue())){
return Resp.scanFail("包件已签收", "包件已签收");
}else {
return R.fail(3006, null);
//判断客户
boolean flag = judgmentClient(distributionReservationEntity, parcelListEntity.getStockArticleId());
if (flag) {
if (parcelListEntity.getOrderPackageStatus().equals(OrderPackageStatusConstant.yiqianshou.getValue())){
return Resp.scanFail("包件已签收", "包件已签收");
}else {
return R.fail(3006, null);
}
} else {
return Resp.scanFail("不满足签收条件", "不满足签收条件");
}
} else {
return Resp.scanFail("不满足签收条件", "不满足签收条件");
}
} else {
//一个客户下出现重复包条码
log.error("############出现重复包条码:{}", collect);
}
} else {
//一个客户下出现重复包条码
log.error("############出现重复包条码:{}", collect);
String str = checkSignNum(distrilbutionloadingscanDTO);
//维护客户
distributionReservationService.maintenanceReservationInfo(distrilbutionloadingscanDTO.getReservationId());
//维护配送任务
distributionDeliveryListService.maintenanceDeliveryInfo(distrilbutionloadingscanDTO.getDeliveryId());
return Resp.scanSuccess("签收成功", str);
} catch (Exception e) {
log.error(">>>>> 签收异常报错", e);
throw new CustomerException("当前登录信息不已失效,请重新登录");
}
String str = checkSignNum(distrilbutionloadingscanDTO);
//维护客户
distributionReservationService.maintenanceReservationInfo(distrilbutionloadingscanDTO.getReservationId());
//维护配送任务
distributionDeliveryListService.maintenanceDeliveryInfo(distrilbutionloadingscanDTO.getDeliveryId());
return Resp.scanSuccess("签收成功", str);
}
@Override

Loading…
Cancel
Save