智能制造MES系统框架

MES系统概述

MES系统是一套面向制造企业车间执行层的生产信息化管理系统。为企业提供包括制造数据管理、计划排成管理、生产调度管理、库存管理、质量管理、人力资源管理、工作中心/设备管理、工具工装管理、采购管理、成本管理、项目看板管理、生产过程控制、底层数据集成分析、上层数据集成分解等管理模块,为企业打造一个扎实、可靠、全面、可行的制造协同管理平台

系统架构

 项目代码

using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Zhaoxi.MES.Frame.Models;

namespace Zhaoxi.MES.Frame.ViewModels
{
    public class DeviceViewModel
    {
        public bool MonitorState { get; set; }

        public List<DeviceItemModel> DeviceList { get; set; }

        public DeviceViewModel()
        {
            DeviceList = new List<DeviceItemModel>();

            App.MqttMessageReceived += App_MqttMessageReceived;

            DeviceItemModel dim = new DeviceItemModel();
            // 网络图片
            dim.Image = "pack://application:,,,/Zhaoxi.MES.Frame;component/Assets/Images/Device/d_1.png";
            dim.LightType = Controls.LightState.Fault;
            dim.Title = "加工中心";
            dim.Properties.Add(new DevicePropertyItemModel { PropName = "运行状态", PropValue = "故障" });
            dim.Properties.Add(new DevicePropertyItemModel { PropName = "工作模式", PropValue = "AUTO" });
            dim.Properties.Add(new DevicePropertyItemModel { PropName = "进给倍率", PropValue = "0" });
            dim.Properties.Add(new DevicePropertyItemModel { PropName = "主轴转速", PropValue = "0" });
            dim.Properties.Add(new DevicePropertyItemModel { PropName = "主轴负载", PropValue = "0 r/min" });
            dim.Properties.Add(new DevicePropertyItemModel { PropName = "程序编号", PropValue = "7014" });
            dim.Properties.Add(new DevicePropertyItemModel { PropName = "机床坐标-X", PropValue = "-500 mm" });
            dim.Properties.Add(new DevicePropertyItemModel { PropName = "机床坐标-Y", PropValue = "-120.002 mm" });
            dim.Properties.Add(new DevicePropertyItemModel { PropName = "机床坐标-Z", PropValue = "-1.525 mm" });
            DeviceList.Add(dim);

            dim = new DeviceItemModel();
            dim.Image = "pack://application:,,,/Zhaoxi.MES.Frame;component/Assets/Images/Device/d_2.png";
            dim.LightType = Controls.LightState.Warning;
            dim.Title = "电火花";
            dim.Properties.Add(new DevicePropertyItemModel { PropName = "L编号", PropValue = "31" });
            dim.Properties.Add(new DevicePropertyItemModel { PropName = "N编号", PropValue = "0" });
            dim.Properties.Add(new DevicePropertyItemModel { PropName = "B编号", PropValue = "0" });
            dim.Properties.Add(new DevicePropertyItemModel { PropName = "停止编号", PropValue = "0" });
            dim.Properties.Add(new DevicePropertyItemModel { PropName = "程序错误", PropValue = "0" });
            dim.Properties.Add(new DevicePropertyItemModel { PropName = "运行错误", PropValue = "0" });
            dim.Properties.Add(new DevicePropertyItemModel { PropName = "顺序错误", PropValue = "0" });
            dim.Properties.Add(new DevicePropertyItemModel { PropName = "启动ON时间", PropValue = "0时:0分:0秒" });
            dim.Properties.Add(new DevicePropertyItemModel { PropName = "加工ON时间", PropValue = "0时:0分:0秒" });
            dim.Properties.Add(new DevicePropertyItemModel { PropName = "E条件编号", PropValue = "909002" });
            dim.Properties.Add(new DevicePropertyItemModel { PropName = "设备机械坐标", PropValue = "暂无" });
            DeviceList.Add(dim);

            dim = new DeviceItemModel();
            dim.Image = "pack://application:,,,/Zhaoxi.MES.Frame;component/Assets/Images/Device/d_3.png";
            dim.LightType = Controls.LightState.Run;
            dim.Title = "机器臂";
            dim.Properties.Add(new DevicePropertyItemModel { PropName = "运行状态", PropValue = "运行" });
            dim.Properties.Add(new DevicePropertyItemModel { PropName = "工作模式", PropValue = "手动" });
            dim.Properties.Add(new DevicePropertyItemModel { PropName = "关节轴J1", PropValue = "-97.979°" });
            dim.Properties.Add(new DevicePropertyItemModel { PropName = "关节轴J2", PropValue = "-31.493°" });
            dim.Properties.Add(new DevicePropertyItemModel { PropName = "关节轴J3", PropValue = "-24.517°" });
            dim.Properties.Add(new DevicePropertyItemModel { PropName = "关节轴J4", PropValue = "-0.032°" });
            dim.Properties.Add(new DevicePropertyItemModel { PropName = "关节轴J5", PropValue = "-34.038°" });
            dim.Properties.Add(new DevicePropertyItemModel { PropName = "关节轴J6", PropValue = "-8.532°" });
            dim.Properties.Add(new DevicePropertyItemModel { PropName = "关节轴J7", PropValue = "3182.790°" });
            DeviceList.Add(dim);

            dim = new DeviceItemModel();
            dim.Image = "pack://application:,,,/Zhaoxi.MES.Frame;component/Assets/Images/Device/d_4.png";
            dim.LightType = Controls.LightState.None;
            dim.Title = "三坐标";
            dim.Properties.Add(new DevicePropertyItemModel { PropName = "运行状态", PropValue = "运行" });
            dim.Properties.Add(new DevicePropertyItemModel { PropName = "工作模式", PropValue = "手动" });
            DeviceList.Add(dim);


            dim = new DeviceItemModel();
            dim.Image = "pack://application:,,,/Zhaoxi.MES.Frame;component/Assets/Images/Device/d_5.png";
            dim.LightType = Controls.LightState.Run;
            dim.Title = "线切割";
            dim.Properties.Add(new DevicePropertyItemModel { PropName = "运行状态", PropValue = "运行" });
            dim.Properties.Add(new DevicePropertyItemModel { PropName = "工作模式", PropValue = "自动" });
            dim.Properties.Add(new DevicePropertyItemModel { PropName = "停止编号", PropValue = "0" });
            dim.Properties.Add(new DevicePropertyItemModel { PropName = "程序错误", PropValue = "0" });
            dim.Properties.Add(new DevicePropertyItemModel { PropName = "运行错误", PropValue = "0" });
            dim.Properties.Add(new DevicePropertyItemModel { PropName = "顺序错误", PropValue = "0" });
            dim.Properties.Add(new DevicePropertyItemModel { PropName = "启动设定为ON的时间", PropValue = "0时:0分:0秒" });
            dim.Properties.Add(new DevicePropertyItemModel { PropName = "加工设定为ON的时间", PropValue = "0时:0分:0秒" });
            dim.Properties.Add(new DevicePropertyItemModel { PropName = "加工条件(E条件)编号", PropValue = "909002" });
            dim.Properties.Add(new DevicePropertyItemModel { PropName = "设备机械坐标", PropValue = "暂无" });
            DeviceList.Add(dim);
        }

