|
@@ -144,6 +144,9 @@ type
|
|
|
procedure cdsBGBillsViewPriceSetText(Sender: TField;
|
|
procedure cdsBGBillsViewPriceSetText(Sender: TField;
|
|
|
const Text: String);
|
|
const Text: String);
|
|
|
procedure cdsBGLViewCodeChange(Sender: TField);
|
|
procedure cdsBGLViewCodeChange(Sender: TField);
|
|
|
|
|
+ procedure cdsScjtBGlViewBeforePost(DataSet: TDataSet);
|
|
|
|
|
+ procedure cdsScjtBGlViewBeforeDelete(DataSet: TDataSet);
|
|
|
|
|
+ procedure cdsScjtBGlViewNewRecord(DataSet: TDataSet);
|
|
|
private
|
|
private
|
|
|
FProjectData: TObject;
|
|
FProjectData: TObject;
|
|
|
|
|
|
|
@@ -687,4 +690,65 @@ begin
|
|
|
end;
|
|
end;
|
|
|
end;
|
|
end;
|
|
|
|
|
|
|
|
|
|
+procedure TBGLData.cdsScjtBGlViewBeforePost(DataSet: TDataSet);
|
|
|
|
|
+var
|
|
|
|
|
+ iIncrement: Integer;
|
|
|
|
|
+ sNewCode: string;
|
|
|
|
|
+begin
|
|
|
|
|
+ // 变更令号不可为空
|
|
|
|
|
+ if cdsScjtBGLViewCode.AsString = '' then
|
|
|
|
|
+ begin
|
|
|
|
|
+ cdsBGLViewCode.Tag := 0;
|
|
|
|
|
+ if cdsBGL.FindKey([cdsScjtBGLViewID.AsInteger]) then
|
|
|
|
|
+ if cdsBGLCode.AsString <> '' then
|
|
|
|
|
+ WarningMessage('变更令号不允许为空,如需删除,请点击右键进行删除。');
|
|
|
|
|
+ DataSet.Cancel;
|
|
|
|
|
+ Abort;
|
|
|
|
|
+ end;
|
|
|
|
|
+
|
|
|
|
|
+ if cdsScjtBGLViewCode.Tag = 1 then
|
|
|
|
|
+ begin
|
|
|
|
|
+ cdsScjtBGLViewCode.Tag := 0;
|
|
|
|
|
+
|
|
|
|
|
+ if CheckBGLUsed(cdsScjtBGLViewID.AsInteger) then
|
|
|
|
|
+ begin
|
|
|
|
|
+ ErrorMessage('当前变更令下变更清单已被应用到清单,不可修改!');
|
|
|
|
|
+ Abort;
|
|
|
|
|
+ end;
|
|
|
|
|
+
|
|
|
|
|
+ sNewCode := cdsScjtBGLViewCode.AsString;
|
|
|
|
|
+ if Pos(';', sNewCode) > 0 then
|
|
|
|
|
+ begin
|
|
|
|
|
+ ErrorMessage('变更令号不可输入'';'',请使用其他符号代替!');
|
|
|
|
|
+ Abort;
|
|
|
|
|
+ end;
|
|
|
|
|
+
|
|
|
|
|
+ // 相同变更令号应递增[1],[2]...
|
|
|
|
|
+ iIncrement := 1;
|
|
|
|
|
+ while LocateBGL(sNewCode) and (cdsBGLID.AsInteger <> cdsScjtBGLViewID.AsInteger) do
|
|
|
|
|
+ begin
|
|
|
|
|
+ sNewCode := Format('%s[%d]', [cdsScjtBGLViewCode.AsString, iIncrement]);
|
|
|
|
|
+ Inc(iIncrement);
|
|
|
|
|
+ end;
|
|
|
|
|
+ if cdsScjtBGLViewCode.AsString <> sNewCode then
|
|
|
|
|
+ begin
|
|
|
|
|
+ cdsScjtBGLViewCode.AsString := sNewCode;
|
|
|
|
|
+ cdsScjtBGLViewCode.Tag := 0;
|
|
|
|
|
+ end;
|
|
|
|
|
+ end;
|
|
|
|
|
+end;
|
|
|
|
|
+
|
|
|
|
|
+procedure TBGLData.cdsScjtBGlViewBeforeDelete(DataSet: TDataSet);
|
|
|
|
|
+begin
|
|
|
|
|
+ if CheckBGLUsed(cdsScjtBGLViewID.AsInteger) then
|
|
|
|
|
+ raise Exception.Create('变更令下变更清单已被应用到清单,不可删除!');
|
|
|
|
|
+ DeleteBGBills(cdsScjtBGLViewID.AsInteger);
|
|
|
|
|
+end;
|
|
|
|
|
+
|
|
|
|
|
+procedure TBGLData.cdsScjtBGlViewNewRecord(DataSet: TDataSet);
|
|
|
|
|
+begin
|
|
|
|
|
+ cdsScjtBGLViewID.AsInteger := GetNewIDOfIndex(cdsBGL);
|
|
|
|
|
+ cdsScjtBGLViewCreatePhaseID.AsInteger := TProjectData(FProjectData).PhaseIndex;
|
|
|
|
|
+end;
|
|
|
|
|
+
|
|
|
end.
|
|
end.
|