فهرست منبع

mxg:连接服务器命令测试通过

mengxiangge 5 سال پیش
والد
کامیت
d8dd789f01

+ 1 - 2
Dispatcher/Client/Class1.cs

@@ -8,7 +8,6 @@ namespace Client
     {
         public static void Main()
         {
-            MessageBox.Show("start");
             try
             {
                 ServiceMBIClientHandler.Start();
@@ -19,7 +18,7 @@ namespace Client
                 MessageBox.Show(ex.Message);
             }
 
-            MessageBox.Show("end");
+            Console.ReadKey();
         }
     }
 }

+ 7 - 6
Dispatcher/Client/Start/RevitCmdExecutor.cs

@@ -7,6 +7,7 @@
 using System;
 using System.Collections.Generic;
 using System.Diagnostics;
+using System.IO;
 using System.Linq;
 using System.Windows.Forms;
 
@@ -22,21 +23,21 @@ namespace Client.Start
             //由revitCmd生成实体类
             //实体类传入参数、参考楼层列表
             //执行方法,返回执行结果 
-            Console.WriteLine("准备执行命令");
-            Process process=new Process();//AppDomain.CurrentDomain.BaseDirectory +
-            process.StartInfo.FileName =  "ExportStart.exe";//执行的exe路径
+            Console.WriteLine(DateTime.Now+" 准备执行命令:"+revitCmd);
+            string fullPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "ExportStart.exe");
+            Process process = new Process();//AppDomain.CurrentDomain.BaseDirectory +
+            process.StartInfo.FileName = fullPath;//执行的exe路径
             process.StartInfo.UseShellExecute = false;//不显示shell
             process.StartInfo.CreateNoWindow = true;//不创建窗口
             process.StartInfo.RedirectStandardInput = true;//打开流输入
             process.StartInfo.RedirectStandardOutput = true;//打开流输出
             process.StartInfo.RedirectStandardError = true;//打开错误流
-            process.StartInfo.Arguments = "(" + revitCmd +  " \"" + filePathList.First() + "\")";//输入参数,多个参数使用空间分割,如果一个参数包含空格,使用""包括此参数
+            process.StartInfo.Arguments = "" + revitCmd + " \"" + filePathList.First() + "\"";//输入参数,多个参数使用空间分割,如果一个参数包含空格,使用""包括此参数
             process.Start();//执行
             string msg = process.StandardOutput.ReadToEnd();//读取输出
             process.WaitForExit();//等待执行完成
             process.Close();//结束
-            
-            MessageBox.Show("命令执行完成 ");
+            Console.WriteLine(DateTime.Now + " 命令执行完成:" + revitCmd);
 
             return msg;
         }

+ 2 - 1
Dispatcher/Client/Start/ServiceMBIClientHandler.cs

@@ -19,7 +19,8 @@ namespace Client.Start
         private static ClientApp m_Client;
         public static void Start()
         {
-            m_Client = new ClientApp("192.168.20.225", 6666, "E:\\", 3, new RevitCmdExecutor(), 5);
+            //192.168.20.225
+            m_Client = new ClientApp("172.16.1.228", 6666, "E:\\", 3, new RevitCmdExecutor(), 5);
             m_Client.Start();
             //Console.ReadKey();
         }

+ 1 - 1
Dispatcher/NettyClient/SimpleMessageHandler.cs

@@ -17,7 +17,7 @@ namespace NettyClient
         public IChannelHandlerContext context;
         public override void ChannelActive(IChannelHandlerContext context)
         {
-            MessageBox.Show("connected");
+            //MessageBox.Show("connected");
             this.context = context;
         }
         public override void ChannelRead(IChannelHandlerContext context, object message)

+ 8 - 1
Dispatcher/TaskDatabase/Model/DownloadTaskModel.cs

