啊鑫
2024-10-25 125a3ef5be646daa13d4fdadac8e77a8da3f66d3
DevApp/Gs.DevApp/DevFrm/QC/Frm_MesQmCheckitemDt.cs
@@ -16,6 +16,7 @@
    {
        string _webServiceName = "MesQmCheckitemManager/";
        List<FilterEntity> _filterList = new List<FilterEntity>();
        public Frm_MesQmCheckitemDt()
        {
            InitializeComponent();
@@ -40,7 +41,9 @@
            {
                string str = "暂未查找到匹配的数据!";
                Font f = new Font("微软雅黑", 16);
                Rectangle r = new Rectangle(gridView1.GridControl.Width / 2 - 100, e.Bounds.Top + 45, e.Bounds.Right - 5, e.Bounds.Height - 5);
                Rectangle r = new Rectangle(
                    gridView1.GridControl.Width / 2 - 100, e.Bounds.Top + 45,
                    e.Bounds.Right - 5, e.Bounds.Height - 5);
                e.Graphics.DrawString(str, f, Brushes.Gray, r);
            };
        }
@@ -52,10 +55,13 @@
        /// <param name="e"></param>
        private void GcMain_MouseDoubleClick(object sender, MouseEventArgs e)
        {
            string rowGuid = Gs.DevApp.ToolBox.UtilityHelper.GetCurrentDoubleRow(gridView1, e, "guid");
            string rowGuid =
                Gs.DevApp.ToolBox.UtilityHelper.GetCurrentDoubleRow(gridView1,
                    e, "guid");
            if (!string.IsNullOrEmpty(rowGuid))
                getModel(rowGuid, false, 999);
        }
        /// <summary>
        /// 分页事件
        /// </summary>
@@ -65,6 +71,7 @@
        {
            getPageList(curPage, pageSize);
        }
        /// <summary>
        /// 查询事件
        /// </summary>
@@ -72,10 +79,13 @@
        /// <param name="e"></param>
        private void ToolBarMenu1_btnQueryClick(object sender, EventArgs e)
        {
            Gs.DevApp.UserControl.ShowFilter frm = new Gs.DevApp.UserControl.ShowFilter(gridView1.Columns, _filterList);
            Gs.DevApp.UserControl.ShowFilter frm =
                new Gs.DevApp.UserControl.ShowFilter(gridView1.Columns,
                    _filterList);
            frm.UpdateParent += Frm_UpdateParent;
            frm.ShowDialog();
        }
        /// <summary>
        /// 查询回调
        /// </summary>
@@ -111,20 +121,25 @@
                ToolBox.MsgHelper.Warning("请先选择你要操作的行!");
                return;
            }
            if (!MsgHelper.AskQuestion("你选择了【" + rowName + "】,确定删除吗?"))
                return;
               List<dynamic> lst = new List<dynamic>();
          lst.Add(rowGuid);
          var _obj = lst;
            List<dynamic> lst = new List<dynamic>();
            lst.Add(rowGuid);
            var _obj = lst;
            try
            {
                string strJson = UtilityHelper.HttpPost("", _webServiceName + "DeleteModel", JsonConvert.SerializeObject(_obj));
                ReturnModel<dynamic> _rtn = ToolBox.UtilityHelper.ReturnToDynamic(strJson);
                string strJson = UtilityHelper.HttpPost("",
                    _webServiceName + "DeleteModel",
                    JsonConvert.SerializeObject(_obj));
                ReturnModel<dynamic> _rtn =
                    ToolBox.UtilityHelper.ReturnToDynamic(strJson);
                if (_rtn.rtnCode > 0)
                {
                    UtilityHelper.JumpToTab(xtraTabControl1, 0);
                    getPageList(1, UtilityHelper.GetPageSize());
                }
                ToolBox.MsgHelper.Warning("提示:" + _rtn.rtnMsg);
            }
            catch (Exception ex)
