using DevExpress.XtraTreeList.Data; 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.Threading.Tasks; using System.Windows.Forms; using static System.Windows.Forms.VisualStyles.VisualStyleElement; namespace Gs.DevApp.DevFrm { public partial class YS_tmdrk : DevExpress.XtraEditors.XtraForm { //入库检报表 string _webServiceName = "YS_rkjreport/"; List _filterList = new List(); public YS_tmdrk() { InitializeComponent(); this.toolBarMenu1.btnLoadClick += ToolBarMenu1_btnLoadClick; this.toolBarMenu1.btnQueryClick += ToolBarMenu1_btnQueryClick; this.toolBarMenu1.getXmlConfig(); Gs.DevApp.ToolBox.UtilityHelper.SetGridViewParameter(gridView1, null, this, "", "", (value) => { }); Gs.DevApp.ToolBox.UtilityHelper.SetTabParameter(gridView1, xtraTabControl1, pageBar1, (value) => { }, (value) => { getPageList(this.pageBar1.CurrentPage); }); getPageList(1); pageBar1.PagerEvent += PageBar1_PagerEvent; } private async void GridView1_ColumnFilterChanged(object sender, EventArgs e) { _filterList = Gs.DevApp.ToolBox.UtilityHelper.GetDilter(gridView1.Columns, gridView1); await Task.Delay(100); getPageList(1); } /// /// 分页事件 /// /// /// private void PageBar1_PagerEvent(int curPage, int pageSize) { getPageList(curPage); } /// /// 查询事件 /// /// /// private void ToolBarMenu1_btnQueryClick(object sender, EventArgs e) { gridView1.ColumnFilterChanged -= GridView1_ColumnFilterChanged; gridView1.ActiveFilter.Clear(); gridView1.ColumnFilterChanged += GridView1_ColumnFilterChanged; var frm = new ShowFilter(gridView1.Columns, _filterList, this.GetType().FullName); frm.UpdateParent += Frm_UpdateParent; frm.ShowDialog(); } /// /// 查询回调 /// /// /// private void Frm_UpdateParent(object sender, UpdateParentEventArgs e) { _filterList = e.FilterList; getPageList(1); } /// /// 刷新事件 /// /// /// private void ToolBarMenu1_btnLoadClick(object sender, EventArgs e) { getPageList(this.pageBar1.CurrentPage); } /// /// /// /// 第几页 /// 每页几条 private void getPageList(int curPage) { gcMain1.DataSource = null; var _sbSqlWhere = UtilityHelper.GetSearchWhere(_filterList); PageQueryModel pgq = new PageQueryModel(curPage, this.pageBar1.RowsCount, "print_time", "DESC", "", _sbSqlWhere.ToString()); string json = JsonConvert.SerializeObject(pgq); try { var strReturn = UtilityHelper.HttpPost("", _webServiceName + "GetListPageBarcodePendingStockReport", json); ReturnModel dd = UtilityHelper.ReturnToTablePage(strReturn); if (dd.rtnCode > 0) { DataTable dt = dd.rtnData.list; //barcode, -- 条码 //workorder_status, --工单状态 //workorder_no, --工单单号 //barcode_quantity, --条码数量 //work_report_flag, --报工标识 //inspection_flag, --检验标识 //inspection_pass_flag, --检验合格标识 //stockin_flag, --入库标识 //timeout_1day_flag, --超时1天标识 //timeout_3day_flag, --超时3天标识 //product_code, --产品编码 //product_name, --产品名称 //specification, --规格 //print_time, --打印时间 //planned_start_date, --预计开工日 //planned_completion_date, --预计完工日 //actual_start_date, --实际开工日 //pending_days, --未入库天数 //work_report_no, --报工单号 //dispatch_no, --派工单号 //inspection_task_no, --检验任务单号 //stockin_no-- 入库单号 gcMain1.BindingContext = new BindingContext(); gridView1.ColumnFilterChanged -= GridView1_ColumnFilterChanged; if (dt.Rows.Count > 0) { gcMain1.DataSource = dt; gcMain1.ForceInitialize(); gridView1.BestFitColumns(); Gs.DevApp.ToolBox.UtilityHelper.SetGridLayout(gridView1); } else UtilityHelper.SetDefaultTable(gcMain1, gridView1); gridView1.ColumnFilterChanged += GridView1_ColumnFilterChanged; pageBar1.TotalPages = dd.rtnData.pages;//总页 pageBar1.CurrentPage = curPage;//当前页 pageBar1.RecordCount = dd.rtnData.total;//总记录数 } else { ToolBox.MsgHelper.ShowError("提示:" + dd.rtnMsg); } } catch (Exception ex) { ToolBox.MsgHelper.ShowError("提示:" + ex.Message); } } } }