From 13610d4b55fb5d2871a4f12e3e8df4ab86bf33f7 Mon Sep 17 00:00:00 2001 From: lsh <lsh@163.com> Date: 星期四, 17 十月 2024 16:01:55 +0800 Subject: [PATCH] * --- src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java | 78 +++++++++++++++++++++++++++++++++++++++ 1 files changed, 78 insertions(+), 0 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 c05f38f..3e6f610 100644 --- a/src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java +++ b/src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java @@ -1,9 +1,36 @@ package com.zy.asrs.service.impl; +import com.alibaba.fastjson.JSON; +import com.core.common.Cools; +import com.zy.asrs.entity.BasRgv; +import com.zy.asrs.entity.BasSte; +import com.zy.asrs.service.BasDevpService; +import com.zy.asrs.utils.Utils; +import com.zy.core.DevpThread; +import com.zy.core.News; +import com.zy.core.cache.MessageQueue; +import com.zy.core.cache.SlaveConnection; +import com.zy.core.enums.*; +import com.zy.core.model.DevpSlave; +import com.zy.core.model.RgvSlave; +import com.zy.core.model.SteSlave; +import com.zy.core.model.Task; +import com.zy.core.model.command.SteCommand; +import com.zy.core.model.protocol.RgvProtocol; +import com.zy.core.model.protocol.StaProtocol; +import com.zy.core.model.protocol.SteProtocol; +import com.zy.core.properties.SlaveProperties; +import com.zy.core.thread.RgvThread; +import com.zy.core.thread.SiemensDevpThread; +import com.zy.core.thread.SteThread; import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; + +import java.util.Date; +import java.util.Map; /** * 绔嬩綋浠撳簱WCS绯荤粺涓绘祦绋嬩笟鍔� @@ -14,4 +41,55 @@ @Transactional public class MainServiceImpl { + @Autowired + private SlaveProperties slaveProperties; + @Autowired + private BasDevpService basDevpService; + @Autowired + private BasRgvServiceImpl basRgvService; + /** + * 绔欑偣浠诲姟妫�娴� 涓嬪彂灏忚溅鍙栨斁浠诲姟 + */ + public synchronized void updateStePosition() { + + } + /** + * 绔欑偣浠诲姟妫�娴� 涓嬪彂灏忚溅鍙栨斁浠诲姟 + */ + public synchronized void DevpTaskNoRun() { + for (DevpSlave devp : slaveProperties.getDevp()) { + // 閬嶅巻绌烘澘鍏ュ簱鍙� + for (DevpSlave.Sta sta : devp.getInSta()) { + // 鑾峰彇绌烘澘鍏ュ簱绔欎俊鎭� + SiemensDevpThread devpThread = (SiemensDevpThread) SlaveConnection.get(SlaveType.Devp, devp.getId()); + StaProtocol staProtocol = devpThread.getStation().get(sta.getStaNo()); + if (staProtocol == null) { + continue; + } else { + staProtocol = staProtocol.clone(); + } + } + } + } + + public synchronized void loopSteCharge() { + for (RgvSlave rgv : slaveProperties.getRgv()) { + RgvThread rgvThread = (RgvThread) SlaveConnection.get(SlaveType.Rgv, rgv.getId()); + RgvProtocol rgvProtocol = rgvThread.getRgvProtocol(); + BasRgv basRgv = basRgvService.selectById(rgv.getId()); + if (Cools.isEmpty(rgvProtocol, basRgv)) { continue; } + try { + // 鍦ㄧ嚎 绌洪棽 鏃犱綔涓氭爣璁� 涓嶅湪鍏呯數 + if (rgvProtocol.getMode() == 0 + || !rgvProtocol.statusType.equals(RgvStatusType.IDLE) + || basRgv.getPakMk().equals("Y") +// || steProtocol.getChargeStatus() == 1 + ) { + continue; + } + } catch (Exception e) { + News.error("fail", e); + } + } + } } -- Gitblit v1.9.1