| | |
| | | |
| | | |
| | | @Scheduled(fixedDelay = 5000) |
| | | @Async("reportThreadPool") |
| | | public void execute() { |
| | | log.info("定时任务开始执行"); |
| | | if (!flag) { |
| | | return; |
| | | } |
| | | Page<ReportData> objectPage = new Page<>(1, 1000); |
| | | Page<ReportData> objectPage = new Page<>(1, 100); |
| | | Page<ReportData> reportData = reportDataService.selectPage(objectPage, new EntityWrapper<ReportData>().orderBy("create_time", false)); |
| | | if (reportData != null && !Cools.isEmpty(reportData.getRecords())) { |
| | | Map<String, Object> mesTokenInfo = getMesTokenInfo(); |
| | |
| | | //移库类型数组 |
| | | private static final List<Integer> MOVE_TYPE_List = new ArrayList<Integer>() {{ |
| | | add(11); |
| | | add(101); |
| | | add(12); |
| | | add(53); |
| | | //add(53); |
| | | add(101); |
| | | add(103); |
| | | add(108); |
| | | add(111); |
| | |
| | | } |
| | | |
| | | |
| | | Integer pltType = agvWrkMast.getPltType(); |
| | | if (Cools.isEmpty(pltType) && !Cools.isEmpty(agvWrkMast.getLocNo())) { |
| | | AgvLocMast agvLocMast = agvLocMastService.selectById(agvWrkMast.getLocNo()); |
| | | if (agvLocMast != null) { |
| | | pltType = agvLocMast.getPltType(); |
| | | } else { |
| | | if (!Cools.isEmpty(agvWrkMast.getSourceLocNo())) { |
| | | agvLocMast = agvLocMastService.selectById(agvWrkMast.getLocNo()); |
| | | if (agvLocMast != null) { |
| | | pltType = agvLocMast.getPltType(); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | if (Cools.isEmpty(agvWrkMast.getPltType())) { |
| | | agvWrkMast.setPltType(pltType); |
| | | } |
| | | agvWrkMast.setModiTime(new Date()); |
| | | //修改工作档状态为207.库存更新完成 |
| | | agvWrkMast.setWrkSts(207L); |
| | |
| | | // } |
| | | // agvWrkMastService.updateById(agvWrkMast); |
| | | // } |
| | | Integer pltType = agvWrkMast.getPltType(); |
| | | if (Cools.isEmpty(pltType) && !Cools.isEmpty(agvWrkMast.getLocNo())) { |
| | | AgvLocMast agvLocMast = agvLocMastService.selectById(agvWrkMast.getLocNo()); |
| | | if (agvLocMast != null) { |
| | | pltType = agvLocMast.getPltType(); |
| | | } |
| | | } |
| | | |
| | | if (!isJSON(orderNo)) { |
| | | //检查订单是否已完成 |
| | | orderService.checkComplete(orderNo, pltType); |
| | |
| | | } |
| | | |
| | | } |
| | | |
| | | |
| | | |
| | | private void reportMesPakinOrder(AgvWrkMast agvWrkMast, List<AgvWrkDetl> agvWrkDetls) { |
| | |
| | | mesPath = orderReportPath; |
| | | break; |
| | | } |
| | | doHttpRequest(data.getReportJson(), mesTokenInfo, data.getMemo(), url, mesPath, null, "127.0.0.1"); |
| | | reportDataService.deleteById(data.getId()); |
| | | ReportDataLog reportDataLog = new ReportDataLog(); |
| | | String fail = null; |
| | | if (!doHttpRequest(data.getReportJson(), mesTokenInfo, data.getMemo(), url, mesPath, null, "127.0.0.1")) { |
| | | fail = "fail"; |
| | | } |
| | | reportDataService.deleteById(data.getId()); |
| | | BeanUtil.copyProperties(data, reportDataLog); |
| | | reportDataLog.setReportTime(new Date()); |
| | | reportDataLog.setReportDataId(data.getId()); |
| | | reportDataLog.setThreeCode(fail); |
| | | reportDataLogService.insert(reportDataLog); |
| | | } |
| | | return SUCCESS; |
| | | } |
| | | |
| | | |
| | | private JSONObject doHttpRequest(String requestParam, Map<String, Object> headParam, String namespace, String url, String path, String appkey, String ip) { |
| | | private Boolean doHttpRequest(String requestParam, Map<String, Object> headParam, String namespace, String url, String path, String appkey, String ip) { |
| | | String response = ""; |
| | | boolean success = false; |
| | | |
| | |
| | | throw new CoolException("mes接口调用失败,返回信息:" + jsonObject); |
| | | } |
| | | success = true; |
| | | return jsonObject; |
| | | return true; |
| | | |
| | | } catch (Exception e) { |
| | | log.error(e.getMessage()); |
| | | throw new CoolException(e.getMessage()); |
| | | //throw new CoolException(e.getMessage()); |
| | | } finally { |
| | | apiLogService.save(namespace, url + path, appkey, ip, requestParam, response, success); |
| | | } |
| | | |
| | | return false; |
| | | } |
| | | } |