自动化立体仓库 - WMS系统
luxiaotao1123
2022-03-27 9d5f53ac13f03b21472401e0bc6980ff1fd7a97f
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
package com.zy.asrs.controller;
 
import com.core.common.BaseRes;
import com.core.common.Cools;
import com.core.common.R;
import com.zy.asrs.entity.OrderDetl;
import com.zy.asrs.service.LocDetlService;
import com.zy.asrs.service.OrderDetlService;
import com.zy.asrs.service.OrderService;
import com.zy.common.model.DetlDto;
import com.zy.common.web.BaseController;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;
 
import java.util.HashSet;
import java.util.List;
import java.util.Set;
 
/**
 * Created by vincent on 2022/3/26
 */
 
@RestController
public class OutController extends BaseController {
 
    @Autowired
    private OrderService orderService;
    @Autowired
    private OrderDetlService orderDetlService;
    @Autowired
    private LocDetlService locDetlService;
 
    @PostMapping("/out/pakout/preview/auth")
    public R pakoutPreview(@RequestBody List<Long> ids) {
        if (Cools.isEmpty(ids)) {
            return R.parse(BaseRes.PARAM);
        }
        // 合并同类项
        List<OrderDetl> orderDetls = orderDetlService.selectBatchIds(ids);
        Set<DetlDto> detlDtos = new HashSet<>();
        for (OrderDetl orderDetl : orderDetls) {
            if (DetlDto.hasList(detlDtos, orderDetl)) {
                DetlDto detlDto = DetlDto.find(detlDtos, orderDetl.getMatnr(), orderDetl.getBatch());
                assert detlDto != null;
                detlDto.setAnfme(detlDto.getAnfme() + orderDetl.getAnfme());
            } else {
                detlDtos.add(new DetlDto(orderDetl.getMatnr(), orderDetl.getBatch(), orderDetl.getAnfme()));
            }
        }
        //
//        List<LocDetl> locDetls = locDetlService.queryStock(orderDetl.getMatnr(), orderDetl.getBatch(), orderDetl.getOrderNo());
 
        return R.ok().add(orderDetls);
 
    }
 
}