| | |
| | | package com.zy.acs.conveyor.core.operation.handler; |
| | | |
| | | import com.zy.acs.conveyor.core.cache.MessageQueue; |
| | | import com.zy.acs.conveyor.core.cache.SlaveConnection; |
| | | import com.zy.acs.common.utils.RedisSupport; |
| | | import com.zy.acs.conveyor.core.constant.RedisConveyorConstant; |
| | | import com.zy.acs.conveyor.core.enums.ConveyorStateType; |
| | | import com.zy.acs.conveyor.core.enums.SlaveType; |
| | | import com.zy.acs.conveyor.core.enums.TaskType; |
| | | import com.zy.acs.conveyor.core.model.Task; |
| | | import com.zy.acs.conveyor.core.model.protocol.StaProtocol; |
| | | import com.zy.acs.conveyor.core.model.StaProtocol; |
| | | import com.zy.acs.conveyor.core.operation.OperationHandler; |
| | | import com.zy.acs.conveyor.core.properties.CtuOperationConfig; |
| | | import com.zy.acs.conveyor.core.properties.SlaveProperties; |
| | | import com.zy.acs.conveyor.core.thread.SiemensDevpThread; |
| | | import com.zy.acs.conveyor.core.service.StationService; |
| | | import com.zy.acs.conveyor.entity.Job; |
| | | import com.zy.acs.conveyor.service.JobService; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Component; |
| | | import org.springframework.transaction.interceptor.TransactionAspectSupport; |
| | | |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * 模拟用户按按钮 |
| | |
| | | private JobService jobService; |
| | | |
| | | |
| | | @Autowired |
| | | private StationService stationService; |
| | | |
| | | private final RedisSupport redis = RedisSupport.defaultRedisSupport; |
| | | |
| | | |
| | | @Override |
| | | public ConveyorStateType getType() { |
| | | return ConveyorStateType.FAKEUSER; |
| | |
| | | |
| | | try { |
| | | // 根据输送线plc遍历 |
| | | SiemensDevpThread devpThread = (SiemensDevpThread) SlaveConnection.get(SlaveType.Devp, 1); |
| | | StaProtocol staProtocol = devpThread.getStation().get(1004); |
| | | Map<Integer, StaProtocol> stationMap = stationService.getStationMap(1); |
| | | StaProtocol staProtocol = stationMap.get(1004); |
| | | if (staProtocol == null) { |
| | | return; |
| | | } else { |
| | |
| | | if (!staProtocol.isLoading()) { |
| | | return; |
| | | } |
| | | StaProtocol staProtocol5 = devpThread.getStation().get(1005); |
| | | StaProtocol staProtocol5 = stationMap.get(1005); |
| | | if (staProtocol5.isLoading()) { |
| | | log.info("1005有物,等无物之后才入库"); |
| | | return; |
| | |
| | | if (jobByWorkNo != null && jobByWorkNo.getJobSts() == ConveyorStateType.OUTBOUND.getStatus()) { |
| | | staProtocol.setWorkNo(9992); |
| | | staProtocol.setStaNo(1005); |
| | | boolean result = MessageQueue.offer(SlaveType.Devp, 1, new Task(TaskType.WRITE, staProtocol)); |
| | | if (result) { |
| | | redis.push(RedisConveyorConstant.CONVEYOR_TASK_FLAG, staProtocol); |
| | | |
| | | jobByWorkNo.setJobSts(3); |
| | | jobByWorkNo.setMemo("模拟按按钮"); |
| | | jobService.updateById(jobByWorkNo); |
| | | log.info("入库输送线下发:{},{}", staProtocol.getWorkNo(), 1006); |
| | | } |
| | | |
| | | } |
| | | } |
| | | } catch (Exception e) { |