| | |
| | | @Value("${mes.pakoutReportPath}") |
| | | private String pakoutReportPath; |
| | | |
| | | @Value("${mes.stock}") |
| | | private String stock; |
| | | |
| | | |
| | | @Transactional |
| | | public ReturnT<String> start(ReportData data, Map<String, Object> mesTokenInfo) { |
| | |
| | | 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 result = doHttpRequest(data.getReportJson(), mesTokenInfo, data.getMemo(), url, mesPath, null, "127.0.0.1"); |
| | | reportDataService.deleteById(data.getId()); |
| | | BeanUtil.copyProperties(data, reportDataLog); |
| | | reportDataLog.setReportTime(new Date()); |
| | | reportDataLog.setReportDataId(data.getId()); |
| | | reportDataLog.setThreeCode(result); |
| | | reportDataLogService.insert(reportDataLog); |
| | | } |
| | | return SUCCESS; |
| | | } |
| | | |
| | | |
| | | private JSONObject doHttpRequest(String requestParam, Map<String, Object> headParam, String namespace, String url, String path, String appkey, String ip) { |
| | | String response = ""; |
| | | private String doHttpRequest(String requestParam, Map<String, Object> headParam, String namespace, String url, String path, String appkey, String ip) { |
| | | String response = "fail"; |
| | | boolean success = false; |
| | | |
| | | try { |
| | |
| | | throw new CoolException("mes接口调用失败,返回信息:" + jsonObject); |
| | | } |
| | | success = true; |
| | | return jsonObject; |
| | | return null; |
| | | |
| | | } catch (Exception e) { |
| | | log.error(e.getMessage()); |
| | | throw new CoolException(e.getMessage()); |
| | | log.error("mes接口调用失败,返回信息:{}", e.getMessage()); |
| | | //throw new CoolException(e.getMessage()); |
| | | } finally { |
| | | apiLogService.save(namespace, url + path, appkey, ip, requestParam, response, success); |
| | | } |
| | | return response; |
| | | } |
| | | |
| | | |
| | | @Transactional |
| | | public ReturnT<String> stock(Map<String, Object> mesTokenInfo) { |
| | | String result = doHttpRequest("{}", mesTokenInfo, "同步MES库存", url, stock, null, "127.0.0.1"); |
| | | |
| | | return SUCCESS; |
| | | } |
| | | } |