| | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; |
| | | import com.zy.acs.common.constant.RedisConstant; |
| | | import com.zy.acs.common.domain.AgvAction; |
| | | import com.zy.acs.common.domain.AgvActionItem; |
| | | import com.zy.acs.common.domain.AgvProtocol; |
| | | import com.zy.acs.common.domain.BaseResult; |
| | | import com.zy.acs.common.domain.*; |
| | | import com.zy.acs.common.domain.protocol.*; |
| | | import com.zy.acs.common.domain.protocol.action.*; |
| | | import com.zy.acs.common.enums.*; |
| | |
| | | long actionPrepareSts = ActionStsType.PREPARE.val(); |
| | | // JSONObject storeDirection = configService.getVal("storeDirection", JSONObject.class); |
| | | int angleOffsetVal = configService.getVal("mapAngleOffsetVal", Integer.class); |
| | | // Double defaultShelfDepth = configService.getVal("defaultShelfDepth", Double.class); |
| | | // defaultShelfDepth = Optional.ofNullable(defaultShelfDepth).orElse((double) 0); |
| | | String agvNo = agvService.getAgvNo(agvId); |
| | | // if (!agvService.judgeEnable(agvId)) { |
| | | // throw new CoolException("AGV[" + agvNo + "]当前不可用..."); |
| | |
| | | ActionTypeType.ReadyTakeFromShelvesLoc.desc, // 名称 |
| | | (double) agvDirectionType.val, // 属性值 |
| | | lastCode.getData(), // 地面码 |
| | | String.valueOf(oriLoc.getOffset()), // 动作参数 |
| | | JSON.toJSONString(new HeightDepthDto(oriLoc.getOffset())), // 动作参数 |
| | | ActionTypeType.ReadyTakeFromShelvesLoc.val(), // 动作类型 |
| | | actionPrepareSts, // 动作进度 |
| | | agvId, // AGV |
| | |
| | | ActionTypeType.ReadyReleaseToShelvesLoc.desc, // 名称 |
| | | (double) agvDirectionType.val, // 属性值 |
| | | lastCode.getData(), // 地面码 |
| | | String.valueOf(destLoc.getOffset()), // 动作参数 |
| | | JSON.toJSONString(new HeightDepthDto(destLoc.getOffset())), // 动作参数 |
| | | ActionTypeType.ReadyReleaseToShelvesLoc.val(), // 动作类型 |
| | | actionPrepareSts, // 动作进度 |
| | | agvId, // AGV |
| | |
| | | ActionTypeType.ReadyTakeFromConveyorSta.desc, // 名称 |
| | | staWorkDirection, // 属性值 |
| | | lastCode.getData(), // 地面码 |
| | | String.valueOf(oriSta.getOffset()), // 动作参数 |
| | | JSON.toJSONString(new HeightDepthDto(oriSta.getHeight(), Optional.ofNullable(oriSta.getDepth()).orElse((double) 0))), // 动作参数 |
| | | ActionTypeType.ReadyTakeFromConveyorSta.val(), // 动作类型 |
| | | actionPrepareSts, // 动作进度 |
| | | agvId, // AGV |
| | |
| | | ActionTypeType.ReadyReleaseToConveyorSta.desc, // 名称 |
| | | staWorkDirection, // 属性值 |
| | | lastCode.getData(), // 地面码 |
| | | String.valueOf(destSta.getOffset()), // 动作参数 |
| | | JSON.toJSONString(new HeightDepthDto(destSta.getHeight(), Optional.ofNullable(destSta.getDepth()).orElse((double) 0))), // 动作参数 |
| | | ActionTypeType.ReadyReleaseToConveyorSta.val(), // 动作类型 |
| | | actionPrepareSts, // 动作进度 |
| | | agvId, // AGV |
| | |
| | | agvAction.add(new AgvActionItem<>(ReadyTakeFromShelvesLoc.class) |
| | | .setVal(action.getVal().intValue()) |
| | | .setQrCode(action.getCode()) |
| | | .bodySync(body -> body.setHeight((short) Double.parseDouble(action.getParams()))) |
| | | .bodySync((body) -> { |
| | | HeightDepthDto heightDepthDto = JSON.parseObject(action.getParams(), HeightDepthDto.class); |
| | | body.setHeight(heightDepthDto.getHeight()); |
| | | body.setDepth(heightDepthDto.getDepth()); |
| | | }) |
| | | ); |
| | | break; |
| | | case ReadyTakeFromConveyorSta: |
| | | agvAction.add(new AgvActionItem<>(ReadyTakeFromConveyorSta.class) |
| | | .setVal(action.getVal().intValue()) |
| | | .setQrCode(action.getCode()) |
| | | .bodySync(body -> body.setHeight((short) Double.parseDouble(action.getParams()))) |
| | | .bodySync((body) -> { |
| | | HeightDepthDto heightDepthDto = JSON.parseObject(action.getParams(), HeightDepthDto.class); |
| | | body.setHeight(heightDepthDto.getHeight()); |
| | | body.setDepth(heightDepthDto.getDepth()); |
| | | }) |
| | | ); |
| | | break; |
| | | case ReadyTakeFromAgvSite: |
| | |
| | | agvAction.add(new AgvActionItem<>(ReadyReleaseToShelvesLoc.class) |
| | | .setVal(action.getVal().intValue()) |
| | | .setQrCode(action.getCode()) |
| | | .bodySync(body -> body.setHeight((short) Double.parseDouble(action.getParams()))) |
| | | ); |
| | | break; |
| | | case LoadPlatformLift: |
| | | agvAction.add(new AgvActionItem<>(LoadPlatformLift.class) |
| | | .setVal(action.getVal().intValue()) |
| | | .setQrCode(action.getCode()) |
| | | .bodySync(body -> body.setHeight((short) Double.parseDouble(action.getParams()))) |
| | | .bodySync((body) -> { |
| | | HeightDepthDto heightDepthDto = JSON.parseObject(action.getParams(), HeightDepthDto.class); |
| | | body.setHeight(heightDepthDto.getHeight()); |
| | | body.setDepth(heightDepthDto.getDepth()); |
| | | }) |
| | | ); |
| | | break; |
| | | case ReadyReleaseToConveyorSta: |
| | | agvAction.add(new AgvActionItem<>(ReadyReleaseToConveyorSta.class) |
| | | .setVal(action.getVal().intValue()) |
| | | .setQrCode(action.getCode()) |
| | | .bodySync(body -> body.setHeight((short) Double.parseDouble(action.getParams()))) |
| | | .bodySync((body) -> { |
| | | HeightDepthDto heightDepthDto = JSON.parseObject(action.getParams(), HeightDepthDto.class); |
| | | body.setHeight(heightDepthDto.getHeight()); |
| | | body.setDepth(heightDepthDto.getDepth()); |
| | | }) |
| | | ); |
| | | break; |
| | | case ReadyReleaseToAgvSite: |
| | |
| | | .setVal(action.getVal().intValue()) |
| | | .setQrCode(action.getCode()) |
| | | .bodySync(body -> body.setDepth((short) Double.parseDouble(action.getParams()))) |
| | | ); |
| | | break; |
| | | case LoadPlatformLift: |
| | | agvAction.add(new AgvActionItem<>(LoadPlatformLift.class) |
| | | .setVal(action.getVal().intValue()) |
| | | .setQrCode(action.getCode()) |
| | | .bodySync(body -> body.setHeight((short) Double.parseDouble(action.getParams()))) |
| | | ); |
| | | break; |
| | | case FinishPath: |
| | |
| | | // load from sta |
| | | sta = staService.getById(currTask.getOriSta()); |
| | | // reserve to be waiting |
| | | if (!staReserveService.waitingStaReserve(sta, currTask, 1, StaReserveType.OUT)) { |
| | | if (!staReserveService.waitingStaReserve(sta, currTask, currSeg, 1, StaReserveType.OUT)) { |
| | | break; |
| | | } |
| | | // convey plc valid |
| | |
| | | // place to sta |
| | | sta = staService.getById(currTask.getDestSta()); |
| | | // reserve to be waiting |
| | | if (!staReserveService.waitingStaReserve(sta, currTask, 1, StaReserveType.IN)) { |
| | | if (!staReserveService.waitingStaReserve(sta, currTask, currSeg, 1, StaReserveType.IN)) { |
| | | break; |
| | | } |
| | | // convey plc valid |