| | |
| | | @RequestMapping(value = "/synchronize/mes/locDetl/report/auth") |
| | | @ManagerAuth(memo = "同步库存至MES") |
| | | public R synchronizeLocDetlMes() { |
| | | List<LocDetl> locDetlList = locDetlService.selectList(new EntityWrapper<LocDetl>()); |
| | | if (locDetlList.isEmpty()) { |
| | | return R.error("库存为空!!!"); |
| | | } |
| | | try{ |
| | | List<LocDetl> locDetlList = locDetlService.selectList(new EntityWrapper<LocDetl>()); |
| | | if (locDetlList.isEmpty()) { |
| | | return R.error("库存为空!!!"); |
| | | } |
| | | |
| | | OrderMesXGHYParam orderMesXGHYParam = new OrderMesXGHYParam(locDetlList,"in","成品入库"); |
| | | orderMesXGHYParam.setBarcode(String.valueOf(snowflakeIdWorker.nextId())); |
| | | orderMesXGHYParam.setPalletizingNo(1); |
| | | OrderMesXGHYParam orderMesXGHYParam = new OrderMesXGHYParam(locDetlList,"in","成品入库"); |
| | | orderMesXGHYParam.setBarcode(String.valueOf(snowflakeIdWorker.nextId())); |
| | | orderMesXGHYParam.setPalletizingNo(1); |
| | | |
| | | |
| | | String response = ""; |
| | | boolean success = false; |
| | | try { |
| | | response = new HttpHandler.Builder() |
| | | .setUri(productInventoryUrl) |
| | | .setPath(productInventory) |
| | | .setJson(JSON.toJSONString(orderMesXGHYParam)) |
| | | .build() |
| | | .doPost(); |
| | | JSONObject jsonObject = JSON.parseObject(response); |
| | | if (jsonObject.getBoolean("state")) { |
| | | success = true; |
| | | } else { |
| | | return R.error("同步库存至MES"); |
| | | String response = ""; |
| | | boolean success = false; |
| | | try { |
| | | response = new HttpHandler.Builder() |
| | | .setUri(productInventoryUrl) |
| | | .setPath(productInventory) |
| | | .setJson(JSON.toJSONString(orderMesXGHYParam)) |
| | | .build() |
| | | .doPost(); |
| | | JSONObject jsonObject = JSON.parseObject(response); |
| | | if (jsonObject.getBoolean("state")) { |
| | | success = true; |
| | | } else { |
| | | return R.error("同步库存至MES"); |
| | | } |
| | | } catch (Exception e) { |
| | | return R.error("同步库存至MES"+e.getMessage()); |
| | | } finally { |
| | | try { |
| | | // 保存接口日志 |
| | | apiLogService.save( |
| | | "同步库存至MES", |
| | | productInventoryUrl+"/"+productInventory, |
| | | null, |
| | | "127.0.0.1", |
| | | JSON.toJSONString(orderMesXGHYParam), |
| | | response, |
| | | success |
| | | ); |
| | | } catch (Exception e) { } |
| | | } |
| | | } catch (Exception e) { |
| | | return R.error("同步库存至MES"+e.getMessage()); |
| | | } finally { |
| | | try { |
| | | // 保存接口日志 |
| | | apiLogService.save( |
| | | "同步库存至MES", |
| | | productInventoryUrl+"/"+productInventory, |
| | | null, |
| | | "127.0.0.1", |
| | | JSON.toJSONString(orderMesXGHYParam), |
| | | response, |
| | | success |
| | | ); |
| | | } catch (Exception e) { } |
| | | return R.error("上报失败"+e.getMessage()).add("上报失败"+e.getMessage()); |
| | | } |
| | | return R.error("上报失败").add("上报失败"); |
| | | } |