Merge branch 'master' of http://10.153.19.25:10101/r/HangZhouMes
36个文件已修改
1 文件已重命名
25个文件已添加
56个文件已删除
| | |
| | | |
| | | // private BigStorageCageMapper bigStorageCageMapper; |
| | | |
| | | // // 获取玻璃存放格子 |
| | | // public BigStorageCageDetails FeedGlass(BigStorageCageDetails bigStorageCageDetails) { |
| | | // //获取同钢化版图id可进片的格子 |
| | | // BigStorageCageDetails LayoutSlotInfo=bigStorageCageMapper.SelectTemperingFeedSlot(bigStorageCageDetails); |
| | | // //有符合条件的格子时 |
| | | // if (LayoutSlotInfo!=null) { |
| | | // //将玻璃信息填入理片笼详情表 |
| | | // bigStorageCageDetails.setSlot(LayoutSlotInfo.getSlot()); |
| | | // }else{ |
| | | // //获取不到时: |
| | | // 获取玻璃存放格子 |
| | | public BigStorageCageDetails FeedGlass(BigStorageCageDetails bigStorageCageDetails) { |
| | | //获取同钢化版图id可进片的格子 |
| | | BigStorageCageDetails LayoutSlotInfo=bigStorageCageMapper.SelectTemperingFeedSlot(bigStorageCageDetails); |
| | | //有符合条件的格子时 |
| | | if (LayoutSlotInfo!=null) { |
| | | //将玻璃信息填入理片笼详情表 |
| | | bigStorageCageDetails.setSlot(LayoutSlotInfo.getSlot()); |
| | | }else{ |
| | | //获取不到时: |
| | | |
| | | // //获取可进片格子信息 |
| | | // BigStorageCageDetails EmptySlotInfo=bigStorageCageMapper.SelectEmptyFeedSlot(); |
| | | // bigStorageCageDetails.setSlot(EmptySlotInfo.getSlot()); |
| | | // //获取其他笼格子 |
| | | //获取可进片格子信息 |
| | | BigStorageCageDetails EmptySlotInfo=bigStorageCageMapper.SelectEmptyFeedSlot(); |
| | | bigStorageCageDetails.setSlot(EmptySlotInfo.getSlot()); |
| | | //获取其他笼格子- |
| | | |
| | | // //将玻璃信息放入该格子 |
| | | //将玻璃信息放入该格子 |
| | | |
| | | // } |
| | | } |
| | | |
| | | // UpdateRemainWidth(bigStorageCageDetails.getSlot()); |
| | | // return bigStorageCageDetails; |
| | | // } |
| | | UpdateRemainWidth(bigStorageCageDetails.getSlot()); |
| | | return bigStorageCageDetails; |
| | | } |
| | | |
| | | // //修改格子剩余宽度 |
| | | // private void UpdateRemainWidth(int Slot){ |
| | | // //获取该格子内玻璃信息 |
| | | //修改格子剩余宽度 |
| | | private void UpdateRemainWidth(int Slot){ |
| | | //获取该格子内玻璃信息 |
| | | |
| | | // //修改格子剩余宽度 |
| | | // BigStorageCageMapper.UpdateRemainWidth(Slot); |
| | | // } |
| | | //修改格子剩余宽度 |
| | | BigStorageCageMapper.UpdateRemainWidth(Slot); |
| | | } |
| | | |
| | | |
| | | } |
| | |
| | | url: jdbc:mysql://10.153.19.150:3306/erp_user_info?serverTimezone=GMT%2b8 |
| | | username: root |
| | | password: beibo.123/ |
| | | driver-class-name: com.mysql.cj.jdbc.Driver |
| | | sd: |
| | | url: jdbc:mysql://10.153.19.150:3306/sd?serverTimezone=GMT%2b8 |
| | | username: root |
| | | password: beibo.123/ |
| | | driver-class-name: com.mysql.cj.jdbc.Driver |
| | | mm: |
| | | url: jdbc:mysql://10.153.19.150:3306/mm?serverTimezone=GMT%2b8 |
| | | username: root |
| | | password: beibo.123/ |
| | | driver-class-name: com.mysql.cj.jdbc.Driver |
| | | pp: |
| | | url: jdbc:mysql://10.153.19.150:3306/pp?serverTimezone=GMT%2b8 |
| | | username: root |
| | | password: beibo.123/ |
| | | driver-class-name: com.mysql.cj.jdbc.Driver |
| | |
| | | package com.mes; |
| | | |
| | | import com.mes.common.PlcTools.S7object; |
| | | import org.springframework.boot.SpringApplication; |
| | | import org.springframework.boot.autoconfigure.SpringBootApplication; |
| | | import org.springframework.cache.annotation.EnableCaching; |
| | |
| | | package com.mes.common.PlcTools; |
| | | |
| | | |
| | | import java.nio.ByteBuffer; |
| | | import java.nio.ByteOrder; |
| | | import java.nio.charset.StandardCharsets; |
| | | import java.sql.Time; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | |
| | |
| | | import com.github.xingshuangs.iot.protocol.s7.service.MultiAddressWrite; |
| | | import com.github.xingshuangs.iot.protocol.s7.service.S7PLC; |
| | | import com.google.common.primitives.Bytes; |
| | | import org.apache.ibatis.jdbc.Null; |
| | | |
| | | public class S7control { |
| | | |
| | | S7PLC s7PLC; // PLC通讯类实例 |
| | | |
| | | public S7control(EPlcType plcType, String ip, int port, int rack, int slot) { |
| | | private EPlcType plcType = EPlcType.S1500; // 西门子PLC类型 |
| | | private String ip = "192.168.10.1"; // plc ip地址 |
| | | private int port = 102; // plc 端口号 |
| | | |
| | | private static volatile S7control instance = null; |
| | | |
| | | private S7control() { |
| | | if (s7PLC == null) |
| | | s7PLC = new S7PLC(plcType, ip, port,0,0); |
| | | } |
| | | } |
| | | public S7control(EPlcType plcType,String ip,int port,int a,int b) { |
| | | if (s7PLC == null) |
| | | s7PLC = new S7PLC(plcType, ip, port,a,b); |
| | | } |
| | | |
| | | // 单例模式 获取类的唯一实例 |
| | | public static S7control getinstance() { |
| | | if (instance == null) { |
| | | synchronized (S7control.class) { |
| | | if (instance == null) |
| | | instance = new S7control(); |
| | | } |
| | | } |
| | | return instance; |
| | | } |
| | | |
| | | /** |
| | | * 关闭西门子s7通讯连接 |
| | | */ |
| | |
| | | public boolean CheckConnected() { |
| | | return s7PLC.checkConnected(); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 按指定的地址 写入一个word |
| | | * |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | private int getIndexFromAddress(String address) { |
| | |
| | | public List<Short> ReadWord(String address, int count) { |
| | | if (s7PLC == null) |
| | | return null; |
| | | |
| | | List<String> addresslist = GetAddressList(address, count, 16); |
| | | try { |
| | | return s7PLC.readInt16(addresslist); |
| | |
| | | return null; |
| | | } |
| | | } |
| | | |
| | | public byte[] Readbyte(String address, int count) { |
| | | byte[] byt=new byte[count]; |
| | | int wordcount=((count%2==0)?count/2:count+1); |
| | | List<Short> word=ReadWord(address,wordcount); |
| | | |
| | | return byt; |
| | | } |
| | | /** |
| | | * 按指定的地址 读取byte结果集 |
| | | * |
| | |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | public List<String> readStringsandword(List<String> addressList) { |
| | | if (s7PLC == null) { |
| | | return null; |
| | | } |
| | | List<String> result = new ArrayList<>(); |
| | | for (String address : addressList) { |
| | | try { |
| | | if (address.contains("-")) { |
| | | address = address.substring(0, address.indexOf("-")); |
| | | |
| | | byte[] bytes = s7PLC.readByte(address, 14); |
| | | if (bytes != null) { |
| | | String str = new String(bytes, StandardCharsets.UTF_8); |
| | | result.add(str); |
| | | } |
| | | |
| | | } else { |
| | | Short value = s7PLC.readInt16(address); |
| | | result.add(value.toString()); |
| | | |
| | | } |
| | | } catch (Exception e) { |
| | | System.out.println("读取 " + address + " 失败:" + e.getMessage()); |
| | | result.add(null); |
| | | } |
| | | } |
| | | |
| | | return result; |
| | | } |
| | | |
| | | |
| | | |
| | | //不连续地址写入Word |
| | | public void WriteWord(List<String> address, List<Short> datas) { |
| | | if (s7PLC == null) |
| | |
| | | glassidlist.add(Byte.valueOf(String.valueOf(iditem))); |
| | | } |
| | | byte[] bytes = Bytes.toArray(glassidlist); |
| | | WriteByte(addr, bytes); |
| | | S7control.getinstance().WriteByte(addr, bytes); |
| | | } |
| | | |
| | | //读取不连续word |
| | |
| | | } |
| | | return addresslist; |
| | | } |
| | | public void writeString(String addr,String data) { |
| | | s7PLC.writeString(addr,data); |
| | | } |
| | | |
| | | public String readStrings(String addr) { |
| | | return s7PLC.readString(addr); |
| | | } |
| | | } |
New file |
| | |
| | | package com.mes.controller; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.*; |
| | | import com.mes.common.Result; |
| | | import com.mes.entity.Tempering; |
| | | import com.mes.entity.UpWorkstation; |
| | | import com.mes.service.LoadGlassService; |
| | | import com.mes.service.TemperingOverService; |
| | | import com.mes.service.TemperingService; |
| | | |
| | | |
| | | @RestController |
| | | @RequestMapping("/LoadGlass") |
| | | |
| | | // TidyUpGlassModule 钢化模块 |
| | | public class LoadGlassController { |
| | | |
| | | @Autowired |
| | | private LoadGlassService loadGlassService; |
| | | |
| | | @PostMapping("/") //查询现在上片机的玻璃信息 |
| | | @ResponseBody |
| | | public Result SelectTerritoryInfo() { |
| | | List<UpWorkstation> glass = loadGlassService.selectAll(); |
| | | System.out.println(glass); |
| | | return Result.seccess(glass); |
| | | } |
| | | |
| | | @PostMapping("/") //新增一条工位信息,接收实例类字段为宽高厚膜系数量工位id |
| | | @ResponseBody |
| | | public void CutTerritory(@RequestBody UpWorkstation upwork) { |
| | | loadGlassService.insertGlass(upwork); |
| | | |
| | | } |
| | | |
| | | @PostMapping("/") //删除一条工位的玻璃信息,传输工位id删除 |
| | | @ResponseBody |
| | | public void SelectCutTerritory(int upworkid) { |
| | | loadGlassService.deleteGlass(upworkid); |
| | | } |
| | | |
| | | @PostMapping("/") //开始上片任务 |
| | | @ResponseBody |
| | | public void selectPriority() { |
| | | boolean result = loadGlassService.isCanLoadGlass(); |
| | | if(result==true){ |
| | | loadGlassService.selectPriority(); |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | } |
| | |
| | | private SysMenuService sysMenuService; |
| | | @GetMapping |
| | | public Result getMenu(){ |
| | | //MyChannelHandlerPool myChannelHandlerPool = new MyChannelHandlerPool(); |
| | | //myChannelHandlerPool.sendMsg("123"); |
| | | //MyChannelHandlerPool.channelGroup.writeAndFlush( new TextWebSocketFrame("123123")); |
| | | //获取缓存 |
| | | return Result.seccess(sysMenuService.getMenu()); |
| | | |
| | | } |
New file |
| | |
| | | package com.mes.entity.device; |
| | | import cn.hutool.json.JSONArray; |
| | | import cn.hutool.json.JSONObject; |
| | | import java.io.BufferedReader; |
| | | import java.io.FileReader; |
| | | import java.io.IOException; |
| | | import java.util.ArrayList; |
| | | import java.util.Arrays; |
| | | import java.util.List; |
| | | |
| | | import com.mes.common.PlcTools.S7control; |
| | | |
| | | public class InitUtil { |
| | | //初始化word |
| | | public static PlcParameterObject initword(String jsonFilePath) { |
| | | try { |
| | | FileReader fileReader = new FileReader(jsonFilePath); |
| | | BufferedReader bufferedReader = new BufferedReader(fileReader); |
| | | |
| | | StringBuilder content = new StringBuilder(); |
| | | String line; |
| | | |
| | | while ((line = bufferedReader.readLine()) != null) { |
| | | content.append(line); |
| | | } |
| | | |
| | | bufferedReader.close(); |
| | | fileReader.close(); |
| | | |
| | | JSONObject jsonfileobj = new JSONObject(content.toString()); |
| | | JSONArray jsonArray = jsonfileobj.getJSONArray("parameteInfor"); |
| | | PlcParameterObject plcParameterObject = new PlcParameterObject(); |
| | | plcParameterObject.setPlcAddressBegin(jsonfileobj.getStr("plcAddressBegin"));//设置起始位地址 |
| | | plcParameterObject.setPlcAddressLength(Integer.valueOf(jsonfileobj.getStr("plcAddressLenght")));//设置地址长度 |
| | | |
| | | for (int i = 0; i < jsonArray.size(); i++) { |
| | | JSONObject parameterObj = jsonArray.getJSONObject(i); |
| | | PlcParameterInfo plcParameterInfo = new PlcParameterInfo(jsonfileobj.getStr("plcAddressBegin")); //参数实例 |
| | | String codeid = parameterObj.getStr("codeId"); |
| | | plcParameterInfo.setCodeId(codeid); |
| | | plcParameterInfo.setAddressIndex(Integer.valueOf(parameterObj.getStr("addressIndex"))); |
| | | //plcParameterInfo.setRatio(Integer.valueOf(parameterObj.getStr("ratio"))); |
| | | plcParameterInfo.setAddressLength(Integer.valueOf(parameterObj.getStr("addressLenght"))); |
| | | plcParameterInfo.setUnit(parameterObj.getStr("unit")); |
| | | plcParameterObject.addPlcParameter(plcParameterInfo); |
| | | } |
| | | // byte[] getplcvlues = {0x01, 0x02, 0x03, 0x04,0x01, 0x02, 0x03, 0x04,0x01, 0x02, 0x03, 0x04,0x01, 0x02,0x01, 0x02, 0x03, 0x04,0x01, 0x02, 0x03, 0x04,0x01, 0x02, 0x03, 0x04,0x01, 0x02,0x01, 0x02, 0x03, 0x04,0x01, 0x02, 0x03, 0x04,0x01, 0x02, 0x03, 0x04,0x01, 0x02}; |
| | | // byte[] getplcvlues = S7control.getinstance().ReadByte(plcParameterObject.getPlcAddressBegin(), plcParameterObject.getPlcAddressLength()); |
| | | // plcParameterObject.setPlcParameterList(getplcvlues); |
| | | |
| | | return plcParameterObject; |
| | | } catch (IOException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | //初始化bit |
| | | public static PlcBitObject initbit(String jsonFilePath) { |
| | | PlcBitObject plcBitObject = new PlcBitObject(); |
| | | |
| | | try { |
| | | FileReader fileReader = new FileReader(jsonFilePath); |
| | | BufferedReader bufferedReader = new BufferedReader(fileReader); |
| | | |
| | | StringBuilder content = new StringBuilder(); |
| | | String line; |
| | | |
| | | while ((line = bufferedReader.readLine()) != null) { |
| | | content.append(line); |
| | | } |
| | | |
| | | bufferedReader.close(); |
| | | fileReader.close(); |
| | | |
| | | JSONObject jsonfileobj = new JSONObject(content.toString()); |
| | | JSONArray jsonArray = jsonfileobj.getJSONArray("parameteInfor"); |
| | | plcBitObject.setPlcAddressBegin(jsonfileobj.getStr("plcAddressBegin"));//设置起始位地址 |
| | | plcBitObject.setPlcAddressLength(Integer.valueOf(jsonfileobj.getStr("plcAddressLenght")));//设置地址长度 |
| | | |
| | | for (int i = 0; i < jsonArray.size(); i++) { |
| | | JSONObject parameterObj = jsonArray.getJSONObject(i); |
| | | |
| | | PlcBitInfo plcBitInfo = new PlcBitInfo(jsonfileobj.getStr("plcAddressBegin")); //参数实例 |
| | | String codeid = parameterObj.getStr("codeId"); |
| | | plcBitInfo.setCodeId(codeid); |
| | | plcBitInfo.setAddressIndex(Integer.valueOf(parameterObj.getStr("addressIndex"))); |
| | | |
| | | plcBitObject.addPlcBit(plcBitInfo); |
| | | } |
| | | System.out.println(""); |
| | | } catch (IOException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | //Boolean[] values1 = { false, true, true, true, false, false, true, false, |
| | | // false, true ,true }; |
| | | // List<Boolean> getplcvlues = new ArrayList<>(Arrays.asList(values1)); |
| | | |
| | | // List<Boolean> getplcvlues = S7control.getinstance().ReadBits(plcBitObject.getPlcAddressBegin(), plcBitObject.getPlcAddressLength()); |
| | | // plcBitObject.setPlcBitList(getplcvlues); |
| | | return plcBitObject; |
| | | } |
| | | |
| | | // |
| | | public static void readAndUpdateBitValues(PlcBitObject plcBitObject) { |
| | | |
| | | // Boolean[] values1 = { false, true, true, true, false, false, true, false, |
| | | // false, true ,true }; |
| | | // List<Boolean> getplcvlues = new ArrayList<>(Arrays.asList(values1)); |
| | | List<Boolean> getplcvlues = S7control.getinstance().ReadBits(plcBitObject.getPlcAddressBegin(), plcBitObject.getPlcAddressLength()); |
| | | plcBitObject.setPlcBitList(getplcvlues); |
| | | } |
| | | |
| | | |
| | | public static void readAndUpdateWordValues(PlcParameterObject plcParameterObject) { |
| | | |
| | | // byte[] getplcvlues = {0x01, 0x02, 0x03, 0x04,0x01, 0x02, 0x03, 0x04,0x01, 0x02, 0x03, 0x04,0x01, 0x02,0x01, 0x02, 0x03, 0x04,0x01, 0x02, 0x03, 0x04,0x01, 0x02, 0x03, 0x04,0x01, 0x02,0x01, 0x02, 0x03, 0x04,0x01, 0x02, 0x03, 0x04,0x01, 0x02, 0x03, 0x04,0x01, 0x02}; |
| | | byte[] getplcvlues = S7control.getinstance().ReadByte(plcParameterObject.getPlcAddressBegin(), plcParameterObject.getPlcAddressLength()); |
| | | plcParameterObject.setPlcParameterList(getplcvlues); |
| | | } |
| | | |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.mes.entity.device; |
| | | |
| | | |
| | | import java.io.IOException; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import static com.mes.entity.device.InitUtil.readAndUpdateWordValues; |
| | | public class PLCAutoMes extends Thread { |
| | | |
| | | // // 用于存储应用程序的配置信息 |
| | | // private Configuration config; |
| | | private static InitUtil initUtil; |
| | | // public static PlcParameterObject PlcMesObject; |
| | | // public static PlcParameterObject PlcReadObject; |
| | | // public static PlcParameterObject PlcframeObject; |
| | | |
| | | // // 创建一个自定义的 S7 控制器消息处理器对象 |
| | | // MessageHandler customS7Control = new MessageHandler(); |
| | | |
| | | // 单例实例 |
| | | private static PLCAutoMes instance; |
| | | // private static String PlcMes = PLCAutoMes.class.getResource("/JsonFile/PlcMes.json").getPath(); |
| | | private static String PlcAlbania = PLCAutoMes.class.getResource("/JsonFile/PlcAlbania.json").getPath(); |
| | | // private static String PlcRead = PLCAutoMes.class.getResource("/JsonFile/PlcRead.json").getPath(); |
| | | // private static String Plcframe = PLCAutoMes.class.getResource("/JsonFile/Plcframe.json").getPath(); |
| | | // private static String PlcParameter = PLCAutomaticParameterSettingReview2.class.getResource("/JsonFile/PlcParameter.json").getPath(); |
| | | |
| | | // private static String PlcSign = PLCAutomaticParameterSettingReview2.class.getResource("/JsonFile/PlcSign.json").getPath(); |
| | | |
| | | // private static String PlcState = PLCAutomaticParameterSettingReview2.class.getResource("/JsonFile/PlcState.json").getPath(); |
| | | |
| | | // private static String PlcAlarm = PLCAutoMes.class.getResource("/JsonFile/PlcAlarm.json").getPath(); |
| | | // private static String PlcTest = PLCAutoMes.class.getResource("/JsonFile/PlcTest.json").getPath(); |
| | | |
| | | // 调用initword方法 |
| | | |
| | | // public static PlcParameterObject plcParameterObject = initUtil.initword(PlcParameter); |
| | | // public static PlcBitObject plcPlcTest = initUtil.initbit(PlcTest); |
| | | // public static PlcBitObject plcBitObject = initUtil.initbit(PlcSign); |
| | | // public static PlcParameterObject plcStateObject= initUtil.initword(PlcState); |
| | | // public static PlcBitObject plcPlcAlarm = initUtil.initbit(PlcAlarm); |
| | | public static PlcParameterObject PlcMesObject = InitUtil.initword(PlcAlbania); |
| | | // public static PlcParameterObject PlcReadObject = initUtil.initword(PlcRead); |
| | | // public static PlcParameterObject PlcframeObject = initUtil.initword(Plcframe); |
| | | |
| | | // 私有构造函数 |
| | | public PLCAutoMes() throws IOException { |
| | | //config = new Configuration("config.properties"); |
| | | initUtil = new InitUtil(); |
| | | } |
| | | |
| | | // 获取单例实例 |
| | | public static synchronized PLCAutoMes getInstance() throws IOException { |
| | | if (instance == null) { |
| | | instance = new PLCAutoMes(); |
| | | } |
| | | return instance; |
| | | } |
| | | |
| | | @Override |
| | | public void run() { |
| | | while (this != null) { |
| | | try { |
| | | Thread.sleep(100); |
| | | |
| | | } catch (InterruptedException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | |
| | | // System.out.println(jsonFilePath); |
| | | |
| | | //readAndUpdateWordValues(PlcReadObject); |
| | | readAndUpdateWordValues(PlcMesObject); |
| | | //readAndUpdateWordValues(PlcframeObject); |
| | | // readAndUpdateWordValues(PlcframeObject); |
| | | |
| | | // readAndUpdateWordValues(plcStateObject); |
| | | // int index = PlcMesObject.getPlcParameter("AddStart").getAddressIndex(); |
| | | // // System.out.println(index); |
| | | // PlcMesObject.getPlcParameter("AddStart").getAddress(index); |
| | | // // System.out.println(PlcMesObject.getPlcParameter("AddStart").getAddress(index)); |
| | | // List<String> addresses = new ArrayList<>(); |
| | | // addresses.add("FeedID"); |
| | | // addresses.add("AddStart"); |
| | | // // System.out.println(addresses); |
| | | // // System.out.println(PlcMesObject.getPlcParameterValues(addresses)); |
| | | // List<String> addresses2 = new ArrayList<>(); |
| | | // addresses2.add("FeedID"); |
| | | // addresses2.add("FeedCarStatus"); |
| | | |
| | | //System.out.println(PlcReadObject.getPlcParameterValues(addresses2)); |
| | | |
| | | } |
| | | } |
| | | } |
New file |
| | |
| | | package com.mes.entity.device; |
| | | |
| | | |
| | | |
| | | public class PlcBitInfo { |
| | | |
| | | public PlcBitInfo(String startAddress) { |
| | | this.startAddress = startAddress; |
| | | } |
| | | private String startAddress; |
| | | // 参数标识 |
| | | private String codeId; |
| | | |
| | | // 参数名称 |
| | | private String name; |
| | | |
| | | // 读取 参数值 |
| | | private Boolean value; |
| | | // 参数地址 |
| | | private int addressIndex; |
| | | |
| | | public String getCodeId() { |
| | | return this.codeId; |
| | | } |
| | | |
| | | public void setCodeId(String codeId) { |
| | | this.codeId = codeId; |
| | | } |
| | | |
| | | public String getName() { |
| | | return this.name; |
| | | } |
| | | |
| | | public void setName(String name) { |
| | | this.name = name; |
| | | } |
| | | |
| | | public Boolean getValue() { |
| | | return this.value; |
| | | } |
| | | |
| | | public void setValue(Boolean value) { |
| | | this.value = value; |
| | | } |
| | | |
| | | |
| | | public int getAddressIndex() { |
| | | return this.addressIndex; |
| | | } |
| | | /** |
| | | * 获取地址 |
| | | * |
| | | * @param index 索引地址 |
| | | */ |
| | | public String getAddress(int index) { |
| | | String[] stringdatas = this.startAddress.trim().split("\\."); |
| | | if (stringdatas.length < 2 ) |
| | | return null; |
| | | int dbwindex = 0; |
| | | int bitindex = 0; |
| | | if (stringdatas.length == 3) { |
| | | dbwindex = Integer.parseInt(stringdatas[1]); |
| | | bitindex = Integer.parseInt(stringdatas[2]); |
| | | } else |
| | | return null; |
| | | dbwindex+=index/8; |
| | | bitindex+=index%8; |
| | | return stringdatas[0]+"."+dbwindex+"."+bitindex; |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | public void setAddressIndex(int addressindex) { |
| | | this.addressIndex = addressindex; |
| | | } |
| | | } |
New file |
| | |
| | | package com.mes.entity.device; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.LinkedHashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | public class PlcBitObject { |
| | | |
| | | // 该模块数据类型,数据起始位置 |
| | | private String plcAddressBegin; |
| | | // 数据地址长度:第一参数到最后一个参数的长度 |
| | | private int plcAddressLength; |
| | | private ArrayList<PlcBitInfo> plcBitList; |
| | | |
| | | /** |
| | | * @return 数据区开始地址 |
| | | */ |
| | | public String getPlcAddressBegin() { |
| | | return plcAddressBegin; |
| | | } |
| | | |
| | | /** |
| | | * @param plcAddressBegin 设置数据区开始地址 |
| | | */ |
| | | public void setPlcAddressBegin(String plcAddressBegin) { |
| | | this.plcAddressBegin = plcAddressBegin; |
| | | } |
| | | |
| | | /** |
| | | * @return 数据区 读取所有数据所需的长度(以byte类型为基准) |
| | | */ |
| | | public int getPlcAddressLength() { |
| | | return plcAddressLength; |
| | | } |
| | | |
| | | /** |
| | | * @return 设置:数据区 读取所有数据所需的长度(以byte类型为基准) |
| | | */ |
| | | public void setPlcAddressLength(int plcAddressLength) { |
| | | this.plcAddressLength = plcAddressLength; |
| | | } |
| | | |
| | | /** |
| | | * @return 获取参数实例集合 |
| | | */ |
| | | public ArrayList<PlcBitInfo> getBitList() { |
| | | return plcBitList; |
| | | } |
| | | |
| | | /** |
| | | * 根据参数标识 获取某个参数实例 |
| | | * |
| | | * @param codeid 参数标识 |
| | | * @return 获取某个参数实例 |
| | | */ |
| | | public PlcBitInfo getPlcBit(String codeid) { |
| | | if (plcBitList != null) { |
| | | for (PlcBitInfo plcbitInfo : plcBitList) { |
| | | if (plcbitInfo.getCodeId().equals(codeid)) |
| | | return plcbitInfo; |
| | | } |
| | | return null; |
| | | } else |
| | | return null; |
| | | } |
| | | |
| | | /** |
| | | * 根据参数标识 获取某个参数实例 |
| | | * |
| | | * @param codeid 参数标识 |
| | | * @return 获取某个参数实例 |
| | | */ |
| | | public List<Boolean> getPlcBitValues(List<String> codeids) { |
| | | List<Boolean> arrayList = new ArrayList<>(); |
| | | if (plcBitList != null) { |
| | | Map<String, Boolean> resultMap = new LinkedHashMap<>(); // 使用 LinkedHashMap 保留插入顺序 |
| | | for (PlcBitInfo plcBitInfo : plcBitList) { |
| | | if (codeids.contains(plcBitInfo.getCodeId().toString())) { |
| | | resultMap.put(plcBitInfo.getCodeId().toString(), plcBitInfo.getValue()); |
| | | } |
| | | } |
| | | for (String codeId : codeids) { // 按照传入参数的顺序遍历 |
| | | Boolean value = resultMap.get(codeId); |
| | | if (value != null) { |
| | | arrayList.add(value); |
| | | } else { |
| | | arrayList.add(null); // 如果找不到对应的值,添加 null |
| | | } |
| | | } |
| | | } |
| | | return arrayList; |
| | | } |
| | | |
| | | |
| | | public List<String> getAddressListByCodeId(List<String> codeIdList) { |
| | | List<String> addressList = new ArrayList<>(); |
| | | for (String codeId : codeIdList) { |
| | | for (PlcBitInfo plcBitInfo : plcBitList) { |
| | | if (plcBitInfo.getCodeId().equals(codeId)) { |
| | | int index = plcBitInfo.getAddressIndex(); |
| | | String address = plcBitInfo.getAddress(index); |
| | | if (address != null) { |
| | | addressList.add(address); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | return addressList; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 添加参数实例 |
| | | * |
| | | * @param param 参数实例 |
| | | */ |
| | | public void addPlcBit(PlcBitInfo param) { |
| | | if (plcBitList != null) |
| | | plcBitList.add(param); |
| | | else { |
| | | plcBitList = new ArrayList<PlcBitInfo>(); |
| | | plcBitList.add(param); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 根据PLC返回的数据 给参数实例赋值 |
| | | * |
| | | * @param plcValueArray PLC读取回来的byte类型数据集合 |
| | | */ |
| | | public void setPlcBitList(List<Boolean> plcValueArray) { |
| | | if (plcBitList != null) { |
| | | for (PlcBitInfo plcbitInfo : plcBitList) { |
| | | plcbitInfo.setValue(plcValueArray.get(plcbitInfo.getAddressIndex())); |
| | | } |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.mes.entity.device; |
| | | public class PlcParameterInfo { |
| | | public PlcParameterInfo(String startAddress) { |
| | | this.startAddress = startAddress; |
| | | } |
| | | private String startAddress; |
| | | // 参数标识 |
| | | private String codeId; |
| | | |
| | | // 参数名称 |
| | | private String name; |
| | | |
| | | // 读取 参数值 |
| | | private String value; |
| | | |
| | | // // 写入 参数值 |
| | | // private String writeValue; |
| | | |
| | | // 参数单位 |
| | | private String unit; |
| | | |
| | | // 参数值转换系数 |
| | | private int ratio; |
| | | |
| | | // 参数地址 |
| | | private int addressIndex; |
| | | |
| | | // 参数地址位长度 |
| | | private int addressLength; |
| | | |
| | | public String getCodeId() { |
| | | return this.codeId; |
| | | } |
| | | |
| | | public void setCodeId(String codeId) { |
| | | this.codeId = codeId; |
| | | } |
| | | |
| | | public String getName() { |
| | | return this.name; |
| | | } |
| | | |
| | | public void setName(String name) { |
| | | this.name = name; |
| | | } |
| | | |
| | | public String getValue() { |
| | | return this.value; |
| | | } |
| | | |
| | | public void setValue(String value) { |
| | | this.value = value; |
| | | } |
| | | |
| | | // public String getWriteValue() { |
| | | // return this.writeValue; |
| | | // } |
| | | |
| | | // public void setWriteValue(String writeValue) { |
| | | // this.writeValue = writeValue; |
| | | // } |
| | | |
| | | public String getUnit() { |
| | | return this.unit; |
| | | } |
| | | |
| | | public void setUnit(String unit) { |
| | | this.unit = unit; |
| | | } |
| | | |
| | | public int getAddressIndex() { |
| | | return this.addressIndex; |
| | | } |
| | | |
| | | public void setAddressIndex(int addressindex) { |
| | | this.addressIndex = addressindex; |
| | | } |
| | | |
| | | public int getAddressLength() { |
| | | return this.addressLength; |
| | | } |
| | | |
| | | public void setAddressLength(int addresslength) { |
| | | this.addressLength = addresslength; |
| | | } |
| | | |
| | | public int getRatio() { |
| | | return this.ratio; |
| | | } |
| | | |
| | | public void setRatio(int ratio) { |
| | | this.ratio = ratio; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 获取地址 |
| | | * |
| | | * @param index 索引地址 |
| | | */ |
| | | public String getAddress(int index) { |
| | | String[] stringdatas = this.startAddress.trim().split("\\."); |
| | | int addressLength=this.addressLength; |
| | | if (addressLength < 2 ){ |
| | | return null; |
| | | } |
| | | |
| | | if (addressLength == 2 ) { |
| | | int wordindex = index; |
| | | |
| | | return stringdatas[0] + "." + wordindex; |
| | | } |
| | | if (addressLength == 14 ) { |
| | | int wordindex = index; |
| | | //int newIndex = wordindex + 13; |
| | | return stringdatas[0] + "." + wordindex ; |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | public int getPlcAddress() { |
| | | |
| | | return addressIndex; |
| | | } |
| | | public String getAddress() { |
| | | return getAddress(this.addressIndex); |
| | | } |
| | | } |
New file |
| | |
| | | package com.mes.entity.device; |
| | | |
| | | import java.lang.reflect.Array; |
| | | import java.nio.charset.StandardCharsets; |
| | | import java.util.ArrayList; |
| | | import java.util.LinkedHashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | public class PlcParameterObject { |
| | | |
| | | // 该模块数据类型,数据起始位置 |
| | | private String plcAddressBegin; |
| | | // 数据地址长度:第一参数到最后一个参数的长度 |
| | | private int plcAddressLength; |
| | | private ArrayList<PlcParameterInfo> plcParameterList; |
| | | |
| | | /** |
| | | * @return 数据区开始地址 |
| | | */ |
| | | public String getPlcAddressBegin() { |
| | | return plcAddressBegin; |
| | | } |
| | | |
| | | /** |
| | | * @param plcAddressBegin 设置数据区开始地址 |
| | | */ |
| | | public void setPlcAddressBegin(String plcAddressBegin) { |
| | | this.plcAddressBegin = plcAddressBegin; |
| | | } |
| | | |
| | | /** |
| | | * @return 数据区 读取所有数据所需的长度(以byte类型为基准) |
| | | */ |
| | | public int getPlcAddressLength() { |
| | | return plcAddressLength; |
| | | } |
| | | |
| | | /** |
| | | * @return 设置:数据区 读取所有数据所需的长度(以byte类型为基准) |
| | | */ |
| | | public void setPlcAddressLength(int plcAddressLength) { |
| | | this.plcAddressLength = plcAddressLength; |
| | | } |
| | | |
| | | /** |
| | | * @return 获取参数实例集合 |
| | | */ |
| | | public ArrayList<PlcParameterInfo> getPlcParameterList() { |
| | | return plcParameterList; |
| | | } |
| | | |
| | | /** |
| | | * 根据参数标识 获取某个参数实例 |
| | | * |
| | | * @param codeid 参数标识 |
| | | * @return 获取某个参数实例 |
| | | */ |
| | | public PlcParameterInfo getPlcParameter(String codeid) { |
| | | if (plcParameterList != null) { |
| | | for (PlcParameterInfo plcParameterInfo : plcParameterList) { |
| | | if (plcParameterInfo.getCodeId().equals(codeid)) |
| | | return plcParameterInfo; |
| | | } |
| | | return null; |
| | | } else |
| | | return null; |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * 根据参数标识 获取某个参数实例 |
| | | * |
| | | * @param codeids 参数标识 |
| | | * @return 获取某个参数实例 |
| | | */ |
| | | public List<String> getPlcParameterValues(List<String> codeids) { |
| | | List<String> arrayList = new ArrayList<>(); |
| | | if (plcParameterList != null) { |
| | | Map<String, PlcParameterInfo> resultMap = new LinkedHashMap<>(); // 使用 LinkedHashMap 保留插入顺序 |
| | | for (PlcParameterInfo plcParameterInfo : plcParameterList) { |
| | | if (codeids.contains(plcParameterInfo.getCodeId())) { |
| | | resultMap.put(plcParameterInfo.getCodeId(), plcParameterInfo); |
| | | } |
| | | } |
| | | for (String codeId : codeids) { // 按照传入参数的顺序遍历 |
| | | PlcParameterInfo plcParameterInfo = resultMap.get(codeId); |
| | | if (plcParameterInfo != null) { |
| | | arrayList.add(plcParameterInfo.getValue()); |
| | | } else { |
| | | arrayList.add(null); // 如果找不到对应的值,添加 null |
| | | } |
| | | } |
| | | } |
| | | return arrayList; |
| | | } |
| | | |
| | | |
| | | public List<String> getAddressListByCodeId(List<String> codeIdList) { |
| | | List<String> addressList = new ArrayList<>(); |
| | | for (String codeId : codeIdList) { |
| | | for (PlcParameterInfo plcParameterInfo : plcParameterList) { |
| | | if (plcParameterInfo.getCodeId().equals(codeId)) { |
| | | int index = plcParameterInfo.getAddressIndex(); |
| | | String address = plcParameterInfo.getAddress(index); |
| | | if (address != null) { |
| | | addressList.add(address); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | return addressList; |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | /** |
| | | * 添加参数实例 |
| | | * |
| | | * @param param 参数实例 |
| | | */ |
| | | public void addPlcParameter(PlcParameterInfo param) { |
| | | if (plcParameterList != null) |
| | | plcParameterList.add(param); |
| | | else { |
| | | plcParameterList = new ArrayList<PlcParameterInfo>(); |
| | | plcParameterList.add(param); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 根据PLC返回的数据 给参数实例赋值 |
| | | * |
| | | * @param plcValueArray PLC读取回来的byte类型数据集合 |
| | | */ |
| | | public void setPlcParameterList(byte[] plcValueArray) { |
| | | if (plcParameterList != null) { |
| | | |
| | | for (PlcParameterInfo plcParameterInfo : plcParameterList) { |
| | | |
| | | byte[] valueList = new byte[plcParameterInfo.getAddressLength()]; |
| | | |
| | | // System.out.println(plcParameterInfo.getAddressLength()); |
| | | |
| | | for (int i = 0; i < plcParameterInfo.getAddressLength(); i++) { |
| | | Array.setByte(valueList, i, plcValueArray[plcParameterInfo.getAddressIndex() + i]); |
| | | |
| | | } |
| | | if (plcParameterInfo.getAddressLength()==2) { |
| | | plcParameterInfo.setValue(String.valueOf(byte2short(valueList))); |
| | | } |
| | | else if (plcParameterInfo.getAddressLength()==14) { |
| | | plcParameterInfo.setValue((byteToHexString(valueList))); |
| | | } |
| | | |
| | | else |
| | | { |
| | | String valuestr = new String(valueList); |
| | | plcParameterInfo.setValue(valuestr); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | /** |
| | | * short类型转byte[] |
| | | * |
| | | * @param s short类型值 |
| | | */ |
| | | public static byte[] short2byte(short s){ |
| | | byte[] b = new byte[2]; |
| | | for(int i = 0; i < 2; i++){ |
| | | int offset = 16 - (i+1)*8; //因为byte占4个字节,所以要计算偏移量 |
| | | b[i] = (byte)((s >> offset)&0xff); //把16位分为2个8位进行分别存储 |
| | | } |
| | | return b; |
| | | } |
| | | /** |
| | | * byte[]类型转short |
| | | * |
| | | * @param b byte[]类型值 |
| | | */ |
| | | public static short byte2short(byte[] b){ |
| | | short l = 0; |
| | | for (int i = 0; i < 2; i++) { |
| | | l<<=8; //<<=和我们的 +=是一样的,意思就是 l = l << 8 |
| | | l |= (b[i] & 0xff); //和上面也是一样的 l = l | (b[i]&0xff) |
| | | } |
| | | return l; |
| | | } |
| | | |
| | | public static String byteToHexString(byte[] bytes) { |
| | | |
| | | String str = new String(bytes, StandardCharsets.UTF_8); |
| | | return str; |
| | | } |
| | | |
| | | |
| | | } |
| | |
| | | package com.mes.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.mes.entity.OrderTest; |
| | | import java.util.List; |
| | | import org.apache.ibatis.annotations.*; |
| | | |
| | | import com.mes.entity.UpWorkstation; |
| | | @Mapper |
| | | public interface LoadGlassMapper extends BaseMapper<UpWorkstation> { |
| | | //显示目前工位玻璃信息 |
| | | @Select("SELECT * FROM up_workstation") |
| | | UpWorkstation SelectALL(); |
| | | List<UpWorkstation> selectALL(); |
| | | //删除工位的玻璃信息 |
| | | @Delete("DELETE FROM up_workstation where workstation_id=#{id}") |
| | | void DeleteALL(int id ); |
| | | void deleteGlass(int id ); |
| | | //增加上片信息 |
| | | @Insert ("INSERT INTO up_workstation (pattern_width,pattern_heigth,pattern_thickness)value(#{patternwidth},#{patternheigth},#{patternthickness}where workstation_id=#{workstationid) ") |
| | | void InsertALL(Double patternwidth,Double patternheigth,Double patternthickness,int workstationid); |
| | | void insertGlass(Double patternwidth,Double patternheigth,Double patternthickness,int workstationid); |
| | | //是否发起吸片 |
| | | @Select("SELECT * FROM up_workstation where workstation_id=#{id}") |
| | | UpWorkstation selectAdd(int id); |
| | | //判断优先工位吸片 |
| | | @Select("select b.layout_sequence from up_workstation a left join up_patten_usage b on a.pattern_width=b.width and a.pattern_heigth=b.width and a.pattern_thickness=b.thickness where a.workstation_id=#{id}") |
| | | int selectPriority(int id); |
| | | |
| | | } |
| | |
| | | package com.mes.service; |
| | | import java.nio.charset.StandardCharsets; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | import com.example.springboot.component.PLCAutoMes; |
| | | import com.example.springboot.component.S7control; |
| | | import com.example.springboot.entity.device.PlcParameterObject; |
| | | import com.mes.entity.device.PLCAutoMes; |
| | | import com.mes.common.PlcTools.S7control; |
| | | import com.mes.entity.device.PlcParameterObject; |
| | | import com.google.common.primitives.Bytes; |
| | | import com.mes.entity.GlassInfo; |
| | | import com.mes.entity.UpWorkstation; |
| | | import com.mes.mapper.LoadGlassMapper; |
| | | import com.mes.mapper.TemperingMapper; |
| | | |
| | | @Service |
| | | public class LoadGlassService { |
| | | @Autowired |
| | | private com.mes.common.PlcTools.S7control s7control; |
| | | private LoadGlassMapper LoadGlassMapper; |
| | | PlcParameterObject plcmes=PLCAutoMes.PlcMesObject; |
| | | //显示工位上的玻璃信息 |
| | | public GlassInfo selectAll() { |
| | | GlassInfo glassInfo = LoadGlassMapper.SelectALL(); |
| | | public List<UpWorkstation> selectAll() { |
| | | List<UpWorkstation> glassInfo= LoadGlassMapper.selectALL(); |
| | | return glassInfo; |
| | | } |
| | | //增加人工输入的工位玻璃信息 |
| | | public void insertGlass(UpWorkstation upwork) { |
| | | LoadGlassMapper.insertGlass(upwork.Getpatternwidth(),upwork.getPatternheigth(),upwork.getPatternthickness(),1); |
| | | public void insertGlass(UpWorkstation upwork) { |
| | | LoadGlassMapper.insertGlass(upwork.getPatternwidth(),upwork.getPatternheigth(),upwork.getPatternthickness(),upwork.getWorkstationid()); |
| | | } |
| | | //删除人工搬走的玻璃信息 |
| | | public void deleteGlass(String id) { |
| | | public void deleteGlass(int id) { |
| | | LoadGlassMapper.deleteGlass(id); |
| | | } |
| | | //判断是否可以吸片进行任务 |
| | | public boolean isCanLoadGlass() { |
| | | boolean result=s7control.WriteWord("100.10", 1); |
| | | return result; |
| | | String loadstate=plcmes.getPlcParameter("吸片信号").getValue(); |
| | | if(loadstate.equals("1")) { |
| | | return true; |
| | | }else{ |
| | | return false; |
| | | } |
| | | |
| | | } |
| | | //判断优先吸片位置后发送出片任务 |
| | | public void selectPriority() { |
| | | int loadid1=LoadGlassMapper.selectPriority(1); |
| | | int loadid2=LoadGlassMapper.selectPriority(2); |
| | | //判断一二号工位哪边的顺序更先 |
| | | if(loadid1>loadid2) { |
| | | s7control.WriteWord("DB100.10", (short)2); |
| | | }else if(loadid1==loadid2){ |
| | | //当两个工位上的玻璃数相同时,判断哪个工位上的玻璃数更少,优先清空一个架子 |
| | | int glassnum1=plcmes.getPlcParameter("玻璃数").getValue(); |
| | | int glassnum2=plcmes.getPlcParameter("玻璃数").getValue(); |
| | | if(glassnum1>glassnum2){ |
| | | s7control.WriteWord("DB100.10", (short)2); |
| | | }else{ |
| | | s7control.WriteWord("DB100.10", (short)1); |
| | | } |
| | | }else{ |
| | | s7control.WriteWord("DB100.10", (short)1); |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | } |
New file |
| | |
| | | { |
| | | "plcAddressBegin":"DB14.0", |
| | | "plcAddressLenght":"208", |
| | | "dataType":"word", |
| | | "parameteInfor":[ |
| | | { |
| | | "codeId": "PLCToMES", |
| | | "addressIndex":"0", |
| | | "addressLenght":"2", |
| | | "ratio":"1", |
| | | "unit":"m/min" |
| | | }, |
| | | { |
| | | "codeId": "IDStatus1", |
| | | "addressIndex":"2", |
| | | "addressLenght":"2", |
| | | "ratio":"1", |
| | | "unit":"m/min" |
| | | }, |
| | | { |
| | | "codeId": "IDStatus2", |
| | | "addressIndex":"4", |
| | | "addressLenght":"2", |
| | | "ratio":"1", |
| | | "unit":"m/min" |
| | | }, |
| | | { |
| | | "codeId": "IDStatus3", |
| | | "addressIndex":"6", |
| | | "addressLenght":"2", |
| | | "ratio":"1", |
| | | "unit":"mm/S" |
| | | }, |
| | | { |
| | | "codeId": "IDStatus4", |
| | | "addressIndex":"8", |
| | | "addressLenght":"2", |
| | | "ratio":"1", |
| | | "unit":"mm/S" |
| | | }, |
| | | { |
| | | "codeId": "IDStatus5", |
| | | "addressIndex":"10", |
| | | "addressLenght":"2", |
| | | "ratio":"1", |
| | | "unit":"mm/S" |
| | | } |
| | | , |
| | | { |
| | | "codeId": "IDStatus6", |
| | | "addressIndex":"12", |
| | | "addressLenght":"2", |
| | | "ratio":"1", |
| | | "unit":"mm/S" |
| | | }, |
| | | { |
| | | "codeId": "StautsID1", |
| | | "addressIndex":"14", |
| | | "addressLenght":"2", |
| | | "ratio":"1", |
| | | "unit":"mm/S" |
| | | } |
| | | , |
| | | { |
| | | "codeId": "StautsID2", |
| | | "addressIndex":"16", |
| | | "addressLenght":"2", |
| | | "ratio":"1", |
| | | "unit":"mm/S" |
| | | } |
| | | , |
| | | { |
| | | "codeId": "StautsID3", |
| | | "addressIndex":"18", |
| | | "addressLenght":"2", |
| | | "ratio":"1", |
| | | "unit":"mm/S" |
| | | } |
| | | , |
| | | { |
| | | "codeId": "StautsID4", |
| | | "addressIndex":"20", |
| | | "addressLenght":"2", |
| | | "ratio":"1", |
| | | "unit":"mm/S" |
| | | } |
| | | , |
| | | { |
| | | "codeId": "StautsID5", |
| | | "addressIndex":"22", |
| | | "addressLenght":"2", |
| | | "ratio":"1", |
| | | "unit":"mm/S" |
| | | }, |
| | | { |
| | | "codeId": "StautsID6", |
| | | "addressIndex":"24", |
| | | "addressLenght":"2", |
| | | "ratio":"1", |
| | | "unit":"mm/S" |
| | | }, |
| | | { |
| | | "codeId": "GaToMES", |
| | | "addressIndex":"26", |
| | | "addressLenght":"2", |
| | | "ratio":"1", |
| | | "unit":"mm/S" |
| | | }, |
| | | { |
| | | "codeId": "Height", |
| | | "addressIndex":"28", |
| | | "addressLenght":"2", |
| | | "ratio":"1", |
| | | "unit":"mm/S" |
| | | }, |
| | | { |
| | | "codeId": "width", |
| | | "addressIndex":"30", |
| | | "addressLenght":"2", |
| | | "ratio":"1", |
| | | "unit":"mm/S" |
| | | }, |
| | | { |
| | | "codeId": "ExportTOMES1", |
| | | "addressIndex":"32", |
| | | "addressLenght":"2", |
| | | "ratio":"1", |
| | | "unit":"mm/S" |
| | | } |
| | | , |
| | | { |
| | | "codeId": "ExportToMES2", |
| | | "addressIndex":"34", |
| | | "addressLenght":"2", |
| | | "ratio":"1", |
| | | "unit":"mm/S" |
| | | } , |
| | | { |
| | | "codeId": "MESToPLC", |
| | | "addressIndex":"36", |
| | | "addressLenght":"2", |
| | | "ratio":"1", |
| | | "unit":"mm/S" |
| | | } , |
| | | { |
| | | "codeId": "MESID1", |
| | | "addressIndex":"38", |
| | | "addressLenght":"14", |
| | | "ratio":"1", |
| | | "unit":"mm/S" |
| | | } , |
| | | { |
| | | "codeId": "MESID2", |
| | | "addressIndex":"54", |
| | | "addressLenght":"14", |
| | | "ratio":"1", |
| | | "unit":"mm/S" |
| | | }, |
| | | { |
| | | "codeId": "MESID3", |
| | | "addressIndex":"70", |
| | | "addressLenght":"14", |
| | | "ratio":"1", |
| | | "unit":"mm/S" |
| | | }, |
| | | { |
| | | "codeId": "MESID4", |
| | | "addressIndex":"86", |
| | | "addressLenght":"14", |
| | | "ratio":"1", |
| | | "unit":"mm/S" |
| | | }, |
| | | { |
| | | "codeId": "MESID5", |
| | | "addressIndex":"102", |
| | | "addressLenght":"14", |
| | | "ratio":"1", |
| | | "unit":"mm/S" |
| | | }, |
| | | { |
| | | "codeId": "MESID6", |
| | | "addressIndex":"118", |
| | | "addressLenght":"14", |
| | | "ratio":"1", |
| | | "unit":"mm/S" |
| | | }, |
| | | { |
| | | "codeId": "MESToPLCStart1", |
| | | "addressIndex":"134", |
| | | "addressLenght":"2", |
| | | "ratio":"1", |
| | | "unit":"mm/S" |
| | | },{ |
| | | "codeId": "MESToPLCStart2", |
| | | "addressIndex":"136", |
| | | "addressLenght":"2", |
| | | "ratio":"1", |
| | | "unit":"mm/S" |
| | | },{ |
| | | "codeId": "MESToPLCStart3", |
| | | "addressIndex":"138", |
| | | "addressLenght":"2", |
| | | "ratio":"1", |
| | | "unit":"mm/S" |
| | | } |
| | | ,{ |
| | | "codeId": "MESToPLCStart4", |
| | | "addressIndex":"140", |
| | | "addressLenght":"2", |
| | | "ratio":"1", |
| | | "unit":"mm/S" |
| | | } |
| | | ,{ |
| | | "codeId": "MESToPLCStart5", |
| | | "addressIndex":"142", |
| | | "addressLenght":"2", |
| | | "ratio":"1", |
| | | "unit":"mm/S" |
| | | } |
| | | ,{ |
| | | "codeId": "MESToPLCStart6", |
| | | "addressIndex":"144", |
| | | "addressLenght":"2", |
| | | "ratio":"1", |
| | | "unit":"mm/S" |
| | | },{ |
| | | "codeId": "MESToPLCTarget1", |
| | | "addressIndex":"146", |
| | | "addressLenght":"2", |
| | | "ratio":"1", |
| | | "unit":"mm/S" |
| | | },{ |
| | | "codeId": "MESToPLCTarget2", |
| | | "addressIndex":"148", |
| | | "addressLenght":"2", |
| | | "ratio":"1", |
| | | "unit":"mm/S" |
| | | },{ |
| | | "codeId": "MESToPLCTarget3", |
| | | "addressIndex":"150", |
| | | "addressLenght":"2", |
| | | "ratio":"1", |
| | | "unit":"mm/S" |
| | | },{ |
| | | "codeId": "MESToPLCTarget4", |
| | | "addressIndex":"152", |
| | | "addressLenght":"2", |
| | | "ratio":"1", |
| | | "unit":"mm/S" |
| | | },{ |
| | | "codeId": "MESToPLCTarget5", |
| | | "addressIndex":"154", |
| | | "addressLenght":"2", |
| | | "ratio":"1", |
| | | "unit":"mm/S" |
| | | },{ |
| | | "codeId": "MESToPLCTarget6", |
| | | "addressIndex":"156", |
| | | "addressLenght":"2", |
| | | "ratio":"1", |
| | | "unit":"mm/S" |
| | | },{ |
| | | "codeId": "MESToPLCStatus1", |
| | | "addressIndex":"158", |
| | | "addressLenght":"2", |
| | | "ratio":"1", |
| | | "unit":"mm/S" |
| | | },{ |
| | | "codeId": "MESToPLCStatus2", |
| | | "addressIndex":"160", |
| | | "addressLenght":"2", |
| | | "ratio":"1", |
| | | "unit":"mm/S" |
| | | },{ |
| | | "codeId": "MESToPLCStatus3", |
| | | "addressIndex":"162", |
| | | "addressLenght":"2", |
| | | "ratio":"1", |
| | | "unit":"mm/S" |
| | | },{ |
| | | "codeId": "MESToPLCStatus4", |
| | | "addressIndex":"164", |
| | | "addressLenght":"2", |
| | | "ratio":"1", |
| | | "unit":"mm/S" |
| | | },{ |
| | | "codeId": "MESToPLCStatus5", |
| | | "addressIndex":"166", |
| | | "addressLenght":"2", |
| | | "ratio":"1", |
| | | "unit":"mm/S" |
| | | },{ |
| | | "codeId": "MESToPLCStatus6", |
| | | "addressIndex":"168", |
| | | "addressLenght":"2", |
| | | "ratio":"1", |
| | | "unit":"mm/S" |
| | | },{ |
| | | "codeId": "MESToGaStatus", |
| | | "addressIndex":"170", |
| | | "addressLenght":"2", |
| | | "ratio":"1", |
| | | "unit":"mm/S" |
| | | },{ |
| | | "codeId": "A01Err", |
| | | "addressIndex":"172", |
| | | "addressLenght":"2", |
| | | "ratio":"1", |
| | | "unit":"mm/S" |
| | | },{ |
| | | "codeId": "A02Err", |
| | | "addressIndex":"174", |
| | | "addressLenght":"2", |
| | | "ratio":"1", |
| | | "unit":"mm/S" |
| | | },{ |
| | | "codeId": "B01Err", |
| | | "addressIndex":"176", |
| | | "addressLenght":"2", |
| | | "ratio":"1", |
| | | "unit":"mm/S" |
| | | },{ |
| | | "codeId": "C01Err", |
| | | "addressIndex":"178", |
| | | "addressLenght":"2", |
| | | "ratio":"1", |
| | | "unit":"mm/S" |
| | | },{ |
| | | "codeId": "C02Err", |
| | | "addressIndex":"180", |
| | | "addressLenght":"2", |
| | | "ratio":"1", |
| | | "unit":"mm/S" |
| | | },{ |
| | | "codeId": "ErrSpace1", |
| | | "addressIndex":"182", |
| | | "addressLenght":"2", |
| | | "ratio":"1", |
| | | "unit":"mm/S" |
| | | },{ |
| | | "codeId": "ErrSpace2", |
| | | "addressIndex":"184", |
| | | "addressLenght":"2", |
| | | "ratio":"1", |
| | | "unit":"mm/S" |
| | | },{ |
| | | "codeId": "ErrSpace3", |
| | | "addressIndex":"186", |
| | | "addressLenght":"2", |
| | | "ratio":"1", |
| | | "unit":"mm/S" |
| | | },{ |
| | | "codeId": "B01Position", |
| | | "addressIndex":"188", |
| | | "addressLenght":"2", |
| | | "ratio":"1", |
| | | "unit":"mm/S" |
| | | },{ |
| | | "codeId": "C01Position", |
| | | "addressIndex":"190", |
| | | "addressLenght":"2", |
| | | "ratio":"1", |
| | | "unit":"mm/S" |
| | | },{ |
| | | "codeId": "C02Position", |
| | | "addressIndex":"192", |
| | | "addressLenght":"2", |
| | | "ratio":"1", |
| | | "unit":"mm/S" |
| | | },{ |
| | | "codeId": "DeviceState", |
| | | "addressIndex":"194", |
| | | "addressLenght":"2", |
| | | "ratio":"1", |
| | | "unit":"mm/S" |
| | | },{ |
| | | "codeId": "AllFVRun", |
| | | "addressIndex":"196", |
| | | "addressLenght":"2", |
| | | "ratio":"1", |
| | | "unit":"mm/S" |
| | | },{ |
| | | "codeId": "A01State", |
| | | "addressIndex":"198", |
| | | "addressLenght":"2", |
| | | "ratio":"1", |
| | | "unit":"mm/S" |
| | | },{ |
| | | "codeId": "A02State", |
| | | "addressIndex":"200", |
| | | "addressLenght":"2", |
| | | "ratio":"1", |
| | | "unit":"mm/S" |
| | | },{ |
| | | "codeId": "B01State", |
| | | "addressIndex":"202", |
| | | "addressLenght":"2", |
| | | "ratio":"1", |
| | | "unit":"mm/S" |
| | | },{ |
| | | "codeId": "C01State", |
| | | "addressIndex":"204", |
| | | "addressLenght":"2", |
| | | "ratio":"1", |
| | | "unit":"mm/S" |
| | | },{ |
| | | "codeId": "C02State", |
| | | "addressIndex":"206", |
| | | "addressLenght":"2", |
| | | "ratio":"1", |
| | | "unit":"mm/S" |
| | | } |
| | | ] |
| | | } |
New file |
| | |
| | | { |
| | | "plcAddressBegin":"DB14.0", |
| | | "plcAddressLenght":"208", |
| | | "dataType":"word", |
| | | "parameteInfor":[ |
| | | { |
| | | "codeId": "PLCToMES", |
| | | "addressIndex":"0", |
| | | "addressLenght":"2", |
| | | "ratio":"1", |
| | | "unit":"m/min" |
| | | }, |
| | | { |
| | | "codeId": "IDStatus1", |
| | | "addressIndex":"2", |
| | | "addressLenght":"2", |
| | | "ratio":"1", |
| | | "unit":"m/min" |
| | | }, |
| | | { |
| | | "codeId": "IDStatus2", |
| | | "addressIndex":"4", |
| | | "addressLenght":"2", |
| | | "ratio":"1", |
| | | "unit":"m/min" |
| | | }, |
| | | { |
| | | "codeId": "IDStatus3", |
| | | "addressIndex":"6", |
| | | "addressLenght":"2", |
| | | "ratio":"1", |
| | | "unit":"mm/S" |
| | | }, |
| | | { |
| | | "codeId": "IDStatus4", |
| | | "addressIndex":"8", |
| | | "addressLenght":"2", |
| | | "ratio":"1", |
| | | "unit":"mm/S" |
| | | }, |
| | | { |
| | | "codeId": "IDStatus5", |
| | | "addressIndex":"10", |
| | | "addressLenght":"2", |
| | | "ratio":"1", |
| | | "unit":"mm/S" |
| | | } |
| | | , |
| | | { |
| | | "codeId": "IDStatus6", |
| | | "addressIndex":"12", |
| | | "addressLenght":"2", |
| | | "ratio":"1", |
| | | "unit":"mm/S" |
| | | }, |
| | | { |
| | | "codeId": "StautsID1", |
| | | "addressIndex":"14", |
| | | "addressLenght":"2", |
| | | "ratio":"1", |
| | | "unit":"mm/S" |
| | | } |
| | | , |
| | | { |
| | | "codeId": "StautsID2", |
| | | "addressIndex":"16", |
| | | "addressLenght":"2", |
| | | "ratio":"1", |
| | | "unit":"mm/S" |
| | | } |
| | | , |
| | | { |
| | | "codeId": "StautsID3", |
| | | "addressIndex":"18", |
| | | "addressLenght":"2", |
| | | "ratio":"1", |
| | | "unit":"mm/S" |
| | | } |
| | | , |
| | | { |
| | | "codeId": "StautsID4", |
| | | "addressIndex":"20", |
| | | "addressLenght":"2", |
| | | "ratio":"1", |
| | | "unit":"mm/S" |
| | | } |
| | | , |
| | | { |
| | | "codeId": "StautsID5", |
| | | "addressIndex":"22", |
| | | "addressLenght":"2", |
| | | "ratio":"1", |
| | | "unit":"mm/S" |
| | | }, |
| | | { |
| | | "codeId": "StautsID6", |
| | | "addressIndex":"24", |
| | | "addressLenght":"2", |
| | | "ratio":"1", |
| | | "unit":"mm/S" |
| | | }, |
| | | { |
| | | "codeId": "GaToMES", |
| | | "addressIndex":"26", |
| | | "addressLenght":"2", |
| | | "ratio":"1", |
| | | "unit":"mm/S" |
| | | }, |
| | | { |
| | | "codeId": "Height", |
| | | "addressIndex":"28", |
| | | "addressLenght":"2", |
| | | "ratio":"1", |
| | | "unit":"mm/S" |
| | | }, |
| | | { |
| | | "codeId": "width", |
| | | "addressIndex":"30", |
| | | "addressLenght":"2", |
| | | "ratio":"1", |
| | | "unit":"mm/S" |
| | | }, |
| | | { |
| | | "codeId": "ExportTOMES1", |
| | | "addressIndex":"32", |
| | | "addressLenght":"2", |
| | | "ratio":"1", |
| | | "unit":"mm/S" |
| | | } |
| | | , |
| | | { |
| | | "codeId": "ExportToMES2", |
| | | "addressIndex":"34", |
| | | "addressLenght":"2", |
| | | "ratio":"1", |
| | | "unit":"mm/S" |
| | | } , |
| | | { |
| | | "codeId": "MESToPLC", |
| | | "addressIndex":"36", |
| | | "addressLenght":"2", |
| | | "ratio":"1", |
| | | "unit":"mm/S" |
| | | } , |
| | | { |
| | | "codeId": "MESID1", |
| | | "addressIndex":"38", |
| | | "addressLenght":"14", |
| | | "ratio":"1", |
| | | "unit":"mm/S" |
| | | } , |
| | | { |
| | | "codeId": "MESID2", |
| | | "addressIndex":"54", |
| | | "addressLenght":"14", |
| | | "ratio":"1", |
| | | "unit":"mm/S" |
| | | }, |
| | | { |
| | | "codeId": "MESID3", |
| | | "addressIndex":"70", |
| | | "addressLenght":"14", |
| | | "ratio":"1", |
| | | "unit":"mm/S" |
| | | }, |
| | | { |
| | | "codeId": "MESID4", |
| | | "addressIndex":"86", |
| | | "addressLenght":"14", |
| | | "ratio":"1", |
| | | "unit":"mm/S" |
| | | }, |
| | | { |
| | | "codeId": "MESID5", |
| | | "addressIndex":"102", |
| | | "addressLenght":"14", |
| | | "ratio":"1", |
| | | "unit":"mm/S" |
| | | }, |
| | | { |
| | | "codeId": "MESID6", |
| | | "addressIndex":"118", |
| | | "addressLenght":"14", |
| | | "ratio":"1", |
| | | "unit":"mm/S" |
| | | }, |
| | | { |
| | | "codeId": "MESToPLCStart1", |
| | | "addressIndex":"134", |
| | | "addressLenght":"2", |
| | | "ratio":"1", |
| | | "unit":"mm/S" |
| | | },{ |
| | | "codeId": "MESToPLCStart2", |
| | | "addressIndex":"136", |
| | | "addressLenght":"2", |
| | | "ratio":"1", |
| | | "unit":"mm/S" |
| | | },{ |
| | | "codeId": "MESToPLCStart3", |
| | | "addressIndex":"138", |
| | | "addressLenght":"2", |
| | | "ratio":"1", |
| | | "unit":"mm/S" |
| | | } |
| | | ,{ |
| | | "codeId": "MESToPLCStart4", |
| | | "addressIndex":"140", |
| | | "addressLenght":"2", |
| | | "ratio":"1", |
| | | "unit":"mm/S" |
| | | } |
| | | ,{ |
| | | "codeId": "MESToPLCStart5", |
| | | "addressIndex":"142", |
| | | "addressLenght":"2", |
| | | "ratio":"1", |
| | | "unit":"mm/S" |
| | | } |
| | | ,{ |
| | | "codeId": "MESToPLCStart6", |
| | | "addressIndex":"144", |
| | | "addressLenght":"2", |
| | | "ratio":"1", |
| | | "unit":"mm/S" |
| | | },{ |
| | | "codeId": "MESToPLCTarget1", |
| | | "addressIndex":"146", |
| | | "addressLenght":"2", |
| | | "ratio":"1", |
| | | "unit":"mm/S" |
| | | },{ |
| | | "codeId": "MESToPLCTarget2", |
| | | "addressIndex":"148", |
| | | "addressLenght":"2", |
| | | "ratio":"1", |
| | | "unit":"mm/S" |
| | | },{ |
| | | "codeId": "MESToPLCTarget3", |
| | | "addressIndex":"150", |
| | | "addressLenght":"2", |
| | | "ratio":"1", |
| | | "unit":"mm/S" |
| | | },{ |
| | | "codeId": "MESToPLCTarget4", |
| | | "addressIndex":"152", |
| | | "addressLenght":"2", |
| | | "ratio":"1", |
| | | "unit":"mm/S" |
| | | },{ |
| | | "codeId": "MESToPLCTarget5", |
| | | "addressIndex":"154", |
| | | "addressLenght":"2", |
| | | "ratio":"1", |
| | | "unit":"mm/S" |
| | | },{ |
| | | "codeId": "MESToPLCTarget6", |
| | | "addressIndex":"156", |
| | | "addressLenght":"2", |
| | | "ratio":"1", |
| | | "unit":"mm/S" |
| | | },{ |
| | | "codeId": "MESToPLCStatus1", |
| | | "addressIndex":"158", |
| | | "addressLenght":"2", |
| | | "ratio":"1", |
| | | "unit":"mm/S" |
| | | },{ |
| | | "codeId": "MESToPLCStatus2", |
| | | "addressIndex":"160", |
| | | "addressLenght":"2", |
| | | "ratio":"1", |
| | | "unit":"mm/S" |
| | | },{ |
| | | "codeId": "MESToPLCStatus3", |
| | | "addressIndex":"162", |
| | | "addressLenght":"2", |
| | | "ratio":"1", |
| | | "unit":"mm/S" |
| | | },{ |
| | | "codeId": "MESToPLCStatus4", |
| | | "addressIndex":"164", |
| | | "addressLenght":"2", |
| | | "ratio":"1", |
| | | "unit":"mm/S" |
| | | },{ |
| | | "codeId": "MESToPLCStatus5", |
| | | "addressIndex":"166", |
| | | "addressLenght":"2", |
| | | "ratio":"1", |
| | | "unit":"mm/S" |
| | | },{ |
| | | "codeId": "MESToPLCStatus6", |
| | | "addressIndex":"168", |
| | | "addressLenght":"2", |
| | | "ratio":"1", |
| | | "unit":"mm/S" |
| | | },{ |
| | | "codeId": "MESToGaStatus", |
| | | "addressIndex":"170", |
| | | "addressLenght":"2", |
| | | "ratio":"1", |
| | | "unit":"mm/S" |
| | | },{ |
| | | "codeId": "A01Err", |
| | | "addressIndex":"172", |
| | | "addressLenght":"2", |
| | | "ratio":"1", |
| | | "unit":"mm/S" |
| | | },{ |
| | | "codeId": "A02Err", |
| | | "addressIndex":"174", |
| | | "addressLenght":"2", |
| | | "ratio":"1", |
| | | "unit":"mm/S" |
| | | },{ |
| | | "codeId": "B01Err", |
| | | "addressIndex":"176", |
| | | "addressLenght":"2", |
| | | "ratio":"1", |
| | | "unit":"mm/S" |
| | | },{ |
| | | "codeId": "C01Err", |
| | | "addressIndex":"178", |
| | | "addressLenght":"2", |
| | | "ratio":"1", |
| | | "unit":"mm/S" |
| | | },{ |
| | | "codeId": "C02Err", |
| | | "addressIndex":"180", |
| | | "addressLenght":"2", |
| | | "ratio":"1", |
| | | "unit":"mm/S" |
| | | },{ |
| | | "codeId": "ErrSpace1", |
| | | "addressIndex":"182", |
| | | "addressLenght":"2", |
| | | "ratio":"1", |
| | | "unit":"mm/S" |
| | | },{ |
| | | "codeId": "ErrSpace2", |
| | | "addressIndex":"184", |
| | | "addressLenght":"2", |
| | | "ratio":"1", |
| | | "unit":"mm/S" |
| | | },{ |
| | | "codeId": "ErrSpace3", |
| | | "addressIndex":"186", |
| | | "addressLenght":"2", |
| | | "ratio":"1", |
| | | "unit":"mm/S" |
| | | },{ |
| | | "codeId": "B01Position", |
| | | "addressIndex":"188", |
| | | "addressLenght":"2", |
| | | "ratio":"1", |
| | | "unit":"mm/S" |
| | | },{ |
| | | "codeId": "C01Position", |
| | | "addressIndex":"190", |
| | | "addressLenght":"2", |
| | | "ratio":"1", |
| | | "unit":"mm/S" |
| | | },{ |
| | | "codeId": "C02Position", |
| | | "addressIndex":"192", |
| | | "addressLenght":"2", |
| | | "ratio":"1", |
| | | "unit":"mm/S" |
| | | },{ |
| | | "codeId": "DeviceState", |
| | | "addressIndex":"194", |
| | | "addressLenght":"2", |
| | | "ratio":"1", |
| | | "unit":"mm/S" |
| | | },{ |
| | | "codeId": "AllFVRun", |
| | | "addressIndex":"196", |
| | | "addressLenght":"2", |
| | | "ratio":"1", |
| | | "unit":"mm/S" |
| | | },{ |
| | | "codeId": "A01State", |
| | | "addressIndex":"198", |
| | | "addressLenght":"2", |
| | | "ratio":"1", |
| | | "unit":"mm/S" |
| | | },{ |
| | | "codeId": "A02State", |
| | | "addressIndex":"200", |
| | | "addressLenght":"2", |
| | | "ratio":"1", |
| | | "unit":"mm/S" |
| | | },{ |
| | | "codeId": "B01State", |
| | | "addressIndex":"202", |
| | | "addressLenght":"2", |
| | | "ratio":"1", |
| | | "unit":"mm/S" |
| | | },{ |
| | | "codeId": "C01State", |
| | | "addressIndex":"204", |
| | | "addressLenght":"2", |
| | | "ratio":"1", |
| | | "unit":"mm/S" |
| | | },{ |
| | | "codeId": "C02State", |
| | | "addressIndex":"206", |
| | | "addressLenght":"2", |
| | | "ratio":"1", |
| | | "unit":"mm/S" |
| | | } |
| | | ] |
| | | } |
| | |
| | | package com.mes; |
| | | |
| | | import com.mes.common.PlcTools.S7object; |
| | | import org.springframework.boot.SpringApplication; |
| | | import org.springframework.boot.autoconfigure.SpringBootApplication; |
| | | import org.springframework.cache.annotation.EnableCaching; |
| | | import org.springframework.transaction.annotation.EnableTransactionManagement; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | //springboot 启动入口 |
| | | @SpringBootApplication |
| | |
| | | package com.mes.common.PlcTools; |
| | | |
| | | |
| | | import java.nio.ByteBuffer; |
| | | import java.nio.ByteOrder; |
| | | import java.nio.charset.StandardCharsets; |
| | | import java.sql.Time; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | |
| | |
| | | import com.github.xingshuangs.iot.protocol.s7.service.MultiAddressWrite; |
| | | import com.github.xingshuangs.iot.protocol.s7.service.S7PLC; |
| | | import com.google.common.primitives.Bytes; |
| | | import org.apache.ibatis.jdbc.Null; |
| | | |
| | | public class S7control { |
| | | |
| | | S7PLC s7PLC; // PLC通讯类实例 |
| | | |
| | | public S7control(EPlcType plcType, String ip, int port, int rack, int slot) { |
| | | private EPlcType plcType = EPlcType.S1500; // 西门子PLC类型 |
| | | private String ip = "192.168.10.1"; // plc ip地址 |
| | | private int port = 102; // plc 端口号 |
| | | |
| | | private static volatile S7control instance = null; |
| | | |
| | | private S7control() { |
| | | if (s7PLC == null) |
| | | s7PLC = new S7PLC(plcType, ip, port,0,0); |
| | | } |
| | | } |
| | | public S7control(EPlcType plcType,String ip,int port,int a,int b) { |
| | | if (s7PLC == null) |
| | | s7PLC = new S7PLC(plcType, ip, port,a,b); |
| | | } |
| | | |
| | | // 单例模式 获取类的唯一实例 |
| | | public static S7control getinstance() { |
| | | if (instance == null) { |
| | | synchronized (S7control.class) { |
| | | if (instance == null) |
| | | instance = new S7control(); |
| | | } |
| | | } |
| | | return instance; |
| | | } |
| | | |
| | | /** |
| | | * 关闭西门子s7通讯连接 |
| | | */ |
| | |
| | | public boolean CheckConnected() { |
| | | return s7PLC.checkConnected(); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 按指定的地址 写入一个word |
| | | * |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | private int getIndexFromAddress(String address) { |
| | |
| | | public List<Short> ReadWord(String address, int count) { |
| | | if (s7PLC == null) |
| | | return null; |
| | | |
| | | List<String> addresslist = GetAddressList(address, count, 16); |
| | | try { |
| | | return s7PLC.readInt16(addresslist); |
| | |
| | | return null; |
| | | } |
| | | } |
| | | |
| | | public byte[] Readbyte(String address, int count) { |
| | | byte[] byt=new byte[count]; |
| | | int wordcount=((count%2==0)?count/2:count+1); |
| | | List<Short> word=ReadWord(address,wordcount); |
| | | |
| | | return byt; |
| | | } |
| | | /** |
| | | * 按指定的地址 读取byte结果集 |
| | | * |
| | |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | public List<String> readStringsandword(List<String> addressList) { |
| | | if (s7PLC == null) { |
| | | return null; |
| | | } |
| | | List<String> result = new ArrayList<>(); |
| | | for (String address : addressList) { |
| | | try { |
| | | if (address.contains("-")) { |
| | | address = address.substring(0, address.indexOf("-")); |
| | | |
| | | byte[] bytes = s7PLC.readByte(address, 14); |
| | | if (bytes != null) { |
| | | String str = new String(bytes, StandardCharsets.UTF_8); |
| | | result.add(str); |
| | | } |
| | | |
| | | } else { |
| | | Short value = s7PLC.readInt16(address); |
| | | result.add(value.toString()); |
| | | |
| | | } |
| | | } catch (Exception e) { |
| | | System.out.println("读取 " + address + " 失败:" + e.getMessage()); |
| | | result.add(null); |
| | | } |
| | | } |
| | | |
| | | return result; |
| | | } |
| | | |
| | | |
| | | |
| | | //不连续地址写入Word |
| | | public void WriteWord(List<String> address, List<Short> datas) { |
| | | if (s7PLC == null) |
| | |
| | | glassidlist.add(Byte.valueOf(String.valueOf(iditem))); |
| | | } |
| | | byte[] bytes = Bytes.toArray(glassidlist); |
| | | WriteByte(addr, bytes); |
| | | S7control.getinstance().WriteByte(addr, bytes); |
| | | } |
| | | |
| | | //读取不连续word |
| | |
| | | } |
| | | return addresslist; |
| | | } |
| | | public void writeString(String addr,String data) { |
| | | s7PLC.writeString(addr,data); |
| | | } |
| | | |
| | | public String readStrings(String addr) { |
| | | return s7PLC.readString(addr); |
| | | } |
| | | } |
| | |
| | | public void run(ApplicationArguments args) throws Exception { |
| | | // TODO Auto-generated method stub |
| | | // |
| | | System.out.println("启动完成"); |
| | | System.out.println("启动完成Tempering"); |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.mes.controller; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.*; |
| | | import com.mes.common.Result; |
| | | import com.mes.entity.Tempering; |
| | | import com.mes.service.TemperingOverService; |
| | | import com.mes.service.TemperingService; |
| | | |
| | | |
| | | @RestController |
| | | @RequestMapping("/Tempering") |
| | | |
| | | // TidyUpGlassModule 钢化模块 |
| | | public class TemperingController { |
| | | |
| | | @Autowired |
| | | private TemperingService temperingService; |
| | | |
| | | @Autowired |
| | | private TemperingOverService temperingOverService; |
| | | |
| | | @GetMapping("/") // 查询钢化等片中的版图信息,状态为1的为已到,状态为0的为等待中 |
| | | @ResponseBody |
| | | public Result SelectTerritoryInfo(@RequestParam(name = "ProcessId", required = false) String ProcessId) { |
| | | List<Tempering> glass = temperingService.SelectWaitingGlass(); |
| | | System.out.println(glass); |
| | | return Result.seccess(glass); |
| | | } |
| | | |
| | | @GetMapping("/") // 查询进炉中的钢化等片中的版图信息,状态全为1的为已到。 |
| | | @ResponseBody |
| | | public Result CutTerritory(String ProcessId) { |
| | | List<Tempering> glass = temperingService.SelectIntoGlass(); |
| | | System.out.println(glass); |
| | | return Result.seccess(glass); |
| | | } |
| | | |
| | | @GetMapping("/") //钢化后显示出炉的版图信息 |
| | | @ResponseBody |
| | | public Result SelectCutTerritory(String ProcessId) { |
| | | List<Tempering> glass = temperingOverService.SelectOutGlass(); |
| | | System.out.println(glass); |
| | | return Result.seccess(glass); |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.mes.entity.device; |
| | | import cn.hutool.json.JSONArray; |
| | | import cn.hutool.json.JSONObject; |
| | | import java.io.BufferedReader; |
| | | import java.io.FileReader; |
| | | import java.io.IOException; |
| | | import java.util.ArrayList; |
| | | import java.util.Arrays; |
| | | import java.util.List; |
| | | |
| | | import com.mes.common.PlcTools.S7control; |
| | | |
| | | public class InitUtil { |
| | | //初始化word |
| | | public static PlcParameterObject initword(String jsonFilePath) { |
| | | try { |
| | | FileReader fileReader = new FileReader(jsonFilePath); |
| | | BufferedReader bufferedReader = new BufferedReader(fileReader); |
| | | |
| | | StringBuilder content = new StringBuilder(); |
| | | String line; |
| | | |
| | | while ((line = bufferedReader.readLine()) != null) { |
| | | content.append(line); |
| | | } |
| | | |
| | | bufferedReader.close(); |
| | | fileReader.close(); |
| | | |
| | | JSONObject jsonfileobj = new JSONObject(content.toString()); |
| | | JSONArray jsonArray = jsonfileobj.getJSONArray("parameteInfor"); |
| | | PlcParameterObject plcParameterObject = new PlcParameterObject(); |
| | | plcParameterObject.setPlcAddressBegin(jsonfileobj.getStr("plcAddressBegin"));//设置起始位地址 |
| | | plcParameterObject.setPlcAddressLength(Integer.valueOf(jsonfileobj.getStr("plcAddressLenght")));//设置地址长度 |
| | | |
| | | for (int i = 0; i < jsonArray.size(); i++) { |
| | | JSONObject parameterObj = jsonArray.getJSONObject(i); |
| | | PlcParameterInfo plcParameterInfo = new PlcParameterInfo(jsonfileobj.getStr("plcAddressBegin")); //参数实例 |
| | | String codeid = parameterObj.getStr("codeId"); |
| | | plcParameterInfo.setCodeId(codeid); |
| | | plcParameterInfo.setAddressIndex(Integer.valueOf(parameterObj.getStr("addressIndex"))); |
| | | //plcParameterInfo.setRatio(Integer.valueOf(parameterObj.getStr("ratio"))); |
| | | plcParameterInfo.setAddressLength(Integer.valueOf(parameterObj.getStr("addressLenght"))); |
| | | plcParameterInfo.setUnit(parameterObj.getStr("unit")); |
| | | plcParameterObject.addPlcParameter(plcParameterInfo); |
| | | } |
| | | // byte[] getplcvlues = {0x01, 0x02, 0x03, 0x04,0x01, 0x02, 0x03, 0x04,0x01, 0x02, 0x03, 0x04,0x01, 0x02,0x01, 0x02, 0x03, 0x04,0x01, 0x02, 0x03, 0x04,0x01, 0x02, 0x03, 0x04,0x01, 0x02,0x01, 0x02, 0x03, 0x04,0x01, 0x02, 0x03, 0x04,0x01, 0x02, 0x03, 0x04,0x01, 0x02}; |
| | | // byte[] getplcvlues = S7control.getinstance().ReadByte(plcParameterObject.getPlcAddressBegin(), plcParameterObject.getPlcAddressLength()); |
| | | // plcParameterObject.setPlcParameterList(getplcvlues); |
| | | |
| | | return plcParameterObject; |
| | | } catch (IOException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | //初始化bit |
| | | public static PlcBitObject initbit(String jsonFilePath) { |
| | | PlcBitObject plcBitObject = new PlcBitObject(); |
| | | |
| | | try { |
| | | FileReader fileReader = new FileReader(jsonFilePath); |
| | | BufferedReader bufferedReader = new BufferedReader(fileReader); |
| | | |
| | | StringBuilder content = new StringBuilder(); |
| | | String line; |
| | | |
| | | while ((line = bufferedReader.readLine()) != null) { |
| | | content.append(line); |
| | | } |
| | | |
| | | bufferedReader.close(); |
| | | fileReader.close(); |
| | | |
| | | JSONObject jsonfileobj = new JSONObject(content.toString()); |
| | | JSONArray jsonArray = jsonfileobj.getJSONArray("parameteInfor"); |
| | | plcBitObject.setPlcAddressBegin(jsonfileobj.getStr("plcAddressBegin"));//设置起始位地址 |
| | | plcBitObject.setPlcAddressLength(Integer.valueOf(jsonfileobj.getStr("plcAddressLenght")));//设置地址长度 |
| | | |
| | | for (int i = 0; i < jsonArray.size(); i++) { |
| | | JSONObject parameterObj = jsonArray.getJSONObject(i); |
| | | |
| | | PlcBitInfo plcBitInfo = new PlcBitInfo(jsonfileobj.getStr("plcAddressBegin")); //参数实例 |
| | | String codeid = parameterObj.getStr("codeId"); |
| | | plcBitInfo.setCodeId(codeid); |
| | | plcBitInfo.setAddressIndex(Integer.valueOf(parameterObj.getStr("addressIndex"))); |
| | | |
| | | plcBitObject.addPlcBit(plcBitInfo); |
| | | } |
| | | System.out.println(""); |
| | | } catch (IOException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | //Boolean[] values1 = { false, true, true, true, false, false, true, false, |
| | | // false, true ,true }; |
| | | // List<Boolean> getplcvlues = new ArrayList<>(Arrays.asList(values1)); |
| | | |
| | | // List<Boolean> getplcvlues = S7control.getinstance().ReadBits(plcBitObject.getPlcAddressBegin(), plcBitObject.getPlcAddressLength()); |
| | | // plcBitObject.setPlcBitList(getplcvlues); |
| | | return plcBitObject; |
| | | } |
| | | |
| | | // |
| | | public static void readAndUpdateBitValues(PlcBitObject plcBitObject) { |
| | | |
| | | // Boolean[] values1 = { false, true, true, true, false, false, true, false, |
| | | // false, true ,true }; |
| | | // List<Boolean> getplcvlues = new ArrayList<>(Arrays.asList(values1)); |
| | | List<Boolean> getplcvlues = S7control.getinstance().ReadBits(plcBitObject.getPlcAddressBegin(), plcBitObject.getPlcAddressLength()); |
| | | plcBitObject.setPlcBitList(getplcvlues); |
| | | } |
| | | |
| | | |
| | | public static void readAndUpdateWordValues(PlcParameterObject plcParameterObject) { |
| | | |
| | | // byte[] getplcvlues = {0x01, 0x02, 0x03, 0x04,0x01, 0x02, 0x03, 0x04,0x01, 0x02, 0x03, 0x04,0x01, 0x02,0x01, 0x02, 0x03, 0x04,0x01, 0x02, 0x03, 0x04,0x01, 0x02, 0x03, 0x04,0x01, 0x02,0x01, 0x02, 0x03, 0x04,0x01, 0x02, 0x03, 0x04,0x01, 0x02, 0x03, 0x04,0x01, 0x02}; |
| | | byte[] getplcvlues = S7control.getinstance().ReadByte(plcParameterObject.getPlcAddressBegin(), plcParameterObject.getPlcAddressLength()); |
| | | plcParameterObject.setPlcParameterList(getplcvlues); |
| | | } |
| | | |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.mes.entity.device; |
| | | |
| | | |
| | | import java.io.IOException; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import static com.mes.entity.device.InitUtil.readAndUpdateWordValues; |
| | | public class PLCAutoMes extends Thread { |
| | | |
| | | // // 用于存储应用程序的配置信息 |
| | | // private Configuration config; |
| | | private static InitUtil initUtil; |
| | | // public static PlcParameterObject PlcMesObject; |
| | | // public static PlcParameterObject PlcReadObject; |
| | | // public static PlcParameterObject PlcframeObject; |
| | | |
| | | // // 创建一个自定义的 S7 控制器消息处理器对象 |
| | | // MessageHandler customS7Control = new MessageHandler(); |
| | | |
| | | // 单例实例 |
| | | private static PLCAutoMes instance; |
| | | // private static String PlcMes = PLCAutoMes.class.getResource("/JsonFile/PlcMes.json").getPath(); |
| | | private static String PlcAlbania = PLCAutoMes.class.getResource("/JsonFile/PlcAlbania.json").getPath(); |
| | | // private static String PlcRead = PLCAutoMes.class.getResource("/JsonFile/PlcRead.json").getPath(); |
| | | // private static String Plcframe = PLCAutoMes.class.getResource("/JsonFile/Plcframe.json").getPath(); |
| | | // private static String PlcParameter = PLCAutomaticParameterSettingReview2.class.getResource("/JsonFile/PlcParameter.json").getPath(); |
| | | |
| | | // private static String PlcSign = PLCAutomaticParameterSettingReview2.class.getResource("/JsonFile/PlcSign.json").getPath(); |
| | | |
| | | // private static String PlcState = PLCAutomaticParameterSettingReview2.class.getResource("/JsonFile/PlcState.json").getPath(); |
| | | |
| | | // private static String PlcAlarm = PLCAutoMes.class.getResource("/JsonFile/PlcAlarm.json").getPath(); |
| | | // private static String PlcTest = PLCAutoMes.class.getResource("/JsonFile/PlcTest.json").getPath(); |
| | | |
| | | // 调用initword方法 |
| | | |
| | | // public static PlcParameterObject plcParameterObject = initUtil.initword(PlcParameter); |
| | | // public static PlcBitObject plcPlcTest = initUtil.initbit(PlcTest); |
| | | // public static PlcBitObject plcBitObject = initUtil.initbit(PlcSign); |
| | | // public static PlcParameterObject plcStateObject= initUtil.initword(PlcState); |
| | | // public static PlcBitObject plcPlcAlarm = initUtil.initbit(PlcAlarm); |
| | | public static PlcParameterObject PlcMesObject = InitUtil.initword(PlcAlbania); |
| | | // public static PlcParameterObject PlcReadObject = initUtil.initword(PlcRead); |
| | | // public static PlcParameterObject PlcframeObject = initUtil.initword(Plcframe); |
| | | |
| | | // 私有构造函数 |
| | | public PLCAutoMes() throws IOException { |
| | | //config = new Configuration("config.properties"); |
| | | initUtil = new InitUtil(); |
| | | } |
| | | |
| | | // 获取单例实例 |
| | | public static synchronized PLCAutoMes getInstance() throws IOException { |
| | | if (instance == null) { |
| | | instance = new PLCAutoMes(); |
| | | } |
| | | return instance; |
| | | } |
| | | |
| | | @Override |
| | | public void run() { |
| | | while (this != null) { |
| | | try { |
| | | Thread.sleep(100); |
| | | |
| | | } catch (InterruptedException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | |
| | | // System.out.println(jsonFilePath); |
| | | |
| | | //readAndUpdateWordValues(PlcReadObject); |
| | | readAndUpdateWordValues(PlcMesObject); |
| | | //readAndUpdateWordValues(PlcframeObject); |
| | | // readAndUpdateWordValues(PlcframeObject); |
| | | |
| | | // readAndUpdateWordValues(plcStateObject); |
| | | // int index = PlcMesObject.getPlcParameter("AddStart").getAddressIndex(); |
| | | // // System.out.println(index); |
| | | // PlcMesObject.getPlcParameter("AddStart").getAddress(index); |
| | | // // System.out.println(PlcMesObject.getPlcParameter("AddStart").getAddress(index)); |
| | | // List<String> addresses = new ArrayList<>(); |
| | | // addresses.add("FeedID"); |
| | | // addresses.add("AddStart"); |
| | | // // System.out.println(addresses); |
| | | // // System.out.println(PlcMesObject.getPlcParameterValues(addresses)); |
| | | // List<String> addresses2 = new ArrayList<>(); |
| | | // addresses2.add("FeedID"); |
| | | // addresses2.add("FeedCarStatus"); |
| | | |
| | | //System.out.println(PlcReadObject.getPlcParameterValues(addresses2)); |
| | | |
| | | } |
| | | } |
| | | } |
New file |
| | |
| | | package com.mes.entity.device; |
| | | |
| | | |
| | | |
| | | public class PlcBitInfo { |
| | | |
| | | public PlcBitInfo(String startAddress) { |
| | | this.startAddress = startAddress; |
| | | } |
| | | private String startAddress; |
| | | // 参数标识 |
| | | private String codeId; |
| | | |
| | | // 参数名称 |
| | | private String name; |
| | | |
| | | // 读取 参数值 |
| | | private Boolean value; |
| | | // 参数地址 |
| | | private int addressIndex; |
| | | |
| | | public String getCodeId() { |
| | | return this.codeId; |
| | | } |
| | | |
| | | public void setCodeId(String codeId) { |
| | | this.codeId = codeId; |
| | | } |
| | | |
| | | public String getName() { |
| | | return this.name; |
| | | } |
| | | |
| | | public void setName(String name) { |
| | | this.name = name; |
| | | } |
| | | |
| | | public Boolean getValue() { |
| | | return this.value; |
| | | } |
| | | |
| | | public void setValue(Boolean value) { |
| | | this.value = value; |
| | | } |
| | | |
| | | |
| | | public int getAddressIndex() { |
| | | return this.addressIndex; |
| | | } |
| | | /** |
| | | * 获取地址 |
| | | * |
| | | * @param index 索引地址 |
| | | */ |
| | | public String getAddress(int index) { |
| | | String[] stringdatas = this.startAddress.trim().split("\\."); |
| | | if (stringdatas.length < 2 ) |
| | | return null; |
| | | int dbwindex = 0; |
| | | int bitindex = 0; |
| | | if (stringdatas.length == 3) { |
| | | dbwindex = Integer.parseInt(stringdatas[1]); |
| | | bitindex = Integer.parseInt(stringdatas[2]); |
| | | } else |
| | | return null; |
| | | dbwindex+=index/8; |
| | | bitindex+=index%8; |
| | | return stringdatas[0]+"."+dbwindex+"."+bitindex; |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | public void setAddressIndex(int addressindex) { |
| | | this.addressIndex = addressindex; |
| | | } |
| | | } |
New file |
| | |
| | | package com.mes.entity.device; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.LinkedHashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | public class PlcBitObject { |
| | | |
| | | // 该模块数据类型,数据起始位置 |
| | | private String plcAddressBegin; |
| | | // 数据地址长度:第一参数到最后一个参数的长度 |
| | | private int plcAddressLength; |
| | | private ArrayList<PlcBitInfo> plcBitList; |
| | | |
| | | /** |
| | | * @return 数据区开始地址 |
| | | */ |
| | | public String getPlcAddressBegin() { |
| | | return plcAddressBegin; |
| | | } |
| | | |
| | | /** |
| | | * @param plcAddressBegin 设置数据区开始地址 |
| | | */ |
| | | public void setPlcAddressBegin(String plcAddressBegin) { |
| | | this.plcAddressBegin = plcAddressBegin; |
| | | } |
| | | |
| | | /** |
| | | * @return 数据区 读取所有数据所需的长度(以byte类型为基准) |
| | | */ |
| | | public int getPlcAddressLength() { |
| | | return plcAddressLength; |
| | | } |
| | | |
| | | /** |
| | | * @return 设置:数据区 读取所有数据所需的长度(以byte类型为基准) |
| | | */ |
| | | public void setPlcAddressLength(int plcAddressLength) { |
| | | this.plcAddressLength = plcAddressLength; |
| | | } |
| | | |
| | | /** |
| | | * @return 获取参数实例集合 |
| | | */ |
| | | public ArrayList<PlcBitInfo> getBitList() { |
| | | return plcBitList; |
| | | } |
| | | |
| | | /** |
| | | * 根据参数标识 获取某个参数实例 |
| | | * |
| | | * @param codeid 参数标识 |
| | | * @return 获取某个参数实例 |
| | | */ |
| | | public PlcBitInfo getPlcBit(String codeid) { |
| | | if (plcBitList != null) { |
| | | for (PlcBitInfo plcbitInfo : plcBitList) { |
| | | if (plcbitInfo.getCodeId().equals(codeid)) |
| | | return plcbitInfo; |
| | | } |
| | | return null; |
| | | } else |
| | | return null; |
| | | } |
| | | |
| | | /** |
| | | * 根据参数标识 获取某个参数实例 |
| | | * |
| | | * @param codeid 参数标识 |
| | | * @return 获取某个参数实例 |
| | | */ |
| | | public List<Boolean> getPlcBitValues(List<String> codeids) { |
| | | List<Boolean> arrayList = new ArrayList<>(); |
| | | if (plcBitList != null) { |
| | | Map<String, Boolean> resultMap = new LinkedHashMap<>(); // 使用 LinkedHashMap 保留插入顺序 |
| | | for (PlcBitInfo plcBitInfo : plcBitList) { |
| | | if (codeids.contains(plcBitInfo.getCodeId().toString())) { |
| | | resultMap.put(plcBitInfo.getCodeId().toString(), plcBitInfo.getValue()); |
| | | } |
| | | } |
| | | for (String codeId : codeids) { // 按照传入参数的顺序遍历 |
| | | Boolean value = resultMap.get(codeId); |
| | | if (value != null) { |
| | | arrayList.add(value); |
| | | } else { |
| | | arrayList.add(null); // 如果找不到对应的值,添加 null |
| | | } |
| | | } |
| | | } |
| | | return arrayList; |
| | | } |
| | | |
| | | |
| | | public List<String> getAddressListByCodeId(List<String> codeIdList) { |
| | | List<String> addressList = new ArrayList<>(); |
| | | for (String codeId : codeIdList) { |
| | | for (PlcBitInfo plcBitInfo : plcBitList) { |
| | | if (plcBitInfo.getCodeId().equals(codeId)) { |
| | | int index = plcBitInfo.getAddressIndex(); |
| | | String address = plcBitInfo.getAddress(index); |
| | | if (address != null) { |
| | | addressList.add(address); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | return addressList; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 添加参数实例 |
| | | * |
| | | * @param param 参数实例 |
| | | */ |
| | | public void addPlcBit(PlcBitInfo param) { |
| | | if (plcBitList != null) |
| | | plcBitList.add(param); |
| | | else { |
| | | plcBitList = new ArrayList<PlcBitInfo>(); |
| | | plcBitList.add(param); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 根据PLC返回的数据 给参数实例赋值 |
| | | * |
| | | * @param plcValueArray PLC读取回来的byte类型数据集合 |
| | | */ |
| | | public void setPlcBitList(List<Boolean> plcValueArray) { |
| | | if (plcBitList != null) { |
| | | for (PlcBitInfo plcbitInfo : plcBitList) { |
| | | plcbitInfo.setValue(plcValueArray.get(plcbitInfo.getAddressIndex())); |
| | | } |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.mes.entity.device; |
| | | public class PlcParameterInfo { |
| | | public PlcParameterInfo(String startAddress) { |
| | | this.startAddress = startAddress; |
| | | } |
| | | private String startAddress; |
| | | // 参数标识 |
| | | private String codeId; |
| | | |
| | | // 参数名称 |
| | | private String name; |
| | | |
| | | // 读取 参数值 |
| | | private String value; |
| | | |
| | | // // 写入 参数值 |
| | | // private String writeValue; |
| | | |
| | | // 参数单位 |
| | | private String unit; |
| | | |
| | | // 参数值转换系数 |
| | | private int ratio; |
| | | |
| | | // 参数地址 |
| | | private int addressIndex; |
| | | |
| | | // 参数地址位长度 |
| | | private int addressLength; |
| | | |
| | | public String getCodeId() { |
| | | return this.codeId; |
| | | } |
| | | |
| | | public void setCodeId(String codeId) { |
| | | this.codeId = codeId; |
| | | } |
| | | |
| | | public String getName() { |
| | | return this.name; |
| | | } |
| | | |
| | | public void setName(String name) { |
| | | this.name = name; |
| | | } |
| | | |
| | | public String getValue() { |
| | | return this.value; |
| | | } |
| | | |
| | | public void setValue(String value) { |
| | | this.value = value; |
| | | } |
| | | |
| | | // public String getWriteValue() { |
| | | // return this.writeValue; |
| | | // } |
| | | |
| | | // public void setWriteValue(String writeValue) { |
| | | // this.writeValue = writeValue; |
| | | // } |
| | | |
| | | public String getUnit() { |
| | | return this.unit; |
| | | } |
| | | |
| | | public void setUnit(String unit) { |
| | | this.unit = unit; |
| | | } |
| | | |
| | | public int getAddressIndex() { |
| | | return this.addressIndex; |
| | | } |
| | | |
| | | public void setAddressIndex(int addressindex) { |
| | | this.addressIndex = addressindex; |
| | | } |
| | | |
| | | public int getAddressLength() { |
| | | return this.addressLength; |
| | | } |
| | | |
| | | public void setAddressLength(int addresslength) { |
| | | this.addressLength = addresslength; |
| | | } |
| | | |
| | | public int getRatio() { |
| | | return this.ratio; |
| | | } |
| | | |
| | | public void setRatio(int ratio) { |
| | | this.ratio = ratio; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 获取地址 |
| | | * |
| | | * @param index 索引地址 |
| | | */ |
| | | public String getAddress(int index) { |
| | | String[] stringdatas = this.startAddress.trim().split("\\."); |
| | | int addressLength=this.addressLength; |
| | | if (addressLength < 2 ){ |
| | | return null; |
| | | } |
| | | |
| | | if (addressLength == 2 ) { |
| | | int wordindex = index; |
| | | |
| | | return stringdatas[0] + "." + wordindex; |
| | | } |
| | | if (addressLength == 14 ) { |
| | | int wordindex = index; |
| | | //int newIndex = wordindex + 13; |
| | | return stringdatas[0] + "." + wordindex ; |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | public int getPlcAddress() { |
| | | |
| | | return addressIndex; |
| | | } |
| | | public String getAddress() { |
| | | return getAddress(this.addressIndex); |
| | | } |
| | | } |
New file |
| | |
| | | package com.mes.entity.device; |
| | | |
| | | import java.lang.reflect.Array; |
| | | import java.nio.charset.StandardCharsets; |
| | | import java.util.ArrayList; |
| | | import java.util.LinkedHashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | public class PlcParameterObject { |
| | | |
| | | // 该模块数据类型,数据起始位置 |
| | | private String plcAddressBegin; |
| | | // 数据地址长度:第一参数到最后一个参数的长度 |
| | | private int plcAddressLength; |
| | | private ArrayList<PlcParameterInfo> plcParameterList; |
| | | |
| | | /** |
| | | * @return 数据区开始地址 |
| | | */ |
| | | public String getPlcAddressBegin() { |
| | | return plcAddressBegin; |
| | | } |
| | | |
| | | /** |
| | | * @param plcAddressBegin 设置数据区开始地址 |
| | | */ |
| | | public void setPlcAddressBegin(String plcAddressBegin) { |
| | | this.plcAddressBegin = plcAddressBegin; |
| | | } |
| | | |
| | | /** |
| | | * @return 数据区 读取所有数据所需的长度(以byte类型为基准) |
| | | */ |
| | | public int getPlcAddressLength() { |
| | | return plcAddressLength; |
| | | } |
| | | |
| | | /** |
| | | * @return 设置:数据区 读取所有数据所需的长度(以byte类型为基准) |
| | | */ |
| | | public void setPlcAddressLength(int plcAddressLength) { |
| | | this.plcAddressLength = plcAddressLength; |
| | | } |
| | | |
| | | /** |
| | | * @return 获取参数实例集合 |
| | | */ |
| | | public ArrayList<PlcParameterInfo> getPlcParameterList() { |
| | | return plcParameterList; |
| | | } |
| | | |
| | | /** |
| | | * 根据参数标识 获取某个参数实例 |
| | | * |
| | | * @param codeid 参数标识 |
| | | * @return 获取某个参数实例 |
| | | */ |
| | | public PlcParameterInfo getPlcParameter(String codeid) { |
| | | if (plcParameterList != null) { |
| | | for (PlcParameterInfo plcParameterInfo : plcParameterList) { |
| | | if (plcParameterInfo.getCodeId().equals(codeid)) |
| | | return plcParameterInfo; |
| | | } |
| | | return null; |
| | | } else |
| | | return null; |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * 根据参数标识 获取某个参数实例 |
| | | * |
| | | * @param codeids 参数标识 |
| | | * @return 获取某个参数实例 |
| | | */ |
| | | public List<String> getPlcParameterValues(List<String> codeids) { |
| | | List<String> arrayList = new ArrayList<>(); |
| | | if (plcParameterList != null) { |
| | | Map<String, PlcParameterInfo> resultMap = new LinkedHashMap<>(); // 使用 LinkedHashMap 保留插入顺序 |
| | | for (PlcParameterInfo plcParameterInfo : plcParameterList) { |
| | | if (codeids.contains(plcParameterInfo.getCodeId())) { |
| | | resultMap.put(plcParameterInfo.getCodeId(), plcParameterInfo); |
| | | } |
| | | } |
| | | for (String codeId : codeids) { // 按照传入参数的顺序遍历 |
| | | PlcParameterInfo plcParameterInfo = resultMap.get(codeId); |
| | | if (plcParameterInfo != null) { |
| | | arrayList.add(plcParameterInfo.getValue()); |
| | | } else { |
| | | arrayList.add(null); // 如果找不到对应的值,添加 null |
| | | } |
| | | } |
| | | } |
| | | return arrayList; |
| | | } |
| | | |
| | | |
| | | public List<String> getAddressListByCodeId(List<String> codeIdList) { |
| | | List<String> addressList = new ArrayList<>(); |
| | | for (String codeId : codeIdList) { |
| | | for (PlcParameterInfo plcParameterInfo : plcParameterList) { |
| | | if (plcParameterInfo.getCodeId().equals(codeId)) { |
| | | int index = plcParameterInfo.getAddressIndex(); |
| | | String address = plcParameterInfo.getAddress(index); |
| | | if (address != null) { |
| | | addressList.add(address); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | return addressList; |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | /** |
| | | * 添加参数实例 |
| | | * |
| | | * @param param 参数实例 |
| | | */ |
| | | public void addPlcParameter(PlcParameterInfo param) { |
| | | if (plcParameterList != null) |
| | | plcParameterList.add(param); |
| | | else { |
| | | plcParameterList = new ArrayList<PlcParameterInfo>(); |
| | | plcParameterList.add(param); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 根据PLC返回的数据 给参数实例赋值 |
| | | * |
| | | * @param plcValueArray PLC读取回来的byte类型数据集合 |
| | | */ |
| | | public void setPlcParameterList(byte[] plcValueArray) { |
| | | if (plcParameterList != null) { |
| | | |
| | | for (PlcParameterInfo plcParameterInfo : plcParameterList) { |
| | | |
| | | byte[] valueList = new byte[plcParameterInfo.getAddressLength()]; |
| | | |
| | | // System.out.println(plcParameterInfo.getAddressLength()); |
| | | |
| | | for (int i = 0; i < plcParameterInfo.getAddressLength(); i++) { |
| | | Array.setByte(valueList, i, plcValueArray[plcParameterInfo.getAddressIndex() + i]); |
| | | |
| | | } |
| | | if (plcParameterInfo.getAddressLength()==2) { |
| | | plcParameterInfo.setValue(String.valueOf(byte2short(valueList))); |
| | | } |
| | | else if (plcParameterInfo.getAddressLength()==14) { |
| | | plcParameterInfo.setValue((byteToHexString(valueList))); |
| | | } |
| | | |
| | | else |
| | | { |
| | | String valuestr = new String(valueList); |
| | | plcParameterInfo.setValue(valuestr); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | /** |
| | | * short类型转byte[] |
| | | * |
| | | * @param s short类型值 |
| | | */ |
| | | public static byte[] short2byte(short s){ |
| | | byte[] b = new byte[2]; |
| | | for(int i = 0; i < 2; i++){ |
| | | int offset = 16 - (i+1)*8; //因为byte占4个字节,所以要计算偏移量 |
| | | b[i] = (byte)((s >> offset)&0xff); //把16位分为2个8位进行分别存储 |
| | | } |
| | | return b; |
| | | } |
| | | /** |
| | | * byte[]类型转short |
| | | * |
| | | * @param b byte[]类型值 |
| | | */ |
| | | public static short byte2short(byte[] b){ |
| | | short l = 0; |
| | | for (int i = 0; i < 2; i++) { |
| | | l<<=8; //<<=和我们的 +=是一样的,意思就是 l = l << 8 |
| | | l |= (b[i] & 0xff); //和上面也是一样的 l = l | (b[i]&0xff) |
| | | } |
| | | return l; |
| | | } |
| | | |
| | | public static String byteToHexString(byte[] bytes) { |
| | | |
| | | String str = new String(bytes, StandardCharsets.UTF_8); |
| | | return str; |
| | | } |
| | | |
| | | |
| | | } |
| | |
| | | import com.mes.entity.GlassInfo; |
| | | import com.mes.entity.Tempering; |
| | | |
| | | import java.util.List; |
| | | |
| | | import org.apache.ibatis.annotations.*; |
| | | |
| | | @Mapper |
| | |
| | | |
| | | //查询该玻璃的尺寸和坐标 |
| | | @Select("select *from glass_info where id=#{glassid};") |
| | | GlassInfo SelectOutGlass(String glassid); |
| | | |
| | | @Select("select *from glass_info where id=#{glassid};") |
| | | GlassInfo SelectGlass(String glassid); |
| | | //是否可以发送进炉信号 |
| | | @Select("select count(*) from glass_info where id=#{glassid};") |
| | | int SelectTempering(String glassid); |
| | | //查询等待中的钢化版图玻璃信息 |
| | | @Select("select*from tempering_glass_info a left join (select flowcard_id,count(state)state from tempering_glass_info GROUP BY flowcard_id,state)b on a.flowcard_id=b.flowcard_id where b.state=2") |
| | | List<Tempering> SelectWaitingGlass(); |
| | | //查询进炉中的钢化版图玻璃信息 |
| | | @Select("select*from tempering_glass_info a left join (select flowcard_id,min(state)state1 from tempering_glass_info GROUP BY flowcard_id having state1=1)b on a.flowcard_id=b.flowcard_id where b.state1=1") |
| | | List<Tempering> SelectInGlass(); |
| | | //查询钢化后的钢化版图信息 |
| | | @Select("select*from tempering_glass_info a left join (select flowcard_id,min(state)state1 from tempering_glass_info GROUP BY flowcard_id having state1=2)b on a.flowcard_id=b.flowcard_id where b.state1=2") |
| | | List <Tempering> SelectOutGlass(); |
| | | |
| | | |
| | | |
| | | } |
| | |
| | | package com.mes.service; |
| | | |
| | | import com.baomidou.dynamic.datasource.annotation.DS; |
| | | import com.mes.entity.GlassInfo; |
| | | import com.mes.entity.userInfo.SysError; |
| | | import com.mes.common.PlcTools.S7control; |
| | | import com.mes.entity.Tempering; |
| | | import com.mes.entity.device.PLCAutoMes; |
| | | import com.mes.entity.device.PlcParameterObject; |
| | | import com.mes.mapper.TemperingMapper; |
| | | import com.mes.mapper.userInfo.SysErrorMapper; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import java.util.List; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | @Service |
| | | @DS("glass_info") |
| | | public class TemperingOverService { |
| | | private final TemperingMapper temperingMapper; |
| | | |
| | | private final TemperingMapper temperingMapper; |
| | | //PlcParameterObject plcmes=PLCAutoMes.PlcMesObject; |
| | | public TemperingOverService(TemperingMapper temperingMapper) { |
| | | this.temperingMapper = temperingMapper; |
| | | } |
| | | //接收出炉信号和炉号 |
| | | public GlassInfo SelectOutGlass (String glassid) { |
| | | GlassInfo GlassInfo = temperingMapper.SelectOutGlass(glassid); |
| | | return GlassInfo; |
| | | public String SelectOutSignal () { |
| | | |
| | | S7control.getinstance().WriteWord("出炉信号", (short)1); |
| | | return "GlassInfo"; |
| | | } |
| | | //发送确认收到 |
| | | //发送确认收到信号 |
| | | public void OverSignal () { |
| | | S7control.getinstance().WriteWord("确认字", (short)1); |
| | | } |
| | | //显示钢化出炉后的版图信息 |
| | | public List <Tempering> SelectOutGlass () { |
| | | return temperingMapper.SelectOutGlass(); |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | } |
| | |
| | | package com.mes.service; |
| | | |
| | | import com.baomidou.dynamic.datasource.annotation.DS; |
| | | import com.mes.common.PlcTools.S7control; |
| | | import com.mes.entity.GlassInfo; |
| | | import com.mes.entity.userInfo.SysError; |
| | | import com.mes.entity.Tempering; |
| | | import com.mes.mapper.TemperingMapper; |
| | | import com.mes.mapper.userInfo.SysErrorMapper; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import java.util.List; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | @Service |
| | |
| | | } |
| | | //接收id返回坐标和数据 |
| | | public GlassInfo SelectOutGlass (String glassid) { |
| | | GlassInfo GlassInfo = temperingMapper.SelectOutGlass(glassid); |
| | | GlassInfo GlassInfo = temperingMapper.SelectGlass(glassid); |
| | | return GlassInfo; |
| | | } |
| | | //发送坐标信息 |
| | |
| | | else { |
| | | return 0; |
| | | } |
| | | |
| | | } |
| | | //发送进炉信号 |
| | | public void SendIntoGlass (short start) { |
| | | s7control.WriteWord("DB100.10", start); |
| | | } |
| | | //接受完成字回复确认字 |
| | | |
| | | public void SendIntoGlass () { |
| | | s7control.WriteWord("DB100.10", (short)1); |
| | | } |
| | | //显示等待中的版图 |
| | | public List <Tempering> SelectWaitingGlass () { |
| | | List<Tempering> WaitingGlass = temperingMapper.SelectWaitingGlass(); |
| | | return WaitingGlass; |
| | | } |
| | | //显示正在进炉的版图 |
| | | public List<Tempering> SelectIntoGlass () { |
| | | List<Tempering> IntoGlass = temperingMapper.SelectInGlass(); |
| | | return IntoGlass; |
| | | } |
| | | } |
| | |
| | | "devDependencies": { |
| | | "@types/sortablejs": "^1.15.7", |
| | | "@vitejs/plugin-vue": "^4.3.4", |
| | | "http-proxy-middleware": "^3.0.0", |
| | | "vite": "^4.4.9" |
| | | } |
| | | }, |
| | |
| | | "resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.2.tgz", |
| | | "integrity": "sha512-VeiPZ9MMwXjO32/Xu7+OwflfmeoRwkE/qzndw42gGtgJwZopBnzy2gD//NN1+go1mADzkDcqf/KnFRSjTJ8xJA==" |
| | | }, |
| | | "node_modules/@types/http-proxy": { |
| | | "version": "1.17.14", |
| | | "resolved": "https://registry.npmmirror.com/@types/http-proxy/-/http-proxy-1.17.14.tgz", |
| | | "integrity": "sha512-SSrD0c1OQzlFX7pGu1eXxSEjemej64aaNPRhhVYUGqXh0BtldAAx37MG8btcumvpgKyZp1F5Gn3JkktdxiFv6w==", |
| | | "dev": true, |
| | | "dependencies": { |
| | | "@types/node": "*" |
| | | } |
| | | }, |
| | | "node_modules/@types/lodash": { |
| | | "version": "4.14.199", |
| | | "resolved": "https://registry.npmjs.org/@types/lodash/-/lodash-4.14.199.tgz", |
| | |
| | | "integrity": "sha512-ZTcmhiI3NNU7dEvWLZJkzG6ao49zOIjEgIE0RgV7wbPxU0f2xT3VSAHw2gmst8swH6V0YkLRGp4qPlX/6I90MQ==", |
| | | "dependencies": { |
| | | "@types/lodash": "*" |
| | | } |
| | | }, |
| | | "node_modules/@types/node": { |
| | | "version": "20.12.5", |
| | | "resolved": "https://registry.npmmirror.com/@types/node/-/node-20.12.5.tgz", |
| | | "integrity": "sha512-BD+BjQ9LS/D8ST9p5uqBxghlN+S42iuNxjsUGjeZobe/ciXzk2qb1B6IXc6AnRLS+yFJRpN2IPEHMzwspfDJNw==", |
| | | "dev": true, |
| | | "dependencies": { |
| | | "undici-types": "~5.26.4" |
| | | } |
| | | }, |
| | | "node_modules/@types/sortablejs": { |
| | |
| | | "resolved": "https://registry.npmjs.org/dayjs/-/dayjs-1.11.10.tgz", |
| | | "integrity": "sha512-vjAczensTgRcqDERK0SR2XMwsF/tSvnvlv6VcF2GIhg6Sx4yOIt/irsr1RDJsKiIyBzJDpCoXiWWq28MqH2cnQ==" |
| | | }, |
| | | "node_modules/debug": { |
| | | "version": "4.3.4", |
| | | "resolved": "https://registry.npmmirror.com/debug/-/debug-4.3.4.tgz", |
| | | "integrity": "sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==", |
| | | "dev": true, |
| | | "dependencies": { |
| | | "ms": "2.1.2" |
| | | }, |
| | | "engines": { |
| | | "node": ">=6.0" |
| | | }, |
| | | "peerDependenciesMeta": { |
| | | "supports-color": { |
| | | "optional": true |
| | | } |
| | | } |
| | | }, |
| | | "node_modules/delayed-stream": { |
| | | "version": "1.0.0", |
| | | "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", |
| | |
| | | "resolved": "https://registry.npmjs.org/estree-walker/-/estree-walker-2.0.2.tgz", |
| | | "integrity": "sha512-Rfkk/Mp/DL7JVje3u18FxFujQlTNR2q6QfMSMB7AvCBx91NGj/ba3kCfza0f6dVDbw7YlRf/nDrn7pQrCCyQ/w==" |
| | | }, |
| | | "node_modules/eventemitter3": { |
| | | "version": "4.0.7", |
| | | "resolved": "https://registry.npmmirror.com/eventemitter3/-/eventemitter3-4.0.7.tgz", |
| | | "integrity": "sha512-8guHBZCwKnFhYdHr2ysuRWErTwhoN2X8XELRlrRwpmfeY2jjuUN4taQMsULKUVo1K4DvZl+0pgfyoysHxvmvEw==", |
| | | "dev": true |
| | | }, |
| | | "node_modules/fill-range": { |
| | | "version": "7.0.1", |
| | | "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz", |
| | |
| | | "node": ">= 6" |
| | | } |
| | | }, |
| | | "node_modules/http-proxy": { |
| | | "version": "1.18.1", |
| | | "resolved": "https://registry.npmmirror.com/http-proxy/-/http-proxy-1.18.1.tgz", |
| | | "integrity": "sha512-7mz/721AbnJwIVbnaSv1Cz3Am0ZLT/UBwkC92VlxhXv/k/BBQfM2fXElQNC27BVGr0uwUpplYPQM9LnaBMR5NQ==", |
| | | "dev": true, |
| | | "dependencies": { |
| | | "eventemitter3": "^4.0.0", |
| | | "follow-redirects": "^1.0.0", |
| | | "requires-port": "^1.0.0" |
| | | }, |
| | | "engines": { |
| | | "node": ">=8.0.0" |
| | | } |
| | | }, |
| | | "node_modules/http-proxy-middleware": { |
| | | "version": "3.0.0", |
| | | "resolved": "https://registry.npmmirror.com/http-proxy-middleware/-/http-proxy-middleware-3.0.0.tgz", |
| | | "integrity": "sha512-36AV1fIaI2cWRzHo+rbcxhe3M3jUDCNzc4D5zRl57sEWRAxdXYtw7FSQKYY6PDKssiAKjLYypbssHk+xs/kMXw==", |
| | | "dev": true, |
| | | "dependencies": { |
| | | "@types/http-proxy": "^1.17.10", |
| | | "debug": "^4.3.4", |
| | | "http-proxy": "^1.18.1", |
| | | "is-glob": "^4.0.1", |
| | | "is-plain-obj": "^3.0.0", |
| | | "micromatch": "^4.0.5" |
| | | }, |
| | | "engines": { |
| | | "node": "^14.15.0 || ^16.10.0 || >=18.0.0" |
| | | } |
| | | }, |
| | | "node_modules/is-binary-path": { |
| | | "version": "2.1.0", |
| | | "resolved": "https://registry.npmjs.org/is-binary-path/-/is-binary-path-2.1.0.tgz", |
| | |
| | | "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==", |
| | | "engines": { |
| | | "node": ">=0.12.0" |
| | | } |
| | | }, |
| | | "node_modules/is-plain-obj": { |
| | | "version": "3.0.0", |
| | | "resolved": "https://registry.npmmirror.com/is-plain-obj/-/is-plain-obj-3.0.0.tgz", |
| | | "integrity": "sha512-gwsOE28k+23GP1B6vFl1oVh/WOzmawBrKwo5Ev6wMKzPkaXaCDIQKzLnvsA42DRlbVTWorkgTKIviAKCWkfUwA==", |
| | | "dev": true, |
| | | "engines": { |
| | | "node": ">=10" |
| | | } |
| | | }, |
| | | "node_modules/local-pkg": { |
| | |
| | | "resolved": "https://registry.npmjs.org/memoize-one/-/memoize-one-6.0.0.tgz", |
| | | "integrity": "sha512-rkpe71W0N0c0Xz6QD0eJETuWAJGnJ9afsl1srmwPrI+yBCkge5EycXXbYRyvL29zZVUWQCY7InPRCv3GDXuZNw==" |
| | | }, |
| | | "node_modules/micromatch": { |
| | | "version": "4.0.5", |
| | | "resolved": "https://registry.npmmirror.com/micromatch/-/micromatch-4.0.5.tgz", |
| | | "integrity": "sha512-DMy+ERcEW2q8Z2Po+WNXuw3c5YaUSFjAO5GsJqfEl7UjvtIuFKO6ZrKvcItdy98dwFI2N1tg3zNIdKaQT+aNdA==", |
| | | "dev": true, |
| | | "dependencies": { |
| | | "braces": "^3.0.2", |
| | | "picomatch": "^2.3.1" |
| | | }, |
| | | "engines": { |
| | | "node": ">=8.6" |
| | | } |
| | | }, |
| | | "node_modules/mime-db": { |
| | | "version": "1.52.0", |
| | | "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz", |
| | |
| | | "engines": { |
| | | "node": "*" |
| | | } |
| | | }, |
| | | "node_modules/ms": { |
| | | "version": "2.1.2", |
| | | "resolved": "https://registry.npmmirror.com/ms/-/ms-2.1.2.tgz", |
| | | "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", |
| | | "dev": true |
| | | }, |
| | | "node_modules/nanoid": { |
| | | "version": "3.3.6", |
| | |
| | | "node": ">=8.10.0" |
| | | } |
| | | }, |
| | | "node_modules/requires-port": { |
| | | "version": "1.0.0", |
| | | "resolved": "https://registry.npmmirror.com/requires-port/-/requires-port-1.0.0.tgz", |
| | | "integrity": "sha512-KigOCHcocU3XODJxsu8i/j8T9tzT4adHiecwORRQ0ZZFcp7ahwXuRU1m+yuO90C5ZUyGeGfocHDI14M3L3yDAQ==", |
| | | "dev": true |
| | | }, |
| | | "node_modules/rollup": { |
| | | "version": "3.29.4", |
| | | "resolved": "https://registry.npmjs.org/rollup/-/rollup-3.29.4.tgz", |
| | |
| | | "engines": { |
| | | "node": ">=8.0" |
| | | } |
| | | }, |
| | | "node_modules/undici-types": { |
| | | "version": "5.26.5", |
| | | "resolved": "https://registry.npmmirror.com/undici-types/-/undici-types-5.26.5.tgz", |
| | | "integrity": "sha512-JlCMO+ehdEIKqlFxk6IfVoAUVmgz7cU7zD/h9XZ0qzeosSHmUJVOzSQvvYSYWXkFXC+IfLKSIffhv0sVZup6pA==", |
| | | "dev": true |
| | | }, |
| | | "node_modules/unplugin": { |
| | | "version": "1.5.0", |
| | |
| | | "resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.2.tgz", |
| | | "integrity": "sha512-VeiPZ9MMwXjO32/Xu7+OwflfmeoRwkE/qzndw42gGtgJwZopBnzy2gD//NN1+go1mADzkDcqf/KnFRSjTJ8xJA==" |
| | | }, |
| | | "@types/http-proxy": { |
| | | "version": "1.17.14", |
| | | "resolved": "https://registry.npmmirror.com/@types/http-proxy/-/http-proxy-1.17.14.tgz", |
| | | "integrity": "sha512-SSrD0c1OQzlFX7pGu1eXxSEjemej64aaNPRhhVYUGqXh0BtldAAx37MG8btcumvpgKyZp1F5Gn3JkktdxiFv6w==", |
| | | "dev": true, |
| | | "requires": { |
| | | "@types/node": "*" |
| | | } |
| | | }, |
| | | "@types/lodash": { |
| | | "version": "4.14.199", |
| | | "resolved": "https://registry.npmjs.org/@types/lodash/-/lodash-4.14.199.tgz", |
| | |
| | | "integrity": "sha512-ZTcmhiI3NNU7dEvWLZJkzG6ao49zOIjEgIE0RgV7wbPxU0f2xT3VSAHw2gmst8swH6V0YkLRGp4qPlX/6I90MQ==", |
| | | "requires": { |
| | | "@types/lodash": "*" |
| | | } |
| | | }, |
| | | "@types/node": { |
| | | "version": "20.12.5", |
| | | "resolved": "https://registry.npmmirror.com/@types/node/-/node-20.12.5.tgz", |
| | | "integrity": "sha512-BD+BjQ9LS/D8ST9p5uqBxghlN+S42iuNxjsUGjeZobe/ciXzk2qb1B6IXc6AnRLS+yFJRpN2IPEHMzwspfDJNw==", |
| | | "dev": true, |
| | | "requires": { |
| | | "undici-types": "~5.26.4" |
| | | } |
| | | }, |
| | | "@types/sortablejs": { |
| | |
| | | "resolved": "https://registry.npmjs.org/dayjs/-/dayjs-1.11.10.tgz", |
| | | "integrity": "sha512-vjAczensTgRcqDERK0SR2XMwsF/tSvnvlv6VcF2GIhg6Sx4yOIt/irsr1RDJsKiIyBzJDpCoXiWWq28MqH2cnQ==" |
| | | }, |
| | | "debug": { |
| | | "version": "4.3.4", |
| | | "resolved": "https://registry.npmmirror.com/debug/-/debug-4.3.4.tgz", |
| | | "integrity": "sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==", |
| | | "dev": true, |
| | | "requires": { |
| | | "ms": "2.1.2" |
| | | } |
| | | }, |
| | | "delayed-stream": { |
| | | "version": "1.0.0", |
| | | "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", |
| | |
| | | "resolved": "https://registry.npmjs.org/estree-walker/-/estree-walker-2.0.2.tgz", |
| | | "integrity": "sha512-Rfkk/Mp/DL7JVje3u18FxFujQlTNR2q6QfMSMB7AvCBx91NGj/ba3kCfza0f6dVDbw7YlRf/nDrn7pQrCCyQ/w==" |
| | | }, |
| | | "eventemitter3": { |
| | | "version": "4.0.7", |
| | | "resolved": "https://registry.npmmirror.com/eventemitter3/-/eventemitter3-4.0.7.tgz", |
| | | "integrity": "sha512-8guHBZCwKnFhYdHr2ysuRWErTwhoN2X8XELRlrRwpmfeY2jjuUN4taQMsULKUVo1K4DvZl+0pgfyoysHxvmvEw==", |
| | | "dev": true |
| | | }, |
| | | "fill-range": { |
| | | "version": "7.0.1", |
| | | "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz", |
| | |
| | | "is-glob": "^4.0.1" |
| | | } |
| | | }, |
| | | "http-proxy": { |
| | | "version": "1.18.1", |
| | | "resolved": "https://registry.npmmirror.com/http-proxy/-/http-proxy-1.18.1.tgz", |
| | | "integrity": "sha512-7mz/721AbnJwIVbnaSv1Cz3Am0ZLT/UBwkC92VlxhXv/k/BBQfM2fXElQNC27BVGr0uwUpplYPQM9LnaBMR5NQ==", |
| | | "dev": true, |
| | | "requires": { |
| | | "eventemitter3": "^4.0.0", |
| | | "follow-redirects": "^1.0.0", |
| | | "requires-port": "^1.0.0" |
| | | } |
| | | }, |
| | | "http-proxy-middleware": { |
| | | "version": "3.0.0", |
| | | "resolved": "https://registry.npmmirror.com/http-proxy-middleware/-/http-proxy-middleware-3.0.0.tgz", |
| | | "integrity": "sha512-36AV1fIaI2cWRzHo+rbcxhe3M3jUDCNzc4D5zRl57sEWRAxdXYtw7FSQKYY6PDKssiAKjLYypbssHk+xs/kMXw==", |
| | | "dev": true, |
| | | "requires": { |
| | | "@types/http-proxy": "^1.17.10", |
| | | "debug": "^4.3.4", |
| | | "http-proxy": "^1.18.1", |
| | | "is-glob": "^4.0.1", |
| | | "is-plain-obj": "^3.0.0", |
| | | "micromatch": "^4.0.5" |
| | | } |
| | | }, |
| | | "is-binary-path": { |
| | | "version": "2.1.0", |
| | | "resolved": "https://registry.npmjs.org/is-binary-path/-/is-binary-path-2.1.0.tgz", |
| | |
| | | "version": "7.0.0", |
| | | "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz", |
| | | "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==" |
| | | }, |
| | | "is-plain-obj": { |
| | | "version": "3.0.0", |
| | | "resolved": "https://registry.npmmirror.com/is-plain-obj/-/is-plain-obj-3.0.0.tgz", |
| | | "integrity": "sha512-gwsOE28k+23GP1B6vFl1oVh/WOzmawBrKwo5Ev6wMKzPkaXaCDIQKzLnvsA42DRlbVTWorkgTKIviAKCWkfUwA==", |
| | | "dev": true |
| | | }, |
| | | "local-pkg": { |
| | | "version": "0.4.3", |
| | |
| | | "resolved": "https://registry.npmjs.org/memoize-one/-/memoize-one-6.0.0.tgz", |
| | | "integrity": "sha512-rkpe71W0N0c0Xz6QD0eJETuWAJGnJ9afsl1srmwPrI+yBCkge5EycXXbYRyvL29zZVUWQCY7InPRCv3GDXuZNw==" |
| | | }, |
| | | "micromatch": { |
| | | "version": "4.0.5", |
| | | "resolved": "https://registry.npmmirror.com/micromatch/-/micromatch-4.0.5.tgz", |
| | | "integrity": "sha512-DMy+ERcEW2q8Z2Po+WNXuw3c5YaUSFjAO5GsJqfEl7UjvtIuFKO6ZrKvcItdy98dwFI2N1tg3zNIdKaQT+aNdA==", |
| | | "dev": true, |
| | | "requires": { |
| | | "braces": "^3.0.2", |
| | | "picomatch": "^2.3.1" |
| | | } |
| | | }, |
| | | "mime-db": { |
| | | "version": "1.52.0", |
| | | "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz", |
| | |
| | | "version": "2.30.1", |
| | | "resolved": "https://registry.npmjs.org/moment/-/moment-2.30.1.tgz", |
| | | "integrity": "sha512-uEmtNhbDOrWPFS+hdjFCBfy9f2YoyzRpwcl+DqpC6taX21FzsTLQVbMV/W7PzNSX6x/bhC1zA3c2UQ5NzH6how==" |
| | | }, |
| | | "ms": { |
| | | "version": "2.1.2", |
| | | "resolved": "https://registry.npmmirror.com/ms/-/ms-2.1.2.tgz", |
| | | "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", |
| | | "dev": true |
| | | }, |
| | | "nanoid": { |
| | | "version": "3.3.6", |
| | |
| | | "picomatch": "^2.2.1" |
| | | } |
| | | }, |
| | | "requires-port": { |
| | | "version": "1.0.0", |
| | | "resolved": "https://registry.npmmirror.com/requires-port/-/requires-port-1.0.0.tgz", |
| | | "integrity": "sha512-KigOCHcocU3XODJxsu8i/j8T9tzT4adHiecwORRQ0ZZFcp7ahwXuRU1m+yuO90C5ZUyGeGfocHDI14M3L3yDAQ==", |
| | | "dev": true |
| | | }, |
| | | "rollup": { |
| | | "version": "3.29.4", |
| | | "resolved": "https://registry.npmjs.org/rollup/-/rollup-3.29.4.tgz", |
| | |
| | | "is-number": "^7.0.0" |
| | | } |
| | | }, |
| | | "undici-types": { |
| | | "version": "5.26.5", |
| | | "resolved": "https://registry.npmmirror.com/undici-types/-/undici-types-5.26.5.tgz", |
| | | "integrity": "sha512-JlCMO+ehdEIKqlFxk6IfVoAUVmgz7cU7zD/h9XZ0qzeosSHmUJVOzSQvvYSYWXkFXC+IfLKSIffhv0sVZup6pA==", |
| | | "dev": true |
| | | }, |
| | | "unplugin": { |
| | | "version": "1.5.0", |
| | | "resolved": "https://registry.npmjs.org/unplugin/-/unplugin-1.5.0.tgz", |
| | |
| | | "devDependencies": { |
| | | "@types/sortablejs": "^1.15.7", |
| | | "@vitejs/plugin-vue": "^4.3.4", |
| | | "http-proxy-middleware": "^3.0.0", |
| | | "vite": "^4.4.9" |
| | | } |
| | | } |
| | |
| | | const router = useRouter() |
| | | const userStore = useUserInfoStore() |
| | | const user = userStore.user.userName |
| | | store.createWebSocket(); |
| | | // store.createWebSocket(); |
| | | function quit(){ |
| | | userStore.$patch({ |
| | | user:null |
| | |
| | | import {defineStore} from 'pinia' |
| | | import {ref} from "vue"; |
| | | import {createWebSocket, global_callback1} from "@/utils/webSocket"; |
| | | // import {createWebSocket, global_callback1} from "@/utils/webSocket"; |
| | | |
| | | export default defineStore("userInfo",{ |
| | | state: () =>{ |
| | |
| | | } |
| | | }, |
| | | actions:{ |
| | | createWebSocket(){ |
| | | createWebSocket(global_callback1) |
| | | } |
| | | // createWebSocket(){ |
| | | // createWebSocket(global_callback1) |
| | | // } |
| | | |
| | | }, |
| | | persist: true//数据持久化,防止刷新数据消失 |
| | |
| | | <script setup> |
| | | import { useRouter, useRoute } from 'vue-router' |
| | | |
| | | import { sendSock, createWebSocket, closeSock } from "@/utils/webSocket" |
| | | |
| | | // function global_callback(msg) { |
| | | // console.log("websocket的回调函数收到服务器信息:" + JSON.stringify(msg)); |
| | | // // console.log("收到服务器信息:" + msg); |
| | |
| | | import { Lock,Avatar } from '@element-plus/icons-vue' |
| | | import request from '@/utils/request' |
| | | import userInfo from '@/stores/userInfo' |
| | | import { sendSock, createWebSocket, closeSock,global_callback1 } from "@/utils/webSocket" |
| | | |
| | | |
| | | const store=userInfo() |
| | | let ruleFormRef = ref<FormInstance>() |
| | |
| | | <script setup> |
| | | import {Search} from "@element-plus/icons-vue"; |
| | | import {reactive} from "vue"; |
| | | import {reactive, onMounted} from "vue"; |
| | | import {useRouter} from "vue-router" |
| | | const router = useRouter() |
| | | |
| | | const dialogFormVisiblea = ref(false) |
| | | import { ref } from 'vue' |
| | | import { ElMessage, ElMessageBox } from 'element-plus' |
| | | import Landingindication from "./Landingindication.vue"; |
| | | // import Landingindicationtwo from "./Landingindicationtwo.vue"; |
| | | import Landingindicationtwo from "./Landingindicationtwo.vue"; |
| | | import unloadrequest from "@/utils/unloadrequest"; |
| | | const dialogFormVisiblea = ref(false) |
| | | |
| | | const tableData = [ |
| | | { |
| | | id: '1', |
| | | long: '1005', |
| | | wide: '183.6', |
| | | thick: '1991', |
| | | state: '未启用', |
| | | }, |
| | | { |
| | | id: '2', |
| | | long: '105', |
| | | wide: '183', |
| | | thick: '191', |
| | | state: '未启用' |
| | | }, |
| | | { |
| | | id: '2', |
| | | long: '105', |
| | | wide: '183', |
| | | thick: '191', |
| | | state: '未启用' |
| | | }, |
| | | ] |
| | | |
| | | |
| | | const dialogFormVisiblea2 = ref(false) |
| | | |
| | | |
| | | const tableData = reactive([]); |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | // 数据 |
| | | const loading = ref(false); |
| | | |
| | | |
| | | // 弹框显示控制 |
| | | |
| | | const dialogFormVisible = ref(false); |
| | | |
| | | // 表单数据 |
| | | const workstationId = ref(''); |
| | | const flowCardId = ref(''); |
| | | const flowCardOptions = ref([]); |
| | | |
| | | |
| | | // 方法 |
| | | const handleSelectionChange = () => { |
| | | // 处理表格行选择事件 |
| | | }; |
| | | |
| | | const handleBindRack = (row) => { |
| | | workstationId.value = row.workstationId; // 假设rackNumber是架号字段的属性名 |
| | | |
| | | // 发起接口请求获取流程卡号 |
| | | fetchFlowCardId(); |
| | | |
| | | |
| | | dialogFormVisiblea.value = true; // 打开绑定架子对话框 |
| | | }; |
| | | |
| | | |
| | | |
| | | //获取流程卡号 |
| | | const fetchFlowCardId = async () => { |
| | | try { |
| | | const response = await unloadrequest.get('/api/downWorkstation/getflowCardId'); |
| | | console.log(response) |
| | | if (response.code === 200) { |
| | | flowCardOptions.value = response.data.map(item => ({ flowcard_id: item.flowcard_id })); |
| | | } else { |
| | | ElMessage.error(response.msg); |
| | | } |
| | | } catch (error) { |
| | | console.error(error); |
| | | } |
| | | }; |
| | | //确认 |
| | | const handleConfirm = async () => { |
| | | try { |
| | | const response = await unloadrequest.post('/api/downWorkstation/updateFlowCardId', { |
| | | workstationId: workstationId.value, |
| | | flowCardId: flowCardId.value |
| | | }); |
| | | |
| | | console.log(response) |
| | | if (response.code == 200) { |
| | | // 绑定成功,处理逻辑 |
| | | console.log('绑定成功'); |
| | | ElMessage.success(response.message); |
| | | dialogFormVisiblea.value = false; |
| | | } else { |
| | | // 请求失败,显示错误消息 |
| | | ElMessage.error(response.msg); |
| | | } |
| | | } catch (error) { |
| | | // 处理错误 |
| | | console.error(error); |
| | | } |
| | | }; |
| | | |
| | | |
| | | |
| | | const handleBindRack2 = (row) => { |
| | | workstationId.value = row.workstationId; // 假设rackNumber是架号字段的属性名 |
| | | |
| | | |
| | | |
| | | |
| | | dialogFormVisiblea2.value = true; // 打开绑定架子对话框 |
| | | }; |
| | | //清除内容 |
| | | const handleclear = async () => { |
| | | try { |
| | | const response = await unloadrequest.post('/api/downWorkstation/clear', { |
| | | workstationId: workstationId.value, |
| | | }); |
| | | |
| | | console.log(response); |
| | | |
| | | if (response.code === 200) { |
| | | // 清除成功的逻辑 |
| | | console.log('清除成功'); |
| | | ElMessage.success(response.message); |
| | | dialogFormVisiblea2.value = false; |
| | | } else if (response.code === 400) { |
| | | // 清除失败的逻辑 |
| | | console.log('清除失败'); |
| | | console.log(response.message); // 打印服务器返回的错误信息 |
| | | ElMessage.error(response.message); |
| | | dialogFormVisiblea2.value = false; |
| | | } |
| | | } catch (error) { |
| | | // console.log(error); |
| | | ElMessage.error("清除失败"); |
| | | dialogFormVisiblea2.value = false; |
| | | } |
| | | }; |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | // 发送获取表格数据的请求 |
| | | const fetchTableData = async () => { |
| | | try { |
| | | // 发送获取表格数据的请求,并等待响应 |
| | | const response = await unloadrequest.get('/api/downWorkstation/getone'); |
| | | |
| | | // 检查响应状态 |
| | | if (response.code === 200) { |
| | | // 更新表格数据 |
| | | console.log('成功获取表格数据:', response.data); |
| | | tableData.splice(0, tableData.length, ...response.data); |
| | | } else { |
| | | // 请求失败,显示错误消息 |
| | | ElMessage.error(response.msg); |
| | | } |
| | | } catch (error) { |
| | | // 处理请求失败的情况 |
| | | ElMessage.error('获取表格数据失败,请重试'); |
| | | } |
| | | }; |
| | | |
| | | |
| | | |
| | | |
| | | // initWebSocket(); |
| | | onMounted(fetchTableData); |
| | | setInterval(fetchTableData, 2000) |
| | | |
| | | const open = () => { |
| | | ElMessageBox.confirm( |
| | | '是否删除该条信息?', |
| | |
| | | ], |
| | | }) |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | </script> |
| | | |
| | | <template> |
| | |
| | | <el-table height="100%" ref="table" |
| | | @selection-change="handleSelectionChange" |
| | | :data="tableData" :header-cell-style="{background:'#F2F3F5 ',color:'#1D2129'}"> |
| | | <el-table-column prop="id" align="center" label="下片位" min-width="80" /> |
| | | <el-table-column prop="long" align="center" label="架号" min-width="120" /> |
| | | <el-table-column prop="wide" align="center" label="流程卡号" min-width="120" /> |
| | | <el-table-column prop="wide" align="center" label="总数量" min-width="120" /> |
| | | <el-table-column prop="wide" align="center" label="已落架数量" min-width="120" /> |
| | | <el-table-column prop="state" align="center" label="启用状态" min-width="120" /> |
| | | <el-table-column prop="workstationId" align="center" label="下片位" min-width="80" /> |
| | | <el-table-column prop="workstationId" align="center" label="架号" min-width="120" /> |
| | | <el-table-column prop="flowCardId" align="center" label="流程卡号" min-width="120" /> |
| | | <el-table-column prop="totalquantity" align="center" label="总数量" min-width="120" /> |
| | | <el-table-column prop="racksnumber" align="center" label="已落架数量" min-width="120" /> |
| | | <el-table-column prop="work_state" align="center" label="状态" min-width="120" /> |
| | | <el-table-column prop="deviceId" align="center" label="设备号" min-width="120" /> |
| | | <el-table-column prop="enableState" align="center" label="启用状态" min-width="120" /> |
| | | <el-table-column fixed="right" label="操作" align="center" width="200"> |
| | | <template #default> |
| | | <el-button size="mini" type="text" plain v-show="state !== '已启用' " @click="dialogFormVisiblea = true">绑定架子</el-button> |
| | | <el-button size="mini" type="text" plain @click="dialogFormVisible = true">清空</el-button> |
| | | </template> |
| | | <template #default="scope"> |
| | | <el-button size="mini" type="text" plain v-show="scope.row.enableState !== '已启用' " @click="handleBindRack(scope.row)">绑定架子</el-button> |
| | | <el-button size="mini" type="text" plain @click="handleBindRack2(scope.row)">清空</el-button> |
| | | </template> |
| | | </el-table-column> |
| | | </el-table> |
| | | </div> |
| | | </el-card> |
| | | |
| | | </div> |
| | | <div style="display: flex;"> |
| | | <div id="main-body"> |
| | | <Landingindication></Landingindication> |
| | | </div> |
| | | <!-- <div id="main-bodya"> |
| | | <Landingindicationtwo></Landingindicationtwo> |
| | | </div> --> |
| | | </div> |
| | | |
| | | |
| | | <el-dialog v-model="dialogFormVisiblea" top="21vh" width="30%" title="绑定架子" > |
| | | <div style="margin-left: 50px;margin-top: 10px;margin-bottom: 10px;"> |
| | | <el-form size="mini" label-width="150px"> |
| | | <el-form label-width="100px" label-position="right"> |
| | | <el-form-item label="架号:" :required="true" style="width: 18vw"> |
| | | <el-input autocomplete="off"/> |
| | | </el-form-item> |
| | | <el-form-item label="流程卡号:" :required="true" style="width: 18vw;"> |
| | | <el-input autocomplete="off" /> |
| | | </el-form-item> |
| | | </el-form> |
| | | </el-form> |
| | | </div> |
| | | <el-form size="mini" label-width="150px"> |
| | | <el-form label-width="100px" label-position="right"> |
| | | <el-form-item label="架号:" :required="true" style="width: 18vw"> |
| | | <el-input v-model="workstationId" autocomplete="off"/> |
| | | </el-form-item> |
| | | <el-form-item label="流程卡号:" :required="true" style="width: 18vw;"> |
| | | <el-select v-model="flowCardId" placeholder="请选择流程卡号"> |
| | | <el-option v-for="item in flowCardOptions" :key="item.flowcard_id" :label="item.flowcard_id" :value="item.flowcard_id" /> |
| | | </el-select> |
| | | </el-form-item> |
| | | </el-form> |
| | | </el-form> |
| | | </div> |
| | | <template #footer> |
| | | <div id="dialog-footer"> |
| | | <el-button type="primary" @click="dialogFormVisiblea = false"> |
| | | <el-button type="primary" @click="handleConfirm"> |
| | | 确认 |
| | | </el-button> |
| | | <el-button @click="dialogFormVisiblea = false">取消</el-button> |
| | | </div> |
| | | </template> |
| | | </el-dialog> |
| | | |
| | | |
| | | |
| | | |
| | | <el-dialog v-model="dialogFormVisiblea2" top="21vh" width="30%" title="清除架子玻璃" > |
| | | |
| | | <template #footer> |
| | | <div id="dialog-footer"> |
| | | <el-button type="primary" @click="handleclear"> |
| | | 确认 |
| | | </el-button> |
| | | <el-button @click="dialogFormVisiblea2 = false">取消</el-button> |
| | | </div> |
| | | </template> |
| | | </el-dialog> |
| | | |
| | | |
| | | <!-- workstationId: '1', |
| | | workstationId: '1005', |
| | | flowCardId: '183.6', |
| | | totalquantity: '1991', |
| | | racksnumber:"1", |
| | | work_state: '待识别', --> |
| | | </div> |
| | | <div style="display: flex;"> |
| | | <div id="main-body"> |
| | | <Landingindication></Landingindication> |
| | | </div> |
| | | <div id="main-bodya"> |
| | | <Landingindicationtwo></Landingindicationtwo> |
| | | </div></div> |
| | | </template> |
| | | |
| | | <style scoped> |
| | |
| | | } |
| | | #main-body{ |
| | | margin-top: -20px; |
| | | margin-left: 450px; |
| | | margin-left: 300px; |
| | | } |
| | | #main-bodya{ |
| | | margin-top: -10px; |
| | | margin-left: 100px; |
| | | } |
| | | </style> |
| | |
| | | state: '未启用' |
| | | }, |
| | | { |
| | | id: '2', |
| | | id: '3', |
| | | long: '105', |
| | | wide: '183', |
| | | thick: '191', |
| | | state: '未启用' |
| | | }, |
| | | { |
| | | id: '4', |
| | | long: '105', |
| | | wide: '183', |
| | | thick: '191', |
| | | state: '未启用' |
| | | }, |
| | | { |
| | | id: '5', |
| | | long: '105', |
| | | wide: '183', |
| | | thick: '191', |
| | |
| | | } |
| | | }, |
| | | server: { |
| | | port: 801,//端口号 |
| | | host: true,//ip地址 或 '0.0.0.0' 或 "loaclhost" |
| | | open: false, //启动后是否自动打开浏览器 |
| | | https: false, // 是否开启 https |
| | | port: 801, |
| | | host: true, |
| | | open: false, |
| | | https: false, |
| | | proxy: { |
| | | '^/api': { |
| | | target: 'localhost:8080/mesModuleTools', //目标源,目标服务器,真实请求地址 |
| | | changeOrigin: true, //支持跨域 |
| | | rewrite: (path) => path.replace(/^\/api/, "/mesModuleTools"), //重写真实路径,替换/api |
| | | // pathRewrite: { |
| | | // '^/api': '' |
| | | // } |
| | | // rewrite: (path) => path.replace(/^\/api/, "/mesModuleTools"), //重写真实路径,替换/api |
| | | '/api': { |
| | | target: 'http://localhost:8080/mesModuleTools', |
| | | changeOrigin: true, |
| | | rewrite: (path) => path.replace(/^\/api/, '/mesModuleTools'), |
| | | }, |
| | | '/api2': { |
| | | target: 'localhost:8080/mesModuleTools', |
| | | target: 'http://localhost:8081/mesModuleTools', |
| | | changeOrigin: true, |
| | | rewrite: (path) => path.replace(/^\/api2/, "mesModuleTools"), |
| | | pathRewrite: { |
| | | '^/api2': '', |
| | | }, |
| | | }, |
| | | } |
| | | } |
| | | }) |
| | | }, |
| | | }, |
| | | configureServer: ({ middlewares }) => { |
| | | middlewares.use( |
| | | '/mesModuleTools', |
| | | createProxyMiddleware({ |
| | | target: 'ws://localhost:8081', |
| | | ws: true, |
| | | changeOrigin: true, |
| | | pathRewrite: { |
| | | '^/mesModuleTools': '', |
| | | }, |
| | | }) |
| | | ); |
| | | }, |
| | | }); |
| | |
| | | } |
| | | |
| | | }; |
| | | |
| | | |
| | | public void writeString(String addr,String data) { |
| | | s7PLC.writeString(addr,data); |
| | | } |
| | | |
| | | |
| | | |
| | |
| | | @Autowired
|
| | | private DownGlassInfoService downGlassInfoService;
|
| | |
|
| | | // 获取指定ID的DownGlassInfo信息
|
| | | /**
|
| | | * @param id
|
| | | * @return
|
| | | * // 获取指定ID的DownGlassInfo信息
|
| | | */
|
| | |
|
| | | @GetMapping("/{id}")
|
| | | public DownGlassInfo getDownGlassInfoById(@PathVariable Integer id) {
|
| | | return downGlassInfoService.getDownGlassInfoById(id);
|
New file |
| | |
| | | package com.mes.controller;
|
| | |
|
| | | import com.mes.entity.DownWorkstation;
|
| | | import com.mes.service.DownWorkstationService;
|
| | | import com.mes.service.GlassInfoService;
|
| | | import org.springframework.beans.factory.annotation.Autowired;
|
| | | import org.springframework.http.HttpStatus;
|
| | | import org.springframework.http.ResponseEntity;
|
| | | import org.springframework.web.bind.annotation.*;
|
| | |
|
| | | import java.util.HashMap;
|
| | | import java.util.List;
|
| | | import java.util.Map;
|
| | |
|
| | | @RestController
|
| | | @RequestMapping("/api/downWorkstation")
|
| | | public class DownWorkstationController {
|
| | |
|
| | | @Autowired
|
| | | private DownWorkstationService downWorkstationService;
|
| | | @Autowired
|
| | | private GlassInfoService glassInfoService;
|
| | |
|
| | | @GetMapping("/getone")
|
| | | public ResponseEntity<?> getOneDownWorkstations() {
|
| | | try {
|
| | | List<DownWorkstation> data = downWorkstationService.getoneDownWorkstations();
|
| | | // 构建符合预期格式的响应数据
|
| | | Map<String, Object> responseData = new HashMap<>();
|
| | | responseData.put("code", 200);
|
| | | responseData.put("msg", "成功");
|
| | | responseData.put("data", data);
|
| | | // 返回 ResponseEntity 对象,包含响应数据和状态码
|
| | | return ResponseEntity.ok(responseData);
|
| | | } catch (Exception e) {
|
| | | e.printStackTrace();
|
| | | // 如果出现异常,返回错误信息
|
| | | Map<String, Object> errorResponse = new HashMap<>();
|
| | | errorResponse.put("code", 500);
|
| | | errorResponse.put("msg", "服务器内部错误");
|
| | | return ResponseEntity.status(500).body(errorResponse);
|
| | | }
|
| | | }
|
| | |
|
| | | @GetMapping("/gettwo")
|
| | | public List<DownWorkstation> gettwoDownWorkstations() {
|
| | | return downWorkstationService.gettwoDownWorkstations();
|
| | | }
|
| | | @GetMapping("/getflowCardId")
|
| | | public ResponseEntity<Map<String, Object>> getflowCardId() {
|
| | | Map<String, Object> responseData = new HashMap<>();
|
| | | try {
|
| | | List<Map<String, Object>> data = downWorkstationService.getflowCardId();
|
| | | responseData.put("code", 200);
|
| | | responseData.put("msg", "成功");
|
| | | responseData.put("data", data);
|
| | | return ResponseEntity.ok(responseData);
|
| | | } catch (Exception e) {
|
| | | responseData.put("code", 500);
|
| | | responseData.put("msg", "失败");
|
| | | responseData.put("data", null);
|
| | | return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body(responseData);
|
| | | }
|
| | | }
|
| | |
|
| | |
|
| | |
|
| | |
|
| | | @PostMapping("/updateFlowCardId")
|
| | | public ResponseEntity<Map<String, Object>> updateFlowCardId(@RequestBody Map<String, Object> requestData) {
|
| | | // 从 requestData 中获取传入的 flowCardId
|
| | | String flowCardId = (String) requestData.get("flowCardId");
|
| | | int workstationId = (int) requestData.get("workstationId");
|
| | |
|
| | | // 查询对应 flowCardId 的玻璃信息总数量
|
| | | int glassInfoCount = glassInfoService.getGlassInfoCountByFlowCardId(flowCardId);
|
| | |
|
| | | // 更新 down_workstation 表中的总数量
|
| | | glassInfoService.updateFlowCardIdAndCount(flowCardId, glassInfoCount, workstationId);
|
| | |
|
| | | // 构建响应数据
|
| | | Map<String, Object> responseData = new HashMap<>();
|
| | | responseData.put("message", "updated successfully");
|
| | | responseData.put("code", 200);
|
| | | // 返回处理结果
|
| | | return ResponseEntity.ok(responseData);
|
| | | }
|
| | |
|
| | |
|
| | | @PostMapping("/clear")
|
| | | public ResponseEntity<Map<String, Object>> clearWorkstationInfo(@RequestBody Map<String, Object> requestData) {
|
| | | // 调用 DownWorkstationService 中的方法清除指定工位ID的信息
|
| | | int workstationId = (int) requestData.get("workstationId");
|
| | |
|
| | | int totalWorkstations = downWorkstationService.getTotalQuantity(workstationId);
|
| | | int downWorkstations = downWorkstationService.getRacksNumber(workstationId);
|
| | |
|
| | |
|
| | | if (downWorkstations == totalWorkstations) {
|
| | | downWorkstationService.clearFlowCardId(workstationId);
|
| | | Map<String, Object> responseData = new HashMap<>();
|
| | | responseData.put("message", "cleared successfully");
|
| | | responseData.put("code", 200);
|
| | | // 返回处理结果
|
| | | return ResponseEntity.ok(responseData);
|
| | | }
|
| | | else {
|
| | | // 如果总数量和落架数量不一致,返回错误响应
|
| | | Map<String, Object> errorResponse = new HashMap<>();
|
| | | errorResponse.put("message", "Total workstations count does not match down workstations count.");
|
| | | errorResponse.put("code", 400);
|
| | | return ResponseEntity.badRequest().body(errorResponse);
|
| | | }
|
| | |
|
| | |
|
| | | // 构建响应数据
|
| | |
|
| | | }
|
| | |
|
| | |
|
| | |
|
| | |
|
| | |
|
| | |
|
| | | }
|
| | |
| | | import com.baomidou.mybatisplus.annotation.IdType;
|
| | | import com.baomidou.mybatisplus.annotation.TableId;
|
| | | import lombok.Data;
|
| | |
|
| | | /**
|
| | | * 下片前理片笼明细实体类
|
| | | */
|
| | | /**
|
| | | * 下片前理片笼明细实体类
|
| | | * @author SNG-012
|
| | | */
|
| | | @Data
|
| | | public class DownStorageCageDetails {
|
| | |
|
| | | @TableId(type = IdType.AUTO)
|
| | | private int id; // 下片前理片笼明细表id
|
| | | /**
|
| | | * 下片前理片笼明细表id
|
| | | */
|
| | | private int id;
|
| | |
|
| | | private int deviceId; // 设备id
|
| | | private int slot; // 栅格号
|
| | | private int glassId; // 玻璃id
|
| | | private int sequence; // 小片在格内的顺序
|
| | | private String flowCardId; // 流程卡号
|
| | | private int glassType; // 玻璃类型
|
| | | private double width; // 宽
|
| | | private double height; // 高
|
| | | private double thickness; // 厚度
|
| | | private int temperingLayoutId; // 钢化版图id
|
| | | private int temperingFeedSequence; // 钢化版图片序
|
| | | private int state; // 状态
|
| | | private int gap; // 玻璃间隙
|
| | | } |
| | | /**
|
| | | * 设备id
|
| | | */
|
| | | private int deviceId;
|
| | |
|
| | | /**
|
| | | * 栅格号
|
| | | */
|
| | | private int slot;
|
| | |
|
| | | /**
|
| | | * 玻璃id
|
| | | */
|
| | | private int glassId;
|
| | |
|
| | | /**
|
| | | * 小片在格内的顺序
|
| | | */
|
| | | private int sequence;
|
| | |
|
| | | /**
|
| | | * 流程卡号
|
| | | */
|
| | | private String flowCardId;
|
| | |
|
| | | /**
|
| | | * 膜系id
|
| | | */
|
| | | private int filmsid;
|
| | | /**
|
| | | * 玻璃类型
|
| | | */
|
| | | private int glassType;
|
| | |
|
| | | /**
|
| | | * 宽
|
| | | */
|
| | | private double width;
|
| | |
|
| | | /**
|
| | | * 高
|
| | | */
|
| | | private double height;
|
| | |
|
| | | /**
|
| | | * 厚度
|
| | | */
|
| | | private double thickness;
|
| | |
|
| | | /**
|
| | | * 钢化版图id
|
| | | */
|
| | | private int temperingFeedSequence;
|
| | |
|
| | | /**
|
| | | * 钢化版图片序
|
| | | */
|
| | | private int temperingLayoutId;
|
| | |
|
| | | /**
|
| | | * 状态
|
| | | */
|
| | | private int state;
|
| | |
|
| | | /**
|
| | | * 玻璃间隙
|
| | | */
|
| | | private int gap;
|
| | | }
|
| | |
|
| | |
| | | package com.mes.entity;
|
| | |
|
| | | import com.baomidou.mybatisplus.annotation.IdType;
|
| | | import com.baomidou.mybatisplus.annotation.TableId;
|
| | | import lombok.Data;
|
| | | import com.baomidou.mybatisplus.annotation.TableField;
|
| | | import com.baomidou.mybatisplus.annotation.TableId;
|
| | | import lombok.Data;
|
| | |
|
| | | @Data
|
| | | public class DownWorkstation {
|
| | |
|
| | | /**
|
| | | * // 下片工位表
|
| | | */
|
| | | @TableId(type = IdType.AUTO)
|
| | | private int id; // 下片工位表id
|
| | | private Integer workstationId; // 工位id
|
| | | private String flowCardId; // 流程卡号
|
| | | private Integer deviceId; // 设备id
|
| | | private Integer enableState; // 启用状态
|
| | | private Integer workState; // 工作状态
|
| | | private Integer racks_number; // 已落架数量
|
| | | private Integer total_quantity; // 总数量
|
| | | private int id;
|
| | |
|
| | | /**
|
| | | * // 工位id
|
| | | */
|
| | | private Integer workstationId;
|
| | |
|
| | | /**
|
| | | * // 流程卡号
|
| | | */
|
| | | private String flowCardId;
|
| | |
|
| | | /**
|
| | | * // 设备id
|
| | | */
|
| | | private Integer deviceId;
|
| | |
|
| | | /**
|
| | | * // 启用状态
|
| | | */
|
| | | private Integer enableState;
|
| | |
|
| | |
|
| | |
|
| | | /**
|
| | | * // 工作状态
|
| | | */
|
| | | private Integer workState;
|
| | |
|
| | | /**
|
| | | * // 已落架数量
|
| | | */
|
| | | @TableField(value = "racks_number")
|
| | | private int racksnumber;
|
| | |
|
| | | /**
|
| | | * // 总数量
|
| | | */
|
| | | @TableField(value = "total_quantity")
|
| | | private Integer totalquantity;
|
| | |
|
| | | } |
New file |
| | |
| | | package com.mes.entity; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import lombok.Data; |
| | | |
| | | import java.math.BigInteger; |
| | | |
| | | @Data //lombok 简写java代码 实体类的get与set |
| | | @TableName("`glass_info`") |
| | | public class GlassInfo { |
| | | @TableId(type = IdType.AUTO) |
| | | private BigInteger id;//玻璃信息表id |
| | | private String flowcardid;//流程卡 |
| | | private Integer glasstype;//流程卡玻璃类型 |
| | | private Double width;//宽 |
| | | private Double height;//高 |
| | | private Double thickness;//厚度 |
| | | private Integer filmsid;//膜系 |
| | | private Double edgwidth;//磨前宽 |
| | | private Double edgheight;//磨前高 |
| | | private Integer ismultiple;//是否配片 |
| | | private Double maxwidth;//配片最大宽 |
| | | private Double maxheight;//配片最大高 |
| | | private Integer ishorizontal;//钢化是否接受横放 |
| | | private Integer patternsequence;//原片顺序 |
| | | private Integer temperinglayoutid;//钢化版图id |
| | | private Integer temperingfeedsequence;//钢化版图片序 |
| | | private Integer xcoordinate;//x坐标 |
| | | private Integer ycoordinate;//y坐标 |
| | | private Integer angle;//旋转角度(逆时针) |
| | | |
| | | } |
New file |
| | |
| | | package com.mes.entity; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import lombok.Data; |
| | | |
| | | @Data //lombok 简写java代码 实体类的get与set |
| | | |
| | | public class TaskCache { |
| | | @TableId(type = IdType.AUTO) |
| | | private int id;//id |
| | | private String startCell;//起始 |
| | | private String endCell;//结束 |
| | | private String taskType;//类型 |
| | | private double width;//宽 |
| | | private double height;//搞 |
| | | private String filmsId;//膜系 |
| | | private double thickness;//厚度 |
| | | private String flowCardId;//流程卡号 |
| | | private int taskStatus;//状态 |
| | | |
| | | } |
| | |
| | | |
| | | return addressIndex; |
| | | } |
| | | |
| | | public String getAddress() { |
| | | return getAddress(this.addressIndex); |
| | | } |
| | | } |
| | |
| | | public interface DownGlassInfoMapper extends BaseMapper<DownGlassInfo> {
|
| | |
|
| | | // 查询下片任务表中状态为1的下片信息
|
| | | @Select("SELECT flow_card_id,filmsid,width,height,thickness FROM down_glass_task WHERE state = 1;")
|
| | | @Select("SELECT flow_card_id,filmsid,width,height,thickness FROM down_glass_task WHERE task_stauts = 1;")
|
| | | List<DownGlassInfo> selectunloadingtaskstate();
|
| | |
|
| | | @Update("UPDATE down_glass_task SET state = 0 WHERE flow_card_id = #{flowCardId}")
|
| | | @Update("UPDATE down_glass_task SET task_stauts = 0 WHERE flow_card_id = #{flowCardId}")
|
| | | void updateTaskStateToZero(@Param("flowCardId") String flowCardId);
|
| | |
|
| | | @Select("SELECT MAX(sequence) FROM down_glass_info WHERE flow_card_id = #{flowCardId} LIMIT 1")
|
| | |
| | | import org.springframework.stereotype.Repository;
|
| | |
|
| | | import java.util.List;
|
| | | import java.util.Map;
|
| | |
|
| | | @Mapper
|
| | | @Component
|
| | |
| | | //从机械手任务表查询状态为1的流程卡号
|
| | | // @Select("SELECT * FROM down_workstation_task WHERE state = 1")
|
| | | // List<DownWorkstation> selectdownWorkstationstate();
|
| | |
|
| | | @Select("SELECT dw.flow_card_id,dw.racks_number FROM down_workstation_task dwt JOIN down_workstation dw ON dwt.flow_card_id = dw.flow_card_id WHERE dwt.state = 1 LIMIT 1")
|
| | | //查询工位表和任务表中状态为1的流程卡号和已落架数量
|
| | | @Select("SELECT dwt.flow_card_id,dw.id,dw.racks_number FROM down_workstation_task dwt JOIN down_workstation dw ON dwt.flow_card_id = dw.flow_card_id WHERE dwt.state = 1 LIMIT 1")
|
| | | List<DownWorkstation> selectdownWorkstationstate();
|
| | |
|
| | | //更新落架数量
|
| | | @Update("UPDATE down_workstation SET racks_number = #{racksNumber} " +
|
| | | "WHERE flow_card_id = #{flowCardId}")
|
| | | void update_racks_number(@Param("flowCardId") String flowCardId,
|
| | | @Param("racksNumber") Integer racksNumber);
|
| | |
|
| | |
|
| | | //插入机械任务表
|
| | | @Insert("INSERT INTO down_workstation_task (flow_card_id, width, height, thickness, filmsid,state) " +
|
| | | "VALUES (#{flowCardId}, #{width}, #{height}, #{thickness}, #{filmsid},1)")
|
| | | void insertdownWorkstationtask(DownGlassInfo downGlassInfo);
|
| | |
|
| | | //根据工位id更新实体类接收的数据
|
| | | @Update("UPDATE down_workstation SET width = #{width}, height = #{height}, flow_card_id = #{flowCardId} WHERE workstation_id = #{workstationId}")
|
| | | void updateFlowCardId(DownWorkstation downWorkstation);
|
| | |
|
| | |
|
| | |
|
| | | //满架拉走,清空信息
|
| | | @Update("UPDATE down_workstation SET width = null, height = null, flow_card_id = null WHERE workstation_id = #{workstationId}")
|
| | | void clearFlowCardId(DownWorkstation downWorkstation);
|
| | |
|
| | |
|
| | |
|
| | | @Update("UPDATE down_workstation_task SET state = 0 WHERE flow_card_id = #{flowCardId}")
|
| | | void update_task_state_to_zero(@Param("flowCardId") String flowCardId);
|
| | |
|
| | |
|
| | | @Select(" SELECT * FROM down_workstation WHERE workstation_id >= 1 AND workstation_id <= 5")
|
| | | List<DownWorkstation> getoneDownWorkstations();
|
| | |
|
| | |
|
| | | @Select(" SELECT * FROM down_workstation WHERE workstation_id >= 6 AND workstation_id <= 10")
|
| | | List<DownWorkstation> gettwoDownWorkstations();
|
| | |
|
| | |
|
| | |
|
| | | @Select("SELECT DISTINCT flowcard_id from glass_info")
|
| | | @ResultType(Map.class)
|
| | | List<Map<String, Object>> getflowCardId();
|
| | |
|
| | | @Update("UPDATE down_workstation SET flow_card_id = NULL, total_quantity = 0, racks_number = 0 WHERE workstation_id = #{workstationId}")
|
| | | void clearFlowCardInfoByWorkstationId(@Param("workstationId") int workstationId);
|
| | |
|
| | | // 获取总数量
|
| | | @Select("SELECT total_quantity FROM down_workstation WHERE workstation_id = #{workstationId}")
|
| | | int getTotalQuantity(@Param("workstationId") int workstationId);
|
| | |
|
| | | // 获取落架数量
|
| | | @Select("SELECT racks_number FROM down_workstation WHERE workstation_id = #{workstationId}")
|
| | | int getRacksNumber(@Param("workstationId") int workstationId);
|
| | |
|
| | | }
|
New file |
| | |
| | | package com.mes.mapper;
|
| | |
|
| | | import org.apache.ibatis.annotations.Mapper;
|
| | | import org.apache.ibatis.annotations.Param;
|
| | | import org.apache.ibatis.annotations.Select;
|
| | | import org.apache.ibatis.annotations.Update;
|
| | |
|
| | | @Mapper
|
| | | public interface GlassInfoMapper {
|
| | |
|
| | | @Select("SELECT COUNT(*) FROM glass_info WHERE flowcard_id = #{flowCardId}")
|
| | | int getGlassInfoCountByFlowCardId(@Param("flowCardId") String flowCardId);
|
| | |
|
| | | @Update("UPDATE down_workstation SET total_quantity = #{glassInfoCount},flow_card_id=#{flowCardId} WHERE workstation_id = #{workstationId}")
|
| | | int updateFlowCardIdAndCount(@Param("flowCardId") String flowCardId, @Param("glassInfoCount") int glassInfoCount,@Param("workstationId")int workstationId);
|
| | |
|
| | | // 这里可以添加其他 SQL 语句
|
| | | } |
New file |
| | |
| | | package com.mes.mapper; |
| | | |
| | | import com.mes.entity.DownStorageCageDetails; |
| | | import com.mes.entity.GlassInfo; |
| | | import com.mes.entity.TaskCache; |
| | | import org.apache.ibatis.annotations.*; |
| | | |
| | | import java.util.List; |
| | | |
| | | @Mapper |
| | | public interface SelectInfo { |
| | | // 玻璃信息 按ID查询 |
| | | @Select("select * from `glass_info` where id=#{id}") |
| | | GlassInfo SelectGlassId(String id); |
| | | |
| | | // 钢化按工程查询 |
| | | // @Select("select * from `v_optimize_heat_layout` where project_no=#{projeceid} ") |
| | | // List<Tempered> SelectTemperedTerritory(String projeceid); |
| | | // |
| | | // // 切割版图按工程查询 |
| | | // @Select("select * from optimize_detail where project_no=#{projeceid} ") |
| | | // List<Map> SelectCutTerritory(String projeceid); |
| | | // |
| | | // // 查询磨边信息 |
| | | // @Select("select * from task_cache where task_type='2' and task_stauts='2' and end_cell=#{EndCell}") |
| | | // List<Map> SelectEdgInfo(String EndCell); |
| | | |
| | | // 查询笼子内空闲 |
| | | @Select("select escd.* from down_storage_cage as esc LEFT JOIN down_storage_cage_details as escd on esc.slot=escd.slot where escd.slot is null order by escd.slot") |
| | | List<DownStorageCageDetails> SelectCacheLeisure(); |
| | | |
| | | // 查询笼子内出片任务 |
| | | @Select("select escd.* from down_storage_cage as esc LEFT JOIN down_storage_cage_details as escd on esc.slot=escd.slot WHERE escd.slot IS NOT NULL order by escd.tempering_layout_id,escd.tempering_feed_sequence") |
| | | List<DownStorageCageDetails> SelectCacheOut(); |
| | | |
| | | // 查询笼子内信息 |
| | | @Select("select escd.* from down_storage_cage as esc LEFT JOIN down_storage_cage_details as escd on esc.slot=escd.slot order by esc.slot") |
| | | List<DownStorageCageDetails> SelectCachInfo(); |
| | | |
| | | // 查询可进此片玻璃的栅格号 |
| | | @Select("select escd.* from down_storage_cage as esc LEFT JOIN down_storage_cage_details as escd on esc.slot=escd.slot where escd.slot is not null escd.tempering_layout_id=#{tempering_layout_id} and escd.tempering_feed_sequence<#{tempering_feed_sequence} and esc.remain_width-#{width}>0 order by escd.tempering_feed_sequence") |
| | | List<DownStorageCageDetails> SelectIsExistIntoCache(Integer tempering_layout_id, Integer tempering_feed_sequence, |
| | | double width); |
| | | |
| | | // 查询可进此片玻璃的栅格号 |
| | | @Select("select escd.* from down_storage_cage as esc LEFT JOIN down_storage_cage_details as escd on esc.slot=escd.slot where escd.slot is not null escd.tempering_layout_id<#{tempering_layout_id} and esc.remain_width-#{width}>0 order by escd.tempering_layout_id desc,escd.tempering_feed_sequence") |
| | | List<DownStorageCageDetails> SelectIsExistIntoCache(Integer tempering_layout_id, double width); |
| | | |
| | | // 查询全部任务 |
| | | @Select("select * from down_glass_task") |
| | | List<TaskCache> SelectCacheInfoAll(); |
| | | |
| | | // 查询进片任务 |
| | | @Select("select * from down_glass_task where task_type='1' and task_stauts='0'") |
| | | List<TaskCache> SelectInputCacheInfo(); |
| | | |
| | | // 查询出片任务 |
| | | @Select("select * from down_glass_task where task_type='2' and task_stauts='0'") |
| | | List<TaskCache> SelectOutCacheInfo(); |
| | | |
| | | // 查询 A06 或 A11 最新的一片 出片任务 |
| | | @Select("select * from down_glass_task where task_type='2' and task_stauts='2' and end_cell=#{EndCell} limit 1") |
| | | GlassInfo SelectLastOutCacheInfo(String EndCell); |
| | | |
| | | // 修改笼子内信息 |
| | | @Update("update") |
| | | Integer UpdateCache(@Param("id") Integer id, @Param("order_id") String order_id); |
| | | |
| | | // 添加下片任务 |
| | | @Insert("INSERT into down_glass_task VALUES(#{id},#{start},#{end},#{type},0,)") |
| | | Integer insertCacheTask(String id, String start, String end, String type,double width,double height,Integer filmsId,double thickness,String flowCardId); |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.mes.service; |
| | | |
| | | import com.mes.common.PlcTools.S7control; |
| | | import com.mes.entity.GlassInfo; |
| | | import com.mes.entity.DownStorageCageDetails; |
| | | import com.mes.entity.device.PlcParameterObject; |
| | | import com.mes.mapper.SelectInfo; |
| | | import lombok.Data; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.List; |
| | | |
| | | @Data |
| | | @Service |
| | | public class DownGlassCacheLogic { |
| | | @Autowired |
| | | private SelectInfo selectInfo; |
| | | |
| | | /** |
| | | * @param Number |
| | | * //识别逻辑 不交互 |
| | | */ |
| | | |
| | | public void identify(String Number){ |
| | | //查询任务 |
| | | PlcParameterObject plcmes=PLCAutoMes.PlcMesObject; |
| | | S7control.getinstance().WriteWord(plcmes.getPlcParameter("MESToGaStatus").getAddress(),(short) 1); |
| | | String s=S7control.getinstance().ReadWord("DB14.26", 1).get(0)+""; |
| | | boolean isexist=isExist(Number); |
| | | if (isexist) { |
| | | //存在逻辑 1.添加信息 2.回复PLC存在 |
| | | //S7control.getinstance().WriteWord(plcmes.getPlcParameter("MESToGaStatus").getAddress(),(short) 1); |
| | | }else { |
| | | //不存在逻辑 1.回复PLC不存在 |
| | | //S7control.getinstance().WriteWord(plcmes.getPlcParameter("MESToGaStatus").getAddress(),(short) 2); |
| | | } |
| | | } |
| | | //下片前理片 |
| | | public static final String RESULT_IN = "1"; |
| | | public static final String RESULT_OUT = "2"; |
| | | public static final String RESULT_IN_OUT = "3"; |
| | | |
| | | public void process() { |
| | | String result = S7control.getinstance().ReadWord("DB14.0", 1).get(0) + ""; |
| | | String number = S7control.getinstance().ReadWord("DB14.2", 1).get(0) + ""; |
| | | |
| | | // 进片请求 |
| | | if (RESULT_IN.equals(result)) { |
| | | processInto(number); |
| | | } |
| | | // 出片请求 |
| | | else if (RESULT_OUT.equals(result)) { |
| | | processOut(); |
| | | } |
| | | // 进出片请求 |
| | | else if (RESULT_IN_OUT.equals(result)) { |
| | | // 先出后进 |
| | | if (!processOut()) { |
| | | processInto(number); |
| | | } |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * @param Number |
| | | * @return |
| | | * //下片前理片 进 |
| | | */ |
| | | |
| | | public boolean processInto(String Number){ |
| | | //按id查询玻璃信息表里的玻璃 |
| | | GlassInfo GlassInfo=selectInfo.SelectGlassId(Number); |
| | | PlcParameterObject plcmes=PLCAutoMes.PlcMesObject; |
| | | //存在此玻璃编号 |
| | | if(GlassInfo!=null){ |
| | | //同钢化版图内的栅格号 |
| | | List<DownStorageCageDetails> list=selectInfo.SelectIsExistIntoCache(GlassInfo.getTemperinglayoutid(),GlassInfo.getTemperingfeedsequence(),GlassInfo.getWidth()); |
| | | //空栅格号 |
| | | if (list.size()==0) { |
| | | list=selectInfo.SelectCacheLeisure(); |
| | | } |
| | | //小于此玻璃钢化版图序号的栅格号 |
| | | if(list.size()==0){ |
| | | list=selectInfo.SelectIsExistIntoCache(GlassInfo.getTemperinglayoutid(),GlassInfo.getWidth()); |
| | | } |
| | | if(list.size()>0){ |
| | | //存在空格 |
| | | //1.生成任务: 起始位置0 结束位置this.slot 任务类型 1 (进片任务) |
| | | //2.回复 1进片 |
| | | DownStorageCageDetails item=list.get(0); |
| | | selectInfo.insertCacheTask(GlassInfo.getId()+"","0",item.getSlot()+"","1",GlassInfo.getWidth(),GlassInfo.getHeight(),GlassInfo.getFilmsid(),GlassInfo.getThickness(),GlassInfo.getFlowcardid()); |
| | | S7control.getinstance().WriteWord(plcmes.getPlcParameter("MESToGaStatus").getAddress(),(short) 1); |
| | | return true; |
| | | } |
| | | |
| | | }else{ |
| | | // ID编号不存在 不处理/回复PLC 进行报警提示 |
| | | } |
| | | //返回结果 |
| | | return false; |
| | | } |
| | | //理片 出 |
| | | public boolean processOut(){ |
| | | //查询任务 |
| | | String G06=S7control.getinstance().ReadWord("DB14.56", 1).get(0)+""; |
| | | String G11=S7control.getinstance().ReadWord("DB14.58", 1).get(0)+""; |
| | | String G13=S7control.getinstance().ReadWord("DB14.58", 1).get(0)+""; |
| | | PlcParameterObject plcmes=PLCAutoMes.PlcMesObject; |
| | | List<DownStorageCageDetails> list=selectInfo.SelectCacheOut(); |
| | | //其他情况条件 如:后续设备故障禁止理片出片 等 |
| | | boolean isOut=true; |
| | | if (list.size()>0&&isOut) { |
| | | DownStorageCageDetails item=list.get(0); |
| | | // |
| | | if(G06=="0"&&G11=="1"){ |
| | | //出到 G06 |
| | | |
| | | selectInfo.insertCacheTask(item.getGlassId()+"","0","06","2",item.getWidth(),item.getHeight(),item.getFilmsid(),item.getThickness(),item.getFlowCardId()); |
| | | S7control.getinstance().writeString(plcmes.getPlcParameter("DB14.28").getAddress(), "1"); |
| | | S7control.getinstance().writeString(plcmes.getPlcParameter("DB14.20").getAddress(), "1"); |
| | | return true; |
| | | }else if(G06=="1"&&G11=="0"){ |
| | | //出到 G11 |
| | | |
| | | selectInfo.insertCacheTask(item.getGlassId()+"","0","11","2",item.getWidth(),item.getHeight(),item.getFilmsid(),item.getThickness(),item.getFlowCardId()); |
| | | S7control.getinstance().writeString(plcmes.getPlcParameter("DB14.28").getAddress(), "2"); |
| | | S7control.getinstance().writeString(plcmes.getPlcParameter("DB14.20").getAddress(), "1"); |
| | | return true; |
| | | }else if(G06=="0"&&G11=="0"){ |
| | | //都允许 G04/G05 上一片是否和此片玻璃尺寸尺寸相同 |
| | | String endcell="06"; |
| | | String SendEndcell="1"; |
| | | boolean If_=false; |
| | | GlassInfo glassInfo06= selectInfo.SelectLastOutCacheInfo("06"); |
| | | GlassInfo glassInfo11= selectInfo.SelectLastOutCacheInfo("11"); |
| | | GlassInfo glassInfo13= selectInfo.SelectLastOutCacheInfo("13"); |
| | | if(glassInfo06!=null&&glassInfo11.getWidth()==item.getWidth()&&glassInfo06.getHeight()==item.getHeight()){ |
| | | endcell="11"; |
| | | SendEndcell="2"; |
| | | }else if(item.getHeight()>=3440&&item.getWidth()>=1440){ |
| | | //其他条件人工处理 |
| | | |
| | | } |
| | | |
| | | selectInfo.insertCacheTask(item.getGlassId()+"","0",endcell,"2",item.getWidth(),item.getHeight(),item.getFilmsid(),item.getThickness(),item.getFlowCardId()); |
| | | S7control.getinstance().writeString(plcmes.getPlcParameter("DB14.28").getAddress(), SendEndcell); |
| | | S7control.getinstance().writeString(plcmes.getPlcParameter("DB14.20").getAddress(), "1"); |
| | | return true; |
| | | } |
| | | } |
| | | //返回结果 |
| | | return false; |
| | | } |
| | | |
| | | /** |
| | | * @param Number |
| | | * //磨边 不交互 理片和磨边机自己交互 |
| | | */ |
| | | |
| | | public void processMb(String Number){ |
| | | //按id查询玻璃信息表里的玻璃 |
| | | GlassInfo GlassInfo=selectInfo.SelectGlassId(Number); |
| | | PlcParameterObject plcmes=PLCAutoMes.PlcMesObject; |
| | | if(GlassInfo!=null){ |
| | | //发送任务 ID 长 宽 厚 倒角 工艺功能等 |
| | | S7control.getinstance().writeString(plcmes.getPlcParameter("DB14.22").getAddress(),"N10000"); |
| | | S7control.getinstance().writeString(plcmes.getPlcParameter("DB14.24").getAddress(), "1000"); |
| | | S7control.getinstance().writeString(plcmes.getPlcParameter("DB14.26").getAddress(),"800"); |
| | | S7control.getinstance().writeString(plcmes.getPlcParameter("DB14.28").getAddress(),"60"); |
| | | S7control.getinstance().writeString(plcmes.getPlcParameter("DB14.30").getAddress(), "2"); |
| | | S7control.getinstance().writeString(plcmes.getPlcParameter("DB14.20").getAddress(), "1"); |
| | | } |
| | | //返回结果 |
| | | } |
| | | |
| | | |
| | | /** |
| | | * @param Number |
| | | * @return |
| | | * 查询消息队列里此玻璃ID的数据 |
| | | */ |
| | | public boolean selectMessageId(String Number){ |
| | | //查询是否存在 |
| | | |
| | | GlassInfo GlassInfo=selectInfo.SelectGlassId(Number); |
| | | if(GlassInfo==null){ |
| | | //返回 不存在 |
| | | return false; |
| | | |
| | | } |
| | | //返回 存在 |
| | | return true; |
| | | } |
| | | |
| | | /** |
| | | * @param Number |
| | | * @return |
| | | * 删除消息队列里此玻璃ID的数据 |
| | | */ |
| | | |
| | | public boolean deleteMessageId(String Number){ |
| | | //查询是否存在 |
| | | GlassInfo GlassInfo=selectInfo.SelectGlassId(Number); |
| | | if(GlassInfo==null){ |
| | | //返回 不存在 |
| | | return false; |
| | | } |
| | | //返回 存在 |
| | | return true; |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * @param Number |
| | | * @return |
| | | * //是否存在此编号玻璃 |
| | | */ |
| | | public boolean isExist(String Number){ |
| | | //查询是否存在 |
| | | GlassInfo GlassInfo=selectInfo.SelectGlassId(Number); |
| | | if(GlassInfo==null){ |
| | | //返回 不存在 |
| | | return false; |
| | | } |
| | | //返回 存在 |
| | | return true; |
| | | } |
| | | |
| | | } |
| | | |
New file |
| | |
| | | package com.mes.service;
|
| | |
|
| | | import com.mes.entity.DownGlassInfo;
|
| | | import com.mes.entity.DownStorageCageDetails;
|
| | | import com.mes.entity.DownWorkstation;
|
| | | import com.mes.entity.device.PlcParameterObject;
|
| | | import com.mes.mapper.DownGlassInfoMapper;
|
| | | import com.mes.mapper.DownWorkstationMapper;
|
| | | import com.mes.tools.WebSocketServer;
|
| | | import lombok.Data;
|
| | | import org.springframework.beans.factory.annotation.Autowired;
|
| | | import org.springframework.stereotype.Service;
|
| | |
|
| | | import java.util.List;
|
| | |
|
| | | @Data
|
| | | @Service
|
| | | public class DownGlassLogic {
|
| | |
|
| | | PlcParameterObject plcread = PLCAutoMes.PlcReadObject;
|
| | | /**
|
| | | * // 机械手1PLC请求字
|
| | | */
|
| | | String robot1PLCrequestword = plcread.getPlcParameter("A01Position").getValue();
|
| | | /**
|
| | | * // 机械手2PLC请求字
|
| | | */
|
| | | String robot2PLCrequestword = plcread.getPlcParameter("A01Position").getValue();
|
| | | /**
|
| | | * // 玻璃id
|
| | | */
|
| | | String glassID = plcread.getPlcParameter("A01Position").getValue();
|
| | | String glasswidth = plcread.getPlcParameter("A01Position").getValue();
|
| | | String glassheight = plcread.getPlcParameter("A01Position").getValue();
|
| | | //
|
| | | String glassthickness = plcread.getPlcParameter("A01Position").getValue();
|
| | | String pLcwancheng = plcread.getPlcParameter("A01Position").getValue();
|
| | | @Autowired
|
| | | private DownWorkstationMapper downWorkstationMapper;
|
| | | private DownGlassInfo downGlassInfo;
|
| | | private DownWorkstation downWorkstation;
|
| | | private DownGlassInfoMapper downGlassInfoMapper;
|
| | | private DownGlassInfoService downGlassInfoService;
|
| | | /**
|
| | | * // 存放待处理的玻璃信息
|
| | | */
|
| | | private List<DownGlassInfo> glassList;
|
| | | /**
|
| | | * 存放玻璃放置在缓存笼中的详细信息
|
| | | */
|
| | | private List<DownStorageCageDetails> cageDetailsList;
|
| | |
|
| | | /**
|
| | | * //当下片任务表状态为1时候将数据插入到下片玻璃信息表
|
| | | */
|
| | |
|
| | | public void insertdownglassinfo() {
|
| | |
|
| | |
|
| | | downWorkstationMapper = WebSocketServer.applicationContext.getBean(DownWorkstationMapper.class);
|
| | | downGlassInfoService = WebSocketServer.applicationContext.getBean(DownGlassInfoService.class);
|
| | | downGlassInfoMapper = WebSocketServer.applicationContext.getBean(DownGlassInfoMapper.class);
|
| | | List<DownGlassInfo> taskdownGlassInf = downGlassInfoMapper.selectunloadingtaskstate();
|
| | | //
|
| | | if (taskdownGlassInf != null && !taskdownGlassInf.isEmpty()) {
|
| | |
|
| | | //
|
| | |
|
| | |
|
| | | for (DownGlassInfo downGlassInfo : taskdownGlassInf) {
|
| | | // 创建新的 DownGlassInfo 对象并设置相关属性
|
| | | DownGlassInfo newdownGlassInfo = new DownGlassInfo();
|
| | |
|
| | | newdownGlassInfo.setFlowCardId(downGlassInfo.getFlowCardId());
|
| | | Integer maxSequence = downGlassInfoMapper.getMaxSequenceByFlowCardId(downGlassInfo.getFlowCardId());
|
| | | // 初始化顺序字段值
|
| | | int sequence = maxSequence != null ? maxSequence + 1 : 1;
|
| | |
|
| | | newdownGlassInfo.setWidth(downGlassInfo.getWidth());
|
| | | newdownGlassInfo.setHeight(downGlassInfo.getHeight());
|
| | | newdownGlassInfo.setThickness(downGlassInfo.getThickness());
|
| | | newdownGlassInfo.setFilmsid(downGlassInfo.getFilmsid());
|
| | | // 设置顺序字段值
|
| | | newdownGlassInfo.setSequence(sequence);
|
| | |
|
| | | // 插入数据到下片玻璃信息表
|
| | | downGlassInfoMapper.insert(newdownGlassInfo);
|
| | | //插入数据到机械手任务表
|
| | | downWorkstationMapper.insertdownWorkstationtask(newdownGlassInfo);
|
| | | //更新下片任务表状态为0
|
| | | downGlassInfoMapper.updateTaskStateToZero(downGlassInfo.getFlowCardId());
|
| | |
|
| | | sequence++; // 递增顺序字段值
|
| | |
|
| | |
|
| | | }
|
| | | }
|
| | | }
|
| | |
|
| | |
|
| | | /**
|
| | | * //当机械手任务表中状态为1,工位表流程卡绑定了架子 更新已经落架数量,并且把下片任务表的对应记录删掉
|
| | | */
|
| | |
|
| | | public void downWorkstation() {
|
| | |
|
| | |
|
| | | try {
|
| | | //查询下片工位表中架子是否绑定了流程卡号 工位表和任务表中状态为1的流程卡号和已落架数量
|
| | | List<DownWorkstation> taskdownWorkstation = downWorkstationMapper.selectdownWorkstationstate();
|
| | | if (taskdownWorkstation != null && !taskdownWorkstation.isEmpty()) {
|
| | | //,如果已经绑定则更新已落架数量,并且删除下片任务表中的记录
|
| | | for (DownWorkstation downWorkstation : taskdownWorkstation) {
|
| | |
|
| | | //更新下片工位表中已落架数量
|
| | | downWorkstationMapper.update_racks_number(downWorkstation.getFlowCardId(), downWorkstation.getRacksnumber() + 1);
|
| | |
|
| | | //更新机械任务表中状态为0
|
| | | downWorkstationMapper.update_task_state_to_zero(downWorkstation.getFlowCardId());
|
| | | //删除下片任务表中的记录
|
| | | downGlassInfoMapper.deletetask(downWorkstation.getFlowCardId());
|
| | |
|
| | | }
|
| | | }
|
| | | } catch (Exception e) {
|
| | | // 打印异常信息
|
| | | e.printStackTrace();
|
| | | // 或者可以进行其他异常处理,比如记录日志或者返回特定的错误信息
|
| | | }
|
| | |
|
| | |
|
| | | }
|
| | |
|
| | |
|
| | | /**
|
| | | * @param downWorkstation // 绑定流程卡号架子
|
| | | */
|
| | |
|
| | | public void bindingshelf(DownWorkstation downWorkstation) {
|
| | | downWorkstationMapper.updateFlowCardId(downWorkstation);
|
| | | }
|
| | |
|
| | |
|
| | | /**
|
| | | * @param downWorkstation // 满架拉走 清除流程卡信息
|
| | | */
|
| | |
|
| | | public void clearFlowCardId(DownWorkstation downWorkstation) {
|
| | |
|
| | | downWorkstationMapper.clearFlowCardId(downWorkstation);
|
| | | }
|
| | |
|
| | |
|
| | | }
|
New file |
| | |
| | | package com.mes.service;
|
| | |
|
| | | import com.baomidou.dynamic.datasource.annotation.DS;
|
| | | import com.mes.entity.DownWorkstation;
|
| | | import org.springframework.beans.factory.annotation.Autowired;
|
| | | import org.springframework.stereotype.Service;
|
| | |
|
| | | import java.util.List;
|
| | | import java.util.Map;
|
| | |
|
| | | @Service
|
| | | @DS("hangzhoumes")
|
| | | public class DownWorkstationService {
|
| | | @Autowired
|
| | | private com.mes.mapper.DownWorkstationMapper DownWorkstationMapper;
|
| | |
|
| | |
|
| | | public List<DownWorkstation> getoneDownWorkstations() {
|
| | |
|
| | | return DownWorkstationMapper.getoneDownWorkstations();
|
| | | }
|
| | |
|
| | | public List<DownWorkstation> gettwoDownWorkstations() {
|
| | |
|
| | | return DownWorkstationMapper.gettwoDownWorkstations();
|
| | | }
|
| | | public List<Map<String, Object>> getflowCardId() {
|
| | |
|
| | | return DownWorkstationMapper.getflowCardId();
|
| | | }
|
| | |
|
| | |
|
| | | public int getTotalQuantity(int workstationId) {
|
| | | // 执行获取总数量的逻辑,可以是数据库查询或其他业务逻辑
|
| | | Integer totalQuantity = DownWorkstationMapper.getTotalQuantity(workstationId);
|
| | | return totalQuantity != null ? totalQuantity : 0;
|
| | | }
|
| | |
|
| | | public int getRacksNumber(int workstationId) {
|
| | | // 执行获取落架数量的逻辑,可以是数据库查询或其他业务逻辑
|
| | | Integer racksNumber = DownWorkstationMapper.getRacksNumber(workstationId);
|
| | | return racksNumber != null ? racksNumber : 0;
|
| | | }
|
| | |
|
| | | public void clearFlowCardId(int workstationId) {
|
| | | // 执行清除指定工位ID的流程卡信息的逻辑,可以是数据库操作或其他业务逻辑
|
| | | // 判断如果落架数量等于总数量执行清除,否则不执行
|
| | | DownWorkstationMapper.clearFlowCardInfoByWorkstationId(workstationId);
|
| | | }
|
| | |
|
| | |
|
| | |
|
| | |
|
| | |
|
| | |
|
| | | }
|
New file |
| | |
| | | package com.mes.service;
|
| | |
|
| | | import com.mes.mapper.GlassInfoMapper;
|
| | | import org.springframework.beans.factory.annotation.Autowired;
|
| | | import org.springframework.stereotype.Service;
|
| | |
|
| | | @Service
|
| | | public class GlassInfoService {
|
| | |
|
| | | @Autowired
|
| | | private GlassInfoMapper glassInfoMapper;
|
| | |
|
| | | public int getGlassInfoCountByFlowCardId(String flowCardId) {
|
| | | return glassInfoMapper.getGlassInfoCountByFlowCardId(flowCardId);
|
| | | }
|
| | |
|
| | | public void updateFlowCardIdAndCount(String flowCardId, int glassInfoCount,int workstationId) {
|
| | | // 调用 GlassInfoMapper 的 updateFlowCardIdAndCount 方法
|
| | | int rowsAffected = glassInfoMapper.updateFlowCardIdAndCount(flowCardId, glassInfoCount,workstationId);
|
| | | if (rowsAffected > 0) {
|
| | | System.out.println("更新架子上流程卡 ID 和数量成功");
|
| | | } else {
|
| | | System.out.println("更新架子上流程卡 ID 和数量失败");
|
| | | }
|
| | | }
|
| | |
|
| | | // 这里可以添加其他业务逻辑方法
|
| | | }
|
| | |
| | |
|
| | | public ModuleA(String QUEUENAME) {
|
| | | QUEUE_NAME = QUEUENAME;
|
| | | receiver = new RabbitMQUtils(); // 实例化 RabbitMQUtils 对象
|
| | | // 实例化 RabbitMQUtils 对象
|
| | | receiver = new RabbitMQUtils();
|
| | | }
|
| | |
|
| | | public static void main(String[] argv) throws Exception {
|
| | |
| | | // String message = "Your message to send666";
|
| | | // String messageId = "5"; // 消息ID
|
| | | // receiver.sendMessageWithId(QUEUE_NAME, message, messageId); // 调用 sendMessageWithId 方法发送消息
|
| | | receiver.sendMessageWithId("hangzhou2", "Hello RabbitMQ!", "1");
|
| | | receiver.sendMessageWithId("hangzhou2", "Another message", "2");
|
| | | receiver.sendMessageWithId("hangzhou2", "Another message", "3");
|
| | | receiver.sendMessageWithId("hangzhou2", "Another message", "4");
|
| | | receiver.sendMessageWithId("hangzhou2", "Another message", "5");
|
| | | RabbitMQUtils.sendMessageWithId("hangzhou2", "Hello RabbitMQ!", "1");
|
| | | RabbitMQUtils.sendMessageWithId("hangzhou2", "Another message", "2");
|
| | | RabbitMQUtils.sendMessageWithId("hangzhou2", "Another message", "3");
|
| | | RabbitMQUtils.sendMessageWithId("hangzhou2", "Another message", "4");
|
| | | RabbitMQUtils.sendMessageWithId("hangzhou2", "Another message", "5");
|
| | | // receiver.sendMessageWithId("hangzhou2", "Yet another message", "1"); // 这条消息会打印重复消息的错误信息
|
| | |
|
| | | }
|
| | |
| | | //receiver.consumeMessageById("5",QUEUE_NAME);
|
| | |
|
| | | // String receivedMessage = receiver.consumeSelectedMessage(1,QUEUE_NAME);
|
| | | List<String> receivedMessage = receiver.browseMessages(QUEUE_NAME);
|
| | | List<String> receivedMessage = RabbitMQUtils.browseMessages(QUEUE_NAME);
|
| | | System.out.println("Received message: " + receivedMessage);
|
| | | } catch (Exception e) {
|
| | | e.printStackTrace();
|
| | |
| | | package com.mes.service;
|
| | |
|
| | | import cn.hutool.json.JSONObject;
|
| | | import com.mes.tools.WebSocketServer;
|
| | | import org.springframework.stereotype.Component;
|
| | |
|
| | | import org.apache.logging.log4j.LogManager;
|
| | | import org.apache.logging.log4j.Logger;
|
| | | import java.util.ArrayList;
|
| | | import java.util.function.Supplier;
|
| | |
|
| | | @Component
|
| | | public class Plchome extends Thread {
|
| | | private int i = 1;
|
| | | private final Supplier<PlcService> plcServiceSupplier;
|
| | | private static final Logger log = LogManager.getLogger(Plchome.class);
|
| | |
|
| | | private final Supplier<DownGlassLogic> plcServiceSupplier;
|
| | |
|
| | | public Plchome() {
|
| | | this.plcServiceSupplier = () -> WebSocketServer.applicationContext.getBean(PlcService.class);
|
| | | this.plcServiceSupplier = () -> WebSocketServer.applicationContext.getBean(DownGlassLogic.class);
|
| | | }
|
| | |
|
| | |
|
| | |
| | | try {
|
| | | i++;
|
| | | Thread.sleep(100);
|
| | | PlcService plcService = plcServiceSupplier.get();
|
| | | DownGlassLogic plcService = plcServiceSupplier.get();
|
| | | // plcService.performPlcActions();
|
| | | //plcService.unloadpush();
|
| | |
|
| | |
| | |
|
| | |
|
| | | //当机械手任务表中状态为1 更新已经落架数量,并且把下片任务表的那条记录删掉 工位表流程卡绑定了架子
|
| | | plcService.down_workstation();
|
| | | plcService.downWorkstation();
|
| | |
|
| | |
|
| | | } catch (InterruptedException e) {
|
| | | Thread.currentThread().interrupt();
|
| | | e.printStackTrace();
|
| | | }
|
| | |
|
| | | JSONObject jsonObject = new JSONObject();
|
| | | // System.out.println(arraylist6);
|
| | | jsonObject.append("data", 1);
|
| | | ArrayList<WebSocketServer> sendwServer = WebSocketServer.sessionMap.get("unloadglass");
|
| | | if (sendwServer != null) {
|
| | | for (WebSocketServer webserver : sendwServer) {
|
| | | webserver.sendMessage(jsonObject.toString());
|
| | | log.info("准备向 WebSocket 服务器发送消息: {}", jsonObject.toString());
|
| | | }}
|
| | |
|
| | | }
|
| | | }
|
| | | }
|
| | |
| | | import java.io.InputStream;
|
| | | import java.util.Properties;
|
| | |
|
| | | // Configuration 类用于加载配置文件并提供访问配置项的方法。
|
| | | /**
|
| | | * @author SNG-012
|
| | | *
|
| | | * Configuration 类用于加载配置文件并提供访问配置项的方法。
|
| | | */
|
| | | public class Configuration {
|
| | | private Properties properties; // Properties 对象,用于存储配置文件中的键值对。
|
| | |
|
| | | // 构造函数,根据传入的文件名加载配置文件。
|
| | | /**
|
| | | * // Properties 对象,用于存储配置文件中的键值对。
|
| | | */
|
| | | private Properties properties;
|
| | |
|
| | | /**
|
| | | * @param fileName
|
| | | * @throws IOException
|
| | | * // 构造函数,根据传入的文件名加载配置文件。
|
| | | */
|
| | |
|
| | | public Configuration(String fileName) throws IOException {
|
| | | // 使用类加载器获取资源文件的输入流。
|
| | | InputStream inputStream = getClass().getClassLoader().getResourceAsStream(fileName);
|
| | |
| | | if (inputStream == null) {
|
| | | throw new FileNotFoundException("Property file '" + fileName + "' not found in the classpath");
|
| | | }
|
| | | properties = new Properties(); // 实例化Properties对象。
|
| | | properties.load(inputStream); // 从输入流加载配置项。
|
| | | // 实例化Properties对象。
|
| | | properties = new Properties();
|
| | | // 从输入流加载配置项。
|
| | | properties.load(inputStream);
|
| | | }
|
| | |
|
| | | // 根据配置项的键获取其对应的值。
|
| | | /**
|
| | | * @param key
|
| | | * @return
|
| | | * // 根据配置项的键获取其对应的值。
|
| | | */
|
| | |
|
| | | public String getProperty(String key) {
|
| | | return properties.getProperty(key);
|
| | | }
|
| | |
| | | public void clearMessages() { |
| | | messages.clear(); |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | } |
| | |
| | | primary: hangzhoumes #设置默认的数据源或者数据源组,默认值即为master |
| | | strict: false #设置严格模式,默认false不启动. 启动后在未匹配到指定数据源时候回抛出异常,不启动会使用默认数据源. |
| | | datasource: |
| | | |
| | | hangzhoumes: |
| | | url: jdbc:mysql://10.153.19.150:3306/hangzhoumes?serverTimezone=GMT%2b8 |
| | | username: root |
| | |
| | | primary: hangzhoumes #设置默认的数据源或者数据源组,默认值即为master |
| | | strict: false #设置严格模式,默认false不启动. 启动后在未匹配到指定数据源时候回抛出异常,不启动会使用默认数据源. |
| | | datasource: |
| | | |
| | | hangzhoumes: |
| | | url: jdbc:mysql://10.153.19.150:3306/hangzhoumes?serverTimezone=GMT%2b8 |
| | | username: root |