自动化立体仓库 - WMS系统
#
18516761980
2021-09-11 7c2c11719b6aa2043e0167184e212577e2cf6056
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
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
package com.zy.asrs.controller;
 
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.core.annotations.ManagerAuth;
import com.core.common.BaseRes;
import com.core.common.Cools;
import com.core.common.R;
import com.zy.asrs.entity.CombBillQueryVo;
import com.zy.asrs.entity.LocDetl;
import com.zy.asrs.entity.LocMast;
import com.zy.asrs.entity.WrkDetl;
import com.zy.asrs.entity.param.CombParam;
import com.zy.asrs.service.LocDetlService;
import com.zy.asrs.service.LocMastService;
import com.zy.asrs.service.MobileService;
import com.zy.asrs.service.WrkDetlService;
import com.zy.common.model.MobileLocDetlVo;
import com.zy.common.web.BaseController;
import com.zy.ints.entity.WaitMatin;
import com.zy.ints.service.WaitMatinService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
 
import java.util.ArrayList;
import java.util.List;
 
/**
 * 移动端接口控制器
 * Created by vincent on 2020/6/10
 */
@RestController
@RequestMapping("mobile")
public class MobileController extends BaseController  {
 
    @Autowired
    private MobileService mobileService;
    @Autowired
    private LocMastService locMastService;
    @Autowired
    private LocDetlService locDetlService;
    @Autowired
    private WrkDetlService wrkDetlService;
    @Autowired
    private WaitMatinService waitMatinService;
 
    /**
     * 组托
     */
    @RequestMapping("/comb/auth")
    @ManagerAuth(memo = "组托")
    public R comb(@RequestBody CombParam combParam){
        mobileService.comb(combParam, getUserId());
        return R.ok();
    }
 
    /**
     * 组托
     */
    @RequestMapping("/comb/form")
    @ManagerAuth(memo = "组托")
    public R combForm(@RequestParam CombParam combParam){
        mobileService.comb(combParam, getUserId());
        return R.ok();
    }
 
    /**
     * 库存查询(根据物料编码和库位查询库存数量和捡料数量)
     * @param locNo
     * @param matNo
     * @return
     */
    @RequestMapping("/locDetl/stockQuery")
    @ManagerAuth
    public R stockQuery(@RequestParam(required = false)String locNo,
                        @RequestParam(required = false)String matNo){
        if (!Cools.isEmpty(locNo)) {
            LocMast locMast = locMastService.selectById(locNo);
            if (null == locMast || !"F".equals(locMast.getLocSts())) {
                return R.parse(BaseRes.EMPTY);
            }
            List<LocDetl> locDetls = locDetlService.selectList(new EntityWrapper<LocDetl>()
                    .eq("loc_no", locNo).orderBy("appe_time", false));
            List<MobileLocDetlVo> res = new ArrayList<>();
            locDetls.forEach(locDetl -> {
                MobileLocDetlVo vo = new MobileLocDetlVo();
                List<WrkDetl> wrkDetlsList = wrkDetlService.queryWrkDetl(locDetl.getMatNo(), locDetl.getLocNo());
                final Double[] pickNum = {0.0};
                wrkDetlsList.forEach(item -> {
                    pickNum[0] = pickNum[0] + item.getQty();
                });
                vo.setPickNum(pickNum[0]);
                vo.setLocNo(locDetl.getLocNo());
                vo.setMatNo(locDetl.getMatNo());
                vo.setMatName(locDetl.getMatName());
                vo.setCount(locDetl.getQty());
                res.add(vo);
            });
            return R.ok().add(res);
        }
        if (!Cools.isEmpty(matNo)) {
            List<LocDetl> locDetls = locDetlService.selectList(new EntityWrapper<LocDetl>()
                    .eq("mat_no", matNo).orderBy("appe_time", false));
            List<MobileLocDetlVo> res = new ArrayList<>();
            locDetls.forEach(locDetl -> {
                MobileLocDetlVo vo = new MobileLocDetlVo();
                List<WrkDetl> wrkDetlsList = wrkDetlService.queryWrkDetl(locDetl.getMatNo(), locDetl.getLocNo());
                final Double[] pickNum = {0.0};
                wrkDetlsList.forEach(item -> {
                    pickNum[0] = pickNum[0] + item.getQty();
                });
                vo.setPickNum(pickNum[0]);
                vo.setLocNo(locDetl.getLocNo());
                vo.setMatNo(locDetl.getMatNo());
                vo.setMatName(locDetl.getMatName());
                vo.setCount(locDetl.getQty());
                res.add(vo);
            });
            return R.ok().add(res);
        }
        return R.parse(BaseRes.PARAM);
    }
 
