From 28670e94bb74ba937fe0ff73334ec68e969beef9 Mon Sep 17 00:00:00 2001 From: luxiaotao1123 <t1341870251@63.com> Date: 星期一, 28 三月 2022 17:05:37 +0800 Subject: [PATCH] # --- src/main/java/com/zy/asrs/controller/OutController.java | 57 ++++++++++++++++++++++++++++++++++++++++++++++++--------- 1 files changed, 48 insertions(+), 9 deletions(-) diff --git a/src/main/java/com/zy/asrs/controller/OutController.java b/src/main/java/com/zy/asrs/controller/OutController.java index 9f494e4..483db64 100644 --- a/src/main/java/com/zy/asrs/controller/OutController.java +++ b/src/main/java/com/zy/asrs/controller/OutController.java @@ -1,17 +1,18 @@ 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.entity.result.StoPreTab; -import com.zy.asrs.service.LocDetlService; -import com.zy.asrs.service.LocMastService; -import com.zy.asrs.service.OrderDetlService; -import com.zy.asrs.service.OrderService; +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; @@ -35,6 +36,13 @@ 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) { @@ -70,6 +78,7 @@ // } @PostMapping("/out/pakout/preview/auth") + @ManagerAuth public R pakoutPreview(@RequestBody List<Long> ids) { if (Cools.isEmpty(ids)) { return R.parse(BaseRes.PARAM); @@ -77,14 +86,15 @@ List<OrderDetl> orderDetls = orderDetlService.selectBatchIds(ids); List<LocDto> locDtos = new ArrayList<>(); for (OrderDetl orderDetl : orderDetls) { - // check stock -// Double stockAnfme = locDetlService.queryStockAnfme(orderDetl.getMatnr(), orderDetl.getBatch()); 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) { - locDtos.add(new LocDto(locDetl.getLocNo(), locDetl.getMatnr(), locDetl.getMaktx(), locDetl.getBatch(), orderDetl.getOrderNo(), - issued>=locDetl.getAnfme()?locDetl.getAnfme():issued)); + 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 { @@ -92,10 +102,39 @@ } } if (issued > 0) { - locDtos.add(new LocDto("缂鸿揣", orderDetl.getMatnr(), orderDetl.getMaktx(), orderDetl.getBatch(), orderDetl.getOrderNo(), issued)); + 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 synchronized 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(staNo, taskDto, getUserId()); + } + return R.ok(); + } + } -- Gitblit v1.9.1