|
|
|
@ -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 |
|
|
|
|