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.Order;
|
import com.zy.asrs.entity.param.OpenOrderPakinParam;
|
import com.zy.asrs.service.OrderDetlService;
|
import com.zy.asrs.service.OrderService;
|
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.RequestMapping;
|
import org.springframework.web.bind.annotation.RestController;
|
|
/**
|
* Created by vincent on 2022/4/8
|
*/
|
@RestController
|
@RequestMapping("open/asrs/")
|
public class OpenController {
|
|
@Autowired
|
private OrderService orderService;
|
@Autowired
|
private OrderDetlService orderDetlService;
|
|
/**
|
* 添加入库单
|
*/
|
@PostMapping("order/pakin/default/v1")
|
public synchronized R orderCreate(@RequestBody OpenOrderPakinParam param) {
|
if (Cools.isEmpty(param)) {
|
return R.parse(BaseRes.PARAM);
|
}
|
if (Cools.isEmpty(param.getOrderNo())) {
|
return R.error("单据编号[orderNo]不能为空");
|
}
|
if (Cools.isEmpty(param.getOrderType())) {
|
return R.error("单据类型[orderType]错误");
|
}
|
if (Cools.isEmpty(param.getOrderDetails())) {
|
return R.error("单据明细[orderDetails]不能为空");
|
}
|
Order order = orderService.selectByNo(param.getOrderNo());
|
if (!Cools.isEmpty(order)) {
|
return R.error(param.getOrderNo() + "单据已存在,请勿重复提交");
|
}
|
|
return R.ok();
|
}
|
|
|
}
|