skyouc
昨天 8f7e1bf264a5beaca1cf563452bc9ef72dea848f
修复取消组托,收货数量修改错误问题
8个文件已修改
185 ■■■■ 已修改文件
rsf-admin/src/i18n/zh.js 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
rsf-admin/src/page/orders/purchase/PurchaseList.jsx 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
rsf-admin/src/page/task/TaskList.jsx 4 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
rsf-admin/src/page/waitPakin/WaitPakinList.jsx 8 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
rsf-server/src/main/java/com/vincent/rsf/server/manager/controller/TaskController.java 99 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
rsf-server/src/main/java/com/vincent/rsf/server/manager/service/TaskService.java 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
rsf-server/src/main/java/com/vincent/rsf/server/manager/service/impl/TaskServiceImpl.java 64 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
rsf-server/src/main/java/com/vincent/rsf/server/manager/service/impl/WaitPakinServiceImpl.java 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
rsf-admin/src/i18n/zh.js
@@ -187,7 +187,7 @@
        taskItem: '任务档明细',
        taskLog: '任务历史档',
        taskItemLog: '任务明细历史档',
        stock: '入出库存信息',
        stock: '入出库历史',
        stockItem: '单据明细',
        locItem: '库位明细',
        histories: '历史档',
rsf-admin/src/page/orders/purchase/PurchaseList.jsx
@@ -124,7 +124,7 @@
        <StyledDatagrid
          preferenceKey='purchase'
          bulkActionButtons={() => <BulkDeleteButton mutationMode="pessimistic"/>}
          rowClick={'edit'}
          rowClick={false}
          expand={false}
          expandSingle={true}
          omit={['id', 'createTime', 'createBy','channel', 'platCode', 'memo', 'channel','startTime','workQty', 'endTime']}
@@ -151,7 +151,7 @@
          {/* <BooleanField source="statusBool" label="common.field.status" sortable={false} /> */}
          <TextField source="memo" label="common.field.memo" sortable={false} />
          <WrapperField cellClassName="opt" label="common.field.opt">
            <EditButton sx={{ padding: '1px', fontSize: '.75rem' }} />
            <EditButton label="toolbar.detail" sx={{ padding: '1px', fontSize: '.75rem' }} />
            <DeleteButton sx={{ padding: '1px', fontSize: '.75rem' }} mutationMode="pessimistic"/>
          </WrapperField>
        </StyledDatagrid>
rsf-admin/src/page/task/TaskList.jsx
@@ -25,6 +25,7 @@
    SelectInput,
    NumberInput,
    Button,
    EditButton,
} from 'react-admin';
import { Box, Typography, Card, Stack, Drawer } from '@mui/material';
import { styled } from '@mui/material/styles';
@@ -129,7 +130,7 @@
                            <BulkDeleteButton mutationMode={OPERATE_MODE} />
                        </>
                    }
                    rowClick={'edit'}
                    rowClick={false}
                    expand={false}
                    expandSingle={true}
                    omit={['id', 'createTime', 'createBy', 'memo', 'robotCode', 'exceStatus', 'expDesc', 'expCode', 'status', 'sort']}
@@ -156,6 +157,7 @@
                    {/* <BooleanField source="statusBool" label="common.field.status" sortable={false} /> */}
                    <TextField source="memo" label="common.field.memo" sortable={false} />
                    <WrapperField cellClassName="opt" label="common.field.opt" onClick={(e) => e.stopPropagation()} >
                        <EditButton  label="toolbar.detail"/>
                        <DoneButton sx={{ padding: '1px', fontSize: '.75rem' }} ></DoneButton>
                        <CancelButton sx={{ padding: '1px', fontSize: '.75rem' }} mutationMode={OPERATE_MODE} />
                        <SetTopButton sx={{ padding: '1px', fontSize: '.75rem' }} ></SetTopButton>
