自动化立体仓库 - WMS系统
dubin
1 天以前 edb03c5169709da2e6d39a999328ce9bf92affff
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
package com.zy.asrs.service.impl;
 
import com.baomidou.mybatisplus.service.impl.ServiceImpl;
import com.core.exception.CoolException;
import com.zy.asrs.entity.Mat;
import com.zy.asrs.entity.MatBarcode;
import com.zy.asrs.entity.WaitPakin;
import com.zy.asrs.mapper.MatBarcodeMapper;
import com.zy.asrs.service.MatBarcodeService;
import com.zy.asrs.service.MatService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
 
import java.util.ArrayList;
import java.util.List;
 
@Service("MatBarcodeService")
public class MatBarcodeServiceImpl extends ServiceImpl<MatBarcodeMapper, MatBarcode> implements MatBarcodeService {
    @Autowired
    private MatBarcodeMapper matBarcodeMapper;
    @Autowired
    private MatBarcodeService matBarcodeService;
    @Autowired
    private MatService matService;
    @Override
    public MatBarcode selectbyMatnr(String matnr) {
        return this.baseMapper.selectByMatnr(matnr);
    }
 
    @Override
    public void deleteMatBarcode(List<MatBarcode> list) {
        for (MatBarcode matBarcode : list) {
            matBarcodeMapper.deleteByMatnr(matBarcode.getMatnr());
        }
    }
 
    @Override
    public void addBarcodeMatnr(WaitPakin waitPakin) {
        Mat mat = matService.selectById(waitPakin.getModiUser());
        if (mat == null){
            throw new CoolException("物料不存在,请先添加物料数据");
        }
        MatBarcode matBarcode = matBarcodeMapper.selectByMatnr(mat.getMatnr());
        if (matBarcode != null){
            throw new CoolException("该物料已经绑定托盘,请勿重复绑定");
        }
        MatBarcode mb=new MatBarcode();
        mb.setZpallet(waitPakin.getBarcode());
        mb.setMatnr(mat.getMatnr());
        mb.setMaktx(mat.getMaktx());
        mb.setSpecs(mat.getSpecs());
        mb.setModel(mat.getModel());
        if (!matBarcodeService.insert(mb)){
            throw new CoolException("物料托盘绑定失败");
        }
    }
}