skyouc
昨天 0d692433815cd80bab48091829c427e22d4663d0
盘点差异单功能优化
4个文件已修改
81 ■■■■■ 已修改文件
rsf-admin/src/page/orders/check/CheckOrderPub.jsx 12 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
rsf-server/src/main/java/com/vincent/rsf/server/api/service/impl/PdaCheckOrderServiceImpl.java 21 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
rsf-server/src/main/java/com/vincent/rsf/server/manager/schedules/TaskSchedules.java 38 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
rsf-server/src/main/java/com/vincent/rsf/server/manager/service/impl/TaskServiceImpl.java 10 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
rsf-admin/src/page/orders/check/CheckOrderPub.jsx
@@ -73,7 +73,11 @@
    const getLocs = async (ids) => {
        const { data: { code, data, msg } } = await request.post('/check/locs/' + ids);
        if (code === 200) {
            console.log('----->');
            console.log(data);
            setRows(data)
            const matnrs = selectedMatnr.filter(item => data.some(bigData => bigData.matnrCode === item));
            // setSelectedMatnr(matnrs)
        } else {
            notify(msg);
        }
@@ -222,7 +226,7 @@
                            </Box>
                            <Box sx={{ textAlign: 'center' }}>
                                <CloseButton setOpen={setOpen} />
                                <SubmitButton selectedIds={selectedIds} setOpen={setOpen} setSelectedIds={setSelectedIds} rowSelectedIds={rowSelectedIds} gridRef={gridRef} record={record} />
                                <SubmitButton selectedIds={selectedIds} setOpen={setOpen} setSelectedIds={setSelectedIds} selectedMatnr={selectedMatnr} rowSelectedIds={rowSelectedIds} gridRef={gridRef} record={record} />
                            </Box>
                        </Card>
                    </Grid>
@@ -420,7 +424,7 @@
//提交按钮
const SubmitButton = ({ selectedIds, setSelectedIds, rowSelectedIds, gridRef, record, setOpen }) => {
const SubmitButton = ({ selectedIds, setSelectedIds, rowSelectedIds, gridRef, record, setOpen, selectedMatnr }) => {
    const notify = useNotify();
    const refresh = useRefresh();
    const translate = useTranslate();
@@ -441,7 +445,9 @@
            }
        })
        const { data: { code, data, msg } } = await request.post('/check/generate/tasks', records);
        let params = records.filter(record => record?.items.length > 0);
        const { data: { code, data, msg } } = await request.post('/check/generate/tasks', params);
        if (code == 200) {
            refresh();
            setOpen(false)
rsf-server/src/main/java/com/vincent/rsf/server/api/service/impl/PdaCheckOrderServiceImpl.java
@@ -1,6 +1,7 @@
package com.vincent.rsf.server.api.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.vincent.rsf.framework.common.Cools;
import com.vincent.rsf.framework.common.R;
import com.vincent.rsf.framework.exception.CoolException;
@@ -128,7 +129,7 @@
                        .setOrderType(OrderType.ORDER_CHECK.type)
                        .setSourceCode(diffItem.getOrderCode())
                        .setWkType(Short.parseShort(OrderWorkType.ORDER_WORK_TYPE_STOCK_CHECK.type))
                        .setAnfme(diffItem.getAnfme())
                        .setAnfme(diffItem.getCheckQty())
                        .setWorkQty(0.0)
                        .setBatch(diffItem.getBatch())
                        .setMaktx(matnr.getName())
@@ -151,7 +152,7 @@
                    throw new CoolException("新增盘点明细保存失败!!");
                }
                diffItem.setTaskItemId(taskItem.getId());
                diffItem.setTaskItemId(taskItem.getId()).setExceStatus(CheckDiffExceStatus.CHECK_DIFF_EXCE_STATUS_HOLD.val);
                if (!checkDiffItemService.updateById(diffItem)) {
                    throw new CoolException("明细修改失败!!");
@@ -162,14 +163,18 @@
                    return R.error("数据错误,未找到差异单明细");
                }
                diffItem.setCheckQty(ckDiffItem.getCheckQty()).setReason(ckDiffItem.getReason()).setMemo(ckDiffItem.getMemo());
            }
            diffItem.setExceStatus(CheckDiffExceStatus.CHECK_DIFF_EXCE_STATUS_HOLD.val);
            if (!checkDiffItemService.updateById(diffItem)) {
                throw new CoolException("更新差异单明细失败");
                diffItem.setExceStatus(CheckDiffExceStatus.CHECK_DIFF_EXCE_STATUS_HOLD.val);
                if (!checkDiffItemService.updateById(diffItem)) {
                    throw new CoolException("更新差异单明细失败");
                }
                if (!taskItemService.update(new LambdaUpdateWrapper<TaskItem>()
                        .set(TaskItem::getAnfme, diffItem.getCheckQty())
                        .eq(TaskItem::getId, diffItem.getTaskItemId()))) {
                    throw new CoolException("任务数量修改失败!!");
                }
            }
