diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/siemens_weigh_conveyor/SiemensWeightConveyorDeviceDriver.java b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/siemens_weigh_conveyor/SiemensWeightConveyorDeviceDriver.java index 39d8b67dd..293be5d91 100644 --- a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/siemens_weigh_conveyor/SiemensWeightConveyorDeviceDriver.java +++ b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/siemens_weigh_conveyor/SiemensWeightConveyorDeviceDriver.java @@ -839,6 +839,7 @@ public class SiemensWeightConveyorDeviceDriver extends AbstractOpcDeviceDriver i } //创建指令后修改任务状态 taskdto.setTask_status("1"); + taskdto.setWeight(String.valueOf(this.weight)); taskserver.update(taskdto); requireSucess = true; String next_addr = nextdevice.getExtraValue().get("address").toString(); diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/agv/AgvWaitUtil.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/agv/AgvWaitUtil.java index 8f13cbc42..7c74d4e71 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/agv/AgvWaitUtil.java +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/agv/AgvWaitUtil.java @@ -53,6 +53,7 @@ public class AgvWaitUtil { if(manipulatorAgvStationDeviceDriver.getAction() != 1){ throw new BadRequestException("上位系统不允许取货"); } + } //agv叉车对接位安全信号交互 if(startDevice.getDeviceDriver() instanceof BoxSubvolumesConveyorDeviceDriver){ diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/agv/server/impl/XianGongAgvServiceImpl.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/agv/server/impl/XianGongAgvServiceImpl.java index cf2c55423..ce0f3a873 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/agv/server/impl/XianGongAgvServiceImpl.java +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/agv/server/impl/XianGongAgvServiceImpl.java @@ -5,6 +5,7 @@ import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.StrUtil; import cn.hutool.http.HttpRequest; import cn.hutool.http.HttpResponse; +import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONObject; import lombok.RequiredArgsConstructor; @@ -23,6 +24,9 @@ import org.nl.acs.instruction.service.InstructionService; import org.nl.acs.instruction.service.dto.InteractionJsonDTO; import org.nl.acs.opc.DeviceAppService; import org.nl.acs.device.enums.DeviceType; +import org.nl.acs.task.enums.ActionTypeEnum; +import org.nl.acs.task.enums.AgvActionTypeEnum; +import org.nl.acs.task.enums.AgvSystemTypeEnum; import org.nl.common.exception.BadRequestException; import org.nl.config.language.LangProcess; import org.nl.config.lucene.service.LuceneExecuteLogService; @@ -32,10 +36,7 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Service; -import java.util.Arrays; -import java.util.HashMap; -import java.util.List; -import java.util.Map; +import java.util.*; /** * @author 20220102CG\noblelift @@ -251,7 +252,11 @@ public class XianGongAgvServiceImpl implements XianGongAgvService { com.alibaba.fastjson.JSONObject jo = new com.alibaba.fastjson.JSONObject(); jo.put("id", inst.getInstruction_code()); //运单封口,true=创建运单之后不可添加动作块;false=创建运单可以添加动作块 - jo.put("complete", true); + if (AgvActionTypeEnum.ORDINARY.getCode().equals(inst.getAgv_action_type())) { + jo.put("complete", true); + } else { + jo.put("complete", false); + } //动作块 jo.put("blocks", createBlocksData(inst)); //运单优先级 @@ -262,7 +267,7 @@ public class XianGongAgvServiceImpl implements XianGongAgvService { .build(); logDto.setLog_level(4); luceneExecuteLogService.deviceExecuteLog(logDto); - log.info("任务号:{},指令号{},下发agv订单序列参数:{}", inst.getTask_code(), inst.getInstruction_code(), jo); + log.info("任务号:{},指令号{},下发诺宝运单序列参数:{}", inst.getTask_code(), inst.getInstruction_code(), jo); if (StrUtil.equals(paramService.findByCode(AcsConfig.FORKAGV).getValue(), CommonFinalParam.ONE)) { String agvurl = paramService.findByCode(AcsConfig.AGVURL).getValue(); @@ -304,22 +309,14 @@ public class XianGongAgvServiceImpl implements XianGongAgvService { String start_point_code = inst.getStart_point_code(); String next_device_code = inst.getNext_device_code(); String next_point_code = inst.getNext_point_code(); - String start_device_code2 = inst.getStart_device_code2(); - String start_point_code2 = inst.getStart_point_code2(); - String next_device_code2 = inst.getNext_device_code2(); - String next_point_code2 = inst.getNext_point_code2(); + Integer agv_action_type = inst.getAgv_action_type(); + + //起点1 - sendStartDeviceOrder(ja, start_device_code, start_point_code, instruction_code); + sendStartDeviceOrder(ja, start_device_code, start_point_code, instruction_code, agv_action_type); //终点1 - sendEndDeviceOrder(ja, start_device_code, instruction_code, next_point_code, next_device_code); - //起点2 - if (StrUtil.isNotEmpty(start_device_code2)) { - sendStartDeviceOrder(ja, start_device_code2, start_point_code2, instruction_code); - } - //终点2 - if (StrUtil.isNotEmpty(next_device_code2)) { - sendEndDeviceOrder(ja, start_device_code2, instruction_code, next_device_code2, next_point_code2); - } + sendEndDeviceOrder(ja, start_device_code, instruction_code, next_point_code, next_device_code, agv_action_type); + return ja; } @@ -327,11 +324,12 @@ public class XianGongAgvServiceImpl implements XianGongAgvService { * 下发取货信号 * * @param ja - * @param pointCode 起始点位 - * @param device_code 起始设备 - * @param instCode 指令号 + * @param pointCode 起始点位 + * @param device_code 起始设备 + * @param instCode 指令号 + * @param agv_action_type */ - public void sendStartDeviceOrder(JSONArray ja, String pointCode, String device_code, String instCode) { + public void sendStartDeviceOrder(JSONArray ja, String pointCode, String device_code, String instCode, Integer agv_action_type) { Device startDevice = deviceAppService.findDeviceByCode(device_code); //取货前等待 JSONObject jo = new JSONObject(); @@ -357,110 +355,99 @@ public class XianGongAgvServiceImpl implements XianGongAgvService { jo.put("script_args", script_args); ja.add(jo); - - //将货物顶起来,机器识别提升高度 - JSONObject jo1 = new JSONObject(); - jo1.put("blockId", IdUtil.simpleUUID()); - jo1.put("location", pointCode); - jo1.put("operation", "JackLoad"); - jo1.put("operationArgs", new JSONObject() {{ - put("recognize", true); - }}); - ja.add(jo1); + if (AgvActionTypeEnum.ORDINARY.getCode().equals(agv_action_type) || AgvActionTypeEnum.OUT_STOCK.getCode().equals(agv_action_type)) { + //将货物顶起来,机器识别提升高度 + JSONObject jo1 = new JSONObject(); + jo1.put("blockId", IdUtil.simpleUUID()); + jo1.put("location", pointCode); + jo1.put("operation", "JackLoad"); + jo1.put("operationArgs", new JSONObject() {{ + put("recognize", true); + }}); + ja.add(jo1); - JSONObject jo2 = new JSONObject(); - jo2.put("blockId", IdUtil.simpleUUID()); - jo2.put("location", pointCode + "OUTGET"); - jo2.put("operation", "script"); - jo2.put("id", pointCode + "OUTGET"); - jo2.put("script_name", "userpy/interact.py"); - JSONObject script_args2 = new JSONObject(); - script_args2.put("addr", addr); - JSONObject data2 = new JSONObject(); - JSONObject reach2 = new JSONObject(); - reach2.put("task_code", instCode); - reach2.put("address", pointCode + "OUTGET"); - data2.put("reach", reach2); - script_args2.put("data", data2); - script_args2.put("protocol", "HTTP"); - jo2.put("script_args", script_args2); - ja.add(jo2); + JSONObject jo2 = new JSONObject(); + jo2.put("blockId", IdUtil.simpleUUID()); + jo2.put("location", pointCode + "OUTGET"); + jo2.put("operation", "script"); + jo2.put("id", pointCode + "OUTGET"); + jo2.put("script_name", "userpy/interact.py"); + JSONObject script_args2 = new JSONObject(); + script_args2.put("addr", addr); + JSONObject data2 = new JSONObject(); + JSONObject reach2 = new JSONObject(); + reach2.put("task_code", instCode); + reach2.put("address", pointCode + "OUTGET"); + data2.put("reach", reach2); + script_args2.put("data", data2); + script_args2.put("protocol", "HTTP"); + jo2.put("script_args", script_args2); + ja.add(jo2); + } } /** * 下发放货信号 * * @param ja - * @param device_code 起始设备 - * @param instCode 指令号 - * @param pointCode 终点点位 - * @param nextDeviceCode 终点设备 + * @param device_code 起始设备 + * @param instCode 指令号 + * @param pointCode 终点点位 + * @param nextDeviceCode 终点设备 + * @param agv_action_type */ - public void sendEndDeviceOrder(JSONArray ja, String device_code, String instCode, String pointCode, String nextDeviceCode) { + public void sendEndDeviceOrder(JSONArray ja, String device_code, String instCode, String pointCode, String nextDeviceCode, Integer agv_action_type) { Device nextDevice = deviceAppService.findDeviceByCode(nextDeviceCode); + if (!AgvActionTypeEnum.IN_STOCK.getCode().equals(agv_action_type)) { + //放货前等待 + JSONObject jo3 = new JSONObject(); + jo3.put("blockId", IdUtil.simpleUUID()); + jo3.put("location", pointCode + "INPUT"); + jo3.put("operation", "script"); + jo3.put("id", pointCode + "INPUT"); + jo3.put("script_name", "userpy/interact.py"); + JSONObject script_args3 = new JSONObject(); + script_args3.put("addr", addr); + JSONObject data3 = new JSONObject(); + JSONObject reach3 = new JSONObject(); + reach3.put("task_code", instCode); + reach3.put("address", pointCode + "INPUT"); + data3.put("reach", reach3); + script_args3.put("data", data3); + script_args3.put("protocol", "HTTP"); + jo3.put("script_args", script_args3); + ja.add(jo3); - //放货前等待 - JSONObject jo3 = new JSONObject(); - jo3.put("blockId", IdUtil.simpleUUID()); - jo3.put("location", pointCode + "INPUT"); - jo3.put("operation", "script"); - jo3.put("id", pointCode + "INPUT"); - jo3.put("script_name", "userpy/interact.py"); - JSONObject script_args3 = new JSONObject(); - script_args3.put("addr", addr); - JSONObject data3 = new JSONObject(); - JSONObject reach3 = new JSONObject(); - reach3.put("task_code", instCode); - reach3.put("address", pointCode + "INPUT"); - data3.put("reach", reach3); - script_args3.put("data", data3); - script_args3.put("protocol", "HTTP"); - jo3.put("script_args", script_args3); - ja.add(jo3); + if (AgvActionTypeEnum.ORDINARY.getCode().equals(agv_action_type)) { + //将货物放下 + com.alibaba.fastjson.JSONObject jo4 = new com.alibaba.fastjson.JSONObject(); + jo4.put("blockId", IdUtil.simpleUUID()); + jo4.put("location", pointCode); + jo4.put("operation", "JackUnload"); + ja.add(jo4); - //放货前下发旋转角度 - /*JSONObject json1 = new JSONObject(); - AcsPointAngle acsPointAngleDto = acsPointAngleService.findByCode(device_code, nextDeviceCode); - if (ObjectUtil.isNotEmpty(acsPointAngleDto)) { - log.info("acsPointAngleDto----參數,{}", acsPointAngleDto.toString()); - com.alibaba.fastjson.JSONObject operation_args = new com.alibaba.fastjson.JSONObject(); - BigDecimal next_point_angle = acsPointAngleDto.getNext_point_angle(); - operation_args.put("increase_spin_angle", next_point_angle);//弧度值,如3.14 - operation_args.put("skill_name", "GoByOdometer"); - json1.put("blockId", IdUtil.simpleUUID()); - json1.put("location", pointCode + "INPUT"); - json1.put("operation_args", operation_args); - ja.add(json1); - }*/ - - //将货物放下 - com.alibaba.fastjson.JSONObject jo4 = new com.alibaba.fastjson.JSONObject(); - jo4.put("blockId", IdUtil.simpleUUID()); - jo4.put("location", pointCode); - jo4.put("operation", "JackUnload"); - ja.add(jo4); - - - //放货完成等待 - com.alibaba.fastjson.JSONObject jo5 = new com.alibaba.fastjson.JSONObject(); - jo5.put("blockId", IdUtil.simpleUUID()); - jo5.put("location", pointCode + "OUTPUT"); - jo5.put("operation", "script"); - jo5.put("id", pointCode + "OUTPUT"); - jo5.put("script_name", "userpy/interact.py"); - com.alibaba.fastjson.JSONObject script_args5 = new com.alibaba.fastjson.JSONObject(); - script_args5.put("addr", addr); - com.alibaba.fastjson.JSONObject data5 = new com.alibaba.fastjson.JSONObject(); - com.alibaba.fastjson.JSONObject reach5 = new com.alibaba.fastjson.JSONObject(); - reach5.put("task_code", instCode); - reach5.put("address", pointCode + "OUTPUT"); - data5.put("reach", reach5); - script_args5.put("data", data5); - script_args5.put("protocol", "HTTP"); - jo5.put("script_args", script_args5); - ja.add(jo5); + //放货完成等待 + com.alibaba.fastjson.JSONObject jo5 = new com.alibaba.fastjson.JSONObject(); + jo5.put("blockId", IdUtil.simpleUUID()); + jo5.put("location", pointCode + "OUTPUT"); + jo5.put("operation", "script"); + jo5.put("id", pointCode + "OUTPUT"); + jo5.put("script_name", "userpy/interact.py"); + com.alibaba.fastjson.JSONObject script_args5 = new com.alibaba.fastjson.JSONObject(); + script_args5.put("addr", addr); + com.alibaba.fastjson.JSONObject data5 = new com.alibaba.fastjson.JSONObject(); + com.alibaba.fastjson.JSONObject reach5 = new com.alibaba.fastjson.JSONObject(); + reach5.put("task_code", instCode); + reach5.put("address", pointCode + "OUTPUT"); + data5.put("reach", reach5); + script_args5.put("data", data5); + script_args5.put("protocol", "HTTP"); + jo5.put("script_args", script_args5); + ja.add(jo5); + } + } } @@ -709,14 +696,33 @@ public class XianGongAgvServiceImpl implements XianGongAgvService { throw new BadRequestException("请求失败,地址为空!"); } if (address.contains("IN")) { + String instructionCode = instructionDto.getInstruction_code(); String deviceCodeNow = address.substring(0, address.length() - 5); if (ObjectUtil.isEmpty(deviceAppService.findDeviceByCode(deviceCodeNow))) { throw new BadRequestException("设备号 " + deviceCodeNow + " 不存在!"); } - if (address.contains("GET")) { + if (instructionDto.getAgv_system_type().equals(AgvSystemTypeEnum.One_NDC_System_Type.getIndex())) { + //如果是取货二次分配,取放货二次分配需要重新追加动作块 + if (AgvActionTypeEnum.IN_STOCK.getCode().equals(instructionDto.getAgv_action_type()) || AgvActionTypeEnum.IN_OUT_STOCK.getCode().equals(instructionDto.getAgv_action_type())) { + Integer actionType = ActionTypeEnum.IN_STOCK.getCode(); + deviceCodeNow = applyXGAgvTask(instructionCode, actionType, instructionDto); + } + } else if (instructionDto.getAgv_system_type().equals(AgvSystemTypeEnum.XG_System_Type.getIndex())) { + + } return agvWaitUtil.waitInGet(deviceCodeNow, instructionDto); } else if (address.contains("PUT")) { + if (instructionDto.getAgv_system_type().equals(AgvSystemTypeEnum.One_NDC_System_Type.getIndex())) { + //如果是放货二次分配,取放货二次分配需要重新追加动作块 + if (AgvActionTypeEnum.OUT_STOCK.getCode().equals(instructionDto.getAgv_action_type()) || AgvActionTypeEnum.IN_OUT_STOCK.getCode().equals(instructionDto.getAgv_action_type())) { + Integer actionType = ActionTypeEnum.OUT_STOCK.getCode(); + deviceCodeNow = applyXGAgvTask(instructionCode, actionType, instructionDto); + } + } else if (instructionDto.getAgv_system_type().equals(AgvSystemTypeEnum.XG_System_Type.getIndex())) { + Integer actionType = ActionTypeEnum.OUT_STOCK.getCode(); + deviceCodeNow = applyCCAgvTask(instructionCode, actionType, instructionDto); + } return agvWaitUtil.waitInPut(deviceCodeNow, instructionDto); } } @@ -736,6 +742,102 @@ public class XianGongAgvServiceImpl implements XianGongAgvService { throw new BadRequestException("请求失败,IN OUT 站点错误!"); } + private String applyCCAgvTask(String instructionCode, Integer actionType, Instruction instructionDto) { + try { + JSONObject param = new JSONObject(); + param.put("taskCode", instructionCode); + param.put("actionType", actionType.toString()); + LuceneLogDto logDto = LuceneLogDto.builder() + .device_code("追加动叉车作块:") + .content("追加动叉车作块,参数:" + instructionCode + "--" + actionType) + .build(); + logDto.setLog_level(4); + luceneExecuteLogService.deviceExecuteLog(logDto); + String response = acsToWmsService.secondaryAllocationPoint(param); + JSONObject jo = JSON.parseObject(response); + if (jo.getInteger("status") == 200) { + LuceneLogDto logDto2 = LuceneLogDto.builder() + .device_code("追加动叉车作块:") + .content("追加动叉车作块,参数,接口返回:" + jo) + .build(); + logDto2.setLog_level(4); + luceneExecuteLogService.deviceExecuteLog(logDto2); + //请求成功调用叉车追加动作块 + sendAddSequencesToCCAgv(instructionCode, jo.getString("data"), instructionDto); + return jo.getString("data"); + + } else { + LuceneLogDto logDto2 = LuceneLogDto.builder() + .device_code("追加动叉车作块:") + .content("追加动叉车作块失败,返回参数:" + jo.getString("body")) + .build(); + logDto2.setLog_level(4); + luceneExecuteLogService.deviceExecuteLog(logDto2); + throw new BadRequestException("追加动叉车作块返回失败"); + } + } catch (Exception e) { + e.printStackTrace(); + } + + return null; + + } + + private void sendAddSequencesToCCAgv(String instructionCode, String nextPoint, Instruction instructionDto) { + com.alibaba.fastjson.JSONObject jo = new com.alibaba.fastjson.JSONObject(); + jo.put("id", instructionCode); + //动作块 + jo.put("blocks", createBlocksDataTowCCStart(nextPoint)); + + LuceneLogDto logDto = LuceneLogDto.builder() + .device_code("追加诺宝运单") + .content("指令号:" + instructionCode + ",追加诺宝运单参数:" + jo) + .build(); + logDto.setLog_level(4); + luceneExecuteLogService.deviceExecuteLog(logDto); + log.info("任务号:{},指令号{},追加诺宝运单:{}", instructionCode, instructionCode, jo); + + if (StrUtil.equals(paramService.findByCode(AcsConfig.FORKAGV).getValue(), CommonFinalParam.ONE)) { + String agvurl = paramService.findByCode(AcsConfig.AGVURL).getValue(); + String agvport = paramService.findByCode(AcsConfig.AGVPORT).getValue(); + + agvurl = agvurl + ":" + agvport + "/addBlocks"; + + log.info(agvurl); + HttpResponse result = HttpRequest.post(agvurl) + //表单内容 + .body(String.valueOf(jo)) + //超时,毫秒 + .timeout(20000) + .execute(); + LuceneLogDto logDto1 = LuceneLogDto.builder() + .device_code("叉车运单响应") + .content("指令号:" + instructionCode + ",下发追加诺宝运单反馈参数:" + jo) + .build(); + logDto.setLog_level(4); + luceneExecuteLogService.deviceExecuteLog(logDto1); + log.info("指令号{},状态{},下发追加诺宝运单序列反馈:{}", instructionCode, result.getStatus(), result.body()); + + } + + } + + private Object createBlocksDataTowCCStart(String nextPoint) { + JSONArray ja = new JSONArray(); + JSONObject jo9 = new JSONObject(); + jo9.put("blockId", IdUtil.simpleUUID()); + jo9.put("location", nextPoint); + jo9.put("binTask", "ForkUnload"); + ja.add(jo9); + + JSONObject jo10 = new JSONObject(); + jo10.put("blockId", IdUtil.simpleUUID()); + jo10.put("location", nextPoint + "OUTPUT"); + jo10.put("binTask", "OutForkHeight"); + ja.add(jo10); + return ja; + } + @Override public HttpResponse getRobotInfo(String robotCode) { if (StrUtil.equals(paramService.findByCode(AcsConfig.FORKAGV).getValue(), "1")) { @@ -754,14 +856,61 @@ public class XianGongAgvServiceImpl implements XianGongAgvService { } } + private String applyXGAgvTask(String instructionCode, Integer actionType, Instruction instructionDto) { + try { + JSONObject param = new JSONObject(); + param.put("taskCode", instructionCode); + param.put("actionType", actionType.toString()); + LuceneLogDto logDto = LuceneLogDto.builder() + .device_code("追加动诺宝作块:") + .content("追加动诺宝作块,参数:" + instructionCode + "--" + actionType) + .build(); + logDto.setLog_level(4); + luceneExecuteLogService.deviceExecuteLog(logDto); + String response = acsToWmsService.secondaryAllocationPoint(param); + JSONObject jo = JSON.parseObject(response); + if (jo.getInteger("status") == 200) { + LuceneLogDto logDto2 = LuceneLogDto.builder() + .device_code("追加动诺宝作块:") + .content("追加动诺宝作块,参数,接口返回:" + jo) + .build(); + logDto2.setLog_level(4); + luceneExecuteLogService.deviceExecuteLog(logDto2); + if (!ActionTypeEnum.IN_FINISHING.getCode().equals(actionType)) { + //请求成功调用诺宝追加动作块 + sendAddSequencesToNBAgv(instructionCode, jo.getString("data"), instructionDto); + } + return jo.getString("data"); + + } else { + LuceneLogDto logDto2 = LuceneLogDto.builder() + .device_code("追加动诺宝作块:") + .content("追加动诺宝作块失败,返回参数:" + jo.getString("body")) + .build(); + logDto2.setLog_level(4); + luceneExecuteLogService.deviceExecuteLog(logDto2); + throw new BadRequestException("追加动诺宝作块返回失败"); + } + } catch (Exception e) { + e.printStackTrace(); + } + + return null; + } + + @Override public HttpResponse sendOrderSequencesToForklift(Instruction inst, InteractionJsonDTO interactionJsonDTO) { com.alibaba.fastjson.JSONObject jo = new com.alibaba.fastjson.JSONObject(); jo.put("id", inst.getInstruction_code()); //运单封口,true=创建运单之后不可添加动作块;false=创建运单可以添加动作块 - jo.put("complete", true); - //动作块 - jo.put("blocks", createBlocksForklift(inst,interactionJsonDTO)); + //运单封口,true=创建运单之后不可添加动作块;false=创建运单可以添加动作块 + if (AgvActionTypeEnum.ORDINARY.getCode().equals(inst.getAgv_action_type())) { + jo.put("complete", true); + } else { + jo.put("complete", false); + } //动作块 + jo.put("blocks", createBlocksForklift(inst, interactionJsonDTO)); //运单优先级 jo.put("priority", inst.getPriority()); LuceneLogDto logDto = LuceneLogDto.builder() @@ -799,6 +948,184 @@ public class XianGongAgvServiceImpl implements XianGongAgvService { } } + + /** + * 追加动作块 + * + * @param + * @param instructionCode + * @param instructionDto + * @return + */ + private void sendAddSequencesToNBAgv(String instructionCode, String point, Instruction instructionDto) { + com.alibaba.fastjson.JSONObject jo = new com.alibaba.fastjson.JSONObject(); + jo.put("id", instructionCode); + //动作块 + if (AgvActionTypeEnum.IN_STOCK.getCode().equals(instructionDto.getAgv_action_type()) || AgvActionTypeEnum.IN_OUT_STOCK.getCode().equals(instructionDto.getAgv_action_type())) { + jo.put("blocks", createBlocksDataTowStart(instructionCode, point, instructionDto)); + } + if (AgvActionTypeEnum.OUT_STOCK.getCode().equals(instructionDto.getAgv_action_type()) || AgvActionTypeEnum.IN_OUT_STOCK.getCode().equals(instructionDto.getAgv_action_type())) { + jo.put("blocks", createBlocksDataTowEnd(instructionCode, point, instructionDto)); + } + LuceneLogDto logDto = LuceneLogDto.builder() + .device_code("追加诺宝运单") + .content("指令号:" + instructionCode + ",追加诺宝运单参数:" + jo) + .build(); + logDto.setLog_level(4); + luceneExecuteLogService.deviceExecuteLog(logDto); + log.info("任务号:{},指令号{},追加诺宝运单:{}", instructionCode, point, jo); + + if (StrUtil.equals(paramService.findByCode(AcsConfig.FORKAGV).getValue(), CommonFinalParam.ONE)) { + String agvurl = paramService.findByCode(AcsConfig.AGVURL).getValue(); + String agvport = paramService.findByCode(AcsConfig.AGVPORT).getValue(); + + agvurl = agvurl + ":" + agvport + "/addBlocks"; + + log.info(agvurl); + HttpResponse result = HttpRequest.post(agvurl) + //表单内容 + .body(String.valueOf(jo)) + //超时,毫秒 + .timeout(20000) + .execute(); + LuceneLogDto logDto1 = LuceneLogDto.builder() + .device_code("叉车运单响应") + .content("指令号:" + instructionCode + ",下发追加诺宝运单反馈参数:" + jo) + .build(); + logDto.setLog_level(4); + luceneExecuteLogService.deviceExecuteLog(logDto1); + log.info("指令号{},状态{},下发追加诺宝运单序列反馈:{}", instructionCode, result.getStatus(), result.body()); + + } + } + + private Object createBlocksDataTowEnd(String instructionCode, String point, Instruction instructionDto) { + JSONArray ja = new JSONArray(); + String nextDeviceCode = instructionDto.getNext_device_code(); + //终点2 + sendEndDeviceOrder3(ja, nextDeviceCode, instructionCode, instructionDto); + return ja; + + } + + private void sendEndDeviceOrder3(JSONArray ja, String nextDeviceCode, String instructionCode, Instruction instructionDto) { + //将货物放下 + com.alibaba.fastjson.JSONObject jo4 = new com.alibaba.fastjson.JSONObject(); + jo4.put("blockId", IdUtil.simpleUUID()); + jo4.put("location", nextDeviceCode); + jo4.put("operation", "JackUnload"); + ja.add(jo4); + //放货完成等待 + com.alibaba.fastjson.JSONObject jo5 = new com.alibaba.fastjson.JSONObject(); + jo5.put("blockId", IdUtil.simpleUUID()); + jo5.put("location", nextDeviceCode + "OUTPUT"); + jo5.put("operation", "script"); + jo5.put("id", nextDeviceCode + "OUTPUT"); + jo5.put("script_name", "userpy/interact.py"); + com.alibaba.fastjson.JSONObject script_args5 = new com.alibaba.fastjson.JSONObject(); + script_args5.put("addr", addr); + com.alibaba.fastjson.JSONObject data5 = new com.alibaba.fastjson.JSONObject(); + com.alibaba.fastjson.JSONObject reach5 = new com.alibaba.fastjson.JSONObject(); + reach5.put("task_code", instructionCode); + reach5.put("address", nextDeviceCode + "OUTPUT"); + data5.put("reach", reach5); + script_args5.put("data", data5); + script_args5.put("protocol", "HTTP"); + jo5.put("script_args", script_args5); + ja.add(jo5); + + } + + + private Object createBlocksDataTowStart(String instructionCode, String startPoint, Instruction instructionDto) { + JSONArray ja = new JSONArray(); + String nextDeviceCode = instructionDto.getNext_device_code(); + //起点2 + sendStartDeviceOrder2(ja, startPoint, instructionCode); + //终点2 + sendEndDeviceOrder2(ja, nextDeviceCode, instructionCode, instructionDto); + return ja; + + } + + private void sendEndDeviceOrder2(JSONArray ja, String nextDeviceCode, String instructionCode, Instruction instructionDto) { + //放货前等待 + JSONObject jo3 = new JSONObject(); + jo3.put("blockId", IdUtil.simpleUUID()); + jo3.put("location", nextDeviceCode + "INPUT"); + jo3.put("operation", "script"); + jo3.put("id", nextDeviceCode + "INPUT"); + jo3.put("script_name", "userpy/interact.py"); + JSONObject script_args3 = new JSONObject(); + script_args3.put("addr", addr); + JSONObject data3 = new JSONObject(); + JSONObject reach3 = new JSONObject(); + reach3.put("task_code", instructionCode); + reach3.put("address", nextDeviceCode + "INPUT"); + data3.put("reach", reach3); + script_args3.put("data", data3); + script_args3.put("protocol", "HTTP"); + jo3.put("script_args", script_args3); + ja.add(jo3); + if (AgvActionTypeEnum.IN_STOCK.getCode().equals(instructionDto.getAgv_action_type())) { + //将货物放下 + com.alibaba.fastjson.JSONObject jo4 = new com.alibaba.fastjson.JSONObject(); + jo4.put("blockId", IdUtil.simpleUUID()); + jo4.put("location", nextDeviceCode); + jo4.put("operation", "JackUnload"); + ja.add(jo4); + //放货完成等待 + com.alibaba.fastjson.JSONObject jo5 = new com.alibaba.fastjson.JSONObject(); + jo5.put("blockId", IdUtil.simpleUUID()); + jo5.put("location", nextDeviceCode + "OUTPUT"); + jo5.put("operation", "script"); + jo5.put("id", nextDeviceCode + "OUTPUT"); + jo5.put("script_name", "userpy/interact.py"); + com.alibaba.fastjson.JSONObject script_args5 = new com.alibaba.fastjson.JSONObject(); + script_args5.put("addr", addr); + com.alibaba.fastjson.JSONObject data5 = new com.alibaba.fastjson.JSONObject(); + com.alibaba.fastjson.JSONObject reach5 = new com.alibaba.fastjson.JSONObject(); + reach5.put("task_code", instructionCode); + reach5.put("address", nextDeviceCode + "OUTPUT"); + data5.put("reach", reach5); + script_args5.put("data", data5); + script_args5.put("protocol", "HTTP"); + jo5.put("script_args", script_args5); + ja.add(jo5); + } + } + + private void sendStartDeviceOrder2(JSONArray ja, String startPoint, String instructionCode) { + //将货物顶起来,机器识别提升高度 + JSONObject jo1 = new JSONObject(); + jo1.put("blockId", IdUtil.simpleUUID()); + jo1.put("location", startPoint); + jo1.put("operation", "JackLoad"); + jo1.put("operationArgs", new JSONObject() {{ + put("recognize", true); + }}); + ja.add(jo1); + + + JSONObject jo2 = new JSONObject(); + jo2.put("blockId", IdUtil.simpleUUID()); + jo2.put("location", startPoint + "OUTGET"); + jo2.put("operation", "script"); + jo2.put("id", startPoint + "OUTGET"); + jo2.put("script_name", "userpy/interact.py"); + JSONObject script_args2 = new JSONObject(); + script_args2.put("addr", addr); + JSONObject data2 = new JSONObject(); + JSONObject reach2 = new JSONObject(); + reach2.put("task_code", instructionCode); + reach2.put("address", startPoint + "OUTGET"); + data2.put("reach", reach2); + script_args2.put("data", data2); + script_args2.put("protocol", "HTTP"); + jo2.put("script_args", script_args2); + ja.add(jo2); + } + /** * 叉车运单动作块 * @@ -813,7 +1140,6 @@ public class XianGongAgvServiceImpl implements XianGongAgvService { String pointCode = inst.getStart_point_code(); - //取货前等待 JSONObject jo = new JSONObject(); //动作块id @@ -838,100 +1164,208 @@ public class XianGongAgvServiceImpl implements XianGongAgvService { jo.put("script_args", script_args); ja.add(jo); + if (AgvActionTypeEnum.ORDINARY.getCode().equals(inst.getAgv_action_type())) { + // to do + JSONObject jo1 = new JSONObject(); + jo1.put("blockId", IdUtil.simpleUUID()); + jo1.put("location", inst.getStart_point_code() + "INGET"); + jo1.put("binTask", "InForkHeight"); + ja.add(jo1); - JSONObject jo1 = new JSONObject(); - jo1.put("blockId", IdUtil.simpleUUID()); - jo1.put("location", inst.getStart_point_code()+ "INGET"); - jo1.put("binTask", "InForkHeight"); - ja.add(jo1); + JSONObject jo3 = new JSONObject(); + //动作块id + jo3.put("blockId", IdUtil.simpleUUID()); + //目的地名称 + jo3.put("location", pointCode + "INGET"); + jo3.put("id", pointCode + "INGET"); + //执行脚本 + jo3.put("operation", "expand"); + //通信脚本,动作前后与现场设备交互的场景 + jo3.put("script_name", "Fork-expand.py"); + JSONObject script_args2 = new JSONObject(); + if (ObjectUtil.isNotEmpty(interactionJsonDTO.getExpandWidthLength())) { + script_args2.put("expandWidth", interactionJsonDTO.getExpandWidthLength()); + } + script_args2.put("operation", "expand"); + jo3.put("script_args", script_args2); + ja.add(jo3); + + JSONObject jo4 = new JSONObject(); + //动作块id + jo4.put("blockId", IdUtil.simpleUUID()); + //目的地名称 + jo4.put("location", pointCode + "INGET"); + jo4.put("id", pointCode + "INGET"); + //执行脚本 + jo4.put("operation", "stretch"); + //通信脚本,动作前后与现场设备交互的场景 + jo4.put("script_name", "Fork-expand.py"); + JSONObject script_args1 = new JSONObject(); + if (ObjectUtil.isNotEmpty(interactionJsonDTO.getExpandWidthLength())) { + script_args1.put("stretchLength", interactionJsonDTO.getExpandWidthLength()); + } + script_args1.put("operation", "stretch"); + jo4.put("script_args", script_args1); + ja.add(jo4); + + JSONObject jo6 = new JSONObject(); + jo6.put("blockId", IdUtil.simpleUUID()); + jo6.put("location", inst.getStart_point_code()); + jo6.put("binTask", "Script"); + ja.add(jo6); + + JSONObject jo7 = new JSONObject(); + jo7.put("blockId", IdUtil.simpleUUID()); + jo7.put("location", inst.getStart_point_code()); + jo7.put("binTask", "ForkLoad"); + ja.add(jo7); + + //取货完成 + JSONObject jo2 = new JSONObject(); + jo2.put("blockId", IdUtil.simpleUUID()); + jo2.put("location", pointCode + "OUTGET"); + jo2.put("operation", "script"); + jo2.put("id", pointCode + "OUTGET"); + jo2.put("script_name", "userpy/interact.py"); + JSONObject script_args4 = new JSONObject(); + script_args4.put("addr", addr); + JSONObject data2 = new JSONObject(); + JSONObject reach2 = new JSONObject(); + reach2.put("task_code", inst.getInstruction_code()); + reach2.put("address", pointCode + "OUTGET"); + data2.put("reach", reach2); + script_args4.put("data", data2); + script_args4.put("protocol", "HTTP"); + jo2.put("script_args", script_args4); + ja.add(jo2); + + + //ForkUnload(货叉卸载货物,会将叉车的状态变成非载货中) + JSONObject jo8 = new JSONObject(); + jo8.put("blockId", IdUtil.simpleUUID()); + jo8.put("location", inst.getStart_point_code() + "OUTGET"); + jo8.put("binTask", "OutForkHeight"); + ja.add(jo8); + + JSONObject jo9 = new JSONObject(); + jo9.put("blockId", IdUtil.simpleUUID()); + jo9.put("location", inst.getNext_point_code()); + jo9.put("binTask", "ForkUnload"); + ja.add(jo9); + + JSONObject jo10 = new JSONObject(); + jo10.put("blockId", IdUtil.simpleUUID()); + jo10.put("location", inst.getNext_point_code() + "OUTPUT"); + jo10.put("binTask", "OutForkHeight"); + ja.add(jo10); + + } else if (AgvActionTypeEnum.IN_STOCK.getCode().equals(inst.getAgv_action_type())) { + + } else if (AgvActionTypeEnum.OUT_STOCK.getCode().equals(inst.getAgv_action_type())) { + // to do + JSONObject jo1 = new JSONObject(); + jo1.put("blockId", IdUtil.simpleUUID()); + jo1.put("location", inst.getStart_point_code() + "INGET"); + jo1.put("binTask", "InForkHeight"); + ja.add(jo1); + + JSONObject jo3 = new JSONObject(); + //动作块id + jo3.put("blockId", IdUtil.simpleUUID()); + //目的地名称 + jo3.put("location", pointCode + "INGET"); + jo3.put("id", pointCode + "INGET"); + //执行脚本 + jo3.put("operation", "expand"); + //通信脚本,动作前后与现场设备交互的场景 + jo3.put("script_name", "Fork-expand.py"); + JSONObject script_args2 = new JSONObject(); + if (ObjectUtil.isNotEmpty(interactionJsonDTO.getExpandWidthLength())) { + script_args2.put("expandWidth", interactionJsonDTO.getExpandWidthLength()); + } + script_args2.put("operation", "expand"); + jo3.put("script_args", script_args2); + ja.add(jo3); + + JSONObject jo4 = new JSONObject(); + //动作块id + jo4.put("blockId", IdUtil.simpleUUID()); + //目的地名称 + jo4.put("location", pointCode + "INGET"); + jo4.put("id", pointCode + "INGET"); + //执行脚本 + jo4.put("operation", "stretch"); + //通信脚本,动作前后与现场设备交互的场景 + jo4.put("script_name", "Fork-expand.py"); + JSONObject script_args1 = new JSONObject(); + if (ObjectUtil.isNotEmpty(interactionJsonDTO.getExpandWidthLength())) { + script_args1.put("stretchLength", interactionJsonDTO.getExpandWidthLength()); + } + script_args1.put("operation", "stretch"); + jo4.put("script_args", script_args1); + ja.add(jo4); + + JSONObject jo6 = new JSONObject(); + jo6.put("blockId", IdUtil.simpleUUID()); + jo6.put("location", inst.getStart_point_code()); + jo6.put("binTask", "Script"); + ja.add(jo6); + + JSONObject jo7 = new JSONObject(); + jo7.put("blockId", IdUtil.simpleUUID()); + jo7.put("location", inst.getStart_point_code()); + jo7.put("binTask", "ForkLoad"); + ja.add(jo7); + + //取货完成 + JSONObject jo2 = new JSONObject(); + jo2.put("blockId", IdUtil.simpleUUID()); + jo2.put("location", pointCode + "OUTGET"); + jo2.put("operation", "script"); + jo2.put("id", pointCode + "OUTGET"); + jo2.put("script_name", "userpy/interact.py"); + JSONObject script_args4 = new JSONObject(); + script_args4.put("addr", addr); + JSONObject data2 = new JSONObject(); + JSONObject reach2 = new JSONObject(); + reach2.put("task_code", inst.getInstruction_code()); + reach2.put("address", pointCode + "OUTGET"); + data2.put("reach", reach2); + script_args4.put("data", data2); + script_args4.put("protocol", "HTTP"); + jo2.put("script_args", script_args4); + ja.add(jo2); + + + //ForkUnload(货叉卸载货物,会将叉车的状态变成非载货中) + JSONObject jo8 = new JSONObject(); + jo8.put("blockId", IdUtil.simpleUUID()); + jo8.put("location", inst.getStart_point_code() + "OUTGET"); + jo8.put("binTask", "OutForkHeight"); + ja.add(jo8); + + JSONObject jo9 = new JSONObject(); + jo9.put("blockId", IdUtil.simpleUUID()); + jo9.put("location", pointCode + "INPUT"); + jo9.put("operation", "script"); + jo9.put("id", pointCode + "INPUT"); + jo9.put("script_name", "userpy/interact.py"); + JSONObject script_args5 = new JSONObject(); + script_args5.put("addr", addr); + JSONObject data3 = new JSONObject(); + JSONObject reach3 = new JSONObject(); + reach3.put("task_code", inst.getInstruction_code()); + reach3.put("address", pointCode + "INPUT"); + data3.put("reach", reach3); + script_args5.put("data", data3); + script_args5.put("protocol", "HTTP"); + jo9.put("script_args", script_args5); + ja.add(jo9); + + } else if (AgvActionTypeEnum.IN_STOCK.getCode().equals(inst.getAgv_action_type())) { - JSONObject jo3 = new JSONObject(); - //动作块id - jo3.put("blockId", IdUtil.simpleUUID()); - //目的地名称 - jo3.put("location", pointCode + "INGET"); - jo3.put("id", pointCode + "INGET"); - //执行脚本 - jo3.put("operation", "expand"); - //通信脚本,动作前后与现场设备交互的场景 - jo3.put("script_name", "Fork-expand.py"); - JSONObject script_args2 = new JSONObject(); - if (ObjectUtil.isNotEmpty(interactionJsonDTO.getExpandWidthLength())) { - script_args2.put("expandWidth",interactionJsonDTO.getExpandWidthLength()); } - script_args2.put("operation", "expand"); - jo3.put("script_args", script_args2); - ja.add(jo3); - JSONObject jo4 = new JSONObject(); - //动作块id - jo4.put("blockId", IdUtil.simpleUUID()); - //目的地名称 - jo4.put("location", pointCode + "INGET"); - jo4.put("id", pointCode + "INGET"); - //执行脚本 - jo4.put("operation", "stretch"); - //通信脚本,动作前后与现场设备交互的场景 - jo4.put("script_name", "Fork-expand.py"); - JSONObject script_args1 = new JSONObject(); - if (ObjectUtil.isNotEmpty(interactionJsonDTO.getExpandWidthLength())) { - script_args2.put("stretchLength",interactionJsonDTO.getExpandWidthLength()); - } - script_args1.put("operation", "stretch"); - jo4.put("script_args", script_args1); - ja.add(jo4); - - JSONObject jo6 = new JSONObject(); - jo6.put("blockId", IdUtil.simpleUUID()); - jo6.put("location", inst.getStart_point_code()); - jo6.put("binTask", "Script"); - ja.add(jo6); - - JSONObject jo7 = new JSONObject(); - jo7.put("blockId", IdUtil.simpleUUID()); - jo7.put("location", inst.getStart_point_code()); - jo7.put("binTask", "ForkLoad"); - ja.add(jo7); - - //取货完成 - JSONObject jo2 = new JSONObject(); - jo2.put("blockId", IdUtil.simpleUUID()); - jo2.put("location", pointCode + "OUTGET"); - jo2.put("operation", "script"); - jo2.put("id", pointCode + "OUTGET"); - jo2.put("script_name", "userpy/interact.py"); - JSONObject script_args4 = new JSONObject(); - script_args4.put("addr", addr); - JSONObject data2 = new JSONObject(); - JSONObject reach2 = new JSONObject(); - reach2.put("task_code", inst.getInstruction_code()); - reach2.put("address", pointCode + "OUTGET"); - data2.put("reach", reach2); - script_args4.put("data", data2); - script_args4.put("protocol", "HTTP"); - jo2.put("script_args", script_args4); - ja.add(jo2); - - - - //ForkUnload(货叉卸载货物,会将叉车的状态变成非载货中) - JSONObject jo8 = new JSONObject(); - jo8.put("blockId", IdUtil.simpleUUID()); - jo8.put("location", inst.getStart_point_code()+"OUTGET"); - jo8.put("binTask", "OutForkHeight"); - ja.add(jo8); - - JSONObject jo9 = new JSONObject(); - jo9.put("blockId", IdUtil.simpleUUID()); - jo9.put("location", inst.getNext_point_code()); - jo9.put("binTask", "ForkUnload"); - ja.add(jo9); - - JSONObject jo10 = new JSONObject(); - jo10.put("blockId", IdUtil.simpleUUID()); - jo10.put("location", inst.getNext_point_code()+"OUTPUT"); - jo10.put("binTask", "OutForkHeight"); - ja.add(jo10); return ja; } diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device/service/impl/DeviceServiceImpl.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device/service/impl/DeviceServiceImpl.java index dea3e883d..a9adea9fa 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device/service/impl/DeviceServiceImpl.java +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device/service/impl/DeviceServiceImpl.java @@ -230,6 +230,7 @@ public class DeviceServiceImpl extends CommonServiceImpl i LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); wrapper.eq(StringUtils.isNotBlank((String) whereJson.get("device_type")), Device::getDevice_type, whereJson.get("device_type")); wrapper.eq(StringUtils.isNotBlank((String) whereJson.get("region")), Device::getRegion, whereJson.get("region")); + wrapper.eq(StringUtils.isNotBlank((String) whereJson.get("is_config")), Device::getIs_config, whereJson.get("is_config")); wrapper.nested(StringUtils.isNotBlank((String) whereJson.get("blurry")), i -> i.like(Device::getDevice_code, whereJson.get("blurry")).or().like(Device::getDevice_name, whereJson.get("blurry"))); wrapper.orderByAsc(Device::getIs_config).orderByDesc(Device::getSeq_num).orderByDesc(Device::getUpdate_time); wrapper.orderByDesc(Device::getCreate_time); @@ -926,6 +927,7 @@ public class DeviceServiceImpl extends CommonServiceImpl i String vehicle_code = form.getString("vehicle_code"); String islock = form.getString("islock"); String requireSucess = form.getString("requireSucess"); + String requireActionSucess = form.getString("requireActionSucess"); String fullrequireSucess = form.getString("fullrequireSucess"); if (device_code.indexOf(".") != -1) { device_code = device_code.substring(0, device_code.indexOf(".")); diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/conveyor/belt_conveyor/BeltConveyorDeviceDriver.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/conveyor/belt_conveyor/BeltConveyorDeviceDriver.java index 758217593..04a1f0b95 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/conveyor/belt_conveyor/BeltConveyorDeviceDriver.java +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/conveyor/belt_conveyor/BeltConveyorDeviceDriver.java @@ -263,9 +263,9 @@ public class BeltConveyorDeviceDriver extends AbstractOpcDeviceDriver implements if (mode == 8 && !requireSucess) { if (container_type == 0) { message = "托盘类型为空"; - } + }else { applyEmptyTask(StorageTypeEnum.DISKS_OUT.getType(), mode); - +} } @@ -606,8 +606,8 @@ public class BeltConveyorDeviceDriver extends AbstractOpcDeviceDriver implements if (nextdevice.getDeviceDriver() instanceof BeltConveyorDeviceDriver) { beltConveyorDeviceDriver = (BeltConveyorDeviceDriver) nextdevice.getDeviceDriver(); - Boolean ignorePickupCheck = (Boolean) beltConveyorDeviceDriver.getExtraValue().get("ignore_pickup_check"); - if (!ignorePickupCheck) { + String ignorePickupCheck = (String) beltConveyorDeviceDriver.getExtraValue().get("ignore_pickup_check"); + if ("false".equals(ignorePickupCheck)) { if (beltConveyorDeviceDriver.getMode() != 2 || beltConveyorDeviceDriver.getMove() == 1) { log.error("输送机,{}未联机或执行中", next_device_code); this.setNotCreateInstMessage("universal_notCreateInstMessage4"); @@ -755,7 +755,7 @@ public class BeltConveyorDeviceDriver extends AbstractOpcDeviceDriver implements public void writing(String key, String param) { String to_param = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code() - + "." + param; + + "." + key; //String opcservcerid = this.getDevice().getOpc_server_id(); //Server server = ReadUtil.getServer(opcservcerid); Map itemMap = new HashMap(); diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_conveyor/box_storage_out_conveyor/BoxStorageOutConveyorDeviceDriver.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_conveyor/box_storage_out_conveyor/BoxStorageOutConveyorDeviceDriver.java index d525b6f26..593383cda 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_conveyor/box_storage_out_conveyor/BoxStorageOutConveyorDeviceDriver.java +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_conveyor/box_storage_out_conveyor/BoxStorageOutConveyorDeviceDriver.java @@ -262,11 +262,11 @@ public class BoxStorageOutConveyorDeviceDriver extends AbstractOpcDeviceDriver i case 25: if ( StrUtil.isEmpty(material_barcode)) { message = "子卷码为空"; - } - - //二楼到一楼输送线申请行架任务 - if (move == 1 && !requireSucess) { - applyManipulatorTask(); + }else { + //二楼到一楼输送线申请行架任务 + if (move == 1 && !requireSucess) { + applyManipulatorTask(); + } } break; } diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_conveyor/box_subvolumes_conveyor/BoxSubvolumesConveyorDeviceDriver.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_conveyor/box_subvolumes_conveyor/BoxSubvolumesConveyorDeviceDriver.java index a2808d1ec..6dc8e9a3c 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_conveyor/box_subvolumes_conveyor/BoxSubvolumesConveyorDeviceDriver.java +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_conveyor/box_subvolumes_conveyor/BoxSubvolumesConveyorDeviceDriver.java @@ -234,8 +234,9 @@ public class BoxSubvolumesConveyorDeviceDriver extends AbstractOpcDeviceDriver i if (move == 1 && !requireSucess) { if (StrUtil.isEmpty(material_barcode)) { message = "条码为空"; + }else { + applyAgvTask(); } - applyAgvTask(); } break; diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_conveyor/fold_disc_site/FoldDiscSiteDeviceDriver.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_conveyor/fold_disc_site/FoldDiscSiteDeviceDriver.java index 7765179d2..26a219819 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_conveyor/fold_disc_site/FoldDiscSiteDeviceDriver.java +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_conveyor/fold_disc_site/FoldDiscSiteDeviceDriver.java @@ -210,7 +210,7 @@ public class FoldDiscSiteDeviceDriver extends AbstractOpcDeviceDriver implements } - if (move != last_move && move==0 && last_move==1) { + if (move != last_move && move == 0 && last_move == 1) { requireSucess = false; clearWrite(); } @@ -244,21 +244,21 @@ public class FoldDiscSiteDeviceDriver extends AbstractOpcDeviceDriver implements //申请空托盘入库 if (mode == 9 && move == 1 && !requireSucess) { - if (container_type==0){ + if (container_type == 0) { message = "托盘类型为空"; + } else { + applyEmptyTask(StorageTypeEnum.DISKS_IN.getType(), mode); } - applyEmptyTask(StorageTypeEnum.DISKS_IN.getType(), mode); - } //申请空托盘出库 if (mode == 8 && !requireSucess) { - if (container_type==0){ + if (container_type == 0) { message = "托盘类型为空"; + } else { + applyEmptyTask(StorageTypeEnum.DISKS_OUT.getType(), mode); } - applyEmptyTask(StorageTypeEnum.DISKS_OUT.getType(), mode); - } @@ -315,21 +315,21 @@ public class FoldDiscSiteDeviceDriver extends AbstractOpcDeviceDriver implements List list = new ArrayList<>(); Map map = new HashMap<>(); - map.put("code","to_target"); - map.put("value","0"); + map.put("code", "to_target"); + map.put("value", "0"); list.add(map); Map map2 = new HashMap<>(); - map2.put("code","to_task"); - map2.put("value","0"); + map2.put("code", "to_task"); + map2.put("value", "0"); list.add(map2); Map map4 = new HashMap<>(); - map4.put("code","to_container_type"); - map4.put("value","0"); + map4.put("code", "to_container_type"); + map4.put("value", "0"); list.add(map4); this.writing(list); - message=null; - vehicle_code=null; + message = null; + vehicle_code = null; } diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_conveyor/scanner_weight_conveyor/ConveyorWithScannerWeightDeviceDriver.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_conveyor/scanner_weight_conveyor/ConveyorWithScannerWeightDeviceDriver.java index c43ad8638..8132f0ff5 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_conveyor/scanner_weight_conveyor/ConveyorWithScannerWeightDeviceDriver.java +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_conveyor/scanner_weight_conveyor/ConveyorWithScannerWeightDeviceDriver.java @@ -316,7 +316,7 @@ public class ConveyorWithScannerWeightDeviceDriver extends AbstractOpcDeviceDriv //申请空托盘入库 if (mode == 9 && move == 1 && !requireSucess) { - if (container_type == 0) { + if (container_type == 0 || StrUtil.isEmpty(barcode)) { message = "托盘类型为空"; }else { applyEmptyTask(StorageTypeEnum.DISKS_IN.getType(), mode); @@ -580,6 +580,12 @@ public class ConveyorWithScannerWeightDeviceDriver extends AbstractOpcDeviceDriv JSONObject param = new JSONObject(); param.put("device_code", device_code); param.put("container_type", container_type); + if (StrUtil.isNotEmpty(hand_barcode)) { + param.put("vehicle_code", hand_barcode); + } + if (StrUtil.isNotEmpty(barcode)&&(barcode.startsWith("A")||barcode.startsWith("B"))) { + param.put("vehicle_code", barcode); + } param.put("type", type); LuceneLogDto logDto = LuceneLogDto.builder() .device_code(device_code) diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/two_conveyor/oven_manipulator/OvenGantryManipulatorDeviceDriver.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/two_conveyor/oven_manipulator/OvenGantryManipulatorDeviceDriver.java index 19d635540..2a64e05da 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/two_conveyor/oven_manipulator/OvenGantryManipulatorDeviceDriver.java +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/two_conveyor/oven_manipulator/OvenGantryManipulatorDeviceDriver.java @@ -360,9 +360,11 @@ public class OvenGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver i }*/ if (startdevice.getDeviceDriver() instanceof StandardInspectSiteDeviceDriver) { standardInspectSiteDeviceDriver = (StandardInspectSiteDeviceDriver) startdevice.getDeviceDriver(); - if (standardInspectSiteDeviceDriver.getMove() != 1) { - notCreateInstMessage = "手动创建指令未下发电气信号原因->取货位-烘箱对接位:" + standardInspectSiteDeviceDriver.getDevicecode() + "无货,无法下发指令!指令号:" + instruction.getInstruction_code(); - return false; + if (ObjectUtil.equal("true", standardInspectSiteDeviceDriver.getExtraValue().get("input_move"))) { + if (standardInspectSiteDeviceDriver.getMove() != 1) { + notCreateInstMessage = "手动创建指令未下发电气信号原因->取货位-烘箱对接位:" + standardInspectSiteDeviceDriver.getDevicecode() + "无货,无法下发指令!指令号:" + instruction.getInstruction_code(); + return false; + } } } if (startdevice.getDeviceDriver() instanceof HongXiangConveyorDeviceDriver) { @@ -375,9 +377,11 @@ public class OvenGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver i if (nextdevice.getDeviceDriver() instanceof StandardInspectSiteDeviceDriver) { standardInspectSiteDeviceDriver = (StandardInspectSiteDeviceDriver) nextdevice.getDeviceDriver(); - if (standardInspectSiteDeviceDriver.getMove() != 0) { - notCreateInstMessage = "手动创建指令未下发电气信号原因->放货位-烘箱对接位:" + standardInspectSiteDeviceDriver.getDevicecode() + "有货,无法下发指令!指令号:" + instruction.getInstruction_code(); - return false; + if (ObjectUtil.equal("true", standardInspectSiteDeviceDriver.getExtraValue().get("input_move"))) { + if (standardInspectSiteDeviceDriver.getMove() != 0) { + notCreateInstMessage = "手动创建指令未下发电气信号原因->放货位-烘箱对接位:" + standardInspectSiteDeviceDriver.getDevicecode() + "有货,无法下发指令!指令号:" + instruction.getInstruction_code(); + return false; + } } } if (nextdevice.getDeviceDriver() instanceof HongXiangConveyorDeviceDriver) { @@ -503,9 +507,11 @@ public class OvenGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver i }*/ if (startdevice.getDeviceDriver() instanceof StandardInspectSiteDeviceDriver) { standardInspectSiteDeviceDriver = (StandardInspectSiteDeviceDriver) startdevice.getDeviceDriver(); - if (standardInspectSiteDeviceDriver.getMove() != 1) { - notCreateInstMessage = "就绪任务未创建指令原因->取货位-烘箱对接位:" + standardInspectSiteDeviceDriver.getDevicecode() + "光电无货,无法生成指令!"; - return false; + if (ObjectUtil.equal("true", standardInspectSiteDeviceDriver.getExtraValue().get("input_move"))) { + if (standardInspectSiteDeviceDriver.getMove() != 1) { + notCreateInstMessage = "就绪任务未创建指令原因->取货位-烘箱对接位:" + standardInspectSiteDeviceDriver.getDevicecode() + "光电无货,无法生成指令!"; + return false; + } } } if (startdevice.getDeviceDriver() instanceof HongXiangConveyorDeviceDriver) { @@ -525,9 +531,11 @@ public class OvenGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver i } if (nextdevice.getDeviceDriver() instanceof StandardInspectSiteDeviceDriver) { standardInspectSiteDeviceDriver = (StandardInspectSiteDeviceDriver) nextdevice.getDeviceDriver(); - if (standardInspectSiteDeviceDriver.getMove() != 0) { - notCreateInstMessage = "就绪任务未创建指令原因->放货位-烘箱对接位:" + standardInspectSiteDeviceDriver.getDevicecode() + "光电有货,无法生成指令!"; - return false; + if (ObjectUtil.equal("true", standardInspectSiteDeviceDriver.getExtraValue().get("input_move"))) { + if (standardInspectSiteDeviceDriver.getMove() != 0) { + notCreateInstMessage = "就绪任务未创建指令原因->放货位-烘箱对接位:" + standardInspectSiteDeviceDriver.getDevicecode() + "光电有货,无法生成指令!"; + return false; + } } } @@ -1117,11 +1125,11 @@ public class OvenGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver i action = LangProcess.msg("universal_releasing_completed"); } if (error == 0 && iserror) { - this.setMessage("universal_message11"); + this.setMessage("信号连接异常!"); } - String requireActionSucess = "指令" + LangProcess.msg("universal_actionMessage4"); + String requireActionSucess = LangProcess.msg("universal_directives") + ":" + LangProcess.msg("universal_actionMessage4"); if(this.requireActionSucess){ - requireActionSucess = "指令" + LangProcess.msg("universal_actionMessage5"); + requireActionSucess = LangProcess.msg("universal_directives") + ":" + LangProcess.msg("universal_actionMessage5"); } map.put("device_name", this.getDevice().getDevice_name()); map.put("mode", mode); @@ -1148,11 +1156,17 @@ public class OvenGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver i @Override public void setDeviceStatus(JSONObject data) { String requestSucess = data.getString("requireSucess"); + String requireActionSucess = data.getString("requireActionSucess"); if (StrUtil.equals(requestSucess, "0")) { this.requireSucess = false; } else if (StrUtil.equals(requestSucess, "1")) { this.requireSucess = true; } + if (StrUtil.equals(requireActionSucess, "0")) { + this.requireActionSucess = false; + } else if (StrUtil.equals(requireActionSucess, "1")) { + this.requireActionSucess = true; + } } public void writing(String param, String value) { diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/two_conveyor/pull_head_manipulator/PullHeadManipulatorDeviceDriver.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/two_conveyor/pull_head_manipulator/PullHeadManipulatorDeviceDriver.java index 21019aaed..4ef5de975 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/two_conveyor/pull_head_manipulator/PullHeadManipulatorDeviceDriver.java +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/two_conveyor/pull_head_manipulator/PullHeadManipulatorDeviceDriver.java @@ -224,7 +224,6 @@ public class PullHeadManipulatorDeviceDriver extends AbstractOpcDeviceDriver imp if (inst != null) { if (StrUtil.equals(inst.getInstruction_status(), InstructionStatusEnum.BUSY.getIndex())) { try { - TaskDto dto = taskserver.findByCode(inst.getTask_code()); Map map = new LinkedHashMap<>(); /*if (ObjectUtil.isNotEmpty(dto)){ String interaction_json = dto.getInteraction_json(); @@ -257,11 +256,11 @@ public class PullHeadManipulatorDeviceDriver extends AbstractOpcDeviceDriver imp if (mode == 0) { this.setIsonline(false); - message = LangProcess.msg("universal_off-line"); + message = "universal_off-line"; //有报警 } else if (error != 0) { this.setIserror(true); - message = LangProcess.msg("universal_message3"); + message = "universal_message3"; //无报警 } else { this.setIsonline(true); @@ -337,6 +336,7 @@ public class PullHeadManipulatorDeviceDriver extends AbstractOpcDeviceDriver imp //放货工位 List putDeviceCodeList = this.getExtraDeviceCodes("put_device_code"); TaskDto task = null; + PlugPullDeviceSiteDeviceDriver plugPullDeviceSiteDeviceDriver; for (int i = 0; i < getDeviceCodeList.size(); i++) { String startDeviceCode = getDeviceCodeList.get(i); List taskDtos = taskserver.queryTaskByDeviceCodeAndStatus(startDeviceCode); @@ -344,6 +344,22 @@ public class PullHeadManipulatorDeviceDriver extends AbstractOpcDeviceDriver imp //按照优先级排序 优先级相等按照创建时间排序 taskDtos = this.sortTask(taskDtos); TaskDto taskDto = taskDtos.get(0); + String startPoint = task.getStart_device_code(); + Device startPointDevice = deviceAppService.findDeviceByCode(startPoint); + if (startPointDevice.getDeviceDriver() instanceof PlugPullDeviceSiteDeviceDriver) { + plugPullDeviceSiteDeviceDriver = (PlugPullDeviceSiteDeviceDriver) startPointDevice.getDeviceDriver(); + if (plugPullDeviceSiteDeviceDriver.getAction() != 1&&plugPullDeviceSiteDeviceDriver.getAction() != 3) + notCreateInstMessage = "universal_notCreateInstMessage9"; + return false; + } + String nextDeviceCode = taskDto.getNext_device_code(); + Device device = deviceAppService.findDeviceByCode(nextDeviceCode); + if (device.getDeviceDriver() instanceof PlugPullDeviceSiteDeviceDriver) { + plugPullDeviceSiteDeviceDriver = (PlugPullDeviceSiteDeviceDriver) device.getDeviceDriver(); + if (plugPullDeviceSiteDeviceDriver.getMode() != 2 || plugPullDeviceSiteDeviceDriver.getMove() != 0 || plugPullDeviceSiteDeviceDriver.getAction() != 2&&plugPullDeviceSiteDeviceDriver.getAction() != 3) + notCreateInstMessage = "universal_notCreateInstMessage9"; + return false; + } Instruction instruction = instructionService.findByTaskcode(taskDto.getTask_code()); String startCode = instruction.getStart_device_code(); String nextCode = instruction.getNext_device_code(); @@ -380,12 +396,20 @@ public class PullHeadManipulatorDeviceDriver extends AbstractOpcDeviceDriver imp } } if (!ObjectUtil.isEmpty(task)) { + String startDeviceCode = task.getStart_device_code(); + Device start_device = deviceAppService.findDeviceByCode(startDeviceCode); + if (start_device.getDeviceDriver() instanceof PlugPullDeviceSiteDeviceDriver) { + plugPullDeviceSiteDeviceDriver = (PlugPullDeviceSiteDeviceDriver) start_device.getDeviceDriver(); + if (plugPullDeviceSiteDeviceDriver.getAction() != 1&&plugPullDeviceSiteDeviceDriver.getAction() != 3) + notCreateInstMessage = "universal_notCreateInstMessage9"; + return false; + } String nextDeviceCode = task.getNext_device_code(); - Device device = deviceAppService.findDeviceByCode(nextDeviceCode); - PlugPullDeviceSiteDeviceDriver plugPullDeviceSiteDeviceDriver; - if (device.getDeviceDriver() instanceof PlugPullDeviceSiteDeviceDriver) { - plugPullDeviceSiteDeviceDriver = (PlugPullDeviceSiteDeviceDriver) device.getDeviceDriver(); - if (plugPullDeviceSiteDeviceDriver.getMode() != 2 && plugPullDeviceSiteDeviceDriver.getMove() != 0 && plugPullDeviceSiteDeviceDriver.getAction() != 1) + Device next_device = deviceAppService.findDeviceByCode(nextDeviceCode); + if (next_device.getDeviceDriver() instanceof PlugPullDeviceSiteDeviceDriver) { + plugPullDeviceSiteDeviceDriver = (PlugPullDeviceSiteDeviceDriver) next_device.getDeviceDriver(); + if (plugPullDeviceSiteDeviceDriver.getMode() != 2 || plugPullDeviceSiteDeviceDriver.getMove() != 0 || plugPullDeviceSiteDeviceDriver.getAction() != 2&&plugPullDeviceSiteDeviceDriver.getAction() != 3) + notCreateInstMessage = "universal_notCreateInstMessage9"; return false; } String taskId = task.getTask_id(); @@ -393,11 +417,9 @@ public class PullHeadManipulatorDeviceDriver extends AbstractOpcDeviceDriver imp String vehicleCode = task.getVehicle_code(); String priority = task.getPriority(); String startPointCode = task.getStart_point_code(); - String startDeviceCode = task.getStart_device_code(); String routePlanCode = task.getRoute_plan_code(); String nextPointCode = task.getNext_point_code(); - Instruction instdto = new Instruction(); instdto.setInstruction_id(IdUtil.simpleUUID()); instdto.setRoute_plan_code(routePlanCode); @@ -679,9 +701,9 @@ public class PullHeadManipulatorDeviceDriver extends AbstractOpcDeviceDriver imp map.put("driver_type", "siemens_conveyor"); map.put("is_click", true); map.put("message", message); - map.put("error", ErrorUtil.getDictDetail("error_type", String.valueOf(this.getError()))); - map.put("notCreateTaskMessage", notCreateTaskMessage); - map.put("notCreateInstMessage", notCreateInstMessage); + map.put("notCreateTaskMessage", LangProcess.msg(notCreateTaskMessage)); + map.put("notCreateInstMessage", LangProcess.msg(notCreateInstMessage)); + map.put("error", ErrorUtil.getDictDetail("bqhj_error_type", String.valueOf(this.getError()))); /*jo.put("x", xPosition); jo.put("y", yPosition);*/ JSONObject jo = new JSONObject(map); diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/two_conveyor/pull_tail_manipulator/PullTailManipulatorDeviceDriver.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/two_conveyor/pull_tail_manipulator/PullTailManipulatorDeviceDriver.java index d68e74c0b..9b61c7145 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/two_conveyor/pull_tail_manipulator/PullTailManipulatorDeviceDriver.java +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/two_conveyor/pull_tail_manipulator/PullTailManipulatorDeviceDriver.java @@ -627,7 +627,7 @@ public class PullTailManipulatorDeviceDriver extends AbstractOpcDeviceDriver imp map.put("move", move); map.put("action", action); map.put("isOnline", this.getIsonline()); - map.put("error", ErrorUtil.getDictDetail("error_type", String.valueOf(this.getError()))); + map.put("error", ErrorUtil.getDictDetail("bhhj_error_type", String.valueOf(this.getError()))); map.put("isError", this.getIserror()); map.put("message", message); map.put("feedMessage", feedMessage); diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/ext/wms/service/AcsToWmsService.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/ext/wms/service/AcsToWmsService.java index a0f6d6f97..db2a23625 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/ext/wms/service/AcsToWmsService.java +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/ext/wms/service/AcsToWmsService.java @@ -199,4 +199,6 @@ public interface AcsToWmsService { * @return */ HttpResponse feedbackDies(JSONObject param); + + String secondaryAllocationPoint(JSONObject param); } diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/ext/wms/service/impl/AcsToWmsServiceImpl.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/ext/wms/service/impl/AcsToWmsServiceImpl.java index 5191dc687..62c0e68b2 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/ext/wms/service/impl/AcsToWmsServiceImpl.java +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/ext/wms/service/impl/AcsToWmsServiceImpl.java @@ -637,6 +637,46 @@ public class AcsToWmsServiceImpl implements AcsToWmsService { } } + @Override + public String secondaryAllocationPoint(JSONObject param) { + try { + MDC.put(log_file_type, log_type); + log.info("applyTaskToWms-----输入参数{}", param); + String wmsurl = paramService.findByCode(AcsConfig.WMSURL).getValue(); + AddressDto addressDto = addressService.findByCode("secondaryAllocationPoint"); + String url = wmsurl + addressDto.getMethods_url(); + HttpResponse result2 = null; + try { + result2 = HttpRequest.post(url) + .header("Authorization", token) + .body(String.valueOf(param)) + .execute(); + } catch (Exception e) { + String msg = e.getMessage(); + log.info("applyTaskToWms-----输出参数{}", msg); + //网络不通 + } + if(ObjectUtil.isEmpty(result2)){ + log.info("applyTaskToWms-----输出参数{}", "返回结果为空"); + return null; + } + String type = ""; + if (result2.getStatus() == 200) { + type = "info"; + } else { + type = "error"; + } + log.info("applyTaskToWms-----输出参数{}", result2.body()); + LuceneLogDto luceneLogDto = new LuceneLogDto(4,"applyTaskToWms", String.valueOf(result2.getStatus()), + JSON.toJSONString(param), String.valueOf(result2.body()), "二期发货申请捆扎、贴标"); + luceneLogService.interfaceExecuteLog(luceneLogDto); + return result2.body(); + + } finally { + MDC.remove(log_file_type); + } + } + @Override public HttpResponse feedbackDies(JSONObject param) { HttpResponse result2 = null; diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/ext/wms/service/impl/WmsToAcsServiceImpl.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/ext/wms/service/impl/WmsToAcsServiceImpl.java index 23413ae31..b2f5de694 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/ext/wms/service/impl/WmsToAcsServiceImpl.java +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/ext/wms/service/impl/WmsToAcsServiceImpl.java @@ -16,6 +16,7 @@ import lombok.extern.slf4j.Slf4j; import org.nl.acs.AcsConfig; import org.nl.acs.device.domain.Device; import org.nl.acs.device_driver.agv.ndctwo.AgvNdcTwoDeviceDriver; +import org.nl.acs.device_driver.conveyor.belt_conveyor.BeltConveyorDeviceDriver; import org.nl.acs.device_driver.conveyor.siemens_conveyor.SiemensConveyorDeviceDriver; import org.nl.acs.device_driver.conveyor.standard_ordinary_site.StandardOrdinarySiteDeviceDriver; import org.nl.acs.device_driver.one_conveyor.fold_disc_site.FoldDiscSiteDeviceDriver; @@ -94,6 +95,8 @@ public class WmsToAcsServiceImpl implements WmsToAcsService { try { MDC.put(log_file_type, log_type); log.info("crateTask-----输入参数{}", param); + LuceneLogDto luceneLogDto = new LuceneLogDto(4, param, "acs接收lms任务"); + luceneLogService.interfaceExecuteLog(luceneLogDto); JSONArray datas = JSONArray.parseArray(param); CreateTaskResponse response = new CreateTaskResponse(); // ParamService paramService = SpringContextHolder.getBean(ParamService.class); @@ -492,7 +495,7 @@ public class WmsToAcsServiceImpl implements WmsToAcsService { public PutActionResponse putAction(String jsonObject) throws Exception { log.info("putAction--------------:输入参数" + jsonObject); String date = new Date().toString(); - LuceneLogDto luceneLogDto = new LuceneLogDto(4, jsonObject, date+"LMS反馈ACS动作信号"); + LuceneLogDto luceneLogDto = new LuceneLogDto(4, jsonObject, date + "LMS反馈ACS动作信号"); luceneLogService.interfaceExecuteLog(luceneLogDto); JSONArray datas = JSONArray.parseArray(jsonObject); PutActionResponse response = new PutActionResponse(); @@ -504,51 +507,51 @@ public class WmsToAcsServiceImpl implements WmsToAcsService { String code = request.getCode(); String value = request.getValue(); Device device = deviceAppService.findDeviceByCode(device_code); - if (ObjectUtil.isEmpty(device)) { - throw new Exception("未找到对应设备:" + device_code); - } - InflatableShaftLibraryDeviceDriver inflatableShaftLibraryDeviceDriver; - HongXiangStationDeviceDriver hongXiangStationDeviceDriver; - LampThreecolorDeviceDriver lampThreecolorDeviceDriver; - SiemensConveyorDeviceDriver siemensConveyorDeviceDriver; - WasteFoilWeighingStationDriver wasteFoilWeighingStationDriver; - FoldDiscSiteDeviceDriver foldDiscSiteDeviceDriver; - if (device.getDeviceDriver() instanceof HongXiangStationDeviceDriver) { - hongXiangStationDeviceDriver = (HongXiangStationDeviceDriver) device.getDeviceDriver(); - hongXiangStationDeviceDriver.writing(code, value); - } - if (device.getDeviceDriver() instanceof LampThreecolorDeviceDriver) { - lampThreecolorDeviceDriver = (LampThreecolorDeviceDriver) device.getDeviceDriver(); - lampThreecolorDeviceDriver.writing(code, value); - } - if (device.getDeviceDriver() instanceof SiemensConveyorDeviceDriver) { - siemensConveyorDeviceDriver = (SiemensConveyorDeviceDriver) device.getDeviceDriver(); - siemensConveyorDeviceDriver.writing(code, value); - } - if (device.getDeviceDriver() instanceof InflatableShaftLibraryDeviceDriver) { - inflatableShaftLibraryDeviceDriver = (InflatableShaftLibraryDeviceDriver) device.getDeviceDriver(); - inflatableShaftLibraryDeviceDriver.writing(code, value); - } - if (device.getDeviceDriver() instanceof FoldDiscSiteDeviceDriver) { - foldDiscSiteDeviceDriver = (FoldDiscSiteDeviceDriver) device.getDeviceDriver(); - List list = new ArrayList(); - Map map = new HashMap(); - map.put("code",code); - map.put("value",value); - list.add(map); - foldDiscSiteDeviceDriver.writing(list); - } - if (device.getDeviceDriver() instanceof WasteFoilWeighingStationDriver) { - wasteFoilWeighingStationDriver = (WasteFoilWeighingStationDriver) device.getDeviceDriver(); - wasteFoilWeighingStationDriver.writing(code, value); - try { - Thread.sleep(1000); //休眠1秒 - } catch (InterruptedException e) { - e.printStackTrace(); - } + if (ObjectUtil.isEmpty(device)) { + throw new Exception("未找到对应设备:" + device_code); + } + InflatableShaftLibraryDeviceDriver inflatableShaftLibraryDeviceDriver; + HongXiangStationDeviceDriver hongXiangStationDeviceDriver; + LampThreecolorDeviceDriver lampThreecolorDeviceDriver; + BeltConveyorDeviceDriver beltConveyorDeviceDriver ; + WasteFoilWeighingStationDriver wasteFoilWeighingStationDriver; + FoldDiscSiteDeviceDriver foldDiscSiteDeviceDriver; + if (device.getDeviceDriver() instanceof HongXiangStationDeviceDriver) { + hongXiangStationDeviceDriver = (HongXiangStationDeviceDriver) device.getDeviceDriver(); + hongXiangStationDeviceDriver.writing(code, value); + } + if (device.getDeviceDriver() instanceof LampThreecolorDeviceDriver) { + lampThreecolorDeviceDriver = (LampThreecolorDeviceDriver) device.getDeviceDriver(); + lampThreecolorDeviceDriver.writing(code, value); + } + if (device.getDeviceDriver() instanceof BeltConveyorDeviceDriver) { + beltConveyorDeviceDriver=(BeltConveyorDeviceDriver) device.getDeviceDriver(); + beltConveyorDeviceDriver.writing(code, value); + } + if (device.getDeviceDriver() instanceof InflatableShaftLibraryDeviceDriver) { + inflatableShaftLibraryDeviceDriver = (InflatableShaftLibraryDeviceDriver) device.getDeviceDriver(); + inflatableShaftLibraryDeviceDriver.writing(code, value); + } + if (device.getDeviceDriver() instanceof FoldDiscSiteDeviceDriver) { + foldDiscSiteDeviceDriver = (FoldDiscSiteDeviceDriver) device.getDeviceDriver(); + List list = new ArrayList(); + Map map = new HashMap(); + map.put("code", code); + map.put("value", value); + list.add(map); + foldDiscSiteDeviceDriver.writing(list); + } + if (device.getDeviceDriver() instanceof WasteFoilWeighingStationDriver) { + wasteFoilWeighingStationDriver = (WasteFoilWeighingStationDriver) device.getDeviceDriver(); + wasteFoilWeighingStationDriver.writing(code, value); + try { + Thread.sleep(1000); //休眠1秒 + } catch (InterruptedException e) { + e.printStackTrace(); } } - response.setStatus(200); + } + response.setStatus(200); response.setMessage("success"); LuceneLogDto luceneLogDto1 = new LuceneLogDto(4, "putAction", String.valueOf(response.getCode()), jsonObject, String.valueOf(response), "LMS下发动作"); @@ -561,7 +564,7 @@ public class WmsToAcsServiceImpl implements WmsToAcsService { public Map putWeightAction(String jsonObject) throws Exception { log.info("putWeightAction--------------:输入参数" + jsonObject); String date = new Date().toString(); - LuceneLogDto luceneLogDto = new LuceneLogDto(4, jsonObject, date+"LMS反馈ACS废箔重量"); + LuceneLogDto luceneLogDto = new LuceneLogDto(4, jsonObject, date + "LMS反馈ACS废箔重量"); luceneLogService.interfaceExecuteLog(luceneLogDto); JSONArray datas = JSONArray.parseArray(jsonObject); JSONObject jo = new JSONObject(); @@ -622,7 +625,7 @@ public class WmsToAcsServiceImpl implements WmsToAcsService { public Map getTubeMes(String jsonObject) throws Exception { log.info("getTubeMes--------------:输入参数" + jsonObject); String date = new Date().toString(); - LuceneLogDto luceneLogDto = new LuceneLogDto(4, jsonObject, date+"获取管芯信息"); + LuceneLogDto luceneLogDto = new LuceneLogDto(4, jsonObject, date + "获取管芯信息"); luceneLogService.interfaceExecuteLog(luceneLogDto); JSONArray datas = JSONArray.parseArray(jsonObject); JSONObject jo = new JSONObject(); @@ -721,7 +724,7 @@ public class WmsToAcsServiceImpl implements WmsToAcsService { jo.put("action", Math.min(3, blankManipulatorDeviceDriver.getAction())); jo.put("task", Math.min(3, blankManipulatorDeviceDriver.getTask())); jo.put("error", blankManipulatorDeviceDriver.getError()); - }else if (device.getDeviceDriver() instanceof HongXiangConveyorDeviceDriver) { + } else if (device.getDeviceDriver() instanceof HongXiangConveyorDeviceDriver) { hongXiangConveyorDeviceDriver = (HongXiangConveyorDeviceDriver) device.getDeviceDriver(); jo.put("device_code", parent_device_code); jo.put("mode", hongXiangConveyorDeviceDriver.getMode()); @@ -831,7 +834,7 @@ public class WmsToAcsServiceImpl implements WmsToAcsService { jo.put("action", subvolumeWeighingStationDriver.getAction()); jo.put("weight", subvolumeWeighingStationDriver.getWeight()); jo.put("error", subvolumeWeighingStationDriver.getError()); - }else if (device.getDeviceDriver() instanceof FoldDiscSiteDeviceDriver) { + } else if (device.getDeviceDriver() instanceof FoldDiscSiteDeviceDriver) { foldDiscSiteDeviceDriver = (FoldDiscSiteDeviceDriver) device.getDeviceDriver(); jo.put("device_code", parent_device_code); jo.put("move", foldDiscSiteDeviceDriver.getMove()); @@ -848,7 +851,7 @@ public class WmsToAcsServiceImpl implements WmsToAcsService { resultJson.put("status", HttpStatus.OK.value()); resultJson.put("message", "操作成功"); resultJson.put("data", backja); - LuceneLogDto luceneLogDto = new LuceneLogDto(4,"queryDevice", String.valueOf(resultJson.get("status")), + LuceneLogDto luceneLogDto = new LuceneLogDto(4, "queryDevice", String.valueOf(resultJson.get("status")), jsonObject, String.valueOf(resultJson), "LMS查询设备状态"); luceneExecuteLogService.interfaceExecuteLog(luceneLogDto); return resultJson; @@ -878,5 +881,4 @@ public class WmsToAcsServiceImpl implements WmsToAcsService { } - } diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/history/ErrorUtil.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/history/ErrorUtil.java index 07a323bd0..cb87e0412 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/history/ErrorUtil.java +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/history/ErrorUtil.java @@ -41,7 +41,7 @@ public class ErrorUtil { String en_label = dictDetailDto.getEn_label(); String in_label = dictDetailDto.getIn_label(); String zh_label = dictDetailDto.getZh_label(); - if (StrUtil.equals(value, error_code)) { + if (StrUtil.equals(value, error_code) && ObjectUtil.isNotEmpty(language)) { if (language.contains("zh")){ detail = zh_label; break; @@ -54,7 +54,10 @@ public class ErrorUtil { detail = en_label; break; } - + if(StrUtil.isEmpty(language)){ + detail = en_label; + break; + } } } } diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/instruction/domain/InstructionMybatis.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/instruction/domain/InstructionMybatis.java index 8b9bdbfee..226cd2917 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/instruction/domain/InstructionMybatis.java +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/instruction/domain/InstructionMybatis.java @@ -34,211 +34,215 @@ import java.io.Serializable; public class InstructionMybatis extends CommonModel implements Serializable { private static final long serialVersionUID = 1L; - + @TableId(type = IdType.ASSIGN_ID) private String instruction_id; - + private String task_id; - + @NotBlank private String instruction_code; - + private String link_num; - + private String execute_device_code; - + private String execute_status; - + private String execute_status_description; - + private String follow_device_code; - + @NotBlank private String compound_inst; - + private String compound_inst_data; - + private String material; - + @NotNull private BigDecimal quantity; - + private String instruction_type; - + private String instruction_status; - + private String create_type; - + private String finish_type; - + private String priority; - + private String execute_code; - + private String execute_message; - + private String start_point_code; - + private String start_device_code; - + private String start_point_code2; - + private String start_device_code2; - + private String next_point_code; - + private String next_device_code; - + private String next_point_code2; - + private String next_device_code2; - + private String put_point_code; - + private String put_device_code; - + private String task_code; - + private String vehicle_code; - + private String vehicle_type; - + private String from_x; - + private String from_y; - + private String from_z; - + private String from_x2; - + private String from_y2; - + private String from_z2; - + private String put_x; - + private String put_y; - + private String put_z; - + private String to_x; - + private String to_y; - + private String to_z; - + private String to_x2; - + private String to_y2; - + private String to_z2; - + private String last_instruction_id; - + @NotBlank private String can_modify; - + private String remark; - + @NotBlank private String is_active; - + @NotBlank private String is_delete; - + @NotBlank @TableField(fill = FieldFill.INSERT) private String create_by; - + @NotBlank @TableField(fill = FieldFill.INSERT) private String create_time; - + @TableField(fill = FieldFill.INSERT_UPDATE) private String update_by; - + @TableField(fill = FieldFill.INSERT_UPDATE) private String update_time; - + private String carno; - + private String agv_jobno; - + private String send_status; - + private String weight; - + private String route_plan_code; - + private String emptypallet_num; - + private String agv_inst_type; - + private String agv_system_type; + + + private Integer agv_action_type; + public void copyFrom(Instruction source) { BeanUtil.copyProperties(source, this, CopyOptions.create().setIgnoreNullValue(true)); } diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/instruction/service/dto/InstructionDto.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/instruction/service/dto/InstructionDto.java index bd79c3678..a9e802d6b 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/instruction/service/dto/InstructionDto.java +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/instruction/service/dto/InstructionDto.java @@ -365,6 +365,12 @@ public class InstructionDto implements Serializable { private String to_device_code; + /** + * agv二次分配类型(1、普通任务 2、取货二次分配 3、防货二次分配 4、取放货二次分配) + */ + private Integer agv_action_type; + + /** * */ diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/instruction/service/impl/InstructionServiceImpl.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/instruction/service/impl/InstructionServiceImpl.java index e9a970c0e..889c69d29 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/instruction/service/impl/InstructionServiceImpl.java +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/instruction/service/impl/InstructionServiceImpl.java @@ -516,7 +516,7 @@ public class InstructionServiceImpl extends CommonServiceImpl instructionMybatis = instructionMapper.selectList(Wrappers.lambdaQuery(InstructionMybatis.class) + .eq(InstructionMybatis::getTask_code, dto.getTask_code())); + if (CollUtil.isNotEmpty(instructionMybatis) && instructionMybatis.stream().anyMatch(inst -> inst.getStart_device_code() + .equals(start_device_code))) { + return; + } + } String currentUsername = SecurityUtils.getCurrentNickName(); String now = DateUtil.now(); if (StrUtil.isEmpty(dto.getRoute_plan_code())) { @@ -582,14 +592,22 @@ public class InstructionServiceImpl extends CommonServiceImpl shortPathsList = @@ -645,26 +658,44 @@ public class InstructionServiceImpl extends CommonServiceImpl 0 && StrUtil.equals(shortPathsList.get(0).getType(), CommonFinalParam.ONE)) { + Device deviceByCode = deviceAppService.findDeviceByCode(dto.getStart_device_code()); + if (dto.getAgv_system_type().equals(AgvSystemTypeEnum.XG_System_Type.getIndex())) { + String interactionJson = task.getInteraction_json(); + if (StrUtil.isEmpty(interactionJson)){ + throw new BadRequestException("agv叉车调整长宽参数为空"); + } + InteractionJsonDTO interactionJsonDTO = JSON.parseObject(interactionJson, InteractionJsonDTO.class); + //仙工叉车 + HttpResponse response = xiangGongAgvService.sendOrderSequencesToForklift(dto,interactionJsonDTO); + if (ObjectUtils.isEmpty(response) || response.getStatus() != 200) { dto.setSend_status("2"); + } else { + dto.setSend_status("1"); + } + } else if (dto.getAgv_system_type().equals(AgvSystemTypeEnum.One_NDC_System_Type.getIndex())) { + //一楼agv任务创建运单序列 + HttpResponse response = xiangGongAgvService.sendOrderSequencesToXZ(dto); + if (ObjectUtils.isEmpty(response) || response.getStatus() != 200) { + dto.setSend_status("2"); + } else { + dto.setSend_status("1"); } } } } catch (Exception e) { dto.setSend_status("2"); - e.printStackTrace(); + log.error(e.getMessage()); + LuceneLogDto logDto = LuceneLogDto.builder() + .device_code("创建指令报错") + .content("任务号" + dto.getTask_code() + "报错原因:" + e.getMessage()) + .build(); + logDto.setLog_level(2); + luceneExecuteLogService.deviceExecuteLog(logDto); + throw e; } - InstructionMybatis entity = ConvertUtil.convert(dto, InstructionMybatis.class); instructionMapper.insert(entity); instructions.add(dto); diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/task/domain/Task.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/task/domain/Task.java index 73cc690d0..065e7a221 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/task/domain/Task.java +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/task/domain/Task.java @@ -240,6 +240,10 @@ public class Task extends CommonModel implements Serializable { private String interaction_json; + + + private Integer agv_action_type; + public void copyFrom(Task source) { BeanUtil.copyProperties(source, this, CopyOptions.create().setIgnoreNullValue(true)); } diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/task/enums/ActionTypeEnum.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/task/enums/ActionTypeEnum.java new file mode 100644 index 000000000..ba2f202f0 --- /dev/null +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/task/enums/ActionTypeEnum.java @@ -0,0 +1,35 @@ +package org.nl.acs.task.enums; + +import lombok.AllArgsConstructor; +import lombok.Getter; + +@Getter +@AllArgsConstructor +public enum ActionTypeEnum { + + /** + * 取货二次分配 + */ + IN_STOCK(1, "取货二次分配"), + + /** + * 防货二次分配 + */ + OUT_STOCK(2, "防货二次分配"), + /** + * 取货完成 + */ + IN_FINISHING(3, "取货完成"); + + Integer code; + String status; + + public static String getStatus(Integer code) { + for (ActionTypeEnum value : values()) { + if (value.code.equals(code)) { + return value.status; + } + } + return null; + } +} diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/task/enums/AgvActionTypeEnum.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/task/enums/AgvActionTypeEnum.java new file mode 100644 index 000000000..67b408a90 --- /dev/null +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/task/enums/AgvActionTypeEnum.java @@ -0,0 +1,39 @@ +package org.nl.acs.task.enums; + + +import lombok.AllArgsConstructor; +import lombok.Getter; + + +@Getter +@AllArgsConstructor +public enum AgvActionTypeEnum { + /** + * 普通任务 + */ + ORDINARY(1, "普通任务"), + /** + * 取货二次分配 + */ + IN_STOCK(2, "取货二次分配"), + /** + * 防货二次分配 + */ + OUT_STOCK(3, "防货二次分配"), + /** + * 取放货二次分配 + */ + IN_OUT_STOCK(4, "取放货二次分配"); + + Integer code; + String status; + + public static String getStatus(Integer code) { + for (AgvActionTypeEnum value : values()) { + if (value.code.equals(code)) { + return value.status; + } + } + return null; + } +} diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/task/service/dto/TaskDto.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/task/service/dto/TaskDto.java index b5a63553a..b54c66f85 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/task/service/dto/TaskDto.java +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/task/service/dto/TaskDto.java @@ -349,4 +349,10 @@ public class TaskDto implements Serializable { * 是否拔轴 0/1 */ private String is_pulling; + + + /** + * agv二次分配类型(1、普通任务 2、取货二次分配 3、防货二次分配 4、取放货二次分配) + */ + private Integer agv_action_type; } diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/task/service/impl/TaskServiceImpl.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/task/service/impl/TaskServiceImpl.java index ca2ac49f2..136ee6a86 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/task/service/impl/TaskServiceImpl.java +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/task/service/impl/TaskServiceImpl.java @@ -42,6 +42,7 @@ import org.nl.acs.route.domain.RoutePlan; import org.nl.acs.route.service.RouteLineService; import org.nl.acs.route.service.dto.RouteLineDto; import org.nl.acs.route.service.mapper.RoutePlanMapper; +import org.nl.acs.task.enums.AgvSystemTypeEnum; import org.nl.acs.task.enums.TaskStatusEnum; import org.nl.acs.task.enums.TaskTypeEnum; import org.nl.acs.task.service.TaskFeedbackService; @@ -839,7 +840,9 @@ public class TaskServiceImpl extends CommonServiceImpl impleme //反馈上位系统任务状态 this.feedWmsTaskStatus(entity); //关闭仙工运单序列 - this.markComplete(entity); + if(StrUtil.equals(task.getTask_type(),TaskTypeEnum.Standard_AGV_Task.getCode()) && (StrUtil.equals(task.getAgv_system_type(), AgvSystemTypeEnum.One_NDC_System_Type.getCode())||StrUtil.equals(task.getAgv_system_type(), AgvSystemTypeEnum.XG_System_Type.getCode()))) { + this.markComplete(entity); + } } @Override @@ -868,7 +871,9 @@ public class TaskServiceImpl extends CommonServiceImpl impleme //反馈上位系统任务状态 this.feedWmsTaskStatus(entity); //关闭仙工运单序列 - this.markComplete(entity); + if(StrUtil.equals(task.getTask_type(),TaskTypeEnum.Standard_AGV_Task.getCode()) && (StrUtil.equals(task.getAgv_system_type(), AgvSystemTypeEnum.One_NDC_System_Type.getCode())||StrUtil.equals(task.getAgv_system_type(), AgvSystemTypeEnum.XG_System_Type.getCode()))) { + this.markComplete(entity); + } } @@ -901,6 +906,8 @@ public class TaskServiceImpl extends CommonServiceImpl impleme String next_point_code2 = acsTask.getNext_point_code2(); String agv_system_type = acsTask.getAgv_system_type(); String task_type = acsTask.getTask_type(); + String start_height = acsTask.getStart_height(); + String next_height = acsTask.getNext_height(); /** 开始平均分解校验 */ String this_device_code = this.queryAssignedByDevice(acsTask.getStart_device_code(), acsTask.getNext_device_code()); @@ -962,31 +969,37 @@ public class TaskServiceImpl extends CommonServiceImpl impleme instdto.setNext_device_code2(next_point_code2); instdto.setNext_point_code2(next_point_code2); instdto.setAgv_system_type(agv_system_type); - instdto.setAgv_inst_type(CommonFinalParam.ONE); + instdto.setStart_height(start_height); + instdto.setNext_height(next_height); - if (!StrUtil.equals(agv_system_type, "1")) { + //判断agv系统 + //1、1楼叉车系统 + //2、2楼1区域AGV系统 + //3、2楼2区域AGV系统 -已废弃 + if (StrUtil.equals(agv_system_type, CommonFinalParam.TWO)) { // task_type - // 1、生箔; Itype=1:取空,取满,放空,放满; - // 2、分切 Itype=3取满、取空、放满、放空; - // 3、普通任务 Itype=2:取货、放货; - // 4、叉车任务 - // 5、输送任务 - // 6、行架 - // 7、立库 - if (StrUtil.equals(task_type, "1")) { - instdto.setAgv_inst_type("1"); + //1、生箔; Itype=1:取空,取满,放空,放满; + //2、分切 Itype=3取满、取空、放满、放空; + //3、普通任务 Itype=2:取货、放货; + //4、叉车任务 + //5、输送任务 + //6、行架 + //7、立库 + if (StrUtil.equals(task_type, CommonFinalParam.ONE)) { + instdto.setAgv_inst_type(CommonFinalParam.ONE); } else if (StrUtil.equals(task_type, "3")) { instdto.setAgv_inst_type("2"); } else if (StrUtil.equals(task_type, "2")) { instdto.setAgv_inst_type("3"); } else if (StrUtil.equals(task_type, "8")) { instdto.setAgv_inst_type("2"); + } else { + log.info("未找到对应的AGV指令类型,任务号:" + acsTask.getTask_code() + ",task_type:" + acsTask.getTask_type()); } } else { instdto.setAgv_inst_type("4"); } instructionservice.create2(instdto); - acsTask.setTask_status(CommonFinalParam.ONE); this.update(acsTask); return instdto; @@ -1634,23 +1647,10 @@ public class TaskServiceImpl extends CommonServiceImpl impleme */ private void markComplete(TaskDto taskDto) { // 如果属于先知AGV,关闭运单序列 - List shortPathsList = - routeLineService.getShortPathLines( - taskDto.getStart_device_code(), - taskDto.getNext_device_code(), - taskDto.getRoute_plan_code()); - if (ObjectUtil.isNotEmpty(shortPathsList)) { - String type = shortPathsList.get(0).getType(); - // != 0 为agv任务 - if (!StrUtil.equals(type, "0")) { - if (StrUtil.equals(paramService.findByCode(AcsConfig.AGVTYPE).getValue(), "3")) { - try { - agvService.markComplete(taskDto.getTask_code()); - } catch (Exception e) { - log.error("关闭运单异常,原因:{}", e.getMessage()); - } - } - } + try { + agvService.markComplete(taskDto.getTask_code()); + } catch (Exception e) { + log.error("关闭运单异常,原因:{}", e.getMessage()); } } diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/config/language/InitLocaleResolver.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/config/language/InitLocaleResolver.java index 5d16d842e..2ed33f922 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/config/language/InitLocaleResolver.java +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/config/language/InitLocaleResolver.java @@ -19,7 +19,6 @@ public class InitLocaleResolver implements LocaleResolver { if (StringUtils.isNotEmpty(header)){ String lang = Language_Country.get(header); language = lang; - System.out.println("lang的值为:"+lang); if (StringUtils.isNotEmpty(lang)){ String[] l = lang.split("-"); //印尼的ISO标准国家代码为id-ID diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/system/service/dict/impl/SysDictServiceImpl.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/system/service/dict/impl/SysDictServiceImpl.java index c8e41b2d3..e389ed070 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/system/service/dict/impl/SysDictServiceImpl.java +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/system/service/dict/impl/SysDictServiceImpl.java @@ -153,6 +153,9 @@ public class SysDictServiceImpl extends ServiceImpl impleme dic.setPara1(dict.getPara1()); dic.setPara2(dict.getPara2()); dic.setPara3(dict.getPara3()); + dic.setZh_label(dict.getZh_label()); + dic.setEn_label(dict.getEn_label()); + dic.setIn_label(dict.getIn_label()); sysDictMapper.updateById(dic); return; } diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/system/service/quartz/task/AutoCreateInst.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/system/service/quartz/task/AutoCreateInst.java index a8bd8141f..5aee86e81 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/system/service/quartz/task/AutoCreateInst.java +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/system/service/quartz/task/AutoCreateInst.java @@ -86,6 +86,7 @@ public class AutoCreateInst { String start_height = acsTask.getStart_height(); String next_height = acsTask.getNext_height(); + Integer agvActionType = acsTask.getAgv_action_type(); if (StrUtil.equals(is_send, "0")) { @@ -158,6 +159,7 @@ public class AutoCreateInst { instdto.setAgv_system_type(agv_system_type); instdto.setStart_height(start_height); instdto.setNext_height(next_height); + instdto.setAgv_action_type(agvActionType); //判断agv系统 //1、1楼叉车系统 //2、2楼1区域AGV系统 diff --git a/acs2/nladmin-system/nlsso-server/src/main/resources/language/monitor/universal/universal.properties b/acs2/nladmin-system/nlsso-server/src/main/resources/language/monitor/universal/universal.properties index 5249d3352..6b680c23b 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/resources/language/monitor/universal/universal.properties +++ b/acs2/nladmin-system/nlsso-server/src/main/resources/language/monitor/universal/universal.properties @@ -57,11 +57,13 @@ universal_notCreateInstMessage5=\u5B58\u5728\u76F8\u540C\u8DEF\u7EBF\u7684\u6307 universal_notCreateInstMessage6=\u4E0B\u4E00\u4E2A\u8BBE\u5907\u4E0D\u662F\u8F93\u9001\u7EBF\u6307\u4EE4! universal_notCreateInstMessage7=\u6258\u76D8\u7C7B\u578B\u4E3A\u7A7A! universal_notCreateInstMessage8=\u6761\u7801\u4E3A\u7A7A! +universal_notCreateInstMessage9=\u63D2\u62D4\u8F74\u5DE5\u4F4D\u6761\u4EF6\u4E0D\u6EE1\u8DB3\uFF0C\u65E0\u6CD5\u751F\u6210\u6307\u4EE4! universal_actionMessage1=\u4E0D\u5141\u8BB8\u53D6\u653E universal_actionMessage2=\u5141\u8BB8\u53D6\u653E universal_actionMessage3=\u5141\u8BB8\u79BB\u5F00 universal_actionMessage4=\u8BF7\u6C42\u52A8\u4F5C\u5DF2\u590D\u4F4D universal_actionMessage5=\u8BF7\u6C42\u52A8\u4F5C\u672A\u590D\u4F4D +universal_directives=\u6307\u4EE4 diff --git a/acs2/nladmin-system/nlsso-server/src/main/resources/language/monitor/universal/universal_en_US.properties b/acs2/nladmin-system/nlsso-server/src/main/resources/language/monitor/universal/universal_en_US.properties index b06e2d793..61adfec8e 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/resources/language/monitor/universal/universal_en_US.properties +++ b/acs2/nladmin-system/nlsso-server/src/main/resources/language/monitor/universal/universal_en_US.properties @@ -54,6 +54,7 @@ universal_notCreateInstMessage3=The device is in standby mode or is not allowed universal_notCreateInstMessage4=ddj interface bit is in stock, cannot generate command! universal_notCreateInstMessage5=Instructions with the same route exist! universal_notCreateInstMessage6=The next device is not a conveyor line directive! +universal_notCreateInstMessage9=The plugging and unplugging shaft station conditions are not met, and the instruction cannot be generated! universal_actionMessage1=Pick-and-place is not permitted universal_actionMessage2=Pick-and-place is allowed universal_actionMessage3=Permission to leave @@ -61,5 +62,6 @@ universal_actionMessage4=The request action has been reset universal_actionMessage5=The request action is not reset universal_notCreateInstMessage7=ray type is empty! universal_notCreateInstMessage8=The barcode is blank\uFF01 +universal_directives=Directives diff --git a/acs2/nladmin-system/nlsso-server/src/main/resources/language/monitor/universal/universal_in_ID.properties b/acs2/nladmin-system/nlsso-server/src/main/resources/language/monitor/universal/universal_in_ID.properties index 7f4707491..506419cd1 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/resources/language/monitor/universal/universal_in_ID.properties +++ b/acs2/nladmin-system/nlsso-server/src/main/resources/language/monitor/universal/universal_in_ID.properties @@ -54,6 +54,7 @@ universal_notCreateInstMessage3=Siaga perangkat atau tidak diizinkan masuk universal_notCreateInstMessage4=DDJ mendarat di dok, tidak ada perintah yang diberikan! universal_notCreateInstMessage5=Ada instruksi tentang rute yang sama! universal_notCreateInstMessage6=Perangkat berikutnya bukan arahan jalur konveyor! +universal_notCreateInstMessage9=Kondisi stasiun poros penyumbatan dan pencabutan tidak terpenuhi, dan instruksi tidak dapat dibuat! universal_actionMessage1=Pick-and-place tidak diizinkan universal_actionMessage2=Pick-and-place diperbolehkan universal_actionMessage3=Izin untuk pergi @@ -61,3 +62,4 @@ universal_actionMessage4=Tindakan permintaan telah disetel ulang universal_actionMessage5=Tindakan permintaan tidak disetel ulang universal_notCreateInstMessage7=ponypianmereka yang kosong! universal_notCreateInstMessage8=Kode batang kosong! +universal_directives=Arahan diff --git a/acs2/nladmin-system/nlsso-server/src/main/resources/language/monitor/universal/universal_zh_CN.properties b/acs2/nladmin-system/nlsso-server/src/main/resources/language/monitor/universal/universal_zh_CN.properties index 83e651b28..c6ad11329 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/resources/language/monitor/universal/universal_zh_CN.properties +++ b/acs2/nladmin-system/nlsso-server/src/main/resources/language/monitor/universal/universal_zh_CN.properties @@ -59,8 +59,9 @@ universal_notCreateInstMessage3=\u8BBE\u5907\u5F85\u673A\u6216\u4E0D\u5141\u8BB8 universal_notCreateInstMessage4=ddj\u5BF9\u63A5\u4F4D\u6709\u8D27,\u65E0\u6CD5\u751F\u6210\u6307\u4EE4! universal_notCreateInstMessage5=\u5B58\u5728\u76F8\u540C\u8DEF\u7EBF\u7684\u6307\u4EE4! universal_notCreateInstMessage6=\u4E0B\u4E00\u4E2A\u8BBE\u5907\u4E0D\u662F\u8F93\u9001\u7EBF\u6307\u4EE4! +universal_notCreateInstMessage9=\u63D2\u62D4\u8F74\u5DE5\u4F4D\u6761\u4EF6\u4E0D\u6EE1\u8DB3\uFF0C\u65E0\u6CD5\u751F\u6210\u6307\u4EE4! universal_notCreateInstMessage7=\u6258\u76D8\u7C7B\u578B\u4E3A\u7A7A! universal_notCreateInstMessage8=\u6761\u7801\u4E3A\u7A7A! - +universal_directives=\u6307\u4EE4 diff --git a/acs2/nladmin-ui/src/i18n/langs/monitor/en.js b/acs2/nladmin-ui/src/i18n/langs/monitor/en.js index c597c9250..394d5e9c8 100644 --- a/acs2/nladmin-ui/src/i18n/langs/monitor/en.js +++ b/acs2/nladmin-ui/src/i18n/langs/monitor/en.js @@ -66,6 +66,9 @@ export default { 'photoelectric_signal': 'photoelectric signal', 'mode': 'mode', 'alarm': 'alarm', + 'last_mission_number': 'Last Mission Number', + 'the_subvolume_number': 'The Subvolume Number', + 'pallet_type': 'Pallet Type', 'ip_address': 'IP', 'pallet_quantity': 'Pallet quantity', 'instruction_information': 'instruction information', diff --git a/acs2/nladmin-ui/src/i18n/langs/monitor/in.js b/acs2/nladmin-ui/src/i18n/langs/monitor/in.js index be5f9fc1e..42388c80d 100644 --- a/acs2/nladmin-ui/src/i18n/langs/monitor/in.js +++ b/acs2/nladmin-ui/src/i18n/langs/monitor/in.js @@ -64,6 +64,9 @@ export default { 'device_name': 'nama divais', 'exception_message': 'pesan yang tidak biasa', 'photoelectric_signal': 'Sinyal fotolistrik', + 'last_mission_number': 'Nomor misi terakhir', + 'the_subvolume_number': 'Nomor Subvolume', + 'pallet_type': 'Jenis Palet', 'mode': 'pola', 'alarm': 'polisi', 'ip_address': 'IP', diff --git a/acs2/nladmin-ui/src/i18n/langs/monitor/zh.js b/acs2/nladmin-ui/src/i18n/langs/monitor/zh.js index d7f237bcb..3885b4a3b 100644 --- a/acs2/nladmin-ui/src/i18n/langs/monitor/zh.js +++ b/acs2/nladmin-ui/src/i18n/langs/monitor/zh.js @@ -98,6 +98,9 @@ export default { 'task_number': '任务号', 'command': '动作', 'disable': '是否禁用', + 'last_mission_number': '上次任务号', + 'the_subvolume_number': '子卷编号', + 'pallet_type': '托盘类型', 'current_temperature': '当前温度', 'oven_finish': '烘箱完成', 'house': '恒温倒计时-时', diff --git a/acs2/nladmin-ui/src/views/acs/device/driver/standard_inspect_site.vue b/acs2/nladmin-ui/src/views/acs/device/driver/standard_inspect_site.vue index c421eda4d..240399dd5 100644 --- a/acs2/nladmin-ui/src/views/acs/device/driver/standard_inspect_site.vue +++ b/acs2/nladmin-ui/src/views/acs/device/driver/standard_inspect_site.vue @@ -1,5 +1,5 @@ + + + +