diff --git a/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/basedriver/agv/ndcone/AgvNdcOneDeviceDriver.java b/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/basedriver/agv/ndcone/AgvNdcOneDeviceDriver.java index 772e776..c2f0de0 100644 --- a/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/basedriver/agv/ndcone/AgvNdcOneDeviceDriver.java +++ b/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/basedriver/agv/ndcone/AgvNdcOneDeviceDriver.java @@ -30,6 +30,7 @@ import org.nl.acs.log.service.DeviceExecuteLogService; import org.nl.acs.opc.DeviceAppService; import org.nl.acs.task.domain.Task; import org.nl.acs.task.service.TaskService; +import org.nl.acs.task.service.dto.TaskDto; import org.nl.acs.task.service.impl.TaskServiceImpl; import org.nl.system.service.param.ISysParamService; import org.nl.config.SpringContextHolder; @@ -124,6 +125,12 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic // SiemensConveyorDeviceDriver siemensConveyorDeviceDriver; + TaskDto task =taskService.findById(inst.getTask_id()); + int start_height= ObjectUtil.isNotEmpty(task.getStart_height())?Integer.parseInt(task.getStart_height()):0; + int next_height= ObjectUtil.isNotEmpty(task.getNext_height())?Integer.parseInt(task.getNext_height()):0; + String start_point=task.getStart_point_code(); + String next_point=task.getNext_point_code(); + //分配 车id //(不需要WCS反馈) if (phase == 0x02) { @@ -168,16 +175,12 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic logServer.deviceExecuteLog(this.device_code, "", "", "未找到关联编号对应的指令" + ikey); return; } - Task task =taskService.getById(inst.getTask_id()); - BaseRequest request=new BaseRequest(); - request.setRequestNo(IdUtil.simpleUUID()); - request.setTaskId(task.getExt_task_id()); - request.setPhase(String.valueOf(phase)); - acsToWmsService.feedbackState(request); - data = NDCAgvService.sendAgvOneModeInst(phase, index, 0,0,0,0,0); + + data = getData(data, index, inst, task); //到达取货等待点 //(需要WCS反馈) } else if (phase == 0x04) { + data = getData(data, index, inst, task); //取货完毕 //(需要WCS反馈) } else if (phase == 0x05) { @@ -214,7 +217,7 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic logServer.deviceExecuteLog(this.device_code, "", "", "未找到关联编号对应的指令" + ikey); return; } - data = NDCAgvService.sendAgvOneModeInst(phase, index, 0,0,0,0,0); + data = getData(data, index, inst, task); //到达放货等待点 //(需要WCS反馈) } else if (phase == 0x06) { @@ -251,7 +254,7 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic log.info("未找到关联编号{}对应的指令", ikey); return; } - data = NDCAgvService.sendAgvOneModeInst(phase, index, 0,0,0,0,0); + data = getData(data, index, inst, task); //放货完毕 //(需要WCS反馈) @@ -310,4 +313,39 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic } } + private byte[] getData(byte[] data, int index, Instruction inst, TaskDto task) { + String next_point; + String start_point; + int next_height; + int start_height; + if(!"1".equals(task.getTask_type())&&!"2".equals(task.getTask_type())) { + BaseRequest request = new BaseRequest(); + request.setRequestNo(IdUtil.simpleUUID()); + request.setTaskId(task.getExt_task_id()); + JSONObject resp = JSONObject.parseObject(acsToWmsService.feedbackState(request)); + if("200".equals(resp.getString("code"))){ + start_height=(resp.getJSONObject("parameters").getInteger("start_height")-1)*1000; + next_height=(resp.getJSONObject("parameters").getInteger("next_height")-1)*1000; + start_point=resp.getJSONObject("parameters").getString("start_point"); + next_point=resp.getJSONObject("parameters").getString("next_point"); + task.setStart_height(String.valueOf(start_height)); + task.setNext_height(String.valueOf(next_height)); + task.setStart_point_code(start_point); + task.setStart_device_code(start_point); + task.setNext_point_code(next_point); + task.setNext_device_code(next_point); + int start_address=deviceService.queryAddressBydeviceCode(start_point); + int next_address=deviceService.queryAddressBydeviceCode(next_point); + taskService.update(task); + data = NDCAgvService.sendAgvOneModeInst(phase, index, 0, start_address, next_address, start_height, next_height); + log.info("指令号:{},phase:{},acs请求wms申请成功", inst.getInstruction_code(),phase); + }else{ + log.info("指令号:{},phase:{},acs请求wms申请失败", inst.getInstruction_code(),phase); + } + }else { + data = NDCAgvService.sendAgvOneModeInst(phase, index, 0, 0, 0, 0, 0); + } + return data; + } + } diff --git a/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/ext/wms/data/BaseRequest.java b/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/ext/wms/data/BaseRequest.java index 093078e..8006730 100644 --- a/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/ext/wms/data/BaseRequest.java +++ b/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/ext/wms/data/BaseRequest.java @@ -68,10 +68,5 @@ public class BaseRequest { */ private String taskId; - /** - * 阶段号 - */ - private String phase; - } diff --git a/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/task/service/dto/TaskDto.java b/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/task/service/dto/TaskDto.java index c80a62d..96c0712 100644 --- a/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/task/service/dto/TaskDto.java +++ b/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/task/service/dto/TaskDto.java @@ -290,4 +290,16 @@ public class TaskDto implements Serializable { * 烘箱温度 */ private String temperature; + + /** + * 起点高度 + */ + private String start_height; + + /** + * 终点高度 + */ + private String next_height; + + } diff --git a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/ext/service/impl/AcsToWmsServiceImpl.java b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/ext/service/impl/AcsToWmsServiceImpl.java index 27aef1d..e9329a0 100644 --- a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/ext/service/impl/AcsToWmsServiceImpl.java +++ b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/ext/service/impl/AcsToWmsServiceImpl.java @@ -39,6 +39,7 @@ import org.springframework.transaction.annotation.Transactional; import javax.annotation.PostConstruct; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; +import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.concurrent.ConcurrentHashMap; @@ -196,8 +197,14 @@ public class AcsToWmsServiceImpl implements AcsToWmsService { } AbstractTask task = taskFactory.getTask(schBaseTask.getConfig_code()); // 执行创建任务 - String resultCode=task.feedbackState(param); - result.getParameters().put("result",resultCode); + task.feedbackState(param,schBaseTask,result); + Map map=new HashMap<>(); + map.put("start_point",schBaseTask.getPoint_code1()); + map.put("next_point",schBaseTask.getPoint_code2()); + //todo + map.put("start_height","0"); + map.put("next_height","0"); + result.setParameters(map); } catch (Exception e) { String message = ObjectUtil.isEmpty(e.getMessage()) ? ((InvocationTargetException) e).getTargetException().getMessage() diff --git a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/AbstractTask.java b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/AbstractTask.java index da25fe7..2bebcc8 100644 --- a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/AbstractTask.java +++ b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/AbstractTask.java @@ -7,6 +7,7 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import org.nl.common.exception.BadRequestException; import org.nl.wms.database.material.service.IMdBaseMaterialService; import org.nl.wms.database.material.service.dao.MdBaseMaterial; +import org.nl.wms.ext.service.dto.to.BaseResponse; import org.nl.wms.pdm.service.IPdmBdWorkorderService; import org.nl.wms.pdm.service.dao.PdmBdWorkorder; import org.nl.wms.sch.point.service.ISchBasePointService; @@ -235,10 +236,10 @@ public abstract class AbstractTask { * @param param * @throws BadRequestException */ - public String feedbackState(JSONObject param) throws BadRequestException { - return this.feedbackTaskState(param); + public void feedbackState(JSONObject param,SchBaseTask schBaseTask, BaseResponse result) throws BadRequestException { + this.feedbackTaskState(param,schBaseTask,result); } - protected abstract String feedbackTaskState(JSONObject param); + protected abstract void feedbackTaskState(JSONObject param,SchBaseTask schBaseTask,BaseResponse result); } diff --git a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/BPSLTask.java b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/BPSLTask.java index 4dd4c6f..996938d 100644 --- a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/BPSLTask.java +++ b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/BPSLTask.java @@ -9,6 +9,7 @@ import lombok.extern.slf4j.Slf4j; import org.nl.common.exception.BadRequestException; import org.nl.config.MapOf; import org.nl.wms.ext.service.WmsToAcsService; +import org.nl.wms.ext.service.dto.to.BaseResponse; import org.nl.wms.pdm.service.IPdmBdWorkorderService; import org.nl.wms.pdm.service.dao.PdmBdWorkorder; import org.nl.wms.sch.group.service.ISchBaseVehiclematerialgroupService; @@ -216,19 +217,12 @@ public class BPSLTask extends AbstractTask { } @Override - protected String feedbackTaskState(JSONObject param) { - int phase=param.getInteger("phase"); - String result="0"; - switch (phase){ - case 3: - break; - case 4: - break; - case 6: - break; - case 7: - break; - } - return result; + protected void feedbackTaskState(JSONObject param,SchBaseTask schBaseTask, BaseResponse result) { + //todo 重算最优点 + JSONObject jsonObject = JSONObject.parseObject(schBaseTask.getExt_group_data()); + SchBasePoint point = this.findNextPoint(jsonObject); + // 设置起点并修改创建成功状态 + schBaseTask.setPoint_code1(point.getPoint_code()); + taskService.update(schBaseTask); } } diff --git a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/KGHJRKTask.java b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/KGHJRKTask.java index 419bc67..9b24457 100644 --- a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/KGHJRKTask.java +++ b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/KGHJRKTask.java @@ -9,6 +9,7 @@ import lombok.extern.slf4j.Slf4j; import org.nl.common.exception.BadRequestException; import org.nl.config.MapOf; import org.nl.wms.ext.service.WmsToAcsService; +import org.nl.wms.ext.service.dto.to.BaseResponse; import org.nl.wms.pdm.service.IPdmBdWorkorderService; import org.nl.wms.pdm.service.dao.PdmBdWorkorder; import org.nl.wms.sch.group.service.ISchBaseVehiclematerialgroupService; @@ -177,19 +178,7 @@ public class KGHJRKTask extends AbstractTask { } @Override - protected String feedbackTaskState(JSONObject param) { - int phase=param.getInteger("phase"); - String result="0"; - switch (phase){ - case 3: - break; - case 4: - break; - case 6: - break; - case 7: - break; - } - return result; + protected void feedbackTaskState(JSONObject param,SchBaseTask schBaseTask, BaseResponse result) { + //todo 重算最优点 } } \ No newline at end of file diff --git a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/MJXLTask.java b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/MJXLTask.java index cc804ea..e19e8c7 100644 --- a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/MJXLTask.java +++ b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/MJXLTask.java @@ -7,6 +7,7 @@ import com.alibaba.fastjson.JSONObject; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import lombok.extern.slf4j.Slf4j; import org.nl.common.exception.BadRequestException; +import org.nl.wms.ext.service.dto.to.BaseResponse; import org.nl.wms.pdm.service.IPdmBdWorkorderService; import org.nl.wms.pdm.service.dao.PdmBdWorkorder; import org.nl.wms.sch.group.service.ISchBaseVehiclematerialgroupService; @@ -244,19 +245,7 @@ public class MJXLTask extends AbstractTask { } @Override - protected String feedbackTaskState(JSONObject param) { - int phase=param.getInteger("phase"); - String result="0"; - switch (phase){ - case 3: - break; - case 4: - break; - case 6: - break; - case 7: - break; - } - return result; + protected void feedbackTaskState(JSONObject param,SchBaseTask schBaseTask, BaseResponse result) { + //todo 重算最优点 } } diff --git a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/TBXBKJTask.java b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/TBXBKJTask.java index 294e590..0e4b895 100644 --- a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/TBXBKJTask.java +++ b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/TBXBKJTask.java @@ -9,6 +9,7 @@ import lombok.extern.slf4j.Slf4j; import org.nl.common.exception.BadRequestException; import org.nl.config.MapOf; import org.nl.wms.ext.service.WmsToAcsService; +import org.nl.wms.ext.service.dto.to.BaseResponse; import org.nl.wms.pdm.service.IPdmBdWorkorderService; import org.nl.wms.pdm.service.dao.PdmBdWorkorder; import org.nl.wms.sch.group.service.ISchBaseVehiclematerialgroupService; @@ -183,19 +184,7 @@ public class TBXBKJTask extends AbstractTask { } @Override - protected String feedbackTaskState(JSONObject param) { - int phase=param.getInteger("phase"); - String result="0"; - switch (phase){ - case 3: - break; - case 4: - break; - case 6: - break; - case 7: - break; - } - return result; + protected void feedbackTaskState(JSONObject param,SchBaseTask schBaseTask, BaseResponse result) { + //todo 重算最优点 } } \ No newline at end of file diff --git a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/XSCKTask.java b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/XSCKTask.java index c9038e1..db71194 100644 --- a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/XSCKTask.java +++ b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/XSCKTask.java @@ -9,6 +9,7 @@ import lombok.extern.slf4j.Slf4j; import org.nl.common.exception.BadRequestException; import org.nl.config.MapOf; import org.nl.wms.ext.service.WmsToAcsService; +import org.nl.wms.ext.service.dto.to.BaseResponse; import org.nl.wms.pdm.service.IPdmBdWorkorderService; import org.nl.wms.pdm.service.dao.PdmBdWorkorder; import org.nl.wms.sch.group.service.ISchBaseVehiclematerialgroupService; @@ -228,19 +229,7 @@ public class XSCKTask extends AbstractTask { } @Override - protected String feedbackTaskState(JSONObject param) { - int phase=param.getInteger("phase"); - String result="0"; - switch (phase){ - case 3: - break; - case 4: - break; - case 6: - break; - case 7: - break; - } - return result; + protected void feedbackTaskState(JSONObject param,SchBaseTask schBaseTask, BaseResponse result) { + //todo 重算最优点 } } \ No newline at end of file diff --git a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/ZJBZKDDTask.java b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/ZJBZKDDTask.java index 9907e57..c1306b5 100644 --- a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/ZJBZKDDTask.java +++ b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/ZJBZKDDTask.java @@ -9,6 +9,7 @@ import lombok.extern.slf4j.Slf4j; import org.nl.common.exception.BadRequestException; import org.nl.config.MapOf; import org.nl.wms.ext.service.WmsToAcsService; +import org.nl.wms.ext.service.dto.to.BaseResponse; import org.nl.wms.pdm.service.IPdmBdWorkorderService; import org.nl.wms.pdm.service.dao.PdmBdWorkorder; import org.nl.wms.sch.group.service.ISchBaseVehiclematerialgroupService; @@ -90,19 +91,7 @@ public class ZJBZKDDTask extends AbstractTask { } @Override - protected String feedbackTaskState(JSONObject param) { - int phase=param.getInteger("phase"); - String result="0"; - switch (phase){ - case 3: - break; - case 4: - break; - case 6: - break; - case 7: - break; - } - return result; + protected void feedbackTaskState(JSONObject param,SchBaseTask schBaseTask, BaseResponse result) { + //todo 重算最优点 } } \ No newline at end of file diff --git a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/ghs/GHSFMTask.java b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/ghs/GHSFMTask.java index b6cef7e..a4b0663 100644 --- a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/ghs/GHSFMTask.java +++ b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/ghs/GHSFMTask.java @@ -11,6 +11,7 @@ import org.nl.common.exception.BadRequestException; import org.nl.config.MapOf; import org.nl.wms.database.material.service.dao.MdBaseMaterial; import org.nl.wms.ext.service.WmsToAcsService; +import org.nl.wms.ext.service.dto.to.BaseResponse; import org.nl.wms.pdm.service.IPdmBdWorkorderService; import org.nl.wms.pdm.service.dao.PdmBdWorkorder; import org.nl.wms.sch.group.service.ISchBaseVehiclematerialgroupService; @@ -280,20 +281,9 @@ public class GHSFMTask extends AbstractTask { this.updateStatus(task_code, TaskStatus.CANCELED); } + @Override - protected String feedbackTaskState(JSONObject param) { - int phase=param.getInteger("phase"); - String result="0"; - switch (phase){ - case 3: - break; - case 4: - break; - case 6: - break; - case 7: - break; - } - return result; + protected void feedbackTaskState(JSONObject param,SchBaseTask schBaseTask, BaseResponse result) { + //todo 重算最优点 } } diff --git a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/ghs/GHSQHTask.java b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/ghs/GHSQHTask.java index ea1a8a6..199e42c 100644 --- a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/ghs/GHSQHTask.java +++ b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/ghs/GHSQHTask.java @@ -10,6 +10,7 @@ import lombok.extern.slf4j.Slf4j; import org.nl.common.exception.BadRequestException; import org.nl.config.MapOf; import org.nl.wms.ext.service.WmsToAcsService; +import org.nl.wms.ext.service.dto.to.BaseResponse; import org.nl.wms.pdm.service.IPdmBdWorkorderService; import org.nl.wms.pdm.service.dao.PdmBdWorkorder; import org.nl.wms.sch.group.service.ISchBaseVehiclematerialgroupService; @@ -294,19 +295,7 @@ public class GHSQHTask extends AbstractTask { } @Override - protected String feedbackTaskState(JSONObject param) { - int phase=param.getInteger("phase"); - String result="0"; - switch (phase){ - case 3: - break; - case 4: - break; - case 6: - break; - case 7: - break; - } - return result; + protected void feedbackTaskState(JSONObject param,SchBaseTask schBaseTask, BaseResponse result) { + //todo 重算最优点 } }