From cb5092a38a5123bd9da452ad311b9323561802b1 Mon Sep 17 00:00:00 2001 From: zwl <1051256694@qq.com> Date: 星期二, 20 五月 2025 13:55:11 +0800 Subject: [PATCH] # --- src/main/java/com/zy/common/service/CommonService.java | 195 +++++++++++++++++++++++++----------------------- 1 files changed, 100 insertions(+), 95 deletions(-) diff --git a/src/main/java/com/zy/common/service/CommonService.java b/src/main/java/com/zy/common/service/CommonService.java index 98226ab..81a7b5f 100644 --- a/src/main/java/com/zy/common/service/CommonService.java +++ b/src/main/java/com/zy/common/service/CommonService.java @@ -548,105 +548,110 @@ */ public LocMast getLocNo2(WaitPakin waitPakin, Integer[] arr, Integer d, Integer locType, Integer locType1) { LocMast locMast = null; - //涓�.鏌ヨ鍏ュ簱璐х墿鏄惁鏄壒娈婃憜鏀捐揣鐗� - if (locType == 2) { - //鏌ユ壘灞傛爣璁扮殑 - LocMast locMast1 = locMastService.selectOne(new EntityWrapper<LocMast>() - .eq("lev1", arr[d]) - .eq("loc_sts", "O") - .eq("loc_type1", 2) - .eq("loc_attribute", 1)); - if (!Cools.isEmpty(locMast1)) { - locMast = locMast1; - } - } else { - List<LocMast> locMasts = new ArrayList<>(); - //浜�.绌烘爤鏉挎憜鏀捐鍒� - //1.璇ュ眰鐩稿悓绌烘爤鏉� - //2.鑾峰緱locAttribute搴撲綅灞炴�т负1鐨勬墍鏈夊簱浣� - //3.鏌ョ湅缁勯噷鏄惁杩樻湁绌轰綅 - if (locType1 == 2) { - locMasts = locMastService.selectList(new EntityWrapper<LocMast>() - .eq("lev1", arr[d]) - .eq("loc_sts", "D") - .eq("loc_type1", 1) - .eq("loc_attribute", 1)); - if (!Cools.isEmpty(locMasts)) { - for (LocMast locMast1 : locMasts) { - //4.鏌ョ湅璇ョ粍鏄惁鏈夐绾﹀叆搴撳拰棰勭害鍑哄簱鐨勫簱浣嶏紝鏈夌殑璇濈洿鎺ヨ烦杩囪缁� - List<LocMast> locMasts2 = locMastService.selectList(new EntityWrapper<LocMast>() - .eq("group1", locMast1.getGroup1()) - .in("loc_sts", "P", "Q", "R", "S")); - if (!Cools.isEmpty(locMasts2)) { - continue; - } - //5.鎵惧嚭鍚屼竴缁勭殑绌哄簱浣� - //6.瀵规繁娴呭簱浣嶈繘琛屾帓搴� - List<LocMast> locMasts1 = locMastService.selectList(new EntityWrapper<LocMast>() - .eq("group1", locMast1.getGroup1()) - .eq("loc_sts", "O") - .orderBy("locAttribute")); - if (Cools.isEmpty(locMasts1)) { - continue; - } - //7.鏌ョ湅 - locMast = locMasts1.get(0); - } - } - } else { - //涓�.姝e父璐х墿鍏ュ簱 - //1.璇ュ眰鐩稿悓鐗╂枡鎽嗘斁 - //2.鑾峰緱locAttribute搴撲綅灞炴�т负1鐨勬墍鏈夊簱浣� - //3.鏌ョ湅缁勯噷鏄惁杩樻湁绌轰綅 - locMasts = locMastService.querySame(waitPakin.getMatnr(), arr[d]); - if (!Cools.isEmpty(locMasts)) { - for (LocMast locMast1 : locMasts) { - //4.鏌ョ湅璇ョ粍鏄惁鏈夐绾﹀叆搴撳拰棰勭害鍑哄簱鐨勫簱浣嶏紝鏈夌殑璇濈洿鎺ヨ烦杩囪缁� - List<LocMast> locMasts2 = locMastService.selectList(new EntityWrapper<LocMast>() - .eq("group1", locMast1.getGroup1()) - .in("loc_sts", "P", "Q", "R", "S")); - if (!Cools.isEmpty(locMasts2)) { - continue; - } - //5.鎵惧嚭鍚屼竴缁勭殑绌哄簱浣� - //6.瀵规繁娴呭簱浣嶈繘琛屾帓搴� - List<LocMast> locMasts1 = locMastService.selectList(new EntityWrapper<LocMast>() - .eq("group1", locMast1.getGroup1()) - .eq("loc_sts", "O") - .orderBy("locAttribute")); - if (Cools.isEmpty(locMasts1)) { - continue; - } - //7.鏌ョ湅 - locMast = locMasts1.get(0); - } - } - - } - //鍥�.娌℃湁鐩稿悓鐗╂枡锛岃繘琛屾甯告壘搴� - if (Cools.isEmpty(locMast)) { - //鏌ユ壘璇ュ眰鎵�鏈夌┖鐨�"loc_attribute",1 - List<LocMast> locMastList = locMastService.selectList(new EntityWrapper<LocMast>() + try { + //涓�.鏌ヨ鍏ュ簱璐х墿鏄惁鏄壒娈婃憜鏀捐揣鐗� + if (locType == 2) { + //鏌ユ壘灞傛爣璁扮殑 + LocMast locMast1 = locMastService.selectOne(new EntityWrapper<LocMast>() .eq("lev1", arr[d]) .eq("loc_sts", "O") - .eq("loc_type1", 1) - .eq("loc_attribute", 1) - .orderBy("row1", false) - .orderBy("bay1", false)); - if (!Cools.isEmpty(locMastList)) { - locMast = locMastList.get(0); + .eq("loc_type1", 2) + .eq("loc_attribute", 1)); + if (!Cools.isEmpty(locMast1)) { + locMast = locMast1; + } + } else { + List<LocMast> locMasts = new ArrayList<>(); + //浜�.绌烘爤鏉挎憜鏀捐鍒� + //1.璇ュ眰鐩稿悓绌烘爤鏉� + //2.鑾峰緱locAttribute搴撲綅灞炴�т负1鐨勬墍鏈夊簱浣� + //3.鏌ョ湅缁勯噷鏄惁杩樻湁绌轰綅 + if (locType1 == 2) { + locMasts = locMastService.selectList(new EntityWrapper<LocMast>() + .eq("lev1", arr[d]) + .eq("loc_sts", "D") + .eq("loc_type1", 1) + .eq("loc_attribute", 1)); + if (!Cools.isEmpty(locMasts)) { + for (LocMast locMast1 : locMasts) { + //4.鏌ョ湅璇ョ粍鏄惁鏈夐绾﹀叆搴撳拰棰勭害鍑哄簱鐨勫簱浣嶏紝鏈夌殑璇濈洿鎺ヨ烦杩囪缁� + List<LocMast> locMasts2 = locMastService.selectList(new EntityWrapper<LocMast>() + .eq("group1", locMast1.getGroup1()) + .in("loc_sts", "P", "Q", "R", "S")); + if (!Cools.isEmpty(locMasts2)) { + continue; + } + //5.鎵惧嚭鍚屼竴缁勭殑绌哄簱浣� + //6.瀵规繁娴呭簱浣嶈繘琛屾帓搴� + List<LocMast> locMasts1 = locMastService.selectList(new EntityWrapper<LocMast>() + .eq("group1", locMast1.getGroup1()) + .eq("loc_sts", "O") + .orderBy("locAttribute")); + if (Cools.isEmpty(locMasts1)) { + continue; + } + //7.鏌ョ湅 + locMast = locMasts1.get(0); + } + } + } else { + //涓�.姝e父璐х墿鍏ュ簱 + //1.璇ュ眰鐩稿悓鐗╂枡鎽嗘斁 + //2.鑾峰緱locAttribute搴撲綅灞炴�т负1鐨勬墍鏈夊簱浣� + //3.鏌ョ湅缁勯噷鏄惁杩樻湁绌轰綅 + locMasts = locMastService.querySame(waitPakin.getMatnr(), arr[d]); + if (!Cools.isEmpty(locMasts)) { + for (LocMast locMast1 : locMasts) { + //4.鏌ョ湅璇ョ粍鏄惁鏈夐绾﹀叆搴撳拰棰勭害鍑哄簱鐨勫簱浣嶏紝鏈夌殑璇濈洿鎺ヨ烦杩囪缁� + List<LocMast> locMasts2 = locMastService.selectList(new EntityWrapper<LocMast>() + .eq("group1", locMast1.getGroup1()) + .in("loc_sts", "P", "Q", "R", "S")); + if (!Cools.isEmpty(locMasts2)) { + continue; + } + //5.鎵惧嚭鍚屼竴缁勭殑绌哄簱浣� + //6.瀵规繁娴呭簱浣嶈繘琛屾帓搴� + List<LocMast> locMasts1 = locMastService.selectList(new EntityWrapper<LocMast>() + .eq("group1", locMast1.getGroup1()) + .eq("loc_sts", "O") + .orderBy("locAttribute")); + if (Cools.isEmpty(locMasts1)) { + continue; + } + //7.鏌ョ湅 + locMast = locMasts1.get(0); + } + } + + } + //鍥�.娌℃湁鐩稿悓鐗╂枡锛岃繘琛屾甯告壘搴� + if (Cools.isEmpty(locMast)) { + //鏌ユ壘璇ュ眰鎵�鏈夌┖鐨�"loc_attribute",1 + List<LocMast> locMastList = locMastService.selectList(new EntityWrapper<LocMast>() + .eq("lev1", arr[d]) + .eq("loc_sts", "O") + .eq("loc_type1", 1) + .eq("loc_attribute", 1) + .orderBy("row1", false) + .orderBy("bay1", false)); + if (!Cools.isEmpty(locMastList)) { + locMast = locMastList.get(0); + } + } + //璇ュ眰娌℃湁鎵惧埌搴撲綅鏃惰繘鍏ラ�掑綊鎹㈠眰鎵惧簱浣� + if (Cools.isEmpty(locMast)) { + ++d; + if (d > 6) { + throw new CoolException("娌℃湁绌哄簱浣�"); + } + if (d == 6 && locType == 2) { + return getLocNo2(waitPakin, arr, 0, 1, locType1); + } + return getLocNo2(waitPakin, arr, d, locType, locType1); } } - //璇ュ眰娌℃湁鎵惧埌搴撲綅鏃惰繘鍏ラ�掑綊鎹㈠眰鎵惧簱浣� - if (Cools.isEmpty(locMast)) { - if (d > 6) { - throw new CoolException("娌℃湁绌哄簱浣�"); - } - if (d == 6 && locType == 2) { - return getLocNo2(waitPakin, arr, 0, 1, locType1); - } - return getLocNo2(waitPakin, arr, d++, locType, locType1); - } + } catch (Exception e) { + e.printStackTrace(); } return locMast; } -- Gitblit v1.9.1