自动化立体仓库 - WMS系统
lty
13 小时以前 9e3ac50b27cbbfc6d82da8177a1a8fcf1c009247
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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
package com.zy.asrs.service.impl;
 
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.mapper.Wrapper;
import com.baomidou.mybatisplus.service.impl.ServiceImpl;
import com.core.common.Cools;
import com.core.exception.CoolException;
import com.zy.asrs.entity.StaDesc;
import com.zy.asrs.mapper.StaDescMapper;
import com.zy.asrs.mapper.WrkMastStaMapper;
import com.zy.asrs.service.MatService;
import com.zy.asrs.service.StaDescService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
 
import java.util.List;
 
@Service("staDescService")
public class StaDescServiceImpl extends ServiceImpl<StaDescMapper, StaDesc> implements StaDescService {
    @Autowired
    private WrkMastStaMapper wrkMastStaMapper;
    @Override
    public List<Integer> queryOutStaNosByLocNo(String locNo, Integer typeNo) {
        return this.baseMapper.queryOutStaNosByLocNo(locNo, typeNo);
    }
 
    @Override
    public StaDesc queryCrnStn(Integer typeNo, Integer crnNo, Integer stnNo) {
        Wrapper<StaDesc> wrapper = new EntityWrapper<StaDesc>()
                .eq("type_no", typeNo)
                .eq("stn_no", stnNo)
                .eq("crn_no", crnNo);
        StaDesc staDesc = this.selectOne(wrapper);
        if (staDesc == null) {
            throw new CoolException("出库路径不存在");
        }
        return staDesc;
    }
 
    @Override
    public StaDesc queryCrnStnCheck(Integer typeNo, Integer crnNo, Integer stnNo) {
        Integer wrkRgv1 = wrkMastStaMapper.wrkCount1();
        Integer wrkRgv2 = wrkMastStaMapper.wrkCount2();
 
        Wrapper<StaDesc> wrapper = new EntityWrapper<StaDesc>();
 
        // ✅ 如果 wrkRgv1 < wrkRgv2,则多加一个条件
        if (wrkRgv1 < wrkRgv2) {
            wrapper.eq("type_no", typeNo)
                    .eq("stn_no", stnNo)
                    .eq("crn_no", crnNo)
                    .lt("crn_stn", 2000);
        }else{
            wrapper.eq("type_no", typeNo)
                    .eq("stn_no", stnNo)
                    .eq("crn_no", crnNo)
                    .gt("crn_stn", 2000);
        }
        StaDesc staDesc = this.selectOne(wrapper);
        if (staDesc == null) {
            throw new CoolException("出库路径不存在");
        }
        return staDesc;
    }
 
 
    @Override
    public StaDesc queryCrnStnAuto(Integer typeNo, Integer crnNo, Integer stnNo) {
        Wrapper<StaDesc> wrapper = new EntityWrapper<StaDesc>()
                .eq("type_no", typeNo)
                .eq("stn_no", stnNo)
                .eq("crn_no", crnNo);
        StaDesc staDesc = this.selectOne(wrapper);
        if (staDesc == null) {
            wrapper = new EntityWrapper<StaDesc>()
                    .eq("type_no", typeNo)
                    .eq("crn_no", crnNo);
            List<StaDesc> staDescs = this.selectList(wrapper);
            if (Cools.isEmpty(staDescs)) {
                throw new CoolException("出库路径不存在");
            }
            // todo:luxiaotao
            return staDescs.get(0);
        }
        return staDesc;
    }
 
    @Override
    public StaDesc queryCrnStn(Integer crnNo) {
        return this.baseMapper.queryCrnStn(crnNo);
    }
 
}