From c6740b17f1dd8c8187c7eb93597aa14e72a9e82f Mon Sep 17 00:00:00 2001
From: cdk <2441919651@qq.com>
Date: 星期四, 27 十一月 2025 09:56:14 +0800
Subject: [PATCH] fqc和待检增加不合格原因字段

---
 DevApp/Gs.DevApp/DevFrm/RkQC/RkDetect01.cs |  255 +++++++++++++++++++++++++++++++++++++-------------
 1 files changed, 189 insertions(+), 66 deletions(-)

diff --git a/DevApp/Gs.DevApp/DevFrm/RkQC/RkDetect01.cs b/DevApp/Gs.DevApp/DevFrm/RkQC/RkDetect01.cs
index 7ee0e9c..3ad5f43 100644
--- a/DevApp/Gs.DevApp/DevFrm/RkQC/RkDetect01.cs
+++ b/DevApp/Gs.DevApp/DevFrm/RkQC/RkDetect01.cs
@@ -1,4 +1,5 @@
-锘縰sing Gs.DevApp.DevFrm.QC;
+锘縰sing DevExpress.XtraLayout.Customization;
+using Gs.DevApp.DevFrm.QC;
 using Gs.DevApp.DevFrm.Rpt;
 using Gs.DevApp.Entity;
 using Gs.DevApp.ToolBox;
@@ -7,7 +8,9 @@
 using Newtonsoft.Json.Linq;
 using System;
 using System.Collections.Generic;
+using System.Configuration;
 using System.Data;
+using System.Net;
 using System.Threading.Tasks;
 using System.Windows.Forms;
 
