From 56de968727bd6e871c6823dce837f8d42f30e6f8 Mon Sep 17 00:00:00 2001 From: zc <zc@123> Date: 星期二, 10 六月 2025 09:28:21 +0800 Subject: [PATCH] # --- src/main/java/com/zy/asrs/service/impl/OpenServiceImpl.java | 110 ++++++++++++++++++++++++++++++++++++++++++++++++++++-- 1 files changed, 105 insertions(+), 5 deletions(-) diff --git a/src/main/java/com/zy/asrs/service/impl/OpenServiceImpl.java b/src/main/java/com/zy/asrs/service/impl/OpenServiceImpl.java index 22ac4dc..9b7804d 100644 --- a/src/main/java/com/zy/asrs/service/impl/OpenServiceImpl.java +++ b/src/main/java/com/zy/asrs/service/impl/OpenServiceImpl.java @@ -478,6 +478,10 @@ throw new CoolException("鍟嗗搧鏁版嵁涓虹┖"); } + + + + for(MatSyncParam.MatParam matParam : param.getMatDetails()){ if(Cools.isEmpty(matParam.getMatnr())){ throw new CoolException("鍟嗗搧缂栫爜涓嶈兘涓虹┖"); @@ -488,19 +492,81 @@ // 鍒嗙被 Long tagId; // 涓�绾у垎绫� - Tag tag = tagService.selectOne(new EntityWrapper<Tag>().eq("memo", matParam.getGroupCode())); - if (tag == null) { - throw new CoolException("鍑洪敊锛屾湭鎵惧埌鍒嗙被"); + if (!Cools.isEmpty(matParam.getTagId()) && !Cools.isEmpty(matParam.getGroupName())) { + Tag priTag = tagService.selectByName(matParam.getTagId(), 1); + if (priTag == null) { + Tag top = tagService.getTop(); + NodeUtils nodeUtils = new NodeUtils(); + nodeUtils.executePath(top.getId()); + priTag = new Tag( + null, // 缂栧彿 + matParam.getTagId(), // 鍚嶇О + top.getId(), // 鐖剁骇 + top.getName(), // 鐖剁骇鍚嶇О + nodeUtils.path.toString(), // 鍏宠仈璺緞 + nodeUtils.pathName.toString(), // 鍏宠仈璺緞鍚� + 0, // 绫诲瀷 + null, // 璐熻矗浜� + null, // 鍥剧墖 + null, // 绠�瑕佹弿杩� + null, // 鏁伴噺 + 2, // 绛夌骇 + null, // 鎺掑簭 + 1, // 鐘舵�� + now, // 娣诲姞鏃堕棿 + null, // 娣诲姞浜哄憳 + now, // 淇敼鏃堕棿 + null, // 淇敼浜哄憳 + null // 澶囨敞 + ); + if (tagMapper.insert(priTag) == 0) { + throw new CoolException("鏈嶅姟鍣ㄥ唴閮ㄩ敊璇紝璇疯仈绯荤鐞嗗憳"); + } + } + // 浜岀骇鍒嗙被 + Tag secTag = tagService.selectByName(matParam.getGroupName(), 2); + if (secTag == null) { + NodeUtils nodeUtils = new NodeUtils(); + nodeUtils.executePath(priTag.getId()); + secTag = new Tag( + null, // 缂栧彿 + matParam.getGroupName(), // 鍚嶇О + priTag.getId(), // 鐖剁骇 + priTag.getName(), // 鐖剁骇鍚嶇О + nodeUtils.path.toString(), // 鍏宠仈璺緞 + nodeUtils.pathName.toString(), // 鍏宠仈璺緞鍚� + 0, // 绫诲瀷 + null, // 璐熻矗浜� + null, // 鍥剧墖 + null, // 绠�瑕佹弿杩� + null, // 鏁伴噺 + 2, // 绛夌骇 + null, // 鎺掑簭 + 1, // 鐘舵�� + now, // 娣诲姞鏃堕棿 + null, // 娣诲姞浜哄憳 + now, // 淇敼鏃堕棿 + null, // 淇敼浜哄憳 + null // 澶囨敞 + ); + if (tagMapper.insert(secTag) == 0) { + throw new CoolException("鏈嶅姟鍣ㄥ唴閮ㄩ敊璇紝璇疯仈绯荤鐞嗗憳"); + } + } + tagId = secTag.getId(); + } else { + tagId = tagService.getTop().getId(); } if (mat == null) { mat = new Mat(); + mat.sync(matParam); // mat.setMatnr(param.getMatnr()); // mat.setMaktx(param.getMaktx()); // mat.setSpecs(param.getSpecs()); // mat.setModel(param.getModel()); - mat.setTagId(tag.getId()); + mat.setTagId(tagId); mat.setStatus(1); mat.setCreateTime(now); mat.setUpdateTime(now); @@ -511,11 +577,45 @@ } } else { mat.sync(matParam); - mat.setTagId(tag.getId()); + mat.setTagId(tagId); if (!matService.update(mat, new EntityWrapper<Mat>().eq("matnr",matParam.getMatnr()))) { throw new CoolException("鏇存柊宸插瓨鍦ㄥ晢鍝佷俊鎭け璐ワ紝璇疯仈绯荤鐞嗗憳"); } } + + + + + + + //Tag tag = tagService.selectOne(new EntityWrapper<Tag>().eq("memo", matParam.getTagId())); +// if (tag == null) { +// throw new CoolException("鍑洪敊锛屾湭鎵惧埌鍒嗙被"); +// } +// if (mat == null) { +// mat = new Mat(); +// mat.sync(matParam); +//// mat.setMatnr(param.getMatnr()); +//// mat.setMaktx(param.getMaktx()); +//// mat.setSpecs(param.getSpecs()); +//// mat.setModel(param.getModel()); +// +// mat.setTagId(tag.getId()); +// mat.setStatus(1); +// mat.setCreateTime(now); +// mat.setUpdateTime(now); +// if (!matService.insert(mat)) { +// throw new CoolException("鏈嶅姟鍣ㄥ唴閮ㄩ敊璇紝璇疯仈绯荤鐞嗗憳"); +// } else { +// log.info("鍚屾鏂扮墿鏂橻鍟嗗搧缂栧彿锛歿}]", mat.getMatnr()); +// } +// } else { +// mat.sync(matParam); +// mat.setTagId(tag.getId()); +// if (!matService.update(mat, new EntityWrapper<Mat>().eq("matnr",matParam.getMatnr()))) { +// throw new CoolException("鏇存柊宸插瓨鍦ㄥ晢鍝佷俊鎭け璐ワ紝璇疯仈绯荤鐞嗗憳"); +// } +// } } } -- Gitblit v1.9.1