From aa64d5ff0554624339d504f926e955c0ce339b0b Mon Sep 17 00:00:00 2001
From: lu <123456>
Date: 星期一, 14 七月 2025 17:38:29 +0800
Subject: [PATCH] bug

---
 DevApp/Gs.DevApp/DevFrm/Ck/Frm_MesCgthSq.cs |  202 ++++++++++++++++++++++++++++++++++++++------------
 1 files changed, 154 insertions(+), 48 deletions(-)

diff --git a/DevApp/Gs.DevApp/DevFrm/Ck/Frm_MesCgthSq.cs b/DevApp/Gs.DevApp/DevFrm/Ck/Frm_MesCgthSq.cs
index e343510..0d34401 100644
--- a/DevApp/Gs.DevApp/DevFrm/Ck/Frm_MesCgthSq.cs
+++ b/DevApp/Gs.DevApp/DevFrm/Ck/Frm_MesCgthSq.cs
@@ -16,6 +16,7 @@
         string _webServiceName = "MesCgthSqManager/";
         List<FilterEntity> _filterList = new List<FilterEntity>();
         string _ucGys = "";//渚涘簲鍟�
+        string _ucBm = "";//閮ㄩ棬
         public Frm_MesCgthSq()
         {
             InitializeComponent();
@@ -51,6 +52,8 @@
                 if (string.IsNullOrEmpty(orgId))
                     return;
                 txt_suppId.getSuppler(orgId, _ucGys);
+                txt_fPurchaseDeptId.getSuppler(orgId, _ucBm);
+                // txt_fPurchaserId.getSuppler();
             };
             //閫夋嫨闇�瑕佺殑鏄庣粏
             btnSelect.Click += (s, e) =>
@@ -60,38 +63,61 @@
                     Gs.DevApp.ToolBox.MsgHelper.ShowError("璇峰厛閫夋嫨渚涘簲鍟嗭紒");
                     return;
                 }
-                var frm = new SelectMesCgthSq(this.txt_suppId.GetId(), this.txt_thOrgId.GetId());
-                //璧嬪�肩粰鏄庣粏琛�
-                frm.UpdateParent += (ss, ee) =>
+                if (txt_fHasLinkRad.SelectedIndex == 0)
                 {
-                    try
+                    var frm = new SelectMesCgthSq(this.txt_suppId.GetId(), this.txt_thOrgId.GetId());
+                    //璧嬪�肩粰鏄庣粏琛�
+                    frm.UpdateParent += (ss, ee) =>
                     {
-                        var lst = new List<string>();
-                        lst = ee.StringList;
-                        var _obj = lst;
-                        var strReturn = UtilityHelper.HttpPost("",
-                            _webServiceName + "SelectFormTo",
-                            JsonConvert.SerializeObject(_obj));
-                        var dt = UtilityHelper.ReturnToList(strReturn);
-                        DataTable _newTable = dt.rtnData;
-                        DataTable _oldTable = (DataTable)gcMx1.DataSource;
-                        DataRow[] sourceRows = _newTable.Select();
-                        for (int i = 0; i < sourceRows.Length; i++)
+                        try
                         {
-                            _oldTable.ImportRow(sourceRows[i]);
+                            var lst = new List<string>();
+                            lst = ee.StringList;
+                            var _obj = lst;
+                            var strReturn = UtilityHelper.HttpPost("",
+                                _webServiceName + "SelectFormTo",
+                                JsonConvert.SerializeObject(_obj));
+                            var dt = UtilityHelper.ReturnToList(strReturn);
+                            DataTable _newTable = dt.rtnData;
+                            DataTable _oldTable = (DataTable)gcMx1.DataSource;
+                            DataRow[] sourceRows = _newTable.Select();
+                            for (int i = 0; i < sourceRows.Length; i++)
+                            {
+                                _oldTable.ImportRow(sourceRows[i]);
+                            }
+                            gcMx1.BindingContext = new BindingContext();
+                            gcMx1.DataSource = _oldTable;
+                            gcMx1.ForceInitialize();
+                            gvMx1.BestFitColumns();
+                            Gs.DevApp.ToolBox.UtilityHelper.SetGridLayout(gvMx1);
                         }
-                        gcMx1.BindingContext = new BindingContext();
-                        gcMx1.DataSource = _oldTable;
-                        gcMx1.ForceInitialize();
-                        gvMx1.BestFitColumns();
-                        Gs.DevApp.ToolBox.UtilityHelper.SetGridLayout(gvMx1);
-                    }
-                    catch (Exception ex)
+                        catch (Exception ex)
+                        {
+                            MessageBox.Show(ex.Message);
+                        }
+                    };
+                    frm.ShowDialog();
+                    return;
+                }
+                if (txt_fHasLinkRad.SelectedIndex == 1)
+                {
+                    var frm2 = new SelectMesCgthSqLink(this.txt_thOrgId.GetId());
+                    frm2.UpdateParent += (ss, ee) =>
                     {
-                        MessageBox.Show(ex.Message);
-                    }
-                };
-                frm.ShowDialog();
+                    };
+                    frm2.ShowDialog();
+                    return;
+                }
+            };
+            //婧愬崟浜嬩欢
+            txt_fHasLinkRad.SelectedIndex = 0;
+            layItem1.Visibility = DevExpress.XtraLayout.Utils.LayoutVisibility.Never;
+            layItem2.Visibility = DevExpress.XtraLayout.Utils.LayoutVisibility.Never;
+            layItem3.Visibility = DevExpress.XtraLayout.Utils.LayoutVisibility.Never;
+            layItem4.Visibility = DevExpress.XtraLayout.Utils.LayoutVisibility.Never;
+            txt_fHasLinkRad.SelectedIndexChanged += (s, e) =>
+            {
+                setSrm();
             };
         }
         private async void GridView1_ColumnFilterChanged(object sender, EventArgs e)
