kyy
2025-08-09 95fd08692e404e5b3c547bdb3c9d0cc8023ff0be
DevApp/Gs.DevApp/DevFrm/Warehouse/Frm_ArrivalBarcode.cs
@@ -24,6 +24,7 @@
            this.toolBarMenu1.getXmlConfig();
            Gs.DevApp.ToolBox.UtilityHelper.SetGridViewParameterMx(gvMx1);
            Gs.DevApp.ToolBox.UtilityHelper.SetGridViewParameterMx(gvMx2);
            Gs.DevApp.ToolBox.UtilityHelper.SetGridViewParameterMx(gvMx3);
            Gs.DevApp.ToolBox.UtilityHelper.SetGridViewParameter(gridView1, null, null, "", "", (value) =>
            {
                Gs.DevApp.ToolBox.UtilityHelper.JumpTab(xtraTabControl1, 0);
@@ -106,9 +107,91 @@
                    MsgHelper.ShowError(ex.Message);
                }
            };
            // -------------------- gvMx3 打印事件 --------------------
            this.ucBtnPrint2.btnPrintClick += (s, e) =>
            {
                string rowGuid = txt_releaseNo.Text.Trim(); // 新增lbMxGuid3用于存储gvMx3的选中行GUID
                ucBtnPrint2.guidKey = rowGuid;
                // 验证输入(使用gvMx3对应的输入控件)
                if (!Gs.DevApp.ToolBox.UtilityHelper.IsNumeric3(txt_iCount_2.Text.Trim(), txt_yuliang_2.Text.Trim()))
                {
                    Gs.DevApp.ToolBox.MsgHelper.ShowError("请输入正确的条码数量!");
                    txt_iCount_2.Focus();
                    this.ucBtnPrint2.rptParameter = "return false";
                    return;
                }
                if (!Gs.DevApp.ToolBox.UtilityHelper.IsNumeric3(txt_psnQty_2.Text.Trim()))
                {
                    Gs.DevApp.ToolBox.MsgHelper.ShowError("请选择打印条码数量!");
                    txt_psnQty_2.Focus();
                    this.ucBtnPrint2.rptParameter = "return false";
                    return;
                }
                if (rowGuid.Length < 10)
                {
                    Gs.DevApp.ToolBox.MsgHelper.ShowError("请选择打印的行!");
                    this.ucBtnPrint2.rptParameter = "return false";
                    return;
                }
                // 组装打印参数(使用gvMx3的控件值)
                this.ucBtnPrint2.rptParameter = "rpt_Arrival_Hb{"
                       + rowGuid//关联主键(gvMx3的GUID)
                       + "," + ""
                       + "," + Gs.DevApp.ToolBox.UtilityHelper.ToDecimal(txt_yuliang_2.Text.Trim())//余数
                       + "," + txt_iCount_2.Text.Trim()//张数
                       + "," + txt_psnQty_2.Text.Trim()//每张条码数量
                       + "}";
                // 清空输入框
                txt_iCount_2.Text = "";
                txt_psnQty_2.Text = "";
            };
            // gvMx3 批量打印事件
            this.ucBtnPrint2.btnAllClick += (s, e) =>
            {
                // string rowGuid = lbMxGuid3.Text.Trim(); // 使用gvMx3的GUID
                string rowGuid = txt_releaseNo.Text.Trim();
                SelectDeleteBar frm = new SelectDeleteBar(rowGuid, "采购入库"); // 标题区分来源
                string strCodeList = "";
                frm.UpdateParent += (ss, ee) =>
                {
                    strCodeList = ee.StringSingle;
                };
                frm.ShowDialog();
                if (string.IsNullOrEmpty(strCodeList))
                    return;
                try
                {
                    string rptParameter = "rpt_Arrival_Hb{"
                    + "100"//重打标识
                    + "," + ""
                    + "," + ""
                    + "," + ""
                    + "," + ""
                    + "," + strCodeList
                    + "}";
                    using (Form rpt = new RptPreview(rowGuid, rptParameter))
                    {
                        rpt.ShowDialog();
                    }
                    frm.Close();
                }
                catch (Exception ex)
                {
                    MsgHelper.ShowError(ex.Message);
                }
            };
            //明细行切换事件
            // 关键:绑定gvMx1和gvMx3的焦点行变化事件
            gvMx1.FocusedRowChanged += GvMx1_FocusedRowChanged;
            //打印自动计算
            gvMx3.FocusedRowChanged += GvMx3_FocusedRowChanged; // 取消注释并绑定事件
            //gvMx3打印自动计算
            txt_psnQty_1.TextChanged += (s, e) =>
            {
                Gs.DevApp.ToolBox.UtilityHelper.PrintJiSuan(txt_psnQty_1, txt_iCount_1, txt_kQty.Text.Trim(), radOut, txt_yuliang_1);
@@ -117,6 +200,16 @@
            {
                Gs.DevApp.ToolBox.UtilityHelper.PrintAuto(txt_psnQty_1, txt_iCount_1, radOut, txt_yuliang_1);
            };
            // gvMx3的自动计算
            txt_psnQty_2.TextChanged += (s, e) =>
            {
                Gs.DevApp.ToolBox.UtilityHelper.PrintJiSuan(txt_psnQty_2, txt_iCount_2, txt_kQtyHb.Text.Trim(), radOut2, txt_yuliang_2);
            };
            radOut2.SelectedIndexChanged += (s, e) =>
            {
                Gs.DevApp.ToolBox.UtilityHelper.PrintAuto(txt_psnQty_2, txt_iCount_2, radOut2, txt_yuliang_2);
            };
        }
        private void GridView1_ColumnFilterChanged(object sender, EventArgs e)
        {
@@ -124,6 +217,9 @@
            Task.Delay(100);
            getPageList(1);
        }
        private void GvMx1_FocusedRowChanged(object sender, DevExpress.XtraGrid.Views.Base.FocusedRowChangedEventArgs e)
        {
            if (e.FocusedRowHandle >= 0)
@@ -152,6 +248,39 @@
                txt_iCount_1.Text = "";
            }
        }
        //明细行切换事件
        private void GvMx3_FocusedRowChanged(object sender, DevExpress.XtraGrid.Views.Base.FocusedRowChangedEventArgs e)
        {
            if (e.FocusedRowHandle >= 0)
            {
                DataRow row = gvMx3.GetDataRow(e.FocusedRowHandle);
                //lbMxGuid.Text = row["guid"].ToString();
                txtItemNo.Text = row["itemNo"].ToString();
                txtItemModel.Text = row["itemModel"].ToString();
                txtItemName.Text = row["itemName"].ToString();
                txtQuantityHb.Text = row["quantity"].ToString();//本次收货总量
                txt_yQtyHb.Text = row["yQty"].ToString();//已打印总量
                txt_kQtyHb.Text = row["kQty"].ToString(); //可打印总量
                txt_psnQty_2.Text = row["mrtmsl"].ToString(); //默认每张条码数量
                txt_releaseNo.Text = row["releaseNo"].ToString(); //可打印总量
            }
            else
            {
                lbMxGuid.Text = "";
                ucBtnPrint1.guidKey = "";
                txtItemNo.Text = "";
                txtItemModel.Text = "";
                txtItemName.Text = "";
                txtQuantityHb.Text = "";
                txt_yQtyHb.Text = "";
                txt_kQtyHb.Text = "";
                txt_psnQty_2.Text = "";
                txt_iCount_2.Text = "";
            }
        }
        /// <summary>
        /// 分页事件
        /// </summary>
@@ -255,6 +384,8 @@
        private void getModel(string strGuid)
        {
            gcMx1.DataSource = null;
            gcMx2.DataSource = null;
            gcMx3.DataSource = null;
            bool isEdit = false;
            if (toolBarMenu1.currentAction == "add") return;
            if (toolBarMenu1.currentAction == "edit") isEdit = true;
@@ -278,6 +409,7 @@
                    List<DevExpress.XtraGrid.Views.Grid.GridView> gvList = new List<DevExpress.XtraGrid.Views.Grid.GridView>();
                    gvList.Add(gvMx1);
                    gvList.Add(gvMx2);
                    gvList.Add(gvMx3);
                    UtilityHelper.SetValueByObj(this.layoutMx1.Controls, dy, isEdit, gvList);
                    JArray array1 = new JArray();
                    foreach (var a in dy["list1"])
@@ -316,6 +448,24 @@
                    {
                        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);