4ee191a023
SVN-Revision: r1246
2750 lines
121 KiB
C#
2750 lines
121 KiB
C#
/******************************
|
|
* 说明:添加、修改界面模版
|
|
* 创建人:龚宇超
|
|
* 创建日期:2017-11-03
|
|
* 修改人:
|
|
* 修改日期:
|
|
* 修改备注:
|
|
* 版本:1.0.0.0
|
|
******************************/
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.ComponentModel;
|
|
using System.Drawing;
|
|
using System.Data;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Windows.Forms;
|
|
using DevExpress.XtraBars;
|
|
using Lskj.Business.Impl;
|
|
using Lskj.Control.Model;
|
|
using Lskj.Model;
|
|
using Lskj.Control;
|
|
using Lskj.Data;
|
|
using Lskj.Util;
|
|
using System.IO;
|
|
using Lskj.Business;
|
|
using DevExpress.XtraEditors;
|
|
using System.Timers;
|
|
using System.Threading;
|
|
using System.Runtime.InteropServices;
|
|
using DevExpress.XtraTab;
|
|
using Lskj.Core;
|
|
using System.Diagnostics;
|
|
using System.Text.RegularExpressions;
|
|
using Lskj.Data.Api.BLL;
|
|
using Lskj.Control.BrowserSetting;
|
|
using System.Net;
|
|
using Newtonsoft.Json.Linq;
|
|
using System.Collections;
|
|
using Newtonsoft.Json;
|
|
using System.Web;
|
|
|
|
namespace Lskj.Control
|
|
{
|
|
/// <summary>
|
|
/// 添加、修改界面模版
|
|
/// </summary>
|
|
public partial class ModulePanelEx : UserControl
|
|
{
|
|
public LabelTextEdit ScanEdit { get { return this._scanEdit; } }
|
|
#region private property
|
|
|
|
/// <summary>
|
|
/// 是否直接打印
|
|
/// </summary>
|
|
private bool _isExcPrint;
|
|
/// <summary>
|
|
/// 左侧树、表格配置字段
|
|
/// </summary>
|
|
private string _leftField;
|
|
/// <summary>
|
|
/// 主打印Sql
|
|
/// </summary>
|
|
private string _mainPrintSql;
|
|
/// <summary>
|
|
/// 打印主sql中关联打印次数返回条件
|
|
/// </summary>
|
|
private string _printModeCond;
|
|
private Thread IDCardThread = null;
|
|
/// <summary>
|
|
/// 打印完成后添加数据用到的参数
|
|
/// </summary>
|
|
private List<string> _printSaveParams;
|
|
/// <summary>
|
|
/// 当前操作的ImageEdit
|
|
/// </summary>
|
|
private LabelImageEdit _imageEdit;
|
|
/// <summary>
|
|
/// 扫码控件
|
|
/// </summary>
|
|
private LabelTextEdit _scanEdit;
|
|
/// <summary>
|
|
/// 控件数据源
|
|
/// </summary>
|
|
private DataTable _controlTable;
|
|
/// <summary>
|
|
/// 清除页面、复制新增、附件管理、常规打印
|
|
/// </summary>
|
|
//BarButtonItem bbi_clear, bbi_copy;
|
|
#endregion
|
|
|
|
#region public property
|
|
/// <summary>
|
|
/// 底部操作控件面板
|
|
/// </summary>
|
|
public TabControlEx TcButtom { get { return tcButtom; } }
|
|
/// <summary>
|
|
/// 底部操作控件面板
|
|
/// </summary>
|
|
public SplitContainerControl SplitContainerControl { get { return scc_container; } }
|
|
/// <summary>
|
|
/// 下方显示的明细数据
|
|
/// </summary>
|
|
public DataRow[] DetailsData;
|
|
/// <summary>
|
|
/// 是否是新增保存
|
|
/// </summary>
|
|
public bool SavaState;
|
|
/// <summary>
|
|
/// 是否为身份证阅读器
|
|
/// </summary>
|
|
public bool IsCard;
|
|
/// <summary>
|
|
/// 控件高度
|
|
/// </summary>
|
|
/// <value>The height of the control.</value>
|
|
public int ControlHeight { get; private set; }
|
|
/// <summary>
|
|
/// 按钮是否可操作
|
|
/// </summary>
|
|
public string IsView;
|
|
/// <summary>
|
|
/// 主键Key
|
|
/// </summary>
|
|
public string PrimaryKey;
|
|
/// <summary>
|
|
/// 主键值
|
|
/// </summary>
|
|
public string PrimaryValue;
|
|
/// <summary>
|
|
/// 分类编号
|
|
/// </summary>
|
|
/// <value>The parent key.</value>
|
|
public string ParentKey
|
|
{
|
|
get { return this.lteSpeciesNo.TextEdit.EditValue + ""; }
|
|
set { this.lteSpeciesNo.TextEdit.Text = value; }
|
|
}
|
|
/// <summary>
|
|
/// 分类名称
|
|
/// </summary>
|
|
/// <value>The parent value.</value>
|
|
public string ParentValue
|
|
{
|
|
get { return this.lteSpeciesName.TextEdit.EditValue + ""; }
|
|
set { this.lteSpeciesName.TextEdit.Text = value; }
|
|
}
|
|
/// <summary>
|
|
/// 外面表格的搜索条件
|
|
/// </summary>
|
|
public string SearchObject;
|
|
/// <summary>
|
|
/// 关联模块Key
|
|
/// </summary>
|
|
public string UnionKey;
|
|
/// <summary>
|
|
/// 关联模块值
|
|
/// </summary>
|
|
public string UnionValue;
|
|
/// <summary>
|
|
/// 控件赋值sql
|
|
/// </summary>
|
|
public string ControlSql;
|
|
/// <summary>
|
|
/// 系统模块实体对象
|
|
/// </summary>
|
|
/// <value>The system model.</value>
|
|
public ModuleModel SysModel { get; private set; }
|
|
/// <summary>
|
|
/// 调用动态链接库默认传递参数
|
|
/// </summary>
|
|
public DynamicModel Model { get; private set; }
|
|
/// <summary>
|
|
/// 控件对象
|
|
/// </summary>
|
|
public MyControl ControlObj { get; private set; }
|
|
/// <summary>
|
|
/// 顶部操作按钮
|
|
/// </summary>
|
|
/// <value>The species panel control object.</value>
|
|
public PanelControl SpeciesPanelControlObj { get { return pl_main_top; } }
|
|
/// <summary>
|
|
/// 底部操作控件面板
|
|
/// </summary>
|
|
/// <value>The panel control object.</value>
|
|
public PanelControl OperatePanelControlObj { get { return pl_buttom; } }
|
|
/// <summary>
|
|
/// 动态控件加载面板
|
|
/// </summary>
|
|
/// <value>The panel control object.</value>
|
|
public XtraScrollableControl plMainControlObj { get { return pl_main; } }
|
|
|
|
[DllImport("user32.dll")]
|
|
[return: MarshalAs(UnmanagedType.Bool)]
|
|
private static extern bool ShowScrollBar(IntPtr hWnd, int wBar, bool bShow);
|
|
private enum ScrollBarDirection { SB_HORZ = 0, SB_VERT = 1, SB_CTL = 2, SB_BOTH = 3 }
|
|
|
|
#endregion
|
|
|
|
#region public event
|
|
/// <summary>
|
|
/// Occurs when [on add record call back].
|
|
/// </summary>
|
|
public event EventHandler OnAddRecordCallBack;
|
|
/// <summary>
|
|
/// Occurs when [on apply record call back].
|
|
/// </summary>
|
|
public event EventHandler OnApplyRecordCallBack;
|
|
/// <summary>
|
|
/// Occurs when [on clear call back].
|
|
/// </summary>
|
|
public event EventHandler OnClearCallBack;
|
|
/// <summary>
|
|
/// Occurs when [on copy record call back].
|
|
/// </summary>
|
|
public event EventHandler OnCopyRecordCallBack;
|
|
/// <summary>
|
|
/// Occurs when [on print call back].
|
|
/// </summary>
|
|
public event EventHandler OnPrintCallBack;
|
|
/// <summary>
|
|
/// Occurs when [on close callback].
|
|
/// </summary>
|
|
public event EventHandler OnCloseCallback;
|
|
#endregion
|
|
|
|
public ModulePanelEx()
|
|
{
|
|
SetStyle(ControlStyles.OptimizedDoubleBuffer | ControlStyles.ResizeRedraw | ControlStyles.Selectable | ControlStyles.AllPaintingInWmPaint | ControlStyles.UserPaint | ControlStyles.SupportsTransparentBackColor, true);
|
|
InitializeComponent();
|
|
this.scc_container.PanelVisibility = SplitPanelVisibility.Panel1;
|
|
this.simpleButton1.Click += simpleButton1_Click;
|
|
this.btnClear.Click += OnBtnClearClick;
|
|
this.btnCopyNew.Click += OnBtnCopyNewClick;
|
|
this.btnAdd.Click += OnAddClick;
|
|
this.btnUpdate.Click += OnUpdateClick;
|
|
this.btnApply.Click += OnApplyClick;
|
|
this.btnAttach.Click += OnBtnAttachClick;
|
|
this.btnClose.Click += OnCloseClick;
|
|
this.BtnMesSave.Click += OnMesSaveClick;
|
|
this.BtnMesClose.Click += OnBtnMesCloseClick;
|
|
}
|
|
|
|
#region private method
|
|
/// <summary>
|
|
/// <para>说明:控制滚动条是否存在横向的</para>
|
|
/// <para>创建人:王一帆</para>
|
|
/// <para>创建日期:2021-03-19 </para>
|
|
/// <para>修改人:</para>
|
|
/// <para>修改日期:</para>
|
|
/// <para>修改备注:</para>
|
|
/// <para>版本:1.0</para>
|
|
/// </summary>
|
|
//protected override void WndProc(ref System.Windows.Forms.Message m)
|
|
//{
|
|
// try
|
|
// {
|
|
// ShowScrollBar(this.panel1.Handle, (int)ScrollBarDirection.SB_HORZ, false); base.WndProc(ref m);
|
|
// }
|
|
// catch (Exception)
|
|
// {
|
|
|
|
// }
|
|
//}
|
|
/// <summary>
|
|
/// <para>说明:初始化常用操作、打印</para>
|
|
/// <para>创建人:龚宇超</para>
|
|
/// <para>创建日期:2017-11-03 </para>
|
|
/// <para>修改人:</para>
|
|
/// <para>修改日期:</para>
|
|
/// <para>修改备注:</para>
|
|
/// <para>版本:1.0</para>
|
|
/// </summary>
|
|
private void InitializeCommonOperation()
|
|
{
|
|
// 常用操作
|
|
//bbi_clear = new BarButtonItem();
|
|
//bbi_clear.Caption = "清除页面";
|
|
//bbi_clear.ItemClick += new ItemClickEventHandler(OnClearItemClick);
|
|
|
|
//bbi_copy = new BarButtonItem();
|
|
//bbi_copy.Caption = "复制新增";
|
|
//bbi_copy.ItemClick += new ItemClickEventHandler(OnCopyItemClick);
|
|
|
|
//bbi_attach = new BarButtonItem();
|
|
//bbi_attach.Caption = "附件管理";
|
|
//bbi_attach.Tag = "附件管理";
|
|
//bbi_attach.ItemClick += new ItemClickEventHandler(OnAttachItemClick);
|
|
|
|
//bbi_print = new BarButtonItem();
|
|
//bbi_print.Caption = "常规打印";
|
|
//bbi_print.ItemClick += new ItemClickEventHandler(bbi_print_ItemClick);
|
|
|
|
//pm_oper.AddItem(bbi_clear);
|
|
//pm_oper.AddItem(bbi_copy);
|
|
//pm_oper.AddItem(bbi_attach);
|
|
//pm_oper.AddItem(bbi_print);
|
|
|
|
// 常用打印
|
|
//if (!string.IsNullOrEmpty(this._printFile))
|
|
//{
|
|
// String[] strs = this._printFile.Split('|');
|
|
// for (int i = 0; i < strs.Length; i++)
|
|
// {
|
|
// BarButtonItem bbi = new BarButtonItem();
|
|
// int index = i + 1;
|
|
// bbi.Caption = strs[i].Replace(".rmf", "");
|
|
// bbi.Tag = strs[i];
|
|
// bbi.ItemClick += new ItemClickEventHandler(bbi_ItemClick);
|
|
// pm_print.AddItem(bbi);
|
|
// }
|
|
//}
|
|
}
|
|
/// <summary>
|
|
/// <para>说明:初始化按钮</para>
|
|
/// <para>创建人:龚宇超</para>
|
|
/// <para>创建日期:2017-11-08 </para>
|
|
/// <para>修改人:</para>
|
|
/// <para>修改日期:</para>
|
|
/// <para>修改备注:</para>
|
|
/// <para>版本:1.0</para>
|
|
/// </summary>
|
|
private void InitializeButton()
|
|
{
|
|
// 清除按钮是否可用
|
|
btnClear.Enabled = this.SysModel.ClearAllEnable;
|
|
// 修改状态时、有权限时 可用
|
|
btnCopyNew.Enabled = btnUpdate.Enabled = !string.IsNullOrWhiteSpace(this.PrimaryValue) && "0".Equals(IsView);
|
|
// 配置按钮可用 显示
|
|
btnCopyNew.Enabled = this.SysModel.AddEnable && this.SysModel.AddCopyEnabled;
|
|
// 配置有目录结构(显示)、修改状态(可用)
|
|
if (this.SysModel.HideAttachBtn)
|
|
{
|
|
btnAttach.Visible = false;
|
|
}
|
|
else
|
|
{
|
|
btnAttach.Visible = this.SysModel.MenuDirId > 0;
|
|
}
|
|
btnAttach.Enabled = !string.IsNullOrWhiteSpace(this.PrimaryValue);
|
|
int AttachCount = AttachImpl.GetFileCount(this.SysModel.MenuDirId + "", this.PrimaryValue);
|
|
this.btnAttach.Text = AttachCount > 0 ? "附件管理" + "(" + AttachCount + ")" : this.btnAttach.Text;
|
|
// 配置有打印模版(显示)、修改状态时(可用),已调整为支持多个打印文件
|
|
//bbi_print.Visibility = !string.IsNullOrWhiteSpace(this.SysModel.PrintFile) ? BarItemVisibility.Always : BarItemVisibility.Never;
|
|
//bbi_print.Enabled = !string.IsNullOrWhiteSpace(this.PrimaryValue);
|
|
// 添加状态时、有权限时 可用
|
|
btnAdd.Enabled = string.IsNullOrWhiteSpace(this.PrimaryValue) && "0".Equals(IsView);
|
|
// 配置有流转步骤(显示)、配置按钮可用、有权限时 可用
|
|
btnApply.Enabled = (this.SysModel.SaveApplyEnable || !string.IsNullOrWhiteSpace(this.PrimaryValue)) && "0".Equals(IsView) && BaseModuleImpl.HasStepFlow(this.Model.ModuleCode);
|
|
|
|
|
|
// 常用打印
|
|
this.InitializePrintFile();
|
|
// 常用工具
|
|
this.InitializeCommonTool();
|
|
if (!BaseModuleImpl.HasStepFlow(this.Model.ModuleCode)|| this.SysModel.HideReviewBut)
|
|
{
|
|
this.btnApply.Visible = false;
|
|
this.btnAdd.Location = this.btnUpdate.Location;
|
|
this.btnUpdate.Location = this.btnApply.Location;
|
|
}
|
|
// 设置文本
|
|
btnAdd.Text = !string.IsNullOrWhiteSpace(this.SysModel.AddCaption) ? this.SysModel.AddCaption : "添加保存(&A)";
|
|
btnUpdate.Text = !string.IsNullOrWhiteSpace(this.SysModel.ModifyCaption) ? this.SysModel.ModifyCaption : "修改保存(&E)";
|
|
btnApply.Text = !string.IsNullOrWhiteSpace(this.SysModel.ApplyCaption) ? this.SysModel.ApplyCaption : "提交审核(&R)";
|
|
|
|
//隐藏帮助文档按钮
|
|
if (SystemInfo.Instance.HideHelpDocument) this.simpleButton1.Visible = false;
|
|
|
|
}
|
|
/// <summary>
|
|
/// <para>说明:初始化打印模版</para>
|
|
/// <para>创建人:龚宇超</para>
|
|
/// <para>创建日期:2018-04-08 </para>
|
|
/// <para>修改人:</para>
|
|
/// <para>修改日期:</para>
|
|
/// <para>修改备注:</para>
|
|
/// <para>版本:1.0</para>
|
|
/// </summary>
|
|
private void InitializePrintFile()
|
|
{
|
|
DataTable printTable = BaseImpl.GetPrintTemp70(this.Model.ModuleCode);
|
|
|
|
if (printTable.Rows.Count > 0)
|
|
{
|
|
for (int i = 0; i < printTable.Rows.Count; i++)
|
|
{
|
|
DataRow item = printTable.Rows[i];
|
|
BarButtonItem bbi = new BarButtonItem();
|
|
int index = i + 1;
|
|
bbi.Caption = (item["printFile"] + "").Replace(".rmf", "").Replace(".frx", "");
|
|
bbi.Tag = item;
|
|
bbi.ItemClick += new ItemClickEventHandler(OnPrintItem70Click);
|
|
pm_print.AddItem(bbi);
|
|
}
|
|
}
|
|
else
|
|
{
|
|
string[] files = this.SysModel.PrintFile.Split('|');
|
|
for (int i = 0; i < files.Length; i++)
|
|
{
|
|
string fileName = files[i];
|
|
if (!string.IsNullOrWhiteSpace(fileName))
|
|
{
|
|
BarButtonItem itemPrint = new BarButtonItem();
|
|
int index = i + 1;
|
|
itemPrint.Caption = files[i].Replace(".rmf", "").Replace(".frx", "");
|
|
itemPrint.Tag = files[i];
|
|
itemPrint.ItemClick += new ItemClickEventHandler(OnCustomPrintItemClick);
|
|
pm_print.AddItem(itemPrint);
|
|
}
|
|
}
|
|
}
|
|
ddb_print.Visible = !string.IsNullOrEmpty(this.SysModel.PrintFile) && printTable.Rows.Count == 0;
|
|
}
|
|
/// <summary>
|
|
/// <para>说明:初始化常用工具</para>
|
|
/// <para>创建人:龚宇超</para>
|
|
/// <para>创建日期:2018-04-09 </para>
|
|
/// <para>修改人:</para>
|
|
/// <para>修改日期:</para>
|
|
/// <para>修改备注:</para>
|
|
/// <para>版本:1.0</para>
|
|
/// </summary>
|
|
private void InitializeCommonTool()
|
|
{
|
|
if (!ddb_print.Visible)
|
|
this.ddb_common.Location = new Point(81, 0);
|
|
DataTable tableCommon = BaseModuleImpl.GetBaseGridRightMenus(this.Model.ModuleCode, ModuleType.BaseModuleAdd);
|
|
int i = 0, x = 4;
|
|
foreach (DataRow item in tableCommon.Rows)
|
|
{
|
|
if (i > 1)
|
|
{
|
|
BarButtonItem itemCommon = new BarButtonItem();
|
|
itemCommon.Caption = item["menuname"] + "";
|
|
itemCommon.Tag = item;
|
|
itemCommon.ItemClick += new ItemClickEventHandler(OnCommonItemClick);
|
|
pm_common.AddItem(itemCommon);
|
|
}
|
|
else
|
|
{
|
|
if (panelControl1.Visible == false)
|
|
{
|
|
BarButtonItem nitemCommon = new BarButtonItem();
|
|
nitemCommon.Caption = item["menuname"] + "";
|
|
nitemCommon.Tag = item;
|
|
nitemCommon.ItemClick += new ItemClickEventHandler(OnCommonItemClick);
|
|
pm_common.AddItem(nitemCommon);
|
|
}
|
|
else
|
|
{
|
|
SimpleButton itemCommon = new SimpleButton();
|
|
//itemCommon.AutoSize = true;
|
|
itemCommon.Text = item["menuname"] + "";
|
|
itemCommon.Tag = item;
|
|
itemCommon.Size = new System.Drawing.Size(120, 49);
|
|
itemCommon.Font = new Font("微软雅黑", 12);
|
|
itemCommon.Click += new EventHandler(itemCommon_Click);
|
|
itemCommon.Location = new Point(x + 6, 6);
|
|
x += itemCommon.Width + 6;
|
|
panelControl1.Controls.Add(itemCommon);
|
|
i++;
|
|
}
|
|
}
|
|
|
|
}
|
|
this.ddb_common.Visible = tableCommon != null && tableCommon.Rows.Count > 0;
|
|
this.ddb_common.Click += Ddb_common_Click;
|
|
}
|
|
|
|
/// <summary>
|
|
/// 判断常用工具中的条件
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
private void Ddb_common_Click(object sender, EventArgs e)
|
|
{
|
|
foreach (BarItemLink itemLink in this.pm_common.ItemLinks)
|
|
{
|
|
DataRow rowItem = itemLink.Item.Tag as DataRow;
|
|
if (rowItem != null && rowItem.Table.Columns.Contains("MenuCond"))
|
|
{
|
|
string menuCond = rowItem["MenuCond"] + "";
|
|
string menuCaption = itemLink.Caption;
|
|
|
|
if (!string.IsNullOrEmpty(menuCond))
|
|
{
|
|
try
|
|
{
|
|
bool result = true;
|
|
menuCond = this.ControlObj.ReplaceControlValue(menuCond);
|
|
if (menuCond.StartsWith("@") || menuCond.StartsWith("!"))
|
|
{
|
|
result = "1".Equals(BaseImpl.GetDefaultValue(menuCond));
|
|
}
|
|
else
|
|
{
|
|
result = ReplaceHelper.EvalCond(menuCond);
|
|
}
|
|
itemLink.Item.Enabled = result;
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
MessageUtil.Show("[" + menuCaption + "] " + ResourceKeys.SetRightMenuCondFault);
|
|
LogHelper.Instance.WriteError(ex);
|
|
LogUtil.WriteError("验证可操作条件出错!", ex);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// <para>说明:常用工具点击</para>
|
|
/// <para>创建人:龚宇超</para>
|
|
/// <para>创建日期:2017-11-27 </para>
|
|
/// <para>修改人:</para>
|
|
/// <para>修改日期:</para>
|
|
/// <para>修改备注:</para>
|
|
/// <para>版本:1.0</para>
|
|
/// </summary>
|
|
/// <param name="sender">The source of the event.</param>
|
|
/// <param name="e">The <see cref="ItemClickEventArgs"/> instance containing the event data.</param>
|
|
protected void itemCommon_Click(object sender, EventArgs e)
|
|
{
|
|
try
|
|
{
|
|
SimpleButton btn = sender as SimpleButton;
|
|
DataRow rowItem = btn.Tag as DataRow;
|
|
CommonMenu menu = new CommonMenu(this.Model, this.ControlObj);
|
|
menu.Apply(rowItem);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
string Message = ErrorMessage.PromptErrorMessage(ex);
|
|
MessageUtil.Show(Message, ex.Message);
|
|
}
|
|
|
|
}
|
|
/// <summary>
|
|
/// <para>说明:初始化身份证阅读器</para>
|
|
/// <para>创建人:龚宇超</para>
|
|
/// <para>创建日期:2018-05-31 </para>
|
|
/// <para>修改人:</para>
|
|
/// <para>修改日期:</para>
|
|
/// <para>修改备注:</para>
|
|
/// <para>版本:1.0</para>
|
|
/// </summary>
|
|
private void InitializeIDCard()
|
|
{
|
|
try
|
|
{
|
|
this.IsCard = this.ControlObj != null && this.ControlObj.ControlModels.FirstOrDefault(x => x.Sign > 0) != null;
|
|
|
|
if (this.IsCard)
|
|
{
|
|
this.IDCardThread = new Thread(OnReadCard);
|
|
this.IDCardThread.IsBackground = true;
|
|
this.IDCardThread.Start();
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
LogUtil.WriteError(SysModel.MenuName + "初始化身份证阅读器出错", ex);
|
|
LogHelper.Instance.WriteLog(ex.StackTrace);
|
|
MessageUtil.Show(SysModel.MenuName + "初始化身份证阅读器出错" + "\n" + ex.Message);
|
|
}
|
|
}
|
|
/// <summary>
|
|
/// <para>说明:设置修改数据</para>
|
|
/// <para>创建人:龚宇超</para>
|
|
/// <para>创建日期:2017-11-09 </para>
|
|
/// <para>修改人:</para>
|
|
/// <para>修改日期:</para>
|
|
/// <para>修改备注:</para>
|
|
/// <para>版本:1.0</para>
|
|
/// </summary>
|
|
private void SetUpdateData(bool FirstLoading = true)
|
|
{
|
|
//外面表格搜索条件赋值
|
|
if (!string.IsNullOrWhiteSpace(SearchObject) && SavaState)
|
|
{
|
|
foreach (string item in SearchObject.Split('|'))
|
|
{
|
|
string name = item.Split('=')[0];
|
|
string value = item.Split('=')[1];
|
|
this.ControlObj.SetControlValue(name, value);
|
|
}
|
|
|
|
}
|
|
|
|
if (!string.IsNullOrWhiteSpace(this.PrimaryValue))
|
|
{
|
|
// 修改默认赋值
|
|
string sqlValue = ReplaceHelper.ReplaceWhereCond(this.SysModel.MenuSql);
|
|
sqlValue = string.Format("{0} AND {1}='{2}'", sqlValue, this.PrimaryKey, this.PrimaryValue);
|
|
|
|
DataTable tableResult = BaseImpl.GetDataTableResult(sqlValue);
|
|
if (tableResult != null && tableResult.Rows.Count > 0)
|
|
{
|
|
DataRow rowItem = tableResult.Rows[0];
|
|
|
|
this.ControlObj.CurrentData = rowItem;
|
|
this.SetSpecies(rowItem);
|
|
this.ControlObj.SetAllControlValue(rowItem);
|
|
// 同步本地数据,用于关闭时检查数据是否已修改.
|
|
this.ControlObj.SyncLocalModel();
|
|
}
|
|
}
|
|
if (!string.IsNullOrWhiteSpace(UnionKey) && !string.IsNullOrWhiteSpace(UnionValue))
|
|
{
|
|
this.ControlObj.SetControlValue(UnionKey, UnionValue);
|
|
}
|
|
//不如不是初始化时进入,就不加载配置数据源sql(添加或者修改后,执行赋值sql会导致保存的数据被覆盖)
|
|
if (!string.IsNullOrWhiteSpace(this.ControlSql) && FirstLoading)
|
|
{
|
|
DataRow rowItem = BaseImpl.GetDataRowResult(this.ControlSql);
|
|
this.ControlObj.CurrentData = rowItem;
|
|
this.ControlObj.SetAllControlValue(rowItem);
|
|
this.ControlObj.SyncLocalModel();
|
|
}
|
|
this.ControlObj.CanExecControl = true;
|
|
|
|
if (this.scc_container.PanelVisibility == SplitPanelVisibility.Both)
|
|
{
|
|
OnSelectedPageChanged(null, null);
|
|
}
|
|
}
|
|
/// <summary>
|
|
/// <para>说明:设置图片事件</para>
|
|
/// <para>创建人:龚宇超</para>
|
|
/// <para>创建日期:2018-02-27 </para>
|
|
/// <para>修改人:</para>
|
|
/// <para>修改日期:</para>
|
|
/// <para>修改备注:</para>
|
|
/// <para>版本:1.0</para>
|
|
/// </summary>
|
|
private void SetImageEvent(DataTable table)
|
|
{
|
|
if (table == null || table.Rows.Count == 0) return;
|
|
DataRow[] imageRows = table.Select("fieldTypeId=" + (int)ControlType.LabPicEx);
|
|
|
|
foreach (DataRow item in imageRows)
|
|
{
|
|
string fieldName = item["fieldName"] + "";
|
|
LabelImageEdit imageEdit = this.ControlObj.FindControl(fieldName) as LabelImageEdit;
|
|
if (imageEdit != null)
|
|
{
|
|
//imageEdit.UnionEvent += new LabelImageEdit.UnionEventHander(OnImageUnionEvent);
|
|
imageEdit.UploadEvent += new LabelImageEdit.UploadEventHander(OnImageUploadEvent);
|
|
imageEdit.DeleteEvent += new LabelImageEdit.DeleteEventHander(OnImageDeleteEvent);
|
|
//AttachHelper.OnUploadSuccess += new EventHandler(OnAttachUploadSuccess);
|
|
//AttachHelper.OnDownLoadSuccess += new EventHandler(OnAttachDownLoadSuccess);
|
|
}
|
|
}
|
|
}
|
|
/// <summary>
|
|
/// <para>说明:设置扫码控件事件</para>
|
|
/// <para>创建人:龚宇超</para>
|
|
/// <para>创建日期:2018-05-25 </para>
|
|
/// <para>修改人:</para>
|
|
/// <para>修改日期:</para>
|
|
/// <para>修改备注:</para>
|
|
/// <para>版本:1.0</para>
|
|
/// </summary>
|
|
private void SetScanEvent()
|
|
{
|
|
if (this.ControlObj != null)
|
|
{
|
|
BaseUserControl[] controls = this.ControlObj.FindControls(ControlType.LabPcSacn);
|
|
controls = controls.Length > 0 ? controls : this.ControlObj.FindControls(ControlType.LabPcSacn);
|
|
if (controls != null && controls.Length > 0)
|
|
{
|
|
// 为第一个扫码控件绑定回车事件
|
|
this._scanEdit = controls[0] as LabelTextEdit;
|
|
if (this._scanEdit != null)
|
|
{
|
|
this._scanEdit.TabIndex = 1;
|
|
this._scanEdit.TextEdit.KeyDown += new KeyEventHandler(OnScanTextEditKeyDown);
|
|
this._scanEdit.Focus();
|
|
this._scanEdit.TextEdit.Focus();
|
|
}
|
|
}
|
|
}
|
|
}
|
|
/// <summary>
|
|
/// <para>说明:设置分类数据</para>
|
|
/// <para>创建人:龚宇超</para>
|
|
/// <para>创建日期:2017-11-09 </para>
|
|
/// <para>修改人:</para>
|
|
/// <para>修改日期:</para>
|
|
/// <para>修改备注:</para>
|
|
/// <para>版本:1.0</para>
|
|
/// </summary>
|
|
private void SetSpecies(DataRow rowItem)
|
|
{
|
|
try
|
|
{
|
|
int menuType = this.SysModel.MenuType;
|
|
if (menuType == 1 || menuType == 2)
|
|
{
|
|
DataRow leftField = BaseModuleImpl.GetBaseLeftTreeField(this.Model.ModuleCode);
|
|
if (leftField != null)
|
|
{
|
|
string leftSpeciesNo = leftField["fieldsqlid"] + "";
|
|
string leftSpeciesName = leftField["fieldsqlname"] + "";
|
|
string leftSpeciesSql = ReplaceHelper.ReplaceWhereCond(leftField["fieldsql"] + "");
|
|
|
|
string parentKeyValue = rowItem.Table.Columns.Contains(leftSpeciesNo) && !string.IsNullOrWhiteSpace(leftSpeciesNo) ? rowItem[leftSpeciesNo] + "" : "";
|
|
string parentNameValue = string.Empty;
|
|
|
|
DataTable leftTable = BaseImpl.GetDataTableResult(leftSpeciesSql + string.Format(" and {0}='{1}'", leftSpeciesNo, parentKeyValue));
|
|
if (leftTable != null && leftTable.Rows.Count > 0)
|
|
{
|
|
parentNameValue = leftTable.Rows[0][leftSpeciesName] + "";
|
|
}
|
|
// 设置父节点相关数据
|
|
this.ControlObj.ParentKey = this.ParentKey = parentKeyValue;
|
|
this.ControlObj.ParentValue = this.ParentValue = parentNameValue;
|
|
}
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
LogHelper.Instance.WriteError(ex);
|
|
LogUtil.WriteError(SysModel.MenuName + "分类数据出错", ex);
|
|
MessageUtil.Show(SysModel.MenuName + "分类数据出错" + ex.Message);
|
|
}
|
|
}
|
|
/// <summary>
|
|
/// <para>说明:设置按钮位置</para>
|
|
/// <para>创建人:龚宇超</para>
|
|
/// <para>创建日期: </para>
|
|
/// <para>修改人:</para>
|
|
/// <para>修改日期:</para>
|
|
/// <para>修改备注:</para>
|
|
/// <para>版本:1.0</para>
|
|
/// </summary>
|
|
private void SetControlLocation()
|
|
{
|
|
int left = 2, space = 2;
|
|
int width = this.pl_buttom.Width;
|
|
System.Windows.Forms.Control[] list = this.panelControl2.Controls.Cast<System.Windows.Forms.Control>().Where(x => x.Visible).OrderBy(y => y.TabIndex).ToArray();
|
|
foreach (var item in list)
|
|
{
|
|
item.Left = left + space;
|
|
left = item.Left + item.Width;
|
|
}
|
|
this.panelControl2.Width = left;
|
|
}
|
|
#endregion
|
|
|
|
#region public method
|
|
/// <summary>
|
|
/// <para>说明:初始化模块</para>
|
|
/// <para>创建人:龚宇超</para>
|
|
/// <para>创建日期:2017-11-03 </para>
|
|
/// <para>修改人:</para>
|
|
/// <para>修改日期:</para>
|
|
/// <para>修改备注:</para>
|
|
/// <para>版本:1.0</para>
|
|
/// </summary>
|
|
/// <param name="menuRow">The menu row.</param>
|
|
public void InitializeControl(ModuleModel sysModel, DynamicModel dyncModel, bool IsAutoScroll = false)
|
|
{
|
|
try
|
|
{
|
|
if (sysModel != null && dyncModel != null)
|
|
{
|
|
this.SysModel = sysModel;
|
|
this.Model = dyncModel;
|
|
|
|
|
|
this._leftField = BaseModuleImpl.GetBaseLeftField(this.Model.ModuleCode);
|
|
this._controlTable = BaseModuleImpl.GetControlLocation(this.SysModel.FormKey, this.Model.ModuleCode);
|
|
this.lteOper.EditText = ERPInfo.Instance.UserName;
|
|
this.InitializeCommonOperation();
|
|
this.InitializeButton();
|
|
this.pl_main.Click += new EventHandler(OnMainClick);
|
|
this.ControlObj = new MyControl()
|
|
{
|
|
ParentKey = this.ParentKey,
|
|
ParentValue = this.ParentValue,
|
|
SystemModel = sysModel,
|
|
CanExecControl = string.IsNullOrEmpty(this.PrimaryValue),
|
|
PrimaryValue = this.PrimaryValue,
|
|
OtherParams = dyncModel.OtherParams(),
|
|
rightItemLinks = pm_common.ItemLinks,
|
|
popUpDyncModel = this.Model,
|
|
Model = this.Model
|
|
};
|
|
|
|
this.ControlObj.SaveCondTab= BaseModuleImpl.GetClientCond(this.Model.ModuleCode);
|
|
|
|
this.SetButtonPanelVisible("lskj.pubadd4.dll".Equals(this.SysModel.MenuAddName.ToLower()));
|
|
bool topVisible = false;
|
|
if ("lskj.pubadd.dll".Equals((this.SysModel.MenuAddName).ToLower()) || "lskj.pubadd2.dll".Equals((this.SysModel.MenuAddName).ToLower()))
|
|
{
|
|
topVisible = true;
|
|
}
|
|
this.SetTopPanelVisible(topVisible);
|
|
//this.ControlHeight = this.ControlObj.InitControl(this._controlTable, this.pl_main, BaseModuleImpl.GetAddGroupData(this.SysModel.FormKey));
|
|
//DataTable divider = BaseModuleImpl.GetDividerData(this.SysModel.FormKey);
|
|
this.ControlHeight = this.ControlObj.InitControl(this._controlTable, this.pl_main, BaseModuleImpl.GetAddGroupData(this.SysModel.FormKey), true);//divider
|
|
this.pl_main.AutoScroll = IsAutoScroll;
|
|
this.InitSpeciesBtn();
|
|
this.pl_main.HorizontalScroll.Visible = false;//设置禁止水平滚动条
|
|
if (!this.pl_buttom.Visible)
|
|
{
|
|
pl_main.Height += pl_buttom.Height;
|
|
}
|
|
if (!this.pl_main_top.Visible)
|
|
{
|
|
pl_main.Height += pl_main_top.Height;
|
|
}
|
|
this.ControlObj.OnDataSourceBindCallBack += new EventHandler(OnControlObjOnDataSourceBindCallBack);
|
|
this.SetScanEvent();
|
|
this.InitializeIDCard();
|
|
this.SetImageEvent(this._controlTable);
|
|
this.GetPrintOtherParam();
|
|
if (Model.HasReadPrivilege())
|
|
{
|
|
btnUpdate.Enabled = btnApply.Enabled = btnCopyNew.Enabled = BtnMesSave.Enabled = btnClear.Enabled = false;
|
|
}
|
|
// 重排按钮位置
|
|
this.SetControlLocation();
|
|
//设置下方页签
|
|
if (DetailsData != null && DetailsData.Length > 0)
|
|
{
|
|
this.CreateTabDetail();
|
|
this.tcButtom.TabControlObj.SelectedPageChanged += this.OnSelectedPageChanged;
|
|
this.tcButtom.TabControlObj.SelectedPageChanging += this.OnSelectedPageChanging;
|
|
this.scc_container.PanelVisibility = SplitPanelVisibility.Both;
|
|
}
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
|
|
string Message = ErrorMessage.PromptErrorMessage(ex);
|
|
MessageUtil.Show(Message, ex.Message);
|
|
}
|
|
|
|
}
|
|
/// <summary>
|
|
/// 切换选项卡
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
protected void OnSelectedPageChanging(object sender, TabPageChangingEventArgs e)
|
|
{
|
|
try
|
|
{
|
|
XtraTabPage page = e.Page;
|
|
if (page != null)
|
|
{
|
|
if (e.PrevPage == this.tcButtom.TabControlObj.TabPages[0] && string.IsNullOrEmpty(this.PrimaryValue))
|
|
{
|
|
MessageUtil.Show(ResourceKeys.BeforeSaveData);
|
|
e.Cancel = true;
|
|
}
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
string Message = ErrorMessage.PromptErrorMessage(ex);
|
|
MessageUtil.Show(Message, ex.Message);
|
|
}
|
|
}
|
|
/// <summary>
|
|
/// <para>说明:切换标签刷新主键值</para>
|
|
/// <para>创建人:龚宇超</para>
|
|
/// <para>创建日期:2018-04-09 </para>
|
|
/// <para>修改人:</para>
|
|
/// <para>修改日期:</para>
|
|
/// <para>修改备注:</para>
|
|
/// <para>版本:1.0</para>
|
|
/// </summary>
|
|
/// <param name="sender">The source of the event.</param>
|
|
/// <param name="e">The <see cref="TabPageChangedEventArgs"/> instance containing the event data.</param>
|
|
private void OnSelectedPageChanged(object sender, TabPageChangedEventArgs e)
|
|
{
|
|
try
|
|
{
|
|
XtraTabPage tabPage = null;
|
|
if (e == null)
|
|
{
|
|
tabPage = this.tcButtom.TabControlObj.SelectedTabPage;
|
|
}
|
|
else
|
|
{
|
|
tabPage = e.Page;
|
|
}
|
|
|
|
//OperatePanelControlObj.Visible = true;
|
|
//if (tabPage.Tag is ModuleGridEx) OperatePanelControlObj.Visible = false;
|
|
//if (!(tabPage.Tag is GridDetailModel)) return;
|
|
//OperatePanelControlObj.Visible = false;
|
|
if (tabPage.Controls.Count == 0)
|
|
{
|
|
|
|
GridDetailModel detailModel = tabPage.Tag as GridDetailModel;
|
|
ModuleModel moduleModel = null;
|
|
DynamicAddModel addModel = new DynamicAddModel(new string[] {
|
|
detailModel.DetailName,
|
|
ERPInfo.Instance.UserId,
|
|
ERPInfo.Instance.UserName,
|
|
"1",detailModel.UnionModule,"","",""
|
|
});
|
|
|
|
if (detailModel.IsWebView)
|
|
{
|
|
// 加载网页
|
|
string url = detailModel.DetailSql.StartsWith("http") ? detailModel.DetailSql : SystemInfo.Instance.OAUrl + detailModel.DetailSql;
|
|
if (!string.IsNullOrWhiteSpace(this.ParentKey))
|
|
{
|
|
string codeSql = "select";
|
|
codeSql += string.Format(" '{0}' as {1}", this.PrimaryValue, this.PrimaryKey);
|
|
url = ReplaceHelper.ReplaceRowParam(BaseImpl.GetDataRowResult(codeSql), ReplaceHelper.ReplaceWhereCond(detailModel.DetailSql));
|
|
}
|
|
if (this.ControlObj.CurrentData != null) url = ReplaceHelper.ReplaceRowParam(this.ControlObj.CurrentData, url);
|
|
//url= System.Web.HttpUtility.UrlEncode(url);
|
|
if (SystemInfo.Instance.PrimitiveBrowser)
|
|
{
|
|
FrmMiniBlink webView = new FrmMiniBlink();
|
|
webView.IsDownVerify = true;
|
|
webView.Dock = DockStyle.Fill;
|
|
webView.Tag = detailModel;
|
|
tabPage.Tag = webView;
|
|
tabPage.Controls.Add(webView);
|
|
webView.LoadUrl(ReplaceHelper.ReplaceUserInfo(url));
|
|
}
|
|
else
|
|
{
|
|
FrmWebBrowser webView = new FrmWebBrowser();
|
|
webView.Dock = DockStyle.Fill;
|
|
webView.Tag = detailModel;
|
|
tabPage.Tag = webView;
|
|
tabPage.Controls.Add(webView);
|
|
webView.FrmLoad(ReplaceHelper.ReplaceUserInfo(url));
|
|
}
|
|
}
|
|
else if (detailModel.IsWebView2)
|
|
{
|
|
// 加载网页
|
|
string url = detailModel.DetailSql.StartsWith("http") ? detailModel.DetailSql : SystemInfo.Instance.OAUrl + detailModel.DetailSql;
|
|
//url= System.Web.HttpUtility.UrlEncode(url);
|
|
if (SystemInfo.Instance.PrimitiveBrowser)
|
|
{
|
|
FrmMiniBlink webView = new FrmMiniBlink();
|
|
webView.Dock = DockStyle.Fill;
|
|
webView.Tag = detailModel;
|
|
tabPage.Tag = webView;
|
|
tabPage.Controls.Add(webView);
|
|
webView.LoadUrl(ReplaceHelper.ReplaceUserInfo(url));
|
|
}
|
|
else
|
|
{
|
|
FrmWebBrowser2 webView = new FrmWebBrowser2();
|
|
webView.Dock = DockStyle.Fill;
|
|
webView.Tag = detailModel;
|
|
tabPage.Tag = webView;
|
|
tabPage.Controls.Add(webView);
|
|
webView.FrmLoad(ReplaceHelper.ReplaceUserInfo(url));
|
|
}
|
|
}
|
|
else if (detailModel.IsWebView3)
|
|
{
|
|
// 加载网页
|
|
string url = detailModel.DetailSql.StartsWith("http") ? detailModel.DetailSql : SystemInfo.Instance.OAUrl + detailModel.DetailSql;
|
|
//url= System.Web.HttpUtility.UrlEncode(url);
|
|
if (SystemInfo.Instance.PrimitiveBrowser)
|
|
{
|
|
FrmMiniBlink webView = new FrmMiniBlink();
|
|
webView.AllowDownload = false;
|
|
webView.Dock = DockStyle.Fill;
|
|
webView.Tag = detailModel;
|
|
tabPage.Tag = webView;
|
|
tabPage.Controls.Add(webView);
|
|
webView.LoadUrl(ReplaceHelper.ReplaceUserInfo(url));
|
|
}
|
|
else
|
|
{
|
|
FrmWebBrowser2 webView = new FrmWebBrowser2();
|
|
webView.Dock = DockStyle.Fill;
|
|
webView.Tag = detailModel;
|
|
webView.AllowDownload = false;
|
|
tabPage.Tag = webView;
|
|
tabPage.Controls.Add(webView);
|
|
webView.FrmLoad(ReplaceHelper.ReplaceUserInfo(url));
|
|
}
|
|
}
|
|
else if (string.IsNullOrEmpty(detailModel.UnionModule))
|
|
{
|
|
PanelControl plBottom = new PanelControl();
|
|
plBottom.Dock = DockStyle.Bottom;
|
|
plBottom.Visible = false;
|
|
PanelControl plMain = new PanelControl();
|
|
plMain.Dock = DockStyle.Fill;
|
|
GridControlEx gridEx = detailModel.AutoMultiHeader == 1 ? new BandedGridControlEx() : new GridControlEx();
|
|
gridEx.Dock = DockStyle.Fill;
|
|
gridEx.Tag = detailModel;
|
|
gridEx.Parent = plMain;
|
|
gridEx.Model = this.Model;
|
|
gridEx.SysModel = this.SysModel;
|
|
gridEx.SetReadOnlyColumns(detailModel.GridColumns, detailModel.GridCustomColumnKey);
|
|
|
|
gridEx.SetGridRightMenus(BaseModuleImpl.GetBaseGridRightMenus(detailModel.FormKey), this.Model);
|
|
gridEx.SetGridRowColors(BaseModuleImpl.GetBaseGridRowColors(detailModel.FormKey));
|
|
if (detailModel.IsCheck == 1)//加载复选框
|
|
{
|
|
GridDragGrid.GridAddCheckBox(gridEx.GridView);
|
|
}
|
|
// 加载配置查询条件
|
|
if (Model != null && Model.IsDetailSearch)
|
|
{
|
|
plBottom.Visible = true;
|
|
MyControl searchObj = new MyControl(detailModel.DetailSql, gridEx);
|
|
plBottom.Height = searchObj.InitSearchControl(BaseModuleImpl.GetCustomQueryFields(detailModel.FormKey), plBottom);
|
|
}
|
|
tabPage.Tag = gridEx;
|
|
tabPage.Controls.AddRange(new PanelControl[] { plBottom, plMain });
|
|
if (detailModel.AutoRefresh)
|
|
{
|
|
if (tabPage == this.tcButtom.TabControlObj.TabPages[0] && string.IsNullOrEmpty(this.PrimaryValue))
|
|
{
|
|
return;
|
|
}
|
|
if (!string.IsNullOrWhiteSpace(this.ParentKey))
|
|
{
|
|
string codeSql = "select";
|
|
codeSql += string.Format(" '{0}' as {1}", this.PrimaryValue, this.PrimaryKey);
|
|
gridEx.SetGridViewDataSource(SqlHelper.ExecuteDataTable(ReplaceHelper.ReplaceRowParam(BaseImpl.GetDataRowResult(codeSql), ReplaceHelper.ReplaceWhereCond(detailModel.DetailSql))));
|
|
}
|
|
else if (this.ControlObj.CurrentData != null)
|
|
{
|
|
gridEx.SetGridViewDataSource(SqlHelper.ExecuteDataTable(ReplaceHelper.ReplaceRowParam(this.ControlObj.CurrentData, ReplaceHelper.ReplaceWhereCond(detailModel.DetailSql))));
|
|
}
|
|
// 自动刷新
|
|
}
|
|
}
|
|
else
|
|
{
|
|
|
|
moduleModel = new ModuleModel(MainImpl.GetSystemdllTab(detailModel.UnionModule));
|
|
ModuleGridEx moduleGrid = new ModuleGridEx();
|
|
moduleGrid.IsDetail = true;
|
|
moduleGrid.Dock = DockStyle.Fill;
|
|
moduleGrid.Tag = detailModel;
|
|
moduleGrid.ParentKeyField = string.IsNullOrEmpty(detailModel.UnionParentField) ? SysModel.ParmaryKey : detailModel.UnionParentField;
|
|
|
|
//直接在控件数据源中取值,控件可能是禁显状态(没用控件获取不到值)
|
|
if (!string.IsNullOrWhiteSpace(moduleGrid.ParentKeyField) && this.ControlObj.CurrentData.Table.Columns.Contains(moduleGrid.ParentKeyField))
|
|
{
|
|
moduleGrid.ParentKeyValue = moduleGrid.UnionValue = this.ControlObj.CurrentData[moduleGrid.ParentKeyField] + "";
|
|
}
|
|
|
|
//moduleGrid.ParentKeyValue = this.ModuleAddControl.ControlObj.GetControlValue(moduleGrid.ParentKeyField);
|
|
moduleGrid.DetailKeyField = detailModel.UnionValue;
|
|
moduleGrid.UnionKey = detailModel.UnionValue;
|
|
//moduleGrid.UnionValue = this.ModuleAddControl.ControlObj.GetControlValue(moduleGrid.ParentKeyField); //Model.ObjectId;
|
|
//moduleGrid.SearchControlSql = Model.ControlSql;
|
|
moduleGrid.InitializeControl(moduleModel, addModel);
|
|
moduleGrid.SearchObj.OnSearchBeforeCallBack += new SearchEventHandler(OnSearchBefore);
|
|
moduleGrid.SearchObj.OnSearchAfterCallBack += new EventHandler(OnSearchAfter);
|
|
Lskj.Control.Model.AutoSizeChange.ControllInitializeSize(moduleGrid);
|
|
tabPage.Controls.Add(moduleGrid);
|
|
tabPage.Tag = moduleGrid;
|
|
if (detailModel.AutoRefresh)
|
|
{
|
|
if (tabPage == this.tcButtom.TabControlObj.TabPages[0] && string.IsNullOrEmpty(this.PrimaryValue))
|
|
{
|
|
return;
|
|
}
|
|
moduleGrid.SearchObj.OnDataSourceBindCallBack += new EventHandler(OnMainSearchDataSourceBindCallBack);
|
|
}
|
|
}
|
|
}
|
|
else
|
|
{
|
|
if (tabPage == this.tcButtom.TabControlObj.TabPages[0] && string.IsNullOrEmpty(this.PrimaryValue))
|
|
{
|
|
return;
|
|
}
|
|
if (tabPage.Tag != null && tabPage.Tag is GridControlEx gridControlEx)
|
|
{
|
|
GridDetailModel detailModel = gridControlEx.Tag as GridDetailModel;
|
|
if (!string.IsNullOrWhiteSpace(this.ParentKey))
|
|
{
|
|
string codeSql = "select";
|
|
codeSql += string.Format(" '{0}' as {1}", this.PrimaryValue, this.PrimaryKey);
|
|
gridControlEx.SetGridViewDataSource(SqlHelper.ExecuteDataTable(ReplaceHelper.ReplaceRowParam(BaseImpl.GetDataRowResult(codeSql), ReplaceHelper.ReplaceWhereCond(detailModel.DetailSql))));
|
|
}
|
|
else if (this.ControlObj.CurrentData != null)
|
|
{
|
|
gridControlEx.SetGridViewDataSource(SqlHelper.ExecuteDataTable(ReplaceHelper.ReplaceRowParam(this.ControlObj.CurrentData, ReplaceHelper.ReplaceWhereCond(detailModel.DetailSql))));
|
|
}
|
|
}
|
|
else if (tabPage.Tag != null && tabPage.Tag is ModuleGridEx moduleGridEx)
|
|
{
|
|
moduleGridEx.SearchObj.SearchGrid();
|
|
}
|
|
else if (tabPage.Tag is FrmWebBrowser)
|
|
{
|
|
// 加载网页
|
|
FrmWebBrowser webView = tabPage.Tag as FrmWebBrowser;
|
|
GridDetailModel detailModel = webView.Tag as GridDetailModel;
|
|
string url = detailModel.DetailSql.StartsWith("http") ? detailModel.DetailSql : SystemInfo.Instance.OAUrl + detailModel.DetailSql;
|
|
if (!string.IsNullOrWhiteSpace(this.ParentKey))
|
|
{
|
|
string codeSql = "select";
|
|
codeSql += string.Format(" '{0}' as {1}", this.PrimaryValue, this.PrimaryKey);
|
|
url = ReplaceHelper.ReplaceRowParam(BaseImpl.GetDataRowResult(codeSql), ReplaceHelper.ReplaceWhereCond(detailModel.DetailSql));
|
|
}
|
|
if (this.ControlObj.CurrentData != null) url = ReplaceHelper.ReplaceRowParam(this.ControlObj.CurrentData, url);
|
|
webView.LoadUrl(url);
|
|
webView.Dock = DockStyle.Fill;
|
|
}
|
|
else if (tabPage.Tag is FrmWebBrowser2)
|
|
{
|
|
// 加载网页
|
|
FrmWebBrowser2 webView = tabPage.Tag as FrmWebBrowser2;
|
|
GridDetailModel detailModel = webView.Tag as GridDetailModel;
|
|
string url = detailModel.DetailSql.StartsWith("http") ? detailModel.DetailSql : SystemInfo.Instance.OAUrl + detailModel.DetailSql;
|
|
if (!string.IsNullOrWhiteSpace(this.ParentKey))
|
|
{
|
|
string codeSql = "select";
|
|
codeSql += string.Format(" '{0}' as {1}", this.PrimaryValue, this.PrimaryKey);
|
|
url = ReplaceHelper.ReplaceRowParam(BaseImpl.GetDataRowResult(codeSql), ReplaceHelper.ReplaceWhereCond(detailModel.DetailSql));
|
|
}
|
|
if (this.ControlObj.CurrentData != null) url = ReplaceHelper.ReplaceRowParam(this.ControlObj.CurrentData, url);
|
|
webView.LoadUrl(url);
|
|
webView.Dock = DockStyle.Fill;
|
|
|
|
}
|
|
else if (tabPage.Tag is FrmMiniBlink)
|
|
{
|
|
// 加载网页
|
|
FrmMiniBlink webView = tabPage.Tag as FrmMiniBlink;
|
|
GridDetailModel detailModel = webView.Tag as GridDetailModel;
|
|
string url = detailModel.DetailSql.StartsWith("http") ? detailModel.DetailSql : SystemInfo.Instance.OAUrl + detailModel.DetailSql;
|
|
if (!string.IsNullOrWhiteSpace(this.ParentKey))
|
|
{
|
|
string codeSql = "select";
|
|
codeSql += string.Format(" '{0}' as {1}", this.PrimaryValue, this.PrimaryKey);
|
|
url = ReplaceHelper.ReplaceRowParam(BaseImpl.GetDataRowResult(codeSql), ReplaceHelper.ReplaceWhereCond(detailModel.DetailSql));
|
|
}
|
|
if (this.ControlObj.CurrentData != null) url = ReplaceHelper.ReplaceRowParam(this.ControlObj.CurrentData, url);
|
|
webView.LoadUrl(url);
|
|
webView.Dock = DockStyle.Fill;
|
|
}
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
string Message = ErrorMessage.PromptErrorMessage(ex);
|
|
MessageUtil.Show(Message, ex.Message);
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// <para>说明:查询条件绑定完成查询数据</para>
|
|
/// <para>创建人:龚宇超</para>
|
|
/// <para>创建日期: </para>
|
|
/// <para>修改人:</para>
|
|
/// <para>修改日期:</para>
|
|
/// <para>修改备注:</para>
|
|
/// <para>版本:1.0</para>
|
|
/// </summary>
|
|
/// <param name="sender">The sender.</param>
|
|
/// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
|
|
protected void OnMainSearchDataSourceBindCallBack(object sender, EventArgs e)
|
|
{
|
|
try
|
|
{
|
|
MyControl searchobj = sender as MyControl;
|
|
searchobj.SearchGrid();
|
|
OnSearchAfter(null, null);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
string Message = ErrorMessage.PromptErrorMessage(ex);
|
|
MessageUtil.Show(Message, ex.Message);
|
|
}
|
|
|
|
}
|
|
|
|
/// <summary>
|
|
/// <para>说明:查询条件执行前</para>
|
|
/// <para>创建人:龚宇超</para>
|
|
/// <para>创建日期:2017-11-10 </para>
|
|
/// <para>修改人:</para>
|
|
/// <para>修改日期:</para>
|
|
/// <para>修改备注:</para>
|
|
/// <para>版本:1.0</para>
|
|
/// </summary>
|
|
/// <param name="sender">The sender.</param>
|
|
/// <param name="e">The e.</param>
|
|
protected void OnSearchBefore(object sender, SearchArgs e)
|
|
{
|
|
try
|
|
{
|
|
XtraTabPage tabPage = this.tcButtom.TabControlObj.SelectedTabPage;
|
|
if (plMainControlObj.Tag is XtraTabControl)
|
|
{
|
|
XtraTabControl xtr = plMainControlObj.Tag as XtraTabControl;
|
|
tabPage = xtr.SelectedTabPage;
|
|
}
|
|
if (tabPage != null)
|
|
{
|
|
ModuleGridEx moduleGrid = tabPage.Tag as ModuleGridEx;
|
|
GridDetailModel detailModel = moduleGrid.Tag as GridDetailModel;
|
|
|
|
moduleGrid.SearchObj.SearchGrid(detailModel.DetailSql + string.Format(" and {0}='{1}'", moduleGrid.DetailKeyField, moduleGrid.UnionValue));
|
|
}
|
|
e.Continue = false;
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
string Message = ErrorMessage.PromptErrorMessage(ex);
|
|
MessageUtil.Show(Message, ex.Message);
|
|
}
|
|
}
|
|
/// <summary>
|
|
/// <para>说明:查询条件执行后</para>
|
|
/// <para>创建人:龚宇超</para>
|
|
/// <para>创建日期:2017-11-10 </para>
|
|
/// <para>修改人:</para>
|
|
/// <para>修改日期:</para>
|
|
/// <para>修改备注:</para>
|
|
/// <para>版本:1.0</para>
|
|
/// </summary>
|
|
/// <param name="sender">The source of the event.</param>
|
|
/// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
|
|
protected void OnSearchAfter(object sender, EventArgs e)
|
|
{
|
|
try
|
|
{
|
|
XtraTabPage tabPage = this.tcButtom.TabControlObj.SelectedTabPage;
|
|
if (plMainControlObj.Tag is XtraTabControl)
|
|
{
|
|
XtraTabControl xtr = plMainControlObj.Tag as XtraTabControl;
|
|
tabPage = xtr.SelectedTabPage;
|
|
}
|
|
if (tabPage != null)
|
|
{
|
|
if (tabPage.Tag is ModuleGridEx)
|
|
{
|
|
ModuleGridEx moduleGrid = tabPage.Tag as ModuleGridEx;
|
|
GridDetailModel detailModel = moduleGrid.Tag as GridDetailModel;
|
|
tabPage.Text = detailModel.DetailName + "(" + moduleGrid.SearchObj.GridRowCount + "条)";
|
|
}
|
|
else if (tabPage.Tag is GridControlEx)
|
|
{
|
|
|
|
GridControlEx moduleGrid = tabPage.Tag as GridControlEx;
|
|
GridDetailModel detailModel = moduleGrid.Tag as GridDetailModel;
|
|
tabPage.Text = detailModel.DetailName + "(" + moduleGrid.DataRowCount() + "条)";
|
|
}
|
|
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
string Message = ErrorMessage.PromptErrorMessage(ex);
|
|
MessageUtil.Show(Message, ex.Message);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
/// <para>说明:初始化多标签</para>
|
|
/// <para>创建人:龚宇超</para>
|
|
/// <para>创建日期:2017-11-10 </para>
|
|
/// <para>修改人:</para>
|
|
/// <para>修改日期:</para>
|
|
/// <para>修改备注:</para>
|
|
/// <para>版本:1.0</para>
|
|
/// </summary>
|
|
private void CreateTabDetail()
|
|
{
|
|
|
|
bool isInside = false;
|
|
|
|
foreach (DataRow item in this.DetailsData)
|
|
{
|
|
|
|
|
|
XtraTabPage tabPage = new XtraTabPage();
|
|
GridDetailModel detailModel = new GridDetailModel(item, null, GridCustomColumnStruct.BaseDetailGridView);
|
|
if (!string.IsNullOrEmpty(detailModel.UnionModule))
|
|
{
|
|
ModuleModel moduleModel = new ModuleModel(MainImpl.GetSystemdllTab(detailModel.UnionModule));
|
|
if (string.IsNullOrWhiteSpace(moduleModel.FormKey))
|
|
{
|
|
MessageUtil.Show(detailModel.DetailName + "模块配置错误");
|
|
return;
|
|
}
|
|
detailModel.DetailSql = moduleModel.MenuSql;
|
|
}
|
|
detailModel.GridColumns = ReportImpl.GetReportDetailColumns(Model.ModuleCode, item["id"] + "");
|
|
tabPage.Text = detailModel.DetailName;
|
|
tabPage.Tag = detailModel;
|
|
|
|
this.tcButtom.TabControlObj.TabPages.Add(tabPage);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
/// 获取数据源缓存
|
|
/// </summary>
|
|
/// <param name="cachesDic"></param>
|
|
/// <param name="sysModel"></param>
|
|
/// <param name="dyncModel"></param>
|
|
/// <param name="IsAutoScroll"></param>
|
|
public void GetDataCaches(Dictionary<object, Hashtable> cachesDic, ModuleModel sysModel, DynamicModel dyncModel, bool IsAutoScroll = false)
|
|
{
|
|
}
|
|
|
|
/// <summary>
|
|
/// <para>说明:默认控件值触发改变事件</para>
|
|
/// <para>创建人:王一帆</para>
|
|
/// <para>创建日期:2021-04-28 </para>
|
|
/// <para>修改人:</para>
|
|
/// <para>修改日期:</para>
|
|
/// <para>修改备注:</para>
|
|
/// <para>版本:1.0</para>
|
|
/// </summary>
|
|
/// <param name="sender">The source of the event.</param>
|
|
/// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
|
|
private void InitSpeciesBtn()
|
|
{
|
|
//DataRow[]ControlTree=_controlTable.Select("fieldTypeld=" + "3");
|
|
//if (ControlTree != null && ControlTree.Count() > 0) {
|
|
|
|
// ControlModel model = this.ControlObj._models.FirstOrDefault(x => x.Sign == (int)cardType);
|
|
//}
|
|
// ControlModel model = new ControlModel();
|
|
|
|
// //lteSpeciesNo.TextEdit.KeyDown += new KeyEventHandler(OnTextEditKeyDown);
|
|
// lteSpeciesNo.TextEdit.TextChanged += new EventHandler(OnTextEditTextChanged);
|
|
//baseControl = textEdit;
|
|
}
|
|
|
|
/// <summary>
|
|
/// <para>说明:默认控件值触发改变事件</para>
|
|
/// <para>创建人:王一帆</para>
|
|
/// <para>创建日期:2021-04-28 </para>
|
|
/// <para>修改人:</para>
|
|
/// <para>修改日期:</para>
|
|
/// <para>修改备注:</para>
|
|
/// <para>版本:1.0</para>
|
|
/// </summary>
|
|
/// <param name="sender">The source of the event.</param>
|
|
/// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
|
|
void OnTextEditTextChanged(object sender, EventArgs e)
|
|
{
|
|
|
|
}
|
|
|
|
/// <summary>
|
|
/// <para>说明:点击空白处获取焦点</para>
|
|
/// <para>创建人:王一帆</para>
|
|
/// <para>创建日期: </para>
|
|
/// <para>修改人:</para>
|
|
/// <para>修改日期:</para>
|
|
/// <para>修改备注:</para>
|
|
/// <para>版本:1.0</para>
|
|
/// </summary>
|
|
/// <param name="sender">The source of the event.</param>
|
|
/// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
|
|
void OnMainClick(object sender, EventArgs e)
|
|
{
|
|
try
|
|
{
|
|
this.pl_main.Focus();
|
|
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
string Message = ErrorMessage.PromptErrorMessage(ex);
|
|
MessageUtil.Show(Message, ex.Message);
|
|
}
|
|
|
|
}
|
|
/// <summary>
|
|
/// <para>说明:数据绑定完成后加载数据</para>
|
|
/// <para>创建人:龚宇超</para>
|
|
/// <para>创建日期: </para>
|
|
/// <para>修改人:</para>
|
|
/// <para>修改日期:</para>
|
|
/// <para>修改备注:</para>
|
|
/// <para>版本:1.0</para>
|
|
/// </summary>
|
|
/// <param name="sender">The source of the event.</param>
|
|
/// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
|
|
void OnControlObjOnDataSourceBindCallBack(object sender, EventArgs e)
|
|
{
|
|
try
|
|
{
|
|
this.SetUpdateData();
|
|
if (this.scc_container.PanelVisibility == SplitPanelVisibility.Both)
|
|
{
|
|
this.tcButtom.TabControlObj.SelectedTabPageIndex = 0;
|
|
this.OnSelectedPageChanged(null, null);
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
string Message = ErrorMessage.PromptErrorMessage(ex);
|
|
MessageUtil.Show(Message, ex.Message);
|
|
}
|
|
|
|
}
|
|
/// <summary>
|
|
/// <para>说明:设置顶部分类是否显示</para>
|
|
/// <para>创建人:龚宇超</para>
|
|
/// <para>创建日期:2017-11-03 </para>
|
|
/// <para>修改人:</para>
|
|
/// <para>修改日期:</para>
|
|
/// <para>修改备注:</para>
|
|
/// <para>版本:1.0</para>
|
|
/// </summary>
|
|
/// <param name="visible">if set to <c>true</c> [visible].</param>
|
|
public void SetTopPanelVisible(bool visible)
|
|
{
|
|
this.pl_main_top.Visible = visible;
|
|
}
|
|
/// <summary>
|
|
/// <para>说明:设置底部按钮是否显示</para>
|
|
/// <para>创建人:龚宇超</para>
|
|
/// <para>创建日期:2019-01-11 </para>
|
|
/// <para>修改人:</para>
|
|
/// <para>修改日期:</para>
|
|
/// <para>修改备注:</para>
|
|
/// <para>版本:1.0</para>
|
|
/// </summary>
|
|
/// <param name="visible">if set to <c>true</c> [visible].</param>
|
|
public void SetButtonPanelVisible(bool visible)
|
|
{
|
|
this.pl_buttom.Visible = !visible;
|
|
this.panelControl1.Visible = visible;
|
|
|
|
}
|
|
/// <summary>
|
|
/// 关闭线程
|
|
/// </summary>
|
|
public void CloseIDCardThread()
|
|
{
|
|
if (this.IDCardThread != null)
|
|
{
|
|
this.IDCardThread.Abort();
|
|
IDCardUtil.CloseIDCard();
|
|
}
|
|
}
|
|
/// <summary>
|
|
/// <para>说明:添加数据</para>
|
|
/// <para>创建人:龚宇超</para>
|
|
/// <para>创建日期:2018-04-03 </para>
|
|
/// <para>修改人:</para>
|
|
/// <para>修改日期:</para>
|
|
/// <para>修改备注:</para>
|
|
/// <para>版本:1.0</para>
|
|
/// </summary>
|
|
public bool AddControlRecord(bool isClose = true, bool isTip = true)
|
|
{
|
|
|
|
if (this.ControlObj.VerifyNull())
|
|
{
|
|
string primaryKey = this.ControlObj.GetControlValue(this.PrimaryKey);
|
|
if (this.ControlObj.SaveBaseModuleData(this.Model.ModuleCode, this.SysModel.MenuTable, this.PrimaryKey, ref primaryKey, true, _leftField, isTip, this.SysModel.NewVer))
|
|
{
|
|
LogUtil.WriteDebug(Model.ModuleCode, Model.FormText + "-->添加", Model.FormText + "[" + primaryKey + "]", Model.FormText, Model.ModuleId + "");
|
|
// 保存成功.
|
|
this.PrimaryValue = this.SysModel.NewVer == 0 ? this.ControlObj.GetControlValue(this.PrimaryKey) : primaryKey;
|
|
if (primaryKey.Contains("LskjIdebtity")) this.PrimaryValue = primaryKey.Replace("LskjIdebtity", "");
|
|
this.ControlObj.SetControlValue(this.PrimaryKey, this.PrimaryValue);
|
|
DataRow rowItem = BaseImpl.GetDataRowResult(string.Format("select * from {0} where {1}='{2}'", this.SysModel.MenuTable, this.PrimaryKey, this.PrimaryValue));
|
|
this.ControlObj.CanExecControl = false;
|
|
this.ControlObj.SetAllControlValue(rowItem);
|
|
this.ControlObj.CanExecControl = true;
|
|
btnAdd.Enabled = false;
|
|
btnApply.Enabled = btnUpdate.Enabled = btnCopyNew.Enabled = btnAttach.Enabled = true;
|
|
SavaState = false;
|
|
// 同步本地数据,用于关闭时检查数据是否已修改.
|
|
this.ControlObj.SyncLocalModel();
|
|
|
|
if (this.OnAddRecordCallBack != null && isClose)
|
|
this.OnAddRecordCallBack(null, null);
|
|
if (1 == SysModel.CloseAfterAdd)
|
|
{
|
|
this.OnCloseCallback(null, null);
|
|
}
|
|
else
|
|
{
|
|
SetUpdateData(false);//重新加载数据
|
|
}
|
|
return true;
|
|
}
|
|
}
|
|
return false;
|
|
}
|
|
/// <summary>
|
|
/// <para>说明:修改数据</para>
|
|
/// <para>创建人:龚宇超</para>
|
|
/// <para>创建日期:2018-04-03 </para>
|
|
/// <para>修改人:</para>
|
|
/// <para>修改日期:</para>
|
|
/// <para>修改备注:</para>
|
|
/// <para>版本:1.0</para>
|
|
/// </summary>
|
|
public bool UpdateControlRecord(bool isClose = true)
|
|
{
|
|
if (this.ControlObj.VerifyNull())
|
|
{
|
|
if (this.ControlObj.SaveBaseModuleData(this.Model.ModuleCode, this.SysModel.MenuTable, this.PrimaryKey, ref this.PrimaryValue, false, this._leftField, true, this.SysModel.NewVer))
|
|
{
|
|
LogUtil.WriteDebug(Model.ModuleCode, Model.FormText + "-->修改", Model.FormText + "[" + PrimaryValue + "]", Model.FormText, Model.ModuleId + "");
|
|
|
|
if (this.SysModel.ModifyClose && this.OnCloseCallback != null && isClose)
|
|
{
|
|
this.OnCloseCallback(null, null);
|
|
}
|
|
else
|
|
{
|
|
SetUpdateData(false);//重新加载数据
|
|
btnApply.Enabled = btnCopyNew.Enabled = btnAttach.Enabled = true;
|
|
}
|
|
return true;
|
|
}
|
|
|
|
}
|
|
return false;
|
|
}
|
|
/// <summary>
|
|
/// <para>说明:测试身份证刷卡</para>
|
|
/// <para>创建人:龚宇超</para>
|
|
/// <para>创建日期:2018-05-31 </para>
|
|
/// <para>修改人:</para>
|
|
/// <para>修改日期:</para>
|
|
/// <para>修改备注:</para>
|
|
/// <para>版本:1.0</para>
|
|
/// </summary>
|
|
/// <param name="sender">The sender.</param>
|
|
/// <param name="e">The <see cref="System.Timers.ElapsedEventArgs"/> instance containing the event data.</param>
|
|
public void OnReadCard()
|
|
{
|
|
while (true)
|
|
{
|
|
var cards = IDCardUtil.ReadCardAllMessage();
|
|
if (cards != null && cards.Count > 0)
|
|
{
|
|
this.Invoke(new MethodInvoker(delegate
|
|
{
|
|
this.ControlObj.SetAllControlValue(cards);
|
|
}));
|
|
}
|
|
}
|
|
}
|
|
#endregion
|
|
|
|
#region protected event
|
|
/// <summary>
|
|
/// <para>说明:清除页面</para>
|
|
/// <para>创建人:龚宇超</para>
|
|
/// <para>创建日期:2017-11-03 </para>
|
|
/// <para>修改人:</para>
|
|
/// <para>修改日期:</para>
|
|
/// <para>修改备注:</para>
|
|
/// <para>版本:1.0</para>
|
|
/// </summary>
|
|
/// <param name="sender">The source of the event.</param>
|
|
/// <param name="e">The <see cref="ItemClickEventArgs"/> instance containing the event data.</param>
|
|
protected void OnClearItemClick(object sender, EventArgs e)
|
|
{
|
|
try
|
|
{
|
|
if (this.ControlObj.ResetControlValue())
|
|
{
|
|
btnAdd.Enabled = true;
|
|
btnUpdate.Enabled = btnCopyNew.Enabled = btnAttach.Enabled = false;
|
|
|
|
if (this.OnClearCallBack != null)
|
|
{
|
|
this.OnClearCallBack(sender, e);
|
|
}
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
string Message = ErrorMessage.PromptErrorMessage(ex);
|
|
MessageUtil.Show(Message, ex.Message);
|
|
}
|
|
|
|
}
|
|
/// <summary>
|
|
/// <para>说明:复制新增</para>
|
|
/// <para>创建人:龚宇超</para>
|
|
/// <para>创建日期:2017-11-03 </para>
|
|
/// <para>修改人:</para>
|
|
/// <para>修改日期:</para>
|
|
/// <para>修改备注:</para>
|
|
/// <para>版本:1.0</para>
|
|
/// </summary>
|
|
/// <param name="sender">The source of the event.</param>
|
|
/// <param name="e">The <see cref="ItemClickEventArgs"/> instance containing the event data.</param>
|
|
protected void OnCopyItemClick(object sender, EventArgs e)
|
|
{
|
|
try
|
|
{
|
|
this.PrimaryValue = string.Empty;
|
|
BaseUserControl baseControl = this.ControlObj.FindControl(PrimaryKey);
|
|
if (baseControl != null)
|
|
{
|
|
this.ControlObj.CopyControlValue();
|
|
baseControl.EditText = BaseImpl.GetDefaultValue(baseControl.Model.Default, ParentKey);
|
|
|
|
lteSpeciesNo.TextEdit.EditValue = this.ParentKey;
|
|
lteSpeciesName.TextEdit.EditValue = this.ParentValue;
|
|
ControlObj.ParentKey = this.ParentKey;
|
|
|
|
// 设置按钮状态
|
|
btnAdd.Enabled = true;
|
|
btnUpdate.Enabled = btnCopyNew.Enabled = btnAttach.Enabled = false;
|
|
|
|
if (this.OnCopyRecordCallBack != null)
|
|
{
|
|
this.OnCopyRecordCallBack(sender, e);
|
|
}
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
string Message = ErrorMessage.PromptErrorMessage(ex);
|
|
MessageUtil.Show(Message, ex.Message);
|
|
}
|
|
|
|
}
|
|
/// <summary>
|
|
/// <para>说明:附件管理</para>
|
|
/// <para>创建人:龚宇超</para>
|
|
/// <para>创建日期:2017-11-03 </para>
|
|
/// <para>修改人:</para>
|
|
/// <para>修改日期:</para>
|
|
/// <para>修改备注:</para>
|
|
/// <para>版本:1.0</para>
|
|
/// </summary>
|
|
/// <param name="sender">The source of the event.</param>
|
|
/// <param name="e">The <see cref="ItemClickEventArgs"/> instance containing the event data.</param>
|
|
protected void OnAttachItemClick(object sender, ItemClickEventArgs e)
|
|
{
|
|
try
|
|
{
|
|
if (string.IsNullOrWhiteSpace(this.PrimaryValue))
|
|
{
|
|
MessageUtil.Show(ResourceKeys.UnSaveData);
|
|
}
|
|
else
|
|
{
|
|
// 固定传入参数(窗口标题、操作员ID、操作员名称、权限、模版编号)
|
|
string[] defaultArgs = string.Format(ModuleArgs.DefaultArgs, this.Model.FormText, ERPInfo.Instance.UserId, ERPInfo.Instance.UserName, this.Model.Privilege, this.Model.ModuleCode).Split('~');
|
|
string[] menuArgs = { string.Format(ModuleArgs.PubPhotoViewArgs, this.PrimaryValue), "0", this.SysModel.MenuDirId + "", "" };
|
|
|
|
string[] args = defaultArgs.Concat(menuArgs).ToArray();
|
|
|
|
IForm form = FormHelper.LoadDllForm(ResourceDynamic.PhotoView, args);
|
|
DialogResult result = form.SubForm.ShowDialog();
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
string Message = ErrorMessage.PromptErrorMessage(ex);
|
|
MessageUtil.Show(Message, ex.Message);
|
|
}
|
|
|
|
}
|
|
/// <summary>
|
|
/// <para>说明:常规打印</para>
|
|
/// <para>创建人:龚宇超</para>
|
|
/// <para>创建日期:2017-11-03 </para>
|
|
/// <para>修改人:</para>
|
|
/// <para>修改日期:</para>
|
|
/// <para>修改备注:</para>
|
|
/// <para>版本:1.0</para>
|
|
/// </summary>
|
|
/// <param name="sender">The source of the event.</param>
|
|
/// <param name="e">The <see cref="ItemClickEventArgs"/> instance containing the event data.</param>
|
|
protected void OnNormalPrintItemClick(object sender, ItemClickEventArgs e)
|
|
{
|
|
try
|
|
{
|
|
if (this.OnPrintCallBack != null)
|
|
{
|
|
this.OnPrintCallBack(sender, e);
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
string Message = ErrorMessage.PromptErrorMessage(ex);
|
|
MessageUtil.Show(Message, ex.Message);
|
|
}
|
|
|
|
}
|
|
/// <summary>
|
|
/// <para>说明:添加数据</para>
|
|
/// <para>创建人:龚宇超</para>
|
|
/// <para>创建日期:2017-11-03 </para>
|
|
/// <para>修改人:</para>
|
|
/// <para>修改日期:</para>
|
|
/// <para>修改备注:</para>
|
|
/// <para>版本:1.0</para>
|
|
/// </summary>
|
|
/// <param name="sender">The source of the event.</param>
|
|
/// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
|
|
protected void OnAddClick(object sender, EventArgs e)
|
|
{
|
|
try
|
|
{
|
|
WaitForm.ShowForm(ResourceKeys.DataSaving);
|
|
bool results = this.AddControlRecord();
|
|
if (this.SysModel.AddAndSubmit&& results)
|
|
{
|
|
if (this.btnApply.Visible && this.btnApply.Enabled) this.OnApplyClick(null,null);
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
string Message = ErrorMessage.PromptErrorMessage(ex);
|
|
MessageUtil.Show(Message, ex.Message);
|
|
}
|
|
finally
|
|
{
|
|
WaitForm.HideForm();
|
|
}
|
|
}
|
|
/// <summary>
|
|
/// <para>说明:更新保存</para>
|
|
/// <para>创建人:龚宇超</para>
|
|
/// <para>创建日期:2017-11-03 </para>
|
|
/// <para>修改人:</para>
|
|
/// <para>修改日期:</para>
|
|
/// <para>修改备注:</para>
|
|
/// <para>版本:1.0</para>
|
|
/// </summary>
|
|
/// <param name="sender">The source of the event.</param>
|
|
/// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
|
|
protected void OnUpdateClick(object sender, EventArgs e)
|
|
{
|
|
try
|
|
{
|
|
WaitForm.ShowForm(ResourceKeys.DataSaving);
|
|
this.UpdateControlRecord();
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
string Message = ErrorMessage.PromptErrorMessage(ex);
|
|
MessageUtil.Show(Message, ex.Message);
|
|
}
|
|
finally
|
|
{
|
|
WaitForm.HideForm();
|
|
}
|
|
|
|
}
|
|
/// <summary>
|
|
/// <para>说明:提交保存</para>
|
|
/// <para>创建人:龚宇超</para>
|
|
/// <para>创建日期:2017-11-03 </para>
|
|
/// <para>修改人:</para>
|
|
/// <para>修改日期:</para>
|
|
/// <para>修改备注:</para>
|
|
/// <para>版本:1.0</para>
|
|
/// </summary>
|
|
/// <param name="sender">The source of the event.</param>
|
|
/// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
|
|
protected void OnApplyClick(object sender, EventArgs e)
|
|
{
|
|
try
|
|
{
|
|
bool isApply = false;
|
|
|
|
string primaryValue = this.PrimaryValue;
|
|
//if (SavaState && string.IsNullOrWhiteSpace(this.PrimaryValue))
|
|
//{
|
|
// primaryValue=this.ControlObj.GetControlValue(this.PrimaryKey);
|
|
//}
|
|
WaitForm.ShowForm(ResourceKeys.Handing);
|
|
if (this.ControlObj.VerifyNull())
|
|
{
|
|
if (this.ControlObj.VerifyUpdated())
|
|
{
|
|
isApply = this.ControlObj.SaveBaseModuleData(this.Model.ModuleCode, this.SysModel.MenuTable, this.PrimaryKey, ref primaryValue, false, this._leftField, false, this.SysModel.NewVer);
|
|
// isApply = this.ControlObj.SaveBaseModuleData(this.Model.ModuleCode, this.SysModel.MenuTable, this.PrimaryKey, ref primaryValue, SavaState, this._leftField, true, this.SysModel.NewVer);
|
|
}
|
|
else
|
|
{
|
|
isApply = true; // 无需保存
|
|
}
|
|
}
|
|
if (isApply)
|
|
{
|
|
// 提交数据
|
|
this.PrimaryValue = this.SysModel.NewVer == 0 ? this.ControlObj.GetControlValue(this.PrimaryKey) : this.PrimaryValue;
|
|
if (string.IsNullOrEmpty(PrimaryValue) || SavaState) this.AddControlRecord(true, false);
|
|
DialogResult result = MessageUtil.Show(ResourceKeys.BillApply, MessageBoxButtons.YesNo);
|
|
if (result == DialogResult.Yes)
|
|
{
|
|
string tipMsg = string.Empty;
|
|
if (BaseModuleImpl.ApplyBaseData(this.Model.ModuleCode, this.PrimaryValue, 1, out tipMsg) == 1)
|
|
{
|
|
if (!this.SysModel.ApplyHideSccesMessage)
|
|
{
|
|
MessageUtil.Show(ResourceKeys.ApplySuccess);
|
|
}
|
|
#region api提交审核时推送
|
|
if (ApiHelper.IsExecEventApi(Interface.Api.OperateEvent.AfterModuleAuditStateChange, this.Model.ModuleCode, 0))
|
|
{
|
|
ApiHelper apiHelper = new ApiHelper(this.Model.ModuleCode, this.PrimaryValue, this.PrimaryKey, this.SysModel.MenuTable, 0);
|
|
apiHelper.OnEvent(Interface.Api.OperateEvent.AfterModuleAuditStateChange, Interface.Api.ActionType.Submit);
|
|
if (!string.IsNullOrEmpty(apiHelper.apiResutMsg))
|
|
MessageUtil.Show(apiHelper.apiResutMsg);
|
|
}
|
|
#endregion
|
|
// 推送消息
|
|
PushHelper push = new PushHelper(this.PrimaryValue, "0", this.Model.ModuleCode, "", "", 0);
|
|
push.Push_Base_Oper_Message();
|
|
|
|
if (this.OnApplyRecordCallBack != null)
|
|
this.OnApplyRecordCallBack(sender, e);
|
|
|
|
if (this.OnCloseCallback != null)
|
|
this.OnCloseCallback(sender, e);
|
|
}
|
|
else
|
|
{
|
|
MessageUtil.Show(ResourceKeys.ApplyFault + "\r\n" + tipMsg);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
string Message = ErrorMessage.PromptErrorMessage(ex);
|
|
MessageUtil.Show(Message, ex.Message);
|
|
}
|
|
finally
|
|
{
|
|
WaitForm.HideForm();
|
|
}
|
|
|
|
}
|
|
/// <summary>
|
|
/// <para>说明:关闭</para>
|
|
/// <para>创建人:龚宇超</para>
|
|
/// <para>创建日期:2017-11-03 </para>
|
|
/// <para>修改人:</para>
|
|
/// <para>修改日期:</para>
|
|
/// <para>修改备注:</para>
|
|
/// <para>版本:1.0</para>
|
|
/// </summary>
|
|
/// <param name="sender">The source of the event.</param>
|
|
/// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
|
|
protected void OnCloseClick(object sender, EventArgs e)
|
|
{
|
|
try
|
|
{
|
|
//bool isClose = true;
|
|
//if (!string.IsNullOrWhiteSpace(this.PrimaryValue) && this.btnUpdate.Enabled && this.ControlObj.VerifyUpdated())
|
|
//{
|
|
// DialogResult result = MessageUtil.Show(ResourceKeys.DataChanged, MessageBoxButtons.YesNo);
|
|
// if (result == DialogResult.Yes)
|
|
// {
|
|
// isClose = this.ControlObj.VerifyNull();
|
|
// if (isClose)
|
|
// {
|
|
// // 保存数据
|
|
// isClose = this.ControlObj.SaveBaseModuleData(this.Model.ModuleCode, this.SysModel.MenuTable, this.PrimaryKey, ref this.PrimaryValue, false, this._leftField, true, this.SysModel.NewVer);
|
|
// }
|
|
// }
|
|
//}
|
|
//if (isClose)
|
|
//{
|
|
if (this.OnCloseCallback != null)
|
|
this.OnCloseCallback(sender, e);
|
|
//}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
string Message = ErrorMessage.PromptErrorMessage(ex);
|
|
MessageUtil.Show(Message, ex.Message);
|
|
}
|
|
|
|
}
|
|
/// <summary>
|
|
/// <para>说明:打印完成需要参数</para>
|
|
/// <para>创建人:龚宇超</para>
|
|
/// <para>创建日期:2018-07-09 </para>
|
|
/// <para>修改人:</para>
|
|
/// <para>修改日期:</para>
|
|
/// <para>修改备注:</para>
|
|
/// <para>版本:1.0</para>
|
|
/// </summary>
|
|
protected void GetPrintOtherParam()
|
|
{
|
|
//取得打印完成后的参数
|
|
if (this.SysModel.PrintSql.Contains("<<"))
|
|
{
|
|
string[] strs = this.SysModel.PrintSql.Split(new[] { ">>" }, 2, StringSplitOptions.None);
|
|
_mainPrintSql = strs[1];
|
|
_printModeCond = strs[0].Replace("<<", "");
|
|
}
|
|
else
|
|
{
|
|
_mainPrintSql = this.SysModel.PrintSql;
|
|
_isExcPrint = true;
|
|
}
|
|
//if (!string.IsNullOrEmpty(_printModeCond) && _printModeCond.IndexOf(';') > 0)
|
|
//{
|
|
string[] str = { "", "" };
|
|
if (!string.IsNullOrEmpty(_printModeCond)) str = _printModeCond.Split(';');
|
|
DataRow item = string.IsNullOrEmpty(str[0]) ? null : AttachImpl.GetSystemModule(str[0]);
|
|
string tableName = "temp";
|
|
string modetype = string.Empty;
|
|
string comprefix = string.Empty;
|
|
string primaryKey = string.Empty;
|
|
if (item != null)
|
|
{
|
|
tableName = item["TableName"] + "";
|
|
modetype = item["modType"] + "";
|
|
comprefix = BaseImpl.GetColumnPrefix(tableName);
|
|
primaryKey = modetype == "1" ? BaseImpl.GetBasePrimaryKey(str[0]) : comprefix + "billdocument_id";
|
|
}
|
|
//表名,列前缀,主键字段,主键值,模块编号,主打印Sql
|
|
_printSaveParams = new List<string>() { tableName, comprefix, primaryKey, str[1], str[0], _mainPrintSql };
|
|
//判断是否直接打印 modetype 区别单据和基础档案模块
|
|
switch (modetype)
|
|
{
|
|
case "1":
|
|
ModuleModel mode = new ModuleModel(MainImpl.GetSystemdllTab(str[0]));
|
|
if (mode != null) _isExcPrint = mode.PrintType == 3;
|
|
break;
|
|
case "2":
|
|
BaseAccraditationModel model = new BaseAccraditationModel(BillAuditImpl.GetPubAuditProperty(str[0]));
|
|
if (model != null) _isExcPrint = model.BillPrintType == 3;
|
|
break;
|
|
}
|
|
//}
|
|
}
|
|
/// <summary>
|
|
/// <para>说明:打印模版</para>
|
|
/// <para>创建人:龚宇超</para>
|
|
/// <para>创建日期:2018-04-08 </para>
|
|
/// <para>修改人:</para>
|
|
/// <para>修改日期:</para>
|
|
/// <para>修改备注:</para>
|
|
/// <para>版本:1.0</para>
|
|
/// </summary>
|
|
/// <param name="sender">The source of the event.</param>
|
|
/// <param name="e">The <see cref="ItemClickEventArgs"/> instance containing the event data.</param>
|
|
protected void OnCustomPrintItemClick(object sender, ItemClickEventArgs e)
|
|
{
|
|
string printFile = e.Item.Tag + "";
|
|
string printPath = PubUtil.PrintFileAbsolutelyPath;
|
|
|
|
if (!File.Exists(printPath))
|
|
{
|
|
MessageUtil.Show(ResourceKeys.NotFoundPrintFile);
|
|
return;
|
|
}
|
|
|
|
bool isPrint = !string.IsNullOrEmpty(this.PrimaryValue);
|
|
if (!isPrint)
|
|
{
|
|
if (MessageUtil.Show(ResourceKeys.BillNotSavedAndNotPrint, MessageBoxButtons.YesNo) == DialogResult.Yes)
|
|
isPrint = this.AddControlRecord();
|
|
}
|
|
|
|
if (isPrint)
|
|
{
|
|
try
|
|
{
|
|
// 判断是否满足打印条件
|
|
string printCond = this.ControlObj.ReplaceControlValue(this.SysModel.PrintCond);
|
|
if (!string.IsNullOrEmpty(printCond) && !ReplaceHelper.EvalCond(printCond))
|
|
{
|
|
MessageUtil.Show(ResourceKeys.DisSatisfyPrintCond);
|
|
return;
|
|
}
|
|
|
|
string tmpSql = this.ControlObj.ReplaceControlValue(this.SysModel.PrintSql);
|
|
string tmpSql1 = this.ControlObj.ReplaceControlValue(this.SysModel.PrintSql1);
|
|
string tmpSql2 = this.ControlObj.ReplaceControlValue(this.SysModel.PrintSql2);
|
|
|
|
if (printFile.Contains(PrintUtil.TemplateFlag))
|
|
{
|
|
//主Sql
|
|
string mainSql = string.Empty;
|
|
List<string> tmpSqls = new List<string>();
|
|
if (_printSaveParams != null && _printSaveParams.Count > 0)
|
|
{
|
|
_printSaveParams[5] = mainSql = this.ControlObj.ReplaceControlValue(_mainPrintSql);
|
|
_printSaveParams[3] = this.ControlObj.ReplaceControlValue(_printSaveParams[2]);
|
|
tmpSqls.Add(mainSql);
|
|
tmpSqls.Add(tmpSql1);
|
|
tmpSqls.AddRange(tmpSql2.Split(';').ToList());
|
|
}
|
|
PrintUtil.OnAfterPrint -= new EventHandler(OnReportPrintAfter);
|
|
PrintUtil.OnAfterPrint += new EventHandler(OnReportPrintAfter);
|
|
PrintUtil.FastReportPrint(tmpSqls, printFile, _isExcPrint);
|
|
}
|
|
else
|
|
{
|
|
DelphiHelper.LoadDelphiDll(printPath, printPath, printFile, tmpSql, tmpSql1, this.SysModel.PrintType, tmpSql2);
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
LogHelper.Instance.WriteError(ex);
|
|
string Message = ErrorMessage.PromptErrorMessage(ex);
|
|
MessageUtil.Show(Message, ex.Message);
|
|
}
|
|
}
|
|
}
|
|
/// <summary>
|
|
/// <para>说明:模版新版打印</para>
|
|
/// <para>创建人:龚宇超</para>
|
|
/// <para>创建日期:2018-01-25</para>
|
|
/// <para>修改人:</para>
|
|
/// <para>修改日期:</para>
|
|
/// <para>修改备注:</para>
|
|
/// <para>版本:1.0</para>
|
|
/// </summary>
|
|
/// <param name="sender">The source of the event.</param>
|
|
/// <param name="e">The <see cref="ItemClickEventArgs"/> instance containing the event data.</param>
|
|
protected void OnPrintItem70Click(object sender, ItemClickEventArgs e)
|
|
{
|
|
DataRow printRowItem = e.Item.Tag as DataRow;
|
|
|
|
string printFile = printRowItem["printFile"] + "";
|
|
string printName = printRowItem["printName"] + "";
|
|
string printParams = printRowItem["printParams"] + "";
|
|
string printType = printRowItem["printType"] + "";
|
|
string sourceType = printRowItem["sourceType"] + "";
|
|
string printPath = PubUtil.PrintFileAbsolutelyPath70;
|
|
|
|
if (!File.Exists(printPath))
|
|
{
|
|
MessageUtil.Show(ResourceKeys.NotFoundPrintFile);
|
|
return;
|
|
}
|
|
try
|
|
{
|
|
printParams = this.ControlObj.ReplaceControlValue(printParams);
|
|
|
|
DelphiHelper.LoadDelphiDll(printPath, printPath, this.Model.ModuleCode, printName, printParams, Convert.ToInt32(printType), "");
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
string Message = ErrorMessage.PromptErrorMessage(ex);
|
|
MessageUtil.Show(Message, ex.Message);
|
|
LogHelper.Instance.WriteError(ex);
|
|
}
|
|
}
|
|
/// <summary>
|
|
/// <para>说明:打印完成后回调</para>
|
|
/// <para>创建人:龚宇超</para>
|
|
/// <para>创建日期:2018-07-05 </para>
|
|
/// <para>修改人:</para>
|
|
/// <para>修改日期:</para>
|
|
/// <para>修改备注:</para>
|
|
/// <para>版本:1.0</para>
|
|
/// </summary>
|
|
/// <param name="sender">The sender.</param>
|
|
/// <param name="e">The e.</param>
|
|
protected void OnReportPrintAfter(object sender, EventArgs e)
|
|
{
|
|
try
|
|
{
|
|
if (_printSaveParams != null && _printSaveParams.Count > 0)
|
|
{
|
|
//打印完成后添加数据库
|
|
int result = BaseModuleImpl.SavePrintRecord(_printSaveParams[0], _printSaveParams[1], _printSaveParams[2], _printSaveParams[3], _printSaveParams[4]);
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
string Message = ErrorMessage.PromptErrorMessage(ex);
|
|
MessageUtil.Show(Message, ex.Message);
|
|
}
|
|
|
|
}
|
|
/// <summary>
|
|
/// <para>说明:常用工具点击</para>
|
|
/// <para>创建人:龚宇超</para>
|
|
/// <para>创建日期:2017-11-27 </para>
|
|
/// <para>修改人:</para>
|
|
/// <para>修改日期:</para>
|
|
/// <para>修改备注:</para>
|
|
/// <para>版本:1.0</para>
|
|
/// </summary>
|
|
/// <param name="sender">The source of the event.</param>
|
|
/// <param name="e">The <see cref="ItemClickEventArgs"/> instance containing the event data.</param>
|
|
protected void OnCommonItemClick(object sender, ItemClickEventArgs e)
|
|
{
|
|
try
|
|
{
|
|
DataRow rowItem = e.Item.Tag as DataRow;
|
|
GridRightMenuModel model = new GridRightMenuModel(rowItem);
|
|
//if (!string.IsNullOrWhiteSpace(model.MenuCond))
|
|
//{
|
|
// try
|
|
// {
|
|
// string cond = this.ControlObj.ReplaceControlValue(model.MenuCond);
|
|
// bool result = ReplaceHelper.EvalCond(cond);
|
|
// if (!result) return;
|
|
// }
|
|
// catch (Exception)
|
|
// {
|
|
// MessageUtil.Show(ResourceKeys.SetRightMenuCondFault);
|
|
// }
|
|
//}
|
|
|
|
CommonMenu menu = new CommonMenu(this.Model, this.ControlObj);
|
|
menu.Apply(rowItem);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
string Message = ErrorMessage.PromptErrorMessage(ex);
|
|
MessageUtil.Show(Message, ex.Message);
|
|
}
|
|
|
|
}
|
|
/// <summary>
|
|
/// <para>说明:删除附件</para>
|
|
/// <para>创建人:龚宇超</para>
|
|
/// <para>创建日期:2018-02-27 </para>
|
|
/// <para>修改人:</para>
|
|
/// <para>修改日期:</para>
|
|
/// <para>修改备注:</para>
|
|
/// <para>版本:1.0</para>
|
|
/// </summary>
|
|
/// <param name="sender">The sender.</param>
|
|
protected void OnImageDeleteEvent(object sender)
|
|
{
|
|
try
|
|
{
|
|
LabelImageEdit imageEdit = sender as LabelImageEdit;
|
|
if (imageEdit != null)
|
|
{
|
|
int result = BaseModuleImpl.UpdateRecord(this.SysModel.MenuTable, imageEdit.Model.FieldName, "", this.PrimaryKey, this.PrimaryValue);
|
|
MessageUtil.Show(result > 0 ? ResourceKeys.OperSuccess : ResourceKeys.OperFault);
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
string Message = ErrorMessage.PromptErrorMessage(ex);
|
|
MessageUtil.Show(Message, ex.Message);
|
|
}
|
|
|
|
}
|
|
/// <summary>
|
|
/// <para>说明:上传附件</para>
|
|
/// <para>创建人:龚宇超</para>
|
|
/// <para>创建日期:2018-02-27 </para>
|
|
/// <para>修改人:</para>
|
|
/// <para>修改日期:</para>
|
|
/// <para>修改备注:</para>
|
|
/// <para>版本:1.0</para>
|
|
/// </summary>
|
|
/// <param name="sender">The sender.</param>
|
|
protected void OnImageUploadEvent(object sender)
|
|
{
|
|
try
|
|
{
|
|
_imageEdit = sender as LabelImageEdit;
|
|
if (string.IsNullOrWhiteSpace(this.PrimaryValue))
|
|
{
|
|
MessageUtil.Show(ResourceKeys.UnSaveData);
|
|
}
|
|
else
|
|
{
|
|
//string prefix = "001";
|
|
//string imagePath = _imageEdit.SaveImageToLocal(prefix);
|
|
OpenFileDialog openFileDialog = new OpenFileDialog();
|
|
if (openFileDialog.ShowDialog() == DialogResult.OK)
|
|
{
|
|
WaitForm.ShowForm("上传中...");
|
|
if (!string.IsNullOrEmpty(openFileDialog.FileName))
|
|
{
|
|
Image image = null;
|
|
bool isImage = true;
|
|
try
|
|
{
|
|
image = Image.FromFile(openFileDialog.FileName);
|
|
}
|
|
catch (Exception)
|
|
{
|
|
isImage = false;
|
|
}
|
|
if (image != null && isImage)
|
|
{
|
|
_imageEdit.TextEdit.Image = image;
|
|
}
|
|
else
|
|
{
|
|
_imageEdit.TextEdit.Image = global::Lskj.Control.Properties.Resources.file;
|
|
}
|
|
_imageEdit.CurrentImagePath = openFileDialog.FileName;
|
|
}
|
|
else
|
|
{
|
|
_imageEdit.CurrentImagePath = string.Empty;
|
|
}
|
|
string imagePath = _imageEdit.CurrentImagePath;
|
|
if (!string.IsNullOrEmpty(imagePath))
|
|
{
|
|
//string speciesNo = string.IsNullOrEmpty(lteSpeciesNo.TextEdit.Text) ? "01" : lteSpeciesNo.TextEdit.Text;
|
|
//int directotyId = AttachImpl.GetAttachDirectoryId(this.SysModel.MenuDirId + "", this.PrimaryValue);
|
|
//AttachHelper.UpLoadFile(this.Handle, directotyId + "", speciesNo, "001", imagePath);
|
|
bool isSuccess = UploadFile(imagePath);
|
|
if (!isSuccess)
|
|
{
|
|
_imageEdit.CurrentImagePath = string.Empty;
|
|
_imageEdit.TextEdit.Image = null;
|
|
}
|
|
}
|
|
else
|
|
{
|
|
MessageUtil.Show("未选择上传文件");
|
|
}
|
|
WaitForm.HideForm();
|
|
}
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
string Message = ErrorMessage.PromptErrorMessage(ex);
|
|
MessageUtil.Show(Message, ex.Message);
|
|
}
|
|
|
|
}
|
|
/// <summary>
|
|
/// 上传附件(新)
|
|
/// </summary>
|
|
private bool UploadFile(string filePath)
|
|
{
|
|
bool isUpload = true;
|
|
try
|
|
{
|
|
string token = "";
|
|
string loginUrl = $"{SystemInfo.Instance.OAUrl}/Api/SysUserAjaxApi.ashx";
|
|
HttpTools.setting("application/x-www-form-urlencoded", null, null, HttpTools.Encode.UTF8);
|
|
Dictionary<string, string> loginPmsDic = new Dictionary<string, string>();
|
|
loginPmsDic.Add("method", "Login");
|
|
loginPmsDic.Add("username", ERPInfo.Instance.UserName);
|
|
loginPmsDic.Add("password", ERPInfo.Instance.InPassWord);
|
|
HttpWebResponse loginResponse = HttpTools.Post(loginUrl, "", loginPmsDic, HttpTools.Method.POST, out CookieCollection loginCookie, out string loginResult);
|
|
if (loginResponse != null && !string.IsNullOrEmpty(loginResult))
|
|
{
|
|
JObject jObject = JsonConvert.DeserializeObject<JObject>(loginResult);
|
|
if (jObject.ContainsKey("success"))
|
|
{
|
|
if ((jObject["success"] + "").Equals("True"))
|
|
{
|
|
if (jObject.ContainsKey("token"))
|
|
{
|
|
token = jObject["token"] + "";
|
|
}
|
|
}
|
|
}
|
|
}
|
|
if (!string.IsNullOrEmpty(token))
|
|
{
|
|
byte[] fileBytes = ConvertFileToBytes(filePath);
|
|
string fileBase64Str = Convert.ToBase64String(fileBytes) + "";
|
|
string postUrl = "{0}Api/FileUploadApi.ashx?moduleId={1}&idValue={2}&folder={3}&totsize={4}&position={5}&filename={6}&method={7}";
|
|
Dictionary<string, string> headerDic = new Dictionary<string, string>();
|
|
headerDic.Add("Authorization", $"Bearer {token}");
|
|
postUrl = string.Format(postUrl, SystemInfo.Instance.OAUrl, this.Model.ModuleCode, this.PrimaryValue, "UploadFilesTemp", fileBytes.Length, 0, HttpUtility.UrlEncode($"{Guid.NewGuid()}_{Path.GetFileName(_imageEdit.CurrentImagePath)}"), "DoWebUpload");
|
|
HttpTools.setting("application/x-www-form-urlencoded", null, null);
|
|
HttpWebResponse webResponse = HttpTools.Post(postUrl, fileBase64Str, null, headerDic, HttpTools.Method.POST, out CookieCollection cookieCollection, out string result);
|
|
if (webResponse != null && !string.IsNullOrEmpty(result))
|
|
{
|
|
JObject jsonObject = (JObject)JsonConvert.DeserializeObject(result);
|
|
string isSuccess = jsonObject["success"] + "";
|
|
if (isSuccess.Equals("True", StringComparison.CurrentCultureIgnoreCase))
|
|
{
|
|
string fileId = jsonObject["other"] + "";
|
|
string webpath = jsonObject["data"]["WebRelPath"] + "";
|
|
BaseModuleImpl.UpdateRecord(this.SysModel.MenuTable, _imageEdit.Model.FieldName, webpath, this.PrimaryKey, this.PrimaryValue);
|
|
//string searchSql = @"update P_fm_FileTab set author='{2}',CreationTime='{3}' ,Uploader='{4}' ,UploadTime='{5}'
|
|
// where dllcoid = '{0}' and
|
|
// parentid = (select dirid from P_fm_DirectoryTab where
|
|
// ParentId = (select dirid from v_systemdlltab where DllCoid = '{0}') and PID = '{1}') and fileId='{6}' ";
|
|
//searchSql = string.Format(searchSql, this.Model.ModuleCode, this.leftTreeGridIdValue, dataRow["author"], fi.CreationTime, ERPInfo.Instance.UserName, dataRow["UploadTime"], fileId);
|
|
//SqlHelper.ExecuteNonQuery(searchSql);
|
|
}
|
|
else
|
|
{
|
|
if (jsonObject.ContainsKey("msg"))
|
|
{
|
|
string returnMsg = jsonObject["msg"] + "";
|
|
MessageUtil.Show(string.Format("上传失败,原因:{0}", returnMsg));
|
|
}
|
|
isUpload = false;
|
|
}
|
|
}
|
|
else
|
|
{
|
|
MessageUtil.Show(string.Format("上传失败,原因:{0}", result));
|
|
}
|
|
}
|
|
else
|
|
{
|
|
MessageUtil.Show(string.Format("验证失败,原因:{0}", loginResult));
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
MessageUtil.Show(string.Format("上传失败,原因:{0}", ex.Message));
|
|
isUpload = false;
|
|
}
|
|
return isUpload;
|
|
}
|
|
/// <summary>
|
|
/// 附件转换byte[]
|
|
/// </summary>
|
|
/// <param name="filePath">附件路径</param>
|
|
/// <returns>二进制</returns>
|
|
private byte[] ConvertFileToBytes(string filePath)
|
|
{
|
|
byte[] bytContent = null;
|
|
System.IO.FileStream fs = null;
|
|
System.IO.BinaryReader br = null;
|
|
try
|
|
{
|
|
fs = new FileStream(filePath, System.IO.FileMode.Open, FileAccess.Read, FileShare.Read);
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw;
|
|
}
|
|
if (fs != null)
|
|
br = new BinaryReader((Stream)fs);
|
|
if (br != null)
|
|
bytContent = br.ReadBytes((Int32)fs.Length);
|
|
if (fs != null)
|
|
fs.Dispose();
|
|
return bytContent;
|
|
}
|
|
/// <summary>
|
|
/// <para>说明:关联附件</para>
|
|
/// <para>创建人:龚宇超</para>
|
|
/// <para>创建日期:2018-02-27 </para>
|
|
/// <para>修改人:</para>
|
|
/// <para>修改日期:</para>
|
|
/// <para>修改备注:</para>
|
|
/// <para>版本:1.0</para>
|
|
/// </summary>
|
|
/// <param name="sender">The sender.</param>
|
|
protected void OnImageUnionEvent(object sender)
|
|
{
|
|
_imageEdit = sender as LabelImageEdit;
|
|
|
|
if (string.IsNullOrWhiteSpace(this.PrimaryValue))
|
|
{
|
|
MessageUtil.Show(ResourceKeys.UnSaveData);
|
|
}
|
|
else
|
|
{
|
|
try
|
|
{
|
|
// 固定传入参数(窗口标题、操作员ID、操作员名称、权限、模版编号)
|
|
string[] defaultArgs = string.Format(ModuleArgs.DefaultArgs, this.Model.FormText, ERPInfo.Instance.UserId, ERPInfo.Instance.UserName, this.Model.Privilege, this.Model.ModuleCode).Split('~');
|
|
string[] menuArgs = { string.Format(ModuleArgs.PubPhotoViewArgs, this.PrimaryValue), "0", this.SysModel.MenuDirId + "", "", "1", _imageEdit.Model.FieldName, lteSpeciesNo.TextEdit.Text };
|
|
|
|
string[] args = defaultArgs.Concat(menuArgs).ToArray();
|
|
|
|
IForm form = FormHelper.LoadDllForm(ResourceDynamic.PhotoView, args);
|
|
DialogResult result = form.SubForm.ShowDialog();
|
|
|
|
// 刷新数据
|
|
string unionPath = BaseImpl.GetRecord(this.SysModel.MenuTable, _imageEdit.Model.FieldName, this.PrimaryKey, this.PrimaryValue) + "";
|
|
if (!string.IsNullOrEmpty(unionPath))
|
|
_imageEdit.LoadImage(unionPath, false);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
string Message = ErrorMessage.PromptErrorMessage(ex);
|
|
MessageUtil.Show(Message, ex.Message);
|
|
}
|
|
|
|
}
|
|
}
|
|
/// <summary>
|
|
/// <para>说明:消息处理</para>
|
|
/// <para>创建人:龚宇超</para>
|
|
/// <para>创建日期:2018-03-23 </para>
|
|
/// <para>修改人:</para>
|
|
/// <para>修改日期:</para>
|
|
/// <para>修改备注:</para>
|
|
/// <para>版本:1.0</para>
|
|
/// </summary>
|
|
/// <param name="m">要处理的 Windows<see cref="T:System.Windows.Forms.Message" />。</param>
|
|
protected override void DefWndProc(ref Message m)
|
|
{
|
|
base.DefWndProc(ref m);
|
|
if (this.Handle == m.HWnd)
|
|
AttachHelper.DefWndProc(m);
|
|
}
|
|
/// <summary>
|
|
/// <para>说明:上传成功</para>
|
|
/// <para>创建人:龚宇超</para>
|
|
/// <para>创建日期:2018-03-23 </para>
|
|
/// <para>修改人:</para>
|
|
/// <para>修改日期:</para>
|
|
/// <para>修改备注:</para>
|
|
/// <para>版本:1.0</para>
|
|
/// </summary>
|
|
/// <param name="sender">The source of the event.</param>
|
|
/// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
|
|
protected void OnAttachUploadSuccess(object sender, EventArgs e)
|
|
{
|
|
try
|
|
{
|
|
if (AttachHelper.IsDefWndProc(this.Handle, (System.Windows.Forms.Message)sender) && _imageEdit != null && File.Exists(_imageEdit.CurrentImagePath))
|
|
{
|
|
int result = BaseModuleImpl.UpdateRecord(this.SysModel.MenuTable, _imageEdit.Model.FieldName, Path.GetFileName(_imageEdit.CurrentImagePath), this.PrimaryKey, this.PrimaryValue);
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
string Message = ErrorMessage.PromptErrorMessage(ex);
|
|
MessageUtil.Show(Message, ex.Message);
|
|
}
|
|
|
|
}
|
|
/// <summary>
|
|
/// <para>说明:下载成功</para>
|
|
/// <para>创建人:龚宇超</para>
|
|
/// <para>创建日期:2018-03-23 </para>
|
|
/// <para>修改人:</para>
|
|
/// <para>修改日期:</para>
|
|
/// <para>修改备注:</para>
|
|
/// <para>版本:1.0</para>
|
|
/// </summary>
|
|
/// <param name="sender">The source of the event.</param>
|
|
/// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
|
|
protected void OnAttachDownLoadSuccess(object sender, EventArgs e)
|
|
{
|
|
try
|
|
{
|
|
if (AttachHelper.IsDefWndProc(this.Handle, (System.Windows.Forms.Message)sender) && _imageEdit != null && File.Exists(_imageEdit.CurrentImagePath))
|
|
{
|
|
this._imageEdit.TextEdit.Image = Image.FromFile(Path.Combine(new string[] { PubUtil.FileDownLoadTempPath, _imageEdit.CurrentImagePath }));
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
string Message = ErrorMessage.PromptErrorMessage(ex);
|
|
MessageUtil.Show(Message, ex.Message);
|
|
}
|
|
|
|
}
|
|
/// <summary>
|
|
/// <para>说明:扫码模块回车处理</para>
|
|
/// <para>创建人:龚宇超</para>
|
|
/// <para>创建日期:2018-05-25 </para>
|
|
/// <para>修改人:</para>
|
|
/// <para>修改日期:</para>
|
|
/// <para>修改备注:</para>
|
|
/// <para>版本:1.0</para>
|
|
/// </summary>
|
|
/// <param name="sender">The sender.</param>
|
|
/// <param name="e">The <see cref="KeyEventArgs"/> instance containing the event data.</param>
|
|
protected void OnScanTextEditKeyDown(object sender, KeyEventArgs e)
|
|
{
|
|
try
|
|
{
|
|
if (e.KeyCode == Keys.Enter)
|
|
{
|
|
BaseUserControl baseControl = null;
|
|
var ctr = sender as System.Windows.Forms.Control;
|
|
if (ctr != null && ctr.Parent != null && ctr.Parent.Parent != null)
|
|
baseControl = ctr.Parent.Parent as BaseUserControl;
|
|
bool isSaveSkip = false;
|
|
BaseUserControl nextControl = this.ControlObj.FindNextControl(baseControl, out isSaveSkip);
|
|
if (nextControl != null && !isSaveSkip)
|
|
{
|
|
nextControl.Focus();//存在跳转控件则直接跳转
|
|
}
|
|
else
|
|
{
|
|
if (SavaState)
|
|
{
|
|
this.AddControlRecord(true, false);
|
|
}
|
|
else
|
|
{
|
|
this.UpdateControlRecord(true);
|
|
}
|
|
if (this._scanEdit != null)
|
|
{
|
|
// 保存成功后重新设置值.
|
|
BaseUserControl control = this.ControlObj.FindControl(PrimaryKey);
|
|
if (control != null)
|
|
{
|
|
this.PrimaryValue = MainImpl.GetDefaultValue(control.Model.Default);
|
|
this.ControlObj.SetControlValue(control.Model, this.PrimaryValue);
|
|
}
|
|
SynchronizationContext.Current.Post(o =>
|
|
{
|
|
this._scanEdit.Focus();
|
|
this._scanEdit.TextEdit.Focus();
|
|
}, null);
|
|
}
|
|
if (nextControl != null && !isSaveSkip)
|
|
{
|
|
nextControl.Focus();
|
|
}
|
|
}
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
string Message = ErrorMessage.PromptErrorMessage(ex);
|
|
MessageUtil.Show(Message, ex.Message);
|
|
}
|
|
}
|
|
/// <summary>
|
|
/// <para>说明:</para>
|
|
/// <para>创建人:龚宇超</para>
|
|
/// <para>创建日期:2019-06-05 </para>
|
|
/// <para>修改人:</para>
|
|
/// <para>修改日期:</para>
|
|
/// <para>修改备注:</para>
|
|
/// <para>版本:1.0</para>
|
|
/// </summary>
|
|
/// <param name="sender">The source of the event.</param>
|
|
/// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
|
|
protected void OnMesSaveClick(object sender, EventArgs e)
|
|
{
|
|
try
|
|
{
|
|
bool success = false;
|
|
if (string.IsNullOrWhiteSpace(this.PrimaryValue))
|
|
success = this.AddControlRecord(false);
|
|
else
|
|
success = this.UpdateControlRecord(false);
|
|
if (success && this.OnCloseCallback != null)
|
|
this.OnCloseCallback(sender, e);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
|
|
string Message = ErrorMessage.PromptErrorMessage(ex);
|
|
MessageUtil.Show(Message, ex.Message);
|
|
}
|
|
|
|
}
|
|
/// <summary>
|
|
/// <para>说明:Mes系统关闭窗口</para>
|
|
/// <para>创建人:龚宇超</para>
|
|
/// <para>创建日期:2019-06-05 </para>
|
|
/// <para>修改人:</para>
|
|
/// <para>修改日期:</para>
|
|
/// <para>修改备注:</para>
|
|
/// <para>版本:1.0</para>
|
|
/// </summary>
|
|
/// <param name="sender">The sender.</param>
|
|
/// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
|
|
protected void OnBtnMesCloseClick(object sender, EventArgs e)
|
|
{
|
|
try
|
|
{
|
|
if (this.OnCloseCallback != null)
|
|
this.OnCloseCallback(sender, e);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
string Message = ErrorMessage.PromptErrorMessage(ex);
|
|
MessageUtil.Show(Message, ex.Message);
|
|
}
|
|
|
|
}
|
|
/// <summary>
|
|
/// <para>说明:附件管理</para>
|
|
/// <para>创建人:龚宇超</para>
|
|
/// <para>创建日期:2019-06-05 </para>
|
|
/// <para>修改人:</para>
|
|
/// <para>修改日期:</para>
|
|
/// <para>修改备注:</para>
|
|
/// <para>版本:1.0</para>
|
|
/// </summary>
|
|
/// <param name="sender">The sender.</param>
|
|
/// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
|
|
protected void OnBtnAttachClick(object sender, EventArgs e)
|
|
{
|
|
try
|
|
{
|
|
string idValue = this.PrimaryValue;
|
|
if (!string.IsNullOrWhiteSpace(this.SysModel.AttachmentAssociated))
|
|
{
|
|
idValue = this.ControlObj.GetControlValue(this.SysModel.AttachmentAssociated);
|
|
}
|
|
|
|
if (string.IsNullOrWhiteSpace(this.PrimaryValue))
|
|
{
|
|
MessageUtil.Show(ResourceKeys.UnSaveData);
|
|
}
|
|
else
|
|
{
|
|
string url = string.Format("pages/PhotoView.html?left=1&username={0}&password={1}&id={2}&isview={3}&dllcoid=", ERPInfo.Instance.UserName, ERPInfo.Instance.Password, idValue, this.btnUpdate.Enabled ? "0" : "1");
|
|
if (!string.IsNullOrWhiteSpace(this.ParentKey) && this.SysModel.AttachmentSelectNode)
|
|
{
|
|
url = string.Format("pages/PhotoView.html?left=1&username={0}&password={1}&id={2}&isview={3}&specno={4}&dllcoid=", ERPInfo.Instance.UserName, ERPInfo.Instance.Password, idValue, this.btnUpdate.Enabled ? "0" : "1", this.ParentKey);
|
|
}
|
|
|
|
// 固定传入参数(窗口标题、操作员ID、操作员名称、权限、模版编号)
|
|
string[] defaultArgs = string.Format(ModuleArgs.DefaultArgs, this.Model.FormText, ERPInfo.Instance.UserId, ERPInfo.Instance.UserName, this.Model.Privilege, this.Model.ModuleCode).Split('~');
|
|
string[] menuArgs = SystemInfo.Instance.BsAttachFlag.Equals("1") ? new string[] { "", "", url } : new string[] { string.Format(ModuleArgs.PubPhotoViewArgs, this.PrimaryValue), "0", this.SysModel.MenuDirId + "", "" };
|
|
string[] args = defaultArgs.Concat(menuArgs).ToArray();
|
|
if (SystemInfo.Instance.BsAttachFlag.Equals("2"))
|
|
{
|
|
IForm form = FormHelper.LoadDllForm(ResourceDynamic.PubBrower, args);
|
|
form.SubForm.Controls.Clear();
|
|
form.SubForm.WindowState = FormWindowState.Maximized;
|
|
ProcessStartInfo processStartInfo = new ProcessStartInfo()
|
|
{
|
|
FileName = "WebBrowser\\Lskj.WebBrowser.exe",
|
|
Arguments = HandleHelper.CombineArgs(args),
|
|
UseShellExecute = false,
|
|
RedirectStandardOutput = false,
|
|
RedirectStandardError = false,
|
|
CreateNoWindow = false
|
|
};
|
|
Process startedProcess = Process.Start(processStartInfo);
|
|
if (startedProcess == null)
|
|
{
|
|
MessageUtil.Show("进程启动失败");
|
|
return;
|
|
}
|
|
startedProcess.WaitForInputIdle();
|
|
int retry = 0;
|
|
while (startedProcess.MainWindowHandle == IntPtr.Zero && retry < 50)
|
|
{
|
|
Thread.Sleep(100);
|
|
startedProcess.Refresh();
|
|
retry++;
|
|
}
|
|
IntPtr exeMainHandle = startedProcess.MainWindowHandle;
|
|
if (exeMainHandle == IntPtr.Zero)
|
|
{
|
|
MessageBox.Show("无法获取启动程序的主窗口句柄");
|
|
return;
|
|
}
|
|
HandleHelper.SetFormNoneStyle(exeMainHandle, form.SubForm);
|
|
DialogResult result = form.SubForm.ShowDialog();
|
|
startedProcess.Kill();
|
|
form.SubForm.Dispose();
|
|
}
|
|
else
|
|
{
|
|
IForm form = FormHelper.LoadDllForm(SystemInfo.Instance.BsAttachFlag.Equals("1") ? ResourceDynamic.PubBrower : ResourceDynamic.PhotoView, args);
|
|
DialogResult result = form.SubForm.ShowDialog();
|
|
form.SubForm.Dispose();
|
|
}
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
string Message = ErrorMessage.PromptErrorMessage(ex);
|
|
MessageUtil.Show(Message, ex.Message);
|
|
}
|
|
|
|
}
|
|
/// <summary>
|
|
/// <para>说明:清除</para>
|
|
/// <para>创建人:龚宇超</para>
|
|
/// <para>创建日期:2019-06-05 </para>
|
|
/// <para>修改人:</para>
|
|
/// <para>修改日期:</para>
|
|
/// <para>修改备注:</para>
|
|
/// <para>版本:1.0</para>
|
|
/// </summary>
|
|
/// <param name="sender">The sender.</param>
|
|
/// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
|
|
protected void OnBtnClearClick(object sender, EventArgs e)
|
|
{
|
|
try
|
|
{
|
|
if (this.ControlObj.ResetControlValue())
|
|
{
|
|
btnAdd.Enabled = true;
|
|
btnUpdate.Enabled = btnCopyNew.Enabled = btnAttach.Enabled = false;
|
|
|
|
if (this.OnClearCallBack != null)
|
|
{
|
|
this.OnClearCallBack(sender, e);
|
|
}
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
string Message = ErrorMessage.PromptErrorMessage(ex);
|
|
MessageUtil.Show(Message, ex.Message);
|
|
}
|
|
|
|
}
|
|
/// <summary>
|
|
/// <para>说明:复制新增</para>
|
|
/// <para>创建人:龚宇超</para>
|
|
/// <para>创建日期:2019-06-05 </para>
|
|
/// <para>修改人:</para>
|
|
/// <para>修改日期:</para>
|
|
/// <para>修改备注:</para>
|
|
/// <para>版本:1.0</para>
|
|
/// </summary>
|
|
/// <param name="sender">The sender.</param>
|
|
/// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
|
|
protected void OnBtnCopyNewClick(object sender, EventArgs e)
|
|
{
|
|
try
|
|
{
|
|
this.PrimaryValue = string.Empty;
|
|
BaseUserControl baseControl = this.ControlObj.FindControl(PrimaryKey);
|
|
if (baseControl != null)
|
|
{
|
|
this.ControlObj.CopyControlValue();
|
|
baseControl.EditText = BaseImpl.GetDefaultValue(baseControl.Model.Default, ParentKey);
|
|
|
|
lteSpeciesNo.TextEdit.EditValue = this.ParentKey;
|
|
lteSpeciesName.TextEdit.EditValue = this.ParentValue;
|
|
ControlObj.ParentKey = this.ParentKey;
|
|
|
|
// 设置按钮状态
|
|
btnAdd.Enabled = true;
|
|
btnUpdate.Enabled = btnCopyNew.Enabled = btnAttach.Enabled = false;
|
|
|
|
if (this.OnCopyRecordCallBack != null)
|
|
{
|
|
|