自动化立体仓库 - WMS系统
pang.jiabao
2024-08-12 1b7c03baf021e4896b296e2c0af277c4c57656e8
src/main/java/com/zy/asrs/service/impl/OpenServiceImpl.java
@@ -30,7 +30,6 @@
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.net.CookieStore;
import java.util.*;
import java.util.stream.Collectors;
@@ -993,16 +992,17 @@
        if (Cools.isEmpty(param)) {
            throw new CoolException("请求参数有误:" + param);
        }
        int zpalletCount = locDetlService.selectCount(new EntityWrapper<LocDetl>().eq("zpallet", param.getBarcode()));
        if (zpalletCount > 0) {
            throw new CoolException("库存托盘码已存在:" + param.getBarcode());
        }
        if (!Cools.isEmpty(param.getBarcode())) {
            int zpalletCount = locDetlService.selectCount(new EntityWrapper<LocDetl>().eq("zpallet", param.getBarcode()));
            if (zpalletCount > 0) {
                throw new CoolException("库存托盘码已存在:" + param.getBarcode());
            }
        int barcodeCount = wrkMastService.selectCount(new EntityWrapper<WrkMast>().eq("barcode", param.getBarcode()));
        if (barcodeCount > 0) {
            throw new CoolException("工作档已存在该托盘码:" + param.getBarcode());
            int barcodeCount = wrkMastService.selectCount(new EntityWrapper<WrkMast>().eq("barcode", param.getBarcode()));
            if (barcodeCount > 0) {
                throw new CoolException("工作档已存在该托盘码:" + param.getBarcode());
            }
        }
        LocTypeDto locTypeDto = new LocTypeDto();
        locTypeDto.setLocType1((short)1);
        int iotype = 1;
@@ -1116,6 +1116,9 @@
        }
        wrkMast.setWrkSts(2L);
        if(wrkMast.getIoType() == 10){
            wrkMast.setBarcode(param.getBarcode());
        }
        wrkMastService.updateById(wrkMast);
        return "请求成功";
@@ -1245,17 +1248,32 @@
        return "出库结果上报成功";
    }
    @Autowired
    private BasCrnpService basCrnpService;
    @Override
    @Transactional
    public String emptyOutLoc(GhjtApiParam param) {
//        3102/3009/3008/3006/3003/3002→3047/3112
        // 获取模式为电脑模式,无任务的堆垛机列表:防止分配到堆垛机不可用
        List<BasCrnp> basCrnps = basCrnpService.selectList(new EntityWrapper<BasCrnp>().eq("crn_sts",3)
                .eq("wrk_no",0));
        if (basCrnps.isEmpty()) {
            // 都有任务则获取电脑模式的堆垛机列表
            basCrnps = basCrnpService.selectList(new EntityWrapper<BasCrnp>().eq("crn_sts",3));
        }
        if (basCrnps.isEmpty()) {
            throw new CoolException("没有可用堆垛机,堆垛机停止或异常");
        }
        // 可用堆垛机列表
        List<Integer> crnNoList = basCrnps.stream().map(BasCrnp::getCrnNo).collect(Collectors.toList());
        // 寻找空托盘库位,先找浅库位
        List<LocMast> locMasts;
            locMasts = locMastService.selectList(new EntityWrapper<LocMast>().eq("loc_sts","D")
                    .orderAsc(Arrays.asList("row1","lev1","bay1")).in("row1",3,4,6,7,10,11,14,15,18,19,22,23));
                    .orderAsc(Arrays.asList("row1","lev1","bay1")).in("crn_no",crnNoList).in("row1",3,4,6,7,10,11,14,15,18,19,22,23));
            if (locMasts.isEmpty()) {
                locMasts = locMastService.selectList(new EntityWrapper<LocMast>().eq("loc_sts","D")
                        .orderAsc(Arrays.asList("row1","lev1","bay1")).in("row1",1,4,5,8,9,12,13,16,17,20,21,24));
                        .orderAsc(Arrays.asList("row1","lev1","bay1")).in("crn_no",crnNoList).in("row1",1,4,5,8,9,12,13,16,17,20,21,24));
            }
        if (locMasts.isEmpty()) {
@@ -1285,6 +1303,7 @@
        wrkMast.setStaNo(staDesc.getStnNo()); // 目标站
        wrkMast.setCrnNo(locMast.getCrnNo());
        wrkMast.setSourceLocNo(locMast.getLocNo()); // 源库位
        wrkMast.setBarcode(locMast.getBarcode());
        wrkMast.setFullPlt("N"); // 满板:Y
        wrkMast.setPicking("N"); // 拣料
        wrkMast.setExitMk("N"); // 退出