| | |
| | | import com.zy.core.cache.SlaveConnection; |
| | | import com.zy.core.enums.ConveyorStateType; |
| | | import com.zy.core.enums.SlaveType; |
| | | import com.zy.core.enums.TaskType; |
| | | import com.zy.core.model.DevpSlave; |
| | | import com.zy.core.model.Task; |
| | | import com.zy.core.model.protocol.StaProtocol; |
| | |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Component; |
| | | import org.springframework.transaction.interceptor.TransactionAspectSupport; |
| | | |
| | | import java.util.Date; |
| | | |
| | | /** |
| | | * 入库 |
| | |
| | | SiemensDevpThread devpThread = (SiemensDevpThread) SlaveConnection.get(SlaveType.Devp, devp.getId()); |
| | | StaProtocol staProtocol = devpThread.getStation().get(inSta.getStaNo()); |
| | | if (staProtocol == null) { |
| | | return; |
| | | continue; |
| | | } else { |
| | | staProtocol = staProtocol.clone(); |
| | | } |
| | | // 判断是否满足条件 |
| | | if (!staProtocol.isLoading()) { |
| | | return; |
| | | continue; |
| | | } |
| | | if (staProtocol.getWorkNo() > 0 && staProtocol.isAutoing()) { |
| | | BarcodeThread barcodeThread = (BarcodeThread) SlaveConnection.get(SlaveType.Barcode, devp.getId()); |
| | | String barcode = barcodeThread.getBarcode(); |
| | | if (Cools.isEmpty(barcode)){ |
| | | return; |
| | | if (Cools.isEmpty(barcode)) { |
| | | continue; |
| | | } |
| | | Job job = jobService.getJobByBarcode(barcode); |
| | | if (job != null) { |
| | | Integer targetSta = inSta.getTargetSta(); |
| | | staProtocol.setWorkNo(job.getJobNo()); |
| | | staProtocol.setStaNo(targetSta); |
| | | boolean result = MessageQueue.offer(SlaveType.Devp, 1, new Task(2, staProtocol)); |
| | | boolean result = MessageQueue.offer(SlaveType.Devp, devp.getId(), new Task(TaskType.WRITE, staProtocol)); |
| | | if (result) { |
| | | job.setJobSts(5); |
| | | job.setJobSts(ConveyorStateType.INBOUND.getStatus()); |
| | | job.setStartTime(new Date()); |
| | | if (!jobService.updateById(job)) { |
| | | throw new CoolException("更新输送线任务失败," + " - " + staProtocol.getWorkNo()); |
| | | } |
| | | log.info("" + config.getMark() + "入库前进:{},{}", staProtocol.getWorkNo(), inSta.getTargetSta()); |
| | | log.info("入库前进:{},{}", staProtocol.getWorkNo(), inSta.getTargetSta()); |
| | | } |
| | | } else { |
| | | // 模拟操作逻辑 |
| | | } |
| | | //} |
| | | } |
| | | } |
| | | } |