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());
|
}
|
|
|
}
|