Forráskód Böngészése

Merge branch 'master' of http://192.168.1.12:3000/maixinrong/measure

builder 8 éve
szülő
commit
2e2bea8019

+ 47 - 1
DataModules/PHPWebDm.pas

@@ -115,7 +115,8 @@ type
     function UploadFiles(AUrl: string; AInFields, AInValues: array of string;
       AUpFileFields, AUpFileNames: array of string; var ErrorMessage: string): Boolean;
 
-    function UrlGet(AUrl: string; APostParam: TStrings; var AResult: TStrings): Integer;
+    function UrlGet(AUrl: string; APostParam: TStrings; var AResult: string): Integer; overload;
+    function UrlGet(AUrl: string; APostParam: TStrings; var AResult: TStrings): Integer; overload;
 
     property Account: string read FAccount write SetAccount;
     property UserID: Integer read FUserID write SetUserID;
@@ -908,6 +909,51 @@ begin
   end;
 end;
 
+function TPHPWeb.UrlGet(AUrl: string; APostParam: TStrings;
+  var AResult: string): Integer;
+var
+  i: Integer;
+  ssResponse: TStringStream;
+  vJson: TCslJson;
+  vIdHTTP: TIdHTTP;
+begin
+  Result := -1;
+  AResult := '';
+  ssResponse := TStringStream.Create('');
+  vIdHTTP := TIdHTTP.Create(nil);
+  try
+    vIdHTTP.Post(AUrl, APostParam, ssResponse);
+    if (Pos('200 OK', vIdHTTP.ResponseText) <> 0) then
+    begin
+      // Analyse Result Json
+      vJson := TCslJson.Create;
+      try
+        vJson.Text := Utf8ToAnsi(ssResponse.DataString);
+        if SameText(vJson.Value['status'], 'true') then
+        begin
+          AResult := vJson.Value['info'];
+          Result := 1;
+        end
+        else if SameText(vJson.Value['status'], 'false') then
+        begin
+          AResult := vJson.Value['msg'];
+          Result := 0;
+        end
+        else
+        begin
+          AResult := '²éѯÊý¾Ý³ö´í, ÇëÖØÊÔ';
+          Result := 0;
+        end;
+      finally
+        vJson.Free;
+      end;
+    end;
+  finally
+    vIdHTTP.Free;
+    ssResponse.Free;
+  end;
+end;
+
 initialization
 
 finalization

+ 33 - 2
DataModules/ReportMemoryDm/rmWeiWuZjjlGatherDm.pas

@@ -100,6 +100,8 @@ type
     cdsZjjlDanWeiName: TWideStringField;
   private
     FZjjlList: TList;
+    FPreText: string;
+    FPhaseIndex: Integer;
     function FindZjjl(ARec: TsdDataRecord; ANode: TBillsIDTreeNode): TZjjl;
 
     procedure GatherZjjl(AProjectData: TProjectData);
@@ -314,6 +316,8 @@ begin
   try
     if AProjectData.PhaseData.Active then
     begin
+      FPreText := AProjectData.PhaseData.PhaseProperty.ZJJLPreText;
+      FPhaseIndex := AProjectData.PhaseIndex;
       GatherZjjl(AProjectData);
       WriteData;
     end;
@@ -378,18 +382,45 @@ begin
 end;
 
 procedure TrmWeiWuZjjlGatherData.WriteData;
+
+  function GetCodeFormat(ACount: Integer): string;
+  begin
+    if ACount < 10 then
+      Result := '-%d'
+    else if ACount < 100 then
+      REsult := '-%2d'
+    else if ACount < 1000 then
+      Result := '-%3d'
+    else if ACount < 10000 then
+      Result := '-%4d'
+    else if ACount < 100000 then
+      Result := '-%5d';
+  end;
+
+  function GetFormatStr(AIndex: Integer; const sFormat: string): string;
+  begin
+    Result := Format(sFormat, [AIndex]);
+    Result := StringReplace(Result, ' ', '0', [rfReplaceAll]);
+  end;
+
 var
   i: Integer;
   vZ: TZjjl;
-begin       
+  sPre, sCode, sFormat: String;
+begin
   cdsZjjl.Active := True;
   cdsZjjl.EmptyDataSet;
