| | |
| | | |
| | | private String specs; |
| | | |
| | | private String model; |
| | | |
| | | private String manuDate; |
| | | |
| | | private double weight; |
| | | |
| | | private double length; |
| | | |
| | | private double volume; |
| | | |
| | | // 客户信息 |
| | | private String manu; |
| | | |
| | |
| | | this.count = count; |
| | | this.total = total; |
| | | } |
| | | public MatDto(String matnr,String batch,String specs,String manuDate,String model,double weight, double length,double volume) { |
| | | this.matnr = matnr; |
| | | this.batch = batch; |
| | | this.specs = specs; |
| | | this.manuDate = manuDate; |
| | | this.model = model; |
| | | this.weight = weight; |
| | | this.length = length; |
| | | this.volume = volume; |
| | | } |
| | | |
| | | public MatDto(String matNo, String maknx, Double count) { |
| | | this.matnr = matNo; |
| | |
| | | vo.setPakMk(staProtocol.isPakMk()?"Y":"N"); // 入库标记 |
| | | vo.setEmptyMk(staProtocol.isEmptyMk()?"Y":"N"); // 空板信号 |
| | | vo.setStaNo(staProtocol.getStaNo()); // 目标站 |
| | | vo.setWorkNo(staProtocol.getWorkNo()); |
| | | // vo.setLocType1(staProtocol.isHigh() != staProtocol.isLow() && staProtocol.isLow() ? "低" : "高"); //高低库位 |
| | | vo.setLocType1(devp.getDevNo()==102 ? "高" : "低"); |
| | | } |
| | |
| | | // mainService.refreshRgvMap(); |
| | | |
| | | // 入出库模式切换函数 |
| | | mainService.ioConvert(); |
| | | // mainService.ioConvert(); |
| | | |
| | | // 拣料、并板、盘点再入库 |
| | | // mainService.stnToCrnStnPick(3); |
| | |
| | | // 堆垛机异常信息记录 |
| | | mainService.recCrnErr(7); |
| | | // 入库 ===>> 空栈板初始化入库,叉车入库站放货 |
| | | mainService.storeEmptyPlt(8); |
| | | // mainService.storeEmptyPlt(8); |
| | | // 出库 ===>> 工作档信息写入led显示器 |
| | | mainService.ledExecute(9); |
| | | // 其他 ===>> LED显示器复位,显示默认信息 |
| | |
| | | mainService.outOfDevp(11); |
| | | |
| | | // 生成106出库任务 |
| | | mainService.generateOutbound(); |
| | | // mainService.generateOutbound(); |
| | | |
| | | // 生成106到105转移任务 |
| | | mainService.autoMoveLoc(); |
| | | // mainService.autoMoveLoc(); |
| | | |
| | | // if (i>10){ |
| | | // //空托盘自动出库 |
| | |
| | | package com.zy.core; |
| | | |
| | | import com.zy.utils.News; |
| | | import com.zy.core.cache.MessageQueue; |
| | | import com.zy.core.cache.SlaveConnection; |
| | | import com.zy.core.enums.SlaveType; |
| | | import com.zy.core.model.CrnSlave; |
| | | import com.zy.core.model.DevpSlave; |
| | | import com.zy.core.model.LedSlave; |
| | | import com.zy.core.model.RgvSlave; |
| | | import com.zy.core.properties.SlaveProperties; |
| | | import com.zy.core.thread.*; |
| | | import com.zy.core.thread.BarcodeThread; |
| | | import com.zy.core.thread.LedThread; |
| | | import com.zy.core.thread.SiemensCrnThread; |
| | | import com.zy.core.thread.SiemensDevpThread; |
| | | import com.zy.utils.News; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.scheduling.annotation.Async; |
| | |
| | | SlaveConnection.put(SlaveType.Crn, crn.getId(), crnThread); |
| | | } |
| | | // 初始化穿梭车线程 |
| | | log.info("初始化RGV线程..................................................."); |
| | | for (RgvSlave rgv : slaveProperties.getRgv()) { |
| | | RgvThread rgvThread = new RgvThread(rgv); |
| | | new Thread((Runnable) rgvThread).start(); |
| | | SlaveConnection.put(SlaveType.Rgv, rgv.getId(), rgvThread); |
| | | } |
| | | // log.info("初始化RGV线程..................................................."); |
| | | // for (RgvSlave rgv : slaveProperties.getRgv()) { |
| | | // RgvThread rgvThread = new RgvThread(rgv); |
| | | // new Thread((Runnable) rgvThread).start(); |
| | | // SlaveConnection.put(SlaveType.Rgv, rgv.getId(), rgvThread); |
| | | // } |
| | | // 初始化输送线线程 |
| | | News.info("初始化输送线线程..................................................."); |
| | | for (DevpSlave devp : slaveProperties.getDevp()) { |
| | |
| | | package com.zy.core.model.command; |
| | | |
| | | import com.core.common.Cools; |
| | | import com.zy.common.model.MatDto; |
| | | import lombok.Data; |
| | | |
| | |
| | | public class LedCommand extends Object { |
| | | |
| | | private String title; |
| | | |
| | | @Override |
| | | public String toString() { |
| | | return "LedCommand{" + |
| | | "title='" + title + '\'' + |
| | | ", workNo=" + workNo + |
| | | ", staNo=" + staNo + |
| | | ", sourceStaNo=" + sourceStaNo + |
| | | ", locNo='" + locNo + '\'' + |
| | | ", sourceLocNo='" + sourceLocNo + '\'' + |
| | | ", matDtos=" + matDtos + |
| | | ", emptyMk=" + emptyMk + |
| | | ", ioType=" + ioType + |
| | | ", barcode='" + barcode + '\'' + |
| | | '}'; |
| | | } |
| | | |
| | | private Integer workNo; |
| | | |
| | |
| | | private Integer ioType; |
| | | private String barcode; |
| | | |
| | | @Override |
| | | public String toString() { |
| | | StringBuffer s = new StringBuffer(); |
| | | s.append("工作号[" + this.workNo + "]\n"); |
| | | s.append("工作类型[" + this.title + "]\n"); |
| | | if (!Cools.isEmpty(this.barcode)) { |
| | | s.append("托盘码[" + this.barcode + "]\n"); |
| | | } |
| | | if (!this.emptyMk){ |
| | | |
| | | for (MatDto matDto : matDtos) { |
| | | s.append("[商品编码:" + matDto.getMatnr() + ", 数量:" + matDto.getCount() + "]\n"); |
| | | } |
| | | } |
| | | |
| | | return s.toString(); |
| | | public static void main(String[] args) { |
| | | LedCommand ledCommand = new LedCommand(); |
| | | ledCommand.setTitle("全板出库"); |
| | | ledCommand.setBarcode("80000001"); |
| | | ledCommand.setSourceLocNo("0100101"); |
| | | ledCommand.setStaNo(100); |
| | | ledCommand.setWorkNo(7001); |
| | | List<MatDto> matDtos = new ArrayList<>(); |
| | | MatDto matDto = new MatDto("0205040001","K44132-09-0724","PE","20240724",",HD-233L",70,2816,53908.56626); |
| | | matDtos.add(matDto); |
| | | ledCommand.setMatDtos(matDtos); |
| | | System.out.println(ledCommand); |
| | | } |
| | | } |
| | |
| | | array[9] = command.getCommand(); |
| | | // array[10] = 0; //备用1 |
| | | |
| | | boolean[] array2 = new boolean[1]; |
| | | array2[0] = command.isTraySize(); |
| | | // boolean[] array2 = new boolean[1]; |
| | | // array2[0] = command.isTraySize(); |
| | | OperateResult result = siemensNet.Write("DB100.0", array); |
| | | OperateResult result2 = siemensNet.Write("DB100.22", array2); |
| | | // OperateResult result2 = siemensNet.Write("DB100.22", array2); |
| | | News.info("堆垛机命令下发[id:{}] >>>>> {}", slave.getId(), array); |
| | | |
| | | if(!result.IsSuccess || !result2.IsSuccess){ |
| | | // if(!result.IsSuccess || !result2.IsSuccess){ |
| | | if(!result.IsSuccess){ |
| | | News.error("写入堆垛机plc数据失败,重新添加任务到队列 ===>> [id:{}],{}", slave.getId(), JSON.toJSON(command)); |
| | | MessageQueue.offer(SlaveType.Crn, slave.getId(), new Task(2, command)); |
| | | Thread.sleep(100); |
| | |
| | | public static void main(String[] args) throws InterruptedException { |
| | | CrnSlave slave = new CrnSlave(); |
| | | slave.setId(1); |
| | | slave.setIp("192.168.6.9"); |
| | | slave.setIp("10.10.10.1"); |
| | | slave.setRack(0); |
| | | slave.setSlot(0); |
| | | SiemensCrnThread crnThread = new SiemensCrnThread(slave); |
| | |
| | | // // 3.库位移转 源和目标都发 pass |
| | | // CrnCommand command = new CrnCommand(); |
| | | // command.setCrnNo(slave.getId()); // 堆垛机编号 |
| | | // command.setTaskNo((short) 0); // 工作号 |
| | | // command.setTaskNo((short) 2); // 工作号 |
| | | // command.setAckFinish((short) 0); // 任务完成确认位 |
| | | // command.setTaskMode(CrnTaskModeType.LOC_MOVE); // 任务模式: 库位移转 |
| | | // command.setSourcePosX((short)2); // 源库位排 |
| | | // command.setSourcePosY((short)2); // 源库位列 |
| | | // command.setSourcePosZ((short)3); // 源库位层 |
| | | // command.setDestinationPosX((short)2); // 目标库位排 |
| | | // command.setDestinationPosY((short)4); // 目标库位列 |
| | | // command.setDestinationPosZ((short)4); // 目标库位层 |
| | | // command.setSourcePosY((short)1); // 源库位列 |
| | | // command.setSourcePosZ((short)1); // 源库位层 |
| | | // command.setDestinationPosX((short)3); // 目标库位排 |
| | | // command.setDestinationPosY((short)1); // 目标库位列 |
| | | // command.setDestinationPosZ((short)1); // 目标库位层 |
| | | // crnThread.write(command); |
| | | |
| | | // 4.站位移转 源和目标都发 |
| | |
| | | import HslCommunication.Profinet.Siemens.SiemensPLCS; |
| | | import HslCommunication.Profinet.Siemens.SiemensS7Net; |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.baomidou.mybatisplus.mapper.EntityWrapper; |
| | | import com.core.common.Cools; |
| | | import com.core.common.DateUtils; |
| | | import com.core.common.SpringUtils; |
| | | import com.core.exception.CoolException; |
| | | import com.zy.entity.BasDevp; |
| | | import com.zy.entity.BasRgvMap; |
| | | import com.zy.service.BasDevpService; |
| | | import com.zy.service.BasRgvMapService; |
| | | import com.zy.utils.News; |
| | | import com.zy.core.DevpThread; |
| | | import com.zy.core.cache.MessageQueue; |
| | | import com.zy.core.cache.OutputQueue; |
| | |
| | | import com.zy.core.model.Task; |
| | | import com.zy.core.model.protocol.StaError1; |
| | | import com.zy.core.model.protocol.StaProtocol; |
| | | import com.zy.entity.BasDevp; |
| | | import com.zy.entity.WrkMast; |
| | | import com.zy.service.BasDevpService; |
| | | import com.zy.service.WrkMastService; |
| | | import com.zy.utils.News; |
| | | import lombok.Data; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | |
| | | import java.text.MessageFormat; |
| | | import java.util.ArrayList; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.*; |
| | | import java.util.concurrent.ConcurrentHashMap; |
| | | |
| | | /** |
| | |
| | | private Map<Integer, StaProtocol> station = new ConcurrentHashMap<>(); |
| | | private short heartBeatVal = 1; |
| | | private StaError1 staError1; |
| | | // public static final ArrayList<Integer> staNos = new ArrayList<Integer>() {{ |
| | | // |
| | | // }}; |
| | | public static final ArrayList<Integer> staNos1 = new ArrayList<Integer>() {{ |
| | | public static final ArrayList<Integer> staNos = new ArrayList<Integer>() {{ |
| | | add(100);add(101);add(102);add(103); |
| | | add(104);add(105);add(106); |
| | | }}; |
| | | |
| | | public static final ArrayList<Integer> staNos2 = new ArrayList<Integer>() {{ |
| | | add(104);add(105);add(106);add(107); |
| | | add(200);add(201);add(202);add(203);add(210); |
| | | add(300);add(301);add(302);add(303);add(304);add(305); |
| | | }}; |
| | | |
| | | public static final ArrayList<Integer> BarcodeList = new ArrayList<Integer>() {{ |
| | | add(0); add(1); |
| | | add(1); add(2); |
| | | }}; |
| | | public static final ArrayList<Integer> staNosErrList = new ArrayList<Integer>() {{ |
| | | add(100); add(102); |
| | | add(101); add(103); |
| | | }}; |
| | | |
| | | /** |
| | |
| | | } |
| | | |
| | | private ArrayList<Integer> getStaNo() { |
| | | switch (slave.getId()) { |
| | | case 1: |
| | | return staNos1; |
| | | case 2: |
| | | return staNos2; |
| | | default: |
| | | throw new CoolException("服务器异常"); |
| | | } |
| | | return staNos; |
| | | } |
| | | |
| | | @Override |
| | |
| | | private void read() throws InterruptedException { |
| | | // // 更新入出库模式 |
| | | // updateIoMode(); |
| | | ArrayList<Integer> staNos = getStaNo(); |
| | | int staNoSize = staNos.size(); |
| | | OperateResultExOne<byte[]> result = siemensS7Net.Read("DB101.0", (short) (staNoSize*8)); |
| | | // ArrayList<Integer> staNos = getStaNo(); |
| | | // int staNoSize = staNos.size(); |
| | | // 读一楼连续8个站点 |
| | | OperateResultExOne<byte[]> result = siemensS7Net.Read("DB101.0", (short) (8*8)); |
| | | if (result.IsSuccess) { |
| | | for (int i = 0; i < staNoSize; i++) { |
| | | for (int i = 0; i < 8; i++) { |
| | | Integer siteId = staNos.get(i); // 站点编号 |
| | | StaProtocol staProtocol = station.get(siteId); |
| | | if (null == staProtocol) { |
| | |
| | | } |
| | | } |
| | | } |
| | | BasRgvMapService basRgvMapService = SpringUtils.getBean(BasRgvMapService.class); |
| | | //RGV小车1 |
| | | // Thread.sleep(100); |
| | | OperateResultExOne<byte[]> result3 = siemensS7Net.Read("DB50.200",(short)10); |
| | | if (result3.IsSuccess) { |
| | | BasRgvMap basRgvMap = basRgvMapService.selectByRgvNo((int) siemensS7Net.getByteTransform().TransInt16(result3.Content, 0)); |
| | | if (!Cools.isEmpty(basRgvMap)){ |
| | | Integer siteId = 1; |
| | | // 读二楼连续4个站点 |
| | | OperateResultExOne<byte[]> result2 = siemensS7Net.Read("DB101.800", (short) (4*8)); |
| | | if (result2.IsSuccess) { |
| | | for (int i = 8; i < 12; i++) { |
| | | Integer siteId = staNos.get(i); // 站点编号 |
| | | StaProtocol staProtocol = station.get(siteId); |
| | | if (null == staProtocol) { |
| | | staProtocol = new StaProtocol(); |
| | | staProtocol.setSiteId(siteId); |
| | | station.put(siteId, staProtocol); |
| | | } |
| | | staProtocol.setAutoing(true); |
| | | staProtocol.setNearbySta(String.valueOf(siemensS7Net.getByteTransform().TransInt16(result3.Content, 8))); |
| | | staProtocol.setWorkNo(siemensS7Net.getByteTransform().TransInt32(result2.Content, (i-8)*8)); // 工作号 |
| | | |
| | | staProtocol.setStaNo(siemensS7Net.getByteTransform().TransInt16(result2.Content, (i-8)*8 + 4)); // 目标站 |
| | | |
| | | boolean[] status = siemensS7Net.getByteTransform().TransBool(result2.Content, (i-8)*8 + 6, 2); |
| | | staProtocol.setAutoing(status[0]); // 自动 |
| | | staProtocol.setLoading(status[1]); // 有物 |
| | | staProtocol.setInEnable(status[2]); // 可入 |
| | | staProtocol.setOutEnable(status[3]);// 可出 |
| | | staProtocol.setEmptyMk(status[4]); // 空板信号 |
| | | staProtocol.setFullPlt(status[5]); // 满托盘 |
| | | staProtocol.setHigh(status[6]); // 高库位 |
| | | staProtocol.setLow(status[7]); // 低库位 |
| | | |
| | | if (!staProtocol.isPakMk() && !staProtocol.isLoading()) { |
| | | staProtocol.setPakMk(true); |
| | | } |
| | | } |
| | | } |
| | | // 读二楼210 |
| | | OperateResultExOne<byte[]> result3 = siemensS7Net.Read("DB101.880", (short) (8)); |
| | | if (result3.IsSuccess) { |
| | | Integer siteId = staNos.get(12); // 站点编号210 |
| | | StaProtocol staProtocol = station.get(siteId); |
| | | if (null == staProtocol) { |
| | | staProtocol = new StaProtocol(); |
| | | staProtocol.setSiteId(siteId); |
| | | station.put(siteId, staProtocol); |
| | | } |
| | | staProtocol.setWorkNo(siemensS7Net.getByteTransform().TransInt32(result3.Content, 0)); // 工作号 |
| | | |
| | | //条码扫描器 |
| | | ArrayList<Integer> barcodeList = BarcodeList; |
| | | OperateResultExOne<byte[]> result2 = siemensS7Net.Read("DB101.840", (short) (barcodeList.size() * 8)); |
| | | if (result2.IsSuccess) { |
| | | for (int i = 0; i < barcodeList.size(); i++) { |
| | | Integer barcodeId = barcodeList.get(i); |
| | | String barcode = siemensS7Net.getByteTransform().TransString(result2.Content,i*8,8, "UTF-8"); |
| | | BarcodeThread barcodeThread = (BarcodeThread) SlaveConnection.get(SlaveType.Barcode, barcodeId + 1); |
| | | staProtocol.setStaNo(siemensS7Net.getByteTransform().TransInt16(result3.Content, 4)); // 目标站 |
| | | |
| | | boolean[] status = siemensS7Net.getByteTransform().TransBool(result3.Content, 6, 2); |
| | | staProtocol.setAutoing(status[0]); // 自动 |
| | | staProtocol.setLoading(status[1]); // 有物 |
| | | staProtocol.setInEnable(status[2]); // 可入 |
| | | staProtocol.setOutEnable(status[3]);// 可出 |
| | | staProtocol.setEmptyMk(status[4]); // 空板信号 |
| | | staProtocol.setFullPlt(status[5]); // 满托盘 |
| | | staProtocol.setHigh(status[6]); // 高库位 |
| | | staProtocol.setLow(status[7]); // 低库位 |
| | | |
| | | if (!staProtocol.isPakMk() && !staProtocol.isLoading()) { |
| | | staProtocol.setPakMk(true); |
| | | } |
| | | } |
| | | |
| | | // BasRgvMapService basRgvMapService = SpringUtils.getBean(BasRgvMapService.class); |
| | | //RGV小车1 |
| | | // Thread.sleep(100); |
| | | // OperateResultExOne<byte[]> result3 = siemensS7Net.Read("DB50.200",(short)10); |
| | | // if (result3.IsSuccess) { |
| | | // BasRgvMap basRgvMap = basRgvMapService.selectByRgvNo((int) siemensS7Net.getByteTransform().TransInt16(result3.Content, 0)); |
| | | // if (!Cools.isEmpty(basRgvMap)){ |
| | | // Integer siteId = 1; |
| | | // StaProtocol staProtocol = station.get(siteId); |
| | | // if (null == staProtocol) { |
| | | // staProtocol = new StaProtocol(); |
| | | // staProtocol.setSiteId(siteId); |
| | | // station.put(siteId, staProtocol); |
| | | // } |
| | | // staProtocol.setAutoing(true); |
| | | // staProtocol.setNearbySta(String.valueOf(siemensS7Net.getByteTransform().TransInt16(result3.Content, 8))); |
| | | // } |
| | | // } |
| | | |
| | | // 条码扫描器 |
| | | OperateResultExOne<byte[]> barcodeResult = siemensS7Net.Read("DB101.1672", (short) ((BarcodeList.size()+1) * 8)); // 不连续 |
| | | if (barcodeResult.IsSuccess) { |
| | | for (int i = 0; i < BarcodeList.size(); i++) { |
| | | String barcode = siemensS7Net.getByteTransform().TransString(barcodeResult.Content,i*16,8, "UTF-8"); |
| | | BarcodeThread barcodeThread = (BarcodeThread) SlaveConnection.get(SlaveType.Barcode, BarcodeList.get(i)); |
| | | if(!Cools.isEmpty(barcodeThread) && !barcodeThread.getBarcode().equals(barcode)) { |
| | | barcodeThread.setBarcode(barcode); |
| | | } |
| | | } |
| | | } |
| | | //外形检测 |
| | | ArrayList<Integer> staNoErrs = staNosErrList; |
| | | int staNoErrsSize = staNoErrs.size(); |
| | | OperateResultExOne<byte[]> resultErr = siemensS7Net.Read("DB101.800", (short) (staNoErrsSize*8)); |
| | | |
| | | // 外形检测 |
| | | OperateResultExOne<byte[]> resultErr = siemensS7Net.Read("DB101.1652", (short) ((staNosErrList.size()+1)*4)); // 不连续,多读中间一个 |
| | | if (resultErr.IsSuccess){ |
| | | for (int i = 0;i<staNoErrsSize;i++){ |
| | | Integer siteId = staNoErrs.get(i); // 站点编号 |
| | | boolean[] status = siemensS7Net.getByteTransform().TransBool(resultErr.Content, i*4+2, 1); |
| | | StaProtocol staProtocol = station.get(siteId); |
| | | for (int i = 0;i<staNosErrList.size();i++){ |
| | | boolean[] status = siemensS7Net.getByteTransform().TransBool(resultErr.Content, i*9+2, 1); |
| | | StaProtocol staProtocol = station.get(staNosErrList.get(i)); |
| | | staProtocol.setFrontErr(status[0]); |
| | | staProtocol.setBackErr(status[1]); |
| | | staProtocol.setHighErr(status[2]); |
| | |
| | | staProtocol.setBarcodeErr(status[6]); |
| | | } |
| | | } |
| | | |
| | | OperateResultExOne<byte[]> resultErr2 = siemensS7Net.Read("DB13.2", (short) (staNoSize*4)); |
| | | // 读一楼连续8个站点,故障信息反馈 |
| | | OperateResultExOne<byte[]> resultErr2 = siemensS7Net.Read("DB101.3312", (short) (8*2)); |
| | | if (resultErr2.IsSuccess) { |
| | | for (int i = 0; i < staNoSize; i++) { |
| | | Integer siteId = staNos.get(i); // 站点编号 |
| | | boolean[] status = siemensS7Net.getByteTransform().TransBool(resultErr2.Content, i*4, 1); |
| | | StaProtocol staProtocol = station.get(siteId); |
| | | for (int i = 0; i < 8; i++) { |
| | | boolean[] status = siemensS7Net.getByteTransform().TransBool(resultErr2.Content, i*2 + 1, 1); |
| | | StaProtocol staProtocol = station.get(staNos.get(i)); // 站点编号 |
| | | staProtocol.setBreakerErr(status[0]); |
| | | staProtocol.setInfraredErr(status[1]); |
| | | staProtocol.setOutTimeErr(status[2]); |
| | |
| | | |
| | | } |
| | | } |
| | | OperateResultExOne<byte[]> resultErr3 = siemensS7Net.Read("DB13.400", (short) 3); |
| | | // 读二楼连续4个站点,故障信息反馈 |
| | | OperateResultExOne<byte[]> resultErr3 = siemensS7Net.Read("DB101.3512", (short) (4*2)); |
| | | if (resultErr3.IsSuccess) { |
| | | if (staError1 == null){ |
| | | staError1 = new StaError1(); |
| | | for (int i = 8; i < 12; i++) { |
| | | boolean[] status = siemensS7Net.getByteTransform().TransBool(resultErr3.Content, (i-8) * 2 + 1, 1); |
| | | StaProtocol staProtocol = station.get(staNos.get(i)); // 站点编号 |
| | | staProtocol.setBreakerErr(status[0]); |
| | | staProtocol.setInfraredErr(status[1]); |
| | | staProtocol.setOutTimeErr(status[2]); |
| | | staProtocol.setSeizeSeatErr(status[3]); |
| | | staProtocol.setWrkYgoodsN(status[4]); |
| | | staProtocol.setInverterErr(status[5]); |
| | | staProtocol.setContactErr(status[6]); |
| | | staProtocol.setUpcontactErr(status[7]); |
| | | } |
| | | boolean[] status = siemensS7Net.getByteTransform().TransBool(resultErr3.Content, 0, 3); |
| | | staError1.setEMERGENCY_Stop_Core(status[0]); |
| | | staError1.setEMERGENCY_STOP1(status[1]); |
| | | staError1.setEMERGENCY_STOP2(status[2]); |
| | | staError1.setEMERGENCY_STOP3(status[3]); |
| | | staError1.setEMERGENCY_STOP4(status[4]); |
| | | |
| | | staError1.setDoor_EMERGENCY_STOP1(status[5]); |
| | | staError1.setDoor_EMERGENCY_STOP2(status[6]); |
| | | staError1.setDoor_EMERGENCY_STOP3(status[7]); |
| | | staError1.setDoor_EMERGENCY_STOP4(status[8]); |
| | | staError1.setDoor_EMERGENCY_STOP5(status[9]); |
| | | staError1.setDoor_EMERGENCY_STOP6(status[10]); |
| | | |
| | | staError1.setDoor_Open_Err1(status[11]); |
| | | staError1.setDoor_Open_Err1(status[12]); |
| | | staError1.setDoor_Open_Err1(status[13]); |
| | | staError1.setDoor_Open_Err1(status[14]); |
| | | staError1.setDoor_Open_Err1(status[15]); |
| | | staError1.setDoor_Open_Err1(status[16]); |
| | | |
| | | } |
| | | |
| | | // 一楼出入库模式切换 |
| | | OperateResultExOne<byte[]> ioModeResult = siemensS7Net.Read("DB101.3724", (short) 1); |
| | | if (ioModeResult.IsSuccess) { |
| | | boolean[] ioModelBooleans = siemensS7Net.getByteTransform().TransBool(ioModeResult.Content, 0, 1); |
| | | // log.info("读取出入库模式:" + Arrays.toString(ioModelBooleans)); |
| | | WrkMastService wrkMastService = SpringUtils.getBean(WrkMastService.class); |
| | | if (ioModelBooleans[0]) { // 100切入库 |
| | | if (ioModeOf101 == IoModeType.PAKOUT_MODE) { |
| | | int outCount = wrkMastService.selectCount(new EntityWrapper<WrkMast>().eq("io_type", 101) |
| | | .eq("sta_no", 100).in("wrk_sts", 12, 13, 14)); |
| | | if (outCount == 0) { |
| | | boolean[] booleans = new boolean[8]; |
| | | booleans[0]=true; |
| | | ioModeOf101 = IoModeType.PAKIN_MODE; |
| | | siemensS7Net.Write("DB100.824",booleans); |
| | | log.info("101切换入库模式成功"); |
| | | } |
| | | } |
| | | } |
| | | if (ioModelBooleans[1]) { // 100切出库 |
| | | if (ioModeOf101 == IoModeType.PAKIN_MODE) { |
| | | int inCount = wrkMastService.selectCount(new EntityWrapper<WrkMast>().eq("io_type", 1) |
| | | .eq("sta_no", 101).in("wrk_sts", 2, 3, 4)); |
| | | if (inCount == 0) { |
| | | boolean[] booleans = new boolean[8]; |
| | | booleans[0]=true; |
| | | ioModeOf101 = IoModeType.PAKOUT_MODE; |
| | | siemensS7Net.Write("DB100.824",booleans); |
| | | log.info("101切换出库模式成功"); |
| | | } |
| | | } |
| | | } |
| | | if (ioModelBooleans[2]) { // 102切入库 |
| | | if (ioModeOf103 == IoModeType.PAKOUT_MODE) { |
| | | int outCount = wrkMastService.selectCount(new EntityWrapper<WrkMast>().eq("io_type", 101) |
| | | .eq("sta_no", 102).in("wrk_sts", 12, 13, 14)); |
| | | if (outCount == 0) { |
| | | boolean[] booleans = new boolean[8]; |
| | | booleans[1]=true; |
| | | ioModeOf103 = IoModeType.PAKIN_MODE; |
| | | siemensS7Net.Write("DB100.824",booleans); |
| | | log.info("103切换入库模式成功"); |
| | | } |
| | | } |
| | | } |
| | | if (ioModelBooleans[3]) { // 102切出库 |
| | | if (ioModeOf103 == IoModeType.PAKIN_MODE) { |
| | | int inCount = wrkMastService.selectCount(new EntityWrapper<WrkMast>().eq("io_type", 1) |
| | | .eq("sta_no", 103).in("wrk_sts", 2, 3, 4)); |
| | | if (inCount == 0) { |
| | | boolean[] booleans = new boolean[8]; |
| | | booleans[1]=true; |
| | | ioModeOf103 = IoModeType.PAKOUT_MODE; |
| | | siemensS7Net.Write("DB100.824",booleans); |
| | | log.info("103切换出库模式成功"); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | |
| | | // OperateResultExOne<byte[]> resultErr3 = siemensS7Net.Read("DB13.400", (short) 3); |
| | | // if (resultErr3.IsSuccess) { |
| | | // if (staError1 == null){ |
| | | // staError1 = new StaError1(); |
| | | // } |
| | | // boolean[] status = siemensS7Net.getByteTransform().TransBool(resultErr3.Content, 0, 3); |
| | | // staError1.setEMERGENCY_Stop_Core(status[0]); |
| | | // staError1.setEMERGENCY_STOP1(status[1]); |
| | | // staError1.setEMERGENCY_STOP2(status[2]); |
| | | // staError1.setEMERGENCY_STOP3(status[3]); |
| | | // staError1.setEMERGENCY_STOP4(status[4]); |
| | | // |
| | | // staError1.setDoor_EMERGENCY_STOP1(status[5]); |
| | | // staError1.setDoor_EMERGENCY_STOP2(status[6]); |
| | | // staError1.setDoor_EMERGENCY_STOP3(status[7]); |
| | | // staError1.setDoor_EMERGENCY_STOP4(status[8]); |
| | | // staError1.setDoor_EMERGENCY_STOP5(status[9]); |
| | | // staError1.setDoor_EMERGENCY_STOP6(status[10]); |
| | | // |
| | | // staError1.setDoor_Open_Err1(status[11]); |
| | | // staError1.setDoor_Open_Err1(status[12]); |
| | | // staError1.setDoor_Open_Err1(status[13]); |
| | | // staError1.setDoor_Open_Err1(status[14]); |
| | | // staError1.setDoor_Open_Err1(status[15]); |
| | | // staError1.setDoor_Open_Err1(status[16]); |
| | | // |
| | | // } |
| | | |
| | | |
| | | if (result.IsSuccess) { |
| | |
| | | if (null == staProtocol) { |
| | | return; |
| | | } |
| | | ArrayList<Integer> staNos = getStaNo(); |
| | | int index = staNos.indexOf(staProtocol.getSiteId()); |
| | | OperateResult write = null; |
| | | OperateResult write1 = null; |
| | | |
| | | int address = -1; |
| | | switch (staProtocol.getSiteId()) { |
| | | case 100: address = 0; break; |
| | | case 101: address = 4; break; |
| | | case 102: address = 8; break; |
| | | case 103: address = 12; break; |
| | | case 104: address = 16; break; |
| | | case 105: address = 20; break; |
| | | case 106: address = 24; break; |
| | | case 107: address = 28; break; |
| | | case 200: address = 400; break; |
| | | case 201: address = 404; break; |
| | | case 202: address = 408; break; |
| | | case 203: address = 412; break; |
| | | case 210: address = 440; break; |
| | | default: |
| | | } |
| | | if(address == -1) { |
| | | throw new CoolException("写入站点异常:" + staProtocol.getSiteId()); |
| | | } |
| | | OperateResult write; |
| | | OperateResult write1; |
| | | //任务下发次数 |
| | | int writeCount = 0; |
| | | do { |
| | | write = siemensS7Net.Write("DB100." + index*6, staProtocol.getWorkNo()); // 工作号 |
| | | write1 = siemensS7Net.Write("DB100." + (address+2), staProtocol.getStaNo()); // 目标站 |
| | | write = siemensS7Net.Write("DB100." + address, staProtocol.getWorkNo().shortValue()); // 工作号 |
| | | Thread.sleep(200); |
| | | write1 = siemensS7Net.Write("DB100." + (index*6+4), staProtocol.getStaNo()); // 目标站 |
| | | if(write.IsSuccess && write1.IsSuccess){ |
| | | break; |
| | | } |
| | |
| | | @Override |
| | | public void close() { |
| | | siemensS7Net.ConnectClose(); |
| | | } |
| | | |
| | | public static void main(String[] args) { |
| | | System.out.println(staNos1.indexOf(129)); |
| | | System.out.println(staNos1.size()); |
| | | for (int i = 0; i<staNos1.size(); i++) { |
| | | // System.out.println(i*2); |
| | | // System.out.println(i*2 + 200); |
| | | // System.out.println(i); |
| | | } |
| | | int index = staNos1.indexOf(128); |
| | | System.out.println(index*2); |
| | | System.out.println(index*2 + 200); |
| | | } |
| | | |
| | | // public static void main(String[] args) throws Exception { |
| | |
| | | import com.core.common.Cools; |
| | | import com.core.common.DateUtils; |
| | | import com.core.exception.CoolException; |
| | | import com.zy.entity.*; |
| | | import com.zy.mapper.*; |
| | | import com.zy.service.*; |
| | | import com.zy.utils.RouteUtils; |
| | | import com.zy.utils.Utils; |
| | | import com.zy.utils.VersionUtils; |
| | | import com.zy.common.model.LocTypeDto; |
| | | import com.zy.common.model.MatDto; |
| | | import com.zy.common.model.SearchLocParam; |
| | | import com.zy.common.model.StartupDto; |
| | | import com.zy.common.service.CommonService; |
| | | import com.zy.utils.CollectionUtils; |
| | | import com.zy.utils.HttpHandler; |
| | | import com.zy.utils.News; |
| | | import com.zy.core.CrnThread; |
| | | import com.zy.core.DevpThread; |
| | | import com.zy.core.cache.MessageQueue; |
| | | import com.zy.core.cache.SlaveConnection; |
| | | import com.zy.core.enums.*; |
| | | import com.zy.core.model.*; |
| | | import com.zy.core.model.CrnSlave; |
| | | import com.zy.core.model.DevpSlave; |
| | | import com.zy.core.model.LedSlave; |
| | | import com.zy.core.model.Task; |
| | | import com.zy.core.model.command.CrnCommand; |
| | | import com.zy.core.model.command.LedCommand; |
| | | import com.zy.core.model.command.RgvCommand; |
| | |
| | | import com.zy.core.thread.LedThread; |
| | | import com.zy.core.thread.RgvThread; |
| | | import com.zy.core.thread.SiemensDevpThread; |
| | | import com.zy.entity.*; |
| | | import com.zy.mapper.*; |
| | | import com.zy.service.*; |
| | | import com.zy.utils.*; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | |
| | | @Value("${wms.url}") |
| | | private String wmsUrl; |
| | | |
| | | public Integer wrkNo = 10000; |
| | | public Integer wrkNo = 9901; |
| | | |
| | | /** |
| | | * 组托 |
| | |
| | | // 尺寸检测异常 |
| | | boolean back = false; |
| | | String errMsg = ""; |
| | | if ((staProtocol.getSiteId() == 101 && devpThread.ioModeOf101 == IoModeType.PAKOUT_MODE) |
| | | ||(staProtocol.getSiteId() == 103 && devpThread.ioModeOf103 == IoModeType.PAKOUT_MODE) |
| | | ||(staProtocol.getSiteId() == 305 && devpThread.ioModeOf305 == IoModeType.PAKOUT_MODE)) { |
| | | errMsg = "当前为出库模式"; |
| | | back = true; |
| | | } |
| | | if (!back && staProtocol.isFrontErr()) { |
| | | // if ((staProtocol.getSiteId() == 101 && devpThread.ioModeOf101 == IoModeType.PAKOUT_MODE) |
| | | // ||(staProtocol.getSiteId() == 103 && devpThread.ioModeOf103 == IoModeType.PAKOUT_MODE) |
| | | // ||(staProtocol.getSiteId() == 305 && devpThread.ioModeOf305 == IoModeType.PAKOUT_MODE)) { |
| | | // errMsg = "当前为出库模式"; |
| | | // back = true; |
| | | // } |
| | | // if (!back && staProtocol.isFrontErr()) { |
| | | if (staProtocol.isFrontErr()) { |
| | | errMsg = "前超限"; |
| | | back = true; |
| | | } |
| | |
| | | } |
| | | staProtocol.setWorkNo(wrkNo); |
| | | News.info("{}入库回退:{},任务号:{}", inSta.getStaNo(), errMsg,wrkNo); |
| | | wrkNo++; |
| | | staProtocol.setStaNo(inSta.getBackSta().shortValue()); |
| | | devpThread.setPakMk(staProtocol.getSiteId(), false); |
| | | MessageQueue.offer(SlaveType.Devp, devp.getId(), new Task(2, staProtocol)); |
| | |
| | | |
| | | staProtocol.setWorkNo(wrkNo); |
| | | News.info("{}入库回退:{},任务号:{}", inSta.getStaNo(), errMsg,wrkNo); |
| | | wrkNo++; |
| | | staProtocol.setStaNo(inSta.getBackSta().shortValue()); |
| | | devpThread.setPakMk(staProtocol.getSiteId(), false); |
| | | MessageQueue.offer(SlaveType.Devp, devp.getId(), new Task(2, staProtocol)); |
| | |
| | | .build() |
| | | .doPost(); |
| | | JSONObject jsonObject = JSON.parseObject(response); |
| | | log.info("组托wms返回:" + jsonObject); |
| | | if (jsonObject.getInteger("code").equals(200)) { |
| | | StartupDto dto = jsonObject.getObject("data", StartupDto.class); |
| | | barcodeThread.setBarcode(""); |
| | |
| | | } |
| | | } else { |
| | | staProtocol.setWorkNo(wrkNo); |
| | | wrkNo++; |
| | | staProtocol.setStaNo(inSta.getBackSta().shortValue()); |
| | | devpThread.setPakMk(staProtocol.getSiteId(), false); |
| | | MessageQueue.offer(SlaveType.Devp, devp.getId(), new Task(2, staProtocol)); |
| | |
| | | StaDesc staDesc = staDescService.selectOne(wrapper); |
| | | if (Cools.isEmpty(staDesc)) { |
| | | News.error(""+mark+" - 2"+" - 入库路径不存在!type_no={},stn_no={},crn_no={}", wrkMast.getIoType(), pickSta.getStaNo(), wrkMast.getCrnNo()); |
| | | staProtocol.setWorkNo(wrkNo++); |
| | | staProtocol.setWorkNo(wrkNo); |
| | | staProtocol.setStaNo((short) (pickSta.getStaNo().shortValue()-(short)1)); |
| | | devpThread.setPakMk(staProtocol.getSiteId(), false); |
| | | MessageQueue.offer(SlaveType.Devp, devp.getId(), new Task(2, staProtocol)); |
| | |
| | | if(!Cools.isEmpty(barcode)) { |
| | | // log.info("{}号条码扫描器检测条码信息:{}", pickSta.getBarcode(), barcode); |
| | | if("NG".endsWith(barcode) || "NoRead".equals(barcode) || "empty".equals(barcode)) { |
| | | staProtocol.setWorkNo(wrkNo++); |
| | | staProtocol.setWorkNo(wrkNo); |
| | | staProtocol.setStaNo(pickSta.getBackSta().shortValue()); |
| | | devpThread.setPakMk(staProtocol.getSiteId(), false); |
| | | MessageQueue.offer(SlaveType.Devp, devp.getId(), new Task(2, staProtocol)); |
| | |
| | | continue; |
| | | } |
| | | } else { |
| | | staProtocol.setWorkNo(wrkNo++); |
| | | staProtocol.setWorkNo(wrkNo); |
| | | staProtocol.setStaNo(pickSta.getBackSta().shortValue()); |
| | | devpThread.setPakMk(staProtocol.getSiteId(), false); |
| | | MessageQueue.offer(SlaveType.Devp, devp.getId(), new Task(2, staProtocol)); |
| | |
| | | } |
| | | } |
| | | } else { |
| | | staProtocol.setWorkNo(wrkNo++); |
| | | staProtocol.setWorkNo(wrkNo); |
| | | staProtocol.setStaNo(pickSta.getBackSta().shortValue()); |
| | | devpThread.setPakMk(staProtocol.getSiteId(), false); |
| | | MessageQueue.offer(SlaveType.Devp, devp.getId(), new Task(2, staProtocol)); |
| | |
| | | |
| | | // 下发站点信息 |
| | | staProtocol.setWorkNo(wrkMast.getWrkNo()); |
| | | staProtocol.setStaNo(RouteUtils.CrnStaEnd(wrkMast.getStaNo(),wrkMast.getSourceStaNo())); |
| | | staProtocol.setStaNo(wrkMast.getStaNo().shortValue()); |
| | | if (!MessageQueue.offer(SlaveType.Devp, crnStn.getDevpPlcId(), new Task(2, staProtocol))) { |
| | | continue; |
| | | } |
| | | |
| | | // 更新工作档状态为14失败 |
| | | wrkMast.setWrkSts(14L); |
| | | if (wrkMast.getStaNo() == 104 && wrkMast.getWrkSts() == 12L) { |
| | | if (wrkMast.getSourceStaNo() == 106 && wrkMast.getWrkSts() == 12L) { |
| | | wrkMast.setWrkSts(16L); |
| | | } |
| | | wrkMast.setCrnEndTime(new Date()); |
| | |
| | | // continue; |
| | | // } |
| | | // 入出库模式判断 |
| | | if ((staProtocol.getSiteId() == 101 && devpThread.ioModeOf101 != IoModeType.PAKOUT_MODE) |
| | | || (staProtocol.getSiteId() == 103 && devpThread.ioModeOf103 != IoModeType.PAKOUT_MODE) |
| | | || (staProtocol.getSiteId() == 305 && devpThread.ioModeOf305 != IoModeType.PAKOUT_MODE)) { |
| | | continue; |
| | | } |
| | | // if ((staProtocol.getSiteId() == 101 && devpThread.ioModeOf101 != IoModeType.PAKOUT_MODE) |
| | | // || (staProtocol.getSiteId() == 103 && devpThread.ioModeOf103 != IoModeType.PAKOUT_MODE) |
| | | // || (staProtocol.getSiteId() == 305 && devpThread.ioModeOf305 != IoModeType.PAKOUT_MODE)) { |
| | | // continue; |
| | | // } |
| | | |
| | | // 查询站点详细信息 |
| | | BasDevp staDetl = basDevpService.selectById(crnStn.getStaNo()); |
| | |
| | | // continue; |
| | | } |
| | | // 判断堆垛机出库站状态 |
| | | if (staProtocol.isAutoing() && !staProtocol.isLoading() && staDetl.getCanouting() != null && staDetl.getCanouting().equals("Y") |
| | | if (staProtocol.isAutoing() && staProtocol.isLoading() && staDetl.getCanouting() != null && staDetl.getCanouting().equals("Y") |
| | | && staProtocol.getWorkNo() == 0 && staProtocol.isOutEnable()) { |
| | | // 命令下发区 -------------------------------------------------------------------------- |
| | | |
| | |
| | | ledCommand.setStaNo(wrkMast.getStaNo()); |
| | | ledCommand.setBarcode(wrkMast.getBarcode()); |
| | | if (wrkMast.getIoType() != 110 && wrkMast.getIoType() != 10) { |
| | | List<WrkDetl> wrkDetls = wrkDetlService.findByWorkNo(wrkMast.getWrkNo()); |
| | | |
| | | wrkDetls.forEach(wrkDetl -> { |
| | | Double total = 0.0; |
| | | EntityWrapper<LocDetl> wrapper = new EntityWrapper<>(); |
| | | LocDetl locDetl = locDetlService.selectOne(wrapper.eq("zpallet", wrkDetl.getZpallet()).eq("matnr", wrkDetl.getMatnr())); |
| | | if (Cools.isEmpty(locDetl)) { |
| | | total = wrkDetl.getAnfme(); |
| | | } else { |
| | | total = locDetl.getAnfme(); |
| | | } |
| | | if (wrkMast.getIoType() == 101 || wrkMast.getIoType() == 1) { |
| | | ledCommand.getMatDtos().add(new MatDto(wrkDetl.getMatnr(), wrkDetl.getMaktx(), wrkDetl.getBatch(), wrkDetl.getSpecs(), wrkDetl.getManu(), wrkDetl.getMemo(), wrkDetl.getAnfme(),total)); |
| | | } |
| | | if (wrkMast.getIoType() == 103 && (null == wrkDetl.getInspect() || 0 == wrkDetl.getInspect())) { |
| | | ledCommand.getMatDtos().add(new MatDto(wrkDetl.getMatnr(), wrkDetl.getMaktx(), wrkDetl.getBatch(), wrkDetl.getSpecs(), wrkDetl.getManu(), wrkDetl.getMemo(), wrkDetl.getAnfme(),total)); |
| | | } |
| | | if (wrkMast.getIoType() == 107) { |
| | | ledCommand.getMatDtos().add(new MatDto(wrkDetl.getMatnr(), wrkDetl.getMaktx(), wrkDetl.getBatch(), wrkDetl.getSpecs(), wrkDetl.getManu(), wrkDetl.getMemo(), wrkDetl.getAnfme(),total)); |
| | | } |
| | | }); |
| | | List<WrkDetl> wrkDetls = wrkDetlService.selectList(new EntityWrapper<WrkDetl>().eq("wrk_no", wrkMast.getWrkNo())); |
| | | // List<WrkDetl> wrkDetls = wrkDetlService.findByWorkNo(wrkMast.getWrkNo()); |
| | | wrkDetls.forEach(wrkDetl -> ledCommand.getMatDtos().add(new MatDto(wrkDetl.getMatnr(), wrkDetl.getBatch(), wrkDetl.getSpecs(),wrkDetl.getManuDate(),wrkDetl.getModel(),wrkDetl.getWeight(),wrkDetl.getLength(),wrkDetl.getVolume()))); |
| | | // wrkDetls.forEach(wrkDetl -> { |
| | | // Double total = 0.0; |
| | | // EntityWrapper<LocDetl> wrapper = new EntityWrapper<>(); |
| | | // LocDetl locDetl = locDetlService.selectOne(wrapper.eq("zpallet", wrkDetl.getZpallet()).eq("matnr", wrkDetl.getMatnr())); |
| | | // if (Cools.isEmpty(locDetl)) { |
| | | // total = wrkDetl.getAnfme(); |
| | | // } else { |
| | | // total = locDetl.getAnfme(); |
| | | // } |
| | | // if (wrkMast.getIoType() == 101 || wrkMast.getIoType() == 1) { |
| | | // ledCommand.getMatDtos().add(new MatDto(wrkDetl.getMatnr(), wrkDetl.getMaktx(), wrkDetl.getBatch(), wrkDetl.getSpecs(), wrkDetl.getManu(), wrkDetl.getMemo(), wrkDetl.getAnfme(),total)); |
| | | // } |
| | | // if (wrkMast.getIoType() == 103 && (null == wrkDetl.getInspect() || 0 == wrkDetl.getInspect())) { |
| | | // ledCommand.getMatDtos().add(new MatDto(wrkDetl.getMatnr(), wrkDetl.getMaktx(), wrkDetl.getBatch(), wrkDetl.getSpecs(), wrkDetl.getManu(), wrkDetl.getMemo(), wrkDetl.getAnfme(),total)); |
| | | // } |
| | | // if (wrkMast.getIoType() == 107) { |
| | | // ledCommand.getMatDtos().add(new MatDto(wrkDetl.getMatnr(), wrkDetl.getMaktx(), wrkDetl.getBatch(), wrkDetl.getSpecs(), wrkDetl.getManu(), wrkDetl.getMemo(), wrkDetl.getAnfme(),total)); |
| | | // } |
| | | // }); |
| | | } |
| | | commands.add(ledCommand); |
| | | } |
| | |
| | | // 判断源站点情况 有任务号,有物,自动 |
| | | SiemensDevpThread devpThread = (SiemensDevpThread) SlaveConnection.get(SlaveType.Devp, 1); |
| | | StaProtocol staProtocol106 = devpThread.getStation().get(106); |
| | | StaProtocol staProtocol105 = devpThread.getStation().get(105); |
| | | if (staProtocol106 == null) { |
| | | return; |
| | | } else { |
| | | staProtocol106 = staProtocol106.clone(); |
| | | } |
| | | if (staProtocol105 == null) { |
| | | return; |
| | | } else { |
| | | staProtocol105 = staProtocol105.clone(); |
| | | } |
| | | // if (staProtocol105 == null) { |
| | | // return; |
| | | // } else { |
| | | // staProtocol105 = staProtocol105.clone(); |
| | | // } |
| | | |
| | | |
| | | // 判断出库站点情况 |
| | | |
| | | |
| | | // 获取堆垛机信息 并 判断是否可入出 |
| | | CrnThread crnThread = (CrnThread) SlaveConnection.get(SlaveType.Crn, 2); |
| | | CrnThread crnThread = (CrnThread) SlaveConnection.get(SlaveType.Crn, 1); |
| | | CrnProtocol crnProtocol = crnThread.getCrnProtocol(); |
| | | if (crnProtocol == null) { |
| | | return; |
| | | } |
| | | BasCrnp basCrnp = basCrnpService.selectById(2); |
| | | BasCrnp basCrnp = basCrnpService.selectById(1); |
| | | if (!basCrnp.getInEnable().equals("Y") && !basCrnp.getOutEnable().equals("Y")) { |
| | | return; |
| | | } |
| | |
| | | } |
| | | |
| | | // 已经存在吊车执行任务时,则过滤 |
| | | if (wrkMastMapper.selectWorking(2) != null) { |
| | | if (wrkMastMapper.selectWorking(1) != null) { |
| | | return; |
| | | } |
| | | // 命令下发区 -------------------------------------------------------------------------- |
| | | CrnCommand crnCommand = new CrnCommand(); |
| | | crnCommand.setCrnNo(2); // 堆垛机编号 |
| | | crnCommand.setCrnNo(1); // 堆垛机编号 |
| | | crnCommand.setTaskNo(wrkMast.getWrkNo().shortValue()); // 工作号 |
| | | crnCommand.setAckFinish((short) 0); // 任务完成确认位 |
| | | crnCommand.setTaskMode(CrnTaskModeType.LOC_MOVE); // 任务模式: 库位移转 |
| | | crnCommand.setSourcePosX((short) 6); // 源库位排 |
| | | crnCommand.setSourcePosY((short) 3); // 源库位列 |
| | | crnCommand.setSourcePosX((short) 3); // 源库位排 |
| | | crnCommand.setSourcePosY((short) 28); // 源库位列 |
| | | crnCommand.setSourcePosZ((short) 1); // 源库位层 |
| | | crnCommand.setDestinationPosX((short) 7); // 目标库位排 |
| | | crnCommand.setDestinationPosX((short) 2); // 目标库位排 |
| | | crnCommand.setDestinationPosY((short) 28); // 目标库位列 |
| | | crnCommand.setDestinationPosZ((short) 1); // 目标库位层 |
| | | if(wrkMast.getStaNo() == 104) { // 目标站104,出到105位置 |
| | | crnCommand.setDestinationPosX((short) 2); // 目标库位排 |
| | | crnCommand.setDestinationPosY((short) 4); // 目标库位列 |
| | | crnCommand.setDestinationPosZ((short) 1); // 目标库位层 |
| | | } |
| | | crnCommand.setTraySize(true); //库位类型 |
| | | if (!MessageQueue.offer(SlaveType.Crn, wrkMast.getCrnNo(), new Task(2, crnCommand))) { |
| | | News.error("106移库2号堆垛机命令下发失败,堆垛机号={},任务数据={}", wrkMast.getCrnNo(), JSON.toJSON(crnCommand)); |
| | | News.error("106移库1号堆垛机命令下发失败,堆垛机号={},任务数据={}", wrkMast.getCrnNo(), JSON.toJSON(crnCommand)); |
| | | } |
| | | // else { |
| | | // wrkMast.setCrnNo(2); |
| | |
| | | # 堆垛机1 |
| | | crn[0]: |
| | | id: 1 |
| | | ip: 10.10.10.1 |
| | | port: 102 |
| | | rack: 0 |
| | | slot: 0 |
| | | # 偏移量,当堆垛机站点列号=1时,偏移量=2 |
| | | offset: 2 |
| | | demo: false |
| | | # 堆垛机入库站点 |
| | | crnInStn[0]: |
| | | devpPlcId: ${wcs-slave.devp[0].id} |
| | | staNo: 103 |
| | | row: 2 |
| | | bay: 1 |
| | | lev: 1 |
| | | crnInStn[1]: |
| | | devpPlcId: ${wcs-slave.devp[0].id} |
| | | staNo: 203 |
| | | row: 2 |
| | | bay: 1 |
| | | lev: 6 |
| | | # 堆垛机出库站点 |
| | | crnOutStn[0]: |
| | | devpPlcId: ${wcs-slave.devp[0].id} |
| | | staNo: 103 |
| | | row: 2 |
| | | bay: 1 |
| | | lev: 1 |
| | | crnOutStn[1]: |
| | | devpPlcId: ${wcs-slave.devp[0].id} |
| | | staNo: 105 |
| | | row: 2 |
| | | bay: 4 |
| | | lev: 1 |
| | | crnOutStn[2]: |
| | | devpPlcId: ${wcs-slave.devp[0].id} |
| | | staNo: 107 |
| | | row: 2 |
| | | bay: 28 |
| | | lev: 1 |
| | | crnOutStn[3]: |
| | | devpPlcId: ${wcs-slave.devp[0].id} |
| | | staNo: 203 |
| | | row: 2 |
| | | bay: 1 |
| | | lev: 6 |
| | | # 堆垛机2 |
| | | crn[1]: |
| | | id: 2 |
| | | ip: 10.10.10.10 |
| | | port: 102 |
| | | rack: 0 |
| | |
| | | crnInStn[0]: |
| | | devpPlcId: ${wcs-slave.devp[0].id} |
| | | staNo: 101 |
| | | row: 3 |
| | | bay: 31 |
| | | row: 6 |
| | | bay: 1 |
| | | lev: 1 |
| | | crnInStn[1]: |
| | | devpPlcId: ${wcs-slave.devp[1].id} |
| | | devpPlcId: ${wcs-slave.devp[0].id} |
| | | staNo: 201 |
| | | row: 3 |
| | | bay: 31 |
| | | row: 6 |
| | | bay: 1 |
| | | lev: 6 |
| | | # 堆垛机出库站点 |
| | | crnOutStn[0]: |
| | | devpPlcId: ${wcs-slave.devp[0].id} |
| | | staNo: 101 |
| | | row: 3 |
| | | bay: 31 |
| | | row: 6 |
| | | bay: 1 |
| | | lev: 1 |
| | | crnOutStn[1]: |
| | | devpPlcId: ${wcs-slave.devp[1].id} |
| | | devpPlcId: ${wcs-slave.devp[0].id} |
| | | staNo: 201 |
| | | row: 3 |
| | | bay: 31 |
| | | row: 6 |
| | | bay: 1 |
| | | lev: 6 |
| | | crnOutStn[2]: |
| | | devpPlcId: ${wcs-slave.devp[0].id} |
| | | staNo: 106 |
| | | row: 3 |
| | | bay: 3 |
| | | lev: 1 |
| | | # 堆垛机2 |
| | | crn[1]: |
| | | id: 2 |
| | | ip: 10.10.10.20 |
| | | port: 102 |
| | | rack: 0 |
| | | slot: 0 |
| | | # 偏移量,当堆垛机站点列号=1时,偏移量=2 |
| | | offset: 2 |
| | | demo: false |
| | | # 堆垛机入库站点 |
| | | crnInStn[0]: |
| | | devpPlcId: ${wcs-slave.devp[0].id} |
| | | staNo: 103 |
| | | row: 7 |
| | | bay: 31 |
| | | lev: 1 |
| | | crnInStn[1]: |
| | | devpPlcId: ${wcs-slave.devp[1].id} |
| | | staNo: 203 |
| | | row: 7 |
| | | bay: 31 |
| | | lev: 6 |
| | | # 堆垛机出库站点 |
| | | crnOutStn[0]: |
| | | devpPlcId: ${wcs-slave.devp[0].id} |
| | | staNo: 103 |
| | | row: 7 |
| | | bay: 31 |
| | | lev: 1 |
| | | crnOutStn[1]: |
| | | devpPlcId: ${wcs-slave.devp[1].id} |
| | | staNo: 203 |
| | | row: 7 |
| | | bay: 31 |
| | | lev: 6 |
| | | crnOutStn[2]: |
| | | devpPlcId: ${wcs-slave.devp[0].id} |
| | | staNo: 105 |
| | | row: 7 |
| | | bay: 27 |
| | | row: 6 |
| | | bay: 28 |
| | | lev: 1 |
| | | |
| | | # 输送线1 |
| | | devp[0]: |
| | | id: 1 |
| | | ip: 10.10.10.50 |
| | | ip: 10.10.10.18 |
| | | port: 102 |
| | | rack: 0 |
| | | slot: 0 |
| | |
| | | barcode: ${wcs-slave.barcode[1].id} |
| | | backSta: 102 |
| | | led: ${wcs-slave.led[1].id} |
| | | # 入库口3 |
| | | inSta[2]: |
| | | staNo: 305 |
| | | # 空板入库口1 |
| | | emptyInSta[0]: |
| | | staNo: 101 |
| | | barcode: ${wcs-slave.barcode[0].id} |
| | | backSta: 100 |
| | | led: ${wcs-slave.led[0].id} |
| | | emptyInSta[1]: |
| | | staNo: 103 |
| | | barcode: ${wcs-slave.barcode[1].id} |
| | | backSta: 102 |
| | | led: ${wcs-slave.led[1].id} |
| | | # emptyInSta[0]: |
| | | # staNo: 101 |
| | | # barcode: ${wcs-slave.barcode[0].id} |
| | | # backSta: 100 |
| | | # led: ${wcs-slave.led[0].id} |
| | | # emptyInSta[1]: |
| | | # staNo: 103 |
| | | # barcode: ${wcs-slave.barcode[1].id} |
| | | # backSta: 102 |
| | | # led: ${wcs-slave.led[1].id} |
| | | # 出库口1 |
| | | outSta[0]: |
| | | staNo: 100 |
| | |
| | | outSta[2]: |
| | | staNo: 104 |
| | | led: ${wcs-slave.led[2].id} |
| | | |
| | | # 输送线2 |
| | | devp[1]: |
| | | id: 2 |
| | | ip: 10.10.10.50 |
| | | port: 102 |
| | | rack: 0 |
| | | slot: 0 |
| | | # 入库口1 |
| | | inSta[0]: |
| | | staNo: 201 |
| | | # 入库口2 |
| | | inSta[1]: |
| | | staNo: 203 |
| | | # # 空板入库口1 |
| | | # emptyInSta[0]: |
| | | # staNo: 106 |
| | | # barcode: ${wcs-slave.barcode[0].id} |
| | | # backSta: 105 |
| | | # led: ${wcs-slave.led[1].id} |
| | | # # 拣料入库口1 |
| | | # pickSta[0]: |
| | | # staNo: 159 |
| | | # barcode: ${wcs-slave.barcode[2].id} |
| | | # led: ${wcs-slave.led[5].id} |
| | | # backSta: 160 |
| | | |
| | | # # 空板入库口1 |
| | | # emptyInSta[1]: |
| | | # staNo: 107 |
| | | # barcode: ${wcs-slave.barcode[1].id} |
| | | # backSta: 108 |
| | | # led: ${wcs-slave.led[2].id} |
| | | ## inSta[2]: |
| | | ## staNo: 159 |
| | | ## barcode: ${wcs-slave.barcode[2].id} |
| | | ## backSta: 160 |
| | | ## led: ${wcs-slave.led[5].id} |
| | | # # # 拣料入库口1 |
| | | # # pickSta[1]: |
| | | # # staNo: 107 |
| | | # # barcode: ${wcs-slave.barcode[1].id} |
| | | # # led: ${wcs-slave.led[1].id} |
| | | # # backSta: 108 |
| | | # 出库口1 |
| | | outSta[0]: |
| | | # 出库口4 |
| | | outSta[3]: |
| | | staNo: 107 |
| | | # 出库口5 |
| | | outSta[4]: |
| | | staNo: 305 |
| | | # outSta[1]: |
| | | # staNo: 152 |
| | | # led: ${wcs-slave.led[3].id} |
| | | # outSta[2]: |
| | | # staNo: 156 |
| | | # led: ${wcs-slave.led[4].id} |
| | | # |
| | | |
| | | # 条码扫描仪1 |
| | | barcode[0]: |
| | | id: 1 |
| | |
| | | "rackCount": 8, |
| | | "crnCount": 2, |
| | | "stbCount": 18, |
| | | "hpPosition": 0, |
| | | "hpPosition": 1, |
| | | "minBayNo": 1, |
| | | "floors": 2, |
| | | "racks": [{ |
| | |
| | | "id": "rack1", |
| | | "top": 189, |
| | | "left": 200, |
| | | "width": 1300, |
| | | "width": 1350, |
| | | "height": 23, |
| | | "minBayNo": 1, |
| | | "maxBayNo": 31 |
| | |
| | | "left": 200, |
| | | "width": 1300, |
| | | "height": 23, |
| | | "minBayNo": 1, |
| | | "maxBayNo": 30 |
| | | "minBayNo": 2, |
| | | "maxBayNo": 31 |
| | | }, { |
| | | "type": "rack", |
| | | "id": "rack7", |
| | |
| | | "left": 200, |
| | | "width": 1300, |
| | | "height": 23, |
| | | "minBayNo": 1, |
| | | "maxBayNo": 30 |
| | | "minBayNo": 2, |
| | | "maxBayNo": 31 |
| | | }, { |
| | | "type": "rack", |
| | | "id": "rack6", |
| | | "top": 365, |
| | | "left": 200, |
| | | "width": 1300, |
| | | "width": 1350, |
| | | "height": 23, |
| | | "minBayNo": 1, |
| | | "maxBayNo": 31 |
| | |
| | | "id": "rack5", |
| | | "top": 338, |
| | | "left": 200, |
| | | "width": 1300, |
| | | "width": 1350, |
| | | "height": 23, |
| | | "minBayNo": 1, |
| | | "maxBayNo": 31 |
| | |
| | | "left": 200, |
| | | "width": 1300, |
| | | "height": 23, |
| | | "minBayNo": 1, |
| | | "maxBayNo": 30 |
| | | "minBayNo": 2, |
| | | "maxBayNo": 31 |
| | | }, { |
| | | "type": "rack", |
| | | "id": "rack3", |
| | |
| | | "left": 200, |
| | | "width": 1300, |
| | | "height": 23, |
| | | "minBayNo": 1, |
| | | "maxBayNo": 30 |
| | | "minBayNo": 2, |
| | | "maxBayNo": 31 |
| | | }, { |
| | | "type": "rack", |
| | | "id": "rack2", |
| | | "top": 217, |
| | | "left": 200, |
| | | "width": 1300, |
| | | "width": 1350, |
| | | "height": 23, |
| | | "minBayNo": 1, |
| | | "maxBayNo": 31 |
| | | }], |
| | | "rackDescs": [{ |
| | | "type": "rackDescs", |
| | | "id": "lb_desc1", |
| | | "text": "#1", |
| | | "id": "lb_desc8", |
| | | "text": "#8", |
| | | "top": 190, |
| | | "left": 150, |
| | | "width": 33, |
| | | "height": 23 |
| | | }, |
| | | {"type": "rackDescs", "id": "lb_desc2", "text": "#2", "top": 218, "left": 150, "width": 33, "height": 23}, |
| | | {"type": "rackDescs", "id": "lb_desc3", "text": "#3", "top": 280, "left": 150, "width": 33, "height": 23}, |
| | | {"type": "rackDescs", "id": "lb_desc4", "text": "#4", "top": 310, "left": 150, "width": 33, "height": 23}, |
| | | {"type": "rackDescs", "id": "lb_desc5", "text": "#5", "top": 340, "left": 150, "width": 33, "height": 23}, |
| | | {"type": "rackDescs", "id": "lb_desc6", "text": "#6", "top": 370, "left": 150, "width": 33, "height": 23}, |
| | | {"type": "rackDescs", "id": "lb_desc7", "text": "#7", "top": 430, "left": 150, "width": 33, "height": 23}, |
| | | {"type": "rackDescs", "id": "lb_desc8", "text": "#8", "top": 460, "left": 150, "width": 33, "height": 23}], |
| | | {"type": "rackDescs", "id": "lb_desc7", "text": "#7", "top": 218, "left": 150, "width": 33, "height": 23}, |
| | | {"type": "rackDescs", "id": "lb_desc6", "text": "#6", "top": 280, "left": 150, "width": 33, "height": 23}, |
| | | {"type": "rackDescs", "id": "lb_desc5", "text": "#5", "top": 310, "left": 150, "width": 33, "height": 23}, |
| | | {"type": "rackDescs", "id": "lb_desc4", "text": "#4", "top": 340, "left": 150, "width": 33, "height": 23}, |
| | | {"type": "rackDescs", "id": "lb_desc3", "text": "#3", "top": 370, "left": 150, "width": 33, "height": 23}, |
| | | {"type": "rackDescs", "id": "lb_desc2", "text": "#2", "top": 430, "left": 150, "width": 33, "height": 23}, |
| | | {"type": "rackDescs", "id": "lb_desc1", "text": "#1", "top": 460, "left": 150, "width": 33, "height": 23}], |
| | | "crns": [{ |
| | | "type": "crane", |
| | | "id": "crn-2", |
| | | "text": "2", |
| | | "id": "crn-1", |
| | | "text": "1", |
| | | "top": 393, |
| | | "left": 376, |
| | | "width": 101, |
| | |
| | | "height": 1 |
| | | }, { |
| | | "type": "crane", |
| | | "id": "crn-1", |
| | | "text": "1", |
| | | "id": "crn-2", |
| | | "text": "2", |
| | | "top": 250, |
| | | "left": 383, |
| | | "width": 101, |
| | |
| | | "left": 287, |
| | | "width": 86, |
| | | "height": 105 |
| | | }, { |
| | | "type": "stn", |
| | | "id": "site-107", |
| | | "text": "107", |
| | | "top": 431, |
| | | "left": 287, |
| | | "width": 86, |
| | | "height": 50 |
| | | }] |
| | | }, { |
| | | "type": "floor", |