Beispiel #1
0
        private void initdata()
        {
            gridView1.Columns.Clear();

            string con = "ProjectID='" + pid + "'and Typeqf='" + type + "'";
            IList listTypes = Common.Services.BaseService.GetList("SelectPs_Table_TZMXByValue", con);
            DevExpress.XtraGrid.Columns.GridColumn column = new DevExpress.XtraGrid.Columns.GridColumn();
            column = new DevExpress.XtraGrid.Columns.GridColumn();
            column.FieldName = "Title";
            column.Caption = "����";
            column.VisibleIndex = 0;
            column.Width = 180;
            column.OptionsColumn.AllowEdit = false;
            this.gridView1.Columns.AddRange(new DevExpress.XtraGrid.Columns.GridColumn[] {
            column});
            if (type == "pw-line")
            {
                if (listTypes.Count==0)
                {
                    Ps_Table_TZMX pt = new Ps_Table_TZMX();
                    pt.ProjectID = pid;
                    pt.Title = "�ܿ���·";
                    pt.Typeqf = "pw-line";
                    pt.BuildYear = buildyear;
                    pt.BuildEnd = buildend;
                    listTypes.Add(pt);
                    Services.BaseService.Create<Ps_Table_TZMX>(pt);
                    pt = new Ps_Table_TZMX();
                    pt.ProjectID = pid;
                    pt.Title = "������·";
                    pt.Typeqf = "pw-line";
                    pt.BuildYear = buildyear;
                    pt.BuildEnd = buildend;
                    listTypes.Add(pt);
                    Services.BaseService.Create<Ps_Table_TZMX>(pt);
                }
                //column = new DevExpress.XtraGrid.Columns.GridColumn();
                //column.FieldName = "Vol";
                //column.Caption = "��̬Ͷ��"+buildend.ToString()+"��";
                //column.VisibleIndex = 1;
                //column.Width = 180;

                //column.OptionsColumn.AllowEdit = false;
            //    this.gridView1.Columns.AddRange(new DevExpress.XtraGrid.Columns.GridColumn[] {
            //column});
            }
            else if (type == "pw-pb")
            {
                if (listTypes.Count == 0)
                {
                    Ps_Table_TZMX pt = new Ps_Table_TZMX();
                    pt.ProjectID = pid;
                    pt.Title = "�����";
                    pt.Typeqf = "pw-pb";
                    pt.BuildYear = buildyear;
                    pt.BuildEnd = buildend;
                    listTypes.Add(pt);
                    Services.BaseService.Create<Ps_Table_TZMX>(pt);
                    pt = new Ps_Table_TZMX();
                    pt.ProjectID = pid;
                    pt.Title = "��ʽ���վ";
                    pt.Typeqf = "pw-pb";
                    pt.BuildYear = buildyear;
                    pt.BuildEnd = buildend;
                    listTypes.Add(pt);
                    Services.BaseService.Create<Ps_Table_TZMX>(pt);
                    pt = new Ps_Table_TZMX();
                    pt.ProjectID = pid;
                    pt.Title = "��������ѹ��";
                    pt.Typeqf = "pw-pb";
                    pt.BuildYear = buildyear;
                    pt.BuildEnd = buildend;
                    listTypes.Add(pt);
                    Services.BaseService.Create<Ps_Table_TZMX>(pt);
                }

            }
            else if (type == "pw-kg")
            {

                if (listTypes.Count == 0)
                {
                    Ps_Table_TZMX pt = new Ps_Table_TZMX();
                    pt.ProjectID = pid;
                    pt.Title = "������";
                    pt.Typeqf = "pw-kg";
                    pt.BuildYear = buildyear;
                    pt.BuildEnd = buildend;
                    listTypes.Add(pt);
                    Services.BaseService.Create<Ps_Table_TZMX>(pt);
                    pt = new Ps_Table_TZMX();
                    pt.ProjectID = pid;
                    pt.Title = "������";
                    pt.Typeqf = "pw-kg";
                    pt.BuildYear = buildyear;
                    pt.BuildEnd = buildend;
                    listTypes.Add(pt);
                    Services.BaseService.Create<Ps_Table_TZMX>(pt);
                    pt = new Ps_Table_TZMX();
                    pt.ProjectID = pid;
                    pt.Title = "���Ͽ���";
                    pt.Typeqf = "pw-kg";
                    pt.BuildYear = buildyear;
                    pt.BuildEnd = buildend;
                    listTypes.Add(pt);
                    Services.BaseService.Create<Ps_Table_TZMX>(pt);
                    pt = new Ps_Table_TZMX();
                    pt.ProjectID = pid;
                    pt.Title = "���·�֧��";
                    pt.Typeqf = "pw-kg";
                    pt.BuildYear = buildyear;
                    pt.BuildEnd = buildend;
                    listTypes.Add(pt);
                    Services.BaseService.Create<Ps_Table_TZMX>(pt);
                }
            }
            int firyear = Convert.ToInt32(buildyear);
            int endyear = Convert.ToInt32(buildend);
            for (int i = firyear; i <= endyear; i++)
            {
                AddColumn(i);
            }
            column = new DevExpress.XtraGrid.Columns.GridColumn();
            column.FieldName = "LendRate";
            column.Caption = "�����ڴ�����Ϣ";
            column.VisibleIndex = 2 + endyear - firyear+1;
            column.Width = 180;
            //column.OptionsColumn.AllowEdit = false;
            this.gridView1.Columns.AddRange(new DevExpress.XtraGrid.Columns.GridColumn[] {
            column});
            column = new DevExpress.XtraGrid.Columns.GridColumn();
            column.FieldName = "PrepChange";
            column.Caption = "Ԥ������";
            column.VisibleIndex = 3+endyear - firyear + 1;
            column.Width = 180;
            //column.OptionsColumn.AllowEdit = false;
            this.gridView1.Columns.AddRange(new DevExpress.XtraGrid.Columns.GridColumn[] {
            column});
            column = new DevExpress.XtraGrid.Columns.GridColumn();
            column.FieldName = "DynInvest";
            column.Caption = "��̬Ͷ��";
            column.VisibleIndex = 4 + endyear - firyear + 1;
            column.Width = 180;
            //column.OptionsColumn.AllowEdit = false;
            this.gridView1.Columns.AddRange(new DevExpress.XtraGrid.Columns.GridColumn[] {
            column});
            this.gridControl1.DataSource = listTypes;
        }
