自动化立体仓库 - WMS系统
1
zhangc
7 天以前 2e2be15548552e9d7ecac1489a86060108f073a5
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
package com.zy.asrs.service.impl;
 
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.service.impl.ServiceImpl;
import com.core.common.Cools;
import com.zy.asrs.entity.RowLastno;
import com.zy.asrs.mapper.RowLastnoMapper;
import com.zy.asrs.service.RowLastnoService;
import org.springframework.stereotype.Service;
 
@Service("rowLastnoService")
public class RowLastnoServiceImpl extends ServiceImpl<RowLastnoMapper, RowLastno> implements RowLastnoService {
 
    @Override
    public RowLastno findBySection(Integer row) {
        return this.baseMapper.findBySection(row);
    }
 
    @Override
    public Integer selectNextWhsType() {
        RowLastno wrk_mk = this.selectOne(new EntityWrapper<RowLastno>()
                .eq("wrk_mk", 1));
        if (Cools.isEmpty(wrk_mk)) {
            this.baseMapper.updateInitWrkMk();
            return 1;
        }else {
            int i = this.selectCount(null);
            if (wrk_mk.getWhsType() >= i){
                this.baseMapper.updateInitWrkMk();
                wrk_mk.setWrkMk("0");
                this.update(wrk_mk,new EntityWrapper<RowLastno>()
                        .eq("whs_type",wrk_mk.getWhsType()));
            }else {
                this.baseMapper.updateNextWrkMk(wrk_mk.getWhsType()+1);
                wrk_mk.setWrkMk("0");
                this.update(wrk_mk,new EntityWrapper<RowLastno>()
                        .eq("whs_type",wrk_mk.getWhsType()));
            }
            return wrk_mk.getWhsType();
        }
    }
}