SVN r485
SVN-Revision: r485
This commit is contained in:
@@ -2394,18 +2394,19 @@ namespace Lskj.Control
|
||||
}
|
||||
|
||||
}
|
||||
public override void OnShowFilterPopupCheckedListBox(object sender, DevExpress.XtraGrid.Views.Grid.FilterPopupCheckedListBoxEventArgs e)
|
||||
public void OnShowFilterPopupCheckedListBox(object sender, DevExpress.XtraGrid.Views.Grid.FilterPopupCheckedListBoxEventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
GridView gridView = (GridView)sender;
|
||||
DataTable filterTable = gridView.GetFilteredAndSortedDataTable();
|
||||
|
||||
BandedGridView gridView = (BandedGridView)sender;
|
||||
|
||||
string actStr = this.bandedGridView.ActiveFilterString;//获取筛选条件
|
||||
string[] actStr_list = actStr.Split(new string[] { "And" }, StringSplitOptions.None);
|
||||
|
||||
DataTable datatable = new DataTable();
|
||||
|
||||
|
||||
if (!actStr_list[0].Contains(e.Column.FieldName) && actStr != "")
|
||||
if ((!actStr_list[0].Contains(e.Column.FieldName) || (this.bandedGridView.OptionsView.ShowAutoFilterRow && e.Column.FilterInfo.Type == ColumnFilterType.AutoFilter)) && actStr != "")
|
||||
{
|
||||
CriteriaOperator criteria_op = this.bandedGridView.ActiveFilterCriteria;
|
||||
GroupOperator group_op = new GroupOperator();
|
||||
@@ -2511,24 +2512,49 @@ namespace Lskj.Control
|
||||
e.CheckedComboBox.HighlightedItemStyle = HighlightStyle.Skinned;
|
||||
}
|
||||
}
|
||||
for (int i = 0; i < e.CheckedComboBox.Items.Count(); i++)
|
||||
|
||||
|
||||
|
||||
|
||||
if (!SystemInfo.Instance.DisableFilteringQuantity)
|
||||
{
|
||||
try
|
||||
DataTable filterTable = gridView.GetGridViewFilteredAndSortedDataToDataTable();
|
||||
DataRow[] dataRowArray = filterTable.Select();
|
||||
DevExpress.XtraEditors.Controls.CheckedListBoxItemCollection _Items = new DevExpress.XtraEditors.Controls.CheckedListBoxItemCollection();
|
||||
|
||||
for (int i = 0; i < e.CheckedComboBox.Items.Count(); i++)
|
||||
{
|
||||
CheckedListBoxItem checkedListBoxItem = e.CheckedComboBox.Items[i];
|
||||
if (checkedListBoxItem.Value is FilterItem)
|
||||
try
|
||||
{
|
||||
CheckedListBoxItem checkedListBoxItem = e.CheckedComboBox.Items[i];
|
||||
if (checkedListBoxItem.Value is FilterItem)
|
||||
{
|
||||
FilterItem filterItem = (FilterItem)checkedListBoxItem.Value;
|
||||
string text = filterItem.Text;
|
||||
object value = filterItem.Value;
|
||||
int count = dataRowArray.Where(n => (n[e.Column.FieldName] + "").Equals(value + "")).Count();
|
||||
checkedListBoxItem.Description = $"{text} ({count})";
|
||||
if (count > 0) _Items.Add(checkedListBoxItem);
|
||||
}
|
||||
}
|
||||
finally
|
||||
{
|
||||
FilterItem filterItem = (FilterItem)checkedListBoxItem.Value;
|
||||
string text = filterItem.Text;
|
||||
object value = filterItem.Value;
|
||||
int count = filterTable.Select().Where(n => (n[e.Column.FieldName] + "").Equals(value + "")).Count();
|
||||
checkedListBoxItem.Description = $"{text} ({count})";
|
||||
}
|
||||
}
|
||||
finally
|
||||
//多表头在使用自带的搜索功能时(ctrl+f),筛选框无法过滤搜索后的内容,根据判断是否有搜索值去手动过滤
|
||||
bool isSearch = !string.IsNullOrWhiteSpace(gridView.FindFilterText);
|
||||
if (isSearch)
|
||||
{
|
||||
e.CheckedComboBox.Items.Clear();
|
||||
for (int i = 0; i < _Items.Count; i++)
|
||||
{
|
||||
e.CheckedComboBox.Items.Add(_Items[i]);
|
||||
}
|
||||
e.CheckedComboBox.HighlightedItemStyle = HighlightStyle.Skinned;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
||||
@@ -133,7 +133,7 @@ namespace Lskj.Control
|
||||
hasBoolean = true;
|
||||
}
|
||||
GridColumnModel model = col.Tag as GridColumnModel;
|
||||
if (model != null && (model.FieldType == ControlType.LabMultiSelectValue || model.FieldType == ControlType.LabMultiSelectValueParam))
|
||||
if (model != null && (model.FieldType == ControlType.LabMultiSelectValue || model.FieldType == ControlType.LabMultiSelectValueNew || model.FieldType == ControlType.LabTreeLookValue || model.FieldType == ControlType.LabMultiSelectValueParam || model.FieldType == ControlType.LabSelectReturnId))
|
||||
{
|
||||
StoreValueList.Add(col.FieldName);
|
||||
}
|
||||
@@ -262,7 +262,7 @@ namespace Lskj.Control
|
||||
{
|
||||
GridColumnModel model = gridColumn.Tag as GridColumnModel;
|
||||
|
||||
if ((model.FieldType == ControlType.LabMultiSelectValue ||
|
||||
if ((model.FieldType == ControlType.LabMultiSelectValue || model.FieldType == ControlType.LabMultiSelectValueNew ||
|
||||
model.FieldType == ControlType.LabMultiSelectValueParam) && row[col.ColumnName].ToString().Contains(","))
|
||||
{
|
||||
string[] cellText = row[col.ColumnName].ToString().Split(',');
|
||||
@@ -454,7 +454,7 @@ namespace Lskj.Control
|
||||
}
|
||||
GridColumnModel model = col.Tag as GridColumnModel;
|
||||
|
||||
if (model != null && (model.FieldType == ControlType.LabMultiSelectValue || model.FieldType == ControlType.LabTreeLookValue || model.FieldType == ControlType.LabMultiSelectValueParam)|| model.FieldType == ControlType.LabSelectReturnId)
|
||||
if (model != null && (model.FieldType == ControlType.LabMultiSelectValue || model.FieldType == ControlType.LabMultiSelectValueNew || model.FieldType == ControlType.LabTreeLookValue || model.FieldType == ControlType.LabMultiSelectValueParam || model.FieldType == ControlType.LabSelectReturnId))
|
||||
{
|
||||
StoreValueList.Add(col.FieldName);
|
||||
}
|
||||
@@ -514,6 +514,10 @@ namespace Lskj.Control
|
||||
if (datetimeList.Contains(col.ColumnName))
|
||||
{
|
||||
newCol.DataType = typeof(DateTime);
|
||||
//if (dictionary.ContainsKey(col.ColumnName) && (dictionary[col.ColumnName] == (int)ControlType.LabDateTime || dictionary[col.ColumnName] == (int)ControlType.LabCheckDateTimeEx))
|
||||
//{
|
||||
// newCol.DataType = typeof(String);//年月日时分秒格式转成String类型。excel表格中时间格式没有这种类型(yyyy-MM-dd HH:mm:ss)
|
||||
//}
|
||||
}
|
||||
if (StoreValueList.Contains(col.ColumnName))
|
||||
{
|
||||
@@ -615,7 +619,7 @@ namespace Lskj.Control
|
||||
{
|
||||
GridColumnModel model = gridColumn.Tag as GridColumnModel;
|
||||
//|| model.FieldType == ControlType.LabSelectReturnId
|
||||
if ((model.FieldType == ControlType.LabMultiSelectValue ||
|
||||
if ((model.FieldType == ControlType.LabMultiSelectValue || model.FieldType == ControlType.LabMultiSelectValueNew ||
|
||||
model.FieldType == ControlType.LabMultiSelectValueParam ) && row[col.ColumnName].ToString().Contains(","))
|
||||
{
|
||||
string[] cellText = row[col.ColumnName].ToString().Split(',');
|
||||
@@ -938,6 +942,7 @@ namespace Lskj.Control
|
||||
if (model != null && !ValueGridColumnTable.ContainsKey(model))
|
||||
{
|
||||
if (model.FieldType == ControlType.LabMultiSelectValue
|
||||
|| model.FieldType == ControlType.LabMultiSelectValueNew
|
||||
|| model.FieldType == ControlType.LabTreeLookValue
|
||||
|| model.FieldType == ControlType.LabMultiSelectValueParam)
|
||||
{
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -146,7 +146,7 @@ namespace Lskj.Control
|
||||
hasBoolean = true;
|
||||
}
|
||||
GridColumnModel model = col.Tag as GridColumnModel;
|
||||
if (model != null && (model.FieldType == ControlType.LabMultiSelectValue || model.FieldType == ControlType.LabTreeLookValue))
|
||||
if (model != null && (model.FieldType == ControlType.LabMultiSelectValue || model.FieldType == ControlType.LabMultiSelectValueNew || model.FieldType == ControlType.LabTreeLookValue))
|
||||
{
|
||||
StoreValueList.Add(col.FieldName);
|
||||
}
|
||||
@@ -297,7 +297,7 @@ namespace Lskj.Control
|
||||
{
|
||||
GridColumnModel model = gridColumn.Tag as GridColumnModel;
|
||||
|
||||
if ((model.FieldType == ControlType.LabMultiSelectValue ||
|
||||
if ((model.FieldType == ControlType.LabMultiSelectValue || model.FieldType == ControlType.LabMultiSelectValueNew ||
|
||||
model.FieldType == ControlType.LabMultiSelectValueParam) && row[col.ColumnName].ToString().Contains(","))
|
||||
{
|
||||
string[] cellText = row[col.ColumnName].ToString().Split(',');
|
||||
@@ -564,7 +564,7 @@ namespace Lskj.Control
|
||||
GridColumnModel model = col.Tag as GridColumnModel;
|
||||
if (model != null && !ValueGridColumnTable.ContainsKey(model))
|
||||
{
|
||||
if (model.FieldType == ControlType.LabMultiSelectValue
|
||||
if (model.FieldType == ControlType.LabMultiSelectValue || model.FieldType == ControlType.LabMultiSelectValueNew
|
||||
|| model.FieldType == ControlType.LabTreeLookValue)
|
||||
{
|
||||
string sqlValue = model.SqlSource;
|
||||
@@ -609,36 +609,4 @@ namespace Lskj.Control
|
||||
/// <para>修改人:</para>
|
||||
/// <para>修改日期:</para>
|
||||
/// <para>修改备注:</para>
|
||||
/// <para>版本:1.0.0.3</para>
|
||||
/// </summary>
|
||||
/// <param name="control">The control.</param>
|
||||
/// <returns>DataTable.</returns>
|
||||
public string GetValueByImportText(GridColumnModel model, string text, bool isBillImport = false)
|
||||
{
|
||||
string value = text;
|
||||
|
||||
Dictionary<string, string> translationDict = null;
|
||||
if (ValueGridColumnTable.TryGetValue(model, out translationDict))
|
||||
{
|
||||
if (translationDict != null && translationDict.Count > 0)
|
||||
{
|
||||
if (translationDict.TryGetValue(text, out string translatedValue))
|
||||
{
|
||||
value = translatedValue;
|
||||
}
|
||||
else
|
||||
{
|
||||
value = text;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
value = "";
|
||||
}
|
||||
}
|
||||
return value;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
/// <para>版本
|
||||
@@ -862,8 +862,10 @@ namespace Lskj.Control
|
||||
this.cellHelper.AddAmountColumn(column, 11);
|
||||
break;
|
||||
case ControlType.LabMultiSelectValue:
|
||||
case ControlType.LabMultiSelectValueNew:
|
||||
case ControlType.LabMultiSelectValueParam:
|
||||
case ControlType.LabMultiSelectText:
|
||||
case ControlType.LabMultiSelectTextNew:
|
||||
case ControlType.LabMultiSelectTextParam:
|
||||
InitMutilEdit(column, model);
|
||||
break;
|
||||
@@ -3237,7 +3239,7 @@ namespace Lskj.Control
|
||||
}
|
||||
if (table != null && table.Rows.Count > 0 && table.Columns.Count > 0)
|
||||
{
|
||||
if ((model.FieldType == ControlType.LabMultiSelectValue || model.FieldType == ControlType.LabMultiSelectValueParam))
|
||||
if ((model.FieldType == ControlType.LabMultiSelectValue || model.FieldType == ControlType.LabMultiSelectValueNew || model.FieldType == ControlType.LabMultiSelectValueParam))
|
||||
{
|
||||
string[] values = (text + "").Trim(',').Split(',');
|
||||
string textNew = string.Empty;
|
||||
@@ -3928,7 +3930,7 @@ namespace Lskj.Control
|
||||
mutilLookUp.TextField = model.TextMember;
|
||||
mutilLookUp.SourceSQL = model.SqlSource;
|
||||
mutilLookUp.IsType = model.FieldType;
|
||||
mutilLookUp.ValueMember = model.FieldType == ControlType.LabMultiSelectValue ||
|
||||
mutilLookUp.ValueMember = (model.FieldType == ControlType.LabMultiSelectValue|| model.FieldType == ControlType.LabMultiSelectValueNew) ||
|
||||
model.FieldType == ControlType.LabMultiSelectValueParam ? model.ValueMember : model.TextMember;
|
||||
mutilLookUp.Tag = model;
|
||||
|
||||
@@ -3939,8 +3941,8 @@ namespace Lskj.Control
|
||||
btnEdit.AllowNullInput = DefaultBoolean.False;
|
||||
btnEdit.DisplayMember = model.TextMember;
|
||||
btnEdit.SeparatorChar = ',';
|
||||
btnEdit.ValueMember = model.FieldType == ControlType.LabMultiSelectValue || model.FieldType == ControlType.LabMultiSelectValueParam ? model.ValueMember : model.TextMember;
|
||||
if (!(model.FieldType == ControlType.LabMultiSelectTextParam || model.FieldType == ControlType.LabMultiSelectText))
|
||||
btnEdit.ValueMember = model.FieldType == ControlType.LabMultiSelectValue || model.FieldType == ControlType.LabMultiSelectValueNew || model.FieldType == ControlType.LabMultiSelectValueParam ? model.ValueMember : model.TextMember;
|
||||
if (!(model.FieldType == ControlType.LabMultiSelectTextParam || model.FieldType == ControlType.LabMultiSelectText || model.FieldType == ControlType.LabMultiSelectTextNew))
|
||||
{
|
||||
btnEdit.DataSource = MainImpl.GetDataTableResult(model.SqlSource);
|
||||
}
|
||||
@@ -6148,7 +6150,7 @@ namespace Lskj.Control
|
||||
GridColumnModel model = frmMain.Tag as GridColumnModel;
|
||||
frmMain.EditText = btnEdit.Text;
|
||||
frmMain.CurrentOperColumnKey = Model.ModuleCode + "_" + model.FieldName;
|
||||
if (model.FieldType == ControlType.LabMultiSelectValue || model.FieldType == ControlType.LabMultiSelectValueParam)
|
||||
if (model.FieldType == ControlType.LabMultiSelectValue || model.FieldType == ControlType.LabMultiSelectValueNew || model.FieldType == ControlType.LabMultiSelectValueParam)
|
||||
{
|
||||
frmMain.EditValue = btnEdit.EditValue + "";
|
||||
frmMain.EditText = string.Empty;
|
||||
@@ -6341,7 +6343,7 @@ namespace Lskj.Control
|
||||
GridColumnModel model = modelLookUp.Tag as GridColumnModel;
|
||||
modelLookUp.EditText = btnEdit.Text;
|
||||
modelLookUp.CurrentOperColumnKey = Model.ModuleCode + "_" + model.FieldName;
|
||||
if (model.FieldType == ControlType.LabMultiSelectValue || model.FieldType == ControlType.LabMultiSelectValueParam)
|
||||
if (model.FieldType == ControlType.LabMultiSelectValue || model.FieldType == ControlType.LabMultiSelectValueNew || model.FieldType == ControlType.LabMultiSelectValueParam)
|
||||
{
|
||||
modelLookUp.EditValue = btnEdit.EditValue + "";
|
||||
modelLookUp.EditText = string.Empty;
|
||||
@@ -6453,7 +6455,7 @@ namespace Lskj.Control
|
||||
GridColumnModel model = modelLookUp.Tag as GridColumnModel;
|
||||
modelLookUp.EditText = btnEdit.Text;
|
||||
modelLookUp.CurrentOperColumnKey = Model.ModuleCode + "_" + model.FieldName;
|
||||
if (model.FieldType == ControlType.LabMultiSelectValue || model.FieldType == ControlType.LabMultiSelectValueParam)
|
||||
if (model.FieldType == ControlType.LabMultiSelectValue || model.FieldType == ControlType.LabMultiSelectValueNew || model.FieldType == ControlType.LabMultiSelectValueParam)
|
||||
{
|
||||
modelLookUp.EditValue = btnEdit.EditValue + "";
|
||||
modelLookUp.EditText = string.Empty;
|
||||
@@ -7144,7 +7146,6 @@ namespace Lskj.Control
|
||||
try
|
||||
{
|
||||
GridView gridView = (GridView)sender;
|
||||
DataTable filterTable = gridView.GetFilteredAndSortedDataTable();
|
||||
string actStr = this.gridView.ActiveFilterString;//获取筛选条件
|
||||
string[] actStr_list = actStr.Split(new string[] { "And" }, StringSplitOptions.None);
|
||||
|
||||
@@ -7259,27 +7260,30 @@ namespace Lskj.Control
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
DataRow[] dataRowArray = filterTable.Select();
|
||||
for (int i = 0; i < e.CheckedComboBox.Items.Count(); i++)
|
||||
if (!SystemInfo.Instance.DisableFilteringQuantity)
|
||||
{
|
||||
try
|
||||
DataTable filterTable = gridView.GetGridViewFilteredAndSortedDataToDataTable();
|
||||
DataRow[] dataRowArray = filterTable.Select();
|
||||
for (int i = 0; i < e.CheckedComboBox.Items.Count(); i++)
|
||||
{
|
||||
CheckedListBoxItem checkedListBoxItem = e.CheckedComboBox.Items[i];
|
||||
if (checkedListBoxItem.Value is FilterItem)
|
||||
try
|
||||
{
|
||||
CheckedListBoxItem checkedListBoxItem = e.CheckedComboBox.Items[i];
|
||||
if (checkedListBoxItem.Value is FilterItem)
|
||||
{
|
||||
FilterItem filterItem = (FilterItem)checkedListBoxItem.Value;
|
||||
string text = filterItem.Text;
|
||||
object value = filterItem.Value;
|
||||
int count = dataRowArray.Where(n => (n[e.Column.FieldName] + "").Equals(value + "")).Count();
|
||||
checkedListBoxItem.Description = $"{text} ({count})";
|
||||
}
|
||||
}
|
||||
finally
|
||||
{
|
||||
FilterItem filterItem = (FilterItem)checkedListBoxItem.Value;
|
||||
string text = filterItem.Text;
|
||||
object value = filterItem.Value;
|
||||
int count = dataRowArray.Where(n => (n[e.Column.FieldName] + "").Equals(value + "")).Count();
|
||||
checkedListBoxItem.Description = $"{text} ({count})";
|
||||
}
|
||||
}
|
||||
finally
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
@@ -8251,4 +8255,36 @@ namespace Lskj.Control
|
||||
{
|
||||
int returnIndex = 0;
|
||||
isContain = false;
|
||||
DataRow dragEn
|
||||
DataRow dragEndRow = sourceTab.Rows[dragEndRowIndex];
|
||||
if (selectRows.Contains(dragEndRow))
|
||||
{
|
||||
isContain = true;
|
||||
dragEndRowIndex = dragEndRowIndex - 1;
|
||||
if (dragEndRowIndex >= 0)
|
||||
{
|
||||
dragEndRow = sourceTab.Rows[dragEndRowIndex];
|
||||
if (selectRows.Contains(dragEndRow))
|
||||
{
|
||||
bool iscontain = false;
|
||||
returnIndex = GetDragEndRowIndex(sourceTab, dragEndRowIndex, selectRows, out iscontain);
|
||||
}
|
||||
else
|
||||
{
|
||||
returnIndex = dragEndRowIndex;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
returnIndex = -1;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
returnIndex = dragEndRowIndex;
|
||||
}
|
||||
return returnIndex;
|
||||
}
|
||||
#endregion
|
||||
|
||||
}
|
||||
}
|
||||
@@ -86,6 +86,7 @@ namespace Lskj.Control
|
||||
this.lblText.Location = new System.Drawing.Point(0, 0);
|
||||
this.lblText.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
|
||||
this.txtEdit.Properties.AutoHeight = false;
|
||||
this.txtEdit.Properties.AppearanceDropDown.Font = this.txtEdit.Properties.Appearance.Font;//下拉框里的字体和选中框中的保持一致
|
||||
this.plLeft.Width = value.Length * GetCharWidth();
|
||||
|
||||
GetCharWidthMultilingual(this.lblText, this.lblText.Text, this.plLeft);
|
||||
|
||||
@@ -201,7 +201,7 @@ namespace Lskj.Control
|
||||
{
|
||||
get
|
||||
{
|
||||
string value = Model.FieldType == ControlType.LabMultiSelectValue || Model.FieldType == ControlType.LabCheckMultiSelectValue || Model.FieldType == ControlType.LabMultiSelectValueParam ? _lookUpForm.EditValue : _lookUpForm.EditText;
|
||||
string value = Model.FieldType == ControlType.LabMultiSelectValue || Model.FieldType == ControlType.LabMultiSelectValueNew || Model.FieldType == ControlType.LabCheckMultiSelectValue || Model.FieldType == ControlType.LabMultiSelectValueParam ? _lookUpForm.EditValue : _lookUpForm.EditText;
|
||||
if (string.IsNullOrEmpty(value))
|
||||
{
|
||||
//直接点击保存时,弹出框里不会返回数据,直接用初始化时赋的值
|
||||
@@ -350,6 +350,7 @@ namespace Lskj.Control
|
||||
public override bool IsUpdate()
|
||||
{
|
||||
if (Model.FieldType == ControlType.LabMultiSelectValue ||
|
||||
Model.FieldType == ControlType.LabMultiSelectValueNew ||
|
||||
Model.FieldType == ControlType.LabMultiSelectValueParam)
|
||||
{
|
||||
return !this.Model.Text.Equals(this.EditValue, StringComparison.OrdinalIgnoreCase);
|
||||
@@ -419,4 +420,5 @@ namespace Lskj.Control
|
||||
string sqlValue = string.Empty;
|
||||
if (this.ControlObj != null)
|
||||
{
|
||||
sqlValue = this.Co
|
||||
sqlValue = this.ControlObj.ReplaceControlValue(Model.SourceSql);
|
||||
|
||||
@@ -263,6 +263,7 @@ namespace Lskj.Control
|
||||
public override bool IsUpdate()
|
||||
{
|
||||
if (Model.FieldType == ControlType.LabMultiSelectValue ||
|
||||
Model.FieldType == ControlType.LabMultiSelectValueNew ||
|
||||
Model.FieldType == ControlType.LabMultiSelectValueParam)
|
||||
{
|
||||
return !this.Model.Text.Equals(this.EditValue, StringComparison.OrdinalIgnoreCase);
|
||||
|
||||
@@ -268,6 +268,7 @@ namespace Lskj.Control
|
||||
public override bool IsUpdate()
|
||||
{
|
||||
if (Model.FieldType == ControlType.LabMultiSelectValue ||
|
||||
Model.FieldType == ControlType.LabMultiSelectValueNew ||
|
||||
Model.FieldType == ControlType.LabMultiSelectValueParam)
|
||||
{
|
||||
return !this.Model.Text.Equals(this.EditValue, StringComparison.OrdinalIgnoreCase);
|
||||
|
||||
@@ -161,7 +161,9 @@ namespace Lskj.Control.Model
|
||||
checkDateEdit.TextEdit.Tag = "Changed";
|
||||
break;
|
||||
case ControlType.LabMultiSelectText:
|
||||
case ControlType.LabMultiSelectTextNew:
|
||||
case ControlType.LabMultiSelectValue:
|
||||
case ControlType.LabMultiSelectValueNew:
|
||||
case ControlType.LabMultiSelectValueParam:
|
||||
case ControlType.LabMultiSelectTextParam:
|
||||
// 多选控件
|
||||
|
||||
@@ -287,4 +287,11 @@ namespace Lskj.Control.Model
|
||||
/// <value>The LookUpFieldsWidth.</value>
|
||||
public string LookUpFieldsWidth { get; set; }
|
||||
/// <summary>
|
||||
///文本框禁编(不是禁编状态,可以点击按钮,但是不能��
|
||||
///文本框禁编(不是禁编状态,可以点击按钮,但是不能手动输入)
|
||||
/// </summary>
|
||||
public bool TextBoxProhibition { get; set; }
|
||||
/// <summary>
|
||||
/// 条件
|
||||
/// </summary>
|
||||
public string SplicingConditions;
|
||||
/// <su
|
||||
@@ -108,10 +108,18 @@ namespace Lskj.Control.Model
|
||||
/// </summary>
|
||||
public const int LabMultiSelectValue = 13;
|
||||
/// <summary>
|
||||
/// 多选框,保存Value值,显示Text值
|
||||
/// </summary>
|
||||
public const int LabMultiSelectValueNew = 130;
|
||||
/// <summary>
|
||||
/// 多选框,保存Text值,显示Text值
|
||||
/// </summary>
|
||||
public const int LabMultiSelectText = 14;
|
||||
/// <summary>
|
||||
/// 多选框,保存Text值,显示Text值
|
||||
/// </summary>
|
||||
public const int LabMultiSelectTextNew = 131;
|
||||
/// <summary>
|
||||
/// 多选框(带复选框),保存Value值,显示Text值
|
||||
/// </summary>
|
||||
public const int LabCheckMultiSelectValue = 213;
|
||||
@@ -434,6 +442,7 @@ namespace Lskj.Control.Model
|
||||
fieldType == LabAutoCompleteValue ||
|
||||
fieldType == LabMultiSelectValueParam ||
|
||||
fieldType == LabMultiSelectValue ||
|
||||
fieldType == LabMultiSelectValueNew ||
|
||||
fieldType == LabCheckMultiSelectValueParam ||
|
||||
fieldType == LabCheckMultiSelectValue ||
|
||||
fieldType == LabGridPopupValue ||
|
||||
@@ -514,28 +523,4 @@ namespace Lskj.Control.Model
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 不需要根据数据源sql获取数据源的控件
|
||||
/// </summary>
|
||||
/// <param name="fieldType"></param>
|
||||
/// <returns></returns>
|
||||
public static bool IsNotLoadData(int fieldType)
|
||||
{
|
||||
return fieldType == LabText ||
|
||||
fieldType == LabDate ||
|
||||
fieldType == LabDateTime ||
|
||||
fieldType == LabDateTimeShort ||
|
||||
fieldType == LabTime ||
|
||||
fieldType == LabShortTime ||
|
||||
fieldType == LabTextInt ||
|
||||
fieldType == LabPassWordValue ||
|
||||
fieldType == LabRemark ||
|
||||
fieldType == LabMemoEdit ||
|
||||
fieldType == LabWWW ||
|
||||
fieldType == LabQQ ||
|
||||
fieldType == LabPhone ||
|
||||
fieldType == LabSelectReturnIdNew ||
|
||||
fieldType == LabSelectReturnTextNew ||
|
||||
fieldType == LabApiBtuton;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -47,6 +47,8 @@ using DevExpress.XtraTab;
|
||||
using NPOI.SS.Util;
|
||||
using DevExpress.Data;
|
||||
using DevExpress.Data.Filtering;
|
||||
using System.Data.SqlClient;
|
||||
using DevExpress.Utils;
|
||||
|
||||
namespace Lskj.Control.Model
|
||||
{
|
||||
@@ -2092,6 +2094,7 @@ namespace Lskj.Control.Model
|
||||
model.FieldType == ControlType.LabAutoCompleteValue ||
|
||||
model.FieldType == ControlType.LabAutoCompleteValueParam ||
|
||||
model.FieldType == ControlType.LabMultiSelectValue ||
|
||||
model.FieldType == ControlType.LabMultiSelectValueNew ||
|
||||
model.FieldType == ControlType.LabMultiSelectValueParam
|
||||
|| model.FieldType == ControlType.LabTreeLookValue
|
||||
|| model.FieldType == ControlType.LabCheckBox
|
||||
@@ -2102,7 +2105,7 @@ namespace Lskj.Control.Model
|
||||
{
|
||||
bool isEmpty = model.CanNull;
|
||||
string fieldValue = GetValueByImportText(dataRow, col.FieldName, cell + "", isBillImport);
|
||||
if ((model.FieldType == ControlType.LabMultiSelectValue ||
|
||||
if ((model.FieldType == ControlType.LabMultiSelectValue || model.FieldType == ControlType.LabMultiSelectValueNew ||
|
||||
model.FieldType == ControlType.LabMultiSelectValueParam) && cell.ToString().Contains(","))
|
||||
{
|
||||
string[] cellText = cell.ToString().Split(',');
|
||||
@@ -2428,6 +2431,7 @@ namespace Lskj.Control.Model
|
||||
model.FieldType == ControlType.LabAutoCompleteValue ||
|
||||
model.FieldType == ControlType.LabAutoCompleteValueParam ||
|
||||
model.FieldType == ControlType.LabMultiSelectValue ||
|
||||
model.FieldType == ControlType.LabMultiSelectValueNew ||
|
||||
model.FieldType == ControlType.LabMultiSelectValueParam
|
||||
|| model.FieldType == ControlType.LabTreeLookValue
|
||||
|| model.FieldType == ControlType.LabCheckBox
|
||||
@@ -2438,7 +2442,7 @@ namespace Lskj.Control.Model
|
||||
{
|
||||
bool isEmpty = model.CanNull;
|
||||
string fieldValue = GetValueByImportText(dataRow, col.FieldName, cell + "", isBillImport);
|
||||
if ((model.FieldType == ControlType.LabMultiSelectValue ||
|
||||
if ((model.FieldType == ControlType.LabMultiSelectValue || model.FieldType == ControlType.LabMultiSelectValueNew ||
|
||||
model.FieldType == ControlType.LabMultiSelectValueParam) && cell.ToString().Contains(","))
|
||||
{
|
||||
string[] cellText = cell.ToString().Split(',');
|
||||
@@ -2593,6 +2597,467 @@ namespace Lskj.Control.Model
|
||||
|
||||
|
||||
|
||||
|
||||
public static bool QuickImport(this GridView gridView, ModuleModel SysModel, string parmaryKey, string leftField, string leftValue,List<string> ImportReturnName, List<string> ImportReturnValue, GridControlEx ParentGridEx=null )
|
||||
{
|
||||
OpenFileDialog dialog = new OpenFileDialog();
|
||||
dialog.Title = "选择导入文件";
|
||||
// dialog.Filter = "Excel|*.xls|Excel|*.xlsx";
|
||||
dialog.Filter = SystemInfo.Instance.IsXlsxFirst ? "Excel文件(*.xlsx)|*.xlsx|Excel文件(*.xls)|*.xls" :
|
||||
"Excel文件(*.xls)|*.xls|Excel文件(*.xlsx)|*.xlsx";
|
||||
DialogResult ImportResult = dialog.ShowDialog();
|
||||
DataTable ImportTable = new DataTable();
|
||||
if (ImportResult == DialogResult.OK)
|
||||
{
|
||||
string _importFlag = "lskjimport_errorFlag";
|
||||
DataTable tableColumns = BaseModuleImpl.GetBaseGridColumns(SysModel.ModeCode);
|
||||
GridControlEx gridControlEx = new GridControlEx();
|
||||
if (gridView is BandedGridView && tableColumns != null && tableColumns.Rows.Count > 0)
|
||||
{
|
||||
gridControlEx = new BandedGridControlEx();
|
||||
(gridControlEx as BandedGridControlEx).moduleModel = SysModel;
|
||||
gridControlEx.SetReadOnlyColumns(tableColumns, GridCustomColumnStruct.BaseMainGridView + SysModel.FormKey);
|
||||
GridBand gridBand = new GridBand();
|
||||
gridBand.Caption = "导入消息";
|
||||
gridBand.AppearanceHeader.Options.UseFont = true;
|
||||
gridBand.AppearanceHeader.Font = new Font("宋体", 9, FontStyle.Bold);
|
||||
gridBand.AppearanceHeader.Options.UseTextOptions = true;
|
||||
gridBand.AppearanceHeader.TextOptions.HAlignment = HorzAlignment.Center;
|
||||
(gridControlEx.GridView as BandedGridView).Bands.AddRange(new GridBand[] { gridBand });
|
||||
//BandedGridColumn
|
||||
BandedGridColumn colMsg = new BandedGridColumn();
|
||||
colMsg.Tag = null;
|
||||
colMsg.FieldName = "import_errormsg";
|
||||
colMsg.Width = 200;
|
||||
colMsg.Caption = "导入错误信息";
|
||||
colMsg.Visible = true;
|
||||
colMsg.OwnerBand = gridBand;
|
||||
gridControlEx.GridView.Columns.Add(colMsg);
|
||||
BandedGridColumn RegressionMsg = new BandedGridColumn();
|
||||
RegressionMsg.Tag = null;
|
||||
RegressionMsg.FieldName = _importFlag;
|
||||
RegressionMsg.Width = 200;
|
||||
RegressionMsg.Caption = "是否导入成功";
|
||||
RegressionMsg.Visible = true;
|
||||
RegressionMsg.OwnerBand = gridBand;
|
||||
gridControlEx.GridView.Columns.Add(RegressionMsg);
|
||||
}
|
||||
else
|
||||
{
|
||||
gridControlEx.SetEditColumns(tableColumns, GridCustomColumnStruct.BaseMainGridView + SysModel.FormKey);
|
||||
gridControlEx.GridView.OptionsBehavior.Editable = false;//禁止编辑
|
||||
GridColumn colMsg = new GridColumn();
|
||||
colMsg.Tag = null;
|
||||
colMsg.FieldName = "import_errormsg";
|
||||
colMsg.Width = 200;
|
||||
colMsg.Caption = "导入错误信息";
|
||||
colMsg.Visible = true;
|
||||
gridControlEx.GridView.Columns.Add(colMsg);
|
||||
GridColumn RegressionMsg = new GridColumn();
|
||||
RegressionMsg.Tag = null;
|
||||
RegressionMsg.FieldName = _importFlag;
|
||||
RegressionMsg.Width = 200;
|
||||
RegressionMsg.Caption = "是否导入成功";
|
||||
RegressionMsg.Visible = true;
|
||||
gridControlEx.GridView.Columns.Add(RegressionMsg);
|
||||
|
||||
}
|
||||
|
||||
if (!BaseImpl.HasExistsColumn(SysModel.MenuTable,_importFlag))
|
||||
{
|
||||
BaseImpl.ExecSqlValue(string.Format("alter table {0} add {1} varchar(20) default('0')", SysModel.MenuTable, _importFlag));
|
||||
}
|
||||
|
||||
string fileName = dialog.FileName;
|
||||
string colFields = gridControlEx.GridView.Columns.ToString(',');
|
||||
ImportTable = gridControlEx.GridView.ToExcelDataTable(fileName, colFields, true);
|
||||
|
||||
|
||||
if (ImportTable==null&&ImportTable.Rows.Count < 1)
|
||||
{
|
||||
MessageBox.Show("没有任何数据可以进行导入", "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning);
|
||||
return false;
|
||||
}
|
||||
//if (MessageUtil.Show("如果导入数据量太多将花费较长时间,是否确认导入", MessageBoxButtons.YesNo) != DialogResult.Yes)
|
||||
// return false;
|
||||
//设置默认值
|
||||
if (SystemInfo.Instance.ImportDefaultValue)
|
||||
{
|
||||
foreach (GridColumn col in gridView.VisibleColumns)
|
||||
{
|
||||
if (!ImportTable.Columns.Contains(col.FieldName)) ImportTable.Columns.Add(col.FieldName);
|
||||
}
|
||||
|
||||
foreach (DataRow rowItem in ImportTable.Rows)
|
||||
{
|
||||
foreach (GridColumn col in gridView.VisibleColumns)
|
||||
{
|
||||
// 未包含字段,则使用控件默认值.
|
||||
GridColumnModel model = col.Tag as GridColumnModel;
|
||||
if (model != null && !string.IsNullOrEmpty(model.DefaultValue))
|
||||
{
|
||||
if (!string.IsNullOrEmpty(rowItem[col.FieldName] + "")) continue;
|
||||
string fieldValue = ReplaceHelper.ReplaceRowParam(rowItem, model.DefaultValue);
|
||||
if (ParentGridEx != null)
|
||||
{
|
||||
DataRow SelectTheLine = ParentGridEx.GetViewFocusedDataRow();
|
||||
fieldValue = ReplaceHelper.ReplaceRowParam(SelectTheLine, fieldValue);
|
||||
}
|
||||
fieldValue = BaseImpl.GetDefaultValue(fieldValue);
|
||||
if (!string.IsNullOrEmpty(fieldValue))
|
||||
{
|
||||
rowItem[col.FieldName] = fieldValue;
|
||||
if (!string.IsNullOrEmpty(model.UnionFields))
|
||||
{
|
||||
SetUnionValue(model, rowItem[col.FieldName] + "", rowItem);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
//判断导入条件
|
||||
if (!string.IsNullOrEmpty(SysModel.ImportConditions))
|
||||
{
|
||||
List<int> ErrorLine = new List<int>();
|
||||
|
||||
int currRow = 0;
|
||||
foreach (DataRow dr in ImportTable.Rows)
|
||||
{
|
||||
currRow++;
|
||||
string cond = ReplaceHelper.ReplaceRowParam(dr, SysModel.ImportConditions);
|
||||
if (ParentGridEx != null)
|
||||
{
|
||||
DataRow SelectTheLine = ParentGridEx.GetViewFocusedDataRow();
|
||||
cond = ReplaceHelper.ReplaceRowParam(SelectTheLine, cond);
|
||||
}
|
||||
bool result = false;
|
||||
if (cond.StartsWith("@") || cond.StartsWith("!"))
|
||||
{
|
||||
result = "1".Equals(BaseImpl.GetDefaultValue(cond));
|
||||
}
|
||||
else
|
||||
{
|
||||
result = ReplaceHelper.ReplaceRowParamCond(dr, cond);
|
||||
}
|
||||
if (!result)
|
||||
{
|
||||
ErrorLine.Add(currRow);
|
||||
}
|
||||
}
|
||||
if (ErrorLine.Count > 0)
|
||||
{
|
||||
XtraMessageBox.Show("导入失败,第" + String.Join(", ", ErrorLine) + "条不满足条件", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
//开始导入
|
||||
//提交到数据库
|
||||
string rowNum = "0";
|
||||
string colNum = "0";
|
||||
string colName = "";
|
||||
int success = 0;
|
||||
int failed = 0;
|
||||
|
||||
List<string> _calcFields = new List<string>();
|
||||
DataTable dtCalcFields = BaseImpl.GetDataTableResult(string.Format("select name from sys.columns where object_id=object_id('{0}') and is_computed=1", SysModel.MenuTable));
|
||||
if ((dtCalcFields != null) && (dtCalcFields.Rows.Count > 0))
|
||||
{
|
||||
foreach (DataRow dr in dtCalcFields.Rows)
|
||||
{
|
||||
_calcFields.Add(dr[0] + "");
|
||||
}
|
||||
}
|
||||
try
|
||||
{
|
||||
string sql = "select * from " + SysModel.MenuTable + " where 1<>1";
|
||||
SqlDataAdapter dat = BaseImpl.GetAdapterResult(sql);
|
||||
SqlCommandBuilder scb = new SqlCommandBuilder(dat);
|
||||
DataTable datatb = new DataTable();
|
||||
DataTable failedData = new DataTable();
|
||||
dat.Fill(datatb);
|
||||
if (ImportReturnName.Count > 0)
|
||||
{
|
||||
foreach (string item in ImportReturnName)
|
||||
{
|
||||
if (!ImportTable.Columns.Contains(item))
|
||||
ImportTable.Columns.Add(item);
|
||||
}
|
||||
}
|
||||
failedData = ImportTable.Clone();
|
||||
|
||||
if (!failedData.Columns.Contains("import_errormsg"))
|
||||
failedData.Columns.Add("import_errormsg");
|
||||
if (!failedData.Columns.Contains(_importFlag))
|
||||
failedData.Columns.Add(_importFlag);
|
||||
|
||||
for (int i = 0; i < ImportTable.Rows.Count; i++)
|
||||
{
|
||||
ImportTable.Rows[i][_importFlag] = "1";
|
||||
if (ImportReturnName.Count > 0)
|
||||
{
|
||||
for (int j = 0; j < ImportReturnName.Count; j++)
|
||||
{
|
||||
string name = ImportReturnName[j];
|
||||
string Value = ImportReturnValue[j];
|
||||
ImportTable.Rows[i][name] = Value;
|
||||
}
|
||||
}
|
||||
}
|
||||
//所有导入的主键集合
|
||||
List<string> parmaryKeys = new List<string>();
|
||||
|
||||
//根据全表字段类型进行默认填充
|
||||
int currRow = 0;
|
||||
foreach (DataRow dr in ImportTable.Rows)
|
||||
{
|
||||
if (SysModel.ImportPrimarykeyVerify && !string.IsNullOrWhiteSpace(parmaryKey))
|
||||
{
|
||||
if (parmaryKeys.Contains(dr[parmaryKey]))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
else
|
||||
{
|
||||
parmaryKeys.Add(dr[parmaryKey] + "");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
rowNum = (currRow + 1) + "";
|
||||
DataRow tmpRow = datatb.NewRow();
|
||||
foreach (DataColumn dc in datatb.Columns)
|
||||
{
|
||||
if (dc.DataType.Name.ToLower() == "string")
|
||||
tmpRow[dc] = "";
|
||||
if (dc.DataType.Name.ToLower().IndexOf("char") >= 0)
|
||||
tmpRow[dc] = "";
|
||||
if (dc.DataType.Name.ToLower().IndexOf("int") >= 0)
|
||||
tmpRow[dc] = 0;
|
||||
if (dc.DataType.Name.ToLower() == "decimal")
|
||||
tmpRow[dc] = 0;
|
||||
}
|
||||
foreach (GridColumn gc in gridControlEx.GridView.Columns)
|
||||
{
|
||||
if (_calcFields.IndexOf(gc.FieldName) != -1)
|
||||
continue;
|
||||
if (datatb.Columns.Contains(gc.FieldName) && ImportTable.Columns.Contains(gc.FieldName))
|
||||
{
|
||||
colName = gc.Caption;
|
||||
colNum = (gc.VisibleIndex + 1) + "";
|
||||
GridColumnModel model = gc.Tag as GridColumnModel;
|
||||
bool isEmpty = false;
|
||||
if (model != null)
|
||||
{
|
||||
isEmpty = model.CanNull;
|
||||
}
|
||||
if (model != null && (model.FieldType == ControlType.LabTreeType ||
|
||||
model.FieldType == ControlType.LabComboxValue ||
|
||||
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 ||
|
||||
model.FieldType == ControlType.LabSelectReturnId
|
||||
))
|
||||
{
|
||||
string fieldValue = GetValueByImportText(dr, gc.FieldName, dr[gc.FieldName] + "");
|
||||
if (!string.IsNullOrEmpty(fieldValue))
|
||||
{
|
||||
tmpRow[gc.FieldName] = fieldValue;
|
||||
}
|
||||
}
|
||||
else if (model != null && (model.FieldType == ControlType.LabDate ||
|
||||
model.FieldType == ControlType.LabDateTime ||
|
||||
model.FieldType == ControlType.LabDateTimeShort ||
|
||||
model.FieldType == ControlType.LabTime ||
|
||||
model.FieldType == ControlType.LabShortTime))
|
||||
{
|
||||
string fieldValue = ToDateTimeValue(dr[gc.FieldName].ToString().Trim());
|
||||
if (!string.IsNullOrEmpty(fieldValue))
|
||||
{
|
||||
tmpRow[gc.FieldName] = fieldValue;
|
||||
}
|
||||
}
|
||||
else if (model != null && (model.FieldType == ControlType.LabRemark) && !dr[gc.FieldName].ToString().Contains("\r\n"))
|
||||
{
|
||||
string fieldValue = dr[gc.FieldName].ToString().Replace("\n", "\r\n");
|
||||
if (!string.IsNullOrEmpty(fieldValue))
|
||||
{
|
||||
tmpRow[gc.FieldName] = fieldValue;
|
||||
}
|
||||
}
|
||||
//排除数值型导入空值的可能
|
||||
else if (dr[gc.FieldName].ToString().Trim() != "")
|
||||
{
|
||||
GridColumn column = gridControlEx.GridView.Columns[gc.FieldName];
|
||||
|
||||
if (dr[gc.FieldName].ToString().Trim() == "校验")
|
||||
tmpRow[gc.FieldName] = "1";
|
||||
else if (dr[gc.FieldName].ToString().Trim() == "非校验")
|
||||
tmpRow[gc.FieldName] = "0";
|
||||
|
||||
string fieldValue = SystemInfo.Instance.ImportReservedSpaces ? dr[gc.FieldName].ToString() : dr[gc.FieldName].ToString().Trim();
|
||||
|
||||
if (fieldValue == "是" || fieldValue == "否")
|
||||
{
|
||||
if (column.ColumnEdit != null && column.ColumnEdit.GetType() == typeof(RepositoryItemCheckEdit))
|
||||
{
|
||||
tmpRow[gc.FieldName] = "1";
|
||||
}
|
||||
else if (column.ColumnType != null && column.ColumnType.Name.ToLower() == "boolean")
|
||||
{
|
||||
tmpRow[gc.FieldName] = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
tmpRow[gc.FieldName] = fieldValue;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
tmpRow[gc.FieldName] = fieldValue;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
setDefaultValue(datatb, tmpRow, SysModel.PrefixKey);
|
||||
|
||||
//if (mainKeyField != "")
|
||||
// tmpRow[mainKeyField] = mainKeyValue;
|
||||
|
||||
|
||||
|
||||
if (SysModel.ConcatenatedPrefix)
|
||||
{
|
||||
if (datatb.Columns.Contains(SysModel.PrefixKey + leftField) && !string.IsNullOrWhiteSpace(leftValue) && SysModel.AssociationLeft)
|
||||
{
|
||||
if (string.IsNullOrEmpty(tmpRow[SysModel.PrefixKey + leftField] + "") || (tmpRow[SysModel.PrefixKey + leftField] + "").Equals("0"))
|
||||
{
|
||||
tmpRow[SysModel.PrefixKey + leftField] = leftValue;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (datatb.Columns.Contains(leftField) && !string.IsNullOrWhiteSpace(leftValue) && SysModel.AssociationLeft)
|
||||
{
|
||||
if (string.IsNullOrEmpty(tmpRow[SysModel.PrefixKey + leftField] + "") || (tmpRow[SysModel.PrefixKey + leftField] + "").Equals("0"))
|
||||
{
|
||||
tmpRow[SysModel.PrefixKey + leftField] = leftValue;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
foreach (GridColumn gc in gridControlEx.GridView.VisibleColumns)
|
||||
{
|
||||
if (tmpRow.Table.Columns.Contains(gc.FieldName))
|
||||
{
|
||||
string fieldValue = tmpRow[gc.FieldName] + "";
|
||||
GridColumnModel model = gc.Tag as GridColumnModel;
|
||||
if (model != null)
|
||||
{
|
||||
if (model.CanNull && string.IsNullOrEmpty(fieldValue))//必填
|
||||
{
|
||||
XtraMessageBox.Show("数据导入错误,数据不能为空,请检查!\r\n第" + (currRow + 1).ToString() + "行,第" + (gc.VisibleIndex + 1).ToString() + "列-" + gc.Caption, "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
datatb.Rows.Add(tmpRow);
|
||||
try
|
||||
{
|
||||
dat.Update(datatb);
|
||||
datatb.AcceptChanges();
|
||||
success++;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
||||
dr.RowError = ex.Message;
|
||||
dr["import_errormsg"] = ex.Message;
|
||||
failedData.ImportRow(dr);
|
||||
datatb.Rows.Remove(tmpRow);
|
||||
failed++;
|
||||
//string Message = ErrorMessage.PromptErrorMessage(ex);
|
||||
//MessageUtil.Show(Message, ex.Message);
|
||||
break;
|
||||
}
|
||||
currRow++;
|
||||
}
|
||||
|
||||
ImportTable.AcceptChanges();
|
||||
XtraMessageBox.Show("数据导入完成,成功" + success.ToString() + "条,失败" + failed.ToString() + "条", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||||
if (failedData.Rows.Count > 0)
|
||||
{
|
||||
MessageUtil.Show(failedData.Rows[0]["import_errormsg"].ToString());
|
||||
string sqlValue2 = string.Format("delete from {0} where {1}='1'", SysModel.MenuTable, _importFlag);
|
||||
SqlHelper.ExecuteNonQuery(sqlValue2);
|
||||
|
||||
}
|
||||
|
||||
string sqlValue = string.Format("update {0} set {1}='0' ", SysModel.MenuTable, _importFlag);
|
||||
sqlValue = string.Format("update {0} set {1}='0' where {1}!='0' ", SysModel.MenuTable, _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();
|
||||
|
||||
|
||||
LogUtil.WriteDebug(SysModel.ModeCode, "导入数据", SysModel.MenuText, "数据导入,成功" + success.ToString() + "条,失败" + failed.ToString() + "条");
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
string mesage = ex.Message;
|
||||
string sqlValue = string.Format("delete from {0} where {1}='1'", SysModel.MenuTable, _importFlag);
|
||||
SqlHelper.ExecuteNonQuery(sqlValue);
|
||||
foreach (GridColumn gc in gridControlEx.GridView.VisibleColumns)
|
||||
{
|
||||
if (ex.Message.Contains(gc.FieldName))
|
||||
{
|
||||
mesage = gc.Caption + " 格式不正确,请检查!";
|
||||
break;
|
||||
}
|
||||
}
|
||||
string errorMsg = string.Format("{0}\r\n第{1}行,第{2}列\r\n列名:{3}", mesage, rowNum, colNum, colName);
|
||||
XtraMessageBox.Show("数据提交错误:\n" + errorMsg + "\r\n", "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 查找当前是否存在指定值
|
||||
/// </summary>
|
||||
/// <param name="dtTable"></param>
|
||||
/// <param name="currentRow"></param>
|
||||
/// <param name="key"></param>
|
||||
private static void setDefaultValue(DataTable dtTable, DataRow currentRow,string _qzKey)
|
||||
{
|
||||
if ((dtTable.Columns.Contains(_qzKey + "operatorid")) && ((string.IsNullOrEmpty(currentRow[_qzKey + "operatorid"] + "") || currentRow[_qzKey + "operatorid"] + "" == "0")))
|
||||
currentRow[_qzKey + "operatorid"] = ERPInfo.Instance.UserId;
|
||||
if ((dtTable.Columns.Contains(_qzKey + "operatorname")) && ((string.IsNullOrEmpty(currentRow[_qzKey + "operatorname"] + "") || currentRow[_qzKey + "operatorname"] + "" == "0")))
|
||||
currentRow[_qzKey + "operatorname"] = ERPInfo.Instance.UserName;
|
||||
if ((dtTable.Columns.Contains(_qzKey + "operatedate")) && ((string.IsNullOrEmpty(currentRow[_qzKey + "operatedate"] + "") || currentRow[_qzKey + "operatedate"] + "" == "0")))
|
||||
currentRow[_qzKey + "operatedate"] = DateTime.Now;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// <para>说明:计算列关联字段</para>
|
||||
/// <para>创建人:龚宇超</para>
|
||||
@@ -2798,6 +3263,7 @@ namespace Lskj.Control.Model
|
||||
model.FieldType == ControlType.LabAutoCompleteValue ||
|
||||
model.FieldType == ControlType.LabAutoCompleteValueParam ||
|
||||
model.FieldType == ControlType.LabMultiSelectValue ||
|
||||
model.FieldType == ControlType.LabMultiSelectValueNew ||
|
||||
model.FieldType == ControlType.LabMultiSelectValueParam
|
||||
|| model.FieldType == ControlType.LabTreeLookValue
|
||||
|| model.FieldType == ControlType.LabCheckBox
|
||||
@@ -2871,6 +3337,7 @@ namespace Lskj.Control.Model
|
||||
model.FieldType == ControlType.LabAutoCompleteValue ||
|
||||
model.FieldType == ControlType.LabAutoCompleteValueParam ||
|
||||
model.FieldType == ControlType.LabMultiSelectValue ||
|
||||
model.FieldType == ControlType.LabMultiSelectValueNew ||
|
||||
model.FieldType == ControlType.LabMultiSelectValueParam
|
||||
|| model.FieldType == ControlType.LabTreeLookValue
|
||||
|| model.FieldType == ControlType.LabCheckBox
|
||||
|
||||
@@ -1048,6 +1048,11 @@ namespace Lskj.Control.Model
|
||||
tp.Controls.Add(form.SubForm);
|
||||
tp.ShowCloseButton = DefaultBoolean.True;
|
||||
tp.Dock = DockStyle.Fill;
|
||||
//配置了右键刷新的情况下,在当前页签关闭时触发刷新
|
||||
if ( model.Refresh && this.OnRightCallback != null)
|
||||
{
|
||||
tp.Disposed += new EventHandler(OnTp_Disposed);
|
||||
}
|
||||
ERPInfo.Instance.PageControl.TabPages.Add(tp);
|
||||
ERPInfo.Instance.PageControl.SelectedTabPage = tp;
|
||||
if (isPrivateDll)
|
||||
@@ -1060,7 +1065,8 @@ namespace Lskj.Control.Model
|
||||
}
|
||||
form.SubForm.Show();
|
||||
ERPInfo.Instance.ModuleForms.Add(guid, module);
|
||||
tp.Disposed += new EventHandler(OnTp_Disposed);
|
||||
//直接页签打开模块会直接向后面运行,默认返回false避免外面执行右键刷新
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
}
|
||||
@@ -1442,7 +1448,7 @@ namespace Lskj.Control.Model
|
||||
string paramsql1 = paramList[3];
|
||||
paramList[3] = ReplaceHelper.ReplaceRowParam(rows, paramsql1, "'", "'");
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (model.DllName.ToLower().Contains("Lskj.PubArgoxPrint.dll".ToLower()))
|
||||
{
|
||||
string mainsql = paramList[2];
|
||||
@@ -1622,4 +1628,28 @@ namespace Lskj.Control.Model
|
||||
DataRow[] dataRows = columnsTab.Select().Where(n => (n["name"] + "").Equals(colunmField.Key)).ToArray();
|
||||
if (dataRows.Length == 0)
|
||||
{
|
||||
string a
|
||||
string addColSql = string.Format("alter table P_PrivateDllTab add {0} {1}", colunmField.Key, colunmField.Value);
|
||||
SqlHelper.ExecuteNonQuery(addColSql);//添加列
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
string createTabSql = "create table P_PrivateDllTab(id int IDENTITY(1,1) NOT NULL,{0})";
|
||||
string createCol = string.Empty;
|
||||
foreach (KeyValuePair<string, string> colunmField in colDic)
|
||||
{
|
||||
createCol += string.Format("{0} {1},", colunmField.Key, colunmField.Value);
|
||||
}
|
||||
createTabSql = string.Format(createTabSql, createCol.TrimEnd(','));
|
||||
SqlHelper.ExecuteNonQuery(createTabSql);//创建表
|
||||
}
|
||||
return true;
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -17,7 +17,7 @@ using System.Windows.Forms;
|
||||
using System.Diagnostics;
|
||||
using Lskj.Business.Impl;
|
||||
using Lskj.Control.Model;
|
||||
|
||||
using Lskj.Business;
|
||||
|
||||
namespace Lskj.Control
|
||||
{
|
||||
@@ -89,6 +89,10 @@ namespace Lskj.Control
|
||||
if (dr != DialogResult.Yes && !string.IsNullOrWhiteSpace(errorMessage))
|
||||
{
|
||||
errorMessage = ErrorMessage.StackTrace;
|
||||
if (SystemInfo.Instance.HideErrorSQL)
|
||||
{
|
||||
errorMessage= errorMessage.Split(new string[] { "SQL=[" }, StringSplitOptions.None)[0];
|
||||
}
|
||||
XtraMessageBox.Show(errorMessage, ResourceKeys.SystemTip, MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||||
}
|
||||
DevExpress.XtraEditors.Controls.Localizer.Active = null;
|
||||
@@ -155,28 +159,4 @@ namespace Lskj.Control
|
||||
{
|
||||
msg = Business.Impl.LanguageTranslation.GetTranslatedText(msg);
|
||||
}
|
||||
return XtraMessageBox.Show(msg, ResourceKeys.SystemTip, buttons, MessageBoxIcon.Information);
|
||||
}
|
||||
/// <summary>
|
||||
/// <para>说明:弹出是否对话框</para>
|
||||
/// <para>创建人:龚宇超</para>
|
||||
/// <para>创建日期:2017-12-07 </para>
|
||||
/// <para>修改人:</para>
|
||||
/// <para>修改日期:</para>
|
||||
/// <para>修改备注:</para>
|
||||
/// <para>版本:1.0</para>
|
||||
/// </summary>
|
||||
/// <param name="ex">The ex.</param>
|
||||
/// <param name="buttons">The buttons.</param>
|
||||
/// <returns>DialogResult.</returns>
|
||||
public static DialogResult Show(Exception ex, MessageBoxButtons buttons)
|
||||
{
|
||||
string msg = ex == null ? "未知提示." : ex.StackTrace;
|
||||
if (Business.Impl.LanguageTranslation.Translatable)
|
||||
{
|
||||
msg = Business.Impl.LanguageTranslation.GetTranslatedText(msg);
|
||||
}
|
||||
return XtraMessageBox.Show(msg, ResourceKeys.SystemTip, buttons, MessageBoxIcon.Information);
|
||||
}
|
||||
}
|
||||
}
|
||||
return XtraMessageBox.Show(msg, ResourceKeys.SystemTip, buttons, M
|
||||
@@ -1493,7 +1493,9 @@ namespace Lskj.Control.Model
|
||||
autoiGridEdit.SetDataSource(table);
|
||||
break;
|
||||
case ControlType.LabMultiSelectText:
|
||||
case ControlType.LabMultiSelectTextNew:
|
||||
case ControlType.LabMultiSelectValue:
|
||||
case ControlType.LabMultiSelectValueNew:
|
||||
case ControlType.LabMultiSelectValueParam:
|
||||
case ControlType.LabMultiSelectTextParam:
|
||||
// 多选控件
|
||||
@@ -1972,13 +1974,15 @@ namespace Lskj.Control.Model
|
||||
value = (checkDateEdit.CheckEdit.Checked) ? checkDateEdit.TextEdit.EditValue + "" : "";
|
||||
break;
|
||||
case ControlType.LabMultiSelectText:
|
||||
case ControlType.LabMultiSelectTextNew:
|
||||
case ControlType.LabMultiSelectValue:
|
||||
case ControlType.LabMultiSelectValueNew:
|
||||
case ControlType.LabMultiSelectValueParam:
|
||||
case ControlType.LabMultiSelectTextParam:
|
||||
|
||||
// 多选控件
|
||||
LabelMultiAutoTextEdit multiAutoEdit = ctr as LabelMultiAutoTextEdit;
|
||||
value = (ControlType.LabMultiSelectValue == model.FieldType || ControlType.LabMultiSelectValueParam == model.FieldType) ? multiAutoEdit.EditValue : multiAutoEdit.EditText;
|
||||
value = (ControlType.LabMultiSelectValue == model.FieldType || model.FieldType == ControlType.LabMultiSelectValueNew || ControlType.LabMultiSelectValueParam == model.FieldType) ? multiAutoEdit.EditValue : multiAutoEdit.EditText;
|
||||
break;
|
||||
case ControlType.LabTreeLookValue:
|
||||
case ControlType.LabTreeLookText:
|
||||
@@ -2481,7 +2485,7 @@ namespace Lskj.Control.Model
|
||||
imageEdit.TextEdit.Image = null;
|
||||
}
|
||||
//清空多选选中值
|
||||
else if (model.FieldType == ControlType.LabMultiSelectValue)
|
||||
else if (model.FieldType == ControlType.LabMultiSelectValue|| model.FieldType == ControlType.LabMultiSelectValueNew )
|
||||
{
|
||||
LabelMultiAutoTextEdit multiEdit = control as LabelMultiAutoTextEdit;
|
||||
multiEdit.ClearSelectForm();
|
||||
@@ -2712,20 +2716,23 @@ namespace Lskj.Control.Model
|
||||
/// 获取导入返回控件的名称
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public string getImportReturnValueControl()
|
||||
public List<string> getImportReturnValueControl()
|
||||
{
|
||||
|
||||
List<string> names = new List<string>();
|
||||
|
||||
foreach (System.Windows.Forms.Control item in _parentPanel.Controls)
|
||||
{
|
||||
if (item is BaseUserControl)
|
||||
{
|
||||
var baseControl = item as BaseUserControl;
|
||||
if (baseControl.Model.ImportReturnValue) return baseControl.Model.FieldName;
|
||||
if (baseControl.Model.ImportReturnValue|| baseControl.Model.ImportCurrentValue)
|
||||
{
|
||||
names.Add(baseControl.Model.FieldName);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
return "";
|
||||
return names;
|
||||
}
|
||||
|
||||
|
||||
@@ -2961,10 +2968,24 @@ namespace Lskj.Control.Model
|
||||
{
|
||||
this.Print(primaryValue, this.SystemModel.PrintFile);
|
||||
}
|
||||
|
||||
//打印文件
|
||||
if (resultMsgs[i].Contains("printfile="))
|
||||
{
|
||||
string[] files = resultMsgs[i].Split('=');
|
||||
string parameter =string.Empty;
|
||||
if (resultMsgs[i].Contains("^"))
|
||||
{
|
||||
//printfile=成品入库标签.rmf|xxxx.rmf^参数1=参数1值|参数2=参数2值
|
||||
//多个打印模块用|分割
|
||||
//替换参数用 ^ 隔开,多个用|分割
|
||||
string[] parameters = resultMsgs[i].Split('^');
|
||||
files= parameters[0].Split('=');
|
||||
parameter = parameters[1];
|
||||
}
|
||||
|
||||
|
||||
|
||||
if (files.Length == 2 && !string.IsNullOrEmpty(files[1]))
|
||||
{
|
||||
string[] printFiles = files[1].Split('|');
|
||||
@@ -2972,10 +2993,10 @@ namespace Lskj.Control.Model
|
||||
{
|
||||
if (!string.IsNullOrEmpty(printFiles[n]))
|
||||
{
|
||||
this.Print(primaryValue, printFiles[n]);
|
||||
this.Print(primaryValue, printFiles[n], parameter);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// 模块
|
||||
if (resultMsgs[i].Contains("module="))
|
||||
@@ -3783,6 +3804,7 @@ namespace Lskj.Control.Model
|
||||
model.IsRadio = item.Table.Columns.Contains("IsRadio") && !string.IsNullOrWhiteSpace(item["IsRadio"] + "") ? "1".Equals(item["IsRadio"] + "") : false;
|
||||
model.ScanAfterEmpty = item.Table.Columns.Contains("ScanAfterEmpty") && !string.IsNullOrWhiteSpace(item["ScanAfterEmpty"] + "") ? "1".Equals(item["ScanAfterEmpty"] + "") : false;
|
||||
model.ImportReturnValue = item.Table.Columns.Contains("ImportReturnValue") && !string.IsNullOrWhiteSpace(item["ImportReturnValue"] + "") ? "1".Equals(item["ImportReturnValue"] + "") : false;
|
||||
model.ImportCurrentValue = item.Table.Columns.Contains("ImportCurrentValue") && !string.IsNullOrWhiteSpace(item["ImportCurrentValue"] + "") ? "1".Equals(item["ImportCurrentValue"] + "") : false;
|
||||
model.SchedStartDataControl = item.Table.Columns.Contains("SchedStartDataControl") && !string.IsNullOrWhiteSpace(item["SchedStartDataControl"] + "") ? "1".Equals(item["SchedStartDataControl"] + "") : false;
|
||||
return model;
|
||||
}
|
||||
@@ -4071,13 +4093,15 @@ namespace Lskj.Control.Model
|
||||
baseControl = checkDateEdit;
|
||||
break;
|
||||
case ControlType.LabMultiSelectText:
|
||||
case ControlType.LabMultiSelectTextNew:
|
||||
case ControlType.LabMultiSelectValue:
|
||||
case ControlType.LabMultiSelectValueNew:
|
||||
case ControlType.LabMultiSelectValueParam:
|
||||
case ControlType.LabMultiSelectTextParam:
|
||||
|
||||
// 多选控件
|
||||
LabelMultiAutoTextEdit multiAutoEdit = new LabelMultiAutoTextEdit();
|
||||
multiAutoEdit.ValueMember = (ControlType.LabMultiSelectValue == model.FieldType || ControlType.LabMultiSelectValueParam == model.FieldType) ? model.ValueMember : model.TextMember;
|
||||
multiAutoEdit.ValueMember = (ControlType.LabMultiSelectValue == model.FieldType || ControlType.LabMultiSelectValueNew == model.FieldType || ControlType.LabMultiSelectValueParam == model.FieldType) ? model.ValueMember : model.TextMember;
|
||||
multiAutoEdit.ValueField = model.ValueMember;
|
||||
multiAutoEdit.TextField = model.TextMember;
|
||||
multiAutoEdit.ControlObj = this;
|
||||
@@ -4999,7 +5023,7 @@ namespace Lskj.Control.Model
|
||||
/// </summary>
|
||||
/// <param name="value">The value.</param>
|
||||
/// <param name="printFile">The print file.</param>
|
||||
private void Print(string value, string printFile)
|
||||
private void Print(string value, string printFile,string parameter="")
|
||||
{
|
||||
if (SystemModel == null) return;
|
||||
string printPath = PubUtil.PrintFileAbsolutelyPath;
|
||||
@@ -5023,6 +5047,21 @@ namespace Lskj.Control.Model
|
||||
string tmpSql = this.ReplaceControlValue(this.SystemModel.PrintSql);
|
||||
string tmpSql1 = this.ReplaceControlValue(this.SystemModel.PrintSql1);
|
||||
string tmpSql2 = this.ReplaceControlValue(this.SystemModel.PrintSql2);
|
||||
if (!string.IsNullOrWhiteSpace(parameter))
|
||||
{
|
||||
string[] parameters = parameter.Split('|');
|
||||
foreach (string item in parameters)
|
||||
{
|
||||
string[] Replacing= item.Split('=');
|
||||
tmpSql =ReplaceHelper.ReplaceParamToValue(tmpSql, Replacing[0], Replacing[1]);
|
||||
tmpSql1 = ReplaceHelper.ReplaceParamToValue(tmpSql1, Replacing[0], Replacing[1]);
|
||||
tmpSql2 = ReplaceHelper.ReplaceParamToValue(tmpSql2, Replacing[0], Replacing[1]);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
DelphiHelper.LoadDelphiDll(printPath, printPath, printFile, tmpSql, tmpSql1, this.SystemModel.PrintType, tmpSql2);
|
||||
}
|
||||
|
||||
@@ -3070,42 +3070,110 @@ namespace Lskj.Control
|
||||
leftValue = this.ParentKeyValue;
|
||||
}
|
||||
|
||||
string ImportReturnName = this.SearchObj.getImportReturnValueControl();
|
||||
string ImportReturnValue = string.Empty;
|
||||
if (!string.IsNullOrWhiteSpace(ImportReturnName))
|
||||
List<string> ImportReturnName = this.SearchObj.getImportReturnValueControl();
|
||||
List<string> ImportReturnValue = new List<string>();
|
||||
if (ImportReturnName.Count>0)
|
||||
{
|
||||
BaseUserControl baseUserControl = this.SearchObj.FindControl(ImportReturnName);
|
||||
ImportReturnValue = BaseImpl.GetDefaultValue(baseUserControl.Model.Default);
|
||||
this.SearchObj.SetControlValue(ImportReturnName, ImportReturnValue);
|
||||
foreach (string item in ImportReturnName)
|
||||
{
|
||||
BaseUserControl baseUserControl = this.SearchObj.FindControl(item);
|
||||
string Value = "";
|
||||
if (baseUserControl.Model.ImportReturnValue)
|
||||
{
|
||||
Value = BaseImpl.GetDefaultValue(baseUserControl.Model.Default);
|
||||
this.SearchObj.SetControlValue(item, Value);
|
||||
}
|
||||
else if (baseUserControl.Model.ImportCurrentValue)
|
||||
{
|
||||
Value = this.SearchObj.GetControlValue(item);
|
||||
}
|
||||
|
||||
ImportReturnValue.Add(Value);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
FrmImport import = new FrmImport(this.SysModel.MenuTable, this.Model.ModuleCode, _parmaryKey, this.gcMain, this.SysModel.PrefixKey, leftField, leftValue, this.Model.FormText, this.SysModel.ConcatenatedPrefix);
|
||||
import.ParentGridEx = this.ParentGridEx;
|
||||
import.ImportReturnName = ImportReturnName;
|
||||
import.ImportReturnValue = ImportReturnValue;
|
||||
DialogResult result = import.ShowDialog();
|
||||
if (result == DialogResult.OK)
|
||||
//快速导入
|
||||
if (SystemInfo.Instance.QuickImportMode)
|
||||
{
|
||||
bool ImportResults = this.gcMain.GridView.QuickImport(this.SysModel, _parmaryKey, leftField, leftValue, ImportReturnName, ImportReturnValue, this.ParentGridEx);
|
||||
// 刷新数据
|
||||
if (!string.IsNullOrWhiteSpace(ImportReturnName))
|
||||
if (ImportResults)
|
||||
{
|
||||
this.SearchObj.SearchGrid();
|
||||
if (ImportReturnName.Count > 0)
|
||||
{
|
||||
this.SearchObj.SearchGrid();
|
||||
}
|
||||
else
|
||||
{
|
||||
this.SearchObj.SearchLastGrid();
|
||||
}
|
||||
if (!string.IsNullOrWhiteSpace(this.SysModel.afterimportSql))
|
||||
{
|
||||
string sql = this.SearchObj.ReplaceControlValue(this.SysModel.afterimportSql);
|
||||
string newResult = SqlHelper.ExecuteScalar(sql) + "";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
this.SearchObj.SearchLastGrid();
|
||||
}
|
||||
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(this.SysModel.afterimportSql))
|
||||
{
|
||||
string sql = this.SearchObj.ReplaceControlValue(this.SysModel.afterimportSql);
|
||||
string newResult = SqlHelper.ExecuteScalar(sql) + "";
|
||||
//if (!string.IsNullOrEmpty(newResult)) MessageUtil.Show(newResult);
|
||||
}
|
||||
|
||||
|
||||
//GridColumnCollection gridColumns = this.gcMain.GridView.Columns;
|
||||
//DataTable NewTable = this.gcMain.GridControl.DataSourceTable();
|
||||
//foreach (DataRow rowItem in ImportTable.Rows)
|
||||
//{
|
||||
// DataRow newRow = NewTable.NewRow();
|
||||
// foreach (GridColumn col in gridColumns)
|
||||
// {
|
||||
// if ("id".Equals(col.FieldName) || col.FieldName.Equals(this.ParmaryKey)) continue;
|
||||
// if (rowItem.Table.Columns.Contains(col.FieldName))
|
||||
// {
|
||||
// // 列中是否包含对应字段,包含则使用值
|
||||
// newRow[col.FieldName] = rowItem[col.FieldName];
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// // 未包含字段,则使用控件默认值.
|
||||
// GridColumnModel model = col.Tag as GridColumnModel;
|
||||
// string fieldValue = BaseImpl.GetDefaultValue(model.DefaultValue);
|
||||
// if (!string.IsNullOrEmpty(fieldValue))
|
||||
// {
|
||||
// newRow[col.FieldName] = fieldValue;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// NewTable.Rows.Add(newRow);
|
||||
//}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
FrmImport import = new FrmImport(this.SysModel.MenuTable, this.Model.ModuleCode, _parmaryKey, this.gcMain, this.SysModel.PrefixKey, leftField, leftValue, this.Model.FormText, this.SysModel.ConcatenatedPrefix);
|
||||
import.ParentGridEx = this.ParentGridEx;
|
||||
import.ImportReturnName = ImportReturnName;
|
||||
import.ImportReturnValue = ImportReturnValue;
|
||||
DialogResult result = import.ShowDialog();
|
||||
if (result == DialogResult.OK)
|
||||
{
|
||||
// 刷新数据
|
||||
if (ImportReturnName.Count > 0)
|
||||
{
|
||||
this.SearchObj.SearchGrid();
|
||||
}
|
||||
else
|
||||
{
|
||||
this.SearchObj.SearchLastGrid();
|
||||
}
|
||||
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(this.SysModel.afterimportSql))
|
||||
{
|
||||
string sql = this.SearchObj.ReplaceControlValue(this.SysModel.afterimportSql);
|
||||
string newResult = SqlHelper.ExecuteScalar(sql) + "";
|
||||
//if (!string.IsNullOrEmpty(newResult)) MessageUtil.Show(newResult);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
||||
@@ -391,7 +391,7 @@ namespace Lskj.Control.MultiGridLookUp
|
||||
private void SetDefaultValue()
|
||||
{
|
||||
this.gridControl2.DataSourceTable().Clear();
|
||||
if (!string.IsNullOrEmpty(EditValue) && (this.IsType == ControlType.LabMultiSelectValue || this.IsType == ControlType.LabMultiSelectValueParam))
|
||||
if (!string.IsNullOrEmpty(EditValue) && (this.IsType == ControlType.LabMultiSelectValue || this.IsType == ControlType.LabMultiSelectValueNew || this.IsType == ControlType.LabMultiSelectValueParam))
|
||||
{
|
||||
this.UpdateChecked(EditValue.Trim().Replace(", ", ",").TrimEnd(',').Split(','), ValueMember, true);
|
||||
}
|
||||
|
||||
@@ -551,8 +551,10 @@ namespace Lskj.Control
|
||||
// this.cellHelper.AddAmountColumn(column, 11);
|
||||
// break;
|
||||
case ControlType.LabMultiSelectValue:
|
||||
case ControlType.LabMultiSelectValueNew:
|
||||
case ControlType.LabMultiSelectValueParam:
|
||||
case ControlType.LabMultiSelectText:
|
||||
case ControlType.LabMultiSelectTextNew:
|
||||
case ControlType.LabMultiSelectTextParam:
|
||||
InitMutilEdit(column, model);
|
||||
break;
|
||||
@@ -960,7 +962,7 @@ namespace Lskj.Control
|
||||
mutilLookUp.TextField = model.TextMember;
|
||||
mutilLookUp.SourceSQL = model.SqlSource;
|
||||
mutilLookUp.IsType = model.FieldType;
|
||||
mutilLookUp.ValueMember = model.FieldType == ControlType.LabMultiSelectValue ||
|
||||
mutilLookUp.ValueMember = model.FieldType == ControlType.LabMultiSelectValue || model.FieldType == ControlType.LabMultiSelectValueNew ||
|
||||
model.FieldType == ControlType.LabMultiSelectValueParam ? model.ValueMember : model.TextMember;
|
||||
mutilLookUp.Tag = model;
|
||||
RepositoryItemCheckedComboBoxEdit btnEdit = new RepositoryItemCheckedComboBoxEdit();
|
||||
@@ -974,7 +976,7 @@ namespace Lskj.Control
|
||||
btnEdit.AllowNullInput = DefaultBoolean.False;
|
||||
btnEdit.DisplayMember = model.TextMember;
|
||||
btnEdit.SeparatorChar = ',';
|
||||
btnEdit.ValueMember = model.FieldType == ControlType.LabMultiSelectValue ||
|
||||
btnEdit.ValueMember = model.FieldType == ControlType.LabMultiSelectValue || model.FieldType == ControlType.LabMultiSelectValueNew ||
|
||||
model.FieldType == ControlType.LabMultiSelectValueParam ? model.ValueMember : model.TextMember;
|
||||
btnEdit.DataSource = MainImpl.GetDataTableResult(model.SqlSource);
|
||||
btnEdit.Buttons[0].Visible = false; // 不能移除,移除后事件不起作用.
|
||||
@@ -2361,7 +2363,7 @@ namespace Lskj.Control
|
||||
GridColumnModel model = modelLookUp.Tag as GridColumnModel;
|
||||
modelLookUp.EditText = btnEdit.Text;
|
||||
modelLookUp.CurrentOperColumnKey = Model.ModuleCode + "_" + model.FieldName;
|
||||
if (model.FieldType == ControlType.LabMultiSelectValue || model.FieldType == ControlType.LabMultiSelectValueParam)
|
||||
if (model.FieldType == ControlType.LabMultiSelectValue || model.FieldType == ControlType.LabMultiSelectValueNew || model.FieldType == ControlType.LabMultiSelectValueParam)
|
||||
{
|
||||
modelLookUp.EditValue = btnEdit.EditValue + "";
|
||||
modelLookUp.EditText = string.Empty;
|
||||
@@ -2415,7 +2417,7 @@ namespace Lskj.Control
|
||||
GridColumnModel model = modelLookUp.Tag as GridColumnModel;
|
||||
modelLookUp.EditText = btnEdit.Text;
|
||||
modelLookUp.CurrentOperColumnKey = Model.ModuleCode + "_" + model.FieldName;
|
||||
if (model.FieldType == ControlType.LabMultiSelectValue || model.FieldType == ControlType.LabMultiSelectValueParam)
|
||||
if (model.FieldType == ControlType.LabMultiSelectValue || model.FieldType == ControlType.LabMultiSelectValueNew || model.FieldType == ControlType.LabMultiSelectValueParam)
|
||||
{
|
||||
modelLookUp.EditValue = btnEdit.EditValue + "";
|
||||
modelLookUp.EditText = string.Empty;
|
||||
|
||||
@@ -337,6 +337,7 @@ namespace Lskj.Control
|
||||
Dictionary<object, Hashtable> dataCaches = Model != null ? Model.DataCaches : null;
|
||||
this.CustomColumKey = customColumKey;
|
||||
this.gcMain.PopupMenuShowing += new PopupMenuShowingEventHandler(OnPopupMenuShowing);
|
||||
|
||||
for (int i = 0; i < table.Rows.Count; i++)
|
||||
{
|
||||
DataRow item = table.Rows[i];
|
||||
@@ -377,6 +378,8 @@ namespace Lskj.Control
|
||||
// 创建列
|
||||
this.InitEditColumns(gridColumn, model);
|
||||
this.gcMain.Columns.AddRange(new TreeListColumn[] { gridColumn });
|
||||
//gcMain.Bands[0].Columns.Add(gridColumn);
|
||||
|
||||
this.ColumnList.Add(model);
|
||||
}
|
||||
if (!dataCaches.GetValue(this, "CustomColumnByDatabase", out DataTable customTable))
|
||||
@@ -455,8 +458,10 @@ namespace Lskj.Control
|
||||
// this.cellHelper.AddAmountColumn(column, 11);
|
||||
// break;
|
||||
case ControlType.LabMultiSelectValue:
|
||||
case ControlType.LabMultiSelectValueNew:
|
||||
case ControlType.LabMultiSelectValueParam:
|
||||
case ControlType.LabMultiSelectText:
|
||||
case ControlType.LabMultiSelectTextNew:
|
||||
case ControlType.LabMultiSelectTextParam:
|
||||
InitMutilEdit(column, model);
|
||||
break;
|
||||
@@ -868,7 +873,7 @@ namespace Lskj.Control
|
||||
mutilLookUp.TextField = model.TextMember;
|
||||
mutilLookUp.SourceSQL = model.SqlSource;
|
||||
mutilLookUp.IsType = model.FieldType;
|
||||
mutilLookUp.ValueMember = model.FieldType == ControlType.LabMultiSelectValue ||
|
||||
mutilLookUp.ValueMember = model.FieldType == ControlType.LabMultiSelectValue || model.FieldType == ControlType.LabMultiSelectValueNew ||
|
||||
model.FieldType == ControlType.LabMultiSelectValueParam ? model.ValueMember : model.TextMember;
|
||||
mutilLookUp.Tag = model;
|
||||
|
||||
@@ -878,7 +883,7 @@ namespace Lskj.Control
|
||||
btnEdit.AllowNullInput = DefaultBoolean.False;
|
||||
btnEdit.DisplayMember = model.TextMember;
|
||||
btnEdit.SeparatorChar = ',';
|
||||
btnEdit.ValueMember = model.FieldType == ControlType.LabMultiSelectValue ||
|
||||
btnEdit.ValueMember = model.FieldType == ControlType.LabMultiSelectValue || model.FieldType == ControlType.LabMultiSelectValueNew ||
|
||||
model.FieldType == ControlType.LabMultiSelectValueParam ? model.ValueMember : model.TextMember;
|
||||
btnEdit.DataSource = MainImpl.GetDataTableResult(model.SqlSource);
|
||||
btnEdit.Buttons[0].Visible = false; // 不能移除,移除后事件不起作用.
|
||||
@@ -2597,7 +2602,7 @@ namespace Lskj.Control
|
||||
GridColumnModel model = modelLookUp.Tag as GridColumnModel;
|
||||
modelLookUp.EditText = btnEdit.Text;
|
||||
modelLookUp.CurrentOperColumnKey = Model.ModuleCode + "_" + model.FieldName;
|
||||
if (model.FieldType == ControlType.LabMultiSelectValue || model.FieldType == ControlType.LabMultiSelectValueParam)
|
||||
if (model.FieldType == ControlType.LabMultiSelectValue || model.FieldType == ControlType.LabMultiSelectValueNew || model.FieldType == ControlType.LabMultiSelectValueParam)
|
||||
{
|
||||
modelLookUp.EditValue = btnEdit.EditValue + "";
|
||||
modelLookUp.EditText = string.Empty;
|
||||
@@ -2714,7 +2719,7 @@ namespace Lskj.Control
|
||||
GridColumnModel model = modelLookUp.Tag as GridColumnModel;
|
||||
modelLookUp.EditText = btnEdit.Text;
|
||||
modelLookUp.CurrentOperColumnKey = Model.ModuleCode + "_" + model.FieldName;
|
||||
if (model.FieldType == ControlType.LabMultiSelectValue || model.FieldType == ControlType.LabMultiSelectValueParam)
|
||||
if (model.FieldType == ControlType.LabMultiSelectValue || model.FieldType == ControlType.LabMultiSelectValueNew || model.FieldType == ControlType.LabMultiSelectValueParam)
|
||||
{
|
||||
modelLookUp.EditValue = btnEdit.EditValue + "";
|
||||
modelLookUp.EditText = string.Empty;
|
||||
@@ -4056,32 +4061,3 @@ namespace Lskj.Control
|
||||
{
|
||||
item.OptionsColumn.AllowEdit = ModifyFields.IndexOf(item.FieldName + ",", StringComparison.OrdinalIgnoreCase) != -1;
|
||||
item.OptionsColumn.ReadOnly = !item.OptionsColumn.AllowEdit;
|
||||
|
||||
if (!item.OptionsColumn.AllowEdit)
|
||||
{
|
||||
item.AppearanceHeader.Options.UseForeColor = true;
|
||||
item.AppearanceHeader.ForeColor = ColorTranslator.FromHtml(HeaderColor);
|
||||
}
|
||||
else
|
||||
{
|
||||
item.AppearanceHeader.Options.UseForeColor = true;
|
||||
item.AppearanceHeader.ForeColor = ColorTranslator.FromHtml("#00000");
|
||||
}
|
||||
if (model.FieldType == ControlType.LabMemoEdit) item.OptionsColumn.AllowEdit = true;
|
||||
|
||||
}
|
||||
//必填
|
||||
if (Required && RequiredFields.IndexOf(item.FieldName + ",", StringComparison.OrdinalIgnoreCase) != -1)
|
||||
{
|
||||
item.AppearanceHeader.Options.UseForeColor = true;
|
||||
item.AppearanceHeader.ForeColor = RequiredForceColor;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user