|
@@ -3,7 +3,7 @@ unit SelectDetailGLsFrm;
|
|
|
interface
|
|
|
|
|
|
uses
|
|
|
- ProjectGLDm, sdDB,
|
|
|
+ ProjectGLDm, sdDB, mDataRecord,
|
|
|
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
|
|
|
Dialogs, ExtCtrls, StdCtrls, sdGridDBA, ZJGrid;
|
|
|
|
|
@@ -21,8 +21,11 @@ type
|
|
|
procedure zgGLSetCellText(Sender: TObject; const ACoord: TPoint;
|
|
|
var Value: String; DisplayText: Boolean);
|
|
|
procedure btnOkClick(Sender: TObject);
|
|
|
+ procedure imgSearchClick(Sender: TObject);
|
|
|
private
|
|
|
FResults: TList;
|
|
|
+
|
|
|
+ function FindProjectGL(AStr: string): TProjectGLRecord;
|
|
|
public
|
|
|
constructor Create(AProjectGLData: TProjectGLData);
|
|
|
destructor Destroy; override;
|
|
@@ -60,6 +63,8 @@ begin
|
|
|
inherited Create(nil);
|
|
|
saGL.DataView := AProjectGLData.sdvProjectGL;
|
|
|
FResults := TList.Create;
|
|
|
+ ClientHeight := 495;
|
|
|
+ ClientWidth := 472;
|
|
|
end;
|
|
|
|
|
|
destructor TSelectDetailGLsForm.Destroy;
|
|
@@ -106,4 +111,48 @@ begin
|
|
|
TipMessage('没有选择任何工料。');
|
|
|
end;
|
|
|
|
|
|
+function TSelectDetailGLsForm.FindProjectGL(AStr: string): TProjectGLRecord;
|
|
|
+
|
|
|
+ function SearchProjectGL(ABegin, AEnd: Integer): TProjectGLRecord;
|
|
|
+ var
|
|
|
+ iGL: Integer;
|
|
|
+ Rec: TProjectGLRecord;
|
|
|
+ begin
|
|
|
+ Result := nil;
|
|
|
+ for iGL := ABegin to AEnd do
|
|
|
+ begin
|
|
|
+ Rec := TProjectGLRecord(saGL.DataView.Records[iGL]);
|
|
|
+ if (Pos(AStr, Rec.Code.AsString) > 0) or
|
|
|
+ (Pos(AStr, Rec.Name.AsString) > 0) then
|
|
|
+ begin
|
|
|
+ Result := Rec;
|
|
|
+ Break;
|
|
|
+ end;
|
|
|
+ end;
|
|
|
+ end;
|
|
|
+
|
|
|
+var
|
|
|
+ iCur, iGL: Integer;
|
|
|
+ GLRec: TProjectGLRecord;
|
|
|
+begin
|
|
|
+ Result := nil;
|
|
|
+ if AStr = '' then Exit;
|
|
|
+
|
|
|
+ iCur := saGL.DataView.IndexOf(saGL.DataView.Current);
|
|
|
+ Result := SearchProjectGL(iCur + 1, saGL.DataView.RecordCount - 1);
|
|
|
+ if not Assigned(Result) then
|
|
|
+ Result := SearchProjectGL(0, iCur);
|
|
|
+end;
|
|
|
+
|
|
|
+procedure TSelectDetailGLsForm.imgSearchClick(Sender: TObject);
|
|
|
+var
|
|
|
+ Rec: TProjectGLRecord;
|
|
|
+begin
|
|
|
+ Rec := FindProjectGL(leSearch.Text);
|
|
|
+ if Assigned(Rec) then
|
|
|
+ saGL.DataView.LocateInControl(Rec)
|
|
|
+ else
|
|
|
+ TipMessage(Format('找不到编号、名称含有“%s”的工料。', [leSearch.Text]));
|
|
|
+end;
|
|
|
+
|
|
|
end.
|