diff --git a/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/basedriver/agv/ndcone/AgvNdcOneDeviceDriver.java b/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/basedriver/agv/ndcone/AgvNdcOneDeviceDriver.java index 35cf45d..0346679 100644 --- a/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/basedriver/agv/ndcone/AgvNdcOneDeviceDriver.java +++ b/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/basedriver/agv/ndcone/AgvNdcOneDeviceDriver.java @@ -337,6 +337,11 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic int start_address=deviceService.queryAddressBydeviceCode(start_point); int next_address=deviceService.queryAddressBydeviceCode(next_point); taskService.update(task); + inst.setStart_point_code(start_point); + inst.setStart_device_code(start_point); + inst.setNext_point_code(next_point); + inst.setNext_device_code(next_point); + instructionService.update(inst); data = NDCAgvService.sendAgvOneModeInst(phase, index, 0, start_address, next_address, start_height, next_height); log.info("指令号:{},phase:{},acs请求wms申请成功", inst.getInstruction_code(),phase); }else{ diff --git a/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/instruction/domain/Instruction.java b/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/instruction/domain/Instruction.java index e3a908c..65f2455 100644 --- a/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/instruction/domain/Instruction.java +++ b/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/instruction/domain/Instruction.java @@ -26,6 +26,10 @@ public class Instruction extends InstructionDto implements Serializable { public Instruction() { } + public Instruction(InstructionDto instructionDto) { + BeanUtil.copyProperties(instructionDto,this, CopyOptions.create().setIgnoreNullValue(true)); + } + public void copyFrom(Instruction source){ BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true)); } diff --git a/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/instruction/rest/InstructionController.java b/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/instruction/rest/InstructionController.java index 398d3e3..adb48a3 100644 --- a/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/instruction/rest/InstructionController.java +++ b/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/instruction/rest/InstructionController.java @@ -38,7 +38,7 @@ public class InstructionController { //@PreAuthorize("@el.check('instruction:list')") public ResponseEntity query(@RequestParam Map whereJson, Pageable page) { if(ObjectUtil.isEmpty(whereJson.get("status"))) { - whereJson.put("status", "1"); + whereJson.put("status", "0"); } return new ResponseEntity<>(instructionService.queryAll(whereJson, page), HttpStatus.OK); } diff --git a/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/instruction/service/impl/InstructionServiceImpl.java b/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/instruction/service/impl/InstructionServiceImpl.java index fa85b8d..334dab5 100644 --- a/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/instruction/service/impl/InstructionServiceImpl.java +++ b/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/instruction/service/impl/InstructionServiceImpl.java @@ -807,7 +807,7 @@ public class InstructionServiceImpl extends CommonServiceImpl schBasePointList = pointMapper.findPointByRegion(regionCode,"2"); + List schBasePointList = pointMapper.findPointByRegion(regionCode,"1"); for(int i=schBasePointList.size()-1;i>=0;i--){ SchBasePoint schBasePoint=schBasePointList.get(i); if (!"2".equals(schBasePoint.getPoint_type())&&schBasePoint.getVehicle_qty()!=0 @@ -230,8 +230,6 @@ public class BPSLTask extends AbstractTask { //todo 重算最优点 JSONObject jsonObject = JSONObject.parseObject(schBaseTask.getExt_group_data()); SchBasePoint point = this.findNextPoint(jsonObject); - // 设置起点并修改创建成功状态 - List vehicleCodeList = Arrays.stream(point.getVehicle_code().split(",")).collect(Collectors.toList()); - schBaseTask.setPoint_code1(point.getPoint_code()+"0"+vehicleCodeList.size()); + schBaseTask.setPoint_code1(point.getPoint_code()); } } diff --git a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/ghs/GHSFMTask.java b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/ghs/GHSFMTask.java index a4b0663..34ae57f 100644 --- a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/ghs/GHSFMTask.java +++ b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/ghs/GHSFMTask.java @@ -161,7 +161,7 @@ public class GHSFMTask extends AbstractTask { Integer tcmn = taskConfig.getTask_create_max_num(); // 获取执行中的任务 List unFinishTasksByTaskConfig = taskService.findUnFinishTasksByTaskConfig( - taskConfig.getConfig_code(), apply_point_code, taskConfig.getTask_direction()); + taskConfig.getConfig_code(), apply_point_code+"01", taskConfig.getTask_direction()); Assert.isFalse(unFinishTasksByTaskConfig.size() >= tcmn, "该点位申请的任务未完成数已超过上限,无法申请任务"); @@ -180,11 +180,13 @@ public class GHSFMTask extends AbstractTask { task.setVehicle_qty(schBasePoint.getVehicle_qty()); task.setTask_status(TaskStatus.APPLY.getCode()); task.setWorkshop_code(taskConfig.getWorkshop_code()); // 车间编码 + //acs固化室首位不存在01和06整体概念,需要补充01生成第一个点位的任务 + task.setPoint_code1(apply_point_code+"01"); task.setPoint_code2(endPoint); task.setTask_status(TaskStatus.CREATED.getCode()); task.setRemark(""); // 设置起/终点 - this.setTaskPoint(taskConfig, task, apply_point_code); +// this.setTaskPoint(taskConfig, task, apply_point_code); taskService.create(task); //下发 @@ -212,7 +214,7 @@ public class GHSFMTask extends AbstractTask { if (taskObj.getTask_status().equals(TaskStatus.CANCELED.getCode())) { throw new BadRequestException("该任务已取消!"); } - String startPoint = taskObj.getPoint_code1(); // 获取起点 + String startPoint = taskObj.getPoint_code1().substring(0,taskObj.getPoint_code1().length()-2); // 获取起点 String endPoint = taskObj.getPoint_code2(); // 获取终点 SchBasePoint startPointObj = pointService.getById(startPoint); SchBasePoint endPointObj = pointService.getById(endPoint); @@ -225,7 +227,6 @@ public class GHSFMTask extends AbstractTask { StringBuilder group_id= new StringBuilder(); // 终点解锁 endPointObj.setIng_task_code(""); - endPointObj.setVehicle_code(startPointObj.getVehicle_code()); endPointObj.setVehicle_type(startPointObj.getVehicle_type()); endPointObj.setVehicle_code(startPointObj.getVehicle_code()); endPointObj.setVehicle_qty(startPointObj.getVehicle_qty()); diff --git a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/ghs/GHSQHTask.java b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/ghs/GHSQHTask.java index 4e49fc4..8ed09e4 100644 --- a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/ghs/GHSQHTask.java +++ b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/ghs/GHSQHTask.java @@ -74,17 +74,17 @@ public class GHSQHTask extends AbstractTask { // @Transactional(rollbackFor = Exception.class) protected void create() throws BadRequestException { - List schBasePointList = pointMapper.findPointByRegion("GHS","3"); - if (schBasePointList.size()==0) { + List schBasePointList = pointMapper.findPointByRegion("GHS", "3"); + if (schBasePointList.size() == 0) { // 消息通知 log.info("未找到当前符合允许取货的固化室点位,暂不生成任务"); return; } - SchBasePoint schBasePoint=null; + SchBasePoint schBasePoint = null; //按顺序查找第一个符合条件的固化室位置,发起任务 - for(SchBasePoint schBasePoint1:schBasePointList){ - if (schBasePoint1.getVehicle_qty()==3&&ObjectUtil.isEmpty(schBasePoint1.getIng_task_code())) { - schBasePoint=schBasePoint1; + for (SchBasePoint schBasePoint1 : schBasePointList) { + if (schBasePoint1.getVehicle_qty() == 3 && ObjectUtil.isEmpty(schBasePoint1.getIng_task_code())) { + schBasePoint = schBasePoint1; break; } } @@ -93,14 +93,14 @@ public class GHSQHTask extends AbstractTask { log.info("未找到当前符合允许取货的固化室点位,暂不生成任务"); return; } - SchBasePoint nextPoint=this.findNextPoint(schBasePoint); + SchBasePoint nextPoint = this.findNextPoint(schBasePoint); if (ObjectUtil.isEmpty(nextPoint)) { // 消息通知 - log.info("未找到当前符合允许放货的缓存点,暂不生成任务Vehicle_type:{}",schBasePoint.getVehicle_type()); + log.info("未找到当前符合允许放货的缓存点,暂不生成任务Vehicle_type:{}", schBasePoint.getVehicle_type()); return; } // 放料先去等待点 - this.createTask(schBasePoint,nextPoint.getNext_wait_point()); + this.createTask(schBasePoint, nextPoint.getNext_wait_point()); } @@ -111,10 +111,10 @@ public class GHSQHTask extends AbstractTask { * @param endPoint * @return */ - private void createTask(SchBasePoint schBasePoint,String endPoint) { + private void createTask(SchBasePoint schBasePoint, String endPoint) { // 申请任务 SchBaseTask task = new SchBaseTask(); // 任务实体 - String apply_point_code =schBasePoint.getPoint_code(); // 请求点 + String apply_point_code = schBasePoint.getPoint_code(); // 请求点 String config_code = "GHSQHTask"; // 1、校验数据 SchBaseTaskconfig taskConfig = taskConfigService.getOne(new LambdaQueryWrapper() @@ -175,28 +175,32 @@ public class GHSQHTask extends AbstractTask { //边负极板到缓存区1 regionCode = "HCQ2"; } - List schBasePointList = pointMapper.findPointByRegion(regionCode,"2"); - for(int i=schBasePointList.size()-1;i>=0;i--){ - SchBasePoint schBasePoint=schBasePointList.get(i); - SchBasePoint temp=null; - if (schBasePoint.getVehicle_qty()==0 - &&ObjectUtil.isEmpty(schBasePoint.getIng_task_code()) - &&(ObjectUtil.isEmpty(schBasePoint.getVehicle_type())||materialType.equals(schBasePoint.getVehicle_type()))){ + List schBasePointList = pointMapper.findPointByRegion(regionCode, "1"); + for (int i = schBasePointList.size() - 1; i >= 0; i--) { + SchBasePoint schBasePoint = schBasePointList.get(i); + SchBasePoint temp = null; + if (schBasePoint.getVehicle_qty() == 0 + && ObjectUtil.isEmpty(schBasePoint.getIng_task_code()) + //放货三拖一起放,只能到01位置 + && schBasePoint.getPoint_code().endsWith("01") + && (ObjectUtil.isEmpty(schBasePoint.getVehicle_type()) || materialType.equals(schBasePoint.getVehicle_type()))) { //发现有空位时暂存当前位置,检查当前列前面是否存在已放货位置,找最前面无货的位置 //如果当列其他位置均已放满,则继续找下一列 List tempList = pointMapper.findPointByParentPoint(schBasePoint.getParent_point_code()); - for(SchBasePoint tempPoint:tempList){ - if(tempPoint.getVehicle_qty()!=0||ObjectUtil.isNotEmpty(schBasePoint.getIng_task_code())){ - if(temp!=null){ - return temp; + + for (SchBasePoint tempPoint : tempList) { + if ((tempPoint.getVehicle_qty() != 0 || ObjectUtil.isNotEmpty(schBasePoint.getIng_task_code())) + ) { + break; // 如果当前库位非空,则跳出循环 + } else { + if(tempPoint.getPoint_code().endsWith("01")) { + temp = tempPoint; // 更新最大空库位 } - temp=tempPoint; } } - if(temp==null){ - continue; + if (temp != null) { + log.info("固化室取货任务找到当前符合条件的缓存区位置{}", schBasePoint.getPoint_code()); } - log.info("固化室取货任务找到当前符合条件的缓存区位置{}",schBasePoint.getPoint_code()); return temp; } } @@ -227,19 +231,23 @@ public class GHSQHTask extends AbstractTask { taskObj.setRemark("执行中"); } if (status.equals(TaskStatus.FINISHED)) { // 完成 - StringBuilder group_id= new StringBuilder(); - // 终点解锁 - endPointObj.setIng_task_code(""); - endPointObj.setVehicle_code(startPointObj.getVehicle_code()); - endPointObj.setVehicle_type(startPointObj.getVehicle_type()); - endPointObj.setVehicle_code(startPointObj.getVehicle_code()); - endPointObj.setVehicle_qty(startPointObj.getVehicle_qty()); - endPointObj.setUpdate_time(DateUtil.now()); - pointService.update(endPointObj); + StringBuilder group_id = new StringBuilder(); + // 终点解锁,缓存区现在由一个点位改为三个点位,所以将物料存在010203三个位置上 + for(int i=1;i<=3;i++) { + SchBasePoint point = pointService.getById(endPoint.substring(0,endPoint.length()-1)+i); + point.setIng_task_code(""); + List vehicleCodeList = Arrays.stream(startPointObj.getVehicle_code().split(",")).collect(Collectors.toList()); + point.setVehicle_code(vehicleCodeList.get(i-1)); + point.setVehicle_type(startPointObj.getVehicle_type()); + point.setVehicle_qty(1); + point.setUpdate_time(DateUtil.now()); + pointService.update(point); + } //固化室放料完毕后,将当前一整排都标记上物料信息,防止出现混放情况 - pointMapper.updateVehicleType(endPointObj.getPoint_code().substring(0,endPointObj.getPoint_code().length()-2),endPointObj.getVehicle_type()); + pointMapper.updateVehicleType(endPointObj.getPoint_code().substring(0, endPointObj.getPoint_code().length() - 2), endPointObj.getVehicle_type()); List vehicleCodeList = Arrays.stream(startPointObj.getVehicle_code().split(",")).collect(Collectors.toList()); - for(String vehicleCode:vehicleCodeList) { + for (int i=0;i() .eq(SchBaseVehiclematerialgroup::getVehicle_code, vehicleCode) .eq(SchBaseVehiclematerialgroup::getGroup_bind_material_status, @@ -248,9 +256,9 @@ public class GHSQHTask extends AbstractTask { throw new BadRequestException(vehicleCode + " => " + startPointObj.getVehicle_type() + "的组盘信息未找到"); } one.setTask_code(taskObj.getTask_code()); - one.setPoint_code(endPointObj.getPoint_code()); // 当前位置 - one.setPoint_name(endPointObj.getPoint_name()); - one.setMove_way(one.getMove_way()==null?"":(one.getMove_way() + " -> ") + endPointObj.getPoint_code()); + one.setPoint_code(endPointObj.getPoint_code().substring(0,endPointObj.getPoint_code().length()-1)+(i+1)); // 当前位置 + one.setPoint_name(endPointObj.getPoint_name().substring(0,endPointObj.getPoint_name().length()-1)+(i+1)); + one.setMove_way(one.getMove_way() == null ? "" : (one.getMove_way() + " -> ") + endPointObj.getPoint_code().substring(0,endPointObj.getPoint_code().length()-1)+(i+1)); one.setUpdate_id(GeneralDefinition.ACS_ID); one.setUpdate_name(GeneralDefinition.ACS_NAME); one.setUpdate_time(DateUtil.now()); @@ -267,7 +275,8 @@ public class GHSQHTask extends AbstractTask { taskObj.setRemark("任务完成"); //如果起点点位为10结尾视为最后该固化室最后一个任务,取完后通知acs取货完毕 - if(taskObj.getPoint_code1().endsWith("10")) { + // (如果不放满的情况可以固化,可能逻辑需要改成任务完成时检测当前固化室所有点位是否已完成) + if (taskObj.getPoint_code1().endsWith("10")) { String middle = taskObj.getPoint_code1().substring(taskObj.getPoint_code1().length() - 4, taskObj.getPoint_code1().length() - 2); //通知acs已经放满,固化室可以进行固化 String device_code = "ZDM" + middle; @@ -302,15 +311,15 @@ public class GHSQHTask extends AbstractTask { @SneakyThrows @Override - protected void feedbackTaskState(JSONObject param,SchBaseTask schBaseTask, BaseResponse result) { + protected void feedbackTaskState(JSONObject param, SchBaseTask schBaseTask, BaseResponse result) { //todo 重算最优点 - SchBasePoint startPoint=pointService.getOne(new LambdaQueryWrapper() + SchBasePoint startPoint = pointService.getOne(new LambdaQueryWrapper() .eq(SchBasePoint::getPoint_code, schBaseTask.getPoint_code1())); - SchBasePoint nextPoint=this.findNextPoint(startPoint); - if(ObjectUtil.isEmpty(nextPoint)){ - throw new Exception("当前起点"+schBaseTask.getPoint_code1()+"未找到合适的放货点位"); + SchBasePoint nextPoint = this.findNextPoint(startPoint); + if (ObjectUtil.isEmpty(nextPoint)) { + throw new Exception("当前起点" + schBaseTask.getPoint_code1() + "未找到合适的放货点位"); } - //上位记的是整一个缓存区三个点,整体搬运时反馈点位带01 - schBaseTask.setPoint_code2(nextPoint.getPoint_code()+"01"); + //上位记的是整一个缓存区三个点 + schBaseTask.setPoint_code2(nextPoint.getPoint_code()); } }