自测问题修复

This commit is contained in:
psh
2023-11-28 18:04:30 +08:00
parent 715cc94e76
commit 8b9cfe49e0
7 changed files with 76 additions and 59 deletions

View File

@@ -93,7 +93,7 @@ public class BPSLTask extends AbstractTask {
taskService.update(task);
//发起任务时先把点位占用,防止发起重复任务
point.setIng_task_code(task.getTask_code());
// point.setIng_task_code(task.getTask_code());
// point.setVehicle_qty(point.getVehicle_qty() - 1);
point.setVehicle_type(materialType);
pointService.update(point);
@@ -120,7 +120,7 @@ public class BPSLTask extends AbstractTask {
}else if ("3".equals(materialType)){
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--){
SchBasePoint schBasePoint=schBasePointList.get(i);
if (!"2".equals(schBasePoint.getPoint_type())&&schBasePoint.getVehicle_qty()!=0
@@ -230,8 +230,6 @@ public class BPSLTask extends AbstractTask {
//todo 重算最优点
JSONObject jsonObject = JSONObject.parseObject(schBaseTask.getExt_group_data());
SchBasePoint point = this.findNextPoint(jsonObject);
// 设置起点并修改创建成功状态
List<String> vehicleCodeList = Arrays.stream(point.getVehicle_code().split(",")).collect(Collectors.toList());
schBaseTask.setPoint_code1(point.getPoint_code()+"0"+vehicleCodeList.size());
schBaseTask.setPoint_code1(point.getPoint_code());
}
}

View File

@@ -161,7 +161,7 @@ public class GHSFMTask extends AbstractTask {
Integer tcmn = taskConfig.getTask_create_max_num();
// 获取执行中的任务
List<SchBaseTask> unFinishTasksByTaskConfig = taskService.findUnFinishTasksByTaskConfig(
taskConfig.getConfig_code(), apply_point_code, taskConfig.getTask_direction());
taskConfig.getConfig_code(), apply_point_code+"01", taskConfig.getTask_direction());
Assert.isFalse(unFinishTasksByTaskConfig.size() >= tcmn,
"该点位申请的任务未完成数已超过上限,无法申请任务");
@@ -180,11 +180,13 @@ public class GHSFMTask extends AbstractTask {
task.setVehicle_qty(schBasePoint.getVehicle_qty());
task.setTask_status(TaskStatus.APPLY.getCode());
task.setWorkshop_code(taskConfig.getWorkshop_code()); // 车间编码
//acs固化室首位不存在01和06整体概念需要补充01生成第一个点位的任务
task.setPoint_code1(apply_point_code+"01");
task.setPoint_code2(endPoint);
task.setTask_status(TaskStatus.CREATED.getCode());
task.setRemark("");
// 设置起/终点
this.setTaskPoint(taskConfig, task, apply_point_code);
// this.setTaskPoint(taskConfig, task, apply_point_code);
taskService.create(task);
//下发
@@ -212,7 +214,7 @@ public class GHSFMTask extends AbstractTask {
if (taskObj.getTask_status().equals(TaskStatus.CANCELED.getCode())) {
throw new BadRequestException("该任务已取消!");
}
String startPoint = taskObj.getPoint_code1(); // 获取起点
String startPoint = taskObj.getPoint_code1().substring(0,taskObj.getPoint_code1().length()-2); // 获取起点
String endPoint = taskObj.getPoint_code2(); // 获取终点
SchBasePoint startPointObj = pointService.getById(startPoint);
SchBasePoint endPointObj = pointService.getById(endPoint);
@@ -225,7 +227,6 @@ public class GHSFMTask extends AbstractTask {
StringBuilder group_id= new StringBuilder();
// 终点解锁
endPointObj.setIng_task_code("");
endPointObj.setVehicle_code(startPointObj.getVehicle_code());
endPointObj.setVehicle_type(startPointObj.getVehicle_type());
endPointObj.setVehicle_code(startPointObj.getVehicle_code());
endPointObj.setVehicle_qty(startPointObj.getVehicle_qty());

View File

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