Ver Fonte

业务流程处理

JeffWang há 3 anos atrás
pai
commit
95be1795d7

+ 8 - 8
FactoryTool_CShare/Business/SanhuaMethod.cs

@@ -14,10 +14,10 @@ namespace MOKA_Factory_Tools
     {
         public static SanhuaMESLoginInfo sanhuaLoginInfo = new SanhuaMESLoginInfo();
 
-        public static bool CheckLogin(string url)
+        public static bool CheckLogin()
         {
             HttpHelper http = new HttpHelper();
-            HttpItem item = new HttpItem() {URL = url + "api/MESTestCollect/CheckLogin", Encoding = Encoding.UTF8,Method = "post", PostEncoding = Encoding.UTF8, KeepAlive = false};
+            HttpItem item = new HttpItem() {URL = sanhuaLoginInfo.url + "api/MESTestCollect/CheckLogin", Encoding = Encoding.UTF8,Method = "post", PostEncoding = Encoding.UTF8, KeepAlive = false};
             item.ContentType = "application/json;charset=utf-8";
             item.Postdata = string.Format("{{\"password\":\"{0}\",\"resourceCode\":\"{1}\",\"staffCode\":\"{2}\"}}", sanhuaLoginInfo.staffCode, sanhuaLoginInfo.password, sanhuaLoginInfo.resourceCode);
             HttpResult result = http.GetHtml(item);
@@ -42,10 +42,10 @@ namespace MOKA_Factory_Tools
             return true;
         }
 
-        public static bool ProductRouteCheck(string url, string productSN)
+        public static bool ProductRouteCheck(string productSN)
         {
             HttpHelper http = new HttpHelper();
-            HttpItem item = new HttpItem() { URL = url + "api/MESTestCollect/ProductRouteCheck", Encoding = Encoding.UTF8, Method = "post", PostEncoding = Encoding.UTF8, KeepAlive = false };
+            HttpItem item = new HttpItem() { URL = sanhuaLoginInfo.url + "api/MESTestCollect/ProductRouteCheck", Encoding = Encoding.UTF8, Method = "post", PostEncoding = Encoding.UTF8, KeepAlive = false };
             item.ContentType = "application/json;charset=utf-8";
             item.Postdata = string.Format("{{\"jigEdition\":\"{0}\",\"resourceCode\":\"{1}\",\"staffCode\":\"{2}\",\"productSN\":\"{3}\"}}", 
                 sanhuaLoginInfo.jigEdtion, sanhuaLoginInfo.resourceCode, sanhuaLoginInfo.staffCode, productSN);
@@ -71,10 +71,10 @@ namespace MOKA_Factory_Tools
             return true;
         }
 
-        public static bool UploadIdcData(string url, string productSN, string acasId)
+        public static bool UploadIdcData(string productSN, string acasId)
         {
             HttpHelper http = new HttpHelper();
-            HttpItem item = new HttpItem() { URL = url + "api/MESTestCollect/UploadIdcData", Encoding = Encoding.UTF8, Method = "post", PostEncoding = Encoding.UTF8, KeepAlive = false };
+            HttpItem item = new HttpItem() { URL = sanhuaLoginInfo.url + "api/MESTestCollect/UploadIdcData", Encoding = Encoding.UTF8, Method = "post", PostEncoding = Encoding.UTF8, KeepAlive = false };
             item.ContentType = "application/json;charset=utf-8";
             item.Postdata = string.Format("{{\"jigEdition\":\"{0}\",\"resourceCode\":\"{1}\",\"staffCode\":\"{2}\",\"productSN\":\"{3}\",\"attr\":\"{{\"ACASID\",\"{4}\"}}\"}}",
                 sanhuaLoginInfo.jigEdtion, sanhuaLoginInfo.resourceCode, sanhuaLoginInfo.staffCode, productSN, acasId);
@@ -100,10 +100,10 @@ namespace MOKA_Factory_Tools
             return true;
         }
 
-        public static bool ProductMoveNext(string url, string productSN, string result, string defectCode)
+        public static bool ProductMoveNext(string productSN, string result, string defectCode)
         {
             HttpHelper http = new HttpHelper();
-            HttpItem item = new HttpItem() { URL = url + "api/MESTestCollect/ProductMoveNext", Encoding = Encoding.UTF8, Method = "post", PostEncoding = Encoding.UTF8, KeepAlive = false };
+            HttpItem item = new HttpItem() { URL = sanhuaLoginInfo.url + "api/MESTestCollect/ProductMoveNext", Encoding = Encoding.UTF8, Method = "post", PostEncoding = Encoding.UTF8, KeepAlive = false };
             item.ContentType = "application/json;charset=utf-8";
             item.Postdata = string.Format("{{\"jigEdition\":\"{0}\",\"resourceCode\":\"{1}\",\"staffCode\":\"{2}\",\"productSN\":\"{3}\",\"defectCode\":\"{4}\",\"result\":\"{5}\"}}",
                 sanhuaLoginInfo.jigEdtion, sanhuaLoginInfo.resourceCode, sanhuaLoginInfo.staffCode, productSN, defectCode, result);

+ 25 - 2
FactoryTool_CShare/Views/OperationPanel.cs

@@ -831,6 +831,15 @@ namespace MOKA_Factory_Tools
                 }
                 #endregion
 
+                if ( FunctionSettingNow.ExportSNACASID )
+                {
+                    if ( !SanhuaMethod.ProductRouteCheck(SN) )
+                    {
+                        MessageBox.Show(string.Format("ProductRouteCheck faild {0}", SN));
+                        return;
+                    }
+                }
+
                 if (preloadNow)
                 {
                     bool copydone = false;
@@ -4714,8 +4723,22 @@ namespace MOKA_Factory_Tools
 
             if (FunctionSettingNow.ExportSNACASID)
             {
-                SerialCMD.ReadJapaneseACASID(TVPort, out result, out data, out error, SerailDelay);
-                CommonMethod.ExportSNACASID(orderNow, SN, Encoding.ASCII.GetString(data));
+                if (SerialCMD.ReadJapaneseACASID(TVPort, out result, out data, out error, SerailDelay))
+                {
+                    CommonMethod.ExportSNACASID(orderNow, SN, Encoding.ASCII.GetString(data));
+
+                    if (!SanhuaMethod.UploadIdcData(SN, Encoding.ASCII.GetString(data)))
+                    {
+                        MessageBox.Show(string.Format("UploadIdcData faild {0}", SN));
+                        return;
+                    }
+
+                    if (!SanhuaMethod.ProductMoveNext(SN, "", ""))
+                    {
+                        MessageBox.Show(string.Format("ProductMoveNext faild {0}", SN));
+                        return;
+                    }
+                }
             }
 
             #region 小米FireTV功能;

+ 1 - 1
FactoryTool_CShare/Views/SanhuaMES.cs

@@ -45,7 +45,7 @@ namespace MOKA_Factory_Tools
 
             SaveLoginInfo();
 
-            if ( SanhuaMethod.CheckLogin(SanhuaMethod.sanhuaLoginInfo.url) )
+            if ( SanhuaMethod.CheckLogin() )
             {
                 DialogResult = DialogResult.OK;
             }