@@ -1,11 +1,18 @@
-namespace TaskDatabase.Model
+using Newtonsoft.Json;
+
+namespace TaskDatabase.Model
 {
+
     public class DownloadTaskModel
     {
         public virtual int Tid { get; set; }
+        [JsonProperty(PropertyName = "id")]
         public virtual int Id { get; set; }
+        [JsonProperty(PropertyName = "taskId")]
         public virtual string Task_id { get; set; }
+        [JsonProperty(PropertyName = "httpUrl")]
         public virtual string Task_url { get; set; }
+        [JsonProperty(PropertyName = "md5")]
         public virtual string Task_md5 { get; set; }
         public virtual string Local_dir { get; set; }
         public virtual long Downloaded_bytes { get; set; }

+ 13 - 9
Dispatcher/TaskDatabase/Model/TaskModel.cs

@@ -1,28 +1,32 @@
-/* ==============================================================================
- * 功能描述:TaskModel  
- * 创 建 者:Garrett
- * 创建日期:2019/4/22 15:52:12
- * ==============================================================================*/
-
+using Newtonsoft.Json;
 using System;
 using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
 
 namespace TaskDatabase.Model
 {
-    /// <summary>
-    /// TaskModel
-    /// </summary>
     public class TaskModel
     {
         public virtual int Tid { get; set; }
+        [JsonProperty(PropertyName = "id")]
         public virtual int Id { get; set; }
+        [JsonProperty(PropertyName = "name")]
         public virtual string Task_name { get; set; }
+        [JsonProperty(PropertyName = "cmd")]
         public virtual string Task_cmd { get; set; }
+        [JsonProperty(PropertyName = "param")]
         public virtual string Task_param { get; set; }
+        [JsonProperty(PropertyName = "status")]
         public virtual int Task_status { get; set; }
+        [JsonProperty(PropertyName = "resultJson")]
         public virtual string Task_result_json { get; set; }
+        [JsonProperty(PropertyName = "expectedFinishTime")]
         public virtual long Task_expected_finish_time { get; set; }
         public virtual DateTime Task_add_time { get; set; }
+        [JsonProperty(PropertyName = "downloadTaskList")]
         public virtual ICollection<DownloadTaskModel> DownloadTaskModelList { get; set; }
     }
+    
 }

+ 3 - 0
Dispatcher/TaskDatabase/TaskDatabase.csproj

@@ -43,6 +43,9 @@
     <Reference Include="MySql.Data, Version=6.10.8.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d, processorArchitecture=MSIL">
       <HintPath>..\packages\MySql.Data.6.10.8\lib\net452\MySql.Data.dll</HintPath>
     </Reference>
+    <Reference Include="Newtonsoft.Json, Version=12.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
+      <HintPath>..\..\packages\Newtonsoft.Json.12.0.2\lib\net45\Newtonsoft.Json.dll</HintPath>
+    </Reference>
     <Reference Include="NHibernate, Version=5.2.0.0, Culture=neutral, PublicKeyToken=aa95f207798dfdb4, processorArchitecture=MSIL">
       <HintPath>..\packages\NHibernate.5.2.0\lib\net461\NHibernate.dll</HintPath>
     </Reference>

+ 1 - 0
Dispatcher/TaskDatabase/packages.config

@@ -4,6 +4,7 @@
   <package id="Google.Protobuf" version="3.5.0" targetFramework="net461" />
   <package id="Iesi.Collections" version="4.0.4" targetFramework="net461" />
   <package id="MySql.Data" version="6.10.8" targetFramework="net461" />
+  <package id="Newtonsoft.Json" version="12.0.2" targetFramework="net461" />
   <package id="NHibernate" version="5.2.0" targetFramework="net461" />
   <package id="Remotion.Linq" version="2.2.0" targetFramework="net461" />
   <package id="Remotion.Linq.EagerFetching" version="2.2.0" targetFramework="net461" />

+ 1 - 1
Executer/DataCheck/TestCommand.cs

@@ -29,7 +29,7 @@ namespace ServiceRevitLib
                 string fileName = DateTime.Now.ToString("yyyyMMddHHmmss");
                 string path = Path.Combine(@"D:\", $"DataCheck{fileName}.json");
                 File.WriteAllText(path, result);
-                System.Diagnostics.Process.Start("notepad.exe", path);
+                //System.Diagnostics.Process.Start("notepad.exe", path);
             }
             catch (Exception e)
             {

+ 1 - 1
Executer/DataExport/RevitToJBim/MbiExport.cs

@@ -50,7 +50,7 @@ namespace RevitToJBim
                 string fileName = DateTime.Now.ToString("yyyyMMddHHmmss");
                 string path = Path.Combine(@"D:\", $"{fileName}.json");
                 File.WriteAllText(path, result);
-                System.Diagnostics.Process.Start("notepad.exe", path);
+                //System.Diagnostics.Process.Start("notepad.exe", path);
             }
             catch (Exception ex)
             {

+ 1 - 1
Starter/ExportStart.csproj

@@ -18,7 +18,7 @@
     <DebugSymbols>true</DebugSymbols>
     <DebugType>full</DebugType>
     <Optimize>false</Optimize>
-    <OutputPath>..\..\OutputDll\</OutputPath>
+    <OutputPath>..\OutputDll\</OutputPath>
     <DefineConstants>DEBUG;TRACE</DefineConstants>
     <ErrorReport>prompt</ErrorReport>
     <WarningLevel>4</WarningLevel>

+ 2 - 1
Starter/Program.cs

@@ -25,7 +25,8 @@ namespace ExportStart
         {
             string command = args[0];
             string path = args[1];
-
+            Console.WriteLine(command);
+            Console.WriteLine(path);
             if (File.Exists(path)&&Enum.TryParse(command, out CommandType commandType))
             {
                 var app = RevitCoreContext.Instance.Application;