kyy
2025-09-04 9ecf582d2b5524915731d0c8bba0b62572d91973
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;
@@ -26,6 +27,9 @@
            Gs.DevApp.ToolBox.UtilityHelper.SetGridViewParameterMx(gvMx1);
            Gs.DevApp.ToolBox.UtilityHelper.SetGridViewParameterMx(gvMx2);
            Gs.DevApp.ToolBox.UtilityHelper.SetGridViewParameterMx(gvMx3);
            Gs.DevApp.ToolBox.UtilityHelper.SetGridViewParameterMx(gvMxL1);
            Gs.DevApp.ToolBox.UtilityHelper.SetGridViewParameterMx(gvMxL2);
            Gs.DevApp.ToolBox.UtilityHelper.SetGridViewParameterMx(gvMxL3);
            Gs.DevApp.ToolBox.UtilityHelper.SetGridViewParameter(gridView1, null, null, "", "", (value) =>
            {
                Gs.DevApp.ToolBox.UtilityHelper.JumpTab(xtraTabControl1, 0);
@@ -34,7 +38,10 @@
            });
            Gs.DevApp.ToolBox.UtilityHelper.SetTabParameter(gridView1, xtraTabControl1, pageBar1, (value) =>
            {
                getModel(value);
            }, (value) =>
            {
                getPageList(this.pageBar1.CurrentPage);
@@ -82,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 打印事件 --------------------
@@ -160,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_Hb{"
                        + "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);
                }
            };
@@ -274,7 +293,7 @@
        releaseNosStr  // s5 → @in6:releaseNo列表
                };
                string paramContent = string.Join(",", reportParams);
                /*string paramContent = string.Join(",", reportParams);
                string rptParam = $"rpt_Arrival_One{{{paramContent}}}";
                this.ucBtnPrintOne1.guidKey = mainGuid;
@@ -307,7 +326,12 @@
                    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数组元素
                    + "}";
                // 6. 清空控件
                txt_iCount_2.Text = "";
                txt_psnQty_2.Text = "";
@@ -352,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) => {
@@ -560,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;
@@ -579,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;
@@ -588,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"])
                    {
@@ -608,6 +656,7 @@
                    {
                        Gs.DevApp.ToolBox.UtilityHelper.SetDefaultTable(gcMx1, gvMx1);
                    }
                    JArray array2 = new JArray();
                    foreach (var a in dy["list2"])
                    {
@@ -626,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);
            }