Beispiel #1
0
 public static void UpdateConstructAnnualPlanInvest(string PBSUnitCode)
 {
     try
     {
         if (PBSUnitCode != "")
         {
             EntityData pBSUnitByCode = PBSDAO.GetPBSUnitByCode(PBSUnitCode);
             if (pBSUnitByCode.HasRecord())
             {
                 decimal    totalInvest = ConvertRule.ToDecimal(pBSUnitByCode.CurrentRow["PInvest"]);
                 EntityData entity      = ConstructDAO.GetConstructAnnualPlanByPBSUnit(PBSUnitCode);
                 foreach (DataRow row2 in entity.CurrentTable.Rows)
                 {
                     string  visualProgress  = ConvertRule.ToString(row2["VisualProgress"]);
                     int     currFloorCount  = ConvertRule.ToInt(row2["CurrentFloor"]);
                     int     totalFloorCount = PBSRule.GetPBSUnitFloorCount(PBSUnitCode);
                     decimal num4            = CalcInvestByVisualProgress(totalInvest, visualProgress, totalFloorCount, currFloorCount);
                     decimal num5            = ConvertRule.ToDecimal(row2["InvestBefore"]);
                     decimal num6            = num4 - num5;
                     row2["PInvest"] = num6;
                 }
                 ConstructDAO.UpdateConstructAnnualPlan(entity);
                 entity.Dispose();
                 pBSUnitByCode.Dispose();
             }
         }
     }
     catch (Exception exception)
     {
         throw exception;
     }
 }
Beispiel #2
0
        public static decimal CalcPBSUnitCompleteInvest(string PBSUnitCode)
        {
            decimal num5;

            try
            {
                decimal    num  = 0M;
                EntityData data = PBSDAO.GetV_PBSUnitByCode(PBSUnitCode);
                if (data.HasRecord())
                {
                    decimal totalInvest     = data.GetDecimal("PInvest");
                    string  visualProgress  = data.GetString("VisualProgress");
                    int     totalFloorCount = PBSRule.GetPBSUnitFloorCount(PBSUnitCode);
                    int     currFloorCount  = PBSRule.GetPBSUnitCurrentFloorCount(PBSUnitCode);
                    num = CalcInvestByVisualProgress(totalInvest, visualProgress, totalFloorCount, currFloorCount);
                }
                data.Dispose();
                num5 = num;
            }
            catch (Exception exception)
            {
                throw exception;
            }
            return(num5);
        }
Beispiel #3
0
        public static object GetConstructProgressStepFirstKg(string PBSUnitCode)
        {
            object obj3;

            try
            {
                object obj2 = DBNull.Value;
                string visualProgressNotStartInStr           = PBSRule.GetVisualProgressNotStartInStr();
                ConstructProgressStepStrategyBuilder builder = new ConstructProgressStepStrategyBuilder();
                builder.AddStrategy(new Strategy(ConstructProgressStepStrategyName.PBSUnitCode, PBSUnitCode));
                builder.AddStrategy(new Strategy(ConstructProgressStepStrategyName.VisualProgressNotIn, visualProgressNotStartInStr));
                builder.AddStrategy(new Strategy(ConstructProgressStepStrategyName.StartDateNotNull));
                builder.AddOrder("StartDate", true);
                string     queryString = builder.BuildMainQueryString();
                QueryAgent agent       = new QueryAgent();
                agent.SetTopNumber(1);
                EntityData data = agent.FillEntityData("ConstructProgressStep", queryString);
                agent.Dispose();
                if (data.HasRecord())
                {
                    obj2 = data.CurrentRow["StartDate"];
                }
                obj3 = obj2;
            }
            catch (Exception exception)
            {
                throw exception;
            }
            return(obj3);
        }
