lu
2025-10-30 07524287033977cdb0cf45c66f2c3b5d8cc44fb7
DevApp/Gs.DevApp/DevFrm/QC/Frm_MesQmAql1.cs
@@ -7,6 +7,7 @@
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Windows.Forms;
namespace Gs.DevApp.DevFrm.QC
@@ -54,10 +55,10 @@
            this.toolBarMenu1.btnEscClick += ToolBarMenu1_btnEscClick;
            toolBarMenu1.btnChkClick += ToolBarMenu1_btnChkClick;
            toolBarMenu1.btnFChkClick += ToolBarMenu1_btnFChkClick;
            toolBarMenu1.btnPiZhunClick += ToolBarMenu1_btnPiZhunClick;
            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, picCheckBox, this, "foneChecked", "", (value) =>
           {
               Gs.DevApp.ToolBox.UtilityHelper.JumpTab(xtraTabControl1, 0);
@@ -73,40 +74,6 @@
            pageBar1.PagerEvent += PageBar1_PagerEvent;
        }
        /// <summary>
        /// 批准
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void ToolBarMenu1_btnPiZhunClick(object sender, EventArgs e)
        {
            string rowGuid, rowName;
            (rowGuid, rowName) = UtilityHelper.GetCurrentRow(xtraTabControl1,
                lbGuid, txt_sampleSizeNo, gridView1, "sampleSizeNo");
            try
            {
                string strJson = UtilityHelper.HttpPost("", _webServiceName + "Approval", JsonConvert.SerializeObject(rowGuid));
                ReturnModel<dynamic> _rtn = ToolBox.UtilityHelper.ReturnToDynamic(strJson);
                ToolBox.MsgHelper.Warning("提示:" + _rtn.rtnMsg);
                if (_rtn.rtnCode > 0)
                {
                    if (xtraTabControl1.SelectedTabPageIndex == 1)
                    {
                        getModel(lbGuid.Text.Trim());
                    }
                    int rowHandle = gridView1.LocateByValue(1, gridView1.Columns["guid"], rowGuid);
                    gridView1.FocusedRowHandle = rowHandle;
                    gridView1.SetFocusedRowCellValue("ftwoChecked", true);
                    gridView1.SetFocusedRowCellValue("isenabled", true);
                    gridView1.SetFocusedRowCellValue("ftwoCheckor", "已批准");
                    gridView1.SetFocusedRowCellValue("ftwoCheckdate", DateTime.Now.ToString());
                }
            }
            catch (Exception ex)
            {
                ToolBox.MsgHelper.Warning("提示:" + ex.Message);
            }
        }
        /// <summary>
        ///     反审核
@@ -160,7 +127,7 @@
            (rowGuid, rowName) = UtilityHelper.GetCurrentRow(xtraTabControl1, lbGuid, txt_sampleSizeNo, gridView1, "sampleSizeNo");
            if (string.IsNullOrEmpty(rowGuid))
            {
                ToolBox.MsgHelper.Warning("请先选择你要操作的行!");
                ToolBox.MsgHelper.ShowError("请先选择你要操作的行!");
                return;
            }
            if (!MsgHelper.AskQuestion("你选择了【" + rowName + "】,确定删除吗?"))
@@ -174,17 +141,20 @@
                ReturnModel<dynamic> _rtn = ToolBox.UtilityHelper.ReturnToDynamic(strJson);
                if (_rtn.rtnCode > 0)
                {
                    ToolBox.MsgHelper.ShowInformation("提示:" + _rtn.rtnMsg);
                    if (xtraTabControl1.SelectedTabPageIndex == 0)
                    { }
                    {
                        getPageList(this.pageBar1.CurrentPage);
                    }
                    else
                        Gs.DevApp.ToolBox.UtilityHelper.JumpTab(xtraTabControl1, 2);
                    getPageList(this.pageBar1.CurrentPage);
                }
                ToolBox.MsgHelper.Warning("提示:" + _rtn.rtnMsg);
                else
                    ToolBox.MsgHelper.ShowError("提示:" + _rtn.rtnMsg);
            }
            catch (Exception ex)
            {
                ToolBox.MsgHelper.Warning("提示:" + ex.Message);
                ToolBox.MsgHelper.ShowError("提示:" + ex.Message);
            }
        }
