jianfeng1.wang 2 лет назад
Родитель
Сommit
4d11129b8a

+ 6 - 1
FactoryTool_CShare/Business/V2Method.cs

@@ -644,8 +644,13 @@ namespace MOKA_Factory_Tools
         /// <param name="sqliteConn"></param>
         /// <param name="msg"></param>
         /// <returns></returns>
-        public static bool ReportOnlineData(string url, string order, string postData, SQLiteConnection sqliteConn, bool repeatupload, string id, int timeout)
+        public static bool ReportOnlineData(string url, string order, string postData, SQLiteConnection sqliteConn, bool repeatupload, string id, int timeout, bool background = false)
         {
+            if ( background )
+            {
+                return SQLiteHelper.AddReportOnlineData(sqliteConn, url + "/reportData/report", order, postData);
+            }
+
             if (timeout < 5000)
                 timeout = 5000;
             HttpHelper http = new HttpHelper();

+ 5 - 0
FactoryTool_CShare/Models/StructList.cs

@@ -271,6 +271,11 @@ namespace MOKA_Factory_Tools
         /// 是否使用三华MES对接;
         /// </summary>
         public bool EnableSanhuaMES { get; set; } = false;
+
+        /// <summary>
+        /// 后台上传IDM的在线数据;
+        /// </summary>
+        public bool BackgroudReportData { get; set; } = false;
     }
 
     public enum KEY_FROM

+ 10 - 0
FactoryTool_CShare/Views/Main.cs

@@ -796,6 +796,16 @@ namespace MOKA_Factory_Tools
                     functionSetting1.NextCommandWaitTime = SerialCMD.NextCommandWaitTime = jObject["NextCommandWaitTime"].Value<int>();
                 }
 
+                // 后台上报数据;
+                if (jObject["BackgroudReportData"] == null)
+                {
+                    SaveJsonConfig("BackgroudReportData", false);
+                }
+                else
+                {
+                    functionSetting1.BackgroudReportData = jObject["BackgroudReportData"].Value<bool>();
+                }
+
                 #region EDID离线模式,使用offline账号登录;
                 if (jObject["edid_offline"] == null)
                 {

+ 10 - 4
FactoryTool_CShare/Views/OperationPanel.cs

@@ -36,6 +36,7 @@ namespace MOKA_Factory_Tools
         SerialPort TVPort = new SerialPort();
         SQLiteConnection localDBNow;
         SQLiteConnection errorDBNow;
+        SQLiteConnection reportDBNow;
         KeyInfo keyInfo = new KeyInfo();
         FireTVKey fireTVKey = new FireTVKey();
         NTFBLL ntfBLL = null;
@@ -137,6 +138,11 @@ namespace MOKA_Factory_Tools
             preloadNow = preload;
             midListNow = midList1;
             orderNow = order;
+            if (reportDBNow == null)
+            {
+                reportDBNow = new SQLiteConnection("data source=" + AppDomain.CurrentDomain.BaseDirectory + "DB\\ReportData.db");
+                reportDBNow.Open();
+            }
             InitPanel();
             mainform = form1;
             this.mainform.MoveEvent += new MoveHandler(SetFormLocation);
@@ -4997,8 +5003,8 @@ namespace MOKA_Factory_Tools
 #endregion
 #endregion
 #endif
-                    //数据上传
-                    if (midListNow.host == "LocalPC" && !preloadNow)
+            //数据上传
+            if (midListNow.host == "LocalPC" && !preloadNow)
             {// 离线抄写
                 if (GetLocalKeyCount.DeleteLocalKeys(keypath, keyStream, keyReader))
                 {
@@ -5043,7 +5049,7 @@ namespace MOKA_Factory_Tools
                 if (WriteDID.Checked)
                 {
                     string postjson = V2Method.GetReportJson(orderNow, SN, isNodid: false, midListNow.clienttype, midListNow.version, ProjectIDText.Text, ref keyInfo, FunctionSettingNow.MITVEnable || FunctionSettingNow.IndiaMITVEnable, ref _MiKey);
-                    if (V2Method.ReportOnlineData(midListNow.host, orderNow, postjson, errorDBNow,  false, "", FunctionSettingNow.ReportTimeOut))
+                    if (V2Method.ReportOnlineData(midListNow.host, orderNow, postjson, FunctionSettingNow.BackgroudReportData ? reportDBNow : errorDBNow,  false, "", FunctionSettingNow.ReportTimeOut, FunctionSettingNow.BackgroudReportData))
                     {
                         TestResult = 1;
                     }
@@ -5066,7 +5072,7 @@ namespace MOKA_Factory_Tools
                         {
                             keycontent += "nodid=true&";
                             string postjson = V2Method.GetReportJson(orderNow, SN, isNodid: true, midListNow.clienttype, midListNow.version, ProjectIDText.Text, ref keyInfo, FunctionSettingNow.MITVEnable || FunctionSettingNow.IndiaMITVEnable, ref _MiKey);
-                            if (V2Method.ReportOnlineData(midListNow.host, orderNow, postjson, errorDBNow, false, "", FunctionSettingNow.ReportTimeOut))
+                            if (V2Method.ReportOnlineData(midListNow.host, orderNow, postjson, FunctionSettingNow.BackgroudReportData ? reportDBNow : errorDBNow, false, "", FunctionSettingNow.ReportTimeOut, FunctionSettingNow.BackgroudReportData))
                             {
                                 TestResult = 1;
                             }