Ejemplo n.º 1
0
        private void Bind()
        {
            try
            {
                if (!string.IsNullOrWhiteSpace(AssemblyLineId))
                {
                    //通过生产线获取对应的所有设备信息和参数
                    DataLogHelper logHelper         = new DataLogHelper();
                    DeviceProduceLogCollection logs = logHelper.GetDeviceProduceLogCollection(AssemblyLineId);


                    //加载进列表
                    foreach (DeviceProduceLog log in logs)
                    {
                        int index = this.dvLogList.Rows.Add();
                        this.dvLogList.Rows[index].Cells["AssemblyLineTitle"].Value = log.AssemblyLineTitle;
                        this.dvLogList.Rows[index].Cells["ProcessTitle"].Value      = log.ProcessTitle;
                        this.dvLogList.Rows[index].Cells["SensorName"].Value        = log.SensorName;
                        this.dvLogList.Rows[index].Cells["DeviceName"].Value        = log.DeviceName;
                        this.dvLogList.Rows[index].Cells["Created"].Value           = log.Created;
                        this.dvLogList.Rows[index].Cells["DeviceStatus"].Value      = SysHelper.Enums.EnumHelper.GetDeviceActionTypeString(log.DeviceStatus);
                        this.dvLogList.Rows[index].Cells["SensorStatus"].Value      = SysHelper.Enums.EnumHelper.GetSenserStatusTypeString(log.SensorStatus);
                        this.dvLogList.Rows[index].Cells["ParType"].Value           = SysHelper.Enums.EnumHelper.GetDeviceParameterTypeString(log.ParType);
                        this.dvLogList.Rows[index].Cells["ParUnit"].Value           = log.ParUnit;
                        this.dvLogList.Rows[index].Cells["ParValue"].Value          = log.ParValue;
                    }
                }
            }catch (Exception ex)
            {
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 获取生产线所有设备传感器当前状态
        /// </summary>
        /// <param name="strAssemblyLineId">生产线编号</param>
        /// <returns></returns>
        public DeviceProduceLogCollection GetDeviceProduceLogCollection(string strAssemblyLineId)
        {
            try
            {
                DeviceProduceLogCollection items = new DeviceProduceLogCollection();
                using (DataModels.HnfactoryautodbDB dataContext = new DataModels.HnfactoryautodbDB())
                {
                    var datas = (from c in dataContext.VDeviceproducelogs
                                 where c.AssemblyLineId == strAssemblyLineId
                                 select c
                                 ).ToList();
                    foreach (DataModels.VDeviceproducelog data in datas)
                    {
                        DeviceProduceLog item = new DeviceProduceLog(data);
                        items.Add(item);
                    }
                }

                return(items);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }