#
luxiaotao1123
2024-09-24 3f4fb86fe372668ae30504ed39a2c228cf4ef91d
#
5个文件已修改
142 ■■■■ 已修改文件
zy-acs-flow/src/page/task/TaskList.jsx 7 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zy-acs-manager/src/main/java/com/zy/acs/manager/core/scheduler/KernelScheduler.java 8 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zy-acs-manager/src/main/java/com/zy/acs/manager/manager/controller/BusController.java 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zy-acs-manager/src/main/java/com/zy/acs/manager/manager/service/TaskService.java 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zy-acs-manager/src/main/java/com/zy/acs/manager/manager/service/impl/TaskServiceImpl.java 124 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zy-acs-flow/src/page/task/TaskList.jsx
@@ -32,6 +32,7 @@
    DeleteButton,
    FunctionField,
    Pagination,
    useNotify,
} from 'react-admin';
import { Box, Chip, Card, Stack } from '@mui/material';
import { styled } from '@mui/material/styles';
@@ -130,7 +131,7 @@
const TaskList = () => {
    const translate = useTranslate();
    const notify = useNotify();
    const [createDialog, setCreateDialog] = useState(false);
    const [drawerVal, setDrawerVal] = useState(false);
@@ -179,8 +180,8 @@
                        <MyExportButton />
                    </TopToolbar>
                )}
                pagination={<Pagination rowsPerPageOptions={[10, 20, 50, 100]} />}
                perPage={20}
                pagination={<Pagination rowsPerPageOptions={[10, 25, 50, 100]} />}
                perPage={25}
                aside={<TaskListAside />}
            >
                <StyledDatagrid
zy-acs-manager/src/main/java/com/zy/acs/manager/core/scheduler/KernelScheduler.java
@@ -122,6 +122,14 @@
                    log.error("Bus [{}] 更新失败 !!!", bus.getUuid());
                }
            }
            long cancelNum = taskList.stream().filter(task -> TaskStsType.CANCEL.val() == task.getTaskSts()).count();
            if (cancelNum == taskList.size()) {
                bus.setBusSts(BusStsType.CANCEL.val());
                bus.setUpdateTime(new Date());
                if (!busService.updateById(bus)) {
                    log.error("Bus [{}] 更新失败 !!!", bus.getUuid());
                }
            }
        }
    }
zy-acs-manager/src/main/java/com/zy/acs/manager/manager/controller/BusController.java
@@ -181,7 +181,6 @@
        if (!busService.updateById(bus)) {
            return R.error("Cancel Fail");
        }
        return R.ok("Cancel Success");
     }
zy-acs-manager/src/main/java/com/zy/acs/manager/manager/service/TaskService.java
@@ -19,8 +19,6 @@
    List<Task> selectInSts(Long agvId, TaskStsType... taskStsTypes);
    void operateTaskSts(Integer taskId, Boolean finish);
    List<Map<String, Object>> selectStatByLastSevenDays();
    Boolean complete(Long taskId, Long userId);
