|
|
|
@ -33,10 +33,7 @@ import com.logpm.distribution.vo.DistributionDeliveryListVO;
|
|
|
|
|
import com.logpm.distribution.vo.DistributionDeliverySelfVO; |
|
|
|
|
import com.logpm.oldproject.feign.IWarehouseClient; |
|
|
|
|
import com.logpm.warehouse.bean.Resp; |
|
|
|
|
import com.logpm.warehouse.dto.RetentionDTO; |
|
|
|
|
import com.logpm.warehouse.dto.RetentionDistributionListDetailDTO; |
|
|
|
|
import com.logpm.warehouse.dto.RetentionParcelListDTO; |
|
|
|
|
import com.logpm.warehouse.dto.RetentionZeroParcelDTO; |
|
|
|
|
import com.logpm.warehouse.dto.*; |
|
|
|
|
import com.logpm.warehouse.entity.WarehouseRetentionRecordEntity; |
|
|
|
|
import com.logpm.warehouse.entity.WarehouseRetentionScanEntity; |
|
|
|
|
import com.logpm.warehouse.excel.WarehouseRetentionRecordExcel; |
|
|
|
@ -162,84 +159,4 @@ public class WarehouseRetentionRecordServiceImpl extends BaseServiceImpl<Warehou
|
|
|
|
|
return warehouseRetentionRecordVO; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public R saveRetentionList(RetentionDTO retentionDTO) { |
|
|
|
|
DistributionDeliveryListVO deliveryDriverInfo = deliveryListClient.getDeliveryDriverInfo(retentionDTO.getDeliveryId()); |
|
|
|
|
if (Func.isEmpty(deliveryDriverInfo)){ |
|
|
|
|
//查询配送任务
|
|
|
|
|
log.error("##############查询配送任务失败,deliveryId:{}",retentionDTO.getDeliveryId()); |
|
|
|
|
} |
|
|
|
|
BasicdataWarehouseEntity myCurrentWarehouse = warehouseClient.getMyCurrentWarehouse(); |
|
|
|
|
if (Objects.isNull(myCurrentWarehouse)) { |
|
|
|
|
throw new CustomerException(403, "仓库信息不能为空"); |
|
|
|
|
} |
|
|
|
|
if (Func.isEmpty(deliveryDriverInfo.getDeliverySelfVO())){ |
|
|
|
|
log.error("##############查询配送任务司机失败"); |
|
|
|
|
} |
|
|
|
|
List<DistributionDeliverySelfVO> deliverySelfVO = deliveryDriverInfo.getDeliverySelfVO(); |
|
|
|
|
DistributionDeliverySelfVO distributionDeliverySelfVO = null; |
|
|
|
|
if (deliveryDriverInfo.getKind().equals("1")){ |
|
|
|
|
distributionDeliverySelfVO = deliverySelfVO.stream().filter(d -> d.getIsMaster() == 2).collect(Collectors.toList()).get(0); |
|
|
|
|
}else if (deliveryDriverInfo.getKind().equals("2")){ |
|
|
|
|
distributionDeliverySelfVO = deliverySelfVO.get(0); |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
WarehouseRetentionRecordEntity warehouseRetentionRecordEntity = new WarehouseRetentionRecordEntity(); |
|
|
|
|
warehouseRetentionRecordEntity.setRetentionType(RetentionTypeConstant.peisongzhiliu.getValue()); |
|
|
|
|
warehouseRetentionRecordEntity.setRetentionWarehouseId(myCurrentWarehouse.getId()); |
|
|
|
|
warehouseRetentionRecordEntity.setRetentionWarehouseName(myCurrentWarehouse.getName()); |
|
|
|
|
warehouseRetentionRecordEntity.setRemark(retentionDTO.getRemarks()); |
|
|
|
|
warehouseRetentionRecordEntity.setTaskId(retentionDTO.getDeliveryId()); |
|
|
|
|
warehouseRetentionRecordEntity.setRetentionCarId(distributionDeliverySelfVO.getId()); |
|
|
|
|
warehouseRetentionRecordEntity.setRetentionCarNo(deliveryDriverInfo.getTrainNumber()); |
|
|
|
|
warehouseRetentionRecordEntity.setAssembleCarPersonId(distributionDeliverySelfVO.getDeliveryId()); |
|
|
|
|
warehouseRetentionRecordEntity.setAssembleCarPersonName(distributionDeliverySelfVO.getDriverName()); |
|
|
|
|
//统计数量
|
|
|
|
|
AtomicInteger retentionQuantity = new AtomicInteger(); |
|
|
|
|
List<RetentionParcelListDTO> parcelListEntityList = retentionDTO.getParcelListEntityList(); |
|
|
|
|
if (Func.isNotEmpty(parcelListEntityList)){ |
|
|
|
|
parcelListEntityList.forEach(p->{ |
|
|
|
|
WarehouseRetentionScanEntity warehouseRetentionScanEntity = new WarehouseRetentionScanEntity(); |
|
|
|
|
warehouseRetentionScanEntity.setConditions(1); |
|
|
|
|
warehouseRetentionScanEntity.setDeliveryId(deliveryDriverInfo.getId()); |
|
|
|
|
warehouseRetentionScanEntity.setOrderCode(p.getOrderCode()); |
|
|
|
|
warehouseRetentionScanEntity.setOrderPackageCode(p.getOrderPackageCode()); |
|
|
|
|
warehouseRetentionScanEntity.setOrderId(p.getStockArticleId()); |
|
|
|
|
warehouseRetentionScanEntity.setOrderPackageId(p.getId()); |
|
|
|
|
warehouseRetentionScanService.save(warehouseRetentionScanEntity); |
|
|
|
|
retentionQuantity.getAndAdd(p.getQuantity()); |
|
|
|
|
//缺少一个进行解绑的远程
|
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
List<RetentionZeroParcelDTO> parcelNumberEntityList = retentionDTO.getParcelNumberEntityList(); |
|
|
|
|
if (Func.isNotEmpty(parcelNumberEntityList)){ |
|
|
|
|
parcelNumberEntityList.forEach(pn->{ |
|
|
|
|
WarehouseRetentionScanEntity warehouseRetentionScanEntity = new WarehouseRetentionScanEntity(); |
|
|
|
|
warehouseRetentionScanEntity.setConditions(2); |
|
|
|
|
warehouseRetentionScanEntity.setDeliveryId(deliveryDriverInfo.getId()); |
|
|
|
|
warehouseRetentionScanEntity.setOrderId(pn.getStockArticleId()); |
|
|
|
|
warehouseRetentionScanEntity.setOrderPackageId(pn.getParcelListId()); |
|
|
|
|
warehouseRetentionScanService.save(warehouseRetentionScanEntity); |
|
|
|
|
retentionQuantity.getAndAdd(pn.getQuantity()); |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
List<RetentionDistributionListDetailDTO> detailEntityList = retentionDTO.getDetailEntityList(); |
|
|
|
|
if (Func.isNotEmpty(detailEntityList)){ |
|
|
|
|
detailEntityList.forEach(d->{ |
|
|
|
|
WarehouseRetentionScanEntity warehouseRetentionScanEntity = new WarehouseRetentionScanEntity(); |
|
|
|
|
warehouseRetentionScanEntity.setConditions(3); |
|
|
|
|
warehouseRetentionScanEntity.setDeliveryId(deliveryDriverInfo.getId()); |
|
|
|
|
warehouseRetentionScanEntity.setInventoryId(d.getStockListId()); |
|
|
|
|
warehouseRetentionScanEntity.setMaterialName(d.getMaterialName()); |
|
|
|
|
warehouseRetentionScanEntity.setMaterialNumber(d.getMaterialNumber()); |
|
|
|
|
warehouseRetentionScanEntity.setOrderPackageCode(d.getStockPackageCode()); |
|
|
|
|
warehouseRetentionScanEntity.setOrderPackageId(d.getId()); |
|
|
|
|
warehouseRetentionScanService.save(warehouseRetentionScanEntity); |
|
|
|
|
retentionQuantity.getAndAdd(d.getNum()); |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
this.save(warehouseRetentionRecordEntity); |
|
|
|
|
return Resp.scanSuccess("操作成功","操作成功"); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|