SVN-Revision: r831
This commit is contained in:
wyf
2025-07-03 07:30:05 +00:00
parent 61fe1a667b
commit 5e80a58b8c
+94 -64
View File
@@ -35,6 +35,7 @@ using DevExpress.Utils;
using System.Data.SqlClient;
using Newtonsoft.Json.Linq;
using Newtonsoft.Json;
using Lskj.PubBillSpecial;
namespace Lskj.PubBill
{
@@ -2285,7 +2286,7 @@ namespace Lskj.PubBill
}
if (unionModel.ModelObj.DragAndSave && e.TreeListObj.Selection.Count == i && i != 0)
{
this.OnBillSaveClick(null,null);
this.OnBillSaveClick(null, null);
}
}
}
@@ -5841,6 +5842,10 @@ namespace Lskj.PubBill
{
}
}
else
{
gcMain.AddHeadquarters(null);
}
gcMain.RefreshHeaderColor();
this.gcMain.GridControl.DataSource = null;
this.gcMain.GridControl.DataSource = dataTable;
@@ -6710,7 +6715,29 @@ namespace Lskj.PubBill
try
{
if (this.CanAddDetailRow())
bool isAgain = true;
if (this.BillModel.isWorkLogin)
{
if (!this.BillModel.SaveState && this.gcMain.DataRowCount() > 0)
{
DialogResult result = MessageUtil.Show(("数据未保存,是否确定新建单据?"), MessageBoxButtons.YesNo);
if (result == DialogResult.Yes)
{
this.SetBillStatus(null);
this.ControlObj.ResetControlValue(this.BillModel.ManuallyTriggerCorrelation, true);
}
else
{
isAgain = false;
}
}
else
{
this.SetBillStatus(null);
this.ControlObj.ResetControlValue(this.BillModel.ManuallyTriggerCorrelation, true);
}
}
if (this.CanAddDetailRow() && isAgain)
{
if (this.BillModel.DisableDragPrompt || MessageUtil.Show(ResourceKeys.DragSelectRow, MessageBoxButtons.YesNo) == DialogResult.Yes)
{
@@ -7503,78 +7530,81 @@ 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)
if (frmSelect.ShowDialog() == DialogResult.OK)
{
//if (frmSelect.isNextOne)
//{
// isNextOne = true;
//}
//else
//{
// isNextOne = false;
//}
// 增加标识列
if (!table.Columns.Contains(frmSelect.RecordPrimaryField))
if (frmSelect.SelectedRows != null && frmSelect.SelectedRows.Length > 0)
{
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 (frmSelect.isNextOne)
//{
// isNextOne = true;
//}
//else
//{
// isNextOne = false;
//}
// 增加标识列
if (!table.Columns.Contains(frmSelect.RecordPrimaryField))
{
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;
}
this.mRecordPrimaryField = frmSelect.RecordPrimaryField;
table.Columns.Add(this.mRecordPrimaryField, typeof(String));
}
foreach (DataColumn col in item.Table.Columns)
foreach (DataRow item in frmSelect.SelectedRows)
{
if (table.Columns.Contains(col.ColumnName))
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)
{
//newRow[col.ColumnName] = item[col.ColumnName];
newRow[col.ColumnName] = item[col.ColumnName];
GridColumn column = this.gcMain.GridView.Columns[col.ColumnName];
if (column != null)
if (IsIdentCol.DataType == typeof(Decimal) ||
IsIdentCol.DataType == typeof(Double) ||
IsIdentCol.DataType == typeof(Int16) ||
IsIdentCol.DataType == typeof(Int32) ||
IsIdentCol.DataType == typeof(Int64))
{
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[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);
}
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();
}
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)
{
@@ -8754,7 +8784,7 @@ namespace Lskj.PubBill
}
i++;
}
if (unionModel.ModelObj.DragAndSave && rows.Length == i && i != 0)
if (unionModel.ModelObj.DragAndSave && rows.Length == i && i != 0)
{
this.OnBillSaveClick(null, null);
}