| | |
| | | // // TODO Auto-generated catch block |
| | | // e.printStackTrace(); |
| | | // } |
| | | // 判断进片请求 |
| | | List<Short> datas1List = S7control.getinstance().ReadWord("DB106.24", 1);// 获取prc进片请求数据 |
| | | |
| | | |
| | | |
| | | |
| | | List<Short> datas1List = S7control.getinstance().ReadWord("DB106.24", 1);// 获取prc进片请求数据 |
| | | List<Short> datas1ListState = S7control.getinstance().ReadWord("DB106.8", 1);// 获取进片车状态 |
| | | List<Short> datas1ListState2 = S7control.getinstance().ReadWord("DB105.16", 1);// 获取进片车任务是否启动 |
| | | |
| | |
| | | // 当B01小车汇报完成时更改玻璃状态为1 |
| | | spianMapper.UpdateCageOver(B01glassid.toString(), 1);// 更改笼子表进片状态 |
| | | spianMapper.Updatetask(1, 0);// 更改进片任务状态为1 |
| | | spianMapper.overqueue(B01glassid.toString(), 0);// 更改上片任务表的状态为0 |
| | | spianMapper.UpdatetaskOut(B01glassid.toString()); // 完成上一次出片或者进片任务 |
| | | spianMapper.OverOutSlice(B01glassid.toString(),2);//完成出片队列任务 |
| | | S7control.getinstance().WriteWord("DB106.60", (short) 0);// 恢复B01小车应答改为0 |
| | | S7control.getinstance().WriteWord("DB105.48", (short) 1);//汇报B01小车收到 |
| | | |
| | | //S7control.getinstance().WriteWord("DB105.48", (short) 1);//汇报B01小车收到 |
| | | } |
| | | |
| | | // 当出片小车完成任务时 |
| | | if (B02backs == true) { |
| | | // 当B02小车汇报完成时更改玻璃状态为0 |
| | | spianMapper.UpdateCageOver(B02glassid.toString(), 0);// 更改笼子表出片状态 |
| | | spianMapper.UpdatetaskOut(B02glassid.toString()); // 完成上一次出片或者调度任务 |
| | | S7control.getinstance().WriteWord("DB105.50", (short) 0);// 恢复B02小车应答改为0 |
| | | spianMapper.UpdatetaskOut(B02glassid.toString()); // 完成上一次出片或者进片任务 |
| | | spianMapper.OverOutSlice(B02glassid.toString(),2);//完成出片队列任务 |
| | | S7control.getinstance().WriteWord("DB106.62", (short) 0);// 恢复B02小车应答改为0 |
| | | // S7control.getinstance().WriteWord("DB105.50", (short) 1);//汇报B02小车收到 |
| | | } |
| | | |
| | | // 获取DO1数据 |
| | | StringBuilder queueid1 = spianService.queGlassid("DB103.44", 14); |
| | | StringBuilder queueid1 = spianService.queGlassid("DB106.26", 14);//获取请求的id跟DO1同时清 |
| | | // 获取DO2数据 |
| | | StringBuilder queueid2 = spianService.queGlassid("DB103.58", 14); |
| | | System.out.println("D01|" + queueid1); |
| | |
| | | north_glass_buffer1 glass2 = spianMapper.selectGlass(queueid2.toString());// D02玻璃信息 |
| | | // 当扫码位玻璃id为空时 宽度为0 |
| | | |
| | | if (queueid1 != null&&questate==0) { |
| | | if (queueid1 != null &&questate==0) { |
| | | // 写入D01的数据到上片队列表 |
| | | if (glass1 == null) { //当没有值时传空 |
| | | spianMapper.Updatequeue(null,null,null,null, 0, null, null, null, null, 1); |
| | | } else { |
| | | spianMapper.overqueue2(queueid2.toString(), 0, 1);// 更改扫码位任务表的状态为0 |
| | | |
| | | spianMapper.Updatequeue(queueid1.toString(),glass1.getordernumber(),glass1.getlistnumber(),glass1.getboxnumber(),0,glass1.getglasslengthmm().toString(),glass1.getglassheightmm().toString(),glass1.getglasslength().toString(),glass1.getglassheight().toString(),1); |
| | | } |
| | | |
| | |
| | | if(glass2==null){ |
| | | spianMapper.Updatequeue(null,null,null,null, 0, null, null, null, null, 2); |
| | | }else{ |
| | | spianMapper.Updatequeue(queueid1.toString(),glass2.getordernumber(),glass2.getlistnumber(),glass2.getboxnumber(),0,glass2.getglasslengthmm().toString(),glass2.getglassheightmm().toString(),glass2.getglasslength().toString(),glass2.getglassheight().toString(),2); |
| | | |
| | | spianMapper.Updatequeue(queueid2.toString(),glass2.getordernumber(),glass2.getlistnumber(),glass2.getboxnumber(),0,glass2.getglasslengthmm().toString(),glass2.getglassheightmm().toString(),glass2.getglasslength().toString(),glass2.getglassheight().toString(),2); |
| | | spianMapper.overqueue2(queueid2.toString(), 0, 1);// 更改扫码位任务表的状态为0 |
| | | S7control.getinstance().WriteWord("DB105.16", (short) 0);//关闭任务启动 |
| | | } |
| | | |
| | |
| | | boolean outstate1 = false;// 出片车任务是否启动 |
| | | if (outlist != null && outlist1 != null) { |
| | | // 判断按订单出片 |
| | | outstate = outlist.contains((short) 0);// 出片车空闲判断 |
| | | outstate1 = outlist1.contains((short) 1);// 出片车任务是否启动 |
| | | outstate = outlist.contains((short) 0);// 出片车空闲判断 当出片车空闲时为true |
| | | outstate1 = outlist1.contains((short) 1);// 出片车任务是否启动 当出片车任务启动时为true |
| | | |
| | | north_glass_buffer1 glass = spianMapper.SelectDBOut();// 判断是否有调拨后的出片任务未完成 |
| | | |
| | |
| | | // 判断铝框出片队列表是否有待出片的玻璃 |
| | | String outglassid = spianMapper.SelectOutSlice(); |
| | | if (outglassid != null) { |
| | | spianMapper.OverOutSlice(outglassid,1); |
| | | spianService.selectout2(outglassid); |
| | | outstate = false; |
| | | } |
| | | } |
| | | if (outstate == true) {// 下发任务后将任务启动改为0//出片车空闲判断 |
| | | if (outstate == true) {//当出片车空闲时,且出片启动为1时,任务启动改为0 |
| | | if (outstate1 == true) { |
| | | S7control.getinstance().WriteWord("DB105.18", (short) 0);// 出片任务启动改为0 |
| | | } |
| | |
| | | |
| | | new PlcHold().start(); |
| | | |
| | | new Plcaction().start(); |
| | | // new Plcaction().start(); |
| | | // |
| | | new Plchome().start(); |
| | | // |
| | | new PlcParameter().start(); |
| | | // |
| | | // new PlcParameter().start(); |
| | | |
| | | // new Plcalarm().start(); |
| | | // |
| | | new Plcsign().start(); |
| | | // |
| | | |
| | | // new Plcsign().start(); |
| | | |
| | | // new Plcstate().start(); |
| | | // new PlcPositioning1().start(); |
| | | // new PlcPositioning2().start(); |
| | |
| | | // new PlcServoManualone().start(); |
| | | // new PLCManualJog().start(); |
| | | // new PlcManualonePosition().start(); |
| | | new PlcManualonePosition2().start(); |
| | | // new PlcManualonePosition2().start(); |
| | | } |
| | | } |
New file |
| | |
| | | package com.example.springboot.entity; |
| | | |
| | | public class Out_slice { |
| | | private int id; |
| | | private String glassId; |
| | | private String barcode; |
| | | private double glasswidth; |
| | | private double glassheight; |
| | | private int state; |
| | | private String time; |
| | | |
| | | private north_glass_buffer1 north_glass_buffer1s; |
| | | |
| | | public void setnorth_glass_buffer1s(north_glass_buffer1 north_glass_buffer1s) { |
| | | this.north_glass_buffer1s = north_glass_buffer1s; |
| | | } |
| | | |
| | | public north_glass_buffer1 getnorth_glass_buffer1s() { |
| | | return north_glass_buffer1s; |
| | | } |
| | | |
| | | private StorageCage storageCage; |
| | | |
| | | public void setstorageCage(StorageCage storageCage) { |
| | | this.storageCage = storageCage; |
| | | } |
| | | |
| | | public StorageCage getstorageCage() { |
| | | return storageCage; |
| | | } |
| | | |
| | | public Out_slice() { |
| | | } |
| | | |
| | | public Out_slice(int ID, String glassId, String barCode, double glasswidth, double glassheight, int state, String time) { |
| | | this.id = ID; |
| | | this.glassId = glassId; |
| | | this.barcode = barCode; |
| | | this.glasswidth = glasswidth; |
| | | this.glassheight = glassheight; |
| | | this.state = state; |
| | | this.time = time; |
| | | } |
| | | |
| | | public int getID() { |
| | | return id; |
| | | } |
| | | |
| | | public String getGlassId() { |
| | | return glassId; |
| | | } |
| | | |
| | | public String getBarCode() { |
| | | return barcode; |
| | | } |
| | | |
| | | public double getGlasswidth() { |
| | | return glasswidth; |
| | | } |
| | | |
| | | public double getGlassheight() { |
| | | return glassheight; |
| | | } |
| | | |
| | | public int getState() { |
| | | return state; |
| | | } |
| | | |
| | | public String getTime() { |
| | | return time; |
| | | } |
| | | |
| | | public void setID(int ID) { |
| | | this.id = ID; |
| | | } |
| | | |
| | | public void setGlassId(String glassId) { |
| | | this.glassId = glassId; |
| | | } |
| | | |
| | | public void setBarCode(String barCode) { |
| | | barcode = barCode; |
| | | } |
| | | |
| | | public void setGlasswidth(double glasswidth) { |
| | | this.glasswidth = glasswidth; |
| | | } |
| | | |
| | | public void setGlassheight(double glassheight) { |
| | | this.glassheight = glassheight; |
| | | } |
| | | |
| | | public void setState(int state) { |
| | | this.state = state; |
| | | } |
| | | |
| | | public void setTime(String time) { |
| | | this.time = time; |
| | | } |
| | | |
| | | } |
| | |
| | | private double glasslength;//玻璃宽 |
| | | private double glassheight;//玻璃高 |
| | | private double glasslengthmm;//玻璃宽mm |
| | | private double glassheightmm; |
| | | private double glassheightmm;//玻璃高mm |
| | | |
| | | private String glassoutside;// |
| | | private String glassinside;// |
| | |
| | | private String slotnumber;// |
| | | private String datemodified;// |
| | | private String datecreated;// |
| | | private String FrameBarcode;// |
| | | private String FrameBarcode;//铝框id |
| | | |
| | | private StorageCage storageCage; |
| | | |
| | |
| | | |
| | | |
| | | //获取玻璃信息 |
| | | @Select("select ordernumber ,glasslength_mm as glasslengthmm,glassheight_mm as glassheightmm,barcode,listnumber,boxnumber,glasslength,glassheight from north_glass_buffer1 where barcode=#{glassid}") |
| | | @Select("select *,ordernumber ,glasslength_mm as glasslengthmm,glassheight_mm as glassheightmm,barcode,listnumber,boxnumber,glasslength,glassheight from north_glass_buffer1 where barcode=#{glassid}") |
| | | north_glass_buffer1 selectGlass(String glassid); |
| | | |
| | | //出片任务查询 |
| | |
| | | //修改笼子信息(进片) |
| | | @Update("update storage_cage set state=#{state},glass_id=#{glassid},order_id=#{orderid},glasswidth=#{width} where id=#{id};") |
| | | void UpdataAddCage(String orderid,String glassid,double width,int cage,int cell,int id,int state); |
| | | |
| | | @Update("update storage_cage set state=#{state},glass_id=#{glassid},order_id=#{glass.ordernumber},glasswidth=#{glass.glasslengthmm},glassheight=#{glass.glassheightmm},glasswidthmm=#{glass.glasslength},glassheightmm=#{glass.glassheight},listid=#{glass.listnumber},boxid=#{glass.boxnumber} where id=#{id};") |
| | | void UpdataAddCage2(String orderid,String glassid,north_glass_buffer1 glass,int cage,int cell,int id,int state); |
| | | //修改笼子信息(多片进片) |
| | | @Update("update storage_cage set state=#{state},glass_id=#{glassid},order_id=#{orderid},glasswidth=#{width} where cage=#{cage} and cell=#{cell} and tier=#{tier};") |
| | | void UpdataAddqueCage(String orderid,String glassid,double width,int cage,int cell,int tier,int state); |
| | |
| | | @Update("update storage_cage set width=width+#{width} where cage=#{cage} and cell=#{cell};") |
| | | void UpdataOutCage1(double width,int cage,int cell); |
| | | //调拨更换笼子信息 |
| | | @Update("update storage_cage as a,(select*from storage_cage b where b.cage=#{cage} and b.cell=#{cell} and b.tier=#{tier})as b set a.glass_id=b.glass_id,a.order_id=b.order_id,a.state=1,a.glasswidth=b.glasswidth where a.id=#{id1}") |
| | | @Update("update storage_cage as a,(select*from storage_cage b where b.cage=#{cage} and b.cell=#{cell} and b.tier=#{tier})as b set a.glass_id=b.glass_id,a.order_id=b.order_id,a.state=1,a.glasswidth=b.glasswidth,a.glassheight=b.glassheight,a.glasswidthmm=b.glasswidthmm,a.glassheightmm=b.glassheightmm,a.listid=b.listid,a.boxid=b.boxid where a.id=#{id1}") |
| | | void UpdateDBCage(int id1,int cage,int cell,int tier); |
| | | // @Insert("insert into user(name, date, address, user_no) values (#{name}, #{date}, #{address}, #{userNo})") |
| | | // void insert (Spian spian); |
| | |
| | | @Update("update storage_task set task_state=#{state} where task_type=#{type} and task_state=0;") |
| | | void Updatetask(int state,int type); |
| | | //修改任务表 |
| | | @Update("update storage_task set task_state=1 where (task_type=1 or task_type=2) and task_state=0 and glass_id=#{glassid};") |
| | | @Update("update storage_task set task_state=1 where task_state=0 and glass_id=#{glassid};") |
| | | void UpdatetaskOut(String glassid); |
| | | //查询按订单出片 |
| | | @Select("select order_id state from order_out where state=0") |
| | | String SelectOrderout(); |
| | | //内外片调换 |
| | | @Update("update storage_cage as a,(select*from storage_cage b where b.cage=#{cage} and b.cell=#{cell} and b.tier=2)as b set a.glass_id=b.glass_id,a.order_id=b.order_id,a.state=1,a.glasswidth=b.glasswidth where a.cage=#{cage} and a.cell=#{cell} and a.tier=1") |
| | | @Update("update storage_cage as a,(select*from storage_cage b where b.cage=#{cage} and b.cell=#{cell} and b.tier=1)as b set a.glass_id=b.glass_id,a.order_id=b.order_id,a.state=1,a.glasswidth=b.glasswidth,a.glassheight=b.glassheight,a.glasswidthmm=b.glasswidthmm,a.glassheightmm=b.glassheightmm,a.listid=b.listid,a.boxid=b.boxid where a.cage=#{cage} and a.cell=#{cell} and a.tier=2") |
| | | void UpdateDBCage1(int cage,int cell); |
| | | //清除内片数据 |
| | | @Update("update storage_cage set glass_id='',order_id='',state=0,glasswidth=0 where a.cage=#{cage} and a.cell=#{cell} and a.tier=1;") |
| | | @Update("update storage_cage a set glass_id='',order_id='',state=0,glasswidth=0,glassheight=0,glasswidthmm=0,glassheightmm=0,listid=null,boxid=null where a.cage=#{cage} and a.cell=#{cell} and a.tier=1;") |
| | | void UpdateDBCage2(int cage,int cell); |
| | | //判断是否有调拨完后出片的任务 |
| | | @Select("select COUNT(*)as id,glass_id as barcode from storage_task where (task_type=1 or task_type=2) and task_state=0;") |
| | |
| | | @Select("SELECT COUNT(*) FROM `storage_cage` where state=3;") |
| | | Integer Selectoutstate(); |
| | | //判断队列表是否有该玻璃 |
| | | @Select("select COUNT(*) from queue where glassid=#{glassid};") |
| | | @Select("select COUNT(*) from queue where glassid=#{glassid} and state=1;") |
| | | int Selectquecount(String glassid); |
| | | //更新进片队列 |
| | | @Update("update queue set glassid=#{glassid},orderid=#{orderid},listid=#{listid},boxid=#{boxid},state=#{state},glasswidthmm=#{glasswidthmm},glassheightmm=#{glassheightmm},glasswidth=#{glasswidth},glassheight=#{glassheight} where type=#{type};") |
| | |
| | | //判断铝框出片表是否有玻璃正在出片中 |
| | | @Select("SELECT count(*) FROM `out_slice` where state=1;") |
| | | int SelectOutSliceshu(); |
| | | //完成出片队列的任务 |
| | | @Update("update out_slice set state=#{state} where glassid=#{glassid}") |
| | | void OverOutSlice(String glassid,int state); |
| | | |
| | | } |
| | | |
| | |
| | | //将外片玻璃的数据更新到内片 |
| | | spianMapper.UpdateDBCage(ids, cage1, cells,1); |
| | | //将新入的玻璃存入外片 |
| | | spianMapper.UpdataAddCage(orderids.toString(), glassid, widths, cage1, cells, ids-1, 2); |
| | | //spianMapper.UpdataAddCage(orderids, glassid, widths, cage1, cells, ids-1, 2); |
| | | spianMapper.UpdataAddCage2(orderids, glassid, glasslist, cage1,cells, ids-1, 2); |
| | | spianMapper.UpdataAddCage1(widths, cage1, cells);// 减少格子宽度 |
| | | spianMapper.Inserttask(0, 0, 1000, ids, glassid.toString());// 新增任务 |
| | | S7control.getinstance().WriteWord(adddresslist, datas); |
| | | |
| | | }else{ |
| | | // 数据库修改笼子表新增一条玻璃 |
| | | spianMapper.UpdataAddCage(orderids.toString(), glassid, widths, cage1, cells, ids, 2); |
| | | //spianMapper.UpdataAddCage(orderids, glassid, widths, cage1, cells, ids, 2); |
| | | spianMapper.UpdataAddCage2(orderids, glassid, glasslist, cage1,cells, ids, 2); |
| | | spianMapper.UpdataAddCage1(widths, cage1, cells);// 减少格子宽度 |
| | | spianMapper.Inserttask(0, 0, 1000, ids, glassid.toString());// 新增任务 |
| | | S7control.getinstance().WriteWord(adddresslist, datas); |
| | |
| | | north_glass_buffer1 qglass = spianMapper.SelectQueueGlass(i); |
| | | width = qglass.getglasslengthmm();// 格子剩余宽度 |
| | | glassid=qglass.getbarcode(); |
| | | spianMapper.UpdataAddqueCage(qglass.getordernumber(), qglass.getbarcode(), width, cage1, cells, i, |
| | | 1); |
| | | spianMapper.UpdataAddqueCage(qglass.getordernumber(), qglass.getbarcode(), width, cage1, cells, i,1); |
| | | spianMapper.UpdataAddCage1(width, cage1, cells);// 减少格子宽度 |
| | | spianMapper.Inserttask(0, 0, 1000, ids, qglass.getbarcode().toString());// 新增任务 |
| | | } |
| | |
| | | spianMapper.UpdataAddCage(orderid, glassid, widths, cage1, cells, ids, 2); |
| | | spianMapper.UpdataAddCage1(widths, cage1, cells);// 减少格子宽度 |
| | | spianMapper.Inserttask(0, 0, 1000, ids, glassid.toString());// 新增任务 |
| | | outmesid(glassid,"DB105.20"); |
| | | outmesid(glassid,"DB105.20");//派发进片id |
| | | // S7control.getinstance().WriteWord(adddresslist, datas); |
| | | break; |
| | | // S7control.getinstance().WriteByte("DB105.16",glassid); |
| | |
| | | spianMapper.UpdateDBCage1(cage, cell);// 将内片数据更新到外片里 |
| | | spianMapper.UpdateDBCage2(cage, cell);// 清除内片数据 |
| | | } |
| | | |
| | | S7control.getinstance().WriteWord(adddresslist, datas);// 派发出片车任务 |
| | | outmesid(glassid,"DB105.34");// 派发出片ID |
| | | |
| | |
| | | spianMapper.Inserttask(1, 0, cageout.getId(), 1000, glassid);// 新增任务 |
| | | spianMapper.UpdataOutCage1(glasswidth, cage, cell);// 增加原格子宽度 |
| | | spianMapper.UpdataGlassCage("", "", glasswidth, cage, cell, tier, 3);// 清除格子玻璃信息 |
| | | spianMapper.OverOutSlice(glassid,2);//完成出片队列任务 |
| | | S7control.getinstance().WriteWord(adddresslist, datas);// 派发出片车任务 |
| | | |
| | | return (200);// 结束 |