Example #1
0
 private void OnRequestIn(EnumPSite site, int index)
 {
     if (RequestIn != null)
     {
         RequestIn(this, new PLCEventArgs(site, index));
     }
 }
Example #2
0
 private void OnPermitOut(EnumPSite site, int index)
 {
     if (PermitOut != null)
     {
         PermitOut(this, new PLCEventArgs(site, index));
     }
 }
Example #3
0
 private void OnAlignmentRead(int index, EnumPSite site = EnumPSite.S6_Alignment)
 {
     if (AlignmentRead != null)
     {
         AlignmentRead(this, new PLCEventArgs(site, index));
     }
 }
Example #4
0
 private void OnScan(EnumPSite site, int index)
 {
     if (Scan != null)
     {
         Scan(this, new PLCEventArgs(site, index));
     }
 }
Example #5
0
 private void OnPrintQRCode(int index, EnumPSite site = EnumPSite.S6_Alignment)
 {
     if (PrintQRCode != null)
     {
         PrintQRCode(this, new PLCEventArgs(site, index));
     }
 }
Example #6
0
 private void OnAssembleRead(int index, EnumPSite site = EnumPSite.S5_Assemble)
 {
     if (AssembleRead != null)
     {
         AssembleRead(this, new PLCEventArgs(site, index));
     }
 }
Example #7
0
 private void OnAssembleWriteFailure(int index, EnumPSite site = EnumPSite.S5_Assemble)
 {
     if (AssembleWriteFailure != null)
     {
         AssembleWriteFailure(this, new PLCEventArgs(site, index));
     }
 }
Example #8
0
 private void OnProcessWriteFailure(EnumPSite site, int index)
 {
     if (ProcessWriteFailure != null)
     {
         ProcessWriteFailure(this, new PLCEventArgs(site, index));
     }
 }
Example #9
0
 private void OnProcessWriteSuccess(EnumPSite site, int index)
 {
     if (ProcessWriteSuccess != null)
     {
         ProcessWriteSuccess(this, new PLCEventArgs(site, index));
     }
 }
Example #10
0
 private void OnProcessRead(EnumPSite site, int index)
 {
     if (ProcessRead != null)
     {
         ProcessRead(this, new PLCEventArgs(site, index));
     }
 }
Example #11
0
        /// <summary>
        /// 顶升
        /// </summary>
        /// <param name="data"></param>
        /// <param name="site"></param>
        private void SimulationDS(RFIDData data, EnumPSite site)
        {
            switch (site)
            {
            case EnumPSite.S1:
                My.Work_Simulation.Send(new DSJ01(data, DSJ01.EnumActionType.物料顶升));
                break;

            case EnumPSite.S2:
                My.Work_Simulation.Send(new DSJ02(data, DSJ02.EnumActionType.物料顶升));
                break;

            case EnumPSite.S3:
                My.Work_Simulation.Send(new DSJ03(data, DSJ03.EnumActionType.物料顶升));
                break;

            case EnumPSite.S4:
                My.Work_Simulation.Send(new DSJ04(data, DSJ04.EnumActionType.物料顶升));
                break;

            case EnumPSite.S5_Assemble:
                My.Work_Simulation.Send(new DSJ05(data, DSJ05.EnumActionType.物料顶升));
                break;

            case EnumPSite.S6_Alignment:
                My.Work_Simulation.Send(new XLW(data, XLW.EnumActionType.物料顶升));
                break;

            default:
                break;
            }
        }
Example #12
0
 private void OnPhotograph(EnumPSite site, int index)
 {
     if (Photograph != null)
     {
         Photograph(this, new PLCEventArgs(site, index));
     }
 }
Example #13
0
 public RFIDReader(EnumPSite site, string ip, int port = 3001)
 {
     Site               = site;
     IPAddress          = ip;
     Port               = port;
     HFReader           = new HFReader();
     HFReader.CommEvent = new CommEventCS();
     ConnectAsync();
 }
Example #14
0
        private static string GetFilePath(EnumPSite site, string filename)
        {
            switch (site)
            {
            case EnumPSite.S1:
                return(GetFilePath("车床", filename));

            case EnumPSite.S2:
                return(GetFilePath("高速钻工中心", filename));

            case EnumPSite.S3:
                return(GetFilePath("三轴加工中心", filename));

            case EnumPSite.S4:
                return(GetFilePath("五轴加工中心", filename));

            default:
                return(string.Empty);
            }
        }
