SVN-Revision: r274
This commit is contained in:
tdx
2025-02-20 09:25:45 +00:00
parent ee0936c0c0
commit 95201e7bcf
5 changed files with 332 additions and 169 deletions
+25 -33
View File
@@ -49,9 +49,10 @@
this.panelControl3 = new DevExpress.XtraEditors.PanelControl();
this.btnTreeSearch = new DevExpress.XtraEditors.SimpleButton();
this.pl_main_bottom = new DevExpress.XtraEditors.PanelControl();
this.dbpFP = new DevExpress.XtraEditors.DropDownButton();
this.pmFP = new DevExpress.XtraBars.PopupMenu();
this.btnRefresh = new DevExpress.XtraEditors.SimpleButton();
this.btnHiding = new DevExpress.XtraEditors.SimpleButton();
this.btnFP = new DevExpress.XtraEditors.SimpleButton();
this.btnHelp = new DevExpress.XtraEditors.SimpleButton();
this.pl_templete = new DevExpress.XtraEditors.PanelControl();
this.cb_templete = new DevExpress.XtraEditors.ComboBoxEdit();
@@ -109,6 +110,7 @@
this.panelControl3.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.pl_main_bottom)).BeginInit();
this.pl_main_bottom.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.pmFP)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.pl_templete)).BeginInit();
this.pl_templete.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.cb_templete.Properties)).BeginInit();
@@ -376,9 +378,9 @@
this.pl_main_bottom.Appearance.BackColor = System.Drawing.Color.Transparent;
this.pl_main_bottom.Appearance.Options.UseBackColor = true;
this.pl_main_bottom.BorderStyle = DevExpress.XtraEditors.Controls.BorderStyles.NoBorder;
this.pl_main_bottom.Controls.Add(this.dbpFP);
this.pl_main_bottom.Controls.Add(this.btnRefresh);
this.pl_main_bottom.Controls.Add(this.btnHiding);
this.pl_main_bottom.Controls.Add(this.btnFP);
this.pl_main_bottom.Controls.Add(this.btnHelp);
this.pl_main_bottom.Controls.Add(this.pl_templete);
this.pl_main_bottom.Controls.Add(this.pl_input);
@@ -396,6 +398,25 @@
this.pl_main_bottom.Size = new System.Drawing.Size(1211, 37);
this.pl_main_bottom.TabIndex = 1;
//
// dbpFP
//
this.dbpFP.AllowFocus = false;
this.dbpFP.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.dbpFP.Appearance.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.dbpFP.Appearance.Options.UseFont = true;
this.dbpFP.DropDownArrowStyle = DevExpress.XtraEditors.DropDownArrowStyle.Show;
this.dbpFP.DropDownControl = this.pmFP;
this.dbpFP.Location = new System.Drawing.Point(356, 7);
this.dbpFP.Name = "dbpFP";
this.dbpFP.Size = new System.Drawing.Size(52, 26);
this.dbpFP.TabIndex = 34;
this.dbpFP.Text = "分配";
//
// pmFP
//
this.pmFP.Manager = this.barManager1;
this.pmFP.Name = "pmFP";
//
// btnRefresh
//
this.btnRefresh.AllowFocus = false;
@@ -423,19 +444,6 @@
this.btnHiding.Visible = false;
this.btnHiding.Click += new System.EventHandler(this.OnMainTableHiding);
//
// btnFP
//
this.btnFP.AllowFocus = false;
this.btnFP.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.btnFP.Appearance.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.btnFP.Appearance.Options.UseFont = true;
this.btnFP.Location = new System.Drawing.Point(345, 7);
this.btnFP.Name = "btnFP";
this.btnFP.Size = new System.Drawing.Size(67, 26);
this.btnFP.TabIndex = 31;
this.btnFP.Text = "分配";
this.btnFP.Click += new System.EventHandler(this.OnBtnFPClick);
//
// btnHelp
//
this.btnHelp.AllowFocus = false;
@@ -850,6 +858,7 @@
this.panelControl3.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.pl_main_bottom)).EndInit();
this.pl_main_bottom.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.pmFP)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.pl_templete)).EndInit();
this.pl_templete.ResumeLayout(false);
this.pl_templete.PerformLayout();
@@ -910,7 +919,6 @@
private DevExpress.XtraEditors.PanelControl panelControl3;
private DevExpress.XtraEditors.SimpleButton btnTreeSearch;
public DevExpress.XtraEditors.PanelControl pl_main_bottom;
private DevExpress.XtraEditors.SimpleButton btnFP;
private DevExpress.XtraEditors.SimpleButton btnHelp;
private DevExpress.XtraEditors.PanelControl pl_templete;
private DevExpress.XtraEditors.ComboBoxEdit cb_templete;
@@ -928,20 +936,4 @@
private DevExpress.XtraEditors.SimpleButton btnDelete;
private DevExpress.XtraEditors.SimpleButton btnBillSave;
private DevExpress.XtraEditors.PanelControl pl_main_top;
private DevExpress.XtraEditors.PanelControl pl_main_top_center;
private System.Windows.Forms.Label lbTitle;
private DevExpress.XtraEditors.PanelControl pl_main_top_right;
private DevExpress.XtraEditors.LabelControl lblOrderNo;
private DevExpress.XtraEditors.LabelControl labelControl1;
private DevExpress.XtraEditors.PanelControl pl_main_top_left;
private DevExpress.XtraEditors.PanelControl pl_red;
private System.Windows.Forms.RadioButton rdRed;
private DevExpress.XtraEditors.PanelControl pl_blue;
private System.Windows.Forms.RadioButton rdBlue;
private Control.TabControlEx tb_buttom;
private DevExpress.XtraEditors.TextEdit txt_input;
private DevExpress.XtraEditors.SimpleButton btnHiding;
private DevExpress.XtraEditors.SimpleButton btnRefresh;
private Control.GridControlEx gcMain;
}
}
private DevExpress
+301 -75
View File
@@ -821,7 +821,7 @@ namespace Lskj.PubBill
this.pl_main_bottom.Enabled = false;
this.ssc_main_top.SplitterPosition = this.BillModel.PanelWidth;
InitializeUnionCode();//根据红蓝字段更新分配
this.btnFP.Visible = !string.IsNullOrWhiteSpace(this.BillModel.PopupUnionCode);
this.dbpFP.Visible = !string.IsNullOrWhiteSpace(this.BillModel.PopupUnionCode);
}
/// <summary>
/// <para>说明:初始化常用操作等功能</para>
@@ -843,6 +843,12 @@ namespace Lskj.PubBill
BarButtonItem itemExport = new BarButtonItem();
itemExport.Caption = "导出Excel文件";
itemExport.ItemClick += new ItemClickEventHandler(OnExportItemClick);
BarButtonItem itemFPNormal = new BarButtonItem();
itemFPNormal.Caption = "普通分配";
itemFPNormal.ItemClick += new ItemClickEventHandler(OnBtnFPOldClick);
BarButtonItem itemFPBatch = new BarButtonItem();
itemFPBatch.Caption = "批量分配";
itemFPBatch.ItemClick += new ItemClickEventHandler(OnBtnFPNewClick);
this._itemImport = new BarButtonItem();
this._itemImport.Caption = "导入Excel文件";
@@ -853,16 +859,17 @@ namespace Lskj.PubBill
// 复制单据
this.pmBill.AddItems(new BarItem[] { itemCopyMaster, itemCopyAll });
// 导入导出
if (this.BillModel.CanExport && this.BillModel.ExportPermission)
{
this.pmBillExp.AddItem(itemExport);
}
if (this.BillModel.CanImport)
{
this.pmBillExp.AddItems(new BarItem[] { _itemImport, _itemImportUpdate });
}
//分配
this.pmFP.AddItems(new BarItem[] { itemFPNormal, itemFPBatch });
// 打印模版
string[] files = this.BillModel.PrintFile.Split('|');
for (int i = 0; i < files.Length; i++)
@@ -1918,7 +1925,7 @@ namespace Lskj.PubBill
this._itemImport.Enabled = this._itemImportUpdate.Enabled = !isReadOnly;
this.ControlObj.SetReadOnlyAllControl(isReadOnly);
this.ControlObj.SetAllControlValue(rowItem);
this.btnFP.Enabled = this.btnDelete.Enabled = this.btnBillSave.Enabled = this.btnBillApply.Enabled = !isReadOnly;
this.dbpFP.Enabled = this.btnDelete.Enabled = this.btnBillSave.Enabled = this.btnBillApply.Enabled = !isReadOnly;
this.ControlObj.CanExecControl = true;
this.cb_input.Enabled = this.btn_input.Enabled = this.txt_input.Enabled = !isReadOnly;
this.BillRowItem = rowItem;
@@ -1929,7 +1936,7 @@ namespace Lskj.PubBill
this.cb_templete.Enabled = !isReadOnly;
}
this.BillModel.PopupUnionCode = rdBlue.Checked ? rdBlueUnionCode : rdRedUnionCode;
this.btnFP.Visible = !string.IsNullOrWhiteSpace(this.BillModel.PopupUnionCode);
this.dbpFP.Visible = !string.IsNullOrWhiteSpace(this.BillModel.PopupUnionCode);
this.labelControl1.ForeColor = this.lblOrderNo.ForeColor = this.lbTitle.ForeColor = rdBlue.Checked ? Color.Blue : Color.Red;
this.gcMain.GridView.OptionsBehavior.Editable = !isReadOnly;
// 上一次查询
@@ -1971,7 +1978,7 @@ namespace Lskj.PubBill
else
{
// 单据为新增状态
this.btnFP.Enabled = this.btnDelete.Enabled = this.btnBillSave.Enabled = this.btnBillApply.Enabled = true;
this.dbpFP.Enabled = this.btnDelete.Enabled = this.btnBillSave.Enabled = this.btnBillApply.Enabled = true;
this.lbTitle.Text = this.BillModel.TypeName + "(新增)";
this.lblOrderNo.Text = BillImpl.GetBillNo(this.BillModel.BillSeq);
this._itemImport.Enabled = this._itemImportUpdate.Enabled = true;
@@ -2022,7 +2029,7 @@ namespace Lskj.PubBill
{
this.rdRed.Checked = false;
this.labelControl1.ForeColor = this.lblOrderNo.ForeColor = this.lbTitle.ForeColor = Color.Blue;
this.btnFP.Visible = !string.IsNullOrWhiteSpace(rdBlueUnionCode);
this.dbpFP.Visible = !string.IsNullOrWhiteSpace(rdBlueUnionCode);
this.BillModel.PopupUnionCode = rdBlueUnionCode;
BaseUserControl userControl = this.ControlObj.FindControl(this.BillModel.RtagidKey);
@@ -2046,7 +2053,7 @@ namespace Lskj.PubBill
{
this.rdBlue.Checked = false;
this.labelControl1.ForeColor = this.lblOrderNo.ForeColor = this.lbTitle.ForeColor = Color.Red;
this.btnFP.Visible = !string.IsNullOrWhiteSpace(rdRedUnionCode);
this.dbpFP.Visible = !string.IsNullOrWhiteSpace(rdRedUnionCode);
this.BillModel.PopupUnionCode = rdRedUnionCode;
BaseUserControl userControl = this.ControlObj.FindControl(this.BillModel.RtagidKey);
@@ -2071,7 +2078,7 @@ namespace Lskj.PubBill
/// <param name="e">The <see cref="ItemClickEventArgs"/> instance containing the event data.</param>
protected void OnCopyMasterItemClick(object sender, ItemClickEventArgs e)
{
this.btnFP.Enabled = this.btnDelete.Enabled = this.btnBillSave.Enabled = this.btnBillApply.Enabled = true;
this.dbpFP.Enabled = this.btnDelete.Enabled = this.btnBillSave.Enabled = this.btnBillApply.Enabled = true;
this.lbTitle.Text = this.BillModel.TypeName + "(新增)";
this.lbTitle.Invalidate();
this.lblOrderNo.Text = BillImpl.GetBillNo(this.BillModel.BillSeq);
@@ -2119,7 +2126,7 @@ namespace Lskj.PubBill
{
gridTable = ((this.gcMain as TreeGridControlEx).TreeListObj.DataSource as DataTable).TrimDeleteRows();
}
this.btnFP.Enabled = this.btnDelete.Enabled = this.btnBillSave.Enabled = this.btnBillApply.Enabled = true;
this.dbpFP.Enabled = this.btnDelete.Enabled = this.btnBillSave.Enabled = this.btnBillApply.Enabled = true;
this.lbTitle.Text = this.BillModel.TypeName + "(新增)";
this.lbTitle.Invalidate();
this.lblOrderNo.Text = BillImpl.GetBillNo(this.BillModel.BillSeq);
@@ -2750,7 +2757,7 @@ namespace Lskj.PubBill
if (unionModel.GridControlObj != null)
{
unionModel.GridControlObj.gridControl.DataSource = BaseImpl.GetDataTableResult(sql);
if (unionModel.GridControlObj != null)
{
unionModel.GridControlObj.GridView.SelectRowHandler(Handle);
@@ -5948,8 +5955,6 @@ namespace Lskj.PubBill
WebBrowserUtil.StartWebBrowser(this.SysModel.ModuleCode, this.BillModel.TypeName);
}
FrmBaseSelect frmSelect = new FrmBaseSelect();
/// <summary>
/// <para>说明:分配明细</para>
/// <para>创建人:龚宇超</para>
@@ -5961,47 +5966,106 @@ namespace Lskj.PubBill
/// </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 OnBtnFPClick(object sender, EventArgs e)
private void OnBtnFPOldClick(object sender, EventArgs e)
{
FPOld();
}
private void OnBtnFPNewClick(object sender, EventArgs e)
{
FPNew();
}
/// <summary>
/// 新版分配
/// </summary>
private void FPNew()
{
try
{
int[] selectRows = this.gcMain.GridView.GetSelectedRows();
if (selectRows.Count() == 0)
{
return;
}
DataTable table = this.gcMain.GridControl.DataSource as DataTable;
if (!table.Columns.Contains(guidField))
{
table.Columns.Add(guidField, typeof(string));
}
#region
string[] args = { this.SysModel.FormText, this.SysModel.UserId, this.SysModel.UserName, this.SysModel.Privilege, this.SysModel.ModuleCode, this.SysModel.ModuleId + "", this.BillModel.PopupUnionCode, "1000" };
DynamicBaseSelectModel baseModel = new DynamicBaseSelectModel(args);
using (FrmBaseSelectBatch frmSelect = new FrmBaseSelectBatch(baseModel, this.ControlObj, this.gcMain))
{
frmSelect.Text = this.BillModel.TypeName;
frmSelect.InitControl();
frmSelect.OnAfterFPCallback += OnAfterFPCallback;
#region
DataRow rowItem = this.gcMain.GridView.GetFocusedDataRow();
if (rowItem == null)
{
return;
}
rowItem[guidField] = Guid.NewGuid().ToString();
if (!string.IsNullOrEmpty(mRecordPrimaryField) && table.Columns.Contains(this.mRecordPrimaryField))
{
// 检查数据是否为分配后的行
if (!string.IsNullOrEmpty(rowItem[this.mRecordPrimaryField] + ""))
{
return;
}
}
if (!string.IsNullOrEmpty(mRecordPrimaryField))
{
frmSelect.FpRows = table.Rows.Cast<DataRow>().Where(x => (rowItem[guidField] + "").Equals(x[guidField] + "")).ToArray();
if (frmSelect.FpRows != null && frmSelect.FpRows.Length > 0)
{
List<DataRow> rows = frmSelect.FpRows.ToList();
rows.Remove(rowItem);
frmSelect.FpRows = rows.ToArray();
}
if (table.Columns.Contains(mRecordPrimaryField))
{
frmSelect.FpOtherRows = table.Rows.Cast<DataRow>().Where(x => !(rowItem[guidField] + "").Equals(x[guidField] + "") && !string.IsNullOrEmpty(x[mRecordPrimaryField] + "")).ToArray();
}
}
frmSelect.InitData(rowItem);
frmSelect.OnBtnFPClick(null, null);
#endregion
//frmSelect.ShowDialog();
#endregion
}
}
catch (Exception ex)
{
MessageUtil.Show(ex.Message);
}
}
/// <summary>
/// 分配完成后回调
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void OnAfterFPCallback(object sender, EventArgs e)
{
WaitForm.ShowForm();
try
{
DataRow rowItem = this.gcMain.GridView.GetFocusedDataRow();
if (rowItem == null)
{
MessageUtil.Show("请先选择一条明细在进行分配!");
return;
}
DataTable table = this.gcMain.GridControl.DataSource as DataTable;
if (!table.Columns.Contains(guidField))
{
table.Columns.Add(guidField, typeof(String));
}
rowItem[guidField] = Guid.NewGuid().ToString(); ;
FrmBaseSelectBatch frmSelect = (FrmBaseSelectBatch)sender;
rowItem[guidField] = Guid.NewGuid().ToString();
if (!string.IsNullOrEmpty(mRecordPrimaryField) && table.Columns.Contains(this.mRecordPrimaryField))
{
// 检查数据是否为分配后的行
if (!string.IsNullOrEmpty(rowItem[this.mRecordPrimaryField] + ""))
{
MessageUtil.Show("该行数据为已分配后的数据,无需分配!");
return;
}
}
string[] args = { this.SysModel.FormText, this.SysModel.UserId, this.SysModel.UserName, this.SysModel.Privilege, this.SysModel.ModuleCode, this.SysModel.ModuleId + "", this.BillModel.PopupUnionCode, "1000" };
DynamicBaseSelectModel baseModel = new DynamicBaseSelectModel(args);
frmSelect = new FrmBaseSelect(baseModel, this.ControlObj, this.gcMain);
//if (frmSelect.SelectRowItem == null)
//{
// frmSelect = new FrmBaseSelect(baseModel, this.ControlObj, this.gcMain);
//}
frmSelect.Text = this.BillModel.TypeName;
frmSelect.SelectRowItem = rowItem;
bool isNextOne = false;
if (!string.IsNullOrEmpty(mRecordPrimaryField))
{
frmSelect.FpRows = table.Rows.Cast<DataRow>().Where(x => (rowItem[guidField] + "").Equals(x[guidField] + "")).ToArray();
@@ -6016,29 +6080,21 @@ namespace Lskj.PubBill
frmSelect.FpOtherRows = table.Rows.Cast<DataRow>().Where(x => !(rowItem[guidField] + "").Equals(x[guidField] + "") && !string.IsNullOrEmpty(x[mRecordPrimaryField] + "")).ToArray();
}
}
if (frmSelect.ShowDialog() == DialogResult.OK && frmSelect.SelectedRows != null && frmSelect.SelectedRows.Length > 0)
frmSelect.InitData(rowItem);
bool success = frmSelect.FP();
if (success && frmSelect.SelectedRows != null && frmSelect.SelectedRows.Length > 0)
{
//if (frmSelect.isNextOne)
//{
// isNextOne = true;
//}
//else
//{
// isNextOne = false;
//}
// 增加标识列
if (!table.Columns.Contains(frmSelect.RecordPrimaryField))
{
this.mRecordPrimaryField = frmSelect.RecordPrimaryField;
table.Columns.Add(this.mRecordPrimaryField, typeof(String));
}
foreach (DataRow item in frmSelect.SelectedRows)
{
DataRow newRow = table.NewRow();
newRow.ItemArray = rowItem.ItemArray;
newRow[guidField] = rowItem[guidField];
DataColumn IsIdentCol = newRow.Table.Columns.Cast<DataColumn>().FirstOrDefault(x => x.ColumnName == BaseImpl.GetResult(string.Format("SELECT COLUMN_NAME FROM INFORMATION_SCHEMA.columns WHERE TABLE_NAME='{0}' AND COLUMNPROPERTY(OBJECT_ID('{0}'),COLUMN_NAME,'IsIdentity')=1", BillModel.DetailTable)) + "");
//自增长列分配按空值取
if (IsIdentCol != null)
@@ -6052,9 +6108,6 @@ namespace Lskj.PubBill
newRow[IsIdentCol.ColumnName] = 0;
}
}
foreach (DataColumn col in item.Table.Columns)
{
if (table.Columns.Contains(col.ColumnName))
@@ -6076,47 +6129,187 @@ namespace Lskj.PubBill
newRow[frmSelect.AmountField] = item[frmSelect.AmountField];
newRow[frmSelect.RecordPrimaryField] = item[frmSelect.RecordPrimaryField];
table.Rows.Add(newRow);
}
NumberMc = frmSelect.AmountField;
//double syAmount = frmSelect.GetSyAmount();
//if (syAmount > 0)
//{
// rowItem[frmSelect.AmountField] = frmSelect.GetSyAmount();
//}
//else
//{
// table.Rows.Remove(rowItem);
//}
table.Rows.Remove(rowItem);
// 重排顺序
table.OrderBy(this.BillModel.DetailOrderField);
this.gcMain.GridView.UpdateCurrentRow();
this.gcMain.GridView.ShowEditor();
if (frmSelect.isNextOne)
{
int SourceRowIndex = this.gcMain.GridView.GetFocusedDataSourceRowIndex();
DataRow[] a = table.Rows.Cast<DataRow>().Where(x => string.IsNullOrEmpty(x[guidField].ToString())).ToArray();
if (a.Length != 0)
{
this.gcMain.GridView.FocusedRowHandle = SourceRowIndex;
OnAfterFPCallback(sender, e);
}
else
{
MessageUtil.Show("全部分配完毕");
// frmSelect.SelectRowItem = null;
}
}
}
if (frmSelect.isNextOne)
}
catch (Exception)
{
throw;
}
finally
{
WaitForm.HideForm();
}
}
/// <summary>
/// 老版分配
/// </summary>
private void FPOld()
{
try
{
DataRow rowItem = this.gcMain.GridView.GetFocusedDataRow();
if (rowItem == null)
{
int SourceRowIndex = this.gcMain.GridView.GetFocusedDataSourceRowIndex();
DataRow[] a = table.Rows.Cast<DataRow>().Where(x => string.IsNullOrEmpty(x[guidField].ToString())).ToArray();
if (a.Length != 0)
MessageUtil.Show("请先选择一条明细在进行分配!");
return;
}
DataTable table = this.gcMain.GridControl.DataSource as DataTable;
if (!table.Columns.Contains(guidField))
{
table.Columns.Add(guidField, typeof(string));
}
rowItem[guidField] = Guid.NewGuid().ToString(); ;
if (!string.IsNullOrEmpty(mRecordPrimaryField) && table.Columns.Contains(this.mRecordPrimaryField))
{
// 检查数据是否为分配后的行
if (!string.IsNullOrEmpty(rowItem[this.mRecordPrimaryField] + ""))
{
this.gcMain.GridView.FocusedRowHandle = SourceRowIndex;
OnBtnFPClick(sender, e);
MessageUtil.Show("该行数据为已分配后的数据,无需分配!");
return;
}
else
}
string[] args = { this.SysModel.FormText, this.SysModel.UserId, this.SysModel.UserName, this.SysModel.Privilege, this.SysModel.ModuleCode, this.SysModel.ModuleId + "", this.BillModel.PopupUnionCode, "1000" };
DynamicBaseSelectModel baseModel = new DynamicBaseSelectModel(args);
using (FrmBaseSelect frmSelect = new FrmBaseSelect(baseModel, this.ControlObj, this.gcMain))
{
//if (frmSelect.SelectRowItem == null)
//{
// frmSelect = new FrmBaseSelect(baseModel, this.ControlObj, this.gcMain);
//}
frmSelect.Text = this.BillModel.TypeName;
frmSelect.SelectRowItem = rowItem;
bool isNextOne = false;
if (!string.IsNullOrEmpty(mRecordPrimaryField))
{
MessageUtil.Show("全部分配完毕");
// frmSelect.SelectRowItem = null;
frmSelect.FpRows = table.Rows.Cast<DataRow>().Where(x => (rowItem[guidField] + "").Equals(x[guidField] + "")).ToArray();
if (frmSelect.FpRows != null && frmSelect.FpRows.Length > 0)
{
List<DataRow> rows = frmSelect.FpRows.ToList();
rows.Remove(rowItem);
frmSelect.FpRows = rows.ToArray();
}
if (table.Columns.Contains(mRecordPrimaryField))
{
frmSelect.FpOtherRows = table.Rows.Cast<DataRow>().Where(x => !(rowItem[guidField] + "").Equals(x[guidField] + "") && !string.IsNullOrEmpty(x[mRecordPrimaryField] + "")).ToArray();
}
}
if (frmSelect.ShowDialog() == DialogResult.OK && frmSelect.SelectedRows != null && frmSelect.SelectedRows.Length > 0)
{
//if (frmSelect.isNextOne)
//{
// isNextOne = true;
//}
//else
//{
// isNextOne = false;
//}
// 增加标识列
if (!table.Columns.Contains(frmSelect.RecordPrimaryField))
{
this.mRecordPrimaryField = frmSelect.RecordPrimaryField;
table.Columns.Add(this.mRecordPrimaryField, typeof(String));
}
foreach (DataRow item in frmSelect.SelectedRows)
{
DataRow newRow = table.NewRow();
newRow.ItemArray = rowItem.ItemArray;
newRow[guidField] = rowItem[guidField];
DataColumn IsIdentCol = newRow.Table.Columns.Cast<DataColumn>().FirstOrDefault(x => x.ColumnName == BaseImpl.GetResult(string.Format("SELECT COLUMN_NAME FROM INFORMATION_SCHEMA.columns WHERE TABLE_NAME='{0}' AND COLUMNPROPERTY(OBJECT_ID('{0}'),COLUMN_NAME,'IsIdentity')=1", BillModel.DetailTable)) + "");
//自增长列分配按空值取
if (IsIdentCol != null)
{
if (IsIdentCol.DataType == typeof(Decimal) ||
IsIdentCol.DataType == typeof(Double) ||
IsIdentCol.DataType == typeof(Int16) ||
IsIdentCol.DataType == typeof(Int32) ||
IsIdentCol.DataType == typeof(Int64))
{
newRow[IsIdentCol.ColumnName] = 0;
}
}
foreach (DataColumn col in item.Table.Columns)
{
if (table.Columns.Contains(col.ColumnName))
{
//newRow[col.ColumnName] = item[col.ColumnName];
newRow[col.ColumnName] = item[col.ColumnName];
GridColumn column = this.gcMain.GridView.Columns[col.ColumnName];
if (column != null)
{
GridColumnModel model = column.Tag as GridColumnModel;
if (!string.IsNullOrEmpty(model.UnionFields))
{
this.SetUnionValue(model, rowItem[column.FieldName] + "", newRow);
}
SetCalcValue(model, rowItem[column.FieldName] + "", newRow);
}
}
}
newRow[frmSelect.AmountField] = item[frmSelect.AmountField];
newRow[frmSelect.RecordPrimaryField] = item[frmSelect.RecordPrimaryField];
table.Rows.Add(newRow);
}
NumberMc = frmSelect.AmountField;
//double syAmount = frmSelect.GetSyAmount();
//if (syAmount > 0)
//{
// rowItem[frmSelect.AmountField] = frmSelect.GetSyAmount();
//}
//else
//{
// table.Rows.Remove(rowItem);
//}
table.Rows.Remove(rowItem);
// 重排顺序
table.OrderBy(this.BillModel.DetailOrderField);
this.gcMain.GridView.UpdateCurrentRow();
this.gcMain.GridView.ShowEditor();
}
if (frmSelect.isNextOne)
{
int SourceRowIndex = this.gcMain.GridView.GetFocusedDataSourceRowIndex();
DataRow[] a = table.Rows.Cast<DataRow>().Where(x => string.IsNullOrEmpty(x[guidField].ToString())).ToArray();
if (a.Length != 0)
{
this.gcMain.GridView.FocusedRowHandle = SourceRowIndex;
OnBtnFPOldClick(null, null);
}
else
{
MessageUtil.Show("全部分配完毕");
// frmSelect.SelectRowItem = null;
}
}
}
}
catch (Exception ex)
{
MessageUtil.Show(ex);
}
}
private void cb_templete_QueryCloseUp(object sender, CancelEventArgs e)
{
@@ -6533,7 +6726,7 @@ namespace Lskj.PubBill
buttons.Add(this.btnRefresh);
}
//分配按钮
buttons.Add(this.btnFP);
buttons.Add(this.dbpFP);
//从最后开始计算
@@ -7308,4 +7501,37 @@ namespace Lskj.PubBill
/// </summary>
/// <param name="cond">The cond.</param>
/// <param name="dataRow">The data row.</param>
/// <returns><c>true</c> if XXXX, <
/// <returns><c>true</c> if XXXX, <c>false</c> otherwise.</returns>
private bool ValidateCond(string cond, DataRow dataRow)
{
bool result = false;
string condition = cond;
try
{
if (string.IsNullOrWhiteSpace(cond)) return true;//如果值是空格或者空行,默认正确
cond = ReplaceHelper.ReplaceRowParam(dataRow, cond);
if (cond.StartsWith("@") || cond.StartsWith("!"))
{
result = "1".Equals(BaseImpl.GetDefaultValue(cond));
}
else if (dataRow == null)
{
result = ReplaceHelper.EvalCond(cond);
}
else
{
result = ReplaceHelper.ReplaceRowParamCond(dataRow, cond);
}
return result;
}
catch (Exception ex)
{
}
return result;
}
}
}
+4 -1
View File
@@ -121,7 +121,10 @@
<value>642, 21</value>
</metadata>
<metadata name="$this.TrayHeight" type="System.Int32, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>25</value>
<value>83</value>
</metadata>
<metadata name="pmFP.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>1078, 23</value>
</metadata>
<metadata name="pmBillExp.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>873, 21</value>
+1 -27
View File
@@ -35,30 +35,4 @@ namespace Lskj.PubBill
try
{
FrmMain main = new FrmMain();
DynamicBillModel moduleModel = new DynamicBillModel(obj);
main.SysModel = moduleModel;
moduleModel.DataCaches = new Dictionary<object, Hashtable>();
if (SystemInfo.Instance.OptimizationSpeed) main.GetDataCaches(moduleModel.DataCaches);
GridEnum gridEnum = GridEnum.GridView;
if (!moduleModel.DataCaches.GetValue(main, "FormType", out int formType))
{
formType = BaseImpl.GetBillDetailType(moduleModel.ModuleCode);
}
if (formType == 1)
{
gridEnum = GridEnum.BandedGridView;
}
main.SysModel.GridEnumObj = gridEnum;
this.SubForm = main;
}
catch (Exception ex)
{
LogUtil.WriteError("Lskj.PubBill.dll--参数错误-->" + obj.ToString(), ex);
}
}
public Form SubForm { get; set; }
}
}
DynamicBillModel
+1 -33
View File
@@ -152,36 +152,4 @@ namespace Lskj.PubBill
{
if (isInitialization)
{
this.billModule1.txtinputobj.Focus();//如果有扫码框,就默认获得焦点
isInitialization = false;
}
}
private void OnClose(object sender, FormClosingEventArgs e)
{
string guid = this.Tag + "";
if (string.IsNullOrWhiteSpace(guid)) return;
DllModule m = Manager.ModuleForms[guid];
m.IsClose = true;
if (billModule1.closeTheJudgment())
{
if (string.IsNullOrWhiteSpace(guid)) return;
DialogResult result = MessageUtil.Show(("数据未保存,是否确定关闭?"), MessageBoxButtons.YesNo);
if (result == DialogResult.Yes)
{
m.IsClose = true;
e.Cancel = false;
}
else
{
m.IsClose = false;
e.Cancel = true;
}
}
}
}
}
this.billModule1.txtinputobj.Fo