lg
2025-11-28 1708934e25d663104182867b4c238a0c1531352f
DevApp/Gs.DevApp/DevFrm/RkQC/RkDetect01.cs
@@ -1,4 +1,5 @@
using Gs.DevApp.DevFrm.QC;
using DevExpress.XtraLayout.Customization;
using Gs.DevApp.DevFrm.QC;
using Gs.DevApp.DevFrm.Rpt;
using Gs.DevApp.Entity;
using Gs.DevApp.ToolBox;
@@ -7,7 +8,9 @@
using Newtonsoft.Json.Linq;
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Data;
using System.Net;
using System.Threading.Tasks;
using System.Windows.Forms;
@@ -36,6 +39,7 @@
            this.toolBarMenu1.btnLoadClick += ToolBarMenu1_btnLoadClick;
            this.toolBarMenu1.btnEscClick += ToolBarMenu1_btnEscClick;
            this.toolBarMenu1.btnQueryClick += ToolBarMenu1_btnQueryClick;
            toolBarMenu1.btnOutClick += ToolBarMenu1_btnOutClick;
            toolBarMenu1.btnLogClick += ToolBarMenu1_btnLogClick;
            toolBarMenu1.btnChkClick += ToolBarMenu1_btnChkClick;
            toolBarMenu1.btnFChkClick += ToolBarMenu1_btnFChkClick;
@@ -63,11 +67,20 @@
            gvMx1.FocusedRowChanged += GvMx1_FocusedRowChanged;
            btnIpt.Click += BtnIpt_Click;
            string rptName = "";
            if (strType == QcSeason.生产退料入库检.ToString())
                rptName = "rpt_SCTL";
            if (strType == QcSeason.受托入库.ToString())
            {
                rptName = "rpt_Strk";
                layoutControlItem25.Visibility = DevExpress.XtraLayout.Utils.LayoutVisibility.Never;
                layoutControlItem27.Visibility = DevExpress.XtraLayout.Utils.LayoutVisibility.Never;
            }
            else
                  if (strType == QcSeason.其它入库检.ToString())
            {
                rptName = "rpt_Qtrk";
                layoutControlItem25.Visibility = DevExpress.XtraLayout.Utils.LayoutVisibility.Never;
                layoutControlItem27.Visibility = DevExpress.XtraLayout.Utils.LayoutVisibility.Never;
            }
            else
                 if (strType == QcSeason.销售退货入库检.ToString())
                rptName = "rpt_Xsth";
@@ -82,8 +95,70 @@
                layoutControlItem27.Visibility = DevExpress.XtraLayout.Utils.LayoutVisibility.Never;
                tabMxPage3.PageVisible = false;
            }
            #region 打印相关
            this.ucBtnPrint1.btnPrintClick += (s, e) =>
            {
                _print(0, rptName);
            };
            this.ucBtnPrint1.btnAllClick += (s, e) =>
            {
                string rowGuid = txt_aboutGuid.Text.Trim();
                SelectDeleteBar frm = new SelectDeleteBar(rowGuid, strType);
                string strCodeList = "";
                string strAction = "";
                frm.UpdateParent += (ss, ee) =>
                {
                    strCodeList = ee.StringSingle;
                    strAction = ee.Data;
                };
                frm.ShowDialog();
                if (string.IsNullOrEmpty(strCodeList))
                    return;
                if (strAction == "print")
                {
                    try
                    {
                        string rptParameter = rptName + "{"
                        + "100"
                        + "," + ""
                        + "," + ""
                        + "," + ""
                        + "," + ""
                        + "," + strCodeList
                        + "}";
                        using (Form rpt = new RptPreview(rowGuid, rptParameter))
                        {
                            rpt.ShowDialog();
                        }
                        frm.Close();
                    }
                    catch (Exception ex)
                    {
                        MsgHelper.ShowError(ex.Message);
                    }
                }
            };
            this.ucBtnPrint1.btnZhiJieClick += (s, e) =>
            {
                _print(1, rptName);
            };
            //自动计算打印量
            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);
            };
            radOut.SelectedIndexChanged += (s, e) =>
            {
                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 rptName)
        {
            ucBtnPrint1.guidKey = "";
            string rowGuid = txt_aboutGuid.Text.Trim();
@@ -115,53 +190,6 @@
                   + "," + txt_iCount_1.Text.Trim()
                   + "," + txt_psnQty_1.Text.Trim()
                   + "}";
        };
            this.ucBtnPrint1.btnAllClick += (s, e) =>
            {
                string rowGuid = txt_aboutGuid.Text.Trim();
                SelectDeleteBar frm = new SelectDeleteBar(rowGuid, strType);
                string strCodeList = "";
                string strAction = "";
                frm.UpdateParent += (ss, ee) =>
                {
                    strCodeList = ee.StringSingle;
                    strAction = ee.Data;
                };
                frm.ShowDialog();
                if (string.IsNullOrEmpty(strCodeList))
                    return;
                if (strAction == "print") {
                    try
                    {
                        string rptParameter = rptName + "{"
                        + "100"
                        + "," + ""
                        + "," + ""
                        + "," + ""
                        + "," + ""
                        + "," + strCodeList
                        + "}";
                        using (Form rpt = new RptPreview(rowGuid, rptParameter))
                        {
                            rpt.ShowDialog();
                        }
                        frm.Close();
                    }
                    catch (Exception ex)
                    {
                        MsgHelper.ShowError(ex.Message);
                    }
                }
            };
            //自动计算打印量
            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);
            };
            radOut.SelectedIndexChanged += (s, e) =>
            {
                Gs.DevApp.ToolBox.UtilityHelper.PrintAuto(txt_psnQty_1, txt_iCount_1, radOut, txt_yuliang_1);
            };
        }
        /// <summary>
        /// 批量录入
