自动化立体仓库 - WMS系统
pang.jiabao
2024-08-27 2d0226ea3dd2116cfcc9ec307f17edf191458aad
src/main/java/com/zy/asrs/service/impl/MobileServiceImpl.java
@@ -1423,7 +1423,8 @@
    public R pdaFxprk(FxprkParam param, Long userId) {
        // 根据包装组号获取到木箱卷信息
        List<Mat> list = matService.selectList(new EntityWrapper<Mat>().in("brand", param.getBoxList().stream().map(FxprkParam.Box::getPackageGroupNo).collect(Collectors.toList())));
        List<String> groupNos = param.getBoxList().stream().map(FxprkParam.Box::getPackageGroupNo).collect(Collectors.toList());
        List<Mat> list = matService.selectList(new EntityWrapper<Mat>().in("brand", groupNos));
        if (list.isEmpty()) {
            throw new CoolException("没有查询到该包装组号信息:" + param.getBoxList().toString());
        }
@@ -1493,6 +1494,9 @@
            }
        }
        // 一楼反修品入库的木箱通过包装组号需给mes推送待判
        pushDpToMes(groupNos);
        // 更新目标库位状态
        LocMast locMast = locMastService.selectById(dto.getLocNo());
        if (locMast.getLocSts().equals("O")) {
@@ -1506,6 +1510,64 @@
        }
        return R.ok("入库成功");
    }
    /**
     * 一楼反修品入库的木箱通过包装组号需给mes推送待判
     */
    private void pushDpToMes(List<String> groupNos) {
        boolean success = false;
        // 获取请求头
        Map<String,Object> headers = new HashMap<>();
        headers.put("digi-type","sync ");
        headers.put("digi-protocol","raw");
        headers.put("digi-datakey"," XCommon.ImportData");
        // 构造请求体
        JSONObject jsonObject = new JSONObject();
        jsonObject.put("groupNos", groupNos);
        String body = jsonObject.toJSONString();
        String response = "";
        try {
            response = new HttpHandler.Builder()
                    .setUri(MesConstant.MES_IP_PORT)
                    .setPath(MesConstant.MES_DP_URL)
                    .setHeaders(headers)
                    .setJson(body)
                    .build()
                    .doPost();
            if (!Cools.isEmpty(response)) {
                JSONObject jsonObject1 = JSONObject.parseObject(response);
                int code = (int) jsonObject1.get("code");
                String msg = (String) jsonObject1.get("msg");
                if (code != 200) {
                    throw new CoolException(msg);
                }
                success = true;
            } else {
                log.error("返修品入库给mes推送待判失败!!!url:{};request:{};response:{}", MesConstant.URL + MesConstant.PAKIN_URL, body, response);
                throw new CoolException("返修品入库给mes推送待判失败");
            }
        } catch (Exception e) {
            log.error("返修品入库给mes推送待判异常:{}", e.getMessage());
        } finally {
            try {
                // 保存接口日志
                apiLogService.save(
                        "返修品入库给mes推送待判",
                        MesConstant.MES_IP_PORT + MesConstant.MES_DP_URL,
                        null,
                        "127.0.0.1",
                        body,
                        response,
                        success
                );
            } catch (Exception e) {
                log.error("", e);
            }
        }
    }
    public boolean pushStaNoToGwcs(Integer palletizingNo, Integer staNo, Integer workNo,String barcode) {
        boolean success = false;
        // 获取请求头