From fdc017bffe579b0855743b68c58e3ba7571b8ad1 Mon Sep 17 00:00:00 2001
From: kyy <3283105747@qq.com>
Date: 星期一, 01 九月 2025 18:12:23 +0800
Subject: [PATCH] 1、优化条码删除报错 2、采购入库三联打印

---
 DevApp/Gs.DevApp/DevFrm/Warehouse/Frm_ArrivalBarcode.cs |  198 ++++++++++++++++++++++++++++---------------------
 1 files changed, 112 insertions(+), 86 deletions(-)

diff --git a/DevApp/Gs.DevApp/DevFrm/Warehouse/Frm_ArrivalBarcode.cs b/DevApp/Gs.DevApp/DevFrm/Warehouse/Frm_ArrivalBarcode.cs
index 6accb25..59b4cec 100644
--- a/DevApp/Gs.DevApp/DevFrm/Warehouse/Frm_ArrivalBarcode.cs
+++ b/DevApp/Gs.DevApp/DevFrm/Warehouse/Frm_ArrivalBarcode.cs
@@ -1,3 +1,4 @@
+using DevExpress.XtraRichEdit.Model;
 using Gs.DevApp.DevFrm.Rpt;
 using Gs.DevApp.Entity;
 using Gs.DevApp.ToolBox;
@@ -37,7 +38,10 @@
             });
             Gs.DevApp.ToolBox.UtilityHelper.SetTabParameter(gridView1, xtraTabControl1, pageBar1, (value) =>
             {
+               
                 getModel(value);
+           
+
             }, (value) =>
             {
                 getPageList(this.pageBar1.CurrentPage);
@@ -85,33 +89,39 @@
                 string rowGuid = lbMxGuid.Text.Trim();
                 SelectDeleteBar frm = new SelectDeleteBar(rowGuid, "閲囪喘鍏ュ簱");
                 string strCodeList = "";
+                string strAction = "";
                 frm.UpdateParent += (ss, ee) =>
                 {
                     strCodeList = ee.StringSingle;
+                    strAction = ee.Data;
                 };
                 frm.ShowDialog();
                 if (string.IsNullOrEmpty(strCodeList))
                     return;
-                try
+                if (strAction == "print")
                 {
-                    string rptParameter = "rpt_Arrival{"
-                    + "100"//閲嶆墦閮芥槸浼�100锛�
-                    + "," + ""
-                    + "," + ""
-                    + "," + ""
-                    + "," + ""
-                    + "," + strCodeList
-                    + "}";
-                    using (Form rpt = new RptPreview(rowGuid, rptParameter))
+                    try
                     {
-                        rpt.ShowDialog();
+                        string rptParameter = "rpt_Arrival{"
+                        + "100"//閲嶆墦閮芥槸浼�100锛�
+                        + "," + ""
+                        + "," + ""
+                        + "," + ""
+                        + "," + ""
+                        + "," + strCodeList
+                        + "}";
+                        using (Form rpt = new RptPreview(rowGuid, rptParameter))
+                        {
+                            rpt.ShowDialog();
+                        }
+                        frm.Close();
                     }
-                    frm.Close();
+                    catch (Exception ex)
+                    {
+                        MsgHelper.ShowError(ex.Message);
+                    }
                 }
-                catch (Exception ex)
-                {
-                    MsgHelper.ShowError(ex.Message);
-                }
+                   
             };
 
             // -------------------- gvMx3 鎵撳嵃浜嬩欢 --------------------
@@ -163,33 +173,39 @@
                 string rowGuid = txt_releaseNo.Text.Trim();
                 SelectDeleteBar frm = new SelectDeleteBar(rowGuid, "鍒拌揣鏉$爜锛堝悎骞讹級鐮�"); // 鏍囬鍖哄垎鏉ユ簮
                 string strCodeList = "";
+                string strAction = "";
                 frm.UpdateParent += (ss, ee) =>
                 {
                     strCodeList = ee.StringSingle;
+                    strAction = ee.Data;
                 };
                 frm.ShowDialog();
                 if (string.IsNullOrEmpty(strCodeList))
                     return;
-                try
+                if (strAction == "print")
                 {
-                    string rptParameter = "rpt_Arrival_Hb{"
-                    + "100"//閲嶆墦鏍囪瘑
-                    + "," + ""
-                    + "," + ""
-                    + "," + ""
-                    + "," + ""
-                    + "," + strCodeList
-                    + "}";
-                    using (Form rpt = new RptPreview(rowGuid, rptParameter))
+                    try
                     {
-                        rpt.ShowDialog();
+                        string rptParameter = "rpt_Arrival{"
+                        + "100"//閲嶆墦閮芥槸浼�100锛�
+                        + "," + ""
+                        + "," + ""
+                        + "," + ""
+                        + "," + ""
+                        + "," + strCodeList
+                        + "}";
+                        using (Form rpt = new RptPreview(rowGuid, rptParameter))
+                        {
+                            rpt.ShowDialog();
+                        }
+                        frm.Close();
                     }
-                    frm.Close();
+                    catch (Exception ex)
+                    {
+                        MsgHelper.ShowError(ex.Message);
+                    }
                 }
-                catch (Exception ex)
-                {
-                    MsgHelper.ShowError(ex.Message);
-                }
+
             };
 
 
