lu
2025-10-13 70c49ce94352ea6097b5de48536e81b1b96682e5
DevApp/Gs.DevApp/DevFrm/Rk/Frm_MesItemTbl.cs
@@ -34,6 +34,8 @@
            toolBarMenu1.btnFPiZhunClick += ToolBarMenu1_btnFPiZhunClick;
            toolBarMenu1.btnPiZhunClick += ToolBarMenu1_btnPiZhunClick;
            toolBarMenu1.btnLogClick += ToolBarMenu1_btnLogClick;
            toolBarMenu1.btnPingZhiClick += ToolBarMenu1_btnPingZhiClick;
            toolBarMenu1.btnFPingZhiClick += ToolBarMenu1_btnFPingZhiClick;
            this.toolBarMenu1.getXmlConfig();
            Gs.DevApp.ToolBox.UtilityHelper.SetGridViewParameterMx(gvMx1);
            Gs.DevApp.ToolBox.UtilityHelper.SetGridViewParameterMx(gvMx2);
@@ -66,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))
                {
@@ -103,7 +107,7 @@
                        gvMx1.CloseEditor();
                        gvMx1.PostEditor();
                        gvMx1.UpdateCurrentRow();
                        gridView1.BestFitColumns();
                        gvMx1.BestFitColumns();
                    }
                    catch (Exception ex)
                    {
@@ -112,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) =>
@@ -186,6 +161,11 @@
                    }
                }
            };
            //直接打印事件
            this.ucBtnPrint1.btnZhiJieClick += (s, e) =>
            {
                _print(1);
            };
            gvMx1.FocusedRowChanged += GvMx1_FocusedRowChanged;
            //打印自动计算
            txt_psnQty_1.TextChanged += (s, e) =>
@@ -196,8 +176,47 @@
            {
                Gs.DevApp.ToolBox.UtilityHelper.PrintAuto(txt_psnQty_1, txt_iCount_1, radOut, txt_yuliang_1);
            };
        }
            #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);
@@ -270,6 +289,25 @@
        {
            _toolCk(3);
        }
        /// <summary>
        /// 反品质
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void ToolBarMenu1_btnPingZhiClick(object sender, EventArgs e)
        {
            _toolCk(4);
        }
        /// <summary>
        /// 品质
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void ToolBarMenu1_btnFPingZhiClick(object sender, EventArgs e)
        {
            _toolCk(5);
        }
        /// <summary>
        ///     审核事件
        /// </summary>
@@ -439,15 +477,21 @@
                txt_tbl002.Focus();
                return;
            }
            if (string.IsNullOrEmpty(txt_tbl005.Text.Trim()))
            if (txt_tbl005.SelectedIndex <= 0)
            {
                Gs.DevApp.ToolBox.MsgHelper.ShowError("请选择原因!");
                Gs.DevApp.ToolBox.MsgHelper.ShowError("请选择类型!");
                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("良品退料不能自动生成补料单,请检查!");
                Gs.DevApp.ToolBox.MsgHelper.ShowError("良品退料不能自动生成补料单,\n只有作业不良类型才能生成补料单,\n 请检查!");
                txt_tbl005.Focus();
                return;
            }
            if ((txt_tbl005.Text.Trim() == "来料不良退料") && txt_chkOut.Checked)
            {
                Gs.DevApp.ToolBox.MsgHelper.ShowError("来料不良退料不能自动生成补料单,\n只有作业不良类型才能生成补料单,\n 请检查!");
                txt_tbl005.Focus();
                return;
            }
@@ -531,7 +575,11 @@
        /// <param name="pageSize">每页几条</param>
        private void getPageList(int curPage)
        {
            gcMain1.DataSource = null; var _sbSqlWhere = UtilityHelper.GetSearchWhere(_filterList);
            gcMain1.DataSource = null;
            System.Text.StringBuilder _sbSqlWhere = new System.Text.StringBuilder();
            _sbSqlWhere.Append(" and a.tbl023 in");
            _sbSqlWhere.Append(ToolBox.UtilityHelper.GetOrgWhere());
            _sbSqlWhere.Append(UtilityHelper.GetSearchWhere(_filterList));
            PageQueryModel pgq = new PageQueryModel(curPage, this.pageBar1.RowsCount, "create_date", "asc", "", _sbSqlWhere.ToString());
            string json = JsonConvert.SerializeObject(pgq);
            try
@@ -681,7 +729,7 @@
                        getModel(lbGuid.Text);
                    }
                    else
                    MsgHelper.ShowError("提示:" + _rtn.rtnMsg);
                        MsgHelper.ShowError("提示:" + _rtn.rtnMsg);
                }
                catch (Exception ex)
                {
@@ -711,6 +759,12 @@
                case 3:
                    strMsg = "反批准";
                    break;
                case 4:
                    strMsg = "品质审核";
                    break;
                case 5:
                    strMsg = "品质反审核";
                    break;
            }
            ;
            toolBarMenu1.guidKey = "";
@@ -727,7 +781,7 @@
            {
                guid = rowGuid,
                inFieldValue = _inFieldValue,
            };
            try
            {