From e590b02a84d728251727a6b982de706bf051990e Mon Sep 17 00:00:00 2001 From: Junjie <fallin.jie@qq.com> Date: 星期六, 29 七月 2023 13:08:04 +0800 Subject: [PATCH] Map适配较多库位 --- src/main/java/com/zy/asrs/service/impl/AgvWorkServiceImpl.java | 48 +++++++++++++++++++++++++++++++++++------------- 1 files changed, 35 insertions(+), 13 deletions(-) diff --git a/src/main/java/com/zy/asrs/service/impl/AgvWorkServiceImpl.java b/src/main/java/com/zy/asrs/service/impl/AgvWorkServiceImpl.java index 82751d4..4d06510 100644 --- a/src/main/java/com/zy/asrs/service/impl/AgvWorkServiceImpl.java +++ b/src/main/java/com/zy/asrs/service/impl/AgvWorkServiceImpl.java @@ -5,7 +5,6 @@ import com.core.exception.CoolException; import com.zy.asrs.entity.*; import com.zy.asrs.service.*; -import com.zy.common.model.DetlDto; import com.zy.common.model.StartupDto; import com.zy.common.service.AgvCommonService; import lombok.extern.slf4j.Slf4j; @@ -13,7 +12,8 @@ import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; -import java.util.*; +import java.util.Date; +import java.util.List; /** * Created by vincent on 2020/6/11 @@ -39,6 +39,8 @@ private AgvWrkMastService agvWrkMastService; @Autowired private AgvWrkDetlService agvWrkDetlService; + @Autowired + private MatService matService; @Override public StartupDto createWaitPainWrkMastStart(List<AgvBasDevp> agvBasDevpList, Long userId) { @@ -61,11 +63,12 @@ //鐢熸垚宸ヤ綔妗� AgvWrkMast wrkMast = createWrkMast(agvBasDevp, agvLocMast, now, userId); //鐢熸垚宸ヤ綔妗f槑缁� - createWrkDetl(agvWaitPakinList,wrkMast,userId); + createWrkDetlReWrite(agvWaitPakinList,wrkMast,userId); //鏇存柊婧愮珯鐐逛俊鎭� updateAgvBasDevp(agvBasDevp); //鏇存柊鐩爣搴撲綅鐘舵�� updateAgvLocMast(agvLocMast); + }); return null; @@ -90,7 +93,7 @@ /* 鐢熸垚宸ヤ綔妗f槑缁� */ - private void createWrkDetl(List<AgvWaitPakin> agvWaitPakinList, AgvWrkMast wrkMast, Long userId){ + /* private void createWrkDetl(List<AgvWaitPakin> agvWaitPakinList, AgvWrkMast wrkMast, Long userId){ List<DetlDto> detlDtos = new ArrayList<>(); agvWaitPakinList.forEach(agvWaitPakin -> { DetlDto detlDto = new DetlDto(agvWaitPakin.getMatnr(), agvWaitPakin.getBatch(), agvWaitPakin.getAnfme()); @@ -103,7 +106,33 @@ } }); agvWrkDetlService.createWorkDetail(wrkMast.getWrkNo(), detlDtos, wrkMast.getBarcode(), userId); - + }*/ + /* + 鐢熸垚宸ヤ綔妗f槑缁� + */ + private void createWrkDetlReWrite(List<AgvWaitPakin> agvWaitPakinList, AgvWrkMast wrkMast, Long userId){ + Date now = new Date(); + agvWaitPakinList.stream().forEach(agvWaitPakin -> { + Mat mat = matService.selectByMatnr(agvWaitPakin.getMatnr()); + if (Cools.isEmpty(mat)) { + throw new CoolException(agvWaitPakin.getMatnr() + "鍟嗗搧缁存姢澶辫触"); + } + AgvWrkDetl wrkDetl = new AgvWrkDetl(); + wrkDetl.sync(mat); + wrkDetl.setWrkNo(wrkMast.getWrkNo()); + wrkDetl.setOrderNo(agvWaitPakin.getOrderNo()); + wrkDetl.setIoTime(now); + wrkDetl.setBatch(agvWaitPakin.getBatch()); + wrkDetl.setAnfme(agvWaitPakin.getAnfme()); // 鏁伴噺 + wrkDetl.setZpallet(agvWaitPakin.getZpallet()); // 鎵樼洏鏉$爜 + wrkDetl.setAppeUser(userId); + wrkDetl.setAppeTime(now); + wrkDetl.setModiUser(userId); + wrkDetl.setModiTime(now); + if (!agvWrkDetlService.insert(wrkDetl)) { + throw new CoolException("淇濆瓨宸ヤ綔鏄庣粏澶辫触"); + } + }); } /* @@ -115,7 +144,7 @@ int workNo = agvCommonService.getWorkNo(0); wrkMast.setWrkNo(workNo); wrkMast.setIoTime(new Date()); - wrkMast.setWrkSts(1L); // 宸ヤ綔鐘舵�侊細鐢熸垚鍏ュ簱ID + wrkMast.setWrkSts(201L); // 宸ヤ綔鐘舵�侊細201.鐢熸垚鍏ュ簱浠诲姟ID wrkMast.setIoType(1); // 鍏ュ嚭搴撶姸鎬侊細1.鍏ュ簱 //鐢熸垚浼樺厛绾� wrkMast.setIoPri(300.0); @@ -136,12 +165,5 @@ } return wrkMast; - } - - public static void main(String[] args) { - Set<AgvBasDevp> set = new HashSet<>(); - set.add(null); - set.add(null); - System.out.println(set.size()); } } -- Gitblit v1.9.1