New file |
| | |
| | | //package com.zy.core; |
| | | // |
| | | //import com.core.exception.CoolException; |
| | | //import com.zy.asrs.entity.LocMast; |
| | | //import com.zy.asrs.entity.WrkMast; |
| | | //import com.zy.asrs.service.WrkMastService; |
| | | //import com.zy.core.cache.MessageQueue; |
| | | //import com.zy.core.cache.SlaveConnection; |
| | | //import com.zy.core.enums.SlaveType; |
| | | //import com.zy.core.model.Task; |
| | | //import com.zy.core.model.protocol.StaProtocol; |
| | | //import org.springframework.beans.factory.annotation.Autowired; |
| | | //import org.springframework.transaction.interceptor.TransactionAspectSupport; |
| | | // |
| | | //import java.util.Date; |
| | | // |
| | | //public class Test { |
| | | // |
| | | // public synchronized void autoEmptyOut() { |
| | | // DevpThread devpThread = (DevpThread) SlaveConnection.get(SlaveType.Devp, 1); |
| | | // Integer autoOutSite = 103; |
| | | // //如果站点可出禁用,则不生成空盘出库任务 |
| | | // StaProtocol staProtocol = devpThread.getStation().get(autoOutSite); |
| | | // if (staProtocol == null) { |
| | | // return; |
| | | // } else { |
| | | // staProtocol = staProtocol.clone(); |
| | | // } |
| | | // if (staProtocol.isAutoing() //自动 |
| | | // && !staProtocol.isLoading() //无物 |
| | | //// && staProtocol.isOutEnable() //可出信号 |
| | | // && staProtocol.getWorkNo() == 0) { |
| | | //// WrkMast pakoutEmpty = wrkMastMapper.selectPakoutEmpty(autoOutSite); |
| | | //// if (null != pakoutEmpty) { |
| | | //// return; |
| | | //// } |
| | | // |
| | | // LocMast locMast = locMastService.getById("0200404"); |
| | | // if (locMast != null && locMast.getLocSts().equalsIgnoreCase("D")) { |
| | | // try { |
| | | // Date now = new Date(); |
| | | // // 保存工作档 |
| | | // WrkMast wrkMast = new WrkMast(); |
| | | // int workNo = commonService.getWorkNo(0); |
| | | // wrkMast.setWrkNo(workNo); |
| | | // wrkMast.setIoTime(now); |
| | | // wrkMast.setWrkSts(11L); // 工作状态:11.生成出库ID |
| | | // wrkMast.setIoType(110); // 入出库状态: 110.空板出库 |
| | | // wrkMast.setIoPri(999D); |
| | | // wrkMast.setSourceStaNo(103); // 源站 |
| | | // wrkMast.setStaNo(0); // 目标站 |
| | | // wrkMast.setCrnNo(1); |
| | | // wrkMast.setSourceLocNo("0200404"); // 源库位 |
| | | // wrkMast.setFullPlt("N"); // 满板:Y |
| | | // wrkMast.setPicking("N"); // 拣料 |
| | | // wrkMast.setExitMk("N"); // 退出 |
| | | // wrkMast.setEmptyMk("Y"); // 空板 |
| | | // wrkMast.setLinkMis("N"); |
| | | // wrkMast.setAppeUser(1L); |
| | | // wrkMast.setTenant(1L); |
| | | // wrkMast.setAppeTime(now); |
| | | // wrkMast.setModiUser(1L); |
| | | // wrkMast.setModiTime(now); |
| | | // wrkMast.setMemo("生成自动空板出库"); |
| | | // boolean res = wrkMastService.save(wrkMast); |
| | | // // 更新库位状态 D.空板 -> R.出库预约 |
| | | // if (locMast.getLocSts().equals("D")) { |
| | | // locMast.setLocSts("R"); |
| | | // locMast.setModiUser(1L); |
| | | // locMast.setModiTime(now); |
| | | // if (!locMastService.updateById(locMast)) { |
| | | // throw new CoolException("更新库位状态失败"); |
| | | // } |
| | | // } |
| | | // } catch (Exception e) { |
| | | // e.printStackTrace(); |
| | | // TransactionAspectSupport.currentTransactionStatus().setRollbackOnly(); |
| | | // } |
| | | // } |
| | | // } |
| | | // } |
| | | // |
| | | // @Autowired |
| | | // private WrkMastService wrkMastService; |
| | | // |
| | | // public synchronized void autoEmptyIn() { |
| | | // DevpThread devpThread = (DevpThread) SlaveConnection.get(SlaveType.Devp, 1); |
| | | // StaProtocol staProtocol = devpThread.getStation().get(103); |
| | | // if (staProtocol == null) { |
| | | // return; |
| | | // } else { |
| | | // staProtocol = staProtocol.clone(); |
| | | // } |
| | | // if (staProtocol.isAutoing() //自动 |
| | | // && staProtocol.isLoading() //有物 |
| | | //// && staProtocol.isInEnable() //可入信号 |
| | | // // && (staProtocol.getWorkNo() == 0 || staProtocol.getWorkNo() >= 9990) //工作号为0或者工作号是9991~9999(输送机留用) |
| | | // ) { |
| | | // LocMast locMast = locMastService.getById("0200404"); |
| | | // if (locMast != null && locMast.getLocSts().equalsIgnoreCase("O")) { |
| | | // try { |
| | | // Date now = new Date(); |
| | | // // 生成工作档 |
| | | // WrkMast wrkMast = new WrkMast(); |
| | | // int workNo = commonService.getWorkNo(0); |
| | | // wrkMast.setWrkNo(workNo); |
| | | // wrkMast.setIoTime(now); |
| | | // wrkMast.setWrkSts(2L); |
| | | // wrkMast.setIoPri(999D); |
| | | // wrkMast.setIoType(10); |
| | | // wrkMast.setTenant(1L); |
| | | // wrkMast.setCrnNo(1); |
| | | // wrkMast.setSourceStaNo(101); |
| | | // wrkMast.setStaNo(103); |
| | | // wrkMast.setLocNo("0200404"); |
| | | // wrkMast.setFullPlt("N"); // 满板:N |
| | | // wrkMast.setPicking("N"); // 拣料 |
| | | // wrkMast.setExitMk("N"); // 退出 |
| | | // wrkMast.setEmptyMk("Y"); // 空板 |
| | | // wrkMast.setLinkMis("Y"); |
| | | // // 操作人员数据 |
| | | // wrkMast.setAppeTime(now); |
| | | // wrkMast.setModiTime(now); |
| | | // wrkMast.setMemo("自动空托入库"); |
| | | // boolean res = wrkMastService.save(wrkMast); |
| | | // staProtocol.setWorkNo(Short.parseShort(wrkMast.getWrkNo() + "")); |
| | | // staProtocol.setStaNo(Short.parseShort(wrkMast.getStaNo() + "")); |
| | | // boolean result = MessageQueue.offer(SlaveType.Devp, 1, new Task(2, staProtocol)); |
| | | // log.info("输送线下发(存在设备上走的工作档,直接下发!)):" + wrkMast.getWrkNo() + "," + wrkMast.getStaNo()); |
| | | // // 更新目标库位状态 |
| | | // if (locMast.getLocSts().equals("O")) { |
| | | // locMast.setLocSts("S"); // S.入库预约 |
| | | // locMast.setModiUser(789L); |
| | | // locMast.setModiTime(now); |
| | | // if (!locMastService.updateById(locMast)) { |
| | | // throw new CoolException("改变库位状态失败"); |
| | | // } |
| | | // } |
| | | // } catch (Exception e) { |
| | | // e.printStackTrace(); |
| | | // TransactionAspectSupport.currentTransactionStatus().setRollbackOnly(); |
| | | // } |
| | | // } |
| | | // } |
| | | // } |
| | | //} |