| | |
| | | using Newtonsoft.Json.Linq; |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using System.Configuration; |
| | | using System.Data; |
| | | using System.Drawing; |
| | | using System.Net; |
| | | using System.Windows.Forms; |
| | | |
| | | namespace Gs.DevApp.DevFrm |
| | |
| | | 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(); |
| | |
| | | this.btnLoad.Click += BtnLoad_Click; |
| | | ucUpFile1.UpChanged += UcUpFile1_UpChanged; |
| | | xtraTabControl2.SelectedPageChanged += XtraTabControl2_SelectedPageChanged; |
| | | |
| | | } |
| | | |
| | | private void GcMx1_MouseClick(object sender, MouseEventArgs e) |
| | |
| | | /// <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)) |
| | |
| | | gcMx1.BindingContext = new BindingContext(); |
| | | gcMx1.DataSource = dt; |
| | | gcMx1.ForceInitialize(); |
| | | getList12(dt.Rows[0]["guid"].ToString()); |
| | | } |
| | | else |
| | | { |
| | |
| | | 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) |
| | | private async void ToolBarMenu1_btnJianYanClick(object sender, EventArgs e) |
| | | { |
| | | toolBarMenu1.guidKey = ""; |
| | | string rowGuid, rowName; |
| | | (rowGuid, rowName) = UtilityHelper.GetCurrentRow(xtraTabControl1, |
| | | lbGuid, txt_releaseNo, gridView1); |
| | | toolBarMenu1.guidKey = rowGuid; |
| | | if (string.IsNullOrEmpty(rowGuid)) |
| | | { |
| | | MsgHelper.Warning("请先选择你要操作的行!"); |
| | | return; |
| | | } |
| | | if (!MsgHelper.AskQuestion("你选择了【" + rowName + "】,确定提交检验吗?")) |
| | | return; |
| | | UcLoading _loading = new UcLoading(); |
| | | var _obj = new |
| | | { |
| | | guid = rowGuid, |
| | | }; |
| | | try |
| | | { |
| | | var strJson = await UtilityHelper.HttpPostAsync("", |
| | | _webServiceName + "EditModelSubmit", |
| | | JsonConvert.SerializeObject(_obj)); |
| | | var _rtn = UtilityHelper.ReturnToDynamic(strJson); |
| | | MsgHelper.Warning("提示:" + _rtn.rtnData.outMsg); |
| | | if (_rtn.rtnCode > 0) |
| | | { |
| | | if (xtraTabControl1.SelectedTabPageIndex == 1) |
| | | getModel(lbGuid.Text.Trim(), false, 999); |
| | | else |
| | | getPageList(1, UtilityHelper.GetPageSize()); |
| | | } |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | MsgHelper.Warning("提示:" + ex.Message); |
| | | } |
| | | _loading.Stop(); |
| | | } |
| | | |
| | | /// <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(), false, 999); |
| | | else |
| | | getPageList(1, UtilityHelper.GetPageSize()); |
| | | } |
| | | /// <summary> |
| | | /// 修改事件 |
| | |
| | | private void ToolBarMenu1_btnSaveClick(object sender, EventArgs e) |
| | | { |
| | | toolBarMenu1.isSetBtn = false; |
| | | //if (string.IsNullOrEmpty(txt_account.Text.Trim())) |
| | | if (string.IsNullOrEmpty(txt_fngDesc.Text.Trim())) |
| | | { |
| | | Gs.DevApp.ToolBox.MsgHelper.Warning("登录账号不能为空!"); |
| | | // txt_account.Focus(); |
| | | Gs.DevApp.ToolBox.MsgHelper.Warning("不良描述不能为空!"); |
| | | txt_fngDesc.Focus(); |
| | | return; |
| | | } |
| | | if (string.IsNullOrEmpty(txt_lotNo1.Text.Trim())) |
| | | { |
| | | Gs.DevApp.ToolBox.MsgHelper.Warning("备注能为空!"); |
| | | txt_fngDesc.Focus(); |
| | | return; |
| | | } |
| | | var _obj = new |
| | | { |
| | | guid = UtilityHelper.ToGuid(lbGuid.Text.Trim()), //主建 |
| | | fngDesc = txt_fngDesc.Text.Trim(), |
| | | lotNo1 = txt_lotNo1.Text.Trim(), |
| | | }; |
| | | try |
| | | { |
| | |
| | | } |
| | | _loading.Stop(); |
| | | } |
| | | private void getModel(string strGuid, bool isEdit, int tabIdx) |
| | | private async void getModel(string strGuid, bool isEdit, int tabIdx) |
| | | { |
| | | if (string.IsNullOrEmpty(strGuid)) |
| | | { |
| | |
| | | return; |
| | | } |
| | | UtilityHelper.JumpToTab(xtraTabControl1, tabIdx); |
| | | UcLoading _loading = new UcLoading(); |
| | | var _obj = new |
| | | { |
| | | guid = strGuid,//主建 |
| | | }; |
| | | try |
| | | { |
| | | string strJson = UtilityHelper.HttpPost("", _webServiceName + "GetModel", JsonConvert.SerializeObject(_obj)); |
| | | string strJson = await UtilityHelper.HttpPostAsync("", _webServiceName + "GetModel", JsonConvert.SerializeObject(_obj)); |
| | | ReturnModel<dynamic> _rtn = ToolBox.UtilityHelper.ReturnToDynamic(strJson); |
| | | if (_rtn.rtnCode > 0) |
| | | { |
| | |
| | | { |
| | | ToolBox.MsgHelper.Warning("提示:" + ex.Message); |
| | | } |
| | | |
| | | _loading.Stop(); |
| | | } |
| | | |
| | | |
| | | |
| | | /// <summary> |
| | | /// 选项卡切换 |
| | | /// </summary> |
| | |
| | | /// 根据检验项目读取抽样结果 |
| | | /// </summary> |
| | | /// <param name="guid5"></param> |
| | | private void getList12(string guid5) |
| | | private async void getList12(string guid5) |
| | | { |
| | | UcLoading _loading = new UcLoading(); |
| | | var _obj = new |
| | | { |
| | | parentGuid = UtilityHelper.ToGuid(lbGuid.Text.Trim()), //主建 |
| | |
| | | }; |
| | | try |
| | | { |
| | | var strReturn = UtilityHelper.HttpPost("", _webServiceName + "GetModel12", JsonConvert.SerializeObject(_obj)); |
| | | var strReturn = await UtilityHelper.HttpPostAsync("", _webServiceName + "GetModel12", JsonConvert.SerializeObject(_obj)); |
| | | var dd = UtilityHelper.ReturnToList(strReturn); |
| | | var dt = dd.rtnData; |
| | | gcMx2.BindingContext = new BindingContext(); |
| | |
| | | { |
| | | MsgHelper.Warning("提示:" + ex.Message); |
| | | } |
| | | _loading.Stop(); |
| | | } |
| | | |
| | | private void repositoryItemButtonEdit1_ButtonClick(object sender, DevExpress.XtraEditors.Controls.ButtonPressedEventArgs e) |
| | |
| | | return; |
| | | if (e.Button.Index == 0) |
| | | { |
| | | MsgHelper.Warning("提示:" + "开发中"); |
| | | try |
| | | { |
| | | var dr = gvMx3.GetDataRow(rowhandle); |
| | | var urlPath = dr["urlPath"].ToString(); |
| | | Gs.DevApp.UserControl.ShowFile frm = new ShowFile(urlPath); |
| | | frm.ShowDialog(); |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | Gs.DevApp.ToolBox.MsgHelper.ShowError(ex.Message); |
| | | } |
| | | |
| | | } |
| | | } |
| | | |
| | | private void repositoryItemButtonEdit3_ButtonClick(object sender, DevExpress.XtraEditors.Controls.ButtonPressedEventArgs e) |
| | | { |
| | | var rowhandle = gvMx3.FocusedRowHandle; |
| | | if (rowhandle < 0) |
| | | return; |
| | | if (e.Button.Index == 0) |
| | | { |
| | | try |
| | | { |
| | | var dr = gvMx3.GetDataRow(rowhandle); |
| | | var urlPath = dr["urlPath"].ToString(); |
| | | using (FolderBrowserDialog folderBrowserDialog = new FolderBrowserDialog()) |
| | | { |
| | | folderBrowserDialog.Description = "选择导出文件的保存路径"; |
| | | DialogResult dialogResult = folderBrowserDialog.ShowDialog(); |
| | | if (dialogResult == DialogResult.OK) |
| | | { |
| | | string _folder = folderBrowserDialog.SelectedPath; |
| | | string _folderName = _folder + "\\" + urlPath; |
| | | string _url = ConfigurationManager.AppSettings["WebApiUrl"].ToString() + "upload/" + urlPath; |
| | | using (WebClient client = new WebClient()) |
| | | { |
| | | client.DownloadFile(_url, _folderName); |
| | | } |
| | | ToolBox.MsgHelper.ShowInformation("下载成功!"); |
| | | } |
| | | } |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | Gs.DevApp.ToolBox.MsgHelper.ShowError(ex.Message); |
| | | } |
| | | } |
| | | } |
| | | } |