cdk
2025-12-02 4b40e0d9657203dd45baa1e6358547f1080491cc
DevApp/Gs.DevApp/DevFrm/Rk/Frm_MesItemTbl.cs
@@ -34,6 +34,11 @@
            toolBarMenu1.btnFPiZhunClick += ToolBarMenu1_btnFPiZhunClick;
            toolBarMenu1.btnPiZhunClick += ToolBarMenu1_btnPiZhunClick;
            toolBarMenu1.btnLogClick += ToolBarMenu1_btnLogClick;
            toolBarMenu1.btnPingZhiClick += ToolBarMenu1_btnPingZhiClick;
            toolBarMenu1.btnFPingZhiClick += ToolBarMenu1_btnFPingZhiClick;
            toolBarMenu1.btnWjClick += ToolBarMenu1_btnWjClick;
            toolBarMenu1.btnPrintClick += ToolBarMenu1_btnPrintClick;
            this.toolBarMenu1.getXmlConfig();
            Gs.DevApp.ToolBox.UtilityHelper.SetGridViewParameterMx(gvMx1);
            Gs.DevApp.ToolBox.UtilityHelper.SetGridViewParameterMx(gvMx2);
@@ -66,10 +71,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))
                {
@@ -82,8 +89,8 @@
                {
                    try
                    {
                        var lst = new List<string>();
                        lst = ee.StringList;
                        var lst = new List<dynamic>();
                        lst = ee.DynamicList;
                        var _obj = lst;
                        var strReturn = UtilityHelper.HttpPost("",
                            "MesItemTblManager/SelectPbaToView",
@@ -98,12 +105,13 @@
                        }
                        gcMx1.BindingContext = new BindingContext();
                        gcMx1.DataSource = _oldTable;
                        gvMx1.Columns["tld016"].SortOrder = DevExpress.Data.ColumnSortOrder.Ascending;
                        gcMx1.ForceInitialize();
                        Gs.DevApp.ToolBox.UtilityHelper.SetGridLayout(gvMx1);
                        gvMx1.CloseEditor();
                        gvMx1.PostEditor();
                        gvMx1.UpdateCurrentRow();
                        gridView1.BestFitColumns();
                        gvMx1.BestFitColumns();
                    }
                    catch (Exception ex)
                    {
@@ -112,40 +120,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 +165,11 @@
                    }
                }
            };
            //直接打印事件
            this.ucBtnPrint1.btnZhiJieClick += (s, e) =>
            {
                _print(1);
            };
            gvMx1.FocusedRowChanged += GvMx1_FocusedRowChanged;
            //打印自动计算
            txt_psnQty_1.TextChanged += (s, e) =>
@@ -196,8 +180,89 @@
            {
                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["tlid"].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);
@@ -226,6 +291,32 @@
        {
            getPageList(curPage);
        }
        /// <summary>
        /// 打印
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void ToolBarMenu1_btnPrintClick(object sender, EventArgs e)
        {
            //guidKey, rptParameter
            string rowGuid, rowName;
            (rowGuid, rowName) = UtilityHelper.GetCurrentRow(xtraTabControl1,
                lbGuid, txt_billNo, gridView1, "billNo");
            if (string.IsNullOrEmpty(rowGuid))
            {
                MsgHelper.ShowError("请先选择你要操作的行!");
                return;
            }
            this.toolBarMenu1.rptParameter = "rpt_SCTLSQ{"
                                               + ""
                                               + "," + ""
                                               + "," + ""
                                               + "," + ""
                                               + "," + ""
                                               + "}";
            this.toolBarMenu1.guidKey = rowGuid;
        }
        /// <summary>
        /// 查询事件
        /// </summary>
@@ -250,7 +341,16 @@
            _filterList = e.FilterList;
            getPageList(1);
        }
        /// <summary>
        /// 完结
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        /// <exception cref="NotImplementedException"></exception>
        private void ToolBarMenu1_btnWjClick(object sender, EventArgs e)
        {
            _toolCk(199);
        }
        /// <summary>
        /// 批准
        /// </summary>
@@ -270,6 +370,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 +558,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;
            }
@@ -493,7 +618,8 @@
                        AboutGuid = Gs.DevApp.ToolBox.UtilityHelper.ToGuid(row["aboutGuid"].ToString()),
                        Sl = _sl, //申请数量
                        Remark = _tld014,
                        Bllb = row["tld015"].ToString().Replace("|", ",")
                        Bllb = row["tld015"].ToString().Replace("|", ","),
                        tld016 = row["tld016"].ToString()
                    });
                }
            }
@@ -531,7 +657,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 +811,7 @@
                        getModel(lbGuid.Text);
                    }
                    else
                    MsgHelper.ShowError("提示:" + _rtn.rtnMsg);
                        MsgHelper.ShowError("提示:" + _rtn.rtnMsg);
                }
                catch (Exception ex)
                {
@@ -711,6 +841,15 @@
                case 3:
                    strMsg = "反批准";
                    break;
                case 4:
                    strMsg = "品质审核";
                    break;
                case 5:
                    strMsg = "品质反审核";
                    break;
                case 199:
                    strMsg = "完结";
                    break;
            }
            ;
            toolBarMenu1.guidKey = "";
@@ -727,7 +866,7 @@
            {
                guid = rowGuid,
                inFieldValue = _inFieldValue,
            };
            try
            {
@@ -767,7 +906,7 @@
            var rowhandle = gvMx1.FocusedRowHandle;
            if (rowhandle < 0)
                return;
            UcDictionarySelect frm = new UcDictionarySelect("异常描述", "  a.s_type='QC异常描述' and a.pid<>'00000000-0000-0000-0000-000000000000'");
            UcDictionarySelect frm = new UcDictionarySelect("退料类别", "  a.s_type='生产退料类别' and a.pid<>'00000000-0000-0000-0000-000000000000'");
            frm.UpdateParent += (ss, ee) =>
            {
                System.Text.StringBuilder stringBuilder = new System.Text.StringBuilder();