|
@@ -24,6 +24,7 @@ type
|
|
|
FTempGLs: TList;
|
|
|
|
|
|
function CheckSameCode(ACode: Integer): Boolean;
|
|
|
+ function CheckApplied(AGLID: Integer): Boolean;
|
|
|
|
|
|
procedure LoadDetailGLs(AGLID: Integer);
|
|
|
|
|
@@ -202,28 +203,27 @@ end;
|
|
|
|
|
|
procedure TProjectGLData.sddProjectGLBeforeValueChange(AValue: TsdValue;
|
|
|
const NewValue: Variant; var Allow: Boolean);
|
|
|
+var
|
|
|
+ Rec: TProjectGLRecord;
|
|
|
begin
|
|
|
+ Rec := TProjectGLRecord(AValue.Owner);
|
|
|
if SameText(AValue.FieldName, 'Code') then
|
|
|
begin
|
|
|
- Allow := False;
|
|
|
if VarIsNull(NewValue) then
|
|
|
- ErrorMessage('编号不可为空。')
|
|
|
+ DataSetErrorMessage(Allow, '编号不可为空。')
|
|
|
else if CheckSameCode(NewValue) then
|
|
|
- ErrorMessage('编号不可重复。')
|
|
|
- else
|
|
|
- Allow := True;
|
|
|
+ DataSetErrorMessage(Allow, '编号不可重复。')
|
|
|
+ else if CheckApplied(Rec.ID.AsInteger) then
|
|
|
+ DataSetErrorMessage(Allow, '工料已被应用,不可修改编号。');
|
|
|
end
|
|
|
else if not(SameText(AValue.FieldName, 'ID') or
|
|
|
SameText(AValue.FieldName, 'CreatePhaseID')) then
|
|
|
begin
|
|
|
- Allow := False;
|
|
|
- if (AValue.Owner.ValueByName('Code').AsString = '') then
|
|
|
+ if (Rec.Code.AsString = '') then
|
|
|
begin
|
|
|
- ErrorMessage('编号不可为空,请先填写编号,再填写其他信息。');
|
|
|
+ DataSetErrorMessage(Allow, '编号不可为空,请先填写编号,再填写其他信息。');
|
|
|
sddProjectGL.Remove(AValue.Owner);
|
|
|
- end
|
|
|
- else
|
|
|
- Allow := True;
|
|
|
+ end;
|
|
|
end;
|
|
|
end;
|
|
|
|
|
@@ -547,4 +547,10 @@ begin
|
|
|
sddProjectGL.BeginUpdate;
|
|
|
end;
|
|
|
|
|
|
+function TProjectGLData.CheckApplied(AGLID: Integer): Boolean;
|
|
|
+begin
|
|
|
+ LoadDetailGLs(AGLID);
|
|
|
+ Result := FTempGLs.Count > 0;
|
|
|
+end;
|
|
|
+
|
|
|
end.
|