| | |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import org.springframework.transaction.interceptor.TransactionAspectSupport; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.Set; |
| | | import java.util.*; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | |
| | | private SlaveProperties slaveProperties; |
| | | @Autowired |
| | | private WrkMastMapper wrkMastMapper; |
| | | @Autowired |
| | | private WrkMastService wrkMastService; |
| | | @Autowired |
| | | private WrkDetlService wrkDetlService; |
| | | @Autowired |
| | |
| | | } |
| | | } |
| | | // 获取入库通知档 |
| | | List<WaitPakin> waitPakins = waitPakinMapper.selectList(new EntityWrapper<WaitPakin>().eq("zpallet", barcode).eq("io_status", "N")); |
| | | if (waitPakins.isEmpty()) { |
| | | log.error("无此入库条码数据。条码号={}", barcode); |
| | | continue; |
| | | } |
| | | // List<WaitPakin> waitPakins = waitPakinMapper.selectList(new EntityWrapper<WaitPakin>().eq("zpallet", barcode).eq("io_status", "N")); |
| | | // if (waitPakins.isEmpty()) { |
| | | // log.error("无此入库条码数据。条码号={}", barcode); |
| | | // continue; |
| | | // } |
| | | |
| | | try { |
| | | LocTypeDto locTypeDto = new LocTypeDto(staProtocol); |
| | |
| | | continue; |
| | | } |
| | | |
| | | //判断堆垛机和当前任务是否处于一个巷道 |
| | | if (Utils.getLaneByLocNo(wrkMast.getLocNo()) != crnProtocol.getCrnLane()) { |
| | | //判断堆垛机所在巷道是否存在其他任务,如存在则优先执行 |
| | | List<WrkMast> wrkMasts = wrkMastService.selectLaneWrkMast(crnProtocol.getCrnLane(), true); |
| | | if (!wrkMasts.isEmpty()) { |
| | | continue;//当前堆垛机所在巷道存在任务 |
| | | } |
| | | } |
| | | |
| | | // 双深库位且浅库位有货,则需先对浅库位进行库位移转 |
| | | if (Utils.isDeepLoc(slaveProperties, wrkMast.getLocNo())) { |
| | | String shallowLocNo = Utils.getShallowLoc(slaveProperties, wrkMast.getLocNo()); |
| | |
| | | if (wrkMastMapper.selectWorking(slave.getId()) != null) { |
| | | break; |
| | | // return; |
| | | } |
| | | |
| | | //判断堆垛机和当前任务是否处于一个巷道 |
| | | if (Utils.getLaneByLocNo(wrkMast.getLocNo()) != crnProtocol.getCrnLane()) { |
| | | //判断堆垛机所在巷道是否存在其他任务,如存在则优先执行 |
| | | List<WrkMast> laneWrkMasts = wrkMastService.selectLaneWrkMast(crnProtocol.getCrnLane(), false); |
| | | if (!laneWrkMasts.isEmpty()) { |
| | | continue;//当前堆垛机所在巷道存在任务 |
| | | } |
| | | } |
| | | |
| | | // 1.堆垛机开始移动 |
| | |
| | | } |
| | | } |
| | | |
| | | } |
| | | } |
| | | |
| | | public synchronized void autoEmptyOut() { |
| | | DevpThread devpThread = (DevpThread) SlaveConnection.get(SlaveType.Devp, 1); |
| | | Integer autoOutSite = 12; |
| | | //如果站点可出禁用,则不生成空盘出库任务 |
| | | StaProtocol staProtocol = devpThread.getStation().get(autoOutSite); |
| | | if (staProtocol == null) { |
| | | return; |
| | | } else { |
| | | staProtocol = staProtocol.clone(); |
| | | } |
| | | if (staProtocol.isAutoing() //自动 |
| | | && !staProtocol.isLoading() //无物 |
| | | && staProtocol.isOutEnable() //可出信号 |
| | | && staProtocol.getWorkNo() == 0 |
| | | ) { |
| | | WrkMast pakoutEmpty = wrkMastMapper.selectPakoutEmpty(autoOutSite); |
| | | if (null != pakoutEmpty) { |
| | | return; |
| | | } |
| | | try { |
| | | String response = new HttpHandler.Builder() |
| | | .setUri(wmsUrl) |
| | | .setPath("/rpc/auto/emptyOut/v1") |
| | | .build() |
| | | .doPost(); |
| | | JSONObject jsonObject = JSON.parseObject(response); |
| | | if (jsonObject.getInteger("code").equals(200)) { |
| | | JSONObject data = (JSONObject) jsonObject.get("data"); |
| | | log.info((String) data.get("msg")); |
| | | } else { |
| | | log.error("请求接口失败!!!url:{};request:{};response:{}", wmsUrl + "/rpc/auto/emptyOut/v1","", response); |
| | | } |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | TransactionAspectSupport.currentTransactionStatus().setRollbackOnly(); |
| | | } |
| | | } |
| | | } |
| | | |