异常杠到异常区域

main
judy 1 year ago
parent ca9daddd7f
commit 71b3878aab
  1. 2
      shkj-wms/src/main/java/com/shkj/wms/bo/AssingEmptyLocBo.java
  2. 337
      shkj-wms/src/main/java/com/shkj/wms/scheduled/ScheduledTasks.java
  3. 8
      shkj-wms/src/main/java/com/shkj/wms/service/IBaseLocationService.java
  4. 140
      shkj-wms/src/main/java/com/shkj/wms/service/impl/BaseLocationServiceImpl.java
  5. 5
      shkj-wms/src/main/java/com/shkj/wms/service/impl/BusinDataTaskServiceImpl.java
  6. 13
      shkj-wms/src/main/java/com/shkj/wms/service/impl/IBusinEnptyContainerServiceImpl.java
  7. 4
      shkj-wms/src/main/java/com/shkj/wms/service/impl/PutInOutStorageServiceImpl.java
  8. 6
      shkj-wms/src/main/resources/mapper/wms/BaseLocationMapper.xml

@ -27,5 +27,7 @@ public class AssingEmptyLocBo implements Serializable {
private String taskId;
private List<BusinDataTaskGoodsVo> businDataTaskGoodsVos;
private Long areaId;
}

@ -199,9 +199,7 @@ public class ScheduledTasks {
taskQueryBo.setTaskType("1");
List<BusinDataTaskVo> businDataTaskVo1 = iBusinDataTaskService.selectBusinDataTask1(taskQueryBo);
businDataTaskVos.addAll(businDataTaskVo1);
taskQueryBo.setTaskType("2");
List<BusinDataTaskVo> businDataTaskVo2 = iBusinDataTaskService.selectBusinDataTask1(taskQueryBo);
businDataTaskVos.addAll(businDataTaskVo2);
//越库模式下或暂停出库,需要设置暂停出库
String startStopOutbound= StartStopOutboundEnum.STOP.getValue();
@ -270,7 +268,7 @@ public class ScheduledTasks {
//查询下挂任务目前的车型:入库:3LN(20秒) 出库:3UG(40秒) 空托和保险杠交替进行 4和15
//从redis中写入
if (inVehicheModel.equals("3LN") || inVehicheModel.equals("3UE")) {//下车型为3LN的时候,根据出库任务数量执行空托任务
if (inVehicheModel.equals("3LN") || inVehicheModel.equals("3UE")) {//下车型为3LN的时候,根据出库任务数量执行空托任务
//获取出库任务下发成功数
if (redisTemplate.hasKey(RedisConstant.redisSurplusWaitIssueEmpFixTaskNum)) {
Integer lastSurpTaskNum = (Integer) redisTemplate.opsForValue().get(RedisConstant.redisSurplusWaitIssueEmpFixTaskNum);
@ -520,163 +518,7 @@ public class ScheduledTasks {
}
else if (taskType.equals("2")) {
Long plcId = 0L;
Long stkPlcId = 0L;
Boolean NUMBER = true;
//维修异常 呼叫AGV
//获取起始点位
String startPoint = businDataTaskVo.getTaskPath();
//查询维修地点是否有空闲
String tepairGroup = sysParameterService.selectConfigByKey(ParameterConstants.ParameterSystem.scanexc_group);
// String tmpPoint = sysParameterService.selectConfigByKey(ParameterConstants.ParameterSystem.putout_point_tmp);
pointQueryBo.setGroupNo(tepairGroup);
BasePointDeviceVo basePointDeviceVo = null;
List<BasePointDeviceVo> basePointDeviceVos = baseLocationPlcMapper.selectBasePointByGroupno(pointQueryBo);
List<String> points = new ArrayList<>();
points.add(startPoint);
Map<String, String> snPointMap = new HashMap<>(3);
snPointMap.put("1", startPoint);
//获取机械手上报点
String tepairGroupin = sysParameterService.selectConfigByKey(ParameterConstants.ParameterSystem.putout_point);
BasePointDeviceQueryBo pointQueryBoup = new BasePointDeviceQueryBo();
pointQueryBoup.setGroupNo(tepairGroupin);
BasePointDeviceVo pointDevice = new BasePointDeviceVo();
pointDevice = basePointDeviceMapper.selectBasePointByGroupno(pointQueryBoup);
points.add(pointDevice.getHandshakePoint());
snPointMap.put("2", pointDevice.getHandshakePoint());
BaseLocationVo locationVo = null;
BusinTaskExeBo exeBo = new BusinTaskExeBo();
//无空闲区 分配异常区库位
// if (basePointDeviceVos.size() ==0) {
// NUMBER=false;
//
// if (businDataTaskVo.getWarehouseType().equals("2")) {
// String tepairGroup1 = sysParameterService.selectConfigByKey(ParameterConstants.ParameterSystem.P_in01);
// pointQueryBo.setGroupNo(tepairGroup1);
// BasePointDeviceVo pointDeviceout = basePointDeviceMapper.selectBasePointByGroupno(pointQueryBo);
// basePointDeviceVo = pointDeviceout;
// } else {
// //异常区ID
// Long abnormalArea =Long.valueOf(sysParameterService.selectConfigByKey(ParameterConstants.ParameterSystem.abnormal_area));
// List<BaseLocationVo> baseLocationVos = baseLocationMapper.getLocationByAreaId(abnormalArea);
// if (baseLocationVos.size() > 0) {
// locationVo = baseLocationVos.get(0);
// }
// businDataTaskVo.setToColumn(locationVo.getLocationColumn());
// businDataTaskVo.setToLayer(locationVo.getLayer());
// businDataTaskVo.setToRow(locationVo.getLocationRow());
// //获取货位及巷道;
// String tunnel = locationVo.getTunnel();
// businDataTaskVo.setTunnel(tunnel);
// pointQueryBo=new BasePointDeviceQueryBo();
// pointQueryBo.setTunnel(tunnel);
// pointQueryBo.setDirection("0");
// basePointDeviceVos = baseLocationPlcMapper.selectBasePointByGroupno(pointQueryBo);
// if (basePointDeviceVos.size() > 0) {
// basePointDeviceVo = basePointDeviceVos.get(0);
// basePointDeviceVo.setPlcId(Long.valueOf(isysParameterService.selectConfigByKey(ParameterConstants.ParameterSystem.LK_plc_id)));
//
// }
// //获取巷道对应的堆垛机信息
// pointQueryBo.setDevType("1");
// BaseDevicePlcVo baseDevicePlcVo = baseLocationPlcMapper.selectBaseDevicePlc(pointQueryBo);
// stkPlcId = baseDevicePlcVo.getPlcId();
// List<BusinDataTaskGoodsVo> businDataTaskGoodsVos = iBusinDataTaskGoodsService.selectBusinTaskGoodsByTaskCode(businDataTaskVo.getId());
//// exeBo.setTaskCode(taskId);
//// exeBo.setBusinDataTaskGoodsVo(businDataTaskGoodsVos);
//// exeBo.setContainerId(containerId);
//// exeBo.setBaseLocationVo(locationVo);
//// exeBo.setTransNo("1");
//// exeBo.setTransQual("1");
// }
// }else {
basePointDeviceVo = basePointDeviceVos.get(0);
// }
//plcId =basePointDeviceVo.getPlcId();
// String toPointNo = basePointDeviceVo.getPointNo();
// snPointMap.put("3",toPointNo);
// points.add(toPointNo);
// int agvTaskType = Integer.valueOf(basePointDeviceVo.getIsDown());
String toPointNo = basePointDeviceVo.getPointNo();
;
int agvTaskType = 33;
snPointMap.put("3", "XX");
points.add("XX");
snPointMap.put("4", "XX");
points.add("XX");
snPointMap.put("5", toPointNo);
points.add(toPointNo);
// TODO 中科 测试 需要删除
businDataTaskVo.setPoints(JsonUtil.toJSONString(snPointMap));
businDataTaskVo.setIsDown(String.valueOf(agvTaskType));
Result<Boolean> booleanResult = new Result<>();
//呼叫AGV
if (StringUtils.isNotEmpty(businDataTaskVo.getAgvNo())) {
booleanResult = callAGV(taskId, agvTaskType, points, businDataTaskVo.getAgvNo());
} else {
booleanResult = callAGV(taskId, agvTaskType, points);
}
if (booleanResult.getCode() == HttpStatus.ERROR.getCode()) {
BusinDataTask businDataTask = new BusinDataTask();
businDataTask.setId(businDataTaskVo.getId());
businDataTask.setTaskStatus(TaskStatusEnum.wait_callback.getValue());
businDataTask.setTaskPath(toPointNo);
iBusinDataTaskService.updateById(businDataTask);
return;
}
//呼叫AGV成功
if (booleanResult.getCode() == HttpStatus.SUCCESS.getCode()) {
businDataTaskVo.setTaskStatus(TaskStatusEnum.wait_callback.getValue());
businDataTaskVo.setTaskPath(toPointNo);
// TODO 中科 测试 需要还原
// //把占用的点位改为已占用
if (NUMBER) {
BasePoint basePoint = iBasePointService.getById(basePointDeviceVo.getPointId());
basePoint.setIsOccupy("1");
iBasePointService.updateById(basePoint);
}
// //更改货位状态为4已分配
// if (ObjectUtils.isNotEmpty(locationVo)){
// BaseLocation baseLocation = iBaseLocationService.getById(locationVo.getId());
// baseLocation.setLocationStatus("4");
// iBaseLocationService.updateById(baseLocation);
// }
// TODO 中科 测试 需要还原
// TODO 中科 测试 需要还原
}
// else{
// if (redisTemplate.opsForValue().get(RedisConstant.redisAgvTaskerror+taskId)==null){
// redisTemplate.opsForValue().set(RedisConstant.redisAgvTaskerror+taskId,0);
// }
// Long a=Long.valueOf(String.valueOf(redisTemplate.opsForValue().get(RedisConstant.redisAgvTaskerror+taskId)));
// businDataTaskVo.setTaskStatus(TaskStatusEnum.err.getValue());
// businDataTaskVo.setExceptionMsg(booleanResult.getMsg());
// if (a<3L){
// long l = a + 1;
// redisTemplate.opsForValue().set(RedisConstant.redisAgvTaskerror+taskId,l);
// }else {
// businDataTaskVo.setTaskStatus("-2");
// }
// }
// TODO 测试注释 要打开
// //更新入库条码表状态为异常
List<BaseBarcodesIn> barcodesIns = new ArrayList<>();
List<BusinDataTaskGoodsVo> goodsVos = iBusinDataTaskGoodsService.selectBusinTaskGoodsByTaskCode(taskId);
for (BusinDataTaskGoodsVo goodsVo : goodsVos) {
BaseBarcodesIn baseBarcodesIn = iBaseBarcodesInService.getOne(new LambdaQueryWrapper<BaseBarcodesIn>()
.eq(BaseBarcodesIn::getQrCode, goodsVo.getQrCode())
);
baseBarcodesIn.setInStatus("4");
baseBarcodesIn.setInDate(DateUtils.getDate());
barcodesIns.add(baseBarcodesIn);
}
iBaseBarcodesInService.saveOrUpdateBatch(barcodesIns);
businDataTaskVo.setDpsNoOne(plcId);
businDataTaskVo.setDpsNoTwo(stkPlcId);
//异常杠下挂区域直接调度
}
else if (taskType.equals("1")) {
Long plcId = 0L;
@ -1336,13 +1178,6 @@ public class ScheduledTasks {
Result<Boolean> taskResult1 = outTask(businDataTaskVo);
if (taskResult1.getCode() == HttpStatus.SUCCESS.getCode()) {
businDataTaskVo.setTaskStatus(TaskStatusEnum.wait_callback.getValue());
//生成出库单
BusinTaskExeBo exeBo = new BusinTaskExeBo();
exeBo.setTaskCode(taskId);
exeBo.setBusinDataTaskGoodsVo(goodsVo);
exeBo.setBaseLocationVo(baseLocationVo);
exeBo.setTransNo("2");
exeBo.setTransQual("2");
// Result<String> billResult = iPutInOutStorageService.exeTaskPutinStorage(exeBo);
// businDataTaskVo.setTransId(billResult.getData());
@ -1407,14 +1242,6 @@ public class ScheduledTasks {
}
BaseLocation baseLocationVo = baseLocationService.getOne(new LambdaQueryWrapper<BaseLocation>()
.eq(BaseLocation::getId, businDataTaskVo.getLocationId()));
//生成出库单
BusinTaskExeBo exeBo = new BusinTaskExeBo();
exeBo.setTaskCode(taskId);
exeBo.setBusinDataTaskGoodsVo(goodsVo);
exeBo.setBaseLocationVo(BeanUtil.toBean(baseLocationVo,BaseLocationVo.class));
exeBo.setTransNo("2");
exeBo.setTransQual("2");
// Result<String> billResult = iPutInOutStorageService.exeTaskPutinStorage(exeBo);
// businDataTaskVo.setTransId(billResult.getData());
//添加货位预占和库存预占
@ -1441,8 +1268,6 @@ public class ScheduledTasks {
businDataTaskVo.setTaskStatus(TaskStatusEnum.err.getValue());
}
}
}
else if (taskType.equals("22")) {
BusinDataTask businDataTask = iBusinDataTaskService.getById(businDataTaskVo.getId());
@ -1851,9 +1676,6 @@ public class ScheduledTasks {
//生成异常出库任务
BusinDataTask task = new BusinDataTask();
int randomoperands = (int) Math.round(Math.random() * 1000);
String taskCode = "T_" + DateUtils.dateTimeNow() + randomoperands;
task.setTaskCode(taskCode);
task.setTaskType(TaskTypeEnum.abnormal_delivery.getValue());
task.setBatch(DateUtils.getDate());
task.setPriority("2");
@ -1903,9 +1725,6 @@ public class ScheduledTasks {
//生成冲孔出库任务
BusinDataTask task = new BusinDataTask();
int randomoperands = (int) Math.round(Math.random() * 1000);
String taskCode = "T_" + DateUtils.dateTimeNow() + randomoperands;
task.setTaskCode(taskCode);
task.setTaskType("21");
task.setBatch(DateUtils.getDate());
task.setPriority("2");
@ -1914,10 +1733,7 @@ public class ScheduledTasks {
task.setCreateTime(DateUtils.getNowDate());
task.setTaskPath(toPointNo);
task.setTaskStatus("0");
iBusinDataTaskService.insertBusinDataTask(task);
}
}
@ -1951,9 +1767,9 @@ public class ScheduledTasks {
//获取要出入库的条码信息
List<BusinDataTaskGoodsVo> businDataTaskGoodsVos = iBusinDataTaskGoodsService.selectBusinTaskGoodsByTaskCode(businDataTaskVo.getId());
String taskType = businDataTaskVo.getTaskType();
if (ObjectUtils.isEmpty(businDataTaskGoodsVos) || (!taskType.equals("0") && !taskType.equals("3")) ) {
return;
}
if (!taskType.equals("0") && !taskType.equals("3") && !taskType.equals("2"))
{ return;}
if ("3".equals(taskType)){
Long plcId = 0L;
@ -2007,6 +1823,7 @@ public class ScheduledTasks {
List<BusinDataTaskGoodsVo> businDataTaskGoodsVoList = iBusinDataTaskGoodsService.selectBusinTaskGoodsByTaskCode(businDataTaskVo.getId());
AssingEmptyLocBo assingEmptyLocBo = new AssingEmptyLocBo();
assingEmptyLocBo.setBusinDataTaskGoodsVos(businDataTaskGoodsVoList);
assingEmptyLocBo.setAreaId(punchingArea);
//冲孔杠分配货位
Result<BaseLocationVo> locationVoResult = iBaseLocationService.assignEmptyLocatioPunching(assingEmptyLocBo);
@ -2084,7 +1901,8 @@ public class ScheduledTasks {
businDataTaskVo.setDpsNoOne(plcId);
businDataTaskVo.setDpsNoTwo(stkPlcId);
iBusinDataTaskService.updateById(BeanUtil.toBean(businDataTaskVo, BusinDataTask.class));
}else {
}
else if ("0".equals(taskType)){
BasePointDeviceQueryBo pointQueryBo = new BasePointDeviceQueryBo();
BusinDataTaskGoodsVo goodsVo = businDataTaskGoodsVos.get(0);
String vehicheModel = goodsVo.getVehicheModel();
@ -2092,8 +1910,6 @@ public class ScheduledTasks {
String startPoint = businDataTaskVo.getTaskPath();
redisTemplate.opsForValue().set(RedisConstant.redisInVehicheModel, vehicheModel);
/**
* 1.判断是否启动越库
* 2.判断此入库的保险杠是否是有出库任务如果有送往小组装
@ -2278,30 +2094,22 @@ public class ScheduledTasks {
//到达组装线等待上报点进行的业务处理
String reportPointGroup = sysParameterService.selectConfigByKey(ParameterConstants.ParameterSystem.report_point);
BasePointDeviceQueryBo pointReportQueryBo = new BasePointDeviceQueryBo();
String reportPoint = "";
pointReportQueryBo.setGroupNo(reportPointGroup);
BasePointDeviceVo reportPointDeviceOut = basePointDeviceMapper.selectBasePointByGroupno(pointReportQueryBo);
if (ObjectUtils.isEmpty(reportPointDeviceOut)) {
log.error("请维护组装线上报点");
return;
}
reportPoint = reportPointDeviceOut.getPointNo();
//越库到小组装的下挂点
toLocation =outTaskVos.get(0).getTaskPath();
points.add(businDataTaskVo.getTaskPath());
// points.add(pointDevice.getHandshakePoint());
// points.add(reportPoint);
points.add(toLocation);
snPointMap.put("1", businDataTaskVo.getTaskPath());
// snPointMap.put("2", pointDevice.getHandshakePoint());
// snPointMap.put("3", reportPoint);
snPointMap.put("2", toLocation);
}
//呼叫AGV
Result<Boolean> booleanResult = new Result<>();
if (taskType.equals("7")) {
@ -2355,8 +2163,135 @@ public class ScheduledTasks {
}
iBusinDataTaskService.updateById(BeanUtil.toBean(businDataTaskVo, BusinDataTask.class));
}
else if ("2".equals(taskType)){
Long plcId = 0L;
Long stkPlcId = 0L;
Boolean NUMBER = true;
BaseLocationVo locationVo = null;
String toPointNo="";
int agvTaskType=33;
//获取起始点位
String startPoint = businDataTaskVo.getTaskPath();
//获取机械手上报点
List<String> points = new ArrayList<>();
Map<String, String> snPointMap = new HashMap<>(3);
String tepairGroupin = sysParameterService.selectConfigByKey(ParameterConstants.ParameterSystem.putout_point);
BasePointDeviceQueryBo pointQueryBoup = new BasePointDeviceQueryBo();
pointQueryBoup.setGroupNo(tepairGroupin);
BasePointDeviceVo pointDevice = basePointDeviceMapper.selectBasePointByGroupno(pointQueryBoup);
points.add(startPoint);
snPointMap.put("1", startPoint);
points.add(pointDevice.getHandshakePoint());
snPointMap.put("2", pointDevice.getHandshakePoint());
//查询维修地点是否有空闲
String tepairGroup = sysParameterService.selectConfigByKey(ParameterConstants.ParameterSystem.scanexc_group);
BasePointDeviceQueryBo pointQueryBo = new BasePointDeviceQueryBo();
pointQueryBo.setGroupNo(tepairGroup);
BasePointDeviceVo basePointDeviceVo = null;
List<BasePointDeviceVo> basePointDeviceVos = baseLocationPlcMapper.selectBasePointByGroupno(pointQueryBo);
//无空闲区 分配异常区库位
if (basePointDeviceVos.size() == 0) {
NUMBER = false;
agvTaskType=RCSTaskTypeEnum.A_TO_B_HAND_PUT.getValue();
if (businDataTaskVo.getWarehouseType().equals("2")) {
String tepairGroup1 = sysParameterService.selectConfigByKey(ParameterConstants.ParameterSystem.P_in01);
pointQueryBo.setGroupNo(tepairGroup1);
basePointDeviceVo = basePointDeviceMapper.selectBasePointByGroupno(pointQueryBo);
} else {
//异常区ID
Long abnormalArea = Long.valueOf(sysParameterService.selectConfigByKey(ParameterConstants.ParameterSystem.abnormal_area));
//分配货位
List<BusinDataTaskGoodsVo> businDataTaskGoodsVoList = iBusinDataTaskGoodsService.selectBusinTaskGoodsByTaskCode(businDataTaskVo.getId());
AssingEmptyLocBo assingEmptyLocBo = new AssingEmptyLocBo();
assingEmptyLocBo.setBusinDataTaskGoodsVos(businDataTaskGoodsVoList);
assingEmptyLocBo.setAreaId(abnormalArea);
Result<BaseLocationVo> locationVoResult = iBaseLocationService.assignEmptyLocatioError(assingEmptyLocBo);
if (Result.isOk(locationVoResult)){
locationVo = locationVoResult.getData();
}
businDataTaskVo.setToColumn(locationVo.getLocationColumn());
businDataTaskVo.setToLayer(locationVo.getLayer());
businDataTaskVo.setToRow(locationVo.getLocationRow());
businDataTaskVo.setLocationId(locationVo.getId());
//获取货位及巷道;
String tunnel = locationVo.getTunnel();
businDataTaskVo.setTunnel(tunnel);
pointQueryBo = new BasePointDeviceQueryBo();
pointQueryBo.setTunnel(tunnel);
pointQueryBo.setDirection("0");
basePointDeviceVos = baseLocationPlcMapper.selectBasePointByGroupno(pointQueryBo);
if (basePointDeviceVos.size() > 0) {
basePointDeviceVo = basePointDeviceVos.get(0);
}
//获取巷道对应的堆垛机信息
pointQueryBo.setDevType("1");
BaseDevicePlcVo baseDevicePlcVo = baseLocationPlcMapper.selectBaseDevicePlc(pointQueryBo);
stkPlcId = baseDevicePlcVo.getPlcId();
plcId =Long.valueOf(isysParameterService.selectConfigByKey(ParameterConstants.ParameterSystem.LK_plc_id));
toPointNo = basePointDeviceVo.getPointNo();
snPointMap.put("3",toPointNo);
points.add(toPointNo);
}
} else {
agvTaskType = 33;
basePointDeviceVo = basePointDeviceVos.get(0);
toPointNo = basePointDeviceVo.getPointNo();
snPointMap.put("3", "XX");
points.add("XX");
snPointMap.put("4", "XX");
points.add("XX");
snPointMap.put("5", toPointNo);
points.add(toPointNo);
}
businDataTaskVo.setPoints(JsonUtil.toJSONString(snPointMap));
businDataTaskVo.setIsDown(String.valueOf(agvTaskType));
Result<Boolean> booleanResult;
//呼叫AGV
if (StringUtils.isNotEmpty(businDataTaskVo.getAgvNo())) {
booleanResult = callAGV(taskId, agvTaskType, points, businDataTaskVo.getAgvNo());
} else {
booleanResult = callAGV(taskId, agvTaskType, points);
}
if (booleanResult.getCode() == HttpStatus.ERROR.getCode()) {
BusinDataTask businDataTask = new BusinDataTask();
businDataTask.setId(businDataTaskVo.getId());
businDataTask.setTaskStatus(TaskStatusEnum.wait_callback.getValue());
businDataTask.setTaskPath(toPointNo);
iBusinDataTaskService.updateById(businDataTask);
return;
}
//呼叫AGV成功
if (booleanResult.getCode() == HttpStatus.SUCCESS.getCode()) {
businDataTaskVo.setTaskStatus(TaskStatusEnum.wait_callback.getValue());
businDataTaskVo.setTaskPath(toPointNo);
if (NUMBER) {
BasePoint basePoint = iBasePointService.getById(basePointDeviceVo.getPointId());
basePoint.setIsOccupy("1");
iBasePointService.updateById(basePoint);
}
}
//更新入库条码表状态为异常
List<BaseBarcodesIn> barcodesIns = new ArrayList<>();
List<BusinDataTaskGoodsVo> goodsVos = iBusinDataTaskGoodsService.selectBusinTaskGoodsByTaskCode(taskId);
for (BusinDataTaskGoodsVo goodsVo : goodsVos) {
BaseBarcodesIn baseBarcodesIn = iBaseBarcodesInService.getOne(new LambdaQueryWrapper<BaseBarcodesIn>()
.eq(BaseBarcodesIn::getQrCode, goodsVo.getQrCode())
);
baseBarcodesIn.setInStatus("4");
baseBarcodesIn.setInDate(DateUtils.getDate());
barcodesIns.add(baseBarcodesIn);
}
iBaseBarcodesInService.saveOrUpdateBatch(barcodesIns);
businDataTaskVo.setDpsNoOne(plcId);
businDataTaskVo.setDpsNoTwo(stkPlcId);
businDataTaskVo.setTaskStatus(TaskStatusEnum.wait_callback.getValue());
iBusinDataTaskService.updateById(BeanUtil.toBean(businDataTaskVo, BusinDataTask.class));
}
}
}

@ -167,6 +167,14 @@ public interface IBaseLocationService extends IService<BaseLocation> {
Result<BaseLocationVo> assignEmptyLocatioPunching(AssingEmptyLocBo assingEmptyLocBo);
/**
* 异常杠分配货位
* @param assingEmptyLocBo
* @return
*/
Result<BaseLocationVo> assignEmptyLocatioError(AssingEmptyLocBo assingEmptyLocBo);
/**
* 检查货位是否有对应双深位
*

@ -814,6 +814,12 @@ public class BaseLocationServiceImpl extends ServiceImpl<BaseLocationMapper, Bas
}
/**
*
* @param assingEmptyLocBo
* @param lcoatinTunnel 空托分配时需要传入巷道
* @return
*/
@Override
public synchronized Result<BaseLocationVo> assignEmptyLocationAll(AssingEmptyLocBo assingEmptyLocBo, String lcoatinTunnel) {
BaseLocationVo locationVo = null;
@ -1054,6 +1060,7 @@ public class BaseLocationServiceImpl extends ServiceImpl<BaseLocationMapper, Bas
BaseLocationQueryListBo bo = new BaseLocationQueryListBo();
bo.setGoodsNo(goodsNo);
bo.setLocationStatus("0");
bo.setAreaId(assingEmptyLocBo.getAreaId());
log.info("冲孔保险杠分配货位查询条件:" + JsonUtil.toJSONString(bo));
List<BaseLocationVo> baseLocationVos = this.baseMapper.queryBaseLocationListByGoodsPunching(bo);
if (baseLocationVos.size() == 0) {
@ -1166,6 +1173,132 @@ public class BaseLocationServiceImpl extends ServiceImpl<BaseLocationMapper, Bas
}
@Override
public synchronized Result<BaseLocationVo> assignEmptyLocatioError(AssingEmptyLocBo assingEmptyLocBo) {
List<BusinDataTaskGoodsVo> businDataTaskGoodsVos = assingEmptyLocBo.getBusinDataTaskGoodsVos();
String goodsNo = "";
String vehicheModel = assingEmptyLocBo.getVehicheModel();
String batch = assingEmptyLocBo.getBatch();
BaseLocationVo locationVo = null;
/* if (businDataTaskGoodsVos != null && businDataTaskGoodsVos.size() > 0) {
BusinDataTaskGoodsVo businDataTaskGoodsVo = businDataTaskGoodsVos.get(0);
String taskCode = businDataTaskGoodsVo.getTaskCode();
goodsNo = businDataTaskGoodsVo.getGoodsNo();
log.info("异常入库分配货位任务号:" + taskCode + " 保险杠编号:" + goodsNo);
} else {
return Result.err().msg("无保险杠信息");
}*/
BaseLocationQueryListBo bo = new BaseLocationQueryListBo();
// bo.setGoodsNo(goodsNo);
bo.setLocationStatus("0");
bo.setAreaId(assingEmptyLocBo.getAreaId());
log.info("异常保险杠分配货位查询条件:" + JsonUtil.toJSONString(bo));
List<BaseLocationVo> baseLocationVos = this.baseMapper.queryBaseLocationListByGoodsPunching(bo);
if (baseLocationVos.size() == 0) {
//查看缓冲区是否还有货位
Long bufferArea = Long.valueOf(sysParameterService.selectConfigByKey(ParameterConstants.ParameterSystem.buffer_area));
List<BaseLocationVo> baseLocationVoList = baseLocationMapper.getLocationByAreaId(bufferArea);
log.info("异常保险杠保险杠缓冲区分配到的货位信息:" + baseLocationVoList.size());
if (baseLocationVoList.size() < 0) {
log.info("异常保险杠车型及缓冲区都未查询到空货位");
return Result.err().msg("异常保险杠保险杠分配货位暂无空货位可用");
}
baseLocationVos = baseLocationVoList;
}
//拿到所有可用货位,根据巷道号对双深位的巷道进行处理
//空货位所在巷道列表,同时过滤掉已有入库任务的巷道
List<String> tunnelList = baseLocationVos.stream().map(e -> e.getTunnel()).distinct().collect(Collectors.toList());
log.info("异常保险杠分配货位查询到的货位对应的巷道信息:" + JsonUtil.toJSONString(tunnelList));
//从存在空货位的巷道里选择较优的巷道进行入库
//首选选择任务数为空或者任务数最少的巷道
//任务数相同时选取空货位最多的巷道;24.06.27改为查询库存数量最少并且空货位数最多的
List<String> tunnelResult = new ArrayList<>();
Integer minTaskNum = 0;
Integer maxEmptyLocationNum = 0;
Integer minGoodsQty = 0;
for (int i = 0; i < tunnelList.size(); i++) {
String tunnel = tunnelList.get(i);
Integer taskNum = tunnelTaskUtil.getTotalTaskNum(tunnel, 0);
List<BaseLocationVo> currTunnelLocationVos = baseLocationVos.stream().filter(e -> tunnel.equals(e.getTunnel())).collect(Collectors.toList());
int curEmptyNum = currTunnelLocationVos.size();
BaseLocationVo baseLocationVo = currTunnelLocationVos.get(0);
int currGoodsQty = 0;
if (baseLocationVo.getGoodQty() != null) {
currGoodsQty = baseLocationVo.getGoodQty();
}
//获取巷道内库存数量最少并且空货位数最多的
log.info("异常保险杠分配之前----当前巷道:" + tunnel + " 目前任务数:" + taskNum + " 当前空货位数量:" + curEmptyNum + " 最小任务数:" + minTaskNum + " 最大空货位数:" + maxEmptyLocationNum + " 当前库存量:" + currGoodsQty);
if (minTaskNum == 0 && taskNum.equals(minTaskNum)) {
if (i != 0) {
if (currGoodsQty < minGoodsQty) {
minGoodsQty = currGoodsQty;
if (curEmptyNum > maxEmptyLocationNum) {
tunnelResult.clear();
tunnelResult.add(tunnel);
maxEmptyLocationNum = curEmptyNum;
}
}
} else {
minGoodsQty = currGoodsQty;
minTaskNum = taskNum;
tunnelResult.add(tunnel);
maxEmptyLocationNum = curEmptyNum;
}
} else if (minTaskNum == 0) {
if (i == 0) {
minGoodsQty = currGoodsQty;
minTaskNum = taskNum;
tunnelResult.add(tunnel);
maxEmptyLocationNum = curEmptyNum;
}
} else if (minTaskNum != 0 && taskNum.equals(minTaskNum)) {
if (currGoodsQty < minGoodsQty) {
minGoodsQty = currGoodsQty;
if (curEmptyNum > maxEmptyLocationNum) {
tunnelResult.clear();
tunnelResult.add(tunnel);
maxEmptyLocationNum = curEmptyNum;
}
}
} else if (minTaskNum != 0 && taskNum < minTaskNum) {
minGoodsQty = currGoodsQty;
minTaskNum = taskNum;
tunnelResult.clear();
tunnelResult.add(tunnel);
maxEmptyLocationNum = curEmptyNum;
}
log.info("保险杠分配之后----当前巷道:" + tunnel + " 目前任务数:" + taskNum + " 当前空货位数量:" + curEmptyNum + " 最小任务数:" + minTaskNum + " 最大空货位数:" + maxEmptyLocationNum + " 当前库存量:" + currGoodsQty);
}
log.info("异常杠巷道的任务数量:" + JsonUtil.toJSONString(tunnelResult));
//从选取的巷道中选择库位
if (tunnelResult.size() > 0) {
String tunnel = tunnelResult.get(0);
List<BaseLocationVo> resultLocationList = baseLocationVos.stream().filter(e -> tunnel.equals(e.getTunnel())).collect(Collectors.toList());
locationVo = resultLocationList.get(0);
log.info("异常杠分配的货位:" + JsonUtil.toJSONString(locationVo));
//巷道中货位数大于1时,进行分配
if (resultLocationList.size() > 0) {
//判断是否是双深位相关
BaseLocationVo assginLocation = assginLocation(resultLocationList, batch, vehicheModel, businDataTaskGoodsVos);
if (assginLocation != null) {
locationVo = assginLocation;
log.info("最终分配的货位信息:" + assginLocation);
}
}
}
if (locationVo != null) {
//确定分配该库位,并将库位状态改为已分配
this.changeLocationStatus(locationVo.getId(), "4");
locationVo.setLocationStatus("4");
return Result.ok().data(locationVo);
} else {
return Result.err();
}
}
/**
* 保险杠分配货位检查是否是双深位
*
@ -1205,8 +1338,6 @@ public class BaseLocationServiceImpl extends ServiceImpl<BaseLocationMapper, Bas
count++;
}
}
//!batch.equals(sysStockDetailVoList.get(0).getBatch()) ||
if (count != stockGoodsNoList.size()
|| deepLocation.getLocationStatus().equals("2")) {
log.info("当前批次:" + batch + " 双深位批次:" + sysStockDetailVoList.get(0).getBatch());
@ -1441,22 +1572,23 @@ public class BaseLocationServiceImpl extends ServiceImpl<BaseLocationMapper, Bas
}
if (!businDataTask.getLocationId().equals(baseLocation.getId())) {
log.info("双深位重新分配-原货位:"+businDataTask.getLocationId() +" 重新分配的货位:"+baseLocation.getId()+" 分配的任务ID:"+businDataTask.getLocationId());
baseLocation.setLocationStatus("4");
this.updateById(baseLocation);
businDataTask.setToLayer(baseLocation.getLayer());
businDataTask.setToColumn(baseLocation.getLocationColumn());
businDataTask.setToRow(baseLocation.getLocationRow());
businDataTask.setLocationId(baseLocation.getId());
log.info("双深位重新分配货位:" + JsonUtil.toJSONString(baseLocation));
iBusinDataTaskService.updateById(businDataTask);
}
} else {
if ("1".equals(locationStatus) || "2".equals(locationStatus) || "5".equals(locationStatus)) {
log.info("给堆垛机下发任务:" + businDataTask.getId() + " 原货位:" + JsonUtil.toJSONString(baseLocation));
BaseLocationVo baseLocationVo = this.queryLocationByTunnel(tunnel);
BaseLocation newLocation = BeanUtil.toBean(baseLocationVo, BaseLocation.class);
newLocation.setLocationStatus("4");
this.updateById(newLocation);
log.info("给堆垛机下发任务:" + businDataTask.getId() + " 原货位:" +baseLocation.getLocationCode()+" 新货位:"+newLocation.getLocationCode());
businDataTask.setToLayer(baseLocationVo.getLayer());
businDataTask.setToColumn(baseLocationVo.getLocationColumn());
businDataTask.setToRow(baseLocationVo.getLocationRow());

@ -301,12 +301,10 @@ public class BusinDataTaskServiceImpl extends ServiceImpl<BusinDataTaskMapper, B
//生成作业任务
BusinDataTask task = new BusinDataTask();
int randomoperands = (int) Math.round(Math.random() * 1000);
String taskCode = "T_" + DateUtils.dateTimeNow() + randomoperands;
task.setTaskCode(taskCode);
task.setTaskType(TaskTypeEnum.normal_out.getValue());
if (baseBarcodesOut.getTraverseDate() != null) {
task.setBatch(DateUtils.dateTime(baseBarcodesOut.getTraverseDate()));
task.setFromSide(baseBarcodesOut.getBumperType());
}
task.setPriority("2");
task.setIsTop("0");
@ -356,6 +354,7 @@ public class BusinDataTaskServiceImpl extends ServiceImpl<BusinDataTaskMapper, B
businDataTask.setTaskType(TaskTypeEnum.normal_out.getValue());
if (baseBarcodesOut.getTraverseDate() != null) {
businDataTask.setBatch(DateUtils.dateTime(baseBarcodesOut.getTraverseDate()));
businDataTask.setFromSide(baseBarcodesOut.getBumperType());
}
businDataTask.setPriority("2");
businDataTask.setIsTop("0");

@ -125,6 +125,12 @@ public class IBusinEnptyContainerServiceImpl extends ServiceImpl<BaseContainerMa
toPpoint = pointDeviceVo.getPointNo();
agvType= "3";
stuats=false;
//更改点位状态为占用
BasePoint basePoint = basePointService.selectBasePointByPointNo(toPpoint);
if (basePoint !=null){
basePoint.setIsOccupy("1");
basePointService.updateById(basePoint);
}
}else {
String outEmptyType = redisTemplate.opsForValue().get(RedisConstant.out_empty_type).toString();
if("开启".equals(outEmptyType)){
@ -225,7 +231,6 @@ public class IBusinEnptyContainerServiceImpl extends ServiceImpl<BaseContainerMa
businDataTask.setToLayer(locationVo.getLayer());
businDataTask.setToRow(locationVo.getLocationRow());
businDataTask.setLocationId(locationVo.getId());
}
int agvTaskType = Integer.valueOf(agvType);
@ -282,11 +287,7 @@ public class IBusinEnptyContainerServiceImpl extends ServiceImpl<BaseContainerMa
businDataTask.setTaskStatus(TaskStatusEnum.wait_callback.getValue());
iBusinDataTaskService.updateById(businDataTask);
//2024-07-12 呼叫AGV成功后不释放点位,待AGV取货完成后,再释放点位信息
// //更改点位状态为空闲
// BasePoint basePoint = basePointService.selectBasePointByPointNo(fromPoint);
// basePoint.setIsOccupy("0");
// basePointService.updateById(basePoint);
//更新货位状态为已分配
if (locationVo!=null){
BaseLocation baseLocation = BeanUtil.toBean(locationVo,BaseLocation.class);

@ -222,7 +222,6 @@ public class PutInOutStorageServiceImpl extends ServiceImpl<BasePointDeviceMappe
if (ObjectUtils.isEmpty(barcodes_f) && ObjectUtils.isEmpty(barcodes_s) &&ObjectUtils.isEmpty(barcodes_t)){
// 创建任务
BusinDataTask task = new BusinDataTask();
task.setTaskCode("T_" + DateUtils.dateTimeNow());
task.setTaskPath("KW17");
task.setTaskStatus(TaskStatusEnum.wait_put.getValue());
//入库计划未有该条码信息设置任务类型为18
@ -305,10 +304,9 @@ public class PutInOutStorageServiceImpl extends ServiceImpl<BasePointDeviceMappe
List<BaseInventoryRatio> baseInventoryRatioList = baseInventoryRatioService.getInfoByvehicheModel(model);
//获取下料点点位
String taskCode = "T_" + DateUtils.dateTimeNow();
String transId = com.shkj.common.utils.uuid.UUID.randomUUID().toString();
BusinTaskAddBo businTaskAddBo =new BusinTaskAddBo();
businTaskAddBo.setTaskCode(taskCode);
businTaskAddBo.setPlcId(plcIP);
businTaskAddBo.setTaskStatus(TaskStatusEnum.wait_put.getValue());
businTaskAddBo.setCreateTime(DateUtils.getNowDate());

@ -577,8 +577,10 @@
WHERE
bl.is_del = '0'
AND ba.is_del = '0'
AND bs.is_del = '0' and bl.area_id =17
AND bs.is_del = '0'
<if test="areaId != null">
and bl.area_id = #{areaId}
</if>
<if test="locationStatus != null">
and ifnull(bl.location_status,'0') = #{locationStatus}
</if>

Loading…
Cancel
Save