Browse Source

新增“变更性质”

MaiXinRong 9 years ago
parent
commit
6170f1104c
5 changed files with 101 additions and 5 deletions
  1. 8 0
      DataModules/BGLDm.dfm
  2. 2 0
      DataModules/BGLDm.pas
  3. 41 1
      Frames/BGLFme.dfm
  4. 46 2
      Frames/BGLFme.pas
  5. 4 2
      Units/DataBaseTables.pas

+ 8 - 0
DataModules/BGLDm.dfm

@@ -60,6 +60,10 @@ object BGLData: TBGLData
     object cdsBGLExecutionRate: TFloatField
       FieldName = 'ExecutionRate'
     end
+    object cdsBGLBGLType: TWideStringField
+      FieldName = 'BGLType'
+      Size = 10
+    end
   end
   object cdsBGLView: TClientDataSet
     Aggregates = <>
@@ -109,6 +113,10 @@ object BGLData: TBGLData
     object cdsBGLViewExecutionRate: TFloatField
       FieldName = 'ExecutionRate'
     end
+    object cdsBGLViewBGLType: TWideStringField
+      FieldName = 'BGLType'
+      Size = 10
+    end
   end
   object dsBGL: TDataSource
     DataSet = cdsBGLView

+ 2 - 0
DataModules/BGLDm.pas

@@ -98,6 +98,8 @@ type
     cdsBGBillsViewTotalPrice: TFloatField;
     cdsBGBillsViewUsedQuantity: TFloatField;
     cdsBGBillsViewLocked: TBooleanField;
+    cdsBGLBGLType: TWideStringField;
+    cdsBGLViewBGLType: TWideStringField;
     procedure cdsBGBillsViewAfterInsert(DataSet: TDataSet);
     procedure cdsBGBillsViewAfterPost(DataSet: TDataSet);
     procedure cdsBGBillsViewQuantityChange(Sender: TField);

+ 41 - 1
Frames/BGLFme.dfm

@@ -117,7 +117,7 @@ object BGLFrame: TBGLFrame
         Height = 271
         Options = [goRangeSelect, goRowSizing, goColSizing, goCellNotMaintainData, goFixedRowShowNo, goFixedColShowNo, goAlwaysShowSelection]
         OptionsEx = []
-        ColCount = 7
+        ColCount = 8
         RowCount = 2
         ShowGridLine = False
         DefaultColWidth = 73
@@ -129,6 +129,9 @@ object BGLFrame: TBGLFrame
         FrozenRow = 0
         OnCopy = zgBGLCopy
         OnPaste = zgBGLPaste
+        OnGetCellEditor = zgBGLGetCellEditor
+        OnEditorLoadCell = zgBGLEditorLoadCell
+        OnEditorSaveCell = zgBGLEditorSaveCell
         OnMouseDown = zgBGLMouseDown
         Align = alClient
       end
@@ -184,6 +187,25 @@ object BGLFrame: TBGLFrame
       end
     end
   end
