1
zhang
2025-08-13 1498da813428be4e35423b6cf26fc45a203e73ab
src/main/java/com/zy/asrs/service/impl/CtuMainServiceImpl.java
@@ -1,6 +1,7 @@
package com.zy.asrs.service.impl;
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.core.common.Cools;
import com.zy.asrs.entity.LocMast;
import com.zy.asrs.entity.WrkMast;
import com.zy.asrs.mapper.WrkMastMapper;
@@ -20,7 +21,9 @@
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
/**
 * 立体仓库WCS系统主流程业务
@@ -97,7 +100,7 @@
                        LocMast locMast = locMastService.selectById(wrkMast.getSourceLocNo());
                        locMast.setLocSts("S");
                        locMast.setModiTime(new Date());
                        locMastService.selectById(locMast);
                        locMastService.updateById(locMast);
                    }
                }
            }
@@ -161,4 +164,63 @@
        }
    }
    public static final ArrayList<Integer> staNos2 = new ArrayList<Integer>() {{
        add(101);
        add(102);
        add(103);
        add(104);
        add(105);
        add(106);
        add(107);
        add(108);
    }};
    public synchronized void in(Integer mark) {
        // 遍历入库口
        for (Integer inSta : staNos2) {
            // 获取入库站信息
            SiemensDevpThread devpThread = (SiemensDevpThread) SlaveConnection.get(SlaveType.Devp, 1);
            StaProtocol staProtocol = devpThread.getStation().get(inSta);
            if (staProtocol == null) {
                continue;
            } else {
                staProtocol = staProtocol.clone();
            }
            // 判断是否满足条件
            if (!staProtocol.isAutoing() && !staProtocol.isLoading()) {
                continue;
            }
            // && staProtocol.isInEnable()
            if (staProtocol.isInEnable()) {
                getWrk(staProtocol, "-2");
            }
            if (staProtocol.isOutEnable()) {
                getWrk(staProtocol, "-3");
            }
        }
    }
    private void getWrk(StaProtocol staProtocol, String lev) {
        List<WrkMast> sourceLocNo = wrkMastService.selectList(new EntityWrapper<WrkMast>().eq("source_loc_no", staProtocol.getSiteId() + lev));
        if (!Cools.isEmpty(sourceLocNo) && !sourceLocNo.isEmpty()) {
            return;
        }
        WrkMast in = new WrkMast();
        in.setSourceLocNo(staProtocol.getSiteId() + lev);
        in.setLocNo("");
        in.setIoType(10);
        in.setIoTime(new Date());
        in.setWrkSts(1L); // 工作状态:11.生成出库ID
        in.setIoPri(13D); // 优先级:13
        in.setFullPlt("Y"); // 满板:Y
        in.setPicking("N"); // 拣料
        in.setExitMk("N"); // 退出
        in.setEmptyMk("Y"); // 空板
        in.setLinkMis("N");
        in.setAppeTime(new Date());
        in.setModiTime(new Date());
        wrkMastService.insert(in);
    }
}