From c8ec0494e03be47ec0f1b3a89ad5e0a004bd7501 Mon Sep 17 00:00:00 2001 From: Junjie <fallin.jie@qq.com> Date: 星期三, 20 九月 2023 12:41:37 +0800 Subject: [PATCH] Merge remote-tracking branch 'origin/tzskasrs' into tzskasrs --- src/main/java/com/zy/asrs/service/impl/MobileServiceImpl.java | 87 ++++++++++++++++++++++++++++++++++++++++--- 1 files changed, 81 insertions(+), 6 deletions(-) diff --git a/src/main/java/com/zy/asrs/service/impl/MobileServiceImpl.java b/src/main/java/com/zy/asrs/service/impl/MobileServiceImpl.java index 74ac54a..fd8233c 100644 --- a/src/main/java/com/zy/asrs/service/impl/MobileServiceImpl.java +++ b/src/main/java/com/zy/asrs/service/impl/MobileServiceImpl.java @@ -16,12 +16,15 @@ import com.zy.asrs.task.core.ReturnT; import com.zy.asrs.task.handler.WorkLogHandler; import com.zy.asrs.utils.MatUtils; +import com.zy.asrs.utils.SaasUtils; import com.zy.common.constant.MesConstant; import com.zy.common.entity.Parameter; import com.zy.common.model.DetlDto; import com.zy.common.model.MesCombParam; import com.zy.common.utils.HttpHandler; +import com.zy.system.entity.User; import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.BeanUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; @@ -63,6 +66,10 @@ private ApiLogService apiLogService; @Autowired private WorkLogHandler workLogHandler; + @Autowired + private ManLocDetlService manLocDetlService; + @Autowired + private WaitPakinLogService waitPakinLogService; @Override @Transactional @@ -93,9 +100,11 @@ // 鐢熸垚鍏ュ簱閫氱煡妗� List<DetlDto> detlDtos = new ArrayList<>(); param.getCombMats().forEach(elem -> { - DetlDto detlDto = new DetlDto(elem.getMatnr(), elem.getBatch(), elem.getAnfme()); + DetlDto detlDto = new DetlDto(elem.getMatnr(), elem.getBatch(), elem.getAnfme(), elem.getCsocode(), elem.getIsoseq()); + detlDto.setContainerCode(elem.getContainerCode()); + if (DetlDto.has(detlDtos, detlDto)) { - DetlDto one = DetlDto.find(detlDtos, detlDto.getMatnr(), detlDto.getBatch()); + DetlDto one = DetlDto.find(detlDtos, detlDto.getMatnr(), detlDto.getBatch(),detlDto.getCsocode(),detlDto.getIsoseq(),detlDto.getContainerCode()); assert one != null; one.setAnfme(one.getAnfme() + detlDto.getAnfme()); } else { @@ -120,6 +129,10 @@ waitPakin.setAppeTime(now); waitPakin.setModiUser(userId); waitPakin.setModiTime(now); + + waitPakin.setThreeCode(detlDto.getCsocode()); + waitPakin.setDeadTime(detlDto.getIsoseq()); + waitPakin.setSuppCode(detlDto.getContainerCode()); if (!waitPakinService.insert(waitPakin)) { throw new CoolException("淇濆瓨鍏ュ簱閫氱煡妗eけ璐�"); } @@ -144,9 +157,11 @@ throw new CoolException("淇敼鍗曟嵁鏄庣粏鏁伴噺澶辫触"); } - DetlDto detlDto = new DetlDto(elem.getMatnr(), elem.getBatch(), elem.getAnfme()); + DetlDto detlDto = new DetlDto(elem.getMatnr(), elem.getBatch(), elem.getAnfme(),elem.getCsocode(),elem.getIsoseq()); + detlDto.setContainerCode(elem.getContainerCode()); + if (DetlDto.has(detlDtos, detlDto)) { - DetlDto one = DetlDto.find(detlDtos, detlDto.getMatnr(), detlDto.getBatch()); + DetlDto one = DetlDto.find(detlDtos, detlDto.getMatnr(), detlDto.getBatch(),detlDto.getCsocode(),detlDto.getIsoseq(),detlDto.getContainerCode()); assert one != null; one.setAnfme(one.getAnfme() + detlDto.getAnfme()); } else { @@ -170,6 +185,11 @@ waitPakin.setAppeTime(now); waitPakin.setModiUser(userId); waitPakin.setModiTime(now); + + waitPakin.setThreeCode(detlDto.getCsocode()); + waitPakin.setDeadTime(detlDto.getIsoseq()); + waitPakin.setSuppCode(detlDto.getContainerCode()); + if (!waitPakinService.insert(waitPakin)) { throw new CoolException("淇濆瓨鍏ュ簱閫氱煡妗eけ璐�"); } @@ -290,10 +310,12 @@ } Mat analyse = MatUtils.analyseMat(elem.getMatnr()); // 鏉$爜銆佺墿鏂欎唬鐮併�佸簭鍒楀彿銆佹暟閲� - DetlDto detlDto = new DetlDto(elem.getMatnr(), analyse.getMatnr(), analyse.getBarcode(), elem.getAnfme()); + DetlDto detlDto = new DetlDto(elem.getMatnr(), analyse.getMatnr(), analyse.getBarcode(), elem.getAnfme(),elem.getCsocode(),elem.getIsoseq()); // DetlDto detlDto = new DetlDto(elem.getMatnr(), elem.getBatch(), elem.getAnfme()); + detlDto.setContainerCode(elem.getContainerCode()); + if (DetlDto.has(detlDtos, detlDto)) { - DetlDto one = DetlDto.find(detlDtos, detlDto.getMatnr(), detlDto.getBatch()); + DetlDto one = DetlDto.find(detlDtos, detlDto.getMatnr(), detlDto.getBatch(),detlDto.getCsocode(),detlDto.getIsoseq(),detlDto.getContainerCode()); assert one != null; one.setAnfme(one.getAnfme() + detlDto.getAnfme()); } else { @@ -398,6 +420,10 @@ waitPakin.setAppeTime(now); waitPakin.setModiUser(userId); waitPakin.setModiTime(now); + + waitPakin.setThreeCode(detlDto.getCsocode()); + waitPakin.setDeadTime(detlDto.getIsoseq()); + waitPakin.setSuppCode(detlDto.getContainerCode()); if (!waitPakinService.insert(waitPakin)) { throw new CoolException("淇濆瓨鍏ュ簱閫氱煡妗eけ璐�"); } @@ -414,4 +440,53 @@ } } + @Transactional + public void nodePutway(String zpallet, String locNo, User user) { + Date now = new Date(); + + //澧炲姞骞冲簱搴撳瓨 + List<WaitPakin> waitPakinList = waitPakinService.selectList(new EntityWrapper<WaitPakin>().eq("zpallet", zpallet)); + waitPakinList.forEach(waitPakin -> { + + //鏂欐兂鐮� + String containerCode = waitPakin.getSuppCode(); + //濡傛灉褰撳墠鏂欐兂鐮佸凡瀛樺湪锛屽垯淇敼璇ユ枡鎯崇殑鐗╂枡鏁伴噺 + ManLocDetl manLocDetl = manLocDetlService.selectOne(new EntityWrapper<ManLocDetl>().eq("container_code", containerCode)); + if(Cools.isEmpty(manLocDetl)){ + saveManlocDetl(manLocDetl,waitPakin,now,locNo); + }else{ + if(Cools.eq(manLocDetl.getMatnr(),waitPakin.getMatnr()) + && Cools.eq(manLocDetl.getCsocode(),waitPakin.getThreeCode()) + && Cools.eq(manLocDetl.getIsoseq(),waitPakin.getDeadTime())){ + manLocDetl.setAnfme(manLocDetl.getAnfme() + waitPakin.getAnfme()); + manLocDetlService.update(manLocDetl,new EntityWrapper<ManLocDetl>() + .eq("loc_no",manLocDetl.getLocNo()) + .eq("container_code",manLocDetl.getContainerCode())); + }else{ + saveManlocDetl(manLocDetl,waitPakin,now,locNo); + } + } + //鐢熸垚骞冲簱鍏ュ嚭搴撴棩蹇� + SaasUtils.insertLog(0,locNo,waitPakin.getMatnr(), waitPakin.getAnfme(),user.getUsername()); + + }); + //鐢熸垚鍏ュ簱閫氱煡鍘嗗彶妗� + waitPakinLogService.save(zpallet); + //鍒犻櫎鍏ュ簱閫氱煡妗� + waitPakinService.delete(new EntityWrapper<WaitPakin>().eq("zpallet", zpallet)); + + } + + private void saveManlocDetl(ManLocDetl manLocDetl, WaitPakin waitPakin, Date now, String locNo){ + manLocDetl = new ManLocDetl(); + BeanUtils.copyProperties(waitPakin,manLocDetl); + manLocDetl.setContainerCode(waitPakin.getSuppCode()); + manLocDetl.setCsocode(waitPakin.getThreeCode()); + manLocDetl.setIsoseq(waitPakin.getDeadTime()); + manLocDetl.setCreateTime(now); + manLocDetl.setModiTime(now); + manLocDetl.setLocNo(locNo); + manLocDetlService.insert(manLocDetl); + } + } -- Gitblit v1.9.1