From dd7c9629d16d81bde03e42b3e9e984088f3e4d2c Mon Sep 17 00:00:00 2001
From: lu <99954486@qq.com>
Date: 星期二, 21 一月 2025 17:28:47 +0800
Subject: [PATCH] 细节

---
 DevApp/Gs.DevApp/DevFrm/Rk/Frm_MesItemQtrk.cs |  287 ++++++++++++++++++++++++++++++++++-----------------------
 1 files changed, 172 insertions(+), 115 deletions(-)

diff --git a/DevApp/Gs.DevApp/DevFrm/Rk/Frm_MesItemQtrk.cs b/DevApp/Gs.DevApp/DevFrm/Rk/Frm_MesItemQtrk.cs
index f055670..18c9a08 100644
--- a/DevApp/Gs.DevApp/DevFrm/Rk/Frm_MesItemQtrk.cs
+++ b/DevApp/Gs.DevApp/DevFrm/Rk/Frm_MesItemQtrk.cs
@@ -7,10 +7,9 @@
 using System;
 using System.Collections.Generic;
 using System.Data;
-using System.Drawing;
 using System.Threading.Tasks;
 using System.Windows.Forms;
-using System.Windows.Media.Animation;
+
 
 namespace Gs.DevApp.DevFrm
 {
@@ -30,8 +29,8 @@
             this.toolBarMenu1.btnQueryClick += ToolBarMenu1_btnQueryClick;
             toolBarMenu1.btnChkClick += ToolBarMenu1_btnChkClick;
             toolBarMenu1.btnFChkClick += ToolBarMenu1_btnFChkClick;
-            toolBarMenu1.btnReportClick += ToolBarMenu1_btnReportClick;
-            toolBarMenu1.btnDesignClick += ToolBarMenu1_btnDesignClick;
+            Gs.DevApp.ToolBox.UtilityHelper.SetGridViewParameterMx(gvMx1);
+            Gs.DevApp.ToolBox.UtilityHelper.SetGridViewParameterMx(gvMx2);
             Gs.DevApp.ToolBox.UtilityHelper.SetGridViewParameter(gridView1, picCheckBox, this, "qt015", "", (value) =>
             {
                 Gs.DevApp.ToolBox.UtilityHelper.JumpTab(xtraTabControl1, 0);
@@ -45,10 +44,10 @@
             });
             getPageList(1);
             pageBar1.PagerEvent += PageBar1_PagerEvent;
-            txt_qt011.getSuppler("");
+            txt_qt008.getSuppler("");
             txt_qt018.getSuppler("");
             //璁剧疆浠撳簱閫夋嫨
-            this.txt_qt011.EditChanged += (s, e) =>
+            this.txt_qt008.EditChanged += (s, e) =>
             {
 
             };
@@ -77,15 +76,52 @@
             {
                 MsgHelper.Warning("鎻愮ず锛�" + ex.Message);
             }
-            gcMx1.MouseClick += GcMx1_MouseClick;
+            gvMx1.FocusedRowChanged += GvMx1_FocusedRowChanged;
+            this.ucBtnPrint1.btnDesignClick += (s, e) =>
+            {
+                ucBtnPrint1.rptParameter = "rpt_Qtrk{}";
+            };
+            this.ucBtnPrint1.btnReportClick += (s, e) =>
+            {
+                ucBtnPrint1.guidKey = "";
+                string rowGuid = lbMxGuid.Text.Trim();
+                ucBtnPrint1.guidKey = rowGuid;
+                if (string.IsNullOrEmpty(txt_iCount_1.Text.Trim()))
+                {
+                    Gs.DevApp.ToolBox.MsgHelper.ShowError("璇烽�夋嫨鎵撳嵃鏉$爜寮犳暟锛�");
+                    txt_iCount_1.Focus();
+                    this.ucBtnPrint1.rptParameter = "return false";
+                    return;
+                }
+                if (string.IsNullOrEmpty(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_Qtrk{" + lbMxGuid.Text.Trim()
+                       + "," + ""
+                       + "," + ""
+                       + "," + txt_iCount_1.Text.Trim()
+                       + "," + txt_psnQty_1.Text.Trim()
+                       + "}";
+            };
         }
-        private   void GridView1_ColumnFilterChanged(object sender, EventArgs e)
+ 
+        private void GridView1_ColumnFilterChanged(object sender, EventArgs e)
         {
-            _filterList = Gs.DevApp.ToolBox.UtilityHelper.GetDilter(gridView1.Columns);
-           Task.Delay(100);
+            Gs.DevApp.ToolBox.UtilityHelper.GetDilter(gridView1.Columns, gridView1);
+            Task.Delay(100);
             getPageList(1);
         }
-      
+
         /// <summary>
         /// 鍒嗛〉浜嬩欢
         /// </summary>
@@ -119,57 +155,6 @@
             _filterList = e.FilterList;
             getPageList(1);
         }
-        private void ToolBarMenu1_btnDesignClick(object sender, EventArgs e)
-        {
-            toolBarMenu1.guidKey = "";
-            string rowGuid, rowName;
-            (rowGuid, rowName) = UtilityHelper.GetCurrentRow(xtraTabControl1,
-                lbGuid, txt_qtck, gridView1);
-            toolBarMenu1.guidKey = rowGuid;
-            toolBarMenu1.rptParameter = "rpt_Qtrk{}";
-        }
-        private void ToolBarMenu1_btnReportClick(object sender, EventArgs e)
-        {
-            //toolBarMenu1.guidKey = "";
-            //string rowGuid, rowName;
-            //(rowGuid, rowName) = UtilityHelper.GetCurrentRow(xtraTabControl1,
-            //    lbGuid, txt_itemName, gridView1);
-            //toolBarMenu1.guidKey = rowGuid;
-            //if (xtraTabControl1.SelectedTabPageIndex == 0)
-            //{
-            //    getModel(rowGuid, false, 999);
-            //    this.toolBarMenu1.rptParameter = "return false";
-            //    return;
-            //}
-            //if (string.IsNullOrEmpty(txt_suppNo_1.GetCode()))
-            //{
-            //    Gs.DevApp.ToolBox.MsgHelper.ShowError("璇烽�夋嫨渚涘簲鍟嗭紒");
-            //    txt_suppNo_1.Focus();
-            //    this.toolBarMenu1.rptParameter = "return false";
-            //    return;
-            //}
-            //if (string.IsNullOrEmpty(txt_iCount_1.Text.Trim()))
-            //{
-            //    Gs.DevApp.ToolBox.MsgHelper.ShowError("璇烽�夋嫨鎵撳嵃鏉$爜寮犳暟锛�");
-            //    txt_iCount_1.Focus();
-            //    this.toolBarMenu1.rptParameter = "return false";
-            //    return;
-            //}
-            //if (string.IsNullOrEmpty(txt_psnQty_1.Text.Trim()))
-            //{
-            //    Gs.DevApp.ToolBox.MsgHelper.ShowError("璇烽�夋嫨鎵撳嵃鏉$爜鏁伴噺锛�");
-            //    txt_psnQty_1.Focus();
-            //    this.toolBarMenu1.rptParameter = "return false";
-            //    return;
-            //}
-            //this.toolBarMenu1.rptParameter = "rpt_ItemInv{" + txt_createDate1.Text.Trim()
-            //       + "," + txt_tc_1.Checked.ToString().ToUpper()
-            //       + "," + txt_suppNo_1.GetId()
-            //       + "," + txt_iCount_1.Text.Trim()
-            //       + "," + txt_psnQty_1.Text.Trim()
-            //       + "}";
-        }
-
         /// <summary>
         /// 鍙栨秷浜嬩欢
         /// </summary>
@@ -211,9 +196,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);
@@ -235,14 +221,15 @@
                 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>
@@ -261,7 +248,17 @@
                 return;
             }
             Gs.DevApp.ToolBox.UtilityHelper.JumpTab(xtraTabControl1, 3);