@@ -271,6 +297,15 @@
                 gvList.Add(gvMx1);
                 UtilityHelper.ChangeEnableByControl(this.layoutMx1.Controls, true, gvList);
             }
+            //2025/07/12鍔犱笂淇敼鐘舵�佷笅涓嶈兘淇敼
+            setSrm();
+            txt_thOrgId.IsReadly = true;
+            txt_suppId.IsReadly = true;
+            txt_fHasLinkRad.ReadOnly = true;
+            txt_fRequireOrgId.IsReadly = true;
+            txt_fOwnerIdHead.IsReadly = true;
+            txt_fPurchaseDeptId.IsReadly = true;
+            txt_fPurchaserId.IsReadly = true;
         }
         /// <summary>
         /// 鏂板浜嬩欢
@@ -287,7 +322,9 @@
             Gs.DevApp.ToolBox.UtilityHelper.SetDefaultTable(gcMx1, gvMx1);
             //澧炲姞鏃讹紝榛樿缁勭粐
             string deftOrg = UtilityHelper.GetFirstOrg(txt_thOrgId);
-
+            string deftXqOrg = UtilityHelper.GetFirstOrg(txt_fRequireOrgId);
+            string deftHzOrg = UtilityHelper.GetFirstOrg(txt_fOwnerIdHead);
+            setSrm();
         }
         /// <summary>
         /// 淇濆瓨浜嬩欢
@@ -298,30 +335,62 @@
         {
             toolBarMenu1.isSetBtn = false;
             var _gysId = txt_suppId.GetId(); //渚涘簲鍟嗙紪鍙�
-            string _orgId = txt_thOrgId.GetId();
+            string _orgId = txt_thOrgId.GetId();//閫�璐х粍缁�
+            string _xqzz = txt_fRequireOrgId.GetId();//闇�姹傜粍缁�
+            string _hz = txt_fOwnerIdHead.GetId();//璐т富
+            string _bm = txt_fPurchaseDeptId.GetId();//閮ㄩ棬
+            string _ygbh = txt_fPurchaserId.GetId();//鍛樺伐
             if (string.IsNullOrEmpty(_orgId))
             {
-                MsgHelper.Warning("璇烽�夋嫨缁勭粐锛�");
+                MsgHelper.ShowError("璇烽�夋嫨缁勭粐锛�");
                 txt_thOrgId.Focus();
                 return;
             }
             if (string.IsNullOrEmpty(_gysId))
             {
-                MsgHelper.Warning("璇烽�夋嫨渚涘簲鍟嗭紒");
+                MsgHelper.ShowError("璇烽�夋嫨渚涘簲鍟嗭紒");
                 txt_suppId.Focus();
                 return;
             }
             if (txt_returnMethod.SelectedIndex <= 0)
             {
-                MsgHelper.Warning("璇烽�夋嫨閫�鏂欐柟寮忥紒");
+                MsgHelper.ShowError("璇烽�夋嫨閫�鏂欐柟寮忥紒");
                 txt_returnMethod.Focus();
                 return;
             }
             if (txt_returnType.SelectedIndex <= 0)
             {
-                MsgHelper.Warning("璇烽�夋嫨閫�鏂欏師鍥狅紒");
+                MsgHelper.ShowError("璇烽�夋嫨閫�鏂欏師鍥狅紒");
                 txt_returnType.Focus();
                 return;
+            }
+            //鏃犳簮鍗曡鍔犱笂鏉′欢
+            if (txt_fHasLinkRad.SelectedIndex == 1)
+            {
+                if (string.IsNullOrEmpty(_xqzz))
+                {
+                    MsgHelper.ShowError("璇烽�夋嫨闇�姹傜粍缁囷紒");
+                    txt_fRequireOrgId.Focus();
+                    return;
+                }
+                if (string.IsNullOrEmpty(_hz))
+                {
+                    MsgHelper.ShowError("璇烽�夋嫨璐т富锛�");
+                    txt_fOwnerIdHead.Focus();
+                    return;
+                }
+                if (string.IsNullOrEmpty(_bm))
+                {
+                    MsgHelper.ShowError("璇烽�夋嫨閮ㄩ棬锛�");
+                    txt_fPurchaseDeptId.Focus();
+                    return;
+                }
+                if (string.IsNullOrEmpty(_ygbh))
+                {
+                    MsgHelper.ShowError("璇烽�夋嫨鍛樺伐锛�");
+                    txt_fPurchaserId.Focus();
+                    return;
+                }
             }
             var _obj = new
             {
@@ -331,6 +400,12 @@
                 FType = txt_isOut.Checked == true ? 1 : 0,  //0=閲囪喘锛�1=濮斿
                 Fmrmode = txt_returnMethod.Text,//閫�鏂欐柟寮�
                 Reason = txt_returnType.Text,//閫�鏂欏師鍥�
+                thOrgId = _orgId,
+                fHasLink = txt_fHasLinkRad.SelectedIndex,
+                fRequireOrgId = _xqzz,
+                fPurchaseDeptId = _bm,
+                fPurchaserId = _ygbh,
+                fOwnerIdHead = _hz,
                 list = new List<dynamic>(),
             };
             gvMx1.CloseEditor();
@@ -375,9 +450,9 @@
                     _webServiceName + "EditModel",
                     JsonConvert.SerializeObject(_obj));
                 var _rtn = UtilityHelper.ReturnToDynamic(strJson);
