From ccc1b0d541d8f3bdd2bcb72dd0b5533e68b886d5 Mon Sep 17 00:00:00 2001
From: lu <99954486@qq.com>
Date: 星期一, 09 六月 2025 09:53:37 +0800
Subject: [PATCH] 采购明细报表

---
 DevApp/Gs.DevApp/DevFrm/WOM/Frm_Wompba.cs |  188 +++++++++++++++++++++++++++-------------------
 1 files changed, 109 insertions(+), 79 deletions(-)

diff --git a/DevApp/Gs.DevApp/DevFrm/WOM/Frm_Wompba.cs b/DevApp/Gs.DevApp/DevFrm/WOM/Frm_Wompba.cs
index 5852be0..c46f33b 100644
--- a/DevApp/Gs.DevApp/DevFrm/WOM/Frm_Wompba.cs
+++ b/DevApp/Gs.DevApp/DevFrm/WOM/Frm_Wompba.cs
@@ -17,6 +17,7 @@
     {
         string _webServiceName = "WompbaManager/";
         List<FilterEntity> _filterList = new List<FilterEntity>();
+        string _cjBm = "";//杞﹂棿
         public Frm_Wompba()
         {
             InitializeComponent();
@@ -29,24 +30,31 @@
             this.toolBarMenu1.btnQueryClick += ToolBarMenu1_btnQueryClick;
             toolBarMenu1.btnChkClick += ToolBarMenu1_btnChkClick;
             toolBarMenu1.btnFChkClick += ToolBarMenu1_btnFChkClick;
+            toolBarMenu1.btnLogClick += ToolBarMenu1_btnLogClick;
+            this.toolBarMenu1.getXmlConfig();
             Gs.DevApp.ToolBox.UtilityHelper.SetGridViewParameterMx(gvMx1);
             Gs.DevApp.ToolBox.UtilityHelper.SetGridViewParameter(gridView1, picCheckBox, this, "fstatus", "", (value) =>
             {
                 Gs.DevApp.ToolBox.UtilityHelper.JumpTab(xtraTabControl1, 0);
-            });
+            }, tips);
             Gs.DevApp.ToolBox.UtilityHelper.SetTabParameter(gridView1, xtraTabControl1, pageBar1, (value) =>
             {
                 getModel(value);
             }, (value) =>
             {
                 getPageList(this.pageBar1.CurrentPage);
-            });
+            }, lbGuid);
             getPageList(1);
             pageBar1.PagerEvent += PageBar1_PagerEvent;
-            this.txt_pba013.getSuppler("");
-            txt_erpSczz.EditChanged += (s, e) => {
-                txt_pba013.getSuppler(txt_erpSczz.GetId());
+            //閫夊瓨缁勭粐锛堝彉鏄庣粏涓殑鐗╂枡鍜岃溅闂达級
+            txt_erpSczz.EditChanged += (s, e) =>
+            {
+                string _orgId = txt_erpSczz.GetId();
+                if (string.IsNullOrEmpty(_orgId))
+                    return;
+                txt_pba013.getSuppler(_orgId, _cjBm);
             };
+            // 閫夋嫨杞﹂棿锛堝彉鏄庣粏涓骇绾匡級
             txt_pba013.EditChanged += (s, e) =>
             {
                 string workGuid = this.txt_pba013.GetId();
@@ -82,7 +90,12 @@
                         }
                         gcMx1.BindingContext = new BindingContext();
                         gcMx1.DataSource = _oldTable;
+                        gvMx1.CloseEditor();
+                        gvMx1.PostEditor();
+                        gvMx1.UpdateCurrentRow();
                         gcMx1.ForceInitialize();
+                        gvMx1.BestFitColumns();
+                        Gs.DevApp.ToolBox.UtilityHelper.SetGridLayout(gvMx1);
                     }
                     catch (Exception ex)
                     {
@@ -94,7 +107,7 @@
         }
         private void GridView1_ColumnFilterChanged(object sender, EventArgs e)
         {
-            _filterList = Gs.DevApp.ToolBox.UtilityHelper.GetDilter(gridView1.Columns);
+            _filterList = Gs.DevApp.ToolBox.UtilityHelper.GetDilter(gridView1.Columns, gridView1);
             Task.Delay(100);
             getPageList(1);
         }
