自动化立体仓库 - WMS系统
pang.jiabao
2025-03-31 a3a66aa959151e91f57be097b83f2a2715b502f5
src/main/java/com/zy/asrs/service/impl/MobileServiceImpl.java
@@ -1436,7 +1436,7 @@
    @Override
    public R pdaFxprk(GwmsGenerateInventoryDto param, Long userId) {
        if (Cools.isEmpty(param)) {
        if (Cools.isEmpty(param,param.getMatList())) {
            throw new CoolException("请求参数不能为空:" + param);
        }
        if (Cools.isEmpty(param.getBarcode())) {
@@ -1468,6 +1468,7 @@
        // 生成工作档
        WrkMast wrkMast = new WrkMast();
        wrkMast.setWrkNo(workNo);
        wrkMast.setWhsType(1); // 返修入库标识
        wrkMast.setIoTime(new Date());
        wrkMast.setWrkSts(1L); // 工作状态:设备上走
        wrkMast.setIoType(iotype); // 入出库状态:1.入库
@@ -1547,10 +1548,67 @@
            throw new CoolException(dto.getLocNo() + "目标库位已被占用");
        }
        // 一楼返修入库推送mes做记录
        pushFxrkToMes(param);
        // 返回GWCS目标信息
        openServiceImpl.pushStaNoToGwcs(param.getPalletizingNo(), dto.getStaNo(), dto.getWorkNo(), param.getBarcode(), "二楼返修入库推送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
@@ -1760,6 +1818,27 @@
       return R.ok("调整成功");
    }
    @Override
    public R pdaFhhd(PdaDhhdParam param, Long userId) {
        String orderNo = param.getOrderNo();
        Order order = orderService.selectByNo(orderNo);
        if (order == null) {
            return R.parse("单据编号不存在:" + orderNo);
        } else if (!order.getSettle().equals(4L)) {
            return R.parse("单据状态不为4.已完成");
        }
        order.setSettle(5L);
        order.setUpdateBy(userId);
        order.setUpdateTime(new Date());
        orderService.updateById(order);
        return R.ok("发货核对成功");
    }
    // 同步盘点异常调整结果给mes
    void kctzPushMes(JSONObject jsonObject) {
        // 接口请求结果
@@ -1914,7 +1993,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 +2003,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,