@@ -27,6 +30,8 @@
 
         protected override void OnCreateControl()
         {
+            //鍒楄〃锛実etmodel 浣跨敤浜哛kqcManager锛�
+            //淇濆瓨锛屽鏍镐娇锛岄噸鏂板姞杞芥楠� 鐢ㄤ簡MesQaItemsDetect01Manager
             base.OnCreateControl();
             if (Parent == null) return;
             this.toolBarMenu1.btnEdtClick += ToolBarMenu1_btnEdtClick;
@@ -34,6 +39,7 @@
             this.toolBarMenu1.btnLoadClick += ToolBarMenu1_btnLoadClick;
             this.toolBarMenu1.btnEscClick += ToolBarMenu1_btnEscClick;
             this.toolBarMenu1.btnQueryClick += ToolBarMenu1_btnQueryClick;
+            toolBarMenu1.btnOutClick += ToolBarMenu1_btnOutClick;
             toolBarMenu1.btnLogClick += ToolBarMenu1_btnLogClick;
             toolBarMenu1.btnChkClick += ToolBarMenu1_btnChkClick;
             toolBarMenu1.btnFChkClick += ToolBarMenu1_btnFChkClick;
@@ -61,80 +67,80 @@
             gvMx1.FocusedRowChanged += GvMx1_FocusedRowChanged;
             btnIpt.Click += BtnIpt_Click;
             string rptName = "";
-            if (strType == QcSeason.鐢熶骇閫�鏂欏叆搴撴.ToString())
-                rptName = "rpt_SCTL";
+            if (strType == QcSeason.鍙楁墭鍏ュ簱.ToString())
+            {
+                rptName = "rpt_Strk";
+                layoutControlItem25.Visibility = DevExpress.XtraLayout.Utils.LayoutVisibility.Never;
+                layoutControlItem27.Visibility = DevExpress.XtraLayout.Utils.LayoutVisibility.Never;
+            }
             else
                   if (strType == QcSeason.鍏跺畠鍏ュ簱妫�.ToString())
+            {
                 rptName = "rpt_Qtrk";
+                layoutControlItem25.Visibility = DevExpress.XtraLayout.Utils.LayoutVisibility.Never;
+                layoutControlItem27.Visibility = DevExpress.XtraLayout.Utils.LayoutVisibility.Never;
+            }
+
             else
                  if (strType == QcSeason.閿�鍞��璐у叆搴撴.ToString())
                 rptName = "rpt_Xsth";
-
+            else
+                 if (strType == QcSeason.濮斿閫�鏂欏叆搴撴.ToString())
+                rptName = "rpt_wwtl";
+            else
+                 if (strType == QcSeason.瓒呮湡妫�.ToString())
+            {
+                rptName = "";
+                layoutControlItem25.Visibility = DevExpress.XtraLayout.Utils.LayoutVisibility.Never;
+                layoutControlItem27.Visibility = DevExpress.XtraLayout.Utils.LayoutVisibility.Never;
+                tabMxPage3.PageVisible = false;
+            }
+            #region 鎵撳嵃鐩稿叧
             this.ucBtnPrint1.btnPrintClick += (s, e) =>
             {
-                ucBtnPrint1.guidKey = "";
-                string rowGuid = txt_aboutGuid.Text.Trim();
-                ucBtnPrint1.guidKey = rowGuid;
-                if (!Gs.DevApp.ToolBox.UtilityHelper.IsNumeric3(txt_iCount_1.Text.Trim(), txt_yuliang_1.Text.Trim()))
-                {
-                    Gs.DevApp.ToolBox.MsgHelper.ShowError("璇疯緭鍏ユ纭殑鏉$爜鏁伴噺锛�");
-                    txt_iCount_1.Focus();
-                    this.ucBtnPrint1.rptParameter = "return false";
-                    return;
-                }
-                if (!Gs.DevApp.ToolBox.UtilityHelper.IsNumeric3(txt_psnQty_1.Text.Trim()))
-                {
-                    Gs.DevApp.ToolBox.MsgHelper.ShowError("璇烽�夋嫨鎵撳嵃鏉$爜鏁伴噺锛�");
-                    txt_psnQty_1.Focus();
-                    this.ucBtnPrint1.rptParameter = "return false";
-                    return;
-                }
-                if (rowGuid.Length < 10)
-                {
-                    Gs.DevApp.ToolBox.MsgHelper.ShowError("璇烽�夋嫨鎵撳嵃鐨勮锛�");
-                    this.ucBtnPrint1.rptParameter = "return false";
-                    return;
-                }
-
-                this.ucBtnPrint1.rptParameter = rptName + "{" + rowGuid.Trim()
-                       + "," + ""
-                       + "," + Gs.DevApp.ToolBox.UtilityHelper.ToDecimal(txt_yuliang_1.Text.Trim())
-                       + "," + txt_iCount_1.Text.Trim()
-                       + "," + txt_psnQty_1.Text.Trim()
-                       + "}";
+                _print(0, rptName);
             };
             this.ucBtnPrint1.btnAllClick += (s, e) =>
             {
                 string rowGuid = txt_aboutGuid.Text.Trim();
                 SelectDeleteBar frm = new SelectDeleteBar(rowGuid, strType);
                 string strCodeList = "";
+                string strAction = "";
                 frm.UpdateParent += (ss, ee) =>
                 {
                     strCodeList = ee.StringSingle;
+                    strAction = ee.Data;
                 };
                 frm.ShowDialog();
                 if (string.IsNullOrEmpty(strCodeList))
                     return;
-                try
+                if (strAction == "print")
                 {
-                    string rptParameter = rptName + "{"
-                    + "100"
-                    + "," + ""
-                    + "," + ""
-                    + "," + ""
-                    + "," + ""
-                    + "," + strCodeList
-                    + "}";
-                    using (Form rpt = new RptPreview(rowGuid, rptParameter))
+                    try
                     {
-                        rpt.ShowDialog();
+                        string rptParameter = rptName + "{"
+                        + "100"
+                        + "," + ""
+                        + "," + ""
+                        + "," + ""
+                        + "," + ""
+                        + "," + strCodeList
+                        + "}";
+                        using (Form rpt = new RptPreview(rowGuid, rptParameter))
+                        {
+                            rpt.ShowDialog();
+                        }
+                        frm.Close();
                     }
-                    frm.Close();
+                    catch (Exception ex)
+                    {
+                        MsgHelper.ShowError(ex.Message);
+                    }
                 }
-                catch (Exception ex)
-                {
-                    MsgHelper.ShowError(ex.Message);
-                }
+            };
+            this.ucBtnPrint1.btnZhiJieClick += (s, e) =>
+            {
+                _print(1, rptName);
             };
             //鑷姩璁$畻鎵撳嵃閲�
             txt_psnQty_1.TextChanged += (s, e) =>
@@ -145,6 +151,45 @@
             {
                 Gs.DevApp.ToolBox.UtilityHelper.PrintAuto(txt_psnQty_1, txt_iCount_1, radOut, txt_yuliang_1);
             };
+            #endregion
+
+        }
+        /// <summary>
+        /// 鎵撳嵃
+        /// </summary>
+        /// <param name="type">0琛ㄧず棰勮鎵撳嵃锛�1琛ㄧず鐩存帴鎵撳嵃</param>
+        private void _print(int type, string rptName)
+        {
+            ucBtnPrint1.guidKey = "";
+            string rowGuid = txt_aboutGuid.Text.Trim();
+            ucBtnPrint1.guidKey = rowGuid;
+            if (!Gs.DevApp.ToolBox.UtilityHelper.IsNumeric3(txt_iCount_1.Text.Trim(), txt_yuliang_1.Text.Trim()))
+            {
+                Gs.DevApp.ToolBox.MsgHelper.ShowError("璇疯緭鍏ユ纭殑鏉$爜鏁伴噺锛�");
+                txt_iCount_1.Focus();
+                this.ucBtnPrint1.rptParameter = "return false";
+                return;
+            }
+            if (!Gs.DevApp.ToolBox.UtilityHelper.IsNumeric3(txt_psnQty_1.Text.Trim()))
+            {
+                Gs.DevApp.ToolBox.MsgHelper.ShowError("璇烽�夋嫨鎵撳嵃鏉$爜鏁伴噺锛�");
+                txt_psnQty_1.Focus();
+                this.ucBtnPrint1.rptParameter = "return false";
+                return;
+            }
+            if (rowGuid.Length < 10)
+            {
+                Gs.DevApp.ToolBox.MsgHelper.ShowError("璇烽�夋嫨鎵撳嵃鐨勮锛�");
+                this.ucBtnPrint1.rptParameter = "return false";
+                return;
+            }
+
+            this.ucBtnPrint1.rptParameter = rptName + "{" + rowGuid.Trim()
+                   + "," + ""
+                   + "," + Gs.DevApp.ToolBox.UtilityHelper.ToDecimal(txt_yuliang_1.Text.Trim())
+                   + "," + txt_iCount_1.Text.Trim()
+                   + "," + txt_psnQty_1.Text.Trim()
+                   + "}";
         }
         /// <summary>
         /// 鎵归噺褰曞叆