rsf-admin/src/page/waitPakin/WaitPakinList.jsx
@@ -93,7 +93,7 @@
    const [drawerVal, setDrawerVal] = useState(false);
    const CreateTaskButton = () => {
        const record = useRecordContext();
        const record = useRecordContext();
        const notify = useNotify();
        const refresh = useRefresh();
        const { selectedIds, onUnselectItems, data } = useListContext();
@@ -115,7 +115,7 @@
    }
    const CreateTaskRowButton = () => {
        const record = useRecordContext();
        const record = useRecordContext();
        const refresh = useRefresh();
        const createTask = (event) => {
@@ -124,7 +124,7 @@
            setSource([record])
            refresh()
        }
        return (
            <>
                <Button onClick={(event) => createTask(event)} label={"toolbar.createTask"}>
@@ -166,7 +166,7 @@
                            <CreateTaskButton />
                            {/* <BulkDeleteButton mutationMode={OPERATE_MODE} /> */}
                        </>}
                    rowClick='edit'
                    rowClick={false}
                    omit={['id', 'createTime', 'createBy', 'memo']}
                >
                    <NumberField source="id" />
rsf-server/src/main/java/com/vincent/rsf/server/manager/controller/TaskController.java
@@ -31,17 +31,13 @@
    @Autowired
    private TaskService taskService;
    @Autowired
    private TaskItemService taskItemService;
    @Autowired
    private WaitPakinService waitPakinService;
    @Autowired
    private LocService locService;
    @Autowired
    private BasStationService basStationService;
    @PreAuthorize("hasAuthority('manager:task:list')")
    @PostMapping("/task/page")
@@ -103,75 +99,8 @@
        if (Objects.isNull(ids) || ids.length < 1) {
            return R.error("参数不能为空!!");
        }
        List<Short> longs = Arrays.asList(TaskStsType.GENERATE_IN.id, TaskStsType.GENERATE_OUT.id);
        List<Task> tasks = taskService.list(new LambdaQueryWrapper<Task>().in(Task::getId, ids).in(Task::getTaskStatus, longs));
        if (tasks.isEmpty()) {
            throw new CoolException("任务已处执行状态不可取消!!");
        }
        for (Task task : tasks) {
            //恢复组托状态
            WaitPakin waitPakin = waitPakinService.getOne(new LambdaQueryWrapper<WaitPakin>()
                    .eq(WaitPakin::getBarcode, task.getBarcode())
            );
            if (null != waitPakin) {
                waitPakin.setIoStatus(Short.valueOf(PakinIOStatus.PAKIN_IO_STATUS_DONE.val));
                if (!waitPakinService.updateById(waitPakin)) {
                    throw new CoolException("更新组托状态失败!!");
                }
            }
            Loc loc = locService.getOne(new LambdaQueryWrapper<Loc>()
                    .eq(Loc::getCode, task.getTaskType() < 100 ? task.getTargLoc() : task.getOrgLoc())
            );
            if (null != loc
                    && (loc.getUseStatus().equals(LocStsType.LOC_STS_TYPE_S.type)
                    || loc.getUseStatus().equals(LocStsType.LOC_STS_TYPE_R.type))) {
                loc.setUseStatus(LocStsType.LOC_STS_TYPE_O.type);
                if (!locService.updateById(loc)) {
                    throw new CoolException("更新库位状态失败!!");
                }
            }
            if (task.getWarehType().equals(WarehType.WAREHOUSE_TYPE_AGV.id)){
                BasStation basStation = null;
                if (task.getTaskType().equals(TaskType.TASK_TYPE_IN.type)
                        || task.getTaskType().equals(TaskType.TASK_TYPE_EMPITY_IN.type)
                ){
                    basStation = basStationService.getOne(new LambdaQueryWrapper<BasStation>()
                            .eq(BasStation::getStationName, task.getOrgSite())
                            .eq(BasStation::getUseStatus, StaUseStatusType.TYPE_R.type)
                    );
                } else if (task.getTaskType().equals(TaskType.TASK_TYPE_OUT.type)
                        || task.getTaskType().equals(TaskType.TASK_TYPE_PICK_AGAIN_IN.type)
                        || task.getTaskType().equals(TaskType.TASK_TYPE_MERGE_OUT.type)
                        || task.getTaskType().equals(TaskType.TASK_TYPE_CHECK_OUT.type)
                        || task.getTaskType().equals(TaskType.TASK_TYPE_EMPITY_OUT.type)
                ) {
                    basStation = basStationService.getOne(new LambdaQueryWrapper<BasStation>()
                            .eq(BasStation::getStationName, task.getTargLoc())
                            .eq(BasStation::getUseStatus, StaUseStatusType.TYPE_R.type)
                    );
                }
                if (null == basStation) {
                    throw new CoolException("站点状态错误!!");
                }
                basStation.setUseStatus(StaUseStatusType.TYPE_F.type);
                if (!basStationService.updateById(basStation)){
                    throw new CoolException("更新站点状态失败!!");
                }
            }
        }
        if (!taskService.removeByIds(Arrays.asList(ids))) {
            return R.error("Delete Fail");
        }
        if (!taskItemService.remove(new LambdaQueryWrapper<TaskItem>().in(TaskItem::getTaskId, ids))) {
            return R.error("Details delete Failed");
        }
        return R.ok("Delete Success").add(ids);
       return taskService.removeTask(ids);
//        return R.ok("Delete Success").add(ids);
    }
    @PreAuthorize("hasAuthority('manager:task:list')")
