SVN r274
SVN-Revision: r274
This commit is contained in:
+301
-75
@@ -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;
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user