/// <summary>
        /// 查询实时接收器信息
        /// </summary>
        /// <param name="strState">分站编号</param>
        /// <param name="dv"></param>
        /// <returns></returns>
        public bool N_SearchStaHeadBreakInfo(string strState,DataGridViewKJ128 dv)
        {
            using (ds = new DataSet())
            {
                dv.Columns.Clear();
                ds = this.N_GetStaHeadBreakInfo(strState);
                if (ds == null )
                {
                    return false;
                }
                ds.Tables[0].Columns[0].ColumnName = HardwareName.Value(CorpsName.StationAddress);
                ds.Tables[0].Columns[1].ColumnName = HardwareName.Value(CorpsName.StationSplace);
                ds.Tables[0].Columns[2].ColumnName = HardwareName.Value(CorpsName.StaHeadAddress);
                ds.Tables[0].Columns[3].ColumnName = HardwareName.Value(CorpsName.StaHeadSplace);
                ds.Tables[0].Columns[4].ColumnName = HardwareName.Value(CorpsName.StaHead) + "联系电话";
                ds.Tables[0].Columns[5].ColumnName = HardwareName.Value(CorpsName.StaHead) + "类型";
                ds.Tables[0].Columns[6].ColumnName = HardwareName.Value(CorpsName.StaHead) + "状态";
                ds.Tables[0].Columns[7].ColumnName = HardwareName.Value(CorpsName.StaHead) + "故障时间";

                dv.DataSource = ds.Tables[0].DefaultView;
                dv.Columns[0].FillWeight = 40;
                dv.Columns[2].FillWeight = 55;
                dv.Columns[3].FillWeight = 150;
                dv.Columns[6].FillWeight = 70;
                dv.Columns[7].FillWeight = 120;
                dv.Columns[7].DefaultCellStyle.Format = "yyyy-MM-dd HH:mm:ss";
            }

            return true;
        }
        public bool GetHisBadStaHeadInfo(string strStartTime, string strEndTime, string strStationAddress, DataGridViewKJ128 dv)
        {
            using (ds = new DataSet())
            {
                try
                {
                    dv.Columns.Clear();

                    ds = hbdal.GetHisBadStaHeadInfo(strStartTime, strEndTime, strStationAddress);

                    if (ds != null && ds.Tables.Count >= 0)
                    {
                        dv.DataSource = ds.Tables[0];

                        dv.Columns[0].HeaderText = HardwareName.Value(CorpsName.StationAddress);

                        dv.Columns[1].HeaderText = HardwareName.Value(CorpsName.StaHeadAddress);
                    }
                }
                catch (Exception)
                {
                    dv.DataSource = null;
                    return false;
                }
            }
            return true;
        }
        /// <summary>
        /// 查询超员信息
        /// </summary>
        /// <param name="intOverEmpType">超员类别,1:超员;2:欠员</param>
        /// <param name="dv"></param>
        /// <returns>True:成功;False:失败</returns>
        public bool SelectOverEmp(int intOverEmpType, DataGridViewKJ128 dv)
        {
            try
            {
                using (ds = new DataSet())
                {
                    dv.Columns.Clear();

                    ds = rtoedal.SelectOverEmp(intOverEmpType);

                    //if (ds == null)
                    //{
                    //    return false;
                    //}
                    ds.Tables[0].TableName = "TaskTimeBLL_RtOverEmp";
                    dv.DataSource = ds.Tables[0].DefaultView;

                }
            }
            catch 
            {
                return false;
            }

            return true;
            
        }
        public bool N_SearchFactoryInfo(string strFacNO, string strFacID, DataGridViewKJ128 dv,out string strCounts)
        {
            using (ds = new DataSet())
            {
                dv.Columns.Clear();
                ds = cemdal.N_GetFactoryInfo(strFacNO, strFacID);

                dv.DataSource = ds.Tables[0].DefaultView;
                if (ds != null && ds.Tables.Count > 0)
                {
                    if (ds.Tables[0].Rows.Count > 0)
                    {
                        strCounts = ds.Tables[0].Rows.Count.ToString();
                    }
                    else
                    {
                        strCounts = "0";
                    }
                }
                else
                {
                    strCounts = "0";
                }
            }
            return true;
        }
        public bool N_SearchDirectionalManage(string txtDetection, string strWhere, DataGridViewKJ128 dv,out string strCounts)
        {
            using (ds = new DataSet())
            {
                dv.Columns.Clear();
                ds = cdmdal.N_SearchDirectionalManage(txtDetection, strWhere);

                dv.DataSource = ds.Tables[0].DefaultView;
                dv.Columns[0].FillWeight = 70;
                dv.Columns[1].FillWeight = 85;
                if (ds != null && ds.Tables.Count > 0)
                {
                    if (ds.Tables[0].Rows.Count > 0)
                    {
                        strCounts = ds.Tables[0].Rows.Count.ToString();
                    }
                    else
                    {
                        strCounts = "0";
                    }
                }
                else
                {
                    strCounts = "0";
                }
            }
            return true;
        }
        /// <summary>
        /// 获取低电量信息
        /// </summary>
        /// <param name="CodeSenderStateID">发码器状态,4:低电量</param>
        /// <param name="dv"></param>
        /// <param name="strCounts"></param>
        /// <returns></returns>
        public bool N_SelectAlarmElectricity(int CodeSenderStateID,int intCsTypeID, DataGridViewKJ128 dv,out string strCounts)
        {
            using (ds = new DataSet())
            {
                dv.Columns.Clear();

                ds = rtaedal.N_GetAlarmElectricity(CodeSenderStateID,intCsTypeID);

                if (ds != null && ds.Tables.Count > 0)
                {
                    if (ds.Tables[0].Rows.Count > 0)
                    {
                        strCounts = ds.Tables[0].Rows.Count.ToString();
                    }
                    else
                    {
                        strCounts = "0";
                    }

                    ds.Tables[0].Columns[0].ColumnName = HardwareName.Value(CorpsName.CodeSenderAddress);

                    dv.DataSource = ds.Tables[0];
                }
                else
                {
                    strCounts = "0";
                }                
            }
            return true;
        }
        public bool N_SearchRTInTerritorialInfo(int  intTerTypeID,string strTerName,bool blIsEmp,string strIsAlarm, DataGridViewKJ128 dv,out string strCounts)
        {            
            using (ds = new DataSet())                              //加载信息
            {
                dv.Columns.Clear();
                ds = rtitdal.N_GetRTInTerritorialInfo(intTerTypeID, strTerName, blIsEmp, strIsAlarm);
                dv.DataSource = ds.Tables[0].DefaultView;

                //将进入区域时间精确到秒
                dv.Columns[6].DefaultCellStyle.Format = "yyyy-MM-dd HH:mm:ss";
                dv.Columns[6].FillWeight = 120;

                dv.Columns[5].Visible  = false;

                if (ds != null && ds.Tables.Count > 0)
                {
                    if (ds.Tables[0].Rows.Count > 0)
                    {
                        strCounts = ds.Tables[0].Rows.Count.ToString();
                    }
                    else
                    {
                        strCounts = "0";
                    }
                }
                else
                {
                    strCounts = "0";
                }
          
            }
            return true;
        }
        public bool N_SearchOverTimeInfo(string strName,string strCard,string strDeptID,string strWorkTypeId,string strDutyId,DataGridViewKJ128 dv,out string strCounts)
        {
            using (ds = new DataSet())
            {
                dv.Columns.Clear();
                //ds = dbacc.GetDataSet(strSql);

                ds=rtotdal.N_GetOverTimeInfo(strName,strCard,strDeptID,strWorkTypeId,strDutyId);

                if (ds != null && ds.Tables.Count > 0)
                {
                    dv.DataSource = ds.Tables[0].DefaultView;

                    //将开始超时时间精确到秒

                    dv.Columns[5].DefaultCellStyle.Format = "yyyy-MM-dd HH:mm:ss";

                    if (ds.Tables[0].Rows.Count > 0)
                    {
                        strCounts = ds.Tables[0].Rows.Count.ToString();
                    }
                    else
                    {
                        strCounts = "0";
                    }
                }
                else
                {
                    strCounts = "0";
                }
            }

            return true;
        }
        public void N_SelectRTDirectional(string strDept, string strName, string strCardAddress, string strStation, string strStaHead, bool blIsEmp,string strDirectional, DataGridViewKJ128 dv,out string strCounts)
        {
            using (ds = new DataSet())
            {
                dv.Columns.Clear();
                ds = rtddal.N_GetRTDirectional(strDept, strName, strCardAddress, strStation, strStaHead, blIsEmp, strDirectional);

                ds.Tables[0].Columns[0].ColumnName = HardwareName.Value(CorpsName.CodeSenderAddress);
                ds.Tables[0].Columns[3].ColumnName = HardwareName.Value(CorpsName.StationAddress);
                ds.Tables[0].Columns[4].ColumnName = HardwareName.Value(CorpsName.StaHeadAddress);
                ds.Tables[0].Columns[6].ColumnName = HardwareName.Value(CorpsName.Inspect);


                if (ds != null && ds.Tables.Count > 0)
                {

                    //ds.Tables[0].Columns[0].ColumnName = HardwareName.Value(CorpsName.CodeSenderAddress);
                    //ds.Tables[0].Columns[3].ColumnName = HardwareName.Value(CorpsName.StationAddress);
                    //ds.Tables[0].Columns[4].ColumnName = HardwareName.Value(CorpsName.StaHeadAddress);
                    //ds.Tables[0].Columns[6].ColumnName = HardwareName.Value(CorpsName.Inspect);

                    dv.DataSource = ds.Tables[0].DefaultView;
                    dv.Columns[7].Visible = false;
                    dv.Columns[0].FillWeight = 50;
                    dv.Columns[1].FillWeight = 60;
                    dv.Columns[2].FillWeight = 60;
                    dv.Columns[3].FillWeight = 45;
                    dv.Columns[4].FillWeight = 45;
                    dv.Columns[5].FillWeight = 120;
                    dv.Columns[6].FillWeight = 85;

                    //将监测时间精确到秒
                    dv.Columns[6].DefaultCellStyle.Format = "yyyy-MM-dd HH:mm:ss";

                    if (ds != null && ds.Tables.Count > 0)
                    {
                        if (ds.Tables[0].Rows.Count > 0)
                        {
                            strCounts = ds.Tables[0].Rows.Count.ToString();
                        }
                        else
                        {
                            strCounts = "0";
                        }
                    }
                    else
                    {
                        strCounts = "0";
                    }
                }
                else
                {
                    dv.DataSource = null;
                    strCounts = "0";
                }
            }             
        }
        /// <summary>
        /// 查询实时超时信息
        /// </summary>
        /// <param name="dv">要显示的DataGridView</param>
        /// <returns></returns>
        public bool SearchRtInOutMine(DataGridViewKJ128 dv)
        {
            using (ds = new DataSet())
            {
                dv.Columns.Clear();
                ds = GetRtInOutMine();
                dv.DataSource = ds.Tables[0].DefaultView;
            }

            return true;
        }
        public bool N_SearchRTInOutAntennaInfo(
            string strStartTime, 
            string strEndTime, 
            string strCard, 
            string strStationAddress, 
            string strStationHeadAddress,
            int intUserType,
            DataGridViewKJ128 dv,
            out string strCounts)
        {
            if (DateTime.Compare(DateTime.Parse(strStartTime), DateTime.Parse(strEndTime)) > 0)
            {
                MessageBox.Show("对不起, 开始时间不能大于结束时间!");
                strCounts = "-1";
                return false;
            }
            using (ds = new DataSet())
            {
                dv.Columns.Clear();
                ds = lrtodal.N_SearchRTInOutAntennaInfo(strStartTime, strEndTime, strCard, strStationAddress, strStationHeadAddress,intUserType);

                dv.DataSource = ds.Tables[0];
                if (ds != null && ds.Tables.Count > 0)
                {
                    dv.Columns[3].FillWeight = 150;

                    dv.Columns[0].HeaderText = HardwareName.Value(CorpsName.CodeSenderAddress);
                    dv.Columns[1].HeaderText = HardwareName.Value(CorpsName.StationAddress);
                    dv.Columns[2].HeaderText = HardwareName.Value(CorpsName.StaHeadAddress);
                    dv.Columns[3].HeaderText = HardwareName.Value(CorpsName.StaHead) + "监测时间";


                    //将监测时间精确到秒
                    dv.Columns[3].DefaultCellStyle.Format = "yyyy-MM-dd HH:mm:ss";

                    if (ds.Tables[0].Rows.Count > 0)
                    {
                        strCounts = ds.Tables[0].Rows.Count.ToString();
                    }
                    else
                    {
                        strCounts = "0";
                    }

                }
                else
                {
                    strCounts = "0";
                }
            }

            return true;
        }
