Browse Source

BillsGather -- DetailGcl: Locate Bills in Measure

MaiXinRong 8 years ago
parent
commit
568214b63b

+ 2 - 1
Forms/BatchInsertBillsFrm.dfm

@@ -100,7 +100,7 @@ object BatchInsertBillsForm: TBatchInsertBillsForm
           Width = 474
           Width = 474
           Height = 166
           Height = 166
           OptionsEx = []
           OptionsEx = []
-          ColCount = 8
+          ColCount = 9
           ShowGridLine = False
           ShowGridLine = False
           DefaultColWidth = 50
           DefaultColWidth = 50
           DefaultFixedColWidth = 25
           DefaultFixedColWidth = 25
@@ -215,6 +215,7 @@ object BatchInsertBillsForm: TBatchInsertBillsForm
           LabelPosition = lpLeft
           LabelPosition = lpLeft
           MaxLength = 255
           MaxLength = 255
           TabOrder = 1
           TabOrder = 1
+          Visible = False
         end
         end
         object udBeginCode: TUpDown
         object udBeginCode: TUpDown
           Left = 137
           Left = 137

+ 47 - 32
Forms/BatchInsertBillsFrm.pas

@@ -84,6 +84,17 @@ uses
 
 
 {$R *.dfm}
 {$R *.dfm}
 
 
+const
+  iBwNameCol = 1;
+  iBwDrawingCodeCol = 2;
+  iBwBillsQtyCol = 3;
+
+  iGclCodeCol = 1;
+  iGclNameCol = 2;
+  iGclUnitsCol = 3;
+  iGclPriceCol = 4;
+  iGclDrawingCodeCol = 5;
+
 procedure AddLeafBills(ABillsCompileData: TBillsCompileData; AInsertType: TInsertType);
 procedure AddLeafBills(ABillsCompileData: TBillsCompileData; AInsertType: TInsertType);
 var
 var
   InsertBillsForm: TBatchInsertBillsForm;
   InsertBillsForm: TBatchInsertBillsForm;
@@ -110,8 +121,8 @@ begin
   with stnNode.Rec do
   with stnNode.Rec do
   begin
   begin
     ValueByName('Code').AsString := GetXmjCode(ARow);{ReplaceLastNum(leBeginCode.Text, ARow);}
     ValueByName('Code').AsString := GetXmjCode(ARow);{ReplaceLastNum(leBeginCode.Text, ARow);}
-    ValueByName('Name').AsString := zgPosition.Cells[1, ARow].Text;
-    ValueByName('DrawingCode').AsString := leDrawingCode.Text;
+    ValueByName('Name').AsString := zgPosition.Cells[iBwNameCol, ARow].Text;
+    ValueByName('DrawingCode').AsString := zgPosition.Cells[iBwDrawingCodeCol, ARow].Text;
   end;
   end;
 
 
   AddBillsNodes(ARow, stnNode);
   AddBillsNodes(ARow, stnNode);
@@ -193,13 +204,16 @@ end;
 
 
 procedure TBatchInsertBillsForm.ResetPositionGridHead;
 procedure TBatchInsertBillsForm.ResetPositionGridHead;
 var
 var
-  iCol: Integer;
+  iCol, iColDiff: Integer;
 begin
 begin
-  zgPosition.Cells[1, 0].Text := '窒弇';
-  zgPosition.ColWidths[1] := 120;
-  for iCol := 2 to zgPosition.ColCount - 1 do
+  zgPosition.Cells[iBwNameCol, 0].Text := '窒弇';
+  zgPosition.ColWidths[iBwNameCol] := 100;
+  zgPosition.Cells[iBwDrawingCodeCol, 0].Text := '芞(聊)瘍';
+  zgPosition.ColWidths[iBwDrawingCodeCol] := 100;
+  iColDiff := iBwBillsQtyCol - 1;
+  for iCol := iBwBillsQtyCol to zgPosition.ColCount - 1 do
   begin
   begin
-    zgPosition.Cells[iCol, 0].Text := 'ラ等' + IntToStr(iCol - 1);
+    zgPosition.Cells[iCol, 0].Text := 'ラ等' + IntToStr(iCol - iColDiff);
     zgPosition.ColWidths[iCol] := 50;
     zgPosition.ColWidths[iCol] := 50;
   end;
   end;
 end;
 end;
