自动化立体仓库 - WMS系统
pang.jiabao
2024-12-19 ae0da7608e8671296ef9be508292bef9d1813819
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
65
66
67
package com.zy.common.utils;
 
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.mapper.Wrapper;
import com.core.common.SpringUtils;
import com.core.exception.CoolException;
import com.zy.asrs.entity.BasDevp;
import com.zy.asrs.entity.WrkMast;
import com.zy.asrs.mapper.BasDevpMapper;
import com.zy.asrs.mapper.WrkMastMapper;
 
import java.util.HashMap;
import java.util.Map;
 
/**
 * @author pang.jiabao
 * @description 出库拦截工具类
 * @createDate 2024/11/9 14:29
 */
public class OutStockInterceptUtil {
 
    /**
     * 堆垛机库入库站点
     */
    public static final Map<Integer,Boolean> inSiteMap = new HashMap<Integer,Boolean>();
 
    static {
        inSiteMap.put(1040, true);inSiteMap.put(1042, true);
        inSiteMap.put(2010, true);inSiteMap.put(2012, true);
        inSiteMap.put(2000, true);inSiteMap.put(2002, true);
        inSiteMap.put(3010, true);inSiteMap.put(3012, true);
    }
 
    /**
     * 堆垛机出库操作时拦截出库站点,判断出入库模式
     * @param site 出库站点
     */
    public static void outStockIntercept(Integer site){
        // 只判断堆垛机库的入库站点
        if (inSiteMap.get(site) != null) {
            BasDevpMapper basDevpMapper = SpringUtils.getBean(BasDevpMapper.class);
            BasDevp basDevp = basDevpMapper.selectById(site);
            String devMk = basDevp.getDevMk();
            if (devMk.equals("1")) {
                 throw new CoolException("该出库站点agv正在执行入库中");
            } else if (devMk.equals("2")) {
                 // 判断该站点入库任务是否完成
                WrkMastMapper wrkMastMapper = SpringUtils.getBean(WrkMastMapper.class);
                Wrapper<WrkMast> wrapper = new EntityWrapper<WrkMast>().in("io_type", 1, 10, 53, 57);
                switch (site) {
                    case 1040: wrapper.in("sta_no","1043","1044");break;
                    case 2010: wrapper.in("sta_no","2013","2014"); break;
                    case 2000: wrapper.in("sta_no","2003","2004");break;
                    case 3010: wrapper.in("sta_no","3013","3014");break;
                    default:
                }
                int count = wrkMastMapper.selectCount(wrapper);
                if (count == 0) {
                    basDevp.setDevMk("0"); // 没有入库任务,切换成出库模式
                    basDevpMapper.updateById(basDevp);
                } else {
                    throw new CoolException("该出库站点存在执行的入库任务");
                }
            }
        }
    }
}