From 7c077bec6a5912b39262e5aa65c1eba174e10e7a Mon Sep 17 00:00:00 2001 From: lsh <1> Date: 星期五, 16 二月 2024 21:43:29 +0800 Subject: [PATCH] # --- src/main/java/com/zy/asrs/utils/Utils.java | 70 +++++++++++ src/main/java/com/zy/asrs/service/impl/OpenServiceImpl.java | 98 ++++++++-------- src/main/java/com/zy/common/service/CommonService.java | 155 +++++++++++++------------ 3 files changed, 195 insertions(+), 128 deletions(-) diff --git a/src/main/java/com/zy/asrs/service/impl/OpenServiceImpl.java b/src/main/java/com/zy/asrs/service/impl/OpenServiceImpl.java index 181a918..7aa331b 100644 --- a/src/main/java/com/zy/asrs/service/impl/OpenServiceImpl.java +++ b/src/main/java/com/zy/asrs/service/impl/OpenServiceImpl.java @@ -699,65 +699,65 @@ //鍒ゆ柇param鍙傛暟 if (Cools.isEmpty(param.getBarcode())){ throw new CoolException("鍙傛暟锛氭墭鐩樼爜 barcode涓虹┖"); - }else if (Cools.isEmpty(param.getPalletizingNo())){ - throw new CoolException("鍙傛暟锛氱爜鍨涗綅缂栧彿 palletizingNo涓虹┖"); - }else if (Cools.isEmpty(param.getBoxType())){ - throw new CoolException("鍙傛暟锛氭湪绠辩被鍨� boxType涓虹┖"); +// }else if (Cools.isEmpty(param.getPalletizingNo())){ +// throw new CoolException("鍙傛暟锛氱爜鍨涗綅缂栧彿 palletizingNo涓虹┖"); +// }else if (Cools.isEmpty(param.getBoxType())){ +// throw new CoolException("鍙傛暟锛氭湪绠辩被鍨� boxType涓虹┖"); }else if (Cools.isEmpty(param.getMatList()) || param.getMatList().size()==0){ - throw new CoolException("鍙傛暟锛氱墿鏂欐槑缁� matLists涓虹┖"); + throw new CoolException("鍙傛暟锛氱墿鏂欐槑缁� matList涓虹┖"); } - String matnrOne = "";//鏈ㄧ鐩稿悓浣嶇疆 瑙勬牸 matnr鏍¢獙 1銆佸乏 - String matnrTwo = "";//鏈ㄧ鐩稿悓浣嶇疆 瑙勬牸 matnr鏍¢獙 2銆佸彸 - ArrayList<String> boxNos = new ArrayList<>(); //鏈ㄧ鍞竴缂栫爜鏌ラ噸 锛坆atch锛� +// String matnrOne = "";//鏈ㄧ鐩稿悓浣嶇疆 瑙勬牸 matnr鏍¢獙 1銆佸乏 +// String matnrTwo = "";//鏈ㄧ鐩稿悓浣嶇疆 瑙勬牸 matnr鏍¢獙 2銆佸彸 +// ArrayList<String> boxNos = new ArrayList<>(); //鏈ㄧ鍞竴缂栫爜鏌ラ噸 锛坆atch锛� //鍒ゆ柇matLists鍙傛暟 for (PalletizingCompleteTwoFloorParam.MatList matList:param.getMatList()){ if (Cools.isEmpty(matList.getMatnr())){ throw new CoolException("鍙傛暟锛氳鏍� matnr涓虹┖"); - }else if (Cools.isEmpty(matList.getPosition())){ - throw new CoolException("瑙勬牸锛�"+matList.getMatnr()+"銆佸弬鏁帮細鐮佸灈浣嶇疆 position涓虹┖"); - }else if (Cools.isEmpty(matList.getBatch())){ - throw new CoolException("瑙勬牸锛�"+matList.getMatnr()+"銆佸弬鏁帮細鏈ㄧ缂栧彿 batch涓虹┖"); - }else if (Cools.isEmpty(matList.getModel())){ - throw new CoolException("瑙勬牸锛�"+matList.getMatnr()+"銆佸弬鏁帮細鍗峰彿 model涓虹┖"); - }else if (Cools.isEmpty(matList.getBatch())){ - throw new CoolException("瑙勬牸锛�"+matList.getMatnr()+"銆佸弬鏁帮細鏈ㄧ缂栧彿 boxNo涓虹┖"); - }else if (Cools.isEmpty(matList.getWeight()) || matList.getWeight().equals(0D)){ - throw new CoolException("瑙勬牸锛�"+matList.getMatnr()+"銆佸弬鏁帮細鍑�閲� weight涓虹┖"); - }else if (Cools.isEmpty(matList.getRoughWeight()) || matList.getRoughWeight().equals(0D)){ - throw new CoolException("瑙勬牸锛�"+matList.getMatnr()+"銆佸弬鏁帮細姣涢噸 roughWeight"); - }else if (Cools.isEmpty(matList.getRollExtent()) || matList.getRollExtent().equals(0D)){ - throw new CoolException("瑙勬牸锛�"+matList.getMatnr()+"銆佸弬鏁帮細鍗烽暱搴� rollExtent"); - } +// }else if (Cools.isEmpty(matList.getPosition())){ +// throw new CoolException("瑙勬牸锛�"+matList.getMatnr()+"銆佸弬鏁帮細鐮佸灈浣嶇疆 position涓虹┖"); +// }else if (Cools.isEmpty(matList.getBatch())){ +// throw new CoolException("瑙勬牸锛�"+matList.getMatnr()+"銆佸弬鏁帮細鏈ㄧ缂栧彿 batch涓虹┖"); +// }else if (Cools.isEmpty(matList.getModel())){ +// throw new CoolException("瑙勬牸锛�"+matList.getMatnr()+"銆佸弬鏁帮細鍗峰彿 model涓虹┖"); +// }else if (Cools.isEmpty(matList.getBatch())){ +// throw new CoolException("瑙勬牸锛�"+matList.getMatnr()+"銆佸弬鏁帮細鏈ㄧ缂栧彿 boxNo涓虹┖"); +// }else if (Cools.isEmpty(matList.getWeight()) || matList.getWeight().equals(0D)){ +// throw new CoolException("瑙勬牸锛�"+matList.getMatnr()+"銆佸弬鏁帮細鍑�閲� weight涓虹┖"); +// }else if (Cools.isEmpty(matList.getRoughWeight()) || matList.getRoughWeight().equals(0D)){ +// throw new CoolException("瑙勬牸锛�"+matList.getMatnr()+"銆佸弬鏁帮細姣涢噸 roughWeight"); +// }else if (Cools.isEmpty(matList.getRollExtent()) || matList.getRollExtent().equals(0D)){ +// throw new CoolException("瑙勬牸锛�"+matList.getMatnr()+"銆佸弬鏁帮細鍗烽暱搴� rollExtent"); +// } // else if (Cools.isEmpty(matList.getJoint()) || matList.getJoint()==0){ // throw new CoolException("瑙勬牸锛�"+matList.getMatnr()+"銆佸弬鏁帮細鎺ュご鏁� joint"); + } + +// if (matList.getPosition().equals("1")){//1銆佸乏 2銆佸彸 +// if (!matnrOne.equals("")){ +// if (!matnrOne.equals(matList.getMatnr())){ +// throw new CoolException("鏈ㄧ浣嶇疆锛�"+matList.getPosition()+"瀛樺湪涓嶅悓瑙勬牸鍗蜂俊鎭�"); +// } +// }else { +// matnrOne=matList.getMatnr(); +// } +// }else if (matList.getPosition().equals("2")){ +// if (!matnrTwo.equals("")){ +// if (!matnrTwo.equals(matList.getMatnr())){ +// throw new CoolException("鏈ㄧ浣嶇疆锛�"+matList.getPosition()+"瀛樺湪涓嶅悓瑙勬牸鍗蜂俊鎭�"); +// } +// }else { +// matnrTwo=matList.getMatnr(); +// } +// }else { +// throw new CoolException("鍙傛暟锛氭湪绠辩紪鍙� boxNo:"+matList.getBatch()+",鏈ㄧ浣嶇疆閿欒锛�"+matList.getPosition()); // } - - if (matList.getPosition().equals("1")){//1銆佸乏 2銆佸彸 - if (!matnrOne.equals("")){ - if (!matnrOne.equals(matList.getMatnr())){ - throw new CoolException("鏈ㄧ浣嶇疆锛�"+matList.getPosition()+"瀛樺湪涓嶅悓瑙勬牸鍗蜂俊鎭�"); - } - }else { - matnrOne=matList.getMatnr(); - } - }else if (matList.getPosition().equals("2")){ - if (!matnrTwo.equals("")){ - if (!matnrTwo.equals(matList.getMatnr())){ - throw new CoolException("鏈ㄧ浣嶇疆锛�"+matList.getPosition()+"瀛樺湪涓嶅悓瑙勬牸鍗蜂俊鎭�"); - } - }else { - matnrTwo=matList.getMatnr(); - } - }else { - throw new CoolException("鍙傛暟锛氭湪绠辩紪鍙� boxNo:"+matList.getBatch()+",鏈ㄧ浣嶇疆閿欒锛�"+matList.getPosition()); - } - - if (!boxNos.contains(matList.getBatch())){ - boxNos.add(matList.getBatch()); - }else { - throw new CoolException("鍙傛暟锛氭湪绠辩紪鍙� boxNo:"+matList.getBatch()+",鏈ㄧ缂栫爜瀛樺湪閲嶅"); - } +// +// if (!boxNos.contains(matList.getBatch())){ +// boxNos.add(matList.getBatch()); +// }else { +// throw new CoolException("鍙傛暟锛氭湪绠辩紪鍙� boxNo:"+matList.getBatch()+",鏈ㄧ缂栫爜瀛樺湪閲嶅"); +// } } // BasDevp basDevp = basDevpService.selectById(Integer.parseInt(param.getDevNo$())); diff --git a/src/main/java/com/zy/asrs/utils/Utils.java b/src/main/java/com/zy/asrs/utils/Utils.java index 1f40a61..2adeca1 100644 --- a/src/main/java/com/zy/asrs/utils/Utils.java +++ b/src/main/java/com/zy/asrs/utils/Utils.java @@ -218,15 +218,36 @@ // System.out.println(deepRow); // } - public static boolean BooleanWhsTypeSta(Integer whsType) { + public static Integer GetWhsType(Integer sourceStaNo) { + switch (sourceStaNo){ + case 104: + case 173: + case 174: + case 175: + case 130: + case 125: + return 5; + default: + return 0; + } + } + + public static boolean BooleanWhsTypeStaIoType(Integer whsType) { if (whsType == 1) { return true; } return false; } + public static boolean BooleanWhsTypeSta(Integer whsType) { + if (whsType == 1 || whsType == 5) { + return true; + } + return false; + } + public static boolean BooleanWhsTypeSta(Integer whsType, Integer staDescId) { - if (whsType == 1 && staDescId != 11 && staDescId != 111) { + if ((whsType == 1 || whsType == 5) && staDescId != 11 && staDescId != 111) { return true; } return false; @@ -252,7 +273,15 @@ public static int[] LocNecessaryParameters(Integer whsType, Integer curRow, Integer crnNumber) { switch (whsType){ case 1://缁忓吀鍙屼几搴撲綅 - return LocNecessaryParametersDoubleExtension(whsType, curRow, crnNumber); + return LocNecessaryParametersDoubleExtension(whsType, curRow, crnNumber); //宸插畬鍠� +// case 2://缁忓吀鍗曚几搴撲綅 +// return LocNecessaryParametersDoubleExtension1(whsType, curRow, crnNumber); //鏈畬鍠� +// case 3://缁忓吀鍗曞弻浼稿簱浣� 宸﹀崟鍙冲弻 +// return LocNecessaryParametersDoubleExtension2(whsType, curRow, crnNumber); //鏈畬鍠� +// case 4://缁忓吀鍗曞弻浼稿簱浣� 宸﹀弻鍙冲崟 +// return LocNecessaryParametersDoubleExtension3(whsType, curRow, crnNumber); //鏈畬鍠� + case 5://鍙屽伐浣嶅崟浼稿簱浣� + return LocNecessaryParametersDoubleExtension5(whsType, curRow, crnNumber); //鏈畬鍠� default: return LocNecessaryParametersMove(whsType, curRow, crnNumber);//moveCrnNo } @@ -309,6 +338,41 @@ return necessaryParameters; } + //鍙屽伐浣嶅崟浼稿簱浣� + public static int[] LocNecessaryParametersDoubleExtension5(Integer whsType, Integer curRow, Integer crnNumber) { + int[] necessaryParameters = new int[]{0, 0, 0, 0}; + if (BooleanWhsTypeSta(whsType)) { + necessaryParameters[0] = crnNumber; // 杞娆℃暟 + //婊℃澘姝e父鍏ュ簱 + if (curRow.equals(crnNumber * 4)) { + necessaryParameters[1] = 1; //curRow 鏈�娣卞簱浣嶆帓 + necessaryParameters[2] = 1; //crnNo 鍫嗗灈鏈哄彿 + necessaryParameters[3] = 2; //nearRow 鏈�娴呭簱浣嶆帓 + } else if (curRow.equals(crnNumber * 4 - 3)) { + necessaryParameters[1] = 4; //curRow 鏈�娣卞簱浣嶆帓 + necessaryParameters[2] = 1; //crnNo 鍫嗗灈鏈哄彿 + necessaryParameters[3] = 3; //nearRow 鏈�娴呭簱浣嶆帓 + } else { + curRow = curRow + 4; + if (curRow < 1 || curRow > (crnNumber * 4)) { + throw new CoolException("搴撲綅鎺掑彿寮傚父锛氭帓鍙凤細" + curRow); + } + if ((curRow - 1) % 4 == 0) { + necessaryParameters[1] = curRow; //curRow 鏈�娣卞簱浣嶆帓 + necessaryParameters[2] = (curRow + 3) / 4; //crnNo 鍫嗗灈鏈哄彿 + necessaryParameters[3] = curRow + 1; //nearRow 鏈�娴呭簱浣嶆帓 + } else if (curRow % 4 == 0) { + necessaryParameters[1] = curRow; //curRow 鏈�娣卞簱浣嶆帓 + necessaryParameters[2] = curRow / 4; //crnNo 鍫嗗灈鏈哄彿 + necessaryParameters[3] = curRow - 1; //nearRow 鏈�娴呭簱浣嶆帓 + } else { + throw new CoolException("搴撲綅鎺掑彿寮傚父锛氭帓鍙凤細" + curRow); + } + } + } + return necessaryParameters; + } + public static void main(String[] args) { List<LocMast> locS = new ArrayList<LocMast>(); diff --git a/src/main/java/com/zy/common/service/CommonService.java b/src/main/java/com/zy/common/service/CommonService.java index d64c6a9..dd50652 100644 --- a/src/main/java/com/zy/common/service/CommonService.java +++ b/src/main/java/com/zy/common/service/CommonService.java @@ -119,6 +119,7 @@ */ @Transactional public StartupDto getLocNo(Integer whsType, Integer staDescId, Integer sourceStaNo, String matnr, String batch, String grade, LocTypeDto locTypeDto) { + whsType = Utils.GetWhsType(sourceStaNo); return getLocNoRun(whsType,staDescId,sourceStaNo,matnr,batch,grade,0,locTypeDto,0); } @@ -172,7 +173,7 @@ } //姝ょ▼搴忕敤浜庝紭鍖栧爢鍨涙満寮傚父鏃剁殑杩愯鏃堕棿 - for (int i = times; i < crnNumber; i++) { + for (int i = times; i < crnNumber*2; i++) { int[] locNecessaryParameters = Utils.LocNecessaryParameters(whsType, curRow, crnNumber); curRow = locNecessaryParameters[1]; crnNo = locNecessaryParameters[2]; @@ -198,58 +199,60 @@ boolean signRule2 = false; - // 闈犺繎鎽嗘斁瑙勫垯 --- 鍚屽ぉ鍚岃鏍肩墿鏂� //鍒嗙鐗� -// if (!Cools.isEmpty(matnr) && (staDescId == 1)){ -// signRule1 = true; -// } -// // 闈犺繎鎽嗘斁瑙勫垯 --- 鍚屽ぉ鍚岃鏍肩墿鏂� //浜掗�氱増 -// if (!Cools.isEmpty(matnr) && staDescId == 1) { -// signRule2 = true; -// } -// -// if (!Cools.isEmpty(matnr) && (staDescId == 11 || staDescId == 111)) { -// signRule1 = true; -// } -// -// if (signRule1){ -// List<LocMast> locMasts = locMastService.selectList(new EntityWrapper<LocMast>().eq("row1", nearRow).eq("loc_sts", "O")); -// for (LocMast locMast1:locMasts){ -// if (VersionUtils.locMoveCheckLocTypeComplete(locMast1, locTypeDto)) { -// continue; -// } -// String shallowLoc = Utils.getDeepLoc(slaveProperties,locMast1.getLocNo()); -// LocMast locMast2 = locMastService.selectById(shallowLoc); -// if (!Cools.isEmpty(locMast2) && locMast2.getLocSts().equals("F")){ -// LocDetl locDetl = locDetlService.selectOne(new EntityWrapper<LocDetl>().eq("loc_no", locMast2.getLocNo())); -// if (!Cools.isEmpty(locDetl) && matnr.equals(locDetl.getMatnr())) { -// locMast = locMast1; -// break; -// } -// } -// } -// }else if (signRule2){ -// List<String> locNos = locDetlService.getSameDetlToday(matnr, sRow, eRow); -// for (String locNo : locNos) { -// if (Utils.isShallowLoc(slaveProperties, locNo)) { -// continue; -// } -// String shallowLocNo = Utils.getShallowLoc(slaveProperties, locNo); -// // 妫�娴嬬洰鏍囧簱浣嶆槸鍚︿负绌哄簱浣� -// LocMast shallowLoc = locMastService.selectById(shallowLocNo); -// if (shallowLoc != null && shallowLoc.getLocSts().equals("O")) { -// if (VersionUtils.locMoveCheckLocTypeComplete(shallowLoc, locTypeDto)) { -// if (basCrnpService.checkSiteError(shallowLoc.getCrnNo(), true)) { -// locMast = shallowLoc; -// crnNo = locMast.getCrnNo(); -// break; -// } -// } -// } -// } -// } + if (Utils.BooleanWhsTypeStaIoType(whsType)){ + // 闈犺繎鎽嗘斁瑙勫垯 --- 鍚屽ぉ鍚岃鏍肩墿鏂� //鍒嗙鐗� + if (!Cools.isEmpty(matnr) && (staDescId == 1)){ + signRule1 = true; + } + // 闈犺繎鎽嗘斁瑙勫垯 --- 鍚屽ぉ鍚岃鏍肩墿鏂� //浜掗�氱増 + if (!Cools.isEmpty(matnr) && staDescId == 1) { + signRule2 = true; + } + + if (!Cools.isEmpty(matnr) && (staDescId == 11 || staDescId == 111)) { + signRule1 = true; + } + } + + if (signRule1){ + List<LocMast> locMasts = locMastService.selectList(new EntityWrapper<LocMast>().eq("row1", nearRow).eq("loc_sts", "O")); + for (LocMast locMast1:locMasts){ + if (VersionUtils.locMoveCheckLocTypeComplete(locMast1, locTypeDto)) { + continue; + } + String shallowLoc = Utils.getDeepLoc(slaveProperties,locMast1.getLocNo()); + LocMast locMast2 = locMastService.selectById(shallowLoc); + if (!Cools.isEmpty(locMast2) && locMast2.getLocSts().equals("F")){ + LocDetl locDetl = locDetlService.selectOne(new EntityWrapper<LocDetl>().eq("loc_no", locMast2.getLocNo())); + if (!Cools.isEmpty(locDetl) && matnr.equals(locDetl.getMatnr())) { + locMast = locMast1; + break; + } + } + } + }else if (signRule2){ + List<String> locNos = locDetlService.getSameDetlToday(matnr, sRow, eRow); + for (String locNo : locNos) { + if (Utils.isShallowLoc(slaveProperties, locNo)) { + continue; + } + String shallowLocNo = Utils.getShallowLoc(slaveProperties, locNo); + // 妫�娴嬬洰鏍囧簱浣嶆槸鍚︿负绌哄簱浣� + LocMast shallowLoc = locMastService.selectById(shallowLocNo); + if (shallowLoc != null && shallowLoc.getLocSts().equals("O")) { + if (VersionUtils.locMoveCheckLocTypeComplete(shallowLoc, locTypeDto)) { + if (basCrnpService.checkSiteError(shallowLoc.getCrnNo(), true)) { + locMast = shallowLoc; + crnNo = locMast.getCrnNo(); + break; + } + } + } + } + } // // 闈犺繎鎽嗘斁瑙勫垯 --- 绌烘墭 //鍒嗙鐗� -// if (staDescId == 10) { +// if (staDescId == 10 && Utils.BooleanWhsTypeStaIoType(whsType)) { // List<LocMast> locMasts = locMastService.selectList(new EntityWrapper<LocMast>().eq("row1", nearRow).eq("loc_sts", "O")); // for (LocMast locMast1:locMasts){ // if (VersionUtils.locMoveCheckLocTypeComplete(locMast1, locTypeDto)) { @@ -264,29 +267,29 @@ // } // } -// // 闈犺繎鎽嗘斁瑙勫垯 --- 绌烘墭 //浜掗�氱増 -// if (staDescId == 10) { -// List<LocMast> locMasts = locMastService.selectList(new EntityWrapper<LocMast>().eq("loc_sts", "D").ge("row1", sRow).le("row1", eRow)); -// if (locMasts.size() > 0) { -// for (LocMast loc : locMasts) { -// if (Utils.isShallowLoc(slaveProperties, loc.getLocNo())) { -// continue; -// } -// String shallowLocNo = Utils.getShallowLoc(slaveProperties, loc.getLocNo()); -// // 妫�娴嬬洰鏍囧簱浣嶆槸鍚︿负绌哄簱浣� -// LocMast shallowLoc = locMastService.selectById(shallowLocNo); -// if (shallowLoc != null && shallowLoc.getLocSts().equals("O")) { -// if (VersionUtils.locMoveCheckLocTypeComplete(shallowLoc, locTypeDto)) { -// if (basCrnpService.checkSiteError(shallowLoc.getCrnNo(), true)) { -// locMast = shallowLoc; -// crnNo = locMast.getCrnNo(); -// break; -// } -// } -// } -// } -// } -// } + // 闈犺繎鎽嗘斁瑙勫垯 --- 绌烘墭 //浜掗�氱増 + if (staDescId == 10 && Utils.BooleanWhsTypeStaIoType(whsType)) { + List<LocMast> locMasts = locMastService.selectList(new EntityWrapper<LocMast>().eq("loc_sts", "D").ge("row1", sRow).le("row1", eRow)); + if (locMasts.size() > 0) { + for (LocMast loc : locMasts) { + if (Utils.isShallowLoc(slaveProperties, loc.getLocNo())) { + continue; + } + String shallowLocNo = Utils.getShallowLoc(slaveProperties, loc.getLocNo()); + // 妫�娴嬬洰鏍囧簱浣嶆槸鍚︿负绌哄簱浣� + LocMast shallowLoc = locMastService.selectById(shallowLocNo); + if (shallowLoc != null && shallowLoc.getLocSts().equals("O")) { + if (VersionUtils.locMoveCheckLocTypeComplete(shallowLoc, locTypeDto)) { + if (basCrnpService.checkSiteError(shallowLoc.getCrnNo(), true)) { + locMast = shallowLoc; + crnNo = locMast.getCrnNo(); + break; + } + } + } + } + } + } Wrapper<StaDesc> wrapper = null; StaDesc staDesc = null; @@ -344,9 +347,9 @@ // 閫掑綊鏌ヨ if (Cools.isEmpty(locMast) || !locMast.getLocSts().equals("O")) { // 褰撳墠宸烽亾鏃犵┖搴撲綅鏃讹紝閫掑綊璋冩暣鑷充笅涓�宸烽亾锛屾绱㈠叏閮ㄥ贩閬撴棤鏋滃悗锛岃烦鍑洪�掑綊 - if (times < rowCount) { + if (times < rowCount*2) { times = times + 1; - return getLocNoRun(1, staDescId, sourceStaNo, matnr, batch, grade,moveCrnNo, locTypeDto, times); + return getLocNoRun(whsType, staDescId, sourceStaNo, matnr, batch, grade,moveCrnNo, locTypeDto, times); } // // 2.搴撲綅褰撳墠鎵�灞炲昂瀵告棤绌哄簱浣嶆椂锛岃皟鏁村昂瀵稿弬鏁帮紝鍚戜笂鍏煎妫�绱㈠簱浣� // if (locTypeDto.getLocType1() < 2) { -- Gitblit v1.9.1