@@ -221,7 +191,7 @@
            (rowGuid, rowName) = UtilityHelper.GetCurrentRow(xtraTabControl1, lbGuid, txt_sampleSizeNo, gridView1);
            if (string.IsNullOrEmpty(rowGuid))
            {
                ToolBox.MsgHelper.Warning("请先选择你要操作的行!");
                ToolBox.MsgHelper.ShowError("请先选择你要操作的行!");
                return;
            }
            Gs.DevApp.ToolBox.UtilityHelper.JumpTab(xtraTabControl1, 3);
@@ -234,6 +204,7 @@
                List<GridView> gridViews = new List<GridView>();
                gridViews.Add(gvMx1);
                gridViews.Add(gvMx2);
                gridViews.Add(gvMx3);
                UtilityHelper.ChangeEnableByControl(this.layoutMx1.Controls, true, gridViews);
            }
        }
@@ -249,9 +220,11 @@
            List<GridView> gridViews = new List<GridView>();
            gridViews.Add(gvMx1);
            gridViews.Add(gvMx2);
            gridViews.Add(gvMx3);
            UtilityHelper.CleanValueByControl(this.layoutMx1.Controls, true, gridViews);
            UtilityHelper.SetDefaultTable(gcMx1, gvMx1);
            UtilityHelper.SetDefaultTable(gcMx2, gvMx2);
            UtilityHelper.SetDefaultTable(gcMx3, gvMx3);
            txt_createDate.Text = DateTime.Now.ToString("G");
            txt_fversion.Text = "1";
        }
@@ -265,14 +238,14 @@
            toolBarMenu1.isSetBtn = false;
            if (string.IsNullOrEmpty(txt_sampleSizeNo.Text.Trim()))
            {
                Gs.DevApp.ToolBox.MsgHelper.Warning("标准编码不能为空!");
                Gs.DevApp.ToolBox.MsgHelper.ShowError("标准编码不能为空!");
                txt_sampleSizeNo.Focus();
                return;
            }
            if (string.IsNullOrEmpty(txt_sampleSizeName.Text.Trim()))
            {
                Gs.DevApp.ToolBox.MsgHelper.Warning("标准名称不能为空!");
                Gs.DevApp.ToolBox.MsgHelper.ShowError("标准名称不能为空!");
                txt_sampleSizeName.Focus();
                return;
            }
@@ -282,6 +255,9 @@
            gvMx2.CloseEditor();
            gvMx2.PostEditor();
            gvMx2.UpdateCurrentRow();
            gvMx3.CloseEditor();
            gvMx3.PostEditor();
            gvMx3.UpdateCurrentRow();
            try
            {
                var qmaql2 = new List<MesQmAql2>();
@@ -357,14 +333,40 @@
                        });
                    }
                }
                var qmaql4 = new List<MesQmAql4>();
                for (var i = 0; i < gvMx3.DataRowCount; i++)
                {
                    var row = gvMx3.GetDataRow(i);
                    if (row != null)
                    {
                        if (string.IsNullOrEmpty(row["aqlType"].ToString()))
                        {
                            MsgHelper.ShowError("拒收质量水平不能为空!");
                            return;
                        }
                        qmaql4.Add(new MesQmAql4
                        {
                            Guid = UtilityHelper.ToGuid(row["Guid"].ToString()),
                            AqlType = Convert.ToDecimal(row["AqlType"].ToString()),
                            AqlTypeCr = row["AqlTypeCr"].ToString(),
                            AqlTypeMa = row["AqlTypeMa"].ToString(),
                            AqlTypeMi = row["AqlTypeMi"].ToString(),
                        });
                    }
                }
                if (qmaql2.Count <= 0)
                {
                    Gs.DevApp.ToolBox.MsgHelper.Warning("样本量子码不能为空!");
                    Gs.DevApp.ToolBox.MsgHelper.ShowError("样本量子码不能为空!");
                    return;
                }
                if (qmaql3.Count <= 0)
                {
                    Gs.DevApp.ToolBox.MsgHelper.Warning("抽样方案不能为空!");
                    Gs.DevApp.ToolBox.MsgHelper.ShowError("抽样方案不能为空!");
                    return;
                }
                if (qmaql4.Count <= 0)
                {
                    Gs.DevApp.ToolBox.MsgHelper.ShowError("AQL抽样基准不能为空!");
                    return;
                }
                var _obj = new MesQmAql1
