From 84e8197da9284b10eb6fca4cd7a8931406d97ad6 Mon Sep 17 00:00:00 2001
From: lu <123456>
Date: 星期六, 12 七月 2025 16:22:14 +0800
Subject: [PATCH] bug

---
 DevApp/Gs.DevApp/DevFrm/Ck/Frm_MesCgthSq.cs |   68 ++++++++++++++++++++++++++-------
 1 files changed, 53 insertions(+), 15 deletions(-)

diff --git a/DevApp/Gs.DevApp/DevFrm/Ck/Frm_MesCgthSq.cs b/DevApp/Gs.DevApp/DevFrm/Ck/Frm_MesCgthSq.cs
index 216c52b..e343510 100644
--- a/DevApp/Gs.DevApp/DevFrm/Ck/Frm_MesCgthSq.cs
+++ b/DevApp/Gs.DevApp/DevFrm/Ck/Frm_MesCgthSq.cs
@@ -15,7 +15,6 @@
     {
         string _webServiceName = "MesCgthSqManager/";
         List<FilterEntity> _filterList = new List<FilterEntity>();
-        string _ucCk = "";//鍙戞枡浠撳簱
         string _ucGys = "";//渚涘簲鍟�
         public Frm_MesCgthSq()
         {
@@ -35,7 +34,7 @@
             Gs.DevApp.ToolBox.UtilityHelper.SetGridViewParameter(gridView1, picCheckBox, this, "status", "", (value) =>
             {
                 Gs.DevApp.ToolBox.UtilityHelper.JumpTab(xtraTabControl1, 0);
-            });
+            }, tips);
             Gs.DevApp.ToolBox.UtilityHelper.SetTabParameter(gridView1, xtraTabControl1, pageBar1, (value) =>
             {
                 getModel(value);
@@ -52,7 +51,6 @@
                 if (string.IsNullOrEmpty(orgId))
                     return;
                 txt_suppId.getSuppler(orgId, _ucGys);
-                txt_depotId.getSuppler(orgId, _ucCk);
             };
             //閫夋嫨闇�瑕佺殑鏄庣粏
             btnSelect.Click += (s, e) =>
@@ -85,6 +83,8 @@
                         gcMx1.BindingContext = new BindingContext();
                         gcMx1.DataSource = _oldTable;
                         gcMx1.ForceInitialize();
+                        gvMx1.BestFitColumns();
+                        Gs.DevApp.ToolBox.UtilityHelper.SetGridLayout(gvMx1);
                     }
                     catch (Exception ex)
                     {
@@ -132,7 +132,7 @@
             gridView1.ColumnFilterChanged -= GridView1_ColumnFilterChanged;
             gridView1.ActiveFilter.Clear();
             gridView1.ColumnFilterChanged += GridView1_ColumnFilterChanged;
-              var frm = new ShowFilter(gridView1.Columns, _filterList, this.GetType().FullName);
+            var frm = new ShowFilter(gridView1.Columns, _filterList, this.GetType().FullName);
             frm.UpdateParent += Frm_UpdateParent;
             frm.ShowDialog();
         }
@@ -285,6 +285,9 @@
             gridViews.Add(gvMx1);
             UtilityHelper.CleanValueByControl(this.layoutMx1.Controls, true, gridViews);
             Gs.DevApp.ToolBox.UtilityHelper.SetDefaultTable(gcMx1, gvMx1);
+            //澧炲姞鏃讹紝榛樿缁勭粐
+            string deftOrg = UtilityHelper.GetFirstOrg(txt_thOrgId);
+
         }
         /// <summary>
         /// 淇濆瓨浜嬩欢
@@ -294,7 +297,6 @@
         private void ToolBarMenu1_btnSaveClick(object sender, EventArgs e)
         {
             toolBarMenu1.isSetBtn = false;
-            var _ckId = txt_depotId.GetId(); //浠撳簱缂栧彿 depots_code
             var _gysId = txt_suppId.GetId(); //渚涘簲鍟嗙紪鍙�
             string _orgId = txt_thOrgId.GetId();
             if (string.IsNullOrEmpty(_orgId))
@@ -307,12 +309,6 @@
             {
                 MsgHelper.Warning("璇烽�夋嫨渚涘簲鍟嗭紒");
                 txt_suppId.Focus();
-                return;
-            }
-            if (string.IsNullOrEmpty(_ckId))
-            {
-                MsgHelper.Warning("璇烽�夋嫨浠撳簱锛�");
-                txt_depotId.Focus();
                 return;
             }
             if (txt_returnMethod.SelectedIndex <= 0)
@@ -332,7 +328,6 @@
                 Guid = Gs.DevApp.ToolBox.UtilityHelper.ToGuid(lbGuid.Text.Trim()), //鍒拌揣鍗曚富閿�
                 Remark = txt_remark.Text.Trim(), //澶囨敞
                 SuppId = int.Parse(_gysId), //渚涘簲鍟�
-                DepotId = int.Parse(_ckId),//浠撳簱
                 FType = txt_isOut.Checked == true ? 1 : 0,  //0=閲囪喘锛�1=濮斿
                 Fmrmode = txt_returnMethod.Text,//閫�鏂欐柟寮�
                 Reason = txt_returnType.Text,//閫�鏂欏師鍥�
@@ -358,12 +353,19 @@
                         MsgHelper.ShowError("鐢宠鏁伴噺涓嶈兘涓虹┖锛�");
                         return;
                     }
