#
Junjie
2024-01-05 3194da551027be67ec3285de7568e90bcfbf27ce
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
package com.zy.asrs.common.wms.service.impl;
 
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.zy.asrs.common.wms.entity.WrkMast;
import com.zy.asrs.common.wms.mapper.BasDevpMapper;
import com.zy.asrs.common.wms.entity.BasDevp;
import com.zy.asrs.common.wms.service.BasDevpService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.zy.asrs.common.wms.service.WrkMastService;
import com.zy.asrs.framework.exception.CoolException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
 
import java.util.List;
 
@Service("basDevpService")
public class BasDevpServiceImpl extends ServiceImpl<BasDevpMapper, BasDevp> implements BasDevpService {
 
    @Autowired
    private WrkMastService wrkMastService;
 
    @Override
    public List<Integer> getAvailableInSite(Long hostId) {
        return this.baseMapper.getAvailableInSite(1, hostId);
    }
 
    @Override
    public List<Integer> getAvailableEmptyInSite(Long hostId) {
        return this.baseMapper.getAvailableInSite(10, hostId);
    }
 
    @Override
    public List<Integer> getAvailableOutSite(Integer typeNo, Long hostId) {
        return this.baseMapper.getAvailableOutSite(typeNo, hostId);
    }
 
    @Override
    public BasDevp checkSiteStatus(Integer devpNo, boolean pakin, Long hostId) {
        BasDevp station = this.getOne(new LambdaQueryWrapper<BasDevp>().eq(BasDevp::getDevNo, devpNo).eq(BasDevp::getHostId, hostId));
        if (station == null){
            throw new CoolException(devpNo + "站点不存在");
        }
        if (pakin) {
            if(station.getAutoing()==null || !station.getAutoing().equals("Y")) {
                throw new CoolException(devpNo + "站点不是自动状态");
            }
            if(station.getLoading()==null || !station.getLoading().equals("Y")) {
                throw new CoolException(devpNo + "站点无物");
            }
            if(station.getWrkNo()!=null && station.getWrkNo()>0 && station.getWrkNo() < 9990) {
                throw new CoolException(devpNo + "站点已有工作号");
            }
            if (wrkMastService.count(new LambdaQueryWrapper<WrkMast>()
                    .eq(WrkMast::getSourceStaNo, devpNo)
                    .in(WrkMast::getWrkSts, 1, 6)) > 0) {
                throw new CoolException(devpNo + "站点不能同时生成两笔入库工作档");
            }
        }
        return station;
    }
 
}