Exemple #1
0
        public void loadData()
        {
            //LFProdArea
            //string sql = "select * from cbase_all_code where CODE_GROUP='"+maintype+"'";

            try
            {
                // string sql = "select * from cbase_all_code where CODE_GROUP='LFProdArea'";
                string sql = "select * from cbase_all_code where CODE_GROUP='" + maintype + "'";
                ds               = new AppSvrHMI.L3DataSet();
                ds.SourceType    = AppSvrHMI.L3DataSetSourceType.SQL;
                ds.SourceMethod  = sql;
                ds.L3DataAdapter = this.Adapter;
                ds.LoadData();

                if (ds.Tables[0].Rows.Count > 0)
                {
                    cbYuanyin.DataSource = ds;
                    // cbYuanyin.DataMember = "L3DataTable";
                    cbYuanyin.DisplayMember = "L3DataTable.Code_Des";
                }
                // cbYuanyin.DataSource = ds;
                //// cbYuanyin.DataMember = "L3DataTable";
                // cbYuanyin.DisplayMember = "L3DataTable.Code_Des";
                // MessageBox.Show(ds.Tables[0].Rows.Count.ToString());
            }
            catch
            {
                return;
            }
        }
        private void LoadData()
        {
            StringBuilder strsql = new StringBuilder();

            // string strheatid = "炉号";
            // dvTel.Rows.Clear();
            //strsql.Append("select heatid as 炉号  from  CCCM_Base_Data  where  HeatConfirm = 1  ");
            //strsql.Append("and PRODUCTIONDATE> sysdate-14 and heatid not in ");
            if (comboBox1.Text.Trim() != "")
            {
                strsql.Append("select a.heatid as 炉号,createtime as 错误时间,b.remark as 错误原因 from  CCCM_Base_Data a,  ");
                strsql.Append("(select heatid,remark,createtime,row_number()over(partition by heatid order by createtime desc) as ar ");
                strsql.Append(string.Format("from CRETRUNDATA_NC where BILLTYPE='{0}' and flag=1) b ", comboBox1.Text));
                strsql.Append("where  a.HeatConfirm = 1   and a.PRODUCTIONDATE> sysdate-14 and a.heatid=b.heatid(+) and ((b.ar=1) or (b.ar is null) ) and a.heatid not in ");
                strsql.Append(string.Format("( select heatid from CRETRUNDATA_NC where BILLTYPE='{0}' and flag=0 )", comboBox1.Text));
            }
            else
            {
                return;
            }

            try
            {
                AppSvrHMI.L3DataSet dsLabElement = new AppSvrHMI.L3DataSet();
                dsLabElement.SourceType    = AppSvrHMI.L3DataSetSourceType.SQL;
                dsLabElement.SourceMethod  = strsql.ToString();
                dsLabElement.L3DataAdapter = this.Adapter;
                dsLabElement.LoadData();
                dvTel.DataSource = dsLabElement.Tables[0];
                MessageBox.Show("执行完毕");
            }
            catch
            {
                return;
            }
        }