| | |
| | | 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; |
| | |
| | | |
| | | for(int i=1;i<=7;i++){ |
| | | glassmate= albaniaMapper.SelectOutGlass(line); |
| | | if(glassmate==null){ |
| | | //未领取任务 |
| | | return (400); |
| | | }else{ |
| | | mateid=glassmate.getMateid(); |
| | | glasstype=glassmate.getGlasstype(); |
| | | tier=glassmate.getTier(); |
| | | sumid=glassmate.getId(); |
| | | flowcard=glassmate.getFlowcard(); |
| | | |
| | | |
| | | StorageCage glass= albaniaMapper.SelectCageGlass(glasstype); |
| | | if(glass!=null){ |
| | | //发送配片数据 |
| | | Mestast(glassmate.getGlasstype()+"i", glass.getId(),2002, 0,"MESID1"); |
| | | Mestast(glassmate.getGlasstype()+"i", glass.getId(),2002, 0,"MESID"+i); |
| | | albaniaMapper.AddFinishNumber(flowcard, mateid, tier); |
| | | albaniaMapper.Inserttask(1, 0, glass.getId(), 2002, glassmate.getGlassid()+i, glasstype,glass.getFlowcard(),mateid,tier); |
| | | if(tier==sumid){ |
| | | if(tier==sumid){//当配片数量等于成品小片总片数时 |
| | | //本次配片完成发送启动命令 |
| | | S7control.getinstance().WriteWord(plcmes.getPlcParameter("MESToPLC").getAddress(), (short)2);//出片任务启动 |
| | | return (200);//结束 |
| | | } |
| | | } |
| | | |
| | | |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | 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().writeString(plcmes.getPlcParameter(address).getAddress(),glassid);//玻璃id |
| | | S7control.getinstance().WriteWord(plcmes.getPlcParameter("MESToPLCStart1").getAddress(), (short) MESToPLCStart1);//起始位置 |
| | | S7control.getinstance().WriteWord(plcmes.getPlcParameter("MESToPLCTarget1").getAddress(), (short) MESToPLCTarget1);//目标位置 |
| | | if(MESToPLC!=0){ |
| | | S7control.getinstance().WriteWord(plcmes.getPlcParameter("MESToPLC").getAddress(), (short)MESToPLC);//mes理片任务类型 |
| | | } |
| | | |
| | | |
| | | } |
| | | } |
| | | |
| | | |
| | | } |