-                MsgHelper.Warning("鎻愮ず锛�" + _rtn.rtnMsg);
                 if (_rtn.rtnCode > 0)
                 {
+                    MsgHelper.ShowInformation("鎻愮ず锛�" + _rtn.rtnMsg);
                     lbGuid.Text = _rtn.rtnData.outGuid;
                     txt_billNo.Text = _rtn.rtnData.outNo;
                     toolBarMenu1.isSetBtn = true;
@@ -387,10 +462,12 @@
                     toolBarMenu1.currentAction = "";
                     Gs.DevApp.ToolBox.UtilityHelper.JumpTab(xtraTabControl1, 6);
                 }
+                else
+                    MsgHelper.ShowError("鎻愮ず锛�" + _rtn.rtnMsg);
             }
             catch (Exception ex)
             {
-                MsgHelper.Warning("鎻愮ず锛�" + ex.Message);
+                MsgHelper.ShowError("鎻愮ず锛�" + ex.Message);
             }
         }
 
@@ -447,7 +524,7 @@
             if (toolBarMenu1.currentAction == "edit") isEdit = true;
             if (string.IsNullOrEmpty(strGuid))
             {
-                ToolBox.MsgHelper.Warning("璇峰厛閫夋嫨浣犺鎿嶄綔鐨勮锛�");
+                ToolBox.MsgHelper.ShowError("璇峰厛閫夋嫨浣犺鎿嶄綔鐨勮锛�");
                 return;
             }
             var _obj = new
@@ -462,11 +539,13 @@
                 {
                     dynamic dy = _rtn.rtnData;
                     _ucGys = dy.suppId;
+                    _ucBm = dy.fPurchaseDeptId;
                     lbGuid.Text = strGuid;
                     List<DevExpress.XtraGrid.Views.Grid.GridView> gvList = new List<DevExpress.XtraGrid.Views.Grid.GridView>();
                     gvList.Add(gvMx1);
                     UtilityHelper.SetValueByObj(this.layoutMx1.Controls, dy, isEdit, gvList);
                     _ucGys = "";
+                    _ucBm = "";
                     JObject _job = JObject.Parse(strJson);
                     JArray array = new JArray();
                     foreach (var a in _job["rtnData"]["list"])
@@ -486,13 +565,14 @@
                     {
                         Gs.DevApp.ToolBox.UtilityHelper.SetDefaultTable(gcMx1, gvMx1);
                     }
+                    setSrm();
                 }
                 else
-                    ToolBox.MsgHelper.Warning("鎻愮ず锛�" + _rtn.rtnMsg);
+                    ToolBox.MsgHelper.ShowError("鎻愮ず锛�" + _rtn.rtnMsg);
             }
             catch (Exception ex)
             {
-                ToolBox.MsgHelper.Warning("鎻愮ず锛�" + ex.Message);
+                ToolBox.MsgHelper.ShowError("鎻愮ず锛�" + ex.Message);
             }
         }
         /// <summary>
@@ -510,13 +590,14 @@
                 case 0:
                     strMsg = "鍙嶅鏍�";
                     break;