@@ -193,7 +238,7 @@
             string strGuid = lbGuid.Text.Trim();
             if (string.IsNullOrEmpty(strGuid))
             {
-                ToolBox.MsgHelper.Warning("璇峰厛閫夋嫨浣犺鎿嶄綔鐨勮锛�");
+                ToolBox.MsgHelper.ShowError("璇峰厛閫夋嫨浣犺鎿嶄綔鐨勮锛�");
                 return;
             }
             var _obj = new
@@ -215,7 +260,7 @@
             }
             catch (Exception ex)
             {
-                ToolBox.MsgHelper.Warning("鎻愮ず锛�" + ex.Message);
+                ToolBox.MsgHelper.ShowError("鎻愮ず锛�" + ex.Message);
             }
         }
         /// <summary>
@@ -277,7 +322,7 @@
                 }
                 catch (Exception ex)
                 {
-                    MsgHelper.Warning("鎻愮ず锛�" + ex.Message);
+                    MsgHelper.ShowError("鎻愮ず锛�" + ex.Message);
                 }
             }
         }
@@ -388,7 +433,7 @@
             (rowGuid, rowName) = UtilityHelper.GetCurrentRow(xtraTabControl1, lbGuid, txt_releaseNo, gridView1, "releaseNo");
             if (string.IsNullOrEmpty(rowGuid))
             {
-                ToolBox.MsgHelper.Warning("璇峰厛閫夋嫨浣犺鎿嶄綔鐨勮锛�");
+                ToolBox.MsgHelper.ShowError("璇峰厛閫夋嫨浣犺鎿嶄綔鐨勮锛�");
                 return;
             }
             Gs.DevApp.ToolBox.UtilityHelper.JumpTab(xtraTabControl1, 3);