@@ -432,7 +460,13 @@
        {
            toolBarMenu1.isSetBtn = false;
            string rkckid = txt_rkCkId.GetId();
            if (strType != QcSeason.超期检.ToString())
            if (strType == QcSeason.超期检.ToString()
                || strType == QcSeason.其它入库检.ToString()
                || strType == QcSeason.受托入库.ToString())
            {
            }
            else
            {
                if (string.IsNullOrEmpty(rkckid))
                {
@@ -484,7 +518,19 @@
        /// <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.ReceiveOrgId in");
            _sbSqlWhere.Append(ToolBox.UtilityHelper.GetOrgWhere());
            _sbSqlWhere.Append(UtilityHelper.GetSearchWhere(_filterList));
            if (strType == QcSeason.其它入库检.ToString())
            {
                _sbSqlWhere.Append(" and isnull(qtrk.qt028,0)=1 and isnull(qtrk.qt032,0)=1 and isnull(qtrk.qt015,0)=1 ");
            }
            if (strType == QcSeason.受托入库.ToString())
            {
                _sbSqlWhere.Append(" and isnull(st.isCheck,0)=1 and isnull(st.qt032,0)=1");
            }
            PageQueryModel pgq = new PageQueryModel(curPage, this.pageBar1.RowsCount, "release_no", "asc", "", " and a.order_type='" + strType + "' " + _sbSqlWhere.ToString());
            string json = JsonConvert.SerializeObject(pgq);
            try
@@ -518,7 +564,6 @@
            {
                ToolBox.MsgHelper.ShowError("提示:" + ex.Message);
            }
        }
        /// <summary>
        /// 读取实体
@@ -728,5 +773,61 @@
            }
        }
        private void ToolBarMenu1_btnOutClick(object sender, EventArgs e)
        {
            using (FolderBrowserDialog folderBrowserDialog = new FolderBrowserDialog())
            {
                folderBrowserDialog.Description = "选择导出文件的保存路径";
                DialogResult dialogResult = folderBrowserDialog.ShowDialog();
                System.Text.StringBuilder _sbSqlWhere = new System.Text.StringBuilder();
                _sbSqlWhere.Append(" and a.ReceiveOrgId in");
                _sbSqlWhere.Append(ToolBox.UtilityHelper.GetOrgWhere());
                _sbSqlWhere.Append(UtilityHelper.GetSearchWhere(_filterList));
                if (strType == QcSeason.其它入库检.ToString())
                {
                    _sbSqlWhere.Append(" and isnull(qtrk.qt028,0)=1 and isnull(qtrk.qt032,0)=1 and isnull(qtrk.qt015,0)=1 ");
                }
                if (strType == QcSeason.受托入库.ToString())
                {
                    _sbSqlWhere.Append(" and isnull(st.isCheck,0)=1 and isnull(st.qt032,0)=1");
                }
                if (dialogResult == DialogResult.OK)
                {
                    string _folder = folderBrowserDialog.SelectedPath;
                    var _params = new
                    {
                        inSortName = "",
                        inSortOrder = "",
                        inQueryWhere = _sbSqlWhere.ToString()
                    };
                    var _obj = new Gs.DevApp.Entity.XlsOutModel("xlsOut_rkqcdetect01lst", "", "", "", _params);
                    try
                    {
                        string strJson = UtilityHelper.HttpPost("", "XlsInOut/XlsOutView_NEW", JsonConvert.SerializeObject(_obj));
                        ReturnModel<dynamic> _rtn = ToolBox.UtilityHelper.ReturnToDynamic(strJson);
                        if (_rtn.rtnCode > 0)
                        {
                            string _file = _rtn.rtnData.fileUrl.ToString();
                            string _folderName = _folder + "\\" + _file.Replace("down/", "");
                            string _url = ConfigurationManager.AppSettings["WebApiUrl"].ToString() + _file;
                            using (WebClient client = new WebClient())
                            {
                                client.DownloadFile(_url, _folderName);
                            }
                            ToolBox.MsgHelper.ShowInformation("导出成功!");
                        }
                        else
                        {
                            ToolBox.MsgHelper.Warning("提示:" + _rtn.rtnMsg);
                        }
                    }
                    catch (Exception ex)
                    {
                        ToolBox.MsgHelper.Warning("提示:" + ex.Message);
                    }
                }
            }
        }
    }
}