using DevExpress.Data; using DevExpress.XtraEditors; using DevExpress.XtraGrid.Views.Grid; using DevExpress.XtraPrinting.Native; using FastReport.Editor.Syntax; using Gs.DevApp.Entity; using Gs.DevApp.ToolBox; using Newtonsoft.Json; using System; using System.Collections.Generic; using System.Data; using System.Windows.Forms; namespace Gs.DevApp.UserControl { public partial class SelectSqmx : XtraForm { private readonly string _webServiceName = "MesInvItemMovesManager/"; private string workId = ""; /// /// /// /// 供应商 /// 收料组织 /// 是否委外 public SelectSqmx() { InitializeComponent(); this.gridView1.CustomDrawColumnHeader += (s, e) => { Gs.DevApp.ToolBox.UtilityHelper.CustomDrawColumnHeader(s, e); }; this.gridView1.MouseUp += (s, e) => { Gs.DevApp.ToolBox.UtilityHelper.CustomMouseUp(s, e, gcMain, gridView1); }; this.colChkInt.OptionsColumn.AllowSort = DevExpress.Utils.DefaultBoolean.False; this.colChkInt.OptionsFilter.AllowAutoFilter = false; this.colChkInt.OptionsFilter.AllowFilter = false; this.colChkInt.OptionsFilter.AllowInHeaderSearch = DevExpress.Utils.DefaultBoolean.False; radioGroup1.SelectedIndex = 0; Gs.DevApp.ToolBox.UtilityHelper.SetGridViewParameter(gridView1, null, null, null, "", null, null, false); getPageList(1); btnIn.Click += (s, e) => { gridView1.PostEditor(); gridView1.UpdateCurrentRow(); var list = new List(); workId = (radioGroup1.SelectedIndex + 1).ToString(); DataTable dt = this.gcMain.DataSource as DataTable; { foreach (DataRow dr in dt.Rows) { string checkBox = dr["chkInt"].ToString(); if (Gs.DevApp.ToolBox.UtilityHelper.ToCheck(checkBox)) { //list.Add(new //{ // rkmxGuid = dr["guid"].ToString(), // ylqd = dr["ylqd"].ToString(), // itemNo = dr["itemNo"].ToString(), // itemName = dr["itemName"].ToString(), // itemModel = dr["itemModel"].ToString(), // itemId = dr["itemId"].ToString(), // scdd = dr["scdd"].ToString(), // dptName = dr["dptName"].ToString(), // dwName = dr["dwName"].ToString(), // remark = dr["remark"].ToString(), // prdOrg = dr["prdOrg"].ToString(), // daa008 = dr["daa008"].ToString() //}); string _guid = dr["guid"].ToString(); list.Add(_guid); } } } UpdateParent?.Invoke(this, new UpdateParentEventArgs { StringList = list , Data = workId }); Close(); }; radioGroup1.SelectedIndexChanged += (s, e) => { getPageList(1); }; } /// /// 选择后的回调事件 /// public event EventHandler UpdateParent; /// /// /// 第几页 /// 每页几条 private void getPageList(int curPage) { var _obj = new { currentPage = curPage, everyPageSize = 999999, sortName = "", keyWhere = "", workId = (radioGroup1.SelectedIndex + 1)//1是生产,2是委外 }; var json = JsonConvert.SerializeObject(_obj); try { var strReturn = UtilityHelper.HttpPost("",_webServiceName + "SelectScdd", json); var dd = UtilityHelper.ReturnToTablePage(strReturn); var dt = dd.rtnData.list; gcMain.BindingContext = new BindingContext(); gcMain.DataSource = dt; gcMain.ForceInitialize(); gridView1.BestFitColumns(); Gs.DevApp.ToolBox.UtilityHelper.SetGridLayout(gridView1); } catch (Exception ex) { MsgHelper.Warning("提示:" + ex.Message); } } } }