skyouc
昨天 45430b88dab1451ecff39236dab01d5668b5b9c8
no message
1个文件已删除
8个文件已修改
190 ■■■■■ 已修改文件
rsf-admin/src/i18n/en.js 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
rsf-admin/src/i18n/zh.js 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
rsf-admin/src/page/task/TaskList.jsx 13 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
rsf-server/src/main/java/basContainer.sql 24 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
rsf-server/src/main/java/com/vincent/rsf/server/manager/controller/TaskController.java 18 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
rsf-server/src/main/java/com/vincent/rsf/server/manager/entity/Task.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
rsf-server/src/main/java/com/vincent/rsf/server/manager/schedules/TaskSchedules.java 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
rsf-server/src/main/java/com/vincent/rsf/server/manager/service/TaskService.java 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
rsf-server/src/main/java/com/vincent/rsf/server/manager/service/impl/TaskServiceImpl.java 122 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
rsf-admin/src/i18n/en.js
@@ -1117,6 +1117,7 @@
        locInit: 'loc init',
        siteInit: 'site init',
        batch: 'batch',
        pick: 'Pick',
        confirm: 'confirm',
        cancel: "cancel",
        query: "Query",
rsf-admin/src/i18n/zh.js
@@ -1115,6 +1115,7 @@
        continue: '继续收货',
        batch: '批量操作',
        confirm: '确认',
        pick: '拣料',
        bulkExport: "批量导出",
        selectSite: '选择站点',
        confirmSelect: '确认选择',
rsf-admin/src/page/task/TaskList.jsx
@@ -43,6 +43,7 @@
import ConfirmButton from "../components/ConfirmButton";
import { PAGE_DRAWER_WIDTH, OPERATE_MODE, DEFAULT_PAGE_SIZE } from '@/config/setting';
import * as Common from '@/utils/common';
import ColorizeOutlinedIcon from '@mui/icons-material/ColorizeOutlined';
const StyledDatagrid = styled(DatagridConfigurable)(({ theme }) => ({
    '& .css-1vooibu-MuiSvgIcon-root': {
@@ -160,7 +161,7 @@
                        <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> */}
                        <PickButton />
                    </WrapperField>
                </StyledDatagrid>
            </List>
@@ -177,13 +178,21 @@
export default TaskList;
/**
 * 拣料出库
 * @returns
 */
const PickButton = () => {
    const record = useRecordContext();
    const notify = useNotify();
    const refresh = useRefresh();
    const pickClick = () => {
    }
    return (
        record?.taskStatus == 103 ? <ConfirmButton label={""} />
        record?.taskStatus == 103 ? <ConfirmButton label={"toolbar.pick"} startIcon={<ColorizeOutlinedIcon />} onConfirm={pickClick}/> : <></>
    )
}
rsf-server/src/main/java/basContainer.sql
File was deleted
rsf-server/src/main/java/com/vincent/rsf/server/manager/controller/TaskController.java
@@ -132,10 +132,6 @@
        }
        List<Short> longs = Arrays.asList(TaskStsType.GENERATE_IN.id, TaskStsType.GENERATE_OUT.id);
        List<Task> tasks = taskService.list(new LambdaQueryWrapper<Task>().eq(Task::getId, id).in(Task::getTaskStatus, longs));
//        if (tasks.isEmpty()) {
//            throw new CoolException("任务已处执行状态不可一键完成!!");
//        }
//        taskService.completeTask(tasks);
        for (Task task : tasks) {
            task.setTaskStatus(task.getTaskType() < (short) 100 ? TaskStsType.COMPLETE_IN.id : TaskStsType.COMPLETE_OUT.id);
        }
@@ -146,6 +142,20 @@
        return R.ok("完成任务成功");
    }
    /**
     * 拣料出库
     * @return
     */
    @PreAuthorize("hasAuthority('manager:task:update')")
    @ApiOperation("拣料出库")
    @PostMapping("/task/pick/{id}")
    public R pickTask(@PathVariable Long id) {
        if (Objects.isNull(id)) {
            throw new CoolException("能数不能为空!!");
        }
        return taskService.pickTask(id);
    }
//    @PreAuthorize("hasAuthority('manager:task:update')")
//    @ApiOperation("取消任务")
//    @PostMapping("/task/cancel/{id}")
rsf-server/src/main/java/com/vincent/rsf/server/manager/entity/Task.java
@@ -253,7 +253,7 @@
        if (Objects.isNull(dictDatas) || Objects.isNull(dictDatas.getLabel())) {
            return null;
        }
        return dictDatas.getLabel();
        return dictDatas.getValue() + "." + dictDatas.getLabel();
    }
    public String getTaskType$() {
@@ -267,7 +267,7 @@
        if (Objects.isNull(dictDatas) || Objects.isNull(dictDatas.getLabel())) {
            return null;
        }
        return dictDatas.getLabel();
        return dictDatas.getValue() + "." + dictDatas.getLabel();
    }
    public String getStartTime$(){
rsf-server/src/main/java/com/vincent/rsf/server/manager/schedules/TaskSchedules.java
@@ -144,10 +144,5 @@
        if (!taskItemService.removeByIds(itemIds)) {
            throw new CoolException("原始任务明细删除失败!!");
        }
    }
}
rsf-server/src/main/java/com/vincent/rsf/server/manager/service/TaskService.java
@@ -20,4 +20,6 @@
     void completeTask(List<Task> task) throws Exception;
    R removeTask(Long[] ids);
    R pickTask(Long id);
}
rsf-server/src/main/java/com/vincent/rsf/server/manager/service/impl/TaskServiceImpl.java
@@ -16,6 +16,7 @@
import com.vincent.rsf.server.system.constant.SerialRuleCode;
import com.vincent.rsf.server.system.enums.LocStsType;
import com.vincent.rsf.server.system.utils.SerialRuleUtils;
import lombok.Synchronized;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
@@ -62,6 +63,8 @@
    private WaveService waveService;
    @Autowired
    private BasStationService basStationService;
    @Autowired
    private TaskService taskService;
    @Override
    @Transactional(rollbackFor = Exception.class)
