春风项目四线(合箱线、总装线)
懒羊羊
2024-01-24 5fc5876a94dcbd5e9a9fb91f5e3c01211e9c2d96
提交 | 用户 | 时间
fd2207 1 package com.jcdm.main.da.passingStationCollection.service.impl;
2
9ebb88 3 import java.time.LocalDate;
W 4 import java.time.LocalDateTime;
5 import java.time.format.DateTimeFormatter;
6 import java.util.ArrayList;
fd2207 7 import java.util.List;
9ebb88 8
W 9 import com.jcdm.common.constant.Constants;
fd2207 10 import com.jcdm.common.utils.DateUtils;
9ebb88 11 import com.jcdm.main.bs.orderScheduling.domain.BsOrderScheduling;
W 12 import com.jcdm.main.bs.orderScheduling.mapper.BsOrderSchedulingMapper;
13 import com.jcdm.main.bs.orderScheduling.service.IBsOrderSchedulingService;
fd2207 14 import com.jcdm.main.da.passingStationCollection.domain.DaPassingStationCollection;
15 import com.jcdm.main.da.passingStationCollection.mapper.DaPassingStationCollectionMapper;
16 import com.jcdm.main.da.passingStationCollection.service.IDaPassingStationCollectionService;
ff985a 17 import com.jcdm.main.rm.repairRecord.domain.RmRepairRecord;
18 import com.jcdm.main.rm.repairRecord.mapper.RmRepairRecordMapper;
fd2207 19 import org.springframework.beans.factory.annotation.Autowired;
9ebb88 20 import org.springframework.format.annotation.DateTimeFormat;
fd2207 21 import org.springframework.stereotype.Service;
22
23 /**
24  * 产品过站采集Service业务层处理
25  * 
26  * @author yyt
27  * @date 2023-12-12
28  */
29 @Service
30 public class DaPassingStationCollectionServiceImpl implements IDaPassingStationCollectionService
31 {
32     @Autowired
33     private DaPassingStationCollectionMapper daPassingStationCollectionMapper;
ff985a 34
35     @Autowired
36     private RmRepairRecordMapper rmRepairRecordMapper;
9ebb88 37
W 38     @Autowired
39     private BsOrderSchedulingMapper bsOrderSchedulingMapper;
40
41     @Autowired
42     private IBsOrderSchedulingService bsOrderSchedulingService;
fd2207 43
44     /**
45      * 查询产品过站采集
46      * 
47      * @param id 产品过站采集主键
48      * @return 产品过站采集
49      */
50     @Override
51     public DaPassingStationCollection selectDaPassingStationCollectionById(Long id)
52     {
53         return daPassingStationCollectionMapper.selectDaPassingStationCollectionById(id);
54     }
55
56     /**
57      * 查询产品过站采集列表
58      * 
59      * @param daPassingStationCollection 产品过站采集
60      * @return 产品过站采集
61      */
62     @Override
63     public List<DaPassingStationCollection> selectDaPassingStationCollectionList(DaPassingStationCollection daPassingStationCollection)
64     {
65         return daPassingStationCollectionMapper.selectDaPassingStationCollectionList(daPassingStationCollection);
66     }
67
68     /**
9ebb88 69      * 获取首页单日累计量产数据
W 70      * @param fieldName bs
71      * @return list
72      */
73     @Override
74     public Integer getProduceNumToday(String fieldName) {
75
76         BsOrderScheduling bsOrderScheduling = new BsOrderScheduling();
77         bsOrderScheduling.setQueryField(fieldName);
78         DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
79         LocalDateTime startTime = LocalDate.now().atStartOfDay();
80         LocalDateTime endTime = LocalDate.now().plusDays(1).atStartOfDay();
81         String s1 = startTime.format(formatter);
82         String s2 = endTime.format(formatter);
83         bsOrderScheduling.setStartTime(s1);
84         bsOrderScheduling.setEndTime(s2);
85         return bsOrderSchedulingMapper.getProduceNumToday(bsOrderScheduling);
86     }
87
88     /**
fd2207 89      * 新增产品过站采集
90      * 
91      * @param daPassingStationCollection 产品过站采集
92      * @return 结果
93      */
94     @Override
95     public int insertDaPassingStationCollection(DaPassingStationCollection daPassingStationCollection)
96     {
97         daPassingStationCollection.setCreateTime(DateUtils.getNowDate());
98         return daPassingStationCollectionMapper.insertDaPassingStationCollection(daPassingStationCollection);
99     }
100
101     /**
102      * 修改产品过站采集
103      * 
104      * @param daPassingStationCollection 产品过站采集
105      * @return 结果
106      */
107     @Override
108     public int updateDaPassingStationCollection(DaPassingStationCollection daPassingStationCollection)
109     {
110         daPassingStationCollection.setUpdateTime(DateUtils.getNowDate());
111         return daPassingStationCollectionMapper.updateDaPassingStationCollection(daPassingStationCollection);
112     }
113
114     /**
115      * 批量删除产品过站采集
116      * 
117      * @param ids 需要删除的产品过站采集主键
118      * @return 结果
119      */
120     @Override
121     public int deleteDaPassingStationCollectionByIds(Long[] ids)
122     {
123         return daPassingStationCollectionMapper.deleteDaPassingStationCollectionByIds(ids);
124     }
125
126     /**
127      * 删除产品过站采集信息
128      * 
129      * @param id 产品过站采集主键
130      * @return 结果
131      */
132     @Override
133     public int deleteDaPassingStationCollectionById(Long id)
134     {
135         return daPassingStationCollectionMapper.deleteDaPassingStationCollectionById(id);
136     }
ff985a 137
138     @Override
139     public void insertRepairRecordByIds(DaPassingStationCollection daPassingStationCollection) {
140         Long[] conditions = daPassingStationCollection.getIds();
141         for (int i = 0; i < conditions.length; i++) {
142             DaPassingStationCollection result = daPassingStationCollectionMapper.selectDaPassingStationCollectionById(conditions[i]);
143             RmRepairRecord rmRepairRecord = new RmRepairRecord();
144             rmRepairRecord.setBoxCode(result.getSfcCode());
145             rmRepairRecord.setProcessesCode(result.getLocationCode());
146             rmRepairRecord.setOriginalResult(result.getOutRsSign());
147             rmRepairRecordMapper.insertRmRepairRecord(rmRepairRecord);
148         }
149     }
fd2207 150 }