Merge branch 'master' of http://10.153.19.25:10101/r/HangZhouMes
# Conflicts:
# UI-Project/src/router/index.js
8个文件已修改
1 文件已重命名
162个文件已添加
18个文件已删除
| | |
| | | package com.mes; |
| | | |
| | | import com.mes.common.PlcTools.S7object; |
| | | import com.mes.mapper.SelectInfo; |
| | | import com.mes.mapper.PpMapper; |
| | | |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.boot.SpringApplication; |
| | |
| | | package com.mes.controller; |
| | | |
| | | import com.mes.mapper.SelectInfo; |
| | | import com.mes.mapper.PpMapper; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | |
| | | import org.springframework.web.bind.annotation.*; |
| | | import com.mes.common.Result; |
| | | import com.mes.entity.Tempered; |
| | | import com.mes.service.pp.SelectdppService; |
| | | import com.mes.service.pp.PpService; |
| | | import com.mes.service.hangzhoumes.*; |
| | | |
| | | @RestController |
| | |
| | | |
| | | // TidyUpGlassModule 理片模块 |
| | | public class TidyUpGlassModuleController { |
| | | @Autowired |
| | | private SelectInfo SelectInfo; |
| | | |
| | | |
| | | @Autowired |
| | | private SelectdppService SelectppService; |
| | | private PpService ppService; |
| | | |
| | | @Autowired |
| | | private hangzhoumesService hangzhoumesService; |
| | | private HangzhoumesService hangzhoumesService; |
| | | |
| | | @GetMapping("/SelectTerritoryInfo") // 查询钢化版图信息-根据 工程号 |
| | | @ResponseBody |
| | | public Result SelectTerritoryInfo(@RequestParam(name = "ProcessId", required = false) String ProcessId) { |
| | | List<Tempered> h = SelectppService.SelectTemperedTerritory(ProcessId); |
| | | System.out.println(h.size()+":"+ProcessId); |
| | | List<Tempered> h = ppService.selectTemperedTerritory(ProcessId); |
| | | return Result.seccess(h); |
| | | } |
| | | |
| | | @GetMapping("/CutTerritory") // 查询切割版图信息-根据 工程号 |
| | | @ResponseBody |
| | | public Result CutTerritory(String ProcessId) { |
| | | List<Map> h = SelectppService.SelectCutTerritory(ProcessId); |
| | | System.out.println(h.size()); |
| | | List<Map> h = ppService.selectCutTerritory(ProcessId); |
| | | return Result.seccess(h); |
| | | } |
| | | |
| | | @GetMapping("/SelectCutTerritory") // 识别显示 当前版图 |
| | | @GetMapping("/CurrentCutTerritory") // 识别显示 当前版图 |
| | | @ResponseBody |
| | | public Result SelectCutTerritory(String ProcessId) { |
| | | List<Map> h = SelectppService.SelectCutTerritory("P24032508"); |
| | | System.out.println(h.size()); |
| | | public Result CurrentCutTerritory() { |
| | | List<Map> h = ppService.selectCutTerritory(); |
| | | return Result.seccess(h); |
| | | } |
| | | |
| | | @GetMapping("/SelectCutTerritory") // 识别显示 特定版图 |
| | | @ResponseBody |
| | | public Result SelectCutTerritory(String TerritoryId) { |
| | | List<Map> h = ppService.selectCutTerritory(TerritoryId); |
| | | return Result.seccess(h); |
| | | } |
| | | |
| | | @GetMapping("/IdentControls") // 识别操作: 破损/拿走 参数(ID,功能[0:破损,1:拿走]) |
| | | @ResponseBody |
| | | public Result Ident(@RequestParam(name = "IdentId", required = false) String ProcessId,@RequestParam(name = "ControlsId", required = false) String ControlsId) { |
| | | List<Map> h = ppService.selectCutTerritory("P24032508"); |
| | | return Result.seccess(h); |
| | | } |
| | | |
| | | @GetMapping("/SelectCageInfo") // 查询笼内信息 |
| | | @ResponseBody |
| | | public Result SelectCageInfo(String ProcessId) { |
| | | List<Map> h = SelectppService.SelectCutTerritory("P24032508"); |
| | | System.out.println(h.size()); |
| | | List<Map> h = hangzhoumesService.SelectCageInfo(); |
| | | return Result.seccess(h); |
| | | } |
| | | |
| | |
| | | @ResponseBody |
| | | public Result SelectEdgTask(String ProcessId) { |
| | | List<Map> EdgTasks = hangzhoumesService.SelectEdgInfo("1"); |
| | | System.out.println(EdgTasks.size()); |
| | | return Result.seccess(EdgTasks); |
| | | } |
| | | |
| | |
| | | import com.mes.entity.EdgStorageCageDetails; |
| | | import com.mes.entity.GlassInfo; |
| | | import com.mes.entity.Tempered; |
| | | import com.mes.mapper.SelectInfo; |
| | | import com.mes.mapper.HangzhouMesMapper; |
| | | import com.mes.mapper.PpMapper; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | |
| | | import java.util.Map; |
| | | |
| | | @Service |
| | | @DS("hangzhoumes") |
| | | public class hangzhoumesService { |
| | | public class HangzhoumesService { |
| | | |
| | | @Autowired |
| | | private SelectInfo SelectInfo; |
| | | |
| | | private HangzhouMesMapper hangzhouMesMapper; |
| | | //根据编号 查找玻璃小片信息 |
| | | public GlassInfo getUserInfo(String process_id){ |
| | | return SelectInfo.SelectGlassId(process_id); |
| | | return hangzhouMesMapper.selectGlassId(process_id); |
| | | } |
| | | // //识别信息 |
| | | // public List<Map> SelectCutTerritory(String process_id){ |
| | | // return SelectInfo.SelectCutTerritory(process_id); |
| | | // } |
| | | |
| | | //理片缓存 笼内信息 |
| | | public List<EdgStorageCageDetails> SelectCageInfo(){ |
| | | return SelectInfo.SelectCachInfo(); |
| | | public List<Map> SelectCageInfo(){ |
| | | return hangzhouMesMapper.selectCachInfo(); |
| | | } |
| | | |
| | | //磨边小片信息 |
| | | public List<Map> SelectEdgInfo(String line){ |
| | | |
| | | return SelectInfo.SelectEdgInfo(line); |
| | | return hangzhouMesMapper.selectEdgInfo(line); |
| | | } |
| | | |
| | | |
| | | } |
| | | |
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("/SelectAll") //查询现在上片机的玻璃信息 |
| | | @ResponseBody |
| | | public Result SelectGlassInfo() { |
| | | List<UpWorkstation> glass = loadGlassService.selectAll(); |
| | | System.out.println(glass); |
| | | return Result.seccess(glass); |
| | | } |
| | | |
| | | @PostMapping("/insertGlass") //修改一条工位信息,接收实例类字段为宽高厚膜系数量工位id |
| | | @ResponseBody |
| | | public void insertGlassinfo(@RequestBody UpWorkstation upwork) { |
| | | loadGlassService.insertGlass(upwork); |
| | | |
| | | } |
| | | |
| | | @PostMapping("/deleteGlass") //修改一条工位的玻璃信息,传输工位id将玻璃信息相关字段更改为null |
| | | @ResponseBody |
| | | public void SelectCutTerritory(int upworkid) { |
| | | loadGlassService.deleteGlass(upworkid); |
| | | } |
| | | |
| | | @PostMapping("/selectPriority") //开始上片任务 |
| | | @ResponseBody |
| | | public void selectPriority() { |
| | | boolean result = loadGlassService.isCanLoadGlass(); |
| | | if(result==true){ |
| | | loadGlassService.selectPriority(); |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | } |
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; |
| | | |
| | | |
| | | |
| | | 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; |
| | | } |
| | | |
| | | |
| | | } |
| | |
| | | public interface LoadGlassMapper extends BaseMapper<UpWorkstation> { |
| | | //显示目前工位玻璃信息 |
| | | @Select("SELECT * FROM up_workstation") |
| | | List<UpWorkstation> SelectALL(); |
| | | List<UpWorkstation> selectALL(); |
| | | //删除工位的玻璃信息 |
| | | @Delete("DELETE FROM up_workstation where workstation_id=#{id}") |
| | | @Update("UPDATE `hangzhoumes`.`up_workstation` SET `pattern_width` =NULL, `pattern_heigth` = NULL, `pattern_thickness` = NULL, `films_id` = NULL, `number` = NULL WHERE `workstation_id`=#{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 insertGlass(Double patternwidth,Double patternheigth,Double patternthickness,int workstationid); |
| | | @Update ("UPDATE `hangzhoumes`.`up_workstation` SET `pattern_width` = #{upwork.patternwidth}, `pattern_heigth` = #{upwork.patternheigth}, `pattern_thickness` =#{upwork.patternthickness}, `films_id` =#{upwork.filmsid}, `number` = #{upwork.number} WHERE `id` = #{upwork.workstationid}; ") |
| | | void insertGlass(UpWorkstation upwork); |
| | | //是否发起吸片 |
| | | @Select("SELECT * FROM up_workstation where workstation_id=#{id}") |
| | | UpWorkstation SelectAdd(int 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); |
| | | int selectPriority(int id); |
| | | |
| | | } |
| | |
| | | PlcParameterObject plcmes=PLCAutoMes.PlcMesObject; |
| | | //显示工位上的玻璃信息 |
| | | public List<UpWorkstation> selectAll() { |
| | | List<UpWorkstation> glassInfo= LoadGlassMapper.SelectALL(); |
| | | List<UpWorkstation> glassInfo= LoadGlassMapper.selectALL(); |
| | | return glassInfo; |
| | | } |
| | | //增加人工输入的工位玻璃信息 |
| | | public void insertGlass(UpWorkstation upwork) { |
| | | LoadGlassMapper.insertGlass(upwork.getPatternwidth(),upwork.getPatternheigth(),upwork.getPatternthickness(),1); |
| | | LoadGlassMapper.insertGlass(upwork.getPatternwidth(),upwork.getPatternheigth(),upwork.getPatternthickness(),upwork.getWorkstationid()); |
| | | } |
| | | //删除人工搬走的玻璃信息 |
| | | public void deleteGlass(int id) { |
| | |
| | | } |
| | | |
| | | } |
| | | //判断优先吸片位置 |
| | | public int selectPriority() { |
| | | int loadid1=LoadGlassMapper.SelectPriority(1); |
| | | int loadid2=LoadGlassMapper.SelectPriority(2); |
| | | //判断优先吸片位置后发送出片任务 |
| | | public void selectPriority() { |
| | | int loadid1=LoadGlassMapper.selectPriority(1); |
| | | int loadid2=LoadGlassMapper.selectPriority(2); |
| | | //判断一二号工位哪边的顺序更先 |
| | | if(loadid1>loadid2) { |
| | | return 1; |
| | | 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{ |
| | | return 2; |
| | | s7control.WriteWord("DB100.10", (short)1); |
| | | } |
| | | } |
| | | |
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("/SelectWaitingGlass") // 查询钢化等片中的版图信息,状态为1的为已到,状态为0的为等待中 |
| | | @ResponseBody |
| | | public Result SelectWaitingGlass(@RequestParam(name = "ProcessId", required = false) String ProcessId) { |
| | | List<Tempering> glass = temperingService.SelectWaitingGlass(); |
| | | System.out.println(glass); |
| | | return Result.seccess(glass); |
| | | } |
| | | |
| | | @GetMapping("/SelectIntoGlass") // 查询进炉中的钢化等片中的版图信息,状态全为1的为已到。 |
| | | @ResponseBody |
| | | public Result SelectIntoGlass(String ProcessId) { |
| | | List<Tempering> glass = temperingService.SelectIntoGlass(); |
| | | System.out.println(glass); |
| | | return Result.seccess(glass); |
| | | } |
| | | |
| | | @GetMapping("/SelectOutGlass") //钢化后显示出炉的版图信息 |
| | | @ResponseBody |
| | | public Result SelectOutGlass(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; |
| | | |
| | | |
| | | |
| | | 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; |
| | | } |
| | | |
| | | |
| | | } |
| | |
| | | children:[ |
| | | |
| | | |
| | | { |
| | | path: 'Temperedlayout', |
| | | name: 'Temperedlayout', |
| | | component: () => import('../views/TL/Temperedlayout/Temperedlayout.vue'), |
| | | children:[ |
| | | { |
| | | path: 'selectLayout', |
| | | name: 'selectLayout', |
| | | component: () => import('../views/TL/Temperedlayout/SelectLayout.vue'), |
| | | } |
| | | ] |
| | | }, |
| | | |
| | | /*----------- 上片机 ----------------*/ |
| | | { |
| | |
| | | } |
| | | ] |
| | | }, |
| | | /*----------- 用户管理 ----------------*/ |
| | | // { |
| | | // path: 'User', |
| | | // name: 'userlist', |
| | | // component: () => import('../views/User/userlist.vue'), |
| | | // children:[ |
| | | // { |
| | | // path: '/User/userlist', |
| | | // name: 'userlist', |
| | | // component: () => import('../views/User/userlist.vue') |
| | | // }, |
| | | // ] |
| | | // }, |
| | | // /*----------- 权限管理 ----------------*/ |
| | | // { |
| | | // path: 'Permissions', |
| | | // name: 'permissionslist', |
| | | // component: () => import('../views/Permissions/permissionslist.vue'), |
| | | // children:[ |
| | | // { |
| | | // path: '/Permissions/permissionslist', |
| | | // name: 'permissionslist', |
| | | // component: () => import('../views/Permissions/permissionslist.vue') |
| | | // }, |
| | | // ] |
| | | // }, |
| | | { |
| | | path: '', |
| | | redirect:'/Slicecage/slicecage' |
| | |
| | | <div style="margin-left: 150px;font-size: 20px;">版图编号:1</div> |
| | | </div> |
| | | <div> |
| | | <div id="boxa" style="width: 700px;height: 220px;margin-left: 300px;"> |
| | | <div id="boxa" style="width: 700px;height: 220px;margin-left: 260px;"> |
| | | <div style="margin-top: 85px;"> NG202405060798A01-1</div> |
| | | <div> 500×1500</div> |
| | | </div> |
| | |
| | | </div> |
| | | </el-card> |
| | | <div id="parent"> |
| | | <img src="../../assets/shangpianji .png" alt="" style="max-width: 20%;max-height: 20%;margin-top: 20px;margin-left: 510px;"> |
| | | <img src="../../assets/shangpianji .png" alt="" style="max-width: 20%;max-height: 20%;margin-top: 20px;margin-left: 130px;"> |
| | | <el-button style="margin-top: -830px;margin-left: -40px;" size="mini" id="searchButton" @click="add = true">添加原片</el-button> |
| | | <el-button style="margin-top: -10px;margin-left: -80px;" size="mini" id="searchButton" @click="adda = true">添加原片</el-button> |
| | | <!-- <div id="overlay" v-show="state"></div> --> |
| | |
| | | } |
| | | #parent{ |
| | | position: relative; |
| | | /* margin-left: 250px; */ |
| | | } |
| | | #overlay{ |
| | | position: absolute; |
New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <project xmlns="http://maven.apache.org/POM/4.0.0" |
| | | xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" |
| | | xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> |
| | | <parent> |
| | | <artifactId>hangzhoumesParent</artifactId> |
| | | <groupId>com.mes</groupId> |
| | | <version>1.0-SNAPSHOT</version> |
| | | </parent> |
| | | <modelVersion>4.0.0</modelVersion> |
| | | |
| | | <artifactId>common</artifactId> |
| | | <packaging>pom</packaging> |
| | | <modules> |
| | | <module>servicebase</module> |
| | | <!-- <module>springsecurity</module>--> |
| | | </modules> |
| | | <properties> |
| | | <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> |
| | | </properties> |
| | | <dependencies> |
| | | |
| | | <dependency> |
| | | <groupId>com.alibaba.cloud</groupId> |
| | | <artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId> |
| | | </dependency> |
| | | |
| | | <dependency> |
| | | <groupId>org.springframework.boot</groupId> |
| | | <artifactId>spring-boot-starter-web</artifactId> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>org.springframework.cloud</groupId> |
| | | <artifactId>spring-cloud-starter-openfeign</artifactId> |
| | | </dependency> |
| | | |
| | | <dependency> |
| | | <groupId>org.springframework.boot</groupId> |
| | | <artifactId>spring-boot-starter-test</artifactId> |
| | | <scope>test</scope> |
| | | </dependency> |
| | | <!-- mybatis-plus--> |
| | | <dependency> |
| | | <groupId>com.baomidou</groupId> |
| | | <artifactId>mybatis-plus-boot-starter</artifactId> |
| | | <version>3.2.0</version> |
| | | </dependency> |
| | | |
| | | <dependency> |
| | | <groupId>org.projectlombok</groupId> |
| | | <artifactId>lombok</artifactId> |
| | | <version>1.18.8</version> |
| | | </dependency> |
| | | |
| | | <!-- https://mvnrepository.com/artifact/org.apache.httpcomponents/httpcore --> |
| | | <dependency> |
| | | <groupId>org.apache.httpcomponents</groupId> |
| | | <artifactId>httpcore</artifactId> |
| | | <version>4.4.12</version> |
| | | </dependency> |
| | | |
| | | |
| | | <dependency> |
| | | <groupId>commons-lang</groupId> |
| | | <artifactId>commons-lang</artifactId> |
| | | <version>2.6</version> |
| | | </dependency> |
| | | |
| | | <!-- 导入mysql驱动 --> |
| | | <!-- https://mvnrepository.com/artifact/mysql/mysql-connector-java --> |
| | | <dependency> |
| | | <groupId>mysql</groupId> |
| | | <artifactId>mysql-connector-java</artifactId> |
| | | <version>8.0.17</version> |
| | | </dependency> |
| | | |
| | | <dependency> |
| | | <groupId>javax.servlet</groupId> |
| | | <artifactId>servlet-api</artifactId> |
| | | <version>2.5</version> |
| | | <scope>provided</scope> |
| | | </dependency> |
| | | |
| | | <dependency> |
| | | <groupId>javax.validation</groupId> |
| | | <artifactId>validation-api</artifactId> |
| | | <version>2.0.1.Final</version> |
| | | </dependency> |
| | | |
| | | <!--代码生成工具--> |
| | | <dependency> |
| | | <groupId>com.baomidou</groupId> |
| | | <artifactId>mybatis-plus-generator</artifactId> |
| | | <version>3.4.1</version> |
| | | </dependency> |
| | | |
| | | <dependency> |
| | | <groupId>org.apache.velocity</groupId> |
| | | <artifactId>velocity-engine-core</artifactId> |
| | | <version>2.0</version> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>com.alibaba</groupId> |
| | | <artifactId>druid</artifactId> |
| | | <version>1.1.8</version> |
| | | </dependency> |
| | | |
| | | <!-- 数据库文档--> |
| | | <dependency> |
| | | <groupId>com.alibaba</groupId> |
| | | <artifactId>fastjson</artifactId> |
| | | <version>1.2.60</version> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>org.apache.poi</groupId> |
| | | <artifactId>poi</artifactId> |
| | | <version>3.17</version> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>org.apache.poi</groupId> |
| | | <artifactId>poi-ooxml</artifactId> |
| | | <version>3.17</version> |
| | | </dependency> |
| | | |
| | | <!-- 数据库设计文档生成工具--> |
| | | <dependency> |
| | | <groupId>cn.smallbun.screw</groupId> |
| | | <artifactId>screw-core</artifactId> |
| | | <version>1.0.5</version> |
| | | </dependency> |
| | | <!-- 2.0~2.2 Knife4j 2.0.0 ~ 2.0.6--> |
| | | <!-- <dependency>--> |
| | | <!-- <groupId>com.github.xiaoymin</groupId>--> |
| | | <!-- <artifactId>knife4j-spring-boot-starter</artifactId>--> |
| | | <!-- <version>2.0.6</version>--> |
| | | <!-- </dependency>--> |
| | | |
| | | <dependency> |
| | | <groupId>io.springfox</groupId> |
| | | <artifactId>springfox-swagger2</artifactId> |
| | | <version>2.7.0</version> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>io.springfox</groupId> |
| | | <artifactId>springfox-swagger-ui</artifactId> |
| | | <version>2.7.0</version> |
| | | </dependency> |
| | | |
| | | |
| | | <!--jwt 项目生成token--> |
| | | <dependency> |
| | | <groupId>com.auth0</groupId> |
| | | <artifactId>java-jwt</artifactId> |
| | | <version>3.10.3</version> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>org.assertj</groupId> |
| | | <artifactId>assertj-core</artifactId> |
| | | </dependency> |
| | | <!--hutool java验证方法类--> |
| | | <dependency> |
| | | <groupId>cn.hutool</groupId> |
| | | <artifactId>hutool-all</artifactId> |
| | | <version>5.4.0</version> |
| | | </dependency> |
| | | |
| | | <dependency> |
| | | <groupId>com.github.xingshuangs</groupId> |
| | | <artifactId>iot-communication</artifactId> |
| | | <version>1.4.2</version> |
| | | </dependency> |
| | | |
| | | <dependency> |
| | | <groupId>org.springframework.boot</groupId> |
| | | <artifactId>spring-boot-starter-data-redis</artifactId> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>org.springframework.session</groupId> |
| | | <artifactId>spring-session-data-redis</artifactId> |
| | | </dependency> |
| | | |
| | | <dependency> |
| | | <groupId>org.springframework.boot</groupId> |
| | | <artifactId>spring-boot-starter-security</artifactId> |
| | | </dependency> |
| | | </dependencies> |
| | | |
| | | |
| | | </project> |
New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <project xmlns="http://maven.apache.org/POM/4.0.0" |
| | | xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" |
| | | xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> |
| | | <parent> |
| | | <artifactId>common</artifactId> |
| | | <groupId>com.mes</groupId> |
| | | <version>1.0-SNAPSHOT</version> |
| | | </parent> |
| | | <modelVersion>4.0.0</modelVersion> |
| | | |
| | | <artifactId>servicebase</artifactId> |
| | | |
| | | <properties> |
| | | <maven.compiler.source>8</maven.compiler.source> |
| | | <maven.compiler.target>8</maven.compiler.target> |
| | | </properties> |
| | | |
| | | </project> |
New file |
| | |
| | | package com.mes.common.config; |
| | | |
| | | import com.mes.common.interceptor.JwtInterceptor; |
| | | import org.springframework.context.annotation.Configuration; |
| | | import org.springframework.web.servlet.config.annotation.InterceptorRegistry; |
| | | import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; |
| | | |
| | | import javax.annotation.Resource; |
| | | |
| | | @Configuration |
| | | |
| | | public class InterceptorConfig implements WebMvcConfigurer { |
| | | @Resource |
| | | private JwtInterceptor jwtInterceptor; |
| | | @Override |
| | | public void addInterceptors(InterceptorRegistry registry) { |
| | | registry.addInterceptor(jwtInterceptor) |
| | | .addPathPatterns("/**") |
| | | .excludePathPatterns("/user/login", |
| | | "/user/register", |
| | | "/swagger-resources/**" |
| | | ,"/webjars/**" |
| | | ,"/v2/**" |
| | | ,"/swagger-ui.html/**" |
| | | ,"/swagger-ui.html#/**"); |
| | | } |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.mes.common.config; |
| | | |
| | | import org.springframework.context.annotation.Bean; |
| | | import org.springframework.context.annotation.Configuration; |
| | | import org.springframework.web.servlet.config.annotation.CorsRegistry; |
| | | import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; |
| | | |
| | | /** |
| | | * @Author : zhoush |
| | | * @Date: 2024/3/25 14:13 |
| | | * @Description: |
| | | */ |
| | | @Configuration |
| | | public class MyCorsConfig { |
| | | |
| | | @Bean |
| | | public WebMvcConfigurer corsConfigurer() { |
| | | return new WebMvcConfigurer() { |
| | | @Override |
| | | public void addCorsMappings(CorsRegistry registry) { |
| | | registry.addMapping("/**"); |
| | | } |
| | | }; |
| | | } |
| | | } |
New file |
| | |
| | | package com.mes.common.config; |
| | | |
| | | import com.alibaba.druid.pool.DruidDataSource; |
| | | import com.baomidou.mybatisplus.annotation.DbType; |
| | | import com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor; |
| | | import com.baomidou.mybatisplus.extension.plugins.inner.PaginationInnerInterceptor; |
| | | import org.apache.ibatis.session.SqlSessionFactory; |
| | | import org.mybatis.spring.SqlSessionFactoryBean; |
| | | import org.mybatis.spring.annotation.MapperScan; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.boot.autoconfigure.jdbc.DataSourceProperties; |
| | | import org.springframework.context.annotation.Bean; |
| | | import org.springframework.context.annotation.Configuration; |
| | | |
| | | import javax.annotation.Resource; |
| | | import javax.sql.DataSource; |
| | | |
| | | |
| | | /** |
| | | * @author zhoush |
| | | * @Date 2024/1/26 13:44 |
| | | */ |
| | | |
| | | @MapperScan(basePackages = "com.mes.*.mapper") |
| | | @Configuration |
| | | public class MybatisPlusConfig { |
| | | |
| | | /** |
| | | * 添加分页插件 |
| | | */ |
| | | @Bean |
| | | public MybatisPlusInterceptor mybatisPlusInterceptor() { |
| | | MybatisPlusInterceptor interceptor = new MybatisPlusInterceptor(); |
| | | interceptor.addInnerInterceptor(new PaginationInnerInterceptor(DbType.MYSQL)); |
| | | return interceptor; |
| | | } |
| | | |
| | | @Resource |
| | | private DataSourceProperties dataSourceProperties; |
| | | |
| | | |
| | | @Bean(name = "dataSource") |
| | | public DataSource dataSource() { |
| | | |
| | | DruidDataSource dataSource = new DruidDataSource(); |
| | | dataSource.setUrl(dataSourceProperties.getUrl()); |
| | | dataSource.setDriverClassName(dataSourceProperties.getDriverClassName()); |
| | | dataSource.setUsername(dataSourceProperties.getUsername()); |
| | | dataSource.setPassword(dataSourceProperties.getPassword()); |
| | | |
| | | return dataSource; |
| | | |
| | | } |
| | | |
| | | public SqlSessionFactory sqlSessionFactory() throws Exception { |
| | | SqlSessionFactoryBean sqlSessionFactoryBean = new SqlSessionFactoryBean(); |
| | | sqlSessionFactoryBean.setDataSource(dataSource()); |
| | | return sqlSessionFactoryBean.getObject(); |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.mes.common.config; |
| | | |
| | | import com.fasterxml.jackson.annotation.JsonAutoDetect; |
| | | import com.fasterxml.jackson.annotation.PropertyAccessor; |
| | | import com.fasterxml.jackson.databind.ObjectMapper; |
| | | import org.springframework.context.annotation.Bean; |
| | | import org.springframework.context.annotation.Configuration; |
| | | import org.springframework.data.redis.connection.RedisConnectionFactory; |
| | | import org.springframework.data.redis.core.RedisTemplate; |
| | | import org.springframework.data.redis.serializer.Jackson2JsonRedisSerializer; |
| | | import org.springframework.data.redis.serializer.RedisSerializer; |
| | | import org.springframework.data.redis.serializer.StringRedisSerializer; |
| | | |
| | | /** |
| | | * @Author : zhoush |
| | | * @Date: 2024/4/8 16:04 |
| | | * @Description: |
| | | */ |
| | | @Configuration |
| | | public class RedisTemplateConfig { |
| | | @Bean |
| | | public RedisTemplate<String, Object> redisTemplate(RedisConnectionFactory factory) { |
| | | RedisTemplate<String, Object> template = new RedisTemplate<>(); |
| | | RedisSerializer<String> redisSerializer = new StringRedisSerializer(); |
| | | Jackson2JsonRedisSerializer jackson2JsonRedisSerializer = new Jackson2JsonRedisSerializer(Object.class); |
| | | ObjectMapper om = new ObjectMapper(); |
| | | om.setVisibility(PropertyAccessor.ALL, JsonAutoDetect.Visibility.ANY); |
| | | om.enableDefaultTyping(ObjectMapper.DefaultTyping.NON_FINAL); |
| | | jackson2JsonRedisSerializer.setObjectMapper(om); |
| | | template.setConnectionFactory(factory); |
| | | //key序列化方式 |
| | | template.setKeySerializer(redisSerializer); |
| | | //value序列化 |
| | | template.setValueSerializer(jackson2JsonRedisSerializer); |
| | | //value hashmap序列化 |
| | | template.setHashValueSerializer(jackson2JsonRedisSerializer); |
| | | return template; |
| | | } |
| | | } |
New file |
| | |
| | | package com.mes.common.config; |
| | | |
| | | import com.alibaba.fastjson.support.spring.GenericFastJsonRedisSerializer; |
| | | import org.springframework.context.annotation.Bean; |
| | | import org.springframework.context.annotation.Configuration; |
| | | import org.springframework.data.redis.serializer.RedisSerializer; |
| | | |
| | | /** |
| | | * @Author : zhoush |
| | | * @Date: 2024/4/1 13:16 |
| | | * @Description:spring session 使用 json 序列化机制 |
| | | */ |
| | | @Configuration |
| | | public class SessionConfig { |
| | | @Bean |
| | | public RedisSerializer<Object> springSessionDefaultRedisSerializer() { |
| | | return new GenericFastJsonRedisSerializer(); |
| | | } |
| | | } |
| | | |
New file |
| | |
| | | package com.mes.common.config; |
| | | |
| | | import org.springframework.context.annotation.Bean; |
| | | import org.springframework.context.annotation.Configuration; |
| | | import springfox.documentation.builders.ApiInfoBuilder; |
| | | import springfox.documentation.builders.ParameterBuilder; |
| | | import springfox.documentation.builders.PathSelectors; |
| | | import springfox.documentation.builders.RequestHandlerSelectors; |
| | | import springfox.documentation.schema.ModelRef; |
| | | import springfox.documentation.service.ApiInfo; |
| | | import springfox.documentation.service.Contact; |
| | | import springfox.documentation.service.Parameter; |
| | | import springfox.documentation.spi.DocumentationType; |
| | | import springfox.documentation.spring.web.plugins.Docket; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @author zhan_py |
| | | * @Date 2024/1/26 16:11 |
| | | * Swagger2配置信息 |
| | | */ |
| | | @Configuration |
| | | public class Swagger2Config { |
| | | |
| | | @Bean |
| | | public Docket webApiConfig(){ |
| | | List<Parameter> pars = new ArrayList<>(); |
| | | ParameterBuilder tokenPar = new ParameterBuilder(); |
| | | tokenPar.name("userId") |
| | | .description("用户token") |
| | | //.defaultValue(JwtHelper.createToken(1L, "admin")) |
| | | .defaultValue("1") |
| | | .modelRef(new ModelRef("string")) |
| | | .parameterType("header") |
| | | .required(false) |
| | | .build(); |
| | | pars.add(tokenPar.build()); |
| | | |
| | | return new Docket(DocumentationType.SWAGGER_2) |
| | | .groupName("webApi") |
| | | .apiInfo(webApiInfo()) |
| | | .select() |
| | | //只显示api路径下的页面 |
| | | .apis(RequestHandlerSelectors.basePackage("com.mes")) |
| | | .paths(PathSelectors.any()) |
| | | .build() |
| | | .globalOperationParameters(pars); |
| | | } |
| | | |
| | | @Bean |
| | | public Docket adminApiConfig(){ |
| | | List<Parameter> pars = new ArrayList<>(); |
| | | ParameterBuilder tokenPar = new ParameterBuilder(); |
| | | tokenPar.name("adminId") |
| | | .description("用户token") |
| | | .defaultValue("1") |
| | | .modelRef(new ModelRef("string")) |
| | | .parameterType("header") |
| | | .required(false) |
| | | .build(); |
| | | pars.add(tokenPar.build()); |
| | | |
| | | return new Docket(DocumentationType.SWAGGER_2) |
| | | .groupName("adminApi") |
| | | .apiInfo(adminApiInfo()) |
| | | .select() |
| | | //只显示admin路径下的页面 |
| | | .apis(RequestHandlerSelectors.basePackage("com.mes")) |
| | | .paths(PathSelectors.any()) |
| | | .build() |
| | | .globalOperationParameters(pars); |
| | | } |
| | | |
| | | private ApiInfo webApiInfo(){ |
| | | return new ApiInfoBuilder() |
| | | .title("网站-API文档") |
| | | .description("本文档描述了mes网站微服务接口定义") |
| | | .version("1.0") |
| | | .contact(new Contact("zhan_py", "", "")) |
| | | .build(); |
| | | } |
| | | |
| | | private ApiInfo adminApiInfo(){ |
| | | return new ApiInfoBuilder() |
| | | .title("后台管理系统-API文档") |
| | | .description("本文档描述了mes后台系统服务接口定义") |
| | | .version("1.0") |
| | | .contact(new Contact("zhan_py", "", "")) |
| | | .build(); |
| | | } |
| | | } |
New file |
| | |
| | | package com.mes.common.exception; |
| | | |
| | | import com.mes.utils.Result; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.web.bind.annotation.ControllerAdvice; |
| | | import org.springframework.web.bind.annotation.ExceptionHandler; |
| | | import org.springframework.web.bind.annotation.ResponseBody; |
| | | |
| | | /** |
| | | * @author zhoush |
| | | * @Date 2024/1/26 15:31 |
| | | */ |
| | | @ControllerAdvice |
| | | @Slf4j |
| | | public class GlobalExceptionHandler { |
| | | /** |
| | | * 如果是serviceExcaption,则调用该方法 |
| | | */ |
| | | @ExceptionHandler(ServiceException.class) |
| | | @ResponseBody |
| | | public Result handle(ServiceException se) { |
| | | return Result.error(se.getCode(), se.getMessage()); |
| | | } |
| | | |
| | | @ExceptionHandler(Exception.class) |
| | | @ResponseBody |
| | | public Result<Object> error(Exception e) { |
| | | e.printStackTrace(); |
| | | return Result.error(); |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.mes.common.exception; |
| | | |
| | | import com.mes.utils.ResultCodeEnum; |
| | | import lombok.Getter; |
| | | |
| | | @Getter |
| | | public class ServiceException extends RuntimeException { |
| | | private Integer code; |
| | | |
| | | public ServiceException(ResultCodeEnum resultCodeEnum, String msg) { |
| | | super(msg); |
| | | this.code = resultCodeEnum.getCode(); |
| | | } |
| | | } |
New file |
| | |
| | | package com.mes.common.handler; |
| | | |
| | | import com.baomidou.mybatisplus.core.handlers.MetaObjectHandler; |
| | | import org.apache.ibatis.reflection.MetaObject; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | import java.util.Date; |
| | | |
| | | @Component |
| | | public class MyMetaObjectHandler implements MetaObjectHandler { |
| | | @Override |
| | | public void insertFill(MetaObject metaObject) { |
| | | //属性名称,不是字段名称 |
| | | this.setFieldValByName("gmtCreate", new Date(), metaObject); |
| | | this.setFieldValByName("gmtModified", new Date(), metaObject); |
| | | } |
| | | |
| | | @Override |
| | | public void updateFill(MetaObject metaObject) { |
| | | this.setFieldValByName("gmtModified", new Date(), metaObject); |
| | | } |
| | | } |
New file |
| | |
| | | package com.mes.common.interceptor; |
| | | |
| | | import org.springframework.stereotype.Component; |
| | | import org.springframework.web.servlet.HandlerInterceptor; |
| | | |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | |
| | | @Component |
| | | public class JwtInterceptor implements HandlerInterceptor { |
| | | @Override |
| | | public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception { |
| | | //return HandlerInterceptor.super.preHandle(request, response, handler); |
| | | /*String token=request.getHeader("token"); |
| | | if(!(handler instanceof HandlerMethod)){ |
| | | return true; |
| | | } |
| | | |
| | | if(StrUtil.isBlank(token)){ |
| | | throw new ServiceException(Constants.Code_401,"无token,重新登陆"); |
| | | } |
| | | String userId; |
| | | try{ |
| | | userId = JWT.decode(token).getAudience().get(0); |
| | | }catch (Exception e){ |
| | | throw new ServiceException(Constants.Code_500,"token格式错误"); |
| | | } |
| | | |
| | | UserDTO getUserDTO = cacheUtil.getCacheData(userId); |
| | | |
| | | if(getUserDTO != null && !getUserDTO.getToken().equals(token)){ |
| | | throw new ServiceException(Constants.Code_600,"用户在其他位置登陆"); |
| | | } |
| | | |
| | | |
| | | String password=userService.getUserByID(userId).toLowerCase(); |
| | | //用户密码加签验证 |
| | | JWTVerifier jwtVerifier = JWT.require(Algorithm.HMAC256(password)).build(); |
| | | try { |
| | | jwtVerifier.verify(token); |
| | | } catch (JWTVerificationException e) { |
| | | throw new ServiceException(Constants.Code_401,"token验证失败,请重新登陆"); |
| | | }*/ |
| | | return true; |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.mes.tools; |
| | | |
| | | |
| | | import com.baomidou.mybatisplus.annotation.DbType; |
| | | import com.baomidou.mybatisplus.generator.AutoGenerator; |
| | | import com.baomidou.mybatisplus.generator.config.DataSourceConfig; |
| | | import com.baomidou.mybatisplus.generator.config.GlobalConfig; |
| | | import com.baomidou.mybatisplus.generator.config.PackageConfig; |
| | | import com.baomidou.mybatisplus.generator.config.StrategyConfig; |
| | | import com.baomidou.mybatisplus.generator.config.rules.NamingStrategy; |
| | | |
| | | /** |
| | | * @author mybatis-plus |
| | | */ |
| | | public class CodeGet { |
| | | |
| | | public static void main(String[] args) { |
| | | |
| | | // 1、创建代码生成器 |
| | | AutoGenerator mpg = new AutoGenerator(); |
| | | |
| | | // 2、全局配置 |
| | | // 全局配置 |
| | | GlobalConfig gc = new GlobalConfig(); |
| | | gc.setOutputDir("D:\\workspace\\hangzhoumesParent1\\"); |
| | | |
| | | gc.setServiceName("%sService"); //去掉Service接口的首字母I |
| | | gc.setAuthor("zhoush"); |
| | | gc.setOpen(false); |
| | | mpg.setGlobalConfig(gc); |
| | | |
| | | // 3、数据源配置 |
| | | DataSourceConfig dsc = new DataSourceConfig(); |
| | | dsc.setUrl("jdbc:mysql://10.153.19.150:3306/hangzhoumes?serverTimezone=GMT%2b8"); |
| | | dsc.setDriverName("com.mysql.cj.jdbc.Driver"); |
| | | dsc.setUsername("root"); |
| | | dsc.setPassword("beibo.123/"); |
| | | dsc.setDbType(DbType.MYSQL); |
| | | mpg.setDataSource(dsc); |
| | | |
| | | // 4、包配置 |
| | | PackageConfig pc = new PackageConfig(); |
| | | pc.setParent("com.mes"); |
| | | pc.setModuleName("userinfo"); //模块名 |
| | | pc.setController("controller"); |
| | | pc.setService("service"); |
| | | pc.setMapper("mapper"); |
| | | mpg.setPackageInfo(pc); |
| | | |
| | | // 5、策略配置 |
| | | StrategyConfig strategy = new StrategyConfig(); |
| | | |
| | | // strategy.setInclude("activity_info", "activity_rule", "activity_sku", "coupon_info", "coupon_range", |
| | | // "coupon_use"); |
| | | |
| | | strategy.setNaming(NamingStrategy.underline_to_camel);//数据库表映射到实体的命名策略 |
| | | |
| | | strategy.setColumnNaming(NamingStrategy.underline_to_camel);//数据库表字段映射到实体的命名策略 |
| | | strategy.setEntityLombokModel(true); // lombok 模型 @Accessors(chain = true) setter链式操作 |
| | | |
| | | strategy.setRestControllerStyle(true); //restful api风格控制器 |
| | | strategy.setControllerMappingHyphenStyle(true); //url中驼峰转连字符 |
| | | |
| | | mpg.setStrategy(strategy); |
| | | |
| | | // 6、执行 |
| | | mpg.execute(); |
| | | |
| | | System.out.println("执行完成"); |
| | | } |
| | | } |
| | | |
| | | /* |
| | | <dependency> |
| | | <groupId>com.baomidou</groupId> |
| | | <artifactId>mybatis-plus-generator</artifactId> |
| | | <version>3.4.1</version> |
| | | </dependency> |
| | | |
| | | <dependency> |
| | | <groupId>org.apache.velocity</groupId> |
| | | <artifactId>velocity-engine-core</artifactId> |
| | | <version>2.0</version> |
| | | </dependency> |
| | | */ |
New file |
| | |
| | | package com.mes.tools; |
| | | |
| | | /** |
| | | * @Author : zhoush |
| | | * @Date: 2024/3/26 9:01 |
| | | * @Description: |
| | | */ |
| | | |
| | | import cn.smallbun.screw.core.Configuration; |
| | | import cn.smallbun.screw.core.engine.EngineConfig; |
| | | import cn.smallbun.screw.core.engine.EngineFileType; |
| | | import cn.smallbun.screw.core.engine.EngineTemplateType; |
| | | import cn.smallbun.screw.core.execute.DocumentationExecute; |
| | | import cn.smallbun.screw.core.process.ProcessConfig; |
| | | import com.zaxxer.hikari.HikariConfig; |
| | | import com.zaxxer.hikari.HikariDataSource; |
| | | |
| | | import javax.sql.DataSource; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | |
| | | public class DatabaseDesignDocUtil { |
| | | |
| | | public static void main(String[] args) { |
| | | documentGeneration(); |
| | | } |
| | | |
| | | /** |
| | | * 文档生成 |
| | | */ |
| | | public static void documentGeneration() { |
| | | //数据源 |
| | | HikariConfig hikariConfig = new HikariConfig(); |
| | | hikariConfig.setDriverClassName("com.mysql.cj.jdbc.Driver"); |
| | | hikariConfig.setJdbcUrl("jdbc:mysql://10.153.19.150:3306/hangzhoumes"+"?serverTimezone=GMT%2B8"); |
| | | hikariConfig.setUsername("root"); |
| | | hikariConfig.setPassword("beibo.123/"); |
| | | //设置可以获取tables remarks信息 |
| | | hikariConfig.addDataSourceProperty("useInformationSchema", "true"); |
| | | hikariConfig.setMinimumIdle(2); |
| | | hikariConfig.setMaximumPoolSize(5); |
| | | DataSource dataSource = new HikariDataSource(hikariConfig); |
| | | //生成配置 |
| | | EngineConfig engineConfig = EngineConfig.builder() |
| | | //生成文件路径 |
| | | .fileOutputDir("E:\\项目\\项目文档\\杭州利来1") |
| | | //打开目录 |
| | | .openOutputDir(true) |
| | | //文件类型 |
| | | .fileType(EngineFileType.WORD) |
| | | //生成模板实现 |
| | | .produceType(EngineTemplateType.freemarker) |
| | | //自定义文件名称 |
| | | .fileName("杭州利来数据库文档").build(); |
| | | |
| | | //忽略表 |
| | | List<String> ignoreTableName = new ArrayList<>(); |
| | | ignoreTableName.add("test_user"); |
| | | ignoreTableName.add("test_group"); |
| | | //忽略表前缀 |
| | | ArrayList<String> ignorePrefix = new ArrayList<>(); |
| | | ignorePrefix.add("test_"); |
| | | //忽略表后缀 |
| | | ArrayList<String> ignoreSuffix = new ArrayList<>(); |
| | | ignoreSuffix.add("_test"); |
| | | ProcessConfig processConfig = ProcessConfig.builder() |
| | | //指定生成逻辑、当存在指定表、指定表前缀、指定表后缀时,将生成指定表,其余表不生成、并跳过忽略表配置 |
| | | //根据名称指定表生成 |
| | | .designatedTableName(new ArrayList<>()) |
| | | //根据表前缀生成 |
| | | .designatedTablePrefix(new ArrayList<>()) |
| | | //根据表后缀生成 |
| | | .designatedTableSuffix(new ArrayList<>()) |
| | | //忽略表名 |
| | | .ignoreTableName(ignoreTableName) |
| | | //忽略表前缀 |
| | | .ignoreTablePrefix(ignorePrefix) |
| | | //忽略表后缀 |
| | | .ignoreTableSuffix(ignoreSuffix).build(); |
| | | //配置 |
| | | Configuration config = Configuration.builder() |
| | | //版本 |
| | | .version("1.0.0") |
| | | //描述 |
| | | .description("数据库设计文档生成") |
| | | //数据源 |
| | | .dataSource(dataSource) |
| | | //生成配置 |
| | | .engineConfig(engineConfig) |
| | | //生成配置 |
| | | .produceConfig(processConfig) |
| | | .build(); |
| | | //执行生成 |
| | | new DocumentationExecute(config).execute(); |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.mes.tools; |
| | | |
| | | /** |
| | | * @Author : zhoush |
| | | * @Date: 2024/3/26 8:16 |
| | | * @Description: |
| | | */ |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import org.apache.poi.xwpf.usermodel.XWPFDocument; |
| | | import org.apache.poi.xwpf.usermodel.XWPFParagraph; |
| | | import org.apache.poi.xwpf.usermodel.XWPFRun; |
| | | import org.apache.poi.xwpf.usermodel.XWPFTable; |
| | | |
| | | import java.io.FileOutputStream; |
| | | import java.sql.Connection; |
| | | import java.sql.DriverManager; |
| | | import java.sql.PreparedStatement; |
| | | import java.sql.ResultSet; |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.*; |
| | | |
| | | /** |
| | | * @Method: 数据库表结构word导出 |
| | | * @Description: 数据库表结构word导出 |
| | | **/ |
| | | public class ExportToWord { |
| | | |
| | | // private final String DRIVER = "com.mysql.jdbc.Driver"; //MySQL5.0 |
| | | private final String DRIVER = "com.mysql.cj.jdbc.Driver"; |
| | | private final String URL = "jdbc:mysql://10.153.19.150:3306/hangzhoumes"+"?serverTimezone=GMT%2B8"; |
| | | //数据库账号 |
| | | private final String USER_NAME = "root"; |
| | | //数据库密码 |
| | | private final String PASS_WORD = "beibo.123/"; |
| | | //对应数据库 此处是你本地对应的数据库名称 |
| | | private final String database = "hangzhoumes"; |
| | | //对应输出地址 |
| | | private final String reportPath = "E:\\项目\\项目文档\\杭州利来\\"; |
| | | |
| | | // 启动方法 |
| | | public static void main(String[] args) { |
| | | |
| | | try { |
| | | ExportToWord rd = new ExportToWord (); |
| | | rd.report(); |
| | | }catch (Exception e){ |
| | | System.out.println("异常:自行处理或者联系我都阔以."); |
| | | e.printStackTrace(); |
| | | } |
| | | |
| | | } |
| | | |
| | | |
| | | Connection conn = null; |
| | | PreparedStatement pst = null; |
| | | ResultSet rs = null; |
| | | |
| | | // 获取查询数据 |
| | | public Map<String,List<TableColumn>> getData() throws Exception{ |
| | | |
| | | System.out.println("数据生成中,请稍等..."); |
| | | Map<String,List<TableColumn>> map = new HashMap<>(); |
| | | |
| | | List<Table> tables = getTables(database); |
| | | |
| | | for (Table table : tables) { |
| | | List<TableColumn> columns = getColumns(database,table.getTableName()); |
| | | map.put(table.getTableName(),columns); |
| | | } |
| | | |
| | | return map; |
| | | |
| | | } |
| | | |
| | | |
| | | // 获取表字段信息 |
| | | public List<TableColumn> getColumns(String database,String tableName) throws Exception{ |
| | | |
| | | String sql = "select column_name,column_comment,column_type,is_nullable, column_key from information_schema.columns where table_schema=? and table_name=? ";// group by column_name |
| | | ResultSet rs = getConn(database,tableName,sql); |
| | | |
| | | List<TableColumn> tableColumns = new ArrayList<>(); |
| | | |
| | | while (rs.next()){ |
| | | |
| | | TableColumn tc = new TableColumn(); |
| | | tc.setTableName(tableName); |
| | | tc.setColumnName(rs.getString("column_name")); |
| | | tc.setColumnType(rs.getString("column_type")); |
| | | tc.setColumnKey(rs.getString("column_key")); |
| | | tc.setIsNullable(rs.getString("is_nullable")); |
| | | tc.setColumnComment(rs.getString("column_comment")); |
| | | tableColumns.add(tc); |
| | | |
| | | } |
| | | |
| | | releaseConn(); |
| | | |
| | | return tableColumns; |
| | | |
| | | } |
| | | |
| | | |
| | | // 获取所有表 |
| | | public List<Table> getTables(String database) throws Exception{ |
| | | |
| | | String sql = "select table_name,table_comment from information_schema.tables where table_schema=?"; |
| | | ResultSet rs = getConn(database, "",sql); |
| | | |
| | | List<Table> tables = new ArrayList<>(); |
| | | while(rs.next()){ |
| | | Table table = new Table(); |
| | | table.setTableName(rs.getString( "table_name")); |
| | | table.setTableCommont(rs.getString("table_comment")); |
| | | tables.add(table); |
| | | } |
| | | |
| | | releaseConn(); |
| | | return tables; |
| | | |
| | | } |
| | | |
| | | // 连接数据库 |
| | | private ResultSet getConn(String dataBase,String tableName,String sql){ |
| | | |
| | | try{ |
| | | |
| | | Class.forName(DRIVER); |
| | | conn = DriverManager.getConnection(URL,USER_NAME,PASS_WORD); |
| | | pst = conn.prepareStatement(sql); |
| | | pst.setString(1,dataBase); |
| | | if(!"".equals(tableName)){ |
| | | pst.setString(2,tableName); |
| | | } |
| | | rs = pst.executeQuery(); |
| | | return rs; |
| | | |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | } |
| | | |
| | | return null; |
| | | |
| | | } |
| | | |
| | | // 释放连接 |
| | | private void releaseConn(){ |
| | | try{ |
| | | if(rs != null ){ |
| | | rs.close(); |
| | | } |
| | | if(pst != null){ |
| | | pst.close(); |
| | | } |
| | | if(conn != null){ |
| | | conn.close(); |
| | | } |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | |
| | | |
| | | // 导出数据 |
| | | public void report() throws Exception{ |
| | | |
| | | Map<String, List<TableColumn>> data = this.getData(); // 表名:表体 |
| | | List<Table> tables = this.getTables(this.database); // 表体(列名、类型、注释) |
| | | Map<String,String> tableMap = new HashMap<>(); // 表名:中文名 |
| | | |
| | | JSONObject json = new JSONObject((HashMap)data); |
| | | |
| | | for (Table table : tables) { |
| | | tableMap.put(table.getTableName(),table.getTableCommont()); |
| | | } |
| | | |
| | | // 构建表格数据 |
| | | XWPFDocument document = new XWPFDocument(); |
| | | |
| | | Integer i = 1; |
| | | for (String tableName : data.keySet()) { |
| | | |
| | | XWPFParagraph paragraph = document.createParagraph(); // 创建标题对象 |
| | | XWPFRun run = paragraph.createRun(); // 创建文本对象 |
| | | run.setText((i+"、"+tableName+" "+tableMap.get(tableName))); // 标题名称 |
| | | run.setFontSize(14); // 字体大小 |
| | | run.setBold(true); // 字体加粗 |
| | | |
| | | int j = 0; |
| | | XWPFTable table = document.createTable(data.get(tableName).size()+1,5); |
| | | // 第一行 |
| | | table.setCellMargins(50,400,50,400); |
| | | table.getRow(j).getCell(0).setText("字段名称"); |
| | | table.getRow(j).getCell(1).setText("字段类型"); |
| | | table.getRow(j).getCell(2).setText("约束"); |
| | | table.getRow(j).getCell(3).setText("为空"); |
| | | table.getRow(j).getCell(4).setText("字段含义"); |
| | | j++; |
| | | |
| | | for (TableColumn tableColumn : data.get(tableName)) { |
| | | |
| | | table.getRow(j).getCell(0).setText(tableColumn.getColumnName()); |
| | | table.getRow(j).getCell(1).setText(tableColumn.getColumnType()); |
| | | table.getRow(j).getCell(2).setText(tableColumn.getColumnKey()); |
| | | table.getRow(j).getCell(3).setText(tableColumn.getIsNullable()); |
| | | table.getRow(j).getCell(4).setText(tableColumn.getColumnComment()); |
| | | j++; |
| | | |
| | | } |
| | | i++; |
| | | } |
| | | |
| | | // 文档输出 |
| | | FileOutputStream out = new FileOutputStream(reportPath + new SimpleDateFormat("yyyyMMddHHmmss").format(new Date()).toString()+"_"+database +".docx"); |
| | | document.write(out); |
| | | out.close(); |
| | | System.out.println("Word生成完成!!!"); |
| | | |
| | | } |
| | | |
| | | // 表 |
| | | class Table{ |
| | | |
| | | private String tableName; |
| | | |
| | | private String tableCommont; |
| | | |
| | | public String getTableName() { |
| | | return tableName; |
| | | } |
| | | |
| | | public void setTableName(String tableName) { |
| | | this.tableName = tableName; |
| | | } |
| | | |
| | | public String getTableCommont() { |
| | | return tableCommont; |
| | | } |
| | | |
| | | public void setTableCommont(String tableCommont) { |
| | | this.tableCommont = tableCommont; |
| | | } |
| | | |
| | | } |
| | | |
| | | // 表列信息 |
| | | class TableColumn{ |
| | | // 表名 |
| | | private String tableName; |
| | | // 字段名 |
| | | private String columnName; |
| | | // 字段类型 |
| | | private String columnType; |
| | | // 字段注释 |
| | | private String columnComment; |
| | | // 可否为空 |
| | | private String isNullable; |
| | | // 约束 |
| | | private String columnKey; |
| | | |
| | | public String getTableName() { |
| | | return tableName; |
| | | } |
| | | |
| | | public void setTableName(String tableName) { |
| | | this.tableName = tableName; |
| | | } |
| | | |
| | | public String getColumnName() { |
| | | return columnName; |
| | | } |
| | | |
| | | public void setColumnName(String columnName) { |
| | | this.columnName = columnName; |
| | | } |
| | | |
| | | public String getColumnType() { |
| | | return columnType; |
| | | } |
| | | |
| | | public void setColumnType(String columnType) { |
| | | this.columnType = columnType; |
| | | } |
| | | |
| | | public String getColumnComment() { |
| | | return columnComment; |
| | | } |
| | | |
| | | public void setColumnComment(String columnComment) { |
| | | this.columnComment = columnComment; |
| | | } |
| | | |
| | | public String getIsNullable() { |
| | | return isNullable; |
| | | } |
| | | |
| | | public void setIsNullable(String isNullable) { |
| | | this.isNullable = isNullable; |
| | | } |
| | | |
| | | public String getColumnKey() { |
| | | return columnKey; |
| | | } |
| | | |
| | | public void setColumnKey(String columnKey) { |
| | | this.columnKey = columnKey; |
| | | } |
| | | |
| | | } |
| | | |
| | | |
| | | } |
| | | |
New file |
| | |
| | | package com.mes.tools; |
| | | |
| | | import com.github.xingshuangs.iot.protocol.s7.enums.EPlcType; |
| | | 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 java.nio.charset.StandardCharsets; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | |
| | | public class S7control { |
| | | |
| | | S7PLC s7PLC; // PLC通讯类实例 |
| | | |
| | | public S7control(EPlcType plcType, String ip, int port, int rack, int slot) { |
| | | if (s7PLC == null) { |
| | | s7PLC = new S7PLC(plcType, ip, port, 0, 0); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 关闭西门子s7通讯连接 |
| | | */ |
| | | public void CloseS7client() { |
| | | if (s7PLC == null) { |
| | | s7PLC.close(); |
| | | } |
| | | s7PLC.checkConnected(); |
| | | } |
| | | |
| | | /** |
| | | * s7通讯连接状态 |
| | | */ |
| | | public boolean CheckConnected() { |
| | | return s7PLC.checkConnected(); |
| | | } |
| | | |
| | | /** |
| | | * 按指定的地址 写入一个word |
| | | * |
| | | * @param address 地址 |
| | | * @param data word的值 |
| | | */ |
| | | public void WriteWord(String address, short data) { |
| | | if (s7PLC == null) { |
| | | return; |
| | | } |
| | | s7PLC.writeInt16(address, data); |
| | | } |
| | | |
| | | /** |
| | | * 从某地址连续 写入多个word |
| | | * |
| | | * @param address 地址 |
| | | * @param datas word的值 |
| | | */ |
| | | public void WriteWord(String address, List<Short> datas) { |
| | | if (s7PLC == null) { |
| | | return; |
| | | } |
| | | // s7PLC.write(address, data); |
| | | List<String> addresslist = GetAddressList(address, datas.size(), 16); |
| | | MultiAddressWrite addressWrite = new MultiAddressWrite(); |
| | | for (int i = 0; i < datas.size(); i++) { |
| | | addressWrite.addInt16(addresslist.get(i), datas.get(i)); |
| | | } |
| | | s7PLC.writeMultiData(addressWrite); |
| | | } |
| | | |
| | | /** |
| | | * 按指定的地址 写入多个word |
| | | * |
| | | * @param address 地址 |
| | | * @param datas word的值 |
| | | */ |
| | | |
| | | |
| | | /** |
| | | * 按指定的地址 写入一个Bit |
| | | * |
| | | * @param address 地址 |
| | | * @param data Bit的值 |
| | | */ |
| | | public void WriteBit(String address, Boolean data) { |
| | | if (s7PLC == null) { |
| | | return; |
| | | } |
| | | s7PLC.writeBoolean(address, data); |
| | | } |
| | | |
| | | /** |
| | | * 按指定的地址 写入多个bit |
| | | * |
| | | * @param address 地址 |
| | | * @param datas bit的值 |
| | | */ |
| | | public void WriteBit(List<String> address, List<Boolean> datas) { |
| | | if (s7PLC == null) { |
| | | return; |
| | | } |
| | | // s7PLC.write(address, data); |
| | | |
| | | MultiAddressWrite addressWrite = new MultiAddressWrite(); |
| | | for (int i = 0; i < address.size(); i++) { |
| | | addressWrite.addBoolean(address.get(i), datas.get(i)); |
| | | } |
| | | s7PLC.writeMultiData(addressWrite); |
| | | } |
| | | |
| | | /** |
| | | * 从某地址连续 写入多个bit |
| | | * |
| | | * @param address 地址 |
| | | * @param datas word的值 |
| | | */ |
| | | public void WriteBit(String address, List<Boolean> datas) { |
| | | if (s7PLC == null) { |
| | | return; |
| | | } |
| | | // s7PLC.write(address, data); |
| | | List<String> addresslist = GetAddressList(address, datas.size(), 1); |
| | | MultiAddressWrite addressWrite = new MultiAddressWrite(); |
| | | for (int i = 0; i < datas.size(); i++) { |
| | | addressWrite.addBoolean(addresslist.get(i), datas.get(i)); |
| | | } |
| | | s7PLC.writeMultiData(addressWrite); |
| | | } |
| | | |
| | | /** |
| | | * 按指定的地址 写入多个byte |
| | | * |
| | | * @param address 地址 |
| | | * @param datas byte的值 |
| | | */ |
| | | public void WriteByte(String address, byte[] datas) { |
| | | if (s7PLC == null) { |
| | | return; |
| | | } |
| | | // s7PLC.write(address, data); |
| | | s7PLC.writeByte(address, datas); |
| | | } |
| | | |
| | | /** |
| | | * 按指定的地址 读取word结果集 |
| | | * |
| | | * @param address 地址 |
| | | * @return 结果 |
| | | */ |
| | | public List<Short> ReadWord(List<String> address) { |
| | | if (s7PLC == null) { |
| | | return null; |
| | | } |
| | | |
| | | try { |
| | | return s7PLC.readInt16(address); |
| | | } catch (Exception e) { |
| | | System.out.println("读取 " + address + " 失败:" + e.getMessage()); |
| | | return null; |
| | | } |
| | | } |
| | | |
| | | |
| | | private int getIndexFromAddress(String address) { |
| | | |
| | | // 可以解析出地址中的数字部分,并转换为整数 |
| | | return 0; |
| | | } |
| | | |
| | | private String getAddressFromIndex(int index) { |
| | | |
| | | // 整数转换为地址格式的字符串 |
| | | return ""; |
| | | } |
| | | |
| | | /** |
| | | * 按指定的地址 读取word结果集 |
| | | * |
| | | * @param address 地址 |
| | | * @param count 连续读多少个word |
| | | * @return 结果 |
| | | */ |
| | | 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); |
| | | } catch (Exception e) { |
| | | System.out.println("读取 " + address + " 失败:" + e.getMessage()); |
| | | |
| | | return null; |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 按指定的地址 读取byte结果集 |
| | | * |
| | | * @param address 地址 |
| | | * @param count 连续读多少个byte |
| | | * @return 结果 |
| | | */ |
| | | public byte[] ReadByte(String address, int count) { |
| | | if (s7PLC == null) { |
| | | return null; |
| | | } |
| | | // List<String> addresslist = GetAddressList(address, count, 16); |
| | | |
| | | try { |
| | | return s7PLC.readByte(address, count); |
| | | } catch (Exception e) { |
| | | // 处理异常 |
| | | System.out.println("读取 " + address + " 失败:" + e.getMessage()); |
| | | return null; |
| | | } |
| | | |
| | | } |
| | | |
| | | /** |
| | | * 按指定的地址 按bit位 0 flase 1 true 读取结果 |
| | | * |
| | | * @param addresslist 地址集 |
| | | * @return Boolean结果 |
| | | */ |
| | | public List<Boolean> ReadBits(List<String> addresslist) { |
| | | if (s7PLC == null) { |
| | | return null; |
| | | } |
| | | return s7PLC.readBoolean(addresslist); |
| | | } |
| | | |
| | | //读取不连续地址bit |
| | | public List<Boolean> readBits(List<String> addressList) { |
| | | if (s7PLC == null || addressList.isEmpty()) { |
| | | return null; |
| | | } |
| | | |
| | | List<Boolean> values = new ArrayList<>(); |
| | | for (String address : addressList) { |
| | | try { |
| | | boolean value = s7PLC.readBoolean(address); |
| | | values.add(value); |
| | | } catch (Exception e) { |
| | | // 处理异常 |
| | | System.out.println("读取 " + address + " 失败:" + e.getMessage()); |
| | | } |
| | | } |
| | | |
| | | return values; |
| | | } |
| | | |
| | | |
| | | //读取String |
| | | public List<String> readStrings(List<String> addressList) { |
| | | if (s7PLC == null) { |
| | | return null; |
| | | } |
| | | List<String> result = new ArrayList<>(); |
| | | for (String address : addressList) { |
| | | try { |
| | | byte[] bytes = s7PLC.readByte(address, 14); |
| | | if (bytes != null) { |
| | | String str = new String(bytes, StandardCharsets.UTF_8); |
| | | result.add(str); |
| | | } |
| | | } 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) { |
| | | return; |
| | | } |
| | | |
| | | for (int i = 0; i < address.size(); i++) { |
| | | String addr = address.get(i); |
| | | short data = datas.get(i); |
| | | |
| | | if (addr.contains("-")) { |
| | | outmesid(String.valueOf(data), addr); // 单独处理带破折号的地址 |
| | | } else { |
| | | s7PLC.writeInt16(addr, data); // 将数据写入单个地址 |
| | | } |
| | | } |
| | | } |
| | | |
| | | |
| | | //字符串写入 |
| | | public void outmesid(String data, String addr) { |
| | | // System.out.println("outmesid: " + data); |
| | | List<Byte> glassidlist = new ArrayList<>(); |
| | | String[] parts = addr.split("-"); |
| | | if (parts.length == 2) { |
| | | addr = parts[0]; // 只保留 "-" 前面的部分 |
| | | } |
| | | for (char iditem : data.toCharArray()) { |
| | | glassidlist.add(Byte.valueOf(String.valueOf(iditem))); |
| | | } |
| | | byte[] bytes = Bytes.toArray(glassidlist); |
| | | WriteByte(addr, bytes); |
| | | } |
| | | |
| | | //读取不连续word |
| | | public List<Short> readWords(List<String> addresses) { |
| | | if (s7PLC == null) { |
| | | return null; |
| | | } |
| | | |
| | | List<Short> data = new ArrayList<>(); |
| | | |
| | | for (String address : addresses) { |
| | | try { |
| | | |
| | | // 单个地址 |
| | | Short value = s7PLC.readInt16(address); |
| | | data.add(value); |
| | | } catch (Exception e) { |
| | | System.out.println("读取 " + address + " 失败:" + e.getMessage()); |
| | | |
| | | } |
| | | |
| | | } |
| | | return data; |
| | | } |
| | | |
| | | //读取时间 |
| | | public Long readtime(String address) { |
| | | if (s7PLC == null) { |
| | | return null; |
| | | } |
| | | try { |
| | | return s7PLC.readTime(address); |
| | | } catch (Exception e) { |
| | | System.out.println("读取 " + address + " 失败:" + e.getMessage()); |
| | | return null; |
| | | } |
| | | } |
| | | |
| | | |
| | | public void writetime(String address, long datas) { |
| | | if (s7PLC == null) |
| | | return; |
| | | |
| | | |
| | | s7PLC.writeTime(address, datas); // 将数据写入单个地址 |
| | | } |
| | | |
| | | |
| | | private int extractAddressNumber(String address) { |
| | | String numberStr = address.replaceAll("\\D+", ""); // 使用正则表达式提取数字部分 |
| | | return Integer.parseInt(numberStr); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 从指定的地址开始 连续按bit位读取 |
| | | * |
| | | * @param address 地址 |
| | | * @param count 长度 |
| | | * @return Boolean结果 |
| | | */ |
| | | public List<Boolean> ReadBits(String address, int count) { |
| | | if (s7PLC == null) |
| | | return null; |
| | | List<String> addresslist = GetAddressList(address, count, 1); |
| | | try { |
| | | return s7PLC.readBoolean(addresslist); |
| | | } catch (Exception e) { |
| | | System.out.println("读取 " + address + " 失败:" + e.getMessage()); |
| | | return null; |
| | | } |
| | | |
| | | } |
| | | |
| | | ; |
| | | |
| | | |
| | | private List<String> GetAddressList(String address, int count, int addedbit) { |
| | | List<String> addresslist = new ArrayList<String>(); |
| | | |
| | | String[] stringdatas = address.trim().split("\\."); |
| | | if (stringdatas.length < 2 || !address.startsWith("DB")) { |
| | | return null; |
| | | } |
| | | int dbwindex = 0; |
| | | int bitindex = 0; |
| | | if (stringdatas.length == 2) { |
| | | dbwindex = Integer.parseInt(stringdatas[1]); |
| | | } else if (stringdatas.length == 3) { |
| | | dbwindex = Integer.parseInt(stringdatas[1]); |
| | | bitindex = Integer.parseInt(stringdatas[2]); |
| | | } else { |
| | | return null; |
| | | } |
| | | |
| | | addresslist.add(address); |
| | | for (int i = 0; i < count - 1; i++) { |
| | | |
| | | int bitcurrent = bitindex + addedbit; |
| | | if (bitcurrent > 7) { |
| | | dbwindex += bitcurrent / 8; |
| | | bitindex = 0; |
| | | } else { |
| | | bitindex = bitcurrent; |
| | | } |
| | | |
| | | String endstr = stringdatas.length == 3 ? "." + bitindex : ""; |
| | | addresslist.add(stringdatas[0] + "." + dbwindex + endstr); |
| | | } |
| | | return addresslist; |
| | | } |
| | | } |
New file |
| | |
| | | package com.mes.tools; |
| | | |
| | | import cn.hutool.core.date.DateUtil; |
| | | import com.auth0.jwt.JWT; |
| | | import com.auth0.jwt.algorithms.Algorithm; |
| | | |
| | | import java.util.Date; |
| | | |
| | | public class TokenTools { |
| | | |
| | | /** |
| | | * 生成token |
| | | * |
| | | * @return |
| | | */ |
| | | public static String getToken(String userid, String sign) { |
| | | return JWT.create().withAudience(userid) // 将 user id 保存到 token 里面,作为载荷 |
| | | .withExpiresAt(DateUtil.offsetHour(new Date(), 24)) // 2小时后token过期 |
| | | .sign(Algorithm.HMAC256(sign)); // 以 password 作为 token 的密钥 |
| | | |
| | | } |
| | | } |
New file |
| | |
| | | package com.mes.utils; |
| | | |
| | | import java.security.MessageDigest; |
| | | import java.security.NoSuchAlgorithmException; |
| | | |
| | | |
| | | public final class MD5 { |
| | | |
| | | public static String encrypt(String strSrc) { |
| | | try { |
| | | char hexChars[] = { '0', '1', '2', '3', '4', '5', '6', '7', '8', |
| | | '9', 'a', 'b', 'c', 'd', 'e', 'f' }; |
| | | byte[] bytes = strSrc.getBytes(); |
| | | MessageDigest md = MessageDigest.getInstance("MD5"); |
| | | md.update(bytes); |
| | | bytes = md.digest(); |
| | | int j = bytes.length; |
| | | char[] chars = new char[j * 2]; |
| | | int k = 0; |
| | | for (int i = 0; i < bytes.length; i++) { |
| | | byte b = bytes[i]; |
| | | chars[k++] = hexChars[b >>> 4 & 0xf]; |
| | | chars[k++] = hexChars[b & 0xf]; |
| | | } |
| | | return new String(chars); |
| | | } catch (NoSuchAlgorithmException e) { |
| | | e.printStackTrace(); |
| | | throw new RuntimeException("MD5加密出错!!+" + e); |
| | | } |
| | | } |
| | | |
| | | public static void main(String[] args) { |
| | | System.out.println(MD5.encrypt("111111")); |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.mes.utils; |
| | | |
| | | import com.fasterxml.jackson.databind.ObjectMapper; |
| | | import org.springframework.http.HttpStatus; |
| | | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.io.IOException; |
| | | |
| | | /** |
| | | * @Author : zhoush |
| | | * @Date: 2024/4/8 15:46 |
| | | * @Description: |
| | | */ |
| | | public class ResponseUtil { |
| | | |
| | | public static final String APPLICATION_JSON_UTF8_VALUE = "application/json;charset=UTF-8"; |
| | | |
| | | public static void out(HttpServletResponse response, Result r) { |
| | | ObjectMapper mapper = new ObjectMapper(); |
| | | response.setStatus(HttpStatus.OK.value()); |
| | | response.setContentType(APPLICATION_JSON_UTF8_VALUE); |
| | | try { |
| | | mapper.writeValue(response.getWriter(), r); |
| | | } catch (IOException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | } |
New file |
| | |
| | | package com.mes.utils; |
| | | |
| | | import lombok.Data; |
| | | |
| | | |
| | | @Data |
| | | public class Result<T> { |
| | | private Integer code; |
| | | private String message; |
| | | private T data; |
| | | |
| | | private Result() { |
| | | |
| | | } |
| | | |
| | | public static <T> Result<T> build(Integer code, String message, T data) { |
| | | Result<T> result = new Result<T>(); |
| | | result.setCode(code); |
| | | result.setMessage(message); |
| | | if (data != null) { |
| | | result.setData(data); |
| | | } |
| | | return result; |
| | | } |
| | | |
| | | public static <T> Result<T> build(ResultCodeEnum resultCodeEnum, T data) { |
| | | Result<T> result = new Result<T>(); |
| | | result.setCode(resultCodeEnum.getCode()); |
| | | result.setMessage(resultCodeEnum.getMessage()); |
| | | if (data != null) { |
| | | result.setData(data); |
| | | } |
| | | return result; |
| | | } |
| | | |
| | | public static <T> Result<T> success() { |
| | | return build(ResultCodeEnum.SUCCESS, null); |
| | | } |
| | | |
| | | public static <T> Result<T> success(T data) { |
| | | return build(ResultCodeEnum.SUCCESS.getCode(), "", data); |
| | | } |
| | | |
| | | |
| | | public static Result error(Integer code, String msg) { |
| | | return build(code, msg, null); |
| | | } |
| | | |
| | | public static <T> Result<T> error(T data) { |
| | | return build(ResultCodeEnum.FAIL.getCode(), "", data); |
| | | } |
| | | |
| | | public static <T> Result<T> error() { |
| | | return build(ResultCodeEnum.FAIL.getCode(), "服务器发生异常", null); |
| | | } |
| | | } |
New file |
| | |
| | | package com.mes.utils; |
| | | |
| | | import lombok.Getter; |
| | | |
| | | /** |
| | | * @author zhoush |
| | | */ |
| | | |
| | | @Getter |
| | | public enum ResultCodeEnum { |
| | | |
| | | SUCCESS(200,"成功"), |
| | | FAIL(201, "失败"), |
| | | SERVICE_ERROR(2012, "服务异常"), |
| | | DATA_ERROR(204, "数据异常"), |
| | | ILLEGAL_REQUEST(205, "非法请求"), |
| | | REPEAT_SUBMIT(206, "重复提交"), |
| | | |
| | | LOGIN_AUTH(208, "未登陆"), |
| | | PERMISSION(209, "没有权限"), |
| | | |
| | | |
| | | ; |
| | | |
| | | private Integer code; |
| | | |
| | | private String message; |
| | | |
| | | ResultCodeEnum(Integer code, String message) { |
| | | this.code = code; |
| | | this.message = message; |
| | | } |
| | | } |
New file |
| | |
| | | ________ ________ ___ _____________ ____ |
| | | `MMMMMMMb. 68b `MMMMMMMb. `MMb dMM'`MMMMMMMMM 6MMMMb\ |
| | | MM `Mb Y89 MM `Mb MMM. ,PMM MM \ 6M' ` |
| | | MM MM ____ ___ MM MM _____ M`Mb d'MM MM MM |
| | | MM .M9 6MMMMb `MM MM .M9 6MMMMMb M YM. ,P MM MM , YM. |
| | | MMMMMMM( 6M' `Mb MM MMMMMMM( 6M' `Mb M `Mb d' MM MMMMMMM YMMMMb |
| | | MM `Mb MM MM MM MM `Mb MM MM M YM.P MM MM ` `Mb |
| | | MM MM MMMMMMMM MM MM MM MM MM M `Mb' MM MM MM |
| | | MM MM MM MM MM MM MM MM M YP MM MM MM |
| | | MM .M9 YM d9 MM MM .M9 YM. ,M9 68b M `' MM MM / L ,M9 |
| | | _MMMMMMM9' YMMMM9 _MM__MMMMMMM9' YMMMMM9 Y89 _M_ _MM__MMMMMMMMM MYMMMM9 |
| | | |
| | | // _ooOoo_ // |
| | | // o8888888o // |
| | | // 88" . "88 // |
| | | // (| ^_^ |) // |
| | | // O\ = /O // |
| | | // ____/`---'\____ // |
| | | // .' \\| |// `. // |
| | | // / \\||| : |||// \ // |
| | | // / _||||| -:- |||||- \ // |
| | | // | | \\\ - /// | | // |
| | | // | \_| ''\---/'' | | // |
| | | // \ .-\__ `-` ___/-. / // |
| | | // ___`. .' /--.--\ `. . ___ // |
| | | // ."" '< `.___\_<|>_/___.' >'"". // |
| | | // | | : `- \`.;`\ _ /`;.`/ - ` : | | // |
| | | // \ \ `-. \_ __\ /__ _/ .-` / / // |
| | | // ========`-.____`-.___\_____/___.-`____.-'======== // |
| | | // `=---=' // |
| | | // ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ // |
| | | // 佛祖保佑 永不宕机 永无BUG // |
New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <project xmlns="http://maven.apache.org/POM/4.0.0" |
| | | xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" |
| | | xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> |
| | | <parent> |
| | | <artifactId>common</artifactId> |
| | | <groupId>com.mes</groupId> |
| | | <version>1.0-SNAPSHOT</version> |
| | | </parent> |
| | | <modelVersion>4.0.0</modelVersion> |
| | | |
| | | <artifactId>springsecurity</artifactId> |
| | | |
| | | <properties> |
| | | <maven.compiler.source>8</maven.compiler.source> |
| | | <maven.compiler.target>8</maven.compiler.target> |
| | | </properties> |
| | | |
| | | <dependencies> |
| | | <dependency> |
| | | <groupId>com.mes</groupId> |
| | | <artifactId>servicebase</artifactId> |
| | | <version>1.0-SNAPSHOT</version> |
| | | </dependency> |
| | | <!-- Spring Security依赖 --> |
| | | <!-- <dependency>--> |
| | | <!-- <groupId>org.springframework.boot</groupId>--> |
| | | <!-- <artifactId>spring-boot-starter-security</artifactId>--> |
| | | <!-- </dependency>--> |
| | | |
| | | <!-- <dependency>--> |
| | | <!-- <groupId>io.jsonwebtoken</groupId>--> |
| | | <!-- <artifactId>jjwt</artifactId>--> |
| | | <!-- </dependency>--> |
| | | </dependencies> |
| | | |
| | | </project> |
New file |
| | |
| | | //package com.mes.config; |
| | | // |
| | | // |
| | | //import com.mes.filter.TokenAuthFilter; |
| | | //import com.mes.filter.TokenLoginFilter; |
| | | //import com.mes.security.DefaultPasswordEncoder; |
| | | //import com.mes.security.TokenLogoutHandler; |
| | | //import com.mes.security.TokenManager; |
| | | //import com.mes.security.UnauthEntryPoint; |
| | | //import org.springframework.beans.factory.annotation.Autowired; |
| | | //import org.springframework.context.annotation.Configuration; |
| | | //import org.springframework.data.redis.core.RedisTemplate; |
| | | //import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder; |
| | | //import org.springframework.security.config.annotation.method.configuration.EnableGlobalMethodSecurity; |
| | | //import org.springframework.security.config.annotation.web.builders.HttpSecurity; |
| | | //import org.springframework.security.config.annotation.web.builders.WebSecurity; |
| | | //import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity; |
| | | //import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter; |
| | | //import org.springframework.security.core.userdetails.UserDetailsService; |
| | | // |
| | | //@Configuration |
| | | //@EnableWebSecurity |
| | | //@EnableGlobalMethodSecurity(prePostEnabled = true) |
| | | //public class TokenWebSecurityConfig extends WebSecurityConfigurerAdapter { |
| | | // |
| | | // private TokenManager tokenManager; |
| | | // private RedisTemplate redisTemplate; |
| | | // private DefaultPasswordEncoder defaultPasswordEncoder; |
| | | // private UserDetailsService userDetailsService; |
| | | // |
| | | // @Autowired |
| | | // public TokenWebSecurityConfig(UserDetailsService userDetailsService, DefaultPasswordEncoder defaultPasswordEncoder, |
| | | // TokenManager tokenManager, RedisTemplate redisTemplate) { |
| | | // this.userDetailsService = userDetailsService; |
| | | // this.defaultPasswordEncoder = defaultPasswordEncoder; |
| | | // this.tokenManager = tokenManager; |
| | | // this.redisTemplate = redisTemplate; |
| | | // } |
| | | // |
| | | // /** |
| | | // * 配置设置 |
| | | // * @param http |
| | | // * @throws Exception |
| | | // */ |
| | | // //设置退出的地址和token,redis操作地址 |
| | | // @Override |
| | | // protected void configure(HttpSecurity http) throws Exception { |
| | | // http.exceptionHandling() |
| | | // .authenticationEntryPoint(new UnauthEntryPoint())//没有权限访问 |
| | | // .and().csrf().disable() |
| | | // .authorizeRequests() |
| | | // .anyRequest().authenticated() |
| | | // .and().logout().logoutUrl("/admin/acl/index/logout")//退出路径 |
| | | // .addLogoutHandler(new TokenLogoutHandler(tokenManager,redisTemplate)).and() |
| | | // .addFilter(new TokenLoginFilter(authenticationManager(), tokenManager, redisTemplate)) |
| | | // .addFilter(new TokenAuthFilter(authenticationManager(), tokenManager, redisTemplate)).httpBasic(); |
| | | // } |
| | | // |
| | | // //调用userDetailsService和密码处理 |
| | | // @Override |
| | | // public void configure(AuthenticationManagerBuilder auth) throws Exception { |
| | | // auth.userDetailsService(userDetailsService).passwordEncoder(defaultPasswordEncoder); |
| | | // } |
| | | // //不进行认证的路径,可以直接访问 |
| | | // @Override |
| | | // public void configure(WebSecurity web) throws Exception { |
| | | // web.ignoring().antMatchers("/api/**"); |
| | | // } |
| | | //} |
New file |
| | |
| | | //package com.mes.entity; |
| | | // |
| | | //import lombok.Data; |
| | | //import org.springframework.security.core.GrantedAuthority; |
| | | //import org.springframework.security.core.authority.SimpleGrantedAuthority; |
| | | //import org.springframework.security.core.userdetails.UserDetails; |
| | | //import org.springframework.util.StringUtils; |
| | | // |
| | | //import java.util.ArrayList; |
| | | //import java.util.Collection; |
| | | //import java.util.List; |
| | | // |
| | | //@Data |
| | | //public class SecurityUser implements UserDetails { |
| | | // |
| | | // //当前登录用户 |
| | | // private transient User currentUserInfo; |
| | | // |
| | | // //当前权限 |
| | | // private List<String> permissionValueList; |
| | | // |
| | | // public SecurityUser() { |
| | | // } |
| | | // |
| | | // public SecurityUser(User user) { |
| | | // if (user != null) { |
| | | // this.currentUserInfo = user; |
| | | // } |
| | | // } |
| | | // |
| | | // @Override |
| | | // public Collection<? extends GrantedAuthority> getAuthorities() { |
| | | // Collection<GrantedAuthority> authorities = new ArrayList<>(); |
| | | // for(String permissionValue : permissionValueList) { |
| | | // if(StringUtils.isEmpty(permissionValue)) continue; |
| | | // SimpleGrantedAuthority authority = new SimpleGrantedAuthority(permissionValue); |
| | | // authorities.add(authority); |
| | | // } |
| | | // |
| | | // return authorities; |
| | | // } |
| | | // |
| | | // @Override |
| | | // public String getPassword() { |
| | | // return currentUserInfo.getPassword(); |
| | | // } |
| | | // |
| | | // @Override |
| | | // public String getUsername() { |
| | | // return currentUserInfo.getUsername(); |
| | | // } |
| | | // |
| | | // @Override |
| | | // public boolean isAccountNonExpired() { |
| | | // return true; |
| | | // } |
| | | // |
| | | // @Override |
| | | // public boolean isAccountNonLocked() { |
| | | // return true; |
| | | // } |
| | | // |
| | | // @Override |
| | | // public boolean isCredentialsNonExpired() { |
| | | // return true; |
| | | // } |
| | | // |
| | | // @Override |
| | | // public boolean isEnabled() { |
| | | // return true; |
| | | // } |
| | | //} |
| | | // |
New file |
| | |
| | | //package com.mes.entity; |
| | | // |
| | | //import io.swagger.annotations.ApiModel; |
| | | //import io.swagger.annotations.ApiModelProperty; |
| | | //import lombok.Data; |
| | | // |
| | | //import java.io.Serializable; |
| | | // |
| | | //@Data |
| | | //@ApiModel(description = "用户实体类") |
| | | //public class User implements Serializable { |
| | | // |
| | | // private static final long serialVersionUID = 1L; |
| | | // |
| | | // @ApiModelProperty(value = "微信openid") |
| | | // private String username; |
| | | // |
| | | // @ApiModelProperty(value = "密码") |
| | | // private String password; |
| | | // |
| | | // @ApiModelProperty(value = "昵称") |
| | | // private String nickName; |
| | | // |
| | | // @ApiModelProperty(value = "用户头像") |
| | | // private String salt; |
| | | // |
| | | // @ApiModelProperty(value = "用户签名") |
| | | // private String token; |
| | | // |
| | | //} |
| | | // |
New file |
| | |
| | | //package com.mes.filter; |
| | | // |
| | | //import com.mes.security.TokenManager; |
| | | //import org.springframework.data.redis.core.RedisTemplate; |
| | | //import org.springframework.security.authentication.AuthenticationManager; |
| | | //import org.springframework.security.authentication.UsernamePasswordAuthenticationToken; |
| | | //import org.springframework.security.core.GrantedAuthority; |
| | | //import org.springframework.security.core.authority.SimpleGrantedAuthority; |
| | | //import org.springframework.security.core.context.SecurityContextHolder; |
| | | //import org.springframework.security.web.authentication.www.BasicAuthenticationFilter; |
| | | // |
| | | //import javax.servlet.FilterChain; |
| | | //import javax.servlet.ServletException; |
| | | //import javax.servlet.http.HttpServletRequest; |
| | | //import javax.servlet.http.HttpServletResponse; |
| | | //import java.io.IOException; |
| | | //import java.util.ArrayList; |
| | | //import java.util.Collection; |
| | | //import java.util.List; |
| | | // |
| | | //public class TokenAuthFilter extends BasicAuthenticationFilter { |
| | | // |
| | | // private TokenManager tokenManager; |
| | | // private RedisTemplate redisTemplate; |
| | | // public TokenAuthFilter(AuthenticationManager authenticationManager,TokenManager tokenManager,RedisTemplate redisTemplate) { |
| | | // super(authenticationManager); |
| | | // this.tokenManager = tokenManager; |
| | | // this.redisTemplate = redisTemplate; |
| | | // } |
| | | // |
| | | // @Override |
| | | // protected void doFilterInternal(HttpServletRequest request, HttpServletResponse response, FilterChain chain) throws IOException, ServletException { |
| | | // //获取当前认证成功用户权限信息 |
| | | // UsernamePasswordAuthenticationToken authRequest = getAuthentication(request); |
| | | // //判断如果有权限信息,放到权限上下文中 |
| | | // if(authRequest != null) { |
| | | // SecurityContextHolder.getContext().setAuthentication(authRequest); |
| | | // } |
| | | // chain.doFilter(request,response); |
| | | // } |
| | | // |
| | | // private UsernamePasswordAuthenticationToken getAuthentication(HttpServletRequest request) { |
| | | // //从header获取token |
| | | // String token = request.getHeader("token"); |
| | | // if(token != null) { |
| | | // //从token获取用户名 |
| | | // String username = tokenManager.getUserInfoFromToken(token); |
| | | // //从redis获取对应权限列表 |
| | | // List<String> permissionValueList = (List<String>)redisTemplate.opsForValue().get(username); |
| | | // Collection<GrantedAuthority> authority = new ArrayList<>(); |
| | | // for(String permissionValue : permissionValueList) { |
| | | // SimpleGrantedAuthority auth = new SimpleGrantedAuthority(permissionValue); |
| | | // authority.add(auth); |
| | | // } |
| | | // return new UsernamePasswordAuthenticationToken(username,token,authority); |
| | | // } |
| | | // return null; |
| | | // } |
| | | // |
| | | //} |
New file |
| | |
| | | //package com.mes.filter; |
| | | // |
| | | //import com.fasterxml.jackson.databind.ObjectMapper; |
| | | //import com.mes.utils.Result; |
| | | //import com.mes.entity.SecurityUser; |
| | | //import com.mes.entity.User; |
| | | //import com.mes.security.TokenManager; |
| | | //import com.mes.utils.ResponseUtil; |
| | | //import org.springframework.data.redis.core.RedisTemplate; |
| | | //import org.springframework.security.authentication.AuthenticationManager; |
| | | //import org.springframework.security.authentication.UsernamePasswordAuthenticationToken; |
| | | //import org.springframework.security.core.Authentication; |
| | | //import org.springframework.security.core.AuthenticationException; |
| | | //import org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter; |
| | | //import org.springframework.security.web.util.matcher.AntPathRequestMatcher; |
| | | // |
| | | //import javax.servlet.FilterChain; |
| | | //import javax.servlet.ServletException; |
| | | //import javax.servlet.http.HttpServletRequest; |
| | | //import javax.servlet.http.HttpServletResponse; |
| | | //import java.io.IOException; |
| | | //import java.util.ArrayList; |
| | | // |
| | | //public class TokenLoginFilter extends UsernamePasswordAuthenticationFilter { |
| | | // |
| | | // private TokenManager tokenManager; |
| | | // private RedisTemplate redisTemplate; |
| | | // private AuthenticationManager authenticationManager; |
| | | // |
| | | // public TokenLoginFilter(AuthenticationManager authenticationManager, TokenManager tokenManager, RedisTemplate redisTemplate) { |
| | | // this.authenticationManager = authenticationManager; |
| | | // this.tokenManager = tokenManager; |
| | | // this.redisTemplate = redisTemplate; |
| | | // this.setPostOnly(false); |
| | | // this.setRequiresAuthenticationRequestMatcher(new AntPathRequestMatcher("/admin/acl/login","POST")); |
| | | // } |
| | | // |
| | | // //1 获取表单提交用户名和密码 |
| | | // @Override |
| | | // public Authentication attemptAuthentication(HttpServletRequest request, HttpServletResponse response) |
| | | // throws AuthenticationException { |
| | | // //获取表单提交数据 |
| | | // try { |
| | | // User user = new ObjectMapper().readValue(request.getInputStream(), User.class); |
| | | // return authenticationManager.authenticate(new UsernamePasswordAuthenticationToken(user.getUsername(),user.getPassword(), |
| | | // new ArrayList<>())); |
| | | // } catch (IOException e) { |
| | | // e.printStackTrace(); |
| | | // throw new RuntimeException(); |
| | | // } |
| | | // } |
| | | // |
| | | // //2 认证成功调用的方法 |
| | | // @Override |
| | | // protected void successfulAuthentication(HttpServletRequest request, |
| | | // HttpServletResponse response, FilterChain chain, Authentication authResult) |
| | | // throws IOException, ServletException { |
| | | // //认证成功,得到认证成功之后用户信息 |
| | | // SecurityUser user = (SecurityUser)authResult.getPrincipal(); |
| | | // //根据用户名生成token |
| | | // String token = tokenManager.createToken(user.getCurrentUserInfo().getUsername()); |
| | | // //把用户名称和用户权限列表放到redis |
| | | // redisTemplate.opsForValue().set(user.getCurrentUserInfo().getUsername(),user.getPermissionValueList()); |
| | | // //返回token |
| | | // ResponseUtil.out(response, Result.success(token)); |
| | | // } |
| | | // |
| | | // //3 认证失败调用的方法 |
| | | // @Override |
| | | // protected void unsuccessfulAuthentication(HttpServletRequest request, HttpServletResponse response, AuthenticationException failed) |
| | | // throws IOException, ServletException { |
| | | // ResponseUtil.out(response, Result.error()); |
| | | // } |
| | | //} |
New file |
| | |
| | | //package com.mes.security; |
| | | // |
| | | //import com.mes.utils.MD5; |
| | | //import org.springframework.security.crypto.password.PasswordEncoder; |
| | | //import org.springframework.stereotype.Component; |
| | | // |
| | | //@Component |
| | | //public class DefaultPasswordEncoder implements PasswordEncoder { |
| | | // |
| | | // public DefaultPasswordEncoder() { |
| | | // this(-1); |
| | | // } |
| | | // public DefaultPasswordEncoder(int strength) { |
| | | // } |
| | | // //进行MD5加密 |
| | | // @Override |
| | | // public String encode(CharSequence charSequence) { |
| | | // return MD5.encrypt(charSequence.toString()); |
| | | // } |
| | | // //进行密码比对 |
| | | // @Override |
| | | // public boolean matches(CharSequence charSequence, String encodedPassword) { |
| | | // return encodedPassword.equals(MD5.encrypt(charSequence.toString())); |
| | | // } |
| | | //} |
New file |
| | |
| | | //package com.mes.security; |
| | | // |
| | | //import com.mes.utils.Result; |
| | | //import com.mes.utils.ResponseUtil; |
| | | //import org.springframework.data.redis.core.RedisTemplate; |
| | | //import org.springframework.security.core.Authentication; |
| | | //import org.springframework.security.web.authentication.logout.LogoutHandler; |
| | | // |
| | | //import javax.servlet.http.HttpServletRequest; |
| | | //import javax.servlet.http.HttpServletResponse; |
| | | // |
| | | ////退出处理器 |
| | | //public class TokenLogoutHandler implements LogoutHandler { |
| | | // private TokenManager tokenManager; |
| | | // private RedisTemplate redisTemplate; |
| | | // |
| | | // public TokenLogoutHandler(TokenManager tokenManager,RedisTemplate redisTemplate) { |
| | | // this.tokenManager = tokenManager; |
| | | // this.redisTemplate = redisTemplate; |
| | | // } |
| | | // @Override |
| | | // public void logout(HttpServletRequest request, HttpServletResponse response, Authentication authentication) { |
| | | // //1 从header里面获取token |
| | | // //2 token不为空,移除token,从redis删除token |
| | | // String token = request.getHeader("token"); |
| | | // if(token != null) { |
| | | // //移除 |
| | | // tokenManager.removeToken(token); |
| | | // //从token获取用户名 |
| | | // String username = tokenManager.getUserInfoFromToken(token); |
| | | // redisTemplate.delete(username); |
| | | // } |
| | | // ResponseUtil.out(response, Result.success()); |
| | | // } |
| | | //} |
New file |
| | |
| | | //package com.mes.security; |
| | | // |
| | | //import io.jsonwebtoken.CompressionCodecs; |
| | | //import io.jsonwebtoken.Jwts; |
| | | //import io.jsonwebtoken.SignatureAlgorithm; |
| | | //import org.springframework.stereotype.Component; |
| | | // |
| | | //import java.util.Date; |
| | | // |
| | | //@Component |
| | | //public class TokenManager { |
| | | // //token有效时长 |
| | | // private long tokenEcpiration = 24*60*60*1000; |
| | | // //编码秘钥 |
| | | // private String tokenSignKey = "123456"; |
| | | // //1 使用jwt根据用户名生成token |
| | | // public String createToken(String username) { |
| | | // String token = Jwts.builder().setSubject(username) |
| | | // .setExpiration(new Date(System.currentTimeMillis()+tokenEcpiration)) |
| | | // .signWith(SignatureAlgorithm.HS512, tokenSignKey).compressWith(CompressionCodecs.GZIP).compact(); |
| | | // return token; |
| | | // } |
| | | // //2 根据token字符串得到用户信息 |
| | | // public String getUserInfoFromToken(String token) { |
| | | // String userinfo = Jwts.parser().setSigningKey(tokenSignKey).parseClaimsJws(token).getBody().getSubject(); |
| | | // return userinfo; |
| | | // } |
| | | // //3 删除token |
| | | // public void removeToken(String token) { } |
| | | //} |
New file |
| | |
| | | //package com.mes.security; |
| | | // |
| | | //import com.mes.utils.Result; |
| | | //import com.mes.utils.ResponseUtil; |
| | | //import org.springframework.security.core.AuthenticationException; |
| | | //import org.springframework.security.web.AuthenticationEntryPoint; |
| | | // |
| | | //import javax.servlet.ServletException; |
| | | //import javax.servlet.http.HttpServletRequest; |
| | | //import javax.servlet.http.HttpServletResponse; |
| | | //import java.io.IOException; |
| | | // |
| | | //public class UnauthEntryPoint implements AuthenticationEntryPoint { |
| | | // @Override |
| | | // public void commence(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse, AuthenticationException e) throws IOException, ServletException { |
| | | // ResponseUtil.out(httpServletResponse, Result.error()); |
| | | // } |
| | | //} |
New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <project xmlns="http://maven.apache.org/POM/4.0.0" |
| | | xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" |
| | | xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> |
| | | <parent> |
| | | <artifactId>hangzhoumesParent</artifactId> |
| | | <groupId>com.mes</groupId> |
| | | <version>1.0-SNAPSHOT</version> |
| | | </parent> |
| | | <modelVersion>4.0.0</modelVersion> |
| | | |
| | | <artifactId>gateway</artifactId> |
| | | |
| | | <properties> |
| | | <maven.compiler.source>8</maven.compiler.source> |
| | | <maven.compiler.target>8</maven.compiler.target> |
| | | </properties> |
| | | <dependencies> |
| | | <!-- 服务注册/发现--> |
| | | <dependency> |
| | | <groupId>com.alibaba.cloud</groupId> |
| | | <artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId> |
| | | </dependency> |
| | | |
| | | <dependency> |
| | | <groupId>org.springframework.cloud</groupId> |
| | | <artifactId>spring-cloud-starter-gateway</artifactId> |
| | | </dependency> |
| | | </dependencies> |
| | | |
| | | </project> |
New file |
| | |
| | | package com.mes; |
| | | |
| | | |
| | | import org.springframework.boot.SpringApplication; |
| | | import org.springframework.boot.autoconfigure.SpringBootApplication; |
| | | import org.springframework.cloud.client.discovery.EnableDiscoveryClient; |
| | | |
| | | /** |
| | | * @Author : zhoush |
| | | * @Date: 2024/3/28 11:21 |
| | | * @Description: |
| | | */ |
| | | @SpringBootApplication |
| | | @EnableDiscoveryClient |
| | | public class GateWayApplication { |
| | | |
| | | public static void main(String[] args) { |
| | | SpringApplication.run(GateWayApplication.class, args); |
| | | } |
| | | } |
New file |
| | |
| | | server: |
| | | port: 88 |
| | | spring: |
| | | application: |
| | | name: gateway |
| | | cloud: |
| | | nacos: |
| | | discovery: |
| | | server-addr: 127.0.0.1:8848 |
| | | gateway: |
| | | discovery: |
| | | locator: |
| | | enabled: true |
| | | routes: |
| | | - id: cacheGlass |
| | | uri: lb://cacheGlass |
| | | predicates: |
| | | - Path=/api/cacheGlass/** |
| | | filters: |
| | | - StripPrefix=2 |
| | | |
| | | - id: cacheVerticalGlass |
| | | uri: http://127.0.0.1:8082 |
| | | predicates: |
| | | - Path=/api/cacheVerticalGlass/** |
| | | filters: |
| | | - StripPrefix=2 |
| | | |
| | | - id: loadGlass |
| | | uri: http://127.0.0.1:8083 |
| | | predicates: |
| | | - Path=/api/loadGlass/** |
| | | filters: |
| | | - StripPrefix=2 |
| | | |
| | | - id: temperingGlass |
| | | uri: http://127.0.0.1:8084 |
| | | predicates: |
| | | - Path=/api/temperingGlass/** |
| | | filters: |
| | | - StripPrefix=2 |
| | | |
| | | - id: unLoadGlass |
| | | uri: http://127.0.0.1:8085 |
| | | predicates: |
| | | - Path=/api/unLoadGlass/** |
| | | filters: |
| | | - StripPrefix=2 |
| | | |
| | | # - id: unLoadGlass |
| | | # uri: lb://unLoadGlass |
| | | # predicates: |
| | | # - Path=/unLoadGlass/** |
| | | # filters: |
| | | # - RewritePath=/unLoadGlass/(?<segment>.*), /$\{segment} |
| | | |
New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <project xmlns="http://maven.apache.org/POM/4.0.0" |
| | | xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" |
| | | xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> |
| | | <parent> |
| | | <artifactId>moduleService</artifactId> |
| | | <groupId>com.mes</groupId> |
| | | <version>1.0-SNAPSHOT</version> |
| | | </parent> |
| | | <modelVersion>4.0.0</modelVersion> |
| | | |
| | | <artifactId>cacheGlass</artifactId> |
| | | <dependencies> |
| | | <dependency> |
| | | <groupId>junit</groupId> |
| | | <artifactId>junit</artifactId> |
| | | <scope>test</scope> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>com.mes</groupId> |
| | | <artifactId>servicebase</artifactId> |
| | | <version>1.0-SNAPSHOT</version> |
| | | <scope>compile</scope> |
| | | </dependency> |
| | | </dependencies> |
| | | |
| | | <properties> |
| | | <maven.compiler.source>8</maven.compiler.source> |
| | | <maven.compiler.target>8</maven.compiler.target> |
| | | </properties> |
| | | |
| | | |
| | | |
| | | </project> |
New file |
| | |
| | | package com.mes; |
| | | |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.mybatis.spring.annotation.MapperScan; |
| | | import org.springframework.boot.SpringApplication; |
| | | import org.springframework.boot.autoconfigure.SpringBootApplication; |
| | | import org.springframework.cloud.client.discovery.EnableDiscoveryClient; |
| | | import springfox.documentation.swagger2.annotations.EnableSwagger2; |
| | | |
| | | /** |
| | | * @Author : zhoush |
| | | * @Date: 2024/3/25 10:49 |
| | | * @Description: |
| | | */ |
| | | @Slf4j |
| | | @SpringBootApplication |
| | | @MapperScan("com.mes.*.mapper") |
| | | @EnableDiscoveryClient |
| | | @EnableSwagger2 |
| | | public class CacheGlassModuleApplication { |
| | | |
| | | public static void main(String[] args) { |
| | | try { |
| | | SpringApplication.run(CacheGlassModuleApplication.class, args); |
| | | }catch (Exception e){ |
| | | log.error(e.getMessage()); |
| | | } |
| | | |
| | | } |
| | | } |
New file |
| | |
| | | package com.mes.common; |
| | | |
| | | import com.github.xingshuangs.iot.protocol.s7.enums.EPlcType; |
| | | import com.mes.tools.S7control; |
| | | |
| | | /** |
| | | * @Author : zhoush |
| | | * @Date: 2024/4/9 15:13 |
| | | * @Description: |
| | | */ |
| | | public class S7object { |
| | | public S7control plccontrol; // PLC通讯类实例 |
| | | private EPlcType plcType = EPlcType.S1500; // 西门子PLC类型 |
| | | private String ip = "192.168.10.1"; // plc ip地址 |
| | | private int port = 102; // plc 端口号 |
| | | |
| | | private static volatile S7object instance = null; |
| | | |
| | | private S7object() { |
| | | if (plccontrol == null) { |
| | | plccontrol = new S7control(plcType, ip, port,0,0); |
| | | } |
| | | } |
| | | |
| | | // 单例模式 获取类的唯一实例 |
| | | public static S7object getinstance() { |
| | | if (instance == null) { |
| | | synchronized (S7object.class) { |
| | | if (instance == null) { |
| | | instance = new S7object(); |
| | | } |
| | | } |
| | | } |
| | | return instance; |
| | | } |
| | | } |
New file |
| | |
| | | package com.mes.edgstoragecage.controller; |
| | | |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | /** |
| | | * <p> |
| | | * 前端控制器 |
| | | * </p> |
| | | * |
| | | * @author zhoush |
| | | * @since 2024-04-07 |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/edgStorageCage") |
| | | public class EdgStorageCageController { |
| | | |
| | | //todo: 实例代码 待删除 |
| | | @ApiOperation("测试") |
| | | @GetMapping("/index") |
| | | public String index() { |
| | | return "hello world"; |
| | | } |
| | | |
| | | } |
| | | |
New file |
| | |
| | | package com.mes.edgstoragecage.controller; |
| | | |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | /** |
| | | * <p> |
| | | * 前端控制器 |
| | | * </p> |
| | | * |
| | | * @author zhoush |
| | | * @since 2024-04-07 |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/edgStorageCageDetails") |
| | | public class EdgStorageCageDetailsController { |
| | | |
| | | } |
| | | |
New file |
| | |
| | | package com.mes.edgstoragecage.entity; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import java.io.Serializable; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | |
| | | /** |
| | | * <p> |
| | | * |
| | | * </p> |
| | | * |
| | | * @author zhoush |
| | | * @since 2024-04-07 |
| | | */ |
| | | @Data |
| | | @EqualsAndHashCode(callSuper = false) |
| | | public class EdgStorageCage implements Serializable { |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | /** |
| | | * 磨边前理片笼表id |
| | | */ |
| | | @TableId(value = "id", type = IdType.AUTO) |
| | | private Integer id; |
| | | |
| | | /** |
| | | * 设备id |
| | | */ |
| | | private Integer deviceId; |
| | | |
| | | /** |
| | | * 栅格号 |
| | | */ |
| | | private Integer slot; |
| | | |
| | | /** |
| | | * 启用状态 |
| | | */ |
| | | private String enableState; |
| | | |
| | | /** |
| | | * 剩余 |
| | | */ |
| | | private Integer remainWidth; |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.mes.edgstoragecage.entity; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import java.io.Serializable; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | |
| | | /** |
| | | * <p> |
| | | * |
| | | * </p> |
| | | * |
| | | * @author zhoush |
| | | * @since 2024-04-07 |
| | | */ |
| | | @Data |
| | | @EqualsAndHashCode(callSuper = false) |
| | | public class EdgStorageCageDetails implements Serializable { |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | /** |
| | | * 磨边前理片笼详情表id |
| | | */ |
| | | @TableId(value = "id", type = IdType.AUTO) |
| | | private Integer id; |
| | | |
| | | /** |
| | | * 设备id |
| | | */ |
| | | private Integer deviceId; |
| | | |
| | | /** |
| | | * 栅格号 |
| | | */ |
| | | private Integer slot; |
| | | |
| | | /** |
| | | * 玻璃id |
| | | */ |
| | | private Integer glassId; |
| | | |
| | | /** |
| | | * 小片在格内的顺序 |
| | | */ |
| | | private Integer sequence; |
| | | |
| | | /** |
| | | * 流程卡号 |
| | | */ |
| | | private String flowCardId; |
| | | |
| | | /** |
| | | * 玻璃类型 |
| | | */ |
| | | private Integer glassType; |
| | | |
| | | /** |
| | | * 宽 |
| | | */ |
| | | private Double width; |
| | | |
| | | /** |
| | | * 高 |
| | | */ |
| | | private Double height; |
| | | |
| | | /** |
| | | * 厚度 |
| | | */ |
| | | private Double thickness; |
| | | |
| | | /** |
| | | * 磨前宽 |
| | | */ |
| | | private Double edgWidth; |
| | | |
| | | /** |
| | | * 磨前高 |
| | | */ |
| | | private Double edgHeight; |
| | | |
| | | /** |
| | | * 钢化版图id |
| | | */ |
| | | private Integer temperingLayoutId; |
| | | |
| | | /** |
| | | * 钢化版图片序 |
| | | */ |
| | | private Integer temperingFeedSequence; |
| | | |
| | | /** |
| | | * 原片顺序 |
| | | */ |
| | | private Integer patternSequence; |
| | | |
| | | /** |
| | | * 状态 |
| | | */ |
| | | private Integer state; |
| | | |
| | | /** |
| | | * 玻璃间隙 |
| | | */ |
| | | private Integer gap; |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.mes.edgstoragecage.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.mes.edgstoragecage.entity.EdgStorageCageDetails; |
| | | |
| | | /** |
| | | * <p> |
| | | * Mapper 接口 |
| | | * </p> |
| | | * |
| | | * @author zhoush |
| | | * @since 2024-04-07 |
| | | */ |
| | | public interface EdgStorageCageDetailsMapper extends BaseMapper<EdgStorageCageDetails> { |
| | | |
| | | } |
New file |
| | |
| | | package com.mes.edgstoragecage.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.mes.edgstoragecage.entity.EdgStorageCage; |
| | | |
| | | /** |
| | | * <p> |
| | | * Mapper 接口 |
| | | * </p> |
| | | * |
| | | * @author zhoush |
| | | * @since 2024-04-07 |
| | | */ |
| | | public interface EdgStorageCageMapper extends BaseMapper<EdgStorageCage> { |
| | | |
| | | } |
New file |
| | |
| | | package com.mes.edgstoragecage.service; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.mes.edgstoragecage.entity.EdgStorageCageDetails; |
| | | |
| | | /** |
| | | * <p> |
| | | * 服务类 |
| | | * </p> |
| | | * |
| | | * @author zhoush |
| | | * @since 2024-04-07 |
| | | */ |
| | | public interface EdgStorageCageDetailsService extends IService<EdgStorageCageDetails> { |
| | | |
| | | } |
New file |
| | |
| | | package com.mes.edgstoragecage.service; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.mes.edgstoragecage.entity.EdgStorageCage; |
| | | |
| | | /** |
| | | * <p> |
| | | * 服务类 |
| | | * </p> |
| | | * |
| | | * @author zhoush |
| | | * @since 2024-04-07 |
| | | */ |
| | | public interface EdgStorageCageService extends IService<EdgStorageCage> { |
| | | |
| | | } |
New file |
| | |
| | | package com.mes.edgstoragecage.service.impl; |
| | | |
| | | import com.mes.edgstoragecage.entity.EdgStorageCageDetails; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.mes.edgstoragecage.mapper.EdgStorageCageDetailsMapper; |
| | | import com.mes.edgstoragecage.service.EdgStorageCageDetailsService; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | /** |
| | | * <p> |
| | | * 服务实现类 |
| | | * </p> |
| | | * |
| | | * @author zhoush |
| | | * @since 2024-04-07 |
| | | */ |
| | | @Service |
| | | public class EdgStorageCageDetailsServiceImpl extends ServiceImpl<EdgStorageCageDetailsMapper, EdgStorageCageDetails> implements EdgStorageCageDetailsService { |
| | | |
| | | } |
New file |
| | |
| | | package com.mes.edgstoragecage.service.impl; |
| | | |
| | | import com.mes.edgstoragecage.entity.EdgStorageCage; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.mes.edgstoragecage.mapper.EdgStorageCageMapper; |
| | | import com.mes.edgstoragecage.service.EdgStorageCageService; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | /** |
| | | * <p> |
| | | * 服务实现类 |
| | | * </p> |
| | | * |
| | | * @author zhoush |
| | | * @since 2024-04-07 |
| | | */ |
| | | @Service |
| | | public class EdgStorageCageServiceImpl extends ServiceImpl<EdgStorageCageMapper, EdgStorageCage> implements EdgStorageCageService { |
| | | |
| | | } |
New file |
| | |
| | | package com.mes.taskcache.controller; |
| | | |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | /** |
| | | * <p> |
| | | * 前端控制器 |
| | | * </p> |
| | | * |
| | | * @author zhoush |
| | | * @since 2024-04-07 |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/taskCache") |
| | | public class TaskCacheController { |
| | | |
| | | } |
| | | |
New file |
| | |
| | | package com.mes.taskcache.entity; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import java.io.Serializable; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | |
| | | /** |
| | | * <p> |
| | | * |
| | | * </p> |
| | | * |
| | | * @author zhoush |
| | | * @since 2024-04-07 |
| | | */ |
| | | @Data |
| | | @EqualsAndHashCode(callSuper = false) |
| | | public class TaskCache implements Serializable { |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | /** |
| | | * ID编号 |
| | | */ |
| | | @TableId("ID") |
| | | private String id; |
| | | |
| | | /** |
| | | * 起始 |
| | | */ |
| | | private String startCell; |
| | | |
| | | /** |
| | | * 目标 |
| | | */ |
| | | private String endCell; |
| | | |
| | | /** |
| | | * 任务类型 1:进 2:出 |
| | | */ |
| | | private String taskType; |
| | | |
| | | /** |
| | | * 任务状态 0 未开始 1正在进行 2完成 |
| | | */ |
| | | private String taskStauts; |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.mes.taskcache.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.mes.taskcache.entity.TaskCache; |
| | | |
| | | /** |
| | | * <p> |
| | | * Mapper 接口 |
| | | * </p> |
| | | * |
| | | * @author zhoush |
| | | * @since 2024-04-07 |
| | | */ |
| | | public interface TaskCacheMapper extends BaseMapper<TaskCache> { |
| | | |
| | | } |
New file |
| | |
| | | package com.mes.taskcache.service; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.mes.taskcache.entity.TaskCache; |
| | | |
| | | /** |
| | | * <p> |
| | | * 服务类 |
| | | * </p> |
| | | * |
| | | * @author zhoush |
| | | * @since 2024-04-07 |
| | | */ |
| | | public interface TaskCacheService extends IService<TaskCache> { |
| | | |
| | | } |
New file |
| | |
| | | package com.mes.taskcache.service.impl; |
| | | |
| | | import com.mes.taskcache.entity.TaskCache; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.mes.taskcache.mapper.TaskCacheMapper; |
| | | import com.mes.taskcache.service.TaskCacheService; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | /** |
| | | * <p> |
| | | * 服务实现类 |
| | | * </p> |
| | | * |
| | | * @author zhoush |
| | | * @since 2024-04-07 |
| | | */ |
| | | @Service |
| | | public class TaskCacheServiceImpl extends ServiceImpl<TaskCacheMapper, TaskCache> implements TaskCacheService { |
| | | |
| | | } |
New file |
| | |
| | | package com.mes.temperingglass.controller; |
| | | |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | /** |
| | | * <p> |
| | | * 前端控制器 |
| | | * </p> |
| | | * |
| | | * @author zhoush |
| | | * @since 2024-04-07 |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/glassInfo") |
| | | public class GlassInfoController { |
| | | |
| | | } |
| | | |
New file |
| | |
| | | package com.mes.temperingglass.entity; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import java.io.Serializable; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | |
| | | /** |
| | | * <p> |
| | | * |
| | | * </p> |
| | | * |
| | | * @author zhoush |
| | | * @since 2024-04-07 |
| | | */ |
| | | @Data |
| | | @EqualsAndHashCode(callSuper = false) |
| | | public class GlassInfo implements Serializable { |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | /** |
| | | * 玻璃信息表id |
| | | */ |
| | | @TableId(value = "id", type = IdType.AUTO) |
| | | private Long 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; |
| | | |
| | | /** |
| | | * 钢化版图id |
| | | */ |
| | | private Integer temperingLayoutId; |
| | | |
| | | /** |
| | | * 钢化版图片序 |
| | | */ |
| | | private Integer temperingFeedSequence; |
| | | |
| | | /** |
| | | * x坐标 |
| | | */ |
| | | private Integer xCoordinate; |
| | | |
| | | /** |
| | | * y坐标 |
| | | */ |
| | | private Integer yCoordinate; |
| | | |
| | | /** |
| | | * 旋转角度(逆时针) |
| | | */ |
| | | private Integer angle; |
| | | |
| | | /** |
| | | * 工程号 |
| | | */ |
| | | private Integer engineerId; |
| | | |
| | | /** |
| | | * 生产规则id |
| | | */ |
| | | private Integer ruleId; |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.mes.temperingglass.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.mes.temperingglass.entity.GlassInfo; |
| | | |
| | | /** |
| | | * <p> |
| | | * Mapper 接口 |
| | | * </p> |
| | | * |
| | | * @author zhoush |
| | | * @since 2024-04-07 |
| | | */ |
| | | public interface GlassInfoMapper extends BaseMapper<GlassInfo> { |
| | | |
| | | } |
New file |
| | |
| | | package com.mes.temperingglass.service; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.mes.temperingglass.entity.GlassInfo; |
| | | |
| | | /** |
| | | * <p> |
| | | * 服务类 |
| | | * </p> |
| | | * |
| | | * @author zhoush |
| | | * @since 2024-04-07 |
| | | */ |
| | | public interface GlassInfoService extends IService<GlassInfo> { |
| | | |
| | | } |
New file |
| | |
| | | package com.mes.temperingglass.service.impl; |
| | | |
| | | import com.mes.temperingglass.entity.GlassInfo; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.mes.temperingglass.mapper.GlassInfoMapper; |
| | | import com.mes.temperingglass.service.GlassInfoService; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | /** |
| | | * <p> |
| | | * 服务实现类 |
| | | * </p> |
| | | * |
| | | * @author zhoush |
| | | * @since 2024-04-07 |
| | | */ |
| | | @Service |
| | | public class GlassInfoServiceImpl extends ServiceImpl<GlassInfoMapper, GlassInfo> implements GlassInfoService { |
| | | |
| | | } |
New file |
| | |
| | | server: |
| | | port: 8081 |
| | | spring: |
| | | datasource: |
| | | driver-class-name: com.mysql.cj.jdbc.Driver |
| | | url: jdbc:mysql://10.153.19.150:3306/hangzhoumes?serverTimezone=GMT%2b8&characterEncoding=utf-8&useSSL=false |
| | | username: root |
| | | password: beibo.123/ |
| | | cloud: |
| | | nacos: |
| | | discovery: |
| | | server-addr: 127.0.0.1:8848 |
| | | application: |
| | | name: cacheGlass |
| | | redis: |
| | | database: 0 |
| | | host: 192.168.56.10 |
| | | port: 6379 |
| | | password: |
| | | session: |
| | | store-type: redis |
| | | mybatis-plus: |
| | | mapper-locations: classpath*:mapper/*.xml |
| | | configuration: |
| | | log-impl: org.apache.ibatis.logging.stdout.StdOutImpl |
New file |
| | |
| | | package com.mes; |
| | | |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.junit.Test; |
| | | import org.junit.runner.RunWith; |
| | | import org.springframework.boot.test.context.SpringBootTest; |
| | | import org.springframework.test.context.junit4.SpringRunner; |
| | | |
| | | import java.util.Arrays; |
| | | |
| | | /** |
| | | * @Author : zhoush |
| | | * @Date: 2024/3/27 16:37 |
| | | * @Description: |
| | | */ |
| | | @Slf4j |
| | | @RunWith(SpringRunner.class) |
| | | @SpringBootTest(classes = CacheGlassModuleApplication.class) |
| | | public class CacheGlassModuleApplicationTest { |
| | | |
| | | |
| | | @Test |
| | | public void testFindPath() { |
| | | log.info("完整路径:{}", Arrays.asList("123")); |
| | | } |
| | | } |
New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <project xmlns="http://maven.apache.org/POM/4.0.0" |
| | | xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" |
| | | xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> |
| | | <parent> |
| | | <artifactId>moduleService</artifactId> |
| | | <groupId>com.mes</groupId> |
| | | <version>1.0-SNAPSHOT</version> |
| | | </parent> |
| | | <modelVersion>4.0.0</modelVersion> |
| | | |
| | | <artifactId>cacheVerticalGlass</artifactId> |
| | | |
| | | <properties> |
| | | <maven.compiler.source>8</maven.compiler.source> |
| | | <maven.compiler.target>8</maven.compiler.target> |
| | | </properties> |
| | | |
| | | </project> |
New file |
| | |
| | | package com.mes; |
| | | |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.mybatis.spring.annotation.MapperScan; |
| | | import org.springframework.boot.SpringApplication; |
| | | import org.springframework.boot.autoconfigure.SpringBootApplication; |
| | | import org.springframework.cloud.client.discovery.EnableDiscoveryClient; |
| | | import springfox.documentation.swagger2.annotations.EnableSwagger2; |
| | | |
| | | /** |
| | | * @Author : zhoush |
| | | * @Date: 2024/3/25 10:49 |
| | | * @Description: |
| | | */ |
| | | @Slf4j |
| | | @SpringBootApplication |
| | | @EnableSwagger2 |
| | | @EnableDiscoveryClient |
| | | @MapperScan(basePackages = "com.mes.*.mapper") |
| | | public class CacheVerticalClassModuleApplication { |
| | | |
| | | public static void main(String[] args) { |
| | | try { |
| | | SpringApplication.run(CacheVerticalClassModuleApplication.class, args); |
| | | }catch (Exception e){ |
| | | log.error(e.getMessage()); |
| | | } |
| | | |
| | | } |
| | | } |
New file |
| | |
| | | package com.mes.bigstorage.controller; |
| | | |
| | | |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | /** |
| | | * <p> |
| | | * 前端控制器 |
| | | * </p> |
| | | * |
| | | * @author zhoush |
| | | * @since 2024-03-27 |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/bigStorageCage") |
| | | public class BigStorageCageController { |
| | | |
| | | //todo: 实例代码 待删除 |
| | | @ApiOperation("测试") |
| | | @GetMapping("/index") |
| | | public String index() { |
| | | return "hello world"; |
| | | } |
| | | } |
| | | |
New file |
| | |
| | | package com.mes.bigstorage.controller; |
| | | |
| | | |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | /** |
| | | * <p> |
| | | * 前端控制器 |
| | | * </p> |
| | | * |
| | | * @author zhoush |
| | | * @since 2024-03-27 |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/bigStorageCageDetails") |
| | | public class BigStorageCageDetailsController { |
| | | |
| | | } |
| | | |
New file |
| | |
| | | package com.mes.bigstorage.entity; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import java.io.Serializable; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | |
| | | /** |
| | | * <p> |
| | | * |
| | | * </p> |
| | | * |
| | | * @author zhoush |
| | | * @since 2024-03-27 |
| | | */ |
| | | @Data |
| | | @EqualsAndHashCode(callSuper = false) |
| | | public class BigStorageCage implements Serializable { |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | /** |
| | | * 大理片笼表id |
| | | */ |
| | | @TableId(value = "id", type = IdType.AUTO) |
| | | private Integer id; |
| | | |
| | | /** |
| | | * 设备id |
| | | */ |
| | | private Integer deviceId; |
| | | |
| | | /** |
| | | * 栅格号 |
| | | */ |
| | | private Integer slot; |
| | | |
| | | /** |
| | | * 启用状态 |
| | | */ |
| | | private String enableState; |
| | | |
| | | /** |
| | | * 剩余宽度 |
| | | */ |
| | | private Integer remainWidth; |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.mes.bigstorage.entity; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import java.io.Serializable; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | |
| | | /** |
| | | * <p> |
| | | * |
| | | * </p> |
| | | * |
| | | * @author zhoush |
| | | * @since 2024-03-27 |
| | | */ |
| | | @Data |
| | | @EqualsAndHashCode(callSuper = false) |
| | | public class BigStorageCageDetails implements Serializable { |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | /** |
| | | * 大理片笼详情表id |
| | | */ |
| | | @TableId(value = "id", type = IdType.AUTO) |
| | | private Integer id; |
| | | |
| | | /** |
| | | * 设备id |
| | | */ |
| | | private Integer deviceId; |
| | | |
| | | /** |
| | | * 栅格号 |
| | | */ |
| | | private Integer slot; |
| | | |
| | | /** |
| | | * 玻璃id |
| | | */ |
| | | private String glassId; |
| | | |
| | | /** |
| | | * 小片在格内的顺序 |
| | | */ |
| | | private Integer sequence; |
| | | |
| | | /** |
| | | * 流程卡号 |
| | | */ |
| | | private String flowCardId; |
| | | |
| | | /** |
| | | * 玻璃类型 |
| | | */ |
| | | private Integer glassType; |
| | | |
| | | /** |
| | | * 宽 |
| | | */ |
| | | private Double width; |
| | | |
| | | /** |
| | | * 高 |
| | | */ |
| | | private Double height; |
| | | |
| | | /** |
| | | * 厚度 |
| | | */ |
| | | private Double thickness; |
| | | |
| | | /** |
| | | * 钢化版图id |
| | | */ |
| | | private Integer temperingLayoutId; |
| | | |
| | | /** |
| | | * 钢化版图片序 |
| | | */ |
| | | private Integer temperingFeedSequence; |
| | | |
| | | /** |
| | | * 状态 |
| | | */ |
| | | private Integer state; |
| | | |
| | | /** |
| | | * 玻璃间隙 |
| | | */ |
| | | private Integer gap; |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.mes.bigstorage.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.mes.bigstorage.entity.BigStorageCageDetails; |
| | | |
| | | |
| | | /** |
| | | * <p> |
| | | * Mapper 接口 |
| | | * </p> |
| | | * |
| | | * @author zhoush |
| | | * @since 2024-03-27 |
| | | */ |
| | | public interface BigStorageCageDetailsMapper extends BaseMapper<BigStorageCageDetails> { |
| | | |
| | | } |
New file |
| | |
| | | package com.mes.bigstorage.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.mes.bigstorage.entity.BigStorageCage; |
| | | |
| | | /** |
| | | * <p> |
| | | * Mapper 接口 |
| | | * </p> |
| | | * |
| | | * @author zhoush |
| | | * @since 2024-03-27 |
| | | */ |
| | | public interface BigStorageCageMapper extends BaseMapper<BigStorageCage> { |
| | | |
| | | } |
New file |
| | |
| | | package com.mes.bigstorage.service; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.mes.bigstorage.entity.BigStorageCageDetails; |
| | | |
| | | /** |
| | | * <p> |
| | | * 服务类 |
| | | * </p> |
| | | * |
| | | * @author zhoush |
| | | * @since 2024-03-27 |
| | | */ |
| | | public interface BigStorageCageDetailsService extends IService<BigStorageCageDetails> { |
| | | |
| | | } |
New file |
| | |
| | | package com.mes.bigstorage.service; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.mes.bigstorage.entity.BigStorageCage; |
| | | |
| | | /** |
| | | * <p> |
| | | * 服务类 |
| | | * </p> |
| | | * |
| | | * @author zhoush |
| | | * @since 2024-03-27 |
| | | */ |
| | | public interface BigStorageCageService extends IService<BigStorageCage> { |
| | | |
| | | } |
New file |
| | |
| | | package com.mes.bigstorage.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.mes.bigstorage.entity.BigStorageCageDetails; |
| | | import com.mes.bigstorage.mapper.BigStorageCageDetailsMapper; |
| | | import com.mes.bigstorage.service.BigStorageCageDetailsService; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | /** |
| | | * <p> |
| | | * 服务实现类 |
| | | * </p> |
| | | * |
| | | * @author zhoush |
| | | * @since 2024-03-27 |
| | | */ |
| | | @Service |
| | | public class BigStorageCageDetailsServiceImpl extends ServiceImpl<BigStorageCageDetailsMapper, BigStorageCageDetails> implements BigStorageCageDetailsService { |
| | | |
| | | } |
New file |
| | |
| | | package com.mes.bigstorage.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.mes.bigstorage.entity.BigStorageCage; |
| | | import com.mes.bigstorage.mapper.BigStorageCageMapper; |
| | | import com.mes.bigstorage.service.BigStorageCageService; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | /** |
| | | * <p> |
| | | * 服务实现类 |
| | | * </p> |
| | | * |
| | | * @author zhoush |
| | | * @since 2024-03-27 |
| | | */ |
| | | @Service |
| | | public class BigStorageCageServiceImpl extends ServiceImpl<BigStorageCageMapper, BigStorageCage> implements BigStorageCageService { |
| | | |
| | | } |
New file |
| | |
| | | package com.mes.temperingglass.controller; |
| | | |
| | | |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | /** |
| | | * <p> |
| | | * 前端控制器 |
| | | * </p> |
| | | * |
| | | * @author zhoush |
| | | * @since 2024-03-27 |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/temperingGlassInfo") |
| | | public class TemperingGlassInfoController { |
| | | |
| | | } |
| | | |
New file |
| | |
| | | package com.mes.temperingglass.entity; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import java.io.Serializable; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | |
| | | /** |
| | | * <p> |
| | | * |
| | | * </p> |
| | | * |
| | | * @author zhoush |
| | | * @since 2024-03-27 |
| | | */ |
| | | @Data |
| | | @EqualsAndHashCode(callSuper = false) |
| | | public class TemperingGlassInfo implements Serializable { |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | /** |
| | | * 钢化小片信息表id |
| | | */ |
| | | @TableId(value = "id", type = IdType.AUTO) |
| | | private Long id; |
| | | |
| | | /** |
| | | * 流程卡 |
| | | */ |
| | | private String flowcardId; |
| | | |
| | | /** |
| | | * 流程卡玻璃类型 |
| | | */ |
| | | private Integer glassType; |
| | | |
| | | /** |
| | | * 宽 |
| | | */ |
| | | private Double width; |
| | | |
| | | /** |
| | | * 高 |
| | | */ |
| | | private Double height; |
| | | |
| | | /** |
| | | * 厚度 |
| | | */ |
| | | private Double thickness; |
| | | |
| | | /** |
| | | * 膜系 |
| | | */ |
| | | private Integer filmsid; |
| | | |
| | | /** |
| | | * 钢化是否接受横放 |
| | | */ |
| | | private Integer ishorizontal; |
| | | |
| | | /** |
| | | * 钢化版图id |
| | | */ |
| | | private Integer temperingLayoutId; |
| | | |
| | | /** |
| | | * 钢化版图片序 |
| | | */ |
| | | private Integer temperingFeedSequence; |
| | | |
| | | /** |
| | | * x坐标 |
| | | */ |
| | | private Integer xCoordinate; |
| | | |
| | | /** |
| | | * y坐标 |
| | | */ |
| | | private Integer yCoordinate; |
| | | |
| | | /** |
| | | * 旋转角度(逆时针) |
| | | */ |
| | | private Integer angle; |
| | | |
| | | /** |
| | | * 状态 |
| | | */ |
| | | private Integer state; |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.mes.temperingglass.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.mes.temperingglass.entity.TemperingGlassInfo; |
| | | |
| | | /** |
| | | * <p> |
| | | * Mapper 接口 |
| | | * </p> |
| | | * |
| | | * @author zhoush |
| | | * @since 2024-03-27 |
| | | */ |
| | | public interface TemperingGlassInfoMapper extends BaseMapper<TemperingGlassInfo> { |
| | | |
| | | } |
New file |
| | |
| | | package com.mes.temperingglass.service; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.mes.temperingglass.entity.TemperingGlassInfo; |
| | | |
| | | /** |
| | | * <p> |
| | | * 服务类 |
| | | * </p> |
| | | * |
| | | * @author zhoush |
| | | * @since 2024-03-27 |
| | | */ |
| | | public interface TemperingGlassInfoService extends IService<TemperingGlassInfo> { |
| | | |
| | | } |
New file |
| | |
| | | package com.mes.temperingglass.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.mes.temperingglass.entity.TemperingGlassInfo; |
| | | import com.mes.temperingglass.mapper.TemperingGlassInfoMapper; |
| | | import com.mes.temperingglass.service.TemperingGlassInfoService; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | /** |
| | | * <p> |
| | | * 服务类 |
| | | * </p> |
| | | * |
| | | * @author zhoush |
| | | * @since 2024-03-27 |
| | | */ |
| | | @Service |
| | | public class TemperingGlassInfoServiceImpl extends ServiceImpl<TemperingGlassInfoMapper, TemperingGlassInfo> implements TemperingGlassInfoService { |
| | | |
| | | } |
New file |
| | |
| | | package com.mes.uppattenusage.controller; |
| | | |
| | | |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | /** |
| | | * <p> |
| | | * 前端控制器 |
| | | * </p> |
| | | * |
| | | * @author zhoush |
| | | * @since 2024-03-27 |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/glassInfo") |
| | | public class GlassInfoController { |
| | | |
| | | } |
| | | |
New file |
| | |
| | | package com.mes.uppattenusage.entity; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import java.io.Serializable; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | |
| | | /** |
| | | * <p> |
| | | * |
| | | * </p> |
| | | * |
| | | * @author zhoush |
| | | * @since 2024-03-27 |
| | | */ |
| | | @Data |
| | | @EqualsAndHashCode(callSuper = false) |
| | | public class GlassInfo implements Serializable { |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | /** |
| | | * 玻璃信息表id |
| | | */ |
| | | @TableId(value = "id", type = IdType.AUTO) |
| | | private Long 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; |
| | | |
| | | /** |
| | | * 钢化版图id |
| | | */ |
| | | private Integer temperingLayoutId; |
| | | |
| | | /** |
| | | * 钢化版图片序 |
| | | */ |
| | | private Integer temperingFeedSequence; |
| | | |
| | | /** |
| | | * x坐标 |
| | | */ |
| | | private Integer xCoordinate; |
| | | |
| | | /** |
| | | * y坐标 |
| | | */ |
| | | private Integer yCoordinate; |
| | | |
| | | /** |
| | | * 旋转角度(逆时针) |
| | | */ |
| | | private Integer angle; |
| | | |
| | | /** |
| | | * 工程号 |
| | | */ |
| | | private Integer engineerId; |
| | | |
| | | /** |
| | | * 生产规则id |
| | | */ |
| | | private Integer ruleId; |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.mes.uppattenusage.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.mes.uppattenusage.entity.GlassInfo; |
| | | |
| | | /** |
| | | * <p> |
| | | * Mapper 接口 |
| | | * </p> |
| | | * |
| | | * @author zhoush |
| | | * @since 2024-03-27 |
| | | */ |
| | | public interface GlassInfoMapper extends BaseMapper<GlassInfo> { |
| | | |
| | | } |
New file |
| | |
| | | package com.mes.uppattenusage.service; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.mes.uppattenusage.entity.GlassInfo; |
| | | |
| | | /** |
| | | * <p> |
| | | * 服务类 |
| | | * </p> |
| | | * |
| | | * @author zhoush |
| | | * @since 2024-03-27 |
| | | */ |
| | | public interface GlassInfoService extends IService<GlassInfo> { |
| | | |
| | | } |
New file |
| | |
| | | package com.mes.uppattenusage.service.impl; |
| | | |
| | | import com.mes.uppattenusage.entity.GlassInfo; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.mes.uppattenusage.mapper.GlassInfoMapper; |
| | | import com.mes.uppattenusage.service.GlassInfoService; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | /** |
| | | * <p> |
| | | * 服务实现类 |
| | | * </p> |
| | | * |
| | | * @author zhoush |
| | | * @since 2024-03-27 |
| | | */ |
| | | @Service |
| | | public class GlassInfoServiceImpl extends ServiceImpl<GlassInfoMapper, GlassInfo> implements GlassInfoService { |
| | | |
| | | } |
New file |
| | |
| | | server: |
| | | port: 8082 |
| | | |
| | | spring: |
| | | datasource: |
| | | driver-class-name: com.mysql.cj.jdbc.Driver |
| | | url: jdbc:mysql://10.153.19.150:3306/hangzhoumes?serverTimezone=GMT%2b8&characterEncoding=utf-8&useSSL=false |
| | | username: root |
| | | password: beibo.123/ |
| | | cloud: |
| | | nacos: |
| | | discovery: |
| | | server-addr: 127.0.0.1:8848 |
| | | application: |
| | | name: cacheVerticalGlass |
| | | redis: |
| | | database: 0 |
| | | host: 192.168.56.10 |
| | | port: 6379 |
| | | mybatis-plus: |
| | | mapper-locations: classpath*:mapper/*.xml |
| | | configuration: |
| | | log-impl: org.apache.ibatis.logging.stdout.StdOutImpl |
New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <project xmlns="http://maven.apache.org/POM/4.0.0" |
| | | xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" |
| | | xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> |
| | | <parent> |
| | | <artifactId>moduleService</artifactId> |
| | | <groupId>com.mes</groupId> |
| | | <version>1.0-SNAPSHOT</version> |
| | | </parent> |
| | | <modelVersion>4.0.0</modelVersion> |
| | | |
| | | <artifactId>loadGlass</artifactId> |
| | | |
| | | <properties> |
| | | <maven.compiler.source>8</maven.compiler.source> |
| | | <maven.compiler.target>8</maven.compiler.target> |
| | | </properties> |
| | | |
| | | </project> |
New file |
| | |
| | | package com.mes; |
| | | |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.mybatis.spring.annotation.MapperScan; |
| | | import org.springframework.boot.SpringApplication; |
| | | import org.springframework.boot.autoconfigure.SpringBootApplication; |
| | | import org.springframework.cloud.client.discovery.EnableDiscoveryClient; |
| | | import springfox.documentation.swagger2.annotations.EnableSwagger2; |
| | | |
| | | /** |
| | | * @Author : zhoush |
| | | * @Date: 2024/4/8 13:26 |
| | | * @Description: |
| | | */ |
| | | @Slf4j |
| | | @SpringBootApplication |
| | | @EnableSwagger2 |
| | | @EnableDiscoveryClient |
| | | @MapperScan(basePackages = "com.mes.*.mapper") |
| | | public class LoadGlassModuleApplication { |
| | | public static void main(String[] args) { |
| | | try { |
| | | SpringApplication.run(LoadGlassModuleApplication.class, args); |
| | | } catch (Exception e) { |
| | | log.error(e.getMessage()); |
| | | } |
| | | |
| | | } |
| | | } |
New file |
| | |
| | | package com.mes.temperingglass.controller; |
| | | |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | /** |
| | | * <p> |
| | | * 前端控制器 |
| | | * </p> |
| | | * |
| | | * @author zhoush |
| | | * @since 2024-04-07 |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/temperingGlassInfo") |
| | | public class TemperingGlassInfoController { |
| | | |
| | | //todo: 实例代码 待删除 |
| | | @ApiOperation("测试") |
| | | @GetMapping("/index") |
| | | public String index() { |
| | | return "hello world"; |
| | | } |
| | | } |
| | | |
New file |
| | |
| | | package com.mes.temperingglass.entity; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | |
| | | import java.io.Serializable; |
| | | |
| | | /** |
| | | * <p> |
| | | * |
| | | * </p> |
| | | * |
| | | * @author zhoush |
| | | * @since 2024-04-07 |
| | | */ |
| | | @Data |
| | | @EqualsAndHashCode(callSuper = false) |
| | | public class TemperingGlassInfo implements Serializable { |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | /** |
| | | * 钢化小片信息表id |
| | | */ |
| | | @TableId(value = "id", type = IdType.AUTO) |
| | | private Long id; |
| | | |
| | | /** |
| | | * 流程卡 |
| | | */ |
| | | private String flowcardId; |
| | | |
| | | /** |
| | | * 流程卡玻璃类型 |
| | | */ |
| | | private Integer glassType; |
| | | |
| | | /** |
| | | * 宽 |
| | | */ |
| | | private Double width; |
| | | |
| | | /** |
| | | * 高 |
| | | */ |
| | | private Double height; |
| | | |
| | | /** |
| | | * 厚度 |
| | | */ |
| | | private Double thickness; |
| | | |
| | | /** |
| | | * 膜系 |
| | | */ |
| | | private Integer filmsid; |
| | | |
| | | /** |
| | | * 钢化是否接受横放 |
| | | */ |
| | | private Integer ishorizontal; |
| | | |
| | | /** |
| | | * 钢化版图id |
| | | */ |
| | | private Integer temperingLayoutId; |
| | | |
| | | /** |
| | | * 钢化版图片序 |
| | | */ |
| | | private Integer temperingFeedSequence; |
| | | |
| | | /** |
| | | * x坐标 |
| | | */ |
| | | private Integer xCoordinate; |
| | | |
| | | /** |
| | | * y坐标 |
| | | */ |
| | | private Integer yCoordinate; |
| | | |
| | | /** |
| | | * 旋转角度(逆时针) |
| | | */ |
| | | private Integer angle; |
| | | |
| | | /** |
| | | * 状态 |
| | | */ |
| | | private Integer state; |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.mes.temperingglass.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.mes.temperingglass.entity.TemperingGlassInfo; |
| | | |
| | | /** |
| | | * <p> |
| | | * Mapper 接口 |
| | | * </p> |
| | | * |
| | | * @author zhoush |
| | | * @since 2024-04-07 |
| | | */ |
| | | public interface TemperingGlassInfoMapper extends BaseMapper<TemperingGlassInfo> { |
| | | |
| | | } |
New file |
| | |
| | | package com.mes.temperingglass.service; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.mes.temperingglass.entity.TemperingGlassInfo; |
| | | |
| | | /** |
| | | * <p> |
| | | * 服务类 |
| | | * </p> |
| | | * |
| | | * @author zhoush |
| | | * @since 2024-04-07 |
| | | */ |
| | | public interface TemperingGlassInfoService extends IService<TemperingGlassInfo> { |
| | | |
| | | } |
New file |
| | |
| | | package com.mes.temperingglass.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.mes.temperingglass.entity.TemperingGlassInfo; |
| | | import com.mes.temperingglass.mapper.TemperingGlassInfoMapper; |
| | | import com.mes.temperingglass.service.TemperingGlassInfoService; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | /** |
| | | * <p> |
| | | * 服务实现类 |
| | | * </p> |
| | | * |
| | | * @author zhoush |
| | | * @since 2024-04-07 |
| | | */ |
| | | @Service |
| | | public class TemperingGlassInfoServiceImpl extends ServiceImpl<TemperingGlassInfoMapper, TemperingGlassInfo> implements TemperingGlassInfoService { |
| | | |
| | | } |
New file |
| | |
| | | package com.mes.uppattenusage.controller; |
| | | |
| | | |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | /** |
| | | * <p> |
| | | * 前端控制器 |
| | | * </p> |
| | | * |
| | | * @author zhoush |
| | | * @since 2024-04-07 |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/upPattenUsage") |
| | | public class UpPattenUsageController { |
| | | |
| | | } |
| | | |
New file |
| | |
| | | package com.mes.uppattenusage.entity; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import java.io.Serializable; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | |
| | | /** |
| | | * <p> |
| | | * |
| | | * </p> |
| | | * |
| | | * @author zhoush |
| | | * @since 2024-04-07 |
| | | */ |
| | | @Data |
| | | @EqualsAndHashCode(callSuper = false) |
| | | public class UpPattenUsage implements Serializable { |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | /** |
| | | * 原片使用情况表id |
| | | */ |
| | | @TableId(value = "id", type = IdType.AUTO) |
| | | private Integer id; |
| | | |
| | | /** |
| | | * 工程号 |
| | | */ |
| | | private Integer engineeringId; |
| | | |
| | | /** |
| | | * 膜系id |
| | | */ |
| | | private Integer filmsId; |
| | | |
| | | /** |
| | | * 宽 |
| | | */ |
| | | private Double width; |
| | | |
| | | /** |
| | | * 高 |
| | | */ |
| | | private Double height; |
| | | |
| | | /** |
| | | * 厚度 |
| | | */ |
| | | private Double thickness; |
| | | |
| | | /** |
| | | * 原片版图片序 |
| | | */ |
| | | private Integer layoutSequence; |
| | | |
| | | /** |
| | | * 状态 |
| | | */ |
| | | private Integer state; |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.mes.uppattenusage.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.mes.uppattenusage.entity.UpPattenUsage; |
| | | |
| | | /** |
| | | * <p> |
| | | * Mapper 接口 |
| | | * </p> |
| | | * |
| | | * @author zhoush |
| | | * @since 2024-04-07 |
| | | */ |
| | | public interface UpPattenUsageMapper extends BaseMapper<UpPattenUsage> { |
| | | |
| | | } |
New file |
| | |
| | | package com.mes.uppattenusage.service; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.mes.uppattenusage.entity.UpPattenUsage; |
| | | |
| | | /** |
| | | * <p> |
| | | * 服务类 |
| | | * </p> |
| | | * |
| | | * @author zhoush |
| | | * @since 2024-04-07 |
| | | */ |
| | | public interface UpPattenUsageService extends IService<UpPattenUsage> { |
| | | |
| | | } |
New file |
| | |
| | | package com.mes.uppattenusage.service.impl; |
| | | |
| | | import com.mes.uppattenusage.entity.UpPattenUsage; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.mes.uppattenusage.mapper.UpPattenUsageMapper; |
| | | import com.mes.uppattenusage.service.UpPattenUsageService; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | /** |
| | | * <p> |
| | | * 服务实现类 |
| | | * </p> |
| | | * |
| | | * @author zhoush |
| | | * @since 2024-04-07 |
| | | */ |
| | | @Service |
| | | public class UpPattenUsageServiceImpl extends ServiceImpl<UpPattenUsageMapper, UpPattenUsage> implements UpPattenUsageService { |
| | | |
| | | } |
New file |
| | |
| | | package com.mes.upworkstation.controller; |
| | | |
| | | |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | /** |
| | | * <p> |
| | | * 前端控制器 |
| | | * </p> |
| | | * |
| | | * @author zhoush |
| | | * @since 2024-04-07 |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/upWorkstation") |
| | | public class UpWorkstationController { |
| | | |
| | | } |
| | | |
New file |
| | |
| | | package com.mes.upworkstation.entity; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import java.io.Serializable; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | |
| | | /** |
| | | * <p> |
| | | * |
| | | * </p> |
| | | * |
| | | * @author zhoush |
| | | * @since 2024-04-07 |
| | | */ |
| | | @Data |
| | | @EqualsAndHashCode(callSuper = false) |
| | | public class UpWorkstation implements Serializable { |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | /** |
| | | * 上片工位表id |
| | | */ |
| | | @TableId(value = "id", type = IdType.AUTO) |
| | | private Integer id; |
| | | |
| | | /** |
| | | * 工位号 |
| | | */ |
| | | private Integer workstationId; |
| | | |
| | | /** |
| | | * 设备id |
| | | */ |
| | | private Integer deviceId; |
| | | |
| | | /** |
| | | * 启用状态 |
| | | */ |
| | | private Integer enableState; |
| | | |
| | | /** |
| | | * 工作状态 |
| | | */ |
| | | private Integer workState; |
| | | |
| | | /** |
| | | * 原片宽 |
| | | */ |
| | | private Double patternWidth; |
| | | |
| | | /** |
| | | * 原片高 |
| | | */ |
| | | private Double patternHeigth; |
| | | |
| | | /** |
| | | * 原片厚度 |
| | | */ |
| | | private Double patternThickness; |
| | | |
| | | /** |
| | | * 膜系 |
| | | */ |
| | | private Integer filmsId; |
| | | |
| | | /** |
| | | * 数量 |
| | | */ |
| | | private Integer number; |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.mes.upworkstation.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.mes.upworkstation.entity.UpWorkstation; |
| | | |
| | | /** |
| | | * <p> |
| | | * Mapper 接口 |
| | | * </p> |
| | | * |
| | | * @author zhoush |
| | | * @since 2024-04-07 |
| | | */ |
| | | public interface UpWorkstationMapper extends BaseMapper<UpWorkstation> { |
| | | |
| | | } |
New file |
| | |
| | | package com.mes.upworkstation.service; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.mes.upworkstation.entity.UpWorkstation; |
| | | |
| | | /** |
| | | * <p> |
| | | * 服务类 |
| | | * </p> |
| | | * |
| | | * @author zhoush |
| | | * @since 2024-04-07 |
| | | */ |
| | | public interface UpWorkstationService extends IService<UpWorkstation> { |
| | | |
| | | } |
New file |
| | |
| | | package com.mes.upworkstation.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.mes.upworkstation.entity.UpWorkstation; |
| | | import com.mes.upworkstation.mapper.UpWorkstationMapper; |
| | | import com.mes.upworkstation.service.UpWorkstationService; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | /** |
| | | * <p> |
| | | * 服务实现类 |
| | | * </p> |
| | | * |
| | | * @author zhoush |
| | | * @since 2024-04-07 |
| | | */ |
| | | @Service |
| | | public class UpWorkstationServiceImpl extends ServiceImpl<UpWorkstationMapper, UpWorkstation> implements UpWorkstationService { |
| | | |
| | | } |
New file |
| | |
| | | server: |
| | | port: 8083 |
| | | |
| | | spring: |
| | | datasource: |
| | | driver-class-name: com.mysql.cj.jdbc.Driver |
| | | url: jdbc:mysql://10.153.19.150:3306/hangzhoumes?serverTimezone=GMT%2b8&characterEncoding=utf-8&useSSL=false |
| | | username: root |
| | | password: beibo.123/ |
| | | cloud: |
| | | nacos: |
| | | discovery: |
| | | server-addr: 127.0.0.1:8848 |
| | | application: |
| | | name: loadGlass |
| | | redis: |
| | | database: 0 |
| | | host: 192.168.56.10 |
| | | port: 6379 |
| | | mybatis-plus: |
| | | mapper-locations: classpath*:mapper/*.xml |
| | | configuration: |
| | | log-impl: org.apache.ibatis.logging.stdout.StdOutImpl |
New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <project xmlns="http://maven.apache.org/POM/4.0.0" |
| | | xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" |
| | | xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> |
| | | <parent> |
| | | <artifactId>moduleService</artifactId> |
| | | <groupId>com.mes</groupId> |
| | | <version>1.0-SNAPSHOT</version> |
| | | </parent> |
| | | <modelVersion>4.0.0</modelVersion> |
| | | |
| | | <artifactId>temperingGlass</artifactId> |
| | | |
| | | <properties> |
| | | <maven.compiler.source>8</maven.compiler.source> |
| | | <maven.compiler.target>8</maven.compiler.target> |
| | | </properties> |
| | | |
| | | </project> |
New file |
| | |
| | | package com.mes; |
| | | |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.mybatis.spring.annotation.MapperScan; |
| | | import org.springframework.boot.SpringApplication; |
| | | import org.springframework.boot.autoconfigure.SpringBootApplication; |
| | | import org.springframework.cloud.client.discovery.EnableDiscoveryClient; |
| | | import springfox.documentation.swagger2.annotations.EnableSwagger2; |
| | | |
| | | /** |
| | | * @Author : zhoush |
| | | * @Date: 2024/4/8 13:26 |
| | | * @Description: |
| | | */ |
| | | @Slf4j |
| | | @SpringBootApplication |
| | | @EnableSwagger2 |
| | | @EnableDiscoveryClient |
| | | @MapperScan(basePackages = "com.mes.*.mapper") |
| | | public class TemperingGlassModuleApplication { |
| | | public static void main(String[] args) { |
| | | try { |
| | | SpringApplication.run(TemperingGlassModuleApplication.class, args); |
| | | } catch (Exception e) { |
| | | log.error(e.getMessage()); |
| | | } |
| | | |
| | | } |
| | | } |
New file |
| | |
| | | package com.mes.temperingglass.controller; |
| | | |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | /** |
| | | * <p> |
| | | * 前端控制器 |
| | | * </p> |
| | | * |
| | | * @author zhoush |
| | | * @since 2024-04-07 |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/temperingGlassInfo") |
| | | public class TemperingGlassInfoController { |
| | | |
| | | //todo: 实例代码 待删除 |
| | | @ApiOperation("测试") |
| | | @GetMapping("/index") |
| | | public String index() { |
| | | return "hello world"; |
| | | } |
| | | } |
| | | |
New file |
| | |
| | | package com.mes.temperingglass.entity; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import java.io.Serializable; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | |
| | | /** |
| | | * <p> |
| | | * |
| | | * </p> |
| | | * |
| | | * @author zhoush |
| | | * @since 2024-04-07 |
| | | */ |
| | | @Data |
| | | @EqualsAndHashCode(callSuper = false) |
| | | public class TemperingGlassInfo implements Serializable { |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | /** |
| | | * 钢化小片信息表id |
| | | */ |
| | | @TableId(value = "id", type = IdType.AUTO) |
| | | private Long id; |
| | | |
| | | /** |
| | | * 流程卡 |
| | | */ |
| | | private String flowcardId; |
| | | |
| | | /** |
| | | * 流程卡玻璃类型 |
| | | */ |
| | | private Integer glassType; |
| | | |
| | | /** |
| | | * 宽 |
| | | */ |
| | | private Double width; |
| | | |
| | | /** |
| | | * 高 |
| | | */ |
| | | private Double height; |
| | | |
| | | /** |
| | | * 厚度 |
| | | */ |
| | | private Double thickness; |
| | | |
| | | /** |
| | | * 膜系 |
| | | */ |
| | | private Integer filmsid; |
| | | |
| | | /** |
| | | * 钢化是否接受横放 |
| | | */ |
| | | private Integer ishorizontal; |
| | | |
| | | /** |
| | | * 钢化版图id |
| | | */ |
| | | private Integer temperingLayoutId; |
| | | |
| | | /** |
| | | * 钢化版图片序 |
| | | */ |
| | | private Integer temperingFeedSequence; |
| | | |
| | | /** |
| | | * x坐标 |
| | | */ |
| | | private Integer xCoordinate; |
| | | |
| | | /** |
| | | * y坐标 |
| | | */ |
| | | private Integer yCoordinate; |
| | | |
| | | /** |
| | | * 旋转角度(逆时针) |
| | | */ |
| | | private Integer angle; |
| | | |
| | | /** |
| | | * 状态 |
| | | */ |
| | | private Integer state; |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.mes.temperingglass.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.mes.temperingglass.entity.TemperingGlassInfo; |
| | | |
| | | /** |
| | | * <p> |
| | | * Mapper 接口 |
| | | * </p> |
| | | * |
| | | * @author zhoush |
| | | * @since 2024-04-07 |
| | | */ |
| | | public interface TemperingGlassInfoMapper extends BaseMapper<TemperingGlassInfo> { |
| | | |
| | | } |
New file |
| | |
| | | package com.mes.temperingglass.service; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.mes.temperingglass.entity.TemperingGlassInfo; |
| | | |
| | | /** |
| | | * <p> |
| | | * 服务类 |
| | | * </p> |
| | | * |
| | | * @author zhoush |
| | | * @since 2024-04-07 |
| | | */ |
| | | public interface TemperingGlassInfoService extends IService<TemperingGlassInfo> { |
| | | |
| | | } |
New file |
| | |
| | | package com.mes.temperingglass.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.mes.temperingglass.entity.TemperingGlassInfo; |
| | | import com.mes.temperingglass.mapper.TemperingGlassInfoMapper; |
| | | import com.mes.temperingglass.service.TemperingGlassInfoService; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | /** |
| | | * <p> |
| | | * 服务实现类 |
| | | * </p> |
| | | * |
| | | * @author zhoush |
| | | * @since 2024-04-07 |
| | | */ |
| | | @Service |
| | | public class TemperingGlassInfoServiceImpl extends ServiceImpl<TemperingGlassInfoMapper, TemperingGlassInfo> implements TemperingGlassInfoService { |
| | | |
| | | } |
New file |
| | |
| | | server: |
| | | port: 8084 |
| | | spring: |
| | | datasource: |
| | | driver-class-name: com.mysql.cj.jdbc.Driver |
| | | url: jdbc:mysql://10.153.19.150:3306/hangzhoumes?serverTimezone=GMT%2b8&characterEncoding=utf-8&useSSL=false |
| | | username: root |
| | | password: beibo.123/ |
| | | cloud: |
| | | nacos: |
| | | discovery: |
| | | server-addr: 127.0.0.1:8848 |
| | | application: |
| | | name: temperingGlass |
| | | redis: |
| | | database: 0 |
| | | host: 192.168.56.10 |
| | | port: 6379 |
| | | mybatis-plus: |
| | | mapper-locations: classpath*:mapper/*.xml |
| | | configuration: |
| | | log-impl: org.apache.ibatis.logging.stdout.StdOutImpl |
New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <project xmlns="http://maven.apache.org/POM/4.0.0" |
| | | xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" |
| | | xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> |
| | | <parent> |
| | | <artifactId>moduleService</artifactId> |
| | | <groupId>com.mes</groupId> |
| | | <version>1.0-SNAPSHOT</version> |
| | | </parent> |
| | | <modelVersion>4.0.0</modelVersion> |
| | | |
| | | <artifactId>unLoadGlass</artifactId> |
| | | |
| | | <properties> |
| | | <maven.compiler.source>8</maven.compiler.source> |
| | | <maven.compiler.target>8</maven.compiler.target> |
| | | </properties> |
| | | |
| | | </project> |
New file |
| | |
| | | package com.mes; |
| | | |
| | | import org.mybatis.spring.annotation.MapperScan; |
| | | import org.springframework.boot.SpringApplication; |
| | | import org.springframework.boot.autoconfigure.SpringBootApplication; |
| | | import org.springframework.cloud.client.discovery.EnableDiscoveryClient; |
| | | |
| | | /** |
| | | * @Author : zhoush |
| | | * @Date: 2024/4/7 14:36 |
| | | * @Description: |
| | | */ |
| | | @SpringBootApplication |
| | | @EnableDiscoveryClient |
| | | @MapperScan(basePackages = "com.mes.*.mapper") |
| | | public class UnLoadGlassApplication { |
| | | public static void main(String[] args) { |
| | | SpringApplication.run(UnLoadGlassApplication.class, args); |
| | | } |
| | | } |
New file |
| | |
| | | package com.mes.downglassinfo.controller; |
| | | |
| | | |
| | | import com.mes.downglassinfo.entity.DownGlassInfo; |
| | | import com.mes.downglassinfo.service.DownGlassInfoService; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | | import org.springframework.web.bind.annotation.PathVariable; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | /** |
| | | * <p> |
| | | * 前端控制器 |
| | | * </p> |
| | | * |
| | | * @author zhoush |
| | | * @since 2024-03-27 |
| | | */ |
| | | @Api(tags = "下料信息") |
| | | @RestController |
| | | @RequestMapping("/downGlassInfo") |
| | | public class DownGlassInfoController { |
| | | |
| | | |
| | | } |
| | | |
New file |
| | |
| | | package com.mes.downglassinfo.controller; |
| | | |
| | | |
| | | import com.mes.downworkstation.entity.DownWorkstation; |
| | | import com.mes.downworkstation.service.DownWorkstationService; |
| | | import com.mes.uppattenusage.service.GlassInfoService; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * <p> |
| | | * 前端控制器 |
| | | * </p> |
| | | * |
| | | * @author zhoush |
| | | * @since 2024-04-07 |
| | | */ |
| | | @Api(tags = "下料任务") |
| | | @RestController |
| | | @RequestMapping("/downGlassTask") |
| | | public class DownGlassTaskController { |
| | | |
| | | //todo: 实例代码 待删除 |
| | | @ApiOperation("测试") |
| | | @GetMapping("/index") |
| | | public String index() { |
| | | return "hello world"; |
| | | } |
| | | } |
| | | |
New file |
| | |
| | | package com.mes.downglassinfo.entity; |
| | | |
| | | import java.io.Serializable; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | |
| | | /** |
| | | * <p> |
| | | * |
| | | * </p> |
| | | * |
| | | * @author zhoush |
| | | * @since 2024-03-27 |
| | | */ |
| | | @Data |
| | | @EqualsAndHashCode(callSuper = false) |
| | | public class DownGlassInfo implements Serializable { |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | /** |
| | | * 下片玻璃信息表id |
| | | */ |
| | | private Integer id; |
| | | |
| | | /** |
| | | * 流程卡号 |
| | | */ |
| | | private String flowCardId; |
| | | |
| | | /** |
| | | * 顺序 |
| | | */ |
| | | private Integer sequence; |
| | | |
| | | /** |
| | | * 宽 |
| | | */ |
| | | private Double width; |
| | | |
| | | /** |
| | | * 高 |
| | | */ |
| | | private Double height; |
| | | |
| | | /** |
| | | * 厚度 |
| | | */ |
| | | private Double thickness; |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.mes.downglassinfo.entity; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import java.io.Serializable; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | |
| | | /** |
| | | * <p> |
| | | * |
| | | * </p> |
| | | * |
| | | * @author zhoush |
| | | * @since 2024-04-07 |
| | | */ |
| | | @Data |
| | | @EqualsAndHashCode(callSuper = false) |
| | | public class DownGlassTask implements Serializable { |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | /** |
| | | * id |
| | | */ |
| | | @TableId(value = "id", type = IdType.AUTO) |
| | | private Integer id; |
| | | |
| | | /** |
| | | * 起始 |
| | | */ |
| | | private String startCell; |
| | | |
| | | /** |
| | | * 目标 |
| | | */ |
| | | private String endCell; |
| | | |
| | | /** |
| | | * 任务类型 1:进 2:出 |
| | | */ |
| | | private String taskType; |
| | | |
| | | /** |
| | | * 宽 |
| | | */ |
| | | private Double width; |
| | | |
| | | /** |
| | | * 高 |
| | | */ |
| | | private Double height; |
| | | |
| | | /** |
| | | * 膜系 |
| | | */ |
| | | private String filmsid; |
| | | |
| | | /** |
| | | * 厚度 |
| | | */ |
| | | private Double thickness; |
| | | |
| | | /** |
| | | * 流程卡号 |
| | | */ |
| | | private String flowCardId; |
| | | |
| | | /** |
| | | * 任务状态 0 未开始 1正在进行 2完成 |
| | | */ |
| | | private Integer taskStauts; |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.mes.downglassinfo.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.mes.downglassinfo.entity.DownGlassInfo; |
| | | |
| | | /** |
| | | * <p> |
| | | * Mapper 接口 |
| | | * </p> |
| | | * |
| | | * @author zhoush |
| | | * @since 2024-03-27 |
| | | */ |
| | | public interface DownGlassInfoMapper extends BaseMapper<DownGlassInfo> { |
| | | |
| | | } |
New file |
| | |
| | | package com.mes.downglassinfo.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.mes.downglassinfo.entity.DownGlassTask; |
| | | |
| | | /** |
| | | * <p> |
| | | * Mapper 接口 |
| | | * </p> |
| | | * |
| | | * @author zhoush |
| | | * @since 2024-04-07 |
| | | */ |
| | | public interface DownGlassTaskMapper extends BaseMapper<DownGlassTask> { |
| | | |
| | | } |
New file |
| | |
| | | package com.mes.downglassinfo.service; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.mes.downglassinfo.entity.DownGlassInfo; |
| | | |
| | | /** |
| | | * <p> |
| | | * 服务类 |
| | | * </p> |
| | | * |
| | | * @author zhoush |
| | | * @since 2024-03-27 |
| | | */ |
| | | public interface DownGlassInfoService extends IService<DownGlassInfo> { |
| | | |
| | | } |
New file |
| | |
| | | package com.mes.downglassinfo.service; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.mes.downglassinfo.entity.DownGlassTask; |
| | | |
| | | /** |
| | | * <p> |
| | | * 服务类 |
| | | * </p> |
| | | * |
| | | * @author zhoush |
| | | * @since 2024-04-07 |
| | | */ |
| | | public interface DownGlassTaskService extends IService<DownGlassTask> { |
| | | |
| | | } |
New file |
| | |
| | | package com.mes.downglassinfo.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.mes.downglassinfo.entity.DownGlassInfo; |
| | | import com.mes.downglassinfo.mapper.DownGlassInfoMapper; |
| | | import com.mes.downglassinfo.service.DownGlassInfoService; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | /** |
| | | * <p> |
| | | * 服务实现类 |
| | | * </p> |
| | | * |
| | | * @author zhoush |
| | | * @since 2024-03-27 |
| | | */ |
| | | @Service |
| | | public class DownGlassInfoServiceImpl extends ServiceImpl<DownGlassInfoMapper, DownGlassInfo> implements DownGlassInfoService { |
| | | |
| | | } |
New file |
| | |
| | | package com.mes.downglassinfo.service.impl; |
| | | |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.mes.downglassinfo.entity.DownGlassTask; |
| | | import com.mes.downglassinfo.mapper.DownGlassTaskMapper; |
| | | import com.mes.downglassinfo.service.DownGlassTaskService; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | /** |
| | | * <p> |
| | | * 服务实现类 |
| | | * </p> |
| | | * |
| | | * @author zhoush |
| | | * @since 2024-04-07 |
| | | */ |
| | | @Service |
| | | public class DownGlassTaskServiceImpl extends ServiceImpl<DownGlassTaskMapper, DownGlassTask> implements DownGlassTaskService { |
| | | |
| | | } |
New file |
| | |
| | | package com.mes.downstorage.controller; |
| | | |
| | | |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | /** |
| | | * <p> |
| | | * 前端控制器 |
| | | * </p> |
| | | * |
| | | * @author zhoush |
| | | * @since 2024-03-27 |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/downStorageCage") |
| | | public class DownStorageCageController { |
| | | |
| | | } |
| | | |
New file |
| | |
| | | package com.mes.downstorage.controller; |
| | | |
| | | |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | /** |
| | | * <p> |
| | | * 前端控制器 |
| | | * </p> |
| | | * |
| | | * @author zhoush |
| | | * @since 2024-03-27 |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/downStorageCageDetails") |
| | | public class DownStorageCageDetailsController { |
| | | |
| | | } |
| | | |
New file |
| | |
| | | package com.mes.downstorage.entity; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import java.io.Serializable; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | |
| | | /** |
| | | * <p> |
| | | * |
| | | * </p> |
| | | * |
| | | * @author zhoush |
| | | * @since 2024-03-27 |
| | | */ |
| | | @Data |
| | | @EqualsAndHashCode(callSuper = false) |
| | | public class DownStorageCage implements Serializable { |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | /** |
| | | * 下片前理片笼表id |
| | | */ |
| | | @TableId(value = "id", type = IdType.AUTO) |
| | | private Integer id; |
| | | |
| | | /** |
| | | * 设备id |
| | | */ |
| | | private Integer deviceId; |
| | | |
| | | /** |
| | | * 栅格号 |
| | | */ |
| | | private Integer slot; |
| | | |
| | | /** |
| | | * 启用状态 |
| | | */ |
| | | private String enableState; |
| | | |
| | | /** |
| | | * 剩余 |
| | | */ |
| | | private Integer remainWidth; |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.mes.downstorage.entity; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import java.io.Serializable; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | |
| | | /** |
| | | * <p> |
| | | * |
| | | * </p> |
| | | * |
| | | * @author zhoush |
| | | * @since 2024-03-27 |
| | | */ |
| | | @Data |
| | | @EqualsAndHashCode(callSuper = false) |
| | | public class DownStorageCageDetails implements Serializable { |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | /** |
| | | * 下片前理片笼明细表id |
| | | */ |
| | | @TableId(value = "id", type = IdType.AUTO) |
| | | private Integer id; |
| | | |
| | | /** |
| | | * 设备id |
| | | */ |
| | | private Integer deviceId; |
| | | |
| | | /** |
| | | * 栅格号 |
| | | */ |
| | | private Integer slot; |
| | | |
| | | /** |
| | | * 玻璃id |
| | | */ |
| | | private Integer glassId; |
| | | |
| | | /** |
| | | * 小片在格内的顺序 |
| | | */ |
| | | private Integer sequence; |
| | | |
| | | /** |
| | | * 流程卡号 |
| | | */ |
| | | private String flowCardId; |
| | | |
| | | /** |
| | | * 玻璃类型 |
| | | */ |
| | | private Integer glassType; |
| | | |
| | | /** |
| | | * 宽 |
| | | */ |
| | | private Double width; |
| | | |
| | | /** |
| | | * 高 |
| | | */ |
| | | private Double height; |
| | | |
| | | /** |
| | | * 厚度 |
| | | */ |
| | | private Double thickness; |
| | | |
| | | /** |
| | | * 钢化版图id |
| | | */ |
| | | private Integer temperingLayoutId; |
| | | |
| | | /** |
| | | * 钢化版图片序 |
| | | */ |
| | | private Integer temperingFeedSequence; |
| | | |
| | | /** |
| | | * 状态 |
| | | */ |
| | | private Integer state; |
| | | |
| | | /** |
| | | * 玻璃间隙 |
| | | */ |
| | | private Integer gap; |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.mes.downstorage.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.mes.downstorage.entity.DownStorageCageDetails; |
| | | |
| | | /** |
| | | * <p> |
| | | * Mapper 接口 |
| | | * </p> |
| | | * |
| | | * @author zhoush |
| | | * @since 2024-03-27 |
| | | */ |
| | | public interface DownStorageCageDetailsMapper extends BaseMapper<DownStorageCageDetails> { |
| | | |
| | | } |
New file |
| | |
| | | package com.mes.downstorage.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.mes.downstorage.entity.DownStorageCage; |
| | | |
| | | /** |
| | | * <p> |
| | | * Mapper 接口 |
| | | * </p> |
| | | * |
| | | * @author zhoush |
| | | * @since 2024-03-27 |
| | | */ |
| | | public interface DownStorageCageMapper extends BaseMapper<DownStorageCage> { |
| | | |
| | | } |
New file |
| | |
| | | package com.mes.downstorage.service; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.mes.downstorage.entity.DownStorageCageDetails; |
| | | |
| | | /** |
| | | * <p> |
| | | * 服务类 |
| | | * </p> |
| | | * |
| | | * @author zhoush |
| | | * @since 2024-03-27 |
| | | */ |
| | | public interface DownStorageCageDetailsService extends IService<DownStorageCageDetails> { |
| | | |
| | | } |
New file |
| | |
| | | package com.mes.downstorage.service; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.mes.downstorage.entity.DownStorageCage; |
| | | |
| | | /** |
| | | * <p> |
| | | * 服务类 |
| | | * </p> |
| | | * |
| | | * @author zhoush |
| | | * @since 2024-03-27 |
| | | */ |
| | | public interface DownStorageCageService extends IService<DownStorageCage> { |
| | | |
| | | } |
New file |
| | |
| | | package com.mes.downstorage.service.impl; |
| | | |
| | | import com.mes.downstorage.entity.DownStorageCageDetails; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.mes.downstorage.mapper.DownStorageCageDetailsMapper; |
| | | import com.mes.downstorage.service.DownStorageCageDetailsService; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | /** |
| | | * <p> |
| | | * 服务实现类 |
| | | * </p> |
| | | * |
| | | * @author zhoush |
| | | * @since 2024-03-27 |
| | | */ |
| | | @Service |
| | | public class DownStorageCageDetailsServiceImpl extends ServiceImpl<DownStorageCageDetailsMapper, DownStorageCageDetails> implements DownStorageCageDetailsService { |
| | | |
| | | } |
New file |
| | |
| | | package com.mes.downstorage.service.impl; |
| | | |
| | | import com.mes.downstorage.entity.DownStorageCage; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.mes.downstorage.mapper.DownStorageCageMapper; |
| | | import com.mes.downstorage.service.DownStorageCageService; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | /** |
| | | * <p> |
| | | * 服务实现类 |
| | | * </p> |
| | | * |
| | | * @author zhoush |
| | | * @since 2024-03-27 |
| | | */ |
| | | @Service |
| | | public class DownStorageCageServiceImpl extends ServiceImpl<DownStorageCageMapper, DownStorageCage> implements DownStorageCageService { |
| | | |
| | | } |
New file |
| | |
| | | package com.mes.downworkstation.controller; |
| | | |
| | | |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | /** |
| | | * <p> |
| | | * 前端控制器 |
| | | * </p> |
| | | * |
| | | * @author zhoush |
| | | * @since 2024-03-27 |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/downWorkstation") |
| | | public class DownWorkstationController { |
| | | |
| | | } |
| | | |
New file |
| | |
| | | package com.mes.downworkstation.controller; |
| | | |
| | | |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | /** |
| | | * <p> |
| | | * 前端控制器 |
| | | * </p> |
| | | * |
| | | * @author zhoush |
| | | * @since 2024-04-07 |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/downWorkstationTask") |
| | | public class DownWorkstationTaskController { |
| | | |
| | | } |
| | | |
New file |
| | |
| | | package com.mes.downworkstation.entity; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import java.io.Serializable; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | |
| | | /** |
| | | * <p> |
| | | * |
| | | * </p> |
| | | * |
| | | * @author zhoush |
| | | * @since 2024-03-27 |
| | | */ |
| | | @Data |
| | | @EqualsAndHashCode(callSuper = false) |
| | | public class DownWorkstation implements Serializable { |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | /** |
| | | * 下片工位表id |
| | | */ |
| | | @TableId(value = "id", type = IdType.AUTO) |
| | | private Integer id; |
| | | |
| | | /** |
| | | * 工位id |
| | | */ |
| | | private Integer workstationId; |
| | | |
| | | /** |
| | | * 流程卡号 |
| | | */ |
| | | private String flowCardId; |
| | | |
| | | /** |
| | | * 设备id |
| | | */ |
| | | private Integer deviceId; |
| | | |
| | | /** |
| | | * 启用状态 |
| | | */ |
| | | private Integer enableState; |
| | | |
| | | /** |
| | | * 工作状态 |
| | | */ |
| | | private Integer workState; |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.mes.downworkstation.entity; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import java.io.Serializable; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | |
| | | /** |
| | | * <p> |
| | | * |
| | | * </p> |
| | | * |
| | | * @author zhoush |
| | | * @since 2024-04-07 |
| | | */ |
| | | @Data |
| | | @EqualsAndHashCode(callSuper = false) |
| | | public class DownWorkstationTask implements Serializable { |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | /** |
| | | * id |
| | | */ |
| | | @TableId(value = "id", type = IdType.AUTO) |
| | | private Integer id; |
| | | |
| | | /** |
| | | * 宽 |
| | | */ |
| | | private Double width; |
| | | |
| | | /** |
| | | * 高 |
| | | */ |
| | | private Double height; |
| | | |
| | | /** |
| | | * 膜系 |
| | | */ |
| | | private String filmsid; |
| | | |
| | | /** |
| | | * 厚度 |
| | | */ |
| | | private Double thickness; |
| | | |
| | | /** |
| | | * 流程卡号 |
| | | */ |
| | | private String flowCardId; |
| | | |
| | | /** |
| | | * 任务状态 |
| | | */ |
| | | private Integer state; |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.mes.downworkstation.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.mes.downworkstation.entity.DownWorkstation; |
| | | |
| | | /** |
| | | * <p> |
| | | * Mapper 接口 |
| | | * </p> |
| | | * |
| | | * @author zhoush |
| | | * @since 2024-03-27 |
| | | */ |
| | | public interface DownWorkstationMapper extends BaseMapper<DownWorkstation> { |
| | | |
| | | } |
New file |
| | |
| | | package com.mes.downworkstation.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.mes.downworkstation.entity.DownWorkstationTask; |
| | | |
| | | /** |
| | | * <p> |
| | | * Mapper 接口 |
| | | * </p> |
| | | * |
| | | * @author zhoush |
| | | * @since 2024-04-07 |
| | | */ |
| | | public interface DownWorkstationTaskMapper extends BaseMapper<DownWorkstationTask> { |
| | | |
| | | } |
New file |
| | |
| | | package com.mes.downworkstation.service; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.mes.downworkstation.entity.DownWorkstation; |
| | | |
| | | /** |
| | | * <p> |
| | | * 服务类 |
| | | * </p> |
| | | * |
| | | * @author zhoush |
| | | * @since 2024-03-27 |
| | | */ |
| | | public interface DownWorkstationService extends IService<DownWorkstation> { |
| | | |
| | | } |
New file |
| | |
| | | package com.mes.downworkstation.service; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.mes.downworkstation.entity.DownWorkstationTask; |
| | | |
| | | /** |
| | | * <p> |
| | | * 服务类 |
| | | * </p> |
| | | * |
| | | * @author zhoush |
| | | * @since 2024-04-07 |
| | | */ |
| | | public interface DownWorkstationTaskService extends IService<DownWorkstationTask> { |
| | | |
| | | } |
New file |
| | |
| | | package com.mes.downworkstation.service.impl; |
| | | |
| | | import com.mes.downworkstation.entity.DownWorkstation; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.mes.downworkstation.mapper.DownWorkstationMapper; |
| | | import com.mes.downworkstation.service.DownWorkstationService; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | /** |
| | | * <p> |
| | | * 服务实现类 |
| | | * </p> |
| | | * |
| | | * @author zhoush |
| | | * @since 2024-03-27 |
| | | */ |
| | | @Service |
| | | public class DownWorkstationServiceImpl extends ServiceImpl<DownWorkstationMapper, DownWorkstation> implements DownWorkstationService { |
| | | |
| | | } |
New file |
| | |
| | | package com.mes.downworkstation.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.mes.downworkstation.entity.DownWorkstationTask; |
| | | import com.mes.downworkstation.mapper.DownWorkstationTaskMapper; |
| | | import com.mes.downworkstation.service.DownWorkstationTaskService; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | /** |
| | | * <p> |
| | | * 服务实现类 |
| | | * </p> |
| | | * |
| | | * @author zhoush |
| | | * @since 2024-04-07 |
| | | */ |
| | | @Service |
| | | public class DownWorkstationTaskServiceImpl extends ServiceImpl<DownWorkstationTaskMapper, DownWorkstationTask> implements DownWorkstationTaskService { |
| | | |
| | | } |
New file |
| | |
| | | package com.mes.uppattenusage.controller; |
| | | |
| | | |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | /** |
| | | * <p> |
| | | * 前端控制器 |
| | | * </p> |
| | | * |
| | | * @author zhoush |
| | | * @since 2024-03-27 |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/glassInfo") |
| | | public class GlassInfoController { |
| | | |
| | | } |
| | | |
New file |
| | |
| | | package com.mes.uppattenusage.entity; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | |
| | | import java.io.Serializable; |
| | | |
| | | /** |
| | | * <p> |
| | | * |
| | | * </p> |
| | | * |
| | | * @author zhoush |
| | | * @since 2024-03-27 |
| | | */ |
| | | @Data |
| | | @EqualsAndHashCode(callSuper = false) |
| | | public class GlassInfo implements Serializable { |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | /** |
| | | * 玻璃信息表id |
| | | */ |
| | | @TableId(value = "id", type = IdType.AUTO) |
| | | private Long 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; |
| | | |
| | | /** |
| | | * 钢化版图id |
| | | */ |
| | | private Integer temperingLayoutId; |
| | | |
| | | /** |
| | | * 钢化版图片序 |
| | | */ |
| | | private Integer temperingFeedSequence; |
| | | |
| | | /** |
| | | * x坐标 |
| | | */ |
| | | private Integer xCoordinate; |
| | | |
| | | /** |
| | | * y坐标 |
| | | */ |
| | | private Integer yCoordinate; |
| | | |
| | | /** |
| | | * 旋转角度(逆时针) |
| | | */ |
| | | private Integer angle; |
| | | |
| | | /** |
| | | * 工程号 |
| | | */ |
| | | private Integer engineerId; |
| | | |
| | | /** |
| | | * 生产规则id |
| | | */ |
| | | private Integer ruleId; |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.mes.uppattenusage.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.mes.uppattenusage.entity.GlassInfo; |
| | | |
| | | /** |
| | | * <p> |
| | | * Mapper 接口 |
| | | * </p> |
| | | * |
| | | * @author zhoush |
| | | * @since 2024-03-27 |
| | | */ |
| | | public interface GlassInfoMapper extends BaseMapper<GlassInfo> { |
| | | |
| | | } |
New file |
| | |
| | | package com.mes.uppattenusage.service; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.mes.uppattenusage.entity.GlassInfo; |
| | | |
| | | /** |
| | | * <p> |
| | | * 服务类 |
| | | * </p> |
| | | * |
| | | * @author zhoush |
| | | * @since 2024-03-27 |
| | | */ |
| | | public interface GlassInfoService extends IService<GlassInfo> { |
| | | |
| | | } |
New file |
| | |
| | | package com.mes.uppattenusage.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.mes.uppattenusage.entity.GlassInfo; |
| | | import com.mes.uppattenusage.mapper.GlassInfoMapper; |
| | | import com.mes.uppattenusage.service.GlassInfoService; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | /** |
| | | * <p> |
| | | * 服务实现类 |
| | | * </p> |
| | | * |
| | | * @author zhoush |
| | | * @since 2024-03-27 |
| | | */ |
| | | @Service |
| | | public class GlassInfoServiceImpl extends ServiceImpl<GlassInfoMapper, GlassInfo> implements GlassInfoService { |
| | | |
| | | } |
New file |
| | |
| | | server: |
| | | port: 8085 |
| | | |
| | | spring: |
| | | datasource: |
| | | driver-class-name: com.mysql.cj.jdbc.Driver |
| | | url: jdbc:mysql://10.153.19.150:3306/hangzhoumes?serverTimezone=GMT%2b8&characterEncoding=utf-8&useSSL=false |
| | | username: root |
| | | password: beibo.123/ |
| | | cloud: |
| | | nacos: |
| | | discovery: |
| | | server-addr: 127.0.0.1:8848 |
| | | application: |
| | | name: unLoadGlass |
| | | redis: |
| | | database: 0 |
| | | host: 192.168.56.10 |
| | | port: 6379 |
| | | mybatis-plus: |
| | | mapper-locations: classpath*:mapper/*.xml |
| | | configuration: |
| | | log-impl: org.apache.ibatis.logging.stdout.StdOutImpl |
New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <project xmlns="http://maven.apache.org/POM/4.0.0" |
| | | xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" |
| | | xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> |
| | | <parent> |
| | | <artifactId>hangzhoumesParent</artifactId> |
| | | <groupId>com.mes</groupId> |
| | | <version>1.0-SNAPSHOT</version> |
| | | </parent> |
| | | <modelVersion>4.0.0</modelVersion> |
| | | |
| | | <artifactId>moduleService</artifactId> |
| | | <packaging>pom</packaging> |
| | | <modules> |
| | | <module>CacheGlassModule</module> |
| | | <module>CacheVerticalGlassModule</module> |
| | | <module>LoadGlassModule</module> |
| | | <module>TemperingGlassModule</module> |
| | | <module>UnLoadGlassModule</module> |
| | | </modules> |
| | | |
| | | <properties> |
| | | <maven.compiler.source>8</maven.compiler.source> |
| | | <maven.compiler.target>8</maven.compiler.target> |
| | | </properties> |
| | | <dependencies> |
| | | <!--web 需要启动项目--> |
| | | <dependency> |
| | | <groupId>org.springframework.boot</groupId> |
| | | <artifactId>spring-boot-starter-web</artifactId> |
| | | </dependency> |
| | | |
| | | <dependency> |
| | | <groupId>org.apache.velocity</groupId> |
| | | <artifactId>velocity-engine-core</artifactId> |
| | | <version>2.0</version> |
| | | </dependency> |
| | | |
| | | <!--依赖服务的工具类--> |
| | | <dependency> |
| | | <groupId>com.mes</groupId> |
| | | <artifactId>common</artifactId> |
| | | <version>1.0-SNAPSHOT</version> |
| | | </dependency> |
| | | |
| | | <!--开发者工具--> |
| | | <dependency> |
| | | <groupId>org.springframework.boot</groupId> |
| | | <artifactId>spring-boot-devtools</artifactId> |
| | | <optional>true</optional> |
| | | </dependency> |
| | | |
| | | <dependency> |
| | | <groupId>org.springframework.boot</groupId> |
| | | <artifactId>spring-boot-starter-test</artifactId> |
| | | <scope>test</scope> |
| | | </dependency> |
| | | </dependencies> |
| | | |
| | | |
| | | </project> |
New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <project xmlns="http://maven.apache.org/POM/4.0.0" |
| | | xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" |
| | | xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> |
| | | <modelVersion>4.0.0</modelVersion> |
| | | |
| | | <groupId>com.mes</groupId> |
| | | <artifactId>hangzhoumesParent</artifactId> |
| | | <version>1.0-SNAPSHOT</version> |
| | | <modules> |
| | | <module>common</module> |
| | | <module>moduleService</module> |
| | | <module>gateway</module> |
| | | </modules> |
| | | <packaging>pom</packaging> |
| | | |
| | | <parent> |
| | | <groupId>org.springframework.boot</groupId> |
| | | <artifactId>spring-boot-starter-parent</artifactId> |
| | | <version>2.1.8.RELEASE</version> |
| | | </parent> |
| | | |
| | | <properties> |
| | | <!-- 跳过测试 --> |
| | | <skipTests>true</skipTests> |
| | | </properties> |
| | | |
| | | <dependencyManagement> |
| | | <dependencies> |
| | | <dependency> |
| | | <groupId>org.springframework.cloud</groupId> |
| | | <artifactId>spring-cloud-dependencies</artifactId> |
| | | <version>Greenwich.SR3</version> |
| | | <type>pom</type> |
| | | <scope>import</scope> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>com.alibaba.cloud</groupId> |
| | | <artifactId>spring-cloud-alibaba-dependencies</artifactId> |
| | | <version>2.1.0.RELEASE</version> |
| | | <type>pom</type> |
| | | <scope>import</scope> |
| | | </dependency> |
| | | </dependencies> |
| | | </dependencyManagement> |
| | | |
| | | <repositories> |
| | | <repository> |
| | | <id>nexus-aliyun</id> |
| | | <name>Nexus aliyun</name> |
| | | <layout>default</layout> |
| | | <url>https://maven.aliyun.com/repository/public</url> |
| | | <snapshots> |
| | | <enabled>false</enabled> |
| | | </snapshots> |
| | | <releases> |
| | | <enabled>true</enabled> |
| | | </releases> |
| | | </repository> |
| | | <repository> |
| | | <id>spring</id> |
| | | <url>https://maven.aliyun.com/repository/spring</url> |
| | | <releases> |
| | | <enabled>true</enabled> |
| | | </releases> |
| | | <snapshots> |
| | | <enabled>true</enabled> |
| | | </snapshots> |
| | | </repository> |
| | | </repositories> |
| | | |
| | | |
| | | </project> |
New file |
| | |
| | | 1、本项目是基于SpringBoot+Mybatis-plus+Mysql+Vue+ElementUI+Maven+Nginx的项目,目录结果结构如下: |
| | | |
| | | ├─src |
| | | ├─com 插件生成的代码,用于各自开发使用 |
| | | │ └─mes |
| | | ├─common 公共模块 |
| | | │ ├─src |
| | | └─moduleService |
| | | ├─-CacheGlassModule |
| | | ├─-CacheVerticalGlassModule |
| | | ├─-LoadGlassModule |
| | | ├─-TemperingGlassModule |
| | | └─-UnLoadGlassModule |
| | | 2、运行项目: |
| | | 1、启动项目:启动各自模块启动类 例如:CacheGlassModuleApplication.java#main() |
| | | 2、访问项目: |
| | | 3、项目地址:http://localhost:8081/mesModuleCache/doc.html#/home |
| | | 4、项目说明: 本界面为Api文档,公开人员用于调试 |
| | | 3、项目说明: |
| | | 1、项目分为公共模块common,业务模块moduleService。 |
| | | 2、common模块中包含公共的类,例如:公共的实体类、拦截器、工具类、常量类、异常处理等。 |
| | | 3、moduleService中包含各个业务模块,每个业务模块中包含一个启动类,开发人员需要开发各自负责的业务模块。 |
| | | 4、com目录下的文件为插件生成的代码,用于各自开发使用。用完删除即可,避免影响开发。 |