New file |
| | |
| | | package com.zy.asrs.controller; |
| | | |
| | | import com.core.common.Cools; |
| | | import com.core.common.R; |
| | | import com.core.exception.CoolException; |
| | | import com.zy.asrs.entity.param.OpenApiStockOutParam; |
| | | import com.zy.asrs.service.LocDetlService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | 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; |
| | | |
| | | import java.util.List; |
| | | import java.util.Optional; |
| | | |
| | | /** |
| | | * Created by vincent on 2021/3/19 |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/open/api") |
| | | public class OpenController { |
| | | |
| | | @Autowired |
| | | private LocDetlService locDetlService; |
| | | |
| | | @PostMapping("/stockOut") |
| | | @Transactional |
| | | public R stockOut(@RequestBody List<OpenApiStockOutParam> params){ |
| | | if (!Cools.isEmpty(params)) { |
| | | for (OpenApiStockOutParam param : params) { |
| | | Double sumAnfme = Optional.ofNullable(locDetlService.getSumAnfme(param.getMatnr())).orElse(0.0D); |
| | | if (sumAnfme < param.getAnfme()) { |
| | | throw new CoolException(param.getMatnr() + "物料数量不足,缺货数量:" + (param.getAnfme() - sumAnfme)); |
| | | } |
| | | |
| | | |
| | | |
| | | } |
| | | } |
| | | |
| | | |
| | | return R.ok(); |
| | | } |
| | | |
| | | |
| | | } |