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 System.Data.SqlClient;
using Newtonsoft.Json.Linq; using Newtonsoft.Json.Linq;
using Newtonsoft.Json; using Newtonsoft.Json;
using Lskj.PubBillSpecial;
namespace Lskj.PubBill namespace Lskj.PubBill
{ {
@@ -2285,7 +2286,7 @@ namespace Lskj.PubBill
} }
if (unionModel.ModelObj.DragAndSave && e.TreeListObj.Selection.Count == i && i != 0) 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(); gcMain.RefreshHeaderColor();
this.gcMain.GridControl.DataSource = null; this.gcMain.GridControl.DataSource = null;
this.gcMain.GridControl.DataSource = dataTable; this.gcMain.GridControl.DataSource = dataTable;
@@ -6710,7 +6715,29 @@ namespace Lskj.PubBill
try 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) 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(); 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) if (frmSelect.SelectedRows != null && frmSelect.SelectedRows.Length > 0)
//{
// isNextOne = true;
//}
//else
//{
// isNextOne = false;
//}
// 增加标识列
if (!table.Columns.Contains(frmSelect.RecordPrimaryField))
{ {
this.mRecordPrimaryField = frmSelect.RecordPrimaryField; //if (frmSelect.isNextOne)
table.Columns.Add(this.mRecordPrimaryField, typeof(String)); //{
} // isNextOne = true;
//}
foreach (DataRow item in frmSelect.SelectedRows) //else
{ //{
DataRow newRow = table.NewRow(); // isNextOne = false;
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 (!table.Columns.Contains(frmSelect.RecordPrimaryField))
//自增长列分配按空值取
if (IsIdentCol != null)
{ {
if (IsIdentCol.DataType == typeof(Decimal) || this.mRecordPrimaryField = frmSelect.RecordPrimaryField;
IsIdentCol.DataType == typeof(Double) || table.Columns.Add(this.mRecordPrimaryField, typeof(String));
IsIdentCol.DataType == typeof(Int16) ||
IsIdentCol.DataType == typeof(Int32) ||
IsIdentCol.DataType == typeof(Int64))
{
newRow[IsIdentCol.ColumnName] = 0;
}
} }
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]; if (IsIdentCol.DataType == typeof(Decimal) ||
newRow[col.ColumnName] = item[col.ColumnName]; IsIdentCol.DataType == typeof(Double) ||
GridColumn column = this.gcMain.GridView.Columns[col.ColumnName]; IsIdentCol.DataType == typeof(Int16) ||
if (column != null) IsIdentCol.DataType == typeof(Int32) ||
IsIdentCol.DataType == typeof(Int64))
{ {
GridColumnModel model = column.Tag as GridColumnModel; newRow[IsIdentCol.ColumnName] = 0;
if (!string.IsNullOrEmpty(model.UnionFields))
{
this.SetUnionValue(model, rowItem[column.FieldName] + "", newRow);
}
SetCalcValue(model, rowItem[column.FieldName] + "", newRow);
} }
} }
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]; NumberMc = frmSelect.AmountField;
newRow[frmSelect.RecordPrimaryField] = item[frmSelect.RecordPrimaryField]; //double syAmount = frmSelect.GetSyAmount();
table.Rows.Add(newRow); //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) if (frmSelect.isNextOne)
{ {
@@ -8754,7 +8784,7 @@ namespace Lskj.PubBill
} }
i++; i++;
} }
if (unionModel.ModelObj.DragAndSave && rows.Length == i && i != 0) if (unionModel.ModelObj.DragAndSave && rows.Length == i && i != 0)
{ {
this.OnBillSaveClick(null, null); this.OnBillSaveClick(null, null);
} }