From 1750abd11320f8d09ffe1580b7467dba87c86c89 Mon Sep 17 00:00:00 2001
From: guoyujie <guoyujie@ng.com>
Date: 星期三, 10 十二月 2025 14:40:25 +0800
Subject: [PATCH] Merge branch 'master' of http://10.153.19.25:10101/r/ERP_override

---
 north-glass-erp/src/main/java/com/example/erp/service/sd/BasicGlassTypeService.java |   66 ++++++++++++++++++++++++++++++++-
 1 files changed, 64 insertions(+), 2 deletions(-)

diff --git a/north-glass-erp/src/main/java/com/example/erp/service/sd/BasicGlassTypeService.java b/north-glass-erp/src/main/java/com/example/erp/service/sd/BasicGlassTypeService.java
index 92adb29..08189cb 100644
--- a/north-glass-erp/src/main/java/com/example/erp/service/sd/BasicGlassTypeService.java
+++ b/north-glass-erp/src/main/java/com/example/erp/service/sd/BasicGlassTypeService.java
@@ -3,6 +3,7 @@
 import com.alibaba.fastjson.JSON;
 import com.baomidou.dynamic.datasource.annotation.DS;
 import com.example.erp.entity.sd.BasicGlassType;
+import com.example.erp.entity.sd.ProcessAttributeConfig;
 import com.example.erp.mapper.sd.BasicGlassTypeMapper;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
@@ -35,7 +36,7 @@
             for (BasicGlassType basicGlassType : twoGlassType) {
                 if (Objects.equals(basicGlassType.getBelong(), glassType.getTypeId())) {
                     Map<String,String> getMap = JSON.parseObject(JSON.toJSONString(basicGlassType), Map.class);
-                    getMap.put("value",getMap.get("typeID"));
+                    getMap.put("value",getMap.get("typeId"));
                     getMap.put("label",getMap.get("typeName"));
                     equalList.add(JSON.toJSONString(getMap)   );
                 }
@@ -84,7 +85,13 @@
                 basicGlassTypeS.setTypeName((String) map.get("value"));
             }else if(list.size()==2) {
                 BasicGlassType basicGlassType =  basicGlassTypeMapper.selectMaxTowLevelType((String) list.get(1));
-                int maxId = Integer.parseInt(basicGlassType.getTypeId().substring(2));
+                Integer maxId = null;
+                if(basicGlassType==null){
+                    maxId = 0;
+                }else {
+                    maxId = Integer.parseInt(basicGlassType.getTypeId().substring(2));
+                }
+
                 String newTypeId =list.get(1) + String.format("%02d", maxId+1);
                 basicGlassTypeS.setLevel((Integer) list.get(0));
                 basicGlassTypeS.setTypeId(newTypeId);
@@ -99,4 +106,59 @@
         }
 
     }
+
+    public List<ProcessAttributeConfig> findAllConfig() {
+        return basicGlassTypeMapper.getFindAllConfig();
+    }
+
+    public List<Map<String,Object>> getOneLevelListMapConfig() {
+        List<ProcessAttributeConfig> processAttributeConfigList = basicGlassTypeMapper.getOneLevelListMapConfig();
+        List<Map<String,Object>> list = new ArrayList<>();
+        for (ProcessAttributeConfig processAttributeConfig : processAttributeConfigList) {
+            Map<String,Object> map = new HashMap<>();
+            map.put("value", processAttributeConfig.getInputType());
+            map.put("label", processAttributeConfig.getProcessName());
+            list.add(map);
+        }
+        return list;
+    }
+
+    public Boolean addConfig(Map<String, Object> map) {
+        List<Object> list = (List<Object>) map.get("glassLevel");
+        if(list.get(0)==null
+                || map.get("processType") == null
+                || map.get("processType").equals("")){
+            return false;
+        }
+        ProcessAttributeConfig processAttributeConfigS = new ProcessAttributeConfig();
+        if(map.get("type").equals("add")){
+            if(list.size()==1){
+                ProcessAttributeConfig processAttributeConfig =  basicGlassTypeMapper.selectMaxTypeConfig((Integer) list.get(0));
+                int maxId = Integer.parseInt(processAttributeConfig.getInputType());
+                String newTypeId = String.format("%02d", maxId+1);
+                processAttributeConfigS.setLevel((Integer) list.get(0));
+                processAttributeConfigS.setInputType(newTypeId);
+                processAttributeConfigS.setProcessType((String) map.get("processType"));
+                processAttributeConfigS.setProcessName((String) map.get("processName"));
+            }else if(list.size()==2) {
+                processAttributeConfigS.setLevel((Integer) list.get(0));
+                processAttributeConfigS.setInputType((String) map.get("inputType"));
+                processAttributeConfigS.setProcessType((String) map.get("processType"));
+                processAttributeConfigS.setProcessName((String) map.get("processName"));
+                processAttributeConfigS.setBelong((String) list.get(1));
+            }
+            return basicGlassTypeMapper.insertProcessAttributeConfig(processAttributeConfigS);
+        }else{
+            processAttributeConfigS.setId((Integer) map.get("id"));
+            processAttributeConfigS.setInputType((String) map.get("inputType"));
+            processAttributeConfigS.setProcessType((String) map.get("processType"));
+            processAttributeConfigS.setProcessName((String) map.get("processName"));
+            return basicGlassTypeMapper.updateProcessAttributeConfig(processAttributeConfigS);
+        }
+
+    }
+
+    public Boolean deleteProcessAttributeConfig(Integer id) {
+        return basicGlassTypeMapper.deleteProcessAttributeConfig(id);
+    }
 }

--
Gitblit v1.8.0