@@ -115,10 +128,14 @@
         /// <param name="e"></param>
         private void ToolBarMenu1_btnQueryClick(object sender, EventArgs e)
         {
-            Gs.DevApp.UserControl.ShowFilter frm = new Gs.DevApp.UserControl.ShowFilter(gridView1.Columns, _filterList);
+            gridView1.ColumnFilterChanged -= GridView1_ColumnFilterChanged;
+            gridView1.ActiveFilter.Clear();
+            gridView1.ColumnFilterChanged += GridView1_ColumnFilterChanged;
+            var frm = new ShowFilter(gridView1.Columns, _filterList, this.GetType().FullName);
             frm.UpdateParent += Frm_UpdateParent;
             frm.ShowDialog();
         }
+
         /// <summary>
         /// 鏌ヨ鍥炶皟
         /// </summary>
@@ -126,34 +143,22 @@
         /// <param name="e"></param>
         private void Frm_UpdateParent(object sender, UpdateParentEventArgs e)
         {
-            gridView1.ColumnFilterChanged -= GridView1_ColumnFilterChanged;
-            gridView1.ActiveFilter.Clear();
-            gridView1.ColumnFilterChanged += GridView1_ColumnFilterChanged;
-            var frm = new ShowFilter(gridView1.Columns, _filterList);
-            frm.UpdateParent += Frm_UpdateParent;
-            frm.ShowDialog();
+            _filterList = e.FilterList;
+            getPageList(1);
         }
         /// <summary>
-        ///     瀹℃牳浜嬩欢
+        /// 鏃ュ織
         /// </summary>
         /// <param name="sender"></param>
         /// <param name="e"></param>
-        private void ToolBarMenu1_btnChkClick(object sender, EventArgs e)
+        private void ToolBarMenu1_btnLogClick(object sender, EventArgs e)
         {
-            _toolCk(1, "EditModelSubmit");
+            toolBarMenu1.guidKey = "";
+            string rowGuid, rowName;
+            (rowGuid, rowName) = UtilityHelper.GetCurrentRow(xtraTabControl1,
+                lbGuid, txt_hNo, gridView1);
+            toolBarMenu1.guidKey = rowGuid;
         }
-
-        /// <summary>
-        ///     鍙嶅鏍�
-        /// </summary>
-        /// <param name="sender"></param>
-        /// <param name="e"></param>
-        /// <exception cref="NotImplementedException"></exception>
-        private void ToolBarMenu1_btnFChkClick(object sender, EventArgs e)
-        {
-            _toolCk(0, "EditModelSubmitFSH");
-        }
-
         /// <summary>
         /// 鍙栨秷浜嬩欢
         /// </summary>
@@ -195,9 +200,10 @@
                 if (_rtn.rtnCode > 0)
                 {
                     if (xtraTabControl1.SelectedTabPageIndex == 0)
-                        getPageList(this.pageBar1.CurrentPage);
+                    { }
                     else
                         Gs.DevApp.ToolBox.UtilityHelper.JumpTab(xtraTabControl1, 2);
+                    getPageList(this.pageBar1.CurrentPage);
                 }
                 MsgHelper.Warning("鎻愮ず锛�" + _rtn.rtnMsg);
             }
@@ -206,7 +212,6 @@
                 MsgHelper.Warning("鎻愮ず锛�" + ex.Message);
             }
         }
-
         /// <summary>
         /// 鍒锋柊浜嬩欢
         /// </summary>
@@ -218,16 +223,39 @@
                 getModel(lbGuid.Text.Trim());
             else
             {
-                _filterList.Clear();
-                if (gridView1.ActiveFilter.Count > 0)
-                {
-                    gridView1.ColumnFilterChanged -= GridView1_ColumnFilterChanged;
-                    gridView1.ActiveFilter.Clear();
-                    gridView1.ColumnFilterChanged += GridView1_ColumnFilterChanged;
-                }
-                getPageList(1);
+                //_filterList.Clear();
+                //if (gridView1.ActiveFilter.Count > 0)
+                //{
+                //    gridView1.ColumnFilterChanged -= GridView1_ColumnFilterChanged;
+                //    gridView1.ActiveFilter.Clear();
+                //    gridView1.ColumnFilterChanged += GridView1_ColumnFilterChanged;
+                //}
+                //getPageList(1);
+                getPageList(this.pageBar1.CurrentPage);
             }
         }
