正极板空架优化
This commit is contained in:
@@ -76,7 +76,7 @@ public class KGHJRKTask extends AbstractTask {
|
|||||||
// 找终点
|
// 找终点
|
||||||
SchBasePoint startPoint = pointService.getOne(new LambdaQueryWrapper<SchBasePoint>()
|
SchBasePoint startPoint = pointService.getOne(new LambdaQueryWrapper<SchBasePoint>()
|
||||||
.eq(SchBasePoint::getPoint_code, task.getPoint_code1()));
|
.eq(SchBasePoint::getPoint_code, task.getPoint_code1()));
|
||||||
SchBasePoint point = findNextPoint(startPoint,task.getVehicle_type());
|
SchBasePoint point = findNextPoint(startPoint, task.getVehicle_type());
|
||||||
if (ObjectUtil.isEmpty(point)) {
|
if (ObjectUtil.isEmpty(point)) {
|
||||||
task.setRemark("未找到所需点位!");
|
task.setRemark("未找到所需点位!");
|
||||||
taskService.update(task);
|
taskService.update(task);
|
||||||
@@ -85,9 +85,9 @@ public class KGHJRKTask extends AbstractTask {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
// 设置终点并修改创建成功状态
|
// 设置终点并修改创建成功状态
|
||||||
if("1".equals(task.getVehicle_type())){
|
if ("1".equals(task.getVehicle_type())) {
|
||||||
task.setTask_type("11");
|
task.setTask_type("11");
|
||||||
}else{
|
} else {
|
||||||
task.setTask_type("12");
|
task.setTask_type("12");
|
||||||
}
|
}
|
||||||
task.setPoint_code2(point.getNext_wait_point());
|
task.setPoint_code2(point.getNext_wait_point());
|
||||||
@@ -109,23 +109,23 @@ public class KGHJRKTask extends AbstractTask {
|
|||||||
* 1.A区的去A区缓存点,B区的去B区
|
* 1.A区的去A区缓存点,B区的去B区
|
||||||
* 2.倒叙查找,找到满足当前位置数量不足3的即可
|
* 2.倒叙查找,找到满足当前位置数量不足3的即可
|
||||||
*/
|
*/
|
||||||
private SchBasePoint findNextPoint(SchBasePoint startPoint,String vehicleType) {
|
private SchBasePoint findNextPoint(SchBasePoint startPoint, String vehicleType) {
|
||||||
String regionCode = null;
|
String regionCode = null;
|
||||||
if ("A1".equals(startPoint.getWorkshop_code())) {
|
if ("A1".equals(startPoint.getWorkshop_code())) {
|
||||||
//A1空架到HCQ1
|
//A1空架到HCQ1
|
||||||
regionCode = "HCQ1";
|
regionCode = "HCQ1";
|
||||||
if("1".equals(vehicleType)){
|
if ("1".equals(vehicleType)) {
|
||||||
regionCode="ZJBKGHJDJW";
|
regionCode = "ZJBKGHJDJW";
|
||||||
}
|
}
|
||||||
|
|
||||||
} else if ("A2".equals(startPoint.getWorkshop_code())) {
|
} else if ("A2".equals(startPoint.getWorkshop_code())) {
|
||||||
//A1空架到KGHJ2
|
//A1空架到KGHJ2
|
||||||
regionCode = "KGHJ2";
|
regionCode = "KGHJ2";
|
||||||
}
|
}
|
||||||
List<SchBasePoint> schBasePointList = pointMapper.findPointByRegion(regionCode,"1");
|
List<SchBasePoint> schBasePointList = pointMapper.findPointByRegion(regionCode, "1");
|
||||||
//从前往后判断,直到发现点位有货,取前一个
|
//从前往后判断,直到发现点位有货,取前一个
|
||||||
SchBasePoint schBasePoint=null;
|
SchBasePoint schBasePoint = null;
|
||||||
if(!"ZJBKGHJDJW".equals(regionCode)) {
|
if (!"ZJBKGHJDJW".equals(regionCode)) {
|
||||||
for (int i = schBasePointList.size() - 1; i >= 0; i--) {
|
for (int i = schBasePointList.size() - 1; i >= 0; i--) {
|
||||||
SchBasePoint temp = schBasePointList.get(i);
|
SchBasePoint temp = schBasePointList.get(i);
|
||||||
if (temp.getVehicle_qty() == 1 &&
|
if (temp.getVehicle_qty() == 1 &&
|
||||||
@@ -133,22 +133,22 @@ public class KGHJRKTask extends AbstractTask {
|
|||||||
if (schBasePoint != null) {
|
if (schBasePoint != null) {
|
||||||
log.info("空固化架放货找到当前点位有货:{},取上一个空位:{}", temp.getPoint_code(), schBasePoint.getPoint_code());
|
log.info("空固化架放货找到当前点位有货:{},取上一个空位:{}", temp.getPoint_code(), schBasePoint.getPoint_code());
|
||||||
} else {
|
} else {
|
||||||
log.info("当前区域:"+regionCode+"所有点位均已放满,暂时跳过");
|
log.info("当前区域:" + regionCode + "所有点位均已放满,暂时跳过");
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
schBasePoint = temp;
|
schBasePoint = temp;
|
||||||
}
|
}
|
||||||
}else{
|
} else {
|
||||||
for (int i = schBasePointList.size() - 1; i >= 0; i--) {
|
for (int i = schBasePointList.size() - 1; i >= 0; i--) {
|
||||||
SchBasePoint temp = schBasePointList.get(i);
|
SchBasePoint temp = schBasePointList.get(i);
|
||||||
if (temp.getVehicle_qty() <3 &&
|
if (temp.getVehicle_qty() < 3 &&
|
||||||
ObjectUtil.isEmpty(temp.getIng_task_code())) {
|
ObjectUtil.isEmpty(temp.getIng_task_code())) {
|
||||||
schBasePoint = temp;
|
schBasePoint = temp;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (schBasePoint==null){
|
if (schBasePoint == null) {
|
||||||
log.info("当前区域:"+regionCode+"所有点位均已放满,暂时跳过");
|
log.info("当前区域:" + regionCode + "所有点位均已放满,暂时跳过");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return schBasePoint;
|
return schBasePoint;
|
||||||
@@ -169,6 +169,9 @@ public class KGHJRKTask extends AbstractTask {
|
|||||||
String startPoint = taskObj.getPoint_code1(); // 获取起点
|
String startPoint = taskObj.getPoint_code1(); // 获取起点
|
||||||
String endPoint = taskObj.getPoint_code2(); // 获取终点
|
String endPoint = taskObj.getPoint_code2(); // 获取终点
|
||||||
SchBasePoint startPointObj = pointService.getById(startPoint);
|
SchBasePoint startPointObj = pointService.getById(startPoint);
|
||||||
|
if (endPoint.startsWith("ZJBDJW")) {
|
||||||
|
endPoint=endPoint.substring(0,endPoint.length()-2);
|
||||||
|
}
|
||||||
SchBasePoint endPointObj = pointService.getById(endPoint);
|
SchBasePoint endPointObj = pointService.getById(endPoint);
|
||||||
// 根据传来的类型去对任务进行操作
|
// 根据传来的类型去对任务进行操作
|
||||||
if (status.equals(TaskStatus.EXECUTING)) { // 执行中
|
if (status.equals(TaskStatus.EXECUTING)) { // 执行中
|
||||||
@@ -177,11 +180,11 @@ public class KGHJRKTask extends AbstractTask {
|
|||||||
}
|
}
|
||||||
if (status.equals(TaskStatus.FINISHED)) { // 完成
|
if (status.equals(TaskStatus.FINISHED)) { // 完成
|
||||||
// 终点解锁,库存增加
|
// 终点解锁,库存增加
|
||||||
startPointObj.setIng_task_code("");
|
endPointObj.setIng_task_code("");
|
||||||
//正极板对接位通过plc信号同步,任务完成不增加
|
//正极板对接位通过plc信号同步,任务完成不增加
|
||||||
if(!"ZJBKGHJDJW".equals(startPointObj.getRegion_code())) {
|
// if(!"ZJBKGHJDJW".equals(startPointObj.getRegion_code())) {
|
||||||
startPointObj.setVehicle_qty(startPointObj.getVehicle_qty() + 1);
|
endPointObj.setVehicle_qty(startPointObj.getVehicle_qty() + 1);
|
||||||
}
|
// }
|
||||||
pointService.update(endPointObj);
|
pointService.update(endPointObj);
|
||||||
|
|
||||||
// 任务完成
|
// 任务完成
|
||||||
@@ -211,22 +214,22 @@ public class KGHJRKTask extends AbstractTask {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void feedbackTaskState(JSONObject param,SchBaseTask schBaseTask, BaseResponse result) {
|
protected void feedbackTaskState(JSONObject param, SchBaseTask schBaseTask, BaseResponse result) {
|
||||||
//重新计算固化室放货点位
|
//重新计算固化室放货点位
|
||||||
JSONObject extGroupData = JSONObject.parseObject(schBaseTask.getExt_group_data());
|
JSONObject extGroupData = JSONObject.parseObject(schBaseTask.getExt_group_data());
|
||||||
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 point = findNextPoint(startPoint, schBaseTask.getVehicle_type());
|
SchBasePoint point = findNextPoint(startPoint, schBaseTask.getVehicle_type());
|
||||||
if("ZJBKGHJDJW".equals(point.getRegion_code())) {
|
if ("ZJBKGHJDJW".equals(point.getRegion_code())) {
|
||||||
schBaseTask.setPoint_code2(point.getPoint_code() + "0" + (point.getVehicle_qty() + 1));
|
schBaseTask.setPoint_code2(point.getPoint_code() + "0" + (point.getVehicle_qty() + 1));
|
||||||
}else{
|
} else {
|
||||||
schBaseTask.setPoint_code2(point.getPoint_code().replace("HCQ","QHQ"));
|
schBaseTask.setPoint_code2(point.getPoint_code().replace("HCQ", "QHQ"));
|
||||||
if(ObjectUtil.isNotEmpty(point.getIng_task_code())&&!schBaseTask.getTask_code().equals(point.getIng_task_code())){
|
if (ObjectUtil.isNotEmpty(point.getIng_task_code()) && !schBaseTask.getTask_code().equals(point.getIng_task_code())) {
|
||||||
throw new BadRequestException("当前空架点位有任务,暂不反馈!");
|
throw new BadRequestException("当前空架点位有任务,暂不反馈!");
|
||||||
|
}
|
||||||
|
//重算点位时把点位占用
|
||||||
|
point.setIng_task_code(schBaseTask.getTask_code());
|
||||||
|
pointService.update(point);
|
||||||
}
|
}
|
||||||
//重算点位时把点位占用
|
|
||||||
point.setIng_task_code(schBaseTask.getTask_code());
|
|
||||||
pointService.update(point);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user