251 lines
9.1 KiB
C#
251 lines
9.1 KiB
C#
/***********************
|
|
* 说明:分单数据
|
|
* 创建人:龚宇超
|
|
* 创建日期:2018-01-09
|
|
* 修改人:
|
|
* 修改日期:
|
|
* 修改备注:
|
|
* 版本: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.Model;
|
|
using Lskj.Business.Impl;
|
|
using Lskj.Util;
|
|
using Lskj.Data;
|
|
|
|
namespace Lskj.PubAccraditation
|
|
{
|
|
public partial class FrmSpare : BaseForm
|
|
{
|
|
#region 公有变量
|
|
/// <summary>
|
|
/// 明细sql
|
|
/// </summary>
|
|
public string DetailSql;
|
|
/// <summary>
|
|
/// 单据模型
|
|
/// </summary>
|
|
public BillModel BillModel;
|
|
/// <summary>
|
|
/// 单据弹出模块模型
|
|
/// </summary>
|
|
public DynamicPubAccraditionPopModel SysModel;
|
|
/// <summary>
|
|
/// 分单源数据
|
|
/// </summary>
|
|
public DataTable DtSource;
|
|
/// <summary>
|
|
/// 分单新数据
|
|
/// </summary>
|
|
public DataTable DtNewSource;
|
|
#endregion
|
|
|
|
#region 私有变量
|
|
/// <summary>
|
|
/// 分单历史
|
|
/// </summary>
|
|
private DataTable _dtHistory = new DataTable();
|
|
#endregion
|
|
|
|
public FrmSpare()
|
|
{
|
|
InitializeComponent();
|
|
}
|
|
|
|
#region 分单加载
|
|
/// <summary>
|
|
/// <para>说明:分单加载</para>
|
|
/// <para>创建人:龚宇超</para>
|
|
/// <para>创建日期:2017-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 FrmSpare_Load(object sender, EventArgs e)
|
|
{
|
|
try
|
|
{
|
|
//源数据
|
|
DataTable dtColumns = BillAuditImpl.GetSpareBillColumns(this.SysModel.ModuleCode, this.SysModel.UserName);
|
|
this.gridOld.SetReadOnlyColumns(dtColumns);
|
|
this.gridOld.SetGridViewDataSource(DtSource);
|
|
this.gridOld.GridView.DoubleClick += new EventHandler(gridOldView_DoubleClick);
|
|
//已经拆分数据
|
|
this.gridNew.SetReadOnlyColumns(dtColumns);
|
|
if (DtNewSource.Rows.Count == 0)
|
|
{
|
|
DtNewSource = DtSource.Clone();
|
|
}
|
|
else
|
|
{
|
|
this.gridNew.gridControl.DataSource = DtNewSource;
|
|
}
|
|
this.gridNew.gridControl.DoubleClick += new EventHandler(gridNewView_DoubleClick);
|
|
//历史数据
|
|
this.gridHistory.SetReadOnlyColumns(dtColumns);
|
|
BillAuditImpl.CreateSourceBillId(this.BillModel.MasterTable);
|
|
this.gridHistory.SetGridViewDataSource(BillAuditImpl.GetSpareBillHistory(this.BillModel.PrimaryKey, this.BillModel.MasterTable, this.SysModel.BillDocumentId));
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
LogHelper.Instance.WriteError(ex, ResourceKeys.BillModuleAudit);
|
|
//MessageUtil.Show(ex);
|
|
string Message = ErrorMessage.PromptErrorMessage(ex);
|
|
MessageUtil.Show(Message,ex.Message);
|
|
}
|
|
}
|
|
#endregion
|
|
|
|
#region 数据源双击
|
|
/// <summary>
|
|
/// <para>说明:旧数据源双击加载</para>
|
|
/// <para>创建人:龚宇超</para>
|
|
/// <para>创建日期:2017-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 gridOldView_DoubleClick(object sender, EventArgs e)
|
|
{
|
|
try
|
|
{
|
|
DataRow dr = this.gridOld.GridView.GetFocusedDataRow();
|
|
if (dr == null) return;
|
|
DataRow newRow = DtNewSource.NewRow();
|
|
newRow.ItemArray = dr.ItemArray;
|
|
this.DtNewSource.Rows.InsertAt(newRow, this.DtNewSource.Rows.Count);
|
|
this.DtSource.Rows.Remove(dr);
|
|
this.gridOld.SetGridViewDataSource(DtSource);
|
|
this.gridNew.SetGridViewDataSource(DtNewSource);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
LogHelper.Instance.WriteError(ex, ResourceKeys.BillModuleAudit);
|
|
//MessageUtil.Show(ex);
|
|
string Message = ErrorMessage.PromptErrorMessage(ex);
|
|
MessageUtil.Show(Message,ex.Message);
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// <para>说明:新数据源双击加载</para>
|
|
/// <para>创建人:龚宇超</para>
|
|
/// <para>创建日期:2017-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 gridNewView_DoubleClick(object sender, EventArgs e)
|
|
{
|
|
try
|
|
{
|
|
DataRow dr = this.gridNew.GridView.GetFocusedDataRow();
|
|
if (dr == null) return;
|
|
DataRow newRow = DtSource.NewRow();
|
|
newRow.ItemArray = dr.ItemArray;
|
|
this.DtSource.Rows.InsertAt(newRow, DtSource.Rows.Count);
|
|
this.DtNewSource.Rows.Remove(dr);
|
|
this.gridOld.gridControl.DataSource = DtSource;
|
|
this.gridNew.gridControl.DataSource = DtNewSource;
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
LogHelper.Instance.WriteError(ex, ResourceKeys.BillModuleAudit);
|
|
//MessageUtil.Show(ex);
|
|
string Message = ErrorMessage.PromptErrorMessage(ex);
|
|
MessageUtil.Show(Message,ex.Message);
|
|
}
|
|
}
|
|
#endregion
|
|
|
|
#region 分单重置大小
|
|
/// <summary>
|
|
/// <para>说明:分单重置大小</para>
|
|
/// <para>创建人:龚宇超</para>
|
|
/// <para>创建日期:2017-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 FrmSpare_Resize(object sender, EventArgs e)
|
|
{
|
|
try
|
|
{
|
|
this.groupControl2.Height = this.groupControl.Height = this.panelMain.Height / 2;
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
string Message = ErrorMessage.PromptErrorMessage(ex);
|
|
MessageUtil.Show(Message,ex.Message);
|
|
}
|
|
}
|
|
#endregion
|
|
|
|
#region 确定事件
|
|
/// <summary>
|
|
/// <para>说明:确定事件</para>
|
|
/// <para>创建人:龚宇超</para>
|
|
/// <para>创建日期:2017-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 btnOk_Click(object sender, EventArgs e)
|
|
{
|
|
try
|
|
{
|
|
this.DialogResult = MessageUtil.Show(ResourceKeys.ConfirmSpliterBill, MessageBoxButtons.YesNo) == DialogResult.Yes ? DialogResult.OK : DialogResult.No;
|
|
this.Close();
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
//MessageUtil.Show(ex);
|
|
string Message = ErrorMessage.PromptErrorMessage(ex);
|
|
MessageUtil.Show(Message,ex.Message);
|
|
}
|
|
}
|
|
#endregion
|
|
|
|
#region 关闭
|
|
/// <summary>
|
|
/// <para>说明:关闭事件</para>
|
|
/// <para>创建人:龚宇超</para>
|
|
/// <para>创建日期:2017-01-30</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)
|
|
{
|
|
this.Close();
|
|
}
|
|
#endregion
|
|
}
|
|
}
|