+  if FPreText <> '' then
+    sPre := FPreText + GetFormatStr(FPhaseIndex, '-%02d')
+  else
+    sPre := FPreText + GetFormatStr(FPhaseIndex, '%02d');
+  sFormat := GetCodeFormat(FZjjlList.Count);
   for i := 0 to FZjjlList.Count - 1 do
   begin
     vZ := TZjjl(FZjjlList.Items[i]);
 
     cdsZjjl.Append;
-    cdsZjjlCode.AsString := vZ.FCode;
+    cdsZjjlCode.AsString := sPre + GetFormatStr(i+1, sFormat);
     cdsZjjlCertificateCode.AsString := vZ.FCertificateCode;
     cdsZjjlBGLCode.AsString := vZ.FBGLCode;
     cdsZjjlPegName.AsString := vZ.FPegName;

+ 1 - 0
DataModules/ZJJLDm.pas

@@ -540,6 +540,7 @@ procedure TZJJLData.CheckZjjlVerison;
 begin
   if TPhaseData(PhaseData).PhaseProperty.ZjjlVersion = 0 then
   begin
+    TPhaseData(PhaseData).PhaseProperty.ZJJLPreText := TProjectData(TPhaseData(PhaseData).ProjectData).ProjProperties.ZJJLPreText;
     LoadVersion0Info;
     LoadVersion0History;
   end;

+ 1 - 0
Frames/ProjectManagerFme.dfm

@@ -524,6 +524,7 @@ object ProjectManagerFrame: TProjectManagerFrame
       end
       item
         BeginGroup = True
+        Item = MainForm.dxbtnSignOnline
         Visible = True
       end
       item

+ 26 - 2
Frames/ProjectManagerFme.pas

@@ -130,6 +130,8 @@ type
     FCurPos: Integer;                         // 用来控制审核人的添加位置
     FCheckerList: TObjectList;
 
+    FSignOnlineSwitch: Integer;
+
     function ReceiveFile(const AFileName: string; AIsReback: Boolean = False): Boolean;
     function ImportFile(const AFileName: string; AFileMD5: string = ''): Boolean;
     procedure ConnectButtonWithAction;
@@ -158,6 +160,8 @@ type
     function FileDownAndReceive(ADownURL: string; AReceiveKind: Integer): Boolean;
     // 线上审批的起止人
     procedure OnLineChecker(AAr: TOVArr; var ABegin, AEnd: Integer; var AOnLineEndIsOwner: Boolean);
+
+    procedure LoadSignOnlineSwitch;
   public
     constructor Create(AOwner: TComponent); override;
     destructor Destroy; override;
@@ -212,6 +216,8 @@ begin
     Application.HintPause := 200;
     Application.HintHidePause := 60000;
 
+    LoadSignOnlineSwitch;
+
     tobtnImport.Visible := False;
     stdProjects.TreeOptions := stdProjects.TreeOptions - [aoAllowUpLevel, aoAllowDownLevel];
     stdProjects.Options := stdProjects.Options - [aoAllowUpMove, aoAllowDownMove];
@@ -1867,7 +1873,10 @@ procedure TProjectManagerFrame.actnSignOnlineExecute(Sender: TObject);
 var
   iPhase: Integer;
 begin
-  if SelectOnlineSignPhase(iPhase, stdProjects.IDTree.Selected.Rec) then
+  LoadSignOnlineSwitch;
+  if (FSignOnlineSwitch = 0) then
+    WarningMessage('云端未开启在线签署功能。')
+  else if SelectOnlineSignPhase(iPhase, stdProjects.IDTree.Selected.Rec) then
     SignOnline(stdProjects.IDTree.Selected, iPhase);
 end;
 
@@ -1885,9 +1894,24 @@ procedure TProjectManagerFrame.actnSignOnlineUpdate(Sender: TObject);
 
 begin
   TAction(Sender).Visible := _IsCloud;
-  TAction(Sender).Enabled := Assigned(stdProjects.IDTree.Selected) and
+  TAction(Sender).Enabled := (FSignOnlineSwitch = 1) and
+       Assigned(stdProjects.IDTree.Selected) and
       (stdProjects.IDTree.Selected.Rec.ValueByName('Type').AsInteger = 1) and
       HasCompletePhase(stdProjects.IDTree.Selected.Rec);
 end;
 
