|
|
@@ -174,8 +174,8 @@ type
|
|
|
procedure BeginAllOperate;
|
|
|
// Connect InterFace
|
|
|
procedure EndAllOperate;
|
|
|
- function LoadMachineFromRationLib(AGLJKey: string; var ARationLib: TObject): TsdDataRecord;
|
|
|
- function AddMachineDetailFromLib(AMachineID: Integer; AGLJKey: string; ARationLib: TObject): Boolean;
|
|
|
+ function LoadMachineFromRationLib(AGLJKey: string; var AProjectRationLib: TObject): TsdDataRecord;
|
|
|
+ function AddMachineDetailFromLib(AMachineID: Integer; AGLJKey: string; AProjectRationLib: TObject): Boolean;
|
|
|
procedure DeleteMachineDetail(AMachineID: Integer);
|
|
|
public
|
|
|
{ Public declarations }
|
|
|
@@ -231,6 +231,8 @@ type
|
|
|
function GetFuelQuantity(AMachineID: Integer; AName: string): Double;
|
|
|
// 赋值动力燃料数量
|
|
|
function SetFuelQuantity(AMachineID: Integer; AName: string; AQuantity: Double): Boolean;
|
|
|
+ // 定额库被使用
|
|
|
+ function LibUsed(ALibID: Integer): Boolean;
|
|
|
// 是否修改
|
|
|
property Modified: Boolean read GetModified;
|
|
|
// 获得机械价格
|
|
|
@@ -525,7 +527,7 @@ var
|
|
|
Rec: TScMachinePriceRecord;
|
|
|
DataRec: TsdDataRecord;
|
|
|
objLib: TObject;
|
|
|
- RationLib: TScRationLib;
|
|
|
+ ProjectRationLib: TScProjectRationLib;
|
|
|
begin
|
|
|
Result := False;
|
|
|
Rec := LocateMachine(AID);
|
|
|
@@ -535,7 +537,7 @@ begin
|
|
|
ResolveGLJKeys(strKeys, strCode, strName, strSpecs, strUnit);
|
|
|
// 先查找定额库中是否有此机械台班
|
|
|
DataRec := LoadMachineFromRationLib(strKeys, objLib);
|
|
|
- RationLib := TScRationLib(objLib);
|
|
|
+ ProjectRationLib := TScProjectRationLib(objLib);
|
|
|
// 所有定额库中找不到,则到MachineCalcData.dat中找部颁台班
|
|
|
if DataRec = nil then
|
|
|
DataRec := CustomMachine.FindMachineData(strKeys);
|
|
|
@@ -566,10 +568,10 @@ begin
|
|
|
Rec.TRQ.AsCurrency := DataRec.ValueByName(STRQ).AsCurrency;
|
|
|
Rec.YLCC.AsCurrency := GetFeeTax(strKeys);
|
|
|
Rec.RGType.AsInteger := DataRec.ValueByName(SRGType).AsInteger;
|
|
|
- if RationLib <> nil then
|
|
|
+ if ProjectRationLib <> nil then
|
|
|
begin
|
|
|
- Rec.LibID.AsInteger := RationLib.ID;
|
|
|
- AddMachineDetailFromLib(AID, strKeys, RationLib);
|
|
|
+ Rec.LibID.AsInteger := ProjectRationLib.ID;
|
|
|
+ AddMachineDetailFromLib(AID, strKeys, ProjectRationLib);
|
|
|
end
|
|
|
else
|
|
|
Rec.LibID.AsInteger := -1;
|
|
|
@@ -650,6 +652,9 @@ procedure TMachineData.Save;
|
|
|
var
|
|
|
I: Integer;
|
|
|
List: TList;
|
|
|
+ DetailRec: TScMachineDetailRecord;
|
|
|
+ MachineRec: TScMachinePriceRecord;
|
|
|
+ ProjectRationLib: TScProjectRationLib;
|
|
|
begin
|
|
|
// (删除错误的记录,错误记录的编号为0)
|
|
|
List := TList.Create;
|
|
|
@@ -667,6 +672,28 @@ begin
|
|
|
sdsMachinePrice.Save;
|
|
|
sdsMachineDetail.Save;
|
|
|
sdsMachineLabours.Save;
|
|
|
+
|
|
|
+ // 如果引用了有MachineDetail数据的定额库,则需要给文件加入提示,限制旧版本使用
|
|
|
+ for I := 0 to sdsMachineDetail.RecordCount - 1 do
|
|
|
+ begin
|
|
|
+ DetailRec := TScMachineDetailRecord(sdsMachineDetail[I]);
|
|
|
+ MachineRec := LocateMachine(DetailRec.OwnerID.AsInteger);
|
|
|
+ ProjectRationLib := TScProject(FProject).RationLibs.Libs[MachineRec.LibID.AsInteger];
|
|
|
+ if ProjectRationLib <> nil then
|
|
|
+ begin
|
|
|
+ // 10.1.5.1012版本前不支持MachineDetail
|
|
|
+ TScProjBaseData(TScProject(FProject).ProjData).Connection.FileArchiver.AddFileVerMsg(
|
|
|
+ Format('10.1.5.1012 当前版本不支持%s', [ProjectRationLib.LibName]));
|
|
|
+ Break;
|
|
|
+ end
|
|
|
+ else
|
|
|
+ begin
|
|
|
+ // 10.1.5.1012版本前不支持MachineDetail
|
|
|
+ TScProjBaseData(TScProject(FProject).ProjData).Connection.FileArchiver.AddFileVerMsg(
|
|
|
+ '10.1.5.1012 当前版本不支持新的机械台班');
|
|
|
+ Break;
|
|
|
+ end
|
|
|
+ end;
|
|
|
end;
|
|
|
|
|
|
function TMachineData.LocateInControl(AID: Integer): Boolean;
|
|
|
@@ -1430,7 +1457,7 @@ begin
|
|
|
end;
|
|
|
|
|
|
function TMachineData.LoadMachineFromRationLib(
|
|
|
- AGLJKey: string; var ARationLib: TObject): TsdDataRecord;
|
|
|
+ AGLJKey: string; var AProjectRationLib: TObject): TsdDataRecord;
|
|
|
var
|
|
|
I, J, K: Integer;
|
|
|
ProjectRationLib: TScProjectRationLib;
|
|
|
@@ -1438,7 +1465,7 @@ var
|
|
|
DetailRec: TsdDataRecord;
|
|
|
begin
|
|
|
Result := nil;
|
|
|
- ARationLib := nil;
|
|
|
+ AProjectRationLib := nil;
|
|
|
// 查找定额库中有没有指定机械台班
|
|
|
for I := 0 to TScProject(FProject).RationLibs.Count - 1 do
|
|
|
begin
|
|
|
@@ -1451,7 +1478,7 @@ begin
|
|
|
DetailRec := LocateByKeys(RationLib.sdsMachinePrice, AGLJKey);
|
|
|
if DetailRec <> nil then
|
|
|
begin
|
|
|
- ARationLib := RationLib;
|
|
|
+ AProjectRationLib := ProjectRationLib;
|
|
|
Result := DetailRec;
|
|
|
Break;
|
|
|
end;
|
|
|
@@ -1461,25 +1488,25 @@ begin
|
|
|
end;
|
|
|
|
|
|
function TMachineData.AddMachineDetailFromLib(
|
|
|
- AMachineID: Integer; AGLJKey: string; ARationLib: TObject): Boolean;
|
|
|
+ AMachineID: Integer; AGLJKey: string; AProjectRationLib: TObject): Boolean;
|
|
|
var
|
|
|
I, iLibID: Integer;
|
|
|
LibDetailRecord, DetailRecord: TsdDataRecord;
|
|
|
ProjectGLJRecord: TScProjectGLJRecord;
|
|
|
- RationLib: TScRationLib;
|
|
|
+ ProjectRationLib: TScProjectRationLib;
|
|
|
lstDetail: TList;
|
|
|
strCode, strName, strSpecs, strUnit, strKey: string;
|
|
|
begin
|
|
|
Result := False;
|
|
|
- RationLib := TScRationLib(ARationLib);
|
|
|
- iLibID := TScProject(FProject).RationLibs.IDByLibID(RationLib.ID);
|
|
|
+ ProjectRationLib := TScProjectRationLib(AProjectRationLib);
|
|
|
+ iLibID := ProjectRationLib.ID;
|
|
|
lstDetail := TList.Create;
|
|
|
try
|
|
|
// 删除已有记录
|
|
|
DeleteMachineDetail(AMachineID);
|
|
|
// 查找定额库中台班明细
|
|
|
ResolveGLJKeys(AGLJKey, strCode, strName, strSpecs, strUnit);
|
|
|
- RationLib.sdsMachineDetail.FilterBy(
|
|
|
+ ProjectRationLib.Lib.sdsMachineDetail.FilterBy(
|
|
|
Format('OwnerCode=''%s'' AND OwnerName=''%s'' AND OwnerSpecs=''%s'' AND OwnerUnit=''%s''', [strCode, strName, strSpecs, strUnit]),
|
|
|
lstDetail, 'OwnerCode');
|
|
|
for I := 0 to lstDetail.Count - 1 do
|
|
|
@@ -1667,4 +1694,21 @@ begin
|
|
|
ARecordClass := TScMachineDetailRecord;
|
|
|
end;
|
|
|
|
|
|
+function TMachineData.LibUsed(ALibID: Integer): Boolean;
|
|
|
+var
|
|
|
+ I: Integer;
|
|
|
+ Rec: TScMachinePriceRecord;
|
|
|
+begin
|
|
|
+ Result := False;;
|
|
|
+ for I := 0 to sdsMachinePrice.RecordCount - 1 do
|
|
|
+ begin
|
|
|
+ Rec := TScMachinePriceRecord(sdsMachinePrice[I]);
|
|
|
+ if Rec.LibID.AsInteger = ALibID then
|
|
|
+ begin
|
|
|
+ Result := True;
|
|
|
+ Break;
|
|
|
+ end;
|
|
|
+ end;
|
|
|
+end;
|
|
|
+
|
|
|
end.
|