@@ -277,45 +293,45 @@
         releaseNosStr  // s5 鈫� @in6锛歳eleaseNo鍒楄〃
                 };
 
-                //string paramContent = string.Join(",", reportParams);
-                //string rptParam = $"rpt_Arrival_One{{{paramContent}}}";
+                /*string paramContent = string.Join(",", reportParams);
+                string rptParam = $"rpt_Arrival_One{{{paramContent}}}";
 
-                //this.ucBtnPrintOne1.guidKey = mainGuid;
-                //this.ucBtnPrintOne1.rptParameter = rptParam;
+                this.ucBtnPrintOne1.guidKey = mainGuid;
+                this.ucBtnPrintOne1.rptParameter = rptParam;
+
+                // 5. 璋冪敤棰勮锛堥�昏緫涓嶅彉锛�
+                try
+                {
+                    using (Form rptPreviewForm = new RptPreview(mainGuid, rptParam))
+                    {
+                        DialogResult previewResult = rptPreviewForm.ShowDialog();
+                        if (previewResult == DialogResult.OK)
+                        {
+                            getModel(mainGuid);
+                            Gs.DevApp.ToolBox.MsgHelper.ShowError($"鎵归噺鎵撳嵃瀹屾垚锛佸叡鎵撳嵃 {validReleaseNos.Count} 鏉℃湁鏁堟槑缁�");
+                        }
+                        else if (previewResult == DialogResult.Cancel)
+                        {
+                            Gs.DevApp.ToolBox.MsgHelper.ShowError("鐢ㄦ埛鍙栨秷鎵归噺鎵撳嵃鎿嶄綔");
+                        }
+                    }
+                }
+                catch (Exception ex)
+                {
+                    string errorMsg = $"鎵归噺鎵撳嵃寮傚父锛歿ex.Message}";
+                    if (ex.InnerException != null)
+                    {
+                        errorMsg += $"\n鍐呴儴閿欒锛歿ex.InnerException.Message}";
+                    }
+                    Gs.DevApp.ToolBox.MsgHelper.ShowError(errorMsg);
+                    this.ucBtnPrintOne1.rptParameter = "return false";
+                }
+*/
 
                 this.ucBtnPrintOne1.guidKey = mainGuid;
                 this.ucBtnPrintOne1.rptParameter = "rpt_Arrival_One{"
                     + string.Join(",", reportParams)  // 鎷兼帴reportParams鏁扮粍鍏冪礌
                     + "}";
-
-                /*  // 5. 璋冪敤棰勮锛堥�昏緫涓嶅彉锛�
-                  try
-                  {
-                      using (Form rptPreviewForm = new RptPreview(mainGuid, rptParam))
-                      {
-                          DialogResult previewResult = rptPreviewForm.ShowDialog();
-                          if (previewResult == DialogResult.OK)
-                          {
-                              getModel(mainGuid);
-                              Gs.DevApp.ToolBox.MsgHelper.ShowError($"鎵归噺鎵撳嵃瀹屾垚锛佸叡鎵撳嵃 {validReleaseNos.Count} 鏉℃湁鏁堟槑缁�");
-                          }
-                          else if (previewResult == DialogResult.Cancel)
-                          {
-                              Gs.DevApp.ToolBox.MsgHelper.ShowError("鐢ㄦ埛鍙栨秷鎵归噺鎵撳嵃鎿嶄綔");
-                          }
-                      }
-                  }
-                  catch (Exception ex)
-                  {
-                      string errorMsg = $"鎵归噺鎵撳嵃寮傚父锛歿ex.Message}";
-                      if (ex.InnerException != null)
-                      {
-                          errorMsg += $"\n鍐呴儴閿欒锛歿ex.InnerException.Message}";
-                      }
-                      Gs.DevApp.ToolBox.MsgHelper.ShowError(errorMsg);
-                      this.ucBtnPrintOne1.rptParameter = "return false";
-                  }
-  */
                 // 6. 娓呯┖鎺т欢
                 txt_iCount_2.Text = "";
                 txt_psnQty_2.Text = "";
