From 9ae6f47ca642d1d52c42dbb5bb771bd5910b60d6 Mon Sep 17 00:00:00 2001
From: cnf <3283105747@qq.com>
Date: 星期三, 17 十二月 2025 18:00:59 +0800
Subject: [PATCH] 工单复选框开启可编辑

---
 DevApp/Gs.DevApp/DevFrm/Rk/Frm_MesItemTbl.cs |  206 ++++++++++++++++++++++++++++++++++++++------------
 1 files changed, 155 insertions(+), 51 deletions(-)

diff --git a/DevApp/Gs.DevApp/DevFrm/Rk/Frm_MesItemTbl.cs b/DevApp/Gs.DevApp/DevFrm/Rk/Frm_MesItemTbl.cs
index 52d0e59..37e9839 100644
--- a/DevApp/Gs.DevApp/DevFrm/Rk/Frm_MesItemTbl.cs
+++ b/DevApp/Gs.DevApp/DevFrm/Rk/Frm_MesItemTbl.cs
@@ -9,6 +9,7 @@
 using System;
 using System.Collections.Generic;
 using System.Data;
+using System.Data.SqlTypes;
 using System.Threading.Tasks;
 using System.Windows.Forms;
 
@@ -34,13 +35,17 @@
             toolBarMenu1.btnFPiZhunClick += ToolBarMenu1_btnFPiZhunClick;
             toolBarMenu1.btnPiZhunClick += ToolBarMenu1_btnPiZhunClick;
             toolBarMenu1.btnLogClick += ToolBarMenu1_btnLogClick;
+            toolBarMenu1.btnPingZhiClick += ToolBarMenu1_btnPingZhiClick;
+            toolBarMenu1.btnFPingZhiClick += ToolBarMenu1_btnFPingZhiClick;
             this.toolBarMenu1.getXmlConfig();
             Gs.DevApp.ToolBox.UtilityHelper.SetGridViewParameterMx(gvMx1);
             Gs.DevApp.ToolBox.UtilityHelper.SetGridViewParameterMx(gvMx2);
             Gs.DevApp.ToolBox.UtilityHelper.SetGridViewParameter(gridView1, picCheckBox, this, "tbl013", "", (value) =>
             {
                 Gs.DevApp.ToolBox.UtilityHelper.JumpTab(xtraTabControl1, 0);
-            }, tips);
+            }, tips, true, (strGuid) => {
+               getModelList(strGuid);
+            });
             Gs.DevApp.ToolBox.UtilityHelper.SetTabParameter(gridView1, xtraTabControl1, pageBar1, (value) =>
             {
                 getModel(value);
@@ -113,47 +118,14 @@
                 frm.ShowDialog();
             };
             //鎵撳嵃浜嬩欢
+
+            this.ucBtnPrint1.btnZhiJieClick += (s, e) =>
+            {
+                _print(1);
+            };
             this.ucBtnPrint1.btnPrintClick += (s, e) =>
             {
-
-                if ((txt_tbl013.EditValue.ToString() == "False") )
-                {
-                    Gs.DevApp.ToolBox.MsgHelper.ShowError("璇ラ��鏂欑敵璇峰崟鏈鏍镐笉鑳芥墦鍗版潯鐮�");
-                    txt_tbl013.Focus();
-                    return;
-                }
-
-                string rowGuid = lbMxGuid.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 (lbMxGuid.Text.Trim().Length < 10)
-                {
-                    Gs.DevApp.ToolBox.MsgHelper.ShowError("璇烽�夋嫨鎵撳嵃鐨勮锛�");
-                    this.ucBtnPrint1.rptParameter = "return false";
-                    return;
-                }
-                this.ucBtnPrint1.rptParameter = "rpt_SCTL{"
-                       + lbMxGuid.Text.Trim()//鍏宠仈涓婚敭
-                       + "," + ""
-                       + "," + Gs.DevApp.ToolBox.UtilityHelper.ToDecimal(txt_yuliang_1.Text.Trim())//浣欐暟
-                       + "," + txt_iCount_1.Text.Trim()//寮犳暟
-                       + "," + txt_psnQty_1.Text.Trim()//姣忓紶鏉$爜鏁伴噺
-                       + "}";
-                txt_iCount_1.Text = "";
-                txt_psnQty_1.Text = "";
+                _print(0);
             };
             //鎵撳嵃鎵归噺鎿嶄綔浜嬩欢
             this.ucBtnPrint1.btnAllClick += (s, e) =>
@@ -205,13 +177,119 @@
                 Gs.DevApp.ToolBox.UtilityHelper.PrintAuto(txt_psnQty_1, txt_iCount_1, radOut, txt_yuliang_1);
             };
         }
