From 149c89d3dafac946ea769367b5717bdcd0a6c1f8 Mon Sep 17 00:00:00 2001 From: luxiaotao1123 <t1341870251@63.com> Date: 星期一, 28 三月 2022 16:13:00 +0800 Subject: [PATCH] # --- src/main/java/com/zy/asrs/controller/OutController.java | 110 +++++++++++++++++++++++++++++++++++++++++++++++++++++-- 1 files changed, 106 insertions(+), 4 deletions(-) diff --git a/src/main/java/com/zy/asrs/controller/OutController.java b/src/main/java/com/zy/asrs/controller/OutController.java index 8f20a4f..4d5bf1f 100644 --- a/src/main/java/com/zy/asrs/controller/OutController.java +++ b/src/main/java/com/zy/asrs/controller/OutController.java @@ -1,18 +1,25 @@ package com.zy.asrs.controller; +import com.alibaba.fastjson.JSON; +import com.core.annotations.ManagerAuth; import com.core.common.BaseRes; import com.core.common.Cools; import com.core.common.R; +import com.zy.asrs.entity.BasDevp; +import com.zy.asrs.entity.LocDetl; import com.zy.asrs.entity.OrderDetl; -import com.zy.asrs.service.OrderDetlService; -import com.zy.asrs.service.OrderService; +import com.zy.asrs.entity.result.StoPreTab; +import com.zy.asrs.service.*; +import com.zy.common.model.DetlDto; +import com.zy.common.model.LocDto; +import com.zy.common.model.TaskDto; import com.zy.common.web.BaseController; 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.RestController; -import java.util.List; +import java.util.*; /** * Created by vincent on 2022/3/26 @@ -25,15 +32,110 @@ private OrderService orderService; @Autowired private OrderDetlService orderDetlService; + @Autowired + private LocDetlService locDetlService; + @Autowired + private LocMastService locMastService; + @Autowired + private StaDescService staDescService; + @Autowired + private WorkService workService; + @Autowired + private BasDevpService basDevpService; + + +// @PostMapping("/out/pakout/preview/auth") +// public R pakoutPreview(@RequestBody List<Long> ids) { +// if (Cools.isEmpty(ids)) { +// return R.parse(BaseRes.PARAM); +// } +// List<OrderDetl> orderDetls = orderDetlService.selectBatchIds(ids); +// Set<DetlDto> detlDtos = new HashSet<>(); +// for (OrderDetl orderDetl : orderDetls) { +// if (DetlDto.hasList(detlDtos, orderDetl)) { +// DetlDto detlDto = DetlDto.find(detlDtos, orderDetl.getMatnr(), orderDetl.getBatch()); +// assert detlDto != null; +// detlDto.setAnfme(detlDto.getAnfme() + orderDetl.getAnfme()); +// } else { +// detlDtos.add(new DetlDto(orderDetl.getMatnr(), orderDetl.getBatch(), orderDetl.getAnfme())); +// } +// } +// List<LocDto> locDtos = new ArrayList<>(); +// for (DetlDto detlDto : detlDtos) { +// double issued = Optional.ofNullable(detlDto.getAnfme()).orElse(0.0D) ; +// List<LocDetl> locDetls = locDetlService.queryStock(detlDto.getMatnr(), detlDto.getBatch(), null); +// for (LocDetl locDetl : locDetls) { +// if (issued > 0) { +// locDtos.add(new LocDto(locDetl.getLocNo(), locDetl.getMatnr(), locDetl.getBatch(), issued>=locDetl.getAnfme()?locDetl.getAnfme():issued)); +// // 鍓╀綑寰呭嚭鏁伴噺閫掑噺 +// issued = issued - locDetl.getAnfme(); +// } else { +// break; +// } +// } +// } +// return R.ok().add(locDtos); +// } @PostMapping("/out/pakout/preview/auth") + @ManagerAuth public R pakoutPreview(@RequestBody List<Long> ids) { if (Cools.isEmpty(ids)) { return R.parse(BaseRes.PARAM); } List<OrderDetl> orderDetls = orderDetlService.selectBatchIds(ids); - return R.ok().add(orderDetls); + List<LocDto> locDtos = new ArrayList<>(); + for (OrderDetl orderDetl : orderDetls) { + double issued = Optional.ofNullable(orderDetl.getAnfme()).orElse(0.0D) ; + List<LocDetl> locDetls = locDetlService.queryStock(orderDetl.getMatnr(), orderDetl.getBatch(), null); + for (LocDetl locDetl : locDetls) { + if (issued > 0) { + LocDto locDto = new LocDto(locDetl.getLocNo(), locDetl.getMatnr(), locDetl.getMaktx(), locDetl.getBatch(), orderDetl.getOrderNo(), + issued >= locDetl.getAnfme() ? locDetl.getAnfme() : issued); + List<Integer> staNos = staDescService.queryOutStaNosByLocNo(locDetl.getLocNo(), issued >= locDetl.getAnfme() ? 101 : 103); + locDto.setStaNos(staNos); + locDtos.add(locDto); + // 鍓╀綑寰呭嚭鏁伴噺閫掑噺 + issued = issued - locDetl.getAnfme(); + } else { + break; + } + } + if (issued > 0) { + LocDto locDto = new LocDto(null, orderDetl.getMatnr(), orderDetl.getMaktx(), orderDetl.getBatch(), orderDetl.getOrderNo(), issued); + locDto.setLack(Boolean.TRUE); + locDtos.add(locDto); + } + } + return R.ok().add(locDtos); + } + @PostMapping("/out/pakout/auth") + @ManagerAuth(memo = "璁㈠崟鍑哄簱") + public R pakout(@RequestBody List<LocDto> locDtos) { + if (Cools.isEmpty(locDtos)) { + return R.parse(BaseRes.PARAM); + } + List<TaskDto> taskDtos = new ArrayList<>(); + for (LocDto locDto : locDtos) { + if (locDto.isLack()) { continue; } + TaskDto taskDto = new TaskDto(locDto.getLocNo(), locDto.getStaNo(), locDto); + if (TaskDto.has(taskDtos, taskDto)) { + TaskDto dto = TaskDto.find(taskDtos, taskDto); + assert dto != null; + dto.getLocDtos().addAll(taskDto.getLocDtos()); + } else { + taskDtos.add(taskDto); + } + } + // ----------------------------------------------------------------------------------------------- + for (TaskDto taskDto : taskDtos) { + // 鐩爣绔欑偣鐘舵�佹娴� + BasDevp staNo = basDevpService.checkSiteStatus(taskDto.getStaNo()); +// workService.stockOut(); + + } + return R.ok(); } } -- Gitblit v1.9.1