| | |
| | | using DevExpress.XtraGrid.Views.Grid; |
| | | using DevExpress.XtraGrid.Views.Grid.ViewInfo; |
| | | using Gs.DevApp.Entity; |
| | | using Gs.DevApp.ToolBox; |
| | | using Newtonsoft.Json; |
| | | using Newtonsoft.Json.Linq; |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using System.Data; |
| | | using System.Drawing; |
| | | using System.Text; |
| | | using System.Threading.Tasks; |
| | | using System.Windows.Forms; |
| | | using DevExpress.XtraEditors; |
| | | using DevExpress.XtraGrid.Views.Grid; |
| | | using Gs.DevApp.Entity; |
| | | using Gs.DevApp.ToolBox; |
| | | using Gs.DevApp.UserControl; |
| | | using MES.Service.Modes; |
| | | using Newtonsoft.Json; |
| | | using Newtonsoft.Json.Linq; |
| | | |
| | | namespace Gs.DevApp.DevFrm |
| | | namespace Gs.DevApp.DevFrm.QC |
| | | { |
| | | public partial class Frm_MesQmCheckitemDt : DevExpress.XtraEditors.XtraForm |
| | | public partial class Frm_MesQmCheckitemDt : XtraForm |
| | | { |
| | | string _webServiceName = "MesQmCheckitemManager/"; |
| | | List<FilterEntity> _filterList = new List<FilterEntity>(); |
| | | private List<FilterEntity> _filterList = new List<FilterEntity>(); |
| | | private readonly string _webServiceName = "MesQmCheckitemManager/"; |
| | | |
| | | public Frm_MesQmCheckitemDt() |
| | | { |
| | | InitializeComponent(); |
| | | this.toolBarMenu1.btnAddClick += ToolBarMenu1_btnAddClick; |
| | | this.toolBarMenu1.btnEdtClick += ToolBarMenu1_btnEdtClick; |
| | | this.toolBarMenu1.btnSaveClick += ToolBarMenu1_btnSaveClick; |
| | | this.toolBarMenu1.btnLoadClick += ToolBarMenu1_btnLoadClick; |
| | | this.toolBarMenu1.btnDelClick += ToolBarMenu1_btnDelClick1; |
| | | this.toolBarMenu1.btnEscClick += ToolBarMenu1_btnEscClick; |
| | | this.toolBarMenu1.btnQueryClick += ToolBarMenu1_btnQueryClick; |
| | | toolBarMenu1.btnAddClick += ToolBarMenu1_btnAddClick; |
| | | toolBarMenu1.btnEdtClick += ToolBarMenu1_btnEdtClick; |
| | | toolBarMenu1.btnSaveClick += ToolBarMenu1_btnSaveClick; |
| | | toolBarMenu1.btnLoadClick += ToolBarMenu1_btnLoadClick; |
| | | toolBarMenu1.btnDelClick += ToolBarMenu1_btnDelClick1; |
| | | toolBarMenu1.btnEscClick += ToolBarMenu1_btnEscClick; |
| | | toolBarMenu1.btnQueryClick += ToolBarMenu1_btnQueryClick; |
| | | toolBarMenu1.btnChkClick += ToolBarMenu1_btnChkClick; |
| | | toolBarMenu1.btnFChkClick += ToolBarMenu1_btnFChkClick; |
| | | toolBarMenu1.btnPiZhunClick += ToolBarMenu1_btnPiZhunClick; |
| | | gcMain.MouseDoubleClick += GcMain_MouseDoubleClick; |
| | | getPageList(1, UtilityHelper.GetPageSize()); |
| | | gridView1.FocusedRowChanged += (s, e) => |
| | | { |
| | | UtilityHelper.SetCheckIco(s, picCheckBox, this, "foneChecked", ""); |
| | | }; |
| | | getPageList(1); |
| | | Gs.DevApp.ToolBox.UtilityHelper.SetGridSear(gridView1); |
| | | pageBar1.PagerEvent += PageBar1_PagerEvent; |
| | | gridView1.CustomDrawRowIndicator += (s, e) => |
| | | { |
| | | if (e.Info.IsRowIndicator && e.RowHandle >= 0) |
| | | { |
| | | e.Info.DisplayText = (e.RowHandle + 1).ToString(); |
| | | } |
| | | }; |
| | | gridView1.CustomDrawEmptyForeground += (s, e) => |
| | | { |
| | | string str = "暂未查找到匹配的数据!"; |
| | | Font f = new Font("微软雅黑", 16); |
| | | Rectangle r = new Rectangle( |
| | | var str = "暂未查找到匹配的数据!"; |
| | | var f = new Font("微软雅黑", 16); |
| | | var 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); |
| | | }; |
| | | //初始化物料选择和各种下拉 |
| | | _setIno(); |
| | | } |
| | | |
| | | private async void GridView1_ColumnFilterChanged(object sender, EventArgs e) |
| | | { |
| | | _filterList = Gs.DevApp.ToolBox.UtilityHelper.GetDilter(gridView1.Columns); |
| | | await Task.Delay(100); |
| | | getPageList(1); |
| | | } |
| | | /// <summary> |
| | | /// 双击事件 |
| | | /// 双击事件 |
| | | /// </summary> |
| | | /// <param name="sender"></param> |
| | | /// <param name="e"></param> |
| | | private void GcMain_MouseDoubleClick(object sender, MouseEventArgs e) |
| | | { |
| | | string rowGuid = |
| | | Gs.DevApp.ToolBox.UtilityHelper.GetCurrentDoubleRow(gridView1, |
| | | var rowGuid = |
| | | UtilityHelper.GetCurrentDoubleRow(gridView1, |
| | | e, "guid"); |
| | | if (!string.IsNullOrEmpty(rowGuid)) |
| | | getModel(rowGuid, false, 999); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 分页事件 |
| | | /// 分页事件 |
| | | /// </summary> |
| | | /// <param name="curPage"></param> |
| | | /// <param name="pageSize"></param> |
| | | private void PageBar1_PagerEvent(int curPage, int pageSize) |
| | | { |
| | | getPageList(curPage, pageSize); |
| | | getPageList(curPage); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 查询事件 |
| | | /// 查询事件 |
| | | /// </summary> |
| | | /// <param name="sender"></param> |
| | | /// <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(); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 查询回调 |
| | | /// 查询回调 |
| | | /// </summary> |
| | | /// <param name="sender"></param> |
| | | /// <param name="e"></param> |
| | | private void Frm_UpdateParent(object sender, UpdateParentEventArgs e) |
| | | { |
| | | _filterList = e.FilterList; |
| | | getPageList(1, pageBar1.RowsCount); |
| | | getPageList(1); |
| | | } |
| | | /// <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_itemNo, gridView1); |
| | | try |
| | | { |
| | | string strJson = UtilityHelper.HttpPost("", _webServiceName + "Approval", JsonConvert.SerializeObject(rowGuid)); |
| | | ReturnModel<dynamic> _rtn = ToolBox.UtilityHelper.ReturnToDynamic(strJson); |
| | | if (_rtn.rtnCode > 0) |
| | | { |
| | | UtilityHelper.JumpToTab(xtraTabControl1, 0); |
| | | getPageList(1); |
| | | } |
| | | ToolBox.MsgHelper.Warning("提示:" + _rtn.rtnMsg); |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | ToolBox.MsgHelper.Warning("提示:" + ex.Message); |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 取消事件 |
| | | /// 反审核 |
| | | /// </summary> |
| | | /// <param name="sender"></param> |
| | | /// <param name="e"></param> |
| | | /// <exception cref="NotImplementedException"></exception> |
| | | private void ToolBarMenu1_btnFChkClick(object sender, EventArgs e) |
| | | { |
| | | toolBarMenu1.guidKey = ""; |
| | | string rowGuid, rowName; |
| | | (rowGuid, rowName) = UtilityHelper.GetCurrentRow(xtraTabControl1, |
| | | lbGuid, txt_itemNo, gridView1); |
| | | toolBarMenu1.guidKey = rowGuid; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 审核事件 |
| | | /// </summary> |
| | | /// <param name="sender"></param> |
| | | /// <param name="e"></param> |
| | | private void ToolBarMenu1_btnChkClick(object sender, EventArgs e) |
| | | { |
| | | toolBarMenu1.guidKey = ""; |
| | | string rowGuid, rowName; |
| | | (rowGuid, rowName) = UtilityHelper.GetCurrentRow(xtraTabControl1, |
| | | lbGuid, txt_itemNo, gridView1); |
| | | toolBarMenu1.guidKey = rowGuid; |
| | | } |
| | | /// <summary> |
| | | /// 取消事件 |
| | | /// </summary> |
| | | /// <param name="sender"></param> |
| | | /// <param name="e"></param> |
| | |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 删除事件 |
| | | /// 删除事件 |
| | | /// </summary> |
| | | /// <param name="sender"></param> |
| | | /// <param name="e"></param> |
| | | private void ToolBarMenu1_btnDelClick1(object sender, EventArgs e) |
| | | { |
| | | string rowGuid = "", rowName = ""; |
| | | // (rowGuid, rowName) = UtilityHelper.GetCurrentRow(xtraTabControl1, lbGuid, txt_billNo, gridView1); |
| | | (rowGuid, rowName) = UtilityHelper.GetCurrentRow(xtraTabControl1, lbGuid, txt_itemNo, gridView1); |
| | | if (string.IsNullOrEmpty(rowGuid)) |
| | | { |
| | | ToolBox.MsgHelper.Warning("请先选择你要操作的行!"); |
| | | MsgHelper.Warning("请先选择你要操作的行!"); |
| | | return; |
| | | } |
| | | |
| | | if (!MsgHelper.AskQuestion("你选择了【" + rowName + "】,确定删除吗?")) |
| | | if (!MsgHelper.AskQuestion("你选择了【" + rowName + "】的检验标准,确定删除吗?")) |
| | | return; |
| | | List<dynamic> lst = new List<dynamic>(); |
| | | var lst = new List<dynamic>(); |
| | | lst.Add(rowGuid); |
| | | var _obj = lst; |
| | | try |
| | | { |
| | | string strJson = UtilityHelper.HttpPost("", |
| | | var strJson = UtilityHelper.HttpPost("", |
| | | _webServiceName + "DeleteModel", |
| | | JsonConvert.SerializeObject(_obj)); |
| | | ReturnModel<dynamic> _rtn = |
| | | ToolBox.UtilityHelper.ReturnToDynamic(strJson); |
| | | var _rtn = |
| | | UtilityHelper.ReturnToDynamic(strJson); |
| | | if (_rtn.rtnCode > 0) |
| | | { |
| | | UtilityHelper.JumpToTab(xtraTabControl1, 0); |
| | | getPageList(1, UtilityHelper.GetPageSize()); |
| | | getPageList(1); |
| | | } |
| | | |
| | | ToolBox.MsgHelper.Warning("提示:" + _rtn.rtnMsg); |
| | | MsgHelper.Warning("提示:" + _rtn.rtnMsg); |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | ToolBox.MsgHelper.Warning("提示:" + ex.Message); |
| | | MsgHelper.Warning("提示:" + ex.Message); |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 刷新事件 |
| | | /// 刷新事件 |
| | | /// </summary> |
| | | /// <param name="sender"></param> |
| | | /// <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> |
| | | /// 修改事件 |
| | | /// 修改事件 |
| | | /// </summary> |
| | | /// <param name="sender"></param> |
| | | /// <param name="e"></param> |
| | | private void ToolBarMenu1_btnEdtClick(object sender, EventArgs e) |
| | | { |
| | | string rowGuid = "", rowName = ""; |
| | | // (rowGuid, rowName) = UtilityHelper.GetCurrentRow(xtraTabControl1, lbGuid, txt_billNo, gridView1); |
| | | (rowGuid, rowName) = UtilityHelper.GetCurrentRow(xtraTabControl1, lbGuid, txt_itemNo, gridView1); |
| | | if (string.IsNullOrEmpty(rowGuid)) |
| | | { |
| | | ToolBox.MsgHelper.Warning("请先选择你要操作的行!"); |
| | | MsgHelper.Warning("请先选择你要操作的行!"); |
| | | return; |
| | | } |
| | | |
| | | getModel(rowGuid, true, 1); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 新增事件 |
| | | /// 新增事件 |
| | | /// </summary> |
| | | /// <param name="sender"></param> |
| | | /// <param name="e"></param> |
| | |
| | | { |
| | | UtilityHelper.JumpToTab(xtraTabControl1, 1); |
| | | lbGuid.Text = ""; |
| | | List<GridView> gridViews = |
| | | var gridViews = |
| | | new List<GridView>(); |
| | | gridViews.Add(gvMx1); |
| | | UtilityHelper.CleanValueByControl(this.panel1.Controls, true, |
| | | UtilityHelper.CleanValueByControl(panel1.Controls, true, |
| | | gridViews); |
| | | Gs.DevApp.ToolBox.UtilityHelper.SetDefaultTable(gcMx1, gvMx1); |
| | | UtilityHelper.SetDefaultTable(gcMx1, gvMx1); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 保存事件 |
| | | /// 保存事件 |
| | | /// </summary> |
| | | /// <param name="sender"></param> |
| | | /// <param name="e"></param> |
| | | private void ToolBarMenu1_btnSaveClick(object sender, EventArgs e) |
| | | { |
| | | toolBarMenu1.isSetBtn = false; |
| | | //if (string.IsNullOrEmpty(txt_account.Text.Trim())) |
| | | string _ItemId = txt_ItemId.GetId() |
| | | ; if (string.IsNullOrEmpty(_ItemId)) |
| | | { |
| | | Gs.DevApp.ToolBox.MsgHelper.Warning("登录账号不能为空!"); |
| | | // txt_account.Focus(); |
| | | MsgHelper.Warning("请选择物料!"); |
| | | txt_ItemId.Focus(); |
| | | return; |
| | | } |
| | | var _obj = new |
| | | gvMx1.CloseEditor(); |
| | | gvMx1.UpdateCurrentRow(); |
| | | var lst = new List<MesQmCheckitemDt>(); |
| | | for (var i = 0; i < gvMx1.DataRowCount; i++) |
| | | { |
| | | guid = lbGuid.Text.Trim(), //主建 |
| | | var row = gvMx1.GetDataRow(i); |
| | | if (row != null) |
| | | lst.Add(new MesQmCheckitemDt |
| | | { |
| | | Guid = UtilityHelper.ToGuid(row["guid"].ToString()), |
| | | Forder = 1, |
| | | FcheckItem = row["FcheckItem"].ToString(), |
| | | SampleSizeNo = row["SampleSizeNo"].ToString(), |
| | | FcheckTool = row["FcheckTool"].ToString(), |
| | | FcheckLevel = row["FcheckLevel"].ToString(), |
| | | Fstand = row["Fstand"].ToString(), |
| | | FacLevel = row["FacLevel"].ToString(), |
| | | FspecRequ = row["FspecRequ"].ToString(), |
| | | Memo = row["memo"].ToString(), |
| | | FupAllow = row["FupAllow"].ToString(), |
| | | FdownAllow = row["FdownAllow"].ToString(), |
| | | }); |
| | | } |
| | | |
| | | var _obj = new MesQmCheckitem |
| | | { |
| | | Guid = UtilityHelper.ToGuid(lbGuid.Text.Trim()), |
| | | ItemId = long.Parse(_ItemId), |
| | | Memo = txt_memo.Text.Trim(), |
| | | ItemNo = txt_itemNo.Text.Trim(), |
| | | Isenabled = txt_isenabled.Checked, |
| | | Ftype = "1", |
| | | Fversion = Gs.DevApp.ToolBox.UtilityHelper.ToLong(txt_fversion.Text.Trim()), |
| | | list = lst |
| | | }; |
| | | try |
| | | { |
| | | string strJson = UtilityHelper.HttpPost("", |
| | | var strJson = UtilityHelper.HttpPost("", |
| | | _webServiceName + "EditModel", |
| | | JsonConvert.SerializeObject(_obj)); |
| | | ReturnModel<dynamic> _rtn = |
| | | ToolBox.UtilityHelper.ReturnToDynamic(strJson); |
| | | ToolBox.MsgHelper.Warning("提示:" + _rtn.rtnMsg); |
| | | var _rtn = |
| | | UtilityHelper.ReturnToDynamic(strJson); |
| | | MsgHelper.Warning("提示:" + _rtn.rtnMsg); |
| | | if (_rtn.rtnCode > 0) |
| | | { |
| | | lbGuid.Text = _rtn.rtnData; |
| | | toolBarMenu1.isSetBtn = true; |
| | | UtilityHelper.ChangeEnableByControl(this.panel1.Controls, |
| | | false); |
| | | var gridViews = new List<GridView>(); |
| | | gridViews.Add(gvMx1); |
| | | UtilityHelper.ChangeEnableByControl(panel1.Controls, false, |
| | | gridViews); |
| | | } |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | ToolBox.MsgHelper.Warning("提示:" + ex.Message); |
| | | MsgHelper.Warning("提示:" + ex.Message); |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// |
| | | /// </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 + "'"); |
| | | } |
| | | UcLoading _loading = new UcLoading(); |
| | | var _sbSqlWhere = UtilityHelper.GetSearchWhere(_filterList); |
| | | |
| | | PageQueryModel pgq = new PageQueryModel(curPage, pageSize, |
| | | "create_date", "asc", "", _sbSqlWhere.ToString()); |
| | | string json = JsonConvert.SerializeObject(pgq); |
| | | var pgq = new PageQueryModel(curPage, this.pageBar1.RowsCount, |
| | | "a.create_date", "asc", "", _sbSqlWhere.ToString()); |
| | | var json = JsonConvert.SerializeObject(pgq); |
| | | try |
| | | { |
| | | string strReturn = UtilityHelper.HttpPost("", |
| | | _webServiceName + "GetListPageIQC", json); |
| | | ReturnModel<PageListModel> dd = |
| | | var strReturn = await UtilityHelper.HttpPostAsync("", |
| | | _webServiceName + "GetListPage", json); |
| | | var 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(); |
| | | 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.RecordCount = dd.rtnData.total;//总记录数 |
| | | } |
| | | else |
| | | { |
| | | ToolBox.MsgHelper.ShowError("提示:" + dd.rtnMsg); |
| | | MsgHelper.ShowError("提示:" + dd.rtnMsg); |
| | | } |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | ToolBox.MsgHelper.Warning("提示:" + ex.Message); |
| | | MsgHelper.Warning("提示:" + ex.Message); |
| | | } |
| | | _loading.Close(); |
| | | } |
| | | |
| | | private void getModel(string strGuid, bool isEdit, int tabIdx) |
| | | { |
| | | if (string.IsNullOrEmpty(strGuid)) |
| | | { |
| | | ToolBox.MsgHelper.Warning("请先选择你要操作的行!"); |
| | | MsgHelper.Warning("请先选择你要操作的行!"); |
| | | return; |
| | | } |
| | | |
| | | UtilityHelper.JumpToTab(xtraTabControl1, tabIdx); |
| | | var _obj = new |
| | | { |
| | | guid = strGuid, //主建 |
| | | guid = strGuid //主建 |
| | | }; |
| | | try |
| | | { |
| | | string strJson = UtilityHelper.HttpPost("", |
| | | _webServiceName + "GetModelIQC", |
| | | var strJson = UtilityHelper.HttpPost("", |
| | | // _webServiceName + "GetModelIQC", |
| | | _webServiceName + "GetModel", |
| | | JsonConvert.SerializeObject(_obj)); |
| | | ReturnModel<dynamic> _rtn = |
| | | ToolBox.UtilityHelper.ReturnToDynamic(strJson); |
| | | var _rtn = |
| | | UtilityHelper.ReturnToDynamic(strJson); |
| | | if (_rtn.rtnCode > 0) |
| | | { |
| | | dynamic dy = _rtn.rtnData; |
| | | var dy = _rtn.rtnData; |
| | | lbGuid.Text = strGuid; |
| | | List<DevExpress.XtraGrid.Views.Grid.GridView> gvList = |
| | | new List<DevExpress.XtraGrid.Views.Grid.GridView>(); |
| | | var gvList = |
| | | new List<GridView>(); |
| | | gvList.Add(gvMx1); |
| | | UtilityHelper.SetValueByObj(this.panel1.Controls, dy, |
| | | UtilityHelper.SetValueByObj(panel1.Controls, dy, |
| | | isEdit, gvList); |
| | | JObject _job = JObject.Parse(strJson); |
| | | JArray array = new JArray(); |
| | | foreach (var a in _job["rtnData"]["list"]) |
| | | { |
| | | array.Add(a); |
| | | } |
| | | var _job = JObject.Parse(strJson); |
| | | var array = new JArray(); |
| | | foreach (var a in _job["rtnData"]["list"]) array.Add(a); |
| | | |
| | | DataTable dt = |
| | | var dt = |
| | | JsonConvert.DeserializeObject<DataTable>( |
| | | array.ToString()); |
| | | if (dt.Rows.Count > 0) |
| | |
| | | } |
| | | else |
| | | { |
| | | Gs.DevApp.ToolBox.UtilityHelper.SetDefaultTable(gcMx1, |
| | | UtilityHelper.SetDefaultTable(gcMx1, |
| | | gvMx1); |
| | | } |
| | | } |
| | | else |
| | | ToolBox.MsgHelper.Warning("提示:" + _rtn.rtnMsg); |
| | | { |
| | | MsgHelper.Warning("提示:" + _rtn.rtnMsg); |
| | | } |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | ToolBox.MsgHelper.Warning("提示:" + ex.Message); |
| | | MsgHelper.Warning("提示:" + ex.Message); |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | #region 以下为种种下拉 |
| | | |
| | | private void getCopyMx(string strGuid) |
| | | { |
| | | if (string.IsNullOrEmpty(strGuid)) |
| | | { |
| | | MsgHelper.Warning("请先选择你要复制的行!"); |
| | | return; |
| | | } |
| | | var _obj = new |
| | | { |
| | | guid = strGuid |
| | | }; |
| | | try |
| | | { |
| | | var strJson = UtilityHelper.HttpPost("", |
| | | _webServiceName + "GetModelIQC", |
| | | JsonConvert.SerializeObject(_obj)); |
| | | var _rtn = |
| | | UtilityHelper.ReturnToDynamic(strJson); |
| | | if (_rtn.rtnCode > 0) |
| | | { |
| | | var dy = _rtn.rtnData; |
| | | var _job = JObject.Parse(strJson); |
| | | var array = new JArray(); |
| | | foreach (var a in _job["rtnData"]["list"]) array.Add(a); |
| | | var dt = |
| | | JsonConvert.DeserializeObject<DataTable>( |
| | | array.ToString()); |
| | | if (dt.Rows.Count > 0) |
| | | { |
| | | gcMx1.BindingContext = new BindingContext(); |
| | | gcMx1.DataSource = dt; |
| | | gcMx1.ForceInitialize(); |
| | | } |
| | | else |
| | | { |
| | | MsgHelper.Warning("提示:没找到相应的明细,请选择其它试试!"); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | MsgHelper.Warning("提示:" + _rtn.rtnMsg); |
| | | } |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | MsgHelper.Warning("提示:" + ex.Message); |
| | | } |
| | | } |
| | | |
| | | private void _setIno() |
| | | { |
| | | txt_ItemId.EditChanged += (s, e) => |
| | | { |
| | | txt_itemModel.Text = this.txt_ItemId.GetModel(); |
| | | txt_itemNo.Text = this.txt_ItemId.GetCode(); |
| | | }; |
| | | btnSelect.Click += (s, e) => |
| | | { |
| | | var frm = new SelectCheckDt(); |
| | | frm.UpdateParent += (ss, ee) => |
| | | { |
| | | var lst = new List<string>(); |
| | | lst = ee.StringList; |
| | | getCopyMx(lst[0]); |
| | | |
| | | }; |
| | | frm.ShowDialog(); |
| | | }; |
| | | _getListJyxm(); |
| | | _getListJygj(); |
| | | _getListJybz(); |
| | | _getListJssp(); |
| | | _getListJysp(); |
| | | } |
| | | /// <summary> |
| | | /// 读取检验项目 |
| | | /// </summary> |
| | | private void _getListJyxm() |
| | | { |
| | | var json = JsonConvert.SerializeObject("QCITEM"); |
| | | try |
| | | { |
| | | var strReturn = UtilityHelper.HttpPost("", "MesSysLookupTypesManager/GetItemList", json); |
| | | var dd = UtilityHelper.ReturnToList(strReturn); |
| | | var dt = dd.rtnData; |
| | | foreach (DataRow dr in dt.Rows) |
| | | { |
| | | rptJYXM.Items.Add(dr["lookUpName"].ToString()); |
| | | } |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | MsgHelper.Warning("提示:" + ex.Message); |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 读取检验工具 |
| | | /// </summary> |
| | | private void _getListJygj() |
| | | { |
| | | var json = JsonConvert.SerializeObject("QATOOLS"); |
| | | try |
| | | { |
| | | var strReturn = UtilityHelper.HttpPost("", "MesSysLookupTypesManager/GetItemList", json); |
| | | var dd = UtilityHelper.ReturnToList(strReturn); |
| | | var dt = dd.rtnData; |
| | | foreach (DataRow dr in dt.Rows) |
| | | { |
| | | rptJYGJ.Items.Add(dr["lookUpName"].ToString()); |
| | | } |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | MsgHelper.Warning("提示:" + ex.Message); |
| | | } |
| | | } |
| | | /// <summary> |
| | | /// 读取检验标准 |
| | | /// </summary> |
| | | private void _getListJybz() |
| | | { |
| | | var pgq = new PageQueryModel(1, 999999, "CREATE_DATE", "asc", "", |
| | | " and 1=1"); |
| | | var json = JsonConvert.SerializeObject(pgq); |
| | | try |
| | | { |
| | | var strReturn = UtilityHelper.HttpPost("", |
| | | "MesQmAql1Manager/GetListPage", json); |
| | | var rtn = UtilityHelper.ReturnToTablePage(strReturn); |
| | | var dt = rtn.rtnData.list; |
| | | foreach (DataRow dr in dt.Rows) |
| | | { |
| | | rptJYBZ.Items.Add((new CboItemEntity(dr["SampleSizeNo"].ToString(), dr["SampleSizeName"].ToString()))); |
| | | //rptJYBZ.Items.Add((new CboItemEntity(dr["SampleSizeNo"].ToString(), dr["SampleSizeName"].ToString()))); |
| | | //string ddddd = dr["SampleSizeName"].ToString(); |
| | | } |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | MsgHelper.Warning("提示:" + ex.Message); |
| | | Close(); |
| | | Application.Exit(); |
| | | } |
| | | } |
| | | /// <summary> |
| | | /// 读取接受水平 |
| | | /// </summary> |
| | | private void _getListJssp() |
| | | { |
| | | rptJSSP.Items.AddRange(new string[] { |
| | | "0.010---(AQL_0_0010)" |
| | | , "0.015---(AQL_0_0015)" |
| | | , "0.025---(AQL_0_0025)" |
| | | ,"0.040---(AQL_0_0040)" |
| | | ,"0.065---(AQL_0_0065)" |
| | | ,"0.10---(AQL_0_010)" |
| | | ,"0.15---(AQL_0_015)" |
| | | ,"0.25---(AQL_0_025)" |
| | | ,"0.40---(AQL_0_040)" |
| | | ,"0.65---(AQL_0_065)" |
| | | ,"1.00---(AQL_0_100)" |
| | | ,"1.50---(AQL_0_150)" |
| | | ,"2.00---(AQL_0_200)" |
| | | ,"2.50---(AQL_0_250)" |
| | | }); |
| | | } |
| | | /// <summary> |
| | | /// 读取检验水平 |
| | | /// </summary> |
| | | private void _getListJysp() |
| | | { |
| | | rptJYSP.Items.AddRange(new string[] { |
| | | "1.一般检验水平(I)" |
| | | , "2.一般检验水平(II)" |
| | | ,"3.一般检验水平(III)" |
| | | ,"4.特殊检验水平(S1)" |
| | | ,"5.特殊检验水平(S2)" |
| | | ,"6.特殊检验水平(S3)" |
| | | ,"7.特殊检验水平(S4)" |
| | | }); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 关联检验标准名称 |
| | | /// </summary> |
| | | /// <param name="sender"></param> |
| | | /// <param name="e"></param> |
| | | private void rptJYBZ_SelectedIndexChanged(object sender, EventArgs e) |
| | | { |
| | | ComboBoxEdit comboBox = sender as ComboBoxEdit; |
| | | if (comboBox != null) |
| | | { |
| | | GridView myView = (gcMx1.MainView as GridView); |
| | | int dataIndex = myView.GetDataSourceRowIndex(myView.FocusedRowHandle); |
| | | CboItemEntity _itm = comboBox.EditValue as CboItemEntity; |
| | | string _val = _itm.Value.ToString(); |
| | | string _txt = _itm.Text.ToString(); |
| | | gvMx1.CloseEditor(); |
| | | gvMx1.UpdateCurrentRow(); |
| | | gvMx1.SetRowCellValue(dataIndex, "sampleSizeNo", _val); |
| | | gvMx1.SetRowCellValue(dataIndex, "sampleSizeName", _txt); |
| | | } |
| | | } |
| | | private void repositoryItemButtonEdit1_ButtonClick(object sender, DevExpress.XtraEditors.Controls.ButtonPressedEventArgs e) |
| | | { |
| | | gvMx1.CloseEditor(); |
| | | gvMx1.UpdateCurrentRow(); |
| | | var rowhandle = gvMx1.FocusedRowHandle; |
| | | if (rowhandle < 0) |
| | | return; |
| | | if (e.Button.Index == 0) |
| | | { |
| | | var dr = gvMx1.GetDataRow(rowhandle); |
| | | var mxGuid = dr["guid"].ToString(); |
| | | if (!MsgHelper.AskQuestion("你选择了1条数据,确定删除吗?")) |
| | | return; |
| | | if (string.IsNullOrEmpty(mxGuid)) |
| | | { |
| | | gvMx1.DeleteRow(rowhandle); |
| | | return; |
| | | } |
| | | var strJson = ""; |
| | | var lst = new List<string>(); |
| | | lst.Add(mxGuid); |
| | | try |
| | | { |
| | | strJson = UtilityHelper.HttpPost("", |
| | | _webServiceName + "DeleteModelMx", |
| | | JsonConvert.SerializeObject(lst)); |
| | | var _rtn = UtilityHelper.ReturnToDynamic(strJson); |
| | | if (_rtn.rtnCode > 0) getModel(lbGuid.Text, true, 1); |
| | | MsgHelper.Warning("提示:" + _rtn.rtnMsg); |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | MsgHelper.Warning("提示:" + ex.Message); |
| | | } |
| | | } |
| | | } |
| | | #endregion |
| | | |
| | | } |
| | | } |