| | |
| | | public class BarcodeUploadHandler extends AbstractHandler<String> { |
| | | |
| | | @Autowired |
| | | private WrkMastService wrkMastService; |
| | | private WaitPakinService waitPakinService; |
| | | @Autowired |
| | | private LocMastService locMastService; |
| | | @Autowired |
| | |
| | | public ReturnT<String> start(int staNo) { |
| | | try { |
| | | BasDevp basDevp = basDevpService.selectById(staNo); |
| | | if (!Cools.isEmpty(basDevp) && basDevp.getWrkNo()!=0){ |
| | | WrkMast wrkMast = wrkMastService.selectById(basDevp.getWrkNo()); |
| | | if (!Cools.isEmpty(wrkMast) && wrkMast.getIoType().equals(201) && wrkMast.getWrkSts().equals(41L)){ |
| | | if (Cools.isEmpty(basDevp) || Cools.isEmpty(basDevp.getBarcode()) || basDevp.getReportSign()!=1 |
| | | || basDevp.getBarcode().equals("")){ |
| | | return FAIL; |
| | | } |
| | | if (basDevp.getWrkNo()>9899 && basDevp.getWrkNo()<10000 && basDevp.getAutoing().equals("Y") |
| | | && basDevp.getLoading().equals("Y") && basDevp.getInEnable().equals("Y")){ //上传前工作号跟电控约定为9992(你可以自定义) |
| | | int zpalletCount = waitPakinService.selectCount(new EntityWrapper<WaitPakin>().eq("zpallet", basDevp.getBarcode())); |
| | | if (zpalletCount==0){ |
| | | ReturnT<String> result = null; |
| | | result = postMesData(barcodeUploadpath,wrkMast); |
| | | result = postMesData(barcodeUploadpath,basDevp); |
| | | System.out.println(result); |
| | | if (result.getCode()==200){ |
| | | wrkMast.setWrkSts(42L); |
| | | // 修改订单状态 41. ===>> 42.已上报 |
| | | if (!wrkMastService.updateById(wrkMast)) { |
| | | throw new CoolException("服务器内部错误,请联系管理员:更新工作号"+wrkMast.getWrkNo()+"工作档状态41==》42失败"); |
| | | }else { |
| | | return SUCCESS; |
| | | } |
| | | basDevp.setReportSign(2); |
| | | basDevpService.updateById(basDevp); |
| | | return SUCCESS; |
| | | }else { |
| | | log.error("条码上传中控失败"); |
| | | } |
| | | } |
| | | } |
| | |
| | | success = true; |
| | | } else { |
| | | log.error("请求接口失败!!!url:{};request:{};response:{}"+erpUrl+erpPath, JSON.toJSONString(combParam), response); |
| | | throw new CoolException("上报erp系统失败"); |
| | | throw new CoolException("条码上传中控失败"); |
| | | } |
| | | } catch (Exception e) { |
| | | log.error("fail", e); |
| | |
| | | try { |
| | | // 保存接口日志 |
| | | apiLogService.save( |
| | | "上报erp系统", |
| | | "条码上传中控", |
| | | erpUrl + erpPath, |
| | | null, |
| | | "127.0.0.1", |
| | | erpUrl, |
| | | JSON.toJSONString(combParam), |
| | | response, |
| | | success |