| | |
| | | type: { |
| | | MOVE: 'MOVE', |
| | | TO_CHARGE: 'TO_CHARGE', |
| | | STOP_CHARGING: 'STOP_CHARGING', |
| | | TO_STANDBY: 'TO_STANDBY', |
| | | LOC_TO_LOC: 'LOC_TO_LOC', |
| | | LOC_TO_STA: 'LOC_TO_STA', |
| | |
| | | MOVE: '移动', |
| | | TO_STANDBY: '去待机位', |
| | | TO_CHARGE: '去充电', |
| | | STOP_CHARGING: '断开充电', |
| | | LOC_TO_LOC: '库位到库位', |
| | | LOC_TO_STA: '库位到站点', |
| | | STA_TO_LOC: '站点到库位', |
| | |
| | | }) |
| | | } |
| | | |
| | | export const handleStopChargingAgv = async (param, callback) => { |
| | | await request.post('/handler/control/agv/charge/stop', param, { |
| | | headers: { |
| | | 'appKey': HANDLE_APP_KEY |
| | | } |
| | | }).then((res) => { |
| | | const { code, msg, data } = res.data; |
| | | if (code === 200) { |
| | | notify.success(msg); |
| | | if (callback) { |
| | | callback(data) |
| | | } |
| | | } else { |
| | | notify.error(msg); |
| | | } |
| | | }).catch((error) => { |
| | | notify.error(error.message); |
| | | console.error(error.message); |
| | | }) |
| | | } |
| | | |
| | | export const handleRestoreAgvAll = async (param, callback) => { |
| | | await request.post('/handler/restore/agv', param, { |
| | | headers: { |
| | |
| | | Toolbar, |
| | | useTheme, |
| | | Autocomplete, |
| | | CircularProgress, |
| | | } from '@mui/material'; |
| | | import CheckOutlinedIcon from '@mui/icons-material/CheckOutlined'; |
| | | import RestartAltIcon from '@mui/icons-material/RestartAlt'; |
| | | import useCoolHook from './useCoolHook'; |
| | | import { handleControlAgv } from '../../http'; |
| | | import { handleControlAgv, handleStopChargingAgv } from '../../http'; |
| | | |
| | | function AgvControl(props) { |
| | | const { curAgvNo } = props; |
| | | const { curAgvNo, curAgvInfo } = props; |
| | | const theme = useTheme(); |
| | | const translate = useTranslate(); |
| | | |
| | |
| | | }, |
| | | }); |
| | | |
| | | const isUnderdriveAgv = curAgvInfo?.agvModelType === 'UNDERDRIVE_AGV'; |
| | | const taskModes = [ |
| | | { value: 'MOVE', label: translate('page.map.insight.control.type.MOVE') }, |
| | | { value: 'TO_CHARGE', label: translate('page.map.insight.control.type.TO_CHARGE') }, |
| | | { value: 'TO_STANDBY', label: translate('page.map.insight.control.type.TO_STANDBY') }, |
| | | { value: 'LOC_TO_LOC', label: translate('page.map.insight.control.type.LOC_TO_LOC') }, |
| | | { value: 'LOC_TO_STA', label: translate('page.map.insight.control.type.LOC_TO_STA') }, |
| | | { value: 'STA_TO_LOC', label: translate('page.map.insight.control.type.STA_TO_LOC') }, |
| | | { value: 'STA_TO_STA', label: translate('page.map.insight.control.type.STA_TO_STA') }, |
| | | { value: 'TO_CHARGE', label: translate('page.map.insight.control.type.TO_CHARGE') }, |
| | | ...(isUnderdriveAgv ? [{ |
| | | value: 'STOP_CHARGING', |
| | | label: translate('page.map.insight.control.type.STOP_CHARGING') |
| | | }] : []), |
| | | ]; |
| | | |
| | | useEffect(() => { |
| | |
| | | |
| | | const onSubmit = (data) => { |
| | | if (curAgvNo) { |
| | | if (data.taskMode === 'STOP_CHARGING') { |
| | | handleStopChargingAgv({ agvNo: curAgvNo }, () => { |
| | | |
| | | }); |
| | | return; |
| | | } |
| | | handleControlAgv({ agvNo: curAgvNo, ...data }, () => { |
| | | |
| | | }); |
| | |
| | | {activeTab === 1 && ( |
| | | <AgvControl |
| | | curAgvNo={curAgvNo} |
| | | curAgvInfo={curAgvInfo} |
| | | /> |
| | | )} |
| | | {activeTab === 2 && ( |
| | |
| | | ) |
| | | } |
| | | |
| | | export default AgvInsight; |
| | | export default AgvInsight; |
| | |
| | | @Autowired |
| | | private TaskService taskService; |
| | | @Autowired |
| | | private AgvModelService agvModelService; |
| | | @Autowired |
| | | private MainService mainService; |
| | | @Autowired |
| | | private MainLockWrapService mainLockWrapService; |
| | |
| | | return R.ok(); |
| | | } |
| | | |
| | | @PreAuthorize("hasAuthority('manager:agv:update')") |
| | | @PostMapping("/control/agv/charge/stop") |
| | | public R stopCharging(@RequestHeader String appKey, |
| | | @RequestBody HandlerPublishParam param) { |
| | | if (Cools.isEmpty(param.getAgvNo(), appKey)) { |
| | | return R.error(); |
| | | } |
| | | if (!APP_KEY.equals(appKey)) { |
| | | return R.error(); |
| | | } |
| | | |
| | | Agv agv = agvService.selectByUuid(param.getAgvNo()); |
| | | if (agv == null) { |
| | | return R.error("AGV不存在"); |
| | | } |
| | | AgvModel agvModel = agvModelService.getByAgvId(agv.getId()); |
| | | if (agvModel == null || !AgvModelType.UNDERDRIVE_AGV.toString().equals(agvModel.getType())) { |
| | | return R.error("当前AGV车型不支持断开充电"); |
| | | } |
| | | if (!hikInstantActionPublishService.support(agv.getId())) { |
| | | return R.error("当前AGV协议不支持断开充电"); |
| | | } |
| | | |
| | | hikInstantActionPublishService.publishStopCharging(agv.getUuid()); |
| | | return R.ok("断开充电指令已发送"); |
| | | } |
| | | |
| | | private void publishRestoreCancelIfNeeded(Agv agv) { |
| | | if (agv == null) { |
| | | return; |
| | |
| | | throw new CoolException("agvNo can not be blank"); |
| | | } |
| | | |
| | | HkInstantActionMessage message = new HkInstantActionMessage(); |
| | | message.setHeaderId(snowflakeIdWorker.nextId()); |
| | | message.setTimestamp(Instant.now().toString()); |
| | | message.setVersion(hikOrderProperties.getMajorVersion()); |
| | | message.setManufacturer(hikOrderProperties.getManufacturer()); |
| | | message.setSerialNumber(agvNo); |
| | | message.setActions(Utils.singletonList(buildCancelOrderAction())); |
| | | publish(agvNo, buildCancelOrderAction(), "cancelOrder"); |
| | | } |
| | | |
| | | HkInstantActionDown down = new HkInstantActionDown(); |
| | | down.setAgvNo(agvNo); |
| | | down.setInstantActionMessage(message); |
| | | redis.pushStrict(RedisConstant.HK_AGV_INSTANT_ACTION_DOWN_FLAG, down); |
| | | public void publishStopCharging(String agvNo) { |
| | | if (!StringUtils.hasText(agvNo)) { |
| | | throw new CoolException("agvNo can not be blank"); |
| | | } |
| | | |
| | | log.info("push hik cancelOrder instant action to redis, agvNo={}, redisKey={}", |
| | | agvNo, RedisConstant.HK_AGV_INSTANT_ACTION_DOWN_FLAG); |
| | | publish(agvNo, buildStopChargingAction(), "stopCharging"); |
| | | } |
| | | |
| | | private HkAction buildCancelOrderAction() { |
| | |
| | | action.setActionParameters(parameters); |
| | | return action; |
| | | } |
| | | |
| | | private HkAction buildStopChargingAction() { |
| | | HkAction action = new HkAction(); |
| | | action.setActionId("stopCharging-" + snowflakeIdWorker.nextId()); |
| | | action.setActionType(HkActionType.STOP_CHARGING); |
| | | action.setBlockingType(HkBlockingType.HARD); |
| | | action.setActionParameters(new ArrayList<>()); |
| | | return action; |
| | | } |
| | | |
| | | private void publish(String agvNo, HkAction action, String actionName) { |
| | | HkInstantActionMessage message = new HkInstantActionMessage(); |
| | | message.setHeaderId(snowflakeIdWorker.nextId()); |
| | | message.setTimestamp(Instant.now().toString()); |
| | | message.setVersion(hikOrderProperties.getMajorVersion()); |
| | | message.setManufacturer(hikOrderProperties.getManufacturer()); |
| | | message.setSerialNumber(agvNo); |
| | | message.setActions(Utils.singletonList(action)); |
| | | |
| | | HkInstantActionDown down = new HkInstantActionDown(); |
| | | down.setAgvNo(agvNo); |
| | | down.setInstantActionMessage(message); |
| | | redis.pushStrict(RedisConstant.HK_AGV_INSTANT_ACTION_DOWN_FLAG, down); |
| | | |
| | | log.info("push hik {} instant action to redis, agvNo={}, redisKey={}", |
| | | actionName, agvNo, RedisConstant.HK_AGV_INSTANT_ACTION_DOWN_FLAG); |
| | | } |
| | | } |
| | |
| | | @Autowired |
| | | private AgvDetailService agvDetailService; |
| | | @Autowired |
| | | private AgvModelService agvModelService; |
| | | @Autowired |
| | | private FloydNavigateService floydNavigateService; |
| | | @Autowired |
| | | private MapService mapService; |
| | |
| | | MapAgvVo vo = new MapAgvVo(); |
| | | vo.setAgvId(agv.getId()); |
| | | vo.setAgvNo(agv.getUuid()); |
| | | AgvModel agvModel = agvModelService.getByAgvId(agv.getId()); |
| | | if (agvModel != null) { |
| | | vo.setAgvModelType(agvModel.getType()); |
| | | } |
| | | vo.setStatus(agv.getStatus()); |
| | | if (null != agvDetail) { |
| | | vo.setOnline(agvService.judgeOnline(agvDetail.getAgvId())); |
| | |
| | | |
| | | private String agvNo; |
| | | |
| | | private String agvModelType; |
| | | |
| | | private Integer status; |
| | | |
| | | private Boolean online = Boolean.FALSE; |