+procedure TProjectManagerFrame.LoadSignOnlineSwitch;
+var
+  iResult: Integer;
+  sResult: string;
+begin
+  FSignOnlineSwitch := 0;
+  iResult := PHPWeb.UrlGet(PhPWeb.MeasureURL + 'sign/switch', nil, sResult);
+  case iResult of
+    1: FSignOnlineSwitch := StrToIntDef(sResult, 0);
+    0: WarningMessage('网络错误:' + sResult);
+    -1: WarningMessage('网络错误:无法连接到云端');
+  end;
+end;
+
 end.

+ 8 - 2
Frames/ZJJLFme.pas

@@ -92,8 +92,10 @@ constructor TZJJLFrame.Create(AParent: TFrame; AZJJLData: TZJJLData);
 begin
   inherited Create(AParent);
   ResetFrameLink(AZJJLData);
-  with TProjectData(TPhaseData(FZJJLData.PhaseData).ProjectData) do
-    lePreText.Text := ProjProperties.ZJJLPreText;
+  with TPhaseData(FZJJLData.PhaseData).PhaseProperty do
+  begin
+    lePreText.Text := ZJJLPreText;
+  end;
   RefreshTitle;
 end;
 
@@ -131,7 +133,10 @@ end;
 procedure TZJJLFrame.lePreTextExit(Sender: TObject);
 begin
   with TProjectData(TPhaseData(FZJJLData.PhaseData).ProjectData) do
+  begin
     ProjProperties.ZJJLPreText := lePreText.Text;
+    PhaseData.PhaseProperty.ZJJLPreText := lePreText.Text;
+  end;
 end;
 
 procedure TZJJLFrame.SetDataReadOnly(const Value: Boolean);
@@ -141,6 +146,7 @@ begin
   lePreText.Enabled := not FDataReadOnly;
   saZJJL.Columns.ColumnByName('Code').ReadOnly := FDataReadOnly;
   saZJJL.Columns.ColumnByName('CertificateCode').ReadOnly := FDataReadOnly;
+  lePreText.Enabled := not Value;
 end;
 
 procedure TZJJLFrame.zgZJJLMouseDown(Sender: TObject; Button: TMouseButton;

+ 13 - 0
Units/PhaseProperty.pas

@@ -27,6 +27,8 @@ type
     procedure SetZJJLType(const Value: Integer);
     procedure SetZjjlVersion(const Value: Integer);
     function GetZjjlVersion: Integer;
+    function GetZJJLPreText: string;
+    procedure SetZJJLPreText(const Value: string);
   public
     constructor Create(AConnection: TADOConnection);
     destructor Destroy; override;
@@ -38,6 +40,7 @@ type
     property FinalAudit: Boolean read FFinalAudit write SetFinalAudit;
 
     property ZJJLType: Integer read GetZJJLType write SetZJJLType;
+    property ZJJLPreText: string read GetZJJLPreText write SetZJJLPreText;
     property ZjjlVersion: Integer read GetZjjlVersion write SetZjjlVersion;
   end;
 
@@ -101,6 +104,11 @@ begin
   Result := VarToStrDef(vProperty, ADef);
 end;
 
+function TPhaseProperties.GetZJJLPreText: string;
+begin
+  Result := GetStrPropertyDef('ZJJLPreText', '');
+end;
+
 function TPhaseProperties.GetZJJLType: Integer;
 begin
   Result := GetIntPropertyDef('ZJJLType', 0);
@@ -139,6 +147,11 @@ begin
   FPropertyInqurity.Value['FinalAudit'] := FFinalAudit;
 end;
 
+procedure TPhaseProperties.SetZJJLPreText(const Value: string);
+begin
+  FPropertyInqurity.Value['ZJJLPreText'] := Value;
+end;
+
 procedure TPhaseProperties.SetZJJLType(const Value: Integer);
 begin
   FPropertyInqurity.Value['ZJJLType'] := Value;

+ 1 - 1
Units/ReportManager.pas

@@ -770,7 +770,7 @@ begin
     56: Result := FrmWeiWuZjjlGatherData.AssignData(AProjectData); // 맵據關嶠 -- 데깃뙈、셕좆連마삠悧깊
   end;
   // For Inner Test
-  //ShowTestForm(Result);
+  ShowTestForm(Result);
 end;
 
 function TMemoryReportManager.GetSqlResultDataSet(const ASql: string;