From d1db7fc8d9726687f554b58cc48bbe063bcc28b4 Mon Sep 17 00:00:00 2001 From: whycq <10027870+whycq@user.noreply.gitee.com> Date: 星期一, 20 三月 2023 15:53:24 +0800 Subject: [PATCH] # --- src/main/java/com/zy/asrs/service/impl/LocMastServiceImpl.java | 10 +++ src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java | 104 ++++++++++++++++++++++++++++++++++ src/main/resources/mapper/LocMastMapper.xml | 13 ++++ src/main/java/com/zy/asrs/mapper/LocMastMapper.java | 4 + src/main/java/com/zy/core/MainProcess.java | 3 + src/main/java/com/zy/asrs/service/LocMastService.java | 4 + 6 files changed, 137 insertions(+), 1 deletions(-) diff --git a/src/main/java/com/zy/asrs/mapper/LocMastMapper.java b/src/main/java/com/zy/asrs/mapper/LocMastMapper.java index f9ae090..6e25b63 100644 --- a/src/main/java/com/zy/asrs/mapper/LocMastMapper.java +++ b/src/main/java/com/zy/asrs/mapper/LocMastMapper.java @@ -30,10 +30,14 @@ LocMast queryDemoSourceLoc(@Param("crnNo") Integer crnNo); + LocMast queryDemoSourceLoc1(@Param("crnNo") Integer crnNo); + LocMast queryDemoLoc(@Param("crnNo") Integer crnNo); LocMast queryDemoLoc0(@Param("crnNo") Integer crnNo, @Param("locType1") short locType1); + LocMast queryDemoLoc2(@Param("crnNo") Integer crnNo, @Param("locType1") short locType1); + @Select("select count(*) as count from asr_loc_mast where 1=1 and loc_sts = 'O' and loc_type1 = #{locType1} and crn_no = #{crnNo}") Integer selectEmptyLocCount(@Param("locType1") Short locType1, @Param("crnNo") Integer crnNo); diff --git a/src/main/java/com/zy/asrs/service/LocMastService.java b/src/main/java/com/zy/asrs/service/LocMastService.java index 60ed6f8..6665ded 100644 --- a/src/main/java/com/zy/asrs/service/LocMastService.java +++ b/src/main/java/com/zy/asrs/service/LocMastService.java @@ -31,6 +31,8 @@ */ LocMast queryDemoSourceLoc(Integer crn); + LocMast queryDemoSourceLoc1(Integer crn); + /** * 鍫嗗灈鏈烘紨绀鸿幏鍙栫洰鏍囧簱浣� * @param crn @@ -46,6 +48,8 @@ */ LocMast queryDemoLoc0(Integer crn, short locType1); + LocMast queryDemoLoc2(Integer crn, short locType1); + /** * 妫�鏌ュ綋鍓嶅簱浣嶆墍灞炲贩閬撶殑绌哄簱浣嶆暟閲� * @param locMast diff --git a/src/main/java/com/zy/asrs/service/impl/LocMastServiceImpl.java b/src/main/java/com/zy/asrs/service/impl/LocMastServiceImpl.java index 0607b65..3c18f3d 100644 --- a/src/main/java/com/zy/asrs/service/impl/LocMastServiceImpl.java +++ b/src/main/java/com/zy/asrs/service/impl/LocMastServiceImpl.java @@ -40,6 +40,11 @@ } @Override + public LocMast queryDemoSourceLoc1(Integer crn) { + return this.baseMapper.queryDemoSourceLoc1(crn); + } + + @Override public LocMast queryDemoLoc(Integer crn) { return this.baseMapper.queryDemoLoc(crn); } @@ -50,6 +55,11 @@ } @Override + public LocMast queryDemoLoc2(Integer crn, short locType1) { + return this.baseMapper.queryDemoLoc2(crn,locType1); + } + + @Override public Boolean checkEmptyCount(LocMast locMast) { if (locMast == null) { return false; diff --git a/src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java b/src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java index a6f0fe9..b7784da 100644 --- a/src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java +++ b/src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java @@ -1966,6 +1966,110 @@ TransactionAspectSupport.currentTransactionStatus().setRollbackOnly(); } } + /** + * 鍫嗗灈鏈烘紨绀� ===>> 鎵�鏈夊簱浣嶈疆璇� + */ + public synchronized void crnDemoOfLocMove2() { + try { + for (CrnSlave crn : slaveProperties.getCrn()) { + if (!crn.getDemo()) { + continue; + } // 蹇呴』涓烘紨绀虹姸鎬� + + CrnThread crnThread = (CrnThread) SlaveConnection.get(SlaveType.Crn, crn.getId()); + CrnProtocol crnProtocol = crnThread.getCrnProtocol(); + if (crnProtocol == null) { + continue; + } + + // 鍙湁褰撳爢鍨涙満绌洪棽 骞朵笖 鏃犱换鍔℃椂鎵嶇户缁墽琛� + if (crnProtocol.getStatusType() == CrnStatusType.IDLE && crnProtocol.getTaskNo() == 0 && crnProtocol.getModeType() == CrnModeType.AUTO) { + // 鑾峰彇绉诲簱宸ヤ綔妗d俊鎭� + WrkMast wrkMast = wrkMastMapper.selectLocMove(crn.getId()); + if (null != wrkMast) { + continue; + } + + + LocMast sourceLoc = locMastService.queryDemoSourceLoc1(crn.getId()); + if (null == sourceLoc ) { + continue; + } + LocMast loc = locMastService.queryDemoLoc2(crn.getId(),sourceLoc.getLocType1()); + if ( null == loc) { + continue; + } + + String sourceLocNo = sourceLoc.getLocNo(); + String locNo = loc.getLocNo(); + + // 鑾峰彇宸ヤ綔鍙� + int workNo = commonService.getWorkNo(0); + // 淇濆瓨宸ヤ綔妗� + wrkMast = new WrkMast(); + wrkMast.setWrkNo(workNo); + wrkMast.setIoTime(new Date()); + wrkMast.setWrkSts(11L); // 宸ヤ綔鐘舵�侊細11.鐢熸垚鍑哄簱ID + wrkMast.setIoType(11); // 鍏ュ嚭搴撶姸鎬侊細 11.搴撴牸绉昏浇 + wrkMast.setIoPri(13D); + wrkMast.setCrnNo(crn.getId()); + wrkMast.setSourceLocNo(sourceLocNo); // 婧愬簱浣� + wrkMast.setLocNo(locNo); // 鐩爣搴撲綅 + wrkMast.setFullPlt("N"); // 婊℃澘锛歒 + wrkMast.setPicking("N"); // 鎷f枡 + wrkMast.setExitMk("N"); // 閫�鍑� + wrkMast.setEmptyMk(sourceLoc.getLocSts().equals("D") ? "Y" : "N"); // 绌烘澘 + wrkMast.setBarcode(sourceLoc.getBarcode()); // 鎵樼洏鐮� + wrkMast.setLinkMis("N"); + wrkMast.setAppeTime(new Date()); + wrkMast.setModiTime(new Date()); + int res = wrkMastMapper.insert(wrkMast); + if (res == 0) { + throw new CoolException("淇濆瓨宸ヤ綔妗eけ璐�"); + } + // 宸ヤ綔妗f槑缁嗕繚瀛� +// List<LocDetl> locDetls = locDetlService.selectList(new EntityWrapper<LocDetl>().eq("loc_no", sourceLocNo)); +// for (LocDetl locDetl : locDetls) { +// WrkDetl wrkDetl = new WrkDetl(); +// wrkDetl.setWrkNo(workNo); +// wrkDetl.setIoTime(new Date()); +// wrkDetl.setAnfme(locDetl.getAnfme()); +// VersionUtils.setWrkDetl(wrkDetl, locDetl); // 鐗堟湰鎺у埗 +// wrkDetl.setAppeTime(new Date()); +// wrkDetl.setModiTime(new Date()); +// if (!wrkDetlService.insert(wrkDetl)) { +// throw new CoolException("淇濆瓨宸ヤ綔妗f槑缁嗗け璐�"); +// } +// } + // 淇敼婧愬簱浣嶇姸鎬� + if (sourceLoc.getLocSts().equals("D")) { + sourceLoc.setLocSts("R"); // R.鍑哄簱棰勭害 + sourceLoc.setModiTime(new Date()); + if (!locMastService.updateById(sourceLoc)) { + throw new CoolException("鏇存柊婧愬簱浣嶇姸鎬佸け璐�"); + } + } else { + throw new CoolException("婧愬簱浣嶅嚭搴撳け璐�"); + } + // 淇敼鐩爣搴撲綅鐘舵�� + if (loc.getLocSts().equals("O")) { + loc.setLocSts("S"); // S.鍏ュ簱棰勭害 + loc.setModiTime(new Date()); + if (!locMastService.updateById(loc)) { + throw new CoolException("鏇存柊鐩爣搴撲綅鐘舵�佸け璐�"); + } + } else { + throw new CoolException("绉昏浆澶辫触"); + } + + } + } + } catch (Exception e) { + log.error("鍫嗗灈鏈烘紨绀� ===>> 搴撲綅绉昏浆澶辫触", e); + e.printStackTrace(); + TransactionAspectSupport.currentTransactionStatus().setRollbackOnly(); + } + } /** * 鍫嗗灈鏈哄懡浠や笅鍙戝悗锛屽紓姝ヤ慨鏀瑰伐浣滄。鐘舵�� diff --git a/src/main/java/com/zy/core/MainProcess.java b/src/main/java/com/zy/core/MainProcess.java index 3b55b0c..614ead6 100644 --- a/src/main/java/com/zy/core/MainProcess.java +++ b/src/main/java/com/zy/core/MainProcess.java @@ -46,6 +46,9 @@ // 婕旂ず mainService.crnDemoOfLocMove1(); + // 婕旂ず 鎵�鏈夊簱浣嶈疆璇� + mainService.crnDemoOfLocMove2(); + // 鍏ュ嚭搴撴ā寮忓垏鎹㈠嚱鏁� // mainService.ioConvert(); diff --git a/src/main/resources/mapper/LocMastMapper.xml b/src/main/resources/mapper/LocMastMapper.xml index 796ebd6..c8be3ea 100644 --- a/src/main/resources/mapper/LocMastMapper.xml +++ b/src/main/resources/mapper/LocMastMapper.xml @@ -54,13 +54,24 @@ ORDER BY NEWID() </select> + <select id="queryDemoSourceLoc1" resultMap="BaseResultMap"> + select top 1 * from asr_loc_mast where crn_no = #{crnNo} + and loc_sts='D' + </select> + <select id="queryDemoLoc" resultMap="BaseResultMap"> select top 1 * from asr_loc_mast where crn_no = #{crnNo} and loc_sts = 'O' ORDER BY NEWID() </select> <select id="queryDemoLoc0" resultMap="BaseResultMap"> - select top 1 * from asr_loc_mast where crn_no = #{crnNo} and loc_sts = 'O'and loc_type1 = #{locType1} + select top 1 * from asr_loc_mast where crn_no = #{crnNo} and loc_sts = 'O' and loc_type1 = #{locType1} ORDER BY NEWID() </select> + + <select id="queryDemoLoc2" resultMap="BaseResultMap"> + select top 1 * from asr_loc_mast where crn_no = #{crnNo} and loc_sts = 'O' and loc_type1 = #{locType1} + and ctn_kind=0 + ORDER BY bay1,row1,lev1 + </select> </mapper> -- Gitblit v1.9.1