自动化立体仓库 - WMS系统
#
zhou zhou
10 小时以前 dda2e4a84cbf54262fd465718b769eb50676977a
src/main/java/com/zy/asrs/service/impl/MobileServiceImpl.java
@@ -179,6 +179,55 @@
    }
    @Override
    public List<ManLocDetl> pingKuGetList(PKInventoryAdjustment combParam) {
        Node node = nodeService.selectOne(new EntityWrapper<Node>().eq("name", combParam.getLocno()).eq("type", 3));
        if (Cools.isEmpty(node)){
            throw new CoolException("未找到平库库位信息");
        }
        EntityWrapper<ManLocDetl> manLocDetlEntityWrapper = new EntityWrapper<>();
        manLocDetlEntityWrapper.eq("loc_no", node.getName());
        manLocDetlEntityWrapper.eq(!Cools.isEmpty(combParam.getMatnr()),"matnr", combParam.getMatnr());
        List<ManLocDetl> manLocDetls = manLocDetlService.selectList(manLocDetlEntityWrapper);
        if (Cools.isEmpty(manLocDetls)){
            throw new CoolException("未找到库存信息");
        }
        return manLocDetls;
    }
    @Override
    @Transactional(rollbackFor = Exception.class)
    public void pingKuInventoryAdjustment(PKInventoryAdjustment combParam) {
        Node node = nodeService.selectOne(new EntityWrapper<Node>().eq("name", combParam.getLocno()).eq("type", 3));
        if (Cools.isEmpty(node)){
            throw new CoolException("未找到平库库位信息");
        }
        for (ManLocDetl manLocDetl :combParam.getManLocDetls()){
            EntityWrapper<ManLocDetl> manLocDetlEntityWrapper = new EntityWrapper<>();
            manLocDetlEntityWrapper.eq("loc_no", manLocDetl.getLocNo());
            manLocDetlEntityWrapper.eq("matnr", manLocDetl.getMatnr());
            manLocDetlEntityWrapper.eq("batch", manLocDetl.getBatch());
            List<ManLocDetl> manLocDetls = manLocDetlService.selectList(manLocDetlEntityWrapper);
            if (Cools.isEmpty(manLocDetls) || manLocDetls.size() > 1){
                throw new CoolException("数据错误");
            }
            ManLocDetl manLocDetl1 = manLocDetls.get(0);
            BigDecimal adjustBigDecimal = new BigDecimal(manLocDetl.getAnfme().toString());
            BigDecimal orgBigDecimal = new BigDecimal(manLocDetl1.getAnfme().toString());
            if (orgBigDecimal.compareTo(adjustBigDecimal) == 0){
                continue;
            }
            manLocDetl1.setAnfme(adjustBigDecimal.doubleValue());
            if (!manLocDetlService.update(manLocDetl1,manLocDetlEntityWrapper)){
                throw new CoolException("更新数据失败");
            }
        }
    }
    @Override
    public R inLocCallAgv(String sta, String inSta) {
        BasDevp basDevp = basDevpMapper.selectById(inSta);
@@ -273,6 +322,57 @@
        }
        return success ? R.ok("呼叫agv成功") : R.parse(message);
    }
    @Override
    public R unbind2(String site) {
        String staMap = AgvSiteConstant.SiteMap.get(site);
        if (staMap == null) {
            return R.parse("没有找到该站点的入库映射:" + site);
        }
        JSONObject jsonObject = new JSONObject();
        jsonObject.put("reqCode",UUID.randomUUID().toString().replace("-", "")); // 请求唯一值
        jsonObject.put("ctnrTyp","3"); // 容器类型2
        jsonObject.put("stgBinCode",staMap); // 仓位编号,根据客仓编号转换
        jsonObject.put("indBind","0"); // 1绑定,0解绑
        String body = jsonObject.toJSONString();
        String response = "";
        String message = "";
        boolean success = false;
        try {
            response = new HttpHandler.Builder()
                    .setUri(ApiInterfaceConstant.AGV_IP)
                    .setPath(ApiInterfaceConstant.AGV_BIND_PATH)
                    .setJson(body)
                    .build()
                    .doPost();
            JSONObject res = JSON.parseObject(response);
            message = res.getString("message");
            if (res.getInteger("code").equals(0)) {
                success = true;
            } else {
                log.error("调用agv解绑暂存位失败!!!url:{};request:{};response:{}", ApiInterfaceConstant.AGV_IP + ApiInterfaceConstant.AGV_BIND_PATH, body, response);
            }
        } catch (Exception e) {
            log.error("调用agv解绑暂存位异常", e);
        } finally {
            try {
                // 保存接口日志
                apiLogService.save(
                        "调用agv解绑暂存位",
                        ApiInterfaceConstant.AGV_IP + ApiInterfaceConstant.AGV_BIND_PATH,
                        null,
                        "127.0.0.1",
                        body,
                        response,
                        success
                );
            } catch (Exception e) {
                log.error("", e);
            }
        }
        return success ? R.ok("解绑成功") : R.parse(message);
    }
    @Override
@@ -429,8 +529,8 @@
        }
        return success;
    }
    private boolean bindPodAndBerth(String sta) {
    @Override
    public boolean bindPodAndBerth(String sta) {
        String staMap = AgvSiteConstant.SiteMap.get(sta);
        if (staMap == null) {
            log.error("没有找到该站点的入库映射:{}",sta);
@@ -438,7 +538,7 @@
        }
        JSONObject jsonObject = new JSONObject();
        jsonObject.put("reqCode",UUID.randomUUID().toString().replace("-", "")); // 请求唯一值
        jsonObject.put("ctnrTyp","2"); // 容器类型2
        jsonObject.put("ctnrTyp","3"); // 容器类型2
        jsonObject.put("stgBinCode",staMap); // 仓位编号,根据客仓编号转换
        jsonObject.put("indBind","1"); // 1绑定,0解绑