    /**
     *  根据库位号查找库存明细
     */
    @RequestMapping("/locDetl")
    @ManagerAuth
    public R getLocDetl(@RequestParam(required = false)String locNo,
                        @RequestParam(required = false)String matNo){
        if (!Cools.isEmpty(locNo)) {
            LocMast locMast = locMastService.selectById(locNo);
            if (null == locMast || !"F".equals(locMast.getLocSts())) {
                return R.parse(BaseRes.EMPTY);
            }
            List<LocDetl> locDetls = locDetlService.selectList(new EntityWrapper<LocDetl>()
                    .eq("loc_no", locNo).orderBy("appe_time", false));
            List<MobileLocDetlVo> res = new ArrayList<>();
            locDetls.forEach(locDetl -> {
                MobileLocDetlVo vo = new MobileLocDetlVo();
                vo.setLocNo(locDetl.getLocNo());
                vo.setMatNo(locDetl.getMatNo());
                vo.setMatName(locDetl.getMatName());
                vo.setCount(locDetl.getQty());
                res.add(vo);
            });
            return R.ok().add(res);
        }
        if (!Cools.isEmpty(matNo)) {
            List<LocDetl> locDetls = locDetlService.selectList(new EntityWrapper<LocDetl>()
                    .eq("mat_no", matNo).orderBy("appe_time", false));
            List<MobileLocDetlVo> res = new ArrayList<>();
            locDetls.forEach(locDetl -> {
                MobileLocDetlVo vo = new MobileLocDetlVo();
                vo.setLocNo(locDetl.getLocNo());
                vo.setMatNo(locDetl.getMatNo());
                vo.setMatName(locDetl.getMatName());
                vo.setCount(locDetl.getQty());
                res.add(vo);
            });
            return R.ok().add(res);
        }
        return R.parse(BaseRes.PARAM);
    }
 
    /**
     * 根据通知单查询明细
     */
    @RequestMapping("/bill/query/auth")
    @ManagerAuth(memo = "根据通知单查询明细")
    public R billQuery(@RequestParam String billNo){
        List<WaitMatin> waitMatins = waitMatinService.selectList(new EntityWrapper<WaitMatin>().eq("bill_no", billNo).last("and qty > in_qty"));
        List<CombBillQueryVo> vos = new ArrayList<>();
        if (!Cools.isEmpty(waitMatins)) {
            for (WaitMatin waitMatin : waitMatins) {
                CombBillQueryVo vo = new CombBillQueryVo();
                vo.setMatNo(waitMatin.getMatNo());
                vo.setMatName(waitMatin.getMatName());
                vo.setCount(waitMatin.getQty()-waitMatin.getInQty());
                vo.setBillNo(waitMatin.getBillNo());
                vo.setSeqNo(waitMatin.getSeqNo());
                vo.setUnit(waitMatin.getUnit());
                vo.setSpecs(waitMatin.getSpecs());
                vo.setSize(waitMatin.getSize());
                vo.setColor(waitMatin.getColor());
                vos.add(vo);
            }
        }
        return R.ok().add(vos);
    }
 
    /**
     * PDA盘点根据出库口查询对应物料信息
     */
    @RequestMapping("/check/queryMatFromDevNo")
    public R queryMatFromDevNo(Integer devNo) {
        List<WrkDetl> list = wrkDetlService.queryMatFromDevNo(devNo);
        return R.ok().add(list);
    }
 
}