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(2010, true);inSiteMap.put(2000, true);
|
inSiteMap.put(3010, 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("该出库站点存在执行的入库任务");
|
}
|
}
|
}
|
}
|
}
|