        // 如果小伙伴对事件委托不理解    加强 一下C#基础
        private void App_MqttMessageReceived(object? sender, string e)
        {
            // 演示
            DeviceList[0].Properties[3].PropValue = e;
            //Debug.WriteLine(e);

            // 真实对接    作业 
            //e  就是一个Json字符串  反序列化 -》 对象 

        }
    }
}

 

 

using System;
using System.Collections.Generic;
using System.DirectoryServices.ActiveDirectory;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Zhaoxi.MES.Frame.Models;
using Zhaoxi.MES.Frame.Base;
using System.Collections.ObjectModel;
using System.Reflection;

namespace Zhaoxi.MES.Frame.ViewModels
{
    public class MainViewModel:NotifyBase
    {
        // 菜单 集合
        public List<MenuItemModel> TreeList { get; set; }
        // 页面 集合
        public ObservableCollection<PageItemModel> Pages { get; set; }
            = new ObservableCollection<PageItemModel>();

        public MainViewModel()
        {
            #region 菜单初始化
            TreeList = new List<MenuItemModel>();
            {
                MenuItemModel tim = new MenuItemModel();
                tim.Header = "工艺设计";
                //&#xe740;  XAML里使用
                tim.IconCode = "\ue610"; // 字体图标编码,阿里的Iconfont平台打包的图标库
                TreeList.Add(tim);
                tim.Children.Add(new MenuItemModel
                {
                    Header = "加工工艺",
                    TargetView = "BlankPage",
                    OpenViewCommand = new Command<MenuItemModel>(OpenView)
                });
                tim.Children.Add(new MenuItemModel
                {
                    Header = "EBOM",
                    TargetView = "BlankPage",
                    OpenViewCommand = new Command<MenuItemModel>(OpenView)
                });
                tim.Children.Add(new MenuItemModel
                {
                    Header = "设备看板",
                    TargetView = "DevicePage",
                    OpenViewCommand = new Command<MenuItemModel>(OpenView)
                });

                tim.Children.Add(new MenuItemModel
                {
                    Header = "PBOM",
                    TargetView = "PBomPage",
                    OpenViewCommand = new Command<MenuItemModel>(OpenView)
                });
                MenuItemModel subMenu = new MenuItemModel();
                subMenu.Header = "二级菜单";
                subMenu.Children.Add(
                    new MenuItemModel
                    {
                        Header = "三级菜单"
                    }
                   );
                tim.Children.Add(subMenu);
            }
            #endregion

            #region 测试  页面初始
            // 所有数据集合都可以 VM中进行控件 (增加和删除)
            //Pages = new ObservableCollection<PageItemModel>();
            //Pages.Add("AAAA");
            //Pages.Add("BBBB");
            //Pages.Add("CCCC");
            //Pages.Add("DDDD");
            #endregion
        }

        private void OpenView(MenuItemModel menu)
        {
            // 两个问题:
            // 1、每点击一次都会有一个新的页面!  解决方案:从集合中判断是否存在
            // 2、新打开一个页面后,不能马上显示 

            //MenuItemModel mim = menu as MenuItemModel;
            // 需要进行页面的打开 
            //Pages.Add("EEEE");

            var page = Pages.ToList().FirstOrDefault(p => p.Header == menu.Header);

            if (page == null)
            {
                Type type = Assembly.GetExecutingAssembly().
                    GetType("Zhaoxi.MES.Frame.Views.Pages." + menu.TargetView);
                object p = Activator.CreateInstance(type);

                Pages.Add(new PageItemModel
                {
                    Header = menu.Header,
                    PageView = p,
                    IsSelected = true,
                    CloseTabCommand = new Command<PageItemModel>(ClosePage)
                });
            }
            else
                page.IsSelected = true;
        }

        private void ClosePage(PageItemModel menu)
        {
            Pages.Remove(menu);
        }
    }
}

 

  • 7
    点赞
  • 40
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

!chen

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值