#
luxiaotao1123
2024-12-16 bc5fa0165da2b3e41b9c27bee5394ff6d47f096f
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
package com.zy.acs.fake.service;
 
import com.zy.acs.fake.domain.DynamicNode;
import com.zy.acs.framework.common.Cools;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
 
import java.util.ArrayList;
import java.util.List;
 
/**
 * Created by vincent on 2023/6/14
 */
@Slf4j
@Component("mapService")
public class MapService {
 
    @Autowired
    private MapDataDispatcher mapDataDispatcher;
 
    public synchronized void unlockPath(String agvNo, String codeData) {
        try {
 
            if (Cools.isEmpty(agvNo, codeData)) {
                return;
            }
 
            Integer lev = null;
 
            String[][] codeMatrix = mapDataDispatcher.getCodeMatrix(null);
            int[] codeMatrixIdx = mapDataDispatcher.getCodeMatrixIdx(lev, codeData);
 
 
            DynamicNode[][] dynamicMatrix = mapDataDispatcher.getDynamicMatrix(lev);
 
            DynamicNode dynamicNode = dynamicMatrix[codeMatrixIdx[0]][codeMatrixIdx[1]];
 
 
            Integer serial = dynamicNode.getSerial();
 
            List<String> resetCodeList = new ArrayList<>();
 
            for (int i = 0; i < dynamicMatrix.length; i++) {
                for (int j = 0; j < dynamicMatrix[i].length; j++) {
                    DynamicNode node = dynamicMatrix[i][j];
                    if (node.getVehicle().equals(agvNo) && node.getSerial() < serial) {
                        resetCodeList.add(codeMatrix[i][j]);
                    }
                }
            }
 
            if (!Cools.isEmpty(resetCodeList)) {
 
                mapDataDispatcher.clearDynamicMatrixByCodeList(lev, resetCodeList);
            }
 
        } catch (Exception e) {
            log.error("TrafficService.unlockPath", e);
        }
 
    }
 
}