|
@@ -100,6 +100,8 @@ type
|
|
|
cdsZjjlDanWeiName: TWideStringField;
|
|
|
private
|
|
|
FZjjlList: TList;
|
|
|
+ FPreText: string;
|
|
|
+ FPhaseIndex: Integer;
|
|
|
function FindZjjl(ARec: TsdDataRecord; ANode: TBillsIDTreeNode): TZjjl;
|
|
|
|
|
|
procedure GatherZjjl(AProjectData: TProjectData);
|
|
@@ -314,6 +316,8 @@ begin
|
|
|
try
|
|
|
if AProjectData.PhaseData.Active then
|
|
|
begin
|
|
|
+ FPreText := AProjectData.PhaseData.PhaseProperty.ZJJLPreText;
|
|
|
+ FPhaseIndex := AProjectData.PhaseIndex;
|
|
|
GatherZjjl(AProjectData);
|
|
|
WriteData;
|
|
|
end;
|
|
@@ -378,18 +382,45 @@ begin
|
|
|
end;
|
|
|
|
|
|
procedure TrmWeiWuZjjlGatherData.WriteData;
|
|
|
+
|
|
|
+ function GetCodeFormat(ACount: Integer): string;
|
|
|
+ begin
|
|
|
+ if ACount < 10 then
|
|
|
+ Result := '-%d'
|
|
|
+ else if ACount < 100 then
|
|
|
+ REsult := '-%2d'
|
|
|
+ else if ACount < 1000 then
|
|
|
+ Result := '-%3d'
|
|
|
+ else if ACount < 10000 then
|
|
|
+ Result := '-%4d'
|
|
|
+ else if ACount < 100000 then
|
|
|
+ Result := '-%5d';
|
|
|
+ end;
|
|
|
+
|
|
|
+ function GetFormatStr(AIndex: Integer; const sFormat: string): string;
|
|
|
+ begin
|
|
|
+ Result := Format(sFormat, [AIndex]);
|
|
|
+ Result := StringReplace(Result, ' ', '0', [rfReplaceAll]);
|
|
|
+ end;
|
|
|
+
|
|
|
var
|
|
|
i: Integer;
|
|
|
vZ: TZjjl;
|
|
|
-begin
|
|
|
+ sPre, sCode, sFormat: String;
|
|
|
+begin
|
|
|
cdsZjjl.Active := True;
|
|
|
cdsZjjl.EmptyDataSet;
|
|
|
+ if FPreText <> '' then
|
|
|
+ sPre := FPreText + GetFormatStr(FPhaseIndex, '-%02d')
|
|
|
+ else
|
|
|
+ sPre := FPreText + GetFormatStr(FPhaseIndex, '%02d');
|
|
|
+ sFormat := GetCodeFormat(FZjjlList.Count);
|
|
|
for i := 0 to FZjjlList.Count - 1 do
|
|
|
begin
|
|
|
vZ := TZjjl(FZjjlList.Items[i]);
|
|
|
|
|
|
cdsZjjl.Append;
|
|
|
- cdsZjjlCode.AsString := vZ.FCode;
|
|
|
+ cdsZjjlCode.AsString := sPre + GetFormatStr(i+1, sFormat);
|
|
|
cdsZjjlCertificateCode.AsString := vZ.FCertificateCode;
|
|
|
cdsZjjlBGLCode.AsString := vZ.FBGLCode;
|
|
|
cdsZjjlPegName.AsString := vZ.FPegName;
|