Beispiel #4
0
        public static EntityData GetConstructProgressReportFirstKg(string PBSUnitCode)
        {
            EntityData data2;

            try
            {
                string visualProgressNotStartInStr       = PBSRule.GetVisualProgressNotStartInStr();
                ConstructProgressStrategyBuilder builder = new ConstructProgressStrategyBuilder();
                builder.AddStrategy(new Strategy(ConstructProgressStrategyName.PBSUnitCode, PBSUnitCode));
                builder.AddStrategy(new Strategy(ConstructProgressStrategyName.VisualProgressNotIn, visualProgressNotStartInStr));
                builder.AddOrder("ReportDate", true);
                builder.AddOrder("ProgressCode", true);
                string     queryString = builder.BuildQueryViewString();
                QueryAgent agent       = new QueryAgent();
                agent.SetTopNumber(1);
                EntityData data = agent.FillEntityData("ConstructProgress", queryString);
                agent.Dispose();
                data2 = data;
            }
            catch (Exception exception)
            {
                throw exception;
            }
            return(data2);
        }
Beispiel #5
0
        public static string GetTaskRelaName(string RelaType, string RelaCode)
        {
            string text4;

            try
            {
                string relaTypeName = "";
                string relaName     = "";
                switch (RelaType.ToUpper())
                {
                case "U":
                    relaTypeName = "单位工程";
                    relaName     = PBSRule.GetPBSUnitName(RelaCode);
                    break;

                case "B":
                    relaTypeName = "楼栋";
                    relaName     = ProductRule.GetBuildingName(RelaCode);
                    break;

                default:
                    relaTypeName = "一般工作项";
                    break;
                }
                text4 = ConcatTaskRelaName(relaTypeName, relaName);
            }
            catch (Exception exception)
            {
                throw exception;
            }
            return(text4);
        }
