From fa4f0111f1f4293cc6dc26c94e3198322fdb6ad2 Mon Sep 17 00:00:00 2001 From: Junjie <fallin.jie@qq.com> Date: 星期三, 23 四月 2025 08:43:44 +0800 Subject: [PATCH] # --- src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java | 243 ------------------------------------------------ 1 files changed, 1 insertions(+), 242 deletions(-) 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 40067e5..391da4e 100644 --- a/src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java +++ b/src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java @@ -7,7 +7,6 @@ import com.core.common.R; import com.core.exception.CoolException; import com.zy.asrs.controller.CrnController; -import com.zy.asrs.controller.OpenController; import com.zy.asrs.controller.SiteController; import com.zy.asrs.domain.enums.TaskStatusType; import com.zy.asrs.domain.enums.WorkNoType; @@ -15,7 +14,6 @@ import com.zy.asrs.entity.*; import com.zy.asrs.entity.param.Result; import com.zy.asrs.entity.param.StorageEscalationParam; -import com.zy.asrs.entity.param.TaskOverToWms; import com.zy.asrs.mapper.*; import com.zy.asrs.service.*; import com.zy.asrs.utils.CommandUtils; @@ -30,27 +28,22 @@ import com.zy.core.model.CrnSlave; import com.zy.core.model.DevpSlave; import com.zy.core.model.Task; -import com.zy.core.model.command.CommandPackage; import com.zy.core.model.command.CrnCommand; import com.zy.core.model.protocol.CrnProtocol; import com.zy.core.model.protocol.StaProtocol; import com.zy.core.properties.SlaveProperties; import com.zy.core.thread.BarcodeThread; import com.zy.core.thread.SiemensDevpThread; -import com.zy.system.entity.Config; import com.zy.system.service.ConfigService; -import lombok.Synchronized; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; -import org.springframework.scheduling.annotation.Async; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.interceptor.TransactionAspectSupport; import java.io.IOException; import java.util.*; -import java.util.concurrent.CompletableFuture; /** * 绔嬩綋浠撳簱WCS绯荤粺涓绘祦绋嬩笟鍔� @@ -113,116 +106,6 @@ private CrnController crnController; @Autowired private SiteController siteController; - @Synchronized - public void shiftTargetToCyclePoint() throws IOException, InterruptedException { - try { - for (DevpSlave devp : slaveProperties.getDevp()) { - for (DevpSlave.Sta outSta : devp.getOutSta()) { - DevpThread devpThread = (DevpThread) SlaveConnection.get(SlaveType.Devp, devp.getId()); - if (devpThread == null) { - continue; - } - - StaProtocol staProtocol = getClonedStation(devpThread, outSta.getStaNo()); - if (staProtocol == null) { - continue; - } - - // 鑾峰彇鍏朵粬鐩稿叧绔欑偣 - StaProtocol staProtocol1 = getClonedStation(devpThread, 1001); - StaProtocol staProtocol2 = getClonedStation(devpThread, 1002); - StaProtocol staProtocol3 = getClonedStation(devpThread, 1003); - StaProtocol staProtocol4 = getClonedStation(devpThread, 1004); - StaProtocol staProtocol6 = getClonedStation(devpThread, 111); - - boolean result = false; - switch (outSta.getStaNo()) { - case 105: - result = (staProtocol1 != null && staProtocol1.isLoading() && staProtocol.isLoading() && staProtocol.getStaNo() == 105); - break; - case 107: - result = (staProtocol2 != null && staProtocol2.isLoading()); - break; - case 109: - result = (staProtocol3 != null && staProtocol3.isLoading()); - break; - case 110: - result = ((staProtocol4 != null && staProtocol4.isLoading() && staProtocol.isLoading() && staProtocol.getStaNo() == 110) || - (staProtocol6 != null && staProtocol6.isLoading() && staProtocol.isLoading() && staProtocol.getStaNo() == 111)); - break; - default: - break; - } - - if (result) { - if (staProtocol.getSiteId() == 107 || staProtocol.getSiteId() == 109) { - StaProtocol staProtocol5 = getClonedStation(devpThread, staProtocol.getSiteId() - 1); - if (staProtocol5 != null && (staProtocol5.isLoading() && (staProtocol5.getStaNo() == 107 || staProtocol5.getStaNo() == 109))) { - short workNo = staProtocol5.getWorkNo(); - staProtocol5.setWorkNo(workNo); - staProtocol5.setStaNo((short) 112); - MessageQueue.offer(SlaveType.Devp, devp.getId(), new Task(4, staProtocol5)); - } - } else { - if(staProtocol.isLoading() && (staProtocol.getStaNo() == 105 || staProtocol.getStaNo() == 110 || staProtocol.getStaNo() == 111)){ - short workNo = staProtocol.getWorkNo(); - staProtocol.setWorkNo(workNo); - staProtocol.setStaNo((short) 112); - MessageQueue.offer(SlaveType.Devp, devp.getId(), new Task(4, staProtocol)); - } - } - } - } - } - } catch (Exception e) { - log.error("shiftTargetToCyclePoint error", e); - } - } - - /** - * 鑾峰彇绔欑偣骞跺厠闅� - */ - private StaProtocol getClonedStation(DevpThread devpThread, int staNo) { - StaProtocol staProtocol = devpThread.getStation().get(staNo); - return (staProtocol != null) ? staProtocol.clone() : null; - } - - // 112寰幆绔欑偣鑷冲嚭搴撶珯 - public synchronized void shiftCyclePointToTarget() throws IOException, InterruptedException { - try { - for (DevpSlave devp : slaveProperties.getDevp()) { - DevpThread devpThread = (DevpThread) SlaveConnection.get(SlaveType.Devp, devp.getId()); - if (devpThread == null) { - continue; - } - - StaProtocol staProtocol = devpThread.getStation().get(112); - if (staProtocol.getStaNo() != 112 || staProtocol.getWorkNo() == 0 || !staProtocol.isLoading() || staProtocol.getWorkNo() > 9000 || staProtocol.getWorkNo() < 6000) { - continue; - } - // 鏌ヨ浠诲姟淇℃伅 - TaskWrk taskWrk = taskWrkMapper.selectStaWorking(Integer.valueOf(staProtocol.getWorkNo())); - if (taskWrk == null || taskWrk.getWrkNo() < 6001 || taskWrk.getWrkNo() > 9000) { - continue; - } - - short workNo = staProtocol.getWorkNo(); - // 鍐嶅啓鍏ョ洰鏍囩珯鐐� - staProtocol.setWorkNo(workNo); - staProtocol.setStaNo(Short.valueOf(taskWrk.getTargetPoint())); - MessageQueue.offer(SlaveType.Devp, devp.getId(), new Task(4, staProtocol)); - Thread.sleep(200); - - log.info("Shifted from cycle station 112 to target {}, workNo: {}", taskWrk.getTargetPoint(), workNo); - } - } catch (Exception e) { - log.error("shiftCyclePointToTarget error", e); - } - } - - - - public synchronized void generateStoreWrkFile1() throws IOException, InterruptedException { try { @@ -320,7 +203,7 @@ staProtocol.setStaNo((short)107); }else if (staProtocol.getWorkNo()>=9851&&staProtocol.getWorkNo()<=9875) { staProtocol.setStaNo((short)109); - }else{ + }else if (staProtocol.getWorkNo()>=9876 && staProtocol.getWorkNo() <= 9900){ staProtocol.setStaNo((short)110); } devpThread.setPakMk(staProtocol.getSiteId(), false); @@ -1404,65 +1287,6 @@ // } // } - //agv鍙栨斁璐т换鍔″畬鎴� - public synchronized void autoCompleteAGV() { - List<BasDevp> basDevps = basDevpService.selectList(new EntityWrapper<>()); - try { - Thread.sleep(500); - } catch (Exception e) { - - } - - for (BasDevp basDevp : basDevps) { - DevpThread devpThread = (DevpThread) SlaveConnection.get(SlaveType.Devp, 1); - StaProtocol staProtocol = devpThread.getStation().get(basDevp.getDevNo()); - if (staProtocol == null) { - continue; - } else { - staProtocol = staProtocol.clone(); - } - if (basDevp.getWrkNo() != 0) { - if (basDevp.getAgvTargetPick() != 0) {//鍙栬揣 - staProtocol.setAgvTypeSign((short) 0); - staProtocol.setStaNo(basDevp.getDevNo().shortValue()); - MessageQueue.offer(SlaveType.Devp, 1, new Task(4, staProtocol)); - } - boolean sign = true; - if (basDevp.getAgvTargetPlace() != 0) { - sign = false; - basDevp.setAgvTargetPlace(0); - basDevpService.updateById(basDevp); - staProtocol.setAgvTypeSign((short) 3);//1 - staProtocol.setStaNo(basDevp.getDevNo().shortValue()); - MessageQueue.offer(SlaveType.Devp, 1, new Task(4, staProtocol)); - } - } else { - if (basDevp.getAgvTargetPlace() != 0) { - if (basDevp.getLoading().equals("Y")) { - staProtocol.setAgvTypeSign((short) 1); - staProtocol.setStaNo(basDevp.getDevNo().shortValue()); - MessageQueue.offer(SlaveType.Devp, 1, new Task(4, staProtocol)); - } else { - log.error("AGV鏀捐揣瀹屾垚浣嗚緭閫佺嚎鏃犵墿锛屽浣嶄俊鍙� ===>> [staNo:{}] [basDevp:{}]", basDevp.getDevNo(), basDevp); - basDevp.setAgvTargetPlace(0); - basDevpService.updateById(basDevp); - staProtocol.setAgvTypeSign((short) 3);//1 - staProtocol.setStaNo(basDevp.getDevNo().shortValue()); - MessageQueue.offer(SlaveType.Devp, 1, new Task(4, staProtocol)); - } - - } - if (basDevp.getAgvTargetPick() != 0) { - basDevp.setAgvTargetPick(0); - basDevpService.updateById(basDevp); - staProtocol.setAgvTypeSign((short) 2);//0 - staProtocol.setStaNo(basDevp.getDevNo().shortValue()); - MessageQueue.offer(SlaveType.Devp, 1, new Task(4, staProtocol)); - } - } - } - } - public synchronized void autoCompleteTask() { List<TaskWrk> taskWrks = taskWrkMapper.selectWorkingTask(); for (TaskWrk taskWrk : taskWrks) { @@ -1510,71 +1334,6 @@ locMastService.updateById(locMast); } } - } - - - public synchronized String CrnStartRunning(TaskWrk taskWrk) { - String tasktype = null; - switch (taskWrk.getIoType()) { - case 1: - tasktype = "RK"; - break; - case 2: - tasktype = "CK"; - break; - case 3: - tasktype = "YK"; - break; - default: - tasktype = "鏈煡"; - } - Map<String, Object> map = new HashMap<>(); - map.put("x-api-key", "7a15b5db-29b6-552c-8cff-0cfec3756da2"); - TaskOverToWms taskOverToWms = new TaskOverToWms(); - taskOverToWms.setFeedbackFrom("WCS"); //鏉ユ簮 - taskOverToWms.setWarehouseId("1688469798893297665"); //浠撳簱鏍囪瘑 - taskOverToWms.setTaskNo(taskWrk.getTaskNo()); //浠诲姟鍙� - taskOverToWms.setTaskType(tasktype); // 浠诲姟绫诲瀷 - taskOverToWms.setContainerCode(taskWrk.getBarcode()); // 瀹瑰櫒缂栫爜 - if (taskWrk.getIoType() == 1 || taskWrk.getIoType() == 3) { - taskOverToWms.setEquipmentCode(String.valueOf(taskWrk.getCrnNo())); //璁惧缂栫爜 - taskOverToWms.setTargetLocationCode(taskWrk.getOriginTargetPoint()); //鐩爣搴撲綅 - } else if (taskWrk.getIoType() == 2) { - Map<Integer, String> map1 = new HashMap<>(); - map1.put(102, "J-1101"); - map1.put(106, "J-1103"); - map1.put(110, "J-1105"); - map1.put(114, "J-1107"); - map1.put(118, "J-1109"); - map1.put(122, "J-1111"); - map1.put(305, "H-1101"); - map1.put(405, "G-1101"); - taskOverToWms.setEquipmentCode(map1.get(taskWrk.getTargetPoint())); //璁惧缂栫爜 - taskOverToWms.setSourceLocationCode(taskWrk.getOriginStartPoint()); //婧愬簱浣� - } - - taskOverToWms.setTaskStatus("executing"); //浠诲姟鐘舵�� - String response = null; - try { - response = new HttpHandler.Builder() - .setHeaders(map) - .setUri(wmsUrl) - .setPath("wcsManager/wcsInterface/taskStatusFeedback") - .setJson(JSON.toJSONString(taskOverToWms)) - .build() - .doPost(); - } catch (Exception e) { - log.error("鍫嗗灈鏈轰换鍔″畬鎴愶紝璇锋眰wms浠诲姟瀹屾垚鎺ュ彛澶辫触"); - } - apiLogService.save("鍫嗗灈鏈哄紑濮嬭繍琛�" - , wmsUrl + "wcsManager/wcsInterface/taskStatusFeedback" - , null - , "127.0.0.1" - , JSON.toJSONString(taskOverToWms) - , response - , true - ); - return response; } private TaskWrk createTask1(Result result, String barcode) { -- Gitblit v1.9.1