+                    string _depotId = row["depotId"].ToString();
+                    if (string.IsNullOrEmpty(_depotId))
+                    {
+                        MsgHelper.ShowError("浠撳簱涓嶈兘涓虹┖锛�");
+                        return;
+                    }
                     _obj.list.Add(new
                     {
                         Guid = _guid,
                         AboutGuid = UtilityHelper.ToGuid(row["rkmxGuid"].ToString()),
                         Quantity = decimal.Parse(row["sqNum"].ToString()),
                         Bz = row["remark"].ToString(),
+                        DepotId = row["depotId"].ToString(),
                     });
                 }
             }
@@ -399,7 +401,7 @@
         /// <param name="pageSize">姣忛〉鍑犳潯</param>
         private void getPageList(int curPage)
         {
-            var _sbSqlWhere = UtilityHelper.GetSearchWhere(_filterList);
+            gcMain1.DataSource = null; var _sbSqlWhere = UtilityHelper.GetSearchWhere(_filterList);
             PageQueryModel pgq = new PageQueryModel(curPage, this.pageBar1.RowsCount, "BILL_NO", "asc", "", _sbSqlWhere.ToString());
             string json = JsonConvert.SerializeObject(pgq);
             try
@@ -434,6 +436,10 @@
                 ToolBox.MsgHelper.ShowError("鎻愮ず锛�" + ex.Message);
             }
         }
+        /// <summary>
+        /// 璇诲彇瀹炰綋
+        /// </summary>
+        /// <param name="strGuid"></param>
         private void getModel(string strGuid)
         {
             bool isEdit = false;
@@ -456,13 +462,11 @@
                 {
                     dynamic dy = _rtn.rtnData;
                     _ucGys = dy.suppId;
-                    _ucCk = dy.depotId;
                     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 = "";
-                    _ucCk = "";
                     JObject _job = JObject.Parse(strJson);
                     JArray array = new JArray();
                     foreach (var a in _job["rtnData"]["list"])
@@ -545,6 +549,12 @@
                 MsgHelper.Warning("鎻愮ず锛�" + ex.Message);
             }
         }
+
+        /// <summary>
+        /// 鍒犻櫎鏄庣粏
+        /// </summary>
+        /// <param name="sender"></param>
+        /// <param name="e"></param>
         private void repositoryItemButtonEdit1_ButtonClick(object sender, DevExpress.XtraEditors.Controls.ButtonPressedEventArgs e)
         {
             gvMx1.CloseEditor();
@@ -587,5 +597,33 @@
                 }
             }
         }
+
+        /// <summary>
+        /// 鏌ユ壘浠撳簱
+        /// </summary>
+        /// <param name="sender"></param>
+        /// <param name="e"></param>
+        private void rptCk_ButtonClick(object sender, DevExpress.XtraEditors.Controls.ButtonPressedEventArgs e)
+        {
+            var rowhandle = gvMx1.FocusedRowHandle;
+            if (rowhandle < 0)
+                return;
+            //var dr = gvMx1.GetDataRow(rowhandle);
+            var strOrgGuid = txt_thOrgId.GetId();
+            if (string.IsNullOrEmpty(strOrgGuid))
+            {
+                MsgHelper.Warning("鎻愮ず锛氳鍏堥�夋嫨璋冨嚭缁勭粐锛�");
+                return;
+            };
+            SelectCk frm = new SelectCk(strOrgGuid);
+            frm.UpdateParent += (ss, ee) =>
+            {
+                var lst = new List<dynamic>();
+                lst = ee.DynamicList;
+                gvMx1.SetFocusedRowCellValue("depotName", lst[0].name);
+                gvMx1.SetFocusedRowCellValue("depotId", lst[0].guid);
+            };
+            frm.ShowDialog();
+        }
     }
 }
\ No newline at end of file

--
Gitblit v1.9.3