| | |
| | | using Newtonsoft.Json.Linq; |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using System.Configuration; |
| | | using System.Data; |
| | | using System.Net; |
| | | using System.Threading.Tasks; |
| | | using System.Windows.Forms; |
| | | |
| | |
| | | { |
| | | public partial class Frm_MesQaItemsDetect01 : DevExpress.XtraEditors.XtraForm |
| | | { |
| | | string _strTag = "N:不合格"; |
| | | string _webServiceName = "MesQaItemsDetect01Manager/"; |
| | | List<FilterEntity> _filterList = new List<FilterEntity>(); |
| | | public Frm_MesQaItemsDetect01() |
| | |
| | | this.toolBarMenu1.btnEscClick += ToolBarMenu1_btnEscClick; |
| | | this.toolBarMenu1.btnQueryClick += ToolBarMenu1_btnQueryClick; |
| | | toolBarMenu1.btnLogClick += ToolBarMenu1_btnLogClick; |
| | | toolBarMenu1.btnJianYanClick += ToolBarMenu1_btnJianYanClick; |
| | | toolBarMenu1.btnChkClick += ToolBarMenu1_btnChkClick; |
| | | toolBarMenu1.btnFChkClick += ToolBarMenu1_btnFChkClick; |
| | | toolBarMenu1.btnOutClick += ToolBarMenu1_btnOutClick; |
| | | this.toolBarMenu1.getXmlConfig(); |
| | | Gs.DevApp.ToolBox.UtilityHelper.SetGridViewParameterMx(gvMx1); |
| | | Gs.DevApp.ToolBox.UtilityHelper.SetGridViewParameterMx(gvMx1, tips); |
| | | Gs.DevApp.ToolBox.UtilityHelper.SetGridViewParameterMx(gvMx2); |
| | | Gs.DevApp.ToolBox.UtilityHelper.SetGridViewParameterMx(gvMx3); |
| | | Gs.DevApp.ToolBox.UtilityHelper.SetGridViewParameter(gridView1, picCheckBox, this, "fsubmitTxt", "", (value) => |
| | |
| | | btnYcReport.Click += BtnYcReport_Click; |
| | | } |
| | | |
| | | |
| | | /// <summary> |
| | | /// 批量录入 |
| | | /// </summary> |
| | |
| | | Task.Delay(100); |
| | | getPageList(1); |
| | | } |
| | | /// <summary> |
| | | /// 5表焦点时,重新读取12表 |
| | | /// </summary> |
| | | /// <param name="sender"></param> |
| | | /// <param name="e"></param> |
| | | private void GvMx1_FocusedRowChanged(object sender, DevExpress.XtraGrid.Views.Base.FocusedRowChangedEventArgs e) |
| | | { |
| | | if (e.FocusedRowHandle >= 0) |
| | |
| | | /// <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)) |
| | |
| | | lbGuid, txt_releaseNo, gridView1); |
| | | toolBarMenu1.guidKey = rowGuid; |
| | | } |
| | | /// <summary> |
| | | ///提交检验事件 |
| | | /// </summary> |
| | | /// <param name="sender"></param> |
| | | /// <param name="e"></param> |
| | | /// <exception cref="NotImplementedException"></exception> |
| | | private void ToolBarMenu1_btnJianYanClick(object sender, EventArgs e) |
| | | { |
| | | toolBarMenu1.guidKey = ""; |
| | | string rowGuid, rowName; |
| | | (rowGuid, rowName) = UtilityHelper.GetCurrentRow(xtraTabControl1, |
| | | 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() == "不合格") |
| | | { |
| | | if (string.IsNullOrEmpty(txt_remarks.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); |
| | | } |
| | | |
| | | |
| | | private void ToolBarMenu1_btnChkClick(object sender, EventArgs e) |
| | | { |
| | | _toolCk("EditModelSubmit"); |
| | | } |
| | | private void ToolBarMenu1_btnFChkClick(object sender, EventArgs e) |
| | | { |
| | | _toolCk("EditModelSubmitZhiLiang"); |
| | | } |
| | | |
| | | /// <summary> |
| | |
| | | { |
| | | Gs.DevApp.ToolBox.UtilityHelper.JumpTab(xtraTabControl1, 1); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 导出 |
| | | /// </summary> |
| | | /// <param name="sender"></param> |
| | | /// <param name="e"></param> |
| | | /// <exception cref="NotImplementedException"></exception> |
| | | private void ToolBarMenu1_btnOutClick(object sender, EventArgs e) |
| | | { |
| | | string rowGuid = "", rowName = ""; |
| | | (rowGuid, rowName) = UtilityHelper.GetCurrentRow(xtraTabControl1, |
| | | lbGuid, txt_releaseNo, gridView1, "releaseNo"); |
| | | if (string.IsNullOrEmpty(rowGuid)) |
| | | { |
| | | MsgHelper.Warning("请先选择你要操作的行!"); |
| | | return; |
| | | } |
| | | if (!MsgHelper.AskQuestion("你选择了【" + rowName + "】,确定导出吗?")) |
| | | return; |
| | | using (FolderBrowserDialog folderBrowserDialog = new FolderBrowserDialog()) |
| | | { |
| | | folderBrowserDialog.Description = "选择导出文件的保存路径"; |
| | | DialogResult dialogResult = folderBrowserDialog.ShowDialog(); |
| | | if (dialogResult == DialogResult.OK) |
| | | { |
| | | string _folder = folderBrowserDialog.SelectedPath; |
| | | var _obj = new |
| | | { |
| | | guid = rowGuid, |
| | | }; |
| | | try |
| | | { |
| | | string strJson = UtilityHelper.HttpPost("", "XlsInOut/XlsOutIqc", JsonConvert.SerializeObject(_obj)); |
| | | ReturnModel<dynamic> _rtn = ToolBox.UtilityHelper.ReturnToDynamic(strJson); |
| | | if (_rtn.rtnCode > 0) |
| | | { |
| | | string _file = _rtn.rtnData.fileUrl.ToString(); |
| | | string _folderName = _folder + "\\" + _file.Replace("down/", ""); |
| | | string _url = ConfigurationManager.AppSettings["WebApiUrl"].ToString() + _file; |
| | | using (WebClient client = new WebClient()) |
| | | { |
| | | client.DownloadFile(_url, _folderName); |
| | | } |
| | | ToolBox.MsgHelper.ShowInformation("导出成功!"); |
| | | } |
| | | else |
| | | { |
| | | ToolBox.MsgHelper.ShowError("提示:" + _rtn.rtnMsg); |
| | | } |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | ToolBox.MsgHelper.ShowError("提示:" + ex.Message); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 刷新事件 |
| | |
| | | private void ToolBarMenu1_btnSaveClick(object sender, EventArgs e) |
| | | { |
| | | toolBarMenu1.isSetBtn = false; |
| | | if (txt_fcheckResu.Text.Trim() == "N:不合格" && string.IsNullOrEmpty(txt_remarks.Text.Trim())) |
| | | if (txt_fcheckResu.Text.Trim() == _strTag && string.IsNullOrEmpty(txt_fngDesc.TextTxt.Trim())) |
| | | { |
| | | Gs.DevApp.ToolBox.MsgHelper.Warning("当检验结果不合格时,请填写备注说明!"); |
| | | txt_remarks.Focus(); |
| | | txt_fngDesc.Focus(); |
| | | return; |
| | | } |
| | | var _obj = new |
| | | { |
| | | guid = UtilityHelper.ToGuid(lbGuid.Text.Trim()), //主建 |
| | | remarks = txt_remarks.Text.Trim(), |
| | | fngDesc = txt_fngDesc.TextTxt.Trim(), |
| | | }; |
| | | try |
| | | { |
| | |
| | | this.setEable(false); |
| | | toolBarMenu1.currentAction = ""; |
| | | Gs.DevApp.ToolBox.UtilityHelper.JumpTab(xtraTabControl1, 6); |
| | | |
| | | } |
| | | } |
| | | catch (Exception ex) |
| | |
| | | /// <param name="pageSize">每页几条</param> |
| | | private void getPageList(int curPage) |
| | | { |
| | | gcMain1.DataSource = null;var _sbSqlWhere = UtilityHelper.GetSearchWhere(_filterList); |
| | | // _sbSqlWhere += " and isnull(fsubmit,0)=0"; |
| | | gcMain1.DataSource = null; var _sbSqlWhere = UtilityHelper.GetSearchWhere(_filterList); |
| | | PageQueryModel pgq = new PageQueryModel(curPage, this.pageBar1.RowsCount, "release_no", "asc", "", _sbSqlWhere.ToString()); |
| | | string json = JsonConvert.SerializeObject(pgq); |
| | | try |
| | |
| | | } |
| | | |
| | | } |
| | | /// <summary> |
| | | /// 读取实体 |
| | | /// </summary> |
| | | /// <param name="strGuid"></param> |
| | | /// <param name="guid5"></param> |
| | | private void getModel(string strGuid, string guid5) |
| | | { |
| | | bool isEdit = false; |
| | |
| | | if (_rtn.rtnCode > 0) |
| | | { |
| | | dynamic dy = _rtn.rtnData; |
| | | btnYcReport.Tag = dy.toGuid.ToString(); |
| | | 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); |
| | |
| | | gcMx1.DataSource = dt; |
| | | gcMx1.ForceInitialize(); |
| | | gvMx1.BestFitColumns(); |
| | | Gs.DevApp.ToolBox.UtilityHelper.SetGridLayout(gvMx1); |
| | | ucUpFileList1.pGuid = lbGuid.Text.Trim(); |
| | | if (guid5.Length > 10) |
| | | { |
| | |
| | | MsgHelper.Warning("提示:" + ex.Message); |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 禁用检验框+重新加载按钮 |
| | | /// </summary> |
| | | /// <param name="bl"></param> |
| | | private void setEable(bool bl) |
| | | { |
| | | txtJianYan.ReadOnly = !bl; |
| | |
| | | btnIpt.Text = (bl == true ? "录入样本" : "查看样本"); |
| | | } |
| | | |
| | | #region 打开父亲窗口委托 |
| | | #region 打开父亲窗口委托,查看异常报告 |
| | | public event EventHandler<UpdateParentEventArgs> ToUpdateParent; |
| | | private void BtnYcReport_Click(object sender, EventArgs e) |
| | | { |
| | | string _toGuid = (btnYcReport.Tag == null ? "" : btnYcReport.Tag.ToString()); |
| | | string _toGuid = (btnYcReport.ToolTip == null ? "" : btnYcReport.ToolTip.ToString()); |
| | | if (string.IsNullOrEmpty(_toGuid)) |
| | | { |
| | | Gs.DevApp.ToolBox.MsgHelper.ShowInformation("该单无异常报告,查看失败!"); |
| | |
| | | } |
| | | #endregion |
| | | |
| | | |
| | | /// <summary> |
| | | /// 检验和反检验 |
| | | /// </summary> |
| | | /// <param name="inFieldValue"></param> |
| | | private void _toolCk(string _meth) |
| | | { |
| | | string rowGuid, rowName; |
| | | (rowGuid, rowName) = UtilityHelper.GetCurrentRow(xtraTabControl1, lbGuid, txt_releaseNo, gridView1, "releaseNo"); |
| | | if (string.IsNullOrEmpty(rowGuid)) |
| | | { |
| | | MsgHelper.Warning("请先选择你要操作的行!"); |
| | | return; |
| | | } |
| | | if (!MsgHelper.AskQuestion("你选择了【" + rowName + "】,确定操作吗?")) |
| | | return; |
| | | var _obj = new |
| | | { |
| | | guid = rowGuid, |
| | | }; |
| | | try |
| | | { |
| | | var strJson = UtilityHelper.HttpPost("", |
| | | _webServiceName + _meth, |
| | | 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 = (_meth == "EditModelSubmit" ? 1 : -1); |
| | | UtilityHelper.SetCheckIco(gridView1, "fsubmitTxt", "", "iqcDate", picCheckBox, this, _inFieldValue.ToString()); |
| | | } |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | MsgHelper.Warning("提示:" + ex.Message); |
| | | } |
| | | } |
| | | |
| | | } |
| | | } |