|
|
|
@ -514,91 +514,103 @@ public class BusinDataTaskServiceImpl extends ServiceImpl<BusinDataTaskMapper, B |
|
|
|
* 4. |
|
|
|
* 4. |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
|
|
|
|
|
|
|
|
BaseLocationVo baseLocationVo = iBaseLocationService.queryLocationByCode(locationCode); |
|
|
|
try { |
|
|
|
if (baseLocationVo == null){ |
|
|
|
BaseLocationVo baseLocationVo = iBaseLocationService.queryLocationByCode(locationCode); |
|
|
|
return Result.err().msg("未查询到货位信息,请确认!"+locationCode); |
|
|
|
if (baseLocationVo == null){ |
|
|
|
} |
|
|
|
return Result.err().msg("未查询到货位信息,请确认!"+locationCode); |
|
|
|
if (baseLocationVo.getLocationStatus().equals("4") || baseLocationVo.getLocationStatus().equals("0")){ |
|
|
|
} |
|
|
|
return Result.err().msg("此货位出库中或已出库,请确认!"+locationCode+" 库位状态:"+baseLocationVo.getLocationStatus()); |
|
|
|
if (baseLocationVo.getLocationStatus().equals("4") || baseLocationVo.getLocationStatus().equals("0")){ |
|
|
|
} |
|
|
|
return Result.err().msg("此货位出库中或已出库,请确认!"+locationCode+" 库位状态:"+baseLocationVo.getLocationStatus()); |
|
|
|
List<SysStockDetailVo> sysStockDetailVoList =null; |
|
|
|
} |
|
|
|
//检查货位是否是双深位
|
|
|
|
List<SysStockDetailVo> sysStockDetailVoList =null; |
|
|
|
Result<Boolean> booleanResult = checkIsSleep(baseLocationVo); |
|
|
|
//检查货位是否是双深位
|
|
|
|
if (!Result.isOk(booleanResult)){ |
|
|
|
Result<Boolean> booleanResult = checkIsSleep(baseLocationVo); |
|
|
|
return booleanResult; |
|
|
|
if (!Result.isOk(booleanResult)){ |
|
|
|
} |
|
|
|
return booleanResult; |
|
|
|
//确认出库的货位是否有库存信息
|
|
|
|
} |
|
|
|
Result<List<SysStockDetailVo>> stockListResult = iSysStockDetailService.queryByLocation(baseLocationVo.getId()); |
|
|
|
//确认出库的货位是否有库存信息
|
|
|
|
if (Result.isOk(stockListResult)){ |
|
|
|
Result<List<SysStockDetailVo>> stockListResult = iSysStockDetailService.queryByLocation(baseLocationVo.getId()); |
|
|
|
sysStockDetailVoList = stockListResult.getData(); |
|
|
|
if (Result.isOk(stockListResult)){ |
|
|
|
if (sysStockDetailVoList == null && sysStockDetailVoList.size() ==0 ){ |
|
|
|
sysStockDetailVoList = stockListResult.getData(); |
|
|
|
return Result.err().msg("此货位未查询到保险杠信息,请确认!"+locationCode); |
|
|
|
if (sysStockDetailVoList == null && sysStockDetailVoList.size() ==0 ){ |
|
|
|
|
|
|
|
return Result.err().msg("此货位未查询到保险杠信息,请确认!"+locationCode); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
//预占库存
|
|
|
|
|
|
|
|
baseLocationVo.setLocationStatus("4"); |
|
|
|
|
|
|
|
BaseLocation baseLocation = BeanUtil.toBean(baseLocationVo, BaseLocation.class); |
|
|
|
|
|
|
|
iBaseLocationService.updateById(baseLocation); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//需要搬运到的码头信息
|
|
|
|
|
|
|
|
String toPoint = sysParameterService.selectConfigByKey(ParameterConstants.ParameterSystem.abnormal_out_point); |
|
|
|
|
|
|
|
String[] toPoints = toPoint.split("、"); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
List<BasePoint> pointList = iBasePointService.list(new LambdaQueryWrapper<BasePoint>() |
|
|
|
|
|
|
|
.in(BasePoint::getPointNo, toPoints) |
|
|
|
|
|
|
|
.eq(BasePoint::getIsOccupy,"0") |
|
|
|
|
|
|
|
); |
|
|
|
|
|
|
|
String taskPath=""; |
|
|
|
|
|
|
|
if (pointList !=null && pointList.size()>0){ |
|
|
|
|
|
|
|
taskPath=pointList.get(0).getPointNo(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if (StringUtils.isEmpty(taskPath)){ |
|
|
|
|
|
|
|
return Result.err().msg("搬运码头无空闲,不可出库"); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//生成作业任务
|
|
|
|
|
|
|
|
int index=0; |
|
|
|
//需要搬运到的码头信息
|
|
|
|
List<BusinDataTaskGoods> taskGoodsList = new ArrayList<>(); |
|
|
|
String toPoint = sysParameterService.selectConfigByKey(ParameterConstants.ParameterSystem.abnormal_out_point); |
|
|
|
List<SysStockDetail> sysStockDetails = new ArrayList<>(); |
|
|
|
String[] toPoints = toPoint.split("、"); |
|
|
|
for (SysStockDetailVo sysStockDetailVo : sysStockDetailVoList) { |
|
|
|
|
|
|
|
Long taskId=0L; |
|
|
|
List<BasePoint> pointList = iBasePointService.list(new LambdaQueryWrapper<BasePoint>() |
|
|
|
if(index ==0) { |
|
|
|
.in(BasePoint::getPointNo, toPoints) |
|
|
|
BusinDataTask task = new BusinDataTask(); |
|
|
|
.eq(BasePoint::getIsOccupy,"0") |
|
|
|
task.setTaskType(TaskTypeEnum.named_loc.getValue()); |
|
|
|
.eq(BasePoint::getIsActive,"1") |
|
|
|
task.setPriority("2"); |
|
|
|
); |
|
|
|
task.setIsTop("0"); |
|
|
|
String taskPath=""; |
|
|
|
task.setBatch(sysStockDetailVo.getBatch()); |
|
|
|
if (pointList !=null && pointList.size()==0){ |
|
|
|
task.setTaskStatus(TaskStatusEnum.wait_put.getValue()); |
|
|
|
return Result.err().msg("搬运码头无空闲,不可出库"); |
|
|
|
task.setIsUrgent("0"); |
|
|
|
|
|
|
|
task.setCreateTime(DateUtils.getNowDate()); |
|
|
|
|
|
|
|
task.setTaskPath(taskPath); |
|
|
|
|
|
|
|
task.setDistinction("1"); |
|
|
|
|
|
|
|
task.setContainerId(sysStockDetailVo.getContainerCode()); |
|
|
|
|
|
|
|
task.setFromRow(baseLocationVo.getLocationRow()); |
|
|
|
|
|
|
|
task.setFromLayer(baseLocationVo.getLayer()); |
|
|
|
|
|
|
|
task.setFromColumn(baseLocationVo.getLocationColumn()); |
|
|
|
|
|
|
|
task.setTunnel(baseLocationVo.getTunnel()); |
|
|
|
|
|
|
|
businDataTaskMapper.insertBusinDataTask(task); |
|
|
|
|
|
|
|
taskId = task.getId(); |
|
|
|
|
|
|
|
index++; |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
//保险杠信息
|
|
|
|
BasePoint basePoint = pointList.get(0); |
|
|
|
BusinDataTaskGoods taskGoods = new BusinDataTaskGoods(); |
|
|
|
taskPath= basePoint.getPointNo(); |
|
|
|
taskGoods.setGoodsNo(sysStockDetailVo.getGoodsNo()); |
|
|
|
//预占码头信息
|
|
|
|
taskGoods.setTaskCode(taskId); |
|
|
|
basePoint.setIsOccupy("1"); |
|
|
|
taskGoods.setIsPunching(sysStockDetailVo.getIsPuch()); |
|
|
|
iBasePointService.updateBasePoint(basePoint); |
|
|
|
taskGoods.setBranchId(SecurityUtils.getCurrentBranchId()); |
|
|
|
//预占库存
|
|
|
|
taskGoodsList.add(taskGoods); |
|
|
|
baseLocationVo.setLocationStatus("4"); |
|
|
|
|
|
|
|
BaseLocation baseLocation = BeanUtil.toBean(baseLocationVo, BaseLocation.class); |
|
|
|
|
|
|
|
iBaseLocationService.updateById(baseLocation); |
|
|
|
|
|
|
|
//生成作业任务
|
|
|
|
|
|
|
|
int index=0; |
|
|
|
|
|
|
|
List<BusinDataTaskGoods> taskGoodsList = new ArrayList<>(); |
|
|
|
|
|
|
|
List<SysStockDetail> sysStockDetails = new ArrayList<>(); |
|
|
|
|
|
|
|
Long taskId=0L; |
|
|
|
|
|
|
|
for (SysStockDetailVo sysStockDetailVo : sysStockDetailVoList) { |
|
|
|
|
|
|
|
if(index ==0) { |
|
|
|
|
|
|
|
BusinDataTask task = new BusinDataTask(); |
|
|
|
|
|
|
|
task.setTaskType(TaskTypeEnum.named_loc.getValue()); |
|
|
|
|
|
|
|
task.setPriority("2"); |
|
|
|
|
|
|
|
task.setIsTop("0"); |
|
|
|
|
|
|
|
task.setBatch(sysStockDetailVo.getBatch()); |
|
|
|
|
|
|
|
task.setTaskStatus(TaskStatusEnum.wait_put.getValue()); |
|
|
|
|
|
|
|
task.setIsUrgent("0"); |
|
|
|
|
|
|
|
task.setCreateTime(DateUtils.getNowDate()); |
|
|
|
|
|
|
|
task.setTaskPath(taskPath); |
|
|
|
|
|
|
|
task.setDistinction("1"); |
|
|
|
|
|
|
|
task.setContainerId(sysStockDetailVo.getContainerCode()); |
|
|
|
|
|
|
|
task.setFromRow(baseLocationVo.getLocationRow()); |
|
|
|
|
|
|
|
task.setFromLayer(baseLocationVo.getLayer()); |
|
|
|
|
|
|
|
task.setFromColumn(baseLocationVo.getLocationColumn()); |
|
|
|
|
|
|
|
task.setTunnel(baseLocationVo.getTunnel()); |
|
|
|
|
|
|
|
task.setLocationId(baseLocationVo.getId()); |
|
|
|
|
|
|
|
this.save(task); |
|
|
|
|
|
|
|
taskId = task.getId(); |
|
|
|
|
|
|
|
index++; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
//出库预占
|
|
|
|
//保险杠信息
|
|
|
|
sysStockDetailVo.setOutQty(sysStockDetailVo.getQty().intValue()); |
|
|
|
BusinDataTaskGoods taskGoods = new BusinDataTaskGoods(); |
|
|
|
SysStockDetail sysStockDetail = BeanUtil.toBean(sysStockDetailVo, SysStockDetail.class); |
|
|
|
taskGoods.setGoodsNo(sysStockDetailVo.getGoodsNo()); |
|
|
|
sysStockDetail.setOutTime(DateUtils.getNowDate()); |
|
|
|
taskGoods.setQrCode(sysStockDetailVo.getQrCode()); |
|
|
|
sysStockDetails.add(sysStockDetail); |
|
|
|
taskGoods.setTaskCode(taskId); |
|
|
|
|
|
|
|
taskGoods.setIsPunching(sysStockDetailVo.getIsPuch()); |
|
|
|
|
|
|
|
taskGoods.setBranchId(SecurityUtils.getCurrentBranchId()); |
|
|
|
|
|
|
|
taskGoods.setCreateBy(SecurityUtils.getUsername()); |
|
|
|
|
|
|
|
taskGoodsList.add(taskGoods); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//出库预占
|
|
|
|
|
|
|
|
sysStockDetailVo.setOutQty(sysStockDetailVo.getQty().intValue()); |
|
|
|
|
|
|
|
SysStockDetail sysStockDetail = BeanUtil.toBean(sysStockDetailVo, SysStockDetail.class); |
|
|
|
|
|
|
|
sysStockDetail.setOutTime(DateUtils.getNowDate()); |
|
|
|
|
|
|
|
sysStockDetails.add(sysStockDetail); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
iSysStockDetailService.updateBatchById(sysStockDetails); |
|
|
|
|
|
|
|
return iBusinDataTaskGoodsService.saveBatch(taskGoodsList)?Result.ok():Result.err().msg("指定货位出库失败"); |
|
|
|
|
|
|
|
}catch (Exception e){ |
|
|
|
|
|
|
|
log.error("指定货位出库失败:"+e.getMessage()); |
|
|
|
|
|
|
|
return Result.err().msg("指定货位出库失败"); |
|
|
|
} |
|
|
|
} |
|
|
|
iSysStockDetailService.updateBatchById(sysStockDetails); |
|
|
|
|
|
|
|
return iBusinDataTaskGoodsService.saveBatch(taskGoodsList)?Result.ok():Result.err().msg("指定货位出库失败"); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
|
|