Ejemplo n.º 1
0
 public static CNCAlarm GetCurrentAlarm(CNCMachine machine)
 {
     if (machine == null)
     {
         return(null);
     }
     return(GetCurrentAlarm(GetCNCStation(machine.MachineIP.ToString())));
 }
Ejemplo n.º 2
0
 public static bool GetPartCount(CNCMachine machine, CNCPartCount cncPartCount)
 {
     if (machine == null)
     {
         return(false);
     }
     return(GetPartCount(GetCNCStation(machine.MachineIP.ToString()), cncPartCount));
 }
Ejemplo n.º 3
0
 public static string GetPlcVer(CNCMachine machine)
 {
     if (machine == null)
     {
         return("");
     }
     return(GetPlcVer(GetCNCStation(machine.MachineIP.ToString())));
 }
Ejemplo n.º 4
0
 public static bool GetInformation(CNCMachine machine, CNCInformation cncInfo)
 {
     if (machine == null)
     {
         return(false);
     }
     return(GetInformation(GetCNCStation(machine.MachineIP.ToString()), cncInfo));
 }
Ejemplo n.º 5
0
 public static bool GetSpindle(CNCMachine machine, CNCSpindle cncSpindle)
 {
     if (machine == null)
     {
         return(false);
     }
     return(GetSpindle(GetCNCStation(machine.MachineIP.ToString()), cncSpindle));
 }
Ejemplo n.º 6
0
 public static bool WritePlcSBit(CNCMachine machine, int port, byte data)
 {
     if (machine == null)
     {
         return(false);
     }
     return(WritePlcSBit(GetCNCStation(machine.MachineIP.ToString()), port, data));
 }
Ejemplo n.º 7
0
 public static bool WriteRegisterData(CNCMachine machine, int registerPort, int data)
 {
     if (machine == null)
     {
         return(false);
     }
     return(WriteRegisterData(GetCNCStation(machine.MachineIP.ToString()), registerPort, data));
 }
Ejemplo n.º 8
0
 public static bool SetWorkCoord_G54(CNCMachine machine, List <float> data)
 {
     if (machine == null)
     {
         return(false);
     }
     return(SetWorkCoord_G54(GetCNCStation(machine.MachineIP.ToString()), data));
 }
Ejemplo n.º 9
0
 public static bool GetPosition(CNCMachine machine, CNCPosition cncPosition)
 {
     if (machine == null)
     {
         return(false);
     }
     return(GetPosition(GetCNCStation(machine.MachineIP.ToString()), cncPosition));
 }
Ejemplo n.º 10
0
 public static string SeriesNo(CNCMachine machine)
 {
     if (machine == null)
     {
         return("");
     }
     return(SeriesNo(GetCNCStation(machine.MachineIP.ToString())));
 }
Ejemplo n.º 11
0
 public static bool GetPlcSBit(CNCMachine machine, int port, out byte data)
 {
     data = 0;
     if (machine == null)
     {
         return(false);
     }
     return(GetPlcSBit(GetCNCStation(machine.MachineIP.ToString()), port, out data));
 }
Ejemplo n.º 12
0
 public static bool GetRegisterData(CNCMachine machine, int registerPort, out int data)
 {
     data = -1;
     if (machine == null)
     {
         return(false);
     }
     return(GetRegisterData(GetCNCStation(machine.MachineIP.ToString()), registerPort, out data));
 }
Ejemplo n.º 13
0
 public static bool GetRegisterString(CNCMachine machine, int registerPort, out string str)
 {
     str = "";
     if (machine == null)
     {
         return(false);
     }
     return(GetRegisterString(GetCNCStation(machine.MachineIP.ToString()), registerPort, out str));
 }
Ejemplo n.º 14
0
 public static bool GetFeedPercent(CNCMachine machine, out int data)
 {
     data = 0;
     if (machine == null)
     {
         return(false);
     }
     return(GetFeedPercent(GetCNCStation(machine.MachineIP.ToString()), out data));
 }
Ejemplo n.º 15
0
        public static void SetMachineModeNext(CNCMachine mchine)
        {
            EnumCNCMachinMode mode;
            SyntecRemoteCNC   cNCStation = GetCNCStation(mchine.MachineIP.ToString());

            if ((cNCStation != null) && GetMachineMode(cNCStation, out mode))
            {
                int num = ((int)(mode + 1) % CarryLine.Common.Common.MachineModeCount);
                SetMachineMode(cNCStation, (EnumCNCMachinMode)num);
            }
        }
Ejemplo n.º 16
0
 public static void MoveAxis(CNCMachine machine, float axisXMachMax, float axisXMachMin, float axisYMachMax, float axisYMachMin, CNCPort xPosPort, CNCPort yPosPort, CNCPort moveStartPort, List <float> dist)
 {
     if (((machine != null) && (xPosPort != null)) && ((yPosPort != null) && (moveStartPort != null)))
     {
         SyntecRemoteCNC cNCStation = GetCNCStation(machine.MachineIP.ToString());
         if (cNCStation != null)
         {
             MoveAxis(cNCStation, dist, axisXMachMax, axisXMachMin, axisYMachMax, axisYMachMin, xPosPort.PortNumber, yPosPort.PortNumber, moveStartPort.PortNumber, machine.ResetPortIntervalTime.Value);
         }
     }
 }
