| | |
| | | package com.zy.common.utils; |
| | | |
| | | import com.baomidou.mybatisplus.mapper.EntityWrapper; |
| | | 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 lombok.extern.slf4j.Slf4j; |
| | | |
| | | import java.util.HashMap; |
| | | import java.util.Map; |
| | |
| | | * @description 出库拦截工具类 |
| | | * @createDate 2024/11/9 14:29 |
| | | */ |
| | | @Slf4j |
| | | public class OutStockInterceptUtil { |
| | | |
| | | /** |
| | | * 堆垛机库入库站点 |
| | | */ |
| | | public static final Map<Integer,Boolean> inSiteMap = new HashMap<Integer,Boolean>(){{ |
| | | inSiteMap.put(1040,true); |
| | | inSiteMap.put(2010,true);inSiteMap.put(2000,true); |
| | | inSiteMap.put(3010,true); |
| | | }}; |
| | | 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){ |
| | | public static void outStockIntercept(Integer site) { |
| | | log.info("出库判断是否有入库任务,出库站点:{}",site); |
| | | // 只判断堆垛机库的入库站点 |
| | | if (inSiteMap.get(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); |
| | | int count = wrkMastMapper.selectCount(new EntityWrapper<WrkMast>() |
| | | .eq("source_sta_no", site).in("io_type",1,10,53,57)); |
| | | if (count == 0) { |
| | | basDevp.setDevMk("0"); // 没有入库任务,切换成出库模式 |
| | | basDevpMapper.updateById(basDevp); |
| | | } else { |
| | | throw new CoolException("该出库站点存在执行的入库任务"); |
| | | } |
| | | int inSite = 0; |
| | | switch (site) { |
| | | case 1040: |
| | | case 1042: |
| | | inSite = 1040; |
| | | break; |
| | | case 2010: |
| | | case 2012: |
| | | inSite = 2010; |
| | | break; |
| | | case 2000: |
| | | case 2002: |
| | | inSite = 2000; |
| | | break; |
| | | case 3010: |
| | | case 3012: |
| | | inSite = 3010; |
| | | break; |
| | | default: |
| | | } |
| | | BasDevp basDevp = basDevpMapper.selectById(inSite); |
| | | Integer inQty = basDevp.getInQty(); |
| | | log.info("入库任务数有:{}条", inQty); |
| | | if (inQty != 0) { |
| | | throw new CoolException("该出库站点存在执行的入库任务"); |
| | | } |
| | | } |
| | | } |