lu
2024-12-03 b94097020bf79e3d5f046ac4fbd3c05efcda30b3
DevApp/Gs.DevApp/DevFrm/QC/Frm_MesQaMj.cs
@@ -1,11 +1,13 @@
using Gs.DevApp.DevFrm.QC.Models;
using Gs.DevApp.Entity;
using Gs.DevApp.ToolBox;
using Gs.DevApp.UserControl;
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Data;
using System.Drawing;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace Gs.DevApp.DevFrm.QC
@@ -24,12 +26,15 @@
            this.toolBarMenu1.btnDelClick += ToolBarMenu1_btnDelClick1;
            this.toolBarMenu1.btnEscClick += ToolBarMenu1_btnEscClick;
            this.toolBarMenu1.btnQueryClick += ToolBarMenu1_btnQueryClick;
            toolBarMenu1.btnChkClick += ToolBarMenu1_btnChkClick;
            toolBarMenu1.btnFChkClick += ToolBarMenu1_btnFChkClick;
            gcMain.MouseDoubleClick += GcMain_MouseDoubleClick;
            getPageList(1, UtilityHelper.GetPageSize());
            gridView1.FocusedRowChanged += (s, e) =>
            {
                UtilityHelper.SetCheckIco(s, picCheckBox, this, "status", "");
            };
            getPageList(1);
            Gs.DevApp.ToolBox.UtilityHelper.SetGridSear(gridView1);
            pageBar1.PagerEvent += PageBar1_PagerEvent;
            gridView1.CustomDrawRowIndicator += (s, e) =>
            {
@@ -47,44 +52,21 @@
            };
            _setIno();
        }
        private async void GridView1_ColumnFilterChanged(object sender, EventArgs e)
        {
            _filterList = Gs.DevApp.ToolBox.UtilityHelper.GetDilter(gridView1.Columns);
            await Task.Delay(100);
            getPageList(1);
        }
        private void _setIno()
        {
            this.txt_itemId.KeyFile = "id";
            this.txt_suppNo.KeyFile = "suppNo";
            txt_itemId.EditChanged += (s, e) =>
            {
                txt_itemNo.Text = this.txt_itemId.GetCode();
                var ItemId = this.txt_itemId.GetId();
                var ItemName = this.txt_itemId.GetName();
                GetCount(ItemId, ItemName);
                //var ItemId = this.txt_itemId.GetId();
                //var ItemName = this.txt_itemId.GetName();
                //GetCount(ItemId, ItemName);
            };
        }
        private void GetCount(string ItemId,string ItemName)
        {
            //string rowGuid = "", rowName = "";
            //(rowGuid, rowName) = UtilityHelper.GetCurrentRow(xtraTabControl1, lbGuid, txt_itemNo, gridView1);
            //if (string.IsNullOrEmpty(rowGuid))
            //{
            //    ToolBox.MsgHelper.Warning("请先选择你要操作的行!");
            //    return;
            //}
            try
            {
                string strJson = UtilityHelper.HttpPost("", _webServiceName + "GetCount", JsonConvert.SerializeObject(ItemId));
                ReturnModel<dynamic> _rtn = ToolBox.UtilityHelper.ReturnToDynamic(strJson);
                if (_rtn.rtnCode > 0)
                {
                    UtilityHelper.JumpToTab(xtraTabControl1, 0);
                    MsgHelper.Warning("提示:"+ ItemName+"这个物料已经维护了免检数据");
                }
            }
            catch (Exception ex)
            {
                ToolBox.MsgHelper.Warning("提示:" + ex.Message);
            }
        }
        /// <summary>
        /// 双击事件
@@ -104,7 +86,7 @@
        /// <param name="pageSize"></param>
        private void PageBar1_PagerEvent(int curPage, int pageSize)
        {
            getPageList(curPage, pageSize);
            getPageList(curPage);
        }
        /// <summary>
        /// 查询事件
@@ -113,7 +95,10 @@
        /// <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);
            gridView1.ColumnFilterChanged -= GridView1_ColumnFilterChanged;
            gridView1.ActiveFilter.Clear();
            gridView1.ColumnFilterChanged += GridView1_ColumnFilterChanged;
            var frm = new ShowFilter(gridView1.Columns, _filterList);
            frm.UpdateParent += Frm_UpdateParent;
            frm.ShowDialog();
        }
@@ -125,7 +110,7 @@
        private void Frm_UpdateParent(object sender, UpdateParentEventArgs e)
        {
            _filterList = e.FilterList;
            getPageList(1, pageBar1.RowsCount);
            getPageList(1);
        }
        /// <summary>
@@ -164,7 +149,7 @@
                if (_rtn.rtnCode > 0)
                {
                    UtilityHelper.JumpToTab(xtraTabControl1, 0);
                    getPageList(1, UtilityHelper.GetPageSize());
                    getPageList(1);
                }
                ToolBox.MsgHelper.Warning("提示:" + _rtn.rtnMsg);
            }
