自动化立体仓库 - WMS系统
pang.jiabao
2024-11-10 8b0130d7ff3d4723e32a3ac86ffee7b7f445851c
src/main/java/com/zy/asrs/service/impl/MobileServiceImpl.java
@@ -1547,10 +1547,67 @@
            throw new CoolException(dto.getLocNo() + "目标库位已被占用");
        }
        // 一楼返修入库推送mes做记录
        pushFxrkToMes(param);
        // 返回GWCS目标信息
        openServiceImpl.pushStaNoToGwcs(param.getPalletizingNo(), dto.getStaNo(), dto.getWorkNo(), param.getBarcode(), "二楼返修入库推送gwcs");
        return R.ok("反修入库成功");
    }
    private void pushFxrkToMes(GwmsGenerateInventoryDto param) {
        for (GwmsGenerateInventoryDto.MatList matList : param.getMatList()){
            matList.setOutOrIn("in");
            matList.setStockType("返修入库");
        }
        boolean success = false;
        // 获取请求头
        Map<String,Object> headers = new HashMap<>();
        headers.put("Content-Type","application/json;charset=UTF-8");
        // 构造请求体
        String body = JSON.toJSONString(param);
        String response = "";
        try {
            response = new HttpHandler.Builder()
                    .setUri(MesConstant.MES_CC_IP_PORT)
                    .setPath(MesConstant.MES_CC_FXRK_URL)
                    .setHeaders(headers)
                    .setJson(body)
                    .build()
                    .doGet();
            if (!Cools.isEmpty(response)) {
                JSONObject jsonObject1 = JSONObject.parseObject(response);
                int code = (int) jsonObject1.get("code");
                boolean state  = jsonObject1.getBoolean("state");
                if (code == 200 && state) {
                    success = true;
                }
            } else {
                log.error("返修入库推送mes记录失败!!!url:{};request:{};response:{}", MesConstant.MES_CC_IP_PORT + MesConstant.MES_CC_FXRK_URL, body, response);
            }
        } catch (Exception e) {
            log.error("返修入库推送mes记录异常:{}", e.getMessage());
        } finally {
            try {
                // 保存接口日志
                apiLogService.save(
                        "返修入库推送mes记录",
                        MesConstant.MES_CC_IP_PORT + MesConstant.MES_CC_FXRK_URL,
                        null,
                        "127.0.0.1",
                        body,
                        response,
                        success
                );
            } catch (Exception e) {
                log.error("", e);
            }
        }
    }
    @Override
@@ -1914,7 +1971,7 @@
                }
                throw new CoolException(msg);
            } else {
                log.error("返修品入库给mes推送待判失败!!!url:{};request:{};response:{}", MesConstant.MES_CC_IP_PORT + MesConstant.MES_CC_IP_PORT, body, response);
                log.error("返修品入库给mes推送待判失败!!!url:{};request:{};response:{}", MesConstant.MES_CC_IP_PORT + MesConstant.MES_CC_DP_URL, body, response);
                throw new CoolException("返修品入库给mes推送待判失败");
            }
        } catch (Exception e) {
@@ -1924,7 +1981,7 @@
                // 保存接口日志
                apiLogService.save(
                        "返修品入库给mes推送待判",
                        MesConstant.MES_CC_IP_PORT + MesConstant.MES_CC_IP_PORT,
                        MesConstant.MES_CC_IP_PORT + MesConstant.MES_CC_DP_URL,
                        null,
                        "127.0.0.1",
                        body,