|
@@ -24,6 +24,8 @@ type
|
|
|
procedure sdvBillsMeasureAfterClose(Sender: TObject);
|
|
|
procedure sdvBillsMeasureAfterValueChanged(AValue: TsdValue);
|
|
|
procedure sdvBillsMeasureCurrentChanged(ARecord: TsdDataRecord);
|
|
|
+ procedure sdvBillsMeasureBeforeValueChange(AValue: TsdValue;
|
|
|
+ const NewValue: Variant; var Allow: Boolean);
|
|
|
private
|
|
|
FProjectData: TObject;
|
|
|
FBillsData: TBillsData;
|
|
@@ -434,7 +436,7 @@ begin
|
|
|
if not CheckValidData then
|
|
|
Allow := False;
|
|
|
if not Allow then Exit;
|
|
|
-
|
|
|
+
|
|
|
vNode := TBillsIDTreeNode(BillsMeasureTree.FindNode(GetBillsID));
|
|
|
|
|
|
CheckLockedData;
|
|
@@ -1085,4 +1087,89 @@ begin
|
|
|
Result := ANode;
|
|
|
end;
|
|
|
|
|
|
+procedure TBillsMeasureData.sdvBillsMeasureBeforeValueChange(
|
|
|
+ AValue: TsdValue; const NewValue: Variant; var Allow: Boolean);
|
|
|
+
|
|
|
+ function CheckParentExist(ANode: TBillsIDTreeNode): Boolean;
|
|
|
+ var
|
|
|
+ vParent: TBillsIDTreeNode;
|
|
|
+ begin
|
|
|
+ Result := False;
|
|
|
+ vParent := TBillsIDTreeNode(ANode.Parent);
|
|
|
+ while Assigned(vParent) and not Result do
|
|
|
+ begin
|
|
|
+ if vParent.Rec.IsGatherZJJL.AsBoolean then
|
|
|
+ Result := True;
|
|
|
+ vParent := TBillsIDTreeNode(vParent.Parent);
|
|
|
+ end;
|
|
|
+ end;
|
|
|
+
|
|
|
+ procedure CancelParentCheck(ANode: TBillsIDTreeNode);
|
|
|
+ var
|
|
|
+ vParent: TBillsIDTreeNode;
|
|
|
+ begin
|
|
|
+ vParent := TBillsIDTreeNode(ANode.Parent);
|
|
|
+ while Assigned(vParent) do
|
|
|
+ begin
|
|
|
+ if vParent.Rec.IsGatherZJJL.AsBoolean then
|
|
|
+ vParent.Rec.IsGatherZJJL.AsBoolean := False;
|
|
|
+ vParent := TBillsIDTreeNode(vParent.Parent);
|
|
|
+ end;
|
|
|
+ end;
|
|
|
+
|
|
|
+ function CheckChildrenExist(ANode: TBillsIDTreeNode): Boolean;
|
|
|
+ var
|
|
|
+ iChild: Integer;
|
|
|
+ vChild: TBillsIDTreeNode;
|
|
|
+ begin
|
|
|
+ Result := False;
|
|
|
+ for iChild := 0 to ANode.ChildCount - 1 do
|
|
|
+ begin
|
|
|
+ vChild := TBillsIDTreeNode(ANode.ChildNodes[iChild]);
|
|
|
+ if vChild.Rec.IsGatherZJJL.AsBoolean or CheckChildrenExist(vChild) then
|
|
|
+ begin
|
|
|
+ Result := True;
|
|
|
+ Break;
|
|
|
+ end;
|
|
|
+ end;
|
|
|
+ end;
|
|
|
+
|
|
|
+ procedure CancelChildrenCheck(ANode: TBillsIDTreeNode);
|
|
|
+ var
|
|
|
+ iChild: Integer;
|
|
|
+ vChild: TBillsIDTreeNode;
|
|
|
+ begin
|
|
|
+ for iChild := 0 to ANode.ChildCount - 1 do
|
|
|
+ begin
|
|
|
+ vChild := TBillsIDTreeNode(ANode.ChildNodes[iChild]);
|
|
|
+ if vChild.Rec.IsGatherZJJL.AsBoolean then
|
|
|
+ vChild.Rec.IsGatherZJJL.AsBoolean := False
|
|
|
+ else
|
|
|
+ CancelChildrenCheck(vChild);
|
|
|
+ end;
|
|
|
+ end;
|
|
|
+
|
|
|
+var
|
|
|
+ vNode: TBillsIDTreeNode;
|
|
|
+begin
|
|
|
+ vNode := TBillsIDTreeNode(BillsMeasureTree.FindNode(AValue.Owner.ValueByName('ID').AsInteger));
|
|
|
+ if SameText(AValue.FieldName, 'IsGatherZJJL') and NewValue then
|
|
|
+ begin
|
|
|
+ if CheckParentExist(vNode) then
|
|
|
+ begin
|
|
|
+ if QuestMessage('父项已勾选,继续将取消父项勾选。') then
|
|
|
+ CancelParentCheck(vNode)
|
|
|
+ else
|
|
|
+ Allow := False;
|
|
|
+ end
|
|
|
+ else if CheckChildrenExist(vNode) then
|
|
|
+ begin
|
|
|
+ if QuestMessage('子项已勾选,继续将取消子项勾选。') then
|
|
|
+ CancelChildrenCheck(vNode)
|
|
|
+ else
|
|
|
+ Allow := False;
|
|
|
+ end;
|
|
|
+ end;
|
|
|
+end;
|
|
|
+
|
|
|
end.
|