@@ -247,17 +261,17 @@ var
 begin
 begin
   if (zgBills.Cells[1, ARow].Text = '') or
   if (zgBills.Cells[1, ARow].Text = '') or
      (zgPosition.Cells[ARow + 1, AQtyRow].Text = '') or
      (zgPosition.Cells[ARow + 1, AQtyRow].Text = '') or
-     not TryStrToFloat(zgPosition.Cells[ARow + 1, AQtyRow].Text, fQuantity) then Exit;
+     not TryStrToFloat(zgPosition.Cells[ARow + iBwBillsQtyCol - 1, AQtyRow].Text, fQuantity) then Exit;
 
 
   stnNode := FBillsCompileData.BillsCompileTree.Add(AParent.ID, -1);
   stnNode := FBillsCompileData.BillsCompileTree.Add(AParent.ID, -1);
   with stnNode.Rec do
   with stnNode.Rec do
   begin
   begin
-    ValueByName('B_Code').AsString := zgBills.Cells[1, ARow].Text;
-    ValueByName('Name').AsString := zgBills.Cells[2, ARow].Text;
-    ValueByName('Units').AsString := zgBills.Cells[3, ARow].Text;
-    ValueByName('Price').AsFloat := StrToFloatDef(zgBills.Cells[4, ARow].Text, 0);
-    ValueByName('OrgQuantity').AsFloat := StrToFloatDef(zgPosition.Cells[ARow + 1, AQtyRow].Text, 0);
-    ValueByName('DrawingCode').AsString := zgBills.Cells[5, ARow].Text;
+    ValueByName('B_Code').AsString := zgBills.Cells[iGclCodeCol, ARow].Text;
+    ValueByName('Name').AsString := zgBills.Cells[iGclNameCol, ARow].Text;
+    ValueByName('Units').AsString := zgBills.Cells[iGclUnitsCol, ARow].Text;
+    ValueByName('Price').AsFloat := StrToFloatDef(zgBills.Cells[iGclPriceCol, ARow].Text, 0);
+    ValueByName('OrgQuantity').AsFloat := StrToFloatDef(zgPosition.Cells[ARow + iBwBillsQtyCol - 1, AQtyRow].Text, 0);
+    ValueByName('DrawingCode').AsString := zgBills.Cells[iGclDrawingCodeCol, ARow].Text;
   end;
   end;
 end;
 end;
 
 
@@ -265,15 +279,15 @@ procedure TBatchInsertBillsForm.ResetBillsGridHead;
 var
 var
   iRow: Integer;
   iRow: Integer;
 begin
 begin
-  zgBills.Cells[1, 0].Text := '晤瘍';
+  zgBills.Cells[iGclCodeCol, 0].Text := '晤瘍';
   zgBills.ColWidths[1] := 80;
   zgBills.ColWidths[1] := 80;
-  zgBills.Cells[2, 0].Text := '靡備';
+  zgBills.Cells[iGclNameCol, 0].Text := '靡備';
   zgBills.ColWidths[2] := 120;
   zgBills.ColWidths[2] := 120;
-  zgBills.Cells[3, 0].Text := '等弇';
+  zgBills.Cells[iGclUnitsCol, 0].Text := '等弇';
   zgBills.ColWidths[3] := 60;
   zgBills.ColWidths[3] := 60;
-  zgBills.Cells[4, 0].Text := '等歎';
+  zgBills.Cells[iGclPriceCol, 0].Text := '等歎';
   zgBills.ColWidths[4] := 60;
   zgBills.ColWidths[4] := 60;
-  zgBills.Cells[5, 0].Text := '芞(聊)瘍';
+  zgBills.Cells[iGclDrawingCodeCol, 0].Text := '芞(聊)瘍';
   zgBills.ColWidths[5] := 60;
   zgBills.ColWidths[5] := 60;
   for iRow := 1 to zgBills.RowCount - 1 do
   for iRow := 1 to zgBills.RowCount - 1 do
     zgBills.Cells[0, iRow].Text := 'ラ等' + IntToStr(iRow);
     zgBills.Cells[0, iRow].Text := 'ラ等' + IntToStr(iRow);
@@ -345,23 +359,23 @@ begin
       Rec := sddBills.Locate('B_Code', sB_Code);
       Rec := sddBills.Locate('B_Code', sB_Code);
     if Assigned(Rec) then
     if Assigned(Rec) then
     begin
     begin
