skyouc
2025-03-29 85b8e7ba6c4d0d780a7f90360150f2bd955eb874
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
package com.vincent.rsf.server.api.controller;
 
import com.vincent.rsf.framework.common.R;
import com.vincent.rsf.framework.exception.CoolException;
import com.vincent.rsf.server.api.controller.params.OtherReceiptParams;
import com.vincent.rsf.server.api.controller.params.ReceiptParams;
import com.vincent.rsf.server.api.service.MobileService;
import com.vincent.rsf.server.system.controller.BaseController;
import com.vincent.rsf.server.system.controller.param.LoginParam;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.tika.utils.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;
 
import javax.servlet.http.HttpServletRequest;
import java.util.Objects;
 
/**
 * @author Ryan
 * @version 1.0
 * @title MobileController
 * @description
 * @create 2025/3/10 08:05
 */
@Api(tags = "PDA操作接口")
@RequestMapping("/pda")
@RestController
public class MobileController extends BaseController {
 
    @Autowired
    private MobileService mobileService;
    /**
     * PDA用户登录
     * @param param
     * @param request
     * @return
     */
    @PostMapping("/login")
    @ApiOperation("PDA用户登录")
    public R login(@RequestBody LoginParam param, HttpServletRequest request) {
        if (Objects.isNull(param)) {
            throw new CoolException("登录信息不能为空!!");
        }
        if (Objects.isNull(param.getUsername())) {
            throw new CoolException("用户名不能为空!!");
        }
        if (Objects.isNull(param.getPassword())) {
            throw new CoolException("密码不能为空!!");
        }
 
        return mobileService.login(param, request);
    }
 
 
    /**
     * 标准扫码收货信息
     * @param trackCode
     * @return
     */
    @PreAuthorize("hasAuthority('manager:asnOrder:list')")
    @GetMapping("/orders/{trackCode}")
    @ApiOperation("标准扫码收货")
    public R  getOrderBybarcode(@PathVariable String trackCode) {
        if (StringUtils.isEmpty(trackCode)) {
            throw new CoolException("条码不能为空!!");
        }
        return mobileService.getOrderByCode(trackCode);
    }
 
    /**
     * 确认收货信息
     * @param params
     * @return
     */
    @PreAuthorize("hasAuthority('manager:warehouseAreas:save')")
    @PostMapping("/orders/confirm")
    @ApiOperation("确认收货")
    public R confirmReceipt(@RequestBody ReceiptParams params) {
       if (Objects.isNull(params)) {
           throw new CoolException("请求参数不能为空!!");
       }
        return mobileService.receiptToWarehouse(params);
    }
 
 
    @PreAuthorize("hasAuthority('manager:asnOrder:list')")
    @PostMapping("/orders/other")
    @ApiOperation("其它扫码收货")
    public R getOtherReceipt(@RequestBody OtherReceiptParams params) {
        if (Objects.isNull(params)) {
            throw new CoolException("参数不能为空!!");
        }
        return mobileService.otherReceipt(params);
    }
 
    @PreAuthorize("hasAuthority('manager:warehouseAreas:list')")
    @ApiOperation("获取收货区")
    @GetMapping("/areas/receipt")
    public R getReceiptAreas() {
        return mobileService.getReceiptAreas();
    }
 
 
    @PreAuthorize("hasAuthority('manager:asnOrder:list')")
    @GetMapping("/orders/asn")
    @ApiOperation("获取通知单")
    public R getAllAsnOrders() {
        return R.ok(mobileService.getAllAsnOrders());
    }
 
 
    @PreAuthorize("hasAuthority('manager:asnOrder:list')")
    @GetMapping("/dynamic/fields")
    @ApiOperation("获取动态字段")
    public R getDynamicFields() {
        return R.ok(mobileService.getDynamicFields());
    }
 
 
}