|
|
@@ -1147,6 +1147,7 @@ type
|
|
|
procedure DoOnAfterGridRemapedPaste(Sender: TObject);
|
|
|
function ExpXMLEnabled: Boolean;
|
|
|
procedure CheckBackUpFileSize(Action: TAction);
|
|
|
+ function SelectedGLJCount: Integer;
|
|
|
protected
|
|
|
procedure CreateWnd; override;
|
|
|
procedure AddMenuItem(const APath: string; AHandle: TNotifyEvent);
|
|
|
@@ -1231,7 +1232,7 @@ uses
|
|
|
{$IFDEF _ScOnline}
|
|
|
, ScMicroWebFrm
|
|
|
{$ENDIF}
|
|
|
- , ScCheckNullRationFrm;
|
|
|
+ , ScCheckNullRationFrm, sdDB;
|
|
|
|
|
|
{$R *.dfm}
|
|
|
{$R ScIcons.res}
|
|
|
@@ -7445,6 +7446,51 @@ begin
|
|
|
and (ActiveChild.Project.Properties.StaticBills <>1);
|
|
|
end;
|
|
|
|
|
|
+var
|
|
|
+ iGLJCount, iSelectedGLJCount: Integer;
|
|
|
+ iTime: Cardinal;
|
|
|
+const
|
|
|
+ // 1900条工料机以下,使用直接删除更快(38万条工料机中删除1900条,14秒左右)),1900以上使用批量处理更快
|
|
|
+ SelectedGLJLimit = 1900;
|
|
|
+
|
|
|
+// 选中清单下工料机数量
|
|
|
+function TScMainForm.SelectedGLJCount: Integer;
|
|
|
+var
|
|
|
+ I, J, iFrom, iTo: Integer;
|
|
|
+ zgGrid: TZJGrid;
|
|
|
+ lstBills, lstGLJ: TList;
|
|
|
+ Node: TsdIDTreeNode;
|
|
|
+ Rec: TsdDataRecord;
|
|
|
+ idxGLJ: TsdIndex;
|
|
|
+begin
|
|
|
+ Result := 0;
|
|
|
+ lstBills := TList.Create;
|
|
|
+ lstGLJ := TList.Create;
|
|
|
+ try
|
|
|
+ zgGrid := ActiveChild.BillsView.zgBills;
|
|
|
+ iFrom := zgGrid.Selection.Top - zgGrid.FixedRowCount;
|
|
|
+ iTo := zgGrid.Selection.Bottom - 1 - zgGrid.FixedRowCount;
|
|
|
+ Node := ActiveChild.Project.Bills.BillsTree.Items[iTo];
|
|
|
+ if Node.LastPosterity <> nil then
|
|
|
+ iTo := Node.LastPosterity.MajorIndex;
|
|
|
+ for I := iFrom to iTo do
|
|
|
+ begin
|
|
|
+ Node := ActiveChild.Project.Bills.BillsTree.Items[I];
|
|
|
+ lstBills.Add(Node);
|
|
|
+ end;
|
|
|
+ idxGLJ := ActiveChild.Project.GLJ.sdsGLJ.FindIndex('idxBillsID');
|
|
|
+ for I := 0 to lstBills.Count - 1 do
|
|
|
+ begin
|
|
|
+ Node := TsdIDTreeNode(lstBills[I]);
|
|
|
+ idxGLJ.RecordsByKey(Node.ID, lstGLJ);
|
|
|
+ Inc(Result, lstGLJ.Count);
|
|
|
+ end;
|
|
|
+ finally
|
|
|
+ lstBills.Free;
|
|
|
+ lstGLJ.Free;
|
|
|
+ end;
|
|
|
+end;
|
|
|
+
|
|
|
procedure TScMainForm.DoOnBeforeGridDelete(Sender: TObject;
|
|
|
var CanExecute: Boolean);
|
|
|
begin
|
|
|
@@ -7456,6 +7502,24 @@ begin
|
|
|
ActiveChild.BillsView.zgBills.Selection.Bottom - 1 - ActiveChild.BillsView.zgBills.FixedRowCount);
|
|
|
if CanExecute then
|
|
|
ActiveChild.BillsView.SnapShootCurrent;
|
|
|
+ // 优化大数据量删除,删除清单时生效
|
|
|
+// iTime := GetTickCount;
|
|
|
+// iGLJCount := ActiveChild.Project.GLJ.sdsGLJ.RecordCount;
|
|
|
+ iSelectedGLJCount := SelectedGLJCount;
|
|
|
+// ShowMessage(Format('Count %d selected GLJ in %f s', [iSelectedGLJCount, (GetTickCount - iTime) / 1000]));
|
|
|
+// iTime := GetTickCount;
|
|
|
+ // 1900条工料机以下,使用直接删除更快(38万条工料机中删除1900条,14秒左右)),1900以上使用批量处理更快
|
|
|
+ if iSelectedGLJCount > SelectedGLJLimit then
|
|
|
+ begin
|
|
|
+ ActiveChild.BillsSubItemView.RAdjustView.sgdGLJAdjust.DisableControl;
|
|
|
+ ActiveChild.Project.GLJ.sdsGLJ.BeginUpdate;
|
|
|
+ ActiveChild.Project.GLJ.sdsGLJ.DisableControls;
|
|
|
+ ActiveChild.BillsSubItemView.sgdRations.DisableControl;
|
|
|
+ ActiveChild.BillsSubItemView.sgdCountPrice.DisableControl;
|
|
|
+ ActiveChild.BillsSubItemView.sgdMachineElectron.DisableControl;
|
|
|
+ ActiveChild.Project.Rations.sdsRations.BeginUpdate;
|
|
|
+ ActiveChild.Project.Rations.sdsRations.DisableControls;
|
|
|
+ end;
|
|
|
end
|
|
|
else if CanExecute then
|
|
|
begin
|
|
|
@@ -7475,6 +7539,28 @@ end;
|
|
|
procedure TScMainForm.DoOnAfterGridDelete(Sender: TObject);
|
|
|
begin
|
|
|
if IsManageView then Exit;
|
|
|
+ if (Sender = ActiveChild.BillsView.zgBills) then
|
|
|
+ begin
|
|
|
+// ShowMessage(Format('Delete %d GLJ in %f s', [iGLJCount - ActiveChild.Project.GLJ.sdsGLJ.RecordCount, (GetTickCount - iTime) / 1000]));
|
|
|
+// iTime := GetTickCount;
|
|
|
+ if iSelectedGLJCount > SelectedGLJLimit then
|
|
|
+ begin
|
|
|
+ Screen.Cursor := crHourGlass;
|
|
|
+ try
|
|
|
+ ActiveChild.Project.GLJ.sdsGLJ.EndUpdate;
|
|
|
+ ActiveChild.Project.GLJ.sdsGLJ.EnableControls;
|
|
|
+ ActiveChild.BillsSubItemView.RAdjustView.sgdGLJAdjust.EnableControl;
|
|
|
+ ActiveChild.Project.Rations.sdsRations.EndUpdate;
|
|
|
+ ActiveChild.Project.Rations.sdsRations.EnableControls;
|
|
|
+ ActiveChild.BillsSubItemView.sgdRations.EnableControl;
|
|
|
+ ActiveChild.BillsSubItemView.sgdCountPrice.EnableControl;
|
|
|
+ ActiveChild.BillsSubItemView.sgdMachineElectron.EnableControl;
|
|
|
+ finally
|
|
|
+ Screen.Cursor := crDefault;
|
|
|
+ end;
|
|
|
+ end;
|
|
|
+// ShowMessage(Format('Enable GLJ DataSet in %f s', [(GetTickCount - iTime) / 1000]));
|
|
|
+ end;
|
|
|
if (Sender = ActiveChild.BillsView.zgBills)
|
|
|
or (Sender = ActiveChild.BillsSubItemView.zgRations)
|
|
|
or (Sender = ActiveChild.BillsSubItemView.zgMachineElectron)
|