From 1a8f404f8641d38b5a2746d9d6d14b1e40f3b5bf Mon Sep 17 00:00:00 2001
From: lu <99954486@qq.com>
Date: 星期四, 14 十一月 2024 18:25:23 +0800
Subject: [PATCH] 打印

---
 DevApp/Gs.DevApp/DevFrm/Warehouse/Frm_ArrivalBarcode.cs |  274 ++++++++++++++++++++++--------------------------------
 1 files changed, 113 insertions(+), 161 deletions(-)

diff --git a/DevApp/Gs.DevApp/DevFrm/Warehouse/Frm_ArrivalBarcode.cs b/DevApp/Gs.DevApp/DevFrm/Warehouse/Frm_ArrivalBarcode.cs
index 4e298cb..aaab8e5 100644
--- a/DevApp/Gs.DevApp/DevFrm/Warehouse/Frm_ArrivalBarcode.cs
+++ b/DevApp/Gs.DevApp/DevFrm/Warehouse/Frm_ArrivalBarcode.cs
@@ -1,5 +1,3 @@
-using DevExpress.XtraGrid.Views.Grid;
-using DevExpress.XtraGrid.Views.Grid.ViewInfo;
 using Gs.DevApp.Entity;
 using Gs.DevApp.ToolBox;
 using Newtonsoft.Json;
@@ -8,6 +6,7 @@
 using System.Collections.Generic;
 using System.Data;
 using System.Drawing;
+using System.Text;
 using System.Windows.Forms;
 
 namespace Gs.DevApp.DevFrm
@@ -19,13 +18,10 @@
         public Frm_ArrivalBarcode()
         {
             InitializeComponent();
-            this.toolBarMenu1.btnAddClick += ToolBarMenu1_btnAddClick;
-            this.toolBarMenu1.btnEdtClick += ToolBarMenu1_btnEdtClick;
-            this.toolBarMenu1.btnSaveClick += ToolBarMenu1_btnSaveClick;
             this.toolBarMenu1.btnLoadClick += ToolBarMenu1_btnLoadClick;
-            this.toolBarMenu1.btnDelClick += ToolBarMenu1_btnDelClick1;
-            this.toolBarMenu1.btnEscClick += ToolBarMenu1_btnEscClick;
             this.toolBarMenu1.btnQueryClick += ToolBarMenu1_btnQueryClick;
+            toolBarMenu1.btnReportClick += ToolBarMenu1_btnReportClick;
+            toolBarMenu1.btnDesignClick += ToolBarMenu1_btnDesignClick;
             gcMain.MouseDoubleClick += GcMain_MouseDoubleClick;
             getPageList(1, UtilityHelper.GetPageSize());
             pageBar1.PagerEvent += PageBar1_PagerEvent;
@@ -43,8 +39,36 @@
                 Rectangle r = new Rectangle(gridView1.GridControl.Width / 2 - 100, e.Bounds.Top + 45, e.Bounds.Right - 5, e.Bounds.Height - 5);
                 e.Graphics.DrawString(str, f, Brushes.Gray, r);
             };
+            //璁剧疆浠撳簱閫夋嫨
+            this.txt_depotsId.KeyFile = "depotId";
+            this.txt_depotsId.EditChanged += (s, e) =>
+            {
+                txtDepotsId.Text = this.txt_depotsId.GetId();
+            };
+            //璁剧疆渚涘簲鍟嗛�夋嫨
+            this.txt_suppId.KeyFile = "id";
+            this.txt_suppId.EditChanged += (s, e) =>
+            {
+                txtSupplierId.Text = this.txt_suppId.GetId();
+            };
+            gcMx1.MouseClick += GcMx1_MouseClick;
         }
-
+        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["itemModel"].ToString();
+            txtWlmc.Text = row["itemName"].ToString();
+            txtQuantity.Text = row["Quantity"].ToString();
+            kyPrtQty.Text = row["kyPrtQty"].ToString();
+        }
         /// <summary>
         /// 鍙屽嚮浜嬩欢
         /// </summary>
@@ -86,51 +110,54 @@
             _filterList = e.FilterList;
             getPageList(1, pageBar1.RowsCount);
         }
