| | |
| | | import com.zy.asrs.service.impl.MobileServiceImpl; |
| | | import com.zy.asrs.task.AbstractHandler; |
| | | import com.zy.asrs.task.core.ReturnT; |
| | | import com.zy.asrs.utils.PostMesDataUtils; |
| | | import com.zy.common.constant.MesConstant; |
| | | import com.zy.common.utils.HttpHandler; |
| | | import lombok.extern.slf4j.Slf4j; |
| | |
| | | combParam.setLocNo(wrkMast.getLocNo()); |
| | | combParam.setPackSts(1); |
| | | combParam.setRequestTime(DateUtils.convert(new Date())); |
| | | result = postMesData(inpath,combParam); |
| | | // result = new PostMesDataUtils().postMesData(inpath,combParam); |
| | | // 保存入库通知档历史档 |
| | | WaitPakin pakin = waitPakinService.selectOne(new EntityWrapper<WaitPakin>().eq("zpallet", wrkMast.getBarcode())); |
| | | if (pakin!=null){ |
| | |
| | | combParam.setLocNo(wrkMast.getSourceLocNo()); |
| | | // combParam.setPackSts(0); |
| | | combParam.setRequestTime(DateUtils.convert(new Date())); |
| | | result = postMesData(outPath,combParam); |
| | | // result = new PostMesDataUtils().postMesData(outPath,combParam); |
| | | } |
| | | } |
| | | if(null != result && !result.isSuccess()){ |
| | |
| | | } |
| | | return SUCCESS; |
| | | } |
| | | |
| | | /*...........................赣州新增..............以下.............赣州新增...........................*/ |
| | | |
| | | private ReturnT<String> postMesData(String mesPath,Object combParam){ |
| | | if(combParam != null){ |
| | | String response = ""; |
| | | boolean success = false; |
| | | try { |
| | | response = new HttpHandler.Builder() |
| | | .setUri(mesUrl) |
| | | .setPath(mesPath) |
| | | .setJson(JSON.toJSONString(combParam)) |
| | | .build() |
| | | .doPost(); |
| | | JSONObject jsonObject = JSON.parseObject(response); |
| | | if (jsonObject.getInteger("code").equals(200)) { |
| | | success = true; |
| | | } else { |
| | | log.error("请求接口失败!!!url:{};request:{};response:{}", mesUrl+mesPath, JSON.toJSONString(combParam), response); |
| | | throw new CoolException("上报mes系统失败"); |
| | | } |
| | | } catch (Exception e) { |
| | | log.error("fail", e); |
| | | // TransactionAspectSupport.currentTransactionStatus().setRollbackOnly(); |
| | | return FAIL.setMsg(e.getMessage()); |
| | | } finally { |
| | | try { |
| | | // 保存接口日志 |
| | | apiLogService.save( |
| | | "上报mes系统", |
| | | mesUrl + mesPath, |
| | | null, |
| | | "127.0.0.1", |
| | | JSON.toJSONString(combParam), |
| | | response, |
| | | success |
| | | ); |
| | | } catch (Exception e) { log.error("", e); } |
| | | } |
| | | } |
| | | return SUCCESS; |
| | | } |
| | | /*...........................赣州新增..............以上.............赣州新增...........................*/ |
| | | } |