@@ -143,6 +158,7 @@
            UtilityHelper.JumpToTab(xtraTabControl1, 0);
            getPageList(1, UtilityHelper.GetPageSize());
        }
        /// <summary>
        /// 修改事件
        /// </summary>
@@ -157,8 +173,10 @@
                ToolBox.MsgHelper.Warning("请先选择你要操作的行!");
                return;
            }
            getModel(rowGuid, true, 1);
        }
        /// <summary>
        /// 新增事件
        /// </summary>
@@ -166,13 +184,16 @@
        /// <param name="e"></param>
        private void ToolBarMenu1_btnAddClick(object sender, EventArgs e)
        {
               UtilityHelper.JumpToTab(xtraTabControl1, 1);
    lbGuid.Text = "";
    List<DevExpress.XtraGrid.Views.Grid.GridView> gridViews = new List<DevExpress.XtraGrid.Views.Grid.GridView>();
    gridViews.Add(gvMx1);
    UtilityHelper.CleanValueByControl(this.panel1.Controls, true, gridViews);
    Gs.DevApp.ToolBox.UtilityHelper.SetDefaultTable(gcMx1, gvMx1);
            UtilityHelper.JumpToTab(xtraTabControl1, 1);
            lbGuid.Text = "";
            List<GridView> gridViews =
                new List<GridView>();
            gridViews.Add(gvMx1);
            UtilityHelper.CleanValueByControl(this.panel1.Controls, true,
                gridViews);
            Gs.DevApp.ToolBox.UtilityHelper.SetDefaultTable(gcMx1, gvMx1);
        }
        /// <summary>
        /// 保存事件
        /// </summary>
@@ -189,19 +210,22 @@
            }
            var _obj = new
            {
                guid = lbGuid.Text.Trim(),//主建
                guid = lbGuid.Text.Trim(), //主建
            };
            try
            {
                string strJson = UtilityHelper.HttpPost("", _webServiceName + "EditModel", JsonConvert.SerializeObject(_obj));
                ReturnModel<dynamic> _rtn = ToolBox.UtilityHelper.ReturnToDynamic(strJson);
                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)
                {
                    lbGuid.Text = _rtn.rtnData;
                    toolBarMenu1.isSetBtn = true;
                    UtilityHelper.ChangeEnableByControl(this.panel1.Controls, false);
                    UtilityHelper.ChangeEnableByControl(this.panel1.Controls,
                        false);
                }
            }
            catch (Exception ex)