-
-        /// <summary>
-        /// 鍙栨秷浜嬩欢
-        /// </summary>
-        /// <param name="sender"></param>
-        /// <param name="e"></param>
-        private void ToolBarMenu1_btnEscClick(object sender, EventArgs e)
+        private void ToolBarMenu1_btnDesignClick(object sender, EventArgs e)
         {
-            UtilityHelper.JumpToTab(xtraTabControl1, 0);
+            toolBarMenu1.guidKey = "";
+            string rowGuid, rowName;
+            (rowGuid, rowName) = UtilityHelper.GetCurrentRow(xtraTabControl1,
+                lbGuid, txt_billNo, gridView1);
+            toolBarMenu1.guidKey = rowGuid;
+            toolBarMenu1.rptParameter = "rpt_Arrival{}";
         }
-
-        /// <summary>
-        /// 鍒犻櫎浜嬩欢
-        /// </summary>
-        /// <param name="sender"></param>
-        /// <param name="e"></param>
-        private void ToolBarMenu1_btnDelClick1(object sender, EventArgs e)
+        private void ToolBarMenu1_btnReportClick(object sender, EventArgs e)
         {
-            string rowGuid = "", rowName = "";
-            // (rowGuid, rowName) = UtilityHelper.GetCurrentRow(xtraTabControl1, lbGuid, txt_billNo, gridView1);
-            if (string.IsNullOrEmpty(rowGuid))
+            toolBarMenu1.guidKey = "";
+            string rowGuid, rowName;
+            (rowGuid, rowName) = UtilityHelper.GetCurrentRow(xtraTabControl1,
+                lbGuid, txt_billNo, gridView1);
+            toolBarMenu1.guidKey = rowGuid;
+            if (xtraTabControl1.SelectedTabPageIndex == 0)
             {
-                ToolBox.MsgHelper.Warning("璇峰厛閫夋嫨浣犺鎿嶄綔鐨勮锛�");
+                getModel(rowGuid, false, 999);
+                this.toolBarMenu1.rptParameter = "return false";
                 return;
             }
-            if (!MsgHelper.AskQuestion("浣犻�夋嫨浜嗐��" + rowName + "銆戯紝纭畾鍒犻櫎鍚楋紵"))
+            if (lbMxGuid.Text.Trim().Length < 36)
+            {
+                Gs.DevApp.ToolBox.MsgHelper.ShowError("璇烽�夋嫨浣犺鎵撳嵃鐨勮锛�");
+                this.toolBarMenu1.rptParameter = "return false";
                 return;
-               List<dynamic> lst = new List<dynamic>();
-          lst.Add(rowGuid);
-          var _obj = lst;
-            try
-            {
-                string strJson = UtilityHelper.HttpPost("", _webServiceName + "DeleteModel", JsonConvert.SerializeObject(_obj));
-                ReturnModel<dynamic> _rtn = ToolBox.UtilityHelper.ReturnToDynamic(strJson);
-                if (_rtn.rtnCode > 0)
-                {
-                    UtilityHelper.JumpToTab(xtraTabControl1, 0);
-                    getPageList(1, UtilityHelper.GetPageSize());
-                }
-                ToolBox.MsgHelper.Warning("鎻愮ず锛�" + _rtn.rtnMsg);
             }
-            catch (Exception ex)
+            if (string.IsNullOrEmpty(txt_iCount_1.Text.Trim()))
             {
-                ToolBox.MsgHelper.Warning("鎻愮ず锛�" + ex.Message);
+                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_Arrival{" + ""
+                   + "," + ""
+                   + "," + ""
+                   + "," + txt_iCount_1.Text.Trim()
+                   + "," + txt_psnQty_1.Text.Trim()
+                   + "}";
         }
 
         /// <summary>
@@ -144,110 +171,38 @@
             getPageList(1, UtilityHelper.GetPageSize());
         }
         /// <summary>
-        /// 淇敼浜嬩欢
-        /// </summary>
-        /// <param name="sender"></param>
-        /// <param name="e"></param>
-        private void ToolBarMenu1_btnEdtClick(object sender, EventArgs e)
-        {
-            string rowGuid = "", rowName = "";
-            // (rowGuid, rowName) = UtilityHelper.GetCurrentRow(xtraTabControl1, lbGuid, txt_billNo, gridView1);
-            if (string.IsNullOrEmpty(rowGuid))
-            {
-                ToolBox.MsgHelper.Warning("璇峰厛閫夋嫨浣犺鎿嶄綔鐨勮锛�");
-                return;
-            }
-            getModel(rowGuid, true, 1);
-        }
-        /// <summary>
-        /// 鏂板浜嬩欢
-        /// </summary>
-        /// <param name="sender"></param>
-        /// <param name="e"></param>
-        private void ToolBarMenu1_btnAddClick(object sender, EventArgs e)
-        {
-               UtilityHelper.JumpToTab(xtraTabControl1, 1);
- 	lbGuid.Text = "";
- 	List<DevExpress.XtraGrid.Views.Grid.GridView> gridViews = new List<DevExpress.XtraGrid.Views.Grid.GridView>();
- 	gridViews.Add(gvMx1);
- 	UtilityHelper.CleanValueByControl(this.panel1.Controls, true, gridViews);
- 	Gs.DevApp.ToolBox.UtilityHelper.SetDefaultTable(gcMx1, gvMx1);
-        }
-        /// <summary>
-        /// 淇濆瓨浜嬩欢
-        /// </summary>
-        /// <param name="sender"></param>
-        /// <param name="e"></param>
-        private void ToolBarMenu1_btnSaveClick(object sender, EventArgs e)
-        {
-            toolBarMenu1.isSetBtn = false;
-            //if (string.IsNullOrEmpty(txt_account.Text.Trim()))
-            {
-                Gs.DevApp.ToolBox.MsgHelper.Warning("鐧诲綍璐﹀彿涓嶈兘涓虹┖锛�");
-                // txt_account.Focus();
-                return;
-            }
-            var _obj = new
-            {
-                  guid =UtilityHelper.ToGuid( lbGuid.Text.Trim()), //涓诲缓
-            };
-            try
-            {
-                string strJson = UtilityHelper.HttpPost("", _webServiceName + "EditModel", JsonConvert.SerializeObject(_obj));
-                ReturnModel<dynamic> _rtn = ToolBox.UtilityHelper.ReturnToDynamic(strJson);
-                ToolBox.MsgHelper.Warning("鎻愮ず锛�" + _rtn.rtnMsg);
-                if (_rtn.rtnCode > 0)
-                {
-                    lbGuid.Text = _rtn.rtnData;
-                    toolBarMenu1.isSetBtn = true;
-                    UtilityHelper.ChangeEnableByControl(this.panel1.Controls, false);
-                }
-            }
-            catch (Exception ex)
-            {
-                ToolBox.MsgHelper.Warning("鎻愮ず锛�" + ex.Message);
-            }
-        }
-
-        /// <summary>
         /// 
         /// </summary>
         /// <param name="curPage">绗嚑椤�</param>
         /// <param name="pageSize">姣忛〉鍑犳潯</param>
         private void getPageList(int curPage, int pageSize)
         {
-            System.Text.StringBuilder _sbSqlWhere = new System.Text.StringBuilder();
-            foreach (FilterEntity itm in _filterList)
-            {
-                _sbSqlWhere.Append(" and " + itm.fileId + itm.fileOper + "'" + itm.fileValue + "'");
-            }
-            PageQueryModel pgq = new PageQueryModel(curPage, pageSize, "create_date", "asc", "", _sbSqlWhere.ToString());
-            string json = JsonConvert.SerializeObject(pgq);
+            var _sbSqlWhere = new StringBuilder();
+            foreach (var itm in _filterList)
+                _sbSqlWhere.Append(" and " + itm.fileId + itm.fileOper + "'" +
+                                   itm.fileValue + "'");
+            var pgq = new PageQueryModel(curPage, pageSize, "create_date",
+                "asc", "", _sbSqlWhere.ToString());
+            var json = JsonConvert.SerializeObject(pgq);
             try
             {
-                string strReturn = UtilityHelper.HttpPost("", _webServiceName + "GetListPage", json);
-                ReturnModel<PageListModel> dd = UtilityHelper.ReturnToTablePage(strReturn);
-                if (dd.rtnCode > 0)
- 	{
-    	 DataTable dt = dd.rtnData.list;
-    	 gcMain.BindingContext = new BindingContext();
-     	gcMain.DataSource = dt;
-     	gcMain.ForceInitialize();
-    	 int dddd = dd.rtnData.pages;//鎬婚〉
-    	 pageBar1.TotalPages = dddd;
-     	pageBar1.RecordCount = dd.rtnData.total;//璁板綍鎬绘暟
-     	pageBar1.CurrentPage = curPage;//褰撳墠椤�
-     	pageBar1.RowsCount = pageSize;//姣忛〉鏄剧ず
-    	 pageBar1.setTxt();
-	 }
-	 else
- 	{
-     	ToolBox.MsgHelper.ShowError("鎻愮ず锛�" + dd.rtnMsg);
- 	}
+                var strReturn = UtilityHelper.HttpPost("",
+                    _webServiceName + "GetListPage", json);
+                var dd = UtilityHelper.ReturnToTablePage(strReturn);
+                var dt = dd.rtnData.list;
+                gcMain.BindingContext = new BindingContext();
+                gcMain.DataSource = dt;
+                gcMain.ForceInitialize();
+                var dddd = dd.rtnData.pages; //鎬婚〉
+                pageBar1.TotalPages = dddd;
+                pageBar1.RecordCount = dd.rtnData.total; //璁板綍鎬绘暟
+                pageBar1.CurrentPage = curPage; //褰撳墠椤�
+                pageBar1.RowsCount = pageSize; //姣忛〉鏄剧ず
+                pageBar1.setTxt();
             }
             catch (Exception ex)
             {
-                ToolBox.MsgHelper.Warning("鎻愮ず锛�" + ex.Message);
+                MsgHelper.Warning("鎻愮ず锛�" + ex.Message);
             }
         }
         private void getModel(string strGuid, bool isEdit, int tabIdx)
@@ -264,7 +219,7 @@
             };
             try
             {
-                string strJson = UtilityHelper.HttpPost("", _webServiceName +"GetModel", JsonConvert.SerializeObject(_obj));
+                string strJson = UtilityHelper.HttpPost("", _webServiceName + "GetModel", JsonConvert.SerializeObject(_obj));
                 ReturnModel<dynamic> _rtn = ToolBox.UtilityHelper.ReturnToDynamic(strJson);
                 if (_rtn.rtnCode > 0)
                 {
@@ -273,41 +228,38 @@
                     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);
-                    JObject _job = JObject.Parse(strJson);
-                    JArray array = new JArray();
-                    JArray list3 = new JArray();
-                    foreach (var a in _job["rtnData"]["list"])
+                    JArray array1 = new JArray();
+                    foreach (var a in dy["list1"])
                     {
-                        array.Add(a);
+                        array1.Add(a);
                     }
-                    DataTable dt = JsonConvert.DeserializeObject<DataTable>(array.ToString());
-                    if (dt.Rows.Count > 0)
+                    DataTable dt1 = JsonConvert.DeserializeObject<DataTable>(array1.ToString());
+                    if (dt1.Rows.Count > 0)
                     {
                         gcMx1.BindingContext = new BindingContext();
-                        gcMx1.DataSource = dt;
+                        gcMx1.DataSource = dt1;
                         gcMx1.ForceInitialize();
                     }
                     else
                     {
                         Gs.DevApp.ToolBox.UtilityHelper.SetDefaultTable(gcMx1, gvMx1);
                     }
+                    //foreach (var a in _job["rtnData"]["list3"])
+                    //{
+                    //    list3.Add(a);
+                    //}
 
-                    foreach (var a in _job["rtnData"]["list3"])
-                    {
-                        list3.Add(a);
-                    }
-
-                    DataTable dt1 = JsonConvert.DeserializeObject<DataTable>(list3.ToString());
-                    if (dt1.Rows.Count > 0)
-                    {
-                        gcMx2.BindingContext = new BindingContext();
-                        gcMx2.DataSource = dt1;
-                        gcMx2.ForceInitialize();
-                    }
-                    else
-                    {
-                        Gs.DevApp.ToolBox.UtilityHelper.SetDefaultTable(gcMx2, gvMx2);
-                    }
+                    //DataTable dt1 = JsonConvert.DeserializeObject<DataTable>(list3.ToString());
+                    //if (dt1.Rows.Count > 0)
+                    //{
+                    //    gcMx2.BindingContext = new BindingContext();
+                    //    gcMx2.DataSource = dt1;
+                    //    gcMx2.ForceInitialize();
+                    //}
+                    //else
+                    //{
+                    //    Gs.DevApp.ToolBox.UtilityHelper.SetDefaultTable(gcMx2, gvMx2);
+                    //}
                 }
                 else
                     ToolBox.MsgHelper.Warning("鎻愮ず锛�" + _rtn.rtnMsg);

--
Gitblit v1.9.3