ab56a9bcf7
SVN-Revision: r240
2802 lines
124 KiB
C#
2802 lines
124 KiB
C#
/***********************
|
|
* 说明:单据审批弹出模块
|
|
* 创建人:龚宇超
|
|
* 创建日期:2018-01-02
|
|
* 修改人:
|
|
* 修改日期:
|
|
* 修改备注:
|
|
* 版本:1.0.0.0
|
|
***********************/
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.ComponentModel;
|
|
using System.Data;
|
|
using System.Drawing;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Windows.Forms;
|
|
using Lskj.Control;
|
|
using Lskj.Control.Model;
|
|
using Lskj.Util;
|
|
using Lskj.Data;
|
|
using Lskj.Model;
|
|
using Lskj.Business.Impl;
|
|
using DevExpress.XtraEditors;
|
|
using DevExpress.XtraTab;
|
|
using DevExpress.XtraGrid.Columns;
|
|
using DevExpress.XtraGrid.Views.Grid;
|
|
using Lskj.Business;
|
|
using DevExpress.XtraBars;
|
|
using System.Collections;
|
|
using Lskj.Core;
|
|
|
|
namespace Lskj.PubAccraditation
|
|
{
|
|
|
|
/// <summary>
|
|
/// 单据审批弹出模块
|
|
/// </summary>
|
|
public partial class FrmAccraditation : BaseForm
|
|
{
|
|
public FrmAccraditation()
|
|
{
|
|
InitializeComponent();
|
|
}
|
|
#region 公有变量
|
|
|
|
/// <summary>
|
|
/// 单据结构明细
|
|
/// </summary>
|
|
public AccraditationModel AuditModelObj;
|
|
/// <summary>
|
|
/// 单据模型
|
|
/// </summary>
|
|
public BillAuditModel BillModelObj;
|
|
/// <summary>
|
|
/// 单据审批表模型
|
|
/// </summary>
|
|
public BillAuditCommonModel BillAuditComObj;
|
|
/// <summary>
|
|
/// 单据入口参数模型
|
|
/// </summary>
|
|
public DynamicPubAccraditionPopModel SysModel;
|
|
/// <summary>
|
|
/// 主表控件
|
|
/// </summary>
|
|
public MyControl ControlObj;
|
|
/// <summary>
|
|
/// 是否是Brp模块加载审核明细
|
|
/// </summary>
|
|
public bool isBrpAccrad = false;
|
|
#endregion
|
|
/// <summary>
|
|
/// 调用动态链接库默认传递参数
|
|
/// </summary>
|
|
public DynamicModel syModel { get; private set; }
|
|
/// <summary>
|
|
/// 关闭当前审核界面,刷新打开界面
|
|
/// </summary>
|
|
/// <param name="sender">The sender.</param>
|
|
public event RefreshThePage refreshThePage;
|
|
public delegate void RefreshThePage(string promptInformation, string id);
|
|
#region 私有变量
|
|
/// <summary>
|
|
/// id(推送记录)
|
|
/// </summary>
|
|
private int _beforeId;
|
|
/// <summary>
|
|
/// 是否初始化完成
|
|
/// </summary>
|
|
private bool _isInitFinish;
|
|
/// <summary>
|
|
/// 意见
|
|
/// </summary>
|
|
private string _auditAdvice;
|
|
/// <summary>
|
|
/// 菜单模块名(推送记录)
|
|
/// </summary>
|
|
private string _beforeMenuName;
|
|
/// <summary>
|
|
/// 用户(推送记录)
|
|
/// </summary>
|
|
private string _beforeUsers;
|
|
/// <summary>
|
|
/// 单据类别值
|
|
/// </summary>
|
|
private string _mainBillTypeValue;
|
|
/// <summary>
|
|
/// 单据信息
|
|
/// </summary>
|
|
private DataRow _drBillInfoMsg;
|
|
/// <summary>
|
|
/// 明细数据
|
|
/// </summary>
|
|
private DataTable _dtSourceData;
|
|
/// <summary>
|
|
/// 单据类别
|
|
/// </summary>
|
|
private DataTable _dtBillType;
|
|
/// <summary>
|
|
/// 单据明细列表
|
|
/// </summary>
|
|
private DataTable _dtBillAttachList;
|
|
/// <summary>
|
|
/// 单据billInfo
|
|
/// </summary>
|
|
private DataTable _dtBillInfoFiled;
|
|
/// <summary>
|
|
/// 分单数据
|
|
/// </summary>
|
|
private DataTable _dtSpareSourceData;
|
|
/// <summary>
|
|
/// 审批流转模型
|
|
/// </summary>
|
|
private FlowTypeStepModel _flowTypeStepModel;
|
|
/// <summary>
|
|
/// 单据水印
|
|
/// </summary>
|
|
private WaterMark _waterMark;
|
|
/// <summary>
|
|
/// 获取隐藏的x轴距
|
|
/// </summary>
|
|
private ArrayList LocationX = new ArrayList();
|
|
/// <summary>
|
|
/// 是否执行了加载储存过程
|
|
/// </summary>
|
|
public bool ProcessExists = false;
|
|
#endregion
|
|
|
|
/// <summary>
|
|
/// <para>说明:窗体加载时</para>
|
|
/// <para>创建人:龚宇超</para>
|
|
/// <para>创建日期:2018-01-02 </para>
|
|
/// <para>修改人:</para>
|
|
/// <para>修改日期:</para>
|
|
/// <para>修改备注:</para>
|
|
/// <para>版本:1.0</para>
|
|
/// </summary>
|
|
/// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
|
|
protected override void OnLoad(EventArgs e)
|
|
{
|
|
WaitForm.ShowForm();
|
|
try
|
|
{
|
|
string results = BaseImpl.GetResult("IF EXISTS(SELECT *FROM SYSOBJECTS WHERE NAME ='p_Get_NewDesignPlatform_DocumentsReview' AND TYPE = 'P') begin select 1 end else Begin select 2 end").ToString();
|
|
if (results.Equals("1") && SystemInfo.Instance.isExecload)
|
|
{
|
|
System.Data.DataSet dsConfig = BillImpl.GetNewDesignPlatformDocumentsReview(SysModel, Lskj.Data.ResourceKeys.SettingTableName);
|
|
Lskj.Data.Caches.CacheSYSConfig.Instance().SetData(dsConfig);
|
|
ProcessExists = true;
|
|
}
|
|
|
|
this._isInitFinish = false;
|
|
this.splitMain.Visible = false;
|
|
this.InitializeSetting();
|
|
this.InitializeControl();
|
|
this.InitializeSplitterPosition();
|
|
|
|
if (SystemInfo.Instance.ReviewCommentsRequired)
|
|
{
|
|
label_auditPerson.ForeColor = string.IsNullOrEmpty(SystemInfo.Instance.ControlRequiredColor) ? Color.Blue : ColorTranslator.FromHtml(SystemInfo.Instance.ControlRequiredColor);
|
|
this.txtRemark.Text = "";
|
|
}
|
|
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
LogHelper.Instance.WriteError(ex, ResourceKeys.BaseModule);
|
|
LogUtil.WriteError("单据审批初始化出错!", ex);
|
|
//MessageUtil.Show(ex);
|
|
string Message = ErrorMessage.PromptErrorMessage(ex);
|
|
MessageUtil.Show(Message, ex.Message);
|
|
}
|
|
finally
|
|
{
|
|
Lskj.Control.Model.AutoSizeChange.ControllInitializeSize(this);
|
|
//默认一开始不加载明细数据
|
|
//if (string.IsNullOrEmpty(this.BillModelObj.AuditLoadDetailFlag) || this.BillModelObj.AuditLoadDetailFlag == "0")
|
|
//{
|
|
// //this.gridBillInfo.GridView.SelectionChanged += new DevExpress.Data.SelectionChangedEventHandler(gridBillInfo_SelectionChanged);
|
|
// this.gridBillInfo.GridView.FocusedRowObjectChanged += GridView_FocusedRowObjectChanged;
|
|
//}
|
|
//else
|
|
//{
|
|
// this.gridBillInfo.GridView.DoubleClick += new EventHandler(gridView_DoubleClick);
|
|
//}
|
|
//2023-10-13 丁哥规定在明细的附加信息中配置双击参数(DBClickEvent),上方的AuditLoadDetailFlag失效
|
|
if (this.BillModelObj.DetailTreeTable)
|
|
{
|
|
(this.gridBillInfo as TreeGridControlEx).TreeListObj.FocusedNodeChanged += TreeListObj_FocusedNodeChanged;
|
|
(this.gridBillInfo as TreeGridControlEx).TreeListObj.DoubleClick += new EventHandler(gridView_DoubleClick);
|
|
}
|
|
else
|
|
{
|
|
this.gridBillInfo.GridView.FocusedRowObjectChanged += GridView_FocusedRowObjectChanged;//SelectionChanged事件会执行2次,故改成焦点行改变事件
|
|
this.gridBillInfo.GridView.DoubleClick += new EventHandler(gridView_DoubleClick);
|
|
}
|
|
|
|
WaitForm.HideForm();
|
|
this._isInitFinish = true;
|
|
this.splitMain.Visible = true;
|
|
InitButLocation();
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#region 初始化属性设置
|
|
/// <summary>
|
|
/// <para>说明:初始化属性设置</para>
|
|
/// <para>创建人:龚宇超</para>
|
|
/// <para>创建日期:2018-01-03 </para>
|
|
/// <para>修改人:</para>
|
|
/// <para>修改日期:</para>
|
|
/// <para>修改备注:</para>
|
|
/// <para>版本:1.0</para>
|
|
/// </summary>
|
|
private void InitializeSetting()
|
|
{
|
|
if (ProcessExists)
|
|
{
|
|
this.AuditModelObj = new AccraditationModel(Lskj.Data.Caches.CacheSYSConfig.Instance().AccessToContentRow());
|
|
this.BillModelObj = new BillAuditModel(Lskj.Data.Caches.CacheSYSConfig.Instance().AccessToContentRow());
|
|
this.BillModelObj.MasterPreFix = Lskj.Data.Caches.CacheSYSConfig.Instance().GetColumnPrefix();
|
|
}
|
|
else
|
|
{
|
|
this.AuditModelObj = new AccraditationModel(BillAuditImpl.GetBillFlowData(this.SysModel.ModuleCode, this.SysModel.StepCode));
|
|
DataRow modelRow = BillImpl.GetBillInfo(this.SysModel.ModuleCode);//获取单个模块信息
|
|
if (modelRow == null)
|
|
{
|
|
throw new Exception("模块编号[" + this.SysModel.ModuleCode + "],配置错误!\r\n该模块信息未找到!");
|
|
}
|
|
this.BillModelObj = new BillAuditModel(modelRow);
|
|
this.BillModelObj.MasterPreFix = BaseImpl.GetColumnPrefix(this.BillModelObj.MasterTable);
|
|
}
|
|
|
|
this.BillModelObj.DetailPreFix = BaseImpl.GetColumnPrefix(this.BillModelObj.DetailTable);// 明细表列前缀
|
|
this.BillModelObj.DetailOrderField = this.BillModelObj.DetailPreFix + "lsidx_id";// 单据来源id
|
|
if (SystemInfo.Instance.IsNotBillDetailOrder)//禁用排序
|
|
this.BillModelObj.DetailOrderField = string.Empty;
|
|
|
|
this.BillAuditComObj = new BillAuditCommonModel();
|
|
this.Text = this.SysModel.FormText + "—" + this.AuditModelObj.CurstepName + " " + string.Format(ResourceKeys.BillNoTitle, this.SysModel.BillDocumentId);
|
|
this.btnAccradit.Text = this.AuditModelObj.StepApplyText;
|
|
this.btnBack.Text = this.AuditModelObj.StepBackText;
|
|
this.btnClose.Text = this.AuditModelObj.StepCloseText;
|
|
this.btnSpare.Enabled = this.AuditModelObj.StepDivide > 0;
|
|
this.label_auditPerson.Text = this.label_managerAudit.LabelText = this.AuditModelObj.CurstepName;
|
|
this.label_managerAudit.EditText = this.SysModel.UserName;
|
|
this.pl_right_bottom.Tag = this.p_right_bottom.Tag = "NotChangeLocation";
|
|
DataRow menuCondRow = null;
|
|
if (ProcessExists)
|
|
{
|
|
menuCondRow = Lskj.Data.Caches.CacheSYSConfig.Instance().AccessToContentRow();
|
|
this.btnAttach.Text += "(" + Lskj.Data.Caches.CacheSYSConfig.Instance().AccessToContentRowCount() + ")";
|
|
}
|
|
else
|
|
{
|
|
menuCondRow = BaseImpl.GetMenuConfigTab(this.SysModel.ModuleId); //获取菜单其他配置
|
|
this.btnAttach.Text += "(" + AttachImpl.GetFileCount(this.BillModelObj.DirId + "", this.SysModel.BillDocumentId) + ")";
|
|
}
|
|
|
|
if (menuCondRow != null)
|
|
{
|
|
if (menuCondRow["DllFileName"].Equals("Lskj.PubAccraditationBrp.dll")) this.isBrpAccrad = true;// 是否是Brp模式加载
|
|
}
|
|
|
|
//树表格
|
|
if (this.BillModelObj.DetailTreeTable)
|
|
{
|
|
this.pl_detail.Controls.Clear();
|
|
this.gridBillInfo = new TreeGridControlEx();
|
|
this.gridBillInfo.Dock = DockStyle.Fill;
|
|
this.pl_detail.Controls.Add(this.gridBillInfo);
|
|
(this.gridBillInfo as TreeGridControlEx).Expansion = this.BillModelObj.DetailTreeTableExpansion;
|
|
(this.gridBillInfo as TreeGridControlEx).AddRightButton();
|
|
//节点编号
|
|
(this.gridBillInfo as TreeGridControlEx).TreeListObj.KeyFieldName = "tap_id";
|
|
//父节点编号
|
|
(this.gridBillInfo as TreeGridControlEx).TreeListObj.ParentFieldName = "tap_pid";
|
|
(this.gridBillInfo as TreeGridControlEx).SortField = this.BillModelObj.DetailOrderField;
|
|
|
|
(this.gridBillInfo as TreeGridControlEx).InitializedragState();
|
|
}
|
|
|
|
|
|
//记录推送用户
|
|
this.GetPushOpers();
|
|
this.gridFlow.GridView.RowStyle += new RowStyleEventHandler(gridFlowInfo_RowStyle);
|
|
if (this.BillModelObj.DetailTreeTable)
|
|
{
|
|
(this.gridBillInfo as TreeGridControlEx).TreeListObj.Paint += new PaintEventHandler(gridBillInfo_Panint);
|
|
(this.gridBillInfo as TreeGridControlEx).TreeListObj.ShowingEditor += new CancelEventHandler(OnGridViewShowingEditor);
|
|
}
|
|
else
|
|
{
|
|
this.gridBillInfo.gridControl.Paint += new PaintEventHandler(gridBillInfo_Panint);
|
|
this.gridBillInfo.GridView.ShowingEditor += new CancelEventHandler(OnGridViewShowingEditor);
|
|
}
|
|
|
|
if (ProcessExists)
|
|
{
|
|
this._dtBillInfoFiled = Lskj.Data.Caches.CacheSYSConfig.Instance().AccessToContent();
|
|
}
|
|
else
|
|
{
|
|
this._dtBillInfoFiled = BillAuditImpl.GetBillInfoData(this.SysModel.ModuleCode);
|
|
}
|
|
|
|
|
|
}
|
|
#endregion
|
|
|
|
#region 表格是否可以编辑设置
|
|
/// <summary>
|
|
/// <para>说明:表格编辑时,判断是否是否编辑</para>
|
|
/// <para>创建人:王一帆</para>
|
|
/// <para>创建日期:2020-03-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="CancelEventArgs"/> instance containing the event data.</param>
|
|
protected void OnGridViewShowingEditor(object sender, CancelEventArgs e)
|
|
{
|
|
try
|
|
{
|
|
DataRow rowItem = this.gridBillInfo.GridView.GetDataRow(this.gridBillInfo.GridView.FocusedRowHandle);
|
|
if (this.BillModelObj.DetailTreeTable)
|
|
{
|
|
rowItem = (this.gridBillInfo as TreeGridControlEx).GetViewFocusedDataRow();
|
|
}
|
|
if (!string.IsNullOrWhiteSpace(BillModelObj.UpdateDetailCond))
|
|
{
|
|
string UpdateCond = this.ControlObj.ReplaceParentControlValue(BillModelObj.UpdateDetailCond);
|
|
UpdateCond = ReplaceHelper.ReplaceRowParam(rowItem, UpdateCond);
|
|
if (!ReplaceHelper.EvalCond(UpdateCond))
|
|
{
|
|
e.Cancel = true;//该行不可编辑
|
|
}
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
LogHelper.Instance.WriteError(ex);
|
|
string Message = ErrorMessage.PromptErrorMessage(ex);
|
|
MessageUtil.Show(Message, ex.Message);
|
|
}
|
|
}
|
|
#endregion
|
|
|
|
#region 流转表格设置行颜色
|
|
/// <summary>
|
|
/// <para>说明:流转表格行颜色区分</para>
|
|
/// <para>创建人:龚宇超</para>
|
|
/// <para>创建日期:2018-01-03 </para>
|
|
/// <para>修改人:</para>
|
|
/// <para>修改日期:</para>
|
|
/// <para>修改备注:</para>
|
|
/// <para>版本:1.0</para>
|
|
/// </summary>
|
|
private void gridFlowInfo_RowStyle(object sender, RowStyleEventArgs e)
|
|
{
|
|
try
|
|
{
|
|
if (e.RowHandle > 0)
|
|
{
|
|
DataRow dr = this.gridFlow.GridView.GetDataRow(e.RowHandle);
|
|
if (dr["sh"].ToString() == "审") e.Appearance.ForeColor = Color.Blue;
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
string Message = ErrorMessage.PromptErrorMessage(ex);
|
|
MessageUtil.Show(Message, ex.Message);
|
|
}
|
|
}
|
|
#endregion
|
|
|
|
#region 初始化控件
|
|
/// <summary>
|
|
/// <para>说明:初始化控件</para>
|
|
/// <para>创建人:龚宇超</para>
|
|
/// <para>创建日期:2018-01-03 </para>
|
|
/// <para>修改人:</para>
|
|
/// <para>修改日期:</para>
|
|
/// <para>修改备注:</para>
|
|
/// <para>版本:1.0</para>
|
|
/// </summary>
|
|
private void InitializeControl()
|
|
{
|
|
if (ProcessExists)
|
|
{
|
|
this.gridFlow.SetReadOnlyColumns(Lskj.Data.Caches.CacheSYSConfig.Instance().AccessToContent(), GridCustomColumnStruct.AuditPopupAttachGridView + this.BillModelObj.FormKey);
|
|
this.gridFlow.SetGridViewDataSource(Lskj.Data.Caches.CacheSYSConfig.Instance().AccessToContent());
|
|
}
|
|
else
|
|
{
|
|
this.gridFlow.SetReadOnlyColumns(BaseAuditImpl.GetFlowRecordColumn(), GridCustomColumnStruct.AuditPopupAttachGridView + this.BillModelObj.FormKey);
|
|
this.gridFlow.SetGridViewDataSource(BaseAuditImpl.GetFlowRecordData(this.BillAuditComObj.SystemTabFlowStep, this.SysModel.BillDocumentId, this.SysModel.ModuleCode));
|
|
}
|
|
|
|
this.SetFormSize();
|
|
this.BindTab();
|
|
this.BindBill();
|
|
this.LoadRemindRecord();
|
|
this.LoadSignRecord();
|
|
this.InitCommonMenu();
|
|
this.InitOtherParms();
|
|
this.InitOkBtn();
|
|
|
|
|
|
}
|
|
#endregion
|
|
#region
|
|
/// <summary>
|
|
/// <para>说明:录所有按钮的位置</para>
|
|
/// <para>创建人:王一帆</para>
|
|
/// <para>创建日期:2020-11-25 </para>
|
|
/// <para>修改人:</para>
|
|
/// <para>修改日期:</para>
|
|
/// <para>修改备注:</para>
|
|
/// <para>版本:1.0</para>
|
|
/// </summary>
|
|
private void InitButLocation()
|
|
{
|
|
LocationX.Clear();
|
|
int newlocationX = 0;
|
|
foreach (System.Windows.Forms.Control control in pl_bottom.Controls)
|
|
{
|
|
int x = control.Location.X;
|
|
bool isvisbel = control.Visible;
|
|
if (!control.Visible)
|
|
{
|
|
LocationX.Add(x);
|
|
}
|
|
}
|
|
foreach (System.Windows.Forms.Control control in pl_bottom.Controls)
|
|
{
|
|
int x = control.Location.X;
|
|
newlocationX = control.Location.X;
|
|
foreach (int b in LocationX)
|
|
{
|
|
if (x < b)
|
|
{
|
|
newlocationX += 73;
|
|
|
|
}
|
|
}
|
|
control.Location = new Point(newlocationX, control.Location.Y);
|
|
}
|
|
if (!btnRemindAccradit.Visible)
|
|
{
|
|
CheckSuggestion.Width = btnRemindAccradit.Location.X + btnRemindAccradit.Width - CheckSuggestion.Location.X;
|
|
}
|
|
if (!btnRemindBack.Visible)
|
|
{
|
|
label_managerAudit.Width = btnRemindBack.Location.X + btnRemindBack.Width - label_managerAudit.Location.X;
|
|
if (!btnBack.Visible)
|
|
{
|
|
label_managerAudit.Width = btnBack.Location.X + btnBack.Width - label_managerAudit.Location.X;
|
|
}
|
|
}
|
|
if (!btnClose.Visible)
|
|
{
|
|
label_date.Width = btnClose.Location.X + btnClose.Width - label_date.Location.X;
|
|
}
|
|
}
|
|
#endregion
|
|
#region 初始化常用菜单
|
|
/// <summary>
|
|
/// <para>说明:设置初始化常用菜单</para>
|
|
/// <para>创建人:龚宇超</para>
|
|
/// <para>创建日期:2018-01-08 </para>
|
|
/// <para>修改人:</para>
|
|
/// <para>修改日期:</para>
|
|
/// <para>修改备注:</para>
|
|
/// <para>版本:1.0</para>
|
|
/// </summary>
|
|
private void InitCommonMenu()
|
|
{
|
|
DataTable tableCommon = new DataTable();
|
|
if (ProcessExists)
|
|
{
|
|
tableCommon = Lskj.Data.Caches.CacheSYSConfig.Instance().AccessToContent();
|
|
}
|
|
else
|
|
{
|
|
tableCommon = BaseModuleImpl.GetBaseGridRightMenus(this.SysModel.ModuleCode, ModuleType.BillDetail);
|
|
}
|
|
|
|
if (tableCommon == null && tableCommon.Rows.Count <= 0)
|
|
{
|
|
dpb_Tools.Enabled = false;
|
|
return;
|
|
}
|
|
foreach (DataRow item in tableCommon.Rows)
|
|
{
|
|
BarButtonItem itemCommon = new BarButtonItem();
|
|
itemCommon.Caption = item["menuname"] + "";
|
|
itemCommon.Tag = item;
|
|
itemCommon.ItemClick += new ItemClickEventHandler(itemCommon_ItemClick);
|
|
this.pMenu.AddItem(itemCommon);
|
|
}
|
|
}
|
|
#endregion
|
|
|
|
#region 常用工具
|
|
/// <summary>
|
|
/// <para>说明:常用工具点击</para>
|
|
/// <para>创建人:龚宇超</para>
|
|
/// <para>创建日期:2017-01-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 itemCommon_ItemClick(object sender, ItemClickEventArgs e)
|
|
{
|
|
try
|
|
{
|
|
DataRow rowItem = e.Item.Tag as DataRow;
|
|
CommonMenu menu = new CommonMenu(this.SysModel, this.ControlObj);
|
|
menu.ApplyBefore += new CommonToolApplyEventHandler(OnMenuApplyBefore);
|
|
menu.Apply(rowItem);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
string Message = ErrorMessage.PromptErrorMessage(ex);
|
|
MessageUtil.Show(Message, ex.Message);
|
|
}
|
|
}
|
|
/// <summary>
|
|
/// <para>说明:执行前单独替换BilldocumentId</para>
|
|
/// <para>创建人:王一帆</para>
|
|
/// <para>创建日期:2020-07-24 </para>
|
|
/// <para>修改人:</para>
|
|
/// <para>修改日期:</para>
|
|
/// <para>修改备注:</para>
|
|
/// <para>版本:1.0</para>
|
|
/// </summary>
|
|
/// <param name="e">The e.</param>
|
|
protected void OnMenuApplyBefore(ApplyArgs e)
|
|
{
|
|
try
|
|
{
|
|
string[] paramList = new string[e.MemuModel.ParamList.Count];
|
|
|
|
for (int i = 0; i < e.MemuModel.ParamList.Count; i++)
|
|
{
|
|
string item = e.MemuModel.ParamList[i];
|
|
List<string> condition = ReplaceHelper.GetParamFields(item);
|
|
foreach (string cond in condition)
|
|
{
|
|
string value = this.BillModelObj.PrimaryKey.Equals(cond.Replace("{", "").Replace("}", "").ToLower(), StringComparison.OrdinalIgnoreCase) ? this.SysModel.BillDocumentId : cond;
|
|
item = item.Replace(cond, value); ;
|
|
}
|
|
paramList[i] = item;
|
|
}
|
|
e.MemuModel.ParamList = paramList.ToList();
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
string Message = ErrorMessage.PromptErrorMessage(ex);
|
|
MessageUtil.Show(Message, ex.Message);
|
|
}
|
|
}
|
|
#endregion
|
|
|
|
#region 设置窗体大小
|
|
/// <summary>
|
|
/// <para>说明:设置窗体大小</para>
|
|
/// <para>创建人:龚宇超</para>
|
|
/// <para>创建日期:2018-01-03 </para>
|
|
/// <para>修改人:</para>
|
|
/// <para>修改日期:</para>
|
|
/// <para>修改备注:</para>
|
|
/// <para>版本:1.0</para>
|
|
/// </summary>
|
|
private void SetFormSize()
|
|
{
|
|
int panelWidth = this.BillModelObj.PanelWidth + this.gridFlow.Width;
|
|
this.Width = panelWidth < Screen.PrimaryScreen.WorkingArea.Width ? panelWidth : Screen.PrimaryScreen.WorkingArea.Width;
|
|
this.Left = (Screen.PrimaryScreen.WorkingArea.Width / 2) - (this.Width / 2);
|
|
this.Top = (Screen.PrimaryScreen.WorkingArea.Height / 2) - (this.Height / 2);
|
|
}
|
|
#endregion
|
|
|
|
#region 绑定选项卡
|
|
/// <summary>
|
|
/// <para>说明:绑定选项卡</para>
|
|
/// <para>创建人:龚宇超</para>
|
|
/// <para>创建日期:2018-01-03 </para>
|
|
/// <para>修改人:</para>
|
|
/// <para>修改日期:</para>
|
|
/// <para>修改备注:</para>
|
|
/// <para>版本:1.0</para>
|
|
/// </summary>
|
|
private void BindTab()
|
|
{
|
|
this.tab_basicInfo.Model = this.SysModel;
|
|
this.tab_basicInfo.ParentGridEx = this.gridBillInfo;
|
|
if (this.BillModelObj.SaveRefresh)
|
|
{
|
|
this.tab_basicInfo.OnDetailSaveGridCallBack += Tab_basicInfo_OnDetailSaveGridCallBack;
|
|
}
|
|
this.tab_basicInfo.InitTabPages(GetTabDetails());
|
|
|
|
this.splitLeft.PanelVisibility = tab_basicInfo.TabControlObj.TabPages.Count == 0 ? SplitPanelVisibility.Panel1 : SplitPanelVisibility.Both;
|
|
this.tab_basicInfo.OnRightCallback += new EventHandler(AuditTab_OnRightCallback);
|
|
}
|
|
|
|
|
|
|
|
/// <summary>
|
|
/// <para>说明:获取选项卡数据</para>
|
|
/// <para>创建人:龚宇超</para>
|
|
/// <para>创建日期:2018-01-15 </para>
|
|
/// <para>修改人:</para>
|
|
/// <para>修改日期:</para>
|
|
/// <para>修改备注:</para>
|
|
/// <para>版本:1.0</para>
|
|
/// </summary>
|
|
/// <returns>List<GridDetailModel>.</returns>
|
|
private List<GridDetailModel> GetTabDetails()
|
|
{
|
|
List<GridDetailModel> details = new List<GridDetailModel>();
|
|
|
|
if (ProcessExists)
|
|
{
|
|
DataTable table = Lskj.Data.Caches.CacheSYSConfig.Instance().AccessToContent();
|
|
foreach (DataRow item in table.Rows)
|
|
{
|
|
DataTable dtGridColumns = Lskj.Data.Caches.CacheSYSConfig.Instance().GetReportDetailColumns(item["formKey"] + "");//获取报表明细列
|
|
details.Add(new GridDetailModel(item, dtGridColumns, GridCustomColumnStruct.AuditPopupBasicInfoGridView + item["formKey"] + ""));
|
|
}
|
|
}
|
|
else
|
|
{
|
|
DataTable table = BaseAuditImpl.GetAttachTabs(this.SysModel.ModuleCode, this.SysModel.StepCode);
|
|
foreach (DataRow item in table.Rows)
|
|
{
|
|
if (table.Columns.Contains("privilegeoper"))
|
|
{
|
|
string privilegeoper = item["privilegeoper"] + "";//配置的权限人员
|
|
if (string.IsNullOrWhiteSpace(privilegeoper) || privilegeoper.Split(',').Contains(ERPInfo.Instance.UserName))
|
|
{
|
|
DataTable dtGridColumns = BaseAuditImpl.GetBottomBasicInformation(item["formKey"] + "");
|
|
details.Add(new GridDetailModel(item, dtGridColumns, GridCustomColumnStruct.AuditPopupBasicInfoGridView + item["formKey"] + ""));
|
|
}
|
|
}
|
|
else
|
|
{
|
|
DataTable dtGridColumns = BaseAuditImpl.GetBottomBasicInformation(item["formKey"] + "");
|
|
details.Add(new GridDetailModel(item, dtGridColumns, GridCustomColumnStruct.AuditPopupBasicInfoGridView + item["formKey"] + ""));
|
|
}
|
|
|
|
}
|
|
}
|
|
|
|
return details;
|
|
}
|
|
#endregion
|
|
|
|
#region 绑定审批单据
|
|
/// <summary>
|
|
/// <para>说明:单据管理</para>
|
|
/// <para>创建人:龚宇超</para>
|
|
/// <para>创建日期:2018-01-04 </para>
|
|
/// <para>修改人:</para>
|
|
/// <para>修改日期:</para>
|
|
/// <para>修改备注:</para>
|
|
/// <para>版本:1.0</para>
|
|
/// </summary>
|
|
private void BindBill()
|
|
{
|
|
// 初始化表头
|
|
this.ControlObj = new MyControl();
|
|
this.ControlObj.PrimaryValue = this.SysModel.BillDocumentId;
|
|
if (ProcessExists)
|
|
{
|
|
this.ControlObj.InitControl(Lskj.Data.Caches.CacheSYSConfig.Instance().AccessToContent(), this.pl_left_top);
|
|
}
|
|
else
|
|
{
|
|
this.ControlObj.InitControl(BaseModuleImpl.GetControlLocation(this.BillModelObj.FormKey, this.SysModel.ModuleCode), this.pl_left_top);
|
|
}
|
|
if (SystemInfo.Instance.AuditAutoScroll) this.pl_left_top.AutoScroll = true;
|
|
|
|
this.ControlObj.OnDataSourceBindCallBack += new EventHandler(OnControlObjOnDataSourceBindCallBack);
|
|
this.pl_left_top.Height = this.BillModelObj.ParentHeight - 36 > this.pl_left_top.Height ? this.pl_left_top.Height : this.BillModelObj.ParentHeight;
|
|
|
|
|
|
//初始明细数据
|
|
this.gridBillInfo.Model = this.SysModel;
|
|
this.gridBillInfo.ParentControl = this.ControlObj;
|
|
if (this.BillModelObj.DetailTreeTable)
|
|
{
|
|
(this.gridBillInfo as TreeGridControlEx).OnDataSourceBindCallBack += new EventHandler(OnGridBillInfoOnDataSourceBindCallBack);
|
|
}
|
|
else
|
|
{
|
|
this.gridBillInfo.OnDataSourceBindCallBack += new EventHandler(OnGridBillInfoOnDataSourceBindCallBack);
|
|
}
|
|
|
|
if (ProcessExists)
|
|
{
|
|
this.gridBillInfo.SetEditColumns(Lskj.Data.Caches.CacheSYSConfig.Instance().AccessToContent(), GridCustomColumnStruct.AuditPopupDetailGridView + this.BillModelObj.FormKey);
|
|
if (this.BillModelObj.DetailTreeTable)
|
|
{
|
|
(this.gridBillInfo as TreeGridControlEx).SetGridRightMenus(Lskj.Data.Caches.CacheSYSConfig.Instance().AccessToContent(), this.SysModel, OnGridViewRightCallBack);
|
|
}
|
|
else
|
|
{
|
|
this.gridBillInfo.SetGridRightMenus(Lskj.Data.Caches.CacheSYSConfig.Instance().AccessToContent(), this.SysModel, OnGridViewRightCallBack);
|
|
}
|
|
this.gridBillInfo.SetGridRowColors(Lskj.Data.Caches.CacheSYSConfig.Instance().AccessToContent());
|
|
}
|
|
else
|
|
{
|
|
this.gridBillInfo.SetEditColumns(BillImpl.GetDetailColumns(this.SysModel.ModuleCode), GridCustomColumnStruct.AuditPopupDetailGridView + this.BillModelObj.FormKey);
|
|
if (this.BillModelObj.DetailTreeTable)
|
|
{
|
|
(this.gridBillInfo as TreeGridControlEx).SetGridRightMenus(BaseModuleImpl.GetBaseGridRightMenus(this.AuditModelObj.BillGridMenuFlag + this.SysModel.ModuleCode, ModuleType.BillAuditDetail), this.SysModel, OnGridViewRightCallBack);
|
|
}
|
|
else
|
|
{
|
|
this.gridBillInfo.SetGridRightMenus(BaseModuleImpl.GetBaseGridRightMenus(this.AuditModelObj.BillGridMenuFlag + this.SysModel.ModuleCode, ModuleType.BillAuditDetail), this.SysModel, OnGridViewRightCallBack);
|
|
}
|
|
|
|
this.gridBillInfo.SetGridRowColors(BaseModuleImpl.GetBaseGridRowColors("BILLDETAIL_" + this.BillModelObj.FormKey));
|
|
}
|
|
|
|
|
|
////修改字段
|
|
//if (!string.IsNullOrEmpty(this.AuditModelObj.DetailModifyFields) && this.AuditModelObj.DetailModifyFields != "-1")
|
|
//{
|
|
// gridBillInfo.GridView.OptionsBehavior.Editable = true;
|
|
// GridColumnCollection gc = this.gridBillInfo.GridView.Columns;
|
|
// this.AuditModelObj.DetailModifyFields = this.AuditModelObj.DetailModifyFields + ",";
|
|
// foreach (GridColumn item in gc)
|
|
// {
|
|
// GridColumnModel model = item.Tag as GridColumnModel;
|
|
// item.OptionsColumn.AllowEdit = this.AuditModelObj.DetailModifyFields.IndexOf(item.FieldName + ",", StringComparison.OrdinalIgnoreCase) != -1;
|
|
// item.OptionsColumn.ReadOnly = !item.OptionsColumn.AllowEdit;
|
|
// if (model.FieldType == ControlType.LabMemoEdit) item.OptionsColumn.AllowEdit = true;
|
|
// }
|
|
//}
|
|
////必填字段
|
|
//if (!string.IsNullOrEmpty(this.AuditModelObj.RequiredDetailFields) && this.AuditModelObj.RequiredDetailFields != "-1")
|
|
//{
|
|
// GridColumnCollection gc = this.gridBillInfo.GridView.Columns;
|
|
// string[] RequiredDetail = this.AuditModelObj.RequiredDetailFields.Split(',');
|
|
// Color RequiredForceColor = string.IsNullOrEmpty(SystemInfo.Instance.ControlRequiredColor) ? Color.Blue : ColorTranslator.FromHtml(SystemInfo.Instance.ControlRequiredColor);
|
|
// foreach (GridColumn item in gc)
|
|
// {
|
|
// GridColumnModel model = item.Tag as GridColumnModel;
|
|
// if (RequiredDetail.Contains(model.FieldName))
|
|
// {
|
|
// item.AppearanceHeader.Options.UseForeColor = true;
|
|
// item.AppearanceHeader.ForeColor = RequiredForceColor;
|
|
// }
|
|
// }
|
|
//}
|
|
|
|
if (this.AuditModelObj.DetailModifyFields != "-1")
|
|
{
|
|
this.gridBillInfo.SetReadOnlyAllColumn();
|
|
}
|
|
//设置必填和修改字段
|
|
this.gridBillInfo.SetFieldStatus(this.AuditModelObj.DetailModifyFields, this.AuditModelObj.RequiredDetailFields);
|
|
|
|
|
|
|
|
this.SetBillControl(this.AuditModelObj.BillModifyFields, this.AuditModelObj.RequiredFields);
|
|
this.InitPrint();
|
|
|
|
}
|
|
|
|
/// <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 OnGridBillInfoOnDataSourceBindCallBack(object sender, EventArgs e)
|
|
{
|
|
try
|
|
{
|
|
WaitForm.ShowForm("正在加载数据");
|
|
|
|
// 设置Brp模版
|
|
if (this.isBrpAccrad)
|
|
{
|
|
this.SetTempleteSelectedValue(this.ControlObj.GetControlValue("brpId"));
|
|
}
|
|
this._dtSourceData = BillImpl.GetDataTableResult(ReplaceHelper.ReplaceParamToValue(this.BillModelObj.DetailSql, this.SysModel.BillDocumentId));
|
|
|
|
|
|
|
|
if (this.BillModelObj.DetailTreeTable)
|
|
{
|
|
if (this._dtSourceData.Columns.Contains(this.BillModelObj.DetailOrderField))
|
|
{
|
|
DataView dataView = this._dtSourceData.AsDataView();
|
|
dataView.Sort = this.BillModelObj.DetailOrderField;
|
|
this._dtSourceData = dataView.ToTable();
|
|
}
|
|
(this.gridBillInfo as TreeGridControlEx).SetGridViewDataSourceGenerateID(_dtSourceData);
|
|
}
|
|
else
|
|
{
|
|
this._dtSourceData.OrderBy(this.BillModelObj.DetailOrderField);
|
|
this.gridBillInfo.SetGridViewDataSource(_dtSourceData);
|
|
}
|
|
|
|
|
|
if (_dtSourceData != null) this._dtSpareSourceData = this._dtSourceData.Clone();
|
|
|
|
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
string Message = ErrorMessage.PromptErrorMessage(ex);
|
|
MessageUtil.Show(Message, ex.Message);
|
|
}
|
|
finally
|
|
{
|
|
WaitForm.HideForm();
|
|
}
|
|
|
|
|
|
}
|
|
/// <summary>
|
|
/// <para>说明:设置Brp模版加载明细</para>
|
|
/// <para>创建人:王一帆</para>
|
|
/// <para>创建日期:2021-03-02 </para>
|
|
/// <para>修改人:</para>
|
|
/// <para>修改日期:</para>
|
|
/// <para>修改备注:</para>
|
|
/// <para>版本:1.0</para>
|
|
/// </summary>
|
|
private void SetTempleteSelectedValue(string id)
|
|
{
|
|
DataTable detailTable = this.BillModelObj.DetailTreeTable ? (this.gridBillInfo as TreeGridControlEx).GetGridViewDataSource() : gridBillInfo.GridControl.DataSourceTable();
|
|
string brpId = id;
|
|
// 清空明细
|
|
detailTable.Clear();
|
|
// 重新设置明细列
|
|
DataTable columns = BillImpl.GetBillDetailBrpColumns(brpId);
|
|
if (columns != null && columns.Rows.Count > 0)
|
|
{
|
|
gridBillInfo.SetEditColumns(columns);
|
|
}
|
|
else
|
|
{
|
|
gridBillInfo.GridView.Columns.Clear();
|
|
if (this.BillModelObj.DetailTreeTable) (this.gridBillInfo as TreeGridControlEx).TreeListObj.Columns.Clear();
|
|
}
|
|
|
|
}
|
|
/// <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>
|
|
void OnControlObjOnDataSourceBindCallBack(object sender, EventArgs e)
|
|
{
|
|
try
|
|
{
|
|
this.ControlObj.CanExecControl = false;
|
|
this.ControlObj.SetAllControlValue(this._drBillInfoMsg);
|
|
this.ControlObj.CanExecControl = true;
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
string Message = ErrorMessage.PromptErrorMessage(ex);
|
|
MessageUtil.Show(Message, ex.Message);
|
|
}
|
|
}
|
|
#endregion
|
|
|
|
#region 右键菜单执行后刷新
|
|
/// <summary>
|
|
/// <para>说明:右键菜单执行后刷新单据数据</para>
|
|
/// <para>创建人:龚宇超</para>
|
|
/// <para>创建日期:2018-03-19 </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 OnGridViewRightCallBack(object sender, EventArgs e)
|
|
{
|
|
try
|
|
{
|
|
// 刷新主表
|
|
this._drBillInfoMsg = BaseAuditImpl.GetCurrentFlowRowData(this.BillModelObj.MasterTable, this.BillModelObj.PrimaryKey, this.SysModel.BillDocumentId);
|
|
this.ControlObj.SetAllControlValue(this._drBillInfoMsg);
|
|
|
|
// 刷新明细表
|
|
this._dtSourceData = BillImpl.GetDataTableResult(ReplaceHelper.ReplaceParamToValue(this.BillModelObj.DetailSql, this.SysModel.BillDocumentId));
|
|
this._dtSourceData.OrderBy(this.BillModelObj.DetailOrderField);
|
|
if (this.BillModelObj.DetailTreeTable)
|
|
{
|
|
(this.gridBillInfo as TreeGridControlEx).SetGridViewDataSourceGenerateID(_dtSourceData);
|
|
}
|
|
else
|
|
{
|
|
this.gridBillInfo.SetGridViewDataSource(_dtSourceData);
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
string Message = ErrorMessage.PromptErrorMessage(ex);
|
|
MessageUtil.Show(Message, ex.Message);
|
|
}
|
|
}
|
|
/// <summary>
|
|
/// <para>说明:单据右键菜单执行后刷新Tab标签数据</para>
|
|
/// <para>创建人:龚宇超</para>
|
|
/// <para>创建日期:2018-01-15 </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 AuditTab_OnRightCallback(object sender, EventArgs e)
|
|
{
|
|
try
|
|
{
|
|
GridDetailModel model = this.tab_basicInfo.GetFocusTabPageGridDetailModel();
|
|
DataRow dataRow = this.BillModelObj.DetailTreeTable ? (this.gridBillInfo as TreeGridControlEx).GetViewFocusedDataRow() : this.gridBillInfo.GridView.GetFocusedDataRow();
|
|
string sqlValue = ReplaceHelper.ReplaceRowParam(dataRow, model.DetailSql);
|
|
|
|
this.tab_basicInfo.SetGridDataSource(MainImpl.GetDataTableResult(sqlValue));
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
string Message = ErrorMessage.PromptErrorMessage(ex);
|
|
MessageUtil.Show(Message, ex.Message);
|
|
}
|
|
}
|
|
#endregion
|
|
|
|
#region 初始化打印
|
|
/// <summary>
|
|
/// <para>说明:创建打印</para>
|
|
/// <para>创建人:龚宇超</para>
|
|
/// <para>创建日期:2018-01-04 </para>
|
|
/// <para>修改人:</para>
|
|
/// <para>修改日期:</para>
|
|
/// <para>修改备注:</para>
|
|
/// <para>版本:1.0</para>
|
|
/// </summary>
|
|
private void InitPrint()
|
|
{
|
|
string[] files = this.BillModelObj.PrintFile.Split('|');
|
|
for (int i = 0; i < files.Length; i++)
|
|
{
|
|
string fileName = files[i];
|
|
if (!string.IsNullOrWhiteSpace(fileName))
|
|
{
|
|
BarButtonItem itemPrint = new BarButtonItem();
|
|
itemPrint.Caption = fileName.Replace(".rmf", "");
|
|
itemPrint.Tag = files[i];
|
|
itemPrint.ItemClick += new ItemClickEventHandler(itemPrint_ItemClick);
|
|
pMprint.AddItem(itemPrint);
|
|
}
|
|
}
|
|
}
|
|
#endregion
|
|
|
|
#region 打印
|
|
/// <summary>
|
|
/// <para>说明:打印事件</para>
|
|
/// <para>创建人:龚宇超</para>
|
|
/// <para>创建日期:2018-01-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 itemPrint_ItemClick(object sender, ItemClickEventArgs e)
|
|
{
|
|
try
|
|
{
|
|
string billNo = txt_billDocumentId.EditText;
|
|
string printPath = PubUtil.PrintFileAbsolutelyPath;
|
|
if (!string.IsNullOrEmpty(billNo))
|
|
{
|
|
DataRow masterRow = BillImpl.GetDataRowResult(ReplaceHelper.ReplaceParamToValue(this.BillModelObj.MasterSql, billNo));
|
|
if (masterRow == null)
|
|
{
|
|
MessageUtil.Show(ResourceKeys.DataNotFount);
|
|
return;
|
|
}
|
|
if (!ReplaceHelper.ReplaceRowParamCond(masterRow, this.BillModelObj.PrintCond))
|
|
{
|
|
MessageUtil.Show(ResourceKeys.DisSatisfyPrintCond);
|
|
return;
|
|
}
|
|
|
|
string tmpSql = ReplaceHelper.ReplaceRowParam(masterRow, this.BillModelObj.PrintSql);
|
|
string tmpSql1 = ReplaceHelper.ReplaceRowParam(masterRow, this.BillModelObj.PrintSql1);
|
|
string tmpSql2 = ReplaceHelper.ReplaceRowParam(masterRow, this.BillModelObj.PrintSql2);
|
|
DelphiHelper.LoadDelphiDll(printPath, printPath, e.Item.Tag + "", tmpSql, tmpSql1, this.BillModelObj.PrintFileType, tmpSql2);
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
string Message = ErrorMessage.PromptErrorMessage(ex);
|
|
MessageUtil.Show(Message, ex.Message);
|
|
}
|
|
}
|
|
#endregion
|
|
|
|
#region 绘制水印
|
|
/// <summary>
|
|
/// <para>说明:绘制水印</para>
|
|
/// <para>创建人:龚宇超</para>
|
|
/// <para>创建日期:2018-01-05 </para>
|
|
/// <para>修改人:</para>
|
|
/// <para>修改日期:</para>
|
|
/// <para>修改备注:</para>
|
|
/// <para>版本:1.0</para>
|
|
/// </summary>
|
|
private void gridBillInfo_Panint(object sender, PaintEventArgs e)
|
|
{
|
|
try
|
|
{
|
|
if (this.SysModel.StepOver != "1") return;
|
|
GraphicsText graphicsText = new GraphicsText();
|
|
graphicsText.Graphics = e.Graphics;
|
|
|
|
StringFormat format = new StringFormat();
|
|
format.Alignment = StringAlignment.Center;
|
|
format.LineAlignment = StringAlignment.Center;
|
|
|
|
Pen pen = new Pen(Color.Red, 2f);
|
|
SolidBrush brush = new SolidBrush(Color.Red);
|
|
|
|
if (!string.IsNullOrEmpty(this._waterMark.Text))
|
|
{
|
|
int x = (this.gridBillInfo.Width - 90) / 2;
|
|
int y = (this.gridBillInfo.Height - 32) / 2;
|
|
graphicsText.DrawString(this._waterMark.Text, new Font("宋体", 20, FontStyle.Bold), brush, new PointF(x, y), format, -20f);
|
|
e.Graphics.TranslateTransform(x, y);
|
|
e.Graphics.RotateTransform(-20f);
|
|
e.Graphics.DrawRectangle(pen, new Rectangle(-45, -19, 90, 32));
|
|
}
|
|
e.Graphics.ResetTransform();
|
|
if (!string.IsNullOrEmpty(this._waterMark.Print))
|
|
{
|
|
int x1 = (this.gridBillInfo.Width - 120) / 2;
|
|
int y1 = (this.gridBillInfo.Height - 90) / 2 + 100;
|
|
graphicsText.DrawString(this._waterMark.Print, new Font("宋体", 18, FontStyle.Bold), brush, new PointF(x1, y1), format, -20f);
|
|
e.Graphics.TranslateTransform(x1, y1);
|
|
e.Graphics.RotateTransform(-20f);
|
|
e.Graphics.DrawRectangle(pen, new Rectangle(-60, -19, 120, 32));
|
|
}
|
|
e.Graphics.ResetTransform();
|
|
if (!string.IsNullOrEmpty(this._waterMark.Collect))
|
|
{
|
|
int x2 = (this.gridBillInfo.Width - 90) / 2;
|
|
int y2 = (this.gridBillInfo.Height - 90) / 2 - 40;
|
|
graphicsText.DrawString(this._waterMark.Collect, new Font("宋体", 20, FontStyle.Bold), brush, new PointF(x2, y2), format, -20f);
|
|
e.Graphics.TranslateTransform(x2, y2);
|
|
e.Graphics.RotateTransform(-20f);
|
|
e.Graphics.DrawRectangle(pen, new Rectangle(-45, -19, 90, 32));
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
string Message = ErrorMessage.PromptErrorMessage(ex);
|
|
MessageUtil.Show(Message, ex.Message);
|
|
}
|
|
}
|
|
#endregion
|
|
|
|
#region 审批单据管理
|
|
/// <summary>
|
|
/// <para>说明:单据管理</para>
|
|
/// <para>创建人:龚宇超</para>
|
|
/// <para>创建日期:2018-01-04 </para>
|
|
/// <para>修改人:</para>
|
|
/// <para>修改日期:</para>
|
|
/// <para>修改备注:</para>
|
|
/// <para>版本:1.0</para>
|
|
/// </summary>
|
|
private void SetBillControl(string billFields, string RequiredFields)
|
|
{
|
|
if (ProcessExists)
|
|
{
|
|
this._drBillInfoMsg = Lskj.Data.Caches.CacheSYSConfig.Instance().AccessToContentRow();
|
|
}
|
|
else
|
|
{
|
|
this._drBillInfoMsg = BaseAuditImpl.GetCurrentFlowRowData(this.BillModelObj.MasterTable, this.BillModelObj.PrimaryKey, this.SysModel.BillDocumentId);
|
|
}
|
|
|
|
if (this._drBillInfoMsg == null)
|
|
{
|
|
MessageUtil.Show(ResourceKeys.NotFindAuditRecord);
|
|
return;
|
|
}
|
|
this._mainBillTypeValue = this._drBillInfoMsg[this.BillModelObj.BillType] + "";
|
|
if (string.IsNullOrEmpty(this._mainBillTypeValue) || this._mainBillTypeValue == "0")
|
|
{
|
|
MessageUtil.Show(ResourceKeys.NotSetFlowType);
|
|
return;
|
|
}
|
|
this._waterMark = new WaterMark(this.BillModelObj.MasterPreFix, this._drBillInfoMsg);
|
|
this.SetButtonsStatus();
|
|
|
|
if (this.AuditModelObj.BillModifyFields != "-1")
|
|
this.ControlObj.SetReadOnlyAllControl(true, false);
|
|
|
|
//改变控件状态 必填字段
|
|
if (!string.IsNullOrEmpty(RequiredFields) && RequiredFields != "-1")
|
|
{
|
|
foreach (DataRow dr in this._dtBillInfoFiled.Rows)
|
|
{
|
|
string fieldName = dr["fieldName"] + "";
|
|
this.ControlObj.SetRequiredControl(fieldName, RequiredFields.Split(',').Contains(fieldName), false);
|
|
}
|
|
}
|
|
|
|
//改变控件状态 操作字段
|
|
if (!string.IsNullOrEmpty(billFields) && billFields != "-1")
|
|
{
|
|
foreach (DataRow dr in this._dtBillInfoFiled.Rows)
|
|
{
|
|
string fieldName = dr["fieldName"] + "";
|
|
this.ControlObj.SetReadOnlyControl(fieldName, !billFields.Split(',').Contains(fieldName), false);
|
|
}
|
|
}
|
|
|
|
}
|
|
#endregion
|
|
|
|
#region 设置按钮状态
|
|
/// <summary>
|
|
/// <para>说明:设置按钮状态</para>
|
|
/// <para>创建人:龚宇超</para>
|
|
/// <para>创建日期:2018-01-04 </para>
|
|
/// <para>修改人:</para>
|
|
/// <para>修改日期:</para>
|
|
/// <para>修改备注:</para>
|
|
/// <para>版本:1.0</para>
|
|
/// </summary>
|
|
private void SetButtonsStatus()
|
|
{
|
|
DataRow dr = null;
|
|
DataRow drOper = null;
|
|
if (ProcessExists)
|
|
{
|
|
dr = Lskj.Data.Caches.CacheSYSConfig.Instance().AccessToContentRow();
|
|
}
|
|
else
|
|
{
|
|
dr = BillAuditImpl.GetBillFlowStep(this.SysModel.ModuleCode, this._mainBillTypeValue, this.SysModel.StepCode);
|
|
}
|
|
|
|
|
|
if (dr == null)
|
|
{
|
|
MessageUtil.Show(ResourceKeys.FlowStepConfigError);
|
|
return;
|
|
}
|
|
this._flowTypeStepModel = new FlowTypeStepModel(dr);
|
|
string operUser = this._flowTypeStepModel.OperUser;
|
|
if (ProcessExists)
|
|
{
|
|
drOper = Lskj.Data.Caches.CacheSYSConfig.Instance().AccessToContentRow();
|
|
this.btnAccradit.Visible = Lskj.Data.Caches.CacheSYSConfig.Instance().AccessToContentRowCount() < 0;
|
|
this.btnAccradit.Visible = BillAuditImpl.GetBillComfirm(this.SysModel.ConfirmId) < 0;
|
|
}
|
|
else
|
|
{
|
|
drOper = BillAuditImpl.GetOperators(this.SysModel.ModuleCode, this.SysModel.BillDocumentId, this.SysModel.StepCode);
|
|
this.btnAccradit.Visible = BillAuditImpl.GetBillComfirm(this.SysModel.ConfirmId) < 0;
|
|
}
|
|
|
|
operUser = drOper != null ? drOper["operators"] + "" : operUser;
|
|
|
|
|
|
|
|
if (operUser.StartsWith("@"))
|
|
{
|
|
string sql = string.Format("select count(1) from p_employeetab where ({0}) and employeeid='{1}' ", ReplaceHelper.ReplaceRowParam(_drBillInfoMsg, ReplaceHelper.ReplaceUserInfo(operUser)).Replace("@", "").Replace("''", "'"), ERPInfo.Instance.UserId);
|
|
object number = MainImpl.GetResult(sql);// MainImpl.GetDataTableResult(sql);
|
|
|
|
this.btnSave.Enabled = this.btnClose.Enabled = this.btnBack.Enabled = this.btnAccradit.Enabled = int.Parse(string.IsNullOrWhiteSpace(number + "") ? "0" : number + "") > 0;
|
|
}
|
|
else
|
|
{
|
|
this.btnSave.Enabled = this.btnClose.Enabled = this.btnBack.Enabled = this.btnAccradit.Enabled = operUser.Contains(this.SysModel.UserName);
|
|
}
|
|
//代理权限
|
|
DataRow agency = BillAuditImpl.GetAgencyAuthority(this.SysModel.ModuleCode);
|
|
if (agency != null)
|
|
{
|
|
string sourceuser = agency["sourceuser"] + "";
|
|
foreach (string item in sourceuser.Split(','))
|
|
{
|
|
if (operUser.Contains(item))
|
|
{
|
|
this.btnSave.Enabled = this.btnClose.Enabled = this.btnBack.Enabled = this.btnAccradit.Enabled = true;
|
|
break;
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
this.btnClose.Visible = this._flowTypeStepModel.StepClosed == 1;
|
|
this.btnRemindAccradit.Visible = this.btnRemindBack.Visible = this._flowTypeStepModel.RemindSelect == "1";
|
|
//终审
|
|
if (this.SysModel.StepOver == "1")
|
|
{
|
|
this.btnSave.Visible = this.btnClose.Visible = this.btnBack.Visible = this.txtRemark.Visible = this.pl_right_bottom.Visible = this.label_auditPerson.Visible = false;
|
|
this.p_right_bottom.Height = 60;
|
|
this.btnPrint.Parent = this.p_right_bottom;
|
|
this.btnPrint.Visible = true;
|
|
this.btnPrint.Left = 15;
|
|
this.btnPrint.Top = 20;
|
|
this.btnPrint.Height = 30;
|
|
this.btnPrint.Width = (this.p_right_bottom.Width - 55) / 2;
|
|
|
|
this.btnAttach.Parent = this.p_right_bottom;
|
|
this.btnAttach.Visible = true;
|
|
this.btnAttach.Left = this.btnPrint.Left + this.btnPrint.Width + 15;
|
|
this.btnAttach.Top = 20;
|
|
this.btnAttach.Height = 30;
|
|
this.btnAttach.Width = (this.p_right_bottom.Width - 55) / 2;
|
|
|
|
}
|
|
}
|
|
#endregion
|
|
|
|
#region 加载提醒记录
|
|
/// <summary>
|
|
/// <para>说明:加载提醒记录</para>
|
|
/// <para>创建人:龚宇超</para>
|
|
/// <para>创建日期:2018-01-08 </para>
|
|
/// <para>修改人:</para>
|
|
/// <para>修改日期:</para>
|
|
/// <para>修改备注:</para>
|
|
/// <para>版本:1.0</para>
|
|
/// </summary>
|
|
private void LoadRemindRecord()
|
|
{
|
|
if (this._flowTypeStepModel != null && !string.IsNullOrEmpty(this._flowTypeStepModel.RemindSelect))
|
|
{
|
|
DataTable dt = new DataTable();
|
|
if (ProcessExists)
|
|
{
|
|
dt = Lskj.Data.Caches.CacheSYSConfig.Instance().AccessToContent();
|
|
}
|
|
else
|
|
{
|
|
dt = BaseAuditImpl.GetRemindinRecord(this.BillAuditComObj.FlowStepTable, this.BillAuditComObj.ComfrimTable, this.SysModel.BillDocumentId, this.SysModel.ModuleCode);
|
|
}
|
|
|
|
if (dt != null && dt.Rows.Count > 0)
|
|
{
|
|
if (ProcessExists)
|
|
{
|
|
this.gridRemind.SetReadOnlyColumns(Lskj.Data.Caches.CacheSYSConfig.Instance().AccessToContent());
|
|
}
|
|
else
|
|
{
|
|
this.gridRemind.SetReadOnlyColumns(BaseAuditImpl.GetRemindColumn());
|
|
}
|
|
|
|
this.gridRemind.SetGridViewDataSource(dt);
|
|
this.tabpage_remind.Text = this.tabpage_remind.Text + "(" + dt.Rows.Count + ")";
|
|
}
|
|
else
|
|
{
|
|
this.TabControl.TabPages.Remove(this.tabpage_remind);
|
|
}
|
|
}
|
|
}
|
|
#endregion
|
|
|
|
#region 加载会签记录
|
|
/// <summary>
|
|
/// <para>说明:加载会签记录</para>
|
|
/// <para>创建人:龚宇超</para>
|
|
/// <para>创建日期:2018-01-08</para>
|
|
/// <para>修改人:</para>
|
|
/// <para>修改日期:</para>
|
|
/// <para>修改备注:</para>
|
|
/// <para>版本:1.0</para>
|
|
/// </summary>
|
|
private void LoadSignRecord()
|
|
{
|
|
if (this.BillAuditComObj == null) return;
|
|
DataTable dt = new DataTable();
|
|
if (ProcessExists)
|
|
{
|
|
dt = Lskj.Data.Caches.CacheSYSConfig.Instance().AccessToContent();
|
|
}
|
|
else
|
|
{
|
|
dt = BaseAuditImpl.GetSignRecord(this.BillAuditComObj.ComfrimTable, this.SysModel.BillDocumentId, this.SysModel.ModuleCode);
|
|
}
|
|
|
|
if (dt != null && dt.Rows.Count > 0)
|
|
{
|
|
if (ProcessExists)
|
|
{
|
|
this.gridSign.SetReadOnlyColumns(Lskj.Data.Caches.CacheSYSConfig.Instance().AccessToContent());
|
|
}
|
|
else
|
|
{
|
|
this.gridSign.SetReadOnlyColumns(BaseAuditImpl.GetSignRecordCoulumn());
|
|
}
|
|
this.gridSign.SetGridViewDataSource(dt);
|
|
this.tabpage_sign.Text = this.tabpage_sign.Text + "(" + dt.Rows.Count + ")";
|
|
}
|
|
else
|
|
{
|
|
this.TabControl.TabPages.Remove(this.tabpage_sign);
|
|
}
|
|
}
|
|
#endregion
|
|
|
|
#region 加载其他属性
|
|
/// <summary>
|
|
/// <para>说明:加载其他属性</para>
|
|
/// <para>创建人:龚宇超</para>
|
|
/// <para>创建日期:2018-01-08</para>
|
|
/// <para>修改人:</para>
|
|
/// <para>修改日期:</para>
|
|
/// <para>修改备注:</para>
|
|
/// <para>版本:1.0</para>
|
|
/// </summary>
|
|
private void InitOtherParms()
|
|
{
|
|
this.CheckSuggestion.ValueField = this.CheckSuggestion.TextField = "Mix_apellation";
|
|
this.CheckSuggestion.SetDataSource(BaseImpl.GetDataTableResult(this.AuditModelObj.SuggestionSql));
|
|
this.CheckSuggestion.TextEdit.SelectedIndex = 0;
|
|
this.CheckSuggestion.TextEdit.SelectedValueChanged += new EventHandler(CheckSuggestion_Click);
|
|
this.txt_billDocumentId.EditText = this.SysModel.BillDocumentId;
|
|
this.label_date.EditText = DateTime.Now.ToString();
|
|
|
|
if (!string.IsNullOrWhiteSpace(this.AuditModelObj.StepApplyContent)) this.txtRemark.Text = this.AuditModelObj.StepApplyContent;
|
|
|
|
|
|
}
|
|
#endregion
|
|
|
|
#region 是否为确认审核功能
|
|
/// <summary>
|
|
/// <para>说明:是否是确认审核</para>
|
|
/// <para>创建人:龚宇超</para>
|
|
/// <para>创建日期:2018-01-08</para>
|
|
/// <para>修改人:</para>
|
|
/// <para>修改日期:</para>
|
|
/// <para>修改备注:</para>
|
|
/// <para>版本:1.0</para>
|
|
/// </summary>
|
|
private void InitOkBtn()
|
|
{
|
|
if (this.SysModel.ConfirmId == "1")
|
|
{
|
|
this.btnAccradit.Enabled = true;
|
|
this.btnRemindAccradit.Visible = this.btnRemindBack.Visible = this.btnSave.Visible = this.btnClose.Visible = this.btnSpare.Visible = this.btnBack.Visible = false;
|
|
this.btnAccradit.Text = "确认(&Y)";
|
|
this.btnAccradit.Text = "确认(&Y)";
|
|
this.label_auditPerson.Text = "确认意见";
|
|
this.label_date.EditText = "会签人";
|
|
this.txtRemark.Text = "确认";
|
|
}
|
|
|
|
}
|
|
#endregion
|
|
|
|
#region 常用意见
|
|
/// <summary>
|
|
/// <para>说明:常用意见下拉框事件</para>
|
|
/// <para>创建人:龚宇超</para>
|
|
/// <para>创建日期:2018-01-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="EventArgs"/> instance containing the event data.</param>
|
|
protected void CheckSuggestion_Click(object sender, EventArgs e)
|
|
{
|
|
try
|
|
{
|
|
this.txtRemark.Text = this.CheckSuggestion.EditText;
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
string Message = ErrorMessage.PromptErrorMessage(ex);
|
|
MessageUtil.Show(Message, ex.Message);
|
|
}
|
|
}
|
|
#endregion
|
|
|
|
#region 表格双击事件
|
|
/// <summary>
|
|
/// <para>说明:双击表格</para>
|
|
/// <para>创建人:龚宇超</para>
|
|
/// <para>创建日期:2018-01-08</para>
|
|
/// <para>修改人:</para>
|
|
/// <para>修改日期:</para>
|
|
/// <para>修改备注:</para>
|
|
/// <para>版本:1.0</para>
|
|
/// </summary>
|
|
private void gridView_DoubleClick(object sender, EventArgs e)
|
|
{
|
|
try
|
|
{
|
|
GridViewClick("2");
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
string Message = ErrorMessage.PromptErrorMessage(ex);
|
|
MessageUtil.Show(Message, ex.Message);
|
|
}
|
|
}
|
|
#endregion
|
|
|
|
#region 表格选中双击共用函数
|
|
/// <summary>
|
|
/// <para>说明:gridBillInfo点击事件共用函数</para>
|
|
/// <para>创建人:龚宇超</para>
|
|
/// <para>创建日期:2018-01-08</para>
|
|
/// <para>修改人:</para>
|
|
/// <para>修改日期:</para>
|
|
/// <para>修改备注:</para>
|
|
/// <para>版本:1.0</para>
|
|
/// <param name="frequency">1表示点击进入,2表示双击进入</param>
|
|
/// </summary>
|
|
private void GridViewClick(string frequency)
|
|
{
|
|
foreach (XtraTabPage tabPage in this.tab_basicInfo.TabControlObj.TabPages)
|
|
{
|
|
GridDetailModel model = this.tab_basicInfo.GetGridDetailModel(tabPage);
|
|
//是否为双击进入
|
|
if (model.DBClickEvent && !frequency.Equals("2")) return;
|
|
|
|
DataRow dataRow = this.BillModelObj.DetailTreeTable ? (this.gridBillInfo as TreeGridControlEx).GetViewFocusedDataRow() : this.gridBillInfo.GridView.GetFocusedDataRow();
|
|
|
|
//条件判断
|
|
if (!string.IsNullOrWhiteSpace(model.Enablecond) && !this.ValidateCond(model.Enablecond, dataRow))
|
|
{
|
|
//配置了条件,并且不满足条件
|
|
this.tab_basicInfo.SetGridDataSource(tabPage, new DataTable());
|
|
continue;
|
|
}
|
|
|
|
|
|
bool isDetailAttach = (model.IsReadOnly || model.IsChart);
|
|
string sqlValue = isDetailAttach ? ReplaceHelper.ReplaceRowParam(dataRow, model.DetailSql) : GetSearchSql(model);
|
|
GridControlEx grdExMain = (tabPage.Tag as GridControlEx);
|
|
if (!isDetailAttach) grdExMain.LastSearchSql = sqlValue;
|
|
//this.tab_basicInfo.SetGridDataSource(tabPage, MainImpl.GetDataTableResult(sqlValue));
|
|
this.tab_basicInfo.SetGridDataSource(tabPage, sqlValue);
|
|
}
|
|
}
|
|
#endregion
|
|
#region 获取查询条件
|
|
/// <summary>
|
|
/// <para>说明:获取查询条件</para>
|
|
/// <para>创建人:王一帆</para>
|
|
/// <para>创建日期:2021-01-22 </para>
|
|
/// <para>修改人:</para>
|
|
/// <para>修改日期:</para>
|
|
/// <para>修改备注:</para>
|
|
/// <para>版本:1.0</para>
|
|
/// </summary>
|
|
/// <param name="model">The model.</param>
|
|
/// <param name="rowItem">The row item.</param>
|
|
/// <returns>System.String.</returns>
|
|
protected string GetSearchSql(GridDetailModel model)
|
|
{
|
|
string fieldName = !string.IsNullOrEmpty(model.UnionParentField) ? model.UnionParentField : BaseImpl.GetBasePrimaryKey(model.UnionModule);
|
|
DataRow dr = this.BillModelObj.DetailTreeTable ? (this.gridBillInfo as TreeGridControlEx).GetViewFocusedDataRow() : this.gridBillInfo.GridView.GetFocusedDataRow();
|
|
|
|
fieldName = dr.Table.Columns.Contains(fieldName) ? dr[fieldName].ToString() : this.ControlObj.PrimaryValue;
|
|
string sqlValue = model.IsReadOnly || model.IsChart ? model.DetailSql : model.SystemModel.MenuSql;
|
|
if (ReplaceHelper.IsSelect(sqlValue) && !string.IsNullOrEmpty(model.UnionValue))
|
|
{
|
|
string[] sqlValues = sqlValue.Split(new string[] { "where " }, StringSplitOptions.None);
|
|
if (sqlValues.Length > 1)
|
|
{
|
|
string sql = string.Empty;
|
|
for (int i = 0; i < sqlValues.Length; i++)
|
|
{
|
|
if (i == sqlValues.Length - 2)
|
|
{
|
|
sql += sqlValues[i] + string.Format(" where {0}='{1}' and ", model.UnionValue, fieldName) + sqlValues[i + 1];
|
|
break;
|
|
}
|
|
sql += sqlValues[i] + " where ";
|
|
}
|
|
sqlValue = sql;
|
|
}
|
|
else
|
|
{
|
|
sqlValue = ReplaceHelper.ReplaceWhereCond(sqlValue) + string.Format(" and {0}='{1}'", model.UnionValue, fieldName);
|
|
}
|
|
|
|
|
|
}
|
|
if (!string.IsNullOrEmpty(model.UnionCond))
|
|
{
|
|
string UnionCond = ReplaceHelper.ReplaceRowParam(dr, model.UnionCond);
|
|
sqlValue += UnionCond;
|
|
}
|
|
return sqlValue;
|
|
}
|
|
#endregion
|
|
#region 表格选中改变事件
|
|
/// <summary>
|
|
/// <para>说明:gridBillInfo选中事件</para>
|
|
/// <para>创建人:龚宇超</para>
|
|
/// <para>创建日期:2018-01-08</para>
|
|
/// <para>修改人:</para>
|
|
/// <para>修改日期:</para>
|
|
/// <para>修改备注:</para>
|
|
/// <para>版本:1.0</para>
|
|
/// </summary>
|
|
private void gridBillInfo_SelectionChanged(object sender, DevExpress.Data.SelectionChangedEventArgs e)
|
|
{
|
|
try
|
|
{
|
|
GridViewClick("1");
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
string Message = ErrorMessage.PromptErrorMessage(ex);
|
|
MessageUtil.Show(Message, ex.Message);
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// <para>说明:gridBillInfo焦点行改变事件</para>
|
|
/// <para>创建人:曹屹峰</para>
|
|
/// <para>创建日期:2023-10-13</para>
|
|
/// <para>修改人:</para>
|
|
/// <para>修改日期:</para>
|
|
/// <para>修改备注:</para>
|
|
/// <para>版本:1.0</para>
|
|
/// </summary>
|
|
private void GridView_FocusedRowObjectChanged(object sender, DevExpress.XtraGrid.Views.Base.FocusedRowObjectChangedEventArgs e)
|
|
{
|
|
try
|
|
{
|
|
GridViewClick("1");
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
string Message = ErrorMessage.PromptErrorMessage(ex);
|
|
MessageUtil.Show(Message, ex.Message);
|
|
}
|
|
}
|
|
|
|
private void TreeListObj_FocusedNodeChanged(object sender, DevExpress.XtraTreeList.FocusedNodeChangedEventArgs e)
|
|
{
|
|
try
|
|
{
|
|
GridViewClick("1");
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
string Message = ErrorMessage.PromptErrorMessage(ex);
|
|
MessageUtil.Show(Message, ex.Message);
|
|
}
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region 关闭
|
|
/// <summary>
|
|
/// <para>说明:关闭</para>
|
|
/// <para>创建人:龚宇超</para>
|
|
/// <para>创建日期:2018-01-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="EventArgs"/> instance containing the event data.</param>
|
|
private void btnClose_Click(object sender, EventArgs e)
|
|
{
|
|
try
|
|
{
|
|
if (!string.IsNullOrEmpty(this.AuditModelObj.StepCloseTip) && MessageUtil.Show(this.AuditModelObj.StepCloseTip, MessageBoxButtons.YesNo) == DialogResult.Yes)
|
|
{
|
|
string nextSelectStepCode = string.Empty;
|
|
string nextSelectStepOper = string.Empty;
|
|
this._auditAdvice = txtRemark.Text;
|
|
string result = BaseAuditImpl.Audit(out nextSelectStepCode, out nextSelectStepOper, this.SysModel, this.SysModel.StepCode, this.SysModel.BillDocumentId, "", "p_BillAudit", "Q", "0", this.txtRemark.Text, "", "", true, -1);
|
|
if ("1".Equals(result))
|
|
{
|
|
MessageUtil.Show(ResourceKeys.CloseSuccess);
|
|
this.DialogResult = DialogResult.OK;
|
|
}
|
|
else
|
|
{
|
|
MessageUtil.Show(ResourceKeys.CloseFail + "\r\n" + result);
|
|
}
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
LogUtil.WriteError("关闭出错!", ex);
|
|
//MessageUtil.Show("关闭出错!" + ex);
|
|
string Message = ErrorMessage.PromptErrorMessage(ex);
|
|
MessageUtil.Show(Message, ex.Message);
|
|
}
|
|
|
|
}
|
|
#endregion
|
|
|
|
#region 返回审核
|
|
/// <summary>
|
|
/// <para>说明:返回审核</para>
|
|
/// <para>创建人:龚宇超</para>
|
|
/// <para>创建日期:2018-01-09</para>
|
|
/// <para>修改人:</para>
|
|
/// <para>修改日期:</para>
|
|
/// <para>修改备注:</para>
|
|
/// <para>版本:1.0</para>
|
|
/// </summary>
|
|
/// <param name="row">The row.</param>
|
|
/// <returns>System.Int32.</returns>
|
|
private int ExecuteBackSelect(DataRow row)
|
|
{
|
|
if (row == null)
|
|
{
|
|
MessageUtil.Show(ResourceKeys.NoFindAntiauditBill);
|
|
return -9;
|
|
}
|
|
if (this.BillModelObj.BackSelected == "0") return -1;
|
|
if (this.SysModel.StepCode == "100")
|
|
{
|
|
FrmBackSelect frmBackSelNew = new FrmBackSelect();
|
|
//frmBackSelNew.FrmBackSelectEx.StepSelection.Hide();
|
|
frmBackSelNew.SysModel = this.SysModel;
|
|
frmBackSelNew.BillModelObj = this.BillModelObj;
|
|
frmBackSelNew.InitControlSpecial();
|
|
if (frmBackSelNew.ShowDialog() != DialogResult.OK) return -9;
|
|
this._auditAdvice = frmBackSelNew.ComfirmMsg;
|
|
return 0;
|
|
}
|
|
|
|
FrmBackSelect frmBackSel = new FrmBackSelect();
|
|
frmBackSel.SysModel = this.SysModel;
|
|
frmBackSel.BillModelObj = this.BillModelObj;
|
|
frmBackSel.InitControl();
|
|
if (frmBackSel.ShowDialog() != DialogResult.OK) return -9;
|
|
this._auditAdvice = frmBackSel.ComfirmMsg;
|
|
return frmBackSel.SelectStepCode;
|
|
}
|
|
#endregion
|
|
|
|
#region 审核事件
|
|
/// <summary>
|
|
/// <para>说明:提醒审核事件</para>
|
|
/// <para>创建人:龚宇超</para>
|
|
/// <para>创建日期:2020-08-20</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 btnRemindAccradit_Click(object sender, EventArgs e)
|
|
{
|
|
try
|
|
{
|
|
if (VerificationRequired()) return;
|
|
|
|
if (this.SysModel.ConfirmId == "1" || this.SysModel.StepOver == "1")
|
|
{
|
|
if (BillAuditImpl.ConfirmAudit(this.SysModel.UserId, this.txtRemark.Text, this.SysModel.ModuleCode, this.SysModel.BillDocumentId) > 0)
|
|
{
|
|
MessageUtil.Show(ResourceKeys.ConfirmSuccess);
|
|
if (refreshThePage != null) refreshThePage("", ERPInfo.Instance.PageControl.SelectedTabPage.Tag + "");
|
|
this.Close();
|
|
}
|
|
else
|
|
{
|
|
MessageUtil.Show(ResourceKeys.ConfirmFail);
|
|
}
|
|
}
|
|
else
|
|
{
|
|
bool isAudit = true;
|
|
string confirmOpers = string.Empty, remindOpers = string.Empty;
|
|
FrmRemindSelectForm formRemind = new FrmRemindSelectForm();
|
|
formRemind.FieldValue = this.SysModel.BillDocumentId;
|
|
formRemind.MenuCode = this.SysModel.ModuleCode;
|
|
isAudit = formRemind.ShowDialog() == DialogResult.Yes;
|
|
confirmOpers = formRemind.ConfirmOpers;
|
|
remindOpers = formRemind.RemindOpers;
|
|
string nextSelectStepCode = string.Empty;
|
|
string nextSelectStepOper = string.Empty;
|
|
if (isAudit)
|
|
{
|
|
if (this.ControlObj.isRequiredFields(this.AuditModelObj.RequiredFields))
|
|
{
|
|
if (this.BillModelObj.DetailTreeTable)
|
|
{
|
|
if (!(this.gridBillInfo as TreeGridControlEx).isRequiredFields(this.AuditModelObj.RequiredDetailFields)) return;
|
|
}
|
|
else
|
|
{
|
|
if (!this.gridBillInfo.GridControl.isRequiredFields(this.AuditModelObj.RequiredDetailFields, this.gridBillInfo.GridView)) return;
|
|
}
|
|
if (!SaveBillData(0, false)) return;
|
|
string result = BaseAuditImpl.Audit(out nextSelectStepCode, out nextSelectStepOper, this.SysModel, this.SysModel.StepCode, this.SysModel.BillDocumentId, "", this.BillAuditComObj.ProcedureName, "F", this._flowTypeStepModel.RemindSelect, this.txtRemark.Text, remindOpers, confirmOpers);
|
|
if ("1".Equals(result))
|
|
{
|
|
PushHelper push = new PushHelper(this.SysModel.BillDocumentId, this.SysModel.StepCode, this.SysModel.ModuleCode, this._beforeUsers, this._beforeMenuName, this._beforeId);
|
|
push.Push_Bill_Oper_Message();
|
|
this.DialogResult = DialogResult.OK;
|
|
if (refreshThePage != null) refreshThePage("审核成功", ERPInfo.Instance.PageControl.SelectedTabPage.Tag + "");
|
|
}
|
|
else
|
|
{
|
|
MessageUtil.Show(ResourceKeys.AuditFail + "\r\n" + result);
|
|
}
|
|
}
|
|
|
|
|
|
}
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
LogUtil.WriteError("提醒审核事件出错!", ex);
|
|
//MessageUtil.Show("提醒审核事件出错!" + ex);
|
|
string Message = ErrorMessage.PromptErrorMessage(ex);
|
|
MessageUtil.Show(Message, ex.Message);
|
|
}
|
|
|
|
}
|
|
|
|
/// <summary>
|
|
/// <para>说明:审核事件</para>
|
|
/// <para>创建人:龚宇超</para>
|
|
/// <para>创建日期:2018-01-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="EventArgs"/> instance containing the event data.</param>
|
|
private void btnAccradit_Click(object sender, EventArgs e)
|
|
{
|
|
try
|
|
{
|
|
if (VerificationRequired()) return;
|
|
WaitForm.ShowForm(ResourceKeys.Handing);
|
|
if (this.SysModel.ConfirmId == "1")
|
|
{
|
|
if (BillAuditImpl.ConfirmAudit(this.SysModel.UserId, this.txtRemark.Text, this.SysModel.ModuleCode, this.SysModel.BillDocumentId) > 0)
|
|
{
|
|
MessageUtil.Show(ResourceKeys.ConfirmSuccess);
|
|
if (refreshThePage != null) refreshThePage("", ERPInfo.Instance.PageControl.SelectedTabPage.Tag + "");
|
|
this.Close();
|
|
}
|
|
else
|
|
{
|
|
MessageUtil.Show(ResourceKeys.ConfirmFail);
|
|
}
|
|
}
|
|
else
|
|
{
|
|
bool isAudit = true;
|
|
string confirmOpers = string.Empty, remindOpers = string.Empty;
|
|
string nextSelectStepCode = string.Empty;
|
|
string nextSelectStepOper = string.Empty;
|
|
if (isAudit)
|
|
{
|
|
if (SystemInfo.Instance.auditComfirmOpers.Split(',').Contains(ERPInfo.Instance.UserName) || "1".Equals(SystemInfo.Instance.auditComfirmOpers))
|
|
{
|
|
|
|
if (MessageUtil.Show(string.Format(ResourceKeys.ConfirmIsAudit), MessageBoxButtons.YesNo) == DialogResult.No)
|
|
{
|
|
return;
|
|
}
|
|
}
|
|
|
|
if (this.ControlObj.isRequiredFields(this.AuditModelObj.RequiredFields))
|
|
{
|
|
if (this.BillModelObj.DetailTreeTable)
|
|
{
|
|
if (!(this.gridBillInfo as TreeGridControlEx).isRequiredFields(this.AuditModelObj.RequiredDetailFields)) return;
|
|
}
|
|
else
|
|
{
|
|
if (!this.gridBillInfo.GridControl.isRequiredFields(this.AuditModelObj.RequiredDetailFields, this.gridBillInfo.GridView)) return;
|
|
}
|
|
|
|
|
|
if (!SaveBillData(0, false)) return;
|
|
|
|
string opinion = this.txtRemark.Text;//审核意见
|
|
if (this.CheckSuggestion.EditText.Equals("不同意"))
|
|
{
|
|
opinion = this.CheckSuggestion.EditText + "^" + opinion;
|
|
}
|
|
//审核前调用
|
|
if (ApiHelper.IsExecEventApi(Interface.Api.OperateEvent.BeforeModuleAuditStateChange, this.SysModel.ModuleCode, 0))
|
|
{
|
|
ApiHelper apiHelper = new ApiHelper(this.SysModel.ModuleCode, this.SysModel.BillDocumentId, this.BillModelObj.PrimaryKey, this.BillModelObj.MasterTable, 0);
|
|
apiHelper.OnEvent(Interface.Api.OperateEvent.BeforeModuleAuditStateChange, Interface.Api.ActionType.Audit);//审核
|
|
if (!apiHelper.apiHandler.GetApiSuccess(apiHelper.apiHandlerModels))
|
|
{
|
|
DialogResult dialogResult = MessageUtil.Show(ResourceKeys.AuditFail + "\r\n" + apiHelper.apiResutMsg);
|
|
return;
|
|
}
|
|
}
|
|
string result = BaseAuditImpl.Audit(out nextSelectStepCode, out nextSelectStepOper,
|
|
this.SysModel, this.SysModel.StepCode, this.SysModel.BillDocumentId, "", this.BillAuditComObj.ProcedureName, "F", this._flowTypeStepModel.RemindSelect, opinion, remindOpers, confirmOpers);
|
|
WaitForm.HideForm();
|
|
if ("1".Equals(result))
|
|
{
|
|
//推送消息
|
|
PushHelper push = new PushHelper(this.SysModel.BillDocumentId, this.SysModel.StepCode, this.SysModel.ModuleCode, this._beforeUsers, this._beforeMenuName, this._beforeId);
|
|
push.Push_Bill_Oper_Message();
|
|
#region 审核成功后调用API
|
|
if (ApiHelper.IsExecEventApi(Interface.Api.OperateEvent.AfterModuleAuditStateChange, this.SysModel.ModuleCode, 0))
|
|
{
|
|
ApiHelper apiHelper = new ApiHelper(this.SysModel.ModuleCode, this.SysModel.BillDocumentId, this.BillModelObj.PrimaryKey, this.BillModelObj.MasterTable, 0);
|
|
apiHelper.OnEvent(Interface.Api.OperateEvent.AfterModuleAuditStateChange, Interface.Api.ActionType.Audit);//审核
|
|
if (!apiHelper.apiHandler.GetApiSuccess(apiHelper.apiHandlerModels))
|
|
{
|
|
MessageUtil.Show(apiHelper.apiResutMsg);
|
|
}
|
|
}
|
|
#endregion
|
|
if (refreshThePage != null)
|
|
{
|
|
refreshThePage("审核成功", ERPInfo.Instance.PageControl.SelectedTabPage.Tag + "");
|
|
}
|
|
else
|
|
{
|
|
//上一次点开page 当前打开page删除后要选中的page
|
|
if (ERPInfo.Instance.PageControl != null)
|
|
{
|
|
string id = ERPInfo.Instance.PageControl.SelectedTabPage.Tag + "";
|
|
XtraTabPage beforePage = ERPInfo.Instance.ModuleForms[id].BeforePage;
|
|
if (beforePage != null)
|
|
{
|
|
MessageUtil.Show("审核成功");
|
|
//要删除的page
|
|
XtraTabPage removePage = new XtraTabPage();
|
|
ERPInfo.Instance.ModuleForms.Remove(id);
|
|
foreach (XtraTabPage tablepage in ERPInfo.Instance.PageControl.TabPages)
|
|
{
|
|
if (tablepage.Tag == null) continue;
|
|
if (tablepage.Tag.ToString().Equals(id)) removePage = tablepage;
|
|
if (tablepage == beforePage) ERPInfo.Instance.PageControl.SelectedTabPage = beforePage;
|
|
}
|
|
ERPInfo.Instance.PageControl.TabPages.Remove(removePage);
|
|
removePage.Dispose();
|
|
}
|
|
}
|
|
}
|
|
this.DialogResult = DialogResult.OK;
|
|
}
|
|
else
|
|
{
|
|
MessageUtil.Show(ResourceKeys.AuditFail + "\r\n" + result);
|
|
}
|
|
|
|
}
|
|
}
|
|
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
LogUtil.WriteError("审核事件出错!", ex);
|
|
MessageUtil.Show("审核事件出错!" + ex);
|
|
string Message = ErrorMessage.PromptErrorMessage(ex);
|
|
MessageUtil.Show(Message, ex.Message);
|
|
}
|
|
finally
|
|
{
|
|
WaitForm.HideForm();
|
|
}
|
|
}
|
|
#endregion
|
|
|
|
#region 分单
|
|
/// <summary>
|
|
/// <para>说明:分单</para>
|
|
/// <para>创建人:龚宇超</para>
|
|
/// <para>创建日期:2018-01-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="EventArgs"/> instance containing the event data.</param>
|
|
private void btnSpare_Click(object sender, EventArgs e)
|
|
{
|
|
try
|
|
{
|
|
FrmSpare spare = new FrmSpare();
|
|
spare.SysModel = this.SysModel;
|
|
spare.BillModel = this.BillModelObj;
|
|
spare.DtSource = this._dtSourceData;
|
|
spare.DetailSql = this.BillModelObj.DetailSql;
|
|
spare.DtNewSource = this._dtSpareSourceData;
|
|
DialogResult result = spare.ShowDialog();
|
|
this._dtSpareSourceData = spare.DtNewSource;
|
|
if (result == DialogResult.OK) checkBillSplite();
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
string Message = ErrorMessage.PromptErrorMessage(ex);
|
|
MessageUtil.Show(Message, ex.Message);
|
|
}
|
|
}
|
|
#endregion
|
|
|
|
#region 检查分单
|
|
/// <summary>
|
|
/// <para>说明:检查分单</para>
|
|
/// <para>创建人:龚宇超</para>
|
|
/// <para>创建日期:2018-01-09</para>
|
|
/// <para>修改人:</para>
|
|
/// <para>修改日期:</para>
|
|
/// <para>修改备注:</para>
|
|
/// <para>版本:1.0</para>
|
|
/// </summary>
|
|
/// <returns>System.Boolean.</returns>
|
|
private bool checkBillSplite()
|
|
{
|
|
bool createResult = false;
|
|
try
|
|
{
|
|
if (this._dtSourceData.Rows.Count > 0)
|
|
{
|
|
createSourceBillId();
|
|
//复制单据数据
|
|
createResult = createBill();
|
|
if (createResult)
|
|
{
|
|
if (this.BillModelObj.DetailTreeTable)
|
|
{
|
|
(this.gridBillInfo as TreeGridControlEx).SetGridViewDataSourceGenerateID(_dtSourceData);
|
|
}
|
|
else
|
|
{
|
|
this.gridBillInfo.SetGridViewDataSource(_dtSourceData);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
//MessageUtil.Show(ex);
|
|
string Message = ErrorMessage.PromptErrorMessage(ex);
|
|
MessageUtil.Show(Message, ex.Message);
|
|
}
|
|
return createResult;
|
|
}
|
|
#endregion
|
|
|
|
#region 单据来源
|
|
/// <summary>
|
|
/// <para>说明:单据来源</para>
|
|
/// <para>创建人:龚宇超</para>
|
|
/// <para>创建日期:2018-01-09</para>
|
|
/// <para>修改人:</para>
|
|
/// <para>修改日期:</para>
|
|
/// <para>修改备注:</para>
|
|
/// <para>版本:1.0</para>
|
|
/// </summary>
|
|
private void createSourceBillId()
|
|
{
|
|
try
|
|
{
|
|
BillAuditImpl.CreateSourceBillId(this.BillModelObj.MasterTable);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
string Message = ErrorMessage.PromptErrorMessage(ex);
|
|
MessageUtil.Show(Message, ex.Message);
|
|
}
|
|
}
|
|
#endregion
|
|
|
|
#region 导出单据明细
|
|
private void btnExport_Click(object sender, EventArgs e)
|
|
{
|
|
try
|
|
{
|
|
this.gridBillInfo.GridControl.ToExcel(this.SysModel.FormText);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
string Message = ErrorMessage.PromptErrorMessage(ex);
|
|
MessageUtil.Show(Message, ex.Message);
|
|
}
|
|
}
|
|
#endregion
|
|
#region 分配明细
|
|
private void OnBtnFPClick(object sender, EventArgs e)
|
|
{
|
|
try
|
|
{
|
|
this.gridBillInfo.GridControl.ToExcel(this.SysModel.FormText);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
string Message = ErrorMessage.PromptErrorMessage(ex);
|
|
MessageUtil.Show(Message, ex.Message);
|
|
}
|
|
}
|
|
#endregion
|
|
#region 分单创建单据
|
|
/// <summary>
|
|
/// <para>说明:分单创建单据</para>
|
|
/// <para>创建人:龚宇超</para>
|
|
/// <para>创建日期:2018-01-10</para>
|
|
/// <para>修改人:</para>
|
|
/// <para>修改日期:</para>
|
|
/// <para>修改备注:</para>
|
|
/// <para>版本:1.0</para>
|
|
/// </summary>
|
|
private bool createBill()
|
|
{
|
|
string defaultValue = SqlHelper.ExecuteScalar(string.Format("select defaultValue from p_systembillinfo where typecode = '{0}' and fieldName = '{1}'", this.SysModel.ModuleCode, this.BillModelObj.MasterPreFix + "billdocument_id")) + "";
|
|
if (!string.IsNullOrEmpty(defaultValue))
|
|
{
|
|
defaultValue = BaseImpl.GetDefaultValue(defaultValue);
|
|
}
|
|
string billNo = this.BillModelObj.NewVer == 1 ? BillImpl.GetBillNo(this.BillModelObj.BillSeq) : defaultValue;
|
|
//构造表头
|
|
string masterSql = this.GetBillHearder(billNo);
|
|
//构造明细"@billdocument_id@"
|
|
string detailSql = this.GetBillDetail(this.BillModelObj.NewVer == 1 ? billNo : billNo);
|
|
//分单处理
|
|
string msg = string.Empty;
|
|
string detailGuid = Guid.NewGuid().ToString();
|
|
//int returnValue = BillImpl.BillSave(masterSql, detailSql, BillModelObj.DetailTable, ref billNo, detailGuid, BillModelObj.BillSeq, BillModelObj.SaveState ? 2 : 1, 0, out msg, 0, this.BillModelObj.NewVer);
|
|
int returnValue = BillAuditImpl.SpliteBill(out msg, masterSql, detailSql, billNo, this.SysModel.ModuleCode, this.SysModel.BillDocumentId);
|
|
if (returnValue == 1)
|
|
{
|
|
MessageUtil.Show(ResourceKeys.SpliterBillSuccess);
|
|
this._dtSourceData = BillImpl.GetDataTableResult(ReplaceHelper.ReplaceParamToValue(this.BillModelObj.DetailSql, this.SysModel.BillDocumentId));
|
|
this._dtSourceData.OrderBy(this.BillModelObj.DetailOrderField);
|
|
this._dtSpareSourceData.Clear();
|
|
return true;
|
|
}
|
|
else if (returnValue != 9)
|
|
{
|
|
MessageUtil.Show(string.Format(ResourceKeys.SpliterBillFail, returnValue, msg));
|
|
}
|
|
return false;
|
|
}
|
|
#endregion
|
|
|
|
#region 构造表头
|
|
/// <summary>
|
|
/// <para>说明:构造表头</para>
|
|
/// <para>创建人:龚宇超</para>
|
|
/// <para>创建日期:2018-01-09</para>
|
|
/// <para>修改人:</para>
|
|
/// <para>修改日期:</para>
|
|
/// <para>修改备注:</para>
|
|
/// <para>版本:1.0</para>
|
|
/// </summary>
|
|
private string GetBillHearder(string billNo)
|
|
{
|
|
StringBuilder fieldBuilder = new StringBuilder();
|
|
StringBuilder valueBuilder = new StringBuilder();
|
|
|
|
DataTable rowTab = SqlHelper.ExecuteDataTable(string.Format("select * from {0} where {1} = '{2}'", this.BillModelObj.MasterTable, this.BillModelObj.PrimaryKey, this.SysModel.BillDocumentId));
|
|
if (rowTab != null && rowTab.Rows.Count > 0)
|
|
{
|
|
DataRow row = rowTab.Rows[0];
|
|
string autogrowcolumn = SqlHelper.ExecuteScalar(string.Format("SELECT COLUMN_NAME FROM INFORMATION_SCHEMA.columns WHERE TABLE_NAME='{0}' AND COLUMNPROPERTY(OBJECT_ID('{0}'),COLUMN_NAME,'IsIdentity')=1", this.BillModelObj.MasterTable)) + "";//自增长列
|
|
foreach (DataColumn column in row.Table.Columns)
|
|
{
|
|
if (column.ColumnName.Equals(autogrowcolumn) || column.ColumnName.Equals(this.BillModelObj.PrimaryKey, StringComparison.CurrentCultureIgnoreCase))
|
|
continue;
|
|
string fieldValue = row[column] + "";
|
|
fieldBuilder.Append(column.ColumnName + ",");
|
|
valueBuilder.AppendFormat("'{0}',", fieldValue);
|
|
}
|
|
}
|
|
//foreach (ControlModel model in this.ControlObj.ControlModels)
|
|
//{
|
|
// if (!model.IsSave ||
|
|
// model.FieldName.Equals(BillModelObj.PrimaryKey, StringComparison.OrdinalIgnoreCase) ||
|
|
// model.FieldType == ControlType.LabPic ||
|
|
// model.FieldType == ControlType.LabPicEx)
|
|
// continue;
|
|
// string fieldValue = this.ControlObj.GetControlValue(model);
|
|
// fieldBuilder.Append(model.FieldName + ",");
|
|
// valueBuilder.AppendFormat("'{0}',", fieldValue);
|
|
//}
|
|
fieldBuilder.Append(this.BillModelObj.PrimaryKey + ",");
|
|
valueBuilder.AppendFormat("'{0}',", billNo);
|
|
return string.Format(@"insert into {0} ({1})values({2})", this.BillModelObj.MasterTable, fieldBuilder.ToString().TrimEnd(','), valueBuilder.ToString().TrimEnd(','));
|
|
}
|
|
#endregion
|
|
|
|
#region 构造明细
|
|
/// <summary>
|
|
/// <para>说明:构造明细</para>
|
|
/// <para>创建人:龚宇超</para>
|
|
/// <para>创建日期:2018-01-09</para>
|
|
/// <para>修改人:</para>
|
|
/// <para>修改日期:</para>
|
|
/// <para>修改备注:</para>
|
|
/// <para>版本:1.0</para>
|
|
/// </summary>
|
|
/// <param name="billNo">单据编号.</param>
|
|
private string GetBillDetail(string billNo)
|
|
{
|
|
string ids = string.Empty;
|
|
string detailPrefix = BaseImpl.GetColumnPrefix(this.BillModelObj.DetailTable);
|
|
string sourceId = detailPrefix + "id";
|
|
foreach (DataRow item in _dtSpareSourceData.Rows)
|
|
{
|
|
ids += item[sourceId] + ",";
|
|
}
|
|
return string.Format("update {0} set {1}Billdocument_id='{2}' where {4} in ({3})", this.BillModelObj.DetailTable, detailPrefix, billNo, ids.TrimEnd(','), sourceId);
|
|
|
|
}
|
|
#endregion
|
|
|
|
#region 返退
|
|
/// <summary>
|
|
/// <para>说明:提醒返回审核</para>
|
|
/// <para>创建人:王一帆</para>
|
|
/// <para>创建日期:2020-08-20</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 btnRemindReturn_Click(object sender, EventArgs e)
|
|
{
|
|
try
|
|
{
|
|
if (VerificationRequired()) return;
|
|
|
|
this._auditAdvice = txtRemark.Text;
|
|
int ret = ExecuteBackSelect(this._drBillInfoMsg);
|
|
if (ret == -9) return;
|
|
string nextSelectStepCode = string.Empty;
|
|
string nextSelectStepOper = string.Empty;
|
|
if (this.SysModel.StepOver == "1")
|
|
{
|
|
if (MessageUtil.Show(ResourceKeys.ConfimAuditFailAndReturnBill, MessageBoxButtons.YesNo) == DialogResult.Yes)
|
|
{
|
|
string result = BaseAuditImpl.Audit(out nextSelectStepCode, out nextSelectStepOper,
|
|
this.SysModel, this.SysModel.StepCode, this.SysModel.BillDocumentId, "", this.BillAuditComObj.ProcedureName, "R", this._flowTypeStepModel.RemindSelect, this._auditAdvice, "", "", true, ret, 0, true);
|
|
if (result == "1")
|
|
{
|
|
MessageUtil.Show(ResourceKeys.ForcedSuccess);
|
|
PushHelper push = new PushHelper(this.SysModel.BillDocumentId, this.SysModel.StepCode, this.SysModel.ModuleCode, this._beforeUsers, this._beforeMenuName, this._beforeId);
|
|
push.Push_Bill_Oper_Message();
|
|
this.DialogResult = DialogResult.OK;
|
|
if (refreshThePage != null) refreshThePage("", ERPInfo.Instance.PageControl.SelectedTabPage.Tag + "");
|
|
}
|
|
else
|
|
{
|
|
MessageUtil.Show(string.Format(ResourceKeys.ForcedFail, result));
|
|
}
|
|
}
|
|
}
|
|
else
|
|
{
|
|
bool isAudit = true;
|
|
string confirmOpers = string.Empty, remindOpers = string.Empty;
|
|
FrmRemindSelectForm formRemind = new FrmRemindSelectForm();
|
|
formRemind.FieldValue = this.SysModel.BillDocumentId;
|
|
formRemind.MenuCode = this.SysModel.ModuleCode;
|
|
isAudit = formRemind.ShowDialog() == DialogResult.Yes;
|
|
confirmOpers = formRemind.ConfirmOpers;
|
|
remindOpers = formRemind.RemindOpers;
|
|
if (isAudit)
|
|
{
|
|
string result = BaseAuditImpl.Audit(out nextSelectStepCode, out nextSelectStepOper,
|
|
this.SysModel, this.SysModel.StepCode, this.SysModel.BillDocumentId, "", this.BillAuditComObj.ProcedureName, "R", this._flowTypeStepModel.RemindSelect, this._auditAdvice, remindOpers, confirmOpers, true, ret);
|
|
if (result == "1")
|
|
{
|
|
MessageUtil.Show(ResourceKeys.ForcedSuccess);
|
|
PushHelper push = new PushHelper(this.SysModel.BillDocumentId, this.SysModel.StepCode, this.SysModel.ModuleCode, this._beforeUsers, this._beforeMenuName, this._beforeId);
|
|
push.Push_Bill_Oper_Message();
|
|
this.DialogResult = DialogResult.OK;
|
|
if (refreshThePage != null) refreshThePage("", ERPInfo.Instance.PageControl.SelectedTabPage.Tag + "");
|
|
}
|
|
else
|
|
{
|
|
MessageUtil.Show(string.Format(ResourceKeys.ForcedFail, result));
|
|
}
|
|
}
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
LogUtil.WriteError("提醒返回审核出错!", ex);
|
|
//MessageUtil.Show("提醒返回审核出错!" + ex);
|
|
string Message = ErrorMessage.PromptErrorMessage(ex);
|
|
MessageUtil.Show(Message, ex.Message);
|
|
}
|
|
|
|
}
|
|
/// <summary>
|
|
/// <para>说明:返回审核</para>
|
|
/// <para>创建人:龚宇超</para>
|
|
/// <para>创建日期:2018-01-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="EventArgs"/> instance containing the event data.</param>
|
|
private void btnReturn_Click(object sender, EventArgs e)
|
|
{
|
|
try
|
|
{
|
|
if (VerificationRequired()) return;
|
|
|
|
this._auditAdvice = txtRemark.Text;
|
|
int ret = ExecuteBackSelect(this._drBillInfoMsg);
|
|
if (ret == -9) return;
|
|
string nextSelectStepCode = string.Empty;
|
|
string nextSelectStepOper = string.Empty;
|
|
if (this.SysModel.StepOver == "1")
|
|
{
|
|
if (MessageUtil.Show(ResourceKeys.ConfimAuditFailAndReturnBill, MessageBoxButtons.YesNo) == DialogResult.Yes)
|
|
{
|
|
if (!SaveBillData(0, false)) return;
|
|
//反退前调用
|
|
if (ApiHelper.IsExecEventApi(Interface.Api.OperateEvent.BeforeModuleAuditStateChange, this.SysModel.ModuleCode, 0))
|
|
{
|
|
ApiHelper apiHelper = new ApiHelper(this.SysModel.ModuleCode, this.SysModel.BillDocumentId, this.BillModelObj.PrimaryKey, this.BillModelObj.MasterTable, 0);
|
|
apiHelper.OnEvent(Interface.Api.OperateEvent.BeforeModuleAuditStateChange, Interface.Api.ActionType.AuditBack);//审核
|
|
if (!apiHelper.apiHandler.GetApiSuccess(apiHelper.apiHandlerModels))
|
|
{
|
|
DialogResult dialogResult = MessageUtil.Show(ResourceKeys.ForcedFail + "\r\n" + apiHelper.apiResutMsg);
|
|
return;
|
|
}
|
|
}
|
|
string result = BaseAuditImpl.Audit(out nextSelectStepCode, out nextSelectStepOper,
|
|
this.SysModel, this.SysModel.StepCode, this.SysModel.BillDocumentId, "", this.BillAuditComObj.ProcedureName, "R", this._flowTypeStepModel.RemindSelect, this._auditAdvice, "", "", true, ret, 0, true);
|
|
if (result == "1")
|
|
{
|
|
MessageUtil.Show(ResourceKeys.ForcedSuccess);
|
|
PushHelper push = new PushHelper(this.SysModel.BillDocumentId, this.SysModel.StepCode, this.SysModel.ModuleCode, this._beforeUsers, this._beforeMenuName, this._beforeId);
|
|
push.Push_Bill_Oper_Message();
|
|
//反退后调用
|
|
if (ApiHelper.IsExecEventApi(Interface.Api.OperateEvent.AfterModuleAuditStateChange, this.SysModel.ModuleCode, 0))
|
|
{
|
|
ApiHelper apiHelper = new ApiHelper(this.SysModel.ModuleCode, this.SysModel.BillDocumentId, this.BillModelObj.PrimaryKey, this.BillModelObj.MasterTable, 0);
|
|
apiHelper.OnEvent(Interface.Api.OperateEvent.AfterModuleAuditStateChange, Interface.Api.ActionType.AuditBack);
|
|
if (!apiHelper.apiHandler.GetApiSuccess(apiHelper.apiHandlerModels))
|
|
{
|
|
MessageUtil.Show(apiHelper.apiResutMsg);
|
|
}
|
|
}
|
|
this.DialogResult = DialogResult.OK;
|
|
if (refreshThePage != null) refreshThePage("", ERPInfo.Instance.PageControl.SelectedTabPage.Tag + "");
|
|
|
|
}
|
|
else
|
|
{
|
|
MessageUtil.Show(string.Format(ResourceKeys.ForcedFail, result));
|
|
}
|
|
}
|
|
}
|
|
else
|
|
{
|
|
if (SystemInfo.Instance.backAuditComfirmOpers.Split(',').Contains(ERPInfo.Instance.UserName) || "1".Equals(SystemInfo.Instance.backAuditComfirmOpers))
|
|
{
|
|
if (MessageUtil.Show(string.Format(ResourceKeys.ConfimAuditFailAndReturnBill), MessageBoxButtons.YesNo) == DialogResult.No)
|
|
{
|
|
return;
|
|
}
|
|
}
|
|
bool isAudit = true;
|
|
string confirmOpers = string.Empty, remindOpers = string.Empty;
|
|
if (isAudit)
|
|
{
|
|
string result = BaseAuditImpl.Audit(out nextSelectStepCode, out nextSelectStepOper,
|
|
this.SysModel, this.SysModel.StepCode, this.SysModel.BillDocumentId, "", this.BillAuditComObj.ProcedureName, "R", this._flowTypeStepModel.RemindSelect, this._auditAdvice, remindOpers, confirmOpers, true, ret);
|
|
if (result == "1")
|
|
{
|
|
MessageUtil.Show(ResourceKeys.ForcedSuccess);
|
|
PushHelper push = new PushHelper(this.SysModel.BillDocumentId, this.SysModel.StepCode, this.SysModel.ModuleCode, this._beforeUsers, this._beforeMenuName, this._beforeId);
|
|
push.Push_Bill_Oper_Message();
|
|
this.DialogResult = DialogResult.OK;
|
|
if (refreshThePage != null) refreshThePage("", ERPInfo.Instance.PageControl.SelectedTabPage.Tag + "");
|
|
}
|
|
else
|
|
{
|
|
MessageUtil.Show(string.Format(ResourceKeys.ForcedFail, result));
|
|
}
|
|
}
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
LogUtil.WriteError("返回审核出错!", ex);
|
|
MessageUtil.Show("返回审核出错!" + ex);
|
|
string Message = ErrorMessage.PromptErrorMessage(ex);
|
|
MessageUtil.Show(Message, ex.Message);
|
|
}
|
|
|
|
}
|
|
#endregion
|
|
|
|
#region 记录本次推送人员
|
|
/// <summary>
|
|
/// <para>说明:记录本次推送人员</para>
|
|
/// <para>创建人:龚宇超</para>
|
|
/// <para>创建日期:2018-01-09 </para>
|
|
/// <para>修改人:</para>
|
|
/// <para>修改日期:</para>
|
|
/// <para>修改备注:</para>
|
|
/// <para>版本:1.0</para>
|
|
/// </summary>
|
|
private void GetPushOpers()
|
|
{
|
|
DataRow beforeOpers = null;
|
|
if (ProcessExists)
|
|
{
|
|
beforeOpers = Lskj.Data.Caches.CacheSYSConfig.Instance().AccessToContentRow();
|
|
}
|
|
else
|
|
{
|
|
beforeOpers = BillAuditImpl.GetPushedOpers(this.SysModel.BillDocumentId, this.SysModel.StepCode);
|
|
}
|
|
|
|
if (beforeOpers != null)
|
|
{
|
|
//记录本次操作信息
|
|
this._beforeMenuName = beforeOpers["menuname"] + "";
|
|
this._beforeUsers = beforeOpers["operators"] + "";
|
|
this._beforeId = Convert.ToInt32(beforeOpers["id"]);
|
|
}
|
|
}
|
|
#endregion
|
|
|
|
#region 保存单据
|
|
/// <summary>
|
|
/// <para>说明:保存单据</para>
|
|
/// <para>创建人:龚宇超</para>
|
|
/// <para>创建日期:2018-01-10 </para>
|
|
/// <para>修改人:</para>
|
|
/// <para>修改日期:</para>
|
|
/// <para>修改备注:</para>
|
|
/// <para>版本:1.0</para>
|
|
/// </summary>
|
|
private void btnSave_Click(object sender, EventArgs e)
|
|
{
|
|
try
|
|
{
|
|
SaveBillData();
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
string Message = ErrorMessage.PromptErrorMessage(ex);
|
|
MessageUtil.Show(Message, ex.Message);
|
|
}
|
|
}
|
|
/// <summary>
|
|
/// <para>说明:保存单据</para>
|
|
/// <para>创建人:龚宇超</para>
|
|
/// <para>创建日期:2018-01-10 </para>
|
|
/// <para>修改人:</para>
|
|
/// <para>修改日期:</para>
|
|
/// <para>修改备注:</para>
|
|
/// <para>版本:1.0</para>
|
|
/// </summary>
|
|
/// <param name="confirmFlag">保存确认标记</param>
|
|
private bool SaveBillData(int confirmFlag = 0, bool showMsg = true)
|
|
{
|
|
bool save = false;
|
|
try
|
|
{
|
|
string HeaderError = string.Empty;//表头错误
|
|
string FormError = string.Empty;//表格内容错误
|
|
string SaveErrorMessage = string.Empty;//提示错误
|
|
|
|
string guid = Guid.NewGuid().ToString();
|
|
string masterSql = GetUpdateBillHeader(out HeaderError);
|
|
string detailSql = GetDetailRecord(guid, out FormError);
|
|
if (string.IsNullOrEmpty(detailSql) && !this.BillModelObj.SaveNullDetail)
|
|
{
|
|
MessageUtil.Show(ResourceKeys.BillDetailIsNotNull);
|
|
return false;
|
|
}
|
|
string tipMsg = string.Empty;
|
|
if (!this.ControlObj.VerifyNull()) return false;
|
|
SaveErrorMessage = HeaderError + FormError;
|
|
if (!string.IsNullOrEmpty(SaveErrorMessage))
|
|
{
|
|
MessageUtil.Show(SaveErrorMessage);
|
|
return false;
|
|
}
|
|
int result = BillImpl.BillSave(masterSql, detailSql, this.BillModelObj.DetailTable, ref this.SysModel.BillDocumentId, guid, this.BillModelObj.BillSeq, 2, confirmFlag, out tipMsg, 1, this.BillModelObj.NewVer);
|
|
switch (result)
|
|
{
|
|
case 1:
|
|
if (showMsg)
|
|
MessageUtil.Show(ResourceKeys.SaveSuccess);
|
|
save = true;
|
|
#region 修改保存成功后调用API
|
|
if (ApiHelper.IsExecEventApi(Interface.Api.OperateEvent.AfterModuleDataChange, this.SysModel.ModuleCode, 0))
|
|
{
|
|
ApiHelper apiHelper = new ApiHelper(this.SysModel.ModuleCode, this.SysModel.BillDocumentId, this.BillModelObj.PrimaryKey, this.BillModelObj.MasterTable, 0);
|
|
apiHelper.OnEvent(Interface.Api.OperateEvent.AfterModuleDataChange, Interface.Api.ActionType.Update);//修改
|
|
if (!apiHelper.apiHandler.GetApiSuccess(apiHelper.apiHandlerModels))
|
|
{
|
|
MessageUtil.Show(apiHelper.apiResutMsg);
|
|
}
|
|
}
|
|
#endregion
|
|
break;
|
|
case 9:
|
|
if (MessageUtil.Show(tipMsg, MessageBoxButtons.YesNo) == DialogResult.Yes)
|
|
save = SaveBillData(1, showMsg);
|
|
break;
|
|
default:
|
|
MessageUtil.Show(string.Format(ResourceKeys.OperateFail, result, tipMsg));
|
|
break;
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
string Message = ErrorMessage.PromptErrorMessage(ex);
|
|
MessageUtil.Show(Message, ex.Message);
|
|
}
|
|
// 刷新主表
|
|
this._drBillInfoMsg = BaseAuditImpl.GetCurrentFlowRowData(this.BillModelObj.MasterTable, this.BillModelObj.PrimaryKey, this.SysModel.BillDocumentId);
|
|
this.ControlObj.CanExecControl = false;
|
|
this.ControlObj.SetAllControlValue(this._drBillInfoMsg);//刷新表头数据
|
|
this.ControlObj.CanExecControl = true;
|
|
|
|
// 刷新明细表
|
|
this._dtSourceData = BillImpl.GetDataTableResult(ReplaceHelper.ReplaceParamToValue(this.BillModelObj.DetailSql, this.SysModel.BillDocumentId));
|
|
this._dtSourceData.OrderBy(this.BillModelObj.DetailOrderField);
|
|
|
|
if (this.BillModelObj.DetailTreeTable)
|
|
{
|
|
(this.gridBillInfo as TreeGridControlEx).SetGridViewDataSourceGenerateID(_dtSourceData);
|
|
}
|
|
else
|
|
{
|
|
this.gridBillInfo.SetGridViewDataSource(_dtSourceData);
|
|
}
|
|
|
|
return save;
|
|
}
|
|
#endregion
|
|
|
|
#region 修改表头
|
|
/// <summary>
|
|
/// <para>说明:获取修改表头</para>
|
|
/// <para>创建人:龚宇超</para>
|
|
/// <para>创建日期:2018-01-10 </para>
|
|
/// <para>修改人:</para>
|
|
/// <para>修改日期:</para>
|
|
/// <para>修改备注:</para>
|
|
/// <para>版本:1.0</para>
|
|
/// </summary>
|
|
/// <returns>System.String.</returns>
|
|
private string GetUpdateBillHeader(out string SaveErrorMessage)
|
|
{
|
|
StringBuilder updateBuilder = new StringBuilder();
|
|
DataTable DetailedProperties = BaseImpl.GetDataTableResult(string.Format("select COLUMN_NAME,DATA_TYPE,CHARACTER_MAXIMUM_LENGTH from information_schema.columns where table_name = '{0}'", this.BillModelObj.MasterTable));
|
|
string errorMessage = string.Empty;
|
|
foreach (ControlModel model in this.ControlObj.ControlModels)
|
|
{
|
|
if (!model.IsSave ||
|
|
model.FieldType == ControlType.LabPic ||
|
|
model.FieldType == ControlType.LabPicEx)
|
|
continue;
|
|
if (this.ControlObj.FindControl(model) != null)
|
|
{
|
|
string fieldValue = this.ControlObj.GetControlValue(model);
|
|
string newfieldValue = fieldValue;
|
|
if (fieldValue == "****") continue;
|
|
|
|
if ((model.FieldType == ControlType.LabDate ||
|
|
model.FieldType == ControlType.LabDate ||
|
|
model.FieldType == ControlType.LabDate ||
|
|
model.FieldType == ControlType.LabDate ||
|
|
model.FieldType == ControlType.LabDate) && string.IsNullOrEmpty(fieldValue))
|
|
{
|
|
fieldValue = "NULL";
|
|
}
|
|
else
|
|
{
|
|
fieldValue = "N'" + fieldValue + "'";
|
|
}
|
|
|
|
updateBuilder.AppendFormat("{0}={1},", model.FieldName, fieldValue);
|
|
errorMessage = errorMessage + DatabaseFormatJudgment.SaveOrModifyBalidation(DetailedProperties, model, newfieldValue);
|
|
}
|
|
}
|
|
SaveErrorMessage = errorMessage;
|
|
return string.Format("update {0} set {1} where {2}='{3}'", this.BillModelObj.MasterTable, updateBuilder.ToString().TrimEnd(','), BillModelObj.PrimaryKey, this.SysModel.BillDocumentId);
|
|
}
|
|
#endregion
|
|
|
|
#region 获取明细
|
|
/// <summary>
|
|
/// <para>说明:获取明细</para>
|
|
/// <para>创建人:龚宇超</para>
|
|
/// <para>创建日期:2017-01-10 </para>
|
|
/// <para>修改人:</para>
|
|
/// <para>修改日期:</para>
|
|
/// <para>修改备注:</para>
|
|
/// <para>版本:1.0</para>
|
|
/// </summary>
|
|
/// <returns>System.String.</returns>
|
|
private string GetDetailRecord(string guid, out string SaveErrorMessage)
|
|
{
|
|
// 构造明细
|
|
StringBuilder detailBuilder = new StringBuilder();
|
|
DataTable DetailedProperties = BaseImpl.GetDataTableResult(string.Format("select COLUMN_NAME,DATA_TYPE,CHARACTER_MAXIMUM_LENGTH from information_schema.columns where table_name = '{0}'", BillModelObj.DetailTable + "_temp"));//单据明细性表
|
|
string errorMessage = string.Empty;
|
|
DataTable detailTable = this.gridBillInfo.GridControl.DataSourceTable().TrimDeleteRows();
|
|
if (this.BillModelObj.DetailTreeTable)
|
|
{
|
|
detailTable = ((this.gridBillInfo as TreeGridControlEx).TreeListObj.DataSource as DataTable).TrimDeleteRows();
|
|
}
|
|
|
|
if (detailTable.Rows.Count > 0)
|
|
{
|
|
DataTable BillTempColumns = BaseImpl.GetDataTableResult(string.Format("select * from {0} where 1<>1", BillModelObj.DetailTable + "_temp"));
|
|
foreach (DataRow dataRow in detailTable.Rows)
|
|
{
|
|
StringBuilder fields = new StringBuilder();
|
|
StringBuilder values = new StringBuilder();
|
|
string detailSql = @"insert into " + BillModelObj.DetailTable + "_temp" + "({0}) values({1})";
|
|
|
|
fields.Append("sysstr,");
|
|
values.Append("'" + guid + "',");
|
|
foreach (DataColumn item in detailTable.Columns)
|
|
{
|
|
fields.Append(item.ColumnName + ",");
|
|
string fieldValue = (dataRow[item] + "").Replace("'", "''");
|
|
if (!BillTempColumns.Columns.Contains(item.ColumnName))
|
|
{
|
|
string type = "varchar(50)";
|
|
if (item.DataType == typeof(DateTime))
|
|
{
|
|
type = "datetime";
|
|
}
|
|
BaseImpl.ExecSqlValue(string.Format("alter table {0} add {1} {2}", BillModelObj.DetailTable + "_temp", item.ColumnName, type));
|
|
}
|
|
if (!string.IsNullOrWhiteSpace(fieldValue))
|
|
{
|
|
values.Append(item.DataType == typeof(DateTime) ? "N'" + Convert.ToDateTime(fieldValue).ToString("yyyy-MM-dd HH:mm:ss") + "'," : "N'" + fieldValue + "',");
|
|
}
|
|
else
|
|
{
|
|
if (item.DataType == typeof(Decimal) ||
|
|
item.DataType == typeof(Double) ||
|
|
item.DataType == typeof(Int16) ||
|
|
item.DataType == typeof(Int32) ||
|
|
item.DataType == typeof(Int64))
|
|
values.Append("0,");
|
|
else if (item.DataType == typeof(DateTime))
|
|
values.Append("NULL,");
|
|
else
|
|
values.Append("'',");
|
|
}
|
|
errorMessage = errorMessage + DatabaseFormatJudgment.SaveOrModifyBalidation(DetailedProperties, dataRow, item, fieldValue);
|
|
}
|
|
detailBuilder.AppendFormat(detailSql, fields.ToString().Trim(','), values.ToString().Trim(','));
|
|
}
|
|
}
|
|
SaveErrorMessage = errorMessage;
|
|
return detailBuilder.ToString();
|
|
}
|
|
#endregion
|
|
|
|
#region 附件管理
|
|
/// <summary>
|
|
/// <para>说明:附件管理</para>
|
|
/// <para>创建人:龚宇超</para>
|
|
/// <para>创建日期:2017-01-25 </para>
|
|
/// <para>修改人:</para>
|
|
/// <para>修改日期:</para>
|
|
/// <para>修改备注:</para>
|
|
/// <para>版本:1.0</para>
|
|
/// </summary>
|
|
/// <returns>System.String.</returns>
|
|
private void btnAttach_Click(object sender, EventArgs e)
|
|
{
|
|
try
|
|
{
|
|
if (string.IsNullOrWhiteSpace(this.SysModel.BillDocumentId))
|
|
{
|
|
MessageUtil.Show(ResourceKeys.NotFoundBillNo);
|
|
}
|
|
else
|
|
{
|
|
string url = string.Format("pages/PhotoView.html?left=1&username={0}&password={1}&id={2}&dllcoid={4}&isview={3}", ERPInfo.Instance.UserName, ERPInfo.Instance.Password, this.SysModel.BillDocumentId, this.btnAccradit.Enabled ? "0" : "1", this.SysModel.ModuleCode);
|
|
// 固定传入参数(窗口标题、操作员ID、操作员名称、权限、模版编号)
|
|
string[] defaultArgs = string.Format(ModuleArgs.DefaultArgs, this.SysModel.FormText, this.SysModel.UserId, this.SysModel.UserName, this.SysModel.Privilege, this.SysModel.ModuleCode).Split('~');
|
|
string[] menuArgs = SystemInfo.Instance.BsAttachFlag.Equals("1") ? new string[] { "", "", url } : new string[] { this.SysModel.BillDocumentId, "0", this.BillModelObj.DirId + "", "", "", "", "", this.SysModel.StepOver };
|
|
string[] args = defaultArgs.Concat(menuArgs).ToArray();
|
|
IForm form = FormHelper.LoadDllForm(SystemInfo.Instance.BsAttachFlag.Equals("1") ? ResourceDynamic.PubBrower : ResourceDynamic.PhotoView, args);
|
|
form.SubForm.StartPosition = FormStartPosition.CenterScreen;
|
|
DialogResult result = form.SubForm.ShowDialog();
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
string Message = ErrorMessage.PromptErrorMessage(ex);
|
|
MessageUtil.Show(Message, ex.Message);
|
|
}
|
|
}
|
|
#endregion
|
|
|
|
#region 记载分割条位置
|
|
private void splitLeft_SplitterPositionChanged(object sender, EventArgs e)
|
|
{
|
|
if (this._isInitFinish)
|
|
{
|
|
IniHelper.Write(string.Format("base_spliterPositionLeft_{0}", this.SysModel.ModuleCode), this.splitLeft.SplitterPosition + "");
|
|
}
|
|
}
|
|
|
|
private void splitMain_SplitterPositionChanged(object sender, EventArgs e)
|
|
{
|
|
if (this._isInitFinish)
|
|
{
|
|
IniHelper.Write(string.Format("base_spliterPositionMain_{0}", this.SysModel.ModuleCode), this.splitMain.SplitterPosition + "");
|
|
}
|
|
}
|
|
#endregion
|
|
|
|
/// <summary>
|
|
/// <para>说明:初始化分割条位置</para>
|
|
/// <para>创建人:龚宇超</para>
|
|
/// <para>创建日期:2017-01-25 </para>
|
|
/// <para>修改人:</para>
|
|
/// <para>修改日期:</para>
|
|
/// <para>修改备注:</para>
|
|
/// <para>版本:1.0</para>
|
|
/// </summary>
|
|
private void InitializeSplitterPosition()
|
|
{
|
|
try
|
|
{
|
|
string splitterMainPosition = IniHelper.Read(string.Format("base_spliterPositionMain_{0}", this.SysModel.ModuleCode));
|
|
if (!string.IsNullOrEmpty(splitterMainPosition)) this.splitMain.SplitterPosition = Convert.ToInt32(splitterMainPosition);
|
|
string splitterLeftPosition = IniHelper.Read(string.Format("base_spliterPositionLeft_{0}", this.SysModel.ModuleCode));
|
|
if (!string.IsNullOrEmpty(splitterLeftPosition)) this.splitLeft.SplitterPosition = Convert.ToInt32(splitterLeftPosition);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
LogHelper.Instance.WriteError(ex);
|
|
string Message = ErrorMessage.PromptErrorMessage(ex);
|
|
MessageUtil.Show(Message, ex.Message);
|
|
}
|
|
}
|
|
|
|
|
|
private bool VerificationRequired()
|
|
{
|
|
bool results = false;
|
|
if (SystemInfo.Instance.ReviewCommentsRequired && string.IsNullOrWhiteSpace(this.txtRemark.Text))
|
|
{
|
|
MessageUtil.Show("请输入审核意见");
|
|
results = true;
|
|
}
|
|
return results;
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
/// 页签里数据修改后刷新明细
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
private void Tab_basicInfo_OnDetailSaveGridCallBack(object sender, EventArgs e)
|
|
{
|
|
// 刷新主表
|
|
this._drBillInfoMsg = BaseAuditImpl.GetCurrentFlowRowData(this.BillModelObj.MasterTable, this.BillModelObj.PrimaryKey, this.SysModel.BillDocumentId);
|
|
this.ControlObj.SetAllControlValue(this._drBillInfoMsg);
|
|
|
|
// 刷新明细表
|
|
this._dtSourceData = BillImpl.GetDataTableResult(ReplaceHelper.ReplaceParamToValue(this.BillModelObj.DetailSql, this.SysModel.BillDocumentId));
|
|
this._dtSourceData.OrderBy(this.BillModelObj.DetailOrderField);
|
|
if (this.BillModelObj.DetailTreeTable)
|
|
{
|
|
(this.gridBillInfo as TreeGridControlEx).SetGridViewDataSourceGenerateID(_dtSourceData);
|
|
}
|
|
else
|
|
{
|
|
this.gridBillInfo.SetGridViewDataSource(_dtSourceData);
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// <para>说明:检查可用条件</para>
|
|
/// <para>创建人:龚宇超</para>
|
|
/// <para>创建日期:2017-11-09 </para>
|
|
/// <para>修改人:</para>
|
|
/// <para>修改日期:</para>
|
|
/// <para>修改备注:</para>
|
|
/// <para>版本:1.0</para>
|
|
/// </summary>
|
|
/// <param name="cond">The cond.</param>
|
|
/// <param name="dataRow">The data row.</param>
|
|
/// <returns><c>true</c> if XXXX, <c>false</c> otherwise.</returns>
|
|
private bool ValidateCond(string cond, DataRow dataRow)
|
|
{
|
|
bool result = false;
|
|
cond = ReplaceHelper.ReplaceRowParam(dataRow, cond);
|
|
if (cond.StartsWith("@") || cond.StartsWith("!"))
|
|
{
|
|
result = "1".Equals(BaseImpl.GetDefaultValue(cond));
|
|
}
|
|
else if (dataRow == null)
|
|
{
|
|
result = ReplaceHelper.EvalCond(cond);
|
|
}
|
|
else
|
|
{
|
|
result = ReplaceHelper.ReplaceRowParamCond(dataRow, cond);
|
|
}
|
|
return result;
|
|
}
|
|
|
|
|
|
}
|
|
}
|