| | |
| | | using Gs.DevApp.DevFrm.QC; |
| | | using Gs.DevApp.DevFrm.Rpt; |
| | | using Gs.DevApp.Entity; |
| | | using Gs.DevApp.ToolBox; |
| | | using Gs.DevApp.UserControl; |
| | |
| | | /// <exception cref="NotImplementedException"></exception> |
| | | private void ToolBarMenu1_btnOutClick(object sender, EventArgs e) |
| | | { |
| | | |
| | | var frm = new SelOutType(); |
| | | var type = 0; |
| | | //赋值给明细表 |
| | | frm.UpdateParent += (ss, ee) => |
| | | { |
| | | var lst = new List<string>(); |
| | | lst = ee.StringList; |
| | | if (!string.IsNullOrEmpty(lst[0])) |
| | | { |
| | | if(lst[0] == "列表导出") |
| | | { |
| | | type = 1; |
| | | } |
| | | else if (lst[0] == "明细导出") |
| | | { |
| | | type = 2; |
| | | } |
| | | } |
| | | }; |
| | | frm.ShowDialog(); |
| | | if(type == 1) |
| | | { |
| | | LstOutput(); |
| | | } |
| | | if(type == 2) |
| | | { |
| | | MxOutput(); |
| | | } |
| | | } |
| | | |
| | | private void MxOutput() |
| | | { |
| | | string rowGuid = "", rowName = ""; |
| | | (rowGuid, rowName) = UtilityHelper.GetCurrentRow(xtraTabControl1, |
| | | lbGuid, txt_releaseNo, gridView1, "releaseNo"); |
| | |
| | | catch (Exception ex) |
| | | { |
| | | ToolBox.MsgHelper.ShowError("提示:" + ex.Message); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | private void LstOutput() |
| | | { |
| | | using (FolderBrowserDialog folderBrowserDialog = new FolderBrowserDialog()) |
| | | { |
| | | folderBrowserDialog.Description = "选择导出文件的保存路径"; |
| | | DialogResult dialogResult = folderBrowserDialog.ShowDialog(); |
| | | System.Text.StringBuilder _sbSqlWhere = new System.Text.StringBuilder(); |
| | | _sbSqlWhere.Append(" and a.ReceiveOrgId in"); |
| | | _sbSqlWhere.Append(ToolBox.UtilityHelper.GetOrgWhere()); |
| | | _sbSqlWhere.Append(UtilityHelper.GetSearchWhere(_filterList)); |
| | | if (dialogResult == DialogResult.OK) |
| | | { |
| | | string _folder = folderBrowserDialog.SelectedPath; |
| | | var _params = new |
| | | { |
| | | inSortName = "", |
| | | inSortOrder = "", |
| | | inQueryWhere = _sbSqlWhere.ToString() |
| | | }; |
| | | var _obj = new Gs.DevApp.Entity.XlsOutModel("xlsOut_iqcdetect01lst", "", "", "", _params); |
| | | try |
| | | { |
| | | string strJson = UtilityHelper.HttpPost("", "XlsInOut/XlsOutView_NEW", 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.Warning("提示:" + _rtn.rtnMsg); |
| | | } |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | ToolBox.MsgHelper.Warning("提示:" + ex.Message); |
| | | } |
| | | } |
| | | } |