+        /// <summary>
+        ///     瀹℃牳浜嬩欢
+        /// </summary>
+        /// <param name="sender"></param>
+        /// <param name="e"></param>
+        private void ToolBarMenu1_btnChkClick(object sender, EventArgs e)
+        {
+            _toolCk(1, "EditModelSubmit");
+        }
+
+        /// <summary>
+        ///     鍙嶅鏍�
+        /// </summary>
+        /// <param name="sender"></param>
+        /// <param name="e"></param>
+        /// <exception cref="NotImplementedException"></exception>
+        private void ToolBarMenu1_btnFChkClick(object sender, EventArgs e)
+        {
+            _toolCk(0, "EditModelSubmitFSH");
+        }
+
+
         /// <summary>
         /// 淇敼浜嬩欢
         /// </summary>
@@ -235,11 +263,12 @@
         /// <param name="e"></param>
         private void ToolBarMenu1_btnEdtClick(object sender, EventArgs e)
         {
-            string rowGuid = "", rowName = "";
-            (rowGuid, rowName) = UtilityHelper.GetCurrentRow(xtraTabControl1, lbGuid, txt_hNo, gridView1);
+            string rowGuid, rowName;
+            (rowGuid, rowName) = UtilityHelper.GetCurrentRow(xtraTabControl1,
+                lbGuid, txt_hNo, gridView1);
             if (string.IsNullOrEmpty(rowGuid))
             {
-                ToolBox.MsgHelper.Warning("璇峰厛閫夋嫨浣犺鎿嶄綔鐨勮锛�");
+                MsgHelper.Warning("璇峰厛閫夋嫨浣犺鎿嶄綔鐨勮锛�");
                 return;
             }
             Gs.DevApp.ToolBox.UtilityHelper.JumpTab(xtraTabControl1, 3);
@@ -251,7 +280,7 @@
             {
                 List<DevExpress.XtraGrid.Views.Grid.GridView> gvList = new List<DevExpress.XtraGrid.Views.Grid.GridView>();
                 gvList.Add(gvMx1);
-                UtilityHelper.ChangeEnableByControl(panel1.Controls, true, gvList);
+                UtilityHelper.ChangeEnableByControl(this.layoutMx1.Controls, true, gvList);
             }
         }
         /// <summary>
@@ -265,9 +294,8 @@
             Gs.DevApp.ToolBox.UtilityHelper.JumpTab(xtraTabControl1, 4);
             List<DevExpress.XtraGrid.Views.Grid.GridView> gridViews = new List<DevExpress.XtraGrid.Views.Grid.GridView>();
             gridViews.Add(gvMx1);
-            UtilityHelper.CleanValueByControl(this.panel1.Controls, true, gridViews);
+            UtilityHelper.CleanValueByControl(this.layoutMx1.Controls, true, gridViews);
             Gs.DevApp.ToolBox.UtilityHelper.SetDefaultTable(gcMx1, gvMx1);
-
         }
         /// <summary>
         /// 淇濆瓨浜嬩欢
@@ -292,10 +320,11 @@
                 list = new List<dynamic>(),
             };
             gvMx1.CloseEditor();
+            gvMx1.PostEditor();
             gvMx1.UpdateCurrentRow();
             if (gvMx1.DataRowCount <= 0)
             {
-                MsgHelper.ShowError("鏄庣粏涓嶈兘涓虹┖锛岃閫夋嫨浣犵殑鏀舵枡鏄庣粏锛�");
+                MsgHelper.ShowError("鏄庣粏涓嶈兘涓虹┖锛岃閫夋嫨鏄庣粏锛�");
                 return;
             }
             for (var i = 0; i < gvMx1.DataRowCount; i++)
