cdk
2025-11-01 4dc2dbda4150c7c74a26435a75308789dc359b99
DevApp/Gs.DevApp/DevFrm/Rk/Frm_MesItemTbl.cs
@@ -68,10 +68,12 @@
                txt_workName.Text = txt_tbl002.GetWorkName();
                txt_itemName.Text = txt_tbl002.GetPrdName();
                txt_itemNo.Text = txt_tbl002.GetPrdNo();
                txt_line.Text = txt_tbl002.GetWorkXb();
            };
            //选择需要入库的明细
            btnSelect.Click += (s, e) =>
            {
                tabMx.SelectedTabPageIndex = 0;
                string _tbl002 = txt_tbl002.GetId();
                if (string.IsNullOrEmpty(_tbl002))
                {
@@ -105,7 +107,7 @@
                        gvMx1.CloseEditor();
                        gvMx1.PostEditor();
                        gvMx1.UpdateCurrentRow();
                        gridView1.BestFitColumns();
                        gvMx1.BestFitColumns();
                    }
                    catch (Exception ex)
                    {
@@ -114,40 +116,11 @@
                };
                frm.ShowDialog();
            };
            //打印事件
            #region 打印相关
            //预览打印事件
            this.ucBtnPrint1.btnPrintClick += (s, e) =>
            {
                string rowGuid = lbMxGuid.Text.Trim();
                ucBtnPrint1.guidKey = rowGuid;
                if (!Gs.DevApp.ToolBox.UtilityHelper.IsNumeric3(txt_iCount_1.Text.Trim(), txt_yuliang_1.Text.Trim()))
                {
                    Gs.DevApp.ToolBox.MsgHelper.ShowError("请输入正确的条码数量!");
                    txt_iCount_1.Focus();
                    this.ucBtnPrint1.rptParameter = "return false";
                    return;
                }
                if (!Gs.DevApp.ToolBox.UtilityHelper.IsNumeric3(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_SCTL{"
                       + lbMxGuid.Text.Trim()//关联主键
                       + "," + ""
                       + "," + Gs.DevApp.ToolBox.UtilityHelper.ToDecimal(txt_yuliang_1.Text.Trim())//余数
                       + "," + txt_iCount_1.Text.Trim()//张数
                       + "," + txt_psnQty_1.Text.Trim()//每张条码数量
                       + "}";
                txt_iCount_1.Text = "";
                txt_psnQty_1.Text = "";
                _print(0);
            };
            //打印批量操作事件
            this.ucBtnPrint1.btnAllClick += (s, e) =>
@@ -188,6 +161,11 @@
                    }
                }
            };
            //直接打印事件
            this.ucBtnPrint1.btnZhiJieClick += (s, e) =>
            {
                _print(1);
            };
            gvMx1.FocusedRowChanged += GvMx1_FocusedRowChanged;
            //打印自动计算
            txt_psnQty_1.TextChanged += (s, e) =>
@@ -198,8 +176,86 @@
            {
                Gs.DevApp.ToolBox.UtilityHelper.PrintAuto(txt_psnQty_1, txt_iCount_1, radOut, txt_yuliang_1);
            };
            //全部打印
            ucBtnPrintAll1.btnPrintClick += (s, e) =>
            {
                this.ucBtnPrintAll1.rptType = "";
                this.ucBtnPrintAll1.mxList = null;
                if (string.IsNullOrEmpty(lbGuid.Text.Trim()))
                {
                    MsgHelper.ShowError("提示:打印前请先保存单据!");
                    return;
                }
                getModel(lbGuid.Text.Trim());
                List<dynamic> lst = new List<dynamic>();
                DataTable dt = (DataTable)gcMx1.DataSource;
                foreach (DataRow row in dt.Rows)
                {
                    string guid = row["guid"].ToString();
                    string psnQty = row["kdy"].ToString();
                    if (string.IsNullOrEmpty(psnQty))
                    {
                        continue;
                    }
                    if (psnQty == "0")
                    {
                        continue;
                    }
                    lst.Add(new
                    {
                        guid = guid,
                        kdy = psnQty,
                    });
                }
                if (lst.Count <= 0)
                {
                    MsgHelper.ShowError("提示:暂无可打印的物料!");
                    return;
                }
                this.ucBtnPrintAll1.rptType = "rpt_SCTL";
                this.ucBtnPrintAll1.mxList = lst;
            };
            #endregion
        }
        /// <summary>
        /// 打印
        /// </summary>
        /// <param name="type">0表示预览打印,1表示直接打印</param>
        private void _print(int type)
        {
            string rowGuid = lbMxGuid.Text.Trim();
            ucBtnPrint1.guidKey = rowGuid;
            if (!Gs.DevApp.ToolBox.UtilityHelper.IsNumeric3(txt_iCount_1.Text.Trim(), txt_yuliang_1.Text.Trim()))
            {
                Gs.DevApp.ToolBox.MsgHelper.ShowError("请输入正确的条码数量!");
                txt_iCount_1.Focus();
                this.ucBtnPrint1.rptParameter = "return false";
                return;
            }
            if (!Gs.DevApp.ToolBox.UtilityHelper.IsNumeric3(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_SCTL{"
                   + lbMxGuid.Text.Trim()//关联主键
                   + "," + ""
                   + "," + Gs.DevApp.ToolBox.UtilityHelper.ToDecimal(txt_yuliang_1.Text.Trim())//余数
                   + "," + txt_iCount_1.Text.Trim()//张数
                   + "," + txt_psnQty_1.Text.Trim()//每张条码数量
                   + "}";
            txt_iCount_1.Text = "";
            txt_psnQty_1.Text = "";
        }
        private async void GridView1_ColumnFilterChanged(object sender, EventArgs e)
        {
            _filterList = Gs.DevApp.ToolBox.UtilityHelper.GetDilter(gridView1.Columns, gridView1);
@@ -290,7 +346,7 @@
        {
            _toolCk(5);
        }
        /// <summary>
        ///     审核事件
        /// </summary>
@@ -466,7 +522,7 @@
                txt_tbl005.Focus();
                return;
            }
            if ((txt_tbl005.Text.Trim()=="良品退料") && txt_chkOut.Checked)
            if ((txt_tbl005.Text.Trim() == "良品退料") && txt_chkOut.Checked)
            {
                Gs.DevApp.ToolBox.MsgHelper.ShowError("良品退料不能自动生成补料单,\n只有作业不良类型才能生成补料单,\n 请检查!");
                txt_tbl005.Focus();
@@ -712,7 +768,7 @@
                        getModel(lbGuid.Text);
                    }
                    else
                    MsgHelper.ShowError("提示:" + _rtn.rtnMsg);
                        MsgHelper.ShowError("提示:" + _rtn.rtnMsg);
                }
                catch (Exception ex)
                {
@@ -764,7 +820,7 @@
            {
                guid = rowGuid,
                inFieldValue = _inFieldValue,
            };
            try
            {