懒羊羊
2024-03-15 b773030f37dc06a92bdb80e8af9a408843d5b317
提交 | 用户 | 时间
e57a89 1 package com.jcdm.main.bs.formulaChild.service.impl;
2
b64ed2 3 import java.util.Date;
e57a89 4 import java.util.List;
5
6 import com.jcdm.common.core.domain.AjaxResult;
7 import com.jcdm.common.utils.DateUtils;
b64ed2 8 import com.jcdm.main.da.paramCollection.domain.DaParamCollection;
9 import com.jcdm.main.da.paramCollection.mapper.DaParamCollectionMapper;
b77303 10 import org.aspectj.weaver.loadtime.Aj;
e57a89 11 import org.springframework.beans.factory.annotation.Autowired;
12 import org.springframework.stereotype.Service;
13 import com.jcdm.main.bs.formulaChild.mapper.BsFormulaChildInfoMapper;
14 import com.jcdm.main.bs.formulaChild.domain.BsFormulaChildInfo;
15 import com.jcdm.main.bs.formulaChild.service.IBsFormulaChildInfoService;
16
17 /**
18  * 配方配置子信息Service业务层处理
19  * 
20  * @author ruimin
21  * @date 2023-12-26
22  */
23 @Service
24 public class BsFormulaChildInfoServiceImpl implements IBsFormulaChildInfoService 
25 {
26     @Autowired
27     private BsFormulaChildInfoMapper bsFormulaChildInfoMapper;
b64ed2 28
29     @Autowired
30     private DaParamCollectionMapper daParamCollectionMapper;
e57a89 31
32     /**
33      * 查询配方配置子信息
34      * 
35      * @param id 配方配置子信息主键
36      * @return 配方配置子信息
37      */
38     @Override
39     public BsFormulaChildInfo selectBsFormulaChildInfoById(Long id)
40     {
41         return bsFormulaChildInfoMapper.selectBsFormulaChildInfoById(id);
42     }
43
44     /**
45      * 查询配方配置子信息列表
46      * 
47      * @param bsFormulaChildInfo 配方配置子信息
48      * @return 配方配置子信息
49      */
50     @Override
51     public List<BsFormulaChildInfo> selectBsFormulaChildInfoList(BsFormulaChildInfo bsFormulaChildInfo)
52     {
53         return bsFormulaChildInfoMapper.selectBsFormulaChildInfoList(bsFormulaChildInfo);
54     }
55
56     /**
57      * 新增配方配置子信息
58      * 
59      * @param bsFormulaChildInfo 配方配置子信息
60      * @return 结果
61      */
62     @Override
63     public int insertBsFormulaChildInfo(BsFormulaChildInfo bsFormulaChildInfo)
64     {
65         bsFormulaChildInfo.setCreateTime(DateUtils.getNowDate());
66         return bsFormulaChildInfoMapper.insertBsFormulaChildInfo(bsFormulaChildInfo);
67     }
68
69     /**
70      * 修改配方配置子信息
71      * 
72      * @param bsFormulaChildInfo 配方配置子信息
73      * @return 结果
74      */
75     @Override
76     public int updateBsFormulaChildInfo(BsFormulaChildInfo bsFormulaChildInfo)
77     {
78         bsFormulaChildInfo.setUpdateTime(DateUtils.getNowDate());
79         return bsFormulaChildInfoMapper.updateBsFormulaChildInfo(bsFormulaChildInfo);
80     }
81
82     /**
83      * 批量删除配方配置子信息
84      * 
85      * @param ids 需要删除的配方配置子信息主键
86      * @return 结果
87      */
88     @Override
89     public int deleteBsFormulaChildInfoByIds(Long[] ids)
90     {
91         return bsFormulaChildInfoMapper.deleteBsFormulaChildInfoByIds(ids);
92     }
93
94     /**
95      * 删除配方配置子信息信息
96      * 
97      * @param id 配方配置子信息主键
98      * @return 结果
99      */
100     @Override
101     public int deleteBsFormulaChildInfoById(Long id)
102     {
103         return bsFormulaChildInfoMapper.deleteBsFormulaChildInfoById(id);
104     }
105
106     @Override
107     public BsFormulaChildInfo selectBsFormulaChildInfoByTypeTopOne(String type,String productCode,String processesCode) {
108         BsFormulaChildInfo info = new BsFormulaChildInfo();
109         info.setOperationType(type);
110         info.setProcessesCode(processesCode);
111         info.setProductCode(productCode);
112         return bsFormulaChildInfoMapper.selectBsFormulaChildInfoByTypeTopOne(info);
113     }
114
115     @Override
b77303 116     public BsFormulaChildInfo getCount(String productCode, String processesCode) {
117         BsFormulaChildInfo info = new BsFormulaChildInfo();
118         info.setProcessesCode(processesCode);
119         info.setProductCode(productCode);
120         return bsFormulaChildInfoMapper.getCount(info);
121     }
122
123     @Override
124     public BsFormulaChildInfo releaseCheck(BsFormulaChildInfo bsFormulaChildInfo) {
e57a89 125         return bsFormulaChildInfoMapper.releaseCheck(bsFormulaChildInfo);
126     }
127
128     @Override
129     public AjaxResult updateResults(BsFormulaChildInfo bsFormulaChildInfo) {
b77303 130         BsFormulaChildInfo checkInfo = new BsFormulaChildInfo();
131         checkInfo.setProcessesCode(bsFormulaChildInfo.getLocationCode());
132         checkInfo.setProductCode(bsFormulaChildInfo.getProductCode());
49c784 133         bsFormulaChildInfo.setMaterialCode(bsFormulaChildInfo.getScanBarcode().substring(1,2));
e57a89 134         List<BsFormulaChildInfo> bsFormulaChildInfos = bsFormulaChildInfoMapper.selectBsFormulaChildInfoList(bsFormulaChildInfo);
135         if(bsFormulaChildInfos.size()>0){
136             bsFormulaChildInfos.get(0).setResults("OK");
137             bsFormulaChildInfoMapper.updateBsFormulaChildInfo(bsFormulaChildInfos.get(0));
49c784 138             bsFormulaChildInfo.setParamValue(bsFormulaChildInfo.getScanBarcode());
b64ed2 139             bsFormulaChildInfo.setParamCode(bsFormulaChildInfos.get(0).getParamCode());
49c784 140             bsFormulaChildInfo.setSfcBarcode(bsFormulaChildInfo.getSfcBarcode());
b64ed2 141             addParameterCollection(bsFormulaChildInfo);
b77303 142 //            BsFormulaChildInfo count = bsFormulaChildInfoMapper.getCount(checkInfo);
143 //            Integer i = count.getCounts();
e57a89 144         }else {
145             return AjaxResult.error("非本工位物料,请重新扫描");
146         }
147         return AjaxResult.success("成功");
148     }
149
b64ed2 150     public void addParameterCollection(BsFormulaChildInfo bsFormulaChildInfo){
151         DaParamCollection daParamCollection = new DaParamCollection();
152         daParamCollection.setParamCode(bsFormulaChildInfo.getParamCode());
153         daParamCollection.setWorkOrderNo(bsFormulaChildInfo.getWorkOrderNo());
154         daParamCollection.setLocationCode(bsFormulaChildInfo.getLocationCode());
155         daParamCollection.setParamValue(bsFormulaChildInfo.getParamValue());
156         daParamCollection.setProductCode(bsFormulaChildInfo.getProductCode());
157         daParamCollection.setCollectionTime(new Date());
49c784 158         daParamCollection.setSfcCode(bsFormulaChildInfo.getSfcBarcode());
b64ed2 159         daParamCollectionMapper.insertDaParamCollection(daParamCollection);
160     }
161
e57a89 162     @Override
163     public AjaxResult workpieceRelease(BsFormulaChildInfo bsFormulaChildInfo) {
164         bsFormulaChildInfoMapper.workpieceRelease(bsFormulaChildInfo);
165         return AjaxResult.success();
166     }
b77303 167
168     @Override
169     public AjaxResult updateTighteningFormula(BsFormulaChildInfo bsFormulaChildInfo) {
170         BsFormulaChildInfo listQuery = new BsFormulaChildInfo();
171         listQuery.setParamCode(bsFormulaChildInfo.getParamCode());
172         String paramCode = bsFormulaChildInfo.getTightenTheArray();
173         if(paramCode.contains("N")){
174             List<BsFormulaChildInfo> bsFormulaChildInfos = bsFormulaChildInfoMapper.selectBsFormulaChildInfoList(listQuery);
175             bsFormulaChildInfos.get(0).setResults("NG");
176             bsFormulaChildInfos.get(0).setCollectData(bsFormulaChildInfo.getTightenTheArray());
177             bsFormulaChildInfoMapper.updateBsFormulaChildInfo(bsFormulaChildInfos.get(0));
178             return AjaxResult.error("扫描结果NG,请重新扫描!");
179         }else {
180             List<BsFormulaChildInfo> bsFormulaChildInfos = bsFormulaChildInfoMapper.selectBsFormulaChildInfoList(listQuery);
181             bsFormulaChildInfos.get(0).setResults("OK");
182             bsFormulaChildInfos.get(0).setCollectData(bsFormulaChildInfo.getTightenTheArray());
183             bsFormulaChildInfoMapper.updateBsFormulaChildInfo(bsFormulaChildInfos.get(0));
184         }
185         return AjaxResult.success("扫描成功!");
186     }
187
188
189
190
e57a89 191 }