Files
lserp_cs_6.0/插件库/Lskj.PubArtworkPreview/Accraditation.cs
T
cyf ab56a9bcf7 基线 SVN r240
SVN-Revision: r240
2025-02-06 06:46:06 +00:00

916 lines
43 KiB
C#

using DevExpress.XtraEditors;
using DevExpress.XtraGrid.Views.Grid;
using Lskj.Business;
using Lskj.Business.Impl;
using Lskj.Control;
using Lskj.Control.Model;
using Lskj.Core;
using Lskj.Data;
using Lskj.Model;
using Lskj.Util;
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;
namespace Lskj.PubArtworkPreview
{
public partial class Accraditation : UserControl
{
/// <summary>
/// 父级窗体控件
/// </summary>
public Form BaseForm;
/// <summary>
/// 系统模块配置
/// </summary>
public DynamicBaseAccraditionPopModel SysModel;
/// <summary>
/// 基础审批用表模型
/// </summary>
public BaseAuditCommonModel BaseAuditModelObj = new BaseAuditCommonModel();
/// <summary>
/// 基础档案模型
/// </summary>
public BaseAuditModel ModuleModelObj;
/// <summary>
/// 审批模型
/// </summary>
public AccraditationModel AccditModelObj;
/// <summary>
/// 主表控件
/// </summary>
public MyControl ControlObj;
/// <summary>
/// 系统数据行
/// </summary>
private DataRow mRowItem;
/// <summary>
/// 当前流转数据
/// </summary>
private DataRow _flowRowData;
/// <summary>
/// 流转步骤模型
/// </summary>
private FlowTypeStepModel _flowTypeStepModel;
/// <summary>
/// 单据水印
/// </summary>
private WaterMark _waterMark;
/// <summary>
/// 推送菜单名
/// </summary>
private string _beforeMenuName;
/// <summary>
/// 推送操作人员
/// </summary>
private string _beforeUsers;
/// <summary>
/// 当前窗体控件数据来源(配置的)
/// </summary>
private DataRow _baseRowData;
/// <summary>
/// 推送模块
/// </summary>
private int _beforeId;
/// <summary>
/// 返退意见
/// </summary>
private string _auditAdvic;
/// <summary>
/// 操作字段
/// </summary>
private DataTable _dtFileds;
/// <summary>
/// 分组控件字段
/// </summary>
private DataTable _dtAddGroup;
/// <summary>
/// 审核
/// </summary>
public SimpleButton ReviewButton { get { return this.btnAudit; } }
/// <summary>
/// 提醒审核
/// </summary>
public SimpleButton ReminderReviewButton { get { return this.btnRemindAccradit; } }
/// <summary>
/// 审核意见
/// </summary>
public LabelComboxEdit CommonAdvice { get { return this.combox_Suggestion; } }
public Accraditation()
{
InitializeComponent();
}
#region 事件
/// <summary>
/// 初始化界面数据
/// </summary>
public void InitaMain(DynamicBaseAccraditionPopModel dynamic)
{
WaitForm.ShowForm();
try
{
this.SysModel = dynamic;
if (this.SysModel == null) return;
if (string.IsNullOrEmpty(this.SysModel.StepCode) || string.IsNullOrEmpty(this.SysModel.PrimaryValue)) return;
this.InitializeSetting();
this.InitPushOpers();
this.InitControl();
if (SystemInfo.Instance.ReviewCommentsRequired)
{
label_auditPerson.ForeColor = string.IsNullOrEmpty(SystemInfo.Instance.ControlRequiredColor) ? Color.Blue : ColorTranslator.FromHtml(SystemInfo.Instance.ControlRequiredColor);
this.txt_remark.Text = "";
}
}
catch (Exception ex)
{
string Message = ErrorMessage.PromptErrorMessage(ex);
MessageUtil.Show(Message, ex.Message);
LogHelper.Instance.WriteError(ex, ResourceKeys.BaseModuleAudit);
}
finally
{
WaitForm.HideForm();
this.InitButLocation();
}
}
/// <summary>
/// <para>说明:绘制水印</para>
/// <para>创建人:龚宇超</para>
/// <para>创建日期:2017-12-21 </para>
/// <para>修改人:</para>
/// <para>修改日期:</para>
/// <para>修改备注:</para>
/// <para>版本:1.0</para>
/// </summary>
private void gridFlow_Panint(object sender, PaintEventArgs e)
{
try
{
if (this._waterMark != null)
{
System.Windows.Forms.Control control = sender as System.Windows.Forms.Control;
GraphicsText graphicsText = new GraphicsText();
graphicsText.Graphics = e.Graphics;
// 绘制围绕点旋转的文本
StringFormat format = new StringFormat();
format.Alignment = StringAlignment.Center;
format.LineAlignment = StringAlignment.Center;
int x = (control.Width - 90) / 2;
int y = (control.Height - 32) / 2;
// 绘制单据状态文本
if (!string.IsNullOrEmpty(this._waterMark.Text))
{
graphicsText.DrawString(this._waterMark.Text, new Font("宋体", 20, FontStyle.Bold), new SolidBrush(Color.Red), new PointF(x, y), format, -20f);
e.Graphics.TranslateTransform(x, y);
e.Graphics.RotateTransform(-20f);
e.Graphics.DrawRectangle(new Pen(Color.Red, 2f), new Rectangle(-45, -19, 90, 32));
}
}
}
catch (Exception ex)
{
string Message = ErrorMessage.PromptErrorMessage(ex);
MessageUtil.Show(Message, ex.Message);
}
}
/// <summary>
/// <para>说明:流转表格行样式</para>
/// <para>创建人:龚宇超</para>
/// <para>创建日期:2017-12-15</para>
/// <para>修改人:</para>
/// <para>修改日期:</para>
/// <para>修改备注:</para>
/// <para>版本:1.0</para>
/// </summary>
private void gridFlowRecord_RowStyle(object sender, RowStyleEventArgs e)
{
try
{
if (e.RowHandle > 0)
{
DataRow dr = this.gridFlowRecord.GridView.GetDataRow(e.RowHandle);
if (dr["sh"] + "" == "审") e.Appearance.ForeColor = Color.Blue;
}
}
catch (Exception ex)
{
string Message = ErrorMessage.PromptErrorMessage(ex);
MessageUtil.Show(Message, ex.Message);
}
}
/// <summary>
/// <para>说明:审核</para>
/// <para>创建人:龚宇超</para>
/// <para>创建日期:2017-12-21 </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 btnAudit_Click(object sender, EventArgs e)
{
try
{
if (VerificationRequired()) return;
string nextSelectStepCode = string.Empty;
string nextSelectStepOper = string.Empty;
if (this.SysModel.ConfirmId == "1")
{
if (BaseAuditImpl.SetBaseFlowComfirm(this.SysModel.UserId, this.SysModel.ModuleCode, this.SysModel.PrimaryValue, this.txt_remark.Text) > 0)
{
MessageUtil.Show(ResourceKeys.ConfirmSuccess);
return;
}
else
{
MessageUtil.Show(ResourceKeys.ConfirmFail);
}
}
else
{
string confirmOpers = string.Empty, remindOpers = string.Empty;
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.VerifyNull())
{
if (!this.ControlObj.isRequiredFields(this.AccditModelObj.RequiredFields)) return;
string parmaryValue = this.SysModel.PrimaryValue;
if (this.ControlObj.SaveBaseModuleData(this.SysModel.ModuleCode, this.ModuleModelObj.MenuTable, this.ModuleModelObj.ParmaryKey, ref parmaryValue, false, "", false, this.ModuleModelObj.NewVer))
{
string result = BaseAuditImpl.Audit(out nextSelectStepCode, out nextSelectStepOper, this.SysModel, this.SysModel.StepCode, this.SysModel.PrimaryValue, "", this.BaseAuditModelObj.ProcedureName, "F", this._flowTypeStepModel.RemindSelect, this.txt_remark.Text, remindOpers, confirmOpers);
if ("1".Equals(result))
{
//推送消息
PushHelper push = new PushHelper(this.SysModel.PrimaryValue, this.SysModel.StepCode, this.SysModel.ModuleCode, this._beforeUsers, this._beforeMenuName, this._beforeId);
push.Push_Base_Oper_Message();
#region 审核成功后调用API
if (ApiHelper.IsExecEventApi(Interface.Api.OperateEvent.AfterModuleAuditStateChange, this.SysModel.ModuleCode, 0))
{
ApiHelper apiHelper = new ApiHelper(this.SysModel.ModuleCode, parmaryValue, this.ModuleModelObj.ParmaryKey, this.ModuleModelObj.MenuTable, 0);
apiHelper.OnEvent(Interface.Api.OperateEvent.AfterModuleAuditStateChange, Interface.Api.ActionType.Audit);//审核
if (!string.IsNullOrEmpty(apiHelper.apiResutMsg))
MessageUtil.Show(apiHelper.apiResutMsg);
}
#endregion
if (this.BaseForm != null)
{
this.BaseForm.DialogResult = DialogResult.OK;
}
//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();
// }
// }
//}
}
else if ("-10".Equals(result))
{
DataRow NextStepFlag = BaseAuditImpl.SetUpNextStep(this.SysModel.ModuleCode, this.ModuleModelObj.BillType, this.SysModel.StepCode);
if (NextStepFlag != null)
{
Lskj.BaseAccraditation.FrmLookupData lookup = new Lskj.BaseAccraditation.FrmLookupData();
lookup.ModuleCode = this.SysModel.ModuleCode;
lookup.BillType = this.ModuleModelObj.BillType;
lookup.StepCode = this.SysModel.StepCode;
lookup.nextSelectStepCode = nextSelectStepCode;
lookup.nextSelectStepCode = nextSelectStepCode;
bool isAginAudit = lookup.ShowDialog() == DialogResult.Yes;
nextSelectStepCode = lookup.nextSelectStepCode;
nextSelectStepCode = lookup.nextSelectStepCode;
if (isAginAudit)
{
string Aginresult = BaseAuditImpl.Audit(out nextSelectStepCode, out nextSelectStepOper, this.SysModel, this.SysModel.StepCode, this.SysModel.PrimaryValue, "", this.BaseAuditModelObj.ProcedureName, "F", this._flowTypeStepModel.RemindSelect, this.txt_remark.Text, remindOpers, confirmOpers, false, 0, 1);
}
}
else
{
MessageUtil.Show("配置新版审批失败!" + "\r\n" + result);
}
}
else
{
MessageUtil.Show(ResourceKeys.AuditFail + "\r\n" + result);
}
}
}
}
}
catch (Exception ex)
{
string Message = ErrorMessage.PromptErrorMessage(ex);
MessageUtil.Show(Message, ex.Message);
}
}
/// <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 btnRemindAudit_Click(object sender, EventArgs e)
{
try
{
if (VerificationRequired()) return;
if (this.SysModel.ConfirmId == "1")
{
if (BaseAuditImpl.SetBaseFlowComfirm(this.SysModel.UserId, this.SysModel.ModuleCode, this.SysModel.PrimaryValue, this.txt_remark.Text) > 0)
{
MessageUtil.Show(ResourceKeys.ConfirmSuccess);
return;
}
else
{
MessageUtil.Show(ResourceKeys.ConfirmFail);
}
}
else
{
bool isAudit = true;
string confirmOpers = string.Empty, remindOpers = string.Empty;
string nextSelectStepCode = string.Empty;
string nextSelectStepOper = string.Empty;
Lskj.BaseAccraditation.FrmRemindSelectForm formRemind = new Lskj.BaseAccraditation.FrmRemindSelectForm();
formRemind.KeyValue = this.SysModel.PrimaryValue;
formRemind.MenuCode = this.SysModel.ModuleCode;
isAudit = formRemind.ShowDialog() == DialogResult.Yes;
confirmOpers = formRemind.ConfirmOpers;
remindOpers = formRemind.RemindOpers;
if (isAudit)
{
if (this.ControlObj.VerifyNull())
{
string parmaryValue = this.SysModel.PrimaryValue;
if (this.ControlObj.SaveBaseModuleData(this.SysModel.ModuleCode, this.ModuleModelObj.MenuTable, this.ModuleModelObj.ParmaryKey, ref parmaryValue, false, "", false, this.ModuleModelObj.NewVer))
{
string result = BaseAuditImpl.Audit(out nextSelectStepCode, out nextSelectStepOper, this.SysModel, this.SysModel.StepCode, this.SysModel.PrimaryValue, "", this.BaseAuditModelObj.ProcedureName, "F", this._flowTypeStepModel.RemindSelect, this.txt_remark.Text, remindOpers, confirmOpers);
if ("1".Equals(result))
{
//推送消息
PushHelper push = new PushHelper(this.SysModel.PrimaryValue, this.SysModel.StepCode, this.SysModel.ModuleCode, this._beforeUsers, this._beforeMenuName, this._beforeId);
push.Push_Base_Oper_Message();
return;
// this.DialogResult = DialogResult.OK;
// if (refreshThePage != null) refreshThePage("审核成功", ERPInfo.Instance.PageControl.SelectedTabPage.Tag + "");
}
else
{
MessageUtil.Show(ResourceKeys.AuditFail + "\r\n" + result);
}
}
}
}
}
}
catch (Exception ex)
{
string Message = ErrorMessage.PromptErrorMessage(ex);
MessageUtil.Show(Message, ex.Message);
}
}
/// <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;
string nextSelectStepCode = string.Empty;
string nextSelectStepOper = string.Empty;
int returnd = ExecuteBackSelect(this._baseRowData);
if (returnd == -9) return;
_auditAdvic = string.IsNullOrWhiteSpace(_auditAdvic) ? txt_remark.Text : string.Empty;
if (this.SysModel.StepOver == "1")
{
//确认审核不通过并反退该单据?
if (MessageUtil.Show(string.Format(ResourceKeys.ConfimAuditFailAndReturnBill), MessageBoxButtons.YesNo) == DialogResult.Yes)
{
string result = BaseAuditImpl.Audit(out nextSelectStepCode, out nextSelectStepOper, this.SysModel, this.SysModel.StepCode, this.SysModel.PrimaryValue, "", this.BaseAuditModelObj.ProcedureName, "F", this._flowTypeStepModel.RemindSelect, this.txt_remark.Text, "", "", false, returnd, 0, true);
if ("1".Equals(result))
{
MessageUtil.Show(ResourceKeys.ForcedSuccess);
//暂未推送消息
PushHelper push = new PushHelper(this.SysModel.PrimaryValue, this.SysModel.StepCode, this.SysModel.ModuleCode, this._beforeUsers, this._beforeMenuName, this._beforeId);
push.Push_Base_Oper_Message();
return;
//this.DialogResult = DialogResult.OK;
//if (refreshThePage != null) refreshThePage("", ERPInfo.Instance.PageControl.SelectedTabPage.Tag + "");
}
else
{
MessageUtil.Show(ResourceKeys.ForcedFail + "\r\n" + result);
}
}
}
else
{
bool isAudit = true;
string confirmOpers = string.Empty, remindOpers = string.Empty;
Lskj.BaseAccraditation.FrmRemindSelectForm formRemind = new Lskj.BaseAccraditation.FrmRemindSelectForm();
formRemind.KeyValue = this.SysModel.PrimaryValue;
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.PrimaryValue, "", this.BaseAuditModelObj.ProcedureName, "R", "", _auditAdvic, remindOpers, confirmOpers, true, returnd);
if (result == "1")
{
MessageUtil.Show(ResourceKeys.ForcedSuccess);
//推送消息
PushHelper push = new PushHelper(this.SysModel.PrimaryValue, this.SysModel.StepCode, this.SysModel.ModuleCode, this._beforeUsers, this._beforeMenuName, this._beforeId);
push.Push_Base_Oper_Message();
return;
//this.DialogResult = DialogResult.OK;
//if (refreshThePage != null) refreshThePage("", ERPInfo.Instance.PageControl.SelectedTabPage.Tag + "");
}
else
{
MessageUtil.Show(string.Format(ResourceKeys.ForcedFail, result));
}
}
}
}
catch (Exception ex)
{
string Message = ErrorMessage.PromptErrorMessage(ex);
MessageUtil.Show(Message, ex.Message);
}
}
/// <summary>
/// <para>说明:返退</para>
/// <para>创建人:龚宇超</para>
/// <para>创建日期:2017-12-22 </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 btnReturnd_Click(object sender, EventArgs e)
{
try
{
if (VerificationRequired()) return;
int returnd = ExecuteBackSelect(this._baseRowData);
if (returnd == -9) return;
string nextSelectStepCode = string.Empty;
string nextSelectStepOper = string.Empty;
_auditAdvic = string.IsNullOrWhiteSpace(_auditAdvic) ? txt_remark.Text : _auditAdvic;
if (this.SysModel.StepOver == "1")
{
//确认审核不通过并反退该单据?
if (MessageUtil.Show(string.Format(ResourceKeys.ConfimAuditFailAndReturnBill), MessageBoxButtons.YesNo) == DialogResult.Yes)
{
string parmaryValue = this.SysModel.PrimaryValue;
if (this.ControlObj.SaveBaseModuleData(this.SysModel.ModuleCode, this.ModuleModelObj.MenuTable, this.ModuleModelObj.ParmaryKey, ref parmaryValue, false, "", false, this.ModuleModelObj.NewVer))
{
string result = BaseAuditImpl.Audit(out nextSelectStepCode, out nextSelectStepOper, this.SysModel, this.SysModel.StepCode, this.SysModel.PrimaryValue, "", this.BaseAuditModelObj.ProcedureName, "R", "", _auditAdvic, "", "", true, returnd, 0, true);
if ("1".Equals(result))
{
MessageUtil.Show(ResourceKeys.ForcedSuccess);
//暂未推送消息
PushHelper push = new PushHelper(this.SysModel.PrimaryValue, this.SysModel.StepCode, this.SysModel.ModuleCode, this._beforeUsers, this._beforeMenuName, this._beforeId);
push.Push_Base_Oper_Message();
//return;
if (this.BaseForm != null)
{
this.BaseForm.DialogResult = DialogResult.OK;
}
}
else
{
MessageUtil.Show(ResourceKeys.ForcedFail + "\r\n" + 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;
}
}
string confirmOpers = string.Empty, remindOpers = string.Empty;
string result = BaseAuditImpl.Audit(out nextSelectStepCode, out nextSelectStepOper, this.SysModel, this.SysModel.StepCode, this.SysModel.PrimaryValue, "", this.BaseAuditModelObj.ProcedureName, "R", "", _auditAdvic, remindOpers, confirmOpers, true, returnd);
if (result == "1")
{
MessageUtil.Show(ResourceKeys.ForcedSuccess);
//推送消息
PushHelper push = new PushHelper(this.SysModel.PrimaryValue, this.SysModel.StepCode, this.SysModel.ModuleCode, this._beforeUsers, this._beforeMenuName, this._beforeId);
push.Push_Base_Oper_Message();
//return;
if (this.BaseForm != null)
{
this.BaseForm.DialogResult = DialogResult.OK;
}
}
else
{
MessageUtil.Show(string.Format(ResourceKeys.ForcedFail, result));
}
}
}
catch (Exception ex)
{
string Message = ErrorMessage.PromptErrorMessage(ex);
MessageUtil.Show(Message, ex.Message);
}
}
/// <summary>
/// <para>说明:执行返退选择</para>
/// <para>创建人:龚宇超</para>
/// <para>创建日期:2017-12-22 </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.ModuleModelObj.BackSelected == "0") return -1;
if (this.SysModel.StepCode == "100") return 0;
FrmBackSelect frmBackSel = new FrmBackSelect();
frmBackSel.Sysmodel = this.SysModel;
frmBackSel.ModuleModelObj = this.ModuleModelObj;
frmBackSel.InitControl(false);
if (frmBackSel.ShowDialog() != DialogResult.OK) return -9;
this._auditAdvic = frmBackSel.ComfirmMsg;
return frmBackSel.SelectStepCode;
}
/// <summary>
/// <para>说明:审核意见下拉框事件</para>
/// <para>创建人:王一帆</para>
/// <para>创建日期:2021-02-25</para>
/// <para>修改人:</para>
/// <para>修改日期:</para>
/// <para>修改备注:</para>
/// <para>版本:1.0</para>
/// </summary>
/// <param name="sender">The source of the event.</param>
/// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
private void OnSelectValueChanged(object sender, EventArgs e)
{
try
{
this.txt_remark.Text = this.combox_Suggestion.EditText;
}
catch (Exception ex)
{
string Message = ErrorMessage.PromptErrorMessage(ex);
MessageUtil.Show(Message, ex.Message);
}
}
/// <summary>
/// <para>说明:数据源绑定完成后执行</para>
/// <para>创建人:龚宇超</para>
/// <para>创建日期: </para>
/// <para>修改人:</para>
/// <para>修改日期:</para>
/// <para>修改备注:</para>
/// <para>版本:1.0</para>
/// </summary>
/// <param name="sender">The sender.</param>
/// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
void OnControlObjOnDataSourceBindCallBack(object sender, EventArgs e)
{
try
{
this.ControlObj.CanExecControl = false;
this.ControlObj.SetAllControlValue(this._baseRowData);
this.ControlObj.CanExecControl = true;
//this.InitTabData();
//this.InitEditTabControl();
}
catch (Exception ex)
{
string Message = ErrorMessage.PromptErrorMessage(ex);
MessageUtil.Show(Message, ex.Message);
}
}
#endregion
#region 方法
/// <summary>
/// 初始化控件
/// </summary>
private void InitControl()
{
//设置控件文本属性
this.Text = this.SysModel.FormText;
this.btnAudit.Text = this.AccditModelObj.StepApplyText;
this.labeltxt_managerAudit.EditText = this.SysModel.UserName;
////设置流转记录的列
this.gridFlowRecord.GridView.RowStyle += new RowStyleEventHandler(gridFlowRecord_RowStyle);
DataRow dr = null;
this.gridFlowRecord.SetReadOnlyColumns(BaseAuditImpl.GetFlowRecordColumn(), GridCustomColumnStruct.AuditPopupAttachGridView + this.ModuleModelObj.FormKey);
this.gridFlowRecord.gridControl.Paint += new PaintEventHandler(gridFlow_Panint);
this.gridFlowRecord.SetGridViewDataSource(BaseAuditImpl.GetFlowRecordData(this.BaseAuditModelObj.SystemTabFlowStep, this.SysModel.PrimaryValue, this.SysModel.ModuleCode));
dr = BaseAuditImpl.GetCurrentStepFlow(this.SysModel.ModuleCode, this.SysModel.StepCode);
if (dr != null)
{
//初始化流转标题
this.label_auditPerson.Text = this.labeltxt_managerAudit.LabelText = dr["stepName"] + "";
}
this.combox_Suggestion.ValueField = this.combox_Suggestion.TextField = "Mix_apellation";
this.combox_Suggestion.SetDataSource(BaseImpl.GetDataTableResult(this.AccditModelObj.SuggestionSql));
this.combox_Suggestion.TextEdit.SelectedIndex = 0;
this.combox_Suggestion.TextEdit.SelectedValueChanged += new EventHandler(OnSelectValueChanged);
//单据水印
this._waterMark = new WaterMark(this.ModuleModelObj.PrefixKey, this._baseRowData);
//this.SetFormSize();
this.SetButtonStatus();
this.CreateAccraditationControl();
//this.LoadRemindRecord();
//this.LoadSignRecord();
//this.BindTab();
//this.InitCommonTools();
}
/// <summary>
/// 刷新
/// </summary>
public void RefControl()
{
if (string.IsNullOrEmpty(this.SysModel.StepCode) || string.IsNullOrEmpty(this.SysModel.PrimaryValue)) return;
this.InitializeSetting();
this.gridFlowRecord.SetGridViewDataSource(BaseAuditImpl.GetFlowRecordData(this.BaseAuditModelObj.SystemTabFlowStep, this.SysModel.PrimaryValue, this.SysModel.ModuleCode));
//单据水印
this._waterMark = new WaterMark(this.ModuleModelObj.PrefixKey, this._baseRowData);
}
/// <summary>
/// <para>说明:初始化属性配置</para>
/// <para>创建人:龚宇超</para>
/// <para>创建日期:2017-12-15</para>
/// <para>修改人:</para>
/// <para>修改日期:</para>
/// <para>修改备注:</para>
/// <para>版本:1.0</para>
/// </summary>
private void InitializeSetting()
{
this.mRowItem = MainImpl.GetSystemdllTab(this.SysModel.ModuleCode);
this.ModuleModelObj = new BaseAuditModel(this.mRowItem);
if (string.IsNullOrEmpty(this.ModuleModelObj.FormKey))
{
MessageUtil.Show(ResourceKeys.ModuleConfigError);
return;
}
this.ModuleModelObj.PrefixKey = BaseImpl.GetColumnPrefix(this.ModuleModelObj.MenuTable);
this.ModuleModelObj.ParmaryKey = BaseImpl.GetBasePrimaryKey(this.SysModel.ModuleCode);
this._flowRowData = BaseAuditImpl.GetCurrentFlowRowData(this.ModuleModelObj.MenuTable, this.ModuleModelObj.ParmaryKey, this.SysModel.PrimaryValue);
string billType = this._flowRowData != null ? _flowRowData[this.ModuleModelObj.BillType] + "" : "";
if (string.IsNullOrEmpty(billType) || billType == "0")
{
//MessageUtil.Show(ResourceKeys.NotSetFlowType);
return;
}
this.AccditModelObj = new AccraditationModel(BaseAuditImpl.GetCurrentStepFlow(this.SysModel.ModuleCode, this.SysModel.StepCode));
this._baseRowData = BaseAuditImpl.GetCurrentControlData(ReplaceHelper.ReplaceWhereCond(ReplaceHelper.ReplaceUserInfo(this.ModuleModelObj.MenuSql)), this.ModuleModelObj.ParmaryKey, this.SysModel.PrimaryValue);
//this.btnFileManger.Text += "(" + AttachImpl.GetFileCount(this.ModuleModelObj.MenuDirId + "", this.SysModel.PrimaryValue) + ")";
this.btnReturnd.Text = this.AccditModelObj.StepBackText;
if (this._baseRowData == null) this._baseRowData = this._flowRowData;
}
/// <summary>
/// <para>说明:初始化设置按钮状态</para>
/// <para>创建人:龚宇超</para>
/// <para>创建日期:2017-12-15 </para>
/// <para>修改人:</para>
/// <para>修改日期:</para>
/// <para>修改备注:</para>
/// <para>版本:1.0</para>
/// </summary>
private void SetButtonStatus()
{
//获取当前流转步骤
DataRow currentFlowStep = currentFlowStep = BaseAuditImpl.GetCurrentFlowStep(this.SysModel.ModuleCode, this._flowRowData[this.ModuleModelObj.BillType] + "", this.SysModel.StepCode);
if (currentFlowStep == null)
{
MessageUtil.Show(ResourceKeys.FlowStepConfigError);
return;
}
this._flowTypeStepModel = new FlowTypeStepModel(currentFlowStep);
string operUser = this._flowTypeStepModel.OperUser;
if (BaseImpl.GetDataRowResult(this.AccditModelObj.FlowOperSql) != null)
{
DataRow flowOper = flowOper = BaseAuditImpl.GetFlowOperators(this.SysModel.ModuleCode, this.SysModel.PrimaryValue, this.SysModel.StepCode);
operUser = flowOper == null ? operUser : flowOper["operators"] + "";
}
//确认权限判断
this.btnRemindAccradit.Visible = this.btnRemindBack.Visible = this._flowTypeStepModel.RemindSelect == "1";
if (operUser.StartsWith("@"))
{
string sql = string.Format("select count(1) from p_employeetab where ({0}) and employeeid='{1}' ", ReplaceHelper.ReplaceRowParam(_flowRowData, ReplaceHelper.ReplaceUserInfo(operUser)).Replace("@", "").Replace("''", "'"), ERPInfo.Instance.UserId);
object number = MainImpl.GetResult(sql);
this.btnReturnd.Enabled = this.btnAudit.Enabled = int.Parse(string.IsNullOrWhiteSpace(number + "") ? "0" : number + "") > 0;
}
else
{
this.btnReturnd.Enabled = this.btnAudit.Enabled = operUser.Contains(this.SysModel.UserName);
}
//代理权限
DataRow agency = BaseAuditImpl.GetAgencyAuthority(this.SysModel.ModuleCode);
if (agency != null)
{
string sourceuser = agency["sourceuser"] + "";
foreach (string item in sourceuser.Split(','))
{
if (operUser.Contains(item))
{
this.btnAudit.Enabled = this.btnReturnd.Enabled = true;
break;
}
}
}
//this.btnAudit.Enabled = true;
//如果已经终审按钮为窗口默认设置,否则
if (this.SysModel.StepOver == "1")
{
this.combox_Suggestion.Enabled = false;
this.btnAudit.Enabled = false;
this.btnRemindAccradit.Enabled = false;
//this.pl_bottom.Visible = true;
}
if (this.SysModel.ConfirmId == "1")
{
this.btnAudit.Enabled = true;
this.btnRemindAccradit.Visible = this.btnRemindBack.Visible = this.btnReturnd.Visible = false;
this.btnAudit.Text = "确认(&Y)";
this.label_auditPerson.Text = "确认意见";
this.labeltxt_managerAudit.Text = "会签人";
this.txt_remark.Text = "确认";
}
}
/// <summary>
/// <para>说明:录所有按钮的位置</para>
/// <para>创建人:王一帆</para>
/// <para>创建日期:2020-11-25 </para>
/// <para>修改人:</para>
/// <para>修改日期:</para>
/// <para>修改备注:</para>
/// <para>版本:1.0</para>
/// </summary>
private void InitButLocation()
{
if (!btnRemindAccradit.Visible)
{
combox_Suggestion.Width = btnRemindAccradit.Location.X + btnRemindAccradit.Width - combox_Suggestion.Location.X;
}
if (!btnRemindBack.Visible)
{
labeltxt_managerAudit.Width = btnRemindBack.Location.X + btnRemindBack.Width - labeltxt_managerAudit.Location.X;
if (!btnReturnd.Visible)
{
labeltxt_managerAudit.Width = btnReturnd.Location.X + btnReturnd.Width - labeltxt_managerAudit.Location.X;
}
}
}
private bool VerificationRequired()
{
bool results = false;
if (SystemInfo.Instance.ReviewCommentsRequired && string.IsNullOrWhiteSpace(this.txt_remark.Text))
{
MessageUtil.Show("请输入审核意见");
results = true;
}
return results;
}
/// <summary>
/// <para>说明:初始化本次推送人员</para>
/// <para>创建人:龚宇超</para>
/// <para>创建日期:2018-05-22 </para>
/// <para>修改人:</para>
/// <para>修改日期:</para>
/// <para>修改备注:</para>
/// <para>版本:1.0</para>
/// </summary>
private void InitPushOpers()
{
DataRow rowItem = BaseAuditImpl.GetPushedOpers(this.SysModel.PrimaryValue, this.SysModel.StepCode);
if (rowItem != null)
{
//记录本次操作信息
this._beforeMenuName = rowItem["menuname"] + "";
this._beforeUsers = rowItem["operators"] + "";
this._beforeId = Convert.ToInt32(rowItem["id"]);
}
}
/// <summary>
/// <para>说明:动态创建控件</para>
/// <para>创建人:龚宇超</para>
/// <para>创建日期:2017-12-15 </para>
/// <para>修改人:</para>
/// <para>修改日期:</para>
/// <para>修改备注:</para>
/// <para>版本:1.0</para>
/// </summary>
private void CreateAccraditationControl()
{
this._dtFileds = BaseModuleImpl.GetControlLocation(this.ModuleModelObj.FormKey, this.SysModel.ModuleCode);
this._dtAddGroup = BaseModuleImpl.GetAddGroupData(this.ModuleModelObj.FormKey);
this.ControlObj = new MyControl();
this.ControlObj.PrimaryValue = this.SysModel.PrimaryValue;
this.ControlObj.InitControl(this._dtFileds, new DevExpress.XtraEditors.XtraScrollableControl(), this._dtAddGroup);
this.ControlObj.OnDataSourceBindCallBack += new EventHandler(OnControlObjOnDataSourceBindCallBack);
if (this.AccditModelObj.BillModifyFields != "-1")
this.ControlObj.SetReadOnlyAllControl(true);
//改变控件状态
foreach (string item in this.AccditModelObj.BillModifyFields.Trim(',').Split(','))
{
this.ControlObj.SetReadOnlyControl(item, false, false);
}
}
#endregion
}
}