Merge branch 'master' of http://10.153.19.25:10101/r/Albania_Mes
# Conflicts:
# Albania_Mes-ui/src/views/home/index.vue
| | |
| | | // System.out.println(jsonFilePath); |
| | | |
| | | //readAndUpdateWordValues(PlcReadObject); |
| | | List<Short> ss=S7control.getinstance().ReadWord("DB14.0", 1); |
| | | readAndUpdateWordValues(PlcMesObject); |
| | | //readAndUpdateWordValues(PlcframeObject); |
| | | // readAndUpdateWordValues(PlcframeObject); |
| | | |
| | | |
| | | // readAndUpdateWordValues(plcStateObject); |
| | | // int index = PlcMesObject.getPlcParameter("AddStart").getAddressIndex(); |
| | | // // System.out.println(index); |
| | |
| | | package com.example.springboot.component; |
| | | |
| | | import java.time.LocalDateTime; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import com.example.springboot.service.JdbcConnections; |
| | | import com.example.springboot.service.SpianServiceNew; |
| | | import com.example.springboot.entity.north_glass_buffer1; |
| | | import com.example.springboot.service.StorageCageService; |
| | | import com.example.springboot.entity.GlassInfo; |
| | | import com.example.springboot.entity.device.PlcParameterObject; |
| | | import com.example.springboot.mapper.AlarmMapper; |
| | | import com.example.springboot.mapper.AlbaniaMapper; |
| | | import com.example.springboot.mapper.SpianMapper; |
| | | |
| | | |
| | | public class PlcHoldNew extends Thread { |
| | | |
| | | private AlarmMapper alarmMapper; |
| | | |
| | | @Autowired |
| | | private JdbcConnections jdbcConnections; |
| | | private AlbaniaMapper albaniaMapper; |
| | | private SpianServiceNew spianService; |
| | | private StorageCageService storageCageService; |
| | | int aaa; |
| | | |
| | | @Override |
| | |
| | | // \\ TODO Auto-generated catch block |
| | | e.printStackTrace(); |
| | | } |
| | | |
| | | |
| | | |
| | | storageCageService = WebSocketServer.applicationContext.getBean(StorageCageService.class); |
| | | spianService = WebSocketServer.applicationContext.getBean(SpianServiceNew.class); |
| | | albaniaMapper = WebSocketServer.applicationContext.getBean(AlbaniaMapper.class); |
| | | //spianService.selectAll(albaniaMapper.SelectGlass()); |
| | | |
| | | //读取DB14区文件 |
| | | PlcParameterObject plcmes=PLCAutoMes.PlcMesObject; |
| | | |
| | | if(plcmes.getPlcParameter("PLCToMES").getValue()!=null){ |
| | | |
| | | // spianService.Mestast("1234567890123",40,0,2,"MESID1"); |
| | | // S7control.getinstance().WriteWord(plcmes.getPlcParameter("MESToPLC").getAddress(), (short)2);//出片任务启动 |
| | | |
| | | String ExportTOMES1=plcmes.getPlcParameter("ExportTOMES1").getValue();//出片请求一线 |
| | | String ExportToMES2=plcmes.getPlcParameter("ExportToMES2").getValue();//出片请求二线 |
| | | String PLCToMES=plcmes.getPlcParameter("PLCToMES").getValue();//进片请求 |
| | | String B01State=plcmes.getPlcParameter("B01State").getValue();//运送车请求 |
| | | String TastState=plcmes.getPlcParameter("MESToPLCStatus1").getValue();//任务完成 |
| | | |
| | | String PLCToMES=plcmes.getPlcParameter("PLCToMES").getValue();//运送车请求 |
| | | //String B01State=plcmes.getPlcParameter("B01State").getValue();//运送车请求 |
| | | String IDStatus1=plcmes.getPlcParameter("IDStatus1").getValue();//1号任务完成 |
| | | String MESToPLCStatus1=plcmes.getPlcParameter("MESToPLCStatus1").getValue();//1号确认字 |
| | | |
| | | //一号线请求 |
| | | // if (ExportTOMES1.equals("1") == true&&B01State.equals("0")==true) { |
| | | // //将运输车状态改为忙碌 |
| | | // S7control.getinstance().WriteWord(plcmes.getPlcParameter("B01report").getAddress(), (short) 1); |
| | | // spianService.selectout(1); |
| | | // } |
| | | // //二线号请求时 |
| | | // if (ExportToMES2.equals("1") == true&&B01State.equals("0")==true) { |
| | | // //将运输车状态改为忙碌 |
| | | // S7control.getinstance().WriteWord(plcmes.getPlcParameter("B01report").getAddress(), (short) 1); |
| | | // spianService.selectout(2); |
| | | // } |
| | | //进片请求时 |
| | | if(PLCToMES!=null && B01State!=null){ |
| | | if(PLCToMES.equals("1")==true&&B01State.equals("0")==true){ |
| | | if(ExportTOMES1!=null){ |
| | | if (ExportTOMES1.equals("1") == true&&PLCToMES.equals("1")==true) { |
| | | //将运输车状态改为忙碌 |
| | | //S7control.getinstance().WriteWord(plcmes.getPlcParameter("B01report").getAddress(), (short) 1); |
| | | |
| | | spianService.selectAll(albaniaMapper.SelectGlass()); |
| | | spianService.selectout(1); |
| | | } |
| | | } |
| | | // //二线号请求时 |
| | | if(ExportToMES2!=null ){ |
| | | if (ExportToMES2.equals("1") == true&&PLCToMES.equals("1")==true) { |
| | | //将运输车状态改为忙碌 |
| | | S7control.getinstance().WriteWord(plcmes.getPlcParameter("B01report").getAddress(), (short) 1); |
| | | spianService.selectout(2); |
| | | } |
| | | } |
| | | //进片请求时 |
| | | GlassInfo glass=albaniaMapper.SelectGlass(); |
| | | if(PLCToMES!=null && glass!=null){ |
| | | if(PLCToMES.equals("1")==true&&glass!=null){ |
| | | spianService.selectAll(glass); |
| | | } |
| | | } |
| | | |
| | | |
| | | //任务完成时 |
| | | if(TastState.equals("1")==true){ |
| | | |
| | | if(IDStatus1.equals("1")==true && MESToPLCStatus1.equals("0")==true){ |
| | | //完成确认字 |
| | | for(int i=1;i<7;i++){ |
| | | String Tastover=plcmes.getPlcParameter("IDStatus"+i).getValue();//依次获取任务类型 |
| | | String Glassid=plcmes.getPlcParameter("MESID"+i).getValue();//依次获取任务类型 |
| | | |
| | | String Tastover=plcmes.getPlcParameter("IDStatus"+i).getValue();//PLC理片任务状态汇报 |
| | | String Glassid=plcmes.getPlcParameter("MESID"+i).getValueString();//MES玻璃ID |
| | | |
| | | GlassInfo id=albaniaMapper.SelectTaskId(Glassid); |
| | | if(Tastover.equals("1")){ |
| | | |
| | | //调用完成任务 Glassid |
| | | S7control.getinstance().WriteWord(plcmes.getPlcParameter("MESToPLCStatus"+i).getAddress(), (short) 1);//完成确认字 |
| | | if(id!=null){ |
| | | //调用完成任务 Glassid |
| | | storageCageService.FinishTask(id.getId()); |
| | | } |
| | | S7control.getinstance().WriteWord(plcmes.getPlcParameter("MESToPLC").getAddress(), (short) 0);//清除任务字 |
| | | S7control.getinstance().WriteWord(plcmes.getPlcParameter("MESToPLCStatus"+i).getAddress(), (short) 1);//完成确认字 |
| | | |
| | | } |
| | | |
| | | |
| | | |
| | | } |
| | | } |
| | | //汇报取消时 |
| | | if(IDStatus1.equals("0")==true &&MESToPLCStatus1.equals("1")){ |
| | | |
| | | //取消确认字 |
| | | for(int i=1;i<7;i++){ |
| | | String Tastover=plcmes.getPlcParameter("IDStatus"+i).getValue();//依次获取任务汇报 |
| | | if(Tastover.equals("0")){ |
| | | //S7control.getinstance().WriteWord(plcmes.getPlcParameter("IDStatus"+i).getAddress(), (short) 0);//清除确认字 |
| | | S7control.getinstance().WriteWord(plcmes.getPlcParameter("MESToPLCStatus"+i).getAddress(), (short) 0);//清除确认字 |
| | | // System.out.println(plcmes.getPlcParameter("MESToPLCStatus1").getValue()); |
| | | // System.out.println(S7control.getinstance().ReadWord("DB14.158", 1)); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | } |
| | | |
| | | // 查询数据库 |
| | | // 推送到前端 |
| | | |
| | | // } |
| | | |
| | | } |
| | | } |
| | | |
| | |
| | | //读取DB105区文件 |
| | | PlcParameterObject plcmes=PLCAutoMes.PlcMesObject; |
| | | |
| | | // String PlcRequest=plcmes.getPlcParameter("GaToMES").getValue();//请求 |
| | | // String MesSend=plcmes.getPlcParameter("MESToGaStatus").getValue();//发送 |
| | | // double width=Double.valueOf(plcmes.getPlcParameter("Height").getValue());//宽 |
| | | // double height=Double.valueOf(plcmes.getPlcParameter("width").getValue());//高 |
| | | String PlcRequest=plcmes.getPlcParameter("GaToMES").getValue();//请求 |
| | | String MesSend=plcmes.getPlcParameter("MESToGaStatus").getValue();//发送 |
| | | double width=Double.valueOf(plcmes.getPlcParameter("width").getValue());//宽 |
| | | double height=Double.valueOf(plcmes.getPlcParameter("Height").getValue());//高 |
| | | |
| | | // String PlcRequest=S7control.getinstance().ReadWord("DB14.26", 1).get(0)+""; |
| | | // double width=Double.parseDouble(S7control.getinstance().ReadWord("DB14.28", 1).get(0)+""); |
| | |
| | | // String MesSend=S7control.getinstance().ReadWord("DB14.170", 1).get(0)+""; |
| | | |
| | | //获取测量的长,宽 |
| | | boolean istest = false; |
| | | String PlcRequest = "1"; |
| | | String MesSend = "0"; |
| | | double width = 402; |
| | | double height = 402; |
| | | boolean istest = true; |
| | | // String PlcRequest = "1"; |
| | | // String MesSend = "0"; |
| | | // double width = 402; |
| | | // double height = 402; |
| | | |
| | | //匹配 |
| | | //System.err.println(PlcRequest+","+MesSend+","+width+","+height); |
| | |
| | | } |
| | | |
| | | } |
| | | //S7control.getinstance().WriteWord("DB14.170", (short)0); |
| | | Queue LastQueue= QueueMapper.selectLastQueue(); |
| | | if(LastQueue==null){ |
| | | Queue nullQueue=new Queue(); |
| | | nullQueue.setglassId(""); |
| | | nullQueue.setglassheight(0); |
| | | nullQueue.setglasswidth(0); |
| | | jsonObject.append("LastQueue", nullQueue); |
| | | }else{ |
| | | jsonObject.append("LastQueue", LastQueue); |
| | | } |
| | | // String E01id = new String( S7controlLK.getinstance().ReadByte("DB17.0",16)); |
| | | // String J01id = new String( S7controlLK.getinstance().ReadByte("DB17.22",14)); |
| | | |
| | | jsonObject.append("LastQueue", LastQueue); |
| | | |
| | | //查询理片笼信息 |
| | | List<StorageCage> StorageCageInfo = storageCageService.SelectStorageCageInfo(); |
| | | jsonObject.append("StorageCageInfo", StorageCageInfo); |
| | |
| | | // TODO Auto-generated method stub |
| | | // |
| | | System.out.println("启动完成"); |
| | | //new PLCAutoMes().start(); |
| | | // new PlcHold().start(); |
| | | //new PlcHoldNew().start(); |
| | | new PLCAutoMes().start(); |
| | | |
| | | new PlcHoldNew().start(); |
| | | |
| | | new Plchome().start(); |
| | | // new PlcLayout().start(); |
| | | // new Plcalarm().start(); |
| | | // new Plcsign().start(); |
| | | // new Plcstate().start(); |
| | | // new PlcPositioning1().start(); |
| | | // new PlcParameter2().start(); |
| | | // new PLCAutomaticParameterSetting().start(); |
| | | |
| | | // new PlcManualonePosition().start(); |
| | | // new PlcManualonePosition2().start(); |
| | | // new PlcServoManualone().start(); |
| | | // new PLCManualJog().start(); |
| | | // new Plclog().start(); |
| | | |
| | | // new PlcInteractionState().start(); |
| | | // new PlcParameter1Review().start(); |
| | | // new PLCAutomaticParameterSettingReview2().start(); |
| | | |
| | | // new PLCManualJogReview().start(); |
| | | new Plchome().start(); |
| | | |
| | | } |
| | | } |
| | |
| | | private Integer sumtier;// 完成数量 |
| | | private Integer measurenumber;// 测量完成数量 |
| | | private Integer cageno;//笼内数量 |
| | | private Integer method;//出片方式 |
| | | } |
| | |
| | | package com.example.springboot.entity.device; |
| | | |
| | | import com.example.springboot.component.S7control; |
| | | |
| | | public class PlcParameterInfo { |
| | | public PlcParameterInfo(String startAddress) { |
| | | this.startAddress = startAddress; |
| | |
| | | |
| | | return addressIndex; |
| | | } |
| | | public String getValueString() { |
| | | return S7control.getinstance().readStrings(getAddress()); |
| | | } |
| | | public String getAddress() { |
| | | return getAddress(this.addressIndex); |
| | | } |
| | |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | public List<String> getAddressListByCodeId(List<String> codeIdList) { |
| | | List<String> addressList = new ArrayList<>(); |
| | | for (String codeId : codeIdList) { |
| | |
| | | plcParameterInfo.setValue(String.valueOf(byte2short(valueList))); |
| | | } |
| | | else if (plcParameterInfo.getAddressLength()==14) { |
| | | String id=(byteToHexString(valueList)); |
| | | plcParameterInfo.setValue((byteToHexString(valueList))); |
| | | } |
| | | |
| | |
| | | private Integer sumtier;// 完成数量 |
| | | private Integer measurenumber;// 测量完成数量 |
| | | private Integer cageno;//笼内数量 |
| | | private Integer method;//出片方式 |
| | | } |
| | |
| | | package com.example.springboot.mapper; |
| | | import org.apache.ibatis.annotations.Delete; |
| | | import org.apache.ibatis.annotations.Insert; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | import org.apache.ibatis.annotations.Select; |
| | |
| | | @Repository |
| | | public interface AlbaniaMapper { |
| | | //判断笼内是否有合适的类型空格 |
| | | @Select("select id from storage_cage where glasstype=#{glasstype} and width>=#{width}+#{widths} and state=0 order by id limit 1") |
| | | int SelectCage(int glasstype,Double width,int widths); |
| | | @Select("select id from storage_cage where glasstype=#{glasstype} and width>=#{width}+#{widths} and state=0 and disabled=0 order by id limit 1") |
| | | StorageCage SelectCage(int glasstype,Double width,int widths); |
| | | //判断笼内没有玻璃的空格 |
| | | @Select("select id from storage_cage where number=0 and cage>#{cage} and cage<#{cage2} order by id limit 1") |
| | | int SelectNewCell(int cage,int cage2); |
| | | @Select("select id from storage_cage where number=0 and cage>#{cage} and cage<#{cage2} and disabled=0 order by id limit 1") |
| | | StorageCage SelectNewCell(int cage,int cage2); |
| | | //增加玻璃数 |
| | | @Update("update storage_cage set number=number+1,width=width-glasswidth where id=#{id}") |
| | | void UpdateCageNumberAdd(int id); |
| | |
| | | void Inserttask(int tasktype, int taskstate, int shelfrack, int loadrack, String glassid, int glasstype,String flowcard,int mateid,int tier); |
| | | //新增一条笼子数据 |
| | | @Update("UPDATE `albania`.`storage_cage` SET `glass_id` =#{glassid}, `width` =width-#{glasswidth}, `glasswidth` =#{glasswidth}, `glassheight` =#{glassheight}, `glasswidthmm` =#{glasswidthmm}, `glassheightmm` = #{glassheightmm}, `state` = #{state}, `glasstype` = #{glasstype}, `number` = #{number} WHERE `id` =#{id};") |
| | | void AddCage(int id,String glassid,Double glasswidth,Double glassheight,Double glasswidthmm,Double glassheightmm,int state,int glasstype,int number); |
| | | void AddCage(int id,String glassid,Double glasswidth,Double glassheight,Double glasswidthmm,Double glassheightmm,int state,String glasstype,int number); |
| | | //获取进片数据 |
| | | @Select("select glassid,flowcard,glasswidth as width,glassheight as height,glasswidthmm,glassheightmm,glasstype from queue where state=1 limit 1") |
| | | @Select("select glassid,flowcard,glasswidth as width,glassheight as height,glasswidthmm,glassheightmm,glasstype,thickness from queue where state=1 limit 1") |
| | | GlassInfo SelectGlass(); |
| | | //一号线查询任务 |
| | | @Select("select * from v_cagerelease1 where mateid not in(select mateid from v_cagerelease1 where surplus=0 group by mateid);") |
| | |
| | | //发送出片后增加已发数量 |
| | | @Update("update glassinfo set finishnumber=finishnumber+1 where flowcard=#{flowcard} and mateid=#{mateid} and tier=#{tier};") |
| | | void AddFinishNumber(String flowcard,int mateid,int tier); |
| | | |
| | | //获取当前任务的id |
| | | @Select("select id from storage_task where task_state=0 and glass_id=#{glassid} LIMIT 1") |
| | | GlassInfo SelectTaskId(String glassid); |
| | | //删除测量表的信息 |
| | | @Delete("delete from queue where glassid=#{glassid}") |
| | | int DeleteQueue(String glassid); |
| | | //判断是否是直出模式 |
| | | @Select("select method from flowcard where state=1 and line=#{line} ORDER BY starttime LIMIT 1;") |
| | | GlassInfo SelectMethod(int line); |
| | | //直出模式任务查询 |
| | | @Select("select b.flowcard,b.glasstype,b.mateid,a.totaltier as id from flowcard a left join glassinfo b on a.flowcard=b.flowcard where a.line=#{line}") |
| | | GlassInfo SelectOutGlass2(int line); |
| | | |
| | | |
| | | |
| | | } |
| | |
| | | StorageCage SelectStorageByCell(String cell); |
| | | |
| | | // 手动完成任务 |
| | | @Select("update storage_task set task_state=1 where id=1429") |
| | | @Select("update storage_task set task_state=1 where id=#{id}") |
| | | void FinishTask(Integer id); |
| | | |
| | | @Select("select gi.* from glassinfo gi inner join flowcard fc on gi.flowcard=fc.flowcard where fc.state!=2 and position(#{width} in gi.width) and position(#{height} in gi.height) and position(#{thickness} in gi.thickness) and position(#{films} in gi.films) group by gi.id") |
| | |
| | | import com.example.springboot.component.S7control; |
| | | import com.example.springboot.entity.GlassInfo; |
| | | import com.example.springboot.entity.StorageCage; |
| | | import com.example.springboot.entity.GlassInfo; |
| | | import com.example.springboot.entity.device.PlcParameterObject; |
| | | import com.example.springboot.mapper.AlbaniaMapper; |
| | | import com.google.common.primitives.Bytes; |
| | |
| | | //读取DB105区文件 |
| | | private PlcParameterObject plcmes=PLCAutoMes.PlcMesObject; |
| | | public Short selectAll(GlassInfo glassInfo) { |
| | | if(glassInfo==null){ |
| | | //有进片请求但是测量台没有玻璃 |
| | | return 400; |
| | | } |
| | | //定义初始字段 |
| | | int cageid; |
| | | StorageCage cage; |
| | | String glassid=glassInfo.getGlassid(); |
| | | Double width=glassInfo.getWidth(); |
| | | //int mateid=glassInfo.getMateid(); |
| | | String flowcard=glassInfo.getFlowcard(); |
| | | int glasstype=glassInfo.getGlasstype(); |
| | | |
| | | |
| | | |
| | | //判断是否有同类型的 |
| | | cageid=albaniaMapper.SelectCage(glasstype,width, 50); |
| | | cage=albaniaMapper.SelectCage(glasstype,width, 50); |
| | | |
| | | //如果有同类型时直接增加 |
| | | if(cageid!=Integer.MIN_VALUE){ |
| | | if(cage!=null){ |
| | | //发送plc任务 |
| | | Mestast(glassid, 1001, cageid, 1,"MESID1"); |
| | | Mestast(glassid, 40, cage.getId(), 1,"MESID1",1); |
| | | //任务发送字 |
| | | //Mestast(glassid,1001,cageid,1); |
| | | |
| | | }else{ |
| | | //判断玻璃是否进入大片笼 |
| | | if(glassInfo.getThickness()>=15){ |
| | | cageid=albaniaMapper.SelectNewCell(3,5); |
| | | if(glassInfo.getThickness()>=15){ |
| | | cage=albaniaMapper.SelectNewCell(3,5); |
| | | }else{ |
| | | cageid=albaniaMapper.SelectNewCell(3,5); |
| | | cage=albaniaMapper.SelectNewCell(0,5); |
| | | //发送plc任务 |
| | | } |
| | | //当返回的格子号为空时,返回400笼子已满 |
| | | if(cageid!=Integer.MIN_VALUE){ |
| | | Mestast(glassid,1001,cageid,1,"MESID1"); |
| | | if(cage!=null){ |
| | | albaniaMapper.AddCage(cage.getId(), glassid, cage.getGlassWidth(), cage.getGlassHeight(), cage.getGlassWidthMm(), cage.getGlassHeightMm(), 1, cage.getGlasstype(), 0); |
| | | Mestast(glassid,1001,cage.getId(),1,"MESID1",1); |
| | | //发送plc任务 |
| | | |
| | | }else{ |
| | |
| | | } |
| | | } |
| | | //增加任务记录 |
| | | albaniaMapper.Inserttask(0, 0, 1001, cageid, glassid,glasstype, flowcard,0,0); |
| | | albaniaMapper.Inserttask(0, 0, 1001, cage.getId(), glassid,glasstype, flowcard,0,0); |
| | | return(200); |
| | | |
| | | } |
| | | |
| | | //出片 |
| | | public Short selectout(int line) { |
| | | int mateid; |
| | | int glasstype; |
| | | int tier; |
| | | int sumid; |
| | | String flowcard; |
| | | GlassInfo glassmate=new GlassInfo(); |
| | | |
| | | GlassInfo method=new GlassInfo(); |
| | | StorageCage glass=new StorageCage(); |
| | | method=albaniaMapper.SelectMethod(line); |
| | | double width=0; |
| | | for(int i=1;i<=7;i++){ |
| | | glassmate= albaniaMapper.SelectOutGlass(line); |
| | | mateid=glassmate.getMateid(); |
| | | glasstype=glassmate.getGlasstype(); |
| | | tier=glassmate.getTier(); |
| | | sumid=glassmate.getId(); |
| | | flowcard=glassmate.getFlowcard(); |
| | | |
| | | StorageCage glass= albaniaMapper.SelectCageGlass(glasstype); |
| | | //发送配片数据 |
| | | Mestast(glassmate.getGlasstype()+"i", glass.getId(),2002, 0,"MESID1"); |
| | | albaniaMapper.AddFinishNumber(flowcard, mateid, tier); |
| | | albaniaMapper.Inserttask(1, 0, glass.getId(), 2002, glassmate.getGlassid()+i, glasstype,glass.getFlowcard(),mateid,tier); |
| | | if(tier==sumid){ |
| | | //本次配片完成发送启动命令 |
| | | S7control.getinstance().WriteWord(plcmes.getPlcParameter("MESToPLC").getAddress(), (short)2);//出片任务启动 |
| | | return (200);//结束 |
| | | } |
| | | //如果不是直通模式只出有完整配片的流程卡 |
| | | if(method.getMethod()==0){ |
| | | glassmate= albaniaMapper.SelectOutGlass(line); |
| | | }else{ |
| | | //直通模式时按顺序直出 |
| | | glassmate= albaniaMapper.SelectOutGlass2(line); |
| | | } |
| | | |
| | | if(glassmate==null){ |
| | | //未领取任务 |
| | | return (400); |
| | | }else{ |
| | | |
| | | glass= albaniaMapper.SelectCageGlass(glassmate.getGlasstype()); |
| | | if(glass!=null){ |
| | | //发送任务之前判断车上的剩余宽度是否大于此玻璃 |
| | | width+=glassmate.getWidth()+50; |
| | | //大于车上空余宽度时提前发送出片启动 |
| | | if(width>5000){ |
| | | //本次配片完成发送启动命令 |
| | | S7control.getinstance().WriteWord(plcmes.getPlcParameter("MESToPLC").getAddress(), (short)1);//出片任务启动 |
| | | return (200);//结束 |
| | | } |
| | | |
| | | //发送配片数据 |
| | | Mestast(glass.getGlassId(), glass.getId(),7, 0,"MESID"+i,i); |
| | | albaniaMapper.AddFinishNumber(glassmate.getFlowcard(), glassmate.getMateid(), glassmate.getTier()); |
| | | albaniaMapper.Inserttask(1, 0, glass.getId(), 2002, glassmate.getGlassid(), glassmate.getGlasstype(),glass.getFlowcard(),glassmate.getMateid(),glassmate.getTier()); |
| | | if(glassmate.getTier()==glassmate.getId()){//当配片数量等于成品小片总片数时 |
| | | //本次配片完成发送启动命令 |
| | | S7control.getinstance().WriteWord(plcmes.getPlcParameter("MESToPLC").getAddress(), (short)1);//出片任务启动 |
| | | return (200);//结束 |
| | | } |
| | | |
| | | }else{ |
| | | return (400);//结束 |
| | | } |
| | | |
| | | |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | return(200);// 结束 |
| | | } |
| | | |
| | |
| | | } |
| | | |
| | | //下发理片任务 |
| | | public void Mestast(String glassid,int MESToPLCStart1,int MESToPLCTarget1,int MESToPLC,String address) { |
| | | //outmesid(glassid, "MESID1");//下发玻璃id |
| | | S7control.getinstance().writeString(plcmes.getPlcParameter(address).getAddress(),glassid); |
| | | S7control.getinstance().WriteWord(plcmes.getPlcParameter("MESToPLCStart1").getAddress(), (short) MESToPLCStart1);//起始位置 |
| | | S7control.getinstance().WriteWord(plcmes.getPlcParameter("MESToPLCTarget1").getAddress(), (short) MESToPLCTarget1);//目标位置 |
| | | public void Mestast(String glassid,int MESToPLCStart1,int MESToPLCTarget1,int MESToPLC,String address,int i) { |
| | | S7control.getinstance().writeString(plcmes.getPlcParameter(address).getAddress(),glassid);//玻璃id |
| | | S7control.getinstance().WriteWord(plcmes.getPlcParameter("MESToPLCStart"+i).getAddress(), (short) MESToPLCStart1);//起始位置 |
| | | S7control.getinstance().WriteWord(plcmes.getPlcParameter("MESToPLCTarget"+i).getAddress(), (short) MESToPLCTarget1);//目标位置 |
| | | if(MESToPLC!=0){ |
| | | S7control.getinstance().WriteWord(plcmes.getPlcParameter("MESToPLC").getAddress(), (short)MESToPLC);//mes理片任务类型 |
| | | } |
| | | |
| | | |
| | | } |
| | | } |
| | | |
| | | |
| | | } |
| | |
| | | homeMapper.UpdateQueue(glassInfo.getFlowcard(), glassInfo.getWidth(), glassInfo.getHeight(), |
| | | glassInfo.getGlasstype()); |
| | | Map<String, Object> map = new HashMap<>(); |
| | | PlcParameterObject plcmes=PLCAutoMes.PlcMesObject; |
| | | S7control.getinstance().WriteWord(plcmes.getPlcParameter("MESToGaStatus").getAddress(),(short) 1); |
| | | map.put("message", "200"); |
| | | return Result.success(map); |
| | | } |
| | |
| | | |
| | | System.out.println(RemoveErrorData.size()); |
| | | // 处理完成 添加数据库 |
| | | int count=1; |
| | | for (Map map : RemoveErrorData) { |
| | | String key = map.get("base").toString() + "_" + map.get("height").toString() + "_" |
| | | + map.get("thickness").toString() + "_" + map.get("films").toString(); |
| | |
| | | Integer glasstype; |
| | | if (TypeData.get(key) == null) { |
| | | glasstype = homeMapper.SelectMaxType(); |
| | | if (glasstype==null) { |
| | | glasstype=1; |
| | | } |
| | | } else { |
| | | glasstype = Integer.valueOf(value); |
| | | } |
| | | // |
| | | homeMapper.AddGlassinfo(map.get("order").toString(), glasstype, |
| | | Integer.parseInt(map.get("matching").toString()) // 需要计算 配片ID |
| | | , glasstype+"" // 需要计算 玻璃ID |
| | | ,map.get("order").toString()+"-"+count+"" // 需要计算 玻璃ID |
| | | , Integer.parseInt(map.get("tier").toString()), map.get("films").toString(), |
| | | Double.parseDouble(map.get("base").toString()), Double.parseDouble(map.get("height").toString()), |
| | | Double.parseDouble(map.get("thickness").toString()), |
| | | Integer.parseInt(map.get("quantity").toString()),groupby.get(tierkey));// 需要计算总层数 |
| | | //订单内总层数 |
| | | homeMapper.InsertFlowcard(map.get("order").toString(),OrderFinishedProduct.get(tierkey+"_Sum")); |
| | | count++; |
| | | } |
| | | Map<String, Object> ResultCode = new HashMap<>(); |
| | | ResultCode.put("message", "200"); |
| | |
| | | #\u6570\u636E\u5E93\u9A71\u52A8 |
| | | spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver |
| | | #\u6570\u636E\u5E93\u8FDE\u63A5\u5730\u5740 |
| | | #spring.datasource.url=jdbc:mysql://localhost:3306/albania?useUnicode=true&characterEncoding=utf-8&serverTimezone=Asia/Shanghai |
| | | spring.datasource.url=jdbc:mysql://10.153.19.150:3306/albania?useUnicode=true&characterEncoding=utf-8&serverTimezone=Asia/Shanghai |
| | | spring.datasource.url=jdbc:mysql://localhost:3306/albania?useUnicode=true&characterEncoding=utf-8&serverTimezone=Asia/Shanghai |
| | | #spring.datasource.url=jdbc:mysql://10.153.19.150:3306/albania?useUnicode=true&characterEncoding=utf-8&serverTimezone=Asia/Shanghai |
| | | #\u6570\u636E\u5E93\u7528\u6237\u540D |
| | | spring.datasource.username=root |
| | | #\u6570\u636E\u5E93\u7528\u6237\u5BC6\u7801 |