@@ -415,11 +460,20 @@
         {
             toolBarMenu1.isSetBtn = false;
             string rkckid = txt_rkCkId.GetId();
-            if (string.IsNullOrEmpty(rkckid))
+            if (strType == QcSeason.瓒呮湡妫�.ToString()
+                || strType == QcSeason.鍏跺畠鍏ュ簱妫�.ToString()
+                || strType == QcSeason.鍙楁墭鍏ュ簱.ToString())
             {
-                Gs.DevApp.ToolBox.MsgHelper.ShowError("璇烽�夋嫨浠撳簱锛�");
-                txt_rkCkId.Focus();
-                return;
+
+            }
+            else
+            {
+                if (string.IsNullOrEmpty(rkckid))
+                {
+                    Gs.DevApp.ToolBox.MsgHelper.ShowError("璇烽�夋嫨浠撳簱锛�");
+                    txt_rkCkId.Focus();
+                    return;
+                }
             }
             if (txt_fcheckResu.Text.Trim() == _strTag && string.IsNullOrEmpty(txt_fngDesc.TextTxt.Trim()))
             {
@@ -464,7 +518,19 @@
         /// <param name="pageSize">姣忛〉鍑犳潯</param>
         private void getPageList(int curPage)
         {
-            gcMain1.DataSource = null; var _sbSqlWhere = UtilityHelper.GetSearchWhere(_filterList);
+            gcMain1.DataSource = null;
+            System.Text.StringBuilder _sbSqlWhere = new System.Text.StringBuilder();
+            _sbSqlWhere.Append(" and a.ReceiveOrgId in");
+            _sbSqlWhere.Append(ToolBox.UtilityHelper.GetOrgWhere());
+            _sbSqlWhere.Append(UtilityHelper.GetSearchWhere(_filterList));
+            if (strType == QcSeason.鍏跺畠鍏ュ簱妫�.ToString())
+            {
+                _sbSqlWhere.Append(" and isnull(qtrk.qt028,0)=1 and isnull(qtrk.qt032,0)=1 and isnull(qtrk.qt015,0)=1 ");
+            }
+            if (strType == QcSeason.鍙楁墭鍏ュ簱.ToString())
+            {
+                _sbSqlWhere.Append(" and isnull(st.isCheck,0)=1 and isnull(st.qt032,0)=1");
+            }
             PageQueryModel pgq = new PageQueryModel(curPage, this.pageBar1.RowsCount, "release_no", "asc", "", " and a.order_type='" + strType + "' " + _sbSqlWhere.ToString());
             string json = JsonConvert.SerializeObject(pgq);
             try
@@ -496,9 +562,8 @@
             }
             catch (Exception ex)
             {
-                ToolBox.MsgHelper.Warning("鎻愮ず锛�" + ex.Message);
+                ToolBox.MsgHelper.ShowError("鎻愮ず锛�" + ex.Message);
             }
-
         }
         /// <summary>
         /// 璇诲彇瀹炰綋
@@ -512,7 +577,7 @@
             if (toolBarMenu1.currentAction == "edit") isEdit = true;
             if (string.IsNullOrEmpty(strGuid))
             {
-                ToolBox.MsgHelper.Warning("璇峰厛閫夋嫨浣犺鎿嶄綔鐨勮锛�");
+                ToolBox.MsgHelper.ShowError("璇峰厛閫夋嫨浣犺鎿嶄綔鐨勮锛�");
                 return;
             }
             var _obj = new
@@ -648,7 +713,7 @@
             }
             catch (Exception ex)
             {
-                MsgHelper.Warning("鎻愮ず锛�" + ex.Message);
+                MsgHelper.ShowError("鎻愮ず锛�" + ex.Message);
             }
         }
         /// <summary>
@@ -671,7 +736,7 @@
             (rowGuid, rowName) = UtilityHelper.GetCurrentRow(xtraTabControl1, lbGuid, txt_releaseNo, gridView1, "releaseNo");
             if (string.IsNullOrEmpty(rowGuid))
             {
-                MsgHelper.Warning("璇峰厛閫夋嫨浣犺鎿嶄綔鐨勮锛�");
+                MsgHelper.ShowError("璇峰厛閫夋嫨浣犺鎿嶄綔鐨勮锛�");
                 return;
             }
             if (!MsgHelper.AskQuestion("浣犻�夋嫨浜嗐��" + rowName + "銆戯紝纭畾鎿嶄綔鍚楋紵"))