@@ -217,40 +241,47 @@
        /// <param name="pageSize">每页几条</param>
        private void getPageList(int curPage, int pageSize)
        {
            System.Text.StringBuilder _sbSqlWhere = new System.Text.StringBuilder();
            System.Text.StringBuilder _sbSqlWhere =
                new System.Text.StringBuilder();
            foreach (FilterEntity itm in _filterList)
            {
                _sbSqlWhere.Append(" and " + itm.fileId + itm.fileOper + "'" + itm.fileValue + "'");
                _sbSqlWhere.Append(" and " + itm.fileId + itm.fileOper + "'" +
                                   itm.fileValue + "'");
            }
            PageQueryModel pgq = new PageQueryModel(curPage, pageSize, "create_date", "asc", "", _sbSqlWhere.ToString());
            PageQueryModel pgq = new PageQueryModel(curPage, pageSize,
                "create_date", "asc", "", _sbSqlWhere.ToString());
            string json = JsonConvert.SerializeObject(pgq);
            try
            {
                string strReturn = UtilityHelper.HttpPost("", _webServiceName + "GetListPage", json);
                ReturnModel<PageListModel> dd = UtilityHelper.ReturnToTablePage(strReturn);
                string strReturn = UtilityHelper.HttpPost("",
                    _webServiceName + "GetListPageIQC", json);
                ReturnModel<PageListModel> dd =
                    UtilityHelper.ReturnToTablePage(strReturn);
                if (dd.rtnCode > 0)
    {
        DataTable dt = dd.rtnData.list;
        gcMain.BindingContext = new BindingContext();
        gcMain.DataSource = dt;
        gcMain.ForceInitialize();
        int dddd = dd.rtnData.pages;//总页
        pageBar1.TotalPages = dddd;
        pageBar1.RecordCount = dd.rtnData.total;//记录总数
        pageBar1.CurrentPage = curPage;//当前页
        pageBar1.RowsCount = pageSize;//每页显示
        pageBar1.setTxt();
    }
    else
    {
        ToolBox.MsgHelper.ShowError("提示:" + dd.rtnMsg);
    }
                {
                    DataTable dt = dd.rtnData.list;
                    gcMain.BindingContext = new BindingContext();
                    gcMain.DataSource = dt;
                    gcMain.ForceInitialize();
                    int dddd = dd.rtnData.pages; //总页
                    pageBar1.TotalPages = dddd;
                    pageBar1.RecordCount = dd.rtnData.total; //记录总数
                    pageBar1.CurrentPage = curPage; //当前页
                    pageBar1.RowsCount = pageSize; //每页显示
                    pageBar1.setTxt();
                }
                else
                {
                    ToolBox.MsgHelper.ShowError("提示:" + dd.rtnMsg);
                }
            }
            catch (Exception ex)
            {
                ToolBox.MsgHelper.Warning("提示:" + ex.Message);
            }
        }
        private void getModel(string strGuid, bool isEdit, int tabIdx)
        {
            if (string.IsNullOrEmpty(strGuid))
@@ -258,29 +289,38 @@
                ToolBox.MsgHelper.Warning("请先选择你要操作的行!");
                return;
            }
            UtilityHelper.JumpToTab(xtraTabControl1, tabIdx);
            var _obj = new
            {
                guid = strGuid,//主建
                guid = strGuid, //主建
            };
            try
            {
                string strJson = UtilityHelper.HttpPost("", _webServiceName +"GetModel", JsonConvert.SerializeObject(_obj));
                ReturnModel<dynamic> _rtn = ToolBox.UtilityHelper.ReturnToDynamic(strJson);
                string strJson = UtilityHelper.HttpPost("",
                    _webServiceName + "GetModelIQC",
                    JsonConvert.SerializeObject(_obj));
                ReturnModel<dynamic> _rtn =
                    ToolBox.UtilityHelper.ReturnToDynamic(strJson);
                if (_rtn.rtnCode > 0)
                {
                    dynamic dy = _rtn.rtnData;
                    lbGuid.Text = strGuid;
                    List<DevExpress.XtraGrid.Views.Grid.GridView> gvList = new List<DevExpress.XtraGrid.Views.Grid.GridView>();
                    List<DevExpress.XtraGrid.Views.Grid.GridView> gvList =
                        new List<DevExpress.XtraGrid.Views.Grid.GridView>();
                    gvList.Add(gvMx1);
                    UtilityHelper.SetValueByObj(this.panel1.Controls, dy, isEdit, gvList);
                    UtilityHelper.SetValueByObj(this.panel1.Controls, dy,
                        isEdit, gvList);
                    JObject _job = JObject.Parse(strJson);
                    JArray array = new JArray();
                    foreach (var a in _job["rtnData"]["list"])
                    {
                        array.Add(a);
                    }
                    DataTable dt = JsonConvert.DeserializeObject<DataTable>(array.ToString());
                    DataTable dt =
                        JsonConvert.DeserializeObject<DataTable>(
                            array.ToString());
                    if (dt.Rows.Count > 0)
                    {
                        gcMx1.BindingContext = new BindingContext();
@@ -289,7 +329,8 @@
                    }
                    else
                    {
                        Gs.DevApp.ToolBox.UtilityHelper.SetDefaultTable(gcMx1, gvMx1);
                        Gs.DevApp.ToolBox.UtilityHelper.SetDefaultTable(gcMx1,
                            gvMx1);
                    }
                }
                else