SVN-Revision: r485
This commit is contained in:
cyf
2025-04-14 08:42:17 +00:00
parent 5c53ca5957
commit eea88e0b2b
20 changed files with 840 additions and 224 deletions
+30 -10
View File
@@ -101,11 +101,11 @@ namespace Lskj.Control
/// <summary>
/// 导入返回控件名
/// </summary>
public string ImportReturnName = string.Empty;
public List<string> ImportReturnName =new List<string>();
/// <summary>
/// 导入返回控件值
/// </summary>
public string ImportReturnValue = string.Empty;
public List<string> ImportReturnValue = new List<string>();
public FrmImport()
: this("", "", "", null, "", "", "", "")
@@ -274,6 +274,7 @@ namespace Lskj.Control
model.FieldType == ControlType.LabAutoCompleteValue ||
model.FieldType == ControlType.LabAutoCompleteValueParam ||
model.FieldType == ControlType.LabMultiSelectValue ||
model.FieldType == ControlType.LabMultiSelectValueNew||
model.FieldType == ControlType.LabMultiSelectValueParam ||
model.FieldType == ControlType.LabAutoGridValue||
model.FieldType == ControlType.LabSelectReturnId
@@ -325,7 +326,7 @@ namespace Lskj.Control
{
string selWhere = "1=1";
DataTable table = this.ValueGridColumnTable[model];
if (model.FieldType == ControlType.LabMultiSelectValue || model.FieldType == ControlType.LabMultiSelectValueParam)
if (model.FieldType == ControlType.LabMultiSelectValue || model.FieldType == ControlType.LabMultiSelectValueNew || model.FieldType == ControlType.LabMultiSelectValueParam)
{
string[] splitString = text.Split(',');
string nemValue = string.Empty;
@@ -391,23 +392,32 @@ namespace Lskj.Control
DataTable datatb = new DataTable();
DataTable failedData = new DataTable();
dat.Fill(datatb);
if (ImportReturnName.Count > 0)
{
foreach (string item in ImportReturnName)
{
if (!dt.Columns.Contains(item))
dt.Columns.Add(item);
}
}
failedData = dt.Clone();
if (!failedData.Columns.Contains("import_errormsg"))
failedData.Columns.Add("import_errormsg");
if (!failedData.Columns.Contains(this._importFlag))
failedData.Columns.Add(this._importFlag);
if (!string.IsNullOrWhiteSpace(this.ImportReturnName))
{
if (!failedData.Columns.Contains(this.ImportReturnName))
failedData.Columns.Add(this.ImportReturnName);
}
for (int i = 0; i < dt.Rows.Count; i++)
{
dt.Rows[i][_importFlag] = "1";
if (!string.IsNullOrWhiteSpace(this.ImportReturnName))
if (ImportReturnName.Count > 0)
{
dt.Rows[i][ImportReturnName] = ImportReturnValue;
for (int j = 0; j < ImportReturnName.Count; j++)
{
string name = ImportReturnName[j];
string Value = ImportReturnValue[j];
dt.Rows[i][name] = Value;
}
}
}
//所有导入的主键集合
@@ -466,6 +476,7 @@ namespace Lskj.Control
model.FieldType == ControlType.LabComboxValueParam ||
model.FieldType == ControlType.LabAutoCompleteValue ||
model.FieldType == ControlType.LabAutoCompleteValueParam ||
model.FieldType == ControlType.LabMultiSelectValueNew||
model.FieldType == ControlType.LabMultiSelectValue ||
model.FieldType == ControlType.LabMultiSelectValueParam ||
model.FieldType == ControlType.LabAutoGridValue||
@@ -615,11 +626,19 @@ namespace Lskj.Control
string sqlValue = string.Format("update {0} set {1}='0' ", this._tableName, this._importFlag);
sqlValue = string.Format("update {0} set {1}='0' where {1}!='0' ", this._tableName, this._importFlag);
SqlHelper.ExecuteNonQuery(sqlValue);
DataRow dataRow = datatb.Rows[0];
if (!string.IsNullOrWhiteSpace(SysModel.afterimportSql2) && failed == 0)
{
SqlHelper.ExecuteNonQuery(ReplaceHelper.ReplaceRowParam(dataRow, ReplaceHelper.ReplaceUserInfo(SysModel.afterimportSql2)));
}
datatb.Clear();
dt.Clear();
if (failed > 0)
gcMain.gridControl.DataSource = failedData;
LogUtil.WriteDebug(_menuCode, "导入数据", SysModel.MenuText, "数据导入,成功" + success.ToString() + "条,失败" + failed.ToString() + "条");
}
catch (Exception ex)
@@ -1050,6 +1069,7 @@ namespace Lskj.Control
gridmodel.FieldType == ControlType.LabAutoCompleteValue ||
gridmodel.FieldType == ControlType.LabAutoCompleteValueParam ||
gridmodel.FieldType == ControlType.LabMultiSelectValue ||
gridmodel.FieldType == ControlType.LabMultiSelectValueNew ||
gridmodel.FieldType == ControlType.LabMultiSelectValueParam))
{
bool isEmpty = gridmodel.CanNull;