skyouc
2025-05-29 76b63d955e90f66fff58496c0311b74b692f7320
Merge branch 'devlop' of http://47.97.1.152:5880/r/wms-master into devlop
22个文件已修改
1个文件已添加
777 ■■■■ 已修改文件
rsf-server/src/main/java/com/vincent/rsf/server/api/service/MobileService.java 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
rsf-server/src/main/java/com/vincent/rsf/server/api/service/impl/MobileServiceImpl.java 10 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
rsf-server/src/main/java/com/vincent/rsf/server/api/service/impl/WcsServiceImpl.java 12 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
rsf-server/src/main/java/com/vincent/rsf/server/api/utils/LocUtils.java 259 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
rsf-server/src/main/java/com/vincent/rsf/server/common/config/ConfigProperties.java 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
rsf-server/src/main/java/com/vincent/rsf/server/manager/controller/LocItemController.java 6 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
rsf-server/src/main/java/com/vincent/rsf/server/manager/controller/TaskController.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
rsf-server/src/main/java/com/vincent/rsf/server/manager/entity/Task.java 14 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
rsf-server/src/main/java/com/vincent/rsf/server/manager/entity/TaskItem.java 13 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
rsf-server/src/main/java/com/vincent/rsf/server/manager/entity/WaitPakinItemLog.java 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
rsf-server/src/main/java/com/vincent/rsf/server/manager/enums/PakinIOStatus.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
rsf-server/src/main/java/com/vincent/rsf/server/manager/schedules/ScheduleJobs.java 51 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
rsf-server/src/main/java/com/vincent/rsf/server/manager/schedules/TaskSchedules.java 36 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
rsf-server/src/main/java/com/vincent/rsf/server/manager/service/LocItemService.java 6 ●●●●● 补丁 | 查看 | 原始文档 | 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/AsnOrderServiceImpl.java 15 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
rsf-server/src/main/java/com/vincent/rsf/server/manager/service/impl/LocItemServiceImpl.java 47 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
rsf-server/src/main/java/com/vincent/rsf/server/manager/service/impl/OutStockServiceImpl.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
rsf-server/src/main/java/com/vincent/rsf/server/manager/service/impl/QlyIsptItemServiceImpl.java 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
rsf-server/src/main/java/com/vincent/rsf/server/manager/service/impl/TaskServiceImpl.java 189 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
rsf-server/src/main/java/com/vincent/rsf/server/manager/service/impl/WaitPakinServiceImpl.java 19 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
rsf-server/src/main/java/com/vincent/rsf/server/system/utils/SystemAuthUtils.java 75 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
rsf-server/src/main/resources/application.yml 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
rsf-server/src/main/java/com/vincent/rsf/server/api/service/MobileService.java
@@ -40,7 +40,6 @@
    WaitPakin mergeItems(WaitPakinParam waitPakin, Long userId);
    WaitPakin unBind(WaitPakinParam param);
    R inspect(String code, Long loginUserId);