-            };
+            }
+            ;
             toolBarMenu1.guidKey = "";
             string rowGuid, rowName;
             (rowGuid, rowName) = UtilityHelper.GetCurrentRow(xtraTabControl1, lbGuid, txt_billNo, gridView1, "billNo");
             if (string.IsNullOrEmpty(rowGuid))
             {
-                MsgHelper.Warning("璇峰厛閫夋嫨浣犺鎿嶄綔鐨勮锛�");
+                MsgHelper.ShowError("璇峰厛閫夋嫨浣犺鎿嶄綔鐨勮锛�");
                 return;
             }
             if (!MsgHelper.AskQuestion("浣犻�夋嫨浜嗐��" + rowName + "銆戯紝纭畾" + strMsg + "鍚楋紵"))
@@ -532,9 +613,9 @@
                     _webServiceName + "EditModelSubmit",
                     JsonConvert.SerializeObject(_obj));
                 var _rtn = UtilityHelper.ReturnToDynamic(strJson);
-                MsgHelper.Warning(_rtn.rtnData.outMsg.ToString());
                 if (_rtn.rtnCode > 0 && _rtn.rtnData.outSum * 1 > 0)
                 {
+                    MsgHelper.ShowInformation(_rtn.rtnData.outMsg.ToString());
                     if (xtraTabControl1.SelectedTabPageIndex == 1)
                     {
                         getModel(lbGuid.Text.Trim());
@@ -543,10 +624,12 @@
                     gridView1.FocusedRowHandle = rowHandle;
                     UtilityHelper.SetCheckIco(gridView1, "status", "checkUser", "checkDate", picCheckBox, this, _inFieldValue.ToString());
                 }
+                else
+                    MsgHelper.ShowError(_rtn.rtnData.outMsg.ToString());
             }
             catch (Exception ex)
             {
-                MsgHelper.Warning("鎻愮ず锛�" + ex.Message);
+                MsgHelper.ShowError("鎻愮ず锛�" + ex.Message);
             }
         }
 
@@ -587,13 +670,15 @@
                     var _rtn = UtilityHelper.ReturnToDynamic(strJson);
                     if (_rtn.rtnCode > 0)
                     {
-                        if (_rtn.rtnCode > 0) getModel(lbGuid.Text);
+                        getModel(lbGuid.Text);
+                        MsgHelper.ShowInformation("鎻愮ず锛�" + _rtn.rtnMsg);
                     }
-                    MsgHelper.Warning("鎻愮ず锛�" + _rtn.rtnMsg);
+                    else
+                        MsgHelper.ShowError("鎻愮ず锛�" + _rtn.rtnMsg);
                 }
                 catch (Exception ex)
                 {
-                    MsgHelper.Warning("鎻愮ず锛�" + ex.Message);
+                    MsgHelper.ShowError("鎻愮ず锛�" + ex.Message);
                 }
             }
         }
@@ -608,13 +693,13 @@
             var rowhandle = gvMx1.FocusedRowHandle;
             if (rowhandle < 0)
                 return;
-            //var dr = gvMx1.GetDataRow(rowhandle);
             var strOrgGuid = txt_thOrgId.GetId();
             if (string.IsNullOrEmpty(strOrgGuid))
             {
-                MsgHelper.Warning("鎻愮ず锛氳鍏堥�夋嫨璋冨嚭缁勭粐锛�");
+                MsgHelper.ShowError("鎻愮ず锛氳鍏堥�夋嫨璋冨嚭缁勭粐锛�");
                 return;
-            };
+            }
+            ;
             SelectCk frm = new SelectCk(strOrgGuid);
             frm.UpdateParent += (ss, ee) =>
             {
@@ -625,5 +710,26 @@
             };
             frm.ShowDialog();
         }
+
+
+        private void setSrm()
+        {
+            int ddd = txt_fHasLinkRad.SelectedIndex;
+            if (ddd == 0)
+            {
+                layItem1.Visibility = DevExpress.XtraLayout.Utils.LayoutVisibility.Never;
+                layItem2.Visibility = DevExpress.XtraLayout.Utils.LayoutVisibility.Never;
+                layItem3.Visibility = DevExpress.XtraLayout.Utils.LayoutVisibility.Never;
+                layItem4.Visibility = DevExpress.XtraLayout.Utils.LayoutVisibility.Never;
+            }
+            else
+            {
+                layItem1.Visibility = DevExpress.XtraLayout.Utils.LayoutVisibility.Always;
+                layItem2.Visibility = DevExpress.XtraLayout.Utils.LayoutVisibility.Always;
+                layItem3.Visibility = DevExpress.XtraLayout.Utils.LayoutVisibility.Always;
+                layItem4.Visibility = DevExpress.XtraLayout.Utils.LayoutVisibility.Always;
+            }
+        }
+
     }
 }
\ No newline at end of file

--
Gitblit v1.9.3