自动化立体仓库 - WMS系统
tzsk
2024-02-07 97c6a268766387d9c6834c23c9da3fdf63f3dc3f
src/main/java/com/zy/asrs/service/impl/DocTypeServiceImpl.java
@@ -1,6 +1,7 @@
package com.zy.asrs.service.impl;
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.mapper.Wrapper;
import com.core.common.Cools;
import com.core.exception.CoolException;
import com.zy.asrs.mapper.DocTypeMapper;
@@ -15,11 +16,24 @@
public class DocTypeServiceImpl extends ServiceImpl<DocTypeMapper, DocType> implements DocTypeService {
    @Override
    public DocType selectOrAdd(String docName) {
    public DocType selectOrAdd(String docName, Boolean pakin) {
        if (Cools.isEmpty(docName)) {
            return null;
        }
        DocType docType = this.selectOne(new EntityWrapper<DocType>().eq("doc_name", docName));
        DocType docType = null;
        try {
            docType = this.selectById(docName);
        } catch (Exception ignore) {}
        if (docType == null) {
            Wrapper<DocType> wrapper = new EntityWrapper<DocType>().eq("doc_name", docName);
            if(pakin){
                wrapper.eq("pakin",1);
            }else {
                wrapper.eq("pakout",1);
            }
            docType = this.selectOne(wrapper);
        }
        if (docType == null) {
            long docId = 1L;
            DocType last = this.selectOne(new EntityWrapper<DocType>().orderBy("doc_id", false));
@@ -29,6 +43,10 @@
            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());