Beispiel #6
0
        public static DataTable RepRoomIn(string ProjectCode, int JGYear, string BeginDate, string EndDate)
        {
            DataTable table3;

            try
            {
                DataTable table;
                string    format = "";
                if (BeginDate != "")
                {
                    format = format + " and {0} >= convert(DateTime, '" + BeginDate + "', 121)";
                }
                if (EndDate != "")
                {
                    format = format + " and {0} < convert(DateTime, '" + EndDate + "', 121) + 1";
                }
                string     text2 = "select sum(isnull(r.BuildArea, 0))  from TempRoomOut a     , TempRoomStructure b       left join Room r on r.RoomCode = b.TempRoomCode where a.OutListCode = b.OutListCode   and a.CheckState = 1   and a.ProjectCode = '{0}'   and b.TempBuildingCode = '{1}'   and a.out_state = '{2}'";
                string     text3 = "select sum(isnull(r.YuboArea, 0))  from TempRoomOut a     , TempRoomStructure b       left join Building r on r.BuildingCode = b.TempBuildingCode where a.OutListCode = b.OutListCode   and a.CheckState = 1   and a.ProjectCode = '{0}'   and b.TempBuildingCode = '{1}'   and a.out_state = '{2}'";
                QueryAgent agent = new QueryAgent();
                try
                {
                    string queryString = "select a.BuildingCode, a.ProjectCode, a.BuildingName, p.ProjectName, a.Remark, a.YuBoArea, t.PBSTypeName, t.PBSTypeFullName from Building a left join V_PBSType t on t.PBSTypeCode = a.PBSTypeCode, Project p, PBSUnit u where a.ProjectCode = p.ProjectCode and a.PBSUnitCode = u.PBSUnitCode and a.IsArea = 2";
                    if (ProjectCode != "")
                    {
                        string text5 = StrategyConvert.BuildInStr(ProjectCode);
                        queryString = queryString + " and a.ProjectCode in (" + text5 + ")";
                    }
                    string visualProgressJgInStr = PBSRule.GetVisualProgressJgInStr();
                    queryString = queryString + " and u.VisualProgress in (" + visualProgressJgInStr + ")";
                    if (JGYear > 0)
                    {
                        queryString = queryString + " and convert(varchar(4), u.EndDate, 112) = '" + JGYear.ToString() + "'";
                    }
                    queryString = queryString + " order by p.ProjectName, a.BuildingName";
                    table       = agent.ExecSqlForDataSet(queryString).Tables[0];
                    table.Columns.Add("ChamberName", typeof(string));
                    table.Columns.Add("state", typeof(string));
                    table.Columns.Add("BeforeInvArea", typeof(decimal));
                    table.Columns.Add("InArea", typeof(decimal));
                    table.Columns.Add("OutArea", typeof(decimal));
                    table.Columns.Add("BackInArea", typeof(decimal));
                    table.Columns.Add("InvArea", typeof(decimal));
                    foreach (DataRow row in table.Rows)
                    {
                        string text7  = ConvertRule.ToString(row["BuildingCode"]);
                        string text8  = ConvertRule.ToString(row["ProjectCode"]);
                        string text9  = "";
                        string text10 = "";
                        queryString = "select ChamberName from Chamber where BuildingCode = '" + text7 + "' order by ChamberName";
                        DataTable table2 = agent.ExecSqlForDataSet(queryString).Tables[0];
                        foreach (DataRow row2 in table2.Rows)
                        {
                            if (text9.Length > 0)
                            {
                                text9 = text9 + ",";
                            }
                            text9 = text9 + ConvertRule.ToString(row2["ChamberName"]);
                        }
                        row["ChamberName"] = text9;
                        if (text9.Length > 0)
                        {
                            decimal num  = 0M;
                            decimal num2 = 0M;
                            decimal num3 = 0M;
                            if (BeginDate != "")
                            {
                                queryString = string.Format(text2, text8, text7, "入库") + " and a.Out_Date < convert(DateTime, '" + BeginDate + "', 121)";
                                num         = ConvertRule.ToDecimal(agent.ExecuteScalar(queryString));
                                queryString = string.Format(text2, text8, text7, "出库") + " and a.Out_Date < convert(DateTime, '" + BeginDate + "', 121)";
                                num2        = ConvertRule.ToDecimal(agent.ExecuteScalar(queryString));
                                queryString = string.Format(text2, text8, text7, "退库") + " and a.Out_Date < convert(DateTime, '" + BeginDate + "', 121)";
                                num3        = ConvertRule.ToDecimal(agent.ExecuteScalar(queryString));
                            }
                            row["BeforeInvArea"] = (num + num3) - num2;
                            queryString          = string.Format(text2, text8, text7, "入库") + string.Format(format, "a.Out_Date");
                            row["InArea"]        = ConvertRule.ToDecimal(agent.ExecuteScalar(queryString));
                            queryString          = string.Format(text3, text8, text7, "预拨") + string.Format(format, "a.Out_Date");
                            row["YuboArea"]      = ConvertRule.ToDecimal(agent.ExecuteScalar(queryString));
                            queryString          = string.Format(text2, text8, text7, "出库") + string.Format(format, "a.Out_Date");
                            row["OutArea"]       = ConvertRule.ToDecimal(agent.ExecuteScalar(queryString));
                            queryString          = string.Format(text2, text8, text7, "退库") + string.Format(format, "a.Out_Date");
                            row["BackInArea"]    = ConvertRule.ToDecimal(agent.ExecuteScalar(queryString));
                            row["InvArea"]       = ((ConvertRule.ToDecimal(row["BeforeInvArea"]) + ConvertRule.ToDecimal(row["InArea"])) + ConvertRule.ToDecimal(row["BackInArea"])) - ConvertRule.ToDecimal(row["OutArea"]);
                            if (EndDate == "")
                            {
                                queryString = "select top 1 1 from room where BuildingCode = '" + text7 + "' and isnull(InvState, '') not in ('入库', '出库', '退库')";
                            }
                            else
                            {
                                queryString = "select top 1 1 from room r where BuildingCode = '" + text7 + "' and not exists( select a.*   from TempRoomOut a      , TempRoomStructure b  where a.OutListCode = b.OutListCode    and b.TempRoomCode = r.RoomCode    and a.CheckState = 1    and a.out_state in ('入库', '出库', '退库')    and a.Out_Date < convert(DateTime, '" + EndDate + "', 121) + 1)";
                            }
                            if (ConvertRule.ToString(agent.ExecuteScalar(queryString)) == "")
                            {
                                text10 = "入库";
                            }
                            else
                            {
                                text10 = "未入库";
                            }
                        }
                        row["state"] = text10;
                    }
                }
                finally
                {
                    agent.Dispose();
                }
                table3 = table;
            }
            catch (Exception exception)
            {
                throw exception;
            }
            return(table3);
        }