#
1
3 天以前 7c264be282c33feedbd4478f7e674ebac8fd55db
#
3个文件已修改
82 ■■■■■ 已修改文件
src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java 14 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/core/model/protocol/RgvProtocol.java 62 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/resources/mapper/WrkMastStaMapper.xml 6 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java
@@ -285,6 +285,9 @@
                            staProtocolNew.setSiteId(staProtocol.getSiteId());
                            devpThread.setPakMk(staProtocol.getSiteId(), false);
                            staProtocolNew.setBarcode(barcode);
                            if(!staProtocolNew.isLoading()){
                                continue;
                            }
                            MessageQueue.offer(SlaveType.Devp, devp.getId(), new Task(2, staProtocolNew));
                            if (ledThread != null) {
                                News.error(methodName + ":扫码失败,请重试");
@@ -1098,14 +1101,17 @@
                    }
                }
            }
            if(staProtocolIn.getWorkNo() != null && staProtocolIn.getStaNo() != 4001){
            WrkMast wrkMastIn= wrkMastMapper.selectByWrkNo(staProtocolIn.getWorkNo());
            if(wrkMastIn == null){
                continue;
            }
            if(staProtocolIn.getWorkNo() != null && wrkMastIn.getStaNo() != 4001){
                WrkMast wrkMastCrn = wrkMastMapper.selectByWrkNo(staProtocolIn.getWorkNo());
                if(wrkMastCrn!=null){
                    if(wrkMastCrn.getCrnNo() == 3 ){
                        continue;
                    }
                }
                WrkMast wrkMastIn = wrkMastMapper.selectByWrkNo(staProtocolIn.getWorkNo());
                WrkMast wrkMast = wrkMastMapper.selectByWrkNo(9996);
                if(wrkMastIn == null){
                    continue;
@@ -5604,7 +5610,7 @@
                    }
                    // 判断重复工作档
                    List<BasAgvMast> basAgvMastList = basAgvMastService.selectList(new EntityWrapper<BasAgvMast>().eq("task_no", staProtocol.getWorkNo()));
                    List<BasAgvMast> basAgvMastList = basAgvMastService.selectList(new EntityWrapper<BasAgvMast>().eq("task_no", wrkMast.getWrkNo()));
                    if (!basAgvMastList.isEmpty()) {
                        wrkMast.setTakeNone("2");
                        wrkMastMapper.updateById(wrkMast);
@@ -5732,7 +5738,7 @@
                    }
                    List<LocMast> locMastList = locMastService.selectList(new EntityWrapper<LocMast>().eq("barcode", barcode));
                    if (!locMastList.isEmpty()) {
//                        News.info("{}号站点条码信息重复:{}", outStaAgv.getStaNo(), barcode);
                        News.info("{}号站点条码信息重复:{}", outStaAgv.getStaNo(), barcode);
                        continue;
                    }
                    // 任务生成区 --------------------------------------------------------------------------
src/main/java/com/zy/core/model/protocol/RgvProtocol.java
@@ -430,8 +430,30 @@
        return map.get(RgvPos);
    }
    // 上一次位置(用于防跳变)
    private Integer lastRgvPos1 = null;
    private Integer lastRgvPos2 = null;
    // ================= 公共方法 =================
    private Integer getClosestSite(int rgvPos, Map<Integer, Integer> posMap, int tolerance) {
        int minDiff = Integer.MAX_VALUE;
        Integer result = 0;
        for (Map.Entry<Integer, Integer> entry : posMap.entrySet()) {
            int diff = Math.abs(rgvPos - entry.getValue());
            if (diff < minDiff) {
                minDiff = diff;
                result = entry.getKey();
            }
        }
        // ⚠️ 不再返回0,强制返回最近点
        return result;
    }
    // ================= RGV1 =================
    public Integer getRgvPosI1() {
        // key: 站点号  value: 基准物理位置
        Map<Integer, Integer> posMap = new HashMap<>();
        posMap.put(1004, 6534);
        posMap.put(1007, 33634);
@@ -444,22 +466,21 @@
        posMap.put(1031, 288194);
        posMap.put(1035, 314954);
        int tolerance = 500;
        int tolerance = 200; // 允许误差范围
        for (Map.Entry<Integer, Integer> entry : posMap.entrySet()) {
            int site = entry.getKey();
            int basePos = entry.getValue();
            if (Math.abs(RgvPos - basePos) <= tolerance) {
                return site;
            }
        // ========= 异常保护 =========
        if (RgvPos < 0 || RgvPos > 400000) {
            return 0;
        }
        return 0; // 没匹配到站点
        lastRgvPos1 = RgvPos;
        return getClosestSite(RgvPos, posMap, tolerance);
    }
    // ================= RGV2 =================
    public Integer getRgvPosI2() {
        // key: 站点号  value: 基准物理位置
        Map<Integer, Integer> posMap = new HashMap<>();
        posMap.put(2030, 314954);
        posMap.put(2027, 288094);
@@ -471,17 +492,16 @@
        posMap.put(2009, 75174);
        posMap.put(2006, 33748);
        posMap.put(2003, 6449);
        int tolerance = 500; // 允许误差范围
        for (Map.Entry<Integer, Integer> entry : posMap.entrySet()) {
            int site = entry.getKey();
            int basePos = entry.getValue();
            if (Math.abs(RgvPos - basePos) <= tolerance) {
                return site;
            }
        }
        int tolerance = 500;
        return 0; // 没匹配到站点
        // ========= 异常保护 =========
        if (RgvPos < 0 || RgvPos > 400000) {
            return 0;
        }
        lastRgvPos2 = RgvPos;
        return getClosestSite(RgvPos, posMap, tolerance);
    }
src/main/resources/mapper/WrkMastStaMapper.xml
@@ -40,9 +40,9 @@
    </select>
    <select id="selectByWrkNoPut" resultMap="BaseResultMap">
        select top 1 * from asr_wrk_mast_sta
        where 1=1
          and wrk_no = #{workNo}
        select top 1 *
        from asr_wrk_mast_sta WITH (ROWLOCK, READPAST)
        where wrk_no = #{workNo}
          and wrk_sts = 1
    </select>