zhoushihao
2024-12-03 c823892f961b266199731ddd365d2dd4af4bf382
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
package com.mes.hollowqueue.service.impl;
 
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.mes.common.config.Const;
import com.mes.hollow.entity.HollowBigStorageCageDetails;
import com.mes.hollow.entity.HollowGlassOutRelationInfo;
import com.mes.hollow.service.HollowBigStorageCageDetailsService;
import com.mes.hollow.service.HollowGlassOutRelationInfoService;
import com.mes.hollowqueue.entity.HollowGlassQueueInfo;
import com.mes.hollowqueue.mapper.HollowGlassQueueInfoMapper;
import com.mes.hollowqueue.service.HollowGlassQueueInfoService;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;
 
import javax.annotation.Resource;
import java.util.List;
import java.util.stream.Collectors;
 
/**
 * (HollowGlassQueueInfo)表服务实现类
 *
 * @author makejava
 * @since 2024-11-30 10:19:56
 */
@Service
public class HollowGlassQueueInfoServiceImpl extends ServiceImpl<HollowGlassQueueInfoMapper, HollowGlassQueueInfo> implements HollowGlassQueueInfoService {
 
    @Resource
    HollowBigStorageCageDetailsService hollowBigStorageCageDetailsService;
 
    @Resource
    HollowGlassOutRelationInfoService hollowGlassOutRelationInfoService;
 
    @Override
    public void forceOutGlass(String flowCardId, int cell, int totalPairQuantity) {
        hollowGlassOutRelationInfoService.receiveTask(flowCardId, cell, totalPairQuantity);
        hollowGlassOutRelationInfoService.update(new LambdaUpdateWrapper<HollowGlassOutRelationInfo>()
                .eq(HollowGlassOutRelationInfo::getFlowCardId, flowCardId)
                .set(HollowGlassOutRelationInfo::getState, Const.HOLLOW_FLOW_CARD_START)
        );
        List<HollowBigStorageCageDetails> hollowBigStorageCageDetailsList = hollowBigStorageCageDetailsService.queryOutGlassList(flowCardId, cell);
 
        List<HollowGlassQueueInfo> hollowQueues = hollowBigStorageCageDetailsList.stream().map(queue -> {
            HollowGlassQueueInfo queueInfo = new HollowGlassQueueInfo();
            BeanUtils.copyProperties(queue, queueInfo);
            queueInfo.setState(Const.TEMPERING_NEW);
            queueInfo.setCell(cell);
            return queueInfo;
        }).collect(Collectors.toList());
        this.saveBatch(hollowQueues);
    }
    @Override
    public List<HollowGlassQueueInfo> queryHollowGlassQueueInfo(int cell) {
        HollowGlassOutRelationInfo one = hollowGlassOutRelationInfoService.getOne(new LambdaUpdateWrapper<HollowGlassOutRelationInfo>()
                .eq(HollowGlassOutRelationInfo::getCell, cell)
                .eq(HollowGlassOutRelationInfo::getState, Const.HOLLOW_FLOW_CARD_START)
        );
        this.list(new LambdaQueryWrapper<HollowGlassQueueInfo>()
                .eq(HollowGlassQueueInfo::getFlowCardId, one.getFlowCardId())
                .eq(HollowGlassQueueInfo::getCell, one.getCell())
        );
        return null;
    }
}