Bläddra i källkod

1. 从云端读变更令、变更清单,不可删除
2. 从云端读取的变更令,部位及原因、说明应只读
3. 非云端变更令,不可编辑已执行
4. 同步清单至云端,清单汇总无数据时,提示用户建立台账

MaiXinRong 7 år sedan
förälder
incheckning
4252825463
4 ändrade filer med 27 tillägg och 8 borttagningar
  1. 4 0
      DataModules/BGLDm.pas
  2. 2 0
      Frames/BGLFme.dfm
  3. 15 8
      Frames/BGLFme.pas
  4. 6 0
      Frames/BillsGatherFme.pas

+ 4 - 0
DataModules/BGLDm.pas

@@ -503,6 +503,8 @@ procedure TBGLData.cdsBGLViewBeforeDelete(DataSet: TDataSet);
 begin
   if CheckBGLUsed(cdsBGLViewID.AsInteger) then
     raise Exception.Create('变更令下变更清单已被应用到清单,不可删除!');
+  if cdsBGLViewIsCloud.AsBoolean then
+    raise Exception.Create('云端获取的变更令不允许删除!');
   DeleteBGBills(cdsBGLViewID.AsInteger);
 end;
 
@@ -528,6 +530,8 @@ procedure TBGLData.cdsBGBillsViewBeforeDelete(DataSet: TDataSet);
 begin
   if cdsBGBillsViewUsedQuantity.AsFloat <> 0 then
     raise Exception.Create('变更清单已被应用至清单,不可删除!');
+  if cdsBGLViewIsCloud.AsBoolean then
+    raise Exception.Create('云端获取的变更清单不允许删除!');
 end;
 
 function TBGLData.CheckBGLUsed(ABGID: Integer): Boolean;

+ 2 - 0
Frames/BGLFme.dfm

@@ -127,6 +127,7 @@ object BGLFrame: TBGLFrame
         Selection.TransparentColor = False
         FrozenCol = 0
         FrozenRow = 0
+        OnCurrentChanged = zgBGLCurrentChanged
         OnCellTextChanged = zgBGLCellTextChanged
         OnCopy = zgBGLCopy
         OnPaste = zgBGLPaste
@@ -338,6 +339,7 @@ object BGLFrame: TBGLFrame
     ExtendRowCount = 1
     Options = [aoAllowEdit, aoAllowDelete, aoAllowUpMove, aoAllowDownMove]
     OnGridCellCanEdit = zaBGLGridCellCanEdit
+    OnBeforeGridRowMove = zaBGLBeforeGridRowMove
     Left = 96
     Top = 88
   end

+ 15 - 8
Frames/BGLFme.pas

@@ -61,6 +61,9 @@ type
       var Allow: Boolean);
     procedure zaBGBillsGridCellCanEdit(Sender: TObject;
       const ACoord: TPoint; var Allow: Boolean);
+    procedure zgBGLCurrentChanged(Sender: TObject; Col, Row: Integer);
+    procedure zaBGLBeforeGridRowMove(Sender: TObject; const ACoord: TPoint;
+      ADist: Integer; ADir: TZjMoveDirection);
   private
     FBGLData: TBGLData;
 
@@ -102,6 +105,7 @@ begin
   begin
     zaBGL.Options := [aoAllowEdit, aoAllowDelete, aoAllowUpMove, aoAllowDownMove];
     zaBGL.ExtendRowCount := 0;
+    zgBGL.OnCurrentChanged := zgBGLCurrentChanged;
   end
   else
     zaBGL.Options := [aoAllowInsert, aoAllowEdit, aoAllowDelete, aoAutoInsert, aoAllowUpMove, aoAllowDownMove];
@@ -284,19 +288,22 @@ end;
 procedure TBGLFrame.zaBGLGridCellCanEdit(Sender: TObject;
   const ACoord: TPoint; var Allow: Boolean);
 begin
-  if _IsCloud then
-    Allow := FBGLData.GetBGLCanEdit(ACoord.Y)
-  else
-    Allow := True;
+  if _IsCloud and Allow then
+    Allow := FBGLData.GetBGLCanEdit(ACoord.Y);
 end;
 
 procedure TBGLFrame.zaBGBillsGridCellCanEdit(Sender: TObject;
   const ACoord: TPoint; var Allow: Boolean);
 begin
-  if _IsCloud then
-    Allow := not FBGLData.cdsBGLViewIsCloud.AsBoolean
-  else
-    Allow := True;
+  if _IsCloud and Allow then
+    Allow := not FBGLData.cdsBGLViewIsCloud.AsBoolean;
+end;
+
+procedure TBGLFrame.zgBGLCurrentChanged(Sender: TObject; Col,
+  Row: Integer);
+begin
+  dbmPos_Reason.ReadOnly := _IsCloud and FBGLData.cdsBGLViewIsCloud.AsBoolean;
+  dbmDirection.ReadOnly := dbmPos_Reason.ReadOnly;
 end;
 
 end.

+ 6 - 0
Frames/BillsGatherFme.pas

@@ -250,6 +250,12 @@ var
   sgsParam: TStrings;
   sResult: string;
 begin
+  if saGclBills.DataView.RecordCount = 0 then
+  begin
+    WarningMessage('헝邱쉔접憩瑯,疼谿꼍헌데逞暾똥。');
+    Exit;
+  end;
+
   sgsParam := TStringList.Create;
   try
     sgsParam.Add(Format('pmid=%d', [TProjectData(FBillsGatherData.ProjectData).WebID]));