提交 | 用户 | 时间
|
2df134
|
1 |
package com.jcdm.main.da.tileMatchRules.service.impl; |
J |
2 |
|
59e228
|
3 |
import java.util.ArrayList; |
2df134
|
4 |
import java.util.List; |
59e228
|
5 |
import java.util.stream.Collectors; |
W |
6 |
|
|
7 |
import cn.hutool.core.collection.CollUtil; |
|
8 |
import cn.hutool.core.collection.ListUtil; |
|
9 |
import cn.hutool.core.util.StrUtil; |
2df134
|
10 |
import com.jcdm.common.utils.DateUtils; |
59e228
|
11 |
import com.jcdm.main.da.passingStationCollection.domain.ProductNewPassStation; |
W |
12 |
import com.jcdm.main.da.passingStationCollection.service.ProductNewPassStationService; |
2df134
|
13 |
import org.springframework.beans.factory.annotation.Autowired; |
J |
14 |
import org.springframework.stereotype.Service; |
|
15 |
import com.jcdm.main.da.tileMatchRules.mapper.DaTileMatchRulesMapper; |
|
16 |
import com.jcdm.main.da.tileMatchRules.domain.DaTileMatchRules; |
|
17 |
import com.jcdm.main.da.tileMatchRules.service.IDaTileMatchRulesService; |
59e228
|
18 |
|
W |
19 |
import javax.annotation.Resource; |
2df134
|
20 |
|
J |
21 |
/** |
|
22 |
* 配瓦规则Service业务层处理 |
|
23 |
* |
|
24 |
* @author jiang |
|
25 |
* @date 2024-01-24 |
|
26 |
*/ |
|
27 |
@Service |
|
28 |
public class DaTileMatchRulesServiceImpl implements IDaTileMatchRulesService |
|
29 |
{ |
|
30 |
@Autowired |
|
31 |
private DaTileMatchRulesMapper daTileMatchRulesMapper; |
59e228
|
32 |
|
W |
33 |
@Resource |
|
34 |
private ProductNewPassStationService productNewPassStationService; |
2df134
|
35 |
|
J |
36 |
/** |
|
37 |
* 查询配瓦规则 |
|
38 |
* |
|
39 |
* @param id 配瓦规则主键 |
|
40 |
* @return 配瓦规则 |
|
41 |
*/ |
|
42 |
@Override |
|
43 |
public DaTileMatchRules selectDaTileMatchRulesById(Long id) |
|
44 |
{ |
|
45 |
return daTileMatchRulesMapper.selectDaTileMatchRulesById(id); |
|
46 |
} |
|
47 |
|
|
48 |
/** |
|
49 |
* 查询配瓦规则列表 |
|
50 |
* |
|
51 |
* @param daTileMatchRules 配瓦规则 |
|
52 |
* @return 配瓦规则 |
|
53 |
*/ |
|
54 |
@Override |
|
55 |
public List<DaTileMatchRules> selectDaTileMatchRulesList(DaTileMatchRules daTileMatchRules) |
|
56 |
{ |
|
57 |
return daTileMatchRulesMapper.selectDaTileMatchRulesList(daTileMatchRules); |
|
58 |
} |
|
59 |
|
|
60 |
/** |
|
61 |
* 新增配瓦规则 |
|
62 |
* |
|
63 |
* @param daTileMatchRules 配瓦规则 |
|
64 |
* @return 结果 |
|
65 |
*/ |
|
66 |
@Override |
|
67 |
public int insertDaTileMatchRules(DaTileMatchRules daTileMatchRules) |
|
68 |
{ |
|
69 |
daTileMatchRules.setCreateTime(DateUtils.getNowDate()); |
|
70 |
return daTileMatchRulesMapper.insertDaTileMatchRules(daTileMatchRules); |
|
71 |
} |
|
72 |
|
|
73 |
/** |
|
74 |
* 修改配瓦规则 |
|
75 |
* |
|
76 |
* @param daTileMatchRules 配瓦规则 |
|
77 |
* @return 结果 |
|
78 |
*/ |
|
79 |
@Override |
|
80 |
public int updateDaTileMatchRules(DaTileMatchRules daTileMatchRules) |
|
81 |
{ |
|
82 |
daTileMatchRules.setUpdateTime(DateUtils.getNowDate()); |
|
83 |
return daTileMatchRulesMapper.updateDaTileMatchRules(daTileMatchRules); |
|
84 |
} |
|
85 |
|
|
86 |
/** |
|
87 |
* 批量删除配瓦规则 |
|
88 |
* |
|
89 |
* @param ids 需要删除的配瓦规则主键 |
|
90 |
* @return 结果 |
|
91 |
*/ |
|
92 |
@Override |
|
93 |
public int deleteDaTileMatchRulesByIds(Long[] ids) |
|
94 |
{ |
|
95 |
return daTileMatchRulesMapper.deleteDaTileMatchRulesByIds(ids); |
|
96 |
} |
|
97 |
|
|
98 |
/** |
|
99 |
* 删除配瓦规则信息 |
|
100 |
* |
|
101 |
* @param id 配瓦规则主键 |
|
102 |
* @return 结果 |
|
103 |
*/ |
|
104 |
@Override |
|
105 |
public int deleteDaTileMatchRulesById(Long id) |
|
106 |
{ |
|
107 |
return daTileMatchRulesMapper.deleteDaTileMatchRulesById(id); |
|
108 |
} |
59e228
|
109 |
|
W |
110 |
@Override |
|
111 |
public List<DaTileMatchRules> checkData(String SNCode, String XT, String CZ) { |
|
112 |
List<DaTileMatchRules> resultList =new ArrayList<>(); |
|
113 |
ProductNewPassStation productNewPassStation = new ProductNewPassStation(); |
|
114 |
productNewPassStation.setSfcCode(SNCode); |
|
115 |
List<ProductNewPassStation> passStationList = productNewPassStationService.getProductPassStationList(productNewPassStation); |
|
116 |
if (CollUtil.isNotEmpty(passStationList)){ |
|
117 |
ProductNewPassStation passStation = passStationList.get(0); |
|
118 |
String productType = passStation.getProductType(); |
|
119 |
DaTileMatchRules daTileMatchRules = new DaTileMatchRules(); |
|
120 |
daTileMatchRules.setProductSeries(productType); |
|
121 |
daTileMatchRules.setScanObject1("箱体"); |
|
122 |
daTileMatchRules.setScanObject2("曲轴"); |
|
123 |
List<DaTileMatchRules> daTileMatchRulesList = this.selectDaTileMatchRulesList(daTileMatchRules); |
|
124 |
if (StrUtil.isNotBlank(XT) && StrUtil.isNotBlank(CZ)){ |
|
125 |
ArrayList<String> xtList = ListUtil.toList(XT.split(";")); |
|
126 |
ArrayList<String> czList = new ArrayList<>(); |
|
127 |
String s2 = ""; |
|
128 |
if (CZ.contains(";")){ |
|
129 |
czList = ListUtil.toList(CZ.split(";")); |
|
130 |
if (CollUtil.isNotEmpty(czList) && czList.size()>2){ |
|
131 |
s2 = czList.get(2); |
|
132 |
} |
|
133 |
} else if (CZ.contains(",")){ |
|
134 |
czList = ListUtil.toList(CZ.split(",")); |
|
135 |
if (CollUtil.isNotEmpty(czList) && czList.size()>1){ |
|
136 |
s2 = czList.get(1); |
|
137 |
} |
|
138 |
} |
|
139 |
if (CollUtil.isNotEmpty(xtList) && xtList.size()>1 && |
|
140 |
StrUtil.isNotBlank(s2)){ |
d2daac
|
141 |
String s1 = xtList.get(1); |
59e228
|
142 |
if ("380".equals(productType)){ |
W |
143 |
for (int i = 1; i < 5; i++){ |
|
144 |
char[] charArray1 = s1.toCharArray(); |
|
145 |
String axisValue; |
|
146 |
String neckValue; |
|
147 |
if (charArray1.length >= 7){ |
|
148 |
axisValue = String.valueOf(charArray1[i]); |
|
149 |
} else { |
|
150 |
axisValue = ""; |
|
151 |
} |
|
152 |
char[] charArray2 = s2.toCharArray(); |
|
153 |
if (charArray2.length >= 8){ |
|
154 |
neckValue = String.valueOf(charArray2[i]); |
|
155 |
} else { |
|
156 |
neckValue = ""; |
|
157 |
} |
|
158 |
Integer position = i+1; |
|
159 |
List<DaTileMatchRules> collect = daTileMatchRulesList.stream().filter(x -> position.equals(x.getAxisParameterNoPosition()) |
|
160 |
&& position.equals(x.getNeckParameterPosition()) |
|
161 |
&& x.getAxisValue().equals(axisValue) |
|
162 |
&& x.getNeckValue().equals(neckValue)).collect(Collectors.toList()); |
|
163 |
if (CollUtil.isNotEmpty(collect)){ |
|
164 |
DaTileMatchRules daTileMatchRules1 = collect.get(0); |
|
165 |
resultList.add(daTileMatchRules1); |
|
166 |
} |
|
167 |
} |
|
168 |
|
|
169 |
} |
|
170 |
} |
|
171 |
|
|
172 |
} |
|
173 |
} |
|
174 |
return resultList; |
|
175 |
} |
2df134
|
176 |
} |