From ac225bd66eb7c21b5af1d8533dc59376ea53da6c Mon Sep 17 00:00:00 2001
From: 廖井涛 <2265517004@qq.com>
Date: 星期五, 12 十二月 2025 12:29:42 +0800
Subject: [PATCH] Merge branch 'master' of http://10.153.19.25:10105/r/ERP_override

---
 north-glass-erp/src/main/java/com/example/erp/service/sd/BasicGlassTypeService.java |   64 +++++++++++++++++++++++++++++++
 1 files changed, 63 insertions(+), 1 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 779dd52..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;
@@ -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