提交 | 用户 | 时间
|
e57a89
|
1 |
package com.jcdm.main.bs.formulaChild.service.impl; |
懒 |
2 |
|
b64ed2
|
3 |
import java.util.Date; |
e57a89
|
4 |
import java.util.List; |
3c2299
|
5 |
import java.util.Map; |
e57a89
|
6 |
|
0ce25f
|
7 |
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
e57a89
|
8 |
import com.jcdm.common.core.domain.AjaxResult; |
懒 |
9 |
import com.jcdm.common.utils.DateUtils; |
3c2299
|
10 |
import com.jcdm.framework.websocket.WebSocketUsers; |
b64ed2
|
11 |
import com.jcdm.main.da.paramCollection.domain.DaParamCollection; |
懒 |
12 |
import com.jcdm.main.da.paramCollection.mapper.DaParamCollectionMapper; |
32483a
|
13 |
import com.jcdm.main.da.passingStationCollection.domain.DaPassingStationCollection; |
懒 |
14 |
import com.jcdm.main.da.passingStationCollection.mapper.DaPassingStationCollectionMapper; |
3c2299
|
15 |
import com.kangaroohy.milo.model.ReadWriteEntity; |
懒 |
16 |
import com.kangaroohy.milo.service.MiloService; |
b77303
|
17 |
import org.aspectj.weaver.loadtime.Aj; |
e57a89
|
18 |
import org.springframework.beans.factory.annotation.Autowired; |
懒 |
19 |
import org.springframework.stereotype.Service; |
|
20 |
import com.jcdm.main.bs.formulaChild.mapper.BsFormulaChildInfoMapper; |
|
21 |
import com.jcdm.main.bs.formulaChild.domain.BsFormulaChildInfo; |
|
22 |
import com.jcdm.main.bs.formulaChild.service.IBsFormulaChildInfoService; |
3c2299
|
23 |
|
懒 |
24 |
import javax.websocket.Session; |
e57a89
|
25 |
|
懒 |
26 |
/** |
|
27 |
* 配方配置子信息Service业务层处理 |
|
28 |
* |
|
29 |
* @author ruimin |
|
30 |
* @date 2023-12-26 |
|
31 |
*/ |
|
32 |
@Service |
0ce25f
|
33 |
public class BsFormulaChildInfoServiceImpl extends ServiceImpl<BsFormulaChildInfoMapper,BsFormulaChildInfo> implements IBsFormulaChildInfoService |
e57a89
|
34 |
{ |
懒 |
35 |
@Autowired |
|
36 |
private BsFormulaChildInfoMapper bsFormulaChildInfoMapper; |
b64ed2
|
37 |
|
懒 |
38 |
@Autowired |
|
39 |
private DaParamCollectionMapper daParamCollectionMapper; |
3c2299
|
40 |
|
懒 |
41 |
@Autowired |
|
42 |
private MiloService miloService; |
32483a
|
43 |
|
懒 |
44 |
@Autowired |
|
45 |
private DaPassingStationCollectionMapper daPassingStationCollectionMapper; |
3c2299
|
46 |
|
懒 |
47 |
Map<String, Session> map = WebSocketUsers.getUsers(); |
e57a89
|
48 |
|
懒 |
49 |
/** |
|
50 |
* 查询配方配置子信息 |
|
51 |
* |
|
52 |
* @param id 配方配置子信息主键 |
|
53 |
* @return 配方配置子信息 |
|
54 |
*/ |
|
55 |
@Override |
|
56 |
public BsFormulaChildInfo selectBsFormulaChildInfoById(Long id) |
|
57 |
{ |
|
58 |
return bsFormulaChildInfoMapper.selectBsFormulaChildInfoById(id); |
|
59 |
} |
|
60 |
|
|
61 |
/** |
|
62 |
* 查询配方配置子信息列表 |
|
63 |
* |
|
64 |
* @param bsFormulaChildInfo 配方配置子信息 |
|
65 |
* @return 配方配置子信息 |
|
66 |
*/ |
|
67 |
@Override |
|
68 |
public List<BsFormulaChildInfo> selectBsFormulaChildInfoList(BsFormulaChildInfo bsFormulaChildInfo) |
|
69 |
{ |
|
70 |
return bsFormulaChildInfoMapper.selectBsFormulaChildInfoList(bsFormulaChildInfo); |
|
71 |
} |
|
72 |
|
|
73 |
/** |
|
74 |
* 新增配方配置子信息 |
|
75 |
* |
|
76 |
* @param bsFormulaChildInfo 配方配置子信息 |
|
77 |
* @return 结果 |
|
78 |
*/ |
|
79 |
@Override |
|
80 |
public int insertBsFormulaChildInfo(BsFormulaChildInfo bsFormulaChildInfo) |
|
81 |
{ |
|
82 |
bsFormulaChildInfo.setCreateTime(DateUtils.getNowDate()); |
|
83 |
return bsFormulaChildInfoMapper.insertBsFormulaChildInfo(bsFormulaChildInfo); |
|
84 |
} |
|
85 |
|
|
86 |
/** |
|
87 |
* 修改配方配置子信息 |
|
88 |
* |
|
89 |
* @param bsFormulaChildInfo 配方配置子信息 |
|
90 |
* @return 结果 |
|
91 |
*/ |
|
92 |
@Override |
|
93 |
public int updateBsFormulaChildInfo(BsFormulaChildInfo bsFormulaChildInfo) |
|
94 |
{ |
|
95 |
bsFormulaChildInfo.setUpdateTime(DateUtils.getNowDate()); |
|
96 |
return bsFormulaChildInfoMapper.updateBsFormulaChildInfo(bsFormulaChildInfo); |
|
97 |
} |
|
98 |
|
|
99 |
/** |
|
100 |
* 批量删除配方配置子信息 |
|
101 |
* |
|
102 |
* @param ids 需要删除的配方配置子信息主键 |
|
103 |
* @return 结果 |
|
104 |
*/ |
|
105 |
@Override |
|
106 |
public int deleteBsFormulaChildInfoByIds(Long[] ids) |
|
107 |
{ |
|
108 |
return bsFormulaChildInfoMapper.deleteBsFormulaChildInfoByIds(ids); |
|
109 |
} |
|
110 |
|
|
111 |
/** |
|
112 |
* 删除配方配置子信息信息 |
|
113 |
* |
|
114 |
* @param id 配方配置子信息主键 |
|
115 |
* @return 结果 |
|
116 |
*/ |
|
117 |
@Override |
|
118 |
public int deleteBsFormulaChildInfoById(Long id) |
|
119 |
{ |
|
120 |
return bsFormulaChildInfoMapper.deleteBsFormulaChildInfoById(id); |
|
121 |
} |
|
122 |
|
|
123 |
@Override |
|
124 |
public BsFormulaChildInfo selectBsFormulaChildInfoByTypeTopOne(String type,String productCode,String processesCode) { |
|
125 |
BsFormulaChildInfo info = new BsFormulaChildInfo(); |
|
126 |
info.setOperationType(type); |
|
127 |
info.setProcessesCode(processesCode); |
|
128 |
info.setProductCode(productCode); |
|
129 |
return bsFormulaChildInfoMapper.selectBsFormulaChildInfoByTypeTopOne(info); |
|
130 |
} |
|
131 |
|
|
132 |
@Override |
b77303
|
133 |
public BsFormulaChildInfo getCount(String productCode, String processesCode) { |
懒 |
134 |
BsFormulaChildInfo info = new BsFormulaChildInfo(); |
|
135 |
info.setProcessesCode(processesCode); |
|
136 |
info.setProductCode(productCode); |
|
137 |
return bsFormulaChildInfoMapper.getCount(info); |
|
138 |
} |
|
139 |
|
|
140 |
@Override |
|
141 |
public BsFormulaChildInfo releaseCheck(BsFormulaChildInfo bsFormulaChildInfo) { |
e57a89
|
142 |
return bsFormulaChildInfoMapper.releaseCheck(bsFormulaChildInfo); |
懒 |
143 |
} |
|
144 |
|
|
145 |
@Override |
|
146 |
public AjaxResult updateResults(BsFormulaChildInfo bsFormulaChildInfo) { |
b77303
|
147 |
BsFormulaChildInfo checkInfo = new BsFormulaChildInfo(); |
懒 |
148 |
checkInfo.setProcessesCode(bsFormulaChildInfo.getLocationCode()); |
|
149 |
checkInfo.setProductCode(bsFormulaChildInfo.getProductCode()); |
49c784
|
150 |
bsFormulaChildInfo.setMaterialCode(bsFormulaChildInfo.getScanBarcode().substring(1,2)); |
e57a89
|
151 |
List<BsFormulaChildInfo> bsFormulaChildInfos = bsFormulaChildInfoMapper.selectBsFormulaChildInfoList(bsFormulaChildInfo); |
懒 |
152 |
if(bsFormulaChildInfos.size()>0){ |
3c2299
|
153 |
bsFormulaChildInfos.get(0).setCollectData(bsFormulaChildInfo.getScanBarcode()); |
e57a89
|
154 |
bsFormulaChildInfos.get(0).setResults("OK"); |
懒 |
155 |
bsFormulaChildInfoMapper.updateBsFormulaChildInfo(bsFormulaChildInfos.get(0)); |
49c784
|
156 |
bsFormulaChildInfo.setParamValue(bsFormulaChildInfo.getScanBarcode()); |
b64ed2
|
157 |
bsFormulaChildInfo.setParamCode(bsFormulaChildInfos.get(0).getParamCode()); |
49c784
|
158 |
bsFormulaChildInfo.setSfcBarcode(bsFormulaChildInfo.getSfcBarcode()); |
b64ed2
|
159 |
addParameterCollection(bsFormulaChildInfo); |
e57a89
|
160 |
}else { |
懒 |
161 |
return AjaxResult.error("非本工位物料,请重新扫描"); |
|
162 |
} |
|
163 |
return AjaxResult.success("成功"); |
|
164 |
} |
|
165 |
|
b64ed2
|
166 |
public void addParameterCollection(BsFormulaChildInfo bsFormulaChildInfo){ |
懒 |
167 |
DaParamCollection daParamCollection = new DaParamCollection(); |
|
168 |
daParamCollection.setParamCode(bsFormulaChildInfo.getParamCode()); |
|
169 |
daParamCollection.setWorkOrderNo(bsFormulaChildInfo.getWorkOrderNo()); |
|
170 |
daParamCollection.setLocationCode(bsFormulaChildInfo.getLocationCode()); |
|
171 |
daParamCollection.setParamValue(bsFormulaChildInfo.getParamValue()); |
|
172 |
daParamCollection.setProductCode(bsFormulaChildInfo.getProductCode()); |
|
173 |
daParamCollection.setCollectionTime(new Date()); |
49c784
|
174 |
daParamCollection.setSfcCode(bsFormulaChildInfo.getSfcBarcode()); |
b64ed2
|
175 |
daParamCollectionMapper.insertDaParamCollection(daParamCollection); |
懒 |
176 |
} |
|
177 |
|
e57a89
|
178 |
@Override |
懒 |
179 |
public AjaxResult workpieceRelease(BsFormulaChildInfo bsFormulaChildInfo) { |
|
180 |
bsFormulaChildInfoMapper.workpieceRelease(bsFormulaChildInfo); |
|
181 |
return AjaxResult.success(); |
|
182 |
} |
b77303
|
183 |
|
懒 |
184 |
@Override |
|
185 |
public AjaxResult updateTighteningFormula(BsFormulaChildInfo bsFormulaChildInfo) { |
|
186 |
BsFormulaChildInfo listQuery = new BsFormulaChildInfo(); |
|
187 |
listQuery.setParamCode(bsFormulaChildInfo.getParamCode()); |
|
188 |
String paramCode = bsFormulaChildInfo.getTightenTheArray(); |
|
189 |
if(paramCode.contains("N")){ |
|
190 |
List<BsFormulaChildInfo> bsFormulaChildInfos = bsFormulaChildInfoMapper.selectBsFormulaChildInfoList(listQuery); |
|
191 |
bsFormulaChildInfos.get(0).setResults("NG"); |
|
192 |
bsFormulaChildInfos.get(0).setCollectData(bsFormulaChildInfo.getTightenTheArray()); |
|
193 |
bsFormulaChildInfoMapper.updateBsFormulaChildInfo(bsFormulaChildInfos.get(0)); |
|
194 |
return AjaxResult.error("扫描结果NG,请重新扫描!"); |
|
195 |
}else { |
|
196 |
List<BsFormulaChildInfo> bsFormulaChildInfos = bsFormulaChildInfoMapper.selectBsFormulaChildInfoList(listQuery); |
|
197 |
bsFormulaChildInfos.get(0).setResults("OK"); |
|
198 |
bsFormulaChildInfos.get(0).setCollectData(bsFormulaChildInfo.getTightenTheArray()); |
|
199 |
bsFormulaChildInfoMapper.updateBsFormulaChildInfo(bsFormulaChildInfos.get(0)); |
3c2299
|
200 |
String spareField4 = bsFormulaChildInfos.get(0).getSpareField4(); |
懒 |
201 |
if (spareField4 != null && !spareField4.isEmpty()) { |
|
202 |
// 执行操作 |
|
203 |
if(bsFormulaChildInfos.get(0).getSpareField4().equals("1")){ |
|
204 |
try { |
32483a
|
205 |
// //更新过站记录表出站时间 |
懒 |
206 |
// DaPassingStationCollection daPassingStationCollection = new DaPassingStationCollection(); |
|
207 |
// daPassingStationCollection.setWorkOrderNo(bsFormulaChildInfo.getWorkOrderNo()); |
|
208 |
// List<DaPassingStationCollection> daPassingStationCollections = daPassingStationCollectionMapper.selectDaPassingStationCollectionList(daPassingStationCollection); |
|
209 |
// daPassingStationCollections.get(0).setOutboundTime(new Date()); |
|
210 |
// daPassingStationCollectionMapper.updateDaPassingStationCollection(daPassingStationCollections.get(0)); |
3c2299
|
211 |
miloService.writeToOpcShort(ReadWriteEntity.builder().identifier("OP."+bsFormulaChildInfo.getLocationCode()+".RecordDataDone").value(21).build()); |
懒 |
212 |
WebSocketUsers.sendMessageToUserByText(map.get(bsFormulaChildInfo.getLocationCode()), "OUT"); |
|
213 |
} catch (Exception e) { |
|
214 |
throw new RuntimeException(e); |
|
215 |
} |
|
216 |
} |
|
217 |
} |
|
218 |
|
b77303
|
219 |
} |
懒 |
220 |
return AjaxResult.success("扫描成功!"); |
|
221 |
} |
|
222 |
|
|
223 |
|
|
224 |
|
|
225 |
|
e57a89
|
226 |
} |