|
|
@ -79,16 +79,19 @@ public class BPSLTask extends AbstractTask { |
|
|
|
String extGroupData = task.getExt_group_data(); |
|
|
|
JSONObject jsonObject = JSONObject.parseObject(extGroupData); |
|
|
|
String materialType = jsonObject.getString("material_type"); |
|
|
|
SchBasePoint point = findNextPoint(jsonObject,task); |
|
|
|
SchBasePoint point = findNextPoint(jsonObject, task); |
|
|
|
if (ObjectUtil.isEmpty(point)) { |
|
|
|
task.setRemark("未找到所需点位!"); |
|
|
|
taskService.update(task); |
|
|
|
// 消息通知
|
|
|
|
log.info("包片上料未找到当前符合条件的点位materialType:{},",materialType); |
|
|
|
log.info("包片上料未找到当前符合条件的点位materialType:{},", materialType); |
|
|
|
continue; |
|
|
|
} |
|
|
|
|
|
|
|
task.setTask_type("3"); |
|
|
|
if ("1".equals(materialType)) { |
|
|
|
task.setTask_type("13"); |
|
|
|
} else { |
|
|
|
task.setTask_type("3"); |
|
|
|
} |
|
|
|
// 设置起点并修改创建成功状态
|
|
|
|
// 取料先去等待点
|
|
|
|
task.setPoint_code1(point.getNext_wait_point()); |
|
|
@ -114,27 +117,27 @@ public class BPSLTask extends AbstractTask { |
|
|
|
* @param extGroupData |
|
|
|
* @return |
|
|
|
*/ |
|
|
|
private SchBasePoint findNextPoint(JSONObject extGroupData,SchBaseTask task) { |
|
|
|
private SchBasePoint findNextPoint(JSONObject extGroupData, SchBaseTask task) { |
|
|
|
String regionCode = ""; |
|
|
|
String materialType = extGroupData.getString("material_type"); |
|
|
|
if("1".equals(materialType)){ |
|
|
|
regionCode="ZJBDJW"; |
|
|
|
}else if("2".equals(materialType)){ |
|
|
|
regionCode="HCQ2"; |
|
|
|
}else if ("3".equals(materialType)){ |
|
|
|
regionCode="HCQ3"; |
|
|
|
if ("1".equals(materialType)) { |
|
|
|
regionCode = "HCQ4"; |
|
|
|
} else if ("2".equals(materialType)) { |
|
|
|
regionCode = "HCQ2"; |
|
|
|
} else if ("3".equals(materialType)) { |
|
|
|
regionCode = "HCQ3"; |
|
|
|
} |
|
|
|
List<SchBasePoint> schBasePointList = pointMapper.findPointByRegion(regionCode,"1"); |
|
|
|
for(int i=schBasePointList.size()-1;i>=0;i--){ |
|
|
|
SchBasePoint schBasePoint=schBasePointList.get(i); |
|
|
|
List<SchBasePoint> schBasePointList = pointMapper.findPointByRegion(regionCode, "1"); |
|
|
|
for (int i = schBasePointList.size() - 1; i >= 0; i--) { |
|
|
|
SchBasePoint schBasePoint = schBasePointList.get(i); |
|
|
|
//已锁定直接返回
|
|
|
|
if(task.getTask_code().equals(schBasePoint.getIng_task_code())){ |
|
|
|
if (task.getTask_code().equals(schBasePoint.getIng_task_code())) { |
|
|
|
return schBasePoint; |
|
|
|
} |
|
|
|
if (!"2".equals(schBasePoint.getPoint_type())&&schBasePoint.getVehicle_qty()!=0 |
|
|
|
&&ObjectUtil.isEmpty(schBasePoint.getIng_task_code()) |
|
|
|
&&(ObjectUtil.isEmpty(schBasePoint.getVehicle_type())||materialType.equals(schBasePoint.getVehicle_type()))){ |
|
|
|
log.info("包片上料任务找到当前符合条件的缓存区位置{}",schBasePoint.getPoint_code()); |
|
|
|
if (!"2".equals(schBasePoint.getPoint_type()) && schBasePoint.getVehicle_qty() != 0 |
|
|
|
&& ObjectUtil.isEmpty(schBasePoint.getIng_task_code()) |
|
|
|
&& (ObjectUtil.isEmpty(schBasePoint.getVehicle_type()) || materialType.equals(schBasePoint.getVehicle_type()))) { |
|
|
|
log.info("包片上料任务找到当前符合条件的缓存区位置{}", schBasePoint.getPoint_code()); |
|
|
|
return schBasePoint; |
|
|
|
} |
|
|
|
} |
|
|
@ -157,8 +160,8 @@ public class BPSLTask extends AbstractTask { |
|
|
|
throw new BadRequestException("该任务已取消!"); |
|
|
|
} |
|
|
|
String startPoint = taskObj.getPoint_code1(); // 获取起点
|
|
|
|
if(startPoint.startsWith("ZJBDJW")){ |
|
|
|
startPoint=startPoint.substring(0,startPoint.length()-2); |
|
|
|
if (startPoint.startsWith("ZJBDJW")) { |
|
|
|
startPoint = startPoint.substring(0, startPoint.length() - 2); |
|
|
|
} |
|
|
|
String endPoint = taskObj.getPoint_code2(); // 获取终点
|
|
|
|
SchBasePoint startPointObj = pointService.getById(startPoint); |
|
|
@ -170,7 +173,7 @@ public class BPSLTask extends AbstractTask { |
|
|
|
} |
|
|
|
if (status.equals(TaskStatus.FINISHED)) { // 完成
|
|
|
|
List<String> vehicleCodeList = Arrays.stream(startPointObj.getVehicle_code().split(",")).collect(Collectors.toList()); |
|
|
|
String vehicleCode=vehicleCodeList.get(vehicleCodeList.size()-1); |
|
|
|
String vehicleCode = vehicleCodeList.get(vehicleCodeList.size() - 1); |
|
|
|
SchBaseVehiclematerialgroup one = vehiclematerialgroupService.getOne(new LambdaQueryWrapper<SchBaseVehiclematerialgroup>() |
|
|
|
.eq(SchBaseVehiclematerialgroup::getVehicle_code, vehicleCode) |
|
|
|
.eq(SchBaseVehiclematerialgroup::getGroup_bind_material_status, |
|
|
@ -189,11 +192,11 @@ public class BPSLTask extends AbstractTask { |
|
|
|
vehiclematerialgroupService.updateById(one); |
|
|
|
} |
|
|
|
// 起点清空
|
|
|
|
if (vehicleCodeList.size()==1) { |
|
|
|
if (vehicleCodeList.size() == 1) { |
|
|
|
startPointObj.setVehicle_code(""); |
|
|
|
}else{ |
|
|
|
StringBuilder vehicle_code=new StringBuilder(); |
|
|
|
for(int i=0;i<=vehicleCodeList.size()-2;i++){ |
|
|
|
} else { |
|
|
|
StringBuilder vehicle_code = new StringBuilder(); |
|
|
|
for (int i = 0; i <= vehicleCodeList.size() - 2; i++) { |
|
|
|
vehicle_code.append(vehicleCodeList.get(i)).append(','); |
|
|
|
} |
|
|
|
startPointObj.setVehicle_code(vehicle_code.toString()); |
|
|
@ -205,7 +208,7 @@ public class BPSLTask extends AbstractTask { |
|
|
|
startPointObj.setUpdate_time(DateUtil.now()); |
|
|
|
pointService.updateById(startPointObj); |
|
|
|
//包片上料完毕后,整排打上记号只允许包片上料
|
|
|
|
pointMapper.updatePointType(endPointObj.getPoint_code().substring(0,endPointObj.getPoint_code().length()-2),"1"); |
|
|
|
pointMapper.updatePointType(endPointObj.getPoint_code().substring(0, endPointObj.getPoint_code().length() - 2), "1"); |
|
|
|
// 任务完成
|
|
|
|
taskObj.setTask_status(TaskStatus.FINISHED.getCode()); |
|
|
|
// taskObj.setGroup_id(one.getGroup_id());
|
|
|
@ -242,24 +245,24 @@ public class BPSLTask extends AbstractTask { |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
protected synchronized void feedbackTaskState(JSONObject param,SchBaseTask schBaseTask, BaseResponse result) { |
|
|
|
protected synchronized void feedbackTaskState(JSONObject param, SchBaseTask schBaseTask, BaseResponse result) { |
|
|
|
//重算最优点
|
|
|
|
JSONObject jsonObject = JSONObject.parseObject(schBaseTask.getExt_group_data()); |
|
|
|
SchBasePoint point = this.findNextPoint(jsonObject,schBaseTask); |
|
|
|
SchBasePoint point = this.findNextPoint(jsonObject, schBaseTask); |
|
|
|
//正极板两种情况,任务没分配就是点位高度,如果已分配则已减掉,所以重复请求需要加回去,多次变动太恶心了待优化
|
|
|
|
if( "1".equals(jsonObject.getString("material_type"))&&ObjectUtil.isEmpty(point.getIng_task_code())) { |
|
|
|
schBaseTask.setPoint_code1(point.getPoint_code()+"0"+(point.getVehicle_qty())); |
|
|
|
}else if ("1".equals(jsonObject.getString("material_type"))&&ObjectUtil.isNotEmpty(point.getIng_task_code())){ |
|
|
|
schBaseTask.setPoint_code1(point.getPoint_code()+"0"+(point.getVehicle_qty()+1)); |
|
|
|
}else{ |
|
|
|
schBaseTask.setPoint_code1(point.getPoint_code().replace("HCQ","QHQ")); |
|
|
|
if ("1".equals(jsonObject.getString("material_type")) && ObjectUtil.isEmpty(point.getIng_task_code())) { |
|
|
|
schBaseTask.setPoint_code1(point.getPoint_code() + "0" + (point.getVehicle_qty())); |
|
|
|
} else if ("1".equals(jsonObject.getString("material_type")) && ObjectUtil.isNotEmpty(point.getIng_task_code())) { |
|
|
|
schBaseTask.setPoint_code1(point.getPoint_code() + "0" + (point.getVehicle_qty() + 1)); |
|
|
|
} else { |
|
|
|
schBaseTask.setPoint_code1(point.getPoint_code().replace("HCQ", "QHQ")); |
|
|
|
} |
|
|
|
//如果是正极板对接位则直接减库存
|
|
|
|
if ((point.getPoint_code().startsWith("ZJBDJW"))&&ObjectUtil.isEmpty(point.getIng_task_code())) { |
|
|
|
if ((point.getPoint_code().startsWith("ZJBDJW")) && ObjectUtil.isEmpty(point.getIng_task_code())) { |
|
|
|
point.setVehicle_qty(point.getVehicle_qty() - 1); |
|
|
|
} |
|
|
|
//重算点位时把点位占用
|
|
|
|
point.setIng_task_code(schBaseTask.getTask_code()); |
|
|
|
point.setIng_task_code(schBaseTask.getTask_code()); |
|
|
|
|
|
|
|
pointService.update(point); |
|
|
|
} |
|
|
|