-      zgBills.Cells[2, Row].Text := Rec.ValueByName('Name').AsString;
-      zgBills.Cells[2, Row].Align := gaCenterLeft;
-      zgBills.Cells[3, Row].Text := Rec.ValueByName('Units').AsString;
-      zgBills.Cells[3, Row].Align := gaCenterCenter;
-      zgBills.Cells[3, Row].Font.Name := 'smartSimSun';
-      zgBills.Cells[4, Row].Text := Rec.ValueByName('Price').AsString;
-      zgBills.Cells[4, Row].Align := gaCenterRight;
-      zgBills.Cells[5, Row].Align := gaCenterLeft;
+      zgBills.Cells[iGclNameCol, Row].Text := Rec.ValueByName('Name').AsString;
+      zgBills.Cells[iGclNameCol, Row].Align := gaCenterLeft;
+      zgBills.Cells[iGclUnitsCol, Row].Text := Rec.ValueByName('Units').AsString;
+      zgBills.Cells[iGclUnitsCol, Row].Align := gaCenterCenter;
+      zgBills.Cells[iGclPriceCol, Row].Font.Name := 'smartSimSun';
+      zgBills.Cells[iGclPriceCol, Row].Text := Rec.ValueByName('Price').AsString;
+      zgBills.Cells[iGclPriceCol, Row].Align := gaCenterRight;
+      zgBills.Cells[iGclDrawingCodeCol, Row].Align := gaCenterLeft;
     end;
     end;
   end
   end
-  else if (Col = 4) and (Row > 0) then
+  else if (Col = iGclPriceCol) and (Row > 0) then
   begin
   begin
     zgBills.Cells[Col, Row].Value := PriceRoundTo(
     zgBills.Cells[Col, Row].Value := PriceRoundTo(
         StrToFloatDef(zgBills.Cells[Col, Row].Text, 0));
         StrToFloatDef(zgBills.Cells[Col, Row].Text, 0));
     zgBills.Cells[Col, Row].Align := gaCenterRight;
     zgBills.Cells[Col, Row].Align := gaCenterRight;
   end
   end
-  else if (Col = 5) and (Row > 0) then
+  else if (Col = iGclDrawingCodeCol) and (Row > 0) then
     zgBills.Cells[Col, Row].Align := gaCenterLeft;
     zgBills.Cells[Col, Row].Align := gaCenterLeft;
 end;
 end;
 
 
