自动化立体仓库 - WMS系统
zc
2024-07-27 cef8161169e99e299eefb7c67eeb4cb6e41d99f2
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
package com.zy.asrs.service.impl;
 
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.core.common.Cools;
import com.core.exception.CoolException;
import com.zy.asrs.mapper.DocTypeMapper;
import com.zy.asrs.entity.DocType;
import com.zy.asrs.service.DocTypeService;
import com.baomidou.mybatisplus.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
 
import java.util.Date;
 
@Service("docTypeService")
public class DocTypeServiceImpl extends ServiceImpl<DocTypeMapper, DocType> implements DocTypeService {
 
    @Override
    @Deprecated
    public DocType selectOrAdd(String docName, Boolean pakin) {
        if (Cools.isEmpty(docName)) {
            return null;
        }
        DocType docType = this.selectOne(new EntityWrapper<DocType>().eq("doc_name", docName));
        if (docType == null) {
            long docId = 1L;
            DocType last = this.selectOne(new EntityWrapper<DocType>().orderBy("doc_id", false));
            if (last != null) {
                docId = last.getDocId() + 1;
            }
            docType = new DocType();
            docType.setDocId(docId);
            docType.setDocName(docName);
            if (null != pakin) {
                docType.setPakin(pakin ? 1 : 0);
                docType.setPakout(pakin ? 0 : 1);
            }
            docType.setStatus(1);
            docType.setCreateTime(new Date());
            docType.setUpdateTime(new Date());
            if (!this.insert(docType)) {
                throw new CoolException("单据类型错误");
            }
        }
        return docType;
    }
 
    @Override
    public DocType selectOrAdd(String docName, String dccType, Boolean pakin) {
        if (Cools.isEmpty(docName) || Cools.isEmpty(docName)) {
            return null;
        }
        DocType docType = this.selectOne(new EntityWrapper<DocType>().eq("doc_code", dccType));
        if (docType == null) {
            long docId = 1L;
            DocType last = this.selectOne(new EntityWrapper<DocType>().orderBy("doc_id", false));
            if (last != null) {
                docId = last.getDocId() + 1;
            }
            docType = new DocType();
            docType.setDocId(docId);
            docType.setDocName(docName);
            docType.setDocCode(dccType);
            if (null != pakin) {
                docType.setPakin(pakin ? 1 : 0);
                docType.setPakout(pakin ? 0 : 1);
            }
            docType.setStatus(1);
            docType.setCreateTime(new Date());
            docType.setUpdateTime(new Date());
            if (!this.insert(docType)) {
                throw new CoolException("单据类型错误");
            }
        }
        return docType;
    }
}