@@ -360,6 +376,8 @@
 
             // 妫�鏌ユ暟鎹姞杞藉悗鍐嶈缃鑹�
             this.Load += (s, e) => {
+
+               
                 System.Windows.Forms.Timer timer = new System.Windows.Forms.Timer();
                 timer.Interval = 1000; // 1绉掑悗鎵ц锛岀‘淇濇暟鎹凡鍔犺浇
                 timer.Tick += (sender, args) => {
@@ -568,9 +586,10 @@
         }
         private void getModel(string strGuid)
         {
+            gcMx3.DataSource = null;
             gcMx1.DataSource = null;
             gcMx2.DataSource = null;
-            gcMx3.DataSource = null;
+            
             bool isEdit = false;
             if (toolBarMenu1.currentAction == "add") return;
             if (toolBarMenu1.currentAction == "edit") isEdit = true;
@@ -587,6 +606,7 @@
             {
                 string strJson = UtilityHelper.HttpPost("", _webServiceName + "GetModel", JsonConvert.SerializeObject(_obj));
                 ReturnModel<dynamic> _rtn = ToolBox.UtilityHelper.ReturnToDynamic(strJson);
+             
                 if (_rtn.rtnCode > 0)
                 {
                     dynamic dy = _rtn.rtnData;
@@ -596,7 +616,27 @@
                     gvList.Add(gvMx2);
                     gvList.Add(gvMx3);
                     UtilityHelper.SetValueByObj(this.layoutMx1.Controls, dy, isEdit, gvList);
-                    
+
+                    JArray array3 = new JArray();
+                    foreach (var a in dy["list3"])
+                    {
+                        array3.Add(a);
+                    }
+                    DataTable dt3 = JsonConvert.DeserializeObject<DataTable>(array3.ToString());
+                    if (dt3.Rows.Count > 0)
+                    {
+                        gcMx3.BindingContext = new BindingContext();
+                        gcMx3.DataSource = dt3;
+                        gcMx3.ForceInitialize();
+                        gvMx3.BestFitColumns();
+                        Gs.DevApp.ToolBox.UtilityHelper.SetGridLayout(gvMx3);
+                    }
+                    else
+                    {
+                        Gs.DevApp.ToolBox.UtilityHelper.SetDefaultTable(gcMx3, gvMx3);
+                    }
+
+
                     JArray array1 = new JArray();
                     foreach (var a in dy["list1"])
                     {
@@ -616,6 +656,7 @@
                     {
                         Gs.DevApp.ToolBox.UtilityHelper.SetDefaultTable(gcMx1, gvMx1);
                     }
+                 
                     JArray array2 = new JArray();
                     foreach (var a in dy["list2"])
                     {
@@ -634,25 +675,10 @@
                     {
                         Gs.DevApp.ToolBox.UtilityHelper.SetDefaultTable(gcMx2, gvMx2);
                     }
-                    JArray array3 = new JArray();
-                    foreach (var a in dy["list3"])
-                    {
-                        array3.Add(a);
-                    }
-                    DataTable dt3 = JsonConvert.DeserializeObject<DataTable>(array3.ToString());
-                    if (dt3.Rows.Count > 0)
-                    {
-                        gcMx3.BindingContext = new BindingContext();
-                        gcMx3.DataSource = dt3;
-                        gcMx3.ForceInitialize();
-                        gvMx3.BestFitColumns();
-                        Gs.DevApp.ToolBox.UtilityHelper.SetGridLayout(gvMx3);
-                    }
-                    else
-                    {
-                        Gs.DevApp.ToolBox.UtilityHelper.SetDefaultTable(gcMx3, gvMx3);
-                    }
-                }
+                  
+                       }
+
+           
                 else
                     ToolBox.MsgHelper.Warning("鎻愮ず锛�" + _rtn.rtnMsg);
             }

--
Gitblit v1.9.3