| | |
| | | zpallet: "zpallet", |
| | | phase: "phase", |
| | | errDesc: "error", |
| | | oriDesc: "origin", |
| | | destDesc: "destination", |
| | | }, |
| | | travel: { |
| | | uuid: "uuid", |
| | |
| | | zpallet: "料箱码", |
| | | phase: "进度", |
| | | errDesc: "异常描述", |
| | | oriDesc: "出发地", |
| | | destDesc: "目的地", |
| | | }, |
| | | travel: { |
| | | uuid: "编号", |
| | |
| | | import React, { useState, useRef, useEffect, useMemo } from "react"; |
| | | import { Box, Card, CardContent, Grid, Typography, Tooltip } from '@mui/material'; |
| | | import { |
| | | Box, |
| | | Card, |
| | | CardContent, |
| | | Grid, |
| | | Typography, |
| | | Tooltip, |
| | | Table, |
| | | TableBody, |
| | | TableCell, |
| | | TableHead, |
| | | TableRow, |
| | | } from '@mui/material'; |
| | | import { |
| | | useTranslate, |
| | | useRecordContext, |
| | | useGetMany, |
| | | Link, |
| | | } from 'react-admin'; |
| | | import PanelTypography from "../components/PanelTypography"; |
| | | import * as Common from '@/utils/common' |
| | | import * as Common from '@/utils/common'; |
| | | import { styled } from '@mui/material/styles'; |
| | | |
| | | const BusPanel = () => { |
| | | const record = useRecordContext(); |
| | | if (!record) return null; |
| | | const translate = useTranslate(); |
| | | const taskIds = record ? record.taskIds : []; |
| | | const { isPending, data: tasks } = useGetMany( |
| | | 'tasks', |
| | | { ids: taskIds }, |
| | | { enabled: !!record } |
| | | ); |
| | | |
| | | if (isPending || !record) return null; |
| | | |
| | | return ( |
| | | <> |
| | | <Card sx={{ width: { xs: 300, sm: 500, md: 600, lg: 800 }, margin: 'auto' }}> |
| | | <Card sx={{ maxWidth: '80%', margin: 'auto' }}> |
| | | <CardContent> |
| | | <Grid container spacing={2}> |
| | | <Grid item xs={12} sx={{ display: 'flex', justifyContent: 'space-between' }}> |
| | |
| | | overflow: 'hidden', |
| | | textOverflow: 'ellipsis', |
| | | }}> |
| | | {Common.camelToPascalWithSpaces(translate('table.field.bus.busNo'))}: {record.seqNum} |
| | | {Common.camelToPascalWithSpaces(translate('table.field.bus.busNo'))}: {record.busNo} |
| | | </Typography> |
| | | {/* inherit, primary, secondary, textPrimary, textSecondary, error */} |
| | | <Typography variant="h6" gutterBottom align="right" > |
| | |
| | | </Grid> |
| | | </Grid> |
| | | <Box height={20}> </Box> |
| | | <Grid container spacing={2}> |
| | | <Grid item xs={6}> |
| | | <PanelTypography |
| | | title="table.field.bus.uuid" |
| | | property={record.uuid} |
| | | /> |
| | | </Grid> |
| | | <Grid item xs={6}> |
| | | <PanelTypography |
| | | title="table.field.bus.busNo" |
| | | property={record.busNo} |
| | | /> |
| | | </Grid> |
| | | <Grid item xs={6}> |
| | | <PanelTypography |
| | | title="table.field.bus.startTime" |
| | | property={record.startTime$} |
| | | /> |
| | | </Grid> |
| | | <Grid item xs={6}> |
| | | <PanelTypography |
| | | title="table.field.bus.endTime" |
| | | property={record.endTime$} |
| | | /> |
| | | </Grid> |
| | | <Grid item xs={6}> |
| | | <PanelTypography |
| | | title="table.field.bus.busSts" |
| | | property={record.busSts$} |
| | | /> |
| | | </Grid> |
| | | <Grid item xs={6}> |
| | | <PanelTypography |
| | | title="table.field.bus.phase" |
| | | property={record.phase} |
| | | /> |
| | | </Grid> |
| | | |
| | | </Grid> |
| | | <Box> |
| | | <Table size="small"> |
| | | <TableHead> |
| | | <TableRow> |
| | | <TableCell> |
| | | {translate('table.field.task.seqNum')} |
| | | </TableCell> |
| | | <TableCellRight> |
| | | {translate('table.field.task.taskType')} |
| | | </TableCellRight> |
| | | <TableCellRight> |
| | | {translate('table.field.task.taskSts')} |
| | | </TableCellRight> |
| | | <TableCellRight> |
| | | {translate('table.field.task.agvId')} |
| | | </TableCellRight> |
| | | <TableCellRight> |
| | | {translate('table.field.task.ioTime')} |
| | | </TableCellRight> |
| | | <TableCellRight> |
| | | {translate('table.field.task.oriDesc')} |
| | | </TableCellRight> |
| | | <TableCellRight> |
| | | {translate('table.field.task.destDesc')} |
| | | </TableCellRight> |
| | | </TableRow> |
| | | </TableHead> |
| | | <TableBody> |
| | | {tasks.map((task) => ( |
| | | <TableRow key={task.id}> |
| | | <TableCell> |
| | | <Link to={`/task/${task.id}`}> |
| | | {task.seqNum} |
| | | </Link> |
| | | </TableCell> |
| | | <TableCellRight> |
| | | {task.taskType$} |
| | | </TableCellRight> |
| | | <TableCellRight> |
| | | {task.taskSts$} |
| | | </TableCellRight> |
| | | <TableCellRight> |
| | | {task.agv$} |
| | | </TableCellRight> |
| | | <TableCellRight> |
| | | {task.ioTime$} |
| | | </TableCellRight> |
| | | <TableCellRight> |
| | | {task.oriDesc} |
| | | </TableCellRight> |
| | | <TableCellRight> |
| | | {task.destDesc} |
| | | </TableCellRight> |
| | | </TableRow> |
| | | ))} |
| | | </TableBody> |
| | | </Table> |
| | | </Box> |
| | | </CardContent> |
| | | </Card > |
| | | </> |
| | | ); |
| | | }; |
| | | |
| | | const TableCellRight = styled(TableCell)({ textAlign: 'right' }); |
| | | |
| | | export default BusPanel; |
| | |
| | | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.util.*; |
| | | import java.util.stream.Collectors; |
| | | |
| | | @RestController |
| | | @RequestMapping("/api") |
| | |
| | | PageParam<Bus, BaseParam> pageParam = new PageParam<>(baseParam, Bus.class); |
| | | PageParam<Bus, BaseParam> page = busService.page(pageParam, pageParam.buildWrapper(true)); |
| | | for (Bus record : page.getRecords()) { |
| | | record.setTasksNum(taskService.count(new LambdaQueryWrapper<Task>().eq(Task::getBusId, record.getId()))); |
| | | List<Task> tasks = taskService.list(new LambdaQueryWrapper<Task>().eq(Task::getBusId, record.getId())); |
| | | if (!Cools.isEmpty(tasks)) { |
| | | record.setTaskIds(tasks.stream().map(Task::getId).collect(Collectors.toList())); |
| | | } |
| | | } |
| | | return R.ok().add(page); |
| | | } |
| | |
| | | |
| | | import java.io.Serializable; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | | @Data |
| | | @TableName("man_bus") |
| | |
| | | private String memo; |
| | | |
| | | @TableField(exist = false) |
| | | private int tasksNum; |
| | | private int tasksNum = 0; |
| | | |
| | | @TableField(exist = false) |
| | | private List<Long> taskIds; |
| | | |
| | | public String getBusSts$(){ |
| | | BusStsService service = SpringUtils.getBean(BusStsService.class); |
| | |
| | | return null; |
| | | } |
| | | |
| | | public String getStatus$(){ |
| | | if (null == this.status){ return null; } |
| | | switch (this.status){ |
| | | case 1: |
| | | return "正常"; |
| | | case 0: |
| | | return "冻结"; |
| | | default: |
| | | return String.valueOf(this.status); |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | public Boolean getStatusBool(){ |
| | | if (null == this.status){ return null; } |
| | | switch (this.status){ |
| | |
| | | } |
| | | } |
| | | |
| | | public String getOriDesc() { |
| | | String oriDesc = ""; |
| | | if (null != this.oriSta) { |
| | | oriDesc = "STA" + " - " + this.getOriSta$(); |
| | | } |
| | | if (null != this.oriLoc) { |
| | | oriDesc = "LOC" + " - " + this.getOriLoc$(); |
| | | } |
| | | if (!Cools.isEmpty(oriDesc) && null != this.oriCode) { |
| | | oriDesc = oriDesc + " (" + this.getOriCode$() + ")"; |
| | | } |
| | | return oriDesc; |
| | | } |
| | | |
| | | public String getDestDesc() { |
| | | String destDesc = ""; |
| | | if (null != this.destSta) { |
| | | destDesc = "STA" + " - " + this.getDestSta$(); |
| | | } |
| | | if (null != this.destLoc) { |
| | | destDesc = "LOC" + " - " + this.getDestLoc$(); |
| | | } |
| | | if (!Cools.isEmpty(destDesc) && null != this.destCode) { |
| | | destDesc = destDesc + " (" + this.getDestCode$() + ")"; |
| | | } |
| | | return destDesc; |
| | | } |
| | | |
| | | } |