自动化立体仓库 - WMS系统
#
zwl
昨天 8ce4dcbd701b40165b0dbf365f667932cf2a8916
src/main/java/com/zy/asrs/service/impl/WorkServiceImpl.java
@@ -443,67 +443,7 @@
     * @date 2026/1/9 20:16
     */
    private void generateOutStock(TaskDto taskDto, Long userId, int workNo, String wrkCode, Date now, int ioType, LocMast locMast, StaDesc staDesc, String deviceNo) {
        if (Objects.isNull(deviceNo)) {
            throw new CoolException("机台号不能为空!!");
        }
        BasDevice basDevice = basDeviceService.selectOne(new EntityWrapper<BasDevice>()
                .eq("status", 1)
                .eq("dev_no", deviceNo));
        if (Objects.isNull(basDevice)) {
            throw new CoolException("机台信息不存在或已禁用!!");
        }
        LocAroundBind binds = locAroundBindService.selectOne(new EntityWrapper<LocAroundBind>()
                .eq("loc_type", LocStsType.LOC_STS_TYPE_O.type)
                .eq("dev_no", basDevice.getType()).orderBy("order_no"));
        if (Objects.isNull(binds)) {
            throw new CoolException("机台未设置默认工作位!!");
        }
//
//        Set<String> locs = binds.stream().map(LocAroundBind::getBlocNo).collect(Collectors.toSet());
//        LocMast locMasts = locMastService.selectOne(new EntityWrapper<LocMast>()
//                .in("loc_no", locs)
//                .eq("loc_sts", LocStsType.LOC_STS_TYPE_O.type)
//                .orderAsc(Arrays.asList("loc_no")));
//        if (Objects.isNull(locMasts)) {
//            binds = locAroundBindService.selectList(new EntityWrapper<LocAroundBind>()
//                    .eq("dev_no", basDevice.getDevNo()));
//
//            Set<String> nlocs = binds.stream().map(LocAroundBind::getBlocNo).collect(Collectors.toSet());
//
//            locMasts = locMastService.selectOne(new EntityWrapper<LocMast>()
//                    .in("loc_no", nlocs)
//                    .eq("loc_sts", LocStsType.LOC_STS_TYPE_O.type)
//                    .orderAsc(Arrays.asList("loc_no")));
//            if (Objects.isNull(locMasts)) {
//                throw new CoolException("暂无可用工作位!!");
//            }
//        }
        LocAroundBind bLocNo = locAroundBindService.selectOne(new EntityWrapper<LocAroundBind>().eq("b_loc_no", binds.getBlocNo()));
        bLocNo.setLocType(LocStsType.LOC_STS_TYPE_S.type);
        if (!locAroundBindService.updateById(bLocNo)) {
            throw new CoolException("工位预约失败!!");
        }
        LocMast locMasts = locMastService.selectOne(new EntityWrapper<LocMast>()
                .eq("loc_no", bLocNo.getBlocNo()));
        locMasts.setLocSts(LocStsType.LOC_STS_TYPE_S.type);
        locMasts.setModiUser(userId);
        locMasts.setModiTime(now);
        if (!locMastService.updateById(locMasts)) {
            throw new CoolException("预约库位状态失败,库位号:" + locMasts.getLocNo());
        }
        List<Integer> staNos = staDescService.queryOutStaNosByLocNo(locMasts.getLocNo(), 1);
        //TODO 1. 获取入库站点, 目标库位  3. 将出库明细添加至入库明细
        Integer staNo = staNos.stream().findFirst().get();
        // 生成工作档
        WrkMast wrkMast = new WrkMast();
        wrkMast.setWrkNo(workNo);
@@ -514,12 +454,7 @@
        wrkMast.setIoType(ioType); // 入出库状态
        wrkMast.setIoPri(13D); // 优先级:13
        wrkMast.setCrnNo(locMast.getCrnNo());
//        wrkMast.setStaNo(staDesc.getStnNo() + ""); // 目标站
        if(!Objects.equals(locMasts.getCrnNo(), locMast.getCrnNo())){
            wrkMast.setSourceStaNo(staDesc.getCrnStn() + ""); // 源站
            wrkMast.setStaNo(staNo + ""); // 目标站
        }
        wrkMast.setLocNo(locMasts.getLocNo());
        wrkMast.setStaNo(staDesc.getStnNo() + ""); // 目标站
        wrkMast.setSourceLocNo(taskDto.getLocNo()); // 源库位
        wrkMast.setFullPlt("Y"); // 满板:Y
        wrkMast.setPicking("N"); // 拣料