| | |
| | | stopPatrol: 'STOP PATROL', |
| | | moreOperation: 'More Operation', |
| | | oneClickLocate: 'One-click Locate', |
| | | oneClickPatrol: 'One-click Patrol', |
| | | cancelPatrol: 'Cancel Patrol', |
| | | }, |
| | | mode: { |
| | | observer: 'OBSERVER', |
| | |
| | | stopPatrol: '停止 巡逻', |
| | | moreOperation: '更多操作', |
| | | oneClickLocate: '一键定位', |
| | | oneClickPatrol: '一键巡逻', |
| | | cancelPatrol: '取消巡逻', |
| | | }, |
| | | mode: { |
| | | observer: '观察模式', |
| | |
| | | ListItemText, |
| | | CircularProgress, |
| | | } from '@mui/material'; |
| | | import { handleLocateAllAgv } from "../http"; |
| | | import { locateAllAgv, startPatrolBatch, cancelPatrolBatch } from "../http"; |
| | | import GpsFixedIcon from '@mui/icons-material/GpsFixed'; |
| | | import { VERIFY_PASSWORD } from '@/config/setting'; |
| | | import TimelineIcon from '@mui/icons-material/Timeline'; |
| | | import CloseIcon from '@mui/icons-material/Close'; |
| | | |
| | | const MoreOperate = ({ }) => { |
| | | const translate = useTranslate(); |
| | |
| | | } |
| | | } |
| | | |
| | | const handleLocateAll = async () => { |
| | | setLoading(true) |
| | | const debounced = async (fn) => { |
| | | setLoading(true); |
| | | try { |
| | | await handleLocateAllAgv(); |
| | | await fn(); |
| | | } finally { |
| | | setLoading(false); |
| | | } |
| | | } |
| | | |
| | | const handleLocateAll = () => { |
| | | debounced(locateAllAgv); |
| | | } |
| | | |
| | | const handleStartPatrolBatch = () => { |
| | | debounced(startPatrolBatch); |
| | | } |
| | | |
| | | const handleCancelPatrolBatch = () => { |
| | | debounced(cancelPatrolBatch); |
| | | } |
| | | |
| | | return ( |
| | |
| | | <Select |
| | | value={translate('page.map.action.moreOperation')} |
| | | onChange={(event) => { |
| | | console.log(event.target.value); |
| | | }} |
| | | renderValue={() => ( |
| | | <Box sx={{ display: 'flex', alignItems: 'center' }}> |
| | |
| | | </ListItemIcon> |
| | | <ListItemText>{translate('page.map.action.oneClickLocate')}</ListItemText> |
| | | </MenuItem> |
| | | <MenuItem |
| | | onClick={() => { |
| | | verifyPassword(handleStartPatrolBatch); |
| | | }} |
| | | disabled={loading} |
| | | > |
| | | <ListItemIcon> |
| | | {loading |
| | | ? <CircularProgress size={20} /> |
| | | : <TimelineIcon fontSize="small" /> |
| | | } |
| | | </ListItemIcon> |
| | | <ListItemText>{translate('page.map.action.oneClickPatrol')}</ListItemText> |
| | | </MenuItem> |
| | | <MenuItem |
| | | onClick={() => { |
| | | verifyPassword(handleCancelPatrolBatch); |
| | | }} |
| | | disabled={loading} |
| | | > |
| | | <ListItemIcon> |
| | | {loading |
| | | ? <CircularProgress size={20} /> |
| | | : <CloseIcon fontSize="small" /> |
| | | } |
| | | </ListItemIcon> |
| | | <ListItemText>{translate('page.map.action.cancelPatrol')}</ListItemText> |
| | | </MenuItem> |
| | | </Select> |
| | | {/* <Button |
| | | variant="contained" |
| | | color="primary" |
| | | onClick={handleToggle} |
| | | sx={{ mr: 2 }} |
| | | > |
| | | 重新定位 |
| | | </Button> */} |
| | | </> |
| | | |
| | | ); |
| | | } |
| | | |
| | |
| | | return false; |
| | | } |
| | | |
| | | export const handleLocateAllAgv = async (param) => { |
| | | export const locateAllAgv = async (param) => { |
| | | try { |
| | | const res = await request.post('/handler/locateAllAgv', param, { |
| | | headers: { |
| | |
| | | console.error(error.message); |
| | | } |
| | | return false; |
| | | } |
| | | |
| | | export const startPatrolBatch = async (param) => { |
| | | try { |
| | | const res = await request.post('/handler/patrol/batch/startup', param, { |
| | | headers: { |
| | | 'appKey': HANDLE_APP_KEY |
| | | } |
| | | }); |
| | | const { code, msg, data } = res.data; |
| | | if (code === 200) { |
| | | notify.success(msg); |
| | | return true; |
| | | } else { |
| | | notify.error(msg); |
| | | } |
| | | } catch (error) { |
| | | notify.error(error.message); |
| | | console.error(error.message); |
| | | } |
| | | return false; |
| | | } |
| | | |
| | | export const cancelPatrolBatch = async (param) => { |
| | | try { |
| | | const res = await request.post('/handler/patrol/batch/shutdown', param, { |
| | | headers: { |
| | | 'appKey': HANDLE_APP_KEY |
| | | } |
| | | }); |
| | | const { code, msg, data } = res.data; |
| | | if (code === 200) { |
| | | notify.success(msg); |
| | | return true; |
| | | } else { |
| | | notify.error(msg); |
| | | } |
| | | } catch (error) { |
| | | notify.error(error.message); |
| | | console.error(error.message); |
| | | } |
| | | return false; |
| | | } |
| | |
| | | import java.util.List; |
| | | import java.util.concurrent.CompletableFuture; |
| | | import java.util.concurrent.ExecutionException; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | | * Created by vincent on 8/1/2024 |
| | |
| | | @PreAuthorize("hasAuthority('manager:agv:update')") |
| | | @OperationLog("Locate All Agv") |
| | | @PostMapping("/locateAllAgv") |
| | | public synchronized R locateAllAgv() throws InterruptedException { |
| | | public synchronized R locateAllAgv() { |
| | | final Integer MAP_DEFAULT_LEV = 1; |
| | | redis.deleteValue(RedisConstant.AGV_MAP_ASTAR_DYNAMIC_FLAG, String.valueOf(MAP_DEFAULT_LEV)); |
| | | avoidWaveCalculator.calcDynamicNodeWhenBoot(); |
| | | return R.ok(); |
| | | } |
| | | |
| | | @PreAuthorize("hasAuthority('manager:agv:update')") |
| | | @PostMapping("/patrol/batch/startup") |
| | | public synchronized R patrolBatchStartup() { |
| | | List<Agv> list = agvService.list(new LambdaQueryWrapper<Agv>().eq(Agv::getStatus, StatusType.ENABLE.val)); |
| | | int result = 0; |
| | | for (Agv agv : list) { |
| | | patrolService.startupPatrol(agv.getUuid()); |
| | | result++; |
| | | } |
| | | return R.ok().add(result); |
| | | } |
| | | |
| | | @PreAuthorize("hasAuthority('manager:agv:update')") |
| | | @PostMapping("/patrol/batch/shutdown") |
| | | public synchronized R patrolBatchShutdown() { |
| | | List<Agv> list = agvService.list(new LambdaQueryWrapper<Agv>()); |
| | | for (String agvNo : list.stream().map(Agv::getUuid).collect(Collectors.toList())) { |
| | | if (patrolService.isPatrolling(agvNo)) { |
| | | patrolService.shutdownPatrol(agvNo); |
| | | } |
| | | } |
| | | return R.ok(); |
| | | } |
| | | |
| | | @RequestMapping(value = "/control/agv", method = {RequestMethod.GET, RequestMethod.POST}) |
| | | @Transactional |
| | |
| | | |
| | | public static final Integer MIN_SLICE_PATH_LENGTH = 3; |
| | | |
| | | public static final Integer MAX_JAM_TIMEOUT = 2 * 1000; |
| | | public static final Integer MAX_JAM_TIMEOUT = 3 * 1000; |
| | | |
| | | public static final String EMPTY_OF_ERROR = "EMPTY"; |
| | | |