| | |
| | | |
| | | public synchronized void autoEmptyOut() { |
| | | DevpThread devpThread = (DevpThread) SlaveConnection.get(SlaveType.Devp, 1); |
| | | Integer autoOutSite = 12; |
| | | Integer autoOutSite = 103; |
| | | //如果站点可出禁用,则不生成空盘出库任务 |
| | | StaProtocol staProtocol = devpThread.getStation().get(autoOutSite); |
| | | if (staProtocol == null) { |
| | |
| | | } |
| | | if (staProtocol.isAutoing() //自动 |
| | | && !staProtocol.isLoading() //无物 |
| | | && staProtocol.isOutEnable() //可出信号 |
| | | // && staProtocol.isOutEnable() //可出信号 |
| | | && staProtocol.getWorkNo() == 0) { |
| | | WrkMast pakoutEmpty = wrkMastMapper.selectPakoutEmpty(autoOutSite); |
| | | if (null != pakoutEmpty) { |
| | | return; |
| | | // WrkMast pakoutEmpty = wrkMastMapper.selectPakoutEmpty(autoOutSite); |
| | | // if (null != pakoutEmpty) { |
| | | // return; |
| | | // } |
| | | |
| | | LocMast byId = locMastService.getById("0200405"); |
| | | if (byId != null&&byId.getLocSts().equalsIgnoreCase("D")){ |
| | | |
| | | } |
| | | 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"); |
| | | News.info((String) data.get("msg")); |
| | | } else { |
| | | News.error("请求接口失败!!!url:{};request:{};response:{}", wmsUrl + "/rpc/auto/emptyOut/v1", "", response); |
| | | } |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | TransactionAspectSupport.currentTransactionStatus().setRollbackOnly(); |
| | | } |
| | | |
| | | } |
| | | } |
| | | |
| | | @Autowired |
| | | private WrkMastService wrkMastService; |
| | | |
| | | public synchronized void autoEmptyIn() { |
| | | DevpThread devpThread = (DevpThread) SlaveConnection.get(SlaveType.Devp, 1); |
| | | Integer autoInSite = 12; |
| | | StaProtocol staProtocol = devpThread.getStation().get(autoInSite); |
| | | StaProtocol staProtocol = devpThread.getStation().get(103); |
| | | if (staProtocol == null) { |
| | | return; |
| | | } else { |
| | |
| | | } |
| | | if (staProtocol.isAutoing() //自动 |
| | | && staProtocol.isLoading() //有物 |
| | | && staProtocol.isInEnable() //可入信号 |
| | | // && staProtocol.isInEnable() //可入信号 |
| | | && (staProtocol.getWorkNo() == 0 || staProtocol.getWorkNo() >= 9990) //工作号为0或者工作号是9991~9999(输送机留用) |
| | | ) { |
| | | |
| | | try { |
| | | LocTypeDto locTypeDto = new LocTypeDto((short) 1, (short) 1, (short) 1); |
| | | Date now = new Date(); |
| | | // 生成工作档 |
| | | WrkMast wrkMast = new WrkMast(); |
| | | int workNo = commonService.getWorkNo(0); |
| | | wrkMast.setWrkNo(workNo); |
| | | wrkMast.setIoTime(now); |
| | | wrkMast.setWrkSts(2L); |
| | | wrkMast.setIoPri(13D); |
| | | wrkMast.setIoType(10); |
| | | wrkMast.setCrnNo(1); |
| | | wrkMast.setSourceStaNo(101); |
| | | wrkMast.setStaNo(103); |
| | | wrkMast.setLocNo("0200405"); |
| | | wrkMast.setFullPlt("N"); // 满板:N |
| | | wrkMast.setPicking("N"); // 拣料 |
| | | wrkMast.setExitMk("N"); // 退出 |
| | | wrkMast.setEmptyMk("Y"); // 空板 |
| | | wrkMast.setLinkMis("Y"); |
| | | // 操作人员数据 |
| | | wrkMast.setAppeTime(now); |
| | | wrkMast.setModiTime(now); |
| | | wrkMast.setMemo("自动空托入库"); |
| | | boolean res = wrkMastService.save(wrkMast); |
| | | |
| | | |
| | | String response = new HttpHandler.Builder().setUri(wmsUrl).setPath("/rpc/auto/emptyIn/v1").setJson(JSON.toJSONString(locTypeDto)).build().doPost(); |
| | | JSONObject jsonObject = JSON.parseObject(response); |
| | | if (jsonObject.getInteger("code").equals(200)) { |
| | | News.info((String) jsonObject.get("msg")); |
| | | } else { |
| | | News.error("请求接口失败!!!url:{};request:{};response:{}", wmsUrl + "/rpc/auto/emptyIn/v1", JSON.toJSONString(locTypeDto), response); |
| | | // 更新目标库位状态 |
| | | LocMast locMast = locMastService.getById("0200405"); |
| | | if (locMast.getLocSts().equals("O")) { |
| | | locMast.setLocSts("S"); // S.入库预约 |
| | | locMast.setModiUser(789L); |
| | | locMast.setModiTime(now); |
| | | if (!locMastService.updateById(locMast)) { |
| | | throw new CoolException("改变库位状态失败"); |
| | | } |
| | | } |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |