自动化立体仓库 - WMS系统
#
lty
4 天以前 dea586adf232c722e8d2dfa833c3d7711a1019df
src/main/java/com/zy/asrs/controller/OutController.java
@@ -14,9 +14,11 @@
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.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import java.util.*;
import java.util.stream.Collectors;
/**
 * Created by vincent on 2022/3/26
@@ -40,8 +42,18 @@
    @Autowired
    private BasDevpService basDevpService;
    @PostMapping("/out/pakout/orderDetlIds/auth")
    @ManagerAuth(memo = "response.order_detail_ids_query")
    public R pakoutOrderDetlIds(@RequestParam Long orderId) throws InterruptedException {
        Thread.sleep(200);
        R r = R.ok();
        r.put("data",orderDetlService.selectByOrderId(orderId).stream().map(OrderDetl::getId).distinct().collect(Collectors.toList()));
        return r;
    }
    @PostMapping("/out/pakout/preview/auth")
    @ManagerAuth
    @ManagerAuth(memo = "response.order_preview")
    public R pakoutPreview(@RequestBody List<Long> ids) {
        if (Cools.isEmpty(ids)) {
            return R.parse(BaseRes.PARAM);
@@ -52,11 +64,10 @@
        Set<String> exist = new HashSet<>();
        for (OrderDetl orderDetl : orderDetls) {
            double issued = Optional.of(orderDetl.getAnfme() - orderDetl.getQty()).orElse(0.0D);
            double issued = Optional.of(orderDetl.getAnfme() - orderDetl.getWorkQty()).orElse(0.0D);
            if (issued <= 0.0D) { continue; }
            List<LocDetl> locDetls = locDetlService.queryStock(orderDetl.getMatnr(), orderDetl.getBatch(), null);
            List<LocDetl> locDetls = locDetlService.queryStock(orderDetl.getMatnr(), orderDetl.getBatch(), null, exist);
            for (LocDetl locDetl : locDetls) {
//                if (exist.contains(locDetl.getLocNo())) { continue; }
                if (issued > 0) {
                    LocDto locDto = new LocDto(locDetl.getLocNo(), locDetl.getMatnr(), locDetl.getMaktx(), locDetl.getBatch(), orderDetl.getOrderNo(),
                            issued >= locDetl.getAnfme() ? locDetl.getAnfme() : issued);
@@ -76,11 +87,13 @@
                locDtos.add(locDto);
            }
        }
        return R.ok().add(locDtos);
        R r = R.ok();
        r.put("data",locDtos);
        return r;
    }
    @PostMapping("/out/pakout/auth")
    @ManagerAuth(memo = "订单出库")
    @ManagerAuth(memo = "response.order_outbound")
    public synchronized R pakout(@RequestBody List<LocDto> locDtos) throws InterruptedException {
        if (Cools.isEmpty(locDtos)) {
            return R.parse(BaseRes.PARAM);
@@ -93,7 +106,7 @@
            }
        }
        if (lack) {
            return R.error("库存不足");
            return R.error("response.stock_insufficient");
        }
        Thread.sleep(1000L);
@@ -116,7 +129,7 @@
            BasDevp staNo = basDevpService.checkSiteStatus(taskDto.getStaNo());
            workService.stockOut(staNo, taskDto, getUserId());
        }
        return R.ok();
        return R.ok("response.outbound_start_success");
    }
}