浏览代码

无中间计量数据时,下方显示详细信息不应报错

MaiXinRong 7 年之前
父节点
当前提交
831f1dc22d
共有 2 个文件被更改,包括 5 次插入3 次删除
  1. 2 2
      DataModules/BillsMeasureDm.pas
  2. 3 1
      Frames/ZJJLFme.pas

+ 2 - 2
DataModules/BillsMeasureDm.pas

@@ -434,7 +434,7 @@ procedure TBillsMeasureData.sdvBillsMeasureSetText(var Text: String;
 var
   vNode: TBillsIDTreeNode;
 begin
-  {if not Assigned(AValue) then Exit;
+  if not Assigned(AValue) then Exit;
   // 修改后数据与原数据相同则不提交
   if not CheckValidData then
     Allow := False;
@@ -450,7 +450,7 @@ begin
 
   Text := Trim(Text);
   if Pos('=', Text) = 1 then
-    Text := Copy(Text, 2, Length(Text) - 1);  }
+    Text := Copy(Text, 2, Length(Text) - 1);
 
   DoCurChanged(vNode);
 end;

+ 3 - 1
Frames/ZJJLFme.pas

@@ -280,7 +280,9 @@ procedure TZJJLFrame.zgDetailInfoGetCellText(Sender: TObject;
     Rec: TsdDataRecord;
   begin
     Rec := saZJJL.DataView.Current;
-    if Rec.ValueByName('Type').AsInteger = Integer(ztFx) then
+    if not Assigned(Rec) then
+      Result := Format(RowFormats[riCurGatherMeasure], ['', ''])
+    else if Rec.ValueByName('Type').AsInteger = Integer(ztFx) then
       Result := Format(RowFormats[riCurGatherMeasure], ['½ð¶î', GetFloatStr(FZJJLData.GetZJJLCalcData(Rec, 'GatherTotalPrice'))])
     else
       Result := Format(RowFormats[riCurGatherMeasure], ['ÊýÁ¿', GetFloatStr(FZJJLData.GetZJJLCalcData(Rec, 'GatherQuantity'))]);