Beispiel #12
0
 public static void Print(DataGridViewKJ128 dgv, string title,string strSum)
 {
     if (dgv.DataSource == null)
     {
         MessageBox.Show("没有数据,无法打印", "提示");
         return;
     }
     DataGridView dgvs = dgv;
     model = GetModel.getMode(dgvs, title, strSum);//获得打印参数
     FormPrint print = new FormPrint(model);
     print.CallPrintForm(dgv, title, strSum);
 }
Beispiel #13
0
 public static void PrintSet128(DataGridViewKJ128 dgv, string title, string strSum)
 {
     if (dgv.DataSource == null)
     {
         MessageBox.Show("没有数据,无法选择输出格式", "提示");
         return;
     }
     DataGridView dgvs = dgv;
     model = GetModel.getMode(dgvs, title, strSum);//获得打印参数
     Frm_Print_Set cs = new Frm_Print_Set(model, title);
     cs.ShowDialog();
 }
Beispiel #14
0
        public bool GetRTEmpHelpInfo(string strBeginTime, string strEndTime, string strCodeSenderAddress, string strSatationAddress, string strStaHeadAddress, string strEmpName, string strDeptName, string strDutyName, string strWtName, string strMeasure, DataGridViewKJ128 dgv)
        {
            try
            {

                using (ds = new DataSet())
                {
                    ds = dal.SelectRealTimeEmpHelpInfo(strBeginTime, strEndTime, strCodeSenderAddress, strSatationAddress, strStaHeadAddress, strEmpName, strDeptName, strDutyName, strWtName, strMeasure);

                    if (ds != null && ds.Tables.Count > 0)
                    {
                        dgv.Columns.Clear();
                        dgv.DataSource = ds.Tables[0];
                        AddColumns(dgv);

                        
                        dgv.Columns[0].HeaderText = HardwareName.Value(CorpsName.StationAddress);
                        dgv.Columns[1].HeaderText = HardwareName.Value(CorpsName.StationSplace);
                        dgv.Columns[2].HeaderText = HardwareName.Value(CorpsName.StaHeadAddress);
                        dgv.Columns[3].HeaderText = HardwareName.Value(CorpsName.StaHeadSplace);
                        dgv.Columns[4].HeaderText = HardwareName.Value(CorpsName.CodeSenderAddress);
                    
                        dgv.Columns[0].Width = 50;
                        dgv.Columns[2].Width = 50;
                        dgv.Columns[4].Width = 50;
                        dgv.Columns[5].Width = 70;
                        dgv.Columns[6].Width = 70;
                        dgv.Columns[7].Width = 70;
                        dgv.Columns[8].Width = 70;

                        dgv.Columns[9].Width = 80;
                        dgv.Columns[10].Width = 140;
                        dgv.Columns[10].DefaultCellStyle.Format = "yyyy-MM-dd HH:mm:ss";

                        dgv.Columns[11].Visible = false;

                        if (New_DBAcess.blIsClient)
                        {
                            dgv.Columns["Measure"].Visible=false;
                            dgv.Columns["EndHelp"].Visible = false;
                        }

                    }

                }
                return true;
            }
            catch
            {
                return false;
            }
        }
        /// <summary>
        /// 查询历史超时记录
        /// </summary>
        /// <param name="strStartTime">开始时间</param>
        /// <param name="strEndTime">结束时间</param>
        /// <param name="strCard">发码器</param>
        /// <param name="dv">所要绑定的 DataGridView</param>
        /// <returns></returns>
        public bool SearchHisTimeOut(
            string strStartTime, 
            string strEndTime, 
            string strCard,
            DataGridViewKJ128 dv)
        {
            if (DateTime.Compare(DateTime.Parse(strStartTime), DateTime.Parse(strEndTime)) > 0)
            {
                MessageBox.Show("对不起, 开始时间不能大于结束时间!");
                return false;
            }

            strSql = " Select " +
                     " Hi.CodeSenderAddress As "+HardwareName.Value(CorpsName.CodeSender)+", " +
                     " Ei.EmpName As 名称, " +
                     " Di.DeptName As 部门, " +
                     " Hi.InMineTime As 下井时间, " +
                     " Hi.DelayedStartTime As 超时开始时间, " +
                     " Hi.DelayedEndTime As 超时结束时间, " +
                     " Hi.DelayedTime As 超时持续时间 " +
                     " From His_OverTimeAlarm As Hi " +
                     " Left Join Emp_Info As Ei On Ei.EmpID = Hi.UserID " +
                     " Left Join Emp_NowCompany As En On En.EmpID = Ei.EmpID " +
                     " Left Join Dept_Info As Di On Di.DeptID = En.DeptID " +
                     " Where Hi.CsTypeID = 1 And Hi.InMineTime >= '" + strStartTime + "' And Hi.InMineTime <= '" + strEndTime + "' ";

            if (!(strCard.Equals("") | strCard.Equals(null)))
            {
                strSql += " And Hi.CodeSenderAddress = " + strCard;
            }

            strSql += " Union " +
                     " Select " +
                     " Hi.CodeSenderAddress As " + HardwareName.Value(CorpsName.CodeSender) + ", " +
                     " Eb.EquName As 名称, " +
                     " Di.DeptName As 部门, " +
                     " Hi.InMineTime As 下井时间, " +
                     " Hi.DelayedStartTime As 超时开始时间, " +
                     " Hi.DelayedEndTime As 超时结束时间, " +
                     " Hi.DelayedTime As 超时持续时间 " +
                     " From His_OverTimeAlarm As Hi " +
                     " Left Join Equ_BaseInfo As Eb On Eb.EquID = Hi.UserID " +
                     " Left Join Dept_Info As Di On Di.DeptID = Eb.DeptID " +
                     " Where Hi.CsTypeID = 2 And Hi.InMineTime >= '" + strStartTime + "' And Hi.InMineTime <= '" + strEndTime + "' ";

            if (!(strCard.Equals("") | strCard.Equals(null)))
            {
                strSql += " And Hi.CodeSenderAddress = " + strCard;
            }

            return true;
        }
        /*
         * 外部调用
         */ 

        #region [ 方法: 查询分站信息 ]

        /// <summary>
        /// 查询分站信息
        /// </summary>
        /// <param name="dv"></param>
        /// <returns></returns>
        public int N_SearchStationInfo(DataGridViewKJ128 dv)
        {
            int iSum = 0;
            using (ds = new DataSet())
            {
                dv.Columns.Clear();
                ds = this.N_GetStationInfo();
                dv.DataSource = ds.Tables[0].DefaultView;
                iSum = ds.Tables[0].Rows.Count;
                if (dv.Rows.Count > 0)
                {
                    dv.Rows[0].Selected = true;
                }
                dv.Columns[0].FillWeight = 60;
                dv.Columns[2].FillWeight = 80;
                dv.Columns[3].FillWeight = 60;
            }

            return iSum;
        }
        /// <summary>
        /// 查询实时分站信息
        /// </summary>
        /// <param name="strState">分站状态</param>
        /// <param name="dv"></param>
        /// <returns></returns>
        public bool N_SearchStaBreakInfo(string strState, DataGridViewKJ128 dv)
        {
            using (ds = new DataSet())
            {
                dv.Columns.Clear();
                ds = rtsbdal.N_StaBreakInfo(strState);
                if (ds == null)
                {
                    return false;
                }
                ds.Tables[0].Columns[0].ColumnName = HardwareName.Value(CorpsName.StationAddress);
                ds.Tables[0].Columns[1].ColumnName = HardwareName.Value(CorpsName.StationSplace);
                //ds.Tables[0].Columns[2].ColumnName = HardwareName.Value(CorpsName.Station) + "联系电话";
                //ds.Tables[0].Columns[3].ColumnName = HardwareName.Value(CorpsName.Station) + "状态";
                //ds.Tables[0].Columns[4].ColumnName = HardwareName.Value(CorpsName.Station) + "故障时间";
 
                dv.DataSource = ds.Tables[0].DefaultView;
                dv.Columns[5].DefaultCellStyle.Format = "yyyy-MM-dd HH:mm:ss";
                dv.Columns[3].Visible = false;
            }

            return true;
        }
 private void cpToExcel_Click(object sender, EventArgs e)
 {
     DataGridViewKJ128 dgv = new DataGridViewKJ128();
     if (rbEmp.Checked)
     {
         
         dgv = dvEmp;
     }
     else
     {
         dgv = dvEqu;
     }
     PrintBLL.Print(dgv, Text, lb_Counts.Text);
     
 }
        public bool SearchOverTimeInfo(string strName, string strCard, string strDeptID, string strWorkTypeId, string strDutyId, DataGridViewKJ128 dv, out string strCounts)
        {
            using (ds = new DataSet())
            {
                dv.Columns.Clear();
                //ds = dbacc.GetDataSet(strSql);

                ds = rtotdal.N_GetOverTimeInfo(strName, strCard, strDeptID, strWorkTypeId, strDutyId);
                ds.Tables[0].TableName = "TaskTimeBLL_RtOverTime";
                dv.DataSource = ds.Tables[0].DefaultView;

                if (ds != null && ds.Tables.Count > 0)
                {
                    if (ds.Tables[0].Rows.Count > 0)
                    {
                        strCounts = ds.Tables[0].Rows.Count.ToString();
                    }
                    else
                    {
                        strCounts = "0";
                    }
                }
                else
                {
                    strCounts = "0";
                }
            }

            return true;
        }
        //#region 获取 发码器状态 基本信息

        ///// <summary>
        ///// 获取 发码器状态 基本信息
        ///// </summary>
        ///// <returns></returns>
        //private DataSet N_GetCsTypeName()
        //{
        //    strSql = " Select EnumID,Title From EnumTable Where FunID=2 ";
        //    return dbacc.GetDataSet(strSql);
        //}

        //#endregion

        #endregion

        #region [ 方法: 发码器查询 ]

        /// <summary>
        /// 发码器查询
        /// </summary>
        /// <param name="strCodeSender">发码器编号</param>
        /// <param name="strCodeSenderStateID">发码器状态ID</param>
        /// <param name="dv">要绑定的DataGridView</param>
        /// <returns>true 成功,false 不成功</returns>
        public bool N_SearchCodeInfo(string strCodeSender, string strCodeSenderStateID,  DataGridViewKJ128 dv,out string strCounts)
        {
            using (ds = new DataSet())
            {
                dv.Columns.Clear();
                ds = ccsdal.N_SearchCodeInfo(strCodeSender, strCodeSenderStateID);

                dv.DataSource = ds.Tables[0].DefaultView;
                dv.Columns[0].FillWeight = 40;
                dv.Columns[1].FillWeight = 40;
                dv.Columns[2].FillWeight = 40;
                if (ds != null && ds.Tables.Count > 0)
                {
                    if (ds.Tables[0].Rows.Count > 0)
                    {
                        strCounts = ds.Tables[0].Rows.Count.ToString();
                    }
                    else
                    {
                        strCounts = "0";
                    }
                }
                else
                {
                    strCounts = "0";
                }

                dv.Columns[1].HeaderText = HardwareName.Value(CorpsName.CodeSender) + "状态";
            }
            return true;
        }
