自动化立体仓库 - WCS系统
*
lsh
6 天以前 f287ab5ee6b9938e0d48cdb62c05078bdec463d8
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
package com.zy.core.cache;
 
import com.zy.core.model.protocol.RgvProtocol;
 
import java.util.concurrent.ConcurrentHashMap;
 
/**
 * Created by IX on 2025/02/21
 */
public class RgvStatusCache {
    // 本地缓存,键为 currentPosition,值为 DeviceStatus
    private static final ConcurrentHashMap<Integer, RgvProtocol> cache = new ConcurrentHashMap<>();
 
    /**
     * 更新设备状态
     */
    public static void updateRgvStatus(RgvProtocol status) {
        try {
            cache.put(status.getRgvNo(), status);
        } finally {
        }
    }
 
    /**
     * 获取设备状态
     */
    public static RgvProtocol getRgvStatus(Integer RgvNo) {
        try {
            return cache.get(RgvNo);
        } finally {
        }
    }
 
    /**
     * 获取所有设备状态
     */
    public static ConcurrentHashMap<Integer, RgvProtocol> getAllRgvStatus() {
        try {
            return new ConcurrentHashMap<>(cache); // 返回副本
        } finally {
        }
    }
 
}