@@ -208,24 +137,24 @@
//        }
//        taskService.completeTask(tasks);
        for (Task task : tasks) {
            task.setTaskStatus(task.getTaskType() < (short)100 ? TaskStsType.COMPLETE_IN.id : TaskStsType.COMPLETE_OUT.id);
            task.setTaskStatus(task.getTaskType() < (short) 100 ? TaskStsType.COMPLETE_IN.id : TaskStsType.COMPLETE_OUT.id);
        }
        if (!taskService.updateBatchById(tasks)){
        if (!taskService.updateBatchById(tasks)) {
            return R.error("完成任务失败");
        }
        return R.ok("完成任务成功");
    }
    @PreAuthorize("hasAuthority('manager:task:update')")
    @ApiOperation("取消任务")
    @PostMapping("/task/cancel/{id}")
    public R cancelTask(@PathVariable String id) {
        if (Objects.isNull(id)) {
            throw new CoolException("参数不能为空!!");
        }
        return R.ok();
    }
//    @PreAuthorize("hasAuthority('manager:task:update')")
//    @ApiOperation("取消任务")
//    @PostMapping("/task/cancel/{id}")
//    public R cancelTask(@PathVariable String id) {
//        if (Objects.isNull(id)) {
//            throw new CoolException("参数不能为空!!");
//        }
//        return R.ok();
//    }
    @PreAuthorize("hasAuthority('manager:task:update')")
    @ApiOperation("任务出库置顶")
rsf-server/src/main/java/com/vincent/rsf/server/manager/service/TaskService.java
@@ -19,4 +19,5 @@
//    R completeTask(String id);
     void completeTask(List<Task> task) throws Exception;
    R removeTask(Long[] ids);
}
rsf-server/src/main/java/com/vincent/rsf/server/manager/service/impl/TaskServiceImpl.java
@@ -60,6 +60,8 @@
    private WaveItemService waveItemService;
    @Autowired
    private WaveService waveService;
    @Autowired
    private BasStationService basStationService;
    @Override
    @Transactional(rollbackFor = Exception.class)
