hdy
2024-03-15 b5450a251628cc9690b4ad51d9f8b6baea1c8509
提交 | 用户 | 时间
e57a89 1 package com.jcdm.main.da.paramCollection.service.impl;
2
b64ed2 3 import cn.hutool.core.date.DateUtil;
e57a89 4 import com.jcdm.common.utils.DateUtils;
b64ed2 5 import com.jcdm.main.da.collectionParamConf.domain.DaCollectionParamConf;
6 import com.jcdm.main.da.collectionParamConf.mapper.DaCollectionParamConfMapper;
e57a89 7 import com.jcdm.main.da.paramCollection.domain.DaParamCollection;
8 import com.jcdm.main.da.paramCollection.mapper.DaParamCollectionMapper;
9 import com.jcdm.main.da.paramCollection.service.IDaParamCollectionService;
10 import org.springframework.beans.factory.annotation.Autowired;
11 import org.springframework.stereotype.Service;
12
b64ed2 13 import java.util.*;
e57a89 14
15 /**
16  * 设备产品过程参数采集Service业务层处理
17  * 
18  * @author yyt
19  * @date 2023-12-13
20  */
21 @Service
22 public class DaParamCollectionServiceImpl implements IDaParamCollectionService
23 {
24     @Autowired
25     private DaParamCollectionMapper daParamCollectionMapper;
b64ed2 26
27     @Autowired
28     private DaCollectionParamConfMapper daCollectionParamConfMapper;
e57a89 29
30     /**
31      * 查询设备产品过程参数采集
32      * 
33      * @param id 设备产品过程参数采集主键
34      * @return 设备产品过程参数采集
35      */
36     @Override
37     public DaParamCollection selectDaParamCollectionById(Long id)
38     {
39         return daParamCollectionMapper.selectDaParamCollectionById(id);
40     }
41
42     /**
43      * 查询设备产品过程参数采集列表
44      * 
45      * @param daParamCollection 设备产品过程参数采集
46      * @return 设备产品过程参数采集
47      */
48     @Override
49     public List<DaParamCollection> selectDaParamCollectionList(DaParamCollection daParamCollection)
50     {
51         return daParamCollectionMapper.selectDaParamCollectionList(daParamCollection);
52     }
53
54     /**
55      * 新增设备产品过程参数采集
56      * 
57      * @param daParamCollection 设备产品过程参数采集
58      * @return 结果
59      */
60     @Override
61     public int insertDaParamCollection(DaParamCollection daParamCollection)
62     {
63         daParamCollection.setCreateTime(DateUtils.getNowDate());
64         return daParamCollectionMapper.insertDaParamCollection(daParamCollection);
65     }
66
67     /**
68      * 修改设备产品过程参数采集
69      * 
70      * @param daParamCollection 设备产品过程参数采集
71      * @return 结果
72      */
73     @Override
74     public int updateDaParamCollection(DaParamCollection daParamCollection)
75     {
76         daParamCollection.setUpdateTime(DateUtils.getNowDate());
77         return daParamCollectionMapper.updateDaParamCollection(daParamCollection);
78     }
79
80     /**
81      * 批量删除设备产品过程参数采集
82      * 
83      * @param ids 需要删除的设备产品过程参数采集主键
84      * @return 结果
85      */
86     @Override
87     public int deleteDaParamCollectionByIds(Long[] ids)
88     {
89         return daParamCollectionMapper.deleteDaParamCollectionByIds(ids);
90     }
91
92     /**
93      * 删除设备产品过程参数采集信息
94      * 
95      * @param id 设备产品过程参数采集主键
96      * @return 结果
97      */
98     @Override
99     public int deleteDaParamCollectionById(Long id)
100     {
101         return daParamCollectionMapper.deleteDaParamCollectionById(id);
102     }
b64ed2 103
104     @Override
105     public void addBasicParameters(DaParamCollection daParamCollection) {
106         // 假设这是从数据库或其他地方获取的参数数据
107         Map<String, String> map = new HashMap<>();
108         map.put("GC", "南浔工厂");
109         map.put("CXBH", "Pack线");
110         map.put("SBBH", "设备001");
111         map.put("YGBH", "员工001");
112         map.put("GDBH", daParamCollection.getWorkOrderNo());
113         map.put("CPXH", daParamCollection.getModel());
114         map.put("INT", DateUtil.formatDateTime(new Date()));
115
116         map.forEach((key, value) -> {
117             DaCollectionParamConf daCollectionParamConf = new DaCollectionParamConf();
118             daCollectionParamConf.setProcessesCode(daParamCollection.getLocationCode());
119             daCollectionParamConf.setCollectParameterId(key);
120             List<DaCollectionParamConf> daCollectionParamConfs = daCollectionParamConfMapper.selectDaCollectionParamConfList(daCollectionParamConf);
121
122             DaParamCollection saveData = new DaParamCollection();
123             saveData.setWorkOrderNo(daParamCollection.getWorkOrderNo());
124             saveData.setProductCode(daParamCollection.getProductCode());
125             saveData.setLocationCode(daParamCollection.getLocationCode());
126             saveData.setParamCode(daCollectionParamConfs.get(0).getCollectParameterId());
127             saveData.setParamName(daCollectionParamConfs.get(0).getCollectParameterName());
128             saveData.setCollectionTime(new Date());
129             saveData.setParamValue(value);
130             daParamCollectionMapper.insertDaParamCollection(saveData);
131         });
132     }
49c784 133
134     @Override
135     public void addTighteningParameters(DaParamCollection daParamCollection) {
136         String str = daParamCollection.getTightenTheArray();
137         str = str.replace("[", "").replace("]", "").replace(" ", "");
138         String[] parts = str.split(",");
139         String value1 = parts[0];
140         String value2 = parts[2];
141
142         System.out.println("value1: " + value1);
143         System.out.println("value2: " + value2);
144
145 //        DaCollectionParamConf daCollectionParamConf = new DaCollectionParamConf();
146 //        daCollectionParamConf.setProductCode(daParamCollection.getProductCode());
147 //        daCollectionParamConf.setProcessesCode(daParamCollection.getLocationCode());
148 //        daCollectionParamConfMapper.selectDaCollectionParamConfList(daCollectionParamConf);
149         daParamCollectionMapper.insertDaParamCollection(daParamCollection);
150     }
e57a89 151 }