| | |
| | | // // TODO Auto-generated catch block |
| | | // e.printStackTrace(); |
| | | // } |
| | | //spianService.selectout2("250"); |
| | | spianService.selectAll("X12345610102GV"); |
| | | 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);// 获取进片车任务是否启动 |
| | |
| | | // |
| | | System.out.println("启动完成"); |
| | | |
| | | // new PlcHold().start(); |
| | | // |
| | | new PlcHold().start(); |
| | | // |
| | | new PlcPositioning2().start(); |
| | | new Plchome().start(); |
| | | // // |
| | | // new PlcParameter().start(); |
| | | // // |
| | | // new Plcalarm().start(); |
| | | // // |
| | | // new Plcsign().start(); |
| | | // // |
| | | // new Plcaction().start(); |
| | | // new Plcstate().start(); |
| | | // new PlcPositioning1().start(); |
| | | // new PlcPositioning2().start(); |
| | | // |
| | | //new PlcPositioning2().start(); |
| | | new Plchome().start(); |
| | | // // |
| | | // new PlcParameter().start(); |
| | | // // |
| | | // new Plcalarm().start(); |
| | | // // |
| | | // new Plcsign().start(); |
| | | // // |
| | | // new Plcaction().start(); |
| | | // new Plcstate().start(); |
| | | // new PlcPositioning1().start(); |
| | | // new PlcPositioning2().start(); |
| | | // new PlcParameter2().start(); |
| | | // new PlcParameter1().start(); |
| | | // new PLCAutomaticParameterSetting().start(); |
| | | // new PlcParameter1().start(); |
| | | // new PLCAutomaticParameterSetting().start(); |
| | | |
| | | // new PlcManualonePosition().start(); |
| | | // new PlcManualonePosition2().start(); |
| | | // new PlcServoManualone().start(); |
| | | // new PLCManualJog().start(); |
| | | // new PlcManualonePosition().start(); |
| | | // new PlcManualonePosition2().start(); |
| | | // new PlcServoManualone().start(); |
| | | // new PLCManualJog().start(); |
| | | } |
| | | } |
| | |
| | | private String cataskStatege; |
| | | private String shelfRack;//起始位 |
| | | private String loadrack;//目标位 |
| | | private Integer count;//玻璃数量 |
| | | |
| | | |
| | | public Integer id() { |
| | |
| | | public Integer getId() { |
| | | return id; |
| | | } |
| | | |
| | | public Integer getCount() { |
| | | return count; |
| | | } |
| | | |
| | | public void setCount(Integer count) { |
| | | this.count = count; |
| | | } |
| | | |
| | | public String getTaskType() { |
| | | return taskType; |
| | | } |
| | |
| | | |
| | | //@Select("(select*from storage_cage as a where a.state=0 and cage%2=0 ORDER BY id LIMIT 1)union (select a.* from storage_cage a inner join (select cage,if(shu2=1,shu3,shu5) as gezi from ( select cage, count(case when state1=1 and state2=0 then cell else null end)as shu1, count(case when state1=0 then cell else null end) as shu2, min(case when state1=1 and state2=0 then cell else null end) as shu3, min(case when state1=0 then cell else null end) as shu4, min(case when state1=0 or state2=0 then cell else null end) as shu5 from (select *,max(state) as state1,min(state) as state2 from storage_cage group by cage,cell) as a where cage%2!=0 GROUP BY cage HAVING shu2>1 or (shu2=1 and shu1>0) ) as sss limit 1)as b on a.cage=b.cage and a.cell=b.gezi and a.state=0 order by tier limit 1) ORDER BY id LIMIT 1;") |
| | | //获取订单号排序的空订单笼子 |
| | | @Select("select a.cage,COUNT(if(a.order_id=#{orderids},a.order_id,null))as orderid,b.shu,c.shu2,a.cell,min(a.state)as state1 from storage_cage a left join (select COUNT(*)shu,cage from storage_cage where order_id=#{orderids} GROUP BY cage)as b on a.cage=b.cage left join(select cage ,COUNT(glass_id)as shu2 from storage_cage GROUP BY cage)c on a.cage=c.cage where (order_id=#{orderids} or ''='') GROUP BY cage,cell HAVING state1=0 ORDER BY shu desc,shu2,cage asc; ") |
| | | @Select("select a.cage,COUNT(if(a.order_id=#{orderids},a.order_id,null))as orderid,b.shu,c.shu2,a.cell,min(a.state)as state1,disabled from storage_cage a left join (select COUNT(*)shu,cage from storage_cage where order_id=#{orderids} GROUP BY cage)as b on a.cage=b.cage left join(select cage ,COUNT(glass_id)as shu2 from storage_cage GROUP BY cage)c on a.cage=c.cage where (order_id=#{orderids} or ''='') GROUP BY cage,cell HAVING state1=0 ORDER BY shu desc,shu2,cage asc; ") |
| | | List<StorageCage> selectAll(String orderids); |
| | | //获取判断该格子是否需要把外片推入内片位置 |
| | | @Select("select state from storage_cage where cage=#{cage} and cell=#{cell} and tier=1;") |
| | |
| | | // @Insert("insert into user(name, date, address, user_no) values (#{name}, #{date}, #{address}, #{userNo})") |
| | | // void insert (Spian spian); |
| | | //新增任务表 |
| | | @Insert("INSERT INTO `canadames`.`storage_task`(`task_type`, `task_state`, `shelf_rack`, `load_rack`,start_time,glass_id) VALUES (#{tasktype},#{taskstate},#{shelfrack},#{loadrack},now(),#{glassid});") |
| | | void Inserttask(int tasktype,int taskstate,int shelfrack,int loadrack,String glassid); |
| | | @Insert("INSERT INTO `canadames`.`storage_task`(`task_type`, `task_state`, `shelf_rack`, `load_rack`,start_time,glass_id,count) VALUES (#{tasktype},#{taskstate},#{shelfrack},#{loadrack},now(),#{glassid},#{count});") |
| | | void Inserttask(int tasktype,int taskstate,int shelfrack,int loadrack,String glassid,int count); |
| | | //修改任务表 |
| | | @Update("update storage_task set task_state=#{state} where task_type=#{type} and task_state=0;") |
| | | void Updatetask(int state,int type); |
| | |
| | | } |
| | | // 判断选中笼子是否有合适宽度空格 |
| | | // 有合适空格时进片 |
| | | if (cages1 != null && cages >= 1) { |
| | | if (cages1 != null && cages >= 1&&storageCage2.getDisabled()==0) { |
| | | ids = cages1.getId();// 数据库ID |
| | | tiers = cages1.getTier();// 内外片 |
| | | cells = cages1.getCell();// 格子号 |
| | |
| | | //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());// 新增任务 |
| | | spianMapper.Inserttask(0, 0, 1000, ids, glassid.toString(),prctier);// 新增任务 |
| | | S7control.getinstance().WriteWord(adddresslist, datas); |
| | | System.out.println("汇报时任务|" + datas); |
| | | |
| | |
| | | //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());// 新增任务 |
| | | spianMapper.Inserttask(0, 0, 1000, ids, glassid.toString(),prctier);// 新增任务 |
| | | S7control.getinstance().WriteWord(adddresslist, datas); |
| | | System.out.println("汇报时任务|" + datas); |
| | | |
| | |
| | | spianMapper.UpdataOutCage1(glasswidth, cage, cell);// 增加原格子宽度 |
| | | spianMapper.UpdataGlassCageState(glassid,3);//更改笼子表的玻璃状态 |
| | | |
| | | spianMapper.Inserttask(1, 0, cageout.getId(), 1000, glassid);// 新增任务 |
| | | spianMapper.Inserttask(1, 0, cageout.getId(), 1000, glassid,state);// 新增任务 |
| | | // int state = spianMapper.selectGlassState(cage, cell);//获取格子数量 |
| | | if (state == 2) { |
| | | spianMapper.UpdateDBCage1(cage, cell);// 将内片数据更新到外片里 |
| | |
| | | datas.add((short) 1); |
| | | datas.add((short) 1); |
| | | spianMapper.OverOutSlice(glassid, 1);//更新出片队列任务状态为进行中 |
| | | spianMapper.Inserttask(1, 0, cageout.getId(), 1000, glassid);// 新增任务 |
| | | spianMapper.Inserttask(1, 0, cageout.getId(), 1000, glassid,1);// 新增任务 |
| | | spianMapper.UpdataOutCage1(glasswidth, cage, cell);// 增加原格子宽度 |
| | | spianMapper.UpdataGlassCageState(glassid,3);//更改笼子表的玻璃状态 |
| | | spianMapper.OverOutSlice(glassid,2);//完成出片队列任务 |
| | |
| | | spianMapper.UpdataAddCage1(glasswidth, cages, cells);// 减少新格子宽度 |
| | | spianMapper.UpdataOutCage1(glasswidth, cage, cell);// 增加原格子宽度 |
| | | spianMapper.UpdataGlassCageState(glassids,3);//更改笼子表的玻璃状态 |
| | | spianMapper.Inserttask(2, 0, cageout.getId(), ids, glassid);// 新增调度任务 |
| | | spianMapper.Inserttask(2, 0, cageout.getId(), ids, glassid,2);// 新增调度任务 |
| | | //spianMapper.Inserttask(1, 0, cageout.getId(), 1000, glassid);// 新增出片任务 |
| | | // 传输mes数据,坐标,数据 |
| | | S7control.getinstance().WriteWord(adddresslist, datas);// 派发出片车任务 |
| | |
| | | datas.add((short) 2); |
| | | datas.add((short) 1); |
| | | String glassids = spianMapper.SelectGlassid(cage, cell); // 获取被调拨的玻璃id |
| | | spianMapper.Inserttask(2, 0, cageout.getId() + 1, ids, glassid);// 新增调度任务 |
| | | spianMapper.Inserttask(2, 0, cageout.getId() + 1, ids, glassid,2);// 新增调度任务 |
| | | //spianMapper.Inserttask(1, 0, cageout.getId(), 1000, glassid);// 新增出片任务 |
| | | spianMapper.UpdateDBCage(ids, cage, cell,2);// 将原格子数据更新到新格子里 |
| | | spianMapper.UpdataAddCage1(glasswidth, cages, cells);// 减少新格子宽度 |