From 2ea047bd801dd9c0f5ed693be452ee67aa8b5ff3 Mon Sep 17 00:00:00 2001
From: 啊鑫 <t2856754968@163.com>
Date: 星期一, 11 十一月 2024 19:35:17 +0800
Subject: [PATCH] 质量审核上的五个按钮

---
 DevApp/Gs.DevApp/DevFrm/QC/Frm_MesQaItemsDetect01.cs |   73 ++++++++++++++++++++++++++++++++----
 1 files changed, 64 insertions(+), 9 deletions(-)

diff --git a/DevApp/Gs.DevApp/DevFrm/QC/Frm_MesQaItemsDetect01.cs b/DevApp/Gs.DevApp/DevFrm/QC/Frm_MesQaItemsDetect01.cs
index 7d7ddd1..bc7044e 100644
--- a/DevApp/Gs.DevApp/DevFrm/QC/Frm_MesQaItemsDetect01.cs
+++ b/DevApp/Gs.DevApp/DevFrm/QC/Frm_MesQaItemsDetect01.cs
@@ -6,8 +6,10 @@
 using Newtonsoft.Json.Linq;
 using System;
 using System.Collections.Generic;
+using System.Configuration;
 using System.Data;
 using System.Drawing;
+using System.Net;
 using System.Windows.Forms;
 
 namespace Gs.DevApp.DevFrm
@@ -334,8 +336,10 @@
         /// <param name="e"></param>
         private void ToolBarMenu1_btnLoadClick(object sender, EventArgs e)
         {
-            UtilityHelper.JumpToTab(xtraTabControl1, 0);
-            getPageList(1, UtilityHelper.GetPageSize());
+            if (xtraTabControl1.SelectedTabPageIndex == 1)
+                getModel(lbGuid.Text.Trim(), false, 999);
+            else
+                getPageList(1, UtilityHelper.GetPageSize());
         }
         /// <summary>
         /// 淇敼浜嬩欢
@@ -391,8 +395,8 @@
             var _obj = new
             {
                 guid = UtilityHelper.ToGuid(lbGuid.Text.Trim()), //涓诲缓
-                fngDesc=txt_fngDesc.Text.Trim(),
-                lotNo1=txt_lotNo1.Text.Trim(),
+                fngDesc = txt_fngDesc.Text.Trim(),
+                lotNo1 = txt_lotNo1.Text.Trim(),
             };
             try
             {
@@ -455,7 +459,7 @@
             }
             _loading.Stop();
         }
-        private void getModel(string strGuid, bool isEdit, int tabIdx)
+        private async void getModel(string strGuid, bool isEdit, int tabIdx)
         {
             if (string.IsNullOrEmpty(strGuid))
             {
@@ -463,13 +467,14 @@
                 return;
             }
             UtilityHelper.JumpToTab(xtraTabControl1, tabIdx);
+            UcLoading _loading = new UcLoading();
             var _obj = new
             {
                 guid = strGuid,//涓诲缓
             };
             try
             {
-                string strJson = UtilityHelper.HttpPost("", _webServiceName + "GetModel", JsonConvert.SerializeObject(_obj));
+                string strJson = await UtilityHelper.HttpPostAsync("", _webServiceName + "GetModel", JsonConvert.SerializeObject(_obj));
                 ReturnModel<dynamic> _rtn = ToolBox.UtilityHelper.ReturnToDynamic(strJson);
                 if (_rtn.rtnCode > 0)
                 {
@@ -505,6 +510,8 @@
             {
                 ToolBox.MsgHelper.Warning("鎻愮ず锛�" + ex.Message);
             }
+
+            _loading.Stop();
         }
 
 
@@ -560,8 +567,9 @@
         /// 鏍规嵁妫�楠岄」鐩鍙栨娊鏍风粨鏋� 
         /// </summary>
         /// <param name="guid5"></param>
-        private void getList12(string guid5)
+        private async void getList12(string guid5)
         {
+            UcLoading _loading = new UcLoading();
             var _obj = new
             {
                 parentGuid = UtilityHelper.ToGuid(lbGuid.Text.Trim()), //涓诲缓
@@ -569,7 +577,7 @@
             };
             try
             {
-                var strReturn = UtilityHelper.HttpPost("", _webServiceName + "GetModel12", JsonConvert.SerializeObject(_obj));
+                var strReturn = await UtilityHelper.HttpPostAsync("", _webServiceName + "GetModel12", JsonConvert.SerializeObject(_obj));
                 var dd = UtilityHelper.ReturnToList(strReturn);
                 var dt = dd.rtnData;
                 gcMx2.BindingContext = new BindingContext();
@@ -580,6 +588,7 @@
             {
                 MsgHelper.Warning("鎻愮ず锛�" + ex.Message);
             }
+            _loading.Stop();
         }
 
         private void repositoryItemButtonEdit1_ButtonClick(object sender, DevExpress.XtraEditors.Controls.ButtonPressedEventArgs e)
@@ -618,7 +627,53 @@
                 return;
             if (e.Button.Index == 0)
             {
-                MsgHelper.Warning("鎻愮ず锛�" + "寮�鍙戜腑");
+                try
+                {
+                    var dr = gvMx3.GetDataRow(rowhandle);
+                    var urlPath = dr["urlPath"].ToString();
+                    Gs.DevApp.UserControl.ShowFile frm = new ShowFile(urlPath);
+                    frm.ShowDialog();
+                }
+                catch (Exception ex)
+                {
+                    Gs.DevApp.ToolBox.MsgHelper.ShowError(ex.Message);
+                }
+            
+            }
+        }
+
+        private void repositoryItemButtonEdit3_ButtonClick(object sender, DevExpress.XtraEditors.Controls.ButtonPressedEventArgs e)
+        {
+            var rowhandle = gvMx3.FocusedRowHandle;
+            if (rowhandle < 0)
+                return;
+            if (e.Button.Index == 0)
+            {
+                try
+                {
+                    var dr = gvMx3.GetDataRow(rowhandle);
+                    var urlPath = dr["urlPath"].ToString();
+                    using (FolderBrowserDialog folderBrowserDialog = new FolderBrowserDialog())
+                    {
+                        folderBrowserDialog.Description = "閫夋嫨瀵煎嚭鏂囦欢鐨勪繚瀛樿矾寰�";
+                        DialogResult dialogResult = folderBrowserDialog.ShowDialog();
+                        if (dialogResult == DialogResult.OK)
+                        {
+                            string _folder = folderBrowserDialog.SelectedPath;
+                            string _folderName = _folder + "\\" + urlPath;
+                            string _url = ConfigurationManager.AppSettings["WebApiUrl"].ToString() + "upload/" + urlPath;
+                            using (WebClient client = new WebClient())
+                            {
+                                client.DownloadFile(_url, _folderName);
+                            }
+                            ToolBox.MsgHelper.ShowInformation("涓嬭浇鎴愬姛锛�");
+                        }
+                    }
+                }
+                catch (Exception ex)
+                {
+                    Gs.DevApp.ToolBox.MsgHelper.ShowError(ex.Message);
+                }
             }
         }
     }

--
Gitblit v1.9.3