| | |
| | | getPageList(1); |
| | | pageBar1.PagerEvent += PageBar1_PagerEvent; |
| | | _setIno(); |
| | | btnSelect.Click += (s, e) => |
| | | { |
| | | var frm = new SelectCheckDt("jyxm"); |
| | | frm.UpdateParent += (ss, ee) => |
| | | { |
| | | var lst = ee.DynamicList; |
| | | var json = JsonConvert.SerializeObject(lst); |
| | | DataTable _newTable = (DataTable)JsonConvert.DeserializeObject(json, (typeof(DataTable))); |
| | | DataTable _oldTable = (DataTable)gridControl2.DataSource; |
| | | DataRow[] sourceRows = _newTable.Select(); |
| | | for (int i = 0; i < sourceRows.Length; i++) |
| | | { |
| | | _oldTable.ImportRow(sourceRows[i]); |
| | | } |
| | | gridControl2.BindingContext = new BindingContext(); |
| | | gridControl2.DataSource = _oldTable; |
| | | gridControl2.ForceInitialize(); |
| | | }; |
| | | frm.ShowDialog(); |
| | | }; |
| | | btnSave.Click += BtnSave_Click; |
| | | } |
| | | private void GridView1_ColumnFilterChanged(object sender, EventArgs e) |
| | | { |
| | | _filterList = Gs.DevApp.ToolBox.UtilityHelper.GetDilter(gridView1.Columns); |
| | | Gs.DevApp.ToolBox.UtilityHelper.GetDilter(gridView1.Columns, gridView1); |
| | | Task.Delay(100); |
| | | getPageList(1); |
| | | } |
| | |
| | | getModel(lbGuid.Text.Trim()); |
| | | else |
| | | { |
| | | _filterList.Clear(); |
| | | if (gridView1.ActiveFilter.Count > 0) |
| | | { |
| | | gridView1.ColumnFilterChanged -= GridView1_ColumnFilterChanged; |
| | | gridView1.ActiveFilter.Clear(); |
| | | gridView1.ColumnFilterChanged += GridView1_ColumnFilterChanged; |
| | | } |
| | | getPageList(1); |
| | | //_filterList.Clear(); |
| | | //if (gridView1.ActiveFilter.Count > 0) |
| | | //{ |
| | | // gridView1.ColumnFilterChanged -= GridView1_ColumnFilterChanged; |
| | | // gridView1.ActiveFilter.Clear(); |
| | | // gridView1.ColumnFilterChanged += GridView1_ColumnFilterChanged; |
| | | //} |
| | | //getPageList(1); |
| | | getPageList(this.pageBar1.CurrentPage); |
| | | } |
| | | } |
| | | |
| | |
| | | return; |
| | | } |
| | | Gs.DevApp.ToolBox.UtilityHelper.JumpTab(xtraTabControl1, 3); |
| | | UtilityHelper.ChangeEnableByControl(panel1.Controls, true); |
| | | |
| | | if (xtraTabControl1.SelectedTabPageIndex == 1) |
| | | { |
| | | getModel(rowGuid); |
| | | } |
| | | else |
| | | { |
| | | List<DevExpress.XtraGrid.Views.Grid.GridView> gvList = new List<DevExpress.XtraGrid.Views.Grid.GridView>(); |
| | | gvList.Add(gvMx1); |
| | | gvList.Add(gridView2); |
| | | UtilityHelper.ChangeEnableByControl(panel1.Controls, true, gvList); |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | |
| | | Gs.DevApp.ToolBox.UtilityHelper.JumpTab(xtraTabControl1, 4); |
| | | var gridViews = new List<GridView>(); |
| | | gridViews.Add(gvMx1); |
| | | gridViews.Add(gridView2); |
| | | UtilityHelper.CleanValueByControl(panel1.Controls, true, gridViews); |
| | | UtilityHelper.SetDefaultTable(gcMx1, gvMx1); |
| | | xtraTabPageCopy.PageEnabled = false; |
| | |
| | | private void ToolBarMenu1_btnSaveClick(object sender, EventArgs e) |
| | | { |
| | | toolBarMenu1.isSetBtn = false; |
| | | string _ItemId = txt_ItemId.GetId(); |
| | | string _ItemId = txt_itemId.GetId(); |
| | | if (string.IsNullOrEmpty(_ItemId)) |
| | | { |
| | | MsgHelper.Warning("请选择物料!"); |
| | | txt_ItemId.Focus(); |
| | | txt_itemId.Focus(); |
| | | return; |
| | | } |
| | | gvMx1.CloseEditor(); |
| | | gvMx1.UpdateCurrentRow(); |
| | | var lst = new List<MesQmCheckitemDt>(); |
| | | for (var i = 0; i < gvMx1.DataRowCount; i++) |
| | | if (gvMx1.DataRowCount <= 0) |
| | | { |
| | | 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(), |
| | | }); |
| | | MsgHelper.Warning("项目明细不能为空!"); |
| | | return; |
| | | } |
| | | var _obj = new MesQmCheckitem |
| | | { |
| | | Guid = UtilityHelper.ToGuid(lbGuid.Text.Trim()), |
| | | ItemId = long.Parse(_ItemId), |
| | | Memo = txt_memo.Text.Trim(), |
| | | ItemNo = txt_itemNo.Text.Trim(), |
| | | Ftype = "1", |
| | | Fversion = Gs.DevApp.ToolBox.UtilityHelper.ToLong(txt_fversion.Text.Trim()), |
| | | list = lst |
| | | }; |
| | | try |
| | | { |
| | | var strJson = UtilityHelper.HttpPost("", |
| | | _webServiceName + "EditModel", |
| | | JsonConvert.SerializeObject(_obj)); |
| | | var _rtn = |
| | | UtilityHelper.ReturnToDynamic(strJson); |
| | | MsgHelper.Warning("提示:" + _rtn.rtnMsg); |
| | | if (_rtn.rtnCode > 0) |
| | | var lst = new List<MesQmCheckitemDt>(); |
| | | for (var i = 0; i < gvMx1.DataRowCount; i++) |
| | | { |
| | | lbGuid.Text = _rtn.rtnData; |
| | | toolBarMenu1.isSetBtn = true; |
| | | var gridViews = new List<GridView>(); |
| | | gridViews.Add(gvMx1); |
| | | UtilityHelper.ChangeEnableByControl(panel1.Controls, false, |
| | | gridViews); |
| | | var row = gvMx1.GetDataRow(i); |
| | | if (row != null) |
| | | { |
| | | if (string.IsNullOrEmpty(row["forder"].ToString())) |
| | | { |
| | | MsgHelper.ShowError("顺序不能为空!"); |
| | | return; |
| | | } |
| | | if (string.IsNullOrEmpty(row["FcheckItem"].ToString())) |
| | | { |
| | | MsgHelper.ShowError("检验项目不能为空!"); |
| | | return; |
| | | } |
| | | if (string.IsNullOrEmpty(row["FcheckTool"].ToString())) |
| | | { |
| | | MsgHelper.ShowError("检验工具不能为空!"); |
| | | return; |
| | | } |
| | | if (string.IsNullOrEmpty(row["SampleSizeNo"].ToString())) |
| | | { |
| | | MsgHelper.ShowError("检验标准不能为空!"); |
| | | return; |
| | | } |
| | | if (string.IsNullOrEmpty(row["FcheckLevel"].ToString())) |
| | | { |
| | | MsgHelper.ShowError("检验水平不能为空!"); |
| | | return; |
| | | } |
| | | if (string.IsNullOrEmpty(row["FacLevel"].ToString())) |
| | | { |
| | | MsgHelper.ShowError("接受水平不能为空!"); |
| | | return; |
| | | } |
| | | string _Fstand = row["Fstand"].ToString(); |
| | | string _FupAllow = row["FupAllow"].ToString(); |
| | | string _FdownAllow = row["FdownAllow"].ToString(); |
| | | //假如三个都为空通过 |
| | | if (string.IsNullOrEmpty(_Fstand) && string.IsNullOrEmpty(_FupAllow) && string.IsNullOrEmpty(_FdownAllow)) |
| | | { |
| | | |
| | | } |
| | | else |
| | | { |
| | | if (!string.IsNullOrEmpty(_Fstand) && !string.IsNullOrEmpty(_FupAllow) && !string.IsNullOrEmpty(_FdownAllow)) |
| | | { |
| | | decimal _Fstand_f = Gs.DevApp.ToolBox.UtilityHelper.ToDecimal(_Fstand); |
| | | decimal _FupAllow_f = Gs.DevApp.ToolBox.UtilityHelper.ToDecimal(_FupAllow); |
| | | decimal _FdownAllow_f = Gs.DevApp.ToolBox.UtilityHelper.ToDecimal(_FdownAllow); |
| | | if (_Fstand_f >= _FdownAllow_f && _Fstand_f <= _FupAllow_f) { } |
| | | else { |
| | | MsgHelper.ShowError("标准值必须在上限和下限之间!"); |
| | | return; |
| | | } |
| | | } |
| | | else |
| | | { |
| | | MsgHelper.ShowError("请填写正确的上限,标准值,下限!"); |
| | | return; |
| | | } |
| | | } |
| | | lst.Add(new MesQmCheckitemDt |
| | | { |
| | | Guid = UtilityHelper.ToGuid(row["guid"].ToString()), |
| | | Forder = int.Parse(row["forder"].ToString()), |
| | | 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(), |
| | | Ftype = "1", |
| | | Fversion = Gs.DevApp.ToolBox.UtilityHelper.ToLong(txt_fversion.Text.Trim()), |
| | | list = lst |
| | | }; |
| | | try |
| | | { |
| | | var strJson = UtilityHelper.HttpPost("", |
| | | _webServiceName + "EditModel", |
| | | JsonConvert.SerializeObject(_obj)); |
| | | var _rtn = |
| | | UtilityHelper.ReturnToDynamic(strJson); |
| | | MsgHelper.Warning("提示:" + _rtn.rtnMsg); |
| | | if (_rtn.rtnCode > 0) |
| | | { |
| | | lbGuid.Text = _rtn.rtnData; |
| | | toolBarMenu1.isSetBtn = true; |
| | | var gridViews = new List<GridView>(); |
| | | gridViews.Add(gvMx1); |
| | | gridViews.Add(gridView2); |
| | | UtilityHelper.ChangeEnableByControl(panel1.Controls, false, gridViews); |
| | | } |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | MsgHelper.Warning("提示:" + ex.Message); |
| | | } |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | MsgHelper.Warning("提示:" + ex.Message); |
| | | MsgHelper.ShowError("提示:" + ex.Message); |
| | | } |
| | | |
| | | } |
| | | |
| | | /// <summary> |
| | |
| | | private void getPageList(int curPage) |
| | | { |
| | | var _sbSqlWhere = UtilityHelper.GetSearchWhere(_filterList); |
| | | _sbSqlWhere += " and b.guid is not null"; |
| | | var pgq = new PageQueryModel(curPage, this.pageBar1.RowsCount, |
| | | "a.create_date", "asc", "", _sbSqlWhere.ToString()); |
| | | "org.FNumber asc ,b.item_no asc,a.FVERSION desc", "", "", _sbSqlWhere.ToString()); |
| | | var json = JsonConvert.SerializeObject(pgq); |
| | | try |
| | | { |
| | |
| | | { |
| | | gcMain.DataSource = dt; |
| | | gcMain.ForceInitialize(); |
| | | gridView1.BestFitColumns(); |
| | | } |
| | | else |
| | | UtilityHelper.SetDefaultTable(gcMain, gridView1); |
| | |
| | | { |
| | | MsgHelper.Warning("提示:" + ex.Message); |
| | | } |
| | | |
| | | } |
| | | |
| | | private void getModel(string strGuid) |
| | |
| | | try |
| | | { |
| | | var strJson = UtilityHelper.HttpPost("", |
| | | // _webServiceName + "GetModelIQC", |
| | | _webServiceName + "GetModel", |
| | | JsonConvert.SerializeObject(_obj)); |
| | | var _rtn = |
| | |
| | | gcMx1.BindingContext = new BindingContext(); |
| | | gcMx1.DataSource = dt; |
| | | gcMx1.ForceInitialize(); |
| | | gvMx1.BestFitColumns(); |
| | | } |
| | | else |
| | | { |
| | | UtilityHelper.SetDefaultTable(gcMx1,gvMx1); |
| | | UtilityHelper.SetDefaultTable(gcMx1, gvMx1); |
| | | } |
| | | UtilityHelper.SetDefaultTable(gridControl2, gridView2); |
| | | } |
| | |
| | | } |
| | | if (!MsgHelper.AskQuestion("你选择了【" + rowName + "】,确定" + strMsg + "吗?")) |
| | | return; |
| | | |
| | | var _obj = new |
| | | { |
| | | guid = rowGuid, |
| | |
| | | if (_rtn.rtnCode > 0 && _rtn.rtnData.outSum * 1 > 0) |
| | | { |
| | | if (xtraTabControl1.SelectedTabPageIndex == 1) |
| | | { |
| | | getModel(lbGuid.Text.Trim()); |
| | | else |
| | | getPageList(this.pageBar1.CurrentPage); |
| | | } |
| | | int rowHandle = gridView1.LocateByValue(1, gridView1.Columns["guid"], rowGuid); |
| | | gridView1.FocusedRowHandle = rowHandle; |
| | | UtilityHelper.SetCheckIco(gridView1, "foneChecked", "foneCheckor", "foneCheckdate", picCheckBox, this, _inFieldValue.ToString()); |
| | | } |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | MsgHelper.Warning("提示:" + ex.Message); |
| | | } |
| | | |
| | | } |
| | | |
| | | |
| | | #region 以下为种种下拉 |
| | | private void _setIno() |
| | | { |
| | | txt_ItemId.EditChanged += (s, e) => |
| | | this.txt_fSubsidiary.EditChanged += (s, e) => |
| | | { |
| | | txt_itemModel.Text = this.txt_ItemId.GetModel(); |
| | | txt_itemNo.Text = this.txt_ItemId.GetCode(); |
| | | string _orgId = txt_fSubsidiary.GetId(); |
| | | if (string.IsNullOrEmpty(_orgId)) |
| | | return; |
| | | txt_itemId.getSuppler(_orgId); |
| | | //txt_gg.Text =""; |
| | | //txt_itemNo.Text = ""; |
| | | }; |
| | | btnSelect.Click += (s, e) => |
| | | txt_itemId.EditChanged += (s, e) => |
| | | { |
| | | var frm = new SelectCheckDt(); |
| | | frm.UpdateParent += (ss, ee) => |
| | | { |
| | | var lst = ee.DynamicList; |
| | | var json = JsonConvert.SerializeObject(lst); |
| | | DataTable _newTable = (DataTable)JsonConvert.DeserializeObject(json, (typeof(DataTable))); |
| | | DataTable _oldTable = (DataTable)gridControl2.DataSource; |
| | | DataRow[] sourceRows = _newTable.Select(); |
| | | for (int i = 0; i < sourceRows.Length; i++) |
| | | { |
| | | _oldTable.ImportRow(sourceRows[i]); |
| | | } |
| | | gridControl2.BindingContext = new BindingContext(); |
| | | gridControl2.DataSource = _oldTable; |
| | | gridControl2.ForceInitialize(); |
| | | }; |
| | | frm.ShowDialog(); |
| | | if (!string.IsNullOrEmpty(this.txt_itemId.GetModel())) |
| | | txt_gg.Text = this.txt_itemId.GetModel(); |
| | | if (!string.IsNullOrEmpty(this.txt_itemId.GetCode())) |
| | | txt_itemNo.Text = this.txt_itemId.GetCode(); |
| | | }; |
| | | _getListJyxm(); |
| | | _getListJygj(); |
| | |
| | | MsgHelper.Warning("提示:" + ex.Message); |
| | | } |
| | | } |
| | | |
| | | } |
| | | } |