-            UtilityHelper.ChangeEnableByControl(panel1.Controls, true);
+            if (xtraTabControl1.SelectedTabPageIndex == 1)
+            {
+                getModel(rowGuid);
+            }
+            else
+            {
+                List<DevExpress.XtraGrid.Views.Grid.GridView> gvList = new List<DevExpress.XtraGrid.Views.Grid.GridView>();
+                gvList.Add(gvMx1);
+                gvList.Add(gvMx2);
+                UtilityHelper.ChangeEnableByControl(panel1.Controls, true, gvList);
+            }
         }
         /// <summary>
         /// 鏂板浜嬩欢
@@ -286,7 +283,7 @@
         {
             toolBarMenu1.isSetBtn = false;
             string inGys = txt_qt018.GetId();
-            string inCjId = txt_qt011.GetId();
+            string inCjId = txt_qt008.GetId();
             if (string.IsNullOrEmpty(inGys))
             {
                 Gs.DevApp.ToolBox.MsgHelper.Warning("璇烽�夋嫨渚涘簲鍟嗭紒");
@@ -296,21 +293,23 @@
             if (string.IsNullOrEmpty(inCjId))
             {
                 Gs.DevApp.ToolBox.MsgHelper.Warning("璇烽�夋嫨浠撳簱锛�");
-                txt_qt011.Focus();
+                txt_qt008.Focus();
                 return;
             }
             var _obj = new
             {
                 guid = UtilityHelper.ToGuid(lbGuid.Text.Trim()), //涓诲缓
-                inRklb = txt_qt003.Text.Trim(),//澶囨敞
-                inYwlx = txt_qt004.Text.Trim(),//涓氬姟绫诲瀷
-                inRkfs = txt_qt019.Text.Trim(),//鍏ュ簱鏂瑰紡
-                inRklx = txt_qt020.Text.Trim(),//鍏ュ簱绫诲瀷
-                inGys = inGys,//渚涘簲鍟�
-                inCjId = inCjId,//鍏ュ簱浠撳簱
-                inDepart = txt_qt009.GetId(),//鐢宠閮ㄩ棬
-                inXsdh = txt_qt021.Text.Trim(),//閿�鍞崟鍙�
+                kcZz = txt_qt022.GetId(),//搴撳瓨缁勭粐
+                kcBm = txt_qt009.GetId(),//搴撳瓨閮ㄩ棬
+                kcGys = txt_qt018.GetId(),//搴撳瓨渚涘簲鍟�
+                kcCk = txt_qt008.GetId(),//搴撳瓨渚涘簲鍟�
                 inRkyy = txt_qt010.Text.Trim(),//鍏ュ簱鍘熷洜
+                djLx = txt_qt003.Text.Trim(),//鍗曟嵁绫诲瀷
+                kcfx = txt_qt019.Text.Trim(),//搴撳瓨鏂瑰悜
+                hzlx = txt_qt023.Text.Trim(),//璐т富绫诲瀷
+                hzzz = txt_qt024.GetId(),//璐т富缁勭粐
+                hzkh = txt_qt025.GetId(),//璐т富瀹㈡埛
+                hzbm = txt_qt026.GetId(),//璐т富閮ㄩ棬
                 list = new List<dynamic>(),
             };
             gvMx1.CloseEditor();
@@ -326,12 +325,12 @@
                 if (row != null)
                 {
                     Guid? _guid = UtilityHelper.ToGuid(row["guid"].ToString());
-                    //string _msl = row["quantity"].ToString();
-                    //if (string.IsNullOrEmpty(_msl))
-                    //{
-                    //    MsgHelper.ShowError("鏁伴噺涓嶈兘涓虹┖锛�");
-                    //    return;
-                    //}
+                    string _msl = row["qd007"].ToString();
+                    if (string.IsNullOrEmpty(_msl))
+                    {
+                        MsgHelper.ShowError("鏁伴噺涓嶈兘涓虹┖锛�");
+                        return;
+                    }
                     _obj.list.Add(new
                     {
                         Guid = _guid,
@@ -364,9 +363,9 @@
         /// </summary>
         /// <param name="curPage">绗嚑椤�</param>
         /// <param name="pageSize">姣忛〉鍑犳潯</param>
-        private   void getPageList(int curPage)
+        private void getPageList(int curPage)
         {
-            
+
             var _sbSqlWhere = UtilityHelper.GetSearchWhere(_filterList);
             PageQueryModel pgq = new PageQueryModel(curPage, this.pageBar1.RowsCount, "qt001", "asc", "", _sbSqlWhere.ToString());
             string json = JsonConvert.SerializeObject(pgq);
@@ -383,6 +382,7 @@
                     {
                         gcMain.DataSource = dt;
                         gcMain.ForceInitialize();
+                        gridView1.BestFitColumns();
                     }
                     else
                         UtilityHelper.SetDefaultTable(gcMain, gridView1);
@@ -400,7 +400,7 @@
             {
                 ToolBox.MsgHelper.ShowError("鎻愮ず锛�" + ex.Message);
             }
-            
+
         }
         private void getModel(string strGuid)
         {
@@ -412,7 +412,6 @@
                 MsgHelper.Warning("璇峰厛閫夋嫨浣犺鎿嶄綔鐨勮锛�");
                 return;
             }
-
             var _obj = new
             {
                 guid = strGuid,//涓诲缓
@@ -440,10 +439,29 @@
                         gcMx1.BindingContext = new BindingContext();
                         gcMx1.DataSource = dt;
                         gcMx1.ForceInitialize();
+                        gvMx1.BestFitColumns();
                     }
                     else
                     {
                         Gs.DevApp.ToolBox.UtilityHelper.SetDefaultTable(gcMx1, gvMx1);
+                    }
+
+                    JArray array2 = new JArray();
+                    foreach (var a in _job["rtnData"]["list2"])
+                    {
+                        array2.Add(a);
+                    }
+                    DataTable dt2 = JsonConvert.DeserializeObject<DataTable>(array2.ToString());
+                    if (dt2.Rows.Count > 0)
+                    {
+                        gcMx2.BindingContext = new BindingContext();
+                        gcMx2.DataSource = dt2;
+                        gcMx2.ForceInitialize();
+                        gvMx2.BestFitColumns();
+                    }
+                    else
+                    {
+                        Gs.DevApp.ToolBox.UtilityHelper.SetDefaultTable(gcMx2, gvMx2);
                     }
                 }
                 else
@@ -457,12 +475,12 @@
 
         private void repositoryItemSearchLookUpEdit1_EditValueChanged(object sender, EventArgs e)
         {
-
             SearchLookUpEdit LookupEdit = sender as SearchLookUpEdit;
             DataRowView SelectedDataRow = (DataRowView)LookupEdit.GetSelectedDataRow();
             gvMx1.SetFocusedRowCellValue("qd002", SelectedDataRow["itemNo"]);
             gvMx1.SetFocusedRowCellValue("qd003", SelectedDataRow["itemName"]);
             gvMx1.SetFocusedRowCellValue("qd004", SelectedDataRow["itemModel"]);
+            gvMx1.SetFocusedRowCellValue("qd009", SelectedDataRow["dwName"]);
         }
 
         private void repositoryItemButtonEdit1_ButtonClick(object sender, DevExpress.XtraEditors.Controls.ButtonPressedEventArgs e)
@@ -510,7 +528,7 @@
         /// </summary>
         /// <param name="sender"></param>
         /// <param name="e"></param>
-        private   void ToolBarMenu1_btnChkClick(object sender, EventArgs e)
+        private void ToolBarMenu1_btnChkClick(object sender, EventArgs e)
         {
             _toolCk(1);
         }
@@ -521,7 +539,7 @@
         /// <param name="sender"></param>
         /// <param name="e"></param>
         /// <exception cref="NotImplementedException"></exception>
-        private   void ToolBarMenu1_btnFChkClick(object sender, EventArgs e)
+        private void ToolBarMenu1_btnFChkClick(object sender, EventArgs e)
         {
             _toolCk(0);
         }
@@ -530,7 +548,7 @@
         /// 宸ュ叿鏉′簨浠�
         /// </summary>
         /// <param name="inFieldValue"></param>
-        private   void _toolCk(int _inFieldValue)
+        private void _toolCk(int _inFieldValue)
         {
             string strMsg = "";
             switch (_inFieldValue)
@@ -553,7 +571,7 @@
             }
             if (!MsgHelper.AskQuestion("浣犻�夋嫨浜嗐��" + rowName + "銆戯紝纭畾" + strMsg + "鍚楋紵"))
                 return;
-            
+
             var _obj = new
             {
                 guid = rowGuid,
@@ -578,25 +596,64 @@
             {
                 MsgHelper.Warning("鎻愮ず锛�" + ex.Message);
             }
-            
+
+        }
+        
+        private void GvMx1_FocusedRowChanged(object sender, DevExpress.XtraGrid.Views.Base.FocusedRowChangedEventArgs e)
+        {
+            if (e.FocusedRowHandle >= 0)
+            {
+                DataRow row = gvMx1.GetDataRow(e.FocusedRowHandle);
+                lbMxGuid.Text = row["guid"].ToString();
+                ucBtnPrint1.guidKey = row["guid"].ToString();
+                txtWlid.Text = row["qd002"].ToString();
+                txtWlgg.Text = row["qd004"].ToString();
+                txtWlmc.Text = row["qd003"].ToString();
+                //txtQuantity.Text = row["qd007"].ToString();//鐢宠鎬婚噺
+                //txtYdy.Text = row["YDYNUM"].ToString();//宸叉墦鍗版�婚噺
+                //kyPrtQty.Text = row["KDYNUM"].ToString();//鍙墦鍗版�婚噺
+            }
+        }
+        /// <summary>
+        /// 绉诲嚭鏉$爜
+        /// </summary>
+        /// <param name="sender"></param>
+        /// <param name="e"></param>
+        private void repositoryItemButtonEdit2_ButtonClick(object sender, DevExpress.XtraEditors.Controls.ButtonPressedEventArgs e)
+        {
+            var rowhandle = gvMx2.FocusedRowHandle;
+            if (rowhandle < 0)
+                return;
+            if (e.Button.Index == 0)
+            {
+                var dr = gvMx2.GetDataRow(rowhandle);
+                var mxGuid = dr["guid"].ToString();
+                if (!MsgHelper.AskQuestion("浣犻�夋嫨浜�1鏉℃暟鎹紝纭畾鍒犻櫎鍚楋紵"))
+                    return;
+                var _obj = new
+                {
+                    mxGuid = mxGuid,
+                    inType = "dhtm"
+                };
+                try
+                {
+                    var strJson = UtilityHelper.HttpPost("",
+                        _webServiceName + "DeleteBarcode",
+                        JsonConvert.SerializeObject(_obj));
+                    var _rtn = UtilityHelper.ReturnToDynamic(strJson);
+                    if (_rtn.rtnCode > 0)
+                    {
+                        if (_rtn.rtnCode > 0) getModel(lbGuid.Text);
+                    }
+                    MsgHelper.Warning("鎻愮ず锛�" + _rtn.rtnMsg);
+                }
+                catch (Exception ex)
+                {
+                    MsgHelper.Warning("鎻愮ず锛�" + ex.Message);
+                }
+            }
         }
 
-        private void GcMx1_MouseClick(object sender, MouseEventArgs e)
-        {
-            string rowGuid = Gs.DevApp.ToolBox.UtilityHelper.GetCurrentDoubleRow(gvMx1, e, "guid");
-            if (string.IsNullOrEmpty(rowGuid))
-                return;
-            lbMxGuid.Text = rowGuid;
-            toolBarMenu1.guidKey = rowGuid;
-            var info = gvMx1.CalcHitInfo(e.Location);
-            var view = info.View;
-            var row = view.GetDataRow(info.RowHandle);
-            txtWlid.Text = row["itemId"].ToString();
-            txtWlgg.Text = row["qd004"].ToString();
-            txtWlmc.Text = row["qd003"].ToString();
-            txtQuantity.Text = row["qd007"].ToString();//鐢宠鎬婚噺
-            txtYdy.Text = row["YDYNUM"].ToString();//宸叉墦鍗版�婚噺
-            kyPrtQty.Text = row["KDYNUM"].ToString();//鍙墦鍗版�婚噺
-        }
+      
     }
 }
\ No newline at end of file

--
Gitblit v1.9.3