Example #1
0
 protected void InitFields(DataRow rowInfo)
 {
     this.Id                = TengDa._Convert.StrToInt(rowInfo["Id"].ToString(), -1);
     this.getPutType        = (GetPutType)Enum.Parse(typeof(GetPutType), rowInfo["GetPutType"].ToString());
     this.clampStatus       = (ClampStatus)Enum.Parse(typeof(ClampStatus), rowInfo["ClampStatus"].ToString());
     this.clampOri          = (ClampOri)Enum.Parse(typeof(ClampOri), rowInfo["ClampOri"].ToString());
     this.clampId           = TengDa._Convert.StrToInt(rowInfo["ClampId"].ToString(), -1);
     this.getPutTime        = DateTime.Parse(rowInfo["GetPutTime"].ToString());
     this.priority          = TengDa._Convert.StrToInt(rowInfo["Priority"].ToString(), 1);
     this.name              = rowInfo["Name"].ToString();
     this.company           = rowInfo["Company"].ToString();
     this.model             = rowInfo["Model"].ToString();
     this.number            = rowInfo["Number"].ToString();
     this.location          = rowInfo["Location"].ToString();
     this.isEnable          = Convert.ToBoolean(rowInfo["IsEnable"]);
     this.rgvValue          = rowInfo["RgvValue"].ToString();
     this.rgvGetFeederValue = rowInfo["RgvGetFeederValue"].ToString();
     this.rgvPutFeederValue = rowInfo["RgvPutFeederValue"].ToString();
     this.floorStatus       = (FloorStatus)Enum.Parse(typeof(FloorStatus), rowInfo["FloorStatus"].ToString());
     this.sampleStatus      = (SampleStatus)Enum.Parse(typeof(SampleStatus), rowInfo["SampleStatus"].ToString());
     this.PreFloorStatus    = this.floorStatus;
     this.fromStationId     = TengDa._Convert.StrToInt(rowInfo["FromStationId"].ToString(), -1);
     //for (int i = 0; i < Option.TemperaturePointCount + 1; i++)
     //{
     //    this.sampledDatas[i] = new List<float>();
     //}
 }
Example #2
0
 protected void InitFields(DataRow rowInfo)
 {
     this.Id       = TengDa._Convert.StrToInt(rowInfo["Id"].ToString(), -1);
     this.name     = rowInfo["Name"].ToString();
     this.plcId    = TengDa._Convert.StrToInt(rowInfo["PlcId"].ToString(), -1);
     this.company  = rowInfo["Company"].ToString();
     this.model    = rowInfo["Model"].ToString();
     this.number   = rowInfo["Number"].ToString();
     this.isEnable = Convert.ToBoolean(rowInfo["IsEnable"]);
     this.clampOri = (ClampOri)Enum.Parse(typeof(ClampOri), rowInfo["ClampOri"].ToString());
 }
Example #3
0
        /// <summary>
        /// 关门指令
        /// </summary>
        /// <returns></returns>
        public void Rotate(ClampOri clampOri)
        {
            if (!this.Blanker.Plc.IsPingSuccess)
            {
                IsAlive = false;
                LogHelper.WriteError("无法连接到 " + this.Blanker.Plc.IP);
                return;
            }

            this.Station.toRotate[0] = clampOri != this.Blanker.Stations[0].ClampOri;
            this.Station.toRotate[1] = clampOri == this.Blanker.Stations[0].ClampOri;
        }
Example #4
0
 protected void InitFields(DataRow rowInfo)
 {
     this.Id              = TengDa._Convert.StrToInt(rowInfo["Id"].ToString(), -1);
     this.clampOri        = (ClampOri)Enum.Parse(typeof(ClampOri), rowInfo["ClampOri"].ToString());
     this.fromType        = (GetPutType)Enum.Parse(typeof(GetPutType), rowInfo["FromType"].ToString());
     this.fromClampStatus = (ClampStatus)Enum.Parse(typeof(ClampStatus), rowInfo["FromClampStatus"].ToString());
     this.toType          = (GetPutType)Enum.Parse(typeof(GetPutType), rowInfo["ToType"].ToString());
     this.toClampStatus   = (ClampStatus)Enum.Parse(typeof(ClampStatus), rowInfo["ToClampStatus"].ToString());
     this.sampleStatus    = (SampleStatus)Enum.Parse(typeof(SampleStatus), rowInfo["SampleStatus"].ToString());
     this.priority        = TengDa._Convert.StrToInt(rowInfo["Priority"].ToString(), 1);
     this.cycleOrder      = TengDa._Convert.StrToInt(rowInfo["CycleOrder"].ToString(), 1);
     this.description     = rowInfo["Description"].ToString();
     this.isEnable        = Convert.ToBoolean(rowInfo["IsEnable"]);
 }