//            Double checkQty = Math.round((checkDiff.getCheckQty() + diffItem.getCheckQty()) * 10000) / 10000.0;
//            checkDiff.setCheckQty(checkQty);
        }
        List<CheckDiffItem> diffItems = checkDiffItemService.list(new LambdaQueryWrapper<CheckDiffItem>()
rsf-server/src/main/java/com/vincent/rsf/server/manager/schedules/TaskSchedules.java
@@ -138,25 +138,25 @@
    /**
     * 每五秒校验深库位是否为空,如果浅库位有货,将浅库位移至深库位
     */
    @Scheduled(cron = "0/35 * * * * ?  ")
    @Transactional(rollbackFor = Exception.class)
    public void shallocToDeep() throws Exception {
        List<Loc> locs = locService.list(new LambdaQueryWrapper<Loc>()
                .eq(Loc::getUseStatus, LocStsType.LOC_STS_TYPE_O.type)
                .in(Loc::getRow, rows));
        if (locs.isEmpty()) {
            return;
        }
        for (Loc loc : locs) {
            String shallowLoc = LocUtils.getShallowLoc(loc.getCode());
            Loc one = locService.getOne(new LambdaQueryWrapper<Loc>().eq(Loc::getCode, shallowLoc));
            if (Objects.isNull(one) || !one.getUseStatus().equals(LocStsType.LOC_STS_TYPE_F.type)) {
                continue;
            }
            taskService.moveToDeep(SystemAuthUtils.getLoginUserId(), shallowLoc);
        }
    }
     *///TODO 生成移库任务前,需要检查是否有任务前往当前托盘
//    @Scheduled(cron = "0/35 * * * * ?  ")
//    @Transactional(rollbackFor = Exception.class)
//    public void shallocToDeep() throws Exception {
//        List<Loc> locs = locService.list(new LambdaQueryWrapper<Loc>()
//                .eq(Loc::getUseStatus, LocStsType.LOC_STS_TYPE_O.type)
//                .in(Loc::getRow, rows));
//        if (locs.isEmpty()) {
//            return;
//        }
//        for (Loc loc : locs) {
//            String shallowLoc = LocUtils.getShallowLoc(loc.getCode());
//            Loc one = locService.getOne(new LambdaQueryWrapper<Loc>().eq(Loc::getCode, shallowLoc));
//            if (Objects.isNull(one) || !one.getUseStatus().equals(LocStsType.LOC_STS_TYPE_F.type)) {
//                continue;
//            }
//            taskService.moveToDeep(SystemAuthUtils.getLoginUserId(), shallowLoc);
//        }
//    }
    /**
rsf-server/src/main/java/com/vincent/rsf/server/manager/service/impl/TaskServiceImpl.java
@@ -997,19 +997,23 @@
        tempLocs.forEach(working -> {
            taskItems.forEach(taskItem -> {
                if (taskItem.getMatnrId().equals(working.getMatnrId())) {
                    Double minQty = Math.round((working.getAnfme() - taskItem.getAnfme()) * 10000) / 10000.0;
                    Double minQty = taskItem.getAnfme();
                    if (!task.getTaskType().equals(TaskType.TASK_TYPE_CHECK_IN.type)) {
                        minQty =  Math.round((working.getAnfme() - taskItem.getAnfme()) * 10000) / 10000.0;
                    }
                    if (minQty.compareTo(0.0) > 0) {
                        taskItem.setAnfme(minQty);
                        if (!taskItemService.updateById(taskItem)) {
                            throw new CoolException("任务明细修改失败!!");
                        }
                    } else {
                        if (!taskItemService.removeById(taskItem)) {
                            throw new CoolException("任务明细修改失败!!");
                        }
                    }
                }
            });
        });
        List<Long> matnrIds = taskItems.stream().map(TaskItem::getMatnrId).collect(Collectors.toList());
@@ -1035,7 +1039,7 @@
        });
        locItemWorkingService.remove(new LambdaQueryWrapper<LocItemWorking>().eq(LocItemWorking::getTaskId, task.getId()));
        Loc loc1 = locService.getOne(new LambdaQueryWrapper<Loc>().eq(Loc::getCode, task.getOrgLoc()));
        Loc loc1 = locService.getOne(new LambdaQueryWrapper<Loc>().eq(Loc::getCode, task.getTargLoc()));
        if (Objects.isNull(loc1)) {
            throw new CoolException("目标库位不存在!!");
        }