Ejemplo n.º 1
0
        public void DeleteWrongStadiumData()
        {
            ModuleManager          Manager      = new ModuleManager();
            TableDefineInfoManager TableManager = new TableDefineInfoManager();
            ModelDataManager       DataManager  = new ModelDataManager();


            String    modelIndex = "05d0d71b-def3-42ee-a16a-79b34de97e9b";
            DataTable dataTb     = GetDataTable("select * from [biz_norm_extent_" + modelIndex + "]");

            if (dataTb != null)
            {
                foreach (DataRow dataRow in dataTb.Rows)
                {
                    try
                    {
                        DataTable dt = GetDataTable("SELECT * FROM sys_biz_reminder_stadiumData WHERE DataID = '" +
                                                    dataRow["ID"].ToString() + "' AND F_IsDone=0");
                        if (dt == null || dt.Rows.Count == 0)
                        {
                            continue;
                        }
                        List <IndexDescriptionPair> Sheets = Manager.InitModuleInfo(modelIndex);

                        List <TableDefineInfo> TableSchemas = new List <TableDefineInfo>();
                        foreach (IndexDescriptionPair pair in Sheets)
                        {
                            TableDefineInfo Info = TableManager.GetTableDefineInfo(pair.Index, pair.DataTable);
                            TableSchemas.Add(Info);
                        }
                        String          extentTable       = "biz_norm_extent_" + modelIndex;
                        TableDefineInfo ExtentTableSchema = TableManager.GetTableDefineInfo("1", extentTable);
                        DataSet         ds        = DataManager.GetData(TableSchemas, ExtentTableSchema, dataRow["ID"].ToString(), dataRow["scpt"].ToString());
                        Object          key       = ds.Tables["[biz_norm_混凝土检查试件抗压强度试验报告]"].Rows[0]["col_norm_I33"];
                        String          deleteSql = "Update dbo.sys_biz_reminder_stadiumData set F_IsDone=1 WHERE F_IsDone IS NULL AND DataID='{0}' AND DateSpan={1}";
                        if (key != DBNull.Value)
                        {
                            if (key.ToString().Contains("28"))
                            {
                                ExcuteCommand(String.Format(deleteSql, dataRow["ID"].ToString(), 56));
                            }
                            else if (key.ToString().Contains("56"))
                            {
                                ExcuteCommand(String.Format(deleteSql, dataRow["ID"].ToString(), 28));
                            }
                        }
                    }
                    catch (Exception ex)
                    {
                        logger.Error("Delete Old Data Error: " + ex.Message + "; ModelIndex=" + modelIndex + "; DataID=" + dataRow["ID"].ToString());
                    }
                }
            }
        }
Ejemplo n.º 2
0
        public void MoveOldStadiumData()
        {
            ModuleManager          Manager      = new ModuleManager();
            TableDefineInfoManager TableManager = new TableDefineInfoManager();
            ModelDataManager       DataManager  = new ModelDataManager();

            DataTable tb = GetDataTable("SELECT DISTINCT a.ID FROM dbo.sys_biz_reminder_stadiumInfo a join sys_biz_Module b on a.id=b.id WHERE a.IsActive=1");

            if (tb != null)
            {
                foreach (DataRow row in tb.Rows)
                {
                    String    modelIndex = row["ID"].ToString();
                    DataTable dataTb     = GetDataTable("select * from [biz_norm_extent_" + modelIndex + "]");

                    if (dataTb != null)
                    {
                        foreach (DataRow dataRow in dataTb.Rows)
                        {
                            try
                            {
                                List <IndexDescriptionPair> Sheets = Manager.InitModuleInfo(modelIndex);

                                List <TableDefineInfo> TableSchemas = new List <TableDefineInfo>();
                                foreach (IndexDescriptionPair pair in Sheets)
                                {
                                    TableDefineInfo Info = TableManager.GetTableDefineInfo(pair.Index, pair.DataTable);
                                    TableSchemas.Add(Info);
                                }
                                String          extentTable       = "biz_norm_extent_" + modelIndex;
                                TableDefineInfo ExtentTableSchema = TableManager.GetTableDefineInfo("1", extentTable);
                                DataSet         ds = DataManager.GetData(TableSchemas, ExtentTableSchema, dataRow["ID"].ToString(), dataRow["scpt"].ToString());

                                InitStadium(modelIndex, ds);
                            }
                            catch (Exception ex)
                            {
                                logger.Error("Move Old Data Error: " + ex.Message + "; ModelIndex=" + modelIndex + "; DataID=" + dataRow["ID"].ToString());
                            }
                        }
                    }
                }
            }
        }
