New file |
| | |
| | | package com.zy.asrs.constant; |
| | | |
| | | public class AsrsConstants { |
| | | //B是二厂,G是三厂 |
| | | public static final String ERCHANG = "B"; |
| | | |
| | | public static final String SANCHANG = "G"; |
| | | } |
| | |
| | | import com.zy.asrs.entity.param.*; |
| | | import com.zy.asrs.service.*; |
| | | import com.zy.asrs.service.impl.OrderServiceImpl; |
| | | import com.zy.asrs.utils.OrderUtils; |
| | | import com.zy.common.web.BaseController; |
| | | import lombok.Synchronized; |
| | | import org.slf4j.Logger; |
| | |
| | | params.getCombParams().forEach(combParam -> { |
| | | agvMobileService.comb(combParam, getUserId()); |
| | | }); |
| | | //获取判断时哪个厂的订单 |
| | | String csocode = params.getCombParams().get(0).getCombMats().get(0).getCsocode(); |
| | | String factory = OrderUtils.getFactory(csocode); |
| | | params.setContainerType(Short.valueOf(params.getContainerCode().substring(0, 2))); |
| | | workService.emptyPlateIn(params.getDevNo(), params.getContainerCode(), params.getContainerType(), getUserId(), false); |
| | | workService.emptyPlateIn(params.getDevNo(), params.getContainerCode(), params.getContainerType(), getUserId(), false,factory); |
| | | |
| | | return R.ok("生成工作档成功"); |
| | | } |
| | |
| | | |
| | | for (AgvMobileStartParam.Pda pda : params.getPad()) { |
| | | pda.setContainerType(Short.valueOf(pda.getContainerCode().substring(0, 2))); |
| | | workService.emptyPlateIn(pda.getDevNo(), pda.getContainerCode(), pda.getContainerType(), getUserId(), false); |
| | | workService.emptyPlateIn(pda.getDevNo(), pda.getContainerCode(), pda.getContainerType(), getUserId(), false,null); |
| | | } |
| | | |
| | | return R.ok(); |
| | |
| | | /* |
| | | 空板入库 |
| | | */ |
| | | String emptyPlateIn(String station,String containerCode,Short containerType, Long userId, boolean emptyAutoIn); |
| | | String emptyPlateIn(String station,String containerCode,Short containerType, Long userId, boolean emptyAutoIn, String factory ); |
| | | |
| | | void emptyPlateOut(String station, int containerType, Long userId); |
| | | |
| | |
| | | 入库 |
| | | */ |
| | | @Transactional |
| | | public String emptyPlateIn(String station, String containerCode, Short containerType, Long userId, boolean emptyAutoIn) { |
| | | public String emptyPlateIn(String station, String containerCode, Short containerType, Long userId, boolean emptyAutoIn,String factory) { |
| | | |
| | | Date now = new Date(); |
| | | |
| | |
| | | Config config = configService.selectOne(new EntityWrapper<Config>().eq("code", "elevatorTasks")); |
| | | if (Cools.isEmpty(config)) { |
| | | if (isCurrLev.get()) { |
| | | agvLocMast = agvCommonService.getLocNo(locType, agvBasDevp.getFloor(), false, true); |
| | | agvLocMast = agvCommonService.getLocNo(locType, agvBasDevp.getFloor(), false, true,factory); |
| | | } else { |
| | | agvLocMast = agvCommonService.getLocNo(locType, agvBasDevp.getFloor(), false, false); |
| | | agvLocMast = agvCommonService.getLocNo(locType, agvBasDevp.getFloor(), false, false,factory); |
| | | } |
| | | } else { |
| | | List<AgvWrkMast> agvWrkMasts = agvWrkMastService.selectList(new EntityWrapper<AgvWrkMast>().like("loc_no", "02F1").like("source_loc_no", "F1")); |
| | | if (Integer.parseInt(config.getValue()) <= agvWrkMasts.size()) { |
| | | agvLocMast = agvCommonService.getLocNo(locType, agvBasDevp.getFloor(), false, true); |
| | | agvLocMast = agvCommonService.getLocNo(locType, agvBasDevp.getFloor(), false, true,factory); |
| | | } else { |
| | | if (isCurrLev.get()) { |
| | | agvLocMast = agvCommonService.getLocNo(locType, agvBasDevp.getFloor(), false, true); |
| | | agvLocMast = agvCommonService.getLocNo(locType, agvBasDevp.getFloor(), false, true,factory); |
| | | } else { |
| | | agvLocMast = agvCommonService.getLocNo(locType, agvBasDevp.getFloor(), false, false); |
| | | agvLocMast = agvCommonService.getLocNo(locType, agvBasDevp.getFloor(), false, false,factory); |
| | | } |
| | | //agvLocMast = agvCommonService.getLocNo(locType,agvBasDevp.getFloor(),false,false); |
| | | } |
| | |
| | | private static final List<Integer> MOVE_TYPE_List = new ArrayList<Integer>() {{ |
| | | add(11); |
| | | add(12); |
| | | //add(53); |
| | | add(53); |
| | | add(101); |
| | | add(103); |
| | | add(108); |
New file |
| | |
| | | package com.zy.asrs.utils; |
| | | |
| | | import com.baomidou.mybatisplus.mapper.EntityWrapper; |
| | | import com.core.common.Cools; |
| | | import com.core.exception.CoolException; |
| | | import com.zy.asrs.constant.AsrsConstants; |
| | | import com.zy.asrs.entity.AgvLocMast; |
| | | import com.zy.asrs.service.AgvLocMastService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | |
| | | @Component |
| | | public class LocUtils { |
| | | |
| | | @Autowired |
| | | private AgvLocMastService agvLocMastService; |
| | | |
| | | /** |
| | | * 查询库位 |
| | | * @param type |
| | | * @param factory |
| | | * @return |
| | | */ |
| | | public AgvLocMast getLocNoRuleByFactory(int type, String factory) { |
| | | if (Cools.isEmpty(factory)) { |
| | | throw new CoolException("搜索库位时,订单类型错误"); |
| | | } |
| | | try { |
| | | EntityWrapper<AgvLocMast> wrapper = new EntityWrapper<>(); |
| | | wrapper.eq("loc_sts", "O").eq("loc_type1", type); |
| | | List<AgvLocMast> agvLocMasts = new ArrayList<>(); |
| | | if (factory.equalsIgnoreCase(AsrsConstants.ERCHANG)) { |
| | | wrapper.orderBy("lev1", false); |
| | | } else if (factory.equalsIgnoreCase(AsrsConstants.SANCHANG)) { |
| | | wrapper.orderBy("lev1", true); |
| | | } |
| | | agvLocMasts = agvLocMastService.selectList(wrapper); |
| | | |
| | | for (AgvLocMast agvLocMast : agvLocMasts) { |
| | | AgvLocMast agvLocMast1 = agvLocMastService.selectOne(new EntityWrapper<AgvLocMast>().eq("loc_no", agvLocMast.getLocNo())); |
| | | if (agvLocMast1.getLocSts().equals("O")) { |
| | | return agvLocMast1; |
| | | } |
| | | } |
| | | throw new CoolException("搜索库位时,未找到可入库库位。"); |
| | | } catch (Exception e) { |
| | | throw new CoolException("搜索库位时,未找到可入库库位。"); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 查询库位 |
| | | * @param type |
| | | * @param floor |
| | | * @return |
| | | */ |
| | | public AgvLocMast getLocNoRuleByFloor(int type, Integer floor, Integer lev1) { |
| | | try { |
| | | EntityWrapper<AgvLocMast> wrapper = new EntityWrapper<>(); |
| | | wrapper.eq("loc_sts", "O").eq("loc_type1", type).eq("floor", floor).eq("lev1", lev1); |
| | | List<AgvLocMast> agvLocMasts = agvLocMastService.selectList(wrapper); |
| | | for (AgvLocMast agvLocMast : agvLocMasts) { |
| | | AgvLocMast agvLocMast1 = agvLocMastService.selectOne(new EntityWrapper<AgvLocMast>().eq("loc_no", agvLocMast.getLocNo())); |
| | | if (agvLocMast1.getLocSts().equals("O")) { |
| | | return agvLocMast1; |
| | | } |
| | | } |
| | | throw new CoolException("搜索库位时,未找到可入库库位。"); |
| | | } catch (Exception e) { |
| | | throw new CoolException("搜索库位时,未找到可入库库位。"); |
| | | } |
| | | } |
| | | } |
New file |
| | |
| | | package com.zy.asrs.utils; |
| | | |
| | | import com.core.common.Cools; |
| | | import com.zy.asrs.constant.AsrsConstants; |
| | | |
| | | public class OrderUtils { |
| | | |
| | | /** |
| | | * 判断时哪个厂的订单 |
| | | * 订单编号里有B是二厂,G是三厂 |
| | | */ |
| | | public static String getFactory(String threeCode) { |
| | | if (Cools.isEmpty(threeCode)) { |
| | | return null; |
| | | } |
| | | if (threeCode.contains(AsrsConstants.ERCHANG)) { |
| | | return AsrsConstants.ERCHANG; |
| | | } else { |
| | | return AsrsConstants.SANCHANG; |
| | | } |
| | | } |
| | | } |
| | |
| | | import com.core.exception.CoolException; |
| | | import com.zy.asrs.entity.*; |
| | | import com.zy.asrs.service.*; |
| | | import com.zy.asrs.utils.LocUtils; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | |
| | | private LocRuleService locRuleService; |
| | | @Autowired |
| | | AgvBasDevpService agvBasDevpService; |
| | | |
| | | @Autowired |
| | | private LocUtils locUtils; |
| | | |
| | | public int getWorkNo(Integer wrkMk) { |
| | | AgvWrkLastno wrkLastno = agvWrkLastnoService.selectById(wrkMk); |
| | |
| | | * 检索库位号 |
| | | * @return locNo 检索到的库位号 |
| | | */ |
| | | public AgvLocMast getLocNo(int type, int floor,boolean isEmpty,boolean isCurrLev) { |
| | | public AgvLocMast getLocNo(int type, int floor, boolean isEmpty, boolean isCurrLev, String factory) { |
| | | // 目标库位 |
| | | AgvLocMast locMast = null; |
| | | // if(Cools.isEmpty(agvWaitPakinList)){ |
| | |
| | | |
| | | try{ |
| | | // 开始查找库位 ==============================>> |
| | | //如果是半成品箱壳 |
| | | if (type == 6) { |
| | | |
| | | // 四期项目:需要改查找库位逻辑 |
| | | // 箱壳入库 |
| | | if (type == 3) { |
| | | //优先入库吸塑1楼,在2楼 |
| | | locMast = locUtils.getLocNoRuleByFactory(type, factory); |
| | | } else if (type == 6) { |
| | | //半成品箱壳入库,入到吸塑2楼的370个库位里 |
| | | locMast = locUtils.getLocNoRuleByFloor(type, floor, 2); |
| | | }else { |
| | | //不动这个逻辑 |
| | | locMast = getLocNoRule(type,floor,isEmpty,isCurrLev); |
| | |
| | | throw new CoolException("搜索库位时,楼层出错。"); |
| | | } |
| | | |
| | | |
| | | //随机取一个货位 |
| | | private AgvLocMast getLocNoRule(int type,int floor,boolean isEmpty,boolean isCurrLev){ |
| | | Boolean orderBy = false; |
| | |
| | | throw new CoolException("搜索库位时,未找到可入库库位。"); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 检索库位号 |
| | | * @return locNo 检索到的库位号 |