Beispiel #2
0
 /// <summary>
 /// 返回单位工程综合造价
 /// </summary>
 /// <param name="pTT1"></param>
 /// <returns></returns>
 private double ReturnAmount(Ps_Table_TZMX pTT1, Ps_Table_TZGS pTT,string Typeqf)
 {
     string strTemp = null;
     int beginYear = 0;
     int EndYear = 0;
     int.TryParse(pTT1.BuildYear, out beginYear);
     int.TryParse(pTT1.BuildEnd, out EndYear);
     strTemp = null;
     for (int k = beginYear; k <= EndYear; ++k)
     {
         if (k == EndYear)
             strTemp += "y" + k;
         else
             strTemp += "y" + k + "+";
     }
     return  SelectAmount(strTemp, pTT.ID, "sub");
 }
Beispiel #3
0
        /// <summary>
        /// 写入高压数据
        /// </summary>
        /// <param name="obj"></param>
        /// <param name="IntRow"></param>
        /// <param name="IntCol"></param>
        private void WriteHeightData(Itop.Client.Base.FormBase FB, FarPoint.Win.Spread.SheetView obj, int IntRow, int IntCol)
        {
            int RowTemp = IntRow;
            double Amount = 0;
            IList list = null;
            Ps_Table_TZGS pTT = new Ps_Table_TZGS();
            Ps_Table_TZMX pTT1 = new Ps_Table_TZMX();
            //IList list = null;
            //list = SelectVoltageClass(FB, "新建");
            for (int i = 0; i < HP.INew.Count; i++)
            {
                pTT = (Ps_Table_TZGS)HP.INew[i];
                PF.CreateSheetView(obj, HP.INewVolume[i].Count, 1, RowTemp, 2, pTT.BianInfo);//新建
                list = HP.INewVolume[i];
                for (int j = 0; j < list.Count; ++j)
                {
                    pTT1 = (Ps_Table_TZMX)list[j];
                    PF.CreateSheetView(obj, 1, 1, (RowTemp + j), 3, pTT1.Vol.ToString() + unit);//新建
                    Amount = ReturnAmount(pTT1, pTT, "sub");
                    obj.SetValue(RowTemp, 4, Amount);//单位工程综合造价
                    obj.SetValue(RowTemp,5,strUnit+unit);//单位
                    obj.SetValue(RowTemp, 6, pTT.Col1);//备注
                }
                if (HP.INewVolume[i].Count == 0)
                {
                    RowTemp += 1;
                }
                else
                {
                    RowTemp += HP.INewVolume[i].Count;
                }
            }
            //list = SelectVoltageClass(FB, "扩建");
            for (int i = 0; i < HP.IExtends.Count; i ++)
            {
                pTT = (Ps_Table_TZGS)HP.IExtends[i];
                PF.CreateSheetView(obj, HP.IExtendsVolume[i].Count, 1, RowTemp , 2, pTT.BianInfo);//扩建
                list = HP.IExtendsVolume[i];
                for (int j = 0; j < list.Count; ++j)
                {
                    pTT1 = (Ps_Table_TZMX)list[j];
                    PF.CreateSheetView(obj, 1, 1, (RowTemp + j), 3, pTT1.Vol.ToString() + unit);//扩建

                    Amount = ReturnAmount(pTT1, pTT, "sub");
                    obj.SetValue(RowTemp, 4, Amount);//单位工程综合造价
                    obj.SetValue(RowTemp, 5, strUnit + unit);//单位
                    obj.SetValue(RowTemp, 6, pTT.Col1);//备注
                }
                if (HP.IExtendsVolume[i].Count==0)
                {
                    RowTemp += 1;
                }
                else
                {
                    RowTemp += HP.IExtendsVolume[i].Count;
                }
            }
            //list = SelectVoltageClass(FB, "改造");
            for (int i = 0; i < HP.IRebuild.Count; i ++)
            {
                pTT = (Ps_Table_TZGS)HP.IRebuild[i];
                PF.CreateSheetView(obj, HP.IRebuildVolume[i].Count, 1, RowTemp , 2, pTT.BianInfo);//改造
                list = HP.IRebuildVolume[i];
                for (int j = 0; j < list.Count; ++j)
                {
                    pTT1 = (Ps_Table_TZMX)list[j];
                    PF.CreateSheetView(obj, 1, 1, (RowTemp + j), 3, pTT1.Vol.ToString() + unit);//改造

                    Amount = ReturnAmount(pTT1, pTT, "sub");
                    obj.SetValue(RowTemp, 4, Amount);//单位工程综合造价
                    obj.SetValue(RowTemp, 5, strUnit + unit);//单位
                    obj.SetValue(RowTemp, 6, pTT.Col1);//备注
                }
                if (HP.IRebuildVolume[i].Count==0)
                {
                    RowTemp += 1;
                }
                else
                {
                    RowTemp += HP.IRebuildVolume[i].Count;
                }
            }
            //架空线路
            for(int i=0;i<HP.INew.Count;++i)
            {
                pTT = (Ps_Table_TZGS)HP.INew[i];
                ////if (HP.Length[i].Count == 0 || HP.Length[i] == null)
                ////{
                ////    intTemp = 1;
                ////}
                ////else
                ////{
                ////    intTemp = HP.Length[i].Count;
                ////}

                PF.CreateSheetView(obj, 1, 1, RowTemp +i, 2, pTT.BianInfo);//新建架空电压等级
                PF.CreateSheetView(obj, 1, 1, RowTemp+i, 3, pTT.Length.ToString());//新建架空线路
                list = HP.Length[i];
                for (int j = 0; j < list.Count;++j )
                {
                    pTT1 = (Ps_Table_TZMX)list[j];
                    Amount = ReturnAmount(pTT1, pTT, "line");
                    obj.SetValue(RowTemp + i, 4, Amount);//单位工程综合造价
                    obj.SetValue(RowTemp, 5, strUnit + strUnit1);//单位
                    obj.SetValue(RowTemp, 6, pTT.Col1);//备注
                }

            }
            RowTemp += HP.INew.Count;
            //新建电缆线路
            for(int i=0;i<HP.INew.Count;++i)
            {
                pTT = (Ps_Table_TZGS)HP.INew[i];
                ////if (HP.Length[i].Count == 0 || HP.Length[i] == null)
                ////{
                ////    intTemp = 1;
                ////}
                ////else
                ////{
                ////    intTemp = HP.Length[i].Count;
                ////}
                PF.CreateSheetView(obj, 1, 1, RowTemp+i , 2, pTT.BianInfo);//新建电缆电压等级
                PF.CreateSheetView(obj, 1, 1, RowTemp+i, 3, pTT.Length2.ToString());//新建电缆线路
                list = HP.Length[i];
                for (int j = 0; j < list.Count; ++j)
                {
                    pTT1 = (Ps_Table_TZMX)list[j];

                    Amount = ReturnAmount(pTT1, pTT, "line");

                    obj.SetValue(RowTemp + i, 4, Amount);//单位工程综合造价
                    obj.SetValue(RowTemp, 5, strUnit + strUnit1);//单位
                    obj.SetValue(RowTemp, 6, pTT.Col1);//备注
                }
            }
            RowTemp += HP.INew.Count;
        }
Beispiel #4
0
        private void barButtonItem1_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            if (devicenum>gridView1.RowCount||devicenum==0)
            {
                Ps_Table_TZMX px = new Ps_Table_TZMX();
                FormTZGSXXdialog fd = new FormTZGSXXdialog();

                fd.type = type;
                fd.volt = volt;
                fd.buildyear =Convert.ToInt32(buildyear);
                fd.buildend =Convert.ToInt32(buildend) ;
                fd.tzmx = px;
                fd.ShowDialog();
                if (fd.DialogResult==DialogResult.OK)
                {
                    Ps_Table_TZMX pt = fd.tzmx;
                    pt.ProjectID = pid;
                    pt.Typeqf = type;
                    pt.BuildYear = buildyear;
                    pt.BuildEnd = buildend;
                    Services.BaseService.Create<Ps_Table_TZMX>(pt);
                }
                initdata();
            }
            else
            {
                MessageBox.Show("���վ����Ŀ�Ѿ��ﵽ!");
                return;
            }
        }