| | |
| | | using Gs.DevApp.DevFrm.QC; |
| | | using Gs.DevApp.Entity; |
| | | using Gs.DevApp.ToolBox; |
| | | using Gs.DevApp.UserControl; |
| | | using MES.Service.Modes; |
| | | using Newtonsoft.Json; |
| | | using Newtonsoft.Json.Linq; |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using System.Data; |
| | | using System.Drawing; |
| | | using System.Threading.Tasks; |
| | | using System.Windows.Forms; |
| | | |
| | | namespace Gs.DevApp.DevFrm |
| | | { |
| | | public partial class Frm_MesQaItemsDetect01 : DevExpress.XtraEditors.XtraForm |
| | | { |
| | | string _strTag = "N:不合格"; |
| | | string _webServiceName = "MesQaItemsDetect01Manager/"; |
| | | List<FilterEntity> _filterList = new List<FilterEntity>(); |
| | | public Frm_MesQaItemsDetect01() |
| | | { |
| | | 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.btnLogClick += ToolBarMenu1_btnLogClick; |
| | | toolBarMenu1.btnJianYanClick += ToolBarMenu1_btnJianYanClick; |
| | | gcMain.MouseDoubleClick += GcMain_MouseDoubleClick; |
| | | gcMx1.MouseClick += GcMx1_MouseClick; |
| | | getPageList(1, UtilityHelper.GetPageSize()); |
| | | this.toolBarMenu1.getXmlConfig(); |
| | | Gs.DevApp.ToolBox.UtilityHelper.SetGridViewParameterMx(gvMx1); |
| | | Gs.DevApp.ToolBox.UtilityHelper.SetGridViewParameterMx(gvMx2); |
| | | Gs.DevApp.ToolBox.UtilityHelper.SetGridViewParameterMx(gvMx3); |
| | | Gs.DevApp.ToolBox.UtilityHelper.SetGridViewParameter(gridView1, picCheckBox, this, "fsubmitTxt", "", (value) => |
| | | { |
| | | Gs.DevApp.ToolBox.UtilityHelper.JumpTab(xtraTabControl1, 0); |
| | | }, tips); |
| | | Gs.DevApp.ToolBox.UtilityHelper.SetTabParameter(gridView1, xtraTabControl1, pageBar1, (value) => |
| | | { |
| | | getModel(value, "0"); |
| | | }, (value) => |
| | | { |
| | | getPageList(this.pageBar1.CurrentPage); |
| | | }, lbGuid); |
| | | getPageList(1); |
| | | 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(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); |
| | | }; |
| | | gvMx2.OptionsFind.ShowSearchNavButtons = false; |
| | | gvMx2.OptionsView.ShowGroupPanel = false; |
| | | gvMx3.OptionsFind.ShowSearchNavButtons = false; |
| | | gvMx3.OptionsView.ShowGroupPanel = false; |
| | | txt_itemId.KeyFile = "id"; |
| | | txt_suppId.KeyFile = "id"; |
| | | txt_itemId.EditChanged += (s, e) => |
| | | { |
| | | txt_itemModel.Text = this.txt_itemId.GetModel(); |
| | | txt_itemNo.Text = this.txt_itemId.GetCode(); |
| | | }; |
| | | txtJianYan.KeyDown += TxtJianYan_KeyDown; |
| | | this.btnLoad.Click += BtnLoad_Click; |
| | | ucUpFile1.UpChanged += UcUpFile1_UpChanged; |
| | | xtraTabControl2.SelectedPageChanged += XtraTabControl2_SelectedPageChanged; |
| | | gvMx1.FocusedRowChanged += GvMx1_FocusedRowChanged; |
| | | btnIpt.Click += BtnIpt_Click; |
| | | btnYcReport.Click += BtnYcReport_Click; |
| | | } |
| | | |
| | | private void GcMx1_MouseClick(object sender, MouseEventArgs e) |
| | | /// <summary> |
| | | /// 批量录入 |
| | | /// </summary> |
| | | /// <param name="sender"></param> |
| | | /// <param name="e"></param> |
| | | /// <exception cref="NotImplementedException"></exception> |
| | | private void BtnIpt_Click(object sender, EventArgs e) |
| | | { |
| | | string rowGuid = Gs.DevApp.ToolBox.UtilityHelper.GetCurrentDoubleRow(gvMx1, e, "guid"); |
| | | if (string.IsNullOrEmpty(rowGuid)) |
| | | return; |
| | | getList12(rowGuid); |
| | | bool bl = btnLoad.Enabled; |
| | | Frm_MesQaItemsDetect01Input frm = new Frm_MesQaItemsDetect01Input(this.lbGuid.Text.Trim(), bl); |
| | | frm.ShowDialog(); |
| | | } |
| | | |
| | | private void GridView1_ColumnFilterChanged(object sender, EventArgs e) |
| | | { |
| | | _filterList = Gs.DevApp.ToolBox.UtilityHelper.GetDilter(gridView1.Columns, gridView1); |
| | | Task.Delay(100); |
| | | getPageList(1); |
| | | } |
| | | private void GvMx1_FocusedRowChanged(object sender, DevExpress.XtraGrid.Views.Base.FocusedRowChangedEventArgs e) |
| | | { |
| | | if (e.FocusedRowHandle >= 0) |
| | | { |
| | | DataRow row = gvMx1.GetDataRow(e.FocusedRowHandle); |
| | | string rowGuid = row["guid"].ToString(); |
| | | if (string.IsNullOrEmpty(rowGuid)) |
| | | return; |
| | | getList12(rowGuid); |
| | | } |
| | | } |
| | | /// <summary> |
| | | /// 重新加载检验 |
| | | /// </summary> |
| | |
| | | /// <param name="e"></param> |
| | | private void BtnLoad_Click(object sender, EventArgs e) |
| | | { |
| | | if (!MsgHelper.AskQuestion("确定重新加载检验项目吗?")) |
| | | if (!MsgHelper.AskQuestion("确定重新加载检验项目吗,该操作将会清空之前的检验记录?")) |
| | | return; |
| | | string strGuid = lbGuid.Text.Trim(); |
| | | if (string.IsNullOrEmpty(strGuid)) |
| | |
| | | { |
| | | string strJson = UtilityHelper.HttpPost("", _webServiceName + "ReloadModel5", JsonConvert.SerializeObject(_obj)); |
| | | ReturnModel<dynamic> _rtn = ToolBox.UtilityHelper.ReturnToDynamic(strJson); |
| | | Gs.DevApp.ToolBox.MsgHelper.ShowInformation(_rtn.rtnMsg); |
| | | if (_rtn.rtnCode > 0) |
| | | { |
| | | dynamic dy = _rtn.rtnData; |
| | | lbGuid.Text = strGuid; |
| | | JObject _job = JObject.Parse(strJson); |
| | | JArray array = new JArray(); |
| | | foreach (var a in _job["rtnData"]["list5"]) |
| | | { |
| | | array.Add(a); |
| | | } |
| | | DataTable dt = JsonConvert.DeserializeObject<DataTable>(array.ToString()); |
| | | if (dt.Rows.Count > 0) |
| | | { |
| | | gcMx1.BindingContext = new BindingContext(); |
| | | gcMx1.DataSource = dt; |
| | | gcMx1.ForceInitialize(); |
| | | getList12(dt.Rows[0]["guid"].ToString()); |
| | | } |
| | | else |
| | | { |
| | | Gs.DevApp.ToolBox.UtilityHelper.SetDefaultTable(gcMx1, gvMx1); |
| | | } |
| | | getModel(lbGuid.Text.Trim(), "0"); |
| | | } |
| | | else |
| | | { |
| | | Gs.DevApp.ToolBox.MsgHelper.ShowInformation(_rtn.rtnMsg); |
| | | } |
| | | } |
| | | catch (Exception ex) |
| | |
| | | } |
| | | if (!_strCmd.Contains("-")) |
| | | { |
| | | Gs.DevApp.ToolBox.MsgHelper.ShowError("命令输入错误:缺少 中画线!"); |
| | | Gs.DevApp.ToolBox.MsgHelper.ShowError("命令输入错误:请正确使用OK 或 NG 命令!"); |
| | | return; |
| | | } |
| | | string[] _ary = _strCmd.Split('-'); |
| | | if (_ary.Length != 2) |
| | | { |
| | | Gs.DevApp.ToolBox.MsgHelper.ShowError("命令输入错误::请正确使用OK 或 NG 命令!"); |
| | | return; |
| | | } |
| | | string _str1 = _ary[0]; |
| | | if (!(_str1 == _strOK || _str1 == _strNG)) |
| | | { |
| | | Gs.DevApp.ToolBox.MsgHelper.ShowError("命令输入错误:请正确使用OK 或 NG 命令!"); |
| | | return; |
| | | } |
| | | string _str2 = _ary[1]; |
| | | int n; |
| | | if (int.TryParse(_str2, out n)) |
| | | var _obj = new |
| | | { |
| | | } |
| | | else |
| | | { |
| | | Gs.DevApp.ToolBox.MsgHelper.ShowError("命令输入错误:请正确使用OK 或 NG 命令!"); |
| | | return; |
| | | } |
| | | for (int i = 0; i < gvMx2.DataRowCount; i++) |
| | | { |
| | | gvMx2.SetRowCellValue(i, "fcheckResu", _str1); |
| | | gvMx2.SetRowCellValue(i, "fstand", _str1); |
| | | } |
| | | List<MesQaItemsDetectDetail12> lst = new List<MesQaItemsDetectDetail12>(); |
| | | for (var i = 0; i < gvMx2.DataRowCount; i++) |
| | | { |
| | | var row = gvMx2.GetDataRow(i); |
| | | if (row != null) |
| | | lst.Add(new MesQaItemsDetectDetail12() |
| | | { |
| | | ParentGuid = UtilityHelper.ToGuid(guid5), |
| | | Guid = UtilityHelper.ToGuid(row["guid"].ToString()), |
| | | FcheckResu = row["fcheckResu"].ToString(), |
| | | GrandpaGuid = UtilityHelper.ToGuid(lbGuid.Text.Trim()), |
| | | }); |
| | | } |
| | | var _obj = lst; |
| | | inOrderGuid1 = UtilityHelper.ToGuid(lbGuid.Text.Trim()), ////这是检验单guid |
| | | inOrderGuid5 = guid5,//这是抽样的guid |
| | | inP1 = _strCmd,//或者0k-19,或者ng-19 |
| | | }; |
| | | try |
| | | { |
| | | var strJson = UtilityHelper.HttpPost("", |
| | | _webServiceName + "EdtModel12", |
| | | JsonConvert.SerializeObject(_obj)); |
| | | var _rtn = UtilityHelper.ReturnToDynamic(strJson); |
| | | MsgHelper.Warning("提示:" + _rtn.rtnMsg); |
| | | if (_rtn.rtnCode > 0) |
| | | { |
| | | getModel(lbGuid.Text.Trim(), guid5); |
| | | } |
| | | else |
| | | { |
| | | Gs.DevApp.ToolBox.MsgHelper.ShowInformation(_rtn.rtnMsg); |
| | | } |
| | | txtJianYan.Text = ""; |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | |
| | | } |
| | | |
| | | /// <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, 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> |
| | | /// 查询事件 |
| | |
| | | /// <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, this.GetType().FullName); |
| | | frm.UpdateParent += Frm_UpdateParent; |
| | | frm.ShowDialog(); |
| | | } |
| | |
| | | private void Frm_UpdateParent(object sender, UpdateParentEventArgs e) |
| | | { |
| | | _filterList = e.FilterList; |
| | | getPageList(1, pageBar1.RowsCount); |
| | | getPageList(1); |
| | | } |
| | | /// <summary> |
| | | /// 日志事件 |
| | |
| | | toolBarMenu1.guidKey = rowGuid; |
| | | } |
| | | /// <summary> |
| | | ///检验事件 |
| | | ///提交检验事件 |
| | | /// </summary> |
| | | /// <param name="sender"></param> |
| | | /// <param name="e"></param> |
| | |
| | | toolBarMenu1.guidKey = ""; |
| | | string rowGuid, rowName; |
| | | (rowGuid, rowName) = UtilityHelper.GetCurrentRow(xtraTabControl1, |
| | | lbGuid, txt_releaseNo, gridView1); |
| | | lbGuid, txt_releaseNo, gridView1, "lotNo"); |
| | | toolBarMenu1.guidKey = rowGuid; |
| | | if (string.IsNullOrEmpty(rowGuid)) |
| | | { |
| | | MsgHelper.Warning("请先选择你要操作的行!"); |
| | | return; |
| | | } |
| | | if (!MsgHelper.AskQuestion("你选择了【" + rowName + "】,确定提交检验吗?")) |
| | | return; |
| | | if (txt_fcheckResu.Text.Trim() == _strTag) |
| | | { |
| | | if (string.IsNullOrEmpty(txt_fngDesc.Text.Trim())) |
| | | { |
| | | MsgHelper.Warning("单据为不合格时,请填写异常备注说明!"); |
| | | return; |
| | | } |
| | | }; |
| | | var _obj = new |
| | | { |
| | | guid = rowGuid, |
| | | }; |
| | | try |
| | | { |
| | | var strJson = UtilityHelper.HttpPost("", |
| | | _webServiceName + "EditModelSubmit", |
| | | JsonConvert.SerializeObject(_obj)); |
| | | var _rtn = UtilityHelper.ReturnToDynamic(strJson); |
| | | MsgHelper.Warning("提示:" + _rtn.rtnData.outMsg); |
| | | if (_rtn.rtnCode > 0 && _rtn.rtnData.outSum * 1 > 0) |
| | | { |
| | | if (xtraTabControl1.SelectedTabPageIndex == 1) |
| | | { |
| | | getModel(lbGuid.Text.Trim(), "0"); |
| | | } |
| | | int rowHandle = gridView1.LocateByValue(1, gridView1.Columns["guid"], rowGuid); |
| | | gridView1.FocusedRowHandle = rowHandle; |
| | | int _inFieldValue = 1; |
| | | UtilityHelper.SetCheckIco(gridView1, "fsubmitTxt", "", "iqcDate", picCheckBox, this, _inFieldValue.ToString()); |
| | | } |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | MsgHelper.Warning("提示:" + ex.Message); |
| | | } |
| | | |
| | | } |
| | | |
| | | /// <summary> |
| | |
| | | /// <param name="e"></param> |
| | | private void ToolBarMenu1_btnEscClick(object sender, EventArgs e) |
| | | { |
| | | UtilityHelper.JumpToTab(xtraTabControl1, 0); |
| | | Gs.DevApp.ToolBox.UtilityHelper.JumpTab(xtraTabControl1, 1); |
| | | } |
| | | |
| | | /// <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_releaseNo, gridView1); |
| | | if (string.IsNullOrEmpty(rowGuid)) |
| | | { |
| | | ToolBox.MsgHelper.Warning("请先选择你要操作的行!"); |
| | | return; |
| | | } |
| | | if (!MsgHelper.AskQuestion("你选择了【" + rowName + "】,确定删除吗?")) |
| | | return; |
| | | 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); |
| | | if (_rtn.rtnCode > 0) |
| | | { |
| | | UtilityHelper.JumpToTab(xtraTabControl1, 0); |
| | | getPageList(1, UtilityHelper.GetPageSize()); |
| | | } |
| | | ToolBox.MsgHelper.Warning("提示:" + _rtn.rtnMsg); |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | ToolBox.MsgHelper.Warning("提示:" + ex.Message); |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 刷新事件 |
| | |
| | | /// <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(), "0"); |
| | | else |
| | | { |
| | | //_filterList.Clear(); |
| | | //if (gridView1.ActiveFilter.Count > 0) |
| | | //{ |
| | | // gridView1.ColumnFilterChanged -= GridView1_ColumnFilterChanged; |
| | | // gridView1.ActiveFilter.Clear(); |
| | | // gridView1.ColumnFilterChanged += GridView1_ColumnFilterChanged; |
| | | //} |
| | | //getPageList(1); |
| | | getPageList(this.pageBar1.CurrentPage); |
| | | } |
| | | } |
| | | /// <summary> |
| | | /// 修改事件 |
| | |
| | | /// <param name="e"></param> |
| | | private void ToolBarMenu1_btnEdtClick(object sender, EventArgs e) |
| | | { |
| | | toolBarMenu1.currentAction = "edit"; |
| | | string rowGuid = "", rowName = ""; |
| | | (rowGuid, rowName) = UtilityHelper.GetCurrentRow(xtraTabControl1, lbGuid, txt_releaseNo, gridView1); |
| | | (rowGuid, rowName) = UtilityHelper.GetCurrentRow(xtraTabControl1, lbGuid, txt_releaseNo, gridView1, "releaseNo"); |
| | | if (string.IsNullOrEmpty(rowGuid)) |
| | | { |
| | | ToolBox.MsgHelper.Warning("请先选择你要操作的行!"); |
| | | return; |
| | | } |
| | | getModel(rowGuid, true, 1); |
| | | Gs.DevApp.ToolBox.UtilityHelper.JumpTab(xtraTabControl1, 3); |
| | | if (xtraTabControl1.SelectedTabPageIndex == 1) |
| | | { |
| | | getModel(rowGuid, "0"); |
| | | } |
| | | else |
| | | { |
| | | List<DevExpress.XtraGrid.Views.Grid.GridView> gvList = new List<DevExpress.XtraGrid.Views.Grid.GridView>(); |
| | | gvList.Add(gvMx1); |
| | | gvList.Add(gvMx2); |
| | | UtilityHelper.ChangeEnableByControl(this.layoutMx1.Controls, true, gvList); |
| | | this.setEable(true); |
| | | } |
| | | } |
| | | /// <summary> |
| | | /// 新增事件 |
| | | /// </summary> |
| | | /// <param name="sender"></param> |
| | | /// <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); |
| | | gridViews.Add(gvMx2); |
| | | UtilityHelper.CleanValueByControl(this.panel1.Controls, true, gridViews); |
| | | Gs.DevApp.ToolBox.UtilityHelper.SetDefaultTable(gcMx1, gvMx1); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 保存事件 |
| | | /// </summary> |
| | |
| | | private void ToolBarMenu1_btnSaveClick(object sender, EventArgs e) |
| | | { |
| | | toolBarMenu1.isSetBtn = false; |
| | | //if (string.IsNullOrEmpty(txt_account.Text.Trim())) |
| | | if (txt_fcheckResu.Text.Trim() == _strTag && string.IsNullOrEmpty(txt_fngDesc.TextTxt.Trim())) |
| | | { |
| | | Gs.DevApp.ToolBox.MsgHelper.Warning("登录账号不能为空!"); |
| | | // txt_account.Focus(); |
| | | Gs.DevApp.ToolBox.MsgHelper.Warning("当检验结果不合格时,请填写备注说明!"); |
| | | txt_fngDesc.Focus(); |
| | | return; |
| | | } |
| | | var _obj = new |
| | | { |
| | | guid = UtilityHelper.ToGuid(lbGuid.Text.Trim()), //主建 |
| | | fngDesc = txt_fngDesc.TextTxt.Trim(), |
| | | }; |
| | | try |
| | | { |
| | |
| | | { |
| | | lbGuid.Text = _rtn.rtnData; |
| | | toolBarMenu1.isSetBtn = true; |
| | | UtilityHelper.ChangeEnableByControl(this.panel1.Controls, false); |
| | | UtilityHelper.ChangeEnableByControl(this.layoutMx1.Controls, false); |
| | | this.setEable(false); |
| | | toolBarMenu1.currentAction = ""; |
| | | Gs.DevApp.ToolBox.UtilityHelper.JumpTab(xtraTabControl1, 6); |
| | | |
| | | } |
| | | } |
| | | catch (Exception ex) |
| | |
| | | /// </summary> |
| | | /// <param name="curPage">第几页</param> |
| | | /// <param name="pageSize">每页几条</param> |
| | | private async void getPageList(int curPage, int pageSize) |
| | | private void getPageList(int curPage) |
| | | { |
| | | UcLoading _loading = new UcLoading(); |
| | | 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()); |
| | | gcMain1.DataSource = null;var _sbSqlWhere = UtilityHelper.GetSearchWhere(_filterList); |
| | | // _sbSqlWhere += " and isnull(fsubmit,0)=0"; |
| | | PageQueryModel pgq = new PageQueryModel(curPage, this.pageBar1.RowsCount, "release_no", "asc", "", _sbSqlWhere.ToString()); |
| | | string json = JsonConvert.SerializeObject(pgq); |
| | | try |
| | | { |
| | | string strReturn = await UtilityHelper.HttpPostAsync("", _webServiceName + "GetListPage", json); |
| | | string strReturn = UtilityHelper.HttpPost("", _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;//记录总数 |
| | | 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.RowsCount = pageSize;//每页显示 |
| | | pageBar1.setTxt(); |
| | | pageBar1.RecordCount = dd.rtnData.total;//总记录数 |
| | | } |
| | | else |
| | | { |
| | |
| | | { |
| | | ToolBox.MsgHelper.Warning("提示:" + ex.Message); |
| | | } |
| | | _loading.Stop(); |
| | | |
| | | } |
| | | private void getModel(string strGuid, bool isEdit, int tabIdx) |
| | | private void getModel(string strGuid, string guid5) |
| | | { |
| | | bool isEdit = false; |
| | | if (toolBarMenu1.currentAction == "add") return; |
| | | if (toolBarMenu1.currentAction == "edit") isEdit = true; |
| | | if (string.IsNullOrEmpty(strGuid)) |
| | | { |
| | | ToolBox.MsgHelper.Warning("请先选择你要操作的行!"); |
| | | return; |
| | | } |
| | | UtilityHelper.JumpToTab(xtraTabControl1, tabIdx); |
| | | var _obj = new |
| | | { |
| | | guid = strGuid,//主建 |
| | |
| | | if (_rtn.rtnCode > 0) |
| | | { |
| | | dynamic dy = _rtn.rtnData; |
| | | btnYcReport.ToolTip = dy.toGuid.ToString(); |
| | | lbGuid.Text = strGuid; |
| | | 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.layoutMx1.Controls, dy, isEdit, gvList); |
| | | setEable(isEdit); |
| | | JObject _job = JObject.Parse(strJson); |
| | | JArray array = new JArray(); |
| | | foreach (var a in _job["rtnData"]["list5"]) |
| | |
| | | DataTable dt = JsonConvert.DeserializeObject<DataTable>(array.ToString()); |
| | | if (dt.Rows.Count > 0) |
| | | { |
| | | gcMx1.DataSource = null; |
| | | gcMx1.BindingContext = new BindingContext(); |
| | | gcMx1.DataSource = dt; |
| | | gcMx1.ForceInitialize(); |
| | | ucUpFile1.parentGuid = lbGuid.Text.Trim(); |
| | | getList12(dt.Rows[0]["guid"].ToString()); |
| | | gvMx1.BestFitColumns(); |
| | | ucUpFileList1.pGuid = lbGuid.Text.Trim(); |
| | | if (guid5.Length > 10) |
| | | { |
| | | int rowHandle = 0; |
| | | rowHandle = gvMx1.LocateByValue(1, gvMx1.Columns["guid"], guid5); |
| | | if (rowHandle < 0) |
| | | rowHandle = 0; |
| | | gvMx1.FocusedRowHandle = rowHandle + 1; |
| | | } |
| | | // MessageBox.Show(rowHandle.ToString() + "**" + guid5); |
| | | } |
| | | else |
| | | { |
| | |
| | | { |
| | | ToolBox.MsgHelper.Warning("提示:" + ex.Message); |
| | | } |
| | | |
| | | } |
| | | |
| | | |
| | | /// <summary> |
| | | /// 选项卡切换 |
| | | /// </summary> |
| | |
| | | /// <param name="e"></param> |
| | | private void XtraTabControl2_SelectedPageChanged(object sender, DevExpress.XtraTab.TabPageChangedEventArgs e) |
| | | { |
| | | if (e.Page.Name == "xtraTabPage3") |
| | | if (e.Page.Name == "tabMxPage2") |
| | | { |
| | | getFileList(); |
| | | ucUpFileList1.getFileList(); |
| | | } |
| | | } |
| | | /// <summary> |
| | | /// 上传后刷新文件列表 |
| | | /// </summary> |
| | | /// <param name="sender"></param> |
| | | /// <param name="e"></param> |
| | | private void UcUpFile1_UpChanged(object sender, EventArgs e) |
| | | { |
| | | getFileList(); |
| | | } |
| | | private void getFileList() |
| | | { |
| | | System.Text.StringBuilder _sbSqlWhere = new System.Text.StringBuilder(); |
| | | _sbSqlWhere.Append(" and parent_Guid='" + lbGuid.Text.Trim() + "'"); |
| | | PageQueryModel pgq = new PageQueryModel(1, 100, "create_date", "asc", "", _sbSqlWhere.ToString()); |
| | | string json = JsonConvert.SerializeObject(pgq); |
| | | try |
| | | { |
| | | string strReturn = UtilityHelper.HttpPost("", "MesFile/GetListPage", json); |
| | | ReturnModel<PageListModel> dd = UtilityHelper.ReturnToTablePage(strReturn); |
| | | if (dd.rtnCode > 0) |
| | | { |
| | | DataTable dt = dd.rtnData.list; |
| | | gcMx3.BindingContext = new BindingContext(); |
| | | gcMx3.DataSource = dt; |
| | | gcMx3.ForceInitialize(); |
| | | } |
| | | else |
| | | { |
| | | ToolBox.MsgHelper.ShowError("提示:" + dd.rtnMsg); |
| | | } |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | ToolBox.MsgHelper.Warning("提示:" + ex.Message); |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 根据检验项目读取抽样结果 |
| | | /// </summary> |
| | |
| | | }; |
| | | try |
| | | { |
| | | var strReturn = UtilityHelper.HttpPost("", _webServiceName + "GetModel12", JsonConvert.SerializeObject(_obj)); |
| | | var dd = UtilityHelper.ReturnToList(strReturn); |
| | | var dt = dd.rtnData; |
| | | var strJson = UtilityHelper.HttpPost("", _webServiceName + "GetModel12", JsonConvert.SerializeObject(_obj)); |
| | | 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()); |
| | | gcMx2.BindingContext = new BindingContext(); |
| | | gcMx2.DataSource = dt; |
| | | gcMx2.ForceInitialize(); |
| | | gvMx2.BestFitColumns(); |
| | | JArray array1 = new JArray(); |
| | | foreach (var a in _job["rtnData"]["list2"]) |
| | | { |
| | | array1.Add(a); |
| | | } |
| | | DataTable dt1 = JsonConvert.DeserializeObject<DataTable>(array1.ToString()); |
| | | gcMx3.BindingContext = new BindingContext(); |
| | | gcMx3.DataSource = dt1; |
| | | gcMx3.ForceInitialize(); |
| | | gvMx3.BestFitColumns(); |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | |
| | | } |
| | | } |
| | | |
| | | private void repositoryItemButtonEdit1_ButtonClick(object sender, DevExpress.XtraEditors.Controls.ButtonPressedEventArgs e) |
| | | private void setEable(bool bl) |
| | | { |
| | | var rowhandle = gvMx3.FocusedRowHandle; |
| | | if (rowhandle < 0) |
| | | return; |
| | | if (e.Button.Index == 0) |
| | | { |
| | | var dr = gvMx3.GetDataRow(rowhandle); |
| | | var mxGuid = dr["guid"].ToString(); |
| | | if (!MsgHelper.AskQuestion("你选择了1条数据,确定删除吗?")) |
| | | return; |
| | | var strJson = ""; |
| | | var lst = new List<string>(); |
| | | lst.Add(mxGuid); |
| | | try |
| | | { |
| | | strJson = UtilityHelper.HttpPost("", "MesFile/DeleteModel", |
| | | JsonConvert.SerializeObject(lst)); |
| | | var _rtn = UtilityHelper.ReturnToDynamic(strJson); |
| | | if (_rtn.rtnCode > 0) gvMx3.DeleteRow(rowhandle); |
| | | MsgHelper.Warning("提示:" + _rtn.rtnMsg); |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | MsgHelper.Warning("提示:" + ex.Message); |
| | | } |
| | | } |
| | | txtJianYan.ReadOnly = !bl; |
| | | btnLoad.Enabled = bl; |
| | | btnIpt.Text = (bl == true ? "录入样本" : "查看样本"); |
| | | } |
| | | |
| | | private void repositoryItemButtonEdit2_ButtonClick(object sender, DevExpress.XtraEditors.Controls.ButtonPressedEventArgs e) |
| | | #region 打开父亲窗口委托 |
| | | public event EventHandler<UpdateParentEventArgs> ToUpdateParent; |
| | | private void BtnYcReport_Click(object sender, EventArgs e) |
| | | { |
| | | var rowhandle = gvMx3.FocusedRowHandle; |
| | | if (rowhandle < 0) |
| | | return; |
| | | if (e.Button.Index == 0) |
| | | string _toGuid = (btnYcReport.ToolTip == null ? "" : btnYcReport.ToolTip.ToString()); |
| | | if (string.IsNullOrEmpty(_toGuid)) |
| | | { |
| | | MsgHelper.Warning("提示:" + "开发中"); |
| | | Gs.DevApp.ToolBox.MsgHelper.ShowInformation("该单无异常报告,查看失败!"); |
| | | return; |
| | | } |
| | | if (ToUpdateParent != null) |
| | | { |
| | | List<string> lst = new List<string>(); |
| | | lst.Add("Gs.DevApp.DevFrm.QC.MesQcExceptional");//类名 |
| | | lst.Add(_toGuid);//异常报告主键 |
| | | lst.Add("tab1");//其它 |
| | | ToUpdateParent?.Invoke(this, |
| | | new UpdateParentEventArgs { StringList = lst }); |
| | | } |
| | | } |
| | | #endregion |
| | | |
| | | } |
| | | } |