Example #5
0
 protected void InitFields(DataRow rowInfo)
 {
     this.Id             = TengDa._Convert.StrToInt(rowInfo["Id"].ToString(), -1);
     this.getPutType     = (GetPutType)Enum.Parse(typeof(GetPutType), rowInfo["GetPutType"].ToString());
     this.clampStatus    = (ClampStatus)Enum.Parse(typeof(ClampStatus), rowInfo["ClampStatus"].ToString());
     this.clampOri       = (ClampOri)Enum.Parse(typeof(ClampOri), rowInfo["ClampOri"].ToString());
     this.clampId        = TengDa._Convert.StrToInt(rowInfo["ClampId"].ToString(), -1);
     this.getPutTime     = DateTime.Parse(rowInfo["GetPutTime"].ToString());
     this.priority       = TengDa._Convert.StrToInt(rowInfo["Priority"].ToString(), 1);
     this.name           = rowInfo["Name"].ToString();
     this.company        = rowInfo["Company"].ToString();
     this.model          = rowInfo["Model"].ToString();
     this.number         = rowInfo["Number"].ToString();
     this.location       = rowInfo["Location"].ToString();
     this.isEnable       = Convert.ToBoolean(rowInfo["IsEnable"]);
     this.robotValues    = rowInfo["RobotValues"].ToString();
     this.floorStatus    = (FloorStatus)Enum.Parse(typeof(FloorStatus), rowInfo["FloorStatus"].ToString());
     this.sampleStatus   = (SampleStatus)Enum.Parse(typeof(SampleStatus), rowInfo["SampleStatus"].ToString());
     this.PreFloorStatus = this.floorStatus;
     this.fromStationId  = TengDa._Convert.StrToInt(rowInfo["FromStationId"].ToString(), -1);
 }
