自动化立体仓库 - WCS系统
#
luxiaotao1123
2022-03-11 d8e984c274d2745a02128dc4f2daddc23ece64d2
#
3个文件已修改
91 ■■■■■ 已修改文件
src/main/java/com/zy/asrs/mapper/WrkMastMapper.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java 87 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/resources/mapper/WrkMastMapper.xml 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/asrs/mapper/WrkMastMapper.java
@@ -43,7 +43,7 @@
    // 出库第一步,从库位到堆垛机出库站
//    @Select("select top 1 * from dbo.asr_wrk_mast where crn_no=#{crnNo} and wrk_sts=11 and io_type>100 order by io_pri desc,io_time,wrk_no asc")
    WrkMast selectPakOutStep1(@Param("crnNo")Integer crnNO, @Param("sourceStaNo")Integer sourceStaNo);
    WrkMast selectPakOutStep11(@Param("crnNo")Integer crnNO, @Param("sourceStaNo")Integer sourceStaNo);
    // 出库第二步,从堆垛机出库站到目标出库站,堆垛机出库站有物时执行
//    @Select("select top 1 * from dbo.asr_wrk_mast where source_sta_no=#{sourceStaNo} and wrk_sts=12 and io_type>100 order by io_pri desc,io_time desc,wrk_no ASC")
src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java
@@ -571,7 +571,7 @@
                // 有小车
                if (steNo != null) {
                    // 小车行走到堆垛机待搬移点
                    if (wrkMast.getWrkSts() == 2L) {
                    if (wrkMast.getWrkSts() == 2L && wrkMast.getStaNo() == null) {
                        this.letCarBeReady(wrkMast, steNo);
                    }
                    // 小车搬走
@@ -831,7 +831,7 @@
    public void locToCrnStn(CrnSlave slave, CrnProtocol crnProtocol){
        for (CrnSlave.CrnStn crnStn : slave.getCrnOutStn()) {
            // 获取工作状态为11(生成出库ID)的出库工作档
            WrkMast wrkMast = wrkMastMapper.selectPakOutStep1(slave.getId(), crnStn.getStaNo());
            WrkMast wrkMast = wrkMastMapper.selectPakOutStep11(slave.getId(), crnStn.getStaNo());
            if (wrkMast == null) {
                continue;
            }
@@ -870,35 +870,6 @@
                    continue;
                }
                // 双深库位且浅库位有货,则需先对浅库位进行库位移转
                if (Utils.isDeepLoc(slaveProperties, wrkMast.getSourceLocNo())) {
                    String shallowLocNo = Utils.getShallowLoc(slaveProperties, wrkMast.getSourceLocNo());
                    LocMast shallowLoc = locMastService.selectById(shallowLocNo);
                    // O.空库位、Q.拣料/盘点/并板再入库、S.入库预约、X.禁用 直接搬!
                    if (shallowLoc.getLocSts().equals("P") || shallowLoc.getLocSts().equals("R")) {
                        WrkMast waitWrkMast = wrkMastMapper.selectByLocNo(shallowLocNo);
                        if (null == waitWrkMast) {
                            log.error("{}库位异常,未检索到相应工作档!", shallowLocNo);
                        } else {
                            waitWrkMast.setIoPri(15D);
                            waitWrkMast.setModiTime(new Date());
                            if (wrkMastMapper.updateById(waitWrkMast) == 0) {
                                log.error("调整工作档优先级失败!工作号={}", waitWrkMast.getWrkNo());
                            }
                        }
                        continue;
                    } else if (shallowLoc.getLocSts().equals("F") || shallowLoc.getLocSts().equals("D")) {
                        // 此标记避免多次执行移库任务
                        if (Cools.isEmpty(wrkMast.getUpdMk()) || "N".equals(wrkMast.getUpdMk())) {
                            wrkMast.setUpdMk("Y");
                            wrkMastMapper.updateById(wrkMast);
                            // 生成工作档、改变浅库位的源库/目标库 库位状态、下发堆垛机命令(立马执行)
                            moveLocForDeepLoc(slave, shallowLoc);
                        }
                        log.error("{}任务出库失败,浅库位堵塞!", wrkMast.getWrkNo());
                        continue;
                    }
                }
                // 已经存在吊车执行任务时,则过滤
                if (wrkMastMapper.selectWorking(slave.getId()) != null) {
@@ -906,9 +877,6 @@
                }
                // todo
                // 最外层库位,直接堆垛机出库
                if (locMastService.isOutMost(wrkMast.getLocNo())) {
                    // 1.堆垛机开始移动
@@ -935,8 +903,59 @@
                            log.error("修改工作档状态 11.生成出库ID => 15.吊车出库中 失败!!,工作号={}", wrkMast.getWrkNo());
                        }
                    }
                // 不是最外层库位,需要使用穿梭车搬运后,再堆垛机出库
                } else {
                    // 当前组库位是否有穿梭车
                    Integer steNo = this.hasCarOfIdle(wrkMast.getLocNo());
                    // 有小车
                    if (steNo != null) {
                        if (wrkMast.getWrkSts() == 11L && wrkMast.getSteNo() == null) {
                            // 给穿梭车下发命令 让其将货物挪至堆垛机搬运点
                            SteThread steThread = (SteThread) SlaveConnection.get(SlaveType.Ste, steNo);
                            SteProtocol steProtocol = steThread.getSteProtocol();
                            if (steProtocol == null) { continue; }
                            if (steProtocol.getStatusType().equals(SteStatusType.IDLE)) {
                                // 命令下发区 --------------------------------------------------------------------------
                                SteCommand steCommand = new SteCommand();
                                steCommand.setSteNo(steNo); // 穿梭车编号
                                steCommand.setTaskNo(wrkMast.getWrkNo()); // 工作号
                                steCommand.setTaskMode(SteTaskModeType.TO_B); // 任务模式:  去近点 等待堆垛机叉取
                                // todo:luxiaotao
                                if (!MessageQueue.offer(SlaveType.Ste, steNo, new Task(2, steCommand))) {
                                    log.error("穿梭车命令下发失败,穿梭车号={},任务数据={}", steNo, JSON.toJSON(steCommand));
                                } else {
                                    // 修改工作档状态 11.生成出库ID => 14.小车待出
                                    Date now = new Date();
                                    wrkMast.setWrkSts(14L);
                                    wrkMast.setSteNo(steNo);
                                    wrkMast.setCrnStrTime(now);
                                    wrkMast.setModiTime(now);
                                    if (wrkMastMapper.updateById(wrkMast) > 0) {
                                    } else {
                                        log.error("修改工作档状态 11.生成出库ID => 14.小车待出 失败!!,工作号={}", wrkMast.getWrkNo());
                                    }
                                }
                            }
                        }
                    // 没有小车
                    } else {
                        if (wrkMast.getWrkSts() == 11L && wrkMast.getStaNo() == null) {
                            // 寻找最近的小车
                            SteThread steThread = queryIdleCar(wrkMast);
                            if (steThread != null) {
                                // 让小车等待搬运待续
                                this.letCarBeReady(wrkMast, steThread.getSlave().getId());
                            }
                        }
                        // 堆垛机搬运小车
                        if (wrkMast.getWrkSts() == 3L) {
                            this.carMoveIn(wrkMast, wrkMast.getSteNo(), crnProtocol);
                        }
                    }
                }
src/main/resources/mapper/WrkMastMapper.xml
@@ -108,7 +108,7 @@
        select top 1 * from asr_wrk_mast where barcode=#{barcode} and wrk_sts=14 and (io_type=103 or io_type=107 or io_type=104)
    </select>
    <select id="selectPakOutStep1" resultMap="BaseResultMap">
    <select id="selectPakOutStep11" resultMap="BaseResultMap">
        select top 1 * from dbo.asr_wrk_mast where crn_no=#{crnNo} and source_sta_no=#{sourceStaNo} and wrk_sts=11 and io_type>100 order by io_pri desc,io_time,wrk_no asc
    </select>