@@ -405,7 +419,7 @@ procedure TBatchInsertBillsForm.zgPositionCellTextChanged(Sender: TObject;
 var
 var
   value: Double;
   value: Double;
 begin
 begin
-  if (Col > 1) and (Row > 0) then
+  if (Col >= iBwBillsQtyCol) and (Row > 0) then
   begin
   begin
     if (TryStrToFloat(zgPosition.Cells[Col, Row].Text, value)) then
     if (TryStrToFloat(zgPosition.Cells[Col, Row].Text, value)) then
     begin
     begin
@@ -425,9 +439,10 @@ end;
 procedure TBatchInsertBillsForm.actnInsertColExecute(Sender: TObject);
 procedure TBatchInsertBillsForm.actnInsertColExecute(Sender: TObject);
 begin
 begin
   zgPosition.ColCount := zgPosition.ColCount + 1;
   zgPosition.ColCount := zgPosition.ColCount + 1;
-  zgPosition.Cells[zgPosition.ColCount-1, 0].Text := 'ラ等' + IntToStr(zgPosition.ColCount -1 - 1);
+  zgPosition.Cells[zgPosition.ColCount-1, 0].Text := 'ラ等' + IntToStr(zgPosition.ColCount - iBwBillsQtyCol);
   zgPosition.ColWidths[zgPosition.ColCount-1] := 50;
   zgPosition.ColWidths[zgPosition.ColCount-1] := 50;
-  zgBills.RowCount := zgPosition.ColCount - 1;
+
+  zgBills.RowCount := zgPosition.ColCount - (iBwBillsQtyCol - 1);
   zgBills.Cells[0, zgBills.RowCount-1].Text := 'ラ等' + IntToStr(zgBills.RowCount-1);
   zgBills.Cells[0, zgBills.RowCount-1].Text := 'ラ等' + IntToStr(zgBills.RowCount-1);
 end;
 end;
 
 

+ 6 - 0
Forms/MainFrm.dfm

@@ -1095,6 +1095,12 @@ object MainForm: TMainForm
       Visible = ivAlways
       Visible = ivAlways
       OnClick = dxbtnHelpCenterClick
       OnClick = dxbtnHelpCenterClick
     end
     end
+    object dxbtnLocateMeasureBills: TdxBarButton
+      Caption = #23450#20301#33267#35745#37327#21488#36134
+      Category = 0
+      Hint = #23450#20301#33267#35745#37327#21488#36134
+      Visible = ivAlways
+    end
   end
   end
   object Images: TImageList
   object Images: TImageList
     DrawingStyle = dsTransparent
     DrawingStyle = dsTransparent

+ 1 - 0
Forms/MainFrm.pas

@@ -163,6 +163,7 @@ type
     dxbtnSignOnline: TdxBarButton;
     dxbtnSignOnline: TdxBarButton;
     dxbtnExportTpExcel: TdxBarButton;
     dxbtnExportTpExcel: TdxBarButton;
     dxbtnHelpCenter: TdxBarButton;
     dxbtnHelpCenter: TdxBarButton;
+    dxbtnLocateMeasureBills: TdxBarButton;
     procedure FormCreate(Sender: TObject);
     procedure FormCreate(Sender: TObject);
     procedure FormDestroy(Sender: TObject);
     procedure FormDestroy(Sender: TObject);
     procedure jtsProjectsChange(Sender: TObject; NewTab: Integer;
     procedure jtsProjectsChange(Sender: TObject; NewTab: Integer;

+ 22 - 0
Frames/BillsGatherFme.dfm

@@ -138,6 +138,7 @@ object BillsGatherFrame: TBillsGatherFrame
           Selection.TransparentColor = False
           Selection.TransparentColor = False
           FrozenCol = 0
           FrozenCol = 0
           FrozenRow = 0
           FrozenRow = 0
+          OnMouseDown = zgDetailGclMouseDown
           Align = alClient
           Align = alClient
         end
         end
       end
       end
@@ -1236,4 +1237,25 @@ object BillsGatherFrame: TBillsGatherFrame
     Left = 224
     Left = 224
     Top = 104
     Top = 104
   end
   end
+  object dxpmDetailGcl: TdxBarPopupMenu
+    BarManager = MainForm.dxBarManager
+    ItemLinks = <
+      item
+        Item = MainForm.dxbtnLocateMeasureBills
+        Visible = True
+      end>
+    UseOwnFont = False
+    OnPopup = dxpmDetailGclPopup
+    Left = 160
+    Top = 496
+  end
+  object alBillsGather: TActionList
+    Left = 288
+    Top = 104
+    object actnLocateMeasureBills: TAction
+      Caption = #23450#20301#33267#35745#37327#21488#36134
+      OnExecute = actnLocateMeasureBillsExecute
+      OnUpdate = actnLocateMeasureBillsUpdate
+    end
+  end
 end
 end

+ 39 - 2
Frames/BillsGatherFme.pas

@@ -6,9 +6,11 @@ uses
   BillsGatherDm, Globals, sdDB,
   BillsGatherDm, Globals, sdDB,
   Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, 
   Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, 
   Dialogs, ZJGrid, ExtCtrls, ZjGridDBA, ZjGridTreeDBA, ComCtrls, ToolWin,
   Dialogs, ZJGrid, ExtCtrls, ZjGridDBA, ZjGridTreeDBA, ComCtrls, ToolWin,
-  XPMenu, sdGridDBA, JimPages;
+  XPMenu, sdGridDBA, JimPages, dxBar, ActnList;
 
 
 type
 type
+  TLocateBillsEvent = procedure (AID: Integer) of object;
+
   TBillsGatherFrame = class(TFrame)
   TBillsGatherFrame = class(TFrame)
     pnlBillsGather: TPanel;
     pnlBillsGather: TPanel;
     zgGclBills: TZJGrid;
     zgGclBills: TZJGrid;
@@ -31,13 +33,22 @@ type
     zgDetailBGL: TZJGrid;
     zgDetailBGL: TZJGrid;
     zgDetailDeal: TZJGrid;
     zgDetailDeal: TZJGrid;
     saGclBills: TsdGridDBA;
     saGclBills: TsdGridDBA;
+    dxpmDetailGcl: TdxBarPopupMenu;
+    alBillsGather: TActionList;
+    actnLocateMeasureBills: TAction;
     procedure zgGclBillsCellGetColor(Sender: TObject; ACoord: TPoint;
     procedure zgGclBillsCellGetColor(Sender: TObject; ACoord: TPoint;
       var AColor: TColor);
       var AColor: TColor);
     procedure tobtnDetailGclClick(Sender: TObject);
     procedure tobtnDetailGclClick(Sender: TObject);
+    procedure dxpmDetailGclPopup(Sender: TObject);
+    procedure actnLocateMeasureBillsExecute(Sender: TObject);
+    procedure actnLocateMeasureBillsUpdate(Sender: TObject);
+    procedure zgDetailGclMouseDown(Sender: TObject; Button: TMouseButton;
+      Shift: TShiftState; X, Y: Integer);
   private
   private
     FBillsGatherData: TBillsGatherData;
     FBillsGatherData: TBillsGatherData;
     FShowPhaseData: Boolean;
     FShowPhaseData: Boolean;
     FShowPriceChange: Boolean;
     FShowPriceChange: Boolean;
+    FOnLocateMeasureBills: TLocateBillsEvent;
 
 
     procedure SetColumnVisible(const AColumn: string; AVisible: Boolean);
     procedure SetColumnVisible(const AColumn: string; AVisible: Boolean);
 
 
@@ -51,12 +62,14 @@ type
 
 
     property ShowPriceChange: Boolean read FShowPriceChange write SetShowPriceChange;
     property ShowPriceChange: Boolean read FShowPriceChange write SetShowPriceChange;
     property ShowPhaseData: Boolean read FShowPhaseData write SetShowPhaseData;
     property ShowPhaseData: Boolean read FShowPhaseData write SetShowPhaseData;
+
+    property OnLocateMeasureBills: TLocateBillsEvent read FOnLocateMeasureBills write FOnLocateMeasureBills;
   end;
   end;
 
 
 implementation
 implementation
 
 
 uses
 uses
-  ProjectData, UtilMethods, CalcDecimal;
+  ProjectData, UtilMethods, CalcDecimal, MainFrm;
 
 
 {$R *.dfm}
 {$R *.dfm}
 
 
@@ -188,4 +201,28 @@ begin
   tobtnDetailBGL.Down := tobtnDetailBGL.Tag = TToolButton(Sender).Tag;
   tobtnDetailBGL.Down := tobtnDetailBGL.Tag = TToolButton(Sender).Tag;
 end;
 end;
 
 
+procedure TBillsGatherFrame.dxpmDetailGclPopup(Sender: TObject);
+begin
+  SetDxBtnAction(actnLocateMeasureBills, MainForm.dxbtnLocateMeasureBills);
+end;
+
+procedure TBillsGatherFrame.actnLocateMeasureBillsExecute(Sender: TObject);
+begin
+  if Assigned(saDetailGcl.DataView.Current) and Assigned(FOnLocateMeasureBills) then
+    FOnLocateMeasureBills(saDetailGcl.DataView.Current.ValueByName('RelaBillsID').AsInteger);
+end;
+
+procedure TBillsGatherFrame.actnLocateMeasureBillsUpdate(Sender: TObject);
+begin
+  TAction(Sender).Enabled := Assigned(saDetailGcl.DataView.Current) and Assigned(FOnLocateMeasureBills);
+end;
+
+procedure TBillsGatherFrame.zgDetailGclMouseDown(Sender: TObject;
+  Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
+begin
+  if Button = mbRight then
+    dxpmDetailGcl.PopupFromCursorPos;
+end;
+
 end.
 end.
+

+ 114 - 2
Frames/ProjectFme.pas

@@ -136,6 +136,11 @@ type
     // 刷新各界面只读、显示等
     // 刷新各界面只读、显示等
     procedure RefreshProjectState;
     procedure RefreshProjectState;
 
 
+    // Change Main View
+    procedure BeforeChangeView(APageIndex: Integer);
+    procedure AfterChangeView(APageIndex: Integer);
+    procedure ChangeView(APageIndex: Integer);
+
     procedure AdjustFramesDisplay;
     procedure AdjustFramesDisplay;
 
 
     procedure SaveLog(AStr: string);
     procedure SaveLog(AStr: string);
@@ -178,6 +183,8 @@ type
     procedure RepairAudits;
     procedure RepairAudits;
     function CheckFileAndCloudChekerList: Boolean;
     function CheckFileAndCloudChekerList: Boolean;
 
 
+    procedure LocateMeasureBills(AID: Integer);
+
     property ProjectData: TProjectData read FProjectData;
     property ProjectData: TProjectData read FProjectData;
 
 
     property BillsCompileFrame: TBillsCompileFrame read FBillsCompileFrame;
     property BillsCompileFrame: TBillsCompileFrame read FBillsCompileFrame;
@@ -536,6 +543,7 @@ procedure TProjectFrame.dxsbViewControlItemClick(Sender: TObject;
     end;
     end;
   end;
   end;
 
 
+  (*
   procedure ChangeView;
   procedure ChangeView;
   begin
   begin
     BeforeChangeView;
     BeforeChangeView;
@@ -545,6 +553,7 @@ procedure TProjectFrame.dxsbViewControlItemClick(Sender: TObject;
     end;
     end;
     AfterChangeView;
     AfterChangeView;
   end;
   end;
+  *)
 
 
   procedure DisplayReports;
   procedure DisplayReports;
   begin
   begin
@@ -598,7 +607,7 @@ procedure TProjectFrame.dxsbViewControlItemClick(Sender: TObject;
       dxsbViewControl.SelectedItem := dxsbViewControl.ActiveGroup.Items[jpsMain.ActivePageIndex];
       dxsbViewControl.SelectedItem := dxsbViewControl.ActiveGroup.Items[jpsMain.ActivePageIndex];
       Abort;
       Abort;
     end;
     end;
-    ChangeView;
+    ChangeView(Item.Tag);
   end;
   end;
 
 
 var
 var
@@ -609,7 +618,7 @@ begin
   bCloseCompare := (Item.Tag in [0..3, 5]) and (jpsMain.ActivePageIndex = 4);
   bCloseCompare := (Item.Tag in [0..3, 5]) and (jpsMain.ActivePageIndex = 4);
 
 
   case Item.Tag of
   case Item.Tag of
-    0..2, 5: ChangeView;
+    0..2, 5: ChangeView(Item.Tag);
     3: DisplayPriceMargin;
     3: DisplayPriceMargin;
     4: DisplayCompare;
     4: DisplayCompare;
     6: DisplayReports;
     6: DisplayReports;
@@ -649,6 +658,7 @@ begin
   AlignControl(FBillsGatherFrame, jpsMainBillsGather, alClient);
   AlignControl(FBillsGatherFrame, jpsMainBillsGather, alClient);
   FBillsGatherFrame.ShowPriceChange := FProjectData.ProjProperties.ShowPriceChange;
   FBillsGatherFrame.ShowPriceChange := FProjectData.ProjProperties.ShowPriceChange;
   FBillsGatherFrame.ShowPhaseData := FProjectData.ProjProperties.PhaseCount > 0;
   FBillsGatherFrame.ShowPhaseData := FProjectData.ProjProperties.PhaseCount > 0;
+  FBillsGatherFrame.OnLocateMeasureBills := LocateMeasureBills;
 end;
 end;
 
 
 procedure TProjectFrame.dxpmExpandBillsPopup(Sender: TObject);
 procedure TProjectFrame.dxpmExpandBillsPopup(Sender: TObject);
@@ -1485,4 +1495,106 @@ begin
   pnlProjectCheckStatus.Update;
   pnlProjectCheckStatus.Update;
 end;
 end;
 
 
+procedure TProjectFrame.LocateMeasureBills(AID: Integer);
+var
+  vNode: TsdIDTreeNode;
+begin
+  dxsbViewControl.SelectedItem := dxsbViewControl.Groups[0].Items[xbiBillsMeasure.Tag];
+  ChangeView(xbiBillsMeasure.Tag);
+  with FProjectData.BillsMeasureData do
+  begin
+    vNode := BillsMeasureTree.FindNode(AID);
+    if Assigned(vNode) then
+      sdvBillsMeasure.LocateInControl(vNode.Rec);
+  end;
+end;
+
+procedure TProjectFrame.ChangeView(APageIndex: Integer);
+begin
+  BeforeChangeView(APageIndex);
+  case APageIndex of
+    0, 2: jpsMain.ActivePageIndex := APageIndex;
+    1, 3, 5: if CheckMeasureEdition then jpsMain.ActivePageIndex := APageIndex;
+  end;
+  AfterChangeView(APageIndex);
+end;
+
+procedure TProjectFrame.AfterChangeView(APageIndex: Integer);
+begin
+  // 仅计量台账界面可以选择计量期
+  pnlPhaseSelect.Visible := APageIndex = xbiBillsMeasure.Tag;
+  // 台账分解、计量台账、审核比较 可使用"显示至"功能
+  tbExpand.Visible := (APageIndex = xbiBillsCompile.Tag)
+                   or (APageIndex = xbiBillsMeasure.Tag)
+                   or (APageIndex = xbiStageCompare.Tag);
+  // 右侧按钮是否显示
+  tbToolsButton.Visible := (APageIndex = xbiBillsCompile.Tag)
+                        or (APageIndex = xbiBillsMeasure.Tag);
+  tobtnBGL.Visible := APageIndex = xbiBillsMeasure.Tag;
+  tobtnZJJL.Visible := APageIndex = xbiBillsMeasure.Tag;
+  // 控制整个按钮工具栏显示,
+  pnlToolBar.Visible := pnlPhaseSelect.Visible or tbExpand.Visible or tbToolsButton.Visible;
+  // 根据当前View控制右侧按钮是否按下,右侧工具窗是否弹开
+  jpsAssistant.ActivePageIndex := jpsMain.ActivePage.Tag;
+  sbtnExpend.Tag := jpsMain.ActivePage.Tag;
+  ControlAssistantButtonsDown(jpsMain.ActivePage.Tag);
+  SetAssistantViewVisible(jpsMain.ActivePage.Tag <> -1);
+  SetImageOfsbtnExpend(jpsMain.ActivePage.Tag <> -1);
+  // 0号台账与计量台账的书签不同
+  if APageIndex = xbiBillsCompile.Tag then
+    FBookmarkFrame.BMType := bmtCompile
+  else if APageIndex = xbiBillsMeasure.Tag then
+    FBookmarkFrame.BMType := bmtMeasure;
+  // 0号台账与计量台账的查找定位不同
+  if APageIndex = xbiBillsCompile.Tag then
+    FSearchFrame.LocateType := ltCompile
+  else if APageIndex = xbiBillsMeasure.Tag then
+    FSearchFrame.LocateType := ltMeasure;
+  // 切换至清单汇总,须重新汇总
+  if APageIndex = xbiBillsGather.Tag then
+    BillsGatherFrame.RefreshBills;
+  // 切换至材料调差,须重新汇总展示调差清单
+  if APageIndex = xbiPriceMargin.Tag then
+    PriceMarginFrame.RefreshBills;
+
+  if G_IsCloud then
+  begin
+    if (APageIndex = xbiBillsCompile.Tag) or (APageIndex = xbiBillsMeasure.Tag) then
+      CheckUpFile;
+
+    tobtnUpFile.Visible := APageIndex = xbiBillsMeasure.Tag;
+    if (tobtnUpFile.Visible = False) and (jpsAssistant.ActivePage = jpsAssistantUpFile) then
+      jpsAssistant.ActivePage := jpsAssistantStandardBills;
+  end;
+end;
+
+procedure TProjectFrame.BeforeChangeView(APageIndex: Integer);
+begin
+  if G_IsCloud then
+  begin
+    tobtnShowChecker.Visible := ProjectData.PhaseIndex > 0;
+    tobtnShowChecker.Enabled := (APageIndex = xbiBillsMeasure.Tag);
+
+    ButtonControl_NewPhase;
+
+    if APageIndex = xbiBillsCompile.Tag then
+    begin
+      if tobtnShowChecker.Down then
+      begin
+        tobtnShowChecker.Down := False;
+        tobtnShowChecker.Click;
+        tobtnStandardBills.Down := True;
+        tobtnStandardBills.Click;
+        tobtnStandardBills.Down := False;
+        tobtnStandardBills.Click;
+      end;
+    end;
+  end;
+  // 记录台账分解、计量台账等的右侧展开情况
+  if jpsAssistant.Visible then
+    jpsMain.ActivePage.Tag := jpsAssistant.ActivePageIndex
+  else
+    jpsMain.ActivePage.Tag := -1;
+end;
+
 end.
 end.