rsf-server/src/main/java/com/vincent/rsf/server/api/service/impl/MobileServiceImpl.java
@@ -237,7 +237,7 @@
            throw new CoolException("数据错误:主单不存在!!");
        }
        //TODO /**收货数量累加,1. 会出超收情况 2. 会有收货不足情况*/
        Double rcptedQty = asnOrder.getQty() + receiptQty;
        Double rcptedQty = Math.round((asnOrder.getQty() + receiptQty) * 10000) / 10000.0;
        asnOrder.setQty(rcptedQty).setExceStatus(AsnExceStatus.ASN_EXCE_STATUS_EXCE_ING.val);
        if (!asnOrderMapper.updateById(asnOrder)) {
@@ -288,7 +288,7 @@
                throw new CoolException("请输入正确的时间格式!!");
            }
            Double itemRcptQty = dto.getReceiptQty() + orderItem.getQty();
            Double itemRcptQty = Math.round((dto.getReceiptQty() + orderItem.getQty()) * 10000) / 10000.0;
            Boolean allowOver = false;
            if (!Objects.isNull(config)) {
                if (Boolean.parseBoolean(config.getVal())) {
@@ -401,7 +401,8 @@
        if (!Objects.isNull(serviceOne)) {
            item.setId(serviceOne.getId());
            item.setAnfme(item.getAnfme() + serviceOne.getAnfme());
            Double anfme = Math.round((item.getAnfme() + serviceOne.getAnfme()) * 10000) / 10000.0;
            item.setAnfme(anfme);
        }
        //未质检
@@ -1094,7 +1095,8 @@
            if (Objects.isNull(stockItem)) {
                detlsDto.setStockQty(0.0);
            } else {
                detlsDto.setStockQty(stockItem.getAnfme() + stockItem.getWorkQty());
                Double anfme = Math.round((stockItem.getAnfme() + stockItem.getWorkQty()) * 10000) / 10000.0;
                detlsDto.setStockQty(anfme);
            }
            if (!Objects.isNull(asnOrderItem.getPoDetlId())) {
rsf-server/src/main/java/com/vincent/rsf/server/api/service/impl/WcsServiceImpl.java
@@ -144,7 +144,7 @@
    private WaitPakin validateWaitPakin(String barcode) {
        WaitPakin waitPakin = waitPakinService.getOne(new LambdaQueryWrapper<WaitPakin>()
                .eq(WaitPakin::getBarcode, barcode)
                .eq(WaitPakin::getIoStatus, Short.parseShort(PakinIOStatus.PAKIN_IO_STATUS_DONE.val)));
                .eq(WaitPakin::getIoStatus, PakinIOStatus.PAKIN_IO_STATUS_DONE.val));
        if (Cools.isEmpty(waitPakin)) {
            throw new CoolException("请检查组拖状态是否完成!!");
@@ -331,7 +331,7 @@
//        return locNo;
//    }
    @Override
    public InTaskMsgDto getLocNo(TaskInParam param) throws Exception{
    public InTaskMsgDto getLocNo(TaskInParam param) throws Exception {
        String matnr = null;
        String batch = null;
        List<WaitPakin> waitPakins = waitPakinService.list(new LambdaQueryWrapper<WaitPakin>().eq(WaitPakin::getBarcode, param.getBarcode()));
@@ -414,10 +414,10 @@
                List<LocItem> locItems = locItemService.list(new LambdaQueryWrapper<LocItem>().eq(LocItem::getMatnrCode, matnr));
                for (LocItem locItem : locItems) {
                    Loc loc1 = locService.getById(locItem.getLocId());
                    if (LocUtils.isShallowLoc(slaveProperties, loc1.getCode())) {
                    if (LocUtils.isShallowLoc(loc1.getCode())) {
                        continue;
                    }
                    String shallowLocNo = LocUtils.getShallowLoc(slaveProperties, loc1.getCode());
                    String shallowLocNo = LocUtils.getShallowLoc(loc1.getCode());
                    // 检测目标库位是否为空库位
                    Loc shallowLoc = locService.getOne(new LambdaQueryWrapper<Loc>().eq(Loc::getCode, shallowLocNo));
                    if (shallowLoc != null && shallowLoc.getUseStatus().equals(LocStsType.LOC_STS_TYPE_O.type)) {
@@ -488,7 +488,7 @@
                if (!LocUtils.locMoveCheckLocTypeComplete(locMast1, locTypeDto)) {
                    continue;
                }
                String shallowLoc = LocUtils.getDeepLoc(slaveProperties, locMast1.getCode());
                String shallowLoc = LocUtils.getDeepLoc(locMast1.getCode());
                if ((ioType == 1 && deviceBind.getBeSimilar().equals("1"))) {
                    //相似物料打开,判断深库位有没有货,没货就放深库位,有货就不操作
                    Loc locMast2 = locService.getOne(new LambdaQueryWrapper<Loc>()
@@ -529,7 +529,7 @@
                        continue;
                    }
                    if (deviceBind.getBeSimilar().equals("1")) {
                        String shallowLoc = LocUtils.getDeepLoc(slaveProperties, locMast1.getCode());
                        String shallowLoc = LocUtils.getDeepLoc(locMast1.getCode());
                        Loc locMast2 = locService.getOne(new LambdaQueryWrapper<Loc>()
                                .eq(Loc::getCode, shallowLoc)
                                .eq(Loc::getUseStatus, LocStsType.LOC_STS_TYPE_O.type)
rsf-server/src/main/java/com/vincent/rsf/server/api/utils/LocUtils.java
@@ -10,6 +10,7 @@
import com.vincent.rsf.server.api.entity.dto.LocTypeDto;
import com.vincent.rsf.server.manager.entity.*;
import com.vincent.rsf.server.manager.enums.LocStsType;
import com.vincent.rsf.server.manager.enums.TaskStsType;
import com.vincent.rsf.server.manager.enums.TaskType;
import com.vincent.rsf.server.manager.service.*;
import org.slf4j.Logger;
@@ -45,11 +46,11 @@
    /**
     * 获取 浅库位对应的深库位号
     */
    public static String getDeepLoc(SlaveProperties slaveProperties, String shallowLoc) {
    public static String getDeepLoc(String shallowLoc) {
        LocService locService = SpringUtils.getBean(LocService.class);
        Loc shaLoc = locService.getOne(new LambdaQueryWrapper<Loc>().eq(Loc::getCode, shallowLoc));
        int row = shaLoc.getRow()-1;
        boolean contains = slaveProperties.getDoubleLocs().contains(row);
        boolean contains = doubleLocs.contains(row);
        Loc deepLoc = null;
        if (contains) {
            deepLoc = locService.getOne(new LambdaQueryWrapper<Loc>()
@@ -72,7 +73,7 @@
    /**
     * 获取 深库位对应的浅库位号
     */
    public static String getShallowLoc(SlaveProperties slaveProperties, String deepLoc) {
    public static String getShallowLoc(String deepLoc) {
        LocService locService = SpringUtils.getBean(LocService.class);
        Loc depLoc = locService.getOne(new LambdaQueryWrapper<Loc>().eq(Loc::getCode, deepLoc));
        int row;
@@ -81,7 +82,7 @@
        } else {
            row = depLoc.getRow();
        }
        boolean contains = slaveProperties.getDoubleLocs().contains(row);
        boolean contains = doubleLocs.contains(row);
        Loc shallowLoc = null;
        if (!contains) {
            shallowLoc = locService.getOne(new LambdaQueryWrapper<Loc>()
@@ -104,10 +105,10 @@
    /**
     * 判断是否为浅库位
     */
    public static boolean isShallowLoc(SlaveProperties slaveProperties, String locNo) {
        if (slaveProperties.isDoubleDeep()) {
    public static boolean isShallowLoc(String locNo) {
        if (isDoubleDeep) {
            int row = getRow(locNo);
            return !slaveProperties.getDoubleLocs().contains(row);
            return !doubleLocs.contains(row);
        } else {
            return false;
        }
@@ -213,8 +214,8 @@
    }
    public static String  getCrnLoc() {
        SlaveProperties bean = SpringUtils.getBean(SlaveProperties.class);
        System.out.println(bean.getDoubleLocs());
//        SlaveProperties bean = SpringUtils.getBean(SlaveProperties.class);
        System.out.println(doubleLocs);
        return null;
    }
@@ -233,4 +234,244 @@
            return msgBuilder.toString();
        }
    }
    /**
     * 获取堆垛机库位信息
     * @param deviceBind
     * @param area
     * @param sourceStaNo
     * @param matnr
     * @param batch
     * @param locTypeDto
     * @param times
     * @param ioType 作业类型(*必传参数)
     * @return
     */
    public static InTaskMsgDto getLocNoCrn(DeviceBind deviceBind, Long area, Integer sourceStaNo, String matnr, String batch, LocTypeDto locTypeDto, int times, Integer ioType) {
        DeviceBindService deviceBindService = SpringUtils.getBean(DeviceBindService.class);
        DeviceSiteService deviceSiteService = SpringUtils.getBean(DeviceSiteService.class);
        LocService locService = SpringUtils.getBean(LocService.class);
        LocItemService locItemService = SpringUtils.getBean(LocItemService.class);
        if (Cools.isEmpty(matnr)) {  //物料号
            matnr = "";
        }
        if (Cools.isEmpty(batch)) {  //批次
            batch = "";
        }
        // 初始化参数
        int channel = 0;      //堆垛机号
        int nearRow = 0;    //最浅库位排
        int curRow = 0;     //最深库位排
        int rowCount = 0;   //轮询轮次
        Loc loc = null;     // 目标库位
        InTaskMsgDto inTaskMsgDto = new InTaskMsgDto();
        int sRow = deviceBind.getStartRow();
        int eRow = deviceBind.getEndRow();
        int deviceQty = deviceBind.getDeviceQty();
        // ===============>>>> 开始执行
        curRow = deviceBind.getCurrentRow();
        //此程序用于优化堆垛机异常时的运行时间
        for (int i = times; i <= deviceQty * 2; i++) {
            int[] locNecessaryParameters = LocUtils.LocNecessaryParameters(deviceBind, curRow, deviceQty);
            curRow = locNecessaryParameters[1];
            channel = locNecessaryParameters[2];
            rowCount = locNecessaryParameters[0];
            nearRow = locNecessaryParameters[3];
            break;
        }
        if (nearRow == 0) {
            throw new CoolException("无可用堆垛机");
        }
        //入库靠近摆放
        if (ioType == 1 && deviceBind.getBeSimilar().equals("1") && !Cools.isEmpty(matnr)) {
            if (nearRow != curRow) {
                List<LocItem> locItems = locItemService.list(new LambdaQueryWrapper<LocItem>().eq(LocItem::getMatnrCode, matnr));
                for (LocItem locItem : locItems) {
                    Loc loc1 = locService.getById(locItem.getLocId());
                    if (LocUtils.isShallowLoc(loc1.getCode())) {
                        continue;
                    }
                    String shallowLocNo = LocUtils.getShallowLoc(loc1.getCode());
                    // 检测目标库位是否为空库位
                    Loc shallowLoc = locService.getOne(new LambdaQueryWrapper<Loc>().eq(Loc::getCode, shallowLocNo));
                    if (shallowLoc != null && shallowLoc.getUseStatus().equals(LocStsType.LOC_STS_TYPE_O.type)) {
                        if (LocUtils.locMoveCheckLocTypeComplete(shallowLoc, locTypeDto)) {
                            loc = shallowLoc;
                            channel = shallowLoc.getChannel();
                            break;
                        }
                    }
                }
            }
        }
//        // 靠近摆放规则 --- 空托 //互通版
//        if (ioType == 10 && deviceBind.getEmptySimilar().equals("1")) {
//            List<LocMast> locMasts = locMastService.selectList(new EntityWrapper<LocMast>()
//                    .eq("loc_sts", "D").ge("row1", sRow).le("row1", eRow).eq("whs_type", rowLastnoType.getType().longValue()));
//            if (!locMasts.isEmpty()) {
//                for (LocMast loc : locMasts) {
//                    if (Utils.isShallowLoc(slaveProperties, loc.getLocNo())) {
//                        continue;
//                    }
//                    String shallowLocNo = Utils.getShallowLoc(slaveProperties, loc.getLocNo());
//                    // 检测目标库位是否为空库位
//                    LocMast shallowLoc = locMastService.selectById(shallowLocNo);
//                    if (shallowLoc != null && shallowLoc.getLocSts().equals("O")) {
//                        if (VersionUtils.locMoveCheckLocTypeComplete(shallowLoc, locTypeDto)) {
//                            if (basCrnpService.checkSiteError(shallowLoc.getCrnNo(), true)) {
//                                locMast = shallowLoc;
//                                crnNo = locMast.getCrnNo();
//                                break;
//                            }
//                        }
//                    }
//                }
//            }
//        }
        //查找路径
        DeviceSite deviceSite = deviceSiteService.getOne(new LambdaQueryWrapper<DeviceSite>()
                .eq(DeviceSite::getType, ioType)
                .eq(DeviceSite::getSite, sourceStaNo)
                .eq(DeviceSite::getChannel, channel)
        );
        if (Cools.isEmpty(deviceSite)) {
            channel = 0;
        } else {
            inTaskMsgDto.setStaNo(Integer.parseInt(deviceSite.getDeviceSite()));
        }
        //更新当前排
        deviceBind.setCurrentRow(curRow);
        deviceBindService.updateById(deviceBind);
        // 开始查找库位 ==============================>>
        // 1.按规则查找库位
        if (Cools.isEmpty(loc) && channel != 0) {
            List<Loc> locMasts = null;
            locMasts = locService.list(new LambdaQueryWrapper<Loc>()
                    .eq(Loc::getRow, nearRow)
                    .eq(Loc::getUseStatus, LocStsType.LOC_STS_TYPE_O.type)
                    .eq(Loc::getType, locTypeDto.getLocType1())
                    .eq(Loc::getAreaId, area)
                    .orderByAsc(Loc::getLev)
                    .orderByAsc(Loc::getCol)
            );
            for (Loc locMast1 : locMasts) {
                if (!LocUtils.locMoveCheckLocTypeComplete(locMast1, locTypeDto)) {
                    continue;
                }
                String shallowLoc = LocUtils.getDeepLoc(locMast1.getCode());
                if ((ioType == TaskStsType.GENERATE_IN.id && deviceBind.getBeSimilar().equals("1"))) {
                    //相似物料打开,判断深库位有没有货,没货就放深库位,有货就不操作
                    Loc locMast2 = locService.getOne(new LambdaQueryWrapper<Loc>()
                            .eq(Loc::getCode, shallowLoc)
                            .eq(Loc::getUseStatus, LocStsType.LOC_STS_TYPE_O.type)
                            .eq(Loc::getAreaId, area)
                    );
                    if (!Cools.isEmpty(locMast2)) {
                        loc = locMast2;
                        break;
                    }
                } else {
                    //相似物料关闭,判断深库位有没有货,有货就放浅库位,无货就不操作
                    Loc locMast2 = locService.getOne(new LambdaQueryWrapper<Loc>()
                            .eq(Loc::getCode, shallowLoc)
                            .in(Loc::getUseStatus, LocStsType.LOC_STS_TYPE_D.type, LocStsType.LOC_STS_TYPE_F.type)
                            .eq(Loc::getAreaId, area)
                    );
                    if (!Cools.isEmpty(locMast2)) {
                        loc = locMast1;
                        break;
                    } else {
                        locMast2 = locService.getOne(new LambdaQueryWrapper<Loc>()
                                .eq(Loc::getCode, shallowLoc)
                                .eq(Loc::getUseStatus, LocStsType.LOC_STS_TYPE_O.type)
                                .eq(Loc::getAreaId, area)
                        );
                        if (!Cools.isEmpty(locMast2)) {
                            loc = locMast2;
                            break;
                        }
                    }
                }
            }
            if (Cools.isEmpty(loc) && deviceBind.getBeSimilar().equals("1")) {
                for (Loc locMast1 : locMasts) {
                    if (!LocUtils.locMoveCheckLocTypeComplete(locMast1, locTypeDto)) {
                        continue;
                    }
                    if (deviceBind.getBeSimilar().equals("1")) {
                        String shallowLoc = LocUtils.getDeepLoc(locMast1.getCode());
                        Loc locMast2 = locService.getOne(new LambdaQueryWrapper<Loc>()
                                .eq(Loc::getCode, shallowLoc)
                                .eq(Loc::getUseStatus, LocStsType.LOC_STS_TYPE_O.type)
                                .eq(Loc::getAreaId, area)
                        );
                        if (!Cools.isEmpty(locMast2)) {
                            loc = locMast2;
                            break;
                        } else {
                            locMast2 = locService.getOne(new LambdaQueryWrapper<Loc>()
                                    .eq(Loc::getCode, shallowLoc)
                                    .in(Loc::getUseStatus, LocStsType.LOC_STS_TYPE_D.type, LocStsType.LOC_STS_TYPE_D.type)
                                    .eq(Loc::getAreaId, area)
                            );
                            if (!Cools.isEmpty(locMast2)) {
                                loc = locMast1;
                                break;
                            }
                        }
                    } else {
                        if (!Cools.isEmpty(locMast1)) {
                            loc = locMast1;
                            break;
                        }
                    }
                }
            }
        }
        //查询当前库位类型空库位 小于5个则locmast = null
        List<Loc> locTypeLocMasts = locService.list(new LambdaQueryWrapper<Loc>()
                .eq(Loc::getUseStatus, LocStsType.LOC_STS_TYPE_O.type)
                .eq(Loc::getChannel, channel)
                .eq(Loc::getType, locTypeDto.getLocType1())
                .eq(Loc::getAreaId, area)
        );
        if (null != locTypeLocMasts && locTypeLocMasts.size() <= 5) {
            loc = null;
        }
        // 递归查询
        if (Cools.isEmpty(loc) || !loc.getUseStatus().equals(LocStsType.LOC_STS_TYPE_O.type)) {
            // 当前巷道无空库位时,递归调整至下一巷道,检索全部巷道无果后,跳出递归
            if (times < rowCount * 2) {
                times = times + 1;
                return getLocNoCrn(deviceBind, area, sourceStaNo, matnr, batch, locTypeDto, times, ioType);
            }
            // 2.库位当前所属尺寸无空库位时,调整尺寸参数,向上兼容检索库位
            if (locTypeDto.getLocType1() < 3) {
                int i = locTypeDto.getLocType1() + 1;
                locTypeDto.setLocType1(i);
                return getLocNoCrn(deviceBind, area, sourceStaNo, matnr, batch, locTypeDto, 0, ioType);
            }
            throw new CoolException("没有空库位");
        }
        String locNo = loc.getCode();
        // 返回dto
        inTaskMsgDto.setDeviceNo(channel);
        inTaskMsgDto.setSourceStaNo(sourceStaNo);
//        inTaskMsgDto.setStaNo();
        inTaskMsgDto.setLocNo(locNo);
        return inTaskMsgDto;
    }
}
rsf-server/src/main/java/com/vincent/rsf/server/common/config/ConfigProperties.java
@@ -70,6 +70,11 @@
     */
    private String securityCode;
    private String userName;
    private String password;
    public List<String> getSuperUserList() {
        return Arrays.stream(superUsername.split(",")).collect(Collectors.toList());
    }
rsf-server/src/main/java/com/vincent/rsf/server/manager/controller/LocItemController.java
@@ -97,7 +97,7 @@
        }
        param.setType(Constants.TASK_TYPE_OUT_STOCK);
        return locItemService.generateTask(param);
        return locItemService.generateTask(param, getLoginUserId());
    }
    /**
@@ -112,7 +112,7 @@
        if (Objects.isNull(map)) {
            return R.error("参数不能为空!!");
        }
        return R.ok("任务生成成功").add(locItemService.genMoveTask(map));
        return R.ok("任务生成成功").add(locItemService.genMoveTask(map, getLoginUserId()));
    }
    /**
@@ -129,7 +129,7 @@
        }
        map.setType(Constants.TASK_TYPE_OUT_CHECK);
        return R.ok("任务生成成功").add(locItemService.generateTask(map));
        return R.ok("任务生成成功").add(locItemService.generateTask(map, getLoginUserId()));
    }
rsf-server/src/main/java/com/vincent/rsf/server/manager/controller/TaskController.java
@@ -102,7 +102,7 @@
        if (Objects.isNull(ids) || ids.length < 1) {
            return R.error("参数不能为空!!");
        }
        return taskService.removeTask(ids);
        return taskService.removeTask(ids, getLoginUserId());
//        return R.ok("Delete Success").add(ids);
    }
rsf-server/src/main/java/com/vincent/rsf/server/manager/entity/Task.java
@@ -9,6 +9,7 @@
import com.vincent.rsf.server.system.entity.DictData;
import com.vincent.rsf.server.system.service.DictDataService;
import lombok.experimental.Accessors;
import org.apache.commons.lang3.StringUtils;
import org.springframework.format.annotation.DateTimeFormat;
import java.text.SimpleDateFormat;
import java.util.Date;
@@ -31,6 +32,7 @@
import com.vincent.rsf.server.system.entity.User;
import java.io.Serializable;
import java.util.Date;
import java.util.stream.Collectors;
@Data
@Accessors(chain = true)
@@ -259,6 +261,18 @@
        return dictDatas.getValue() + "." + dictDatas.getLabel();
    }
    public String getWarehType$(){
        if (null == this.warehType){ return null; }
        DictDataService dictDataService = SpringUtils.getBean(DictDataService.class);
        DictData dictDatas = dictDataService.getOne(new LambdaQueryWrapper<DictData>()
                .eq(DictData::getDictTypeCode, DictTypeCode.DICT_SYS_DEVICE_TYPE)
                .eq(DictData::getValue, warehType));
        if (Objects.isNull(dictDatas)) {
            return null;
        }
        return dictDatas.getLabel();
    }
    public String getTaskType$() {
        if (Cools.isEmpty(this.taskType)) {
            return null;
rsf-server/src/main/java/com/vincent/rsf/server/manager/entity/TaskItem.java
@@ -263,6 +263,19 @@
        return dictDatas.getLabel();
    }
    public String getWkType$(){
        if (Cools.isEmpty(this.wkType)){
            return "";
        }
        DictDataService dictDataService = SpringUtils.getBean(DictDataService.class);
        DictData dictData = dictDataService.getOne(new LambdaQueryWrapper<DictData>().eq(DictData::getDictTypeCode, DictTypeCode.DICT_SYS_BUSINESS_TYPE).eq(DictData::getValue, this.wkType));
        if (Objects.isNull(dictData)) {
            return null;
        }
        return dictData.getLabel();
    }
    public String getIsptResult$(){
        if (Cools.isEmpty(this.isptResult)){
            return null;
rsf-server/src/main/java/com/vincent/rsf/server/manager/entity/WaitPakinItemLog.java
@@ -40,6 +40,9 @@
    @TableId(value = "id", type = IdType.AUTO)
    private Long id;
    @ApiModelProperty("日志主单ID")
    private Long logId;
    /**
     * 主单ID
     */
rsf-server/src/main/java/com/vincent/rsf/server/manager/enums/PakinIOStatus.java
@@ -17,11 +17,11 @@
            ;
    PakinIOStatus(String val, String desc) {
        this.val = val;
        this.val = Short.parseShort(val);
        this.desc = desc;
    }
    public String val;
    public Short val;
    public String desc;
}
rsf-server/src/main/java/com/vincent/rsf/server/manager/schedules/ScheduleJobs.java
@@ -190,7 +190,8 @@
        WarehouseAreasItem serviceOne = warehouseAreasItemService.getOne(queryWrapper);
        if (!Objects.isNull(serviceOne)) {
            item.setId(serviceOne.getId());
            item.setAnfme(item.getAnfme() + serviceOne.getAnfme());
            Double anfme = Math.round((item.getAnfme() + serviceOne.getAnfme()) * 10000) / 10000.0;
            item.setAnfme(anfme);
        }
        //未质检
        if (!warehouseAreasItemService.saveOrUpdate(item)) {
@@ -329,7 +330,7 @@
    @Transactional(rollbackFor = Exception.class)
    public void pakinLog() {
        List<WaitPakin> pakinIds = waitPakinService.list(new LambdaQueryWrapper<WaitPakin>()
                .eq(WaitPakin::getIoStatus, Short.valueOf(PakinIOStatus.PAKIN_IO_STATUS_TASK_DONE.val))
                .eq(WaitPakin::getIoStatus, PakinIOStatus.PAKIN_IO_STATUS_TASK_DONE.val)
                .select(WaitPakin::getId));
        if (pakinIds.isEmpty()) {
            return;
@@ -339,32 +340,36 @@
        if (pakins.isEmpty()) {
            throw new CoolException("组拖单为空!!");
        }
        List<WaitPakinLog> pakinLogs = new ArrayList<>();
        pakins.forEach(pakin -> {
            WaitPakinLog log = new WaitPakinLog();
            BeanUtils.copyProperties(pakin, log);
            log.setPakinId(pakin.getId()).setIoStatus(Short.parseShort("2"));
            pakinLogs.add(log);
        });
        if (!waitPakinLogService.saveBatch(pakinLogs)) {
            throw new CoolException("历史档保存失败!!");
        }
        List<WaitPakinItemLog> itemLogs = new ArrayList<>();
        List<WaitPakinItem> pakinItems = waitPakinItemService.list(new LambdaQueryWrapper<WaitPakinItem>().in(WaitPakinItem::getPakinId, list));
        if (pakinItems.isEmpty()) {
            throw new CoolException("组拖明细为空!!");
        }
        pakinItems.forEach(item -> {
            WaitPakinItemLog itemLog = new WaitPakinItemLog();
            BeanUtils.copyProperties(item, itemLog);
            itemLog.setPakinItemId(item.getId())
                    .setPakinId(item.getPakinId());
            itemLogs.add(itemLog);
            log.setPakinId(pakin.getId()).setIoStatus(PakinIOStatus.PAKIN_IO_STATUS_TASK_DONE.val);
            if (!waitPakinLogService.save(log)) {
                throw new CoolException("组托日志保存失败!!");
            }
            List<WaitPakinItem> pakinItems = waitPakinItemService.list(new LambdaQueryWrapper<WaitPakinItem>().in(WaitPakinItem::getPakinId, pakin.getId()));
            if (pakinItems.isEmpty()) {
                throw new CoolException("组拖明细为空!!");
            }
            List<WaitPakinItemLog> itemLogs = new ArrayList<>();
            pakinItems.forEach(item -> {
                WaitPakinItemLog itemLog = new WaitPakinItemLog();
                BeanUtils.copyProperties(item, itemLog);
                itemLog.setPakinItemId(item.getId())
                        .setLogId(log.getId())
                        .setQty(item.getWorkQty())
                        .setWorkQty(0.0)
                        .setPakinId(item.getPakinId());
                itemLogs.add(itemLog);
            });
            if (!waitPakinItemLogService.saveBatch(itemLogs)) {
                throw new CoolException("历史明细档保存失败!!");
            }
        });
        if (!waitPakinItemLogService.saveBatch(itemLogs)) {
            throw new CoolException("历史明细档保存失败!!");
        }
        if (!waitPakinService.removeByIds(list)) {
            throw new CoolException("原单据删除失败!!");
        }
rsf-server/src/main/java/com/vincent/rsf/server/manager/schedules/TaskSchedules.java
@@ -8,16 +8,16 @@
import com.vincent.rsf.server.system.constant.GlobalConfigCode;
import com.vincent.rsf.server.system.entity.Config;
import com.vincent.rsf.server.system.service.ConfigService;
import com.vincent.rsf.server.system.utils.SystemAuthUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.*;
import java.util.stream.Collectors;
/**
@@ -27,6 +27,8 @@
@Component
public class TaskSchedules {
    public static Logger logger = LoggerFactory.getLogger(TaskSchedules.class);
    @Autowired
    private TaskService taskService;
    @Autowired
@@ -35,18 +37,6 @@
    private TaskLogService taskLogService;
    @Autowired
    private TaskItemLogService taskItemLogService;
    @Autowired
    private StockItemService stockItemService;
    @Autowired
    private PurchaseService purchaseService;
    @Autowired
    private AsnOrderService asnOrderService;
    @Autowired
    private AsnOrderItemService asnOrderItemService;
    @Autowired
    private StockService stockService;
    @Autowired
    private LocService locService;
    @Autowired
    private ConfigService configService;
@@ -59,11 +49,13 @@
     */
    @Scheduled(cron = "0/3 * * * * ?")
    public void completeInStock() throws Exception {
        List<Task> tasks = taskService.list(new LambdaQueryWrapper<Task>().eq(Task::getTaskStatus, TaskStsType.COMPLETE_IN.id));
        List<Task> tasks = taskService.list(new LambdaQueryWrapper<Task>().eq(Task::getTaskStatus, TaskStsType.COMPLETE_IN.id).select(Task::getId));
        if (tasks.isEmpty()) {
            return;
        }
        taskService.complateInTask(tasks);
        List<Long> longSet = tasks.stream().map(Task::getId).collect(Collectors.toList());
        List<Task> vaildTasks = taskService.list(new LambdaQueryWrapper<Task>().in(Task::getId, longSet));
        taskService.complateInTask(vaildTasks);
    }
    /**
@@ -74,11 +66,15 @@
     */
    @Scheduled(cron = "0/5 * * * * ?  ")
    public void complateOutStock() throws Exception {
        List<Task> tasks = taskService.list(new LambdaQueryWrapper<Task>().eq(Task::getTaskStatus, TaskStsType.COMPLETE_OUT.id));
        List<Task> tasks = taskService.list(new LambdaQueryWrapper<Task>()
                .eq(Task::getTaskStatus, TaskStsType.COMPLETE_OUT.id)
                .select(Task::getId));
        if (tasks.isEmpty()) {
            return;
        }
        taskService.completeTask(tasks);
        List<Long> longSet = tasks.stream().map(Task::getId).collect(Collectors.toList());
        List<Task> vaildTasks = taskService.list(new LambdaQueryWrapper<Task>().in(Task::getId, longSet));
        taskService.completeTask(vaildTasks);
    }
    /**
rsf-server/src/main/java/com/vincent/rsf/server/manager/service/LocItemService.java
@@ -6,12 +6,10 @@
import com.vincent.rsf.server.manager.entity.LocItem;
import com.vincent.rsf.server.manager.entity.Task;
import java.util.Map;
public interface LocItemService extends IService<LocItem> {
    R generateTask(LocToTaskParams map);
    R generateTask(LocToTaskParams map, Long loginUserId);
    Task genMoveTask(LocToTaskParams map);
    Task genMoveTask(LocToTaskParams map, Long loginUserId);
}
rsf-server/src/main/java/com/vincent/rsf/server/manager/service/TaskService.java
@@ -19,7 +19,7 @@
//    R completeTask(String id);
     void completeTask(List<Task> task) throws Exception;
    R removeTask(Long[] ids);
    R removeTask(Long[] ids, Long loginUserId);
    Task pickOrCheckTask(Long id, String oType) throws Exception;
rsf-server/src/main/java/com/vincent/rsf/server/manager/service/impl/AsnOrderServiceImpl.java
@@ -290,7 +290,7 @@
            }
            PurchaseItem service = purchaseItemService.getById(item.getId());
            Double qty = service.getQty() + item.getAnfme();
            Double qty = Math.round((service.getQty() + item.getAnfme()) * 10000) / 10000.0;
            if (qty.compareTo(service.getAnfme()) > 0) {
                throw new CoolException("新建单据数量不能大于计划数量!!");
            }
@@ -316,7 +316,9 @@
            if (Objects.isNull(purchaseItem)) {
                throw new CoolException("单据不存在!!");
            }
            purchaseItem.setQty(purchaseItem.getQty() +  item.getAnfme());
            Double toQty = Math.round((purchaseItem.getQty() + item.getAnfme()) * 10000) / 10000.0;
            purchaseItem.setQty(toQty);
            if (!purchaseItemService.updateById(purchaseItem)) {
                throw new CoolException("PO单明细修改失败!!");
            }
@@ -328,7 +330,8 @@
            throw new CoolException(("Asn单据明细保存失败!!"));
        }
        //任务执行完成,修改已完成数量和PO单执行状态
        purchase.setQty(sum + purchase.getQty())
        Double qty = Math.round((sum + purchase.getQty()) * 10000) / 10000.0;
        purchase.setQty(qty)
                .setExceStatus(POExceStatus.PO_EXCE_STATUS_EXCE_ING.val);
        if (!purchaseService.saveOrUpdate(purchase)) {
@@ -361,7 +364,8 @@
            list.forEach(item -> {
                PurchaseItem purchaseItem = purchaseItemService.getById(item.getPoDetlId());
                if (!Objects.isNull(purchaseItem)) {
                    purchaseItem.setQty(purchaseItem.getQty() - item.getAnfme());
                    Double minusQty = Math.round((purchaseItem.getQty() - item.getAnfme()) * 10000) / 10000.0;
                    purchaseItem.setQty(minusQty);
                    if (!purchaseItemService.updateById(purchaseItem)) {
                        throw new CoolException("PO单明细更新失败!!");
                    }
@@ -373,7 +377,8 @@
            Purchase purchase = purchaseService.getOne(new LambdaQueryWrapper<Purchase>()
                    .eq(Purchase::getCode, list.stream().findFirst().get().getPoCode()));
            if (!Objects.isNull(purchase)) {
                purchase.setQty(purchase.getQty() - sum)
                Double qty = Math.round((purchase.getQty() - sum) * 10000) / 10000.0;
                purchase.setQty(qty)
                        .setExceStatus(POExceStatus.PO_EXCE_STATUS_EXCE_ING.val);
                if (!purchaseService.updateById(purchase)) {
rsf-server/src/main/java/com/vincent/rsf/server/manager/service/impl/LocItemServiceImpl.java
@@ -1,7 +1,5 @@
package com.vincent.rsf.server.manager.service.impl;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.vincent.rsf.framework.common.R;
import com.vincent.rsf.framework.exception.CoolException;
@@ -14,7 +12,6 @@
import com.vincent.rsf.server.manager.controller.params.LocToTaskParams;
import com.vincent.rsf.server.manager.entity.*;
import com.vincent.rsf.server.manager.enums.*;
import com.vincent.rsf.server.manager.enums.LocType;
import com.vincent.rsf.server.manager.mapper.LocItemMapper;
import com.vincent.rsf.server.manager.service.*;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
@@ -27,7 +24,6 @@
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.lang.reflect.Array;
import java.util.*;
import java.util.stream.Collectors;
@@ -45,8 +41,6 @@
    @Autowired
    private DeviceSiteService deviceSiteService;
    @Autowired
    private SlaveProperties slaveProperties;
    @Autowired
    private WcsService wcsService;
@@ -55,12 +49,13 @@
     * type: check 盘点, stock: 库存出库
     *
     * @param map
     * @param loginUserId
     * @return
     */
    @Override
    @Synchronized
    @Transactional(rollbackFor = Exception.class)
    public R generateTask(LocToTaskParams map) {
    public R generateTask(LocToTaskParams map, Long loginUserId) {
        if (Objects.isNull(map.getSiteNo())) {
            throw new CoolException("站点不能为空!");
        }
@@ -84,9 +79,9 @@
            }
            Task moveTask = new Task();
            if (!LocUtils.isShallowLoc(slaveProperties, loc.getCode())) {
            if (!LocUtils.isShallowLoc(loc.getCode())) {
                //获取深库位对应浅库位
                String shallowLoc = LocUtils.getShallowLoc(slaveProperties, loc.getCode());
                String shallowLoc = LocUtils.getShallowLoc(loc.getCode());
                Loc one = locService.getOne(new LambdaQueryWrapper<Loc>().eq(Loc::getCode, shallowLoc));
                if (Objects.isNull(one)) {
                    throw new CoolException("对应库位不存在!!");
@@ -94,7 +89,7 @@
                map.setOrgLoc(one.getCode());
                //优先生成移库任务
                if (!one.getUseStatus().equals(LocStsType.LOC_STS_TYPE_O.type)) {
                    moveTask = genMoveTask(map);
                    moveTask = genMoveTask(map, loginUserId);
                }
            }
@@ -103,6 +98,10 @@
                    .setTaskCode(ruleCode)
                    .setParentId(moveTask.getId())
                    .setTargSite(siteNo)
                    .setUpdateBy(loginUserId)
                    .setCreateBy(loginUserId)
                    .setCreateTime(new Date())
                    .setUpdateTime(new Date())
                    .setTaskStatus(TaskStsType.GENERATE_OUT.id)
                    .setBarcode(loc.getBarcode());
@@ -125,7 +124,6 @@
                Double useQty = Math.round((outQty + workQty) * 10000) / 10000.0;
                if (orgQty.compareTo(useQty) > 0) {
                    //拣料出库
                    task.setTaskType(TaskType.TASK_TYPE_PICK_AGAIN_OUT.type);
                    DeviceSite deviceSite = deviceSiteService.getOne(new LambdaQueryWrapper<DeviceSite>()
                            .eq(DeviceSite::getSite, siteNo)
@@ -134,19 +132,21 @@
                    if (Objects.isNull(deviceSite)) {
                        throw new CoolException("站点不支持拣料出库!!");
                    }
                    task.setTaskType(TaskType.TASK_TYPE_PICK_AGAIN_OUT.type).setWarehType(deviceSite.getDevice());
                } else {
                    //全板出库
                    task.setTaskType(TaskType.TASK_TYPE_OUT.type);
                    DeviceSite deviceSite = deviceSiteService.getOne(new LambdaQueryWrapper<DeviceSite>()
                            .eq(DeviceSite::getChannel, loc.getChannel())
                            .eq(DeviceSite::getSite, siteNo).eq(DeviceSite::getType, TaskType.TASK_TYPE_OUT.type));
                    if (Objects.isNull(deviceSite)) {
                        throw new CoolException("站点不支持全板出库!!");
                    }
                    task.setTaskType(TaskType.TASK_TYPE_OUT.type).setWarehType(deviceSite.getDevice());
                }
            } else if (map.getType().equals(Constants.TASK_TYPE_OUT_CHECK)) {
                //盘点出库
                task.setTaskType(TaskType.TASK_TYPE_CHECK_OUT.type);
                DeviceSite deviceSite = deviceSiteService.getOne(new LambdaQueryWrapper<DeviceSite>()
                        .eq(DeviceSite::getChannel, loc.getChannel())
                        .eq(DeviceSite::getSite, siteNo)
@@ -154,6 +154,8 @@
                if (Objects.isNull(deviceSite)) {
                    throw new CoolException("当前站点不支持盘点出库!!");
                }
                task.setTaskType(TaskType.TASK_TYPE_CHECK_OUT.type).setWarehType(deviceSite.getDevice());
            }
            if (!taskService.save(task)) {
@@ -166,6 +168,13 @@
                taskItem.setTaskId(task.getId())
                        .setAnfme(item.getOutQty())
                        .setBatch(item.getBatch())
                        .setUpdateBy(loginUserId)
                        .setCreateBy(loginUserId)
                        .setSource(item.getId())
                        .setSourceId(item.getLocId())
                        .setSourceCode(item.getLocCode())
                        .setCreateTime(new Date())
                        .setUpdateTime(new Date())
                        .setOrderType(OrderType.ORDER_OUT.type)
                        .setWkType(Short.parseShort(OrderWorkType.ORDER_WORK_TYPE_STOCK_OUT.type));
                taskItems.add(taskItem);
@@ -186,6 +195,8 @@
                } else {
                    item.setWorkQty(qty);
                }
                item.setUpdateBy(loginUserId).setUpdateTime(new Date());
                if (!locItemService.updateById(item)) {
                    throw new CoolException("库存信息修改失败!!");
                }
@@ -203,11 +214,12 @@
     * 生成移库任务
     *
     * @param map
     * @param loginUserId
     * @return
     */
    @Override
    @Transactional(rollbackFor = Exception.class)
    public Task genMoveTask(LocToTaskParams map) {
    public Task genMoveTask(LocToTaskParams map, Long loginUserId) {
        if (Objects.isNull(map.getOrgLoc()) || StringUtils.isBlank(map.getOrgLoc())) {
            throw new CoolException("源库位不能为空!");
        }
@@ -270,6 +282,8 @@
                .setTaskCode(ruleCode)
                .setTaskType(TaskType.TASK_TYPE_LOC_MOVE.type)
                .setTargLoc(targetLoc.getCode())
                .setUpdateBy(loginUserId)
                .setUpdateTime(new Date())
                .setTaskStatus(TaskStsType.GENERATE_IN.id)
                .setBarcode(orgLoc.getBarcode());
@@ -286,6 +300,11 @@
                taskItem.setTaskId(task.getId())
                        .setAnfme(item.getAnfme())
                        .setBatch(item.getBatch())
                        .setUpdateBy(loginUserId)
                        .setSourceId(item.getLocId())
                        .setSourceCode(item.getLocCode())
                        .setSource(item.getId())
                        .setUpdateTime(new Date())
                        .setOrderType(OrderType.ORDER_IN.type)
                        .setWkType(Short.parseShort(OrderWorkType.ORDER_WORK_TYPE_OTHER_IN.type));
                taskItems.add(taskItem);
rsf-server/src/main/java/com/vincent/rsf/server/manager/service/impl/OutStockServiceImpl.java
@@ -366,7 +366,7 @@
                        p1.getUnit(),
                        p1.getTrackCode(),
                        p1.getFieldsIndex(),
                        p1.getAnfme() + p2.getAnfme(),
                        Math.round((p1.getAnfme() + p2.getAnfme()) * 10000) / 10000.0,
                        p1.getWorkQty(),
                        p1.getTenantId(),
                        p1.getStatus(),
rsf-server/src/main/java/com/vincent/rsf/server/manager/service/impl/QlyIsptItemServiceImpl.java
@@ -190,7 +190,8 @@
                }
            }
        } else {
            orderItem.setAnfme(orderItem.getAnfme() - sum);
            Double anfme = Math.round((orderItem.getAnfme() - sum) * 10000) / 10000.0;
            orderItem.setAnfme(anfme);
            if (!warehouseAreasItemService.updateById(orderItem)) {
                throw new CoolException("收货区库存明细更新失败!!");
            }
rsf-server/src/main/java/com/vincent/rsf/server/manager/service/impl/TaskServiceImpl.java
@@ -13,7 +13,6 @@
import com.vincent.rsf.server.api.utils.LocUtils;
import com.vincent.rsf.server.manager.controller.params.GenerateTaskParams;
import com.vincent.rsf.server.manager.entity.*;
import com.vincent.rsf.server.manager.enums.LocType;
import com.vincent.rsf.server.manager.mapper.TaskMapper;
import com.vincent.rsf.server.manager.service.*;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
@@ -21,8 +20,11 @@
import com.vincent.rsf.server.system.constant.SerialRuleCode;
import com.vincent.rsf.server.manager.enums.LocStsType;
import com.vincent.rsf.server.system.utils.SerialRuleUtils;
import com.vincent.rsf.server.system.utils.SystemAuthUtils;
import lombok.Synchronized;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@@ -33,6 +35,8 @@
@Service("taskService")
public class TaskServiceImpl extends ServiceImpl<TaskMapper, Task> implements TaskService {
    public static final Logger logger = LoggerFactory.getLogger(TaskServiceImpl.class);
    @Autowired
    private WaitPakinService waitPakinService;
@@ -84,7 +88,7 @@
        /**获取组拖*/
        List<WaitPakin> waitPakins = waitPakinService.list(new LambdaQueryWrapper<WaitPakin>()
                .in(WaitPakin::getId, pakins.getId())
                .eq(WaitPakin::getIoStatus, Short.parseShort(PakinIOStatus.PAKIN_IO_STATUS_DONE.val)));
                .eq(WaitPakin::getIoStatus, PakinIOStatus.PAKIN_IO_STATUS_DONE.val));
        if (waitPakins.isEmpty()) {
            throw new CoolException("请检查组托状态是否完成!!");
        }
@@ -169,7 +173,7 @@
        /**获取组拖*/
        List<WaitPakin> waitPakins = waitPakinService.list(new LambdaQueryWrapper<WaitPakin>()
                .in(WaitPakin::getId, pakins.getId())
                .eq(WaitPakin::getIoStatus, Short.parseShort(PakinIOStatus.PAKIN_IO_STATUS_DONE.val)));
                .eq(WaitPakin::getIoStatus, PakinIOStatus.PAKIN_IO_STATUS_DONE.val));
        if (waitPakins.isEmpty()) {
            throw new CoolException("请检查组托状态是否完成!!");
        }
@@ -193,13 +197,18 @@
                    .setTargLoc(targetLoc)
                    .setBarcode(pakin.getBarcode())
                    .setCreateBy(loginUserId)
                    .setUpdateTime(new Date())
                    .setUpdateBy(loginUserId);
            if (!this.save(task)) {
                throw new CoolException("任务保存失败!!");
            }
            if (!locService.update(new LambdaUpdateWrapper<Loc>().eq(Loc::getCode, task.getTargLoc())
                    .set(Loc::getUseStatus, LocStsType.LOC_STS_TYPE_S.type).set(Loc::getBarcode, pakin.getBarcode()))) {
            if (!locService.update(new LambdaUpdateWrapper<Loc>()
                    .eq(Loc::getCode, task.getTargLoc())
                    .set(Loc::getUseStatus, LocStsType.LOC_STS_TYPE_S.type)
                            .set(Loc::getUpdateBy, loginUserId)
                            .set(Loc::getUpdateTime, new Date())
                    .set(Loc::getBarcode, pakin.getBarcode()))) {
                throw new CoolException("库位预约失败!!");
            }
            /**获取组拖明细**/
@@ -276,7 +285,7 @@
        List<Long> ids = waitPakin.getWaitPakins().stream().map(WaitPakin::getId).collect(Collectors.toList());
        List<WaitPakin> waitPakins = waitPakinService.list(new LambdaQueryWrapper<WaitPakin>()
                .in(WaitPakin::getId, ids)
                .eq(WaitPakin::getIoStatus, Short.parseShort(PakinIOStatus.PAKIN_IO_STATUS_DONE.val)));
                .eq(WaitPakin::getIoStatus, PakinIOStatus.PAKIN_IO_STATUS_DONE.val));
        if (waitPakins.isEmpty()) {
            throw new CoolException("请检查组拖状态是否完成!!");
        }
@@ -385,23 +394,24 @@
    @Override
    @Transactional(rollbackFor = Exception.class)
    public void complateInTask(List<Task> tasks) throws Exception {
        Long loginUserId = SystemAuthUtils.getLoginUserId();
        for (Task task : tasks) {
            if (task.getTaskType().equals(TaskType.TASK_TYPE_IN.type)) {
                //1.入库
                complateInstock(task);
                complateInstock(task, loginUserId);
            } else if (task.getTaskType().equals(TaskType.TASK_TYPE_PICK_IN.type) || task.getTaskType().equals(TaskType.TASK_TYPE_CHECK_IN.type)) {
                //53.拣料再入库
                //57.盘点再入库
                pickComplateInStock(task);
                pickComplateInStock(task, loginUserId);
            } else if (task.getTaskType().equals(TaskType.TASK_TYPE_LOC_MOVE.type)) {
                //移库
                moveInStock(task);
                moveInStock(task, loginUserId);
            }
        }
    }
    @Transactional(rollbackFor = Exception.class)
    public void moveInStock(Task task) {
    public void moveInStock(Task task, Long loginUserId) {
        if (Objects.isNull(task)) {
            return;
        }
@@ -430,7 +440,7 @@
            //移库有可能是空板
            try {
                //更新库位明细
                saveLocItem(taskItems, task.getId());
                saveLocItem(taskItems, task.getId(), loginUserId);
            } catch (Exception e) {
                throw new CoolException("库位明细更新失败!!");
            }
@@ -444,19 +454,26 @@
        /**修改库位状态为F.在库*/
        if (!locService.update(new LambdaUpdateWrapper<Loc>()
                        .set(Loc::getBarcode, task.getBarcode())
                .set(Loc::getUseStatus, LocStsType.LOC_STS_TYPE_F.type)
                .eq(Loc::getCode, task.getTargLoc()))) {
                        .set(Loc::getUseStatus, LocStsType.LOC_STS_TYPE_F.type)
                        .set(Loc::getUpdateBy, loginUserId)
                        .set(Loc::getUpdateTime, new Date())
                        .eq(Loc::getCode, task.getTargLoc()))) {
            throw new CoolException("库位状态修改失败!!");
        }
        if (!locService.update(new LambdaUpdateWrapper<Loc>()
                        .set(Loc::getBarcode, null)
                .set(Loc::getUseStatus, LocStsType.LOC_STS_TYPE_O.type).eq(Loc::getCode, task.getOrgLoc()))) {
                        .set(Loc::getUpdateBy, loginUserId)
                        .set(Loc::getUpdateTime, new Date())
                        .set(Loc::getUseStatus, LocStsType.LOC_STS_TYPE_O.type)
                .eq(Loc::getCode, task.getOrgLoc()))) {
            throw new CoolException("库位状态修改失败!!");
        }
        if (!this.update(new LambdaUpdateWrapper<Task>().eq(Task::getId, task.getId()).set(Task::getTaskStatus, TaskStsType.UPDATED_IN.id))) {
        if (!this.update(new LambdaUpdateWrapper<Task>().eq(Task::getId, task.getId())
                        .set(Task::getUpdateBy, loginUserId)
                        .set(Task::getUpdateTime, new Date())
                .set(Task::getTaskStatus, TaskStsType.UPDATED_IN.id))) {
            throw new CoolException("任务状态修改失败!!");
        }
@@ -473,17 +490,18 @@
    @Override
    @Transactional(rollbackFor = Exception.class)
    public void completeTask(List<Task> tasks) throws Exception {
        Long loginUserId = SystemAuthUtils.getLoginUserId();
        for (Task task : tasks) {
            //出库任务
            if (task.getTaskType().equals(TaskType.TASK_TYPE_OUT.type)) {
                //全托出库
                complateOutStock(task);
                complateOutStock(task, loginUserId);
            } else if (task.getTaskType().equals(TaskType.TASK_TYPE_PICK_AGAIN_OUT.type)) {
                //拣料出库
                complateOutStock(task);
                complateOutStock(task, loginUserId);
            } else if (task.getTaskType().equals(TaskType.TASK_TYPE_CHECK_OUT.type)) {
                //盘点出库
                complateOutStock(task);
                complateOutStock(task, loginUserId);
            }
        }
    }
@@ -492,9 +510,10 @@
     * 拣料再入库
     *
     * @param task
     * @param loginUserId
     */
    @Transactional(rollbackFor = Exception.class)
    public void pickComplateInStock(Task task) throws Exception {
    public void pickComplateInStock(Task task, Long loginUserId) throws Exception {
        if (Objects.isNull(task)) {
            return;
        }
@@ -506,7 +525,9 @@
            throw new CoolException("当前库位状态不处于S.入库预约,不可执行入库操作!");
        }
        loc.setUseStatus(LocStsType.LOC_STS_TYPE_F.type).setBarcode(task.getBarcode());
        loc.setUseStatus(LocStsType.LOC_STS_TYPE_F.type)
                .setBarcode(task.getBarcode())
                .setUpdateBy(loginUserId).setUpdateTime(new Date());
        if (!locService.updateById(loc)) {
            throw new CoolException("库位信息更新失败!!");
@@ -531,7 +552,7 @@
                locWorking.setAnfme(taskItem.getAnfme());
            }
            BeanUtils.copyProperties(locWorking, locItem);
            locItem.setWorkQty(0.0).setLocCode(loc.getCode()).setLocId(loc.getId()).setId(null);
            locItem.setWorkQty(0.0).setLocCode(loc.getCode()).setLocId(loc.getId()).setId(null).setUpdateBy(loginUserId).setUpdateTime(new Date());
            items.add(locItem);
        }
@@ -541,13 +562,13 @@
        TaskItem taskItem = taskItems.stream().findFirst().get();
        //保存入出库流水
        saveStockItems(taskItems, task, null, null, taskItem.getWkType(), taskItem.getOrderType());
        saveStockItems(taskItems, task, null, null, taskItem.getWkType(), taskItem.getOrderType(), loginUserId);
        if (!locItemWorkingService.remove(new LambdaQueryWrapper<LocItemWorking>().eq(LocItemWorking::getTaskId, task.getId()))) {
            throw new CoolException("作业中库存删除失败!!");
        }
        task.setTaskStatus(TaskStsType.UPDATED_IN.id).setUpdateTime(null);
        task.setTaskStatus(TaskStsType.UPDATED_IN.id).setUpdateTime(new Date()).setUpdateBy(loginUserId);
        if (!taskService.updateById(task)) {
            throw new CoolException("任务状态修改失败!!");
        }
@@ -558,11 +579,12 @@
     * 任务取消
     *
     * @param ids
     * @param loginUserId
     * @return
     */
    @Override
    @Transactional(rollbackFor = Exception.class)
    public R removeTask(Long[] ids) {
    public R removeTask(Long[] ids, Long loginUserId) {
        List<Integer> longs = Arrays.asList(TaskStsType.GENERATE_IN.id, TaskStsType.GENERATE_OUT.id);
        List<Integer> list = Arrays.asList(TaskType.TASK_TYPE_IN.type, TaskType.TASK_TYPE_OUT.type, TaskType.TASK_TYPE_EMPITY_IN.type, TaskType.TASK_TYPE_EMPITY_OUT.type, TaskType.TASK_TYPE_MERGE_OUT.type);
        List<Task> tasks = this.list(new LambdaQueryWrapper<Task>()
@@ -572,24 +594,6 @@
            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.val)) {
                BasStation basStation = null;
                if (task.getTaskType().equals(TaskType.TASK_TYPE_IN.type) || task.getTaskType().equals(TaskType.TASK_TYPE_EMPITY_IN.type)) {
@@ -616,8 +620,47 @@
                }
            }
            if (!taskItemService.remove(new LambdaQueryWrapper<TaskItem>().eq(TaskItem::getTaskId, task.getId()))) {
                throw new CoolException("任务明细删除失败!!");
            List<TaskItem> taskItems = taskItemService.list(new LambdaQueryWrapper<TaskItem>().eq(TaskItem::getTaskId, task.getId()));
            if (!taskItems.isEmpty()) {
                for (TaskItem item : taskItems) {
                    if (item.getOrderType().equals(OrderType.ORDER_OUT.type)) {
                        //出库
                        if (item.getWkType().equals(Short.parseShort(OrderWorkType.ORDER_WORK_TYPE_STOCK_OUT.type))) {
                            //库存出库
                            Loc loc = locService.getOne(new LambdaQueryWrapper<Loc>().eq(Loc::getId, item.getSourceId()));
                            if (Objects.isNull(loc)) {
                                throw new CoolException("数据错误:库位信息不存在!!");
                            }
                            loc.setUseStatus(LocStsType.LOC_STS_TYPE_F.type).setBarcode(task.getBarcode()).setUpdateBy(loginUserId).setUpdateTime(new Date());
                            if (!locService.updateById(loc)) {
                                throw new CoolException("库位信息修改失败!!");
                            }
                        }
                    } else {
                        //入库
                        //恢复组托状态
                        WaitPakin waitPakin = waitPakinService.getOne(new LambdaQueryWrapper<WaitPakin>()
                                .eq(WaitPakin::getBarcode, task.getBarcode()));
                        if (null != waitPakin) {
                            waitPakin.setIoStatus(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 (!taskItemService.remove(new LambdaQueryWrapper<TaskItem>().eq(TaskItem::getTaskId, task.getId()))) {
                    throw new CoolException("任务明细删除失败!!");
                }
            }
        }
        if (!this.removeByIds(Arrays.asList(ids))) {
@@ -736,11 +779,10 @@
     */
    @Synchronized
    @Transactional(rollbackFor = Exception.class)
    public void complateOutStock(Task task) throws Exception {
    public void complateOutStock(Task task, Long loginUserId) throws Exception {
        if (Objects.isNull(task)) {
            throw new CoolException("参数不能为空!!");
        }
        Loc loc = locService.getOne(new LambdaQueryWrapper<Loc>().eq(Loc::getCode, task.getOrgLoc()));
        if (Objects.isNull(loc)) {
            throw new CoolException("库位不存在!!");
@@ -763,7 +805,11 @@
        for (LocItem item : locItems) {
            LocItemWorking working = new LocItemWorking();
            BeanUtils.copyProperties(item, working);
            working.setId(null).setTaskId(task.getId()).setLocItemId(item.getId());
            working.setId(null)
                    .setTaskId(task.getId())
                    .setLocItemId(item.getId())
                    .setUpdateBy(loginUserId)
                    .setUpdateTime(new Date());
            workings.add(working);
        }
@@ -775,7 +821,7 @@
            //更新库位明细
            subtractLocItem(loc);
        } catch (Exception e) {
            log.error("<UNK>", e);
            logger.error("<UNK>", e);
            throw new CoolException(e.getMessage());
        }
@@ -794,14 +840,14 @@
                    throw new CoolException("波次明细不存在!!");
                }
                try {
                    saveOutStockItem(maps.get(key), waveItem);
                    saveOutStockItem(maps.get(key), waveItem, loginUserId);
                } catch (Exception e) {
                    throw new CoolException(e.getMessage());
                }
            });
        } else {
            try {
                saveOutStockItem(taskItems, null);
                saveOutStockItem(taskItems, null, loginUserId);
            } catch (Exception e) {
                throw new CoolException(e.getMessage());
            }
@@ -811,6 +857,8 @@
        if (!locService.update(new LambdaUpdateWrapper<Loc>()
                .set(Loc::getUseStatus, LocStsType.LOC_STS_TYPE_O.type)
                .set(Loc::getBarcode, null)
                        .set(Loc::getUpdateBy, loginUserId)
                        .set(Loc::getUpdateTime, new Date())
                .eq(Loc::getId, loc.getId()))) {
            throw new CoolException("库位状态修改失败!!");
        }
@@ -818,21 +866,23 @@
        if (task.getTaskType().equals(TaskType.TASK_TYPE_PICK_AGAIN_OUT.type) || task.getTaskType().equals(TaskType.TASK_TYPE_CHECK_OUT.type)) {
            if (!this.update(new LambdaUpdateWrapper<Task>()
                    .eq(Task::getId, task.getId())
                    .set(Task::getUpdateBy, loginUserId)
                    .set(Task::getUpdateTime, new Date())
                    .set(Task::getTaskStatus, TaskStsType.WAVE_SEED.id))) {
                throw new CoolException("库存状态更新失败!!");
            }
        } else {
            if (!this.update(new LambdaUpdateWrapper<Task>()
                    .eq(Task::getId, task.getId())
                    .set(Task::getUpdateBy, loginUserId)
                    .set(Task::getUpdateTime, new Date())
                    .set(Task::getTaskStatus, TaskStsType.UPDATED_OUT.id))) {
                throw new CoolException("库存状态更新失败!!");
            }
            //全板出库,删除临时库存
            if (!locItemWorkingService.remove(new LambdaQueryWrapper<LocItemWorking>().eq(LocItemWorking::getTaskId, task.getId()))) {
                throw new CoolException("临时库存清除失败!!");
            }
        }
    }
@@ -844,7 +894,7 @@
     * @version 1.0
     */
    @Transactional(rollbackFor = Exception.class)
    public void saveOutStockItem(List<TaskItem> taskItems, WaveItem waveItem) throws Exception {
    public void saveOutStockItem(List<TaskItem> taskItems, WaveItem waveItem, Long loginUserId) throws Exception {
        Stock stock = new Stock();
        String ruleCode = SerialRuleUtils.generateRuleCode(SerialRuleCode.SYS_STOCK_CODE, null);
        if (StringUtils.isBlank(ruleCode)) {
@@ -852,6 +902,8 @@
        }
        Double sum = taskItems.stream().mapToDouble(TaskItem::getAnfme).sum();
        stock.setCode(ruleCode)
                .setUpdateBy(loginUserId)
                .setUpdateTime(new Date())
                .setAnfme(sum);
        if (Objects.isNull(waveItem)) {
            stock.setWkType(Short.parseShort(OrderWorkType.ORDER_WORK_TYPE_STOCK_OUT.type))
@@ -870,6 +922,8 @@
            StockItem stockItem = new StockItem();
            BeanUtils.copyProperties(item, stockItem);
            stockItem.setSourceItemId(item.getOrderItemId())
                    .setUpdateBy(loginUserId)
                    .setUpdateTime(new Date())
                    .setStockCode(stock.getCode())
                    .setId(null)
                    .setStockId(stock.getId());
@@ -901,7 +955,7 @@
     * @version 1.0
     */
    @Transactional(rollbackFor = Exception.class)
    public void complateInstock(Task task) {
    public void complateInstock(Task task, Long loginUserId) {
        if (Objects.isNull(task)) {
            return;
        }
@@ -921,7 +975,7 @@
        }
        try {
            //更新库位明细
            saveLocItem(taskItems, task.getId());
            saveLocItem(taskItems, task.getId(), loginUserId);
        } catch (Exception e) {
            throw new CoolException("库位明细更新失败!!");
        }
@@ -936,10 +990,11 @@
            List<TaskItem> items = orderMap.get(key);
            try {
                //保存库存明细
                saveStockItems(items, task, pakinItem.getId(), pakinItem.getAsnCode(), pakinItem.getWkType(), pakinItem.getType());
                saveStockItems(items, task, pakinItem.getId(), pakinItem.getAsnCode(), pakinItem.getWkType(), pakinItem.getType(), loginUserId);
                //移出收货区库存, 修改组托状态
                removeReceiptStock(pakinItem);
                removeReceiptStock(pakinItem, loginUserId);
            } catch (Exception e) {
                logger.error("<UNK>", e);
                throw new CoolException(e.getMessage());
            }
        });
@@ -954,24 +1009,26 @@
    /**
     * @param
     * @param loginUserId
     * @return
     * @author Ryan
     * @description 移除收货区库存
     * @time 2025/4/30 16:32
     */
    @Transactional(rollbackFor = Exception.class)
    public void removeReceiptStock(WaitPakinItem pakinItem) {
    public void removeReceiptStock(WaitPakinItem pakinItem, Long loginUserId) {
        WarehouseAreasItem itemServiceOne = warehouseAreasItemService.getOne(new LambdaQueryWrapper<WarehouseAreasItem>()
                .eq(WarehouseAreasItem::getId, pakinItem.getSource()));
        if (Objects.isNull(itemServiceOne)) {
            throw new CoolException("数据错误:请查看请货区库存是否存在!!");
        }
        Double workQty = itemServiceOne.getWorkQty() - pakinItem.getAnfme();
        Double qty = itemServiceOne.getQty() + pakinItem.getAnfme();
        Double workQty = Math.round((itemServiceOne.getWorkQty() - pakinItem.getAnfme()) * 10000) / 10000.0;
        Double qty = Math.round((itemServiceOne.getQty() + pakinItem.getAnfme()) * 10000) / 10000.0;
        itemServiceOne.setWorkQty(workQty).setQty(qty);
        if (!waitPakinService.update(new LambdaUpdateWrapper<WaitPakin>()
                .set(WaitPakin::getIoStatus, PakinIOStatus.PAKIN_IO_STATUS_TASK_DONE.val)
                        .set(WaitPakin::getUpdateBy, loginUserId)
                .eq(WaitPakin::getId, pakinItem.getPakinId()))) {
            throw new CoolException("组拖状态修改失败!!");
        }
@@ -981,6 +1038,7 @@
                throw new CoolException("收货区物料删除失败!!");
            }
        } else {
            itemServiceOne.setUpdateBy(loginUserId).setUpdateTime(null);
            if (!warehouseAreasItemService.updateById(itemServiceOne)) {
                throw new CoolException("收货区库完成数量修改失败!!");
            }
@@ -989,13 +1047,14 @@
    /**
     * @param
     * @param loginUserId
     * @return
     * @author Ryan
     * @description 更新库位明细
     * @time 2025/4/15 15:28
     */
    @Transactional(rollbackFor = Exception.class)
    public void saveLocItem(List<TaskItem> items, Long taskId) throws Exception {
    public void saveLocItem(List<TaskItem> items, Long taskId, Long loginUserId) throws Exception {
        Task task = this.getById(taskId);
        if (Objects.isNull(task)) {
            throw new CoolException("任务不存在!!");
@@ -1008,6 +1067,7 @@
            BeanUtils.copyProperties(taskItem, item);
            item.setLocCode(loc.getCode()).setId(null)
                    .setLocId(loc.getId())
                    .setUpdateBy(loginUserId)
                    .setWkType(taskItem.getWkType())
                    .setType(taskItem.getOrderType());
            locItems.add(item);
@@ -1021,10 +1081,11 @@
     * 生成入库库存明细
     *
     * @param items
     * @param loginUserId
     * @return
     */
    @Transactional(rollbackFor = Exception.class)
    public void saveStockItems(List<TaskItem> items, Task task, Long id, String code, Short wkType, String type) throws
    public void saveStockItems(List<TaskItem> items, Task task, Long id, String code, Short wkType, String type, Long loginUserId) throws
            Exception {
        Stock stock = new Stock();
        String ruleCode = SerialRuleUtils.generateRuleCode(SerialRuleCode.SYS_STOCK_CODE, null);
@@ -1038,6 +1099,7 @@
                .setAnfme(sum)
                .setWkType(wkType)
                .setBarcode(task.getBarcode())
                .setUpdateBy(loginUserId)
                .setType(type);
        if (task.getTaskType().equals(TaskType.TASK_TYPE_IN.type) ||
                task.getTaskType().equals(TaskType.TASK_TYPE_MERGE_IN.type) ||
@@ -1061,6 +1123,7 @@
                    .setStockCode(stock.getCode())
                    .setBarcode(task.getBarcode())
                    .setSourceItemId(item.getOrderItemId())
                    .setUpdateBy(loginUserId)
                    .setId(null)
                    .setStockId(stock.getId());
            stockItems.add(stockItem);
rsf-server/src/main/java/com/vincent/rsf/server/manager/service/impl/WaitPakinServiceImpl.java
@@ -63,7 +63,7 @@
        if (StringUtils.isBlank(waitPakin.getBarcode())) {
            throw new CoolException("参数错误:托盘码为空!!");
        }
        List<Short> asList = Arrays.asList(Short.valueOf(PakinIOStatus.PAKIN_IO_STATUS_DONE.val), Short.valueOf(PakinIOStatus.PAKIN_IO_STATUS_DONE.val));
//        List<Short> asList = Arrays.asList(Short.valueOf(PakinIOStatus.PAKIN_IO_STATUS_DONE.val), Short.valueOf(PakinIOStatus.PAKIN_IO_STATUS_DONE.val));
        WaitPakin pakin = waitPakinService.getOne(new LambdaQueryWrapper<WaitPakin>()
                .eq(WaitPakin::getBarcode, waitPakin.getBarcode()));
        if (!Objects.isNull(pakin)) {
@@ -84,7 +84,7 @@
        }
        waitPakin1.setCode(ruleCode)
                //状态修改为入库中
                .setIoStatus(Short.parseShort(PakinIOStatus.PAKIN_IO_STATUS_DONE.val))
                .setIoStatus(PakinIOStatus.PAKIN_IO_STATUS_DONE.val)
                .setAnfme(sum)
                .setUpdateBy(userId)
                .setCreateBy(userId)
@@ -220,10 +220,13 @@
                            if (item.getReceiptQty().compareTo(0.00) == 0) {
                                throw new CoolException("解绑数量不能为零!!");
                            }
                            if (item.getReceiptQty().compareTo(pakinItems.get(i1).getAnfme() - pakinItems.get(i1).getWorkQty() - pakinItems.get(i1).getQty()) > 0) {
                            Double reslt = Math.round((pakinItems.get(i1).getAnfme() - pakinItems.get(i1).getWorkQty() - pakinItems.get(i1).getQty()) * 10000) / 10000.0;
                            if (item.getReceiptQty().compareTo(reslt) > 0) {
                                throw new CoolException("解绑数量不能大于剩余可执行数!!");
                            }
                           pakinItems.get(i1).setAnfme(pakinItems.get(i1).getAnfme() - item.getReceiptQty());
                            Double anfme = Math.round((pakinItems.get(i1).getAnfme() - item.getReceiptQty()) * 10000) / 10000.0;
                           pakinItems.get(i1).setAnfme(anfme);
                           if (!waitPakinItemService.updateById(pakinItems.get(i1))) {
                               throw new CoolException("组托明细数量修改失败!!");
                           }
@@ -234,7 +237,7 @@
                        }
                        for (int i = 0; i < warehouseAreasItems.size(); i++) {
                            if (warehouseAreasItems.get(i).getId().equals(pakinItems.get(i1).getSource())) {
                                double v = warehouseAreasItems.get(i).getWorkQty() - item.getReceiptQty();
                                double v = Math.round((warehouseAreasItems.get(i).getWorkQty() - item.getReceiptQty()) * 10000) / 10000.0;
                                warehouseAreasItems.get(i).setWorkQty(v);
                                if (!warehouseAreasItemService.updateById(warehouseAreasItems.get(i))) {
                                    throw new CoolException("收货区数量修改失败!!");
@@ -252,7 +255,8 @@
                    throw new CoolException("组托删除失败!!");
                }
            } else {
                waitPakins.setAnfme(waitPakins.getAnfme() - anfmes);
                Double anfme = Math.round((waitPakins.getAnfme() - anfmes) * 10000) / 10000.0;
                waitPakins.setAnfme(anfme);
                if (!waitPakinService.updateById(waitPakins)) {
                    throw new CoolException("组托数据修改失败!!");
                }
@@ -296,7 +300,8 @@
                    continue;
                }
                double sum = pakin.stream().mapToDouble(WaitPakinItem::getAnfme).sum();
                item.setWorkQty(item.getWorkQty() - sum);
                Double workQty = Math.round((item.getWorkQty() - sum) * 10000) / 10000.0;
                item.setWorkQty(workQty);
                if (!warehouseAreasItemService.updateById(item)) {
                    throw new CoolException("收货区数据回滚失败!!");
                }
rsf-server/src/main/java/com/vincent/rsf/server/system/utils/SystemAuthUtils.java
New file
@@ -0,0 +1,75 @@
package com.vincent.rsf.server.system.utils;
import com.vincent.rsf.common.enums.SystemModeType;
import com.vincent.rsf.framework.common.R;
import com.vincent.rsf.framework.common.SpringUtils;
import com.vincent.rsf.server.common.config.ConfigProperties;
import com.vincent.rsf.server.common.domain.BusinessRes;
import com.vincent.rsf.server.common.security.JwtSubject;
import com.vincent.rsf.server.common.utils.JwtUtil;
import com.vincent.rsf.server.system.entity.Tenant;
import com.vincent.rsf.server.system.entity.User;
import com.vincent.rsf.server.system.entity.UserLogin;
import com.vincent.rsf.server.system.service.TenantService;
import com.vincent.rsf.server.system.service.UserLoginService;
import com.vincent.rsf.server.system.service.UserService;
import org.checkerframework.checker.units.qual.C;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.core.Authentication;
import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.PostMapping;
import javax.annotation.PostConstruct;
import java.util.Objects;
@Component
public class SystemAuthUtils {
    public static Logger logger = LoggerFactory.getLogger(SystemAuthUtils.class);
    private static String username;
    private static String password;
    private static String tokenKey;
    private static Long tokenExpireTime;
    private static SystemModeType systemMode;
    @Autowired
    private ConfigProperties configProperties;
    @PostConstruct
    public void init() {
        username = configProperties.getUserName();
        password = configProperties.getPassword();
    }
    public static User getLoginUser() {
        try {
            Authentication authentication = SecurityContextHolder.getContext().getAuthentication();
            if (authentication != null) {
                Object object = authentication.getPrincipal();
                if (object instanceof User) {
                    return (User) object;
                }
            } else {
                UserService userService = SpringUtils.getBean(UserService.class);
                return userService.getByUsername(username, null);
            }
        } catch (Exception e) {
            logger.error("<UNK>", e);
        }
        return null;
    }
    public static Long getLoginUserId() {
        User loginUser = getLoginUser();
        return loginUser == null ? null : loginUser.getId();
    }
}
rsf-server/src/main/resources/application.yml
@@ -11,6 +11,8 @@
  code-length: 6
  code-time: 300
  security-code: 951123
  username: super
  password: 123456
eureka:
  client:
@@ -37,6 +39,7 @@
super:
  pwd: xltys1995
logging:
  file:
    path: logs/@pom.artifactId@