d896f67c52
SVN-Revision: r1196
3776 lines
169 KiB
C#
3776 lines
169 KiB
C#
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.Control.Model;
|
|
using Lskj.Util;
|
|
using Lskj.Business.Impl;
|
|
using DevExpress.XtraGrid.Views.Grid;
|
|
using Lskj.Data;
|
|
using DevExpress.XtraBars;
|
|
using DevExpress.XtraTab;
|
|
using DevExpress.XtraEditors;
|
|
using System.Collections;
|
|
using Lskj.PubBillAccount.Model;
|
|
using DevExpress.Data;
|
|
using DevExpress.XtraGrid.Columns;
|
|
using System.IO;
|
|
using Lskj.Business;
|
|
using System.Text.RegularExpressions;
|
|
using DevExpress.XtraTreeList.Nodes;
|
|
using DevExpress.XtraEditors.Repository;
|
|
using DevExpress.XtraGrid.Views.Base;
|
|
using DevExpress.Utils;
|
|
using System.Reflection;
|
|
using DevExpress.Data.Filtering;
|
|
using DevExpress.XtraEditors.Controls;
|
|
|
|
namespace Lskj.PubBillAccount
|
|
{
|
|
public partial class BillModule : UserControl
|
|
{
|
|
/// <summary>
|
|
/// 是否为初始化创建
|
|
/// </summary>
|
|
private bool _isInitFinish;
|
|
/// <summary>
|
|
/// 是否加载右侧控件数据
|
|
/// </summary>
|
|
private bool _isLoadRightControlValue = true;
|
|
/// <summary>
|
|
/// 是否直接打印
|
|
/// </summary>
|
|
private bool _isExcPrint;
|
|
/// <summary>
|
|
/// 主打印Sql
|
|
/// </summary>
|
|
private string _mainPrintSql;
|
|
private string guidField = "xxxxx_guid";
|
|
/// <summary>
|
|
/// 主键字段
|
|
/// </summary>
|
|
private string mRecordPrimaryField;
|
|
/// <summary>
|
|
/// 单据水印
|
|
/// </summary>
|
|
private WaterMark _waterMark;
|
|
|
|
/// <summary>
|
|
/// 打印主sql中关联打印次数返回条件
|
|
/// </summary>
|
|
private string _printModeCond;
|
|
/// <summary>
|
|
/// 导入单据明细数据、导入单据明细并更新
|
|
/// </summary>
|
|
private BarButtonItem _itemImport, _itemImportUpdate;
|
|
/// <summary>
|
|
/// 打印完成后添加数据用到的参数: 表名,列前缀,主键字段,主键值,模块编号,主打印Sql
|
|
/// </summary>
|
|
private List<string> _printSaveParams;
|
|
/// <summary>
|
|
/// 单据明细列
|
|
/// </summary>
|
|
private DataTable _detailColumns;
|
|
private DataTable _detailTableColumns = new DataTable();
|
|
|
|
protected DataRow BillRowItem;
|
|
/// <summary>
|
|
/// 主表控件
|
|
/// </summary>
|
|
//protected MyControl ControlObj;
|
|
/// <summary>
|
|
/// 入口参数
|
|
/// </summary>
|
|
protected DynamicBillModel SysModel;
|
|
/// <summary>
|
|
/// 是否为Brp模版
|
|
/// </summary>
|
|
/// <value><c>true</c> if this instance is BRP templete; otherwise, <c>false</c>.</value>
|
|
protected bool IsBrpTemplete { get { return SysModel is DynamicBillBrpModel; } }
|
|
/// <summary>
|
|
///
|
|
/// </summary>
|
|
public BillModel BillModel;
|
|
/// <summary>
|
|
/// 数量名称
|
|
/// </summary>
|
|
public string NumberMc;
|
|
/// <summary>
|
|
/// 红字单据的分配管理模块
|
|
/// </summary>
|
|
public string rdRedUnionCode;
|
|
/// <summary>
|
|
/// 蓝字单据的分配管理模块
|
|
/// </summary>
|
|
public string rdBlueUnionCode;
|
|
public AmountCellRender cellHelper;
|
|
public Class2 class2_0, class2_1;
|
|
|
|
public DataTable detailTable = new DataTable();
|
|
|
|
public BillModule()
|
|
{
|
|
InitializeComponent();
|
|
}
|
|
|
|
#region 初始化操作
|
|
/// <summary>
|
|
/// <para>说明:窗口加载</para>
|
|
/// <para>创建人:龚宇超</para>
|
|
/// <para>创建日期:2017-11-23 </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>
|
|
public void OnLoad(DynamicBillModel Model)
|
|
{
|
|
try
|
|
{
|
|
this.SysModel = Model;
|
|
this._isInitFinish = false;
|
|
this.InitializeSetting();
|
|
this.InitializeControl();
|
|
this.InitlizeSpiltLocation();
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
LogHelper.Instance.WriteError(ex);
|
|
LogUtil.WriteError("单据初始化窗体失败!", ex);
|
|
//MessageUtil.Show(ex.StackTrace);
|
|
string Message = ErrorMessage.PromptErrorMessage(ex);
|
|
MessageUtil.Show(Message, ex.Message);
|
|
}
|
|
finally
|
|
{
|
|
this._isInitFinish = true;
|
|
}
|
|
}
|
|
/// <summary>
|
|
/// <para>说明:初始化分割条位置</para>
|
|
/// <para>创建人:龚宇超</para>
|
|
/// <para>创建日期:2018-03-06 </para>
|
|
/// <para>修改人:</para>
|
|
/// <para>修改日期:</para>
|
|
/// <para>修改备注:</para>
|
|
/// <para>版本:1.0</para>
|
|
/// </summary>
|
|
private void InitlizeSpiltLocation()
|
|
{
|
|
try
|
|
{
|
|
// 设置单据来源左侧宽度
|
|
if (this.BillModel.PanelWidth == 0)
|
|
{
|
|
// 隐藏来源
|
|
this.ssc_main_top.PanelVisibility = SplitPanelVisibility.Panel2;
|
|
}
|
|
else
|
|
{
|
|
string width = IniHelper.Read(string.Format("bill_width_{0}", this.SysModel.ModuleCode));
|
|
if (!string.IsNullOrEmpty(width))
|
|
this.ssc_main_top.SplitterPosition = Convert.ToInt32(width);
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
LogHelper.Instance.WriteError(ex);
|
|
string Message = ErrorMessage.PromptErrorMessage(ex);
|
|
MessageUtil.Show(Message, ex.Message);
|
|
}
|
|
|
|
}
|
|
/// <summary>
|
|
/// <para>说明:初始化系统配置</para>
|
|
/// <para>创建人:龚宇超</para>
|
|
/// <para>创建日期:2017-11-27 </para>
|
|
/// <para>修改人:</para>
|
|
/// <para>修改日期:</para>
|
|
/// <para>修改备注:</para>
|
|
/// <para>版本:1.0</para>
|
|
/// </summary>
|
|
private void InitializeSetting()
|
|
{
|
|
this.BillModel = new BillModel(BillImpl.GetBillInfo(this.SysModel.ModuleCode));
|
|
if (this.BillModel != null)
|
|
{
|
|
this.BillModel.TypeName = string.IsNullOrEmpty(SysModel.BillMasterSql) ? this.SysModel.FormText : this.BillModel.TypeName;
|
|
this.BillModel.MasterPreFix = BaseImpl.GetColumnPrefix(this.BillModel.MasterTable);
|
|
this.BillModel.DetailPreFix = BaseImpl.GetColumnPrefix(this.BillModel.DetailTable);
|
|
this.BillModel.DetailOrderField = this.BillModel.DetailPreFix + "lsidx_id";
|
|
}
|
|
DataRow menuRow = BillImpl.GetMenuConfigTab(this.SysModel.ModuleId);
|
|
if (menuRow != null)
|
|
{
|
|
this.BillModel.BillSourceIds = menuRow.Table.Columns.Contains("BillSourceIds") ? (menuRow["BillSourceIds"] + "").Trim(',') : string.Empty;
|
|
this.BillModel.BillFlag = menuRow.Table.Columns.Contains("BillFlag") && !string.IsNullOrEmpty(menuRow["BillFlag"] + "") ? Convert.ToInt32(menuRow["BillFlag"] + "") : -1;
|
|
}
|
|
//获取打印其他参数
|
|
GetPrintOtherParam();
|
|
BillImpl.InitBillSetting(this.BillModel);
|
|
}
|
|
/// <summary>
|
|
/// <para>说明:初始化分配关联模块</para>
|
|
/// <para>创建人:王一帆</para>
|
|
/// <para>创建日期:2020-02-18 </para>
|
|
/// <para>修改人:</para>
|
|
/// <para>修改日期:</para>
|
|
/// <para>修改备注:</para>
|
|
/// <para>版本:1.0</para>
|
|
/// </summary>
|
|
private void InitializeUnionCode()
|
|
{
|
|
if (this.BillModel.PopupUnionCode.Contains(","))
|
|
{
|
|
string[] UnionCodeSplit = this.BillModel.PopupUnionCode.Split(',');
|
|
if (UnionCodeSplit.Length >= 1)
|
|
{
|
|
this.BillModel.PopupUnionCode = this.BillModel.BillFlag == 1 ? UnionCodeSplit[1] + "" : UnionCodeSplit[0] + "";
|
|
rdBlueUnionCode = UnionCodeSplit[0] + "";
|
|
rdRedUnionCode = UnionCodeSplit[1] + "";
|
|
}
|
|
}
|
|
else
|
|
{
|
|
rdBlueUnionCode = rdRedUnionCode = this.BillModel.PopupUnionCode;
|
|
}
|
|
}
|
|
/// <summary>
|
|
/// <para>说明:初始化控件</para>
|
|
/// <para>创建人:龚宇超</para>
|
|
/// <para>创建日期:2017-11-23 </para>
|
|
/// <para>修改人:</para>
|
|
/// <para>修改日期:</para>
|
|
/// <para>修改备注:</para>
|
|
/// <para>版本:1.0</para>
|
|
/// </summary>
|
|
private void InitializeControl()
|
|
{
|
|
this.InitializeStatus();
|
|
this.InitializeOper();
|
|
this.InitializeBillInfo();
|
|
this.InitializeBillDetail();
|
|
this.InitialAutoSearchControl();
|
|
|
|
if (this.BillModel.PanelWidth > 0)
|
|
this.InitializeBillSource();
|
|
}
|
|
/// <summary>
|
|
/// <para>说明:初始化红蓝字单</para>
|
|
/// <para>创建人:龚宇超</para>
|
|
/// <para>创建日期:2017-11-27 </para>
|
|
/// <para>修改人:</para>
|
|
/// <para>修改日期:</para>
|
|
/// <para>修改备注:</para>
|
|
/// <para>版本:1.0</para>
|
|
/// </summary>
|
|
private void InitializeStatus()
|
|
{
|
|
|
|
if (this.BillModel.DefaultAddEmptyRow)
|
|
this.gcMain.OptionsView.NewItemRowPosition = NewItemRowPosition.Bottom;
|
|
|
|
this.dpCopyBill.Enabled = this.BillModel.CanCopy;
|
|
this.dpbImport.Enabled = this.BillModel.CanImport || this.BillModel.CanExport;
|
|
|
|
if (this.SysModel.HasReadPrivilege())
|
|
this.pl_main_bottom.Enabled = false;
|
|
this.ssc_main_top.SplitterPosition = this.BillModel.PanelWidth;
|
|
|
|
}
|
|
/// <summary>
|
|
/// <para>说明:初始化常用操作等功能</para>
|
|
/// <para>创建人:龚宇超</para>
|
|
/// <para>创建日期:2017-11-27 </para>
|
|
/// <para>修改人:</para>
|
|
/// <para>修改日期:</para>
|
|
/// <para>修改备注:</para>
|
|
/// <para>版本:1.0</para>
|
|
/// </summary>
|
|
private void InitializeOper()
|
|
{
|
|
BarButtonItem itemCopyMaster = new BarButtonItem();
|
|
itemCopyMaster.Caption = "复制表头信息";
|
|
itemCopyMaster.ItemClick += new ItemClickEventHandler(OnCopyMasterItemClick);
|
|
BarButtonItem itemCopyAll = new BarButtonItem();
|
|
itemCopyAll.Caption = "复制整单信息";
|
|
itemCopyAll.ItemClick += new ItemClickEventHandler(OnCopyAllItemClick);
|
|
BarButtonItem itemExport = new BarButtonItem();
|
|
itemExport.Caption = "导出Excel文件";
|
|
itemExport.ItemClick += new ItemClickEventHandler(OnExportItemClick);
|
|
|
|
this._itemImport = new BarButtonItem();
|
|
this._itemImport.Caption = "导入Excel文件";
|
|
this._itemImport.ItemClick += new ItemClickEventHandler(OnImportItemClick);
|
|
this._itemImportUpdate = new BarButtonItem();
|
|
this._itemImportUpdate.Caption = "导入Excel文件(更新)";
|
|
this._itemImportUpdate.ItemClick += new ItemClickEventHandler(OnImportUpdateItemClick);
|
|
|
|
// 复制单据
|
|
this.pmBill.AddItems(new BarItem[] { itemCopyMaster, itemCopyAll });
|
|
|
|
// 导入导出
|
|
if (this.BillModel.CanExport)
|
|
this.pmBillExp.AddItem(itemExport);
|
|
if (this.BillModel.CanImport)
|
|
this.pmBillExp.AddItems(new BarItem[] { _itemImport, _itemImportUpdate });
|
|
|
|
// 打印模版
|
|
string[] files = this.BillModel.PrintFile.Split('|');
|
|
for (int i = 0; i < files.Length; i++)
|
|
{
|
|
string fileName = files[i];
|
|
if (!string.IsNullOrWhiteSpace(fileName))
|
|
{
|
|
BarButtonItem itemPrint = new BarButtonItem();
|
|
int index = i + 1;
|
|
itemPrint.Caption = files[i].Replace(".rmf", "").Replace(".frx", "");
|
|
itemPrint.Tag = files[i];
|
|
itemPrint.ItemClick += new ItemClickEventHandler(OnPrintItemClick);
|
|
pMprint.AddItem(itemPrint);
|
|
}
|
|
}
|
|
|
|
// 常用工具
|
|
DataTable tableCommon = BaseModuleImpl.GetBaseGridRightMenus(this.SysModel.ModuleCode, ModuleType.BillDetail);
|
|
foreach (DataRow item in tableCommon.Rows)
|
|
{
|
|
BarButtonItem itemCommon = new BarButtonItem();
|
|
itemCommon.Caption = item["menuname"] + "";
|
|
itemCommon.Tag = item;
|
|
itemCommon.ItemClick += new ItemClickEventHandler(OnCommonItemClick);
|
|
pMenu.AddItem(itemCommon);
|
|
}
|
|
}
|
|
/// <summary>
|
|
/// <para>说明:初始化自动搜索框</para>
|
|
/// <para>创建人:龚宇超</para>
|
|
/// <para>创建日期: </para>
|
|
/// <para>修改人:</para>
|
|
/// <para>修改日期:</para>
|
|
/// <para>修改备注:</para>
|
|
/// <para>版本:1.0</para>
|
|
/// </summary>
|
|
private void InitialAutoSearchControl()
|
|
{
|
|
DataTable _detailColumns = BillImpl.GetDetailColumns(this.SysModel.ModuleCode);//初始化单据明细列
|
|
DataRow dr = null;
|
|
|
|
// 绑定项目
|
|
//string citemSql = "select productid as dm,Appellation as mc from p_producttab";
|
|
dr = _detailColumns.Rows.Cast<DataRow>().FirstOrDefault(x => x["fieldName"].ToString().Equals("citem_id"));
|
|
string citemSql = dr["fieldsql"].ToString();
|
|
if (string.IsNullOrWhiteSpace(citemSql)) citemSql = "select productid as dm,Appellation as mc from p_producttab";
|
|
txtcitem_id.ValueField = txtcitem_id.ValueMember = "dm";
|
|
txtcitem_id.TextField = "mc";
|
|
txtcitem_id.TextEdit.SourceSQL = citemSql;
|
|
txtcitem_id.TextEdit.Properties.BorderStyle = DevExpress.XtraEditors.Controls.BorderStyles.NoBorder;
|
|
txtcitem_id.SetDataSource(BaseImpl.GetDataTableResult(citemSql));
|
|
if (_detailColumns.Columns.Contains("labelText") && !string.IsNullOrWhiteSpace(dr["labelText"] + "")) labelControl13.Text = dr["labelText"] + "";
|
|
txtcitem_id.LabelText = labelControl13.Text;
|
|
labelControl13.Hide();
|
|
|
|
// 绑定部门
|
|
//string cdeptSql = "select departmentid as dm,departmentname as mc from p_departmenttab";
|
|
dr = _detailColumns.Rows.Cast<DataRow>().FirstOrDefault(x => x["fieldName"].ToString().Equals("cdept_id"));
|
|
string cdeptSql = dr["fieldsql"].ToString();
|
|
if (string.IsNullOrWhiteSpace(cdeptSql)) cdeptSql = "select departmentid as dm,departmentname as mc from p_departmenttab";
|
|
txtcdept_id.ValueField = txtcdept_id.ValueMember = "dm";
|
|
txtcdept_id.TextField = "mc";
|
|
txtcdept_id.TextEdit.SourceSQL = cdeptSql;
|
|
txtcdept_id.TextEdit.Properties.BorderStyle = DevExpress.XtraEditors.Controls.BorderStyles.NoBorder;
|
|
txtcdept_id.SetDataSource(BaseImpl.GetDataTableResult(cdeptSql));
|
|
if (_detailColumns.Columns.Contains("labelText") && !string.IsNullOrWhiteSpace(dr["labelText"] + "")) labelControl17.Text = dr["labelText"] + "";
|
|
txtcdept_id.LabelText = labelControl17.Text;
|
|
labelControl17.Hide();
|
|
|
|
// 绑定供应商
|
|
//string csupSql = "select id as dm,coname as mc from p_providertab";
|
|
dr = _detailColumns.Rows.Cast<DataRow>().FirstOrDefault(x => x["fieldName"].ToString().Equals("csup_id"));
|
|
string csupSql = dr["fieldsql"].ToString();
|
|
if (string.IsNullOrWhiteSpace(csupSql)) csupSql = "select id as dm,coname as mc from p_providertab";
|
|
txtcsup_id.ValueField = txtcsup_id.ValueMember = "dm";
|
|
txtcsup_id.TextField = "mc";
|
|
txtcsup_id.TextEdit.SourceSQL = csupSql;
|
|
txtcsup_id.TextEdit.Properties.BorderStyle = DevExpress.XtraEditors.Controls.BorderStyles.NoBorder;
|
|
txtcsup_id.SetDataSource(BaseImpl.GetDataTableResult(csupSql));
|
|
if (_detailColumns.Columns.Contains("labelText") && !string.IsNullOrWhiteSpace(dr["labelText"] + "")) labelControl18.Text = dr["labelText"] + "";
|
|
txtcsup_id.LabelText = labelControl18.Text;
|
|
labelControl18.Hide();
|
|
|
|
//人员使用的是同一个sql
|
|
dr = _detailColumns.Rows.Cast<DataRow>().FirstOrDefault(x => x["fieldName"].ToString().Equals("cperson_id"));
|
|
string personnelSql = dr["fieldsql"].ToString();
|
|
if (string.IsNullOrWhiteSpace(personnelSql)) personnelSql = "select employeeid as dm,employeename as mc from p_employeetab";
|
|
DataTable ReturnsResult = BaseImpl.GetDataTableResult(personnelSql);
|
|
|
|
// 绑定个人
|
|
//string cpersionSql = "select employeeid as dm,employeename as mc from p_employeetab";
|
|
//dr = _detailColumns.Rows.Cast<DataRow>().FirstOrDefault(x => x["fieldName"].ToString().Equals("cperson_id"));
|
|
//string cpersionSql = dr["fieldsql"].ToString();
|
|
txtcperson_id.ValueField = txtcperson_id.ValueMember = "dm";
|
|
txtcperson_id.TextField = "mc";
|
|
txtcperson_id.TextEdit.SourceSQL = personnelSql;
|
|
txtcperson_id.TextEdit.Properties.BorderStyle = DevExpress.XtraEditors.Controls.BorderStyles.NoBorder;
|
|
txtcperson_id.SetDataSource(ReturnsResult);
|
|
txtcperson_id.LabelText = labelControl15.Text;
|
|
labelControl15.Hide();
|
|
|
|
|
|
// 绑定业务员
|
|
//string cnameSql = "select employeeid as dm,employeename as mc from p_employeetab";
|
|
//dr = _detailColumns.Rows.Cast<DataRow>().FirstOrDefault(x => x["fieldName"].ToString().Equals("cperson_id"));
|
|
//string cnameSql = dr["fieldsql"].ToString();
|
|
txtcname.ValueField = txtcname.ValueMember = "dm";
|
|
txtcname.TextField = "mc";
|
|
txtcname.TextEdit.SourceSQL = personnelSql;
|
|
txtcname.TextEdit.Properties.BorderStyle = DevExpress.XtraEditors.Controls.BorderStyles.NoBorder;
|
|
txtcname.SetDataSource(ReturnsResult);
|
|
txtcname.LabelText = labelControl16.Text;
|
|
labelControl16.Hide();
|
|
|
|
|
|
// 绑定记账人
|
|
//string cbookSql = "select employeeid as dm,employeename as mc from p_employeetab";
|
|
//dr = _detailColumns.Rows.Cast<DataRow>().FirstOrDefault(x => x["fieldName"].ToString().Equals("cperson_id"));
|
|
//string cbookSql = dr["fieldsql"].ToString();
|
|
txtcbook.ValueField = txtcbook.ValueMember = "dm";
|
|
txtcbook.TextField = "mc";
|
|
txtcbook.TextEdit.SourceSQL = personnelSql;
|
|
txtcbook.TextEdit.Properties.BorderStyle = DevExpress.XtraEditors.Controls.BorderStyles.NoBorder;
|
|
txtcbook.SetDataSource(ReturnsResult);
|
|
txtcbook.LabelText = labelControl19.Text;
|
|
labelControl19.Hide();
|
|
|
|
|
|
// 绑定审核人
|
|
// string ccheckSql = "select employeeid as dm,employeename as mc from p_employeetab";
|
|
//dr = _detailColumns.Rows.Cast<DataRow>().FirstOrDefault(x => x["fieldName"].ToString().Equals("cperson_id"));
|
|
//string ccheckSql = dr["fieldsql"].ToString();
|
|
txtccheck.ValueField = txtccheck.ValueMember = "dm";
|
|
txtccheck.TextField = "mc";
|
|
txtccheck.TextEdit.SourceSQL = personnelSql;
|
|
txtccheck.TextEdit.Properties.BorderStyle = DevExpress.XtraEditors.Controls.BorderStyles.NoBorder;
|
|
txtccheck.SetDataSource(ReturnsResult);
|
|
txtccheck.LabelText = labelControl20.Text;
|
|
labelControl20.Hide();
|
|
|
|
|
|
// 绑定出纳人
|
|
//string ccashierSql = "select employeeid as dm,employeename as mc from p_employeetab";
|
|
//dr = _detailColumns.Rows.Cast<DataRow>().FirstOrDefault(x => x["fieldName"].ToString().Equals("cperson_id"));
|
|
//string ccashierSql = dr["fieldsql"].ToString();
|
|
txtccashier.ValueField = txtccashier.ValueMember = "dm";
|
|
txtccashier.TextField = "mc";
|
|
txtccashier.TextEdit.SourceSQL = personnelSql;
|
|
txtccashier.TextEdit.Properties.BorderStyle = DevExpress.XtraEditors.Controls.BorderStyles.NoBorder;
|
|
txtccashier.SetDataSource(ReturnsResult);
|
|
txtccashier.LabelText = labelControl21.Text;
|
|
labelControl21.Hide();
|
|
|
|
|
|
// 绑定制单人
|
|
//string cbillSql = "select employeeid as dm,employeename as mc from p_employeetab";
|
|
//dr = _detailColumns.Rows.Cast<DataRow>().FirstOrDefault(x => x["fieldName"].ToString().Equals("cperson_id"));
|
|
//string cbillSql = dr["fieldsql"].ToString();
|
|
txtcbill.ValueField = txtcbill.ValueMember = "dm";
|
|
txtcbill.TextField = "mc";
|
|
txtcbill.TextEdit.SourceSQL = personnelSql;
|
|
txtcbill.TextEdit.Properties.BorderStyle = DevExpress.XtraEditors.Controls.BorderStyles.NoBorder;
|
|
txtcbill.SetDataSource(ReturnsResult);
|
|
txtcbill.LabelText = labelControl22.Text;
|
|
labelControl22.Hide();
|
|
|
|
// 绑定区域名称
|
|
//string cNameSql = "select Mix_bak AS dm ,Mix_apellation AS mc from P_BaseMixInfoTab a where Tag='1213' ";
|
|
dr = _detailColumns.Rows.Cast<DataRow>().FirstOrDefault(x => x["fieldName"].ToString().Equals("cDefine11"));
|
|
string cNameSql = dr["fieldsql"].ToString();
|
|
txtczoneName.ValueField = txtczoneName.ValueMember = "dm";
|
|
txtczoneName.TextField = "mc";
|
|
txtczoneName.TextEdit.SourceSQL = cNameSql;
|
|
txtczoneName.TextEdit.Properties.BorderStyle = DevExpress.XtraEditors.Controls.BorderStyles.NoBorder;
|
|
txtczoneName.SetDataSource(BaseImpl.GetDataTableResult(cNameSql));
|
|
if (_detailColumns.Columns.Contains("labelText") && !string.IsNullOrWhiteSpace(dr["labelText"] + "")) labelControl7.Text = dr["labelText"] + "";
|
|
txtczoneName.LabelText = labelControl7.Text;
|
|
labelControl7.Hide();
|
|
|
|
// 绑定生产线名称
|
|
//string cproductionSql = "select mes_ws_pno as dm ,mes_ws_Name as mc from mes_wsline_list where 1=1";
|
|
dr = _detailColumns.Rows.Cast<DataRow>().FirstOrDefault(x => x["fieldName"].ToString().Equals("cDefine12"));
|
|
string cproductionSql = dr["fieldsql"].ToString();
|
|
if (string.IsNullOrWhiteSpace(cproductionSql)) cproductionSql = "select mes_ws_pno as dm ,mes_ws_Name as mc from mes_wsline_list where 1=1";
|
|
txtcproductionLine.ValueField = txtcproductionLine.ValueMember = "dm";
|
|
txtcproductionLine.TextField = "mc";
|
|
txtcproductionLine.TextEdit.SourceSQL = cproductionSql;
|
|
txtcproductionLine.TextEdit.Properties.BorderStyle = DevExpress.XtraEditors.Controls.BorderStyles.NoBorder;
|
|
txtcproductionLine.SetDataSource(BaseImpl.GetDataTableResult(cproductionSql));
|
|
if (_detailColumns.Columns.Contains("labelText") && !string.IsNullOrWhiteSpace(dr["labelText"] + "")) labelControl23.Text = dr["labelText"] + "";
|
|
txtcproductionLine.LabelText = labelControl23.Text;
|
|
labelControl23.Hide();
|
|
|
|
|
|
// 科目SQL
|
|
dr = _detailColumns.Rows.Cast<DataRow>().FirstOrDefault(x => x["fieldName"].ToString().Equals("ccode"));
|
|
string subjectsSql = dr["fieldsql"].ToString();
|
|
if (string.IsNullOrWhiteSpace(subjectsSql)) subjectsSql = "select ItemCode as dm,mc as mc from accView_ItemSetTab where 1=1";
|
|
this.InitAutoSearchEdit(this.ccode, subjectsSql);
|
|
|
|
|
|
// 摘要
|
|
//this.InitAutoSearchEdit(this.cdigest, "select dm,isnull(mc,'')+'/'+isnull(mc,'') as mc from accView_ItemSetTab");
|
|
|
|
//客户
|
|
dr = _detailColumns.Rows.Cast<DataRow>().FirstOrDefault(x => x["fieldName"].ToString().Equals("ccus_id"));
|
|
string customerSql = dr["fieldsql"].ToString();
|
|
if (string.IsNullOrWhiteSpace(customerSql)) customerSql = "select id as dm,coname as mc from p_customertab";
|
|
//customerSql = "select id as dm,coname as mc from p_customertab";
|
|
txtcCustomer.ValueField = txtcCustomer.ValueMember = "dm";
|
|
txtcCustomer.TextField = "mc";
|
|
txtcCustomer.TextEdit.SourceSQL = customerSql;
|
|
txtcCustomer.TextEdit.Properties.BorderStyle = DevExpress.XtraEditors.Controls.BorderStyles.NoBorder;
|
|
txtcCustomer.SetDataSource(BaseImpl.GetDataTableResult(customerSql));
|
|
if (_detailColumns.Columns.Contains("labelText") && !string.IsNullOrWhiteSpace(dr["labelText"] + "")) labelControl25.Text = dr["labelText"] + "";
|
|
txtcCustomer.LabelText = labelControl25.Text;
|
|
labelControl25.Hide();
|
|
|
|
|
|
//合同名称号
|
|
dr = _detailColumns.Rows.Cast<DataRow>().FirstOrDefault(x => x["fieldName"].ToString().Equals("cDefine13"));
|
|
txtcontractNoName.TextEdit.Properties.BorderStyle = DevExpress.XtraEditors.Controls.BorderStyles.NoBorder;
|
|
if (_detailColumns.Columns.Contains("labelText") && !string.IsNullOrWhiteSpace(dr["labelText"] + "")) labelControl24.Text = dr["labelText"] + "";
|
|
txtcontractNoName.LabelText = labelControl24.Text;
|
|
labelControl24.Hide();
|
|
|
|
|
|
}
|
|
/// <summary>
|
|
/// <para>说明:初始化自动搜索框</para>
|
|
/// <para>创建人:龚宇超</para>
|
|
/// <para>创建日期: </para>
|
|
/// <para>修改人:</para>
|
|
/// <para>修改日期:</para>
|
|
/// <para>修改备注:</para>
|
|
/// <para>版本:1.0</para>
|
|
/// </summary>
|
|
/// <param name="gridColumn">The grid column.</param>
|
|
/// <param name="sql">The SQL.</param>
|
|
private void InitAutoSearchEdit(GridColumn gridColumn, string sql)
|
|
{
|
|
int popWidth = 0;
|
|
|
|
//DataTable table = MainImpl.GetDataTableResult(ReplaceHelper.ReplaceWhereCond(model.SqlSource) + " and 1<>1");
|
|
|
|
RepositoryItemGridLookUpEdit searchEdit = new RepositoryItemGridLookUpEdit();
|
|
searchEdit.View.OptionsView.ShowIndicator = false;
|
|
searchEdit.View.OptionsView.ColumnAutoWidth = true;
|
|
searchEdit.PopupSizeable = true;
|
|
searchEdit.PopupResizeMode = ResizeMode.Default;
|
|
|
|
searchEdit.AllowFocused = true;
|
|
searchEdit.ImmediatePopup = true;
|
|
searchEdit.ShowFooter = false;
|
|
searchEdit.NullText = "";
|
|
searchEdit.TextEditStyle = TextEditStyles.Standard;
|
|
searchEdit.PopupBorderStyle = PopupBorderStyles.Flat;
|
|
searchEdit.AllowNullInput = DefaultBoolean.False;
|
|
searchEdit.ShowPopupShadow = true;
|
|
searchEdit.DisplayMember = "mc";
|
|
searchEdit.ValueMember = "dm";
|
|
searchEdit.DataSource = BaseImpl.GetDataTableResult(sql);
|
|
searchEdit.View.Appearance.HeaderPanel.TextOptions.HAlignment = HorzAlignment.Center;
|
|
DataTable cusTable = new DataTable();
|
|
|
|
GridColumn valueColumn = new GridColumn();
|
|
valueColumn.Name = valueColumn.FieldName = "dm";
|
|
valueColumn.Caption = "编码";
|
|
valueColumn.Visible = false;
|
|
|
|
GridColumn textColumn = new GridColumn();
|
|
textColumn.Name = textColumn.FieldName = "mc";
|
|
textColumn.Caption = "名称";
|
|
textColumn.Visible = true;
|
|
|
|
searchEdit.View.Columns.AddRange(new GridColumn[] { valueColumn, textColumn });
|
|
|
|
searchEdit.PopupFormSize = new System.Drawing.Size(popWidth, searchEdit.PopupFormSize.Height);
|
|
gridControl.RepositoryItems.Add(searchEdit);
|
|
gridColumn.ColumnEdit = searchEdit;
|
|
searchEdit.View.Tag = searchEdit;
|
|
}
|
|
/// <summary>
|
|
/// <para>说明:初始化单据控件信息</para>
|
|
/// <para>创建人:龚宇超</para>
|
|
/// <para>创建日期:2017-11-27 </para>
|
|
/// <para>修改人:</para>
|
|
/// <para>修改日期:</para>
|
|
/// <para>修改备注:</para>
|
|
/// <para>版本:1.0</para>
|
|
/// </summary>
|
|
private void InitializeBillInfo()
|
|
{
|
|
// 初始化默认值
|
|
this.txtOperateDate.TextEditObj.Text = DateTime.Now.ToString();
|
|
this.txtcbill.Text = ERPInfo.Instance.UserId;
|
|
|
|
// 设置控件状态
|
|
this.txtOperateDate.TextEditObj.Enabled = false;
|
|
this.txtAffimDate.TextEditObj.Enabled = false;
|
|
this.txtcbook.TextEdit.Properties.ReadOnly = true;
|
|
this.txtcbook.TextEdit.Properties.AppearanceReadOnly.BackColor = Color.White;
|
|
this.txtccheck.TextEdit.Properties.ReadOnly = true;
|
|
this.txtccheck.TextEdit.Properties.AppearanceReadOnly.BackColor = Color.White;
|
|
this.txtccashier.TextEdit.Properties.ReadOnly = true;
|
|
this.txtccashier.TextEdit.Properties.AppearanceReadOnly.BackColor = Color.White;
|
|
this.txtcbill.TextEdit.Properties.ReadOnly = true;
|
|
this.txtcbill.TextEdit.Properties.AppearanceReadOnly.BackColor = Color.White;
|
|
|
|
}
|
|
/// <summary>
|
|
/// <para>说明:初始化单据明细</para>
|
|
/// <para>创建人:龚宇超</para>
|
|
/// <para>创建日期: </para>
|
|
/// <para>修改人:</para>
|
|
/// <para>修改日期:</para>
|
|
/// <para>修改备注:</para>
|
|
/// <para>版本:1.0</para>
|
|
/// </summary>
|
|
private void InitializeBillDetail()
|
|
{
|
|
// 设置单据明细列
|
|
this._detailTableColumns = BaseImpl.GetDataTableResult(string.Format("select * from {0} where 1>1", this.BillModel.DetailTable));
|
|
|
|
// 默认空行
|
|
this.gcMain.OptionsView.NewItemRowPosition = NewItemRowPosition.Bottom;
|
|
this.gcMain.FocusedRowChanged += OnGridViewFocusedRowChanged;
|
|
|
|
// 初始化金额字段
|
|
cellHelper = new AmountCellRender(gcMain);
|
|
this.class2_0 = this.cellHelper.AddAmountColumn(this.md, 11);
|
|
this.class2_1 = this.cellHelper.AddAmountColumn(this.mc, 11);
|
|
this.gcMain.RefreshData();
|
|
|
|
// 绑定辅助项事件
|
|
this.txtcn_id.TextEditObj.EditValueChanged += new EventHandler(Oncn_idTextEditEditValueChanged);
|
|
this.txtnum.TextEditObj.EditValueChanged += new EventHandler(OnnumTextEditEditValueChanged);
|
|
this.txtdt_date.TextEditObj.EditValueChanged += new EventHandler(Ondt_dateTextEditEditValueChanged);
|
|
this.txtprice.TextEditObj.EditValueChanged += new EventHandler(OnpriceTextEditEditValueChanged);
|
|
this.txtcitem_id.TextEdit.EditValueChanged += new EventHandler(Oncitem_idTextEditEditValueChanged);
|
|
this.txtcdept_id.TextEdit.EditValueChanged += new EventHandler(Oncdept_idTextEditEditValueChanged);
|
|
this.txtcperson_id.TextEdit.EditValueChanged += new EventHandler(Oncperson_idTextEditEditValueChanged);
|
|
this.txtcsup_id.TextEdit.EditValueChanged += new EventHandler(Oncsup_idTextEditEditValueChanged);
|
|
this.txtcname.TextEdit.EditValueChanged += new EventHandler(OncnameTextEditEditValueChanged);
|
|
this.txtczoneName.TextChanged += new EventHandler(OnccDefine11EditValueChanged);
|
|
this.txtcproductionLine.TextChanged += new EventHandler(OncDefine12EditValueChanged);
|
|
this.txtcontractNoName.TextEdit.TextChanged += new EventHandler(OncDefine13EditEditValueChanged);
|
|
this.txtcCustomer.TextEdit.EditValueChanged += new EventHandler(Oncccus_idEditEditValueChanged);
|
|
|
|
// 初始化明细数据源
|
|
detailTable.Columns.Add("cdigest", typeof(String));
|
|
detailTable.Columns.Add("ccode", typeof(String));
|
|
detailTable.Columns.Add("md", typeof(String));
|
|
detailTable.Columns.Add("mc", typeof(String));
|
|
detailTable.Columns.Add("Billdocument_Id", typeof(String));
|
|
detailTable.Columns.Add("cn_id", typeof(String));
|
|
detailTable.Columns.Add("num", typeof(String));
|
|
detailTable.Columns.Add("dt_date", typeof(String));
|
|
detailTable.Columns.Add("price", typeof(String));
|
|
detailTable.Columns.Add("citem_id", typeof(String));
|
|
detailTable.Columns.Add("cdept_id", typeof(String));
|
|
detailTable.Columns.Add("cperson_id", typeof(String));
|
|
detailTable.Columns.Add("csup_id", typeof(String));
|
|
detailTable.Columns.Add("cname", typeof(String));
|
|
detailTable.Columns.Add("cDefine11", typeof(String));//区域名称
|
|
detailTable.Columns.Add("cDefine12", typeof(String));//生产线名称
|
|
detailTable.Columns.Add("cDefine13", typeof(String));//合同号名称
|
|
detailTable.Columns.Add("ccus_id", typeof(String));//客户
|
|
|
|
|
|
// 加载单据明细
|
|
this.gridControl.DataSource = detailTable;//BaseImpl.GetDataTableResult(this.BillModel.DetailSql);
|
|
}
|
|
/// <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 OnInitializeHeaderCallBack()
|
|
{
|
|
try
|
|
{
|
|
if (string.IsNullOrWhiteSpace(this.SysModel.BillOrderNo) && string.IsNullOrWhiteSpace(this.SysModel.BillMasterSql)) return;
|
|
// 通过右键菜单打开单据时,判断修改还是新增
|
|
if (!string.IsNullOrEmpty(this.SysModel.BillOrderNo))
|
|
{
|
|
// 修改
|
|
//string sqlValue = "select * from " + this.BillModel.MasterTable + " where 1=1";
|
|
//string sqlCond = string.Format(" and {0}='{1}'", this.BillModel.PrimaryKey, this.SysModel.BillOrderNo);
|
|
//DataTable masterTable = BillImpl.GetDataTableResult(sqlValue + sqlCond);
|
|
//this.SetBillStatus(masterTable.Rows.Count > 0 ? masterTable.Rows[0] : null);
|
|
|
|
//2026-4-14 王杰 根据参数10单据编号替换主表sql中所有参数,获取主表数据
|
|
//获取主表数据
|
|
string sourceSQL = ReplaceHelper.ReplaceParamToValue(BillModel.MasterSql, this.SysModel.BillOrderNo);
|
|
DataRow sourceRow = BillImpl.GetDataRowResult(sourceSQL);
|
|
//获取明细数据
|
|
DataTable dt = BillImpl.GetDataTableResult(ReplaceHelper.ReplaceRowParam(sourceRow, this.BillModel.DetailSql));
|
|
|
|
|
|
this.detailTable.Clear();
|
|
|
|
// 设置表头
|
|
this.txtcsign.TextEditObj.EditValue = sourceRow[this.BillModel.CsignFieldName] + "";
|
|
this.txtisgnseq.TextEditObj.EditValue = sourceRow["ino_id"] + "";
|
|
this.txtOperateDate.TextEditObj.EditValue = sourceRow["OperateDate"] + "";
|
|
this.txtAffimDate.TextEditObj.EditValue = sourceRow["AffirmDate"] + "";
|
|
this.txtidoc.TextEditObj.EditValue = sourceRow["idoc"] + "";
|
|
this.txtcbill.TextEdit.EditValue = sourceRow["OperatorId"] + "";
|
|
//this.txtcbill.TextEdit.EditValue = sourceRow["OperatorId"] + "";
|
|
|
|
if (sourceRow.Table.Columns.Contains("cbill"))
|
|
{
|
|
this.txtccashier.TextEdit.EditValue = sourceRow["cbill"] + "";
|
|
}
|
|
if (sourceRow.Table.Columns.Contains("ccheck"))
|
|
{
|
|
this.txtccheck.TextEdit.EditValue = sourceRow["ccheck"] + "";
|
|
}
|
|
if (sourceRow.Table.Columns.Contains("cbook"))
|
|
{
|
|
this.txtcbook.TextEdit.EditValue = sourceRow["cbook"] + "";
|
|
}
|
|
|
|
// 设置明细
|
|
foreach (DataRow item in dt.Rows)
|
|
{
|
|
DataRow newRow = detailTable.NewRow();
|
|
|
|
foreach (DataColumn col in this.detailTable.Columns)
|
|
{
|
|
if (item.Table.Columns.Contains(col.ColumnName))
|
|
{
|
|
newRow[col.ColumnName] = item[col.ColumnName];
|
|
}
|
|
}
|
|
this.detailTable.Rows.Add(newRow);
|
|
}
|
|
|
|
this.gridControl.DataSource = detailTable;
|
|
|
|
// 设置借方金额
|
|
this.txtmd.Text = CalcColumnTotal(md) + "";
|
|
// 设置贷方金额
|
|
this.txtmc.Text = CalcColumnTotal(mc) + "";
|
|
this.SetBillStatus(sourceRow);
|
|
|
|
}
|
|
else
|
|
{
|
|
this.SetBillStatus(null);
|
|
// 新增
|
|
if (!string.IsNullOrEmpty(this.SysModel.BillMasterSql))
|
|
{
|
|
// 处理单据表头数据
|
|
DataRow row = BillImpl.GetDataRowResult(this.SysModel.BillMasterSql);
|
|
if (row != null)
|
|
{
|
|
//this.ControlObj.SetAllControlValue(row, true);
|
|
|
|
}
|
|
}
|
|
if (!string.IsNullOrEmpty(this.SysModel.BillMasterSql))
|
|
{
|
|
// 处理单据明细数据
|
|
this.AddMultiRowToGridView(BillImpl.GetDataTableResult(this.SysModel.BillDetailSql));
|
|
}
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
string Message = ErrorMessage.PromptErrorMessage(ex);
|
|
MessageUtil.Show(Message, ex.Message);
|
|
}
|
|
}
|
|
/// <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.gcMain.GetDataRow(this.gcMain.FocusedRowHandle);
|
|
// if (!string.IsNullOrWhiteSpace(BillModel.UpdateDetailCond))
|
|
// {
|
|
// //string UpdateCond = this.ControlObj.ReplaceParentControlValue(BillModel.UpdateDetailCond);
|
|
// UpdateCond = ReplaceHelper.ReplaceRowParam(rowItem, UpdateCond);
|
|
// if (!ReplaceHelper.EvalCond(UpdateCond))
|
|
// {
|
|
// e.Cancel = true;//该行不可编辑
|
|
// }
|
|
// }
|
|
//}
|
|
//catch (Exception ex)
|
|
//{
|
|
// LogHelper.Instance.WriteError(ex);
|
|
|
|
//}
|
|
}
|
|
/// <summary>
|
|
/// 虚拟行点击添加
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
private void InitNewRowMethod(object sender)
|
|
{
|
|
try
|
|
{
|
|
GridView view = sender as DevExpress.XtraGrid.Views.Grid.GridView;
|
|
|
|
DataTable gridTable = (this.gcMain.GridControl.DataSource as DataTable).TrimDeleteRows();
|
|
DataRow tmpRow = gridTable.NewRow();
|
|
gridTable.Rows.Add(tmpRow);
|
|
int position = gridTable.Rows.Count - 1;
|
|
//foreach (DataRow dr in _detailColumns.Rows)
|
|
//{
|
|
// GridColumnModel model = new GridColumnModel(dr);
|
|
// string fieldValue = BaseImpl.GetDefaultValue(model.DefaultValue);
|
|
// if (model.DefaultValue.Contains("{#"))
|
|
// {
|
|
// fieldValue = this.ControlObj.ReplaceParentControlValue(model.DefaultValue);
|
|
// if (!string.IsNullOrEmpty(fieldValue))
|
|
// {
|
|
// tmpRow[model.FieldName] = fieldValue;
|
|
// }
|
|
// }
|
|
// else if (!string.IsNullOrEmpty(model.DefaultValue))
|
|
// {
|
|
// if (model.DefaultValue.Contains("{ROW"))
|
|
// {
|
|
// if (position > 0)
|
|
// {
|
|
// fieldValue = ReplaceHelper.GetParamFields(model.DefaultValue)[0];
|
|
// fieldValue = fieldValue.Replace("}", "").Replace("{", "");
|
|
// fieldValue = fieldValue.Substring(fieldValue.IndexOf('_') + 1);
|
|
// tmpRow[model.FieldName] = gridTable.Rows[position - 1][fieldValue] + "";
|
|
// }
|
|
// }
|
|
// else
|
|
// {
|
|
// tmpRow[model.FieldName] = fieldValue;
|
|
// }
|
|
// }
|
|
//}
|
|
gridTable.OrderBy(this.BillModel.DetailOrderField);
|
|
|
|
if (tmpRow.Table.Columns.Contains(this.BillModel.DetailOrderField) && gridTable.Rows.Count == 0)
|
|
{
|
|
tmpRow[this.BillModel.DetailOrderField] = 1;
|
|
}
|
|
|
|
this.gcMain.UpdateCurrentRow();
|
|
this.gcMain.ShowEditor();
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
string Message = ErrorMessage.PromptErrorMessage(ex);
|
|
MessageUtil.Show(Message, ex.Message);
|
|
}
|
|
}
|
|
/// <summary>
|
|
/// <para>说明:初始化单据来源</para>
|
|
/// <para>创建人:龚宇超</para>
|
|
/// <para>创建日期:2017-11-28 </para>
|
|
/// <para>修改人:</para>
|
|
/// <para>修改日期:</para>
|
|
/// <para>修改备注:</para>
|
|
/// <para>版本:1.0</para>
|
|
/// </summary>
|
|
private void InitializeBillSource()
|
|
{
|
|
this.xtc_left_container.TabPages.Clear();
|
|
Dictionary<XtraTabPage, string> pageNumKey = new Dictionary<XtraTabPage, string>();
|
|
List<GridDetailModel> attachModels = GetAttachTabs();
|
|
Hashtable htTable = BillImpl.GetSources(this.SysModel.ModuleCode, this.BillModel.BillSourceIds);
|
|
|
|
DataTable masterTable = htTable["master"] as DataTable;
|
|
DataTable detailTable = htTable["detail"] as DataTable;
|
|
|
|
/* 构造原理
|
|
* 1. 假如存在附加信息,则底部显示来源明细(来源明细摆放在标签第一个位置)+多标签,假如标签只有一个则隐藏标签头.
|
|
* 2. 假如不存在附加信息,则底部只显示来源明细.
|
|
**/
|
|
for (int i = 0; i < masterTable.Rows.Count; i++)
|
|
{
|
|
BillSourceModel model = new BillSourceModel(masterTable.Rows[i]);
|
|
if (model.SourceType != 2) continue;
|
|
|
|
BillSourceUnionModel unionModel = new BillSourceUnionModel();
|
|
DataTable controls = BaseModuleImpl.GetCustomQueryFields(model.FormKey);
|
|
|
|
XtraTabPage tabPage = new XtraTabPage();
|
|
tabPage.Text = model.UserName;
|
|
|
|
|
|
|
|
#region 加载来源表头
|
|
GridControlEx gridControl = null;
|
|
TreeViewEx treeView = null;
|
|
|
|
if (model.SourceType == 1)
|
|
{
|
|
// 来源为树类型
|
|
treeView = new TreeViewEx();
|
|
treeView.BorderStyle = BorderStyle.None;
|
|
treeView.Dock = DockStyle.Fill;
|
|
treeView.TreeNodeKeyField = model.SourceKeyField;
|
|
treeView.TreeNodeTextField = model.SourceResult;
|
|
treeView.BindTreeView(BillImpl.GetDataTableResult(model.SourceSql));
|
|
treeView.TreeNodeSelectAfter += new TreeViewEventHandler(OnTreeNodeSelectAfter);
|
|
|
|
tabPage.Controls.Add(treeView);
|
|
}
|
|
else if (model.SourceType == 3 || model.SourceType == 4)
|
|
{
|
|
gridControl = new TreeGridControlEx();
|
|
gridControl.Dock = DockStyle.Fill;
|
|
gridControl.BorderStyle = System.Windows.Forms.BorderStyle.None;
|
|
gridControl.Model = this.SysModel;
|
|
gridControl.SetReadOnlyColumns(BillImpl.GetSourceColumns(model.Id), GridCustomColumnStruct.BillSourceGridView + model.FormKey);
|
|
gridControl.SetGridRowColors(BaseModuleImpl.GetBaseGridRowColors("BILLSOURCE_" + model.FormKey));
|
|
gridControl.SetGridRightMenus(BaseModuleImpl.GetBaseGridRightMenus("BILLSOURCE_" + model.FormKey), this.SysModel, OnGridControlRightCallback);
|
|
unionModel.TreeGridControlObj = gridControl as TreeGridControlEx;
|
|
unionModel.TreeGridControlObj.TreeListObj.FocusedNodeChanged += new DevExpress.XtraTreeList.FocusedNodeChangedEventHandler(OnTreeListObjFocusedNodeChanged);
|
|
|
|
tabPage.Controls.Add(gridControl);
|
|
}
|
|
else
|
|
{
|
|
// 来源为表格类型
|
|
gridControl = new GridControlEx();
|
|
gridControl.BorderStyle = BorderStyle.None;
|
|
gridControl.Model = this.SysModel;
|
|
gridControl.Dock = DockStyle.Fill;
|
|
gridControl.SetReadOnlyColumns(BillImpl.GetSourceColumns(model.Id), GridCustomColumnStruct.BillSourceGridView + model.FormKey);
|
|
gridControl.SetGridRowColors(BaseModuleImpl.GetBaseGridRowColors("BILLSOURCE_" + model.FormKey));
|
|
gridControl.SetGridRightMenus(BaseModuleImpl.GetBaseGridRightMenus("BILLSOURCE_" + model.FormKey), this.SysModel, OnGridControlRightCallback);
|
|
//gridControl.GridView.SelectionChanged += new SelectionChangedEventHandler(OnGridControlSelectionChanged);
|
|
//gridControl.GridView.FocusedRowObjectChanged += OnFocusedRowObjectChanged;
|
|
gridControl.GridView.ColumnPanelRowHeight = 30;
|
|
gridControl.GridView.RowHeight = 30;
|
|
gridControl.GridView.RowCellClick += OnGridViewRowCellClick; // 2019-11-12 cmd提出改为行点击事件,否则会出现保存提交后,单据管理无法查询出数据
|
|
if (BillModel.IsBillSourceCheck == 1)
|
|
{
|
|
GridDragGrid.GridAddCheckBox(gridControl.GridView);
|
|
}
|
|
if (model.SourceType == 0)
|
|
{
|
|
GridDragGrid dragMainGrid = new GridDragGrid(gridControl.GridView, this.gcMain);
|
|
dragMainGrid.OnDragComplete += new GridFragGridCompleteEventHandler(OnDragMainGridCompleted);
|
|
}
|
|
tabPage.Controls.Add(gridControl);
|
|
}
|
|
#endregion
|
|
|
|
#region 加载来源明细
|
|
//XtraTabPage tabDetail = new XtraTabPage();
|
|
|
|
//DataRow[] detailColumns = detailTable.Select("sourceId=" + model.Id);
|
|
//GridControlEx gridDetail = new GridControlEx();
|
|
//gridDetail.Model = this.SysModel;
|
|
//gridDetail.Dock = DockStyle.Fill;
|
|
//gridDetail.SetReadOnlyColumns(detailColumns == null || detailColumns.Length == 0 ? new DataTable() : detailColumns.CopyToDataTable(), GridCustomColumnStruct.BillSourceDetailGridView + model.FormKey);
|
|
//gridDetail.SetGridRowColors(BaseModuleImpl.GetBaseGridRowColors("SOURCEDETAIL_" + model.FormKey));
|
|
//gridDetail.SetGridRightMenus(BaseModuleImpl.GetBaseGridRightMenus("BILLSOURCEDT_" + model.FormKey), this.SysModel, OnGridDetailRightMenuCallback);
|
|
//gridDetail.GridView.DoubleClick += new EventHandler(OnGridDetailDoubleClick);
|
|
//gridDetail.Parent = tabDetail;
|
|
//gridDetail.BorderStyle = System.Windows.Forms.BorderStyle.None;
|
|
|
|
|
|
|
|
//GridDragGrid dragDetailGrid = new GridDragGrid(gridDetail.GridView, this.gcMain);
|
|
//dragDetailGrid.OnDragComplete += new GridFragGridCompleteEventHandler(OnDragDetailGridCompleted);
|
|
|
|
#endregion
|
|
|
|
#region 加载来源条件
|
|
// 创建自定义条件
|
|
string searchSql = model.SourceType == 1 ? Regex.Replace(model.DetailSql, "{speciesno}", "", RegexOptions.IgnoreCase) : model.SourceSql;
|
|
PanelControl searchPanel = new PanelControl();
|
|
MyControl searchControl = new MyControl(searchSql, gridControl, treeView);
|
|
searchControl.OnSearchBeforeCallBack += new SearchEventHandler(OnSearchBefore);
|
|
searchControl.OnSearchAfterCallBack += new EventHandler(OnSearchAfterd);
|
|
// 第一个页面要刷新数据,所以绑定事件用于初始化完成后在查询数据
|
|
searchControl.OnDataSourceBindCallBack += new EventHandler(OnFirstPageDataSourceBindCallBack);
|
|
|
|
searchControl.ParentUnionField = model.SourceKeyField;
|
|
|
|
searchPanel.Dock = DockStyle.Bottom;
|
|
searchPanel.BorderStyle = DevExpress.XtraEditors.Controls.BorderStyles.NoBorder;
|
|
searchPanel.BackColor = Color.Transparent;
|
|
searchPanel.Parent = tabPage;
|
|
searchPanel.Height = searchControl.InitSearchControl(controls, searchPanel);
|
|
unionModel.SearchObj = searchControl;
|
|
#endregion
|
|
|
|
unionModel.GridControlObj = gridControl;
|
|
unionModel.ModelObj = model;
|
|
unionModel.TreeViewObj = treeView;
|
|
|
|
tabPage.Tag = unionModel;
|
|
|
|
this.xtc_left_container.TabPages.Add(tabPage);
|
|
}
|
|
}
|
|
/// <summary>
|
|
/// <para>说明:验证单据是否修改过</para>
|
|
/// <para>创建人:龚宇超</para>
|
|
/// <para>创建日期: </para>
|
|
/// <para>修改人:</para>
|
|
/// <para>修改日期:</para>
|
|
/// <para>修改备注:</para>
|
|
/// <para>版本:1.0</para>
|
|
/// </summary>
|
|
//private void VerfyBillUpdated()
|
|
//{
|
|
// bool isUpdateDetailed = false;
|
|
// DataTable table = this.gridControl.DataSource as DataTable;
|
|
// if (table != null && table.Rows.Count > 0)
|
|
// {
|
|
// DataRow updateRow = table.Rows.Cast<DataRow>().FirstOrDefault(x => x.RowState != DataRowState.Unchanged);
|
|
// isUpdateDetailed = updateRow != null;
|
|
// }
|
|
// if (this.BillRowItem != null && (this.ControlObj.VerifyUpdated() || isUpdateDetailed))
|
|
// {
|
|
// bool isReadOnly2 = !string.IsNullOrEmpty(this.BillModel.ModifyCond) && !ReplaceHelper.ReplaceRowParamCond(this.BillRowItem, this.BillModel.ModifyCond);
|
|
// if (!isReadOnly2)
|
|
// {
|
|
// if (MessageUtil.Show(ResourceKeys.DataChanged, MessageBoxButtons.YesNo) == DialogResult.Yes)
|
|
// {
|
|
// this.BillSave();
|
|
// }
|
|
// }
|
|
// }
|
|
//}
|
|
/// <summary>
|
|
/// <para>说明:初始化单据按钮状态</para>
|
|
/// <para>创建人:龚宇超</para>
|
|
/// <para>创建日期:2017-12-04 </para>
|
|
/// <para>修改人:</para>
|
|
/// <para>修改日期:</para>
|
|
/// <para>修改备注:</para>
|
|
/// <para>版本:1.0</para>
|
|
/// </summary>
|
|
/// <param name="isEdit">if set to <c>true</c> [is edit].</param>
|
|
private void SetBillStatus(DataRow rowItem)
|
|
{
|
|
if (rowItem != null)
|
|
{
|
|
// 单据为修改状态,无需设置赋值时不需要计算面板属性
|
|
bool isReadOnly = !string.IsNullOrEmpty(this.BillModel.ModifyCond) && !ReplaceHelper.ReplaceRowParamCond(rowItem, this.BillModel.ModifyCond);
|
|
this.lbTitle.Text = this.BillModel.TypeName + "(修改)";
|
|
this.lblOrderNo.Text = rowItem[this.BillModel.PrimaryKey] + "";
|
|
this.BillModel.SaveState = true;
|
|
this._itemImport.Enabled = this._itemImportUpdate.Enabled = !isReadOnly;
|
|
//this.ControlObj.SetReadOnlyAllControl(isReadOnly);
|
|
//this.ControlObj.SetAllControlValue(rowItem);
|
|
//this.ControlObj.CanExecControl = true;
|
|
this.BillRowItem = rowItem;
|
|
this.gcMain.OptionsBehavior.Editable = !isReadOnly;
|
|
//this.gcMain.GridControl.DataSource = BillImpl.GetDataTableResult(ReplaceHelper.ReplaceRowParam(rowItem, this.BillModel.DetailSql));
|
|
//RefreshPrindMenu();
|
|
}
|
|
else
|
|
{
|
|
this.lbTitle.Text = this.BillModel.TypeName + "(新增)";
|
|
this.lblOrderNo.Text = BillImpl.GetBillNo(this.BillModel.BillSeq);
|
|
this._itemImport.Enabled = this._itemImportUpdate.Enabled = true;
|
|
this.BillModel.SaveState = false;
|
|
//this.ControlObj.SetReadOnlyAllControl(false);
|
|
// 通过右键菜单打开单据,假如明细有数据则在初始化时使用传入数据.
|
|
this.gcMain.OptionsBehavior.Editable = true;
|
|
//this.gcMain.GridControl.DataSource = BillImpl.GetDataTableResult(this.BillModel.DetailSql);
|
|
}
|
|
|
|
this._waterMark = new WaterMark(this.BillModel.MasterPreFix, rowItem);
|
|
this.lbTitle.Invalidate();
|
|
}
|
|
#endregion
|
|
|
|
#region 复制单据
|
|
/// <summary>
|
|
/// <para>说明:复制表头数据</para>
|
|
/// <para>创建人:龚宇超</para>
|
|
/// <para>创建日期:2017-11-27 </para>
|
|
/// <para>修改人:</para>
|
|
/// <para>修改日期:</para>
|
|
/// <para>修改备注:</para>
|
|
/// <para>版本:1.0</para>
|
|
/// </summary>
|
|
/// <param name="sender">The source of the event.</param>
|
|
/// <param name="e">The <see cref="ItemClickEventArgs"/> instance containing the event data.</param>
|
|
protected void OnCopyMasterItemClick(object sender, ItemClickEventArgs e)
|
|
{
|
|
try
|
|
{
|
|
this.lbTitle.Text = this.BillModel.TypeName + "(新增)";
|
|
this.lbTitle.Invalidate();
|
|
this.lblOrderNo.Text = BillImpl.GetBillNo(this.BillModel.BillSeq);
|
|
this.BillModel.SaveState = false;
|
|
this._itemImport.Enabled = this._itemImportUpdate.Enabled = true;
|
|
this.txtOperateDate.TextEditObj.Text = DateTime.Now.ToString();
|
|
//this.ControlObj.CopyControlValue();
|
|
//this.ControlObj.SetReadOnlyAllControl(false);
|
|
this.gcMain.GridControl.DataSourceTable().Clear();
|
|
this.gcMain.OptionsBehavior.Editable = true;
|
|
this._waterMark = new WaterMark(this.BillModel.MasterPreFix, null);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
string Message = ErrorMessage.PromptErrorMessage(ex);
|
|
MessageUtil.Show(Message, ex.Message);
|
|
}
|
|
}
|
|
/// <summary>
|
|
/// <para>说明:复制整单</para>
|
|
/// <para>创建人:龚宇超</para>
|
|
/// <para>创建日期:2017-11-27 </para>
|
|
/// <para>修改人:</para>
|
|
/// <para>修改日期:</para>
|
|
/// <para>修改备注:</para>
|
|
/// <para>版本:1.0</para>
|
|
/// </summary>
|
|
/// <param name="sender">The source of the event.</param>
|
|
/// <param name="e">The <see cref="ItemClickEventArgs"/> instance containing the event data.</param>
|
|
protected void OnCopyAllItemClick(object sender, ItemClickEventArgs e)
|
|
{
|
|
try
|
|
{
|
|
DataTable gridTable = (this.gcMain.GridControl.DataSource as DataTable).TrimDeleteRows();
|
|
this.lbTitle.Text = this.BillModel.TypeName + "(新增)";
|
|
this.lbTitle.Invalidate();
|
|
this.lblOrderNo.Text = BillImpl.GetBillNo(this.BillModel.BillSeq);
|
|
this._itemImport.Enabled = this._itemImportUpdate.Enabled = true;
|
|
//this.ControlObj.CopyControlValue();
|
|
//this.ControlObj.SetReadOnlyAllControl(false);
|
|
this.txtOperateDate.TextEditObj.Text = DateTime.Now.ToString();
|
|
this._waterMark = new WaterMark(this.BillModel.MasterPreFix, null);
|
|
if (!gridTable.Columns.Contains(ERPInfo.Instance.isAddRows))
|
|
{
|
|
gridTable.Columns.Add(ERPInfo.Instance.isAddRows, typeof(String));
|
|
}
|
|
// 处理单据明细
|
|
DataTable detailTable = this.gcMain.GridControl.DataSourceTable();
|
|
bool canCopy = false;
|
|
string defaultValue = string.Empty;
|
|
if (detailTable.Columns.Contains(this.BillModel.PrimaryDetailKey))
|
|
{
|
|
foreach (DataRow item in detailTable.Rows)
|
|
{
|
|
//根据后台列配置可否复制
|
|
if (_detailColumns.Columns.Contains("canCopy"))
|
|
{
|
|
int index = detailTable.Rows.IndexOf(item);
|
|
foreach (DataRow dr in _detailColumns.Rows)
|
|
{
|
|
canCopy = string.IsNullOrEmpty(dr["canCopy"] + "") || Convert.ToInt32(dr["canCopy"] + "") == 0 ? false : true;
|
|
if (!canCopy)
|
|
{
|
|
GridColumn column = this.gcMain.Columns.ColumnByFieldName(dr["fieldName"] + "");
|
|
//defaultValue = this.ControlObj.ReplaceParentControlValue(dr["defaultdate"] + "");
|
|
if (!string.IsNullOrEmpty(defaultValue))
|
|
{
|
|
this.gcMain.SetRowCellValue(index, column, defaultValue);
|
|
}
|
|
else
|
|
{
|
|
this.gcMain.SetRowCellValue(index, column, DBNull.Value);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
item[this.BillModel.PrimaryDetailKey] = this.lblOrderNo.Text;
|
|
}
|
|
}
|
|
this.gcMain.OptionsBehavior.Editable = true;
|
|
this.BillModel.SaveState = false;
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
string Message = ErrorMessage.PromptErrorMessage(ex);
|
|
MessageUtil.Show(Message, ex.Message);
|
|
}
|
|
}
|
|
#endregion
|
|
|
|
#region Excel操作
|
|
/// <summary>
|
|
/// <para>说明:导出Excel</para>
|
|
/// <para>创建人:龚宇超</para>
|
|
/// <para>创建日期:2017-11-27 </para>
|
|
/// <para>修改人:</para>
|
|
/// <para>修改日期:</para>
|
|
/// <para>修改备注:</para>
|
|
/// <para>版本:1.0</para>
|
|
/// </summary>
|
|
/// <param name="sender">The source of the event.</param>
|
|
/// <param name="e">The <see cref="ItemClickEventArgs"/> instance containing the event data.</param>
|
|
protected void OnExportItemClick(object sender, ItemClickEventArgs e)
|
|
{
|
|
try
|
|
{
|
|
this.gcMain.GridControl.ToExcel(this.SysModel.FormText);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
string Message = ErrorMessage.PromptErrorMessage(ex);
|
|
MessageUtil.Show(Message, ex.Message);
|
|
}
|
|
}
|
|
/// <summary>
|
|
/// <para>说明:从Excel导入</para>
|
|
/// <para>创建人:龚宇超</para>
|
|
/// <para>创建日期:2017-11-27 </para>
|
|
/// <para>修改人:</para>
|
|
/// <para>修改日期:</para>
|
|
/// <para>修改备注:</para>
|
|
/// <para>版本:1.0</para>
|
|
/// </summary>
|
|
/// <param name="sender">The source of the event.</param>
|
|
/// <param name="e">The <see cref="ItemClickEventArgs"/> instance containing the event data.</param>
|
|
protected void OnImportItemClick(object sender, ItemClickEventArgs e)
|
|
{
|
|
try
|
|
{
|
|
OpenFileDialog dialog = new OpenFileDialog();
|
|
dialog.Title = "选择导入文件";
|
|
dialog.Filter = "Excel文件(*.xls)|*.xls";
|
|
|
|
DialogResult result = dialog.ShowDialog();
|
|
if (result == DialogResult.OK)
|
|
{
|
|
string fileName = dialog.FileName;
|
|
string colFields = this.gcMain.Columns.ToString(',');
|
|
DataTable DataImportTable = this.gcMain.ToExcelDataTable(fileName, colFields, true);
|
|
DataTable NewTable = this.gcMain.GridControl.DataSourceTable();
|
|
GridColumnCollection gridColumns = this.gcMain.Columns;
|
|
foreach (DataRow rowItem in DataImportTable.Rows)
|
|
{
|
|
DataRow newRow = NewTable.NewRow();
|
|
foreach (GridColumn col in gridColumns)
|
|
{
|
|
if ("id".Equals(col.FieldName) || col.FieldName.Equals(this.BillModel.PrimaryKey)) continue;
|
|
if (rowItem.Table.Columns.Contains(col.FieldName))
|
|
{
|
|
// 列中是否包含对应字段,包含则使用值
|
|
newRow[col.FieldName] = rowItem[col.FieldName];
|
|
}
|
|
else
|
|
{
|
|
// 未包含字段,则使用控件默认值.
|
|
GridColumnModel model = col.Tag as GridColumnModel;
|
|
string fieldValue = BaseImpl.GetDefaultValue(model.DefaultValue);
|
|
if (model.DefaultValue.Contains("{#"))
|
|
{
|
|
//fieldValue = this.ControlObj.ReplaceParentControlValue(model.DefaultValue);
|
|
|
|
}
|
|
if (!string.IsNullOrEmpty(fieldValue))
|
|
{
|
|
newRow[col.FieldName] = fieldValue;
|
|
}
|
|
}
|
|
}
|
|
NewTable.Rows.Add(newRow);
|
|
}
|
|
this.gcMain.GridControl.DataSource = NewTable;
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
string Message = ErrorMessage.PromptErrorMessage(ex);
|
|
MessageUtil.Show(Message, ex.Message);
|
|
}
|
|
}
|
|
/// <summary>
|
|
/// <para>说明:导入Excel文件(更新)</para>
|
|
/// <para>创建人:龚宇超</para>
|
|
/// <para>创建日期:2017-11-27 </para>
|
|
/// <para>修改人:</para>
|
|
/// <para>修改日期:</para>
|
|
/// <para>修改备注:</para>
|
|
/// <para>版本:1.0</para>
|
|
/// </summary>
|
|
/// <param name="sender">The source of the event.</param>
|
|
/// <param name="e">The <see cref="ItemClickEventArgs"/> instance containing the event data.</param>
|
|
protected void OnImportUpdateItemClick(object sender, ItemClickEventArgs e)
|
|
{
|
|
|
|
}
|
|
#endregion
|
|
|
|
#region 常用工具
|
|
/// <summary>
|
|
/// <para>说明:验证可操作条件</para>
|
|
/// <para>创建人:龚宇超</para>
|
|
/// <para>创建日期:2018-03-07 </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 OnToolsClick(object sender, EventArgs e)
|
|
{
|
|
//foreach (BarItemLink itemLink in pMenu.ItemLinks)
|
|
//{
|
|
// DataRow rowItem = itemLink.Item.Tag as DataRow;
|
|
// if (rowItem != null)
|
|
// {
|
|
// string menuCond = rowItem["MenuCond"] + "";
|
|
// string menuCaption = itemLink.Caption;
|
|
|
|
// if (!string.IsNullOrEmpty(menuCond))
|
|
// {
|
|
// try
|
|
// {
|
|
// bool result = true;
|
|
// menuCond = ReplaceHelper.ReplaceParamToValue(menuCond, "{" + this.BillModel.PrimaryKey + "}", this.lblOrderNo.Text.Trim());
|
|
|
|
// if (menuCond.StartsWith("@") || menuCond.StartsWith("!"))
|
|
// {
|
|
// result = "1".Equals(BaseImpl.GetDefaultValue(menuCond));
|
|
// }
|
|
// else
|
|
// {
|
|
// menuCond = this.ControlObj.ReplaceControlValue(menuCond);
|
|
// if (this.BillRowItem != null)
|
|
// menuCond = ReplaceHelper.ReplaceRowParam(this.BillRowItem, menuCond);
|
|
// menuCond = ReplaceHelper.ReplaceParamToValue(menuCond, "0"); // 未替换的参数所有替换为0
|
|
|
|
// result = ReplaceHelper.EvalCond(menuCond);
|
|
// }
|
|
// itemLink.Item.Enabled = result;
|
|
// }
|
|
// catch (Exception ex)
|
|
// {
|
|
// MessageUtil.Show("[" + menuCaption + "] " + ResourceKeys.SetRightMenuCondFault);
|
|
// LogHelper.Instance.WriteError(ex);
|
|
// }
|
|
// }
|
|
// }
|
|
//}
|
|
}
|
|
/// <summary>
|
|
/// <para>说明:常用工具点击</para>
|
|
/// <para>创建人:龚宇超</para>
|
|
/// <para>创建日期:2017-11-27 </para>
|
|
/// <para>修改人:</para>
|
|
/// <para>修改日期:</para>
|
|
/// <para>修改备注:</para>
|
|
/// <para>版本:1.0</para>
|
|
/// </summary>
|
|
/// <param name="sender">The source of the event.</param>
|
|
/// <param name="e">The <see cref="ItemClickEventArgs"/> instance containing the event data.</param>
|
|
protected void OnCommonItemClick(object sender, ItemClickEventArgs e)
|
|
{
|
|
//DataRow rowItem = e.Item.Tag as DataRow;
|
|
|
|
//CommonMenu menu = new CommonMenu(this.SysModel, this.ControlObj);
|
|
//menu.ApplyBefore += new CommonToolApplyEventHandler(OnMenuApplyBefore);
|
|
//menu.Apply(rowItem);
|
|
}
|
|
/// <summary>
|
|
/// <para>说明:执行前单独替换BilldocumentId</para>
|
|
/// <para>创建人:龚宇超</para>
|
|
/// <para>创建日期:2018-03-07 </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.BillModel.PrimaryKey.Equals(cond.Replace("{", "").Replace("}", "").ToLower(), StringComparison.OrdinalIgnoreCase) ? this.lblOrderNo.Text.Trim() : 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-07-09 </para>
|
|
/// <para>修改人:</para>
|
|
/// <para>修改日期:</para>
|
|
/// <para>修改备注:</para>
|
|
/// <para>版本:1.0</para>
|
|
/// </summary>
|
|
protected void GetPrintOtherParam()
|
|
{
|
|
//取得打印完成后的参数
|
|
if (!string.IsNullOrEmpty(this.BillModel.PrintSql) && this.BillModel.PrintSql.Contains("<<"))
|
|
{
|
|
string[] strs = this.BillModel.PrintSql.Split(new[] { ">>" }, 2, StringSplitOptions.None);
|
|
_mainPrintSql = strs[1];
|
|
_printModeCond = strs[0].Replace("<<", "");
|
|
}
|
|
if (!string.IsNullOrEmpty(_printModeCond) && _printModeCond.IndexOf(';') > 0)
|
|
{
|
|
string[] str = _printModeCond.Split(';');
|
|
DataRow item = AttachImpl.GetSystemModule(str[0]);
|
|
string tableName = item["TableName"] + "";
|
|
string modetype = item["modType"] + "";
|
|
string comprefix = BaseImpl.GetColumnPrefix(tableName);
|
|
string primaryKey = modetype == "1" ? BaseImpl.GetBasePrimaryKey(str[0]) : comprefix + "billdocument_id";
|
|
//表名,列前缀,主键字段,主键值,模块编号,主打印Sql
|
|
_printSaveParams = new List<string>() { tableName, comprefix, primaryKey, str[1], str[0], _mainPrintSql };
|
|
|
|
//判断是否直接打印 modetype 区别单据和基础档案模块
|
|
switch (modetype)
|
|
{
|
|
case "1":
|
|
ModuleModel mode = new ModuleModel(MainImpl.GetSystemdllTab(str[0]));
|
|
if (mode != null) _isExcPrint = mode.PrintType == 3;
|
|
break;
|
|
case "2":
|
|
BaseAccraditationModel model = new BaseAccraditationModel(BillAuditImpl.GetPubAuditProperty(str[0]));
|
|
if (model != null) _isExcPrint = model.BillPrintType == 3;
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
/// <summary>
|
|
/// <para>说明:打印模版</para>
|
|
/// <para>创建人:龚宇超</para>
|
|
/// <para>创建日期:2017-11-27 </para>
|
|
/// <para>修改人:</para>
|
|
/// <para>修改日期:</para>
|
|
/// <para>修改备注:</para>
|
|
/// <para>版本:1.0</para>
|
|
/// </summary>
|
|
/// <param name="sender">The source of the event.</param>
|
|
/// <param name="e">The <see cref="ItemClickEventArgs"/> instance containing the event data.</param>
|
|
protected void OnPrintItemClick(object sender, ItemClickEventArgs e)
|
|
{
|
|
string printFile = e.Item.Tag + "";
|
|
string printPath = PubUtil.PrintFileAbsolutelyPath;
|
|
|
|
if (!File.Exists(printPath))
|
|
{
|
|
MessageUtil.Show(ResourceKeys.NotFoundPrintFile);
|
|
return;
|
|
}
|
|
|
|
bool isPrint = this.BillModel.SaveState;
|
|
if (!isPrint)
|
|
{
|
|
if (MessageUtil.Show(ResourceKeys.BillNotSavedAndNotPrint, MessageBoxButtons.YesNo) == DialogResult.Yes)
|
|
isPrint = this.BillSave();
|
|
}
|
|
|
|
if (isPrint)
|
|
{
|
|
try
|
|
{
|
|
// 判断是否满足打印条件
|
|
|
|
//DataRow masterRow = BillImpl.GetDataRowResult(this.BillModel.MasterSql.Replace("{" + this.BillModel.PrimaryKey + "}", this.lblOrderNo.Text));
|
|
DataRow masterRow = BillImpl.GetDataRowResult(string.Format("select * from {0} where {1}='{2}'", BillModel.MasterTable, BillModel.PrimaryKey, this.lblOrderNo.Text));
|
|
if (masterRow == null)
|
|
{
|
|
MessageUtil.Show(ResourceKeys.DataNotFount);
|
|
return;
|
|
}
|
|
|
|
if (!ReplaceHelper.ReplaceRowParamCond(masterRow, this.BillModel.PrintCond))
|
|
{
|
|
MessageUtil.Show(ResourceKeys.DisSatisfyPrintCond);
|
|
return;
|
|
}
|
|
|
|
string tmpSql = ReplaceHelper.ReplaceRowParam(masterRow, this.BillModel.PrintSql);
|
|
string tmpSql1 = ReplaceHelper.ReplaceRowParam(masterRow, this.BillModel.PrintSql1);
|
|
string tmpSql2 = ReplaceHelper.ReplaceRowParam(masterRow, this.BillModel.PrintSql2);
|
|
|
|
if (printFile.Contains(PrintUtil.TemplateFlag))
|
|
{
|
|
//主Sql
|
|
string mainSql = string.Empty;
|
|
List<string> tmpSqls = new List<string>();
|
|
if (_printSaveParams != null && _printSaveParams.Count > 0)
|
|
{
|
|
_printSaveParams[5] = mainSql = ReplaceHelper.ReplaceRowParam(masterRow, _mainPrintSql);
|
|
_printSaveParams[3] = masterRow.Table.Columns.Contains(_printSaveParams[2] + "") ? masterRow[_printSaveParams[2]] + "" : masterRow[BillModel.PrimaryKey] + "";
|
|
tmpSqls.Add(mainSql);
|
|
tmpSqls.Add(tmpSql1);
|
|
tmpSqls.AddRange(tmpSql2.Split(';').ToList());
|
|
}
|
|
PrintUtil.OnAfterPrint -= new EventHandler(OnReportPrintAfter);
|
|
PrintUtil.OnAfterPrint += new EventHandler(OnReportPrintAfter);
|
|
PrintUtil.FastReportPrint(tmpSqls, printFile, _isExcPrint);
|
|
}
|
|
else
|
|
{
|
|
DelphiHelper.LoadDelphiDll(printPath, printPath, printFile, tmpSql, tmpSql1, this.BillModel.PrintFileType, tmpSql2);
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
//MessageUtil.Show(ex.Message + "\r\n" + ex.StackTrace);
|
|
LogUtil.WriteError(ResourceKeys.BillModule + "打印模板错误", ex);
|
|
LogHelper.Instance.WriteError(ex);
|
|
string Message = ErrorMessage.PromptErrorMessage(ex);
|
|
MessageUtil.Show(Message, ex.Message);
|
|
}
|
|
}
|
|
}
|
|
#endregion
|
|
|
|
#region 单据来源相关
|
|
/// <summary>
|
|
/// <para>说明:刷新当前选中的TabPage</para>
|
|
/// <para>创建人:龚宇超</para>
|
|
/// <para>创建日期:2018-06-29 </para>
|
|
/// <para>修改人:</para>
|
|
/// <para>修改日期:</para>
|
|
/// <para>修改备注:</para>
|
|
/// <para>版本:1.0</para>
|
|
/// </summary>
|
|
private void RefreshSelectedSource()
|
|
{
|
|
XtraTabPage tabPage = this.xtc_left_container.SelectedTabPage;
|
|
|
|
BillSourceUnionModel model = tabPage.Tag as BillSourceUnionModel;
|
|
if (model.GridControlObj != null) this.RefreshSource(model);
|
|
// 假如只有单据来源主表没有记录,则手动调用刷新明细.否则会通过选中行自动刷新明细
|
|
//if (model.GridControlObj != null && model.GridControlObj.DataRowCount() == 0)
|
|
//{
|
|
// this.RefreshSourceDetail(model);
|
|
//}
|
|
}
|
|
/// <summary>
|
|
/// <para>说明:刷新单据来源主表,未传递时,默认刷新</para>
|
|
/// <para>创建人:龚宇超</para>
|
|
/// <para>创建日期:2017-12-13 </para>
|
|
/// <para>修改人:</para>
|
|
/// <para>修改日期:</para>
|
|
/// <para>修改备注:</para>gcMain
|
|
/// <para>版本:1.0</para>
|
|
/// </summary>
|
|
/// <param name="unionModel">The union model.</param>
|
|
/// <returns>XtraTabPage.</returns>
|
|
private void RefreshSource(BillSourceUnionModel unionModel = null)
|
|
{
|
|
if (unionModel == null || unionModel.SearchObj == null) return;
|
|
unionModel.SearchObj.SearchLastGrid();
|
|
}
|
|
/// <summary>
|
|
/// <para>说明:右边选择下拉框刷新左边来源</para>
|
|
/// <para>创建人:龚宇超</para>
|
|
/// <para>创建日期:2018-08-16 </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>
|
|
private void OnRefreshBillSource(object sender, EventArgs e)
|
|
{
|
|
//XtraTabPage tabPage = this.xtc_left_container.SelectedTabPage;
|
|
//BillSourceUnionModel unionModel = tabPage.Tag as BillSourceUnionModel;
|
|
//if (unionModel.ModelObj.SourceType != 2)
|
|
//{
|
|
// string sql = ReplaceHelper.ReplaceUserInfo(unionModel.ModelObj.SourceSql);
|
|
// sql = sql.Replace("#", "");
|
|
// List<string> paramList = ReplaceHelper.GetParamFields(sql);
|
|
// if (unionModel.SearchObj != null)
|
|
// {
|
|
// sql = this.ControlObj.ReplaceControlValue(unionModel.SearchObj.SetSearchSqlValue(sql, true));
|
|
// }
|
|
// if (unionModel.GridControlObj != null)
|
|
// {
|
|
// unionModel.GridControlObj.gridControl.DataSource = BaseImpl.GetDataTableResult(sql);
|
|
// }
|
|
// if (unionModel.TreeViewObj != null && unionModel.TreeViewObj.TreeView.SelectedNode != null)
|
|
// {
|
|
// sql = ReplaceHelper.ReplaceUserInfo(ReplaceHelper.ReplaceWhereCond(unionModel.ModelObj.DetailSql));
|
|
// sql = sql.Replace("#", "");
|
|
// sql = this.ControlObj.ReplaceControlValue(sql);
|
|
// sql = ReplaceHelper.ReplaceParamToValue(sql, unionModel.TreeViewObj.TreeView.SelectedNode.Name);
|
|
// unionModel.GridDetailControlObj.GridControl.DataSource = BillImpl.GetDataTableResult(sql);
|
|
// }
|
|
//}
|
|
}
|
|
/// <summary>
|
|
/// <para>说明:刷新单据来源</para>
|
|
/// <para>创建人:龚宇超</para>
|
|
/// <para>创建日期:2019-12-16 </para>
|
|
/// <para>修改人:</para>
|
|
/// <para>修改日期:</para>
|
|
/// <para>修改备注:</para>
|
|
/// <para>版本:1.0</para>
|
|
/// </summary>
|
|
private void SaveRefreshSource()
|
|
{
|
|
foreach (XtraTabPage tabPage in this.xtc_left_container.TabPages)
|
|
{
|
|
BillSourceUnionModel model = tabPage.Tag as BillSourceUnionModel;
|
|
if (model != null && model.GridControlObj != null && model.ModelObj.SaveRefreshFlag)
|
|
{
|
|
this.RefreshSource(model);
|
|
//this.RefreshSourceDetail(model);
|
|
}
|
|
}
|
|
}
|
|
/// <summary>
|
|
/// <para>说明:添加行到单据明细中</para>
|
|
/// <para>创建人:龚宇超</para>
|
|
/// <para>创建日期:2017-11-30 </para>
|
|
/// <para>修改人:</para>
|
|
/// <para>修改日期:</para>
|
|
/// <para>修改备注:</para>
|
|
/// <para>版本:1.0</para>
|
|
/// </summary>
|
|
/// <param name="rowItem">The row item.</param>
|
|
/// <param name="unionModel">The union model.</param>
|
|
//private void AddRowToGridView(DataRow rowItem)
|
|
//{
|
|
// GridColumnCollection gridColumns = this.gcMain.Columns;
|
|
// DataTable gridTable = (this.gcMain.GridControl.DataSource as DataTable).TrimDeleteRows();
|
|
// if (!gridTable.Columns.Contains(ERPInfo.Instance.isAddRows))
|
|
// {
|
|
// gridTable.Columns.Add(ERPInfo.Instance.isAddRows, typeof(String));
|
|
// }
|
|
// string repeatProduct = this.gcMain.Columns["ProductId"] != null && rowItem.Table.Columns.Contains("ProductId") ? "ProductId" : this.BillModel.DetailPreFix + "ProductId";
|
|
// if ("1".Equals(this.BillModel.DetailDoubleClickTip) && this.gcMain.Columns[repeatProduct] != null && rowItem.Table.Columns.Contains(repeatProduct))
|
|
// {
|
|
// // 需要提示编码重复
|
|
// GridView view = this.gcMain;
|
|
// bool result = (view.LocateByValue(repeatProduct, rowItem[repeatProduct], null) >= 0) |
|
|
// (view.LocateByValue(repeatProduct, rowItem[repeatProduct], null) >= 0) |
|
|
// (view.LocateByValue(repeatProduct, rowItem[repeatProduct], null) >= 0) |
|
|
// (view.LocateByValue(repeatProduct, rowItem[repeatProduct], null) >= 0);
|
|
// if (result)
|
|
// {
|
|
// DialogResult dialog = MessageUtil.Show(ResourceKeys.ProductIsRepet, MessageBoxButtons.YesNo);
|
|
// if (dialog != DialogResult.Yes)
|
|
// return;
|
|
// }
|
|
// }
|
|
|
|
// DataRow newRow = gridTable.NewRow();
|
|
// //if (gridTable.Columns.Contains(guidField))
|
|
// //{
|
|
// // newRow[guidField] = Guid.NewGuid().ToString();
|
|
// //}
|
|
// int position = this.gcMain.FocusedRowHandle;
|
|
// bool isLastRow = this.gcMain.IsLastVisibleRow;
|
|
|
|
// if (!isLastRow)
|
|
// {
|
|
// // 插入数据行
|
|
// gridTable.Rows.InsertAt(newRow, position);
|
|
|
|
// this.gcMain.ClearSelection();
|
|
// this.gcMain.SelectRowHandler(position);
|
|
// }
|
|
// else
|
|
// {
|
|
// // 添加数据行
|
|
// gridTable.Rows.Add(newRow);
|
|
// this.gcMain.ClearSelection();
|
|
// this.gcMain.SelectRowHandler(gridTable.Rows.Count - 1);
|
|
// }
|
|
|
|
// // 赋值明细字段
|
|
// foreach (GridColumn col in gridColumns)
|
|
// {
|
|
// try
|
|
// {
|
|
// if (rowItem.Table.Columns.Contains(col.FieldName))
|
|
// {
|
|
// // 来源列中是否包含对应字段,包含则使用值
|
|
// newRow[col.FieldName] = rowItem[col.FieldName];
|
|
// this.gcMain.SetFocusedRowCellValue(col, rowItem[col.FieldName]);
|
|
// }
|
|
// else
|
|
// {
|
|
// // 未包含字段,则使用控件默认值.
|
|
// GridColumnModel model = col.Tag as GridColumnModel;
|
|
// string fieldValue = BaseImpl.GetDefaultValue(model.DefaultValue);
|
|
|
|
// if (model.DefaultValue.Contains("{#"))
|
|
// {
|
|
// fieldValue = this.ControlObj.ReplaceParentControlValue(model.DefaultValue);
|
|
// if (!string.IsNullOrEmpty(fieldValue))
|
|
// {
|
|
// newRow[col.FieldName] = fieldValue;
|
|
// this.gcMain.SetFocusedRowCellValue(col, fieldValue);
|
|
// }
|
|
// }
|
|
// else if (!string.IsNullOrEmpty(model.DefaultValue))
|
|
// {
|
|
// newRow[col.FieldName] = fieldValue;
|
|
// this.gcMain.SetFocusedRowCellValue(col, fieldValue);
|
|
// }
|
|
// }
|
|
// }
|
|
// catch (Exception ex)
|
|
// {
|
|
// LogHelper.Instance.WriteError(ex);
|
|
// LogUtil.WriteError(col.FieldName + "添加出错!", ex);
|
|
// }
|
|
// }
|
|
|
|
|
|
// // 插入数据后
|
|
// if (isLastRow)
|
|
// {
|
|
// this.gcMain.ClearSelection();
|
|
// this.gcMain.SelectRowHandler(position + 1);
|
|
// }
|
|
|
|
// gridTable.OrderBy(this.BillModel.DetailOrderField);
|
|
// this.gcMain.UpdateCurrentRow();
|
|
// this.gcMain.ShowEditor();
|
|
//}
|
|
/// <summary>
|
|
/// <para>说明:检查添加数据到表格中是否包含Bom</para>
|
|
/// <para>创建人:龚宇超</para>
|
|
/// <para>创建日期:2018-04-20 </para>
|
|
/// <para>修改人:</para>
|
|
/// <para>修改日期:</para>
|
|
/// <para>修改备注:</para>
|
|
/// <para>版本:1.0</para>
|
|
/// </summary>
|
|
/// <param name="rowItem">The row item.</param>
|
|
/// <param name="unionModel">The union model.</param>
|
|
/// <param name="onlyPopup">if set to <c>true</c> [only popup].</param>
|
|
private void AddRowToGridViewByBom(DataRow rowItem, BillSourceUnionModel unionModel, ref bool onlyPopup)
|
|
{
|
|
//if (!string.IsNullOrEmpty(unionModel.ModelObj.BomSql))
|
|
//{
|
|
// string bomSql = unionModel.ModelObj.BomSql;
|
|
// // 检查是否有bom配置
|
|
// if (unionModel.ModelObj.LoadBom == 1)
|
|
// {
|
|
// // 自动带出bom数据,不弹出选择
|
|
// DataTable table = BaseImpl.GetDataTableResult(ReplaceHelper.ReplaceRowParam(rowItem, bomSql));
|
|
// foreach (DataRow item in table.Rows)
|
|
// {
|
|
// this.AddRowToGridView(item);
|
|
// }
|
|
// }
|
|
// else if (unionModel.ModelObj.LoadBom == 2)
|
|
// {
|
|
// DataTable table = BaseImpl.GetDataTableResult(ReplaceHelper.ReplaceRowParam(rowItem, bomSql));
|
|
|
|
// if (!onlyPopup && table.Rows.Count > 0)
|
|
// {
|
|
// // 自动带出bom数据,弹出选择
|
|
// FrmBomSelect frmSelect = new FrmBomSelect();
|
|
// frmSelect.Caption = unionModel.ModelObj.BomCaption;
|
|
// frmSelect.GridColumns = unionModel.GridDetailControlObj.GridView.Columns;
|
|
// frmSelect.BomDataTable = table;
|
|
|
|
// DialogResult result = frmSelect.ShowDialog();
|
|
// onlyPopup = frmSelect.OnlyPopup;
|
|
|
|
// if (result == DialogResult.OK && frmSelect.SelectBomRows != null && frmSelect.SelectBomRows.Length > 0)
|
|
// {
|
|
// foreach (DataRow item in frmSelect.SelectBomRows)
|
|
// {
|
|
// this.AddRowToGridView(item);
|
|
// }
|
|
// }
|
|
// }
|
|
// else
|
|
// {
|
|
// foreach (DataRow item in table.Rows)
|
|
// {
|
|
// this.AddRowToGridView(item);
|
|
// }
|
|
// }
|
|
// }
|
|
//}
|
|
}
|
|
/// <summary>
|
|
/// <para>说明:添加多条数据到单据明细</para>
|
|
/// <para>创建人:龚宇超</para>
|
|
/// <para>创建日期:2017-11-30 </para>
|
|
/// <para>修改人:</para>
|
|
/// <para>修改日期:</para>
|
|
/// <para>修改备注:</para>
|
|
/// <para>版本:1.0</para>
|
|
/// </summary>
|
|
private void AddMultiRowToGridView(DataRow[] rowItems)
|
|
{
|
|
//bool onlyPopup = false;
|
|
|
|
//XtraTabPage tabPage = this.xtc_left_container.SelectedTabPage;
|
|
//BillSourceUnionModel unionModel = tabPage.Tag as BillSourceUnionModel;
|
|
|
|
//if (unionModel != null)
|
|
//{
|
|
// bool onlyOne = true;
|
|
// for (int i = 0; i < rowItems.Length; i++)
|
|
// {
|
|
// DataRow rowItem = rowItems[i]; //unionModel.GridDetailControlObj.GridView.GetDataRow(selectedRows[i]);
|
|
// // 检查当前记录是否满足条件
|
|
// if (ValidateDetailCond(rowItem, unionModel))
|
|
// {
|
|
// this.AddRowToGridView(rowItem);
|
|
// this.AddRowToGridViewByBom(rowItem, unionModel, ref onlyPopup);
|
|
// }
|
|
// else
|
|
// {
|
|
// if (onlyOne)
|
|
// {
|
|
// onlyOne = false;
|
|
// if (!string.IsNullOrEmpty(unionModel.ModelObj.DetailEnableMsg))
|
|
// {
|
|
// if (unionModel.ModelObj.DetailEnableMsg.StartsWith("select", StringComparison.OrdinalIgnoreCase) ||
|
|
// unionModel.ModelObj.DetailEnableMsg.StartsWith("exec", StringComparison.OrdinalIgnoreCase))
|
|
// {
|
|
// MessageUtil.Show(BaseImpl.GetResult(unionModel.ModelObj.DetailEnableMsg) + "");
|
|
// }
|
|
// else
|
|
// {
|
|
// MessageUtil.Show(unionModel.ModelObj.DetailEnableMsg);
|
|
// }
|
|
// }
|
|
// }
|
|
// }
|
|
// }
|
|
//}
|
|
}
|
|
/// <summary>
|
|
/// <para>说明:添加多条数据到单据明细</para>
|
|
/// <para>创建人:龚宇超</para>
|
|
/// <para>创建日期:2018-05-30 </para>
|
|
/// <para>修改人:</para>
|
|
/// <para>修改日期:</para>
|
|
/// <para>修改备注:</para>
|
|
/// <para>版本:1.0</para>
|
|
/// </summary>
|
|
/// <param name="table">The table.</param>
|
|
private void AddMultiRowToGridView(DataTable table, BillSourceUnionModel unionModel = null)
|
|
{
|
|
//if (table == null) return;
|
|
|
|
//foreach (DataRow item in table.Rows)
|
|
//{
|
|
// if (unionModel == null)
|
|
// {
|
|
// this.AddRowToGridView(item);
|
|
// }
|
|
// else
|
|
// {
|
|
// // 检查当前记录是否满足条件
|
|
// if (ValidateDetailCond(item, unionModel))
|
|
// {
|
|
// this.AddRowToGridView(item);
|
|
// }
|
|
// }
|
|
// Application.DoEvents();
|
|
//}
|
|
}
|
|
/// <summary>
|
|
/// <para>说明:是否允许添加明细</para>
|
|
/// <para>创建人:龚宇超</para>
|
|
/// <para>创建日期:2018-06-06 </para>
|
|
/// <para>修改人:</para>
|
|
/// <para>修改日期:</para>
|
|
/// <para>修改备注:</para>
|
|
/// <para>版本:1.0</para>
|
|
/// </summary>
|
|
/// <returns><c>true</c> if this instance [can add detail row]; otherwise, <c>false</c>.</returns>
|
|
private bool CanAddDetailRow()
|
|
{
|
|
// 检测是否正在筛选数据
|
|
if (!string.IsNullOrEmpty(gcMain.FindFilterText.Trim()) ||
|
|
!string.IsNullOrEmpty(gcMain.FilterPanelText.Trim()))
|
|
{
|
|
if (MessageUtil.Show(ResourceKeys.GridViewSearching, MessageBoxButtons.YesNo) == DialogResult.Yes)
|
|
{
|
|
this.gcMain.FindFilterText = "";
|
|
return true;
|
|
}
|
|
return false;
|
|
}
|
|
// 检测是否点击了排序表格
|
|
if (this.gcMain.HasSortColumn())
|
|
{
|
|
//if (MessageUtil.Show(ResourceKeys.GridViewColumnSorting, MessageBoxButtons.YesNo) == DialogResult.Yes)
|
|
//{
|
|
this.gcMain.Columns.ClearAllSort();
|
|
// return true;
|
|
//}
|
|
//return false;
|
|
}
|
|
// 检测是否为提交或者终审模块
|
|
if (_waterMark.Text.Contains("已终审"))
|
|
{
|
|
MessageUtil.Show(ResourceKeys.AddBillDetailed);
|
|
return false;
|
|
}
|
|
return true;
|
|
}
|
|
/// <summary>
|
|
/// <para>说明:</para>
|
|
/// <para>创建人:龚宇超</para>
|
|
/// <para>创建日期:2017-11-30 </para>
|
|
/// <para>修改人:</para>
|
|
/// <para>修改日期:</para>
|
|
/// <para>修改备注:</para>
|
|
/// <para>版本:1.0</para>
|
|
/// </summary>
|
|
/// <returns><c>true</c> if XXXX, <c>false</c> otherwise.</returns>
|
|
private bool ValidateDetailCond(DataRow rowItem, BillSourceUnionModel unionModel)
|
|
{
|
|
//bool validate = false;
|
|
//try
|
|
//{
|
|
// string detailCond = ReplaceHelper.ReplaceRowParam(rowItem, unionModel.ModelObj.DetailEnableCond);
|
|
// if (detailCond.Contains("#"))
|
|
// {
|
|
// List<string> condition = ReplaceHelper.GetParamFields(detailCond);
|
|
// foreach (string item in condition)
|
|
// {
|
|
// string fieldValue = this.ControlObj.GetControlValue(item.Replace("{#", "").Replace("}", ""));
|
|
// detailCond = detailCond.Replace(item, fieldValue);
|
|
// }
|
|
// }
|
|
// validate = ReplaceHelper.EvalCond(detailCond);
|
|
//}
|
|
//catch (Exception ex)
|
|
//{
|
|
// LogHelper.Instance.WriteLog(ex.StackTrace);
|
|
// LogUtil.WriteError("验证多条添加条件出错!", ex);
|
|
// //MessageUtil.Show(ResourceKeys.CondtionError + "\r\n" + unionModel.ModelObj.DetailEnableCond);
|
|
//}
|
|
return false;
|
|
}
|
|
/// <summary>
|
|
/// <para>说明:单据来源右键菜单执行完后刷新</para>
|
|
/// <para>创建人:龚宇超</para>
|
|
/// <para>创建日期:2017-12-11 </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 OnGridControlRightCallback(object sender, EventArgs e)
|
|
{
|
|
try
|
|
{
|
|
this.RefreshSelectedSource();
|
|
|
|
// 执行右键菜单后刷新单据状态2020-03-23
|
|
XtraTabPage tabPage = this.xtc_left_container.SelectedTabPage;
|
|
BillSourceUnionModel model = tabPage.Tag as BillSourceUnionModel;
|
|
if (model.ModelObj.SourceType == 2 && this._isLoadRightControlValue)
|
|
{
|
|
DataRow rowItem = null;
|
|
if (model.GridControlObj.DataRowCount() > 0)
|
|
{
|
|
DataRow selectRow = model.GridControlObj.GridView.GetFocusedDataRow();
|
|
rowItem = BillImpl.GetDataRowResult(ReplaceHelper.ReplaceRowParam(selectRow, BillModel.MasterSql));
|
|
}
|
|
// 加载单据信息
|
|
this.SetBillStatus(rowItem);
|
|
if (rowItem == null)
|
|
{
|
|
this.ResetControlValue();
|
|
}
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
string Message = ErrorMessage.PromptErrorMessage(ex);
|
|
MessageUtil.Show(Message, ex.Message);
|
|
}
|
|
}
|
|
/// <summary>
|
|
/// <para>说明:获取单据管理的单据来源标签</para>
|
|
/// <para>创建人:龚宇超</para>
|
|
/// <para>创建日期:2017-12-13 </para>
|
|
/// <para>修改人:</para>
|
|
/// <para>修改日期:</para>
|
|
/// <para>修改备注:</para>
|
|
/// <para>版本:1.0</para>
|
|
/// </summary>
|
|
private BillSourceUnionModel GetBillSourceManager()
|
|
{
|
|
foreach (XtraTabPage item in this.xtc_left_container.TabPages)
|
|
{
|
|
BillSourceUnionModel model = item.Tag as BillSourceUnionModel;
|
|
if (model.ModelObj.SourceType == 2)
|
|
return model;
|
|
}
|
|
return null;
|
|
}
|
|
/// <summary>
|
|
/// <para>说明:初始化附加信息</para>
|
|
/// <para>创建人:龚宇超</para>
|
|
/// <para>创建日期:2018-04-26 </para>
|
|
/// <para>修改人:</para>
|
|
/// <para>修改日期:</para>
|
|
/// <para>修改备注:</para>
|
|
/// <para>版本:1.0</para>
|
|
/// </summary>
|
|
private List<GridDetailModel> GetAttachTabs()
|
|
{
|
|
List<GridDetailModel> details = new List<GridDetailModel>();
|
|
DataTable table = BaseAuditImpl.GetAttachTabs(this.SysModel.ModuleCode, "100", " and orderid < 0 ");
|
|
foreach (DataRow item in table.Rows)
|
|
{
|
|
DataTable gridColumns = BaseAuditImpl.GetBottomBasicInformation(item["formKey"] + "");
|
|
details.Add(new GridDetailModel(item, gridColumns, GridCustomColumnStruct.BillSourceDetailAttachGridView));
|
|
}
|
|
return details;
|
|
}
|
|
#endregion
|
|
|
|
#region 单据保存、提交
|
|
private bool VerifyNull()
|
|
{
|
|
// 主字段不能为空
|
|
string isgnseq = this.txtisgnseq.TextEditObj.EditValue + "";
|
|
if (string.IsNullOrEmpty(isgnseq))
|
|
{
|
|
MessageUtil.Show("字不能为空!");
|
|
this.txtisgnseq.TextEditObj.Focus();
|
|
return false;
|
|
}
|
|
|
|
// 明细字段不能为空
|
|
DataTable table = this.gridControl.DataSourceTable().TrimEmptyRows();
|
|
string[] columns = { "cdigest", "ccode" };
|
|
|
|
foreach (DataRow item in table.Rows)
|
|
{
|
|
foreach (string col in columns)
|
|
{
|
|
GridColumn column = this.gcMain.Columns[col];
|
|
if (string.IsNullOrWhiteSpace(item[col] + ""))
|
|
{
|
|
MessageUtil.Show(string.Format(ResourceKeys.NullField, column.Caption));
|
|
this.gcMain.Focus();
|
|
this.gcMain.SelectRowHandler(table.Rows.IndexOf(item));
|
|
this.gcMain.FocusedColumn = this.gcMain.Columns[col];
|
|
this.gcMain.SelectCell(gcMain.FocusedRowHandle, this.gcMain.Columns[col]);
|
|
this.gcMain.ShowEditorByMouse();
|
|
return false;
|
|
}
|
|
}
|
|
// 特殊情况
|
|
if (string.IsNullOrEmpty(item["md"] + "") && string.IsNullOrEmpty(item["mc"] + ""))
|
|
{
|
|
MessageUtil.Show("贷方和借方不能为同时空!");
|
|
this.txtisgnseq.TextEditObj.Focus();
|
|
return false;
|
|
}
|
|
}
|
|
return true;
|
|
}
|
|
/// <summary>
|
|
/// <para>说明:获取添加表头数据</para>
|
|
/// <para>创建人:龚宇超</para>
|
|
/// <para>创建日期:2017-12-07 </para>
|
|
/// <para>修改人:</para>
|
|
/// <para>修改日期:</para>
|
|
/// <para>修改备注:</para>
|
|
/// <para>版本:1.0</para>
|
|
/// </summary>
|
|
/// <param name="parmaryValue">The parmary value.</param>
|
|
/// <returns>System.String.</returns>
|
|
private string GetAddRecord(ref string parmaryValue)
|
|
{
|
|
if (BillModel.NewVer == 0)
|
|
{
|
|
// 检查当前的单据号是否已被占用.
|
|
string newBillNo = BillImpl.GetBillNo(this.BillModel.BillSeq);
|
|
|
|
if (!parmaryValue.Equals(newBillNo))
|
|
{
|
|
if (MessageUtil.Show(ResourceKeys.BillRecordRepeat, MessageBoxButtons.YesNo) == DialogResult.No)
|
|
{
|
|
return string.Empty;
|
|
}
|
|
else
|
|
{
|
|
this.lblOrderNo.Text = newBillNo;
|
|
parmaryValue = newBillNo;
|
|
}
|
|
}
|
|
}
|
|
|
|
StringBuilder fieldBuilder = new StringBuilder();
|
|
StringBuilder valueBuilder = new StringBuilder();
|
|
|
|
fieldBuilder.Append(this.BillModel.CsignFieldName + ",");
|
|
fieldBuilder.Append("isgnseq,");
|
|
fieldBuilder.Append("OperateDate,");
|
|
fieldBuilder.Append("idoc,");
|
|
fieldBuilder.Append("cbill,");
|
|
valueBuilder.Append(string.Format("'{0}',", this.txtcsign.TextEditObj.EditValue));
|
|
valueBuilder.Append(string.Format("'{0}',", this.txtisgnseq.TextEditObj.EditValue));
|
|
valueBuilder.Append(string.Format("'{0}',", this.txtOperateDate.TextEditObj.EditValue));
|
|
valueBuilder.Append(string.Format("'{0}',", this.txtidoc.TextEditObj.EditValue));
|
|
valueBuilder.Append(string.Format("'{0}',", this.txtcbill.EditValue));
|
|
|
|
// 增加主键
|
|
fieldBuilder.Append(BillModel.PrimaryKey);
|
|
valueBuilder.Append("'" + parmaryValue + "'");
|
|
|
|
return string.Format("insert into {0}({1}) values ({2})", BillModel.MasterTable, fieldBuilder.ToString().TrimEnd(','), valueBuilder.ToString().TrimEnd(','));
|
|
}
|
|
/// <summary>
|
|
/// <para>说明:获取修改表头数据</para>
|
|
/// <para>创建人:龚宇超</para>
|
|
/// <para>创建日期:2017-12-07 </para>
|
|
/// <para>修改人:</para>
|
|
/// <para>修改日期:</para>
|
|
/// <para>修改备注:</para>
|
|
/// <para>版本:1.0</para>
|
|
/// </summary>
|
|
/// <param name="parmaryValue">单据值.</param>
|
|
/// <returns>System.String.</returns>
|
|
private string GetUpdateRecord(string parmaryValue)
|
|
{
|
|
StringBuilder updateBuilder = new StringBuilder();
|
|
|
|
// 修改单据
|
|
updateBuilder.Append(this.BillModel.CsignFieldName+"='" + this.txtcsign.TextEditObj.EditValue + "',");
|
|
updateBuilder.Append("isgnseq='" + this.txtisgnseq.TextEditObj.EditValue + "',");
|
|
updateBuilder.Append("OperateDate='" + this.txtOperateDate.TextEditObj.EditValue + "',");
|
|
updateBuilder.Append("idoc='" + this.txtidoc.TextEditObj.EditValue + "',");
|
|
updateBuilder.Append("cbill='" + this.txtcbill.EditValue + "',");
|
|
|
|
return string.Format("update {0} set {1} where {2}='{3}'", BillModel.MasterTable, updateBuilder.ToString().TrimEnd(','), BillModel.PrimaryKey, parmaryValue);
|
|
}
|
|
/// <summary>
|
|
/// <para>说明:获取保存明细数据</para>
|
|
/// <para>创建人:龚宇超</para>
|
|
/// <para>创建日期:2017-12-07 </para>
|
|
/// <para>修改人:</para>
|
|
/// <para>修改日期:</para>
|
|
/// <para>修改备注:</para>
|
|
/// <para>版本:1.0</para>
|
|
/// </summary>
|
|
/// <returns>System.String.</returns>
|
|
private StringBuilder GetDetailRecord(string guid, string billNo)
|
|
{
|
|
// 构造明细
|
|
StringBuilder detailBuilder = new StringBuilder();
|
|
DataTable detailTable = this.gcMain.GridControl.DataSourceTable().TrimDeleteRows();
|
|
if (detailTable.Rows.Count > 0)
|
|
{
|
|
foreach (DataRow dataRow in detailTable.Rows)
|
|
{
|
|
StringBuilder fields = new StringBuilder();
|
|
StringBuilder values = new StringBuilder();
|
|
string detailSql = @"insert into " + BillModel.DetailTable + "_temp" + "({0}) values({1})";
|
|
fields.Append("sysstr,");
|
|
values.Append("'" + guid + "',");
|
|
foreach (DataColumn item in detailTable.Columns)
|
|
{
|
|
DataColumn dataCol = _detailTableColumns.Columns.Cast<DataColumn>().FirstOrDefault(x => item.ColumnName == x.ColumnName);
|
|
if (dataCol == null) continue;
|
|
|
|
if (item.ColumnName.Equals(guidField) || item.ColumnName.Equals(mRecordPrimaryField) || item.ColumnName.Equals(ERPInfo.Instance.isAddRows)) continue;
|
|
fields.Append(item.ColumnName + ",");
|
|
string fieldValue = dataRow[item] + "";
|
|
|
|
if (item.ColumnName.Equals(BillModel.PrimaryDetailKey, StringComparison.OrdinalIgnoreCase))
|
|
fieldValue = billNo;
|
|
|
|
if (!string.IsNullOrWhiteSpace(fieldValue))
|
|
{
|
|
values.Append(item.DataType == typeof(DateTime) ? "'" + Convert.ToDateTime(fieldValue).ToString("yyyy-MM-dd HH:mm:ss") + "'," : "'" + 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("'',");
|
|
}
|
|
}
|
|
detailBuilder.AppendFormat(detailSql, fields.ToString().Trim(','), values.ToString().Trim(','));
|
|
}
|
|
}
|
|
return detailBuilder;
|
|
}
|
|
/// <summary>
|
|
/// <para>说明:保存单据</para>
|
|
/// <para>创建人:龚宇超</para>
|
|
/// <para>创建日期:2018-04-20 </para>
|
|
/// <para>修改人:</para>
|
|
/// <para>修改日期:</para>
|
|
/// <para>修改备注:</para>
|
|
/// <para>版本:1.0</para>
|
|
/// </summary>
|
|
/// <param name="comfirm">是否继续执行(0.1).</param>
|
|
/// <param name="canTipMsg">是否显示成功提示信息</param>
|
|
/// <returns><c>true</c> if XXXX, <c>false</c> otherwise.</returns>
|
|
private bool BillSave(int comfirm = 0, bool canTipMsg = true)
|
|
{
|
|
bool saveResult = false;
|
|
if (this.VerifyNull())
|
|
{
|
|
// 保存之前先进行表格更新
|
|
this.gcMain.PostEditor();
|
|
this.gcMain.UpdateCurrentRow();
|
|
|
|
try
|
|
{
|
|
WaitForm.ShowForm(ResourceKeys.DataSaving);
|
|
|
|
string billNo = this.lblOrderNo.Text.Trim();
|
|
string detailGuid = Guid.NewGuid().ToString();
|
|
|
|
string masterSql = BillModel.SaveState ? GetUpdateRecord(billNo) : GetAddRecord(ref billNo);
|
|
string detailSql = GetDetailRecord(detailGuid, billNo).ToString();
|
|
|
|
// 检查单据头数据合法性
|
|
if (string.IsNullOrEmpty(masterSql)) return false;
|
|
|
|
// 验证明细合法性
|
|
if (string.IsNullOrEmpty(detailSql))
|
|
{
|
|
MessageUtil.Show(ResourceKeys.BillDetailIsNotNull);
|
|
return false;
|
|
}
|
|
|
|
string tipMsg = string.Empty;
|
|
int result = BillImpl.BillSave(masterSql, detailSql, BillModel.DetailTable, ref billNo, detailGuid, BillModel.BillSeq, BillModel.SaveState ? 2 : 1, comfirm, out tipMsg, 0, this.BillModel.NewVer);
|
|
|
|
switch (result)
|
|
{
|
|
case 1:
|
|
// 保存成功
|
|
if (canTipMsg) MessageUtil.Show(BillModel.TypeName + ResourceKeys.SaveSuccess);
|
|
this.lblOrderNo.Text = billNo;
|
|
this.SetBillStatus(BillImpl.GetDataRowResult(string.Format("select * from {0} where {1}='{2}'", BillModel.MasterTable, BillModel.PrimaryKey, billNo)));
|
|
saveResult = true;
|
|
SaveRefreshSource();
|
|
RefreshPrindMenu();
|
|
break;
|
|
case 9:
|
|
// 继续执行保存
|
|
if (MessageUtil.Show(tipMsg, MessageBoxButtons.YesNo) == DialogResult.Yes)
|
|
this.BillSave(1, canTipMsg);
|
|
saveResult = true;
|
|
break;
|
|
default:
|
|
// 保存失败
|
|
MessageUtil.Show(BillModel.TypeName + ResourceKeys.SaveFault + "\r\n" + tipMsg);
|
|
break;
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
//MessageUtil.Show(ex);
|
|
LogHelper.Instance.WriteError(ex);
|
|
LogUtil.WriteError("保存单据失败!", ex);
|
|
string Message = ErrorMessage.PromptErrorMessage(ex);
|
|
MessageUtil.Show(Message, ex.Message);
|
|
}
|
|
finally
|
|
{
|
|
WaitForm.HideForm();
|
|
}
|
|
}
|
|
return saveResult;
|
|
}
|
|
/// <summary>
|
|
/// <para>说明:通过配置条件刷新打印菜单</para>
|
|
/// <para>创建人:王一帆</para>
|
|
/// <para>创建日期:2020-04-10 </para>
|
|
/// <para>修改人:</para>
|
|
/// <para>修改日期:</para>
|
|
/// <para>修改备注:</para>
|
|
/// <para>版本:1.0</para>
|
|
/// </summary>
|
|
/// <param name="hintMsg">The hint MSG.</param>
|
|
/// <returns><c>true</c> if XXXX, <c>false</c> otherwise.</returns>
|
|
public void RefreshPrindMenu()
|
|
{
|
|
if (!string.IsNullOrWhiteSpace(BillModel.BillPrintTag))
|
|
{
|
|
pMprint.ClearLinks();
|
|
// 打印模版
|
|
DataRow rowItem = this.gcMain.GetDataRow(this.gcMain.FocusedRowHandle);
|
|
string BillPrintTag = BillModel.BillPrintTag;
|
|
BillPrintTag = ReplaceHelper.ReplaceRowParam(rowItem, BillPrintTag);
|
|
// BillPrintTag = ReplaceHelper.ReplaceParamToValue(BillPrintTag,this.lblOrderNo.Text.Trim());
|
|
string value = MainImpl.GetResult(ReplaceHelper.ReplaceRowParam(rowItem, BillPrintTag)) + "";
|
|
string[] files = value.Split('|');
|
|
for (int i = 0; i < files.Length; i++)
|
|
{
|
|
string fileName = files[i];
|
|
if (!string.IsNullOrWhiteSpace(fileName))
|
|
{
|
|
BarButtonItem itemPrint = new BarButtonItem();
|
|
int index = i + 1;
|
|
itemPrint.Caption = files[i].Replace(".rmf", "").Replace(".frx", "");
|
|
itemPrint.Tag = files[i];
|
|
itemPrint.ItemClick += new ItemClickEventHandler(OnPrintItemClick);
|
|
pMprint.AddItem(itemPrint);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
/// <summary>
|
|
/// <para>说明:单据提交</para>
|
|
/// <para>创建人:龚宇超</para>
|
|
/// <para>创建日期:2017-12-13 </para>
|
|
/// <para>修改人:</para>
|
|
/// <para>修改日期:</para>
|
|
/// <para>修改备注:</para>
|
|
/// <para>版本:1.0</para>
|
|
/// </summary>
|
|
/// <param name="hintMsg">The hint MSG.</param>
|
|
/// <returns><c>true</c> if XXXX, <c>false</c> otherwise.</returns>
|
|
private void BillApply(string hintMsg = "")
|
|
{
|
|
string tipMsg = string.Empty;
|
|
string billNo = this.lblOrderNo.Text.Trim();
|
|
|
|
int result = BillImpl.BillApply(this.SysModel.ModuleCode, billNo, "", 1, out tipMsg);
|
|
switch (result)
|
|
{
|
|
case 1:
|
|
// 提交成功
|
|
MessageUtil.Show(BillModel.TypeName + ResourceKeys.ApplySuccess);
|
|
this.SetBillStatus(BillImpl.GetDataRowResult(string.Format("select * from {0} where {1}='{2}'", BillModel.MasterTable, BillModel.PrimaryKey, billNo)));
|
|
this.RefreshSource(GetBillSourceManager());
|
|
this.RefreshSelectedSource();
|
|
|
|
if (this.BillModel.ApplyRefresh)
|
|
{
|
|
this.SetBillStatus(null);
|
|
this.ResetControlValue();
|
|
//this.ControlObj.ResetControlValue();
|
|
}
|
|
|
|
|
|
// 推送消息
|
|
PushHelper push = new PushHelper(billNo, "0", this.SysModel.ModuleCode, "", "", 0);
|
|
push.Push_Bill_Oper_Message();
|
|
break;
|
|
case 99:
|
|
// 继续执行提交
|
|
if (MessageUtil.Show(tipMsg, MessageBoxButtons.YesNo) == DialogResult.Yes)
|
|
{
|
|
FrmPrompt prompt = new FrmPrompt(tipMsg);
|
|
prompt.Size = new Size(300, 200);
|
|
|
|
DialogResult dialog = prompt.ShowDialog();
|
|
if (dialog == DialogResult.OK)
|
|
{
|
|
this.BillApply(prompt.PromptMsg);
|
|
}
|
|
}
|
|
break;
|
|
default:
|
|
// 提交失败
|
|
MessageUtil.Show(BillModel.TypeName + ResourceKeys.ApplyFault + "\r\n" + tipMsg);
|
|
break;
|
|
}
|
|
}
|
|
#endregion
|
|
|
|
#region 事件相关
|
|
/// <summary>
|
|
/// <para>说明:点击空白界面后需要获取焦点</para>
|
|
/// <para>创建人:王一帆</para>
|
|
/// <para>创建日期:2020-09-04 </para>
|
|
/// <para>修改人:</para>
|
|
/// <para>修改日期:</para>
|
|
/// <para>修改备注:</para>
|
|
/// <para>版本:1.0</para>
|
|
/// </summary>
|
|
private void OnMainFocusAfter(object sender, EventArgs e)
|
|
{
|
|
try
|
|
{
|
|
this.pl_main_center_master.Focus();
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
string Message = ErrorMessage.PromptErrorMessage(ex);
|
|
MessageUtil.Show(Message, ex.Message);
|
|
}
|
|
}
|
|
/// <summary>
|
|
/// <para>说明:打印完成后回调</para>
|
|
/// <para>创建人:龚宇超</para>
|
|
/// <para>创建日期:2018-07-05 </para>
|
|
/// <para>修改人:</para>
|
|
/// <para>修改日期:</para>
|
|
/// <para>修改备注:</para>
|
|
/// <para>版本:1.0</para>
|
|
/// </summary>
|
|
/// <param name="sender">The sender.</param>
|
|
/// <param name="e">The e.</param>
|
|
private void OnReportPrintAfter(object sender, EventArgs e)
|
|
{
|
|
try
|
|
{
|
|
//打印完成后添加数据库
|
|
if (_printSaveParams != null && _printSaveParams.Count > 0)
|
|
{
|
|
int result = BaseModuleImpl.SavePrintRecord(_printSaveParams[0], _printSaveParams[1], _printSaveParams[2], _printSaveParams[3], _printSaveParams[4]);
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
string Message = ErrorMessage.PromptErrorMessage(ex);
|
|
MessageUtil.Show(Message, ex.Message);
|
|
}
|
|
}
|
|
/// <summary>
|
|
/// <para>说明:</para>
|
|
/// <para>创建人:龚宇超</para>
|
|
/// <para>创建日期:2017-11-28 </para>
|
|
/// <para>修改人:</para>
|
|
/// <para>修改日期:</para>
|
|
/// <para>修改备注:</para>
|
|
/// <para>版本:1.0</para>
|
|
/// </summary>
|
|
/// <param name="sender">The source of the event.</param>
|
|
/// <param name="e">The <see cref="KeyEventArgs"/> instance containing the event data.</param>
|
|
private void OnFrmMainKeyDown(object sender, KeyEventArgs e)
|
|
{
|
|
try
|
|
{
|
|
// 窗口获取按键则表格按键中断.有时间处理
|
|
if (e.Modifiers.CompareTo(Keys.Control) == 0)
|
|
{
|
|
if (e.KeyCode == Keys.Left)
|
|
this.ssc_main_top.Collapsed = true;
|
|
if (e.KeyCode == Keys.Right)
|
|
this.ssc_main_top.Collapsed = false;
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
string Message = ErrorMessage.PromptErrorMessage(ex);
|
|
MessageUtil.Show(Message, ex.Message);
|
|
}
|
|
}
|
|
/// <summary>
|
|
/// <para>说明:树节点选中刷新明细</para>
|
|
/// <para>创建人:龚宇超</para>
|
|
/// <para>创建日期:2017-12-01 </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="TreeViewEventArgs"/> instance containing the event data.</param>
|
|
private void OnTreeNodeSelectAfter(object sender, TreeViewEventArgs e)
|
|
{
|
|
//TreeView tree = (TreeView)sender;
|
|
//XtraTabPage tabPage = this.xtc_left_container.SelectedTabPage;
|
|
//BillSourceUnionModel unionModel = tabPage.Tag as BillSourceUnionModel;
|
|
//if (unionModel != null)
|
|
//{
|
|
// WaitForm.ShowForm();
|
|
// try
|
|
// {
|
|
// string sqlValue = ReplaceHelper.ReplaceUserInfo(ReplaceHelper.ReplaceWhereCond(unionModel.ModelObj.DetailSql));
|
|
// sqlValue = sqlValue.Replace("#", "");
|
|
// sqlValue = this.ControlObj.ReplaceControlValue(sqlValue);
|
|
// sqlValue = ReplaceHelper.ReplaceParamToValue(sqlValue, e.Node.Name);
|
|
|
|
// unionModel.GridDetailControlObj.GridControl.DataSource = BillImpl.GetDataTableResult(sqlValue);
|
|
// }
|
|
// catch (Exception ex)
|
|
// {
|
|
// LogHelper.Instance.WriteError(ex);
|
|
// LogUtil.WriteError(BillModel.TypeName + "模块选中树节点" + tree.SelectedNode.Text + "刷新明细失败!", ex);
|
|
// }
|
|
// finally
|
|
// {
|
|
// WaitForm.HideForm();
|
|
// }
|
|
//}
|
|
}
|
|
/// <summary>
|
|
/// <para>说明:单据来源切换Tab标签</para>
|
|
/// <para>创建人:龚宇超</para>
|
|
/// <para>创建日期:2017-11-28 </para>
|
|
/// <para>修改人:</para>
|
|
/// <para>修改日期:</para>
|
|
/// <para>修改备注:</para>
|
|
/// <para>版本:1.0</para>
|
|
/// </summary>
|
|
/// <param name="sender">The source of the event.</param>
|
|
/// <param name="e">The <see cref="TabPageChangedEventArgs"/> instance containing the event data.</param>
|
|
private void OnTabSelectedPageChanged(object sender, TabPageChangedEventArgs e)
|
|
{
|
|
try
|
|
{
|
|
if (_isInitFinish)
|
|
{
|
|
BillSourceUnionModel unionModel = e.Page.Tag as BillSourceUnionModel;
|
|
if (unionModel != null)
|
|
{
|
|
this.RefreshSelectedSource();
|
|
|
|
}
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
LogHelper.Instance.WriteError(ex);
|
|
LogUtil.WriteError("单据切换标签失败!", ex);
|
|
string Message = ErrorMessage.PromptErrorMessage(ex);
|
|
MessageUtil.Show(Message, ex.Message);
|
|
}
|
|
}
|
|
/// <summary>
|
|
/// <para>说明:单据来源树结构默认查询条件</para>
|
|
/// <para>创建人:龚宇超</para>
|
|
/// <para>创建日期:2017-11-28 </para>
|
|
/// <para>修改人:</para>
|
|
/// <para>修改日期:</para>
|
|
/// <para>修改备注:</para>
|
|
/// <para>版本:1.0</para>
|
|
/// </summary>
|
|
/// <param name="sender">The source of the event.</param>
|
|
/// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
|
|
private void OnTreeSearchClick(object sender, EventArgs e)
|
|
{
|
|
try
|
|
{
|
|
XtraTabPage tabPage = this.xtc_left_container.SelectedTabPage;
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
string Message = ErrorMessage.PromptErrorMessage(ex);
|
|
MessageUtil.Show(Message, ex.Message);
|
|
}
|
|
//this.RefreshSourceDetail(tabPage.Tag as BillSourceUnionModel);
|
|
}
|
|
/// <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>
|
|
private void OnFirstPageDataSourceBindCallBack(object sender, EventArgs e)
|
|
{
|
|
try
|
|
{
|
|
this.RefreshSelectedSource();
|
|
this.OnInitializeHeaderCallBack();
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
LogHelper.Instance.WriteError(ex);
|
|
LogUtil.WriteError("单据切换标查询失败!", ex);
|
|
string Message = ErrorMessage.PromptErrorMessage(ex);
|
|
MessageUtil.Show(Message, ex.Message);
|
|
}
|
|
}
|
|
/// <summary>
|
|
/// <para>说明:单据来源选中行,加载明细</para>
|
|
/// <para>创建人:龚宇超</para>
|
|
/// <para>创建日期:2017-11-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="SelectionChangedEventArgs"/> instance containing the event data.</param>
|
|
private void OnGridControlSelectionChanged(object sender, SelectionChangedEventArgs e)
|
|
{
|
|
try
|
|
{
|
|
XtraTabPage tabPage = this.xtc_left_container.SelectedTabPage;
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
string Message = ErrorMessage.PromptErrorMessage(ex);
|
|
MessageUtil.Show(Message, ex.Message);
|
|
}
|
|
|
|
//this.RefreshSourceDetail(tabPage.Tag as BillSourceUnionModel);
|
|
}
|
|
/// <summary>
|
|
/// <para>说明:单据来源选中行,加载明细</para>
|
|
/// <para>创建人:龚宇超</para>
|
|
/// <para>创建日期:2017-11-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="SelectionChangedEventArgs"/> instance containing the event data.</param>
|
|
private void OnGridViewRowCellClick(object sender, RowCellClickEventArgs e)
|
|
{
|
|
try
|
|
{
|
|
XtraTabPage tabPage = xtc_left_container.TabPages[0];
|
|
BillSourceUnionModel unionModel = tabPage.Tag as BillSourceUnionModel;
|
|
if (unionModel != null)
|
|
{
|
|
DataRow rowItem = unionModel.GridControlObj.GridView.GetDataRow(e.RowHandle);
|
|
if (rowItem != null)
|
|
{
|
|
string sourceSQL = ReplaceHelper.ReplaceRowParam(rowItem, BillModel.MasterSql);
|
|
string detailSQL = ReplaceHelper.ReplaceRowParam(rowItem, BillModel.DetailSql);
|
|
|
|
DataRow sourceRow = BaseImpl.GetDataRowResult(sourceSQL);
|
|
DataTable table = BaseImpl.GetDataTableResult(detailSQL);
|
|
|
|
this.detailTable.Clear();
|
|
|
|
// 设置表头
|
|
this.txtcsign.TextEditObj.EditValue = sourceRow[this.BillModel.CsignFieldName] + "";
|
|
this.txtisgnseq.TextEditObj.EditValue = sourceRow["ino_id"] + "";
|
|
this.txtOperateDate.TextEditObj.EditValue = sourceRow["OperateDate"] + "";
|
|
this.txtAffimDate.TextEditObj.EditValue = sourceRow["AffirmDate"] + "";
|
|
this.txtidoc.TextEditObj.EditValue = sourceRow["idoc"] + "";
|
|
this.txtcbill.TextEdit.EditValue = sourceRow["OperatorId"] + "";
|
|
//this.txtcbill.TextEdit.EditValue = sourceRow["OperatorId"] + "";
|
|
|
|
if (sourceRow.Table.Columns.Contains("cbill"))
|
|
{
|
|
this.txtccashier.TextEdit.EditValue = sourceRow["cbill"] + "";
|
|
}
|
|
if (sourceRow.Table.Columns.Contains("ccheck"))
|
|
{
|
|
this.txtccheck.TextEdit.EditValue = sourceRow["ccheck"] + "";
|
|
}
|
|
if (sourceRow.Table.Columns.Contains("cbook"))
|
|
{
|
|
this.txtcbook.TextEdit.EditValue = sourceRow["cbook"] + "";
|
|
}
|
|
|
|
|
|
|
|
// 设置明细
|
|
foreach (DataRow item in table.Rows)
|
|
{
|
|
DataRow newRow = detailTable.NewRow();
|
|
|
|
foreach (DataColumn col in this.detailTable.Columns)
|
|
{
|
|
if (item.Table.Columns.Contains(col.ColumnName))
|
|
{
|
|
newRow[col.ColumnName] = item[col.ColumnName];
|
|
}
|
|
}
|
|
this.detailTable.Rows.Add(newRow);
|
|
}
|
|
|
|
this.gridControl.DataSource = detailTable;
|
|
|
|
// 设置借方金额
|
|
this.txtmd.Text = CalcColumnTotal(md) + "";
|
|
// 设置贷方金额
|
|
this.txtmc.Text = CalcColumnTotal(mc) + "";
|
|
|
|
this.SetBillStatus(sourceRow);
|
|
}
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
string Message = ErrorMessage.PromptErrorMessage(ex);
|
|
MessageUtil.Show(Message, ex.Message);
|
|
}
|
|
}
|
|
/// <summary>
|
|
/// <para>说明:单据来源选中行,加载明细</para>
|
|
/// <para>创建人:龚宇超</para>
|
|
/// <para>创建日期:2019-07-25 </para>
|
|
/// <para>修改人:</para>
|
|
/// <para>修改日期:</para>
|
|
/// <para>修改备注:</para>
|
|
/// <para>版本:1.0</para>
|
|
/// </summary>
|
|
/// <param name="sender">The sender.</param>
|
|
/// <param name="e">The <see cref="DevExpress.XtraTreeList.FocusedNodeChangedEventArgs"/> instance containing the event data.</param>
|
|
private void OnTreeListObjFocusedNodeChanged(object sender, DevExpress.XtraTreeList.FocusedNodeChangedEventArgs e)
|
|
{
|
|
try
|
|
{
|
|
XtraTabPage tabPage = this.xtc_left_container.SelectedTabPage;
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
string Message = ErrorMessage.PromptErrorMessage(ex);
|
|
MessageUtil.Show(Message, ex.Message);
|
|
}
|
|
|
|
//this.RefreshSourceDetail(tabPage.Tag as BillSourceUnionModel);
|
|
}
|
|
/// <summary>
|
|
/// <para>说明:单据来源明细右键菜单执行后刷新数据</para>
|
|
/// <para>创建人:龚宇超</para>
|
|
/// <para>创建日期:2017-12-19 </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 OnGridDetailRightMenuCallback(object sender, EventArgs e)
|
|
{
|
|
try
|
|
{
|
|
XtraTabPage tabPage = this.xtc_left_container.SelectedTabPage;
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
string Message = ErrorMessage.PromptErrorMessage(ex);
|
|
MessageUtil.Show(Message, ex.Message);
|
|
}
|
|
|
|
//this.RefreshSourceDetail(tabPage.Tag as BillSourceUnionModel);
|
|
}
|
|
/// <summary>
|
|
/// <para>说明:来源双击加载明细</para>
|
|
/// <para>创建人:龚宇超</para>
|
|
/// <para>创建日期:2017-11-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 OnGridDetailDoubleClick(object sender, EventArgs e)
|
|
{
|
|
try
|
|
{
|
|
if (this.CanAddDetailRow())
|
|
{
|
|
DataTable table = this.gcMain.GridControl.DataSource as DataTable;
|
|
XtraTabPage tabPage = this.xtc_left_container.SelectedTabPage;
|
|
BillSourceUnionModel unionModel = tabPage.Tag as BillSourceUnionModel;
|
|
DataRow rowItem = unionModel.GridDetailControlObj.GridView.GetFocusedDataRow();
|
|
this.AddMultiRowToGridView(new DataRow[] { rowItem });
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
string Message = ErrorMessage.PromptErrorMessage(ex);
|
|
MessageUtil.Show(Message, ex.Message);
|
|
}
|
|
}
|
|
/// <summary>
|
|
/// <para>说明:单据空行新增时初始化默认值</para>
|
|
/// <para>创建人:dl</para>
|
|
/// <para>创建日期:2019-01-29 </para>
|
|
/// <para>修改人:</para>
|
|
/// <para>修改日期:</para>
|
|
/// <para>修改备注:</para>
|
|
/// <para>版本:1.0</para>
|
|
/// </summary>
|
|
/// <param name="sender">The source of the event.</param>
|
|
private void OnGridViewInitNewRow(object sender, InitNewRowEventArgs e)
|
|
{
|
|
try
|
|
{
|
|
InitNewRowMethod(sender);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
string Message = ErrorMessage.PromptErrorMessage(ex);
|
|
MessageUtil.Show(Message, ex.Message);
|
|
}
|
|
}
|
|
/// <summary>
|
|
/// <para>说明:右键菜单执行后刷新数据,刷新规则按照上一次查询条件刷新</para>
|
|
/// <para>创建人:龚宇超</para>
|
|
/// <para>创建日期:2017-11-02 </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>
|
|
private void OnGridViewRightCallBack(object sender, EventArgs e)
|
|
{
|
|
try
|
|
{
|
|
string billNo = this.lblOrderNo.Text.Trim();
|
|
this.SetBillStatus(BillImpl.GetDataRowResult(string.Format("select * from {0} where {1}='{2}'", BillModel.MasterTable, BillModel.PrimaryKey, billNo)));
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
string Message = ErrorMessage.PromptErrorMessage(ex);
|
|
MessageUtil.Show(Message, ex.Message);
|
|
}
|
|
}
|
|
/// <summary>
|
|
/// <para>说明:重绘单据水印</para>
|
|
/// <para>创建人:龚宇超</para>
|
|
/// <para>创建日期:2017-12-04 </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="PaintEventArgs"/> instance containing the event data.</param>
|
|
private void OnLabelTitlePaint(object sender, PaintEventArgs e)
|
|
{
|
|
try
|
|
{
|
|
if (this._waterMark != null)
|
|
{
|
|
GraphicsText graphicsText = new GraphicsText();
|
|
graphicsText.Graphics = e.Graphics;
|
|
|
|
// 绘制围绕点旋转的文本
|
|
StringFormat format = new StringFormat();
|
|
format.Alignment = StringAlignment.Center;
|
|
format.LineAlignment = StringAlignment.Center;
|
|
|
|
// 绘制单据状态文本
|
|
if (!string.IsNullOrEmpty(this._waterMark.Text))
|
|
{
|
|
graphicsText.DrawString(this._waterMark.Text, new Font("宋体", 12, FontStyle.Bold), new SolidBrush(Color.Red), new PointF(50, 21), format, -15f);
|
|
|
|
e.Graphics.TranslateTransform(0, 0);
|
|
e.Graphics.RotateTransform(-15f);
|
|
e.Graphics.DrawRectangle(new Pen(Color.Red, 2f), new Rectangle(14, 20, 55, 21));
|
|
}
|
|
|
|
// 绘制打印次数文本
|
|
e.Graphics.ResetTransform();
|
|
if (!string.IsNullOrEmpty(this._waterMark.Print))
|
|
{
|
|
graphicsText.DrawString(this._waterMark.Print, new Font("宋体", 11, FontStyle.Bold), new SolidBrush(Color.Red), new PointF((this.lbTitle.Width - 70), 21), format, -15f);
|
|
|
|
e.Graphics.TranslateTransform(this.lbTitle.Width - 70, 21);
|
|
e.Graphics.RotateTransform(-15f);
|
|
e.Graphics.DrawRectangle(new Pen(Color.Red, 2f), new Rectangle(-35, -14, 70, 21));
|
|
}
|
|
|
|
// 绘制收款文本
|
|
e.Graphics.ResetTransform();
|
|
if (!string.IsNullOrEmpty(this._waterMark.Collect))
|
|
{
|
|
graphicsText.DrawString(this._waterMark.Collect, new Font("宋体", 12, FontStyle.Bold), new SolidBrush(Color.Red), new PointF((this.lbTitle.Width - 170), 21), format, -15f);
|
|
|
|
e.Graphics.TranslateTransform(this.lbTitle.Width - 100, 21);
|
|
e.Graphics.RotateTransform(-15f);
|
|
e.Graphics.DrawRectangle(new Pen(Color.Red, 2f), new Rectangle(-100, -32, 55, 21));
|
|
}
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
string Message = ErrorMessage.PromptErrorMessage(ex);
|
|
MessageUtil.Show(Message, ex.Message);
|
|
}
|
|
}
|
|
/// <summary>
|
|
/// <para>说明:单据来源拖动数据到单据明细表格后</para>
|
|
/// <para>创建人:龚宇超</para>
|
|
/// <para>创建日期:2017-12-05 </para>
|
|
/// <para>修改人:</para>
|
|
/// <para>修改日期:</para>
|
|
/// <para>修改备注:</para>
|
|
/// <para>版本:1.0</para>
|
|
/// </summary>
|
|
/// <param name="sender">The sender.</param>
|
|
/// <param name="e">The e.</param>
|
|
private void OnDragDetailGridCompleted(object sender, GridDragGridArgs e)
|
|
{
|
|
try
|
|
{
|
|
if (this.CanAddDetailRow())
|
|
{
|
|
DataRow[] dragRows = e.GridViewSelectRows;
|
|
if (dragRows != null && dragRows.Length > 0)
|
|
{
|
|
this.AddMultiRowToGridView(dragRows);
|
|
}
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
string Message = ErrorMessage.PromptErrorMessage(ex);
|
|
MessageUtil.Show(Message, ex.Message);
|
|
}
|
|
}
|
|
/// <summary>
|
|
/// <para>说明:单据来源表格拖拽完成</para>
|
|
/// <para>创建人:龚宇超</para>
|
|
/// <para>创建日期:2018-03-21 </para>
|
|
/// <para>修改人:</para>
|
|
/// <para>修改日期:</para>
|
|
/// <para>修改备注:</para>
|
|
/// <para>版本:1.0</para>
|
|
/// </summary>
|
|
/// <param name="sender">The sender.</param>
|
|
/// <param name="e">The e.</param>
|
|
private void OnDragMainGridCompleted(object sender, GridDragGridArgs e)
|
|
{
|
|
//if (e.GridViewSelectRows == null || e.GridViewSelectRows.Length == 0) return;
|
|
|
|
//try
|
|
//{
|
|
// if (this.CanAddDetailRow())
|
|
// {
|
|
// if (MessageUtil.Show(ResourceKeys.DragSelectRow, MessageBoxButtons.YesNo) == DialogResult.Yes)
|
|
// {
|
|
// XtraTabPage tabPage = this.xtc_left_container.SelectedTabPage;
|
|
// BillSourceUnionModel unionModel = tabPage.Tag as BillSourceUnionModel;
|
|
|
|
// int[] rows = e.SourceGridViewObj.GetSelectedRows();
|
|
// foreach (int rowIndex in rows)
|
|
// {
|
|
// // 拖动多行,所以明细数据改为动态查询
|
|
// DataRow rowItem = e.SourceGridViewObj.GetDataRow(rowIndex);
|
|
// DataTable details = BillImpl.GetDataTableResult(ReplaceHelper.ReplaceRowParam(rowItem, unionModel.ModelObj.DetailSql));
|
|
// //details = GetGridViewFilteredAndSortedDataToDataTable(unionModel.GridDetailControlObj.GridView);
|
|
// //DataTable details = unionModel.GridDetailControlObj.GridView.DataController.GetAllFilteredAndSortedRows().OfType<DataRow>().CopyToDataTable();
|
|
|
|
// this.ControlObj.SetAllControlValue(rowItem, true);
|
|
|
|
// if (unionModel.ModelObj.CadDragDetail)
|
|
// {
|
|
// this.AddMultiRowToGridView(details, unionModel);
|
|
// }
|
|
// }
|
|
// }
|
|
// }
|
|
//}
|
|
//catch (Exception ex)
|
|
//{
|
|
// LogHelper.Instance.WriteError(ex);
|
|
// LogUtil.WriteError("单据来源表格拖拽完出错!", ex);
|
|
// MessageUtil.Show(ResourceKeys.OperFault);
|
|
//}
|
|
}
|
|
/// <summary>
|
|
/// <para>说明:新增单据</para>
|
|
/// <para>创建人:龚宇超</para>
|
|
/// <para>创建日期:2017-12-14 </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 OnBillAddClick(object sender, EventArgs e)
|
|
{
|
|
try
|
|
{
|
|
DataTable table = this.gridControl.DataSource as DataTable;
|
|
if (!this.BillModel.SaveState && table.Rows.Count > 0)
|
|
{
|
|
DialogResult result = MessageUtil.Show(("数据未保存,是否确定新建单据?"), MessageBoxButtons.YesNo);
|
|
if (result == DialogResult.Yes)
|
|
{
|
|
this.SetBillStatus(null);
|
|
ResetControlValue();//初始化明细控件所有值
|
|
//this.ControlObj.ResetControlValue();
|
|
}
|
|
}
|
|
else
|
|
{
|
|
this.SetBillStatus(null);
|
|
ResetControlValue();//初始化明细控件所有值
|
|
//this.ControlObj.ResetControlValue();
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
string Message = ErrorMessage.PromptErrorMessage(ex);
|
|
MessageUtil.Show(Message, ex.Message);
|
|
}
|
|
}
|
|
/// <summary>
|
|
/// <para>说明:初始化单据明细上的所有值</para>
|
|
/// <para>创建人:王一帆</para>
|
|
/// <para>创建日期:2021-01-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="EventArgs"/> instance containing the event data.</param>
|
|
private void ResetControlValue()
|
|
{
|
|
// 设置表头
|
|
this.txtcsign.TextEditObj.EditValue = string.Empty;
|
|
this.txtisgnseq.TextEditObj.EditValue = string.Empty;
|
|
// 初始化默认值
|
|
this.txtOperateDate.TextEditObj.Text = DateTime.Now.ToString();
|
|
this.txtcbill.Text = ERPInfo.Instance.UserId;
|
|
this.txtAffimDate.TextEditObj.EditValue = string.Empty;
|
|
this.txtidoc.TextEditObj.EditValue = string.Empty;
|
|
//初始化虚拟行
|
|
this.txtcn_id.TextEditObj.Text = string.Empty;
|
|
this.txtnum.TextEditObj.Text = string.Empty;
|
|
this.txtdt_date.TextEditObj.Text = string.Empty;
|
|
this.txtprice.TextEditObj.Text = string.Empty;
|
|
this.txtcitem_id.TextEdit.Text = string.Empty;
|
|
this.txtcdept_id.TextEdit.Text = string.Empty;
|
|
this.txtcperson_id.TextEdit.Text = string.Empty;
|
|
this.txtcsup_id.TextEdit.Text = string.Empty;
|
|
this.txtcname.TextEdit.Text = string.Empty;
|
|
this.txtczoneName.Text = string.Empty;
|
|
this.txtcproductionLine.Text = string.Empty;
|
|
this.txtcontractNoName.Text = string.Empty;
|
|
this.txtcCustomer.TextEdit.Text = string.Empty;
|
|
|
|
this.detailTable.Clear();
|
|
//this.txtcbill.TextEdit.EditValue = sourceRow["OperatorId"] + "";
|
|
this.gridControl.DataSource = detailTable;
|
|
|
|
// 设置借方金额
|
|
this.txtmd.EditValue = "000"; ;
|
|
// 设置贷方金额
|
|
this.txtmc.EditValue = "000";
|
|
|
|
}
|
|
/// <summary>
|
|
/// <para>说明:删除明细记录</para>
|
|
/// <para>创建人:龚宇超</para>
|
|
/// <para>创建日期:2017-12-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>
|
|
private void OnDeleteClick(object sender, EventArgs e)
|
|
{
|
|
try
|
|
{
|
|
int[] rows = this.gcMain.GetSelectedRows();
|
|
|
|
if (rows.Length < 1)
|
|
return;
|
|
if (string.IsNullOrEmpty(BillModel.DeleteDetailCond))
|
|
{
|
|
DialogResult result = MessageUtil.Show(string.Format(ResourceKeys.DeleteRows, rows.Length), MessageBoxButtons.YesNo);
|
|
if (result == DialogResult.Yes)
|
|
{
|
|
this.gcMain.Columns.ClearAllSort();
|
|
this.gcMain.DeleteSelectedRows();
|
|
this.gcMain.ClearSelection();
|
|
this.gcMain.SelectRow(this.gcMain.FocusedRowHandle);
|
|
this.gcMain.GridControl.DataSourceTable().OrderBy(this.BillModel.DetailOrderField);
|
|
}
|
|
}
|
|
//else
|
|
//{
|
|
// string successMsg = string.Empty, faultMsg = string.Empty;
|
|
// string deleteCond = this.ControlObj.ReplaceParentControlValue(BillModel.DeleteDetailCond);
|
|
// List<DataRow> deleteRows = new List<DataRow>();
|
|
// List<int> faultInts = new List<int>();
|
|
|
|
// foreach (int rowIndex in rows)
|
|
// {
|
|
// DataRow rowItem = this.gcMain.GetDataRow(rowIndex);
|
|
|
|
// string deleteCond2 = ReplaceHelper.ReplaceRowParam(rowItem, deleteCond);
|
|
|
|
// if (ReplaceHelper.EvalCond(deleteCond2))
|
|
// {
|
|
// deleteRows.Add(rowItem);
|
|
// }
|
|
// else
|
|
// {
|
|
// faultInts.Add(rowIndex);
|
|
// }
|
|
// }
|
|
|
|
// DataTable table = this.gcMain.GridControl.DataSourceTable();
|
|
// foreach (DataRow item in deleteRows)
|
|
// {
|
|
// table.Rows.Remove(item);
|
|
// }
|
|
|
|
// if (faultInts != null && faultInts.Count > 0)
|
|
// {
|
|
// MessageUtil.Show("发现如下:" + string.Join(",", faultInts.ToArray()) + "行不满足条件无法删除!");
|
|
// }
|
|
// else
|
|
// {
|
|
// MessageUtil.Show("删除成功!");
|
|
// }
|
|
//}
|
|
return;
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
LogHelper.Instance.WriteError(ex);
|
|
string Message = ErrorMessage.PromptErrorMessage(ex);
|
|
MessageUtil.Show(Message, ex.Message);
|
|
}
|
|
|
|
}
|
|
/// <summary>
|
|
/// <para>说明:单据保存</para>
|
|
/// <para>创建人:龚宇超</para>
|
|
/// <para>创建日期:2017-12-07 </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 OnBillSaveClick(object sender, EventArgs e)
|
|
{
|
|
try
|
|
{
|
|
if (this.BillSave())
|
|
{
|
|
this.RefreshSelectedSource();
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
//MessageUtil.Show(ex);
|
|
string Message = ErrorMessage.PromptErrorMessage(ex);
|
|
MessageUtil.Show(Message, ex.Message);
|
|
}
|
|
}
|
|
/// <summary>
|
|
/// <para>说明:单据保存提交</para>
|
|
/// <para>创建人:龚宇超</para>
|
|
/// <para>创建日期:2017-12-07 </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 OnBillApplyClick(object sender, EventArgs e)
|
|
{
|
|
try
|
|
{
|
|
DialogResult result = MessageUtil.Show(ResourceKeys.BillApply, MessageBoxButtons.YesNo);
|
|
if (result == DialogResult.Yes)
|
|
{
|
|
if (this.BillSave(0, false))
|
|
{
|
|
this.BillApply();
|
|
}
|
|
}
|
|
return;
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
string Message = ErrorMessage.PromptErrorMessage(ex);
|
|
MessageUtil.Show(Message, ex.Message);
|
|
}
|
|
}
|
|
/// <summary>
|
|
/// <para>说明:分割条移动保存位置</para>
|
|
/// <para>创建人:龚宇超</para>
|
|
/// <para>创建日期:2018-03-06 </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 OnTopSplitterMoved(object sender, EventArgs e)
|
|
{
|
|
try
|
|
{
|
|
if (this._isInitFinish)
|
|
{
|
|
IniHelper.Write(string.Format("bill_width_{0}", this.SysModel.ModuleCode), this.ssc_main_top.SplitterPosition + "");
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
string Message = ErrorMessage.PromptErrorMessage(ex);
|
|
MessageUtil.Show(Message, ex.Message);
|
|
}
|
|
}
|
|
/// <summary>
|
|
/// <para>说明:单据来源查询之前处理</para>
|
|
/// <para>创建人:龚宇超</para>
|
|
/// <para>创建日期:2018-03-06 </para>
|
|
/// <para>修改人:</para>
|
|
/// <para>修改日期:</para>
|
|
/// <para>修改备注:</para>
|
|
/// <para>版本:1.0</para>
|
|
/// </summary>
|
|
/// <param name="sender">The sender.</param>
|
|
/// <param name="e">The e.</param>
|
|
private void OnSearchBefore(object sender, SearchArgs e)
|
|
{
|
|
try
|
|
{
|
|
// 用户搜索时不加载右侧控件值,只有点击、人为选中行在加载右侧控件值.
|
|
this._isLoadRightControlValue = false;
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
string Message = ErrorMessage.PromptErrorMessage(ex);
|
|
MessageUtil.Show(Message, ex.Message);
|
|
}
|
|
}
|
|
/// <summary>
|
|
/// <para>说明:单据来源查询完成</para>
|
|
/// <para>创建人:龚宇超</para>
|
|
/// <para>创建日期:2018-03-06 </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>
|
|
/// <exception cref="System.NotImplementedException"></exception>
|
|
private void OnSearchAfterd(object sender, EventArgs e)
|
|
{
|
|
try
|
|
{
|
|
this._isLoadRightControlValue = true;
|
|
|
|
XtraTabPage tabPage = this.xtc_left_container.SelectedTabPage;
|
|
BillSourceUnionModel unionModel = tabPage.Tag as BillSourceUnionModel;
|
|
if (unionModel.ModelObj.SourceType != 1)
|
|
{
|
|
if (unionModel.GridControlObj != null)
|
|
{
|
|
string sql = ReplaceHelper.ReplaceUserInfo(unionModel.GridControlObj.LastSearchSql);
|
|
//sql = this.ControlObj.ReplaceControlValue(sql);
|
|
unionModel.GridControlObj.gridControl.DataSource = BaseImpl.GetDataTableResult(sql);
|
|
if (unionModel.ModelObj.SourceType == 0) tabPage.Text = unionModel.ModelObj.UserName + "(" + unionModel.SearchObj.GridRowCount + "条)";
|
|
}
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
string Message = ErrorMessage.PromptErrorMessage(ex);
|
|
MessageUtil.Show(Message, ex.Message);
|
|
}
|
|
}
|
|
/// <summary>
|
|
/// <para>说明:帮助文档</para>
|
|
/// <para>创建人:龚宇超</para>
|
|
/// <para>创建日期:2020-01-15 </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>
|
|
private void OnHelpClick(object sender, EventArgs e)
|
|
{
|
|
try
|
|
{
|
|
WebBrowserUtil.StartWebBrowser(this.SysModel.ModuleCode, this.BillModel.TypeName);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
string Message = ErrorMessage.PromptErrorMessage(ex);
|
|
MessageUtil.Show(Message, ex.Message);
|
|
}
|
|
}
|
|
/// <summary>
|
|
/// 切换行判断是否是虚拟行数据进行数据填充
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
private void OnGridViewFocusedRowChanged(object sender, DevExpress.XtraGrid.Views.Base.FocusedRowChangedEventArgs e)
|
|
{
|
|
try
|
|
{
|
|
//DataTable gridTable = (this.gcMain.GridControl.DataSource as DataTable).TrimDeleteRows();
|
|
|
|
//int _rowNumber = this.gcMain.FocusedRowHandle;
|
|
//int _prvFocused = e.PrevFocusedRowHandle;
|
|
//int indexNumber = this.gcMain.RowCount;
|
|
//if (_rowNumber < 0 && _prvFocused != gridTable.Rows.Count)
|
|
//{
|
|
// InitNewRowMethod(sender);
|
|
// this.gcMain.FocusedRowHandle = indexNumber - 1;
|
|
//}
|
|
|
|
DataRow rowItem = this.gcMain.GetFocusedDataRow();
|
|
if (rowItem != null)
|
|
{
|
|
this.txtcn_id.TextEditObj.EditValue = rowItem["cn_id"] + "";
|
|
this.txtnum.TextEditObj.EditValue = rowItem["num"] + "";
|
|
this.txtdt_date.TextEditObj.EditValue = rowItem["dt_date"] + "";
|
|
this.txtprice.TextEditObj.EditValue = rowItem["price"] + "";
|
|
this.txtcitem_id.TextEdit.EditValue = rowItem["citem_id"] + "";
|
|
this.txtcdept_id.TextEdit.EditValue = rowItem["cdept_id"] + "";
|
|
this.txtcperson_id.TextEdit.EditValue = rowItem["cperson_id"] + "";
|
|
this.txtcsup_id.EditText = rowItem["csup_id"] + "";
|
|
this.txtcname.TextEdit.Text = rowItem["cname"] + "";
|
|
this.txtczoneName.TextEdit.EditValue = rowItem["cDefine11"] + "";
|
|
this.txtcproductionLine.TextEdit.EditValue = rowItem["cDefine12"] + "";
|
|
this.txtcontractNoName.EditText = rowItem["cDefine13"] + "";
|
|
this.txtcCustomer.TextEdit.EditValue = rowItem["ccus_id"] + "";
|
|
}
|
|
else
|
|
{
|
|
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
string Message = ErrorMessage.PromptErrorMessage(ex);
|
|
MessageUtil.Show(Message, ex.Message);
|
|
}
|
|
}
|
|
#endregion
|
|
|
|
#region 凭证计算
|
|
double CalcColumnTotal(GridColumn col)
|
|
{
|
|
DataTable table = this.gridControl.DataSource as DataTable;
|
|
double total = 0f;
|
|
foreach (DataRow item in table.Rows)
|
|
{
|
|
double colValue = string.IsNullOrEmpty(item[col.Name] + "") ? 0 : Convert.ToDouble(item[col.Name] + "");
|
|
total += colValue;
|
|
}
|
|
return total;
|
|
}
|
|
/// <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="CellValueChangedEventArgs"/> instance containing the event data.</param>
|
|
void OnGridMainCellValueChanged(object sender, CellValueChangedEventArgs e)
|
|
{
|
|
try
|
|
{
|
|
if (e.Column.Name == "md")
|
|
{
|
|
// 借方金额改变
|
|
double mdTotal = CalcColumnTotal(e.Column);
|
|
txtmd.Text = mdTotal + "";
|
|
|
|
// 输入借方、清空贷方
|
|
if (!string.IsNullOrEmpty(e.Value + ""))
|
|
{
|
|
this.gcMain.SetRowCellValue(e.RowHandle, this.mc, "");
|
|
|
|
// 新增一行,显示贷方金额
|
|
//InitNewRowMethod(sender);
|
|
//this.gcMain.SetRowCellValue(e.RowHandle + 1, this.mc, mdTotal);
|
|
}
|
|
}
|
|
else if (e.Column.Name == "mc")
|
|
{
|
|
// 贷方金额改变
|
|
double mcTotal = CalcColumnTotal(e.Column);
|
|
txtmc.Text = mcTotal + "";
|
|
|
|
// 输入贷方,清空借方
|
|
if (!string.IsNullOrEmpty(e.Value + ""))
|
|
{
|
|
this.gcMain.SetRowCellValue(e.RowHandle, this.md, "");
|
|
}
|
|
}
|
|
}
|
|
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 OnmdTextChanged(object sender, EventArgs e)
|
|
{
|
|
try
|
|
{
|
|
this.lblMoney.Text = NumToUpper.MoneyToUpper(this.txtmd.Text);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
string Message = ErrorMessage.PromptErrorMessage(ex);
|
|
MessageUtil.Show(Message, ex.Message);
|
|
}
|
|
}
|
|
#endregion
|
|
|
|
#region 辅助项事件
|
|
/// <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 Oncn_idTextEditEditValueChanged(object sender, EventArgs e)
|
|
{
|
|
try
|
|
{
|
|
DataRow rowItem = this.gcMain.GetFocusedDataRow();
|
|
if (rowItem != null)
|
|
{
|
|
rowItem["cn_id"] = this.txtcn_id.TextEditObj.EditValue;
|
|
}
|
|
}
|
|
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 OnnumTextEditEditValueChanged(object sender, EventArgs e)
|
|
{
|
|
try
|
|
{
|
|
DataRow rowItem = this.gcMain.GetFocusedDataRow();
|
|
if (rowItem != null)
|
|
{
|
|
rowItem["num"] = this.txtnum.TextEditObj.EditValue;
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
string Message = ErrorMessage.PromptErrorMessage(ex);
|
|
MessageUtil.Show(Message, ex.Message);
|
|
}
|
|
}
|
|
/// <summary>
|
|
/// <para>说明:日期值改变</para>
|
|
/// <para>创建人:龚宇超</para>
|
|
/// <para>创建日期: </para>
|
|
/// <para>修改人:</para>
|
|
/// <para>修改日期:</para>
|
|
/// <para>修改备注:</para>
|
|
/// <para>版本:1.0</para>
|
|
/// </summary>
|
|
/// <param name="sender">The source of the event.</param>
|
|
/// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
|
|
void Ondt_dateTextEditEditValueChanged(object sender, EventArgs e)
|
|
{
|
|
try
|
|
{
|
|
DataRow rowItem = this.gcMain.GetFocusedDataRow();
|
|
if (rowItem != null)
|
|
{
|
|
rowItem["dt_date"] = this.txtdt_date.TextEditObj.EditValue;
|
|
}
|
|
}
|
|
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 OnpriceTextEditEditValueChanged(object sender, EventArgs e)
|
|
{
|
|
try
|
|
{
|
|
DataRow rowItem = this.gcMain.GetFocusedDataRow();
|
|
if (rowItem != null)
|
|
{
|
|
rowItem["price"] = this.txtprice.TextEditObj.EditValue;
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
string Message = ErrorMessage.PromptErrorMessage(ex);
|
|
MessageUtil.Show(Message, ex.Message);
|
|
}
|
|
}
|
|
/// <summary>
|
|
/// <para>说明:项目值改变</para>
|
|
/// <para>创建人:龚宇超</para>
|
|
/// <para>创建日期: </para>
|
|
/// <para>修改人:</para>
|
|
/// <para>修改日期:</para>
|
|
/// <para>修改备注:</para>
|
|
/// <para>版本:1.0</para>
|
|
/// </summary>
|
|
/// <param name="sender">The source of the event.</param>
|
|
/// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
|
|
void Oncitem_idTextEditEditValueChanged(object sender, EventArgs e)
|
|
{
|
|
try
|
|
{
|
|
DataRow rowItem = this.gcMain.GetFocusedDataRow();
|
|
if (rowItem != null)
|
|
{
|
|
rowItem["citem_id"] = this.txtcitem_id.EditValue;
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
string Message = ErrorMessage.PromptErrorMessage(ex);
|
|
MessageUtil.Show(Message, ex.Message);
|
|
}
|
|
}
|
|
/// <summary>
|
|
/// <para>说明:部门值改变</para>
|
|
/// <para>创建人:龚宇超</para>
|
|
/// <para>创建日期: </para>
|
|
/// <para>修改人:</para>
|
|
/// <para>修改日期:</para>
|
|
/// <para>修改备注:</para>
|
|
/// <para>版本:1.0</para>
|
|
/// </summary>
|
|
/// <param name="sender">The source of the event.</param>
|
|
/// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
|
|
void Oncdept_idTextEditEditValueChanged(object sender, EventArgs e)
|
|
{
|
|
try
|
|
{
|
|
DataRow rowItem = this.gcMain.GetFocusedDataRow();
|
|
if (rowItem != null)
|
|
{
|
|
rowItem["cdept_id"] = this.txtcdept_id.EditValue;
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
string Message = ErrorMessage.PromptErrorMessage(ex);
|
|
MessageUtil.Show(Message, ex.Message);
|
|
}
|
|
}
|
|
/// <summary>
|
|
/// <para>说明:个人值改变</para>
|
|
/// <para>创建人:龚宇超</para>
|
|
/// <para>创建日期: </para>
|
|
/// <para>修改人:</para>
|
|
/// <para>修改日期:</para>
|
|
/// <para>修改备注:</para>
|
|
/// <para>版本:1.0</para>
|
|
/// </summary>
|
|
/// <param name="sender">The source of the event.</param>
|
|
/// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
|
|
void Oncperson_idTextEditEditValueChanged(object sender, EventArgs e)
|
|
{
|
|
try
|
|
{
|
|
DataRow rowItem = this.gcMain.GetFocusedDataRow();
|
|
if (rowItem != null)
|
|
{
|
|
rowItem["cperson_id"] = this.txtcperson_id.EditValue;
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
string Message = ErrorMessage.PromptErrorMessage(ex);
|
|
MessageUtil.Show(Message, ex.Message);
|
|
}
|
|
}
|
|
/// <summary>
|
|
/// <para>说明:供应商值改变</para>
|
|
/// <para>创建人:龚宇超</para>
|
|
/// <para>创建日期: </para>
|
|
/// <para>修改人:</para>
|
|
/// <para>修改日期:</para>
|
|
/// <para>修改备注:</para>
|
|
/// <para>版本:1.0</para>
|
|
/// </summary>
|
|
/// <param name="sender">The source of the event.</param>
|
|
/// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
|
|
void Oncsup_idTextEditEditValueChanged(object sender, EventArgs e)
|
|
{
|
|
try
|
|
{
|
|
DataRow rowItem = this.gcMain.GetFocusedDataRow();
|
|
if (rowItem != null)
|
|
{
|
|
|
|
rowItem["csup_id"] = this.txtcsup_id.EditValue;
|
|
//this.txtcsup_id.EditText = rowItem["csup_id"].ToString();
|
|
// DataTable a = this.txtcsup_id.TextEdit.DataSourceTable;
|
|
}
|
|
}
|
|
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 OncnameTextEditEditValueChanged(object sender, EventArgs e)
|
|
{
|
|
try
|
|
{
|
|
DataRow rowItem = this.gcMain.GetFocusedDataRow();
|
|
if (rowItem != null)
|
|
{
|
|
rowItem["cname"] = this.txtcname.EditValue;
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
string Message = ErrorMessage.PromptErrorMessage(ex);
|
|
MessageUtil.Show(Message, ex.Message);
|
|
}
|
|
}
|
|
|
|
|
|
//区域名称改变
|
|
void OnccDefine11EditValueChanged(object sender, EventArgs e)
|
|
{
|
|
try
|
|
{
|
|
DataRow rowItem = this.gcMain.GetFocusedDataRow();
|
|
if (rowItem != null)
|
|
{
|
|
rowItem["cDefine11"] = this.txtczoneName.EditValue;
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
string Message = ErrorMessage.PromptErrorMessage(ex);
|
|
MessageUtil.Show(Message, ex.Message);
|
|
}
|
|
}
|
|
//生产线名称改变
|
|
void OncDefine12EditValueChanged(object sender, EventArgs e)
|
|
{
|
|
try
|
|
{
|
|
DataRow rowItem = this.gcMain.GetFocusedDataRow();
|
|
if (rowItem != null)
|
|
{
|
|
rowItem["cDefine12"] = this.txtcproductionLine.EditValue;
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
string Message = ErrorMessage.PromptErrorMessage(ex);
|
|
MessageUtil.Show(Message, ex.Message);
|
|
}
|
|
}
|
|
//合同号名称改变
|
|
void OncDefine13EditEditValueChanged(object sender, EventArgs e)
|
|
{
|
|
try
|
|
{
|
|
|