1
20 小时以前 5e4d6a9017f2cce64506ae6a2bef3e9b57c19f8a
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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
package com.vincent.rsf.server.api.service.impl;
 
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.vincent.rsf.framework.common.Cools;
import com.vincent.rsf.framework.common.R;
import com.vincent.rsf.framework.exception.CoolException;
import com.vincent.rsf.server.api.entity.params.PdaGeneralParam;
import com.vincent.rsf.server.api.service.PdaOtherService;
import com.vincent.rsf.server.manager.entity.Loc;
import com.vincent.rsf.server.manager.entity.LocItem;
import com.vincent.rsf.server.manager.entity.Transfer;
import com.vincent.rsf.server.manager.enums.LocStatusType;
import com.vincent.rsf.server.manager.enums.LocStsType;
import com.vincent.rsf.server.manager.service.LocItemService;
import com.vincent.rsf.server.manager.service.LocService;
import com.vincent.rsf.server.manager.service.TransferService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
 
import java.util.List;
 
@Service
public class PdaOtherServiceImpl implements PdaOtherService {
 
    @Autowired
    private TransferService transferService;
 
    @Autowired
    private LocService locService;
    @Autowired
    private LocItemService locItemService;
 
    @Override
    public R transferPage(String orderNo, Integer curr, Integer limit) {
        Page<Transfer> page = new Page<>(curr, limit);
        LambdaQueryWrapper<Transfer> transferLambdaQueryWrapper = new LambdaQueryWrapper<>();
        transferLambdaQueryWrapper.eq(!Cools.isEmpty(orderNo), Transfer::getCode, orderNo);
        Page<Transfer> page1 = transferService.page(page, transferLambdaQueryWrapper);
        return R.ok(page1);
    }
 
    @Override
    public R inspectList(PdaGeneralParam generalParam) {
       if (Cools.isEmpty(generalParam.getContainerNo())) {
           throw new CoolException("容器码为空");
       }
       Loc loc = null;
       try {
           loc = locService.getOne(new LambdaQueryWrapper<Loc>().eq(Loc::getBarcode, generalParam.getContainerNo()));
       }catch (Exception e){
           throw new CoolException("数据错误,查询到多条库位");
       }
       if (Cools.isEmpty(loc)) {
           throw new CoolException("未找到对应的库位");
       }
       if (!loc.getUseStatus().equals(LocStsType.LOC_STS_TYPE_F.type)){
           throw new CoolException("库位不为在库状态");
       }
        List<LocItem> list = locItemService.list(new LambdaQueryWrapper<LocItem>()
                .eq(LocItem::getLocId, loc.getId())
                .eq(!Cools.isEmpty(generalParam.getMatnrCode()),LocItem::getMatnrCode, generalParam.getMatnrCode())
        );
       if (Cools.isEmpty(list)) {
           throw new CoolException("库位为在库状态,但库位为空");
       }
       return R.ok(list);
 
    }
 
    @Override
    public R inspectConfirm(PdaGeneralParam generalParam) {
        if (Cools.isEmpty(generalParam.getMatnrList())){
            throw new CoolException("参数为空");
        }
        for (LocItem locItem : generalParam.getMatnrList()) {
            LocItem locItem1 = locItemService.getById(locItem.getId());
            if (Cools.isEmpty(locItem1)) {
                throw new CoolException("数据错误");
            }
            if (locItem1.getStatus().equals(LocStatusType.FREEZE.type)){
                continue;
            }
            if (locItem.getStatus().equals(LocStatusType.FREEZE.type)){
                locItem1.setStatus(LocStatusType.FREEZE.type);
                locItemService.updateById(locItem1);
            }
 
 
        }
        return R.ok();
    }
 
    @Override
    public R inspectConfirm2(PdaGeneralParam generalParam) {
        if (Cools.isEmpty(generalParam.getMatnrList())){
            throw new CoolException("参数为空");
        }
        for (LocItem locItem : generalParam.getMatnrList()) {
            LocItem locItem1 = locItemService.getById(locItem.getId());
            if (Cools.isEmpty(locItem1)) {
                throw new CoolException("数据错误");
            }
            if (locItem1.getStatus().equals(LocStatusType.NORMAL.type)){
                continue;
            }
            if (locItem.getStatus().equals(LocStatusType.NORMAL.type)){
                locItem1.setStatus(LocStatusType.NORMAL.type);
                locItemService.updateById(locItem1);
            }
 
 
        }
        return R.ok();
    }
}