Beispiel #21
0
        public void SearchStaHeadInfo(string strSta, string strStaHead, int headDisplayType, DataGridViewKJ128 dv,out string strCounts)
        {
            /*string strSql;
            strSql = " Select " +
                        " Rcs.CodeSenderAddress as 发码器, " +
                        " 名称=case when CsTypeID=0 then Ei.EmpName when CsTypeID=1 then Ebi.EquName end, " +
                        " 配置类型= case when CsTypeID=0 then '人员' when CsTypeID=1 then '设备' end, " +
                        " 部门=case when CsTypeID=0 then Di1.DeptName when CsTypeID=1 then Di2.DeptName end, " +
                        " Cd.Directional as 方向性, " +
                        " StationHeadDetectTime as 监测时间 " +
                     " From " +
                        " RealTimeCodeSender as Rcs left join CodeSender_Set as Cs on Cs.CsSetID=Rcs.CsSetID " +
                        " left join Emp_Info as Ei on Ei.EmpID=Cs.UserID and CsTypeID=0 " +
                        " left join Emp_NowCompany as Enc on Enc.EmpID=Ei.EmpID " +
                        " left join Dept_Info as Di1 on Di1.DeptID=Enc.DeptID " +
                        " left join CodeSender_Directional as Cd on Cd.DetectionInfo =Rcs.CodeSenderDirectional " +
                        " left join Equ_BaseInfo as Ebi on Ebi.EquID =Cs.UserID and CsTypeID=1 " +
                        " left join Dept_Info as Di2 on Di2.DeptID=Ebi.DeptID " +
                     " Where " +
                        " Rcs.StationAddress = " + strSta;
            if (strStaHead != "")
            {
                strSql += " And Rcs.StationHeadAddress = " + strStaHead;
            }
            if (headDisplayType != 2)
            {
                strSql += " And CsTypeID=" + headDisplayType.ToString();
            }
            using (ds = new DataSet())
            {
                dv.Columns.Clear();
                ds = dbacc.GetDataSet(strSql);
                dv.DataSource = ds.Tables[0].DefaultView;
            }*/
            string procName = "PROC_GetRTStaHeadCodeInfo";
            SqlParameter[] sqlParmeters ={
                            new SqlParameter("StationAddress",SqlDbType.Int),
                            new SqlParameter("StationHeadAddress",SqlDbType.Int),
                            new SqlParameter("sumType",SqlDbType.Int)
            };
            sqlParmeters[0].Value = strSta;
            sqlParmeters[1].Value = strStaHead;
            sqlParmeters[2].Value = headDisplayType;

            using (ds = new DataSet())
            {
                dv.Columns.Clear();
                ds = dbacc.GetDataSet(procName, sqlParmeters);

                if (ds == null)
                {
                    dv.DataSource = null;
                    strCounts = "0";
                    return;
                }
                ds.Tables[0].Columns[0].ColumnName = HardwareName.Value(CorpsName.CodeSenderAddress);   //发码器编号
                ds.Tables[0].Columns[5].ColumnName = HardwareName.Value(CorpsName.Inspect);             //监测时间

                dv.DataSource = ds.Tables[0].DefaultView;

                dv.Columns[5].DefaultCellStyle.Format = "yyyy-MM-dd HH:mm:ss";

                if (ds != null && ds.Tables.Count > 0)
                {
                    if (ds.Tables[0].Rows.Count > 0)
                    {
                        strCounts = ds.Tables[0].Rows.Count.ToString();
                    }
                    else
                    {
                        strCounts = "0";
                    }
                }
                else
                {
                    strCounts = "0";
                }
            }

        }
        /// <summary>
        /// 查询部门信息
        /// </summary>
        /// <param name="dv">要绑定的DataGridView</param>
        /// <param name="strDeptID">部门ID</param>
        /// <returns>true 成功,false 不成功</returns>
        public int N_SearchDeptInfo(DataGridViewKJ128 dv, string strDeptID)
        {
            using (ds = new DataSet())
            {
                dv.Columns.Clear();
                ds = this.N_GetSearchDeptInfo(strDeptID);
                dv.DataSource = ds.Tables[0].DefaultView;
                //dv.Columns[0].FillWeight = 76;
                //dv.Columns[1].FillWeight = 76;
                //dv.Columns[2].FillWeight = 53;
                //dv.Columns[3].FillWeight = 70;
                //dv.Columns[4].FillWeight = 70;
                //dv.Columns[5].FillWeight = 70;
                //dv.Columns[6].FillWeight = 90;
                //dv.Columns[7].FillWeight = 100;
                //dv.Columns[8].FillWeight = 100;
            }

            return ds.Tables[0].Rows.Count;
        }
 /// <summary>
 /// 查询(工种、证书、职务) 信息
 /// </summary>
 /// <param name="dv">要绑定的DataGridView</param>
 /// <param name="strFlagFun">信息标志,  工种为"WorkType", 证书为"Certificate", 职务为"Duty"</param>
 /// <returns>true 成功,false 不成功</returns>
 public int N_SearchInfo(DataGridViewKJ128 dv, string strFlagFun)
 {
     int iSum = 0;
     using (ds = new DataSet())
     {
         dv.Columns.Clear();
         switch (strFlagFun)
         {
             case "WorkType":
                 ds = this.N_GetWorkTypeInfo();
                 dv.DataSource = ds.Tables[0].DefaultView;
                 dv.Columns[0].FillWeight = 45;
                 dv.Columns[1].FillWeight = 45;
                 dv.Columns[2].FillWeight = 50;
                 dv.Columns[3].FillWeight = 50;
                 break;
             case "Certificate":
                 ds = this.N_GetCertificateInfo();
                 dv.DataSource = ds.Tables[0].DefaultView;
                 dv.Columns[0].FillWeight = 45;
                 dv.Columns[1].FillWeight = 65;
                 dv.Columns[2].FillWeight = 45;
                 break;
             case "Duty":
                 ds = this.N_GetDutyInfo();
                 dv.DataSource = ds.Tables[0].DefaultView;
                 dv.Columns[0].FillWeight = 45;
                 dv.Columns[1].FillWeight = 45;
                 break;
             default:
                 return 0;
         }
         iSum = ds.Tables[0].Rows.Count;
     }
     return iSum;
 }
        /// <summary>
        /// 查询实时进出接收器信息_人员 
        /// </summary>
        /// <param name="strStartTime">开始时间</param>
        /// <param name="strEndTime">结束时间</param>
        /// <param name="strStationAddress">分站编号</param>
        /// <param name="strStationHeadAddress">接收器号</param>
        /// <param name="strName">姓名</param>
        /// <param name="strCard">发码器</param>
        /// <param name="strWorkTypeId">工种</param>
        /// <param name="strDeptName">部门</param>
        /// <param name="intUserType">用户类型 1人 2设备</param>
        /// <param name="dv">要显示的DataGridView</param>
        /// <returns></returns>
        public bool N_SearchRTInOutStationHeadInfo(
            string strStartTime, 
            string strEndTime, 
            string strStationAddress, 
            string strStationHeadAddress,
            string strName,
            string strCard,
            string strWorkTypeId,
            string strDeptName,
            int intUserType,
            DataGridViewKJ128 dv,
            out string strCounts)
        {
            if (DateTime.Compare(DateTime.Parse(strStartTime), DateTime.Parse(strEndTime)) > 0)
            {
                MessageBox.Show("对不起, 开始时间不能大于结束时间!");
                strCounts="-1";
                return false;
            }

            using (ds = new DataSet())
            {
                dv.Columns.Clear();
                //ds = dbacc.GetDataSet(strSql);
                ds = lrtdal.N_GetRTInOutStationHeadInfo(strStartTime, strEndTime, strStationAddress, strStationHeadAddress, strName, strCard, strWorkTypeId, strDeptName, intUserType);

                dv.DataSource = ds.Tables[0].DefaultView;
                if (ds != null && ds.Tables.Count > 0)
                {
                    dv.Columns[4].FillWeight = 60;
                    dv.Columns[5].FillWeight = 60;
                    dv.Columns[6].FillWeight = 160;
                    dv.Columns[8].FillWeight = 130;

                    //将监测时间精确到秒
                    dv.Columns[8].DefaultCellStyle.Format = "yyyy-MM-dd HH:mm:ss";

                    if (ds.Tables[0].Rows.Count > 0)
                    {
                        strCounts = ds.Tables[0].Rows.Count.ToString();
                    }
                    else
                    {
                        strCounts = "0";
                    }


                }
                else
                {
                    strCounts = "0";
                }
            }

            return true;
        }
        /// <summary>
        /// 查询人员配置信息
        /// </summary>
        /// <param name="strName">员工姓名</param>
        /// <param name="strNo">员工编号</param>
        /// <param name="strIdCard">身份证编号</param>
        /// <param name="strDeptID">部门ID</param>
        /// <param name="strWorkTypeId">工种ID</param>
        /// <param name="strDutyId">职务ID</param>
        /// <param name="dv">要绑定的DataGridView</param>
        /// <returns>true 成功,false 不成功</returns>
        public bool N_SearchConEmployeeInfo(string strName, string strNo, string strIdCard, string strDeptID, string strWorkTypeId, string strDutyId, DataGridViewKJ128 dv, out string strCounts)
        {
            using (ds = new DataSet())
            {
                dv.Columns.Clear();
                ds = ceidal.N_GetConEmployeeInfo(strName, strNo, strIdCard, strDeptID, strWorkTypeId, strDutyId);

                dv.DataSource = ds.Tables[0].DefaultView;
                dv.Columns[0].FillWeight = 76;
                dv.Columns[1].FillWeight = 76;
                dv.Columns[2].FillWeight = 53;
                dv.Columns[3].FillWeight = 70;
                dv.Columns[4].FillWeight = 70;
                dv.Columns[5].FillWeight = 70;
                dv.Columns[6].FillWeight = 90;
                dv.Columns[7].FillWeight = 100;
                dv.Columns[8].FillWeight = 100;
                if (ds != null && ds.Tables.Count > 0)
                {
                    if (ds.Tables[0].Rows.Count > 0)
                    {
                        strCounts = ds.Tables[0].Rows.Count.ToString();
                    }
                    else
                    {
                        strCounts = "0";
                    }
                }
                else
                {
                    strCounts = "0";
                }
            }
            return true;
        }
