懒羊羊
2024-03-13 b64ed2c784bde6dea9d18149ca706ebe532c857d
提交 | 用户 | 时间
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;
e57a89 10 import org.springframework.beans.factory.annotation.Autowired;
11 import org.springframework.stereotype.Service;
12 import com.jcdm.main.bs.formulaChild.mapper.BsFormulaChildInfoMapper;
13 import com.jcdm.main.bs.formulaChild.domain.BsFormulaChildInfo;
14 import com.jcdm.main.bs.formulaChild.service.IBsFormulaChildInfoService;
15
16 /**
17  * 配方配置子信息Service业务层处理
18  * 
19  * @author ruimin
20  * @date 2023-12-26
21  */
22 @Service
23 public class BsFormulaChildInfoServiceImpl implements IBsFormulaChildInfoService 
24 {
25     @Autowired
26     private BsFormulaChildInfoMapper bsFormulaChildInfoMapper;
b64ed2 27
28     @Autowired
29     private DaParamCollectionMapper daParamCollectionMapper;
e57a89 30
31     /**
32      * 查询配方配置子信息
33      * 
34      * @param id 配方配置子信息主键
35      * @return 配方配置子信息
36      */
37     @Override
38     public BsFormulaChildInfo selectBsFormulaChildInfoById(Long id)
39     {
40         return bsFormulaChildInfoMapper.selectBsFormulaChildInfoById(id);
41     }
42
43     /**
44      * 查询配方配置子信息列表
45      * 
46      * @param bsFormulaChildInfo 配方配置子信息
47      * @return 配方配置子信息
48      */
49     @Override
50     public List<BsFormulaChildInfo> selectBsFormulaChildInfoList(BsFormulaChildInfo bsFormulaChildInfo)
51     {
52         return bsFormulaChildInfoMapper.selectBsFormulaChildInfoList(bsFormulaChildInfo);
53     }
54
55     /**
56      * 新增配方配置子信息
57      * 
58      * @param bsFormulaChildInfo 配方配置子信息
59      * @return 结果
60      */
61     @Override
62     public int insertBsFormulaChildInfo(BsFormulaChildInfo bsFormulaChildInfo)
63     {
64         bsFormulaChildInfo.setCreateTime(DateUtils.getNowDate());
65         return bsFormulaChildInfoMapper.insertBsFormulaChildInfo(bsFormulaChildInfo);
66     }
67
68     /**
69      * 修改配方配置子信息
70      * 
71      * @param bsFormulaChildInfo 配方配置子信息
72      * @return 结果
73      */
74     @Override
75     public int updateBsFormulaChildInfo(BsFormulaChildInfo bsFormulaChildInfo)
76     {
77         bsFormulaChildInfo.setUpdateTime(DateUtils.getNowDate());
78         return bsFormulaChildInfoMapper.updateBsFormulaChildInfo(bsFormulaChildInfo);
79     }
80
81     /**
82      * 批量删除配方配置子信息
83      * 
84      * @param ids 需要删除的配方配置子信息主键
85      * @return 结果
86      */
87     @Override
88     public int deleteBsFormulaChildInfoByIds(Long[] ids)
89     {
90         return bsFormulaChildInfoMapper.deleteBsFormulaChildInfoByIds(ids);
91     }
92
93     /**
94      * 删除配方配置子信息信息
95      * 
96      * @param id 配方配置子信息主键
97      * @return 结果
98      */
99     @Override
100     public int deleteBsFormulaChildInfoById(Long id)
101     {
102         return bsFormulaChildInfoMapper.deleteBsFormulaChildInfoById(id);
103     }
104
105     @Override
106     public BsFormulaChildInfo selectBsFormulaChildInfoByTypeTopOne(String type,String productCode,String processesCode) {
107         BsFormulaChildInfo info = new BsFormulaChildInfo();
108         info.setOperationType(type);
109         info.setProcessesCode(processesCode);
110         info.setProductCode(productCode);
111         return bsFormulaChildInfoMapper.selectBsFormulaChildInfoByTypeTopOne(info);
112     }
113
114     @Override
115     public List<BsFormulaChildInfo> releaseCheck(BsFormulaChildInfo bsFormulaChildInfo) {
116         return bsFormulaChildInfoMapper.releaseCheck(bsFormulaChildInfo);
117     }
118
119     @Override
120     public AjaxResult updateResults(BsFormulaChildInfo bsFormulaChildInfo) {
121         List<BsFormulaChildInfo> bsFormulaChildInfos = bsFormulaChildInfoMapper.selectBsFormulaChildInfoList(bsFormulaChildInfo);
122         if(bsFormulaChildInfos.size()>0){
123             bsFormulaChildInfos.get(0).setResults("OK");
124             bsFormulaChildInfoMapper.updateBsFormulaChildInfo(bsFormulaChildInfos.get(0));
b64ed2 125             bsFormulaChildInfo.setParamValue(bsFormulaChildInfo.getMaterialCode());
126             bsFormulaChildInfo.setParamCode(bsFormulaChildInfos.get(0).getParamCode());
127             addParameterCollection(bsFormulaChildInfo);
e57a89 128         }else {
129             return AjaxResult.error("非本工位物料,请重新扫描");
130         }
131         return AjaxResult.success("成功");
132     }
133
b64ed2 134     public void addParameterCollection(BsFormulaChildInfo bsFormulaChildInfo){
135         DaParamCollection daParamCollection = new DaParamCollection();
136         daParamCollection.setParamCode(bsFormulaChildInfo.getParamCode());
137         daParamCollection.setWorkOrderNo(bsFormulaChildInfo.getWorkOrderNo());
138         daParamCollection.setLocationCode(bsFormulaChildInfo.getLocationCode());
139         daParamCollection.setParamValue(bsFormulaChildInfo.getParamValue());
140         daParamCollection.setProductCode(bsFormulaChildInfo.getProductCode());
141         daParamCollection.setCollectionTime(new Date());
142         daParamCollectionMapper.insertDaParamCollection(daParamCollection);
143     }
144
e57a89 145     @Override
146     public AjaxResult workpieceRelease(BsFormulaChildInfo bsFormulaChildInfo) {
147         bsFormulaChildInfoMapper.workpieceRelease(bsFormulaChildInfo);
148         return AjaxResult.success();
149     }
150 }