|
|
|
|
@ -1936,82 +1936,27 @@ public class BusinDataTaskServiceImpl extends ServiceImpl<BusinDataTaskMapper, B |
|
|
|
|
return Result.err().msg("移出货位有未完成的货位移动任务,不可重复移动"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
//出库检查是否是双深位,如果是,检查单深位是否有货
|
|
|
|
|
booleanResult = checkIsSleep(outBaseLocation); |
|
|
|
|
if (!Result.isOk(booleanResult)){ |
|
|
|
|
return booleanResult; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
//查询目标货位,并预占
|
|
|
|
|
Long inLocationId = bo.getInLocationId(); |
|
|
|
|
BaseLocation inBaseLocation = iBaseLocationService.getById(inLocationId); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (inBaseLocation == null) { |
|
|
|
|
return Result.err().msg("未获取到移入货位信息"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (!inBaseLocation.getLocationStatus().equals("0")) { |
|
|
|
|
return Result.err().msg("移入货位已被占用:" + inBaseLocation.getLocationCode()); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
//查询移入的货位是否有双深位,如果有则判断保险杠是否一样
|
|
|
|
|
BaseLocation locationDeep =null; |
|
|
|
|
String locationColumn = inBaseLocation.getLocationColumn(); |
|
|
|
|
String layer = inBaseLocation.getLayer(); |
|
|
|
|
String locationRow = inBaseLocation.getLocationRow(); |
|
|
|
|
String tunnel = inBaseLocation.getTunnel(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
booleanResult = checkIsSleep(inBaseLocation); |
|
|
|
|
//检查单深位时,双深位是否有货及品规是否一样
|
|
|
|
|
booleanResult = checkDoubleLocation(outBaseLocation, inBaseLocation); |
|
|
|
|
if (!Result.isOk(booleanResult)){ |
|
|
|
|
return booleanResult; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if ("2".equals(locationRow) && "3".equals(locationRow) && "14".equals(locationRow)){ |
|
|
|
|
//获取双深位的货位信息
|
|
|
|
|
if (locationRow.equals("2")){ |
|
|
|
|
locationRow="1"; |
|
|
|
|
}else if (locationRow.equals("3")){ |
|
|
|
|
locationRow="4"; |
|
|
|
|
}else if (locationRow.equals("14")){ |
|
|
|
|
locationRow="15"; |
|
|
|
|
} |
|
|
|
|
//双深位的库存
|
|
|
|
|
locationDeep = iBaseLocationService.queryBaseLocationByrcl(locationRow, locationColumn, layer, tunnel); |
|
|
|
|
if (locationDeep !=null){ Long locationDeepId = locationDeep.getId(); |
|
|
|
|
stockDetailQueryBo = new SysStockDetailQueryBo(); |
|
|
|
|
stockDetailQueryBo.setLocationId(locationDeepId); |
|
|
|
|
|
|
|
|
|
List<SysStockDetailVo> deepStockDetailVos = iSysStockDetailService.queryList(stockDetailQueryBo); |
|
|
|
|
|
|
|
|
|
/* if (deepStockDetailVos.size() ==1 && sysStockDetailVos.size()==0){ |
|
|
|
|
SysStockDetailVo deepStockDetailVo = deepStockDetailVos.get(0); |
|
|
|
|
SysStockDetailVo sysStockDetailVo = sysStockDetailVos.get(0); |
|
|
|
|
String deepGoodsNo = deepStockDetailVo.getGoodsNo(); |
|
|
|
|
String outGoodsNo = sysStockDetailVo.getGoodsNo(); |
|
|
|
|
if (deepGoodsNo !=null && outGoodsNo !=null){ |
|
|
|
|
if (deepGoodsNo!= sysStockDetailVo.getGoodsNo()){ |
|
|
|
|
return Result.err().msg("移入的货位双深位货物不同,不可移入"); |
|
|
|
|
} |
|
|
|
|
}else if (deepGoodsNo == null && outGoodsNo !=null){ |
|
|
|
|
return Result.err().msg("移入的货位双深位是空托,移入的是保险杠"); |
|
|
|
|
}else if (deepGoodsNo != null && outGoodsNo ==null){ |
|
|
|
|
return Result.err().msg("移入的货位双深位是保险杠,移入的是空托"); |
|
|
|
|
} |
|
|
|
|
}else { |
|
|
|
|
long count = deepStockDetailVos.stream().filter(val -> sysStockDetailVos.stream().anyMatch(instock -> Objects.equals(val.getGoodsNo(), instock.getGoodsNo()))).count(); |
|
|
|
|
if (count<1){ |
|
|
|
|
return Result.err().msg("移入的货位双深位货物不同,不可移入"); |
|
|
|
|
} |
|
|
|
|
}*/ |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
//获取出库堆垛机
|
|
|
|
|
BasePointDeviceQueryBo pointDeviceQueryBo = new BasePointDeviceQueryBo(); |
|
|
|
|
pointDeviceQueryBo.setDevType("1"); |
|
|
|
|
pointDeviceQueryBo.setTunnel(outBaseLocation.getTunnel()); |
|
|
|
|
BaseDevicePlcVo baseDevicePlcVo = baseLocationPlcMapper.selectBaseDevicePlc(pointDeviceQueryBo); |
|
|
|
|
Long stkPlcId = baseDevicePlcVo.getPlcId(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//记录货位调整前的货位状态
|
|
|
|
|
inBaseLocation.setExtend1(outBaseLocation.getLocationStatus()); |
|
|
|
|
inBaseLocation.setLocationStatus("4"); |
|
|
|
|
@ -2023,23 +1968,19 @@ public class BusinDataTaskServiceImpl extends ServiceImpl<BusinDataTaskMapper, B |
|
|
|
|
//生成移库出库任务
|
|
|
|
|
int index = 0; |
|
|
|
|
List<BusinDataTaskGoods> taskGoodsList = new ArrayList<>(); |
|
|
|
|
List<SysStockDetail> sysStockDetails = new ArrayList<>(); |
|
|
|
|
|
|
|
|
|
String inTunnel = inBaseLocation.getTunnel(); |
|
|
|
|
String locationColumn = inBaseLocation.getLocationColumn(); |
|
|
|
|
String layer = inBaseLocation.getLayer(); |
|
|
|
|
String locationRow = inBaseLocation.getLocationRow(); |
|
|
|
|
String tunnel = inBaseLocation.getTunnel(); |
|
|
|
|
|
|
|
|
|
String inTunnel = tunnel; |
|
|
|
|
String outTunnel = outBaseLocation.getTunnel(); |
|
|
|
|
BusinDataTask dataTaskAdd = new BusinDataTask(); |
|
|
|
|
BusinDataTask dataTaskOut = new BusinDataTask(); |
|
|
|
|
BusinDataTask dataTaskIn = new BusinDataTask(); |
|
|
|
|
|
|
|
|
|
if (!inTunnel.equals(outTunnel)) { |
|
|
|
|
|
|
|
|
|
//获取出库堆垛机
|
|
|
|
|
pointDeviceQueryBo = new BasePointDeviceQueryBo(); |
|
|
|
|
pointDeviceQueryBo.setDevType("1"); |
|
|
|
|
pointDeviceQueryBo.setTunnel(inBaseLocation.getTunnel()); |
|
|
|
|
baseDevicePlcVo = baseLocationPlcMapper.selectBaseDevicePlc(pointDeviceQueryBo); |
|
|
|
|
Long inStkPlcId = baseDevicePlcVo.getPlcId(); |
|
|
|
|
//移出任务
|
|
|
|
|
dataTaskOut.setTaskStatus("0"); |
|
|
|
|
dataTaskOut.setBatch(DateUtils.getDate()); |
|
|
|
|
@ -2051,7 +1992,6 @@ public class BusinDataTaskServiceImpl extends ServiceImpl<BusinDataTaskMapper, B |
|
|
|
|
dataTaskOut.setFromRow(outBaseLocation.getLocationRow()); |
|
|
|
|
dataTaskOut.setTaskType(TaskTypeEnum.relocation_out.getValue()); |
|
|
|
|
dataTaskOut.setTunnel(outBaseLocation.getTunnel()); |
|
|
|
|
dataTaskOut.setPlcId(stkPlcId); |
|
|
|
|
|
|
|
|
|
//移入任务
|
|
|
|
|
dataTaskIn.setTaskStatus(TaskStatusEnum.wait_callback.getValue()); |
|
|
|
|
@ -2064,9 +2004,17 @@ public class BusinDataTaskServiceImpl extends ServiceImpl<BusinDataTaskMapper, B |
|
|
|
|
dataTaskIn.setToColumn(locationColumn); |
|
|
|
|
dataTaskIn.setTaskType(TaskTypeEnum.relocation_in.getValue()); |
|
|
|
|
dataTaskIn.setTunnel(tunnel); |
|
|
|
|
dataTaskIn.setPlcId(inStkPlcId); |
|
|
|
|
|
|
|
|
|
} else { |
|
|
|
|
} |
|
|
|
|
else { |
|
|
|
|
|
|
|
|
|
//获取出库堆垛机
|
|
|
|
|
BasePointDeviceQueryBo pointDeviceQueryBo = new BasePointDeviceQueryBo(); |
|
|
|
|
pointDeviceQueryBo.setDevType("1"); |
|
|
|
|
pointDeviceQueryBo.setTunnel(outBaseLocation.getTunnel()); |
|
|
|
|
BaseDevicePlcVo baseDevicePlcVo = baseLocationPlcMapper.selectBaseDevicePlc(pointDeviceQueryBo); |
|
|
|
|
Long stkPlcId = baseDevicePlcVo.getPlcId(); |
|
|
|
|
|
|
|
|
|
dataTaskAdd.setTaskStatus("0"); |
|
|
|
|
dataTaskAdd.setBatch(DateUtils.getDate()); |
|
|
|
|
dataTaskAdd.setIsUrgent("0");//非紧急任务
|
|
|
|
|
@ -2080,8 +2028,8 @@ public class BusinDataTaskServiceImpl extends ServiceImpl<BusinDataTaskMapper, B |
|
|
|
|
dataTaskAdd.setFromLayer(outBaseLocation.getLayer()); |
|
|
|
|
dataTaskAdd.setFromColumn(outBaseLocation.getLocationColumn()); |
|
|
|
|
dataTaskAdd.setTunnel(outTunnel); |
|
|
|
|
dataTaskAdd.setPlcId(stkPlcId); |
|
|
|
|
dataTaskAdd.setFromSide(outBaseLocation.getLocationStatus()); |
|
|
|
|
dataTaskAdd.setPlcId(stkPlcId); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
for (SysStockDetailVo sysStockDetailVo : sysStockDetailVos) { |
|
|
|
|
@ -2100,7 +2048,6 @@ public class BusinDataTaskServiceImpl extends ServiceImpl<BusinDataTaskMapper, B |
|
|
|
|
dataTaskOut.setTaskPath(pointNo); |
|
|
|
|
dataTaskOut.setDpsNoOne(plcId); |
|
|
|
|
dataTaskOut.setLocationId(outLocationId); |
|
|
|
|
dataTaskOut.setPlcId(stkPlcId); |
|
|
|
|
|
|
|
|
|
//根据巷道获取目标货位的输送线的agv接驳点
|
|
|
|
|
pointQueryBo = new BasePointQueryBo(); |
|
|
|
|
@ -2108,7 +2055,6 @@ public class BusinDataTaskServiceImpl extends ServiceImpl<BusinDataTaskMapper, B |
|
|
|
|
pointQueryBo.setGroupNo("04"); |
|
|
|
|
basePointVo = iBasePointService.selectBasePointByQuery(pointQueryBo); |
|
|
|
|
pointNo = basePointVo.getPointNo(); |
|
|
|
|
plcId = basePointVo.getPlcId(); |
|
|
|
|
|
|
|
|
|
dataTaskIn.setIsDown(basePointVo.getIsDown()); |
|
|
|
|
dataTaskIn.setTaskPath(pointNo); |
|
|
|
|
@ -2149,16 +2095,8 @@ public class BusinDataTaskServiceImpl extends ServiceImpl<BusinDataTaskMapper, B |
|
|
|
|
taskGoodsAdd.setTaskCode(taskOutId); |
|
|
|
|
taskGoodsList.add(taskGoodsAdd); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// //出库预占
|
|
|
|
|
// sysStockDetailVo.setOutQty(sysStockDetailVo.getQty().intValue());
|
|
|
|
|
// SysStockDetail sysStockDetail = BeanUtil.toBean(sysStockDetailVo, SysStockDetail.class);
|
|
|
|
|
// sysStockDetail.setOutTime(DateUtils.getNowDate());
|
|
|
|
|
// sysStockDetails.add(sysStockDetail);
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// iSysStockDetailService.updateBatchById(sysStockDetails);
|
|
|
|
|
iBusinDataTaskGoodsService.saveBatch(taskGoodsList); |
|
|
|
|
return Result.ok().msg("移库任务成功"); |
|
|
|
|
}catch (Exception e){ |
|
|
|
|
@ -2189,10 +2127,54 @@ public class BusinDataTaskServiceImpl extends ServiceImpl<BusinDataTaskMapper, B |
|
|
|
|
List<SysStockDetailVo> sysStockDetailVoList = iSysStockDetailService.queryByLocation(one.getId()); |
|
|
|
|
|
|
|
|
|
if (sysStockDetailVoList != null && sysStockDetailVoList.size() != 0) { |
|
|
|
|
return Result.err().msg("出入库货位是双深位,单深位有货,不可出入库" + baseLocationVo.getLocationCode()); |
|
|
|
|
return Result.err().msg("出库货位是双深位,单深位有货,不可出库" + baseLocationVo.getLocationCode()); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
return Result.ok().msg("单深位"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public Result<Boolean> checkDoubleLocation(BaseLocation outLocation ,BaseLocation inLocation){ |
|
|
|
|
String tunnel = inLocation.getTunnel(); |
|
|
|
|
if ("01".equals(tunnel) || "06".equals(tunnel)) { |
|
|
|
|
//如果是单深位,验证下双深位的是否有库存,如果有在判断车型颜色是否一致
|
|
|
|
|
String locationRow = inLocation.getLocationRow(); |
|
|
|
|
if ("2".equals(locationRow) || "3".equals(locationRow) || "14".equals(locationRow)) { |
|
|
|
|
String locationColumn = inLocation.getLocationColumn(); |
|
|
|
|
String layer = inLocation.getLayer(); |
|
|
|
|
if (locationRow.equals("2")) { |
|
|
|
|
locationRow = "1"; |
|
|
|
|
} else if (locationRow.equals("3")) { |
|
|
|
|
locationRow = "4"; |
|
|
|
|
} else if (locationRow.equals("14")) { |
|
|
|
|
locationRow = "15"; |
|
|
|
|
} |
|
|
|
|
BaseLocation doubleLocation = iBaseLocationService.getOne(new LambdaQueryWrapper<BaseLocation>() |
|
|
|
|
.eq(BaseLocation::getLocationRow, locationRow) |
|
|
|
|
.eq(BaseLocation::getLocationColumn, locationColumn) |
|
|
|
|
.eq(BaseLocation::getLayer, layer)); |
|
|
|
|
//双深位库存
|
|
|
|
|
List<SysStockDetailVo> sysStockDetailVoList = iSysStockDetailService.queryByLocation(doubleLocation.getId()); |
|
|
|
|
|
|
|
|
|
//移入的库存
|
|
|
|
|
List<SysStockDetailVo> outSysStockDetailVoList = iSysStockDetailService.queryByLocation(outLocation.getId()); |
|
|
|
|
|
|
|
|
|
//双深位无库存
|
|
|
|
|
if (sysStockDetailVoList != null && sysStockDetailVoList.size() == 0) { |
|
|
|
|
//移入的货位双深位无库存,不可移入单深位
|
|
|
|
|
return Result.err().msg("移入的货位双深位无库存,不可移入单深位:"+ inLocation.getLocationCode()); |
|
|
|
|
} else { |
|
|
|
|
//判断移入的货位是单深位时,判断双深位的库存品规是否一样
|
|
|
|
|
if (outSysStockDetailVoList != null && outSysStockDetailVoList.size()>0) { |
|
|
|
|
long count = sysStockDetailVoList.stream().filter(val -> outSysStockDetailVoList.stream().anyMatch(o -> Objects.equals(val.getGoodsNo(), o.getGoodsNo()))).count(); |
|
|
|
|
if (count == 0) { |
|
|
|
|
//品规不一样,不允许移入
|
|
|
|
|
return Result.err().msg("移入的货位双深位有库存,品规不一样:"+ inLocation.getLocationCode()); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
return Result.ok(); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|