Beispiel #26
0
 //自动打印
 public void AutoPrint(DataGridViewKJ128 dgv, string title, string strSum)
 {
     //FormPrint print1 = new FormPrint();
     //print1.CallPrintForm(dgv, title, strSum, true);
     PrintBLL.Print(dgv, title, strSum);
 }
Beispiel #27
0
        //FunID 16 时间 15是打印    EnumValue为0时不打印
        public void TimePrint()
        {
            string date = GetTime();
            DataTable dt = GetPrint();
            string s = "";
            if (date != "0")
            {
                string nowDate = DateTime.Now.ToString("HH")+":" + DateTime.Now.ToString("mm");
                if (nowDate == date)
                {
                    if (dt.Select("EnumID=1")[0]["EnumValue"].ToString() == "1")
                    {
                        s += "1,";
                        // 实时下井人员总数及人员
                        RealTimeBLL rtbll = new RealTimeBLL();
                        DataSet ds = rtbll.getRTInWellEmpInfo(0, 9999, "1=1");
                        if (ds != null && ds.Tables.Count > 0)
                        {
                            DataGridViewKJ128 dgvRTInfo = new DataGridViewKJ128();
                            dgvRTInfo.DataSource = ds.Tables[0];
                            ds.Tables[0].TableName = "TaskTimeBLL_RtInOutMine";
                            Bind(dgvRTInfo,ds.Tables[0]);

                            dgvRTInfo.Columns[5].DefaultCellStyle.Format = "yyyy-MM-dd HH:mm:ss";
                            dgvRTInfo.Columns[5].FillWeight = 130;
                            dgvRTInfo.Columns[5].HeaderText = HardwareName.Value(CorpsName.InWellTime);
                            dgvRTInfo.Columns[6].HeaderText = HardwareName.Value(CorpsName.StandingWellTime);
                            PrintBLL.Print(dgvRTInfo, "实时下井人员总数及人员", ds.Tables[1].Rows[0][0].ToString());

                            AutoPrint(dgvRTInfo, "实时下井人员总数及人员", "实时下井人员总数:" + ds.Tables[1].Rows[0][0].ToString());
                        }
                    }

                    if (dt.Select("EnumID=2")[0]["EnumValue"].ToString() == "1")
                    {
                        s += "2,";
                        // 重点区域人员总数及人员
                        RealTimeInTerritorialDAL dal = new RealTimeInTerritorialDAL();
                        DataGridViewKJ128 dgvzd = new DataGridViewKJ128();
                        ds = dal.GetAreaTable("重点");
                        if (ds != null && ds.Tables.Count > 0)
                        {
                            dgvzd.DataSource = ds.Tables[0];
                            ds.Tables[0].TableName = "TaskTimeBLL_ImpArea";
                            Bind(dgvzd, ds.Tables[0]);
                            // print
                            AutoPrint(dgvzd, "重点区域人员总数及人员", "重点区域人员总数:" + ds.Tables[0].Rows.Count.ToString());

                        }
                    }

                    if (dt.Select("EnumID=3")[0]["EnumValue"].ToString() == "1")
                    {
                        s += "3,";
                        // 超时报警人员总数及人员
                        RealtimeOverTimeInfoBLL rtotbll = new RealtimeOverTimeInfoBLL();
                        DataGridViewKJ128 dgValue = new DataGridViewKJ128();
                        string strCounts = string.Empty;
                        rtotbll.SearchOverTimeInfo("", "", "", "0", "0", dgValue, out strCounts);

                        Bind(dgValue, ((DataView)dgValue.DataSource).Table);
                        //print
                        AutoPrint(dgValue, "超时报警人员总数及人员", "超时报警人员总数:" + ((DataView)dgValue.DataSource).Table.Rows.Count.ToString());
                    }

                    if (dt.Select("EnumID=4")[0]["EnumValue"].ToString() == "1")
                    {
                        s += "4,";
                        // 超员报警人员总数及人员
                        RealTimeOverEmpBLL rtoebll = new RealTimeOverEmpBLL();
                        DataGridViewKJ128 dgvOverEmp = new DataGridViewKJ128();
                        rtoebll.SelectOverEmp(1, dgvOverEmp);
                        Bind(dgvOverEmp, ((DataView)dgvOverEmp.DataSource).Table);
                        AutoPrint(dgvOverEmp, "超员报警人员总数及人员", "超员报警人员总数:" + ((DataView)dgvOverEmp.DataSource).Table.Rows.Count.ToString());

                    }

                    if (dt.Select("EnumID=5")[0]["EnumValue"].ToString() == "1")
                    {
                        s += "5,";
                        // 限制区域报警人员总数及人员
                        RealTimeInTerritorialDAL rtdal = new RealTimeInTerritorialDAL();
                        DataGridViewKJ128 dgvxz = new DataGridViewKJ128();
                        ds = rtdal.GetAreaTable("限制");
                        if (ds != null && ds.Tables.Count > 0)
                        {
                            ds.Tables[0].TableName = "TaskTimeBLL_LimitArea";
                            dgvxz.DataSource = ds.Tables[0];
                            Bind(dgvxz, ds.Tables[0]);
                            AutoPrint(dgvxz, "限制区域报警人员总数及人员", "限制区域报警人员总数:" + ds.Tables[0].Rows.Count.ToString());

                            // print
                        }
                    }

                    if (dt.Select("EnumID=6")[0]["EnumValue"].ToString() == "1")
                    {
                        s += "6,";
                        // 特种作业人员工作异常报警总数及人员
                        SpecialWorkTypeTerrialSetBLL swt = new SpecialWorkTypeTerrialSetBLL();
                        DataGridViewKJ128 dgvWork = new DataGridViewKJ128();
                        string strErr = string.Empty;
                        DataSet dswork = swt.Query_RealTimeSpecialWorkTypeAlarm(1, 9999, "", out strErr);
                        if (dswork != null && dswork.Tables.Count > 0)
                        {
                            dswork.Tables[0].TableName = "TaskTimeBLL_Special";
                            dgvWork.DataSource = dswork.Tables[0];
                            if (dgvWork.Columns.Count > 0)
                            {
                                dgvWork.Columns[0].Visible = false;
                                Bind(dgvWork, dswork.Tables[0]);
                                AutoPrint(dgvWork, "特种作业人员工作异常报警总数及人员", "特种作业人员工作异常报警总数:" + dgvWork.RowCount.ToString());
                            }
                        }
                    }

                    string value = dt.Select("EnumID=7")[0]["EnumValue"].ToString();
                    if (value != "0")
                    {
                        string now = DateTime.Now.ToString("dd")+":" + DateTime.Now.ToString("HH")+":"+DateTime.Now.ToString("mm");
                        if (value == now)
                        {
                            s += "7,";
                            // 领导干部每月下井总数及时间统计
                            AttendanceBLL aBLL = new AttendanceBLL();
                            DataGridViewKJ128 dgv = new DataGridViewKJ128();
                            string strErr7 = string.Empty;
                            string where = "and DataAttendance >" + Convert.ToString(int.Parse(DateTime.Now.ToString("MM")) - 1) + "-1"
                               + " and DataAttendance<" + DateTime.Now.ToString("MM").ToString() + "-1";
                            ds = aBLL.GetAttendanceStatisticByDuty(where, " and en.DutyID in (select EnumID from EnumTable where FunID = 4 and EnumValue = '1'"
                                , out strErr7);
                            if (ds != null && ds.Tables.Count > 0)
                            {
                                ds.Tables[0].TableName = "TaskTimeBLL_LeaderMonth";
                                dgv.DataSource = ds.Tables[0];
                                Bind(dgv, ds.Tables[0]);
                                AutoPrint(dgv, "领导干部每月下井总数及时间统计", "共 " + ds.Tables[0].Rows.Count.ToString() + "人");
                            }
                        }
                    }
                    //MessageBox.Show(s);
                }
            }
        }