@@ -383,6 +385,68 @@
        }
    }
    @Override
    public R removeTask(Long[] ids) {
        List<Short> longs = Arrays.asList(TaskStsType.GENERATE_IN.id, TaskStsType.GENERATE_OUT.id);
        List<Task> tasks = this.list(new LambdaQueryWrapper<Task>().in(Task::getId, ids).in(Task::getTaskStatus, longs));
        if (tasks.isEmpty()) {
            throw new CoolException("任务已处执行状态不可取消!!");
        }
        for (Task task : tasks) {
            //恢复组托状态
            WaitPakin waitPakin = waitPakinService.getOne(new LambdaQueryWrapper<WaitPakin>()
                    .eq(WaitPakin::getBarcode, task.getBarcode())
            );
            if (null != waitPakin) {
                waitPakin.setIoStatus(Short.valueOf(PakinIOStatus.PAKIN_IO_STATUS_DONE.val));
                if (!waitPakinService.updateById(waitPakin)) {
                    throw new CoolException("更新组托状态失败!!");
                }
            }
            Loc loc = locService.getOne(new LambdaQueryWrapper<Loc>().eq(Loc::getCode, task.getTaskType() < TaskStsType.UPDATED_IN.id ? task.getTargLoc() : task.getOrgLoc()));
            if (null != loc
                    && (loc.getUseStatus().equals(LocStsType.LOC_STS_TYPE_S.type)
                    || loc.getUseStatus().equals(LocStsType.LOC_STS_TYPE_R.type))) {
                loc.setUseStatus(LocStsType.LOC_STS_TYPE_O.type);
                if (!locService.updateById(loc)) {
                    throw new CoolException("更新库位状态失败!!");
                }
            }
            if (!Objects.isNull(task.getWarehType()) && task.getWarehType().equals(WarehType.WAREHOUSE_TYPE_AGV.id)) {
                BasStation basStation = null;
                if (task.getTaskType().equals(TaskType.TASK_TYPE_IN.type) || task.getTaskType().equals(TaskType.TASK_TYPE_EMPITY_IN.type) ) {
                    basStation = basStationService.getOne(new LambdaQueryWrapper<BasStation>()
                            .eq(BasStation::getStationName, task.getOrgSite())
                            .eq(BasStation::getUseStatus, StaUseStatusType.TYPE_R.type)
                    );
                } else if (task.getTaskType().equals(TaskType.TASK_TYPE_OUT.type)
                        || task.getTaskType().equals(TaskType.TASK_TYPE_PICK_AGAIN_IN.type)
                        || task.getTaskType().equals(TaskType.TASK_TYPE_MERGE_OUT.type)
                        || task.getTaskType().equals(TaskType.TASK_TYPE_CHECK_OUT.type)
                        || task.getTaskType().equals(TaskType.TASK_TYPE_EMPITY_OUT.type)
                ) {
                    basStation = basStationService.getOne(new LambdaQueryWrapper<BasStation>()
                            .eq(BasStation::getStationName, task.getTargLoc())
                            .eq(BasStation::getUseStatus, StaUseStatusType.TYPE_R.type)
                    );
                }
                if (null == basStation) {
                    throw new CoolException("站点状态错误!!");
                }
                basStation.setUseStatus(StaUseStatusType.TYPE_F.type);
                if (!basStationService.updateById(basStation)) {
                    throw new CoolException("更新站点状态失败!!");
                }
            }
        }
        if (!this.removeByIds(Arrays.asList(ids))) {
            throw new CoolException("Delete Fail");
        }
        return R.ok("操作成功");
    }
    /**
     * @author Ryan
     * @date 2025/5/20
rsf-server/src/main/java/com/vincent/rsf/server/manager/service/impl/WaitPakinServiceImpl.java
@@ -298,8 +298,7 @@
                    continue;
                }
                double sum = pakin.stream().mapToDouble(WaitPakinItem::getAnfme).sum();
                item.setWorkQty(item.getWorkQty() - sum)
                        .setAnfme(item.getAnfme() + sum);
                item.setWorkQty(item.getWorkQty() - sum);
                if (!warehouseAreasItemService.updateById(item)) {
                    throw new CoolException("收货区数据回滚失败!!");
                }