|
|
|
@ -55,7 +55,8 @@ import com.logpm.oldproject.feign.IWarehouseClient;
|
|
|
|
|
import com.logpm.trunkline.dto.WaybillLogDTO; |
|
|
|
|
import com.logpm.trunkline.feign.ITrunklinePackageTrackLogClient; |
|
|
|
|
import com.logpm.trunkline.feign.ITrunklineWaybillTrackClient; |
|
|
|
|
import com.logpm.warehouse.entity.WarehouseTrayGoodsEntity; |
|
|
|
|
import com.logpm.warehouse.entity.WarehouseRetentionScanEntity; |
|
|
|
|
import com.logpm.warehouse.feign.IWarehouseRetentionScanClient; |
|
|
|
|
import com.logpm.warehouse.feign.IWarehouseUpdownStockUpAreaClient; |
|
|
|
|
import com.logpm.warehouse.feign.IWarehouseUpdownTypeClient; |
|
|
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
|
@ -261,6 +262,9 @@ public class DistributionSignforServiceImpl extends BaseServiceImpl<Distribution
|
|
|
|
|
@Autowired |
|
|
|
|
private IBasicdataDriverArteryClient basicdataDriverArteryClient; |
|
|
|
|
|
|
|
|
|
@Autowired |
|
|
|
|
private IWarehouseRetentionScanClient warehouseRetentionScanClient; |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public IPage<DistributionSignforVO> selectDistributionSignforPage(IPage<DistributionSignforVO> page, DistributionSignforVO distributionSignfor) { |
|
|
|
|
|
|
|
|
@ -8329,6 +8333,122 @@ public class DistributionSignforServiceImpl extends BaseServiceImpl<Distribution
|
|
|
|
|
return R.data(loadscanAbnormalVOS); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
@Transactional |
|
|
|
|
public R newLoadingAbnormalPackageListTurnDown(String ids) { |
|
|
|
|
//异常驳回进行异常信息的删除,对于装车记录的清理,对于已装车和签收的数量扣减
|
|
|
|
|
String method = "####################异常驳回loadingAbnormalPackageListTurnDown"; |
|
|
|
|
if (Func.isEmpty(ids)) { |
|
|
|
|
log.error(method + "ids参数缺失:{}", ids); |
|
|
|
|
return R.fail("参数缺失,请联系管理员"); |
|
|
|
|
} |
|
|
|
|
BasicdataWarehouseEntity myCurrentWarehouse = basicdataWarehouseClient.getMyCurrentWarehouse(); |
|
|
|
|
if (Func.isEmpty(myCurrentWarehouse)) { |
|
|
|
|
log.error(method + "未授权"); |
|
|
|
|
return R.fail(403,"未授权!!!"); |
|
|
|
|
} |
|
|
|
|
List<Long> list = Func.toLongList(ids); |
|
|
|
|
List<DistributionLoadscanAbnormalEntity> abnormalEntities = distributionLoadscanAbnormalService.listByIds(list); |
|
|
|
|
if (abnormalEntities.isEmpty()){ |
|
|
|
|
log.error(method + "查询异常列表数据错误,ids:{}", ids); |
|
|
|
|
return R.fail("查询异常列表数据错误,请联系管理员"); |
|
|
|
|
} |
|
|
|
|
boolean isLoadingFlag = abnormalEntities.stream().anyMatch(a -> Objects.isNull(a.getLoadingId())); |
|
|
|
|
if (isLoadingFlag) { |
|
|
|
|
//存在驳回但是未进行装车数据
|
|
|
|
|
String unLoadingPackageCode = abnormalEntities.stream().filter(a -> Objects.isNull(a.getLoadingId())).map(DistributionLoadscanAbnormalEntity::getPackageCode).collect(Collectors.joining(",")); |
|
|
|
|
|
|
|
|
|
log.error(method + "驳回出现,未进行装车的包件,unLoadingPackageCode:{}", unLoadingPackageCode); |
|
|
|
|
return R.fail(unLoadingPackageCode+"未进行装车"); |
|
|
|
|
} |
|
|
|
|
List<Long> packageIds = abnormalEntities.stream().map(DistributionLoadscanAbnormalEntity::getPackageId).collect(Collectors.toList()); |
|
|
|
|
List<Long> reservationId = abnormalEntities.stream().map(DistributionLoadscanAbnormalEntity::getReservationId).distinct().collect(Collectors.toList()); |
|
|
|
|
List<Long> deliveryId = abnormalEntities.stream().map(DistributionLoadscanAbnormalEntity::getDeliveryListId).distinct().collect(Collectors.toList()); |
|
|
|
|
if (reservationId.size() != 1) { |
|
|
|
|
log.error(method + "当前异常驳回存在多个客户信息,reservationId:{}", reservationId); |
|
|
|
|
return R.fail("查询包件装车信息错误"); |
|
|
|
|
} |
|
|
|
|
if (deliveryId.size() != 1) { |
|
|
|
|
log.error(method + "当前异常驳回存在多个配送信息,deliveryId:{}", deliveryId); |
|
|
|
|
return R.fail("查询包件装车信息错误"); |
|
|
|
|
} |
|
|
|
|
DistributionReservationEntity reservationEntity = distributionReservationService.getById(reservationId.get(0)); |
|
|
|
|
if (Objects.isNull(reservationEntity)){ |
|
|
|
|
log.error(method + "当前异常驳回查询预约计划错误,reservationId:{}", reservationId.get(0)); |
|
|
|
|
return R.fail("查询预约计划错误"); |
|
|
|
|
} |
|
|
|
|
DistributionDeliveryListEntity deliveryListEntity = distributionDeliveryListService.getById(deliveryId.get(0)); |
|
|
|
|
if (Objects.isNull(deliveryListEntity)){ |
|
|
|
|
log.error(method + "当前异常驳回查询配送计划错误,deliveryId:{}", deliveryId.get(0)); |
|
|
|
|
return R.fail("查询配送计划错误"); |
|
|
|
|
} |
|
|
|
|
List<DistributionLoadscanEntity> loadscanEntityList = distributionLoadscanService.list(Wrappers.<DistributionLoadscanEntity>query().lambda() |
|
|
|
|
.in(DistributionLoadscanEntity::getPackageId, packageIds) |
|
|
|
|
.ne(DistributionLoadscanEntity::getScanStatus, LoadingStatusConstant.quxiao.getValue()) |
|
|
|
|
); |
|
|
|
|
if (loadscanEntityList.isEmpty()) { |
|
|
|
|
log.error(method + "查询包件装车信息错误,packageIds:{}", packageIds); |
|
|
|
|
return R.fail("查询包件装车信息错误"); |
|
|
|
|
} |
|
|
|
|
//进行异常驳回
|
|
|
|
|
distributionLoadscanAbnormalService.update(Wrappers.<DistributionLoadscanAbnormalEntity>update().lambda() |
|
|
|
|
.in(DistributionLoadscanAbnormalEntity::getId,ids) |
|
|
|
|
.set(DistributionLoadscanAbnormalEntity::getAuditingStatus,LoadingAbnormalAuditingStatusConstant.yichang.getValue()) |
|
|
|
|
.set(DistributionLoadscanAbnormalEntity::getAuditingUser,AuthUtil.getNickName()) |
|
|
|
|
.set(DistributionLoadscanAbnormalEntity::getAuditingTime,new Date()) |
|
|
|
|
); |
|
|
|
|
List<WarehouseRetentionScanEntity> entityList = createdRetentionScanEntity(loadscanEntityList,myCurrentWarehouse,AuthUtil.getUser(),reservationEntity,deliveryListEntity); |
|
|
|
|
if (!entityList.isEmpty()){ |
|
|
|
|
//进行批量回库任务提交
|
|
|
|
|
warehouseRetentionScanClient.saveBatchRetentionScan(entityList); |
|
|
|
|
} |
|
|
|
|
return R.success("操作成功"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private List<WarehouseRetentionScanEntity> createdRetentionScanEntity(List<DistributionLoadscanEntity> loadscanEntityList, BasicdataWarehouseEntity myCurrentWarehouse, BladeUser user, DistributionReservationEntity reservationEntity, DistributionDeliveryListEntity deliveryListEntity) { |
|
|
|
|
List<WarehouseRetentionScanEntity> entityList = new ArrayList<>(); |
|
|
|
|
List<JSONObject> logList = new ArrayList<>(); |
|
|
|
|
for (DistributionLoadscanEntity distributionLoadscanEntity : loadscanEntityList) { |
|
|
|
|
//进行回库任务生成
|
|
|
|
|
WarehouseRetentionScanEntity warehouseRetentionScanEntity = new WarehouseRetentionScanEntity(); |
|
|
|
|
warehouseRetentionScanEntity.setWarehouseName(myCurrentWarehouse.getName()); |
|
|
|
|
warehouseRetentionScanEntity.setTaskCode(distributionReservationService.retentionMa()); |
|
|
|
|
warehouseRetentionScanEntity.setWarehouseId(myCurrentWarehouse.getId()); |
|
|
|
|
warehouseRetentionScanEntity.setLoadingId(myCurrentWarehouse.getId()); |
|
|
|
|
warehouseRetentionScanEntity.setDeliveryId(distributionLoadscanEntity.getDeliveryId()); |
|
|
|
|
warehouseRetentionScanEntity.setReservationId(distributionLoadscanEntity.getReservationId()); |
|
|
|
|
warehouseRetentionScanEntity.setConditions(1); |
|
|
|
|
warehouseRetentionScanEntity.setReservationCode(reservationEntity.getReservationCode()); |
|
|
|
|
warehouseRetentionScanEntity.setTrainNumber(deliveryListEntity.getTrainNumber()); |
|
|
|
|
|
|
|
|
|
//查询此包件
|
|
|
|
|
DistributionParcelListEntity parcelListEntity = distributionParcelListService.selectByOrderPackageCode(distributionLoadscanEntity.getOrderPackageCode(), myCurrentWarehouse.getId()); |
|
|
|
|
if (!Objects.isNull(parcelListEntity)){ |
|
|
|
|
//订单运单信息填充
|
|
|
|
|
warehouseRetentionScanEntity.setOrderCode(parcelListEntity.getOrderCode()); |
|
|
|
|
warehouseRetentionScanEntity.setWaybillNumber(parcelListEntity.getWaybillNumber()); |
|
|
|
|
warehouseRetentionScanEntity.setWaybillId(parcelListEntity.getWaybillId()); |
|
|
|
|
warehouseRetentionScanEntity.setOrderId(parcelListEntity.getStockArticleId()); |
|
|
|
|
warehouseRetentionScanEntity.setRetentionQuantity(parcelListEntity.getQuantity()); |
|
|
|
|
//记录当前包件生成待回库任务
|
|
|
|
|
String content = "包件在" + myCurrentWarehouse.getName() + "由" + user.getNickName() + "异常装车驳回生成待回库任务,配送车次号:" + deliveryListEntity.getTrainNumber() + "预约任务号:" + reservationEntity.getReservationCode(); |
|
|
|
|
JSONObject jsonObject = handleLogJSONObject(myCurrentWarehouse, user, distributionLoadscanEntity.getOrderPackageCode(), content, WorkNodeEnums.DISTRIBUTION_ABNORMAL_REJECT.getCode(), deliveryListEntity.getTrainNumber(), parcelListEntity.getWarehouseEntryTimeEnd()); |
|
|
|
|
logList.add(jsonObject); |
|
|
|
|
} |
|
|
|
|
warehouseRetentionScanEntity.setOrderPackageCode(distributionLoadscanEntity.getOrderPackageCode()); |
|
|
|
|
warehouseRetentionScanEntity.setOrderPackageId(distributionLoadscanEntity.getPackageId()); |
|
|
|
|
warehouseRetentionScanEntity.setVehicleNumber(distributionLoadscanEntity.getVehicleName()); |
|
|
|
|
warehouseRetentionScanEntity.setRetentionType(2); |
|
|
|
|
warehouseRetentionScanEntity.setDeliveryType(Integer.parseInt(deliveryListEntity.getType())); |
|
|
|
|
warehouseRetentionScanEntity.setConfirmStatus(false); |
|
|
|
|
entityList.add(warehouseRetentionScanEntity); |
|
|
|
|
} |
|
|
|
|
if (!logList.isEmpty()) { |
|
|
|
|
trunklinePackageTrackLogClient.addPackageTrackLog(logList); |
|
|
|
|
} |
|
|
|
|
return entityList; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 修改装车为签收数据 |
|
|
|
|
* @param loadscanEntity |
|
|
|
@ -8603,5 +8723,4 @@ public class DistributionSignforServiceImpl extends BaseServiceImpl<Distribution
|
|
|
|
|
return trunklinePackageTrackLog; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|