コード例 #1
0
 /// <summary>
 /// 修改设备控制数据
 /// </summary>
 /// <param name="pc">查询函数</param>
 /// <param name="ap">修改字段函数</param>
 /// 说明:如果在修改时遇到错误,执行一次新增设备控制数据,再次进行修改操作
 public static void UpdateDeviceControl(List <DeviceControl> dclist, Expression <Func <DeviceControl, bool> > pc, Action <DeviceControl> ap)
 {
     try
     {
         if (pc != null && ap != null)
         {
             DeviceControlDAL.UpdateDevice(pc, ap);
         }
     }
     catch
     {
         EMEWE.CarManagement.Commons.CommonClass.CommonalityEntity.WriteTextLog("记录设备控制表修改异常:");
         try
         {
             AddDeviceControl(dclist);
             if (pc != null && ap != null)
             {
                 DeviceControlDAL.UpdateDevice(pc, ap);
             }
         }
         catch
         {
             EMEWE.CarManagement.Commons.CommonClass.CommonalityEntity.WriteTextLog("记录设备控制表新增后再次修改异常:");
         }
     }
 }
コード例 #2
0
        /// <summary>
        /// 新增设备控制数据
        /// 说明:每次获取数据前先检查是否有新增的数据并进行新增
        /// </summary>
        public static void AddDeviceControl(List <DeviceControl> dclist)
        {
            try
            {
                if (dclist.Count <= 0)
                {
                    dclist = GetDeviceControl();
                }

                string strSql = "select * from View_FVN_Driveway_Position where Position_Value='" + SystemClass.PosistionValue + "'";
                List <View_FVN_Driveway_Position> vfdpList = View_FVN_Driveway_PositionDAL.GetSQLList(strSql);
                if (vfdpList.Count > dclist.Count)
                {
                    bool isFind = false;
                    foreach (View_FVN_Driveway_Position vfdp in vfdpList)
                    {
                        foreach (DeviceControl dc in dclist)
                        {
                            if (vfdp.FVN_Value.ToString() == dc.DeviceControl_FanValue && vfdp.Driveway_Value == dc.DeviceControl_DrivewayValue && vfdp.Driveway_ReadCardPort == dc.DeviceControl_ReadValue && vfdp.Position_Value == dc.DeviceControl_PositionValue)
                            {
                                isFind = true;
                                break;
                            }
                            else
                            {
                                isFind = false;
                            }
                        }
                        if (!isFind)
                        {
                            DeviceControl rentity = new DeviceControl();
                            //rentity.DeviceControl_CardNo = "";
                            rentity.DeviceControl_DrivewayAddress = vfdp.Driveway_Address;
                            rentity.DeviceControl_DrivewayValue   = vfdp.Driveway_Value;
                            rentity.DeviceControl_FanValue        = vfdp.FVN_Value.ToString();
                            rentity.DeviceControl_FanSate         = "0";   //无地感
                            rentity.DeviceControl_ISCardRelease   = false; //未刷卡放行
                            rentity.DeviceControl_OutSate         = "无";   //输出无命令
                            rentity.DeviceControl_PositionValue   = vfdp.Position_Value;
                            rentity.DeviceControl_ReadValue       = vfdp.Driveway_ReadCardPort;
                            DeviceControlDAL.InsertOneDevice(rentity);
                        }
                    }
                }
            }
            catch
            {
                EMEWE.CarManagement.Commons.CommonClass.CommonalityEntity.WriteTextLog("记录设备控制表新增异常:");
            }
        }
コード例 #3
0
        //List<DeviceControl> dclist = new List<DeviceControl>();

        //bool ISBusyTimerDeviceControl = false;
        //private void timerDeviceControl_Tick(object sender, EventArgs e)
        //{
        //    if (!ISBusyTimerDeviceControl)
        //    {
        //        ISBusyTimerDeviceControl = true;
        //        GetDeviceControl();
        //        ISBusyTimerDeviceControl = false;

        //    }
        //}

        /// <summary>
        /// 根据当前门岗获取设备控制数据
        /// </summary>
        public static List <DeviceControl> GetDeviceControl()
        {
            List <DeviceControl> listDC = new List <DeviceControl>();

            try
            {
                string strSql = "select * from DeviceControl where DeviceControl_PositionValue='" + SystemClass.PosistionValue + "'";
                listDC = DeviceControlDAL.GetDeviceControl(strSql);
            }
            catch
            {
                EMEWE.CarManagement.Commons.CommonClass.CommonalityEntity.WriteTextLog("记录设备控制表获取数据异常:");
            }
            return(listDC);
        }