@@ -686,9 +751,9 @@
                     "MesQaItemsDetect01Manager/" + _meth,
                     JsonConvert.SerializeObject(_obj));
                 var _rtn = UtilityHelper.ReturnToDynamic(strJson);
-                MsgHelper.Warning("鎻愮ず锛�" + _rtn.rtnData.outMsg);
                 if (_rtn.rtnCode > 0 && _rtn.rtnData.outSum * 1 > 0)
                 {
+                    MsgHelper.ShowInformation("鎻愮ず锛�" + _rtn.rtnData.outMsg);
                     if (xtraTabControl1.SelectedTabPageIndex == 1)
                     {
                         getModel(lbGuid.Text.Trim(), "0");
@@ -699,10 +764,68 @@
                     int _inFieldValue = (_meth == "EditModelSubmit" ? 1 : -1);
                     UtilityHelper.SetCheckIco(gridView1, "fsubmitTxt", "", "iqcDate", picCheckBox, parentForm, _inFieldValue.ToString());
                 }
+                else
+                    MsgHelper.ShowError("鎻愮ず锛�" + _rtn.rtnData.outMsg);
             }
             catch (Exception ex)
             {
-                MsgHelper.Warning("鎻愮ず锛�" + ex.Message);
+                MsgHelper.ShowError("鎻愮ず锛�" + ex.Message);
+            }
+        }
+
+        private void ToolBarMenu1_btnOutClick(object sender, EventArgs e)
+        {
+            using (FolderBrowserDialog folderBrowserDialog = new FolderBrowserDialog())
+            {
+                folderBrowserDialog.Description = "閫夋嫨瀵煎嚭鏂囦欢鐨勪繚瀛樿矾寰�";
+                DialogResult dialogResult = folderBrowserDialog.ShowDialog();
+                System.Text.StringBuilder _sbSqlWhere = new System.Text.StringBuilder();
+                _sbSqlWhere.Append(" and a.ReceiveOrgId in");
+                _sbSqlWhere.Append(ToolBox.UtilityHelper.GetOrgWhere());
+                _sbSqlWhere.Append(UtilityHelper.GetSearchWhere(_filterList));
+                if (strType == QcSeason.鍏跺畠鍏ュ簱妫�.ToString())
+                {
+                    _sbSqlWhere.Append(" and isnull(qtrk.qt028,0)=1 and isnull(qtrk.qt032,0)=1 and isnull(qtrk.qt015,0)=1 ");
+                }
+                if (strType == QcSeason.鍙楁墭鍏ュ簱.ToString())
+                {
+                    _sbSqlWhere.Append(" and isnull(st.isCheck,0)=1 and isnull(st.qt032,0)=1");
+                }
+                if (dialogResult == DialogResult.OK)
+                {
+                    string _folder = folderBrowserDialog.SelectedPath;
+                    var _params = new
+                    {
+                        inSortName = "",
+                        inSortOrder = "",
+                        inQueryWhere = _sbSqlWhere.ToString()
+                    };
+                    var _obj = new Gs.DevApp.Entity.XlsOutModel("xlsOut_rkqcdetect01lst", "", "", "", _params);
+                    try
+                    {
+                        string strJson = UtilityHelper.HttpPost("", "XlsInOut/XlsOutView_NEW", JsonConvert.SerializeObject(_obj));
+                        ReturnModel<dynamic> _rtn = ToolBox.UtilityHelper.ReturnToDynamic(strJson);
+                        if (_rtn.rtnCode > 0)
+                        {
+                            string _file = _rtn.rtnData.fileUrl.ToString();
+                            string _folderName = _folder + "\\" + _file.Replace("down/", "");
+                            string _url = ConfigurationManager.AppSettings["WebApiUrl"].ToString() + _file;
+                            using (WebClient client = new WebClient())
+                            {
+                                client.DownloadFile(_url, _folderName);
+                            }
+                            ToolBox.MsgHelper.ShowInformation("瀵煎嚭鎴愬姛锛�");
+                        }
+                        else
+                        {
+                            ToolBox.MsgHelper.Warning("鎻愮ず锛�" + _rtn.rtnMsg);
+                        }
+                    }
+                    catch (Exception ex)
+                    {
+                        ToolBox.MsgHelper.Warning("鎻愮ず锛�" + ex.Message);
+                    }
+                }
             }
         }
 

--
Gitblit v1.9.3