zy-acs-manager/src/main/java/com/zy/acs/manager/manager/service/impl/TaskServiceImpl.java
@@ -75,80 +75,18 @@
    }
    @Override
    @Transactional
    public void operateTaskSts(Integer taskId, Boolean finish) {
        Task task = this.getById(taskId);
        Loc oriLoc = null; Loc destLoc = null;
        Sta oriSta = null; Sta destSta = null;
        Date now = new Date();
        TaskTypeType typeType = TaskTypeType.get(task.getTaskTypeEl());
        switch (Objects.requireNonNull(typeType)) {
            case LOC_TO_LOC:
                oriLoc = locService.getById(task.getOriLoc());
                destLoc = locService.getById(task.getDestLoc());
                oriLoc.setLocSts(finish?LocStsType.IDLE.val():LocStsType.STOCK.val());
                oriLoc.setUpdateTime(now);
                if (!locService.updateById(oriLoc)) {
                    throw new BusinessException("Loc [" + task.getOriLoc$() + "] 库位修改状态失败 !!!");
                }
                destLoc.setLocSts(finish?LocStsType.STOCK.val():LocStsType.IDLE.val());
                destLoc.setUpdateTime(now);
                if (!locService.updateById(destLoc)) {
                    throw new BusinessException("Loc [" + task.getDestLoc$() + "] 库位修改状态失败 !!!");
                }
                break;
            case LOC_TO_STA:
                oriLoc = locService.getById(task.getOriLoc());
                oriLoc.setLocSts(finish?LocStsType.IDLE.val():LocStsType.STOCK.val());
                oriLoc.setUpdateTime(now);
                if (!locService.updateById(oriLoc)) {
                    throw new BusinessException("Loc [" + task.getOriLoc$() + "] 库位修改状态失败 !!!");
                }
                break;
            case STA_TO_LOC:
                destLoc = locService.getById(task.getDestLoc());
                destLoc.setLocSts(finish?LocStsType.STOCK.val():LocStsType.IDLE.val());
                destLoc.setUpdateTime(now);
                if (!locService.updateById(destLoc)) {
                    throw new BusinessException("Loc [" + task.getDestLoc$() + "] 库位修改状态失败 !!!");
                }
                break;
            case STA_TO_STA:
                break;
            case TO_CHARGE:
            case TO_STANDBY:
                FuncSta funcSta = funcStaService.getByCodeAndType(task.getDestCode(), FuncStaType.query(typeType).toString());
                if (!finish) {
                    funcSta.setState(FuncStaStateType.IDLE.toString());
                    funcSta.setUpdateTime(now);
                    if (!funcStaService.updateById(funcSta)) {
                        throw new BusinessException("FuncSta [" + funcSta.getName() + "] 更新状态失败 !!!");
                    }
                }
                break;
            default:
                break;
        }
        task.setTaskSts(TaskStsType.COMPLETE.val());
        task.setUpdateTime(now);
        if (!this.updateById(task)) {
            throw new BusinessException(task.getSeqNum() + "任务更新状态失败");
        }
    }
    @Override
    public List<Map<String, Object>> selectStatByLastSevenDays() {
        return this.baseMapper.selectStatByLastSevenDays();
    }
    @Override
    @Transactional
    public Boolean complete(Long taskId, Long userId) {
        Task task = this.getById(taskId);
        if (null == task) {
            return Boolean.FALSE;
        }
        this.maintainLocSts(task, Boolean.TRUE);
        task.setTaskSts(TaskStsType.COMPLETE.val());
        task.setUpdateTime(new Date());
@@ -160,11 +98,13 @@
    }
    @Override
    @Transactional
    public Boolean cancel(Long taskId, Long userId) {
        Task task = this.getById(taskId);
        if (null == task) {
            return Boolean.FALSE;
        }
        this.maintainLocSts(task, Boolean.FALSE);
        task.setTaskSts(TaskStsType.CANCEL.val());
        task.setUpdateTime(new Date());
@@ -175,5 +115,61 @@
        return Boolean.TRUE;
    }
    @Transactional
    public void maintainLocSts(Task task, Boolean complete) {
        Loc oriLoc = null; Loc destLoc = null;
        Sta oriSta = null; Sta destSta = null;
        Date now = new Date();
        TaskTypeType typeType = TaskTypeType.get(task.getTaskTypeEl());
        switch (Objects.requireNonNull(typeType)) {
            case LOC_TO_LOC:
                oriLoc = locService.getById(task.getOriLoc());
                destLoc = locService.getById(task.getDestLoc());
                oriLoc.setLocSts(complete?LocStsType.IDLE.val():LocStsType.STOCK.val());
                oriLoc.setUpdateTime(now);
                if (!locService.updateById(oriLoc)) {
                    throw new BusinessException("Loc [" + task.getOriLoc$() + "] 库位修改状态失败 !!!");
                }
                destLoc.setLocSts(complete?LocStsType.STOCK.val():LocStsType.IDLE.val());
                destLoc.setUpdateTime(now);
                if (!locService.updateById(destLoc)) {
                    throw new BusinessException("Loc [" + task.getDestLoc$() + "] 库位修改状态失败 !!!");
                }
                break;
            case LOC_TO_STA:
                oriLoc = locService.getById(task.getOriLoc());
                oriLoc.setLocSts(complete?LocStsType.IDLE.val():LocStsType.STOCK.val());
                oriLoc.setUpdateTime(now);
                if (!locService.updateById(oriLoc)) {
                    throw new BusinessException("Loc [" + task.getOriLoc$() + "] 库位修改状态失败 !!!");
                }
                break;
            case STA_TO_LOC:
                destLoc = locService.getById(task.getDestLoc());
                destLoc.setLocSts(complete?LocStsType.STOCK.val():LocStsType.IDLE.val());
                destLoc.setUpdateTime(now);
                if (!locService.updateById(destLoc)) {
                    throw new BusinessException("Loc [" + task.getDestLoc$() + "] 库位修改状态失败 !!!");
                }
                break;
            case STA_TO_STA:
                break;
            case TO_CHARGE:
            case TO_STANDBY:
                FuncSta funcSta = funcStaService.getByCodeAndType(task.getDestCode(), FuncStaType.query(typeType).toString());
                if (!complete) {
                    funcSta.setState(FuncStaStateType.IDLE.toString());
                    funcSta.setUpdateTime(now);
                    if (!funcStaService.updateById(funcSta)) {
                        throw new BusinessException("FuncSta [" + funcSta.getName() + "] 更新状态失败 !!!");
                    }
                }
                break;
            default:
                break;
        }
    }
}