| | |
| | | /// </summary> |
| | | public event EventHandler btnFChkClick; |
| | | |
| | | |
| | | /// <summary> |
| | | /// 检验 |
| | | /// </summary> |
| | | public event EventHandler btnJianYanClick; |
| | | /// <summary> |
| | | /// 反检验 |
| | | /// </summary> |
| | | public event EventHandler btnFjianYanClick; |
| | | |
| | | #endregion |
| | | |
| | | #region 公共属性 |
| | |
| | | public List<string> actions { get; } |
| | | |
| | | /// <summary> |
| | | /// 报表类型,在数据库中要唯一,否则会保存不了报表设计 |
| | | /// 报表,在数据库中要唯一,如:存储过程名{入参1名|入参值,入参2名|入参值} |
| | | /// </summary> |
| | | public string rptService { get; set; } |
| | | public string rptParameter { get; set; } |
| | | |
| | | /// <summary> |
| | | /// 导出服务名 |
| | | /// 导出,视图名,如:视图名{入参1名|入参值,入参2名|入参值} |
| | | /// </summary> |
| | | public string xlsOutView { get; set; } |
| | | public string xlsOutParameter { get; set; } |
| | | |
| | | /// <summary> |
| | | /// 导入服务名 |
| | | /// 导入 |
| | | /// </summary> |
| | | public string xlsInService { get; set; } |
| | | |
| | | /// <summary> |
| | | /// 审核参数,形如:MES_HOLIDAY,check_date,check_status,check_by |
| | | /// 审核参数,表名,字段名,如:MES_HOLIDAY,check_date,check_status,check_by |
| | | /// </summary> |
| | | public string chkParameter { get; set; } |
| | | #endregion |
| | |
| | | this.btnIn.ItemClick += BtnIn_ItemClick; |
| | | this.btnChk.ItemClick += BtnChk_ItemClick; |
| | | this.btnFchk.ItemClick += BtnFchk_ItemClick; |
| | | this.btnJianYan.ItemClick += BtnJianYan_ItemClick; |
| | | this.btnFjianYan.ItemClick += BtnFjianYan_ItemClick; |
| | | List<string> lst = new List<string>(); |
| | | foreach (BarItem item in barManager1.Items) |
| | | { |
| | |
| | | } |
| | | this.actions = lst; |
| | | } |
| | | |
| | | |
| | | /// <summary> |
| | | /// 初始化按钮状态 |
| | |
| | | ToolBox.MsgHelper.Warning("提示:" + _rtn.rtnMsg); |
| | | } |
| | | } |
| | | |
| | | |
| | | private void BtnChk_ItemClick(object sender, ItemClickEventArgs e) |
| | | { |
| | | if (btnChkClick != null) |
| | |
| | | ToolBox.MsgHelper.Warning("提示:" + _rtn.rtnMsg); |
| | | } |
| | | } |
| | | |
| | | private void BtnFjianYan_ItemClick(object sender, ItemClickEventArgs e) |
| | | { |
| | | if (btnFjianYanClick != null) |
| | | { |
| | | btnFjianYanClick(this, e); |
| | | } |
| | | else |
| | | return; |
| | | |
| | | if (string.IsNullOrEmpty(this.guidKey)) |
| | | { |
| | | ToolBox.MsgHelper.Warning("请先选择你要操作的行!"); |
| | | return; |
| | | } |
| | | if (string.IsNullOrEmpty(this.chkParameter)) |
| | | { |
| | | ToolBox.MsgHelper.ShowError("没有指定检验参数,请联系开发人员获取支持!"); |
| | | return; |
| | | } |
| | | if (!MsgHelper.AskQuestion("你选择了1条数据,确定反检验吗?")) |
| | | return; |
| | | var _obj = new |
| | | { |
| | | guid = this.guidKey, |
| | | parameter = this.chkParameter |
| | | }; |
| | | string strJson = UtilityHelper.HttpPost("", "General/GeneralFCheck", JsonConvert.SerializeObject(_obj)); |
| | | ReturnModel<dynamic> _rtn = ToolBox.UtilityHelper.ReturnToDynamic(strJson); |
| | | if (_rtn.rtnCode > 0) |
| | | { |
| | | ToolBox.MsgHelper.Warning("提示:" + _rtn.rtnData["outMsg"].ToString()); |
| | | } |
| | | else |
| | | { |
| | | ToolBox.MsgHelper.Warning("提示:" + _rtn.rtnMsg); |
| | | } |
| | | } |
| | | |
| | | private void BtnJianYan_ItemClick(object sender, ItemClickEventArgs e) |
| | | { |
| | | if (btnJianYanClick != null) |
| | | { |
| | | btnJianYanClick(this, e); |
| | | } |
| | | else |
| | | return; |
| | | |
| | | if (string.IsNullOrEmpty(this.guidKey)) |
| | | { |
| | | ToolBox.MsgHelper.Warning("请先选择你要操作的行!"); |
| | | return; |
| | | } |
| | | if (string.IsNullOrEmpty(this.chkParameter)) |
| | | { |
| | | ToolBox.MsgHelper.ShowError("没有指定检验参数,请联系开发人员获取支持!"); |
| | | return; |
| | | } |
| | | if (!MsgHelper.AskQuestion("你选择了1条数据,确定提交检验吗?")) |
| | | return; |
| | | var _obj = new |
| | | { |
| | | guid = this.guidKey, |
| | | parameter = this.chkParameter |
| | | }; |
| | | string strJson = UtilityHelper.HttpPost("", "General/GeneralCheck", JsonConvert.SerializeObject(_obj)); |
| | | ReturnModel<dynamic> _rtn = ToolBox.UtilityHelper.ReturnToDynamic(strJson); |
| | | if (_rtn.rtnCode > 0) |
| | | { |
| | | ToolBox.MsgHelper.Warning("提示:" + _rtn.rtnData["outMsg"].ToString()); |
| | | } |
| | | else |
| | | { |
| | | ToolBox.MsgHelper.Warning("提示:" + _rtn.rtnMsg); |
| | | } |
| | | } |
| | | |
| | | private async void BtnIn_ItemClick(object sender, ItemClickEventArgs e) |
| | | { |
| | | if (string.IsNullOrEmpty(this.xlsInService)) |
| | |
| | | |
| | | private void BtnOut_ItemClick(object sender, ItemClickEventArgs e) |
| | | { |
| | | if (string.IsNullOrEmpty(this.xlsOutView)) |
| | | { |
| | | ToolBox.MsgHelper.ShowError("没有指定导出服务,请联系开发人员获取支持!"); |
| | | return; |
| | | } |
| | | using (FolderBrowserDialog folderBrowserDialog = new FolderBrowserDialog()) |
| | | { |
| | | folderBrowserDialog.Description = "选择导出文件的保存路径"; |
| | | DialogResult dialogResult = folderBrowserDialog.ShowDialog(); |
| | | if (dialogResult == DialogResult.OK) |
| | | { |
| | | string _folder = folderBrowserDialog.SelectedPath; |
| | | var _obj = new Gs.DevApp.Entity.XlsOutModel(this.xlsOutView); |
| | | try |
| | | { |
| | | string strJson = UtilityHelper.HttpPost("", "XlsInOut/XlsOutView", 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); |
| | | } |
| | | } |
| | | } |
| | | //if (string.IsNullOrEmpty(this.xlsOutView)) |
| | | //{ |
| | | // ToolBox.MsgHelper.ShowError("没有指定导出服务,请联系开发人员获取支持!"); |
| | | // return; |
| | | //} |
| | | //using (FolderBrowserDialog folderBrowserDialog = new FolderBrowserDialog()) |
| | | //{ |
| | | // folderBrowserDialog.Description = "选择导出文件的保存路径"; |
| | | // DialogResult dialogResult = folderBrowserDialog.ShowDialog(); |
| | | // if (dialogResult == DialogResult.OK) |
| | | // { |
| | | // string _folder = folderBrowserDialog.SelectedPath; |
| | | // var _obj = new Gs.DevApp.Entity.XlsOutModel(this.xlsOutView); |
| | | // try |
| | | // { |
| | | // string strJson = UtilityHelper.HttpPost("", "XlsInOut/XlsOutView", 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); |
| | | // } |
| | | // } |
| | | //} |
| | | } |
| | | private void BtnReport_ItemClick(object sender, ItemClickEventArgs e) |
| | | { |
| | | if (string.IsNullOrEmpty(this.rptService)) |
| | | if (string.IsNullOrEmpty(this.rptParameter)) |
| | | { |
| | | ToolBox.MsgHelper.ShowError("没有指定报表类型,请联系开发人员获取支持!"); |
| | | ToolBox.MsgHelper.ShowError("没有指定报表参数,请联系技术开发人员!"); |
| | | return; |
| | | } |
| | | bool _bl = false; |
| | | _bl = _ckRptService(); |
| | | if (_bl) |
| | | { |
| | | Gs.DevApp.DevFrm.Rpt.RptPreview frm = new Gs.DevApp.DevFrm.Rpt.RptPreview(this.rptService); |
| | | Gs.DevApp.DevFrm.Rpt.RptPreview frm = new Gs.DevApp.DevFrm.Rpt.RptPreview(this.rptParameter); |
| | | frm.Show(); |
| | | return; |
| | | } |
| | | ToolBox.MsgHelper.ShowError("还没有设计模板,请先设计模板!"); |
| | | ToolBox.MsgHelper.ShowError("没有设计模板,请先设计模板!"); |
| | | return; |
| | | } |
| | | private void BtnDesign_ItemClick(object sender, ItemClickEventArgs e) |
| | | { |
| | | if (string.IsNullOrEmpty(this.rptService)) |
| | | if (string.IsNullOrEmpty(this.rptParameter)) |
| | | { |
| | | ToolBox.MsgHelper.ShowError("没有指定报表类型,请联系开发人员获取支持!"); |
| | | ToolBox.MsgHelper.ShowError("没有指定报表参数,请联系技术开发人员!"); |
| | | return; |
| | | } |
| | | bool _bl = false; |
| | | _bl = _ckRptService(); |
| | | //如果已经有模板了,直接打开 |
| | | //如果已经有模板了,直接打开设置模板 |
| | | if (_bl) |
| | | { |
| | | Gs.DevApp.DevFrm.Sys.EasyRptDesign frm = new Gs.DevApp.DevFrm.Sys.EasyRptDesign(this.rptService); |
| | | Gs.DevApp.DevFrm.Sys.EasyRptDesign frm = new Gs.DevApp.DevFrm.Sys.EasyRptDesign(this.rptParameter); |
| | | frm.Show(); |
| | | return; |
| | | } |
| | | //否则向导设计模板 |
| | | UserControl.ShowRptWizard rptWizard = new ShowRptWizard(this.rptService); |
| | | UserControl.ShowRptWizard rptWizard = new ShowRptWizard(this.rptParameter); |
| | | rptWizard.ShowDialog(); |
| | | } |
| | | |
| | |
| | | ); |
| | | if (ld1 == true) |
| | | { |
| | | |
| | | btnEsc.Visibility = btnSave.Visibility = btnLoad.Visibility = BarItemVisibility.Always; |
| | | btnAdd.Visibility = BarItemVisibility.Always; |
| | | _enabledList.Add(item.Name); |
| | |
| | | { |
| | | item.Visibility = BarItemVisibility.Always; |
| | | //准备启用 |
| | | _enabledList.Add(item.Name); |
| | | continue; |
| | | } |
| | | } |
| | | ///具有联动关系的按钮(提交检验), |
| | | if (item.Caption == "提交检验") |
| | | { |
| | | bool ld1 = dt.AsEnumerable().Any(row => row.Field<string>("name") == "提交检验" |
| | | ); |
| | | if (ld1 == true) |
| | | { |
| | | btnJianYan.Visibility = btnFjianYan.Visibility = btnLoad.Visibility = BarItemVisibility.Always; |
| | | btnJianYan.Visibility = BarItemVisibility.Always; |
| | | _enabledList.Add(item.Name); |
| | | continue; |
| | | } |
| | |
| | | { |
| | | var _obj = new |
| | | { |
| | | reportType = this.rptService, |
| | | rptParameter = this.rptParameter, |
| | | }; |
| | | string strJson = UtilityHelper.HttpPost("", "Report/GetTemplate", JsonConvert.SerializeObject(_obj)); |
| | | ReturnModel<dynamic> _rtn = ToolBox.UtilityHelper.ReturnToDynamic(strJson); |
| | |
| | | ToolBox.MsgHelper.Warning("提示:" + ex.Message); |
| | | return true; |
| | | } |
| | | return false; |
| | | } |
| | | } |
| | | } |