@@ -181,8 +166,20 @@
        /// <param name="e"></param>
        private void ToolBarMenu1_btnLoadClick(object sender, EventArgs e)
        {
            UtilityHelper.JumpToTab(xtraTabControl1, 0);
            getPageList(1, UtilityHelper.GetPageSize());
            if (xtraTabControl1.SelectedTabPageIndex == 1)
                getModel(lbGuid.Text.Trim(), false, 999);
            else
            {
                _filterList.Clear();
                if (gridView1.ActiveFilter.Count > 0)
                {
                    gridView1.ColumnFilterChanged -= GridView1_ColumnFilterChanged;
                    gridView1.ActiveFilter.Clear();
                    gridView1.ColumnFilterChanged += GridView1_ColumnFilterChanged;
                }
                getPageList(1);
            }
        }
        /// <summary>
        /// 修改事件
@@ -210,7 +207,6 @@
            UtilityHelper.JumpToTab(xtraTabControl1, 1);
            lbGuid.Text = "";
            UtilityHelper.CleanValueByControl(this.panel1.Controls, true);
            txt_createBy.Enabled = false;
            txt_createDate.Enabled = false;
            txt_lastupdateBy.Enabled = false;
@@ -218,7 +214,6 @@
            txt_checkUser.Enabled = false;
            txt_checkDate.Enabled = false;
            txt_status.Enabled = false;
        }
        /// <summary>
        /// 保存事件
@@ -229,7 +224,7 @@
        {
            toolBarMenu1.isSetBtn = false;
            string _ItemId = txt_itemId.GetId();
            string _suppNo = txt_suppNo.GetCode();
            string _suppNo = txt_suppId.GetId();
            if (string.IsNullOrEmpty(_ItemId))
            {
                Gs.DevApp.ToolBox.MsgHelper.Warning("请选择物料!");
@@ -239,7 +234,7 @@
            if (string.IsNullOrEmpty(_suppNo))
            {
                Gs.DevApp.ToolBox.MsgHelper.Warning("请选择供应商!");
                txt_suppNo.Focus();
                txt_suppId.Focus();
                return;
            }
            var _obj = new MesQaMj
@@ -247,7 +242,7 @@
                Guid = UtilityHelper.ToGuid(lbGuid.Text.Trim()), //主建
                ItemId = Convert.ToInt32(_ItemId),
                ItemNo = txt_itemId.GetCode(),
                SuppNo= _suppNo,
                SuppId = _suppNo,
            };
            try
            {
@@ -272,31 +267,32 @@
        /// </summary>
        /// <param name="curPage">第几页</param>
        /// <param name="pageSize">每页几条</param>
        private void getPageList(int curPage, int pageSize)
        private async void getPageList(int curPage)
        {
            System.Text.StringBuilder _sbSqlWhere = new System.Text.StringBuilder();
            foreach (FilterEntity itm in _filterList)
            {
                _sbSqlWhere.Append(" and " + itm.fileId + itm.fileOper + "'" + itm.fileValue + "'");
            }
            PageQueryModel pgq = new PageQueryModel(curPage, pageSize, "create_date", "asc", "", _sbSqlWhere.ToString());
            UcLoading _loading = new UcLoading();
            var _sbSqlWhere = UtilityHelper.GetSearchWhere(_filterList);
            PageQueryModel pgq = new PageQueryModel(curPage, this.pageBar1.RowsCount, "a.create_date", "asc", "", _sbSqlWhere.ToString());
            string json = JsonConvert.SerializeObject(pgq);
            try
            {
                string strReturn = UtilityHelper.HttpPost("", _webServiceName + "GetListPage", json);
                var strReturn = await UtilityHelper.HttpPostAsync("", _webServiceName + "GetListPage", 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;//记录总数
                    gridView1.ColumnFilterChanged -= GridView1_ColumnFilterChanged;
                    if (dt.Rows.Count > 0)
                    {
                        gcMain.DataSource = dt;
                        gcMain.ForceInitialize();
                    }
                    else
                        UtilityHelper.SetDefaultTable(gcMain, gridView1);
                    gridView1.ColumnFilterChanged += GridView1_ColumnFilterChanged;
                    pageBar1.TotalPages = dd.rtnData.pages;//总页
                    pageBar1.CurrentPage = curPage;//当前页
                    pageBar1.RowsCount = pageSize;//每页显示
                    pageBar1.setTxt();
                    pageBar1.RecordCount = dd.rtnData.total;//总记录数
                }
                else
                {
@@ -307,6 +303,7 @@
            {
                ToolBox.MsgHelper.Warning("提示:" + ex.Message);
            }
            _loading.Stop();
        }
        /// <summary>
        ///