Ejemplo n.º 17
0
        public static bool GetPLCAdreesData(CNCMachine machine, CNCPort port, out int data)
        {
            data = -1;
            if ((machine == null) || (port == null))
            {
                return(false);
            }
            byte num  = 0;
            bool flag = false;

            switch (port.AddressType)
            {
            case EnumCNCAddress.I:
                flag = GetPlcIBit(machine, port.PortNumber, out num);
                data = num;
                return(flag);

            case EnumCNCAddress.O:
                flag = GetPlcOBit(machine, port.PortNumber, out num);
                data = num;
                return(flag);

            case EnumCNCAddress.C:
                flag = GetPlcCBit(machine, port.PortNumber, out num);
                data = num;
                return(flag);

            case EnumCNCAddress.S:
                flag = GetPlcSBit(machine, port.PortNumber, out num);
                data = num;
                return(flag);

            case EnumCNCAddress.A:
                flag = GetPlcABit(machine, port.PortNumber, out num);
                data = num;
                return(flag);

            case EnumCNCAddress.R:
                return(GetRegisterData(machine, port.PortNumber, out data));
            }
            return(flag);
        }
Ejemplo n.º 18
0
 public static bool Reset(CNCMachine machine, CNCPort port)
 {
     return(((machine != null) && (port != null)) && Reset(GetCNCStation(machine.MachineIP.ToString()), port.PortNumber, machine.ResetPortIntervalTime.Value));
 }
Ejemplo n.º 19
0
        public string AddOrEditCNCMachineAPI(CNCMachineDTO dto)
        {
            try
            {
                int EQP_Uid = CNCMachineRepository.GetEquipment_UID(dto.BG_Organization_UID, dto.FunPlant_Organization_UID == null ? 0 : dto.FunPlant_Organization_UID.Value, dto.Equipment);

                if (EQP_Uid == 0)
                {
                    return("保存失败:没有找到对应的设备EMT号.");
                }

                if (dto.CNCMachineUID == 0)
                {
                    CNCMachine SC = new CNCMachine();

                    SC.Plant_Organization_UID    = dto.Plant_Organization_UID;
                    SC.BG_Organization_UID       = dto.BG_Organization_UID;
                    SC.FunPlant_Organization_UID = dto.FunPlant_Organization_UID;
                    if (EQP_Uid != 0)
                    {
                        SC.EQP_Uid = EQP_Uid;
                    }
                    else
                    {
                        SC.EQP_Uid = null;
                    }

                    SC.Machine_Name  = dto.Machine_Name;
                    SC.Machine_ID    = dto.Machine_ID;
                    SC.Project_UID   = dto.Project_UID;
                    SC.Is_Enable     = dto.Is_Enable;
                    SC.Modified_UID  = dto.Modified_UID;
                    SC.Modified_Date = dto.Modified_Date;
                    CNCMachineRepository.Add(SC);

                    _unitOfWork.Commit();
                    return("");
                }
                else
                {
                    var SC = CNCMachineRepository.GetFirstOrDefault(m => m.CNCMachineUID == dto.CNCMachineUID);

                    SC.Plant_Organization_UID    = dto.Plant_Organization_UID;
                    SC.BG_Organization_UID       = dto.BG_Organization_UID;
                    SC.FunPlant_Organization_UID = dto.FunPlant_Organization_UID;
                    if (EQP_Uid != 0)
                    {
                        SC.EQP_Uid = EQP_Uid;
                    }
                    else
                    {
                        SC.EQP_Uid = null;
                    }
                    SC.Machine_Name  = dto.Machine_Name;
                    SC.Machine_ID    = dto.Machine_ID;
                    SC.Project_UID   = dto.Project_UID;
                    SC.Is_Enable     = dto.Is_Enable;
                    SC.Modified_UID  = dto.Modified_UID;
                    SC.Modified_Date = dto.Modified_Date;

                    CNCMachineRepository.Update(SC);
                    _unitOfWork.Commit();

                    return("0");
                }
            }
            catch (Exception e)
            {
                return("保存失败:" + e.Message);
            }
        }
Ejemplo n.º 20
0
 public static bool Start(CNCMachine machine, CNCPort startPort, CNCPort resetPort)
 {
     return((((machine != null) && (startPort != null)) && (resetPort != null)) && Start(GetCNCStation(machine.MachineIP.ToString()), startPort.PortNumber, resetPort.PortNumber, machine.ResetPortIntervalTime.Value));
 }
Ejemplo n.º 21
0
 public static bool WriteNcMain(CNCMachine machine, string fileName)
 {
     return(WriteNcMain(GetCNCStation(machine.MachineIP.ToString()), fileName));
 }
Ejemplo n.º 22
0
 public static bool GetMachineMode(CNCMachine machine, out EnumCNCMachinMode mode)
 {
     return(GetMachineMode(GetCNCStation(machine.MachineIP.ToString()), out mode));
 }
Ejemplo n.º 23
0
 public static bool GetMachineRunMode(CNCMachine machine, out int data, CNCCheckPort port)
 {
     data = -1;
     return(((machine != null) && (port != null)) && GetMachineRunMode(GetCNCStation(machine.MachineIP.ToString()), out data, port.PortNumber));
 }
Ejemplo n.º 24
0
 public static bool GetNCPointer(CNCMachine machine, out int pointer)
 {
     pointer = 0;
     return(GetNCPointer(GetCNCStation(machine.MachineIP.ToString()), out pointer));
 }