| | |
| | | using DevExpress.XtraGrid.Views.Base.ViewInfo; |
| | | using Gs.DevApp.DevFrm.QC; |
| | | using Gs.DevApp.Entity; |
| | | using Gs.DevApp.ToolBox; |
| | |
| | | { |
| | | public partial class Frm_MesQaItemsDetect01 : DevExpress.XtraEditors.XtraForm |
| | | { |
| | | int _currentHandle5 = 0; |
| | | string _webServiceName = "MesQaItemsDetect01Manager/"; |
| | | List<FilterEntity> _filterList = new List<FilterEntity>(); |
| | | public Frm_MesQaItemsDetect01() |
| | |
| | | }); |
| | | Gs.DevApp.ToolBox.UtilityHelper.SetTabParameter(gridView1, xtraTabControl1, pageBar1, (value) => |
| | | { |
| | | getModel(value); |
| | | getModel(value, "0"); |
| | | }, (value) => |
| | | { |
| | | getPageList(this.pageBar1.CurrentPage); |
| | |
| | | getPageList(1); |
| | | pageBar1.PagerEvent += PageBar1_PagerEvent; |
| | | txtJianYan.KeyDown += TxtJianYan_KeyDown; |
| | | this.btnLoad.Click += BtnLoad_Click; |
| | | ucUpFile1.UpChanged += UcUpFile1_UpChanged; |
| | | xtraTabControl2.SelectedPageChanged += XtraTabControl2_SelectedPageChanged; |
| | | gvMx1.FocusedRowChanged += GvMx1_FocusedRowChanged; |
| | | //重新加载 |
| | | this.btnLoad.Click += (s, e) => |
| | | { |
| | | if (!MsgHelper.AskQuestion("确定重新加载检验项目吗?\n\r该操作将会清空之前的检验记录!")) |
| | | return; |
| | | string strGuid = lbGuid.Text.Trim(); |
| | | if (string.IsNullOrEmpty(strGuid)) |
| | | { |
| | | ToolBox.MsgHelper.Warning("请先选择你要操作的行!"); |
| | | return; |
| | | } |
| | | var _obj = new |
| | | { |
| | | guid = strGuid, |
| | | }; |
| | | try |
| | | { |
| | | string strJson = UtilityHelper.HttpPost("", _webServiceName + "ReloadModel5", JsonConvert.SerializeObject(_obj)); |
| | | ReturnModel<dynamic> _rtn = ToolBox.UtilityHelper.ReturnToDynamic(strJson); |
| | | if (_rtn.rtnCode > 0) |
| | | { |
| | | getModel(lbGuid.Text.Trim()); |
| | | } |
| | | else |
| | | { |
| | | Gs.DevApp.ToolBox.MsgHelper.ShowInformation(_rtn.rtnMsg); |
| | | } |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | ToolBox.MsgHelper.Warning("提示:" + ex.Message); |
| | | } |
| | | }; |
| | | //批量录入 |
| | | btnIpt.Click += (s, e) => |
| | | { |
| | | Frm_MesQaItemsDetect01Input frm = new Frm_MesQaItemsDetect01Input(this.lbGuid.Text.Trim()); |
| | | frm.ShowDialog(); |
| | | }; |
| | | btnIpt.Click += BtnIpt_Click; |
| | | } |
| | | /// <summary> |
| | | /// 批量录入 |
| | | /// </summary> |
| | | /// <param name="sender"></param> |
| | | /// <param name="e"></param> |
| | | /// <exception cref="NotImplementedException"></exception> |
| | | private void BtnIpt_Click(object sender, EventArgs e) |
| | | { |
| | | 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) |
| | |
| | | getList12(rowGuid); |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 重新加载检验 |
| | | /// </summary> |
| | | /// <param name="sender"></param> |
| | | /// <param name="e"></param> |
| | | private void BtnLoad_Click(object sender, EventArgs e) |
| | | { |
| | | if (!MsgHelper.AskQuestion("确定重新加载检验项目吗,该操作将会清空之前的检验记录?")) |
| | | return; |
| | | string strGuid = lbGuid.Text.Trim(); |
| | | if (string.IsNullOrEmpty(strGuid)) |
| | | { |
| | | ToolBox.MsgHelper.Warning("请先选择你要操作的行!"); |
| | | return; |
| | | } |
| | | var _obj = new |
| | | { |
| | | guid = strGuid, |
| | | }; |
| | | try |
| | | { |
| | | string strJson = UtilityHelper.HttpPost("", _webServiceName + "ReloadModel5", JsonConvert.SerializeObject(_obj)); |
| | | ReturnModel<dynamic> _rtn = ToolBox.UtilityHelper.ReturnToDynamic(strJson); |
| | | if (_rtn.rtnCode > 0) |
| | | { |
| | | getModel(lbGuid.Text.Trim(), "0"); |
| | | } |
| | | else |
| | | { |
| | | Gs.DevApp.ToolBox.MsgHelper.ShowInformation(_rtn.rtnMsg); |
| | | } |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | ToolBox.MsgHelper.Warning("提示:" + ex.Message); |
| | | } |
| | | } |
| | | /// <summary> |
| | | /// 输入检验事件 |
| | | /// </summary> |
| | |
| | | private void TxtJianYan_KeyDown(object sender, KeyEventArgs e) |
| | | { |
| | | int intHandle = this.gvMx1.FocusedRowHandle; |
| | | this._currentHandle5 = intHandle; |
| | | if (intHandle < 0) |
| | | { |
| | | ToolBox.MsgHelper.Warning("提示:请选择检验项目!"); |
| | |
| | | var _rtn = UtilityHelper.ReturnToDynamic(strJson); |
| | | if (_rtn.rtnCode > 0) |
| | | { |
| | | getModel(lbGuid.Text.Trim()); |
| | | getModel(lbGuid.Text.Trim(), guid5); |
| | | } |
| | | else |
| | | { |
| | |
| | | { |
| | | if (xtraTabControl1.SelectedTabPageIndex == 1) |
| | | { |
| | | getModel(lbGuid.Text.Trim()); |
| | | getModel(lbGuid.Text.Trim(), "0"); |
| | | } |
| | | int rowHandle = gridView1.LocateByValue(1, gridView1.Columns["guid"], rowGuid); |
| | | gridView1.FocusedRowHandle = rowHandle; |
| | |
| | | private void ToolBarMenu1_btnLoadClick(object sender, EventArgs e) |
| | | { |
| | | if (xtraTabControl1.SelectedTabPageIndex == 1) |
| | | getModel(lbGuid.Text.Trim()); |
| | | getModel(lbGuid.Text.Trim(), "0"); |
| | | else |
| | | { |
| | | //_filterList.Clear(); |
| | |
| | | Gs.DevApp.ToolBox.UtilityHelper.JumpTab(xtraTabControl1, 3); |
| | | if (xtraTabControl1.SelectedTabPageIndex == 1) |
| | | { |
| | | getModel(rowGuid); |
| | | getModel(rowGuid, "0"); |
| | | } |
| | | else |
| | | { |
| | |
| | | gvList.Add(gvMx1); |
| | | gvList.Add(gvMx2); |
| | | UtilityHelper.ChangeEnableByControl(this.layoutMx1.Controls, true, gvList); |
| | | this.setEable(true); |
| | | } |
| | | } |
| | | |
| | |
| | | { |
| | | string strJson = UtilityHelper.HttpPost("", _webServiceName + "EditModel", JsonConvert.SerializeObject(_obj)); |
| | | ReturnModel<dynamic> _rtn = ToolBox.UtilityHelper.ReturnToDynamic(strJson); |
| | | |
| | | ToolBox.MsgHelper.Warning("提示:" + _rtn.rtnMsg); |
| | | if (_rtn.rtnCode > 0) |
| | | { |
| | | lbGuid.Text = _rtn.rtnData; |
| | | toolBarMenu1.isSetBtn = true; |
| | | UtilityHelper.ChangeEnableByControl(this.layoutMx1.Controls, false); |
| | | |
| | | this.setEable(false); |
| | | } |
| | | } |
| | | catch (Exception ex) |
| | |
| | | private void getPageList(int curPage) |
| | | { |
| | | var _sbSqlWhere = UtilityHelper.GetSearchWhere(_filterList); |
| | | // _sbSqlWhere += " and isnull(fsubmit,0)=0"; |
| | | // _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 |
| | |
| | | { |
| | | ToolBox.MsgHelper.Warning("提示:" + ex.Message); |
| | | } |
| | | |
| | | } |
| | | private void getModel(string strGuid) |
| | | private void getModel(string strGuid, string guid5) |
| | | { |
| | | bool isEdit = false; |
| | | if (toolBarMenu1.currentAction == "add") return; |
| | |
| | | List<DevExpress.XtraGrid.Views.Grid.GridView> gvList = new List<DevExpress.XtraGrid.Views.Grid.GridView>(); |
| | | gvList.Add(gvMx1); |
| | | 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(); |
| | | gvMx1.BestFitColumns(); |
| | | gvMx1.FocusedRowHandle = _currentHandle5; |
| | | ucUpFile1.parentGuid = lbGuid.Text.Trim(); |
| | | var row = gvMx1.GetDataRow(_currentHandle5); |
| | | if (row != null) |
| | | if (guid5.Length > 10) |
| | | { |
| | | var rowGuid = row["guid"].ToString(); |
| | | getList12(rowGuid); |
| | | 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> |
| | | /// 选项卡切换 |
| | |
| | | MsgHelper.Warning("提示:" + ex.Message); |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 删除上传 |
| | | /// 删除附件 |
| | | /// </summary> |
| | | /// <param name="sender"></param> |
| | | /// <param name="e"></param> |
| | |
| | | } |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 查看上传 |
| | | /// 浏览附件 |
| | | /// </summary> |
| | | /// <param name="sender"></param> |
| | | /// <param name="e"></param> |
| | |
| | | { |
| | | Gs.DevApp.ToolBox.MsgHelper.ShowError(ex.Message); |
| | | } |
| | | |
| | | } |
| | | } |
| | | /// <summary> |
| | | /// 下载上传 |
| | | /// 下载附件 |
| | | /// </summary> |
| | | /// <param name="sender"></param> |
| | | /// <param name="e"></param> |
| | |
| | | } |
| | | } |
| | | } |
| | | |
| | | private void setEable(bool bl) { |
| | | |
| | | txtJianYan.ReadOnly = !bl; |
| | | btnLoad.Enabled = bl; |
| | | btnIpt.Text = ( bl==true?"录入样本":"查看样本"); |
| | | } |
| | | } |
| | | } |