Merge branch 'master' of http://10.153.19.25:10101/r/HangZhouMes
| | |
| | | // WebSocketService.js
|
| | |
|
| | | let socket = null;
|
| | |
|
| | | let messages = '';
|
| | | export const initializeWebSocket = (socketUrl, messageHandler) => {
|
| | | if (typeof WebSocket === "undefined") {
|
| | | console.log("Your browser does not support WebSocket");
|
| | |
| | | if (!msg.data) {
|
| | | return;
|
| | | }
|
| | | |
| | | const obj = JSON.parse(msg.data);
|
| | | messages += msg.data;
|
| | | const isLastChunk = msg.data.endsWith('<END>');
|
| | | //是否为最后一块消息
|
| | | if(isLastChunk) {
|
| | | messages= messages.replace('<END>', '');
|
| | | const obj = JSON.parse(messages);
|
| | |
|
| | | // 调用消息处理函数,将数据传递给 Vue 组件
|
| | | if (messageHandler) {
|
| | | messageHandler(obj);
|
| | | }
|
| | | messages='';
|
| | | }
|
| | | |
| | | |
| | |
|
| | | |
| | | |
| | | };
|
| | |
|
| | | return socket;
|
New file |
| | |
| | | // src/services/api.js
|
| | | import request from 'request';
|
| | |
|
| | |
|
| | | export const findTasks = (id, newState) => {
|
| | | const url = `glassStorage/api/storageTask/findTasks`;
|
| | | const options = {
|
| | | method: 'POST',
|
| | | url,
|
| | | json: true,
|
| | | body: { id, enableState: newState }
|
| | | };
|
| | |
|
| | | return new Promise((resolve, reject) => {
|
| | | request(options, (error, response, body) => {
|
| | | if (error) {
|
| | | reject(new Error(error.message));
|
| | | } else {
|
| | | resolve(body);
|
| | | }
|
| | | });
|
| | | });
|
| | | };
|
| | |
| | | |
| | | |
| | | |
| | | const socketUrl = `ws://${WebSocketHost}:${host}/api/unLoadGlass/api/talk/unloadglass`; |
| | | const socketUrl = `ws://${WebSocketHost}:${host}/api/unLoadGlass/api/talk/downcache`; |
| | | // 定义消息处理函数,更新 receivedData 变量 |
| | | const handleMessage = (data) => { |
| | | // 更新 tableData 的数据 |
| | |
| | | </script>
|
| | |
|
| | | <style scoped>
|
| | | html, body {
|
| | | height: 100%;
|
| | | margin: 0;
|
| | | padding: 0;
|
| | | overflow: hidden; /* 禁止出现滚动条 */
|
| | | }
|
| | |
|
| | | .app-container {
|
| | |
|
| | | flex-direction: column;
|
| | | height: 100vh; /* 使用视口高度 */
|
| | | #dt { display:block; float:left;line-height: 20px;margin-left: 100px;}
|
| | | #dta { display:block; float:left;line-height: 20px;margin-left: 80%;}
|
| | | #dialog-footer{
|
| | | text-align: center;
|
| | | margin-top: -15px;
|
| | | }
|
| | |
|
| | |
|
| | |
| | | console.log('清除成功'); |
| | | ElMessage.success(response.message); |
| | | dialogFormVisiblea2.value = false; |
| | | } else if (response.code === 400) { |
| | | } else if (response.code === 500) { |
| | | // 清除失败的逻辑 |
| | | console.log('清除失败'); |
| | | console.log(response.message); // 打印服务器返回的错误信息 |
| | |
| | | */ |
| | | @ApiModelProperty(value = "宽") |
| | | private double width; |
| | | /** |
| | | * 宽 |
| | | */ |
| | | @ApiModelProperty(value = "高") |
| | | private double height; |
| | | |
| | | /** |
| | | * 格子号 |
| | |
| | | @ApiModelProperty(value = "玻璃id") |
| | | private Integer slot; |
| | | |
| | | /** |
| | | * x坐标 |
| | | */ |
| | | @ApiModelProperty(value = "x坐标", position = 13) |
| | | private Integer xCoordinate; |
| | | |
| | | /** |
| | | * y坐标 |
| | | */ |
| | | @ApiModelProperty(value = "y坐标", position = 14) |
| | | private Integer yCoordinate; |
| | | |
| | | } |
| | |
| | | package com.mes.damage.mapper; |
| | | |
| | | import com.baomidou.dynamic.datasource.annotation.DS; |
| | | import com.mes.damage.entity.Damage; |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | |
| | |
| | | * @author wu |
| | | * @since 2024-06-13 |
| | | */ |
| | | @DS("hangzhoumes") |
| | | public interface DamageMapper extends BaseMapper<Damage> { |
| | | |
| | | } |
| | |
| | | package com.mes.glassinfo.mapper; |
| | | |
| | | import com.baomidou.dynamic.datasource.annotation.DS; |
| | | import com.github.yulichang.base.MPJBaseMapper; |
| | | import com.mes.glassinfo.entity.GlassInfo; |
| | | |
| | |
| | | * @author wu |
| | | * @since 2024-04-29 |
| | | */ |
| | | @DS("hangzhoumes") |
| | | public interface GlassInfoMapper extends MPJBaseMapper<GlassInfo> { |
| | | |
| | | } |
| | |
| | | package com.mes.temperingglass.entity; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.mes.base.entity.BigStorageCageBaseInfo; |
| | |
| | | private Integer glassType; |
| | | |
| | | /** |
| | | * 高 |
| | | */ |
| | | @ApiModelProperty(value = "高", position = 7) |
| | | private double height; |
| | | |
| | | /** |
| | | * 厚度 |
| | | */ |
| | | @ApiModelProperty(value = "厚度", position = 8) |
| | |
| | | */ |
| | | @ApiModelProperty(value = "钢化版图片序", position = 12) |
| | | private Integer temperingFeedSequence; |
| | | |
| | | /** |
| | | * x坐标 |
| | | */ |
| | | @ApiModelProperty(value = "x坐标", position = 13) |
| | | private Integer xCoordinate; |
| | | |
| | | /** |
| | | * y坐标 |
| | | */ |
| | | @ApiModelProperty(value = "y坐标", position = 14) |
| | | private Integer yCoordinate; |
| | | |
| | | /** |
| | | * 旋转角度(逆时针) |
| | |
| | | * @since 2024-04-07 |
| | | */ |
| | | public interface TemperingGlassInfoService extends MPJBaseService<TemperingGlassInfo> { |
| | | |
| | | /** |
| | | * 等待中的玻璃 |
| | | * @return |
| | | */ |
| | | List<TemperingGlassInfo> selectWaitingGlass(); |
| | | |
| | | List<TemperingGlassInfo> selectIntoGlass(int layoutId); |
| | | |
| | | /** |
| | | * 进炉中的玻璃 |
| | | * @return |
| | | */ |
| | | List<TemperingGlassInfo> selectIntoGlass(TemperingGlassInfo temperingGlassInfo); |
| | | /** |
| | | * 出炉中的玻璃 |
| | | * @return |
| | | */ |
| | | List<TemperingGlassInfo> selectOutGlass(); |
| | | |
| | | /** |
| | | * 钢化后的玻璃 |
| | | * @return |
| | | */ |
| | | List<TemperingGlassInfo> selectOverGlass(); |
| | | |
| | | /** |
| | | * 查询钢化后的版图id |
| | | * @return |
| | | */ |
| | | List<TemperingGlassInfo> selectLayoutId(); |
| | | |
| | | /** |
| | | * 查询钢化状态 |
| | | * @return |
| | | */ |
| | | List<TemperingGlassInfo> selectTaskType(); |
| | | /** |
| | | * 钢化模块破损 |
| | | * @return |
| | | */ |
| | | Integer updateTemperingState(TemperingGlassInfo temperingGlassInfo); |
| | | |
| | | } |
| | |
| | | |
| | | import com.baomidou.dynamic.datasource.annotation.DS; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; |
| | | import com.mes.temperingglass.entity.TemperingGlassInfo; |
| | | import com.mes.temperingglass.mapper.TemperingGlassInfoMapper; |
| | | import com.mes.temperingglass.service.TemperingGlassInfoService; |
| | |
| | | public List<TemperingGlassInfo> selectWaitingGlass() { |
| | | //获取等待进炉中的玻璃信息 |
| | | QueryWrapper<TemperingGlassInfo> wrapper = new QueryWrapper<>(); |
| | | //wrapper.eq("state",1); |
| | | wrapper.in("state",1,0,-1); |
| | | return temperingMapper.selectList(wrapper); |
| | | wrapper.select("Top 1 *").eq("state",1); |
| | | TemperingGlassInfo glass=temperingMapper.selectOne(wrapper); |
| | | QueryWrapper<TemperingGlassInfo> glassinfo = new QueryWrapper<>(); |
| | | glassinfo.eq("engineer_id",glass.getEngineerId()) |
| | | .eq("tempering_layout_id", glass.getTemperingLayoutId()); |
| | | return temperingMapper.selectList(glassinfo); |
| | | } |
| | | |
| | | @Override |
| | | public List<TemperingGlassInfo> selectIntoGlass(int layoutId) { |
| | | public List<TemperingGlassInfo> selectIntoGlass(TemperingGlassInfo temperingGlassInfo) { |
| | | //获取进炉中的玻璃信息 |
| | | QueryWrapper<TemperingGlassInfo> wrapper = new QueryWrapper<>(); |
| | | wrapper.eq("state",2) |
| | | .eq("tempering_layout_id", layoutId) |
| | | wrapper.eq("tempering_layout_id", temperingGlassInfo.getTemperingLayoutId()) |
| | | .eq("engineer_id", temperingGlassInfo.getEngineerId()) |
| | | .orderByAsc("tempering_layout_id","tempering_feed_sequence"); |
| | | return temperingMapper.selectList(wrapper); |
| | | } |
| | |
| | | @Override |
| | | public List<TemperingGlassInfo> selectOutGlass() { |
| | | //获取出炉中的玻璃信息 |
| | | QueryWrapper<TemperingGlassInfo> wrap = new QueryWrapper<>(); |
| | | wrap.select("Top 1 *").eq("state",3); |
| | | TemperingGlassInfo glass=temperingMapper.selectOne(wrap); |
| | | //根据工程号和版图获取数据 |
| | | QueryWrapper<TemperingGlassInfo> wapper = new QueryWrapper<>(); |
| | | wapper.eq("state", 3) |
| | | wapper.eq("engineer_id",glass.getEngineerId()) |
| | | .eq("tempering_layout_id", glass.getTemperingLayoutId()) |
| | | .orderByAsc("tempering_layout_id","tempering_feed_sequence"); |
| | | return temperingMapper.selectList(wapper); |
| | | } |
| | |
| | | //获取过旋转台最大的钢化版图id |
| | | QueryWrapper<TemperingGlassInfo> wapper = new QueryWrapper<>(); |
| | | wapper.select("Top 1 *").eq("state", 4) |
| | | .orderByDesc("tempering_layout_id"); |
| | | .orderByDesc("tempering_layout_id,engineer_id"); |
| | | //根据最大的版图id显示钢化后的版图信息 |
| | | TemperingGlassInfo glassinfo= temperingMapper.selectOne(wapper); |
| | | if (glassinfo == null) { |
| | | return null; // 直接返回null,表示没有找到符合条件的记录 |
| | | } |
| | | QueryWrapper<TemperingGlassInfo> wrapper = new QueryWrapper<>(); |
| | | wrapper.eq("tempering_layout_id",glassinfo.getTemperingLayoutId()); |
| | | wrapper.eq("tempering_layout_id",glassinfo.getTemperingLayoutId()) |
| | | .eq("engineer_id",glassinfo.getEngineerId()); |
| | | |
| | | return temperingMapper.selectList(wrapper); |
| | | } |
| | |
| | | @Override |
| | | public List<TemperingGlassInfo> selectLayoutId() { |
| | | QueryWrapper<TemperingGlassInfo> wrapper = new QueryWrapper<>(); |
| | | wrapper.select("distinct tempering_layout_id") |
| | | wrapper.select("distinct tempering_layout_id,engineer_id") |
| | | .eq("state",2) |
| | | .orderByAsc("tempering_layout_id"); |
| | | return temperingMapper.selectList(wrapper); |
| | |
| | | .groupBy("state"); |
| | | return temperingMapper.selectList(wrapper); |
| | | } |
| | | |
| | | @Override |
| | | public Integer updateTemperingState(TemperingGlassInfo temperingGlassInfo) { |
| | | UpdateWrapper<TemperingGlassInfo> wrapper = new UpdateWrapper<>(); |
| | | wrapper.eq("glass_id",temperingGlassInfo.getGlassId()) |
| | | .lt("state",5) |
| | | .set("state", temperingGlassInfo.getState());; |
| | | if (temperingMapper.update(null,wrapper) > 0) { |
| | | return 200; |
| | | }else { |
| | | return 100; |
| | | } |
| | | } |
| | | } |
| | |
| | | s7PLC.writeUInt16(address, data); |
| | | result = true; |
| | | } catch (Exception ex) { |
| | | System.out.println("向plc写命令过程中发生异常,原因为:" + ex.getMessage()); |
| | | reStartS7client(); |
| | | } finally { |
| | | tryCount -= 1; |
| | |
| | | public void onOpen(Session session, @PathParam("username") String username) { |
| | | this.username = username; |
| | | this.session = session; |
| | | this.session.setMaxTextMessageBufferSize(12*1024*1024); |
| | | this.session.setMaxBinaryMessageBufferSize(12*1024*1024); |
| | | List<WebSocketServer> webSocketServers = sessionMap.get(username); |
| | | if (webSocketServers == null) { |
| | | ArrayList<WebSocketServer> arrayListwebserver = new ArrayList<WebSocketServer>(); |
| | |
| | | * |
| | | * @param message 客户端发送过来的消息 |
| | | */ |
| | | @OnMessage(maxMessageSize = 5242880) |
| | | @OnMessage |
| | | public void onMessage(String message, Session session, @PathParam("username") String username) { |
| | | log.info("服务端收到用户username={}的消息:{}", username, message); |
| | | JSONObject obj = JSONUtil.parseObj(message); |
| | |
| | | public void sendMessage(String message) { |
| | | try { |
| | | // log.info("服务端给客户端[{}]发送消息{}", this.session.getId(), message); |
| | | this.session.getBasicRemote().sendText(message); |
| | | if(this.session.isOpen()){ |
| | | int maxChunkSize = 50000; // 定义最大的分块大小 |
| | | int length = message.length(); |
| | | int chunks = (int) Math.ceil((double) length / maxChunkSize); |
| | | //分块发送消息 |
| | | for (int i = 0; i < chunks; i++) { |
| | | int startIndex = i * maxChunkSize; |
| | | int endIndex = Math.min(startIndex + maxChunkSize, length); |
| | | String chunk = message.substring(startIndex, endIndex); |
| | | |
| | | // 判断是否是最后一块消息 |
| | | boolean isLastChunk = (i == chunks - 1); |
| | | if(isLastChunk==true){ |
| | | chunk+="<END>"; |
| | | } |
| | | // 发送分块消息,并传递是否是最后一块消息的标识 |
| | | this.session.getBasicRemote().sendText(chunk); |
| | | } |
| | | } |
| | | } catch (Exception e) { |
| | | log.error("服务端发送消息给客户端失败", e); |
| | | log.error("发送消息给客户端失败:{}", e.getMessage(), e); |
| | | } |
| | | } |
| | | |
| | |
| | | package com.mes.work_assignment.mapper; |
| | | |
| | | import com.baomidou.dynamic.datasource.annotation.DS; |
| | | import com.mes.work_assignment.entity.WorkAssignment; |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | |
| | |
| | | * @author wu |
| | | * @since 2024-07-01 |
| | | */ |
| | | @DS("hangzhoumes") |
| | | public interface WorkAssignmentMapper extends BaseMapper<WorkAssignment> { |
| | | |
| | | } |
| | |
| | | package com.mes.userinfo.mapper; |
| | | |
| | | import com.baomidou.dynamic.datasource.annotation.DS; |
| | | import com.github.yulichang.base.MPJBaseMapper; |
| | | import com.mes.userinfo.entity.SysUser; |
| | | |
| | |
| | | * @author zhoush |
| | | * @since 2024-04-11 |
| | | */ |
| | | |
| | | @DS("hangzhoumes") |
| | | public interface SysUserMapper extends MPJBaseMapper<SysUser> { |
| | | |
| | | } |
| | |
| | | |
| | | @Test |
| | | public void testSelectCacheEmpty() { |
| | | List<EdgStorageCage> map = edgStorageCageService.selectCacheEmpty(); |
| | | log.info("笼内空格:{}", Arrays.asList(map)); |
| | | // List<EdgStorageCage> map = edgStorageCageService.selectCacheEmpty(); |
| | | // log.info("笼内空格:{}", Arrays.asList(map)); |
| | | } |
| | | |
| | | @Test |
| | |
| | | if(result==true){ |
| | | return Result.build(200,"指定钢化成功",1); |
| | | }else { |
| | | return Result.build(200, "已存在钢化任务", 1); |
| | | return Result.build(200, "已存在钢化任务,请等待钢化完成再指定钢化", 1); |
| | | } |
| | | } |
| | | |
| | |
| | | @ApiModelProperty(value = "玻璃类型", position = 8) |
| | | private Integer glassType; |
| | | |
| | | /** |
| | | * 高 |
| | | */ |
| | | @ApiModelProperty(value = "高", position = 10) |
| | | private double height; |
| | | |
| | | /** |
| | | * 厚度 |
| | |
| | | .eq(BigStorageCage::getRemainWidth, slotWidth) |
| | | .eq(BigStorageCage::getEnableState, Const.SLOT_ON) |
| | | .notInSql(BigStorageCage::getDeviceId, |
| | | "select distinct device_id from big_storage_cage_details where tempering_layout_id = " + glassInfo.getTemperingLayoutId()) |
| | | .gt(BigStorageCage::getMaxThickness, glassInfo.getThickness()) |
| | | "select distinct device_id from big_storage_cage_details where state in (100,102,103)") |
| | | .ge(BigStorageCage::getMaxThickness, glassInfo.getThickness()) |
| | | .orderByAsc(BigStorageCage::getDeviceId) |
| | | .last("limit 1")); |
| | | if (null != bigStorageCage) { |
| | |
| | | bigStorageCage = bigStorageCageService.getOne(new LambdaQueryWrapper<BigStorageCage>() |
| | | .eq(BigStorageCage::getRemainWidth, slotWidth) |
| | | .eq(BigStorageCage::getEnableState, Const.SLOT_ON) |
| | | .gt(BigStorageCage::getMaxThickness, glassInfo.getThickness()) |
| | | .ge(BigStorageCage::getMaxThickness, glassInfo.getThickness()) |
| | | .orderByAsc(BigStorageCage::getDeviceId) |
| | | .last("limit 1")); |
| | | Assert.isTrue(null != bigStorageCage, "没有空余的笼子存放玻璃"); |
| | |
| | | public boolean TemperingGlass(String temperingLayoutId, String engineerId){ |
| | | LambdaQueryWrapper<TemperingGlassInfo> temperingGlassInfoLambdaQueryWrapper=new LambdaQueryWrapper<>(); |
| | | temperingGlassInfoLambdaQueryWrapper |
| | | .eq(TemperingGlassInfo::getTemperingLayoutId,temperingLayoutId) |
| | | .eq(TemperingGlassInfo::getEngineerId,engineerId); |
| | | .eq(TemperingGlassInfo::getState,Const.TEMPERING_NEW); |
| | | List<TemperingGlassInfo> temperingGlassInfoList=temperingGlassInfoMapper.selectList(temperingGlassInfoLambdaQueryWrapper); |
| | | |
| | | if(temperingGlassInfoList.size()==0){ |
| | | LambdaQueryWrapper<BigStorageCageDetails> wrapper =new LambdaQueryWrapper<>(); |
| | | wrapper.eq(BigStorageCageDetails::getTemperingLayoutId,temperingLayoutId) |
| | |
| | | GlassInfo glassInfo=glassInfoMapper.selectOne(glassInfoLambdaQueryWrapper); |
| | | |
| | | BeanUtils.copyProperties(glassInfo, temperingGlassInfo); |
| | | temperingGlassInfo.setAngle((int) glassInfo.getAngle()); |
| | | temperingGlassInfo.setState(Const.TEMPERING_NEW); |
| | | temperingGlassInfo.setSlot(bigStorageCageDetails.getSlot()); |
| | | temperingGlassInfoMapper.insert(temperingGlassInfo); |
| | |
| | | public BigStorageCageOutTask() { |
| | | } |
| | | |
| | | public BigStorageCageOutTask(String glassId, Integer startSlot, Integer endSlot, Integer width, Integer trainNumber, Integer serialNumber, Integer taskState) { |
| | | public BigStorageCageOutTask(String glassId, Integer startSlot, Integer endSlot, double width, double height, Integer trainNumber, Integer serialNumber, Integer taskState) { |
| | | this.glassId = glassId; |
| | | this.startSlot = startSlot; |
| | | this.endSlot = endSlot; |
| | | this.width = width; |
| | | this.height = height; |
| | | this.trainNumber = trainNumber; |
| | | this.serialNumber = serialNumber; |
| | | this.taskState = taskState; |
| | |
| | | */ |
| | | @ApiModelProperty(value = "目标位置", position = 5) |
| | | private Integer endSlot; |
| | | /** |
| | | * 目标位置 |
| | | */ |
| | | @ApiModelProperty(value = "目标位置", position = 5) |
| | | private double width; |
| | | /** |
| | | * 目标位置 |
| | | */ |
| | | @ApiModelProperty(value = "目标位置", position = 5) |
| | | private double height; |
| | | |
| | | /** |
| | | * 车次 |
| | |
| | | e.printStackTrace(); |
| | | } |
| | | Date startDate = new Date(); |
| | | log.info("大理片笼读取plc数据开始时间:{}", startDate); |
| | | byte[] getplcvlues = plccontrol.readByte(PlcMesObject.getPlcAddressBegin(), PlcMesObject.getPlcAddressLength()); |
| | | Date endDate = new Date(); |
| | | log.info("大理片笼读取plc数据结束时间:{},共耗时:{}ms,结束扫码任务", endDate, endDate.getTime() - startDate.getTime()); |
| | | log.info("大理片笼读取plc数据,开始时间:{},结束时间:{},共耗时:{}ms,结束扫码任务", startDate, endDate, endDate.getTime() - startDate.getTime()); |
| | | if (getplcvlues != null) { |
| | | PlcMesObject.setPlcParameterList(getplcvlues); |
| | | log.info("大理片当前进卧转立确认字为d01:{},d04:{},进笼送片任务确认字为:d03:{},d05:{},出片任务确认字为{}", |
| | | PlcMesObject.getPlcParameter("MESToD01").getValue(), |
| | | PlcMesObject.getPlcParameter("MESToD04").getValue(), |
| | | PlcMesObject.getPlcParameter("MESToD03").getValue(), |
| | | PlcMesObject.getPlcParameter("MESToD05").getValue(), |
| | | PlcMesObject.getPlcParameter("MESToPLC").getValue()); |
| | | } |
| | | } |
| | | } |
| | |
| | | private TemperingGlassInfoService temperingGlassInfoService; |
| | | |
| | | private JSONObject jsonObject = new JSONObject(); |
| | | private JSONObject jsonObject1 = new JSONObject(); |
| | | public void queryDataSource1() throws InterruptedException { |
| | | List<Double> carPostion=new ArrayList<>(); |
| | | carPostion.add(0.25); |
| | | carPostion.add(0.5); |
| | | jsonObject.append("carPostion",carPostion); |
| | | //界面展示笼子信息 |
| | | jsonObject1.append("bigStorageCageInfos", bigStorageCageService.querybigStorageCageDetail()); |
| | | jsonObject.append("bigStorageCageInfos", bigStorageCageService.querybigStorageCageDetail()); |
| | | |
| | | //进片任务数据 |
| | | List<BigStorageCageDetails> bigStorageCageDetailsFeedTask=bigStorageCageDetailsService.selectTask(1); |
| | |
| | | @Scheduled(fixedDelay = 1000) |
| | | public void plcStorageCageTask() throws InterruptedException { |
| | | jsonObject = new JSONObject(); |
| | | jsonObject1 = new JSONObject(); |
| | | try { |
| | | //查询使用数据源1查询数据 |
| | | queryDataSource1(); |
| | |
| | | for (WebSocketServer webserver : sendwServer) { |
| | | if (webserver != null) { |
| | | webserver.sendMessage(jsonObject.toString()); |
| | | webserver.sendMessage(jsonObject1.toString()); |
| | | List<String> messages = webserver.getMessages(); |
| | | if (!messages.isEmpty()) { |
| | | // // 将最后一个消息转换为整数类型的列表 |
| | |
| | | @Value("${mes.glassGap}") |
| | | private Integer glassGap; |
| | | |
| | | @Value("${mes.xMaxSize}") |
| | | private Integer xMaxSize; |
| | | |
| | | |
| | | private String d01GlassId = ""; |
| | | private String d04GlassId = ""; |
| | | |
| | |
| | | Date startDate = new Date(); |
| | | log.info("大理片笼空车进片任务开始执行时间:{}", startDate); |
| | | PlcParameterObject plcMesObject = S7object.getinstance().PlcMesObject; |
| | | String e02State = plcMesObject.getPlcParameter("E02State").getAddress(); |
| | | if (REQUEST_WORD.equals(e02State)) { |
| | | log.info("出片忙碌,结束出片任务"); |
| | | return; |
| | | } |
| | | String mesToPLCAddress = plcMesObject.getPlcParameter("MESToPLC").getAddress(); |
| | | List<BigStorageCageOutTask> outingList = bigStorageCageOutTaskService.list(new LambdaQueryWrapper<BigStorageCageOutTask>().eq(BigStorageCageOutTask::getTaskState, Const.BIG_STORAGE_OUT_NEW)); |
| | | Assert.isTrue(CollectionUtils.isEmpty(outingList), "有正在执行出片的任务,结束当前出片线程"); |
| | |
| | | List<BigStorageCageDetails> list = bigStorageCageDetailsService.list(new LambdaQueryWrapper<BigStorageCageDetails>() |
| | | .eq(BigStorageCageDetails::getSlot, first.getSlot()).eq(BigStorageCageDetails::getState, Const.GLASS_STATE_IN)); |
| | | List<BigStorageCageOutTask> outTasks = list.stream().map(e -> new BigStorageCageOutTask(e.getGlassId(), first.getSlot(), second.getSlot(), |
| | | slotWidth, 0, 0, 1)).collect(Collectors.toList()); |
| | | e.getWidth() * 10, e.getHeight() * 10, 0, 0, 1)).collect(Collectors.toList()); |
| | | bigStorageCageOutTaskService.saveBatch(outTasks); |
| | | |
| | | //向plc写入确认字 |
| | | int returnData = 0; |
| | | int count = 1; |
| | | while (returnData == 0) { |
| | | log.info("已向plc第{}次送协议", count); |
| | | S7object.getinstance().plccontrol.writeWord(mesToPLCAddress, 1); |
| | | log.info("已向plc发送出片任务确认,地址为:{}", mesToPLCAddress); |
| | | returnData = S7object.getinstance().plccontrol.readWord(mesToPLCAddress, 1).get(0); |
| | | log.info("已向plc第{}次发送出片任务确认,地址为:{},写入的内容为{}", count++, mesToPLCAddress, returnData); |
| | | } |
| | | Date endDate = new Date(); |
| | | log.info("大理片笼出片任务结束时间:{},共耗时:{}ms,结束扫码任务", endDate, endDate.getTime() - startDate.getTime()); |
| | | return; |
| | |
| | | } |
| | | //向plc发送进片确认 |
| | | if (flag) { |
| | | //向plc写入确认字 |
| | | int returnData = 0; |
| | | int count = 1; |
| | | while (returnData == 0) { |
| | | S7object.getinstance().plccontrol.writeWord(mesAddress, 1); |
| | | log.info("进卧转立发送确认字完成,地址为{}", mesAddress); |
| | | returnData = S7object.getinstance().plccontrol.readWord(mesAddress, 1).get(0); |
| | | log.info("进卧转立第{}次发送确认字完成,地址为:{},写入的内容为{}", count++, mesAddress, returnData); |
| | | |
| | | } |
| | | } |
| | | //记录无法放下玻璃,后续判断启动 |
| | | return flag; |
| | |
| | | s7control.writeWord(plcMesObject.getPlcParameter("StartAddToImport" + i).getAddress(), taskList.get(i - 1).getLine()); |
| | | s7control.writeWord(plcMesObject.getPlcParameter("TargetAddToImport" + i).getAddress(), taskList.get(i - 1).getTargetSlot()); |
| | | } |
| | | int returnData = 0; |
| | | int count = 1; |
| | | while (returnData == 0) { |
| | | s7control.writeWord(outLine, 2); |
| | | log.info("送片任务已发送完成,任务线路为:{},启动地址为{},确认字为{}", line, outLine, 2); |
| | | returnData = s7control.readWord(outLine, 1).get(0); |
| | | log.info("已向plc第{}次发送出片任务确认,地址为:{},写入的内容为{}", count++, outLine, returnData); |
| | | } |
| | | } |
| | | |
| | | private <T extends BigStorageCageBaseInfo> Boolean computeOutGlassInfo(List<T> list, Boolean isTempering, String mesToPLCAddress) { |
| | |
| | | List<BigStorageCageOutTask> bigStorageCageOutTaskList = new ArrayList<>(); |
| | | //打车剩余尺寸 |
| | | Integer remainWidth = carWidth; |
| | | int maxX = 0; |
| | | for (T e : list) { |
| | | if (bigStorageCageOutTaskList.size() >= outCarMaxSize || e.getWidth() > remainWidth) { |
| | | break; |
| | | } |
| | | remainWidth = remainWidth - (int) e.getWidth() - glassGap; |
| | | if (isTempering) { |
| | | int minLength = Math.min((int) e.getWidth(), (int) e.getHeight()); |
| | | if (maxX + minLength <= xMaxSize) { |
| | | bigStorageCageOutTaskList.add(new BigStorageCageOutTask(e.getGlassId(), e.getSlot(), Const.TEMPERING_OUT_TARGET_POSITION, |
| | | (int) e.getWidth() * 10, 0, 0, 1)); |
| | | e.getWidth() * 10, e.getHeight() * 10, 0, 0, 1)); |
| | | maxX = Math.max(maxX, e.getXCoordinate()); |
| | | } else { |
| | | break; |
| | | } |
| | | |
| | | } else { |
| | | bigStorageCageOutTaskList.add(new BigStorageCageOutTask(e.getGlassId(), e.getSlot(), Const.ARTIFICIAL_OUT_TARGET_POSITION, |
| | | (int) e.getWidth() * 10, 0, 0, 1)); |
| | | e.getWidth() * 10, e.getHeight(), 0, 0, 1)); |
| | | } |
| | | |
| | | } |
| | |
| | | .in(BigStorageCageDetails::getGlassId, glassIds)); |
| | | //更新笼子内格子的剩余尺寸 |
| | | updateSlotRemain(list, glassIds); |
| | | |
| | | int returnData = 0; |
| | | int count = 1; |
| | | while (returnData == 0) { |
| | | S7object.getinstance().plccontrol.writeWord(mesToPLCAddress, 1); |
| | | log.info("已向plc发送出片任务确认,地址为:{}", mesToPLCAddress); |
| | | returnData = S7object.getinstance().plccontrol.readWord(mesToPLCAddress, 1).get(0); |
| | | log.info("已向plc第{}次发送出片任务确认,地址为:{},写入的内容为{}", count++, mesToPLCAddress, returnData); |
| | | } |
| | | return Boolean.TRUE; |
| | | } |
| | | |
| | |
| | | |
| | | spring: |
| | | profiles: |
| | | active: prod |
| | | active: cz |
| | | application: |
| | | name: cacheVerticalGlass |
| | | mybatis-plus: |
| | |
| | | minCount: 5 |
| | | carWidth: 5000 #大车宽度 |
| | | slotWidth: 5000 #大车宽度 |
| | | inCarMaxSize: 6 #进片大车最大存放玻璃数量 |
| | | outCarMaxSize: 1 #出片大车最大存放玻璃数量 |
| | | glassGap: 300 #玻璃间距 |
| | | inCarMaxSize: 2 #进片大车最大存放玻璃数量 |
| | | outCarMaxSize: 3 #出片大车最大存放玻璃数量 |
| | | glassGap: 1000 #玻璃间距 |
| | | xMaxSize: 2850 |
| | |
| | | import org.springframework.web.bind.annotation.PutMapping;
|
| | | import org.springframework.web.bind.annotation.GetMapping;
|
| | | import java.util.List;
|
| | | import java.util.Map;
|
| | |
|
| | | /**
|
| | | *
|
| | |
| | | return Result.success(result);
|
| | | }
|
| | |
|
| | |
|
| | | @ApiOperation(value = "架子表格查询",notes = "架子表格查询",produces = "application/json")
|
| | | @ApiResponses({@ApiResponse(code = 200, message = "查询成功")})
|
| | | @GetMapping("/findshelfrack")
|
| | | public Result findshelfrack() {
|
| | | List<Map<String, Object>> result = shelfRackService.selectshelf_rack();
|
| | | return Result.success(result);
|
| | | }
|
| | |
|
| | | } |
| | |
| | | package com.mes.shelfrack.mapper;
|
| | |
|
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
| | | import com.github.yulichang.base.MPJBaseMapper;
|
| | | import com.mes.shelfrack.entity.ShelfRack;
|
| | |
|
| | | import java.util.List;
|
| | | import java.util.Map;
|
| | |
|
| | | /**
|
| | | *
|
| | | *
|
| | |
| | | *
|
| | | */
|
| | |
|
| | | public interface ShelfRackMapper extends BaseMapper<ShelfRack> {
|
| | | public interface ShelfRackMapper extends MPJBaseMapper<ShelfRack> {
|
| | |
|
| | |
|
| | | List<Map<String, Object>> selectshelf_rack();
|
| | | } |
| | |
| | | import com.baomidou.mybatisplus.extension.service.IService;
|
| | |
|
| | | import java.util.List;
|
| | | import java.util.Map;
|
| | |
|
| | | /**
|
| | | * @author system
|
| | | * @since 2024-07-09 14:51:27
|
| | |
| | |
|
| | | List<ShelfRack> findList(ShelfRack params);
|
| | |
|
| | |
|
| | | List<Map<String, Object>> selectshelf_rack();
|
| | |
|
| | | } |
| | |
| | | package com.mes.shelfrack.service.impl;
|
| | |
|
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
| | | import com.github.yulichang.toolkit.JoinWrappers;
|
| | | import com.mes.common.config.Const;
|
| | | import com.mes.rawusage.entity.RawUsage;
|
| | | import com.mes.shelfrack.mapper.ShelfRackMapper;
|
| | | import com.mes.shelfrack.entity.ShelfRack;
|
| | | import com.mes.shelfrack.service.ShelfRackService;
|
| | | import org.springframework.beans.factory.annotation.Autowired;
|
| | | import org.springframework.stereotype.Service;
|
| | |
|
| | | import java.util.List;
|
| | | import java.util.Map;
|
| | |
|
| | | /**
|
| | | * @author system
|
| | |
| | | return shelfRackMapper.selectList(query);
|
| | | }
|
| | |
|
| | | //
|
| | | // public void yourMethodName() {
|
| | | // List<Map<String, Object>> resultList = shelfRackMapper.selectMaps(
|
| | | // new LambdaQueryWrapper<ShelfRack>()
|
| | | // .select(ShelfRack::getNumber, RawUsage::getRawType, RawUsage::getRawWidth,
|
| | | // RawUsage::getRawHeight, RawUsage::getRawThickness, ShelfRack::getModTime,
|
| | | // ShelfRack::getEnableState, RawUsage::getPieces, RawUsage::getLeftPieces,
|
| | | // "(datediff(now(), raw_usage.create_time)) as rukuTime",
|
| | | // "(concat(if(ROUND(raw_usage.left_pieces / #{param1} * 100, 0) < 20, 20, ROUND(raw_usage.left_pieces / #{param1} * 100, 0)), '%')) as bfb")
|
| | | // .leftJoin(RawUsage.class, RawUsage::getId, ShelfRack::getRawPackageId)
|
| | | // .orderByAsc(ShelfRack::getNumber)
|
| | | // );
|
| | | //
|
| | | // // Process resultList as needed
|
| | | // }
|
| | |
|
| | |
|
| | |
|
| | | @Override
|
| | | public List<Map<String, Object>> selectshelf_rack() {
|
| | | return baseMapper.selectshelf_rack();
|
| | | }
|
| | |
|
| | |
|
| | |
|
| | | } |
| | |
| | | import org.springframework.web.bind.annotation.PutMapping;
|
| | | import org.springframework.web.bind.annotation.GetMapping;
|
| | | import java.util.List;
|
| | | import java.util.Map;
|
| | | import java.util.Optional;
|
| | |
|
| | | /**
|
| | | *
|
| | |
| | | return Result.success(result);
|
| | | }
|
| | |
|
| | |
|
| | | @ApiOperation(value = "任务查询",notes = "任务查询",produces = "application/json")
|
| | | @ApiResponses({@ApiResponse(code = 200, message = "查询成功")})
|
| | | @GetMapping("/findTasks")
|
| | | public Result findLatestTasks() {
|
| | | List<Map<String, Object>> result = storageTaskService.Tasks();
|
| | | return Result.success(result);
|
| | | }
|
| | |
|
| | |
|
| | | } |
| | |
| | |
|
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
| | | import com.mes.storagetask.entity.StorageTask;
|
| | | import org.apache.ibatis.annotations.Param;
|
| | | import org.springframework.stereotype.Repository;
|
| | |
|
| | | import java.util.List;
|
| | | import java.util.Map;
|
| | |
|
| | | /**
|
| | | *
|
| | | *
|
| | |
| | | * @since 2024-07-09 14:51:27
|
| | | *
|
| | | */
|
| | |
|
| | | @Repository
|
| | | public interface StorageTaskMapper extends BaseMapper<StorageTask> {
|
| | |
|
| | |
|
| | | List<Map<String, Object>> selectTasks();
|
| | |
|
| | | } |
| | |
| | | List<StorageTask> findList(StorageTask params);
|
| | |
|
| | | Map<String, Optional<StorageTask>> findLatestTasks();
|
| | |
|
| | | List<Map<String, Object>> Tasks();
|
| | | } |
| | |
| | | }
|
| | |
|
| | |
|
| | | @Override
|
| | | public List<Map<String, Object>> Tasks() {
|
| | | return baseMapper.selectTasks();
|
| | | }
|
| | |
|
| | |
|
| | |
|
| | |
|
| | |
|
| | | } |
| | |
| | | strict: false #设置严格模式,默认false不启动. 启动后在未匹配到指定数据源时候回抛出异常,不启动会使用默认数据源. |
| | | datasource: |
| | | hangzhoumes: |
| | | url: jdbc:mysql://127.0.0.1:3306/hangzhoumes?serverTimezone=GMT%2b8 |
| | | url: jdbc:mysql://127.0.0.1:3306/yiwumes?serverTimezone=GMT%2b8 |
| | | username: root |
| | | password: beibo.123/ |
| | | driver-class-name: com.mysql.cj.jdbc.Driver |
| | |
| | | strict: false #设置严格模式,默认false不启动. 启动后在未匹配到指定数据源时候回抛出异常,不启动会使用默认数据源. |
| | | datasource: |
| | | hangzhoumes: |
| | | url: jdbc:mysql://127.0.0.1:3306/hangzhoumes?serverTimezone=GMT%2b8 |
| | | url: jdbc:mysql://127.0.0.1:3306/yiwumes?serverTimezone=GMT%2b8 |
| | | username: root |
| | | password: beibo.123/ |
| | | driver-class-name: com.mysql.cj.jdbc.Driver |
New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?>
|
| | | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
| | | <mapper namespace="com.mes.shelfrack.mapper.ShelfRackMapper">
|
| | |
|
| | |
|
| | | <select id="selectshelf_rack" resultType="java.util.Map">
|
| | | <![CDATA[
|
| | | SELECT a.number, b.raw_type, b.raw_width, b.raw_height, b.raw_thickness, b.left_pieces, a.mod_time, a.enable_state, b.pieces,
|
| | | datediff(now(), b.create_time) as rukutime,
|
| | | concat(if(ROUND(b.left_pieces / b.pieces * 100, 0) < 20, 20, ROUND(b.left_pieces / b.pieces * 100, 0)), '%') as bfb
|
| | | FROM shelf_rack AS a
|
| | | LEFT JOIN raw_usage AS b ON a.raw_package_id = b.id
|
| | | ]]>
|
| | | </select>
|
| | |
|
| | | </mapper>
|
New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?>
|
| | | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
| | | <mapper namespace="com.mes.storagetask.mapper.StorageTaskMapper">
|
| | |
|
| | |
|
| | |
|
| | | <select id="selectTasks" resultType="java.util.Map">
|
| | | <![CDATA[
|
| | | SELECT d.*, g.raw_thickness, g.color
|
| | | FROM (
|
| | | (SELECT * FROM storage_task AS a WHERE a.task_state = '已完成' ORDER BY a.id DESC LIMIT 1)
|
| | | UNION ALL
|
| | | (SELECT * FROM storage_task AS c WHERE c.task_state = '正在工作')
|
| | | UNION ALL
|
| | | (SELECT * FROM storage_task AS b WHERE b.task_state = '等待中')
|
| | | ) AS d
|
| | | LEFT JOIN shelf_rack AS f ON f.id = d.shelf_rack
|
| | | LEFT JOIN raw_usage AS g ON g.id = f.raw_package_id
|
| | | ]]>
|
| | | </select>
|
| | |
|
| | | </mapper>
|
| | |
| | | package mes; |
| | | |
| | | import com.mes.GlassStorageApplication; |
| | | import com.mes.shelfrack.service.ShelfRackService; |
| | | import com.mes.storagetask.entity.StorageTask; |
| | | import com.mes.storagetask.service.StorageTaskService; |
| | | import lombok.extern.slf4j.Slf4j; |
| | |
| | | |
| | | @Autowired |
| | | private StorageTaskService storageTaskService; |
| | | @Autowired |
| | | private ShelfRackService shelfRackService; |
| | | |
| | | |
| | | @Test |
| | |
| | | // storageTaskService.updateById(storageTask); |
| | | // storageTaskService.getBaseMapper().deleteById(1); |
| | | // storageTaskService.findList(storageTask); |
| | | storageTaskService.findLatestTasks(); |
| | | ///storageTaskService.findLatestTasks(); |
| | | storageTaskService.Tasks(); |
| | | } |
| | | @Test |
| | | public void selectshelf_rack() { |
| | | |
| | | shelfRackService.selectshelf_rack(); |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | |
| | | * fixedDelay : 上一个调用结束后再次调用的延时 |
| | | */ |
| | | |
| | | @Scheduled(fixedDelay = 30000000) |
| | | @Scheduled(fixedDelay = 300) |
| | | public void plcLoadGlassTask() throws InterruptedException { |
| | | try { |
| | | //获取联机状态 |
| | |
| | | } |
| | | } |
| | | |
| | | @Scheduled(fixedDelay = 30000000) |
| | | @Scheduled(fixedDelay = 300) |
| | | public void plcLoadGlassReport(){ |
| | | //获取是否有汇报 |
| | | String loadStatus = plcParameterObject.getPlcParameter("PlcStatus").getValue(); |
| | |
| | | public void loadGlassStatus(){ |
| | | JSONObject jsonObject = new JSONObject(); |
| | | //正在进行的任务 |
| | | //String inkageStatus =plcParameterObject.getPlcParameter("MesToPlc").getValue(); |
| | | String inkageStatus ="1"; |
| | | String inkageStatus =plcParameterObject.getPlcParameter("MesToPlc").getValue(); |
| | | //String inkageStatus ="1"; |
| | | jsonObject.append("InkageStatus", inkageStatus); |
| | | ArrayList<WebSocketServer> sendwServer = WebSocketServer.sessionMap.get("loadGlass"); |
| | | if (sendwServer != null) { |
| | |
| | | List<OptimizeUpPattenUsage> upPattenUsageList = null; |
| | | if (engineeringId != null) { |
| | | upPattenUsageList = optimizeProjectMapper.selectJoinList(OptimizeUpPattenUsage.class, new MPJQueryWrapper<OptimizeProject>() |
| | | .select("t.project_no,t.glass_type,b.width,b.height ,REGEXP_REPLACE(t.glass_thickness,'\\D','')as glass_thickness,b.count as stockId") |
| | | .select("t.project_no,t.glass_type,b.realwidth as width,b.realheight as height ,REGEXP_REPLACE(t.glass_thickness,'\\D','')as glass_thickness,b.stock_id") |
| | | .leftJoin("optimize_layout b on t.project_no=b.project_no") |
| | | .eq("b.project_no", engineeringId)); |
| | | } |
| | |
| | | @Scheduled(fixedDelay = 2000) |
| | | public void screenHome(){ |
| | | JSONObject jsonObject = new JSONObject(); |
| | | //正在等待进片的玻璃 |
| | | Reportingdamage reportingdamage = new Reportingdamage(); |
| | | reportingdamage.setReportingWorkTime("2024-05-11"); |
| | | //获取切割信息 |
| | | reportingdamage.setThisProcess("切割"); |
| | | List<Reportingdamage> cutting = reportingWorkService.selectDamage(reportingdamage); |
| | | jsonObject.append("cutting", cutting); |
| | | //获取磨边信息 |
| | | reportingdamage.setThisProcess("磨边"); |
| | | List<Reportingdamage> edging = reportingWorkService.selectDamage(reportingdamage); |
| | | jsonObject.append("edging", edging); |
| | | //获取钢化信息 |
| | | reportingdamage.setThisProcess("钢化"); |
| | | List<Reportingdamage> tempering = reportingWorkService.selectDamage(reportingdamage); |
| | | jsonObject.append("tempering", tempering); |
| | | //获取夹胶信息 |
| | | reportingdamage.setThisProcess("夹胶"); |
| | | List<Reportingdamage> doubling = reportingWorkService.selectDamage(reportingdamage); |
| | | jsonObject.append("doubling", doubling); |
| | | //获取中空信息 |
| | | reportingdamage.setThisProcess("中空"); |
| | | List<Reportingdamage> hollow = reportingWorkService.selectDamage(reportingdamage); |
| | | jsonObject.append("hollow", hollow); |
| | | //获取包装信息 |
| | | reportingdamage.setThisProcess("包装"); |
| | | List<Reportingdamage> packaging = reportingWorkService.selectDamage(reportingdamage); |
| | | jsonObject.append("packaging", packaging); |
| | | //扇形图各设备的加工破损数量 |
| | | List<Reportingdamage> device = reportingWorkService.selectDamage(reportingdamage); |
| | | jsonObject.append("device", device); |
| | | //获取次破未补信息 |
| | | List<AwaitingRepair>awaitingRepairs = reportingWorkService.selectAwaitingRepair(); |
| | | jsonObject.append("awaitingRepairs", awaitingRepairs); |
| | |
| | | List<Orders>orders=ordersService.selectOrders(); |
| | | jsonObject.append("orders", orders); |
| | | |
| | | /*现场规划图显示*/ |
| | | |
| | | |
| | | ArrayList<WebSocketServer> sendwServer = WebSocketServer.sessionMap.get("screen"); |
| | | if (sendwServer != null) { |
| | | for (WebSocketServer webserver : sendwServer) { |
| | |
| | | List<TemperingGlassInfo> layoutId = temperingAgoService.selectLayoutId(); |
| | | //进炉中的玻璃 |
| | | if(!layoutId.isEmpty()) { |
| | | List<TemperingGlassInfo> intoGlass = temperingAgoService.selectIntoGlass(layoutId.get(0).getTemperingLayoutId()); |
| | | List<TemperingGlassInfo> intoGlass = temperingAgoService.selectIntoGlass(layoutId.get(0)); |
| | | jsonObject.append("intoGlass", intoGlass); |
| | | //进炉中的第二个版图 |
| | | if (layoutId.size() > 1) { |
| | | List<TemperingGlassInfo> intoGlass2 = temperingAgoService.selectIntoGlass(layoutId.get(1).getTemperingLayoutId()); |
| | | List<TemperingGlassInfo> intoGlass2 = temperingAgoService.selectIntoGlass(layoutId.get(1)); |
| | | jsonObject.append("intoGlass2", intoGlass2); |
| | | } |
| | | } |
| | |
| | | package com.mes.temperingglass.controller; |
| | | import com.mes.damage.entity.Damage; |
| | | import com.mes.damage.service.DamageService; |
| | | import com.mes.temperingglass.service.TemperingGlassInfoService; |
| | | import com.mes.temperingglass.entity.TemperingGlassInfo; |
| | | import com.mes.utils.Result; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.util.List; |
| | | |
| | |
| | | public class TemperingGlassInfoController { |
| | | |
| | | @Autowired |
| | | private TemperingGlassInfoService temperingAgoService; |
| | | private TemperingGlassInfoService temperingGlassInfoService; |
| | | @Autowired |
| | | private DamageService damageService; |
| | | |
| | | @ApiOperation("查询钢化等片中的版图信息,状态为1的为已到,状态为0的为等待中") |
| | | @GetMapping("/selectWaitingGlass") // 查询钢化等片中的版图信息,状态为1的为已到,状态为0的为等待中 |
| | | public Result <List<TemperingGlassInfo>> selectWaitingGlass() { |
| | | List<TemperingGlassInfo> glass = temperingAgoService.selectWaitingGlass(); |
| | | List<TemperingGlassInfo> glass = temperingGlassInfoService.selectWaitingGlass(); |
| | | log.info("等待中的玻璃信息{}",glass); |
| | | return Result.build(200, "", glass); |
| | | } |
| | |
| | | @ApiOperation("//钢化后显示出炉的版图信息。") |
| | | @GetMapping("/selectOutGlass") //钢化后显示出炉的版图信息 |
| | | public Result <List<TemperingGlassInfo>> selectOutGlass() { |
| | | List<TemperingGlassInfo> glass = temperingAgoService.selectOutGlass(); |
| | | List<TemperingGlassInfo> glass = temperingGlassInfoService.selectOutGlass(); |
| | | log.info("钢化出炉后的玻璃信息{}",glass); |
| | | return Result.build(200, "", glass); |
| | | } |
| | | |
| | | @ApiOperation("//钢化破损") |
| | | @PostMapping("/updateTemperingState") //钢化后显示出炉的版图信息 |
| | | public Result <Integer> updateTemperingState(@RequestBody Damage damage) { |
| | | damageService.insertDamage(damage); |
| | | TemperingGlassInfo temperingGlassInfo=new TemperingGlassInfo(); |
| | | if(damage.getStatus()==2){ |
| | | temperingGlassInfo.setState(5); |
| | | |
| | | } |
| | | temperingGlassInfo.setGlassId(damage.getGlassId()); |
| | | int result=temperingGlassInfoService.updateTemperingState(temperingGlassInfo); |
| | | return Result.build(200, "破损成功", result); |
| | | } |
| | | |
| | | |
| | | } |
| | |
| | | password: beibo.123/ |
| | | driver-class-name: com.mysql.cj.jdbc.Driver |
| | | salve_hangzhoumes: |
| | | url: jdbc:sqlserver://192.168.20.24:1433;databasename=hangzhoumes |
| | | url: jdbc:sqlserver://192.168.10.2:1433;databasename=hangzhoumes |
| | | username: sa |
| | | password: beibo.123/ |
| | | driver-class-name: com.microsoft.sqlserver.jdbc.SQLServerDriver |
| | |
| | | |
| | | @Test |
| | | public void testFindPa() { |
| | | List<TemperingGlassInfo> glass = temperingAgoService.selectIntoGlass(12); |
| | | log.info("进炉中的玻璃:{}", Arrays.asList(glass)); |
| | | List<TemperingGlassInfo> layoutId = temperingAgoService.selectLayoutId(); |
| | | if(!layoutId.isEmpty()) { |
| | | List<TemperingGlassInfo> intoGlass = temperingAgoService.selectIntoGlass(layoutId.get(0)); |
| | | log.info("已出中的玻璃:{}", Arrays.asList(intoGlass)); |
| | | //进炉中的第二个版图 |
| | | if (layoutId.size() > 1) { |
| | | List<TemperingGlassInfo> intoGlass2 = temperingAgoService.selectIntoGlass(layoutId.get(1)); |
| | | log.info("已出中的玻璃:{}", Arrays.asList(intoGlass2)); |
| | | } |
| | | } |
| | | } |
| | | @Test |
| | | public void testFindPa2() { |
| | |
| | | public void testFindPa4() { |
| | | List<TemperingGlassInfo> glass = temperingAgoService.selectOverGlass(); |
| | | log.info("钢化后的玻璃:{}", Arrays.asList(glass)); |
| | | } |
| | | @Test |
| | | public void testFindPa5() { |
| | | List<TemperingGlassInfo> layoutId = temperingAgoService.selectLayoutId(); |
| | | //进炉中的玻璃 |
| | | log.info("版图id:{}", Arrays.asList(layoutId.get(0).getTemperingLayoutId())); |
| | | List<TemperingGlassInfo> intoGlass = temperingAgoService.selectIntoGlass(layoutId.get(0).getTemperingLayoutId()); |
| | | log.info("玻璃版图id:{}", Arrays.asList(intoGlass)); |
| | | List<TemperingGlassInfo> intoGlass2 = temperingAgoService.selectIntoGlass(layoutId.get(1).getTemperingLayoutId()); |
| | | log.info("玻璃版图id:{}", Arrays.asList(intoGlass2)); |
| | | } |
| | | } |
| | |
| | | private Integer minHeight; |
| | | |
| | | |
| | | @Scheduled(fixedDelay = 3000) |
| | | @Scheduled(fixedDelay = 300) |
| | | public void plcHomeEdgTask() { |
| | | PlcParameterObject plcParameterObject = S7object.getinstance().PlcMesObject; |
| | | String requestWord = plcParameterObject.getPlcParameter("requestWord").getValue(); |
| | |
| | | String confirmationWrodValue = plcParameterObject.getPlcParameter("confirmationWord").getValue(); |
| | | String confirmationWrodAddress = plcParameterObject.getPlcParameter("confirmationWord").getAddress(); |
| | | String currentSlot = plcParameterObject.getPlcParameter("currentCell").getValue(); |
| | | |
| | | |
| | | |
| | | log.info("1、获取到的请求字为:{},获取到的扫描ID为:{},获取到的确认字为:{},获取到的出片状态分别为:g06:{}、g08:{}、g11:{}、g13:{},当前格子号为:{}", |
| | |
| | | if (CollectionUtils.isNotEmpty(list)) { |
| | | log.info("有空架子,将流程卡与架子好绑定,执行进片任务 结束"); |
| | | //绑定流程卡 |
| | | downWorkstationService.updateFlowCardIdAndCount(glassInfo.getFlowCardId(), glassInfo.getLayer(), list.get(0).getWorkstationId()); |
| | | downWorkstationService.updateFlowCardIdAndCount(glassInfo.getFlowCardId(), list.get(0).getWorkstationId(), glassInfo.getLayer()); |
| | | checkFlag = Boolean.TRUE; |
| | | } |
| | | } |
| | |
| | | return Boolean.FALSE; |
| | | } |
| | | Boolean flag08 = "1".equals(out08Glassstate) ? Boolean.TRUE : Boolean.FALSE; |
| | | if (!flag08) { |
| | | generateTaskByShelf(glassStatus06, glassStatus11, flag08, glassStatus13, tempList, cageDetails, glassId); |
| | | } else { |
| | | if (!generateTaskByShelf(glassStatus06, glassStatus11, flag08, glassStatus13, tempList, cageDetails, glassId)) { |
| | | return generateTaskByShelf(glassStatus06, glassStatus11, !flag08, glassStatus13, tempList, cageDetails, glassId); |
| | | } |
| | | } |
| | | |
| | | return Boolean.TRUE; |
| | | } |
| | | |
| | |
| | | list = tempList.stream().filter(item -> item.getWidth() > maxWidth || item.getHeight() > maxHeight).collect(Collectors.toList()); |
| | | } |
| | | } else { |
| | | //获取可落架的的架子信息(包括空架子) |
| | | List<DownWorkstation> workstationsIsNotBind = downWorkstationList.stream().filter(item -> null == (item.getFlowCardId())).collect(Collectors.toList()); |
| | | Map<String, List<DownWorkstation>> listMap = downWorkstationList.stream().collect(Collectors.groupingBy(item -> item.getFlowCardId() + ":" + item.getLayer())); |
| | | //将架子的流程卡号及层数作为key |
| | | if (CollectionUtils.isEmpty(workstationsIsNotBind)) { |
| | | log.info("不存在未绑定流程卡架子"); |
| | | //筛选出对应架子已绑定流程卡可下片的玻璃 |
| | | Map<String, List<DownWorkstation>> listMap = downWorkstationList.stream() |
| | | .filter(item -> null != (item.getFlowCardId())).collect(Collectors.groupingBy(item -> item.getFlowCardId() + ":" + item.getLayer())); |
| | | list = tempList.stream().filter(item -> listMap.containsKey(item.getFlowCardId() + ":" + item.getLayer())).collect(Collectors.toList()); |
| | | } else { |
| | | log.info("存在未绑定流程卡架子,直接获取笼内所有玻璃"); |
| | | log.info("存在未绑定流程卡架子,直接获取笼内所有玻璃,且未绑定架子的玻璃信息"); |
| | | //获取禁用架子的流程号,将笼内绑定架子且架子被禁用的流程卡信息 |
| | | List<Integer> workStationAll = Arrays.asList(1, 2, 3, 4, 5, 6); |
| | | List<Integer> offWorkStationList = workStationAll.stream().filter(e -> !workList.contains(e)).collect(Collectors.toList()); |
| | | List<DownWorkstation> downWorkstationOffList = downWorkstationService.list(new LambdaQueryWrapper<DownWorkstation>() |
| | | .and(i -> i.in(DownWorkstation::getWorkstationId, offWorkStationList).or().eq(DownWorkstation::getEnableState, Const.SLOT_OFF))); |
| | | //获取被禁用的流程卡信息 |
| | | if (CollectionUtils.isEmpty(downWorkstationOffList)) { |
| | | list = tempList; |
| | | } else { |
| | | Map<String, List<DownWorkstation>> listOffMap = downWorkstationOffList.stream().filter(item -> null != (item.getFlowCardId())).collect(Collectors.groupingBy(item -> item.getFlowCardId() + ":" + item.getLayer())); |
| | | list = tempList.stream().filter(item -> !listOffMap.containsKey(item.getFlowCardId() + ":" + item.getLayer())).collect(Collectors.toList()); |
| | | } |
| | | isEmptyShelf = Boolean.TRUE; |
| | | //todo:如果禁用架子已绑定流程卡,因为时间不确定,笼子内的玻璃可重新绑定新架子 |
| | | // list = tempList.stream().filter(item -> !listMap.containsKey(item.getFlowCardId() + ":" + item.getLayer())).collect(Collectors.toList()); |
| | | list = tempList; |
| | | |
| | | } |
| | | } |
| | | } else { |
| | |
| | | break loop; |
| | | } |
| | | //将笼子内的玻璃进行过滤,仅获取无法落架的流程卡玻璃 |
| | | List<DownStorageCageDetails> noDownLoadList = list.stream().filter(item -> !downGlassFlowList.contains(item.getFlowCardId() + ":" + item.getLayer())).collect(Collectors.toList()); |
| | | List<DownStorageCageDetails> noDownLoadList = list.stream().filter(item -> !downGlassFlowList.contains(item.getFlowCardId() + ":" + item.getLayer())) |
| | | .collect(Collectors.toList()); |
| | | if (CollectionUtils.isNotEmpty(noDownLoadList)) { |
| | | //是否有空架子 |
| | | // List<DownWorkstation> emptyShelfList = downWorkstationService.list(new LambdaQueryWrapper<DownWorkstation>() |
| | |
| | | } |
| | | |
| | | Integer endCell = null; |
| | | if (!isBind) { |
| | | if (isBind) { |
| | | //获取空架子信息,将空架子信息绑定流程卡 |
| | | DownWorkstation emptyDownWorkstation = downWorkstationService.getOne(new LambdaQueryWrapper<DownWorkstation>() |
| | | .isNull(DownWorkstation::getFlowCardId).orderByDesc(DownWorkstation::getWorkstationId).last("limit 1")); |
| | | if (null != emptyDownWorkstation) { |
| | | log.info("获取到空架子信息,绑定流程卡"); |
| | | downWorkstationService.updateFlowCardIdAndCount(downStorageCageDetails.getFlowCardId(), downStorageCageDetails.getLayer(), emptyDownWorkstation.getWorkstationId()); |
| | | downWorkstationService.updateFlowCardIdAndCount(downStorageCageDetails.getFlowCardId(), emptyDownWorkstation.getWorkstationId(), downStorageCageDetails.getLayer()); |
| | | endCell = emptyDownWorkstation.getWorkstationId(); |
| | | //将下片玻璃存入笼子详情信息表中 |
| | | //将任务插入理片笼详情表 |
| | | downStorageCageDetails.setState(Const.GLASS_STATE_OUT); |
| | | downStorageCageDetailsService.save(downStorageCageDetails); |
| | | } else { |
| | | log.info("没有空架子信息,无法绑定流程卡"); |
| | | return Boolean.FALSE; |
| | |
| | | DownWorkstation workstation = downWorkstationService.getOne(new LambdaUpdateWrapper<DownWorkstation>() |
| | | .eq(DownWorkstation::getFlowCardId, downStorageCageDetails.getFlowCardId()).eq(DownWorkstation::getLayer, downStorageCageDetails.getLayer())); |
| | | endCell = workstation.getWorkstationId(); |
| | | } |
| | | //更新详情表内的状态 |
| | | |
| | | if (downStorageCageDetailsService.update(new LambdaUpdateWrapper<DownStorageCageDetails>() |
| | | .set(DownStorageCageDetails::getState, Const.GLASS_STATE_OUT).eq(DownStorageCageDetails::getGlassId, glassId))) { |
| | | log.info("更新详情表内的状态成功"); |
| | | // return Boolean.TRUE; |
| | | } else { |
| | | log.info("更新详情表内的状态失败"); |
| | | return Boolean.FALSE; |
| | | } |
| | | } |
| | | //更新落架玻璃数量 |
| | | if (endCell == 7) { |
| | | downWorkstationService.update(new UpdateWrapper<DownWorkstation>().eq("flow_card_id", downStorageCageDetails.getFlowCardId()) |