Beispiel #28
0
 private void Bind(DataGridViewKJ128 dgv,DataTable dt)
 {
     foreach (DataColumn col in dt.Columns)
     {
         DataGridViewColumn c = new DataGridViewColumn();
         c.DataPropertyName = col.ColumnName;
         //c.Name = col.ColumnName;
         c.HeaderText = col.ColumnName;
         dgv.Columns.Add(c);
     }
 }
        public int N_SearchTerType(DataGridViewKJ128 dv)
        {
            int iSum = 0;
            using (ds = new DataSet())
            {
                dv.Columns.Clear();
                ds=camdal.N_SearchTerType();

                dv.DataSource = ds.Tables[0].DefaultView;
                iSum = ds.Tables[0].Rows.Count;
            }
            return iSum;
        }
Beispiel #30
0
 /// <summary>
 /// 绑定工种(返回DataGridView)
 /// </summary>
 /// <returns>返回DataGridView</returns>
 public DataGridViewKJ128 GetWorkTypeDgv(DataGridViewKJ128 dgv)
 {
     string strSql = "select * from KJ128N_WorkType_Info_Table";
     DataTable dt = GetDataTableWorkType(strSql);
     //DataGridViewColumn dgvc1=new DataGridViewColumn();
     //DataGridViewColumn dgvc2=new DataGridViewColumn();
     dgv.DataSource = dt;
     dgv.ReadOnly = true;
     dgv.Columns[0].DisplayIndex = 11;
     dgv.Columns[1].DisplayIndex = 11;
     dgv.Columns[4].Visible = false;
     dgv.Columns[9].Visible = false;
     dgv.Columns[10].Visible = false;
     dgv.Columns[11].Visible = false;
     dgv.Columns[2].Visible = false;
     dgv.Columns[8].Visible = false;
     return dgv;
 }