+  object cbbBGLType: TZjComboBox
+    Left = 198
+    Top = 160
+    Width = 145
+    Height = 20
+    Font.Charset = ANSI_CHARSET
+    Font.Color = clWindowText
+    Font.Height = -12
+    Font.Name = 'smartSimSun'
+    Font.Style = []
+    ItemHeight = 12
+    ParentFont = False
+    TabOrder = 3
+    Visible = False
+    Items.Strings = (
+      #19968#33324
+      #36739#22823
+      #37325#22823)
+  end
   object zaBGL: TZjGridDBA
     Columns = <
       item
@@ -277,6 +299,24 @@ object BGLFrame: TBGLFrame
         ReadOnly = False
       end
       item
+        Title.Caption = #21464#26356#24615#36136
+        Title.CaptionAcrossCols = '1'
+        Title.Font.Charset = GB2312_CHARSET
+        Title.Font.Color = clWindowText
+        Title.Font.Height = -12
+        Title.Font.Name = #23435#20307
+        Title.Font.Style = []
+        Alignment = taCenter
+        Font.Charset = GB2312_CHARSET
+        Font.Color = clWindowText
+        Font.Height = -12
+        Font.Name = #23435#20307
+        Font.Style = []
+        FieldName = 'BGLType'
+        Width = 60
+        ReadOnly = False
+      end
+      item
         Title.Caption = #24050#25191#34892'(%)'
         Title.CaptionAcrossCols = '1'
         Title.Font.Charset = GB2312_CHARSET

+ 46 - 2
Frames/BGLFme.pas

@@ -6,7 +6,7 @@ uses
   BGLDm,
   Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
   Dialogs, ZjGridDBA, StdCtrls, DBCtrls, ZJGrid, ExtCtrls, ComCtrls,
-  ToolWin, JimLabels, ActnList, DB, dxBar;
+  ToolWin, JimLabels, ActnList, DB, dxBar, ZJEdits;
 
 type
   TBGLFrame = class(TFrame)
@@ -33,6 +33,7 @@ type
     pnlBGL: TPanel;
     sprBGL: TSplitter;
     actnCopyBGLBlock: TAction;
+    cbbBGLType: TZjComboBox;
     procedure actnNewExecute(Sender: TObject);
     procedure dbmPos_ReasonExit(Sender: TObject);
     procedure zgBGLMouseDown(Sender: TObject; Button: TMouseButton;
@@ -49,6 +50,12 @@ type
     procedure zgBGLPaste(Sender: TObject; const ABounds: TRect;
       var Allow: Boolean);
     procedure actnCopyBGLBlockUpdate(Sender: TObject);
+    procedure zgBGLGetCellEditor(Sender: TObject; ACoord: TPoint;
+      var AControl: TWinControl);
+    procedure zgBGLEditorSaveCell(Sender: TObject; ACoord: TPoint;
+      AControl: TWinControl);
+    procedure zgBGLEditorLoadCell(Sender: TObject; ACoord: TPoint;
+      AControl: TWinControl);
   private
     FBGLData: TBGLData;
 
@@ -62,7 +69,7 @@ implementation
 
 uses
   UtilMethods, MergeTextFrm, ProjectData, MainFrm, mEncryptEditions,
-  BGLClipboard, ConstUnit;
+  BGLClipboard, ConstUnit, ZjCells;
 
 {$R *.dfm}
 
@@ -72,7 +79,13 @@ constructor TBGLFrame.Create(AParent: TFrame; ABGLData: TBGLData);
 begin
   inherited Create(AParent);
   FBGLData := ABGLData;
+  zgBGL.CellClass.Cols[zaBGL.ColumnCol('BGLType')] := TZjComboCell;
   zaBGL.DataSet := FBGLData.cdsBGLView;
+
+  zgBGL.OnGetCellEditor := zgBGLGetCellEditor;
+  zgBGL.OnEditorLoadCell := zgBGLEditorLoadCell;
+  zgBGL.OnEditorSaveCell := zgBGLEditorSaveCell;
+
   dbmPos_Reason.DataSource := FBGLData.dsBGL;
   dbmDirection.DataSource := FBGLData.dsBGL;
   zaBGBills.DataSet := FBGLData.cdsBGBillsView;
@@ -193,4 +206,35 @@ begin
     TAction(Sender).Visible := False;
 end;
 
+procedure TBGLFrame.zgBGLGetCellEditor(Sender: TObject; ACoord: TPoint;
+  var AControl: TWinControl);
+begin
+  if ACoord.X = zaBGL.ColumnCol('BGLType') then
+    AControl := cbbBGLType;
+end;
+
+procedure TBGLFrame.zgBGLEditorSaveCell(Sender: TObject; ACoord: TPoint;
+  AControl: TWinControl);
+begin
+  if AControl = cbbBGLType then
+  begin
+    zaBGL.DataSet.Edit;
+    if cbbBGLType.ItemIndex = -1 then
+      zaBGL.DataSet.FieldByName('BGLType').Clear
+    else
+      zaBGL.DataSet.FieldByName('BGLType').AsString := cbbBGLType.Text;
+    zaBGL.DataSet.Post;
+  end;
+end;
+
+procedure TBGLFrame.zgBGLEditorLoadCell(Sender: TObject; ACoord: TPoint;
+  AControl: TWinControl);
+begin
+  if AControl = cbbBGLType then
+    if zaBGL.DataSet.FieldByName('BGLType').AsString = '' then
+      cbbBGLType.ItemIndex := -1
+    else
+      cbbBGLType.Text := zaBGL.DataSet.FieldByName('BGLType').AsString;
+end;
+
 end.

+ 4 - 2
Units/DataBaseTables.pas

@@ -328,7 +328,7 @@ const
 
   {变更令}
   SBGL = 'BGL';
-  tdBGL: array [0..10] of TScFieldDef =(
+  tdBGL: array [0..11] of TScFieldDef =(
     (FieldName: 'ID'; FieldType: ftInteger; Size: 0; NotNull: True; PrimaryKey: True; ForceUpdate: False),
     // 变更令号
     (FieldName: 'Code'; FieldType: ftString; Size: 50; NotNull: False; PrimaryKey: False; ForceUpdate: False),
@@ -349,7 +349,9 @@ const
     // 创建期数
     (FieldName: 'CreatePhaseID'; FieldType: ftInteger; Size: 0; NotNull: False; PrimaryKey: False; ForceUpdate: False),
     // 已执行
-    (FieldName: 'ExecutionRate'; FieldType: ftDouble; Size: 0; NotNull: False; PrimaryKey: False; ForceUpdate: False)
+    (FieldName: 'ExecutionRate'; FieldType: ftDouble; Size: 0; NotNull: False; PrimaryKey: False; ForceUpdate: False),
+    // 变更令类型:一般、较大、重大
+    (FieldName: 'BGLType'; FieldType: ftString; Size: 10; NotNull: False; PrimaryKey: False; ForceUpdate: False)
   );
 
   SBGBills = 'BGBills';