513 lines
18 KiB
Plaintext
513 lines
18 KiB
Plaintext
unit MachineMst;
|
||
|
||
interface
|
||
|
||
uses
|
||
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
|
||
wItem,
|
||
FireDAC.Stan.Intf,
|
||
FireDAC.Stan.Option, FireDAC.Stan.Error, FireDAC.UI.Intf, FireDAC.Phys.Intf,
|
||
FireDAC.Stan.Def, FireDAC.Stan.Pool, FireDAC.Stan.Async, FireDAC.Phys,
|
||
FireDAC.Stan.Param, FireDAC.DatS, FireDAC.DApt.Intf, FireDAC.DApt,
|
||
FireDAC.Phys.PGDef, FireDAC.VCLUI.Wait, FireDAC.Comp.UI, FireDAC.Phys.PG,
|
||
Data.DB, FireDAC.Comp.DataSet, FireDAC.Comp.Client;
|
||
|
||
type
|
||
TMachineMst = class(TwItem)
|
||
private
|
||
{ Private declarations }
|
||
FMachCode: string;
|
||
FMachDate: string;
|
||
FCustName: string;
|
||
FDescriptions: string;
|
||
FProcType: string;
|
||
FNickName: string;
|
||
FManager: string;
|
||
FDriver: string;
|
||
FLocationPath: string;
|
||
FNilmID: string;
|
||
FChannelNum: string;
|
||
FKind: string;
|
||
FExistTemp: string;
|
||
FSeqNum: string;
|
||
FIsMachine: string;
|
||
|
||
FqRepList: TList;
|
||
protected
|
||
{ Protected declarations }
|
||
public
|
||
{ Public declarations }
|
||
constructor Create(AOwner: TObject);// override;
|
||
destructor Destroy; override;
|
||
|
||
class function xAddSqlMark(velStr: string): string;
|
||
class function xGetStrSqlMachineMstList(AQuery: TFDQuery; kindStr, codeStr, nameStr: string): TList;
|
||
class function xGetObjsCurMachineList(AQuery: TFDQuery; kindStr, codeStr, nameStr: string): TList;
|
||
class function LoadFromQuery(AQuery: TFDQuery): TList;
|
||
|
||
class function xGetObjsMachineToRepairList(AQuery: TFDQuery; kindStr, codeStr, nameStr: string): TList;
|
||
class function xGetObjsMachineToRepairList2(AQuery: TFDQuery; kindStr, codeStr, nameStr: string): TList;
|
||
class function LoadFromQueryMachRepairList(AQuery: TFDQuery): TList;
|
||
|
||
class function xGetStrsDistinctColumnName(AQuery: TFDQuery; colName: string): TStrings;
|
||
class function xGetStrsDistinctMachineName(AQuery: TFDQuery; name, mtype: string): TStrings;
|
||
class function xAddSqlDoubleMark(velStr: String): String;
|
||
class function LoadFromStringsQuery(AQuery: TFDQuery; column: string): TStrings;
|
||
|
||
class function xGetStrMachineMstTotalCount(AQuery: TFDQuery): string;
|
||
class function xGetObjAlarmMachineInfo(AQuery: TFDQuery): TMachineMst;
|
||
|
||
class function xGetStrsDistinctSinteringMachName(AQuery: TFDQuery): TStrings;
|
||
|
||
function xGetStrAlarmCurrStatus(AQuery: TFDQuery): string;
|
||
|
||
property qRepList: TList read FqRepList write FqRepList;
|
||
published
|
||
{ Published declarations }
|
||
property MachCode: string read FMachCode write FMachCode;
|
||
property MachDate: string read FMachDate write FMachDate;
|
||
property CustName: string read FCustName write FCustName;
|
||
property Descriptions: string read FDescriptions write FDescriptions;
|
||
property ProcType: string read FProcType write FProcType;
|
||
property NickName: string read FNickName write FNickName;
|
||
property Manager: string read FManager write FManager;
|
||
property Driver: string read FDriver write FDriver;
|
||
property LocationPath: string read FLocationPath write FLocationPath;
|
||
property NilmID: string read FNilmID write FNilmID;
|
||
property ChannelNum: string read FChannelNum write FChannelNum;
|
||
property Kind: string read FKind write FKind;
|
||
property ExistTemp: string read FExistTemp write FExistTemp;
|
||
property SeqNum: string read FSeqNum write FSeqNum;
|
||
property IsMachine: string read FIsMachine write FIsMachine;
|
||
end;
|
||
|
||
implementation
|
||
|
||
uses
|
||
MachineRepair;
|
||
|
||
{ TMachineMst }
|
||
|
||
constructor TMachineMst.Create(AOwner: TObject);
|
||
begin
|
||
FqRepList := TList.Create;
|
||
end;
|
||
|
||
destructor TMachineMst.Destroy;
|
||
var
|
||
i: Integer;
|
||
tmpObj: TObject;
|
||
begin
|
||
if FqRepList <> nil then begin
|
||
i := 0;
|
||
while i < FqRepList.Count do begin
|
||
tmpObj := FqRepList.Items[i];
|
||
if tmpObj <> nil then tmpObj.Free;
|
||
tmpObj := nil;
|
||
FqRepList.Delete(i);
|
||
end;
|
||
FqRepList.Free; FqRepList:=nil;
|
||
end;
|
||
|
||
inherited;
|
||
end;
|
||
|
||
class function TMachineMst.LoadFromQuery(AQuery: TFDQuery): TList;
|
||
var
|
||
curMach: TMachineMst;
|
||
begin
|
||
Result := TList.Create;
|
||
while not AQuery.Eof do begin
|
||
curMach := TMachineMst.Create(nil);
|
||
curMach.OBID := AQuery.FieldByName('OBID').AsString;
|
||
curMach.Name := AQuery.FieldByName('Name').AsString;
|
||
curMach.wClassName := AQuery.FieldByName('wClassName').AsString;
|
||
curMach.CreateDate := AQuery.FieldByName('CreateDate').AsString;
|
||
curMach.CreateTime := FormatDateTime('hh:nn:ss', AQuery.FieldByName('CreateTime').AsDateTime);
|
||
curMach.CreatorID := AQuery.FieldByName('CreatorID').AsString;
|
||
curMach.IsValid := AQuery.FieldByName('IsValid').AsString;
|
||
curMach.LcStatus := AQuery.FieldByName('LcStatus').AsString;
|
||
|
||
curMach.MachCode := AQuery.FieldByName('MachCode').AsString;
|
||
curMach.MachDate := AQuery.FieldByName('MachDate').AsString;
|
||
curMach.CustName := AQuery.FieldByName('CustName').AsString;
|
||
curMach.Descriptions := AQuery.FieldByName('Descriptions').AsString;
|
||
curMach.ProcType := AQuery.FieldByName('ProcType').AsString;
|
||
curMach.NickName := AQuery.FieldByName('NickName').AsString;
|
||
curMach.Manager := AQuery.FieldByName('Manager').AsString;
|
||
curMach.Driver := AQuery.FieldByName('Driver').AsString;
|
||
curMach.LocationPath := AQuery.FieldByName('LocationPath').AsString;
|
||
curMach.NilmID := AQuery.FieldByName('NilmID').AsString;
|
||
curMach.ChannelNum := AQuery.FieldByName('ChannelNum').AsString;
|
||
curMach.Kind := AQuery.FieldByName('Kind').AsString;
|
||
curMach.ExistTemp := AQuery.FieldByName('ExistTemp').AsString;
|
||
curMach.SeqNum := AQuery.FieldByName('SeqNum').AsString;
|
||
Result.Add(curMach);
|
||
|
||
AQuery.Next;
|
||
end;
|
||
end;
|
||
|
||
class function TMachineMst.LoadFromQueryMachRepairList(AQuery: TFDQuery): TList;
|
||
var
|
||
i, idx, nidx, nnidx: Integer;
|
||
valName, fieName, obidVal: string;
|
||
curMach, tmpMach: TMachineMst;
|
||
curRepair: TMachineRepair;
|
||
begin
|
||
Result := TList.Create;
|
||
|
||
AQuery.First;
|
||
//<2F>ߺ<EFBFBD> <20>÷<EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> ã<><C3A3>..
|
||
nidx := -1;
|
||
for i := 0 to AQuery.FieldCount-1 do begin
|
||
fieName := AQuery.Fields[i].FieldName;
|
||
if Pos('_1',fieName) > 0 then begin
|
||
nidx := i;
|
||
Break;
|
||
end;
|
||
end;
|
||
|
||
AQuery.First;
|
||
while not AQuery.Eof do begin
|
||
obidVal := AQuery.FieldByName('OBID').AsString;
|
||
//<2F>ߺ<EFBFBD> <20><>ü ã<><C3A3>..
|
||
idx := -1;
|
||
for i := 0 to Result.Count - 1 do begin
|
||
curMach := TMachineMst(Result[i]);
|
||
if SameText(obidVal, curMach.OBID) then begin
|
||
idx := i;
|
||
Break;
|
||
end;
|
||
end;
|
||
|
||
if idx = -1 then begin
|
||
curMach := TMachineMst.Create(nil);
|
||
for i := 0 to nidx-1 do begin
|
||
fieName := AQuery.Fields[i].FieldName;
|
||
valName := AQuery.Fields[i].AsString;
|
||
if SameText(fieName, 'OBID') then curMach.OBID := valName
|
||
else if SameText(fieName, 'Name') then curMach.Name := valName
|
||
else if SameText(fieName, 'wClassName') then curMach.wClassName := valName
|
||
else if SameText(fieName, 'CreateDate') then curMach.CreateDate := valName
|
||
else if SameText(fieName, 'CreateTime') then curMach.CreateTime := valName
|
||
else if SameText(fieName, 'CreatorID') then curMach.CreatorID := valName
|
||
else if SameText(fieName, 'IsValid') then curMach.IsValid := valName
|
||
else if SameText(fieName, 'LcStatus') then curMach.LcStatus := valName
|
||
else if SameText(fieName, 'MachCode') then curMach.MachCode := valName
|
||
else if SameText(fieName, 'MachDate') then curMach.MachDate := valName
|
||
else if SameText(fieName, 'CustName') then curMach.CustName := valName
|
||
else if SameText(fieName, 'Descriptions') then curMach.Descriptions := valName
|
||
else if SameText(fieName, 'ProcType') then curMach.ProcType := valName
|
||
else if SameText(fieName, 'NickName') then curMach.NickName := valName
|
||
else if SameText(fieName, 'Manager') then curMach.Manager := valName
|
||
else if SameText(fieName, 'Driver') then curMach.Driver := valName
|
||
else if SameText(fieName, 'LocationPath') then curMach.LocationPath := valName
|
||
else if SameText(fieName, 'NilmID') then curMach.NilmID := valName
|
||
else if SameText(fieName, 'ChannelNum') then curMach.ChannelNum := valName
|
||
else if SameText(fieName, 'Kind') then curMach.Kind := valName
|
||
else if SameText(fieName, 'ExistTemp') then curMach.ExistTemp := valName
|
||
else if SameText(fieName, 'SeqNum') then curMach.SeqNum := valName;
|
||
end;
|
||
Result.Add(curMach);
|
||
end else begin
|
||
curMach := TMachineMst(Result.Items[idx]);
|
||
end;
|
||
|
||
curRepair := TMachineRepair.Create(nil);
|
||
for i := nidx to AQuery.FieldCount-1 do begin
|
||
fieName := StringReplace(AQuery.Fields[i].FieldName, '_1', '', [rfReplaceAll]);
|
||
valName := AQuery.Fields[i].AsString;
|
||
if SameText(fieName, 'OBID') then curRepair.OBID := valName
|
||
else if SameText(fieName, 'Name') then curRepair.Name := valName
|
||
else if SameText(fieName, 'wClassName') then curRepair.wClassName := valName
|
||
else if SameText(fieName, 'CreateDate') then curRepair.CreateDate := valName
|
||
else if SameText(fieName, 'CreateTime') then curRepair.CreateTime := valName
|
||
else if SameText(fieName, 'CreatorID') then curRepair.CreatorID := valName
|
||
else if SameText(fieName, 'IsValid') then curRepair.IsValid := valName
|
||
else if SameText(fieName, 'LcStatus') then curRepair.LcStatus := valName
|
||
else if SameText(fieName, 'OrdDate') then curRepair.OrdDate := valName
|
||
else if SameText(fieName, 'RepairDetail') then curRepair.RepairDetail := valName
|
||
else if SameText(fieName, 'Descriptions') then curRepair.Descriptions := valName;
|
||
end;
|
||
curMach.qRepList.Add(curRepair);
|
||
AQuery.Next;
|
||
end;
|
||
end;
|
||
|
||
class function TMachineMst.LoadFromStringsQuery(AQuery: TFDQuery;
|
||
column: string): TStrings;
|
||
var
|
||
valStr: string;
|
||
begin
|
||
Result := TStringList.Create;
|
||
while not AQuery.Eof do begin
|
||
valStr := AQuery.FieldByName(column).AsString;
|
||
Result.Add(valStr);
|
||
|
||
AQuery.Next;
|
||
end;
|
||
end;
|
||
|
||
class function TMachineMst.xAddSqlDoubleMark(velStr: String): String;
|
||
begin
|
||
Result := '';
|
||
Result := '"' + velStr + '"';
|
||
end;
|
||
|
||
class function TMachineMst.xAddSqlMark(velStr: string): string;
|
||
begin
|
||
Result := '';
|
||
Result := '''' + velStr + '''';
|
||
end;
|
||
|
||
class function TMachineMst.xGetObjAlarmMachineInfo(
|
||
AQuery: TFDQuery): TMachineMst;
|
||
var
|
||
sql: string;
|
||
tmpList: TList;
|
||
begin
|
||
Result := nil;
|
||
sql := 'SELECT * FROM "MachineMst"';
|
||
sql := sql + ' WHERE "IsValid"=' + xAddSqlMark('t');
|
||
sql := sql + ' AND "IsMachine"=' + xAddSqlMark('f');
|
||
sql := sql + ' AND "Name"=' + xAddSqlMark('ALARM');
|
||
|
||
try
|
||
AQuery.Close;
|
||
AQuery.SQL.Text := sql;
|
||
AQuery.Open;
|
||
except
|
||
on E: Exception do ShowMessage('xGetObjAlarmMachineInfo <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>: ' + E.Message);
|
||
end;
|
||
tmpList := LoadFromQuery(AQuery);
|
||
if tmpList.Count > 0 then begin
|
||
Result := TMachineMst(tmpList.Items[0]);
|
||
tmpList.Delete(0);
|
||
end;
|
||
tmpList.Free;
|
||
end;
|
||
|
||
class function TMachineMst.xGetObjsCurMachineList(AQuery: TFDQuery; kindStr,
|
||
codeStr, nameStr: string): TList;
|
||
var
|
||
sql: string;
|
||
begin
|
||
Result := nil;
|
||
sql := 'SELECT * FROM "MachineMst"';
|
||
sql := sql + ' WHERE "IsValid"=' + xAddSqlMark('t');
|
||
sql := sql + ' AND "IsMachine"=' + xAddSqlMark('t');
|
||
sql := sql + ' AND "LcStatus"=' + xAddSqlMark('<27><><EFBFBD><EFBFBD>');
|
||
if Length(Trim(kindStr)) > 0 then sql := sql + ' AND "ProcType"=' + xAddSqlMark(kindStr);
|
||
if Length(Trim(codeStr)) > 0 then sql := sql + ' AND "MachCode"=' + xAddSqlMark(codeStr);
|
||
if Length(Trim(nameStr)) > 0 then sql := sql + ' AND "Name"=' + xAddSqlMark(nameStr);
|
||
sql := sql + ' AND "Kind"<>' + xAddSqlMark('NONE');
|
||
// sql := sql + ' ORDER BY "MachCode"';
|
||
sql := sql + ' ORDER BY "SeqNum"';
|
||
|
||
try
|
||
AQuery.Close;
|
||
AQuery.SQL.Text := sql;
|
||
AQuery.Open;
|
||
except
|
||
on E: Exception do ShowMessage('xGetObjsCurMachineList <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>: ' + E.Message);
|
||
end;
|
||
Result := LoadFromQuery(AQuery);
|
||
end;
|
||
|
||
class function TMachineMst.xGetObjsMachineToRepairList(AQuery: TFDQuery;
|
||
kindStr, codeStr, nameStr: string): TList;
|
||
var
|
||
sql: string;
|
||
begin
|
||
Result := nil;
|
||
sql := 'SELECT obj0.*, obj2.* FROM "MachineMst"obj0, "MachMstMachRepairR"obj1, "MachineRepair"obj2';
|
||
sql := sql + ' WHERE obj0."IsValid"=' + xAddSqlMark('t');
|
||
sql := sql + ' AND obj0."IsMachine"=' + xAddSqlMark('t');
|
||
if Length(Trim(kindStr)) > 0 then sql := sql + ' AND "ProcType"=' + xAddSqlMark(kindStr);
|
||
if Length(Trim(codeStr)) > 0 then sql := sql + ' AND "MachCode"=' + xAddSqlMark(codeStr);
|
||
if Length(Trim(nameStr)) > 0 then sql := sql + ' AND "Name"=' + xAddSqlMark(nameStr);
|
||
sql := sql + ' AND obj1."IsValid"=' + xAddSqlMark('t');
|
||
sql := sql + ' AND obj1."LOBID"=obj0."OBID"';
|
||
sql := sql + ' AND obj2."IsValid"=' + xAddSqlMark('t');
|
||
sql := sql + ' AND obj2."OBID"=obj1."ROBID"';
|
||
|
||
try
|
||
AQuery.Close;
|
||
AQuery.SQL.Text := sql;
|
||
AQuery.Open;
|
||
except
|
||
on E: Exception do ShowMessage('xGetObjsMachineToRepairList <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>: ' + E.Message);
|
||
end;
|
||
Result := LoadFromQueryMachRepairList(AQuery);
|
||
end;
|
||
|
||
class function TMachineMst.xGetObjsMachineToRepairList2(AQuery: TFDQuery;
|
||
kindStr, codeStr, nameStr: string): TList;
|
||
var
|
||
sql: string;
|
||
begin
|
||
Result := nil;
|
||
sql := 'SELECT obj0.*, obj2.* FROM "MachineMst" obj0 LEFT JOIN "MachMstMachRepairR" obj1 ON obj1."LOBID" = obj0."OBID"';
|
||
sql := sql + ' AND obj0."IsMachine"=' + xAddSqlMark('t');
|
||
sql := sql + ' AND obj1."IsValid" = ' + xAddSqlMark('t');
|
||
sql := sql + ' LEFT JOIN "MachineRepair" obj2 ON obj2."OBID" = obj1."ROBID"';
|
||
sql := sql + ' AND obj2."IsValid" = ' + xAddSqlMark('t');
|
||
sql := sql + ' WHERE obj0."IsValid" = ' + xAddSqlMark('t');
|
||
if Length(Trim(kindStr)) > 0 then sql := sql + ' AND obj0."ProcType"=' + xAddSqlMark(kindStr);
|
||
if Length(Trim(codeStr)) > 0 then sql := sql + ' AND obj0."MachCode"=' + xAddSqlMark(codeStr);
|
||
if Length(Trim(nameStr)) > 0 then sql := sql + ' AND obj0."Name"=' + xAddSqlMark(nameStr);
|
||
sql := sql + ' ORDER BY obj0."MachCode", obj2."OBID" NULLS LAST';
|
||
|
||
try
|
||
AQuery.Close;
|
||
AQuery.SQL.Text := sql;
|
||
AQuery.Open;
|
||
except
|
||
on E: Exception do ShowMessage('xGetObjsMachineToRepairList2 <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>: ' + E.Message);
|
||
end;
|
||
Result := LoadFromQueryMachRepairList(AQuery);
|
||
end;
|
||
|
||
function TMachineMst.xGetStrAlarmCurrStatus(AQuery: TFDQuery): string;
|
||
var
|
||
sql, colName: string;
|
||
tmpStrs: TStrings;
|
||
begin
|
||
Result := '';
|
||
sql := 'SELECT "LcStatus"' + ' FROM "MachineMst"';
|
||
sql := sql + ' WHERE "IsValid"=' + xAddSqlMark('t');
|
||
sql := sql + ' AND "OBID"=' + xAddSqlMark(OBID);
|
||
|
||
try
|
||
AQuery.Close;
|
||
AQuery.SQL.Text := sql;
|
||
AQuery.Open;
|
||
except
|
||
on E: Exception do ShowMessage('xGetStrAlarmCurrStatus <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>: ' + E.Message);
|
||
end;
|
||
|
||
colName := 'LcStatus';
|
||
tmpStrs := LoadFromStringsQuery(AQuery, colName);
|
||
if tmpStrs.Count > 0 then Result := tmpStrs.Strings[0];
|
||
tmpStrs.Free;
|
||
end;
|
||
|
||
class function TMachineMst.xGetStrMachineMstTotalCount(
|
||
AQuery: TFDQuery): string;
|
||
var
|
||
sql, colName: string;
|
||
tmpStrs: TStrings;
|
||
begin
|
||
Result := '';
|
||
sql := 'SELECT COUNT(*)' + ' FROM "MachineMst"';
|
||
sql := sql + ' WHERE "IsValid"=' + xAddSqlMark('t');
|
||
|
||
try
|
||
AQuery.Close;
|
||
AQuery.SQL.Text := sql;
|
||
AQuery.Open;
|
||
except
|
||
on E: Exception do ShowMessage('xGetStrMachineMstTotalCount <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>: ' + E.Message);
|
||
end;
|
||
|
||
colName := 'COUNT';
|
||
tmpStrs := LoadFromStringsQuery(AQuery, colName);
|
||
if tmpStrs.Count > 0 then Result := tmpStrs.Strings[0];
|
||
tmpStrs.Free;
|
||
end;
|
||
|
||
class function TMachineMst.xGetStrsDistinctColumnName(AQuery: TFDQuery;
|
||
colName: string): TStrings;
|
||
var
|
||
sql: string;
|
||
begin
|
||
Result := nil;
|
||
sql := 'SELECT DISTINCT ' + xAddSqlDoubleMark(colName) + ' FROM "MachineMst"';
|
||
sql := sql + ' WHERE "IsValid"=' + xAddSqlMark('t');
|
||
sql := sql + ' AND "IsMachine"=' + xAddSqlMark('t');
|
||
|
||
try
|
||
AQuery.Close;
|
||
AQuery.SQL.Text := sql;
|
||
AQuery.Open;
|
||
except
|
||
on E: Exception do ShowMessage('xGetStrsDistinctColumnName <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>: ' + E.Message);
|
||
end;
|
||
Result := LoadFromStringsQuery(AQuery, colName);
|
||
end;
|
||
|
||
class function TMachineMst.xGetStrsDistinctMachineName(AQuery: TFDQuery; name,
|
||
mtype: string): TStrings;
|
||
var
|
||
sql, colName: string;
|
||
begin
|
||
Result := nil;
|
||
sql := 'SELECT DISTINCT ' + xAddSqlDoubleMark('Name') + ' FROM "MachineMst"';
|
||
sql := sql + ' WHERE "IsValid"=' + xAddSqlMark('t');
|
||
sql := sql + ' AND "IsMachine"=' + xAddSqlMark('t');
|
||
if Length(name) > 0 then sql := sql + ' AND ' + xAddSqlDoubleMark('Name') + '=' + xAddSqlMark(name);
|
||
if Length(mtype) > 0 then sql := sql + ' AND ' + xAddSqlDoubleMark('ProcType') + '=' + xAddSqlMark(mtype);
|
||
|
||
try
|
||
AQuery.Close;
|
||
AQuery.SQL.Text := sql;
|
||
AQuery.Open;
|
||
except
|
||
on E: Exception do ShowMessage('xGetStrsDistinctMachineName <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>: ' + E.Message);
|
||
end;
|
||
colName := 'Name';
|
||
Result := LoadFromStringsQuery(AQuery, colName);
|
||
end;
|
||
|
||
class function TMachineMst.xGetStrsDistinctSinteringMachName(
|
||
AQuery: TFDQuery): TStrings;
|
||
var
|
||
sql, colName: string;
|
||
begin
|
||
Result := nil;
|
||
sql := 'SELECT DISTINCT "Name" FROM "MachineMst"';
|
||
sql := sql + ' WHERE "IsValid"=' + xAddSqlMark('t');
|
||
sql := sql + ' AND "IsMachine"=' + xAddSqlMark('t');
|
||
sql := sql + ' AND ' + xAddSqlDoubleMark('ProcType') + '=' + xAddSqlMark('<27>Ұ<EFBFBD>');
|
||
sql := sql + ' ORDER BY "Name"';
|
||
|
||
try
|
||
AQuery.Close;
|
||
AQuery.SQL.Text := sql;
|
||
AQuery.Open;
|
||
except
|
||
on E: Exception do ShowMessage('xGetStrsDistinctSinteringMachName <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>: ' + E.Message);
|
||
end;
|
||
colName := 'Name';
|
||
Result := LoadFromStringsQuery(AQuery, colName);
|
||
end;
|
||
|
||
class function TMachineMst.xGetStrSqlMachineMstList(AQuery: TFDQuery; kindStr,
|
||
codeStr, nameStr: string): TList;
|
||
var
|
||
sql: string;
|
||
begin
|
||
Result := nil;
|
||
sql := 'SELECT * FROM "MachineMst"';
|
||
sql := sql + ' WHERE "IsValid"=' + xAddSqlMark('t');
|
||
sql := sql + ' AND "IsMachine"=' + xAddSqlMark('t');
|
||
if Length(Trim(kindStr)) > 0 then sql := sql + ' AND "ProcType"=' + xAddSqlMark(kindStr);
|
||
if Length(Trim(codeStr)) > 0 then sql := sql + ' AND "MachCode"=' + xAddSqlMark(codeStr);
|
||
if Length(Trim(nameStr)) > 0 then sql := sql + ' AND "Name"=' + xAddSqlMark(nameStr);
|
||
// sql := sql + ' ORDER BY "NilmID", "ChannelNum"';
|
||
sql := sql + ' ORDER BY "MachCode"';
|
||
|
||
try
|
||
AQuery.Close;
|
||
AQuery.SQL.Text := sql;
|
||
AQuery.Open;
|
||
except
|
||
on E: Exception do ShowMessage('xGetStrSqlMachineMstList <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>: ' + E.Message);
|
||
end;
|
||
Result := LoadFromQuery(AQuery);
|
||
end;
|
||
|
||
end.
|
||
|