@@ -304,16 +333,15 @@
                 if (row != null)
                 {
                     Guid? _guid = UtilityHelper.ToGuid(row["guid"].ToString());
-                    //string _LineId = row["daa015"].ToString();
-                    //if (string.IsNullOrEmpty(_LineId))
-                    //{
-                    //    MsgHelper.ShowError("浜х嚎缂栫爜涓嶈兘涓虹┖锛�");
-                    //    return;
-                    //}
-                    string _Pcsl = row["daa008"].ToString();
-                    if (string.IsNullOrEmpty(_Pcsl))
+                    string _LineId = row["daa015"].ToString();
+                    if (string.IsNullOrEmpty(_LineId))
                     {
-                        MsgHelper.ShowError("鎺掍骇鏁伴噺涓嶈兘涓虹┖锛�");
+                        MsgHelper.ShowError("绾垮埆涓嶈兘涓虹┖锛�");
+                        return;
+                    }
+                    if (Gs.DevApp.ToolBox.UtilityHelper.ToDecimal(row["daa008"].ToString()) <= 0)
+                    {
+                        MsgHelper.ShowError("璇疯緭鍏ユ纭殑鎺掍骇鏁伴噺锛�");
                         return;
                     }
                     string _Yjkgsj = row["mesStartProd"].ToString();
@@ -374,11 +402,14 @@
                 ToolBox.MsgHelper.Warning("鎻愮ず锛�" + _rtn.rtnMsg);
                 if (_rtn.rtnCode > 0)
                 {
-                    lbGuid.Text = _rtn.rtnData;
+                    lbGuid.Text = _rtn.rtnData.outGuid;
+                    txt_hNo.Text = _rtn.rtnData.outNo;
                     toolBarMenu1.isSetBtn = true;
                     List<DevExpress.XtraGrid.Views.Grid.GridView> gvList = new List<DevExpress.XtraGrid.Views.Grid.GridView>();
                     gvList.Add(gvMx1);
-                    UtilityHelper.ChangeEnableByControl(this.panel1.Controls, false, gvList);
+                    UtilityHelper.ChangeEnableByControl(this.layoutMx1.Controls, false, gvList);
+                    toolBarMenu1.currentAction = "";
+                    Gs.DevApp.ToolBox.UtilityHelper.JumpTab(xtraTabControl1, 6);
                 }
             }
             catch (Exception ex)
@@ -394,7 +425,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, "create_date", "asc", "", _sbSqlWhere.ToString());
             string json = JsonConvert.SerializeObject(pgq);
             try
@@ -405,15 +436,16 @@
                 if (dd.rtnCode > 0)
                 {
                     DataTable dt = dd.rtnData.list;
-                    gcMain.BindingContext = new BindingContext();
+                    gcMain1.BindingContext = new BindingContext();
                     gridView1.ColumnFilterChanged -= GridView1_ColumnFilterChanged;
                     if (dt.Rows.Count > 0)
                     {
-                        gcMain.DataSource = dt;
-                        gcMain.ForceInitialize();
+                        gcMain1.DataSource = dt;
+                        gcMain1.ForceInitialize();
+                        gridView1.BestFitColumns(); Gs.DevApp.ToolBox.UtilityHelper.SetGridLayout(gridView1);
                     }
                     else
-                        UtilityHelper.SetDefaultTable(gcMain, gridView1);
+                        UtilityHelper.SetDefaultTable(gcMain1, gridView1);
                     gridView1.ColumnFilterChanged += GridView1_ColumnFilterChanged;
                     pageBar1.TotalPages = dd.rtnData.pages;//鎬婚〉
                     pageBar1.CurrentPage = curPage;//褰撳墠椤�
@@ -432,17 +464,12 @@
         }
         private void getModel(string strGuid)
         {
-           
             bool isEdit = false;
-            if (toolBarMenu1.currentAction == "add")
-            {
-                Gs.DevApp.ToolBox.UtilityHelper.SetDefaultTable(gcMx1, gvMx1);
-                return;
-            };
+            if (toolBarMenu1.currentAction == "add") return;
             if (toolBarMenu1.currentAction == "edit") isEdit = true;
             if (string.IsNullOrEmpty(strGuid))
             {
-                ToolBox.MsgHelper.Warning("璇峰厛閫夋嫨浣犺鎿嶄綔鐨勮锛�");
+                MsgHelper.Warning("璇峰厛閫夋嫨浣犺鎿嶄綔鐨勮锛�");
                 return;
             }
             var _obj = new
@@ -456,10 +483,12 @@
                 if (_rtn.rtnCode > 0)
                 {
                     dynamic dy = _rtn.rtnData;
+                    _cjBm = dy.pba013;
                     lbGuid.Text = strGuid;
                     List<DevExpress.XtraGrid.Views.Grid.GridView> gvList = new List<DevExpress.XtraGrid.Views.Grid.GridView>();
                     gvList.Add(gvMx1);
-                    UtilityHelper.SetValueByObj(this.panel1.Controls, dy, isEdit, gvList);
+                    UtilityHelper.SetValueByObj(this.layoutMx1.Controls, dy, isEdit, gvList);
+                    _cjBm = "";
                     JObject _job = JObject.Parse(strJson);
                     JArray array = new JArray();
                     foreach (var a in _job["rtnData"]["list"])
@@ -472,6 +501,8 @@
                         gcMx1.BindingContext = new BindingContext();
                         gcMx1.DataSource = dt;
                         gcMx1.ForceInitialize();
+                        gvMx1.BestFitColumns();
+                        Gs.DevApp.ToolBox.UtilityHelper.SetGridLayout(gvMx1);
                     }
                     else
                     {
@@ -486,7 +517,6 @@
                 ToolBox.MsgHelper.Warning("鎻愮ず锛�" + ex.Message);
             }
         }
