|
@ -74,17 +74,17 @@ public class GHSQHTask extends AbstractTask { |
|
|
// @Transactional(rollbackFor = Exception.class)
|
|
|
// @Transactional(rollbackFor = Exception.class)
|
|
|
protected void create() throws BadRequestException { |
|
|
protected void create() throws BadRequestException { |
|
|
|
|
|
|
|
|
List<SchBasePoint> schBasePointList = pointMapper.findPointByRegion("GHS","3"); |
|
|
List<SchBasePoint> schBasePointList = pointMapper.findPointByRegion("GHS", "3"); |
|
|
if (schBasePointList.size()==0) { |
|
|
if (schBasePointList.size() == 0) { |
|
|
// 消息通知
|
|
|
// 消息通知
|
|
|
log.info("未找到当前符合允许取货的固化室点位,暂不生成任务"); |
|
|
log.info("未找到当前符合允许取货的固化室点位,暂不生成任务"); |
|
|
return; |
|
|
return; |
|
|
} |
|
|
} |
|
|
SchBasePoint schBasePoint=null; |
|
|
SchBasePoint schBasePoint = null; |
|
|
//按顺序查找第一个符合条件的固化室位置,发起任务
|
|
|
//按顺序查找第一个符合条件的固化室位置,发起任务
|
|
|
for(SchBasePoint schBasePoint1:schBasePointList){ |
|
|
for (SchBasePoint schBasePoint1 : schBasePointList) { |
|
|
if (schBasePoint1.getVehicle_qty()==3&&ObjectUtil.isEmpty(schBasePoint1.getIng_task_code())) { |
|
|
if (schBasePoint1.getVehicle_qty() == 3 && ObjectUtil.isEmpty(schBasePoint1.getIng_task_code())) { |
|
|
schBasePoint=schBasePoint1; |
|
|
schBasePoint = schBasePoint1; |
|
|
break; |
|
|
break; |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
@ -93,14 +93,14 @@ public class GHSQHTask extends AbstractTask { |
|
|
log.info("未找到当前符合允许取货的固化室点位,暂不生成任务"); |
|
|
log.info("未找到当前符合允许取货的固化室点位,暂不生成任务"); |
|
|
return; |
|
|
return; |
|
|
} |
|
|
} |
|
|
SchBasePoint nextPoint=this.findNextPoint(schBasePoint); |
|
|
SchBasePoint nextPoint = this.findNextPoint(schBasePoint); |
|
|
if (ObjectUtil.isEmpty(nextPoint)) { |
|
|
if (ObjectUtil.isEmpty(nextPoint)) { |
|
|
// 消息通知
|
|
|
// 消息通知
|
|
|
log.info("未找到当前符合允许放货的缓存点,暂不生成任务Vehicle_type:{}",schBasePoint.getVehicle_type()); |
|
|
log.info("未找到当前符合允许放货的缓存点,暂不生成任务Vehicle_type:{}", schBasePoint.getVehicle_type()); |
|
|
return; |
|
|
return; |
|
|
} |
|
|
} |
|
|
// 放料先去等待点
|
|
|
// 放料先去等待点
|
|
|
this.createTask(schBasePoint,nextPoint.getNext_wait_point()); |
|
|
this.createTask(schBasePoint, nextPoint.getNext_wait_point()); |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
@ -111,10 +111,10 @@ public class GHSQHTask extends AbstractTask { |
|
|
* @param endPoint |
|
|
* @param endPoint |
|
|
* @return |
|
|
* @return |
|
|
*/ |
|
|
*/ |
|
|
private void createTask(SchBasePoint schBasePoint,String endPoint) { |
|
|
private void createTask(SchBasePoint schBasePoint, String endPoint) { |
|
|
// 申请任务
|
|
|
// 申请任务
|
|
|
SchBaseTask task = new SchBaseTask(); // 任务实体
|
|
|
SchBaseTask task = new SchBaseTask(); // 任务实体
|
|
|
String apply_point_code =schBasePoint.getPoint_code(); // 请求点
|
|
|
String apply_point_code = schBasePoint.getPoint_code(); // 请求点
|
|
|
String config_code = "GHSQHTask"; |
|
|
String config_code = "GHSQHTask"; |
|
|
// 1、校验数据
|
|
|
// 1、校验数据
|
|
|
SchBaseTaskconfig taskConfig = taskConfigService.getOne(new LambdaQueryWrapper<SchBaseTaskconfig>() |
|
|
SchBaseTaskconfig taskConfig = taskConfigService.getOne(new LambdaQueryWrapper<SchBaseTaskconfig>() |
|
@ -175,28 +175,32 @@ public class GHSQHTask extends AbstractTask { |
|
|
//边负极板到缓存区1
|
|
|
//边负极板到缓存区1
|
|
|
regionCode = "HCQ2"; |
|
|
regionCode = "HCQ2"; |
|
|
} |
|
|
} |
|
|
List<SchBasePoint> schBasePointList = pointMapper.findPointByRegion(regionCode,"2"); |
|
|
List<SchBasePoint> schBasePointList = pointMapper.findPointByRegion(regionCode, "1"); |
|
|
for(int i=schBasePointList.size()-1;i>=0;i--){ |
|
|
for (int i = schBasePointList.size() - 1; i >= 0; i--) { |
|
|
SchBasePoint schBasePoint=schBasePointList.get(i); |
|
|
SchBasePoint schBasePoint = schBasePointList.get(i); |
|
|
SchBasePoint temp=null; |
|
|
SchBasePoint temp = null; |
|
|
if (schBasePoint.getVehicle_qty()==0 |
|
|
if (schBasePoint.getVehicle_qty() == 0 |
|
|
&&ObjectUtil.isEmpty(schBasePoint.getIng_task_code()) |
|
|
&& ObjectUtil.isEmpty(schBasePoint.getIng_task_code()) |
|
|
&&(ObjectUtil.isEmpty(schBasePoint.getVehicle_type())||materialType.equals(schBasePoint.getVehicle_type()))){ |
|
|
//放货三拖一起放,只能到01位置
|
|
|
|
|
|
&& schBasePoint.getPoint_code().endsWith("01") |
|
|
|
|
|
&& (ObjectUtil.isEmpty(schBasePoint.getVehicle_type()) || materialType.equals(schBasePoint.getVehicle_type()))) { |
|
|
//发现有空位时暂存当前位置,检查当前列前面是否存在已放货位置,找最前面无货的位置
|
|
|
//发现有空位时暂存当前位置,检查当前列前面是否存在已放货位置,找最前面无货的位置
|
|
|
//如果当列其他位置均已放满,则继续找下一列
|
|
|
//如果当列其他位置均已放满,则继续找下一列
|
|
|
List<SchBasePoint> tempList = pointMapper.findPointByParentPoint(schBasePoint.getParent_point_code()); |
|
|
List<SchBasePoint> tempList = pointMapper.findPointByParentPoint(schBasePoint.getParent_point_code()); |
|
|
for(SchBasePoint tempPoint:tempList){ |
|
|
|
|
|
if(tempPoint.getVehicle_qty()!=0||ObjectUtil.isNotEmpty(schBasePoint.getIng_task_code())){ |
|
|
for (SchBasePoint tempPoint : tempList) { |
|
|
if(temp!=null){ |
|
|
if ((tempPoint.getVehicle_qty() != 0 || ObjectUtil.isNotEmpty(schBasePoint.getIng_task_code())) |
|
|
return temp; |
|
|
) { |
|
|
|
|
|
break; // 如果当前库位非空,则跳出循环
|
|
|
|
|
|
} else { |
|
|
|
|
|
if(tempPoint.getPoint_code().endsWith("01")) { |
|
|
|
|
|
temp = tempPoint; // 更新最大空库位
|
|
|
} |
|
|
} |
|
|
temp=tempPoint; |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
if(temp==null){ |
|
|
if (temp != null) { |
|
|
continue; |
|
|
log.info("固化室取货任务找到当前符合条件的缓存区位置{}", schBasePoint.getPoint_code()); |
|
|
} |
|
|
} |
|
|
log.info("固化室取货任务找到当前符合条件的缓存区位置{}",schBasePoint.getPoint_code()); |
|
|
|
|
|
return temp; |
|
|
return temp; |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
@ -227,19 +231,23 @@ public class GHSQHTask extends AbstractTask { |
|
|
taskObj.setRemark("执行中"); |
|
|
taskObj.setRemark("执行中"); |
|
|
} |
|
|
} |
|
|
if (status.equals(TaskStatus.FINISHED)) { // 完成
|
|
|
if (status.equals(TaskStatus.FINISHED)) { // 完成
|
|
|
StringBuilder group_id= new StringBuilder(); |
|
|
StringBuilder group_id = new StringBuilder(); |
|
|
// 终点解锁
|
|
|
// 终点解锁,缓存区现在由一个点位改为三个点位,所以将物料存在010203三个位置上
|
|
|
endPointObj.setIng_task_code(""); |
|
|
for(int i=1;i<=3;i++) { |
|
|
endPointObj.setVehicle_code(startPointObj.getVehicle_code()); |
|
|
SchBasePoint point = pointService.getById(endPoint.substring(0,endPoint.length()-1)+i); |
|
|
endPointObj.setVehicle_type(startPointObj.getVehicle_type()); |
|
|
point.setIng_task_code(""); |
|
|
endPointObj.setVehicle_code(startPointObj.getVehicle_code()); |
|
|
List<String> vehicleCodeList = Arrays.stream(startPointObj.getVehicle_code().split(",")).collect(Collectors.toList()); |
|
|
endPointObj.setVehicle_qty(startPointObj.getVehicle_qty()); |
|
|
point.setVehicle_code(vehicleCodeList.get(i-1)); |
|
|
endPointObj.setUpdate_time(DateUtil.now()); |
|
|
point.setVehicle_type(startPointObj.getVehicle_type()); |
|
|
pointService.update(endPointObj); |
|
|
point.setVehicle_qty(1); |
|
|
|
|
|
point.setUpdate_time(DateUtil.now()); |
|
|
|
|
|
pointService.update(point); |
|
|
|
|
|
} |
|
|
//固化室放料完毕后,将当前一整排都标记上物料信息,防止出现混放情况
|
|
|
//固化室放料完毕后,将当前一整排都标记上物料信息,防止出现混放情况
|
|
|
pointMapper.updateVehicleType(endPointObj.getPoint_code().substring(0,endPointObj.getPoint_code().length()-2),endPointObj.getVehicle_type()); |
|
|
pointMapper.updateVehicleType(endPointObj.getPoint_code().substring(0, endPointObj.getPoint_code().length() - 2), endPointObj.getVehicle_type()); |
|
|
List<String> vehicleCodeList = Arrays.stream(startPointObj.getVehicle_code().split(",")).collect(Collectors.toList()); |
|
|
List<String> vehicleCodeList = Arrays.stream(startPointObj.getVehicle_code().split(",")).collect(Collectors.toList()); |
|
|
for(String vehicleCode:vehicleCodeList) { |
|
|
for (int i=0;i<vehicleCodeList.size();i++) { |
|
|
|
|
|
String vehicleCode=vehicleCodeList.get(i); |
|
|
SchBaseVehiclematerialgroup one = vehiclematerialgroupService.getOne(new LambdaQueryWrapper<SchBaseVehiclematerialgroup>() |
|
|
SchBaseVehiclematerialgroup one = vehiclematerialgroupService.getOne(new LambdaQueryWrapper<SchBaseVehiclematerialgroup>() |
|
|
.eq(SchBaseVehiclematerialgroup::getVehicle_code, vehicleCode) |
|
|
.eq(SchBaseVehiclematerialgroup::getVehicle_code, vehicleCode) |
|
|
.eq(SchBaseVehiclematerialgroup::getGroup_bind_material_status, |
|
|
.eq(SchBaseVehiclematerialgroup::getGroup_bind_material_status, |
|
@ -248,9 +256,9 @@ public class GHSQHTask extends AbstractTask { |
|
|
throw new BadRequestException(vehicleCode + " => " + startPointObj.getVehicle_type() + "的组盘信息未找到"); |
|
|
throw new BadRequestException(vehicleCode + " => " + startPointObj.getVehicle_type() + "的组盘信息未找到"); |
|
|
} |
|
|
} |
|
|
one.setTask_code(taskObj.getTask_code()); |
|
|
one.setTask_code(taskObj.getTask_code()); |
|
|
one.setPoint_code(endPointObj.getPoint_code()); // 当前位置
|
|
|
one.setPoint_code(endPointObj.getPoint_code().substring(0,endPointObj.getPoint_code().length()-1)+(i+1)); // 当前位置
|
|
|
one.setPoint_name(endPointObj.getPoint_name()); |
|
|
one.setPoint_name(endPointObj.getPoint_name().substring(0,endPointObj.getPoint_name().length()-1)+(i+1)); |
|
|
one.setMove_way(one.getMove_way()==null?"":(one.getMove_way() + " -> ") + endPointObj.getPoint_code()); |
|
|
one.setMove_way(one.getMove_way() == null ? "" : (one.getMove_way() + " -> ") + endPointObj.getPoint_code().substring(0,endPointObj.getPoint_code().length()-1)+(i+1)); |
|
|
one.setUpdate_id(GeneralDefinition.ACS_ID); |
|
|
one.setUpdate_id(GeneralDefinition.ACS_ID); |
|
|
one.setUpdate_name(GeneralDefinition.ACS_NAME); |
|
|
one.setUpdate_name(GeneralDefinition.ACS_NAME); |
|
|
one.setUpdate_time(DateUtil.now()); |
|
|
one.setUpdate_time(DateUtil.now()); |
|
@ -267,7 +275,8 @@ public class GHSQHTask extends AbstractTask { |
|
|
taskObj.setRemark("任务完成"); |
|
|
taskObj.setRemark("任务完成"); |
|
|
|
|
|
|
|
|
//如果起点点位为10结尾视为最后该固化室最后一个任务,取完后通知acs取货完毕
|
|
|
//如果起点点位为10结尾视为最后该固化室最后一个任务,取完后通知acs取货完毕
|
|
|
if(taskObj.getPoint_code1().endsWith("10")) { |
|
|
// (如果不放满的情况可以固化,可能逻辑需要改成任务完成时检测当前固化室所有点位是否已完成)
|
|
|
|
|
|
if (taskObj.getPoint_code1().endsWith("10")) { |
|
|
String middle = taskObj.getPoint_code1().substring(taskObj.getPoint_code1().length() - 4, taskObj.getPoint_code1().length() - 2); |
|
|
String middle = taskObj.getPoint_code1().substring(taskObj.getPoint_code1().length() - 4, taskObj.getPoint_code1().length() - 2); |
|
|
//通知acs已经放满,固化室可以进行固化
|
|
|
//通知acs已经放满,固化室可以进行固化
|
|
|
String device_code = "ZDM" + middle; |
|
|
String device_code = "ZDM" + middle; |
|
@ -302,15 +311,15 @@ public class GHSQHTask extends AbstractTask { |
|
|
|
|
|
|
|
|
@SneakyThrows |
|
|
@SneakyThrows |
|
|
@Override |
|
|
@Override |
|
|
protected void feedbackTaskState(JSONObject param,SchBaseTask schBaseTask, BaseResponse result) { |
|
|
protected void feedbackTaskState(JSONObject param, SchBaseTask schBaseTask, BaseResponse result) { |
|
|
//todo 重算最优点
|
|
|
//todo 重算最优点
|
|
|
SchBasePoint startPoint=pointService.getOne(new LambdaQueryWrapper<SchBasePoint>() |
|
|
SchBasePoint startPoint = pointService.getOne(new LambdaQueryWrapper<SchBasePoint>() |
|
|
.eq(SchBasePoint::getPoint_code, schBaseTask.getPoint_code1())); |
|
|
.eq(SchBasePoint::getPoint_code, schBaseTask.getPoint_code1())); |
|
|
SchBasePoint nextPoint=this.findNextPoint(startPoint); |
|
|
SchBasePoint nextPoint = this.findNextPoint(startPoint); |
|
|
if(ObjectUtil.isEmpty(nextPoint)){ |
|
|
if (ObjectUtil.isEmpty(nextPoint)) { |
|
|
throw new Exception("当前起点"+schBaseTask.getPoint_code1()+"未找到合适的放货点位"); |
|
|
throw new Exception("当前起点" + schBaseTask.getPoint_code1() + "未找到合适的放货点位"); |
|
|
} |
|
|
} |
|
|
//上位记的是整一个缓存区三个点,整体搬运时反馈点位带01
|
|
|
//上位记的是整一个缓存区三个点
|
|
|
schBaseTask.setPoint_code2(nextPoint.getPoint_code()+"01"); |
|
|
schBaseTask.setPoint_code2(nextPoint.getPoint_code()); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|