-
+ 
         private async void GridView1_ColumnFilterChanged(object sender, EventArgs e)
         {
             _filterList = Gs.DevApp.ToolBox.UtilityHelper.GetDilter(gridView1.Columns, gridView1);
             await Task.Delay(100);
             getPageList(1);
         }
+
+        private void _print(int type)
+        {
+            string rowGuid = lbMxGuid.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 (lbMxGuid.Text.Trim().Length < 10)
+            {
+                Gs.DevApp.ToolBox.MsgHelper.ShowError("璇烽�夋嫨鎵撳嵃鐨勮锛�");
+                this.ucBtnPrint1.rptParameter = "return false";
+                return;
+            }
+            this.ucBtnPrint1.rptParameter = "rpt_SCTL{"
+                   + lbMxGuid.Text.Trim()//鍏宠仈涓婚敭
+                   + "," + ""
+                   + "," + Gs.DevApp.ToolBox.UtilityHelper.ToDecimal(txt_yuliang_1.Text.Trim())//浣欐暟
+                   + "," + txt_iCount_1.Text.Trim()//寮犳暟
+                   + "," + txt_psnQty_1.Text.Trim()//姣忓紶鏉$爜鏁伴噺
+                   + "}";
+            txt_iCount_1.Text = "";
+            txt_psnQty_1.Text = "";
+        }
+
+        /// <summary>
+        ///  鏂板鏂规硶锛氬垪琛ㄦ樉绀�
+        /// </summary>
+        /// <param name="strGuid">涓昏〃id</param>
+
+        private void getModelList(string strGuid)
+        {
+            gcMxL1.DataSource = null;
+            gcMxL2.DataSource = null;
+
+            var _obj = new
+            {
+                guid = strGuid,//涓诲缓
+            };
+            try
+            {
+                string strJson = UtilityHelper.HttpPost("", _webServiceName + "GetModel", JsonConvert.SerializeObject(_obj));
+                ReturnModel<dynamic> _rtn = ToolBox.UtilityHelper.ReturnToDynamic(strJson);
+                if (_rtn.rtnCode > 0)
+                {
+                    dynamic dy = _rtn.rtnData;
+
+                    JArray array1 = new JArray();
+                    foreach (var a in dy["list"])
+                    {
+                        array1.Add(a);
+                    }
+                    DataTable dt1 = JsonConvert.DeserializeObject<DataTable>(array1.ToString());
+                    if (dt1.Rows.Count > 0)
+                    {
+                        gcMxL1.BindingContext = new BindingContext();
+                        gcMxL1.DataSource = dt1;
+                        gcMxL1.ForceInitialize();
+                        gvMxL1.BestFitColumns();
+                        Gs.DevApp.ToolBox.UtilityHelper.SetGridLayout(gvMxL1);
+                    }
+                    else
+                    {
+                        Gs.DevApp.ToolBox.UtilityHelper.SetDefaultTable(gcMxL1, gvMxL1);
+                    }
+                    JArray array2 = new JArray();
+                    foreach (var a in dy["list2"])
+                    {
+                        array2.Add(a);
+                    }
+
+                    DataTable dt2 = JsonConvert.DeserializeObject<DataTable>(array2.ToString());
+                    if (dt2.Rows.Count > 0)
+                    {
+                        gcMxL2.BindingContext = new BindingContext();
+                        gcMxL2.DataSource = dt2;
+                        gcMxL2.ForceInitialize();
+                        gvMxL2.BestFitColumns();
+                        Gs.DevApp.ToolBox.UtilityHelper.SetGridLayout(gvMxL2);
+                    }
+                    else
+                    {
+                        Gs.DevApp.ToolBox.UtilityHelper.SetDefaultTable(gcMxL2, gvMxL2);
+                    }
+
+                }
+                else
+                    ToolBox.MsgHelper.Warning("鎻愮ず锛�" + _rtn.rtnMsg);
+            }
+            catch (Exception ex)
+            {
+                ToolBox.MsgHelper.Warning("鎻愮ず锛�" + ex.Message);
+            }
+        }
+
         /// <summary>
         /// 鏃ュ織
         /// </summary>
@@ -278,6 +356,25 @@
         {
             _toolCk(3);
         }
+        /// <summary>
+        /// 鍙嶅搧璐�
+        /// </summary>
+        /// <param name="sender"></param>
+        /// <param name="e"></param>
+        private void ToolBarMenu1_btnPingZhiClick(object sender, EventArgs e)
+        {
+            _toolCk(4);
+        }
+        /// <summary>
+        /// 鍝佽川
+        /// </summary>
+        /// <param name="sender"></param>
+        /// <param name="e"></param>
+        private void ToolBarMenu1_btnFPingZhiClick(object sender, EventArgs e)
+        {
+            _toolCk(5);
+        }
+       
         /// <summary>
         ///     瀹℃牳浜嬩欢
         /// </summary>