-
         private void repositoryItemButtonEdit1_ButtonClick(object sender, DevExpress.XtraEditors.Controls.ButtonPressedEventArgs e)
         {
             var rowhandle = gvMx1.FocusedRowHandle;
@@ -536,7 +566,7 @@
             rptJYBZ.Items.Clear();
             if (string.IsNullOrEmpty(workGuid))
                 return;
-            var _sbSqlWhere = " and 1=1 and dpt_id="+ workGuid;
+            var _sbSqlWhere = " and 1=1 and dpt_id=" + workGuid;
             var pgq = new PageQueryModel(1, 999999, "a.line_no", "asc", "", _sbSqlWhere.ToString());
             var json = JsonConvert.SerializeObject(pgq);
             try
@@ -554,7 +584,6 @@
                 MsgHelper.Warning("鎻愮ず锛�" + ex.Message);
             }
         }
-
         private void rptJYBZ_SelectedIndexChanged(object sender, EventArgs e)
         {
             ComboBoxEdit comboBox = sender as ComboBoxEdit;
@@ -566,6 +595,7 @@
                 string _val = _itm.Value.ToString();
                 string _txt = _itm.Text.ToString();
                 gvMx1.CloseEditor();
+                gvMx1.PostEditor();
                 gvMx1.UpdateCurrentRow();
                 gvMx1.SetRowCellValue(dataIndex, "daa015LineName", _txt);
                 gvMx1.SetRowCellValue(dataIndex, "daa015", _val);
@@ -605,24 +635,24 @@
             };
             try
             {
-                var strJson = UtilityHelper.HttpPost("",
-                    _webServiceName + _mth,
-                    JsonConvert.SerializeObject(_obj));
+                var strJson = UtilityHelper.HttpPost("", _webServiceName + _mth, JsonConvert.SerializeObject(_obj));
                 var _rtn = UtilityHelper.ReturnToDynamic(strJson);
                 MsgHelper.Warning(_rtn.rtnData.outMsg.ToString());
-                if (_rtn.rtnCode > 0)
+                if (_rtn.rtnCode > 0 && _rtn.rtnData.outSum * 1 > 0)
                 {
                     if (xtraTabControl1.SelectedTabPageIndex == 1)
+                    {
                         getModel(lbGuid.Text.Trim());
-                    else
-                        getPageList(this.pageBar1.CurrentPage);
+                    }
+                    int rowHandle = gridView1.LocateByValue(1, gridView1.Columns["guid"], rowGuid);
+                    gridView1.FocusedRowHandle = rowHandle;
+                    UtilityHelper.SetCheckIco(gridView1, "fstatus", "checkUser", "checkDate", picCheckBox, this, _inFieldValue.ToString());
                 }
             }
             catch (Exception ex)
             {
                 MsgHelper.Warning("鎻愮ず锛�" + ex.Message);
             }
-
         }
     }
 }
\ No newline at end of file

--
Gitblit v1.9.3