@@ -371,20 +374,39 @@
     * @param tasks
     * @throws Exception
     */
    @Synchronized
    @Override
    @Transactional(rollbackFor = Exception.class)
    public synchronized void completeTask(List<Task> tasks) throws Exception {
    public void completeTask(List<Task> tasks) throws Exception {
        for (Task task : tasks) {
            //出库任务
            if (task.getTaskType() < TaskType.TASK_TYPE_OUT.type) {
                //入库任务
                if (task.getTaskType().equals(TaskType.TASK_TYPE_IN.type)) {
                    //1.入库
                complateInstock(task);
                } else if (task.getTaskType().equals(TaskType.TASK_TYPE_PICK_IN.type)) {
                    //53.拣料再入库
                }
            } else {
                //出库任务
                if (task.getTaskType().equals(TaskType.TASK_TYPE_OUT.type)) {
                    //全托出库
                complateOutStock(task);
                } else if (task.getTaskType().equals(TaskType.TASK_TYPE_PICK_AGAIN_IN.type)) {
                    //拣料出库,
                    taskService.pickTask(task.getId());
                }
            }
        }
    }
    /**
     * 任务取消
     *
     * @param ids
     * @return
     */
    @Override
    public R removeTask(Long[] ids) {
        List<Short> longs = Arrays.asList(TaskStsType.GENERATE_IN.id, TaskStsType.GENERATE_OUT.id);
@@ -444,7 +466,50 @@
            throw new CoolException("Delete Fail");
        }
        return R.ok("操作成功");
        return R.ok("取消完成");
    }
    /**
     * 拣料出库
     *
     * @param id
     * @return
     */
    @Override
    public R pickTask(Long id) {
        Task task = this.getById(id);
        if (Objects.isNull(task)) {
            throw new CoolException("当前任务不存在!!");
        }
        if (!task.getTaskType().equals(TaskType.TASK_TYPE_PICK_AGAIN_IN.type)) {
            throw new CoolException("非拣料出库 ,不可执行此操作!!");
        }
        Loc loc = locService.getOne(new LambdaQueryWrapper<Loc>()
                .eq(Loc::getCode, task.getOrgLoc()));
        if (Objects.isNull(loc)) {
            throw new CoolException("没有空库位!!");
        }
        String ruleCode = SerialRuleUtils.generateRuleCode(SerialRuleCode.SYS_TASK_CODE, task);
        //更新任务主单
        task.setTaskCode(ruleCode)
                .setTaskType(TaskType.TASK_TYPE_PICK_IN.type)
                .setTargLoc(task.getOrgLoc()) //出库源库位变入库目标库位
                .setTaskStatus(TaskStsType.GENERATE_IN.id);
        if (!this.updateById(task)) {
            throw new CoolException("任务状态更新失败!!");
        }
        //修改库位状态 预约出库.R==>预约入库.S
        loc.setUseStatus(StaUseStatusType.TYPE_S.type);
        if (!locService.updateById(loc)) {
            throw new CoolException("库位状态更新失败!!");
        }
        return R.ok("拣货成功!!");
    }
    /**
@@ -456,15 +521,23 @@
    @Transactional(rollbackFor = Exception.class)
    public synchronized void complateOutStock(Task task) {
        if (Objects.isNull(task)) {
            return;
            throw new CoolException("参数不能为空!!");
        }
        Loc loc = locService.getOne(new LambdaQueryWrapper<Loc>().eq(Loc::getCode, task.getOrgLoc()));
        if (Objects.isNull(loc)) {
            throw new CoolException("库位不存在!!");
        }
        if (!loc.getUseStatus().equals(LocStsType.LOC_STS_TYPE_R.type)) {
            throw new CoolException("库位状态不处理于R.出库预约!!");
        }
        List<TaskItem> taskItems = taskItemService.list(new LambdaQueryWrapper<TaskItem>().eq(TaskItem::getTaskId, task.getId()));
        if (taskItems.isEmpty()) {
            throw new CoolException("任务明细不存在!!");
        }
        try {
            //更新库位明细
            subtractLocItem(taskItems, task.getId());
            subtractLocItem(taskItems, loc);
        } catch (Exception e) {
            throw new RuntimeException(e.getMessage());
        }
@@ -497,13 +570,9 @@
            }
        }
        /**修改库位状态为F.在库*/
        List<Loc> locs = locService.list(new LambdaQueryWrapper<Loc>().eq(Loc::getCode, task.getTargLoc()));
        if (locs.isEmpty()) {
            //如单据明细为空,修改为库位状态为O.空库
            if (!locService.update(new LambdaUpdateWrapper<Loc>().set(Loc::getUseStatus, LocStsType.LOC_STS_TYPE_O.type).eq(Loc::getCode, task.getTargLoc()))) {
        /**修改为库位状态为O.空库*/
        if (!locService.update(new LambdaUpdateWrapper<Loc>().set(Loc::getUseStatus, LocStsType.LOC_STS_TYPE_O.type).eq(Loc::getCode, loc.getId()))) {
                throw new CoolException("库位状态修改失败!!");
            }
        }
        if (!this.update(new LambdaUpdateWrapper<Task>().eq(Task::getId, task.getId()).set(Task::getTaskStatus, TaskStsType.UPDATED_OUT.id))) {
            throw new CoolException("任务状态修改失败!!");
@@ -561,34 +630,9 @@
     * @version 1.0
     */
    @Transactional(rollbackFor = Exception.class)
    public void subtractLocItem(List<TaskItem> items, Long taskId) throws Exception {
        Task task = this.getById(taskId);
        if (Objects.isNull(task)) {
            throw new CoolException("任务不存在!!");
        }
        for (TaskItem item : items) {
            LocItem locItem = locItemService.getOne(new LambdaQueryWrapper<LocItem>()
                    .eq(LocItem::getBatch, item.getBatch())
                    .eq(LocItem::getFieldsIndex, item.getFieldsIndex())
                    .eq(LocItem::getMatnrId, item.getMatnrId())
                    .eq(LocItem::getLocCode, task.getTargLoc()));
            if (Objects.isNull(locItem)) {
                throw new CoolException("库存明细不存在!!");
            }
            //剩余库存
            Double minuValue = (Math.round((locItem.getAnfme() - locItem.getWorkQty() - locItem.getQty()) * 10000.0) / 10000.0);
            if (minuValue.compareTo(item.getAnfme()) <= 0) {
                //剩余库存小于出库库存,移除当前库存信息
                if (!locItemService.removeById(locItem.getId())) {
                    throw new CoolException("库存删除失败!!");
                }
            } else {
                locItem.setWorkQty((Math.round((locItem.getWorkQty() - minuValue) * 10000.0) / 10000.0));
                locItem.setQty((Math.round((minuValue + locItem.getQty()) * 10000.0) / 10000.0));
                if (!locItemService.updateById(locItem)) {
                    throw new CoolException("库存信息更新失败!!");
                }
            }
    public void subtractLocItem(List<TaskItem> items, Loc loc) throws Exception {
        if (!locItemService.remove(new LambdaQueryWrapper<LocItem>().eq(LocItem::getLocId, loc.getId()))) {
            throw new CoolException("库存明细删除失败!!");
        }
    }