@@ -405,8 +502,7 @@
             //2025/07/12鍔犱笂淇敼鐘舵�佷笅涓嶈兘淇敼
             txt_tbl023.IsReadly = true;
             txt_tbl002.IsReadly = true;
-            //txt_tbl005.ReadOnly = true;
-            //txt_tbl005.EditValue = true;
+            txt_tbl005.ReadOnly = true;
         }
         /// <summary>
         /// 鏂板浜嬩欢
@@ -448,26 +544,24 @@
                 txt_tbl002.Focus();
                 return;
             }
-            if (string.IsNullOrEmpty(txt_tbl005.Text.Trim()))
+            if (txt_tbl005.SelectedIndex <= 0)
             {
-                Gs.DevApp.ToolBox.MsgHelper.ShowError("璇烽�夋嫨鍘熷洜锛�");
+                Gs.DevApp.ToolBox.MsgHelper.ShowError("璇烽�夋嫨绫诲瀷锛�");
                 txt_tbl005.Focus();
                 return;
             }
             if ((txt_tbl005.Text.Trim()=="鑹搧閫�鏂�") && txt_chkOut.Checked)
             {
-                Gs.DevApp.ToolBox.MsgHelper.ShowError("鑹搧閫�鏂欎笉鑳借嚜鍔ㄧ敓鎴愯ˉ鏂欏崟锛岃妫�鏌ワ紒");
+                Gs.DevApp.ToolBox.MsgHelper.ShowError("鑹搧閫�鏂欎笉鑳借嚜鍔ㄧ敓鎴愯ˉ鏂欏崟锛孿n鍙湁浣滀笟涓嶈壇绫诲瀷鎵嶈兘鐢熸垚琛ユ枡鍗曪紝\n 璇锋鏌ワ紒");
                 txt_tbl005.Focus();
                 return;
             }
-
             if ((txt_tbl005.Text.Trim() == "鏉ユ枡涓嶈壇閫�鏂�") && txt_chkOut.Checked)
             {
-                Gs.DevApp.ToolBox.MsgHelper.ShowError("鏉ユ枡涓嶈壇閫�鏂欎笉鑳借嚜鍔ㄧ敓鎴愯ˉ鏂欏崟锛岃妫�鏌ワ紒");
+                Gs.DevApp.ToolBox.MsgHelper.ShowError("鏉ユ枡涓嶈壇閫�鏂欎笉鑳借嚜鍔ㄧ敓鎴愯ˉ鏂欏崟锛孿n鍙湁浣滀笟涓嶈壇绫诲瀷鎵嶈兘鐢熸垚琛ユ枡鍗曪紝\n 璇锋鏌ワ紒");
                 txt_tbl005.Focus();
                 return;
             }
-
             var _obj = new
             {
                 guid = UtilityHelper.ToGuid(lbGuid.Text.Trim()), //涓诲缓
@@ -548,7 +642,11 @@
         /// <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.tbl023 in");
+            _sbSqlWhere.Append(ToolBox.UtilityHelper.GetOrgWhere());
+            _sbSqlWhere.Append(UtilityHelper.GetSearchWhere(_filterList));
             PageQueryModel pgq = new PageQueryModel(curPage, this.pageBar1.RowsCount, "create_date", "asc", "", _sbSqlWhere.ToString());
             string json = JsonConvert.SerializeObject(pgq);
             try
@@ -728,6 +826,12 @@
                 case 3:
                     strMsg = "鍙嶆壒鍑�";
                     break;
+                case 4:
+                    strMsg = "鍝佽川瀹℃牳";
+                    break;
+                case 5:
+                    strMsg = "鍝佽川鍙嶅鏍�";
+                    break;
             }
             ;
             toolBarMenu1.guidKey = "";
@@ -815,7 +919,7 @@
                 txtQuantity.Text = row["tld005"].ToString();//鐢宠鎬婚噺
                 txt_yQty.Text = row["ydy"].ToString();//宸叉墦鍗版�婚噺
                 txt_kQty.Text = row["kdy"].ToString();//鍙墦鍗版�婚噺
-                txt_psnQty_1.Text = row["tld005"].ToString(); //榛樿姣忓紶鏉$爜鏁伴噺
+                txt_psnQty_1.Text = row["kdy"].ToString(); //榛樿姣忓紶鏉$爜鏁伴噺
             }
             else
             {

--
Gitblit v1.9.3