@@ -379,28 +381,33 @@
                    FoneChecked = false,
                    Fversion = Convert.ToInt32(txt_fversion.Text.Trim()),
                    MesQmAql2s = qmaql2,
                    MesQmAql3s = qmaql3
                    MesQmAql3s = qmaql3,
                    MesQmAql4s = qmaql4
                };
                try
                {
                    string strJson = UtilityHelper.HttpPost("", _webServiceName + "EditModel", JsonConvert.SerializeObject(_obj));
                    ReturnModel<dynamic> _rtn = ToolBox.UtilityHelper.ReturnToDynamic(strJson);
                    ToolBox.MsgHelper.Warning("提示:" + _rtn.rtnMsg);
                    if (_rtn.rtnCode > 0)
                    {
                        ToolBox.MsgHelper.ShowInformation("提示:" + _rtn.rtnMsg);
                        lbGuid.Text = _rtn.rtnData;
                        toolBarMenu1.isSetBtn = true;
                        List<GridView> gridViews = new List<GridView>();
                        gridViews.Add(gvMx1);
                        gridViews.Add(gvMx2);
                        gridViews.Add(gvMx3);
                        UtilityHelper.ChangeEnableByControl(this.layoutMx1.Controls, false, gridViews);
                        toolBarMenu1.currentAction = "";
                        Gs.DevApp.ToolBox.UtilityHelper.JumpTab(xtraTabControl1, 6);
                    }
                    else
                        ToolBox.MsgHelper.ShowError("提示:" + _rtn.rtnMsg);
                }
                catch (Exception ex)
                {
                    ToolBox.MsgHelper.Warning("提示:" + ex.Message);
                    ToolBox.MsgHelper.ShowError("提示:" + ex.Message);
                }
            }
            catch (Exception ex)
@@ -418,7 +425,7 @@
        /// <param name="pageSize">每页几条</param>
        private void getPageList(int curPage)
        {
            gcMain1.DataSource = null;var _sbSqlWhere = UtilityHelper.GetSearchWhere(_filterList);
            gcMain1.DataSource = null; var _sbSqlWhere = UtilityHelper.GetSearchWhere(_filterList);
            PageQueryModel pgq = new PageQueryModel(curPage, this.pageBar1.RowsCount, "create_date", "asc", "", _sbSqlWhere.ToString());
            string json = JsonConvert.SerializeObject(pgq);
            try
@@ -448,9 +455,14 @@
            }
            catch (Exception ex)
            {
                ToolBox.MsgHelper.Warning("提示:" + ex.Message);
                ToolBox.MsgHelper.ShowError("提示:" + ex.Message);
            }
        }
        /// <summary>
        /// 读取实体
        /// </summary>
        /// <param name="strGuid"></param>
        private void getModel(string strGuid)
        {
            bool isEdit = false;
@@ -458,7 +470,7 @@
            if (toolBarMenu1.currentAction == "edit") isEdit = true;
            if (string.IsNullOrEmpty(strGuid))
            {
                ToolBox.MsgHelper.Warning("请先选择你要操作的行!");
                ToolBox.MsgHelper.ShowError("请先选择你要操作的行!");
                return;
            }
            var _obj = new
@@ -476,10 +488,12 @@
                    List<GridView> gvList = new List<GridView>();
                    gvList.Add(gvMx1);
                    gvList.Add(gvMx2);
                    gvList.Add(gvMx3);
                    UtilityHelper.SetValueByObj(this.layoutMx1.Controls, dy, isEdit, gvList);
                    JObject _job = JObject.Parse(strJson);
                    JArray array = new JArray();
                    JArray mesQmAql3s = new JArray();
                    JArray mesQmAql4s = new JArray();
                    foreach (var a in _job["rtnData"]["mesQmAql2s"])
                    {
                        array.Add(a);
@@ -510,15 +524,32 @@
                    }
                    else
                    {
                        Gs.DevApp.ToolBox.UtilityHelper.SetDefaultTable(gcMx2, gvMx2);
                        Gs.DevApp.ToolBox.UtilityHelper.SetDefaultTable(gcMx3, gvMx3);
                    }
                        foreach (var a in _job["rtnData"]["mesQmAql4s"])
                        {
                            mesQmAql4s.Add(a);
                        }
                    DataTable dt2 = JsonConvert.DeserializeObject<DataTable>(mesQmAql4s.ToString());
                    if (dt2.Rows.Count > 0)
                    {
                        gcMx3.BindingContext = new BindingContext();
                        gcMx3.DataSource = dt2;
                        gcMx3.ForceInitialize();
                        // gvMx3.BestFitColumns();
                    }
                    else
                    {
                        Gs.DevApp.ToolBox.UtilityHelper.SetDefaultTable(gcMx3, gvMx3);
                    }
                }
                else
                    ToolBox.MsgHelper.Warning("提示:" + _rtn.rtnMsg);
                    ToolBox.MsgHelper.ShowError("提示:" + _rtn.rtnMsg);
            }
            catch (Exception ex)
            {
                ToolBox.MsgHelper.Warning("提示:" + ex.Message);
                ToolBox.MsgHelper.ShowError("提示:" + ex.Message);
            }
        }
