wujian
2024-05-24 09ef66abe6ffc1325c5d23055ed6f3f4cb88b625
提交 | 用户 | 时间
e6c837 1 package com.jcdm.main.da.passingStationCollection.service.impl;
A 2
09ef66 3 import cn.hutool.core.util.StrUtil;
W 4 import cn.hutool.http.HttpRequest;
5 import cn.hutool.http.HttpResponse;
6 import cn.hutool.json.JSONUtil;
7 import com.alibaba.fastjson2.JSON;
e6c837 8 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
A 9 import com.jcdm.common.utils.DateUtils;
10 import com.jcdm.main.da.passingStationCollection.domain.DaPassingStationCollection;
11 import com.jcdm.main.da.passingStationCollection.mapper.DaPassingStationCollectionMapper;
09ef66 12 import com.jcdm.main.da.passingStationCollection.query.ProductOrderQuery;
W 13 import com.jcdm.main.da.passingStationCollection.query.ProductOrderVO;
e6c837 14 import com.jcdm.main.da.passingStationCollection.service.IDaPassingStationCollectionService;
A 15 import com.jcdm.main.rm.repairRecord.domain.RmRepairRecord;
16 import com.jcdm.main.rm.repairRecord.mapper.RmRepairRecordMapper;
17 import org.springframework.beans.factory.annotation.Autowired;
09ef66 18 import org.springframework.beans.factory.annotation.Value;
e6c837 19 import org.springframework.stereotype.Service;
A 20
21 import java.util.List;
22
23 /**
24  * 产品过站采集Service业务层处理
25  * 
26  * @author yyt
27  * @date 2023-12-12
28  */
29 @Service
30 public class DaPassingStationCollectionServiceImpl extends ServiceImpl<DaPassingStationCollectionMapper,DaPassingStationCollection> implements IDaPassingStationCollectionService
31 {
32     @Autowired
33     private DaPassingStationCollectionMapper daPassingStationCollectionMapper;
34
35     @Autowired
36     private IDaPassingStationCollectionService daPassingStationCollectionService;
37
38     @Autowired
39     private RmRepairRecordMapper rmRepairRecordMapper;
40
09ef66 41
W 42     @Value("${orderLineUrl}")
43     private String orderLineUrl;
e6c837 44 //    @Autowired
A 45 //    private BsOrderSchedulingMapper bsOrderSchedulingMapper;
46 //
47 //    @Autowired
48 //    private IBsOrderSchedulingService bsOrderSchedulingService;
49
50     /**
51      * 查询产品过站采集
52      * 
53      * @param id 产品过站采集主键
54      * @return 产品过站采集
55      */
56     @Override
57     public DaPassingStationCollection selectDaPassingStationCollectionById(Long id)
58     {
59         return daPassingStationCollectionMapper.selectDaPassingStationCollectionById(id);
60     }
61
62     /**
63      * 查询产品过站采集列表
64      * 
65      * @param daPassingStationCollection 产品过站采集
66      * @return 产品过站采集
67      */
68     @Override
69     public List<DaPassingStationCollection> selectDaPassingStationCollectionList(DaPassingStationCollection daPassingStationCollection)
70     {
71         return daPassingStationCollectionMapper.selectDaPassingStationCollectionList(daPassingStationCollection);
72     }
73
74 //    /**
75 //     * 获取首页单日累计量产数据
76 //     * @param fieldName bs
77 //     * @return list
78 //     */
79 //    @Override
80 //    public Integer getProduceNumToday(String fieldName) {
81 //
82 //        BsOrderScheduling bsOrderScheduling = new BsOrderScheduling();
83 //        bsOrderScheduling.setQueryField(fieldName);
84 //        DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
85 //        LocalDateTime startTime = LocalDate.now().atStartOfDay();
86 //        LocalDateTime endTime = LocalDate.now().plusDays(1).atStartOfDay();
87 //        String s1 = startTime.format(formatter);
88 //        String s2 = endTime.format(formatter);
89 //        bsOrderScheduling.setStartTime(s1);
90 //        bsOrderScheduling.setEndTime(s2);
91 //        return bsOrderSchedulingMapper.getProduceNumToday(bsOrderScheduling);
92 //    }
93
94     /**
95      * 新增产品过站采集
96      * 
97      * @param daPassingStationCollection 产品过站采集
98      * @return 结果
99      */
100     @Override
101     public int insertDaPassingStationCollection(DaPassingStationCollection daPassingStationCollection)
102     {
103         daPassingStationCollection.setCreateTime(DateUtils.getNowDate());
104         return daPassingStationCollectionMapper.insertDaPassingStationCollection(daPassingStationCollection);
105     }
106
107     /**
108      * 修改产品过站采集
109      * 
110      * @param daPassingStationCollection 产品过站采集
111      * @return 结果
112      */
113     @Override
114     public int updateDaPassingStationCollection(DaPassingStationCollection daPassingStationCollection)
115     {
116         daPassingStationCollection.setUpdateTime(DateUtils.getNowDate());
117         return daPassingStationCollectionMapper.updateDaPassingStationCollection(daPassingStationCollection);
118     }
119
120     /**
121      * 批量删除产品过站采集
122      * 
123      * @param ids 需要删除的产品过站采集主键
124      * @return 结果
125      */
126     @Override
127     public int deleteDaPassingStationCollectionByIds(Long[] ids)
128     {
129         return daPassingStationCollectionMapper.deleteDaPassingStationCollectionByIds(ids);
130     }
131
132     /**
133      * 删除产品过站采集信息
134      * 
135      * @param id 产品过站采集主键
136      * @return 结果
137      */
138     @Override
139     public int deleteDaPassingStationCollectionById(Long id)
140     {
141         return daPassingStationCollectionMapper.deleteDaPassingStationCollectionById(id);
142     }
143
144     @Override
145     public void insertRepairRecordByIds(DaPassingStationCollection daPassingStationCollection) {
146         Long[] conditions = daPassingStationCollection.getIds();
147         for (int i = 0; i < conditions.length; i++) {
148             DaPassingStationCollection result = daPassingStationCollectionMapper.selectDaPassingStationCollectionById(conditions[i]);
149             RmRepairRecord rmRepairRecord = new RmRepairRecord();
150             rmRepairRecord.setBoxCode(result.getSfcCode());
151             rmRepairRecord.setProcessesCode(result.getLocationCode());
152             rmRepairRecord.setOriginalResult(result.getOutRsSign());
153             rmRepairRecordMapper.insertRmRepairRecord(rmRepairRecord);
154         }
155     }
156
157     @Override
158     public int jrmAddPassingStationCollection(DaPassingStationCollection daPassingStationCollection) {
159         for (String model : daPassingStationCollection.getSfcCode().split(",")) {
160             daPassingStationCollection.setSfcCode(model);
161             daPassingStationCollectionService.save(daPassingStationCollection);
162         }
163         return 1;
164     }
09ef66 165
W 166
167     @Override
168     public ProductOrderVO queryMessFromLine(ProductOrderQuery query){
169         ProductOrderVO vo = new ProductOrderVO();
170         String jsonStr = JSONUtil.toJsonStr(query);
171         String url = orderLineUrl + "/productionWorkOrderRequest?siteCode="+query.getSiteCode()+"&stationCode="+query.getStationCode()+"&productNum="+query.getProductNum();
172 //        String url = "https://imes-uat-group.geelycv-test.com/api/mom-open/restful/aMesSysIntegration/productionWorkOrderRequest?siteCode=3983&stationCode=OP230&productNum=0RSPB001139E3AE5B0000011";
173         HttpResponse execute = HttpRequest.get(url).execute();
174         String body = execute.body();
175         if (StrUtil.isNotBlank(body)){
176 //            JSONObject jsonObject = new JSONObject(body);
177             vo = JSON.parseObject(body, ProductOrderVO.class);
178         }
179
180         return vo;
181     }
182
183     @Override
184     public void insertBatch(List<DaPassingStationCollection> confList){
185         try{
186             this.saveBatch(confList);
187         }catch (Exception e){
188             return;
189         }
190
191     }
e6c837 192 }