Ejemplo n.º 3
0
        /// <summary>
        /// 为西成线11标中心,删除219条资料的28d数据,并生成1条56d数据
        /// </summary>
        public void SpStadiumData()
        {
            ModuleManager          Manager      = new ModuleManager();
            TableDefineInfoManager TableManager = new TableDefineInfoManager();
            ModelDataManager       DataManager  = new ModelDataManager();


            String        modelIndex  = "05d0d71b-def3-42ee-a16a-79b34de97e9b";
            DataTable     dataTb      = GetDataTable("select * from [biz_norm_extent_" + modelIndex + "] WHERE scpt LIKE '0001001700010001%' ");
            DataTable     stadiumInfo = GetStadiumInfoByModelIndex(modelIndex);
            StadiumConfig config      = Newtonsoft.Json.JsonConvert.DeserializeObject <StadiumConfig>(stadiumInfo.Rows[0]["StadiumConfig"].ToString());

            if (dataTb != null)
            {
                foreach (DataRow dataRow in dataTb.Rows)
                {
                    try
                    {
                        DataTable dt = GetDataTable("SELECT * FROM sys_biz_reminder_stadiumData WHERE DataID='" + dataRow["ID"].ToString() + "' AND DateSpan = 56");
                        if (dt.Rows.Count == 0)
                        {
                            List <IndexDescriptionPair> Sheets = Manager.InitModuleInfo(modelIndex);

                            List <TableDefineInfo> TableSchemas = new List <TableDefineInfo>();
                            foreach (IndexDescriptionPair pair in Sheets)
                            {
                                TableDefineInfo Info = TableManager.GetTableDefineInfo(pair.Index, pair.DataTable);
                                TableSchemas.Add(Info);
                            }
                            String          extentTable       = "biz_norm_extent_" + modelIndex;
                            TableDefineInfo ExtentTableSchema = TableManager.GetTableDefineInfo("1", extentTable);
                            DataSet         dataset           = DataManager.GetData(TableSchemas, ExtentTableSchema, dataRow["ID"].ToString(), dataRow["scpt"].ToString());

                            DataTable extTable = dataset.Tables["[biz_norm_extent_" + modelIndex + "]"];
                            String    dataID   = extTable.Rows[0]["ID"].ToString();

                            String modelCode = extTable.Rows[0]["SCPT"].ToString();
                            String fName     = extTable.Rows[0]["DataName"].ToString();
                            String fPH       = config.fPH == null ? "" : dataset.Tables[config.fPH.TableName].Rows[0][config.fPH.ColumnName].ToString().Replace("'", "''");
                            String fZJRQ     = config.fZJRQ == null ? "" : dataset.Tables[config.fZJRQ.TableName].Rows[0][config.fZJRQ.ColumnName].ToString();
                            String fSJBH     = config.fSJBH == null ? "" : dataset.Tables[config.fSJBH.TableName].Rows[0][config.fSJBH.ColumnName].ToString().Replace("'", "''");
                            String fSJSize   = config.fSJSize == null ? "" : dataset.Tables[config.fSJSize.TableName].Rows[0][config.fSJSize.ColumnName].ToString();
                            String fAdded    = config.fAdded == null ? "" : dataset.Tables[config.fAdded.TableName].Rows[0][config.fAdded.ColumnName].ToString();
                            String fBGBH     = config.fBGBH == null ? "" : dataset.Tables[config.fBGBH.TableName].Rows[0][config.fBGBH.ColumnName].ToString();
                            String fWTBH     = config.fWTBH == null ? "" : dataset.Tables[config.fWTBH.TableName].Rows[0][config.fWTBH.ColumnName].ToString();

                            String insertSql = String.Format(@"INSERT INTO dbo.sys_biz_reminder_stadiumData
                                        ( DataID ,
                                          Scts ,
                                          ModelCode ,
                                          ModelIndex ,
                                          DateSpan ,
                                          F_Name ,
                                          F_ItemId ,
                                          F_PH ,
                                          F_ZJRQ ,
                                          F_SJBH ,
                                          F_SJSize ,
                                          F_SYXM ,
                                          F_BGBH ,
                                          F_WTBH,
                                          F_Added
                                        )
                                VALUES  ( '{0}' , '{1}' ,'{2}' ,'{3}' ,'{4}' ,'{5}' ,'{6}' ,'{7}' ,
                                          '{8}' , '{9}' , '{10}' , '{11}' , '{12}' , '{13}','{14}' )",
                                                             dataID, DateTime.Now.ToString(), modelCode, modelIndex,
                                                             56, fName, "95", fPH, fZJRQ, fSJBH, fSJSize, "混凝土抗压56天", fBGBH, fWTBH, fAdded);
                            ExcuteCommand(insertSql);
                        }
                    }
                    catch (Exception ex)
                    {
                        logger.Error("SP Old Data Error: " + ex.Message + "; ModelIndex=" + modelIndex + "; DataID=" + dataRow["ID"].ToString());
                    }
                }
            }
        }