Example #6
0
        public bool GetInfo()
        {
            if (!this.Plc.IsPingSuccess)
            {
                if (this.RotaterId > 0)
                {
                    this.Rotater.IsAlive = false;
                }
                this.Plc.IsAlive = false;
                LogHelper.WriteError("无法连接到 " + this.Plc.IP);
                return(false);
            }

            string msg    = string.Empty;
            string output = string.Empty;

            try
            {
                if (!this.Plc.GetInfo(false, Current.option.GetBlankerInfoStr, out output, out msg))
                {
                    Error.Alert(msg);
                    this.Rotater.IsAlive = false;
                    this.Plc.IsAlive     = false;
                    return(false);
                }
                if (output.Substring(3, 1) != "$")
                {
                    LogHelper.WriteError(string.Format("与PLC通信格式错误,input:{0},output:{1}", Current.option.GetBlankerInfoStr, output));
                    return(false);
                }

                int[] iOut = new int[13];
                output = PanasonicPLC.ConvertHexStr(output.TrimEnd('\r'), false);
                for (int j = 0; j < iOut.Length; j++)
                {
                    iOut[j] = int.Parse(output.Substring(j * 4, 4), System.Globalization.NumberStyles.AllowHexSpecifier);
                }

                for (int j = 0; j < this.Stations.Count; j++)
                {
                    switch (iOut[j])
                    {
                    case 1:
                        this.Stations[j].ClampStatus = ClampStatus.无夹具;
                        this.Stations[j].Status      = StationStatus.可放;
                        break;

                    case 2:
                        this.Stations[j].ClampStatus = ClampStatus.满夹具;
                        this.Stations[j].Status      = StationStatus.工作中;
                        break;

                    case 3:
                        this.Stations[j].ClampStatus = ClampStatus.空夹具;
                        this.Stations[j].Status      = StationStatus.可取;
                        break;

                    default:
                        this.Stations[j].ClampStatus = ClampStatus.未知;
                        this.Stations[j].Status      = StationStatus.可用;
                        break;
                    }
                }

                if (this.RotaterId > 0)
                {
                    switch (iOut[6])
                    {
                    case 1: this.Rotater.Station.ClampStatus = ClampStatus.无夹具; break;

                    case 2:
                    case 3: this.Rotater.Station.ClampStatus = ClampStatus.空夹具; break;

                    default: this.Rotater.Station.ClampStatus = ClampStatus.异常; break;
                    }

                    switch (iOut[7])
                    {
                    case 1: this.Rotater.Station.DoorStatus = DoorStatus.打开; break;

                    case 2: this.Rotater.Station.DoorStatus = DoorStatus.关闭; break;

                    default: this.Rotater.Station.DoorStatus = DoorStatus.异常; break;
                    }

                    if (this.Rotater.Station.ClampStatus == ClampStatus.无夹具 && this.Rotater.Station.DoorStatus == DoorStatus.打开)
                    {
                        this.Rotater.Station.Status = StationStatus.可放;
                    }
                    else if (this.Rotater.Station.ClampStatus == ClampStatus.空夹具 && this.Rotater.Station.DoorStatus == DoorStatus.打开)
                    {
                        this.Rotater.Station.Status = StationStatus.可取;
                    }
                    else
                    {
                        this.Rotater.Station.Status = StationStatus.工作中;
                    }

                    ClampOri clampOri = this.Stations[0].ClampOri;
                    switch (iOut[12])
                    {
                    case 1: this.Rotater.Station.ClampOri = clampOri == ClampOri.A ? ClampOri.B : ClampOri.A; break;

                    case 2: this.Rotater.Station.ClampOri = clampOri; break;

                    default: this.Rotater.Station.ClampOri = ClampOri.未知; break;
                    }

                    #region 控制开门
                    if (this.Rotater.Station.toOpenDoor)
                    {
                        output = string.Empty;
                        if (!this.Plc.GetInfo(false, Current.option.RotaterOpenDoorStr, out output, out msg))
                        {
                            Error.Alert(msg);
                            this.Plc.IsAlive = false;
                            return(false);
                        }

                        if (output.Substring(3, 1) != "$")
                        {
                            LogHelper.WriteError(string.Format("与PLC通信格式错误,input:{0},output:{1}", Current.option.RotaterOpenDoorStr, output));
                            return(false);
                        }
                        LogHelper.WriteInfo(string.Format("成功发送旋转台开门指令到{0}:{1}", this.Rotater.Station.Name, Current.option.RotaterOpenDoorStr));
                        this.Rotater.Station.toOpenDoor = false;
                    }
                    #endregion

                    #region 控制关门
                    if (this.Rotater.Station.toCloseDoor)
                    {
                        output = string.Empty;
                        if (!this.Plc.GetInfo(false, Current.option.RotaterCloseDoorStr, out output, out msg))
                        {
                            Error.Alert(msg);
                            this.Plc.IsAlive = false;
                            return(false);
                        }

                        if (output.Substring(3, 1) != "$")
                        {
                            LogHelper.WriteError(string.Format("与PLC通信格式错误,input:{0},output:{1}", Current.option.RotaterCloseDoorStr, output));
                            return(false);
                        }
                        LogHelper.WriteInfo(string.Format("成功发送旋转台关门指令到{0}:{1}", this.Rotater.Station.Name, Current.option.RotaterCloseDoorStr));
                        this.Rotater.Station.toCloseDoor = false;
                    }

                    #endregion

                    #region 控制旋转

                    for (int x = 0; x < 2; x++)
                    {
                        if (this.Rotater.Station.toRotate[x])
                        {
                            output = string.Empty;
                            if (!this.Plc.GetInfo(false, Current.option.RotaterRotateStrs.Split(',')[x], out output, out msg))
                            {
                                Error.Alert(msg);
                                this.Plc.IsAlive = false;
                                return(false);
                            }

                            if (output.Substring(3, 1) != "$")
                            {
                                LogHelper.WriteError(string.Format("与PLC通信格式错误,input:{0},output:{1}", Current.option.RotaterRotateStrs.Split(',')[x], output));
                                return(false);
                            }
                            LogHelper.WriteInfo(string.Format("成功发送旋转台旋转指令到{0}:{1}", this.Rotater.Station.Name, Current.option.RotaterRotateStrs.Split(',')[x]));
                            this.Rotater.Station.toRotate[x] = false;
                        }
                    }
                    #endregion
                }

                if (this.CacheId > 0)
                {
                    for (int j = 0; j < this.Cache.Stations.Count; j++)
                    {
                        switch (iOut[8 + j])
                        {
                        case 1:
                            this.Cache.Stations[j].ClampStatus = ClampStatus.无夹具;
                            this.Cache.Stations[j].Status      = StationStatus.可放;
                            break;

                        case 2:
                            this.Cache.Stations[j].ClampStatus = this.Cache.Stations[j].Clamp.Batteries.Count > 0 ? ClampStatus.满夹具 : ClampStatus.空夹具;
                            this.Cache.Stations[j].Status      = StationStatus.工作中;
                            break;

                        case 3:
                            this.Cache.Stations[j].ClampStatus = this.Cache.Stations[j].Clamp.Batteries.Count > 0 ? ClampStatus.满夹具 : ClampStatus.空夹具;
                            this.Cache.Stations[j].Status      = StationStatus.可取;
                            break;

                        case 4:
                            this.Cache.Stations[j].ClampStatus = ClampStatus.异常;
                            this.Cache.Stations[j].Status      = StationStatus.可用;
                            break;

                        default:
                            this.Cache.Stations[j].ClampStatus = ClampStatus.未知;
                            this.Cache.Stations[j].Status      = StationStatus.可用;
                            break;
                        }
                        this.Cache.Stations[j].Status = StationStatus.工作中;
                    }
                }

                Thread.Sleep(100);
            }
            catch (Exception ex)
            {
                Error.Alert(ex);
            }

            this.Plc.IsAlive = true;

            this.AlreadyGetAllInfo = true;

            return(true);
        }