Example #15
0
        /// <summary>
        /// 阻挡
        /// </summary>
        /// <param name="data"></param>
        /// <param name="site"></param>
        private void SimulationZD(RFIDData data, EnumPSite site)
        {
            switch (site)
            {
            case EnumPSite.S1:
                My.Work_Simulation.Send(new DSJ01(data, DSJ01.EnumActionType.正阻挡位转移物料至顶升机2前阻挡位));
                My.Work_Simulation.Send(new DSJ02(data, DSJ02.EnumActionType.前阻挡位到位));
                break;

            case EnumPSite.S2:
                My.Work_Simulation.Send(new DSJ02(data, DSJ02.EnumActionType.正阻挡位转移物料至顶升机3前阻挡位));
                My.Work_Simulation.Send(new DSJ03(data, DSJ03.EnumActionType.前阻挡位到位));
                break;

            case EnumPSite.S3:
                My.Work_Simulation.Send(new DSJ03(data, DSJ03.EnumActionType.正阻挡位转移物料至顶升机4前阻挡位));
                My.Work_Simulation.Send(new DSJ04(data, DSJ04.EnumActionType.前阻挡位到位));
                break;

            case EnumPSite.S4:
                My.Work_Simulation.Send(new DSJ04(data, DSJ04.EnumActionType.正阻挡位转移物料至顶升机5前阻挡位));
                My.Work_Simulation.Send(new DSJ05(data, DSJ05.EnumActionType.前阻挡位到位));
                break;

            case EnumPSite.S5_Assemble:
                My.Work_Simulation.Send(new DSJ05(data, DSJ05.EnumActionType.正阻挡位转移物料至下料位前阻挡位));
                My.Work_Simulation.Send(new XLW(data, XLW.EnumActionType.前阻挡位到位));
                break;

            case EnumPSite.S6_Alignment:
                My.Work_Simulation.Send(new XLW(data, XLW.EnumActionType.正阻挡位转移物料至升降机2));
                break;

            default:
                break;
            }
        }
Example #16
0
File: My.cs Project: fr830/SCADA-1
        /// <summary>
        /// 初始化
        /// </summary>
        public static async Task InitializeAsync()
        {
            await Task.Run(async() =>
            {
                BLL     = BLLCustom.Instance;
                AdminID = BLL.GetUserIDByUsername("admin");
                OnLoadCompleted("数据库连接成功", 20);

                LocationID   = BLL.GetLocationIDByLocationName(LocationName);
                WorkpieceIDs = new Dictionary <EnumWorkpiece, string>();
                if (string.IsNullOrWhiteSpace(LocationID))
                {
                    InitializeDB();
                }
                else
                {
                    ManufactureID = BLL.TManufacture.GetModel(Tool.CreateDict("Name", ManufactureName)).ID;
                    var wpList    = BLL.TWorkpiece.GetList(Tool.CreateDict("LocationID", LocationID));
                    foreach (var item in wpList)
                    {
                        EnumWorkpiece wp;
                        if (Enum.TryParse <EnumWorkpiece>(item.Name, true, out wp))
                        {
                            WorkpieceIDs.Add(wp, item.ID);
                        }
                    }
                }
                if (!string.IsNullOrWhiteSpace(LocationID))
                {
                    OnLoadCompleted("数据库初始化成功", 30);
                }
                else
                {
                    OnLoadCompleted("数据库初始化失败!", 30);
#if !DEBUG
                    throw new Exception("数据库初始化失败!");
#endif
                }

                var macIPs   = BLL.SettingGet(AdminID, "MacIP").ToString().Split(';');
                MachineTools = new Dictionary <EnumPSite, MachineTool>();
                try
                {
                    MachineTools.Add(EnumPSite.None, new MachineTool(macIPs[0]));
                }
                catch (Exception)
                {
                    OnLoadCompleted("PLC连接失败!", 35);
#if !DEBUG
                    throw new Exception("PLC连接失败,IP:" + macIPs[0]);
#endif
                }
                try
                {
                    MachineTools.Add(EnumPSite.S1, new MachineTool(macIPs[1]));
                    MachineTools.Add(EnumPSite.S2, new MachineTool(macIPs[2]));
                    MachineTools.Add(EnumPSite.S3, new MachineTool(macIPs[3]));
                    MachineTools.Add(EnumPSite.S4, new MachineTool(macIPs[4]));
                    OnLoadCompleted("数控系统连接成功", 40);
                }
                catch (Exception)
                {
                    OnLoadCompleted("数控系统连接失败!", 40);
                }

                var rfidIPs = BLL.SettingGet(AdminID, "RFIDIP").ToString().Split(';');
                RFIDs       = new Dictionary <EnumPSite, RFIDReader>();
                for (EnumPSite i = EnumPSite.S1; i <= EnumPSite.S9_Manual; i++)
                {
                    RFIDs.Add(i, new RFIDReader(i, rfidIPs[(int)i - 1]));
                }
                OnLoadCompleted("RFID连接成功", 60);

                Work_PLC        = Work_PLC.Instance;
                Work_RFID       = Work_RFID.Instance;
                Work_WMS        = Work_WMS.Instance;
                Work_MES        = Work_MES.Instance;
                Work_QRCode     = Work_QRCode.Instance;
                Work_Vision     = Work_Vision.Instance;
                Work_Simulation = Work_Simulation.Instance;
                OnLoadCompleted("后台服务连接成功", 80);

                Initialized = true;
                OnLoadCompleted("系统加载完成", 98);

                await Task.Delay(1000);
                OnLoadCompleted("即将进入总控界面", 100);
            });
        }
Example #17
0
 public PLCEventArgs(EnumPSite site, int index)
 {
     Site  = site;
     Index = index;
 }
Example #18
0
 public ProcessData(EnumPSite site, EnumPResult result = EnumPResult.Waiting)
 {
     Site   = site;
     Result = result;
 }