| | |
| | | import com.zy.asrs.mapper.WrkMastMapper; |
| | | import com.zy.asrs.service.*; |
| | | import com.zy.asrs.utils.Utils; |
| | | import com.zy.common.service.CommonService; |
| | | import com.zy.core.CrnThread; |
| | | import com.zy.core.DevpThread; |
| | | import com.zy.core.cache.MessageQueue; |
| | |
| | | import com.zy.core.properties.SlaveProperties; |
| | | import com.zy.core.thread.BarcodeThread; |
| | | import com.zy.core.thread.SiemensDevpThread; |
| | | import com.zy.system.service.ConfigService; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | |
| | | |
| | | |
| | | @Autowired |
| | | private CommonService commonService; |
| | | |
| | | @Autowired |
| | | private ToWmsService toWmsService; |
| | | |
| | | |
| | |
| | | private CrnController crnController; |
| | | |
| | | @Autowired |
| | | private ConfigService configService; |
| | | private TransferTaskService transferTaskService; |
| | | |
| | | |
| | | public void generateStoreWrkFile1() throws IOException, InterruptedException { |
| | | try { |
| | |
| | | try { |
| | | // 根据输送线plc遍历 |
| | | for (DevpSlave devp : slaveProperties.getDevp()) { |
| | | if (devp.getId() == 2) { |
| | | continue; |
| | | } |
| | | SiemensDevpThread devpThread = (SiemensDevpThread) SlaveConnection.get(SlaveType.Devp, devp.getId()); |
| | | for (DevpSlave.Sta inSta : devp.getInSta()) { |
| | | WrkMast pakout = wrkMastMapper.selectWorkingPakout(inSta.getBackSta()); |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 转移任务下发 |
| | | */ |
| | | public void transferTaskStart() { |
| | | |
| | | for (DevpSlave.Sta sta : slaveProperties.getDevp().get(1).getInSta()) { |
| | | try { |
| | | // 获取入库站信息 |
| | | DevpThread devpThread = (DevpThread) SlaveConnection.get(SlaveType.Devp, 2); |
| | | StaProtocol staProtocol = devpThread.getStation().get(sta.getStaNo()); |
| | | if (staProtocol == null) { |
| | | continue; |
| | | } else { |
| | | staProtocol = staProtocol.clone(); |
| | | } |
| | | if (staProtocol.isAutoing() && staProtocol.isLoading() && (staProtocol.getWorkNo() == 0 || staProtocol.getStaNo() == 0)) { |
| | | // 查询工作档 |
| | | TransferTask transferTask = transferTaskService.selectByStartPoint(sta.getStaNo()); |
| | | if (transferTask == null) { |
| | | continue; |
| | | } |
| | | log.info("下发输送线转移任务:taskWrk:" + JSON.toJSONString(transferTask)); |
| | | staProtocol.setWorkNo(transferTask.getWrkNo().shortValue()); |
| | | staProtocol.setStaNo(transferTask.getTargetPoint().shortValue()); |
| | | boolean offer = false; |
| | | try { |
| | | offer = MessageQueue.offer(SlaveType.Devp, 1, new Task(2, staProtocol)); |
| | | } catch (Exception e) { |
| | | log.error("下发输送线转移任务:异常:" + e); |
| | | log.error("下发输送线转移任务:异常:offer:" + offer); |
| | | } |
| | | if (offer) { |
| | | log.info("下发输送线任务成功:taskWrk:" + JSON.toJSONString(transferTask)); |
| | | transferTask.setStatus(2); |
| | | transferTaskService.updateById(transferTask); |
| | | } else { |
| | | log.error("下发输送线任务失败:taskWrk:" + JSON.toJSONString(transferTask)); |
| | | } |
| | | } |
| | | } catch (Exception e) { |
| | | log.error("转移任务异常:异常信息:" + e); |
| | | } |
| | | } |
| | | |
| | | } |
| | | |
| | | /** |
| | | * 转移任务完成 |
| | | */ |
| | | public void transferTaskEnd() { |
| | | for (DevpSlave.Sta sta : slaveProperties.getDevp().get(1).getInSta()) { |
| | | try { |
| | | // 获取终点站 |
| | | DevpThread devpThread = (DevpThread) SlaveConnection.get(SlaveType.Devp, 2); |
| | | StaProtocol staProtocol = devpThread.getStation().get(sta.getOverSta()); |
| | | if (staProtocol == null) { |
| | | continue; |
| | | } else { |
| | | staProtocol = staProtocol.clone(); |
| | | } |
| | | if (staProtocol.isAutoing() && staProtocol.isLoading() && (staProtocol.getWorkNo() == 0 || staProtocol.getStaNo() == 0)) { |
| | | // 查询工作档 |
| | | TransferTask transferTask = transferTaskService.selectByEndPoint(sta.getStaNo()); |
| | | if (transferTask == null) { |
| | | continue; |
| | | } |
| | | log.info("转移任务完成:transferTask:" + JSON.toJSONString(transferTask)); |
| | | transferTask.setStatus(5); |
| | | transferTaskService.updateById(transferTask); |
| | | } |
| | | } catch (Exception e) { |
| | | log.error("转移任务异常:异常信息:" + e); |
| | | } |
| | | } |
| | | |
| | | } |
| | | |
| | | } |