@@ -556,13 +587,17 @@
                        JsonConvert.SerializeObject(lst));
                    var _rtn =
                        UtilityHelper.ReturnToDynamic(strJson);
                    if (_rtn.rtnCode > 0) getModel(lbGuid.Text);
                    MsgHelper.Warning("提示:" + _rtn.rtnMsg);
                    if (_rtn.rtnCode > 0)
                    {
                        MsgHelper.ShowInformation("提示:" + _rtn.rtnMsg);
                        getModel(lbGuid.Text);
                    }
                    else
                        MsgHelper.ShowError("提示:" + _rtn.rtnMsg);
                }
                catch (Exception ex)
                {
                    MsgHelper.Warning("提示:" + ex.Message);
                    MsgHelper.ShowError("提示:" + ex.Message);
                }
            }
        }
@@ -599,13 +634,16 @@
                        JsonConvert.SerializeObject(lst));
                    var _rtn =
                        UtilityHelper.ReturnToDynamic(strJson);
                    if (_rtn.rtnCode > 0) getModel(lbGuid.Text);
                    MsgHelper.Warning("提示:" + _rtn.rtnMsg);
                    if (_rtn.rtnCode > 0)
                    {
                        getModel(lbGuid.Text); MsgHelper.ShowInformation("提示:" + _rtn.rtnMsg);
                    }
                    else
                        MsgHelper.ShowError("提示:" + _rtn.rtnMsg);
                }
                catch (Exception ex)
                {
                    MsgHelper.Warning("提示:" + ex.Message);
                    MsgHelper.ShowError("提示:" + ex.Message);
                }
            }
        }
@@ -625,13 +663,14 @@
                case 0:
                    strMsg = "反审核";
                    break;
            };
            }
            ;
            toolBarMenu1.guidKey = "";
            string rowGuid, rowName;
            (rowGuid, rowName) = UtilityHelper.GetCurrentRow(xtraTabControl1, lbGuid, txt_sampleSizeNo, gridView1, "sampleSizeNo");
            if (string.IsNullOrEmpty(rowGuid))
            {
                MsgHelper.Warning("请先选择你要操作的行!");
                MsgHelper.ShowError("请先选择你要操作的行!");
                return;
            }
            if (!MsgHelper.AskQuestion("你选择了【" + rowName + "】,确定" + strMsg + "吗?"))
@@ -648,9 +687,9 @@
                var strJson = UtilityHelper.HttpPost("", "General/GeneralCheck",
                    JsonConvert.SerializeObject(_obj));
                var _rtn = UtilityHelper.ReturnToDynamic(strJson);
                MsgHelper.Warning(_rtn.rtnData.outMsg.ToString());
                if (_rtn.rtnCode > 0)
                {
                    MsgHelper.ShowInformation(_rtn.rtnData.outMsg.ToString());
                    if (xtraTabControl1.SelectedTabPageIndex == 1)
                    {
                        getModel(lbGuid.Text.Trim());
@@ -659,10 +698,12 @@
                    gridView1.FocusedRowHandle = rowHandle;
                    UtilityHelper.SetCheckIco(gridView1, "foneChecked", "foneCheckor", "foneCheckdate", picCheckBox, this, _inFieldValue.ToString());
                }
                else
                    MsgHelper.ShowError(_rtn.rtnData.outMsg.ToString());
            }
            catch (Exception ex)
            {
                MsgHelper.Warning("提示:" + ex.Message);
                MsgHelper.ShowError("提示:" + ex.Message);
            }
        }
    }