瀏覽代碼

1. 云南项目,拉取附件,报错内存溢出
2. 清单汇总,根据清单单价是否为0的过滤,只用于签约清单。

MaiXinRong 5 年之前
父節點
當前提交
c9db622800
共有 3 個文件被更改,包括 41 次插入48 次删除
  1. 2 1
      DataModules/PHPWebDm.pas
  2. 2 2
      Units/GclBillsGatherModel.pas
  3. 37 45
      Units/UpFileManageUnit.pas

+ 2 - 1
DataModules/PHPWebDm.pas

@@ -152,7 +152,7 @@ function ExeCategoryName: string;
 implementation
 
 uses
-  MD5Unit, IdMultipartFormData, VCLUnZip, VCLZip,
+  MD5Unit, IdMultipartFormData, VCLUnZip, VCLZip, Globals,
   IniFiles, Forms, UtilMethods, Variants, ConstUnit, ScUtils, superobject;{, Controls, Windows}
 
 var g_PHPWeb: TPHPWeb;
@@ -455,6 +455,7 @@ var
   vJson: TCslJson;
   vIdHTTP: TIdHTTP;
 begin
+  MeasureLog.AppendLogTo(AURL);
   Result := -1;
   postList := TStringList.Create;
   ssResponse := TStringStream.Create('');

+ 2 - 2
Units/GclBillsGatherModel.pas

@@ -568,7 +568,6 @@ begin
   for i := 0 to FGcls.Count - 1 do
   begin
     vGcl := TGclNode(FGcls.Items[i]);
-    if (PriceRoundTo(vGcl.Price) = 0) then Continue;
 
     FGather.TotalPrice := FGather.TotalPrice + vGcl.TotalPrice;
 
@@ -592,7 +591,8 @@ begin
     FGather.AddQcTotalPrice := FGather.AddQcTotalPrice + vGcl.AddQcTotalPrice;
     FGather.AddGatherTotalPrice := FGather.AddGatherTotalPrice + vGcl.AddGatherTotalPrice;
 
-    FGather.DealTotalPrice := FGather.DealTotalPrice + vGcl.DealTotalPrice;
+    if (PriceRoundTo(vGcl.Price) <> 0) then
+      FGather.DealTotalPrice := FGather.DealTotalPrice + vGcl.DealTotalPrice;
     FGather.BGLTotalPrice := FGather.BGLTotalPrice + vGcl.BGLTotalPrice;
   end;
 

+ 37 - 45
Units/UpFileManageUnit.pas

@@ -127,7 +127,7 @@ type
 implementation
 
 uses ProjectData, Forms, PHPWebDm, CslJson, ConstUnit, UtilMethods,
-  StdConvs;
+  StdConvs, superobject;
 
 { TUpFile }
 
@@ -262,54 +262,46 @@ begin
 end;
 
 procedure TUpFiles.LoadDatas;
-var vArrFile: TOVArr;
-  i, iBillID: Integer;
-  vFile: TUpFile;
+
+  procedure LoadData(AFile: ISuperObject);
+  var
+    vFile: TUpFile;
+  begin
+    vFile := Add(AFile.I['itemid']);
+    vFile.DownURL := AFile.S['downurl'];
+    vFile.DisplayName := AFile.S['filename'];
+    vFile.LocalFile := FPath + vFile.DisplayName;
+    vFile.UperName := AFile.S['ownerName'];
+    vFile.Category := AFile.S['Category'];
+    vFile.Memo := AFile.S['Memo'];
+    vFile.UperID := AFile.I['owmerid'];
+    vFile.UpTime := AFile.S['uptime'];
+    vFile.ID := AFile.I['fileid'];
+    vFile.Phase := AFile.I['phase'];
+    vFile.WebID := TProjectData(FProjectData).WebID;
+    vFile.Status := ufsNormal;
+  end;
+
+var
+  i, iCount: Integer;
+  sUrl, sInfo: string;
+  vJ: ISuperObject;
 begin
-  if G_IsCloud then
+  if not G_IsCloud then Exit;
+
+  sUrl := Format('%stender/attachment/%d/list', [PHPWeb.MeasureURL, TProjectData(FProjectData).WebID]);
+  if PHPWeb.UrlGet(sUrl, nil, sInfo) = 1 then
   begin
-    if PHPWeb.GetAttachmentList(TProjectData(FProjectData).WebID, vArrFile) then
-    begin
-      for i := Low(vArrFile) to High(vArrFile) do
-      begin
-        iBillID := StrToInt(vArrFile[i, 4]);
-        vFile := Add(iBillID);    // AAAAA
-        vFile.DownURL := vArrFile[i, 0];
-        vFile.DisplayName := vArrFile[i, 1];
-        vFile.LocalFile := FPath + vArrFile[i, 1];
-        vFile.UperName := vArrFile[i, 3];
-        vFile.Category := vArrFile[i, 5];
-        vFile.Memo := vArrFile[i, 6];
-        vFile.UperID := StrToInt(vArrFile[i, 7]);
-        vFile.UpTime := vArrFile[i, 8];
-        vFile.ID := StrToInt(vArrFile[i, 9]);
-        vFile.Phase := StrToInt(vArrFile[i, 10]);     // vArrFile[i, 2] ÎļþÀ©Õ¹Ãû
-        vFile.WebID := TProjectData(FProjectData).WebID;
-        vFile.Status := ufsNormal;
-      end;
+    vJ := SO(sInfo);
+    try
+      if not Assigned(vJ.AsArray) then Exit;
+      iCount := vJ.AsArray.Length;
+      for i := 0 to iCount - 1 do
+        LoadData(vJ.AsArray.O[i]);
+    finally
+      vJ := nil;
     end;
   end;
-//  else
-//  begin
-//    FLocalQue.Close;
-//    FLocalQue.SQL.Text := 'Select * from AttachmentFile order by ID';
-//    FLocalQue.Open;
-//    FLocalQue.First;
-//
-//    while not FLocalQue.Eof do
-//    begin
-//      iBillID := FLocalQue.FieldByName('BillID').AsInteger;
-//      iPhase := FLocalQue.FieldByName('Phase').AsInteger;
-//      vFile := Add(iBillID, iPhase);
-//      vFile.ID := FLocalQue.FieldByName('ID').AsInteger;
-//      vFile.LocalFile := FPath + FLocalQue.FieldByName('FileName').AsString;
-//      vFile.DisplayName := FLocalQue.FieldByName('FileName').AsString;
-//
-//      FLocalQue.Next;
-//    end;
-//
-//    FLocalCon.Close;
-//  end;
 end;
 
 procedure TUpFile.SetID(const Value: Integer);