Compare commits
14 Commits
aacefa24f8
...
tdx
| Author | SHA1 | Date | |
|---|---|---|---|
| 950ea4d8a1 | |||
| 5e01995e17 | |||
| 6df28462be | |||
| 4d907cf1dd | |||
| 1fc67234ef | |||
| d96459d01b | |||
| f3994c6c6e | |||
| 4d3128bbfe | |||
| fa48419bd8 | |||
| 6be6607a40 | |||
| 43ae774164 | |||
| 326fccf8fe | |||
| 5042f2c8c2 | |||
| 57ff1ea406 |
@@ -38,13 +38,13 @@ namespace NewMyFormDesigner
|
||||
//myFormDesigner.Password = "DWlserp1101";//XDerp20210411%
|
||||
|
||||
//MessageBox.Show(args.Length + "");
|
||||
//MessageBox.Show(args[0]);
|
||||
//MessageBox.Show("1:"+args[0]);
|
||||
//System.Windows.Forms.Clipboard.SetText(args[0]);
|
||||
//MessageBox.Show(args[1]);
|
||||
//MessageBox.Show("2:"+args[1]);
|
||||
//System.Windows.Forms.Clipboard.SetText(args[1]);
|
||||
//MessageBox.Show(args[2]);
|
||||
//MessageBox.Show("3:" + args[2]);
|
||||
//System.Windows.Forms.Clipboard.SetText(args[2]);
|
||||
//MessageBox.Show(args[3]);
|
||||
//MessageBox.Show("4:" + args[3]);
|
||||
|
||||
//--------------------------------------------
|
||||
myFormDesigner.FrmKey = args[0];
|
||||
|
||||
@@ -1375,6 +1375,18 @@ namespace Lskj.Business.Impl
|
||||
return GetDataTableResult(sqlValue);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取基础档案附加信息,用formKey查询
|
||||
/// </summary>
|
||||
/// <param name="tabKey"></param>
|
||||
/// <returns></returns>
|
||||
public static DataTable GetBaseAttachKey(string tabKey)
|
||||
{
|
||||
string sqlValue = string.Format(@"select * from p_SystemdllTabAttach where tabKey='{0}' and ISNULL(isVisible,0)=0 order by orderid", tabKey);
|
||||
return GetDataTableResult(sqlValue);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// <para>说明:判断存储过程参数方法</para>
|
||||
|
||||
@@ -72,11 +72,14 @@ namespace Lskj.Business.Impl
|
||||
maxNum += "9";
|
||||
}
|
||||
|
||||
string sqlValue = string.Format("select max(cast({1} as bigint))+1 from {0} where {1} like '{2}{3}'", tableName, parentKey, parentValue, maxdivision);
|
||||
// SpeciesNo是层级编码,完整编码可能超过bigint范围,只对当前节点编号进行数值运算。
|
||||
string sqlValue = string.Format("select max(cast(right({1},{4}) as bigint))+1 from {0} where {1} like '{2}{3}'", tableName, parentKey, parentValue, maxdivision, firstNode.Length);
|
||||
string maxNo = GetResult(sqlValue) + "";
|
||||
|
||||
if (string.IsNullOrWhiteSpace(maxNo))
|
||||
maxNo = parentValue + PrefixNum+"1";
|
||||
else
|
||||
maxNo = parentValue + maxNo.PadLeft(firstNode.Length, '0');
|
||||
maxNo = maxNo.PadLeft(parentValue.Length + firstNode.Length, '0');
|
||||
|
||||
if ((PrefixNum + "0").Equals(maxNo.Substring(maxNo.Length - firstNode.Length)))
|
||||
@@ -87,11 +90,11 @@ namespace Lskj.Business.Impl
|
||||
return maxNum;
|
||||
|
||||
// 取未使用的编号
|
||||
sqlValue = string.Format("select cast({1} as bigint) as SpeciesNo from {0} where {1} like '{2}{3}' order by {1}", tableName, parentKey, parentValue,maxdivision);
|
||||
sqlValue = string.Format("select cast(right({1},{4}) as bigint) as SpeciesNo from {0} where {1} like '{2}{3}' order by SpeciesNo", tableName, parentKey, parentValue,maxdivision, firstNode.Length);
|
||||
DataTable table = GetDataTableResult(sqlValue);
|
||||
|
||||
Int64 speciesNo = table.Rows.Count > 0 ? Convert.ToInt64(table.Rows[0]["SpeciesNo"] + "") : 0;
|
||||
if (speciesNo != Int64.Parse(parentValue + PrefixNum+"1"))
|
||||
if (speciesNo != 1)
|
||||
return parentValue +PrefixNum+"1";;
|
||||
|
||||
foreach (DataRow item in table.Rows)
|
||||
@@ -101,8 +104,7 @@ namespace Lskj.Business.Impl
|
||||
|
||||
if (rowSpeciesNo != speciesNo + 1)
|
||||
{
|
||||
maxNo = (speciesNo + 1).ToString();
|
||||
maxNo = maxNo.PadLeft(parentValue.Length + firstNode.Length, '0');
|
||||
maxNo = parentValue + (speciesNo + 1).ToString().PadLeft(firstNode.Length, '0');
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -328,6 +328,8 @@ namespace Lskj.Business
|
||||
Instance.EnableSpecialInfoProcess = item.Table.Columns.Contains("EnableSpecialInfoProcess") && !string.IsNullOrEmpty(item["EnableSpecialInfoProcess"] + "") ? "1".Equals(item["EnableSpecialInfoProcess"] + "") : false;
|
||||
Instance.SourceFilteringMobile = item.Table.Columns.Contains("SourceFilteringMobile") && !string.IsNullOrEmpty(item["SourceFilteringMobile"] + "") ? "1".Equals(item["SourceFilteringMobile"] + "") : false;
|
||||
Instance.LoginUsername = item.Table.Columns.Contains("LoginUsername") && !string.IsNullOrEmpty(item["LoginUsername"] + "") ? item["LoginUsername"] + "" : "";
|
||||
Instance.MainLeftShowMode = item.Table.Columns.Contains("MainLeftShowMode") && !string.IsNullOrEmpty(item["MainLeftShowMode"] + "") ? item["MainLeftShowMode"] + "" : "";
|
||||
Instance.DeadlockPrompt = item.Table.Columns.Contains("DeadlockPrompt") && !string.IsNullOrEmpty(item["DeadlockPrompt"] + "") ? item["DeadlockPrompt"] + "" : "";
|
||||
}
|
||||
/// <summary>
|
||||
/// 高拍仪AccessKey
|
||||
@@ -1144,6 +1146,14 @@ namespace Lskj.Business
|
||||
///登录界面,用户名显示字段
|
||||
/// </summary>
|
||||
public string LoginUsername;
|
||||
/// <summary>
|
||||
/// 主界面左侧树展示模式
|
||||
/// </summary>
|
||||
public string MainLeftShowMode;
|
||||
/// <summary>
|
||||
/// 死锁提示
|
||||
/// </summary>
|
||||
public string DeadlockPrompt;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2913,7 +2913,7 @@ namespace Lskj.Control
|
||||
int[] rows = this.bandedGridView.GetSelectedRows();
|
||||
|
||||
// 只判断单元格数目,允许同行多单元格选中
|
||||
this.pl_buttom.Visible = cells.Length > 1;
|
||||
this.pl_buttom.Visible = cells.Length > 1 && rows.Length > 1;
|
||||
|
||||
if (this.pl_buttom.Visible)
|
||||
{
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
using Lskj.Business;
|
||||
using Lskj.Model;
|
||||
using Lskj.Util;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
@@ -56,6 +57,19 @@ namespace Lskj.Control.BrowserSetting
|
||||
return contextMenuHandler;
|
||||
}
|
||||
protected override bool OnProcessMessageReceived(CefBrowser browser, CefFrame frame, CefProcessId sourceProcess, CefProcessMessage message)
|
||||
{
|
||||
try
|
||||
{
|
||||
return OnProcessMessageReceivedCore(browser, frame, sourceProcess, message);
|
||||
}
|
||||
catch (Exception exception)
|
||||
{
|
||||
ReportProcessMessageFailure(exception);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
private bool OnProcessMessageReceivedCore(CefBrowser browser, CefFrame frame, CefProcessId sourceProcess, CefProcessMessage message)
|
||||
{
|
||||
if (message.Name.Equals("OpenModule"))
|
||||
{
|
||||
@@ -150,6 +164,46 @@ namespace Lskj.Control.BrowserSetting
|
||||
|
||||
return base.OnProcessMessageReceived(browser, frame, sourceProcess, message);
|
||||
}
|
||||
|
||||
private static void ReportProcessMessageFailure(Exception exception)
|
||||
{
|
||||
try
|
||||
{
|
||||
LogHelper.Instance.WriteError(exception);
|
||||
}
|
||||
catch
|
||||
{
|
||||
// Logging must never rethrow across the native CEF callback.
|
||||
}
|
||||
|
||||
Action showError = () =>
|
||||
{
|
||||
try
|
||||
{
|
||||
MessageUtil.Show(exception);
|
||||
}
|
||||
catch
|
||||
{
|
||||
// Error reporting must never terminate the browser callback.
|
||||
}
|
||||
};
|
||||
|
||||
try
|
||||
{
|
||||
System.Windows.Forms.Control mainControl = ERPInfo.Instance.MainControl;
|
||||
if (mainControl == null || mainControl.IsDisposed || !mainControl.IsHandleCreated)
|
||||
return;
|
||||
|
||||
if (mainControl.InvokeRequired)
|
||||
mainControl.BeginInvoke(showError);
|
||||
else
|
||||
showError();
|
||||
}
|
||||
catch
|
||||
{
|
||||
// The main window may close while the CEF callback is reporting.
|
||||
}
|
||||
}
|
||||
public void Created(CefBrowser cefBrowser)
|
||||
{
|
||||
if (OnCreated != null)
|
||||
|
||||
@@ -192,6 +192,30 @@ namespace Lskj.Control
|
||||
/// </summary>
|
||||
public Dictionary<GridColumnModel, Task<DataTable>> mControlSourceDic = new Dictionary<GridColumnModel, Task<DataTable>>();
|
||||
/// <summary>
|
||||
/// 字典搜索框数据源缓存,只用于弹出下拉框时临时绑定,避免表格滚动时控件持有大数据源。
|
||||
/// </summary>
|
||||
private Dictionary<string, DataTable> mSpecialReturnSourceDic = new Dictionary<string, DataTable>();
|
||||
/// <summary>
|
||||
/// 字典搜索框后台加载任务缓存。
|
||||
/// </summary>
|
||||
private Dictionary<string, Task<DataTable>> mSpecialReturnSourceTaskDic = new Dictionary<string, Task<DataTable>>();
|
||||
/// <summary>
|
||||
/// 字典搜索框显示文本缓存,表格显示时按单元格值快速转换为显示文本。
|
||||
/// </summary>
|
||||
private Dictionary<string, Dictionary<string, string>> mSpecialReturnDisplayDic = new Dictionary<string, Dictionary<string, string>>();
|
||||
/// <summary>
|
||||
/// 字典搜索框编辑器缓存,进入编辑状态时再替换为搜索框控件。
|
||||
/// </summary>
|
||||
private Dictionary<string, RepositoryItemGridLookUpEdit> mSpecialReturnEditDic = new Dictionary<string, RepositoryItemGridLookUpEdit>();
|
||||
/// <summary>
|
||||
/// 字典搜索框显示文本事件是否已绑定。
|
||||
/// </summary>
|
||||
private bool mSpecialReturnDisplayEventAttached = false;
|
||||
/// <summary>
|
||||
/// 字典搜索框编辑器替换事件是否已绑定。
|
||||
/// </summary>
|
||||
private bool mSpecialReturnEditEventAttached = false;
|
||||
/// <summary>
|
||||
/// 计算值
|
||||
/// </summary>
|
||||
public decimal customSum;
|
||||
@@ -995,7 +1019,7 @@ namespace Lskj.Control
|
||||
return;
|
||||
}
|
||||
|
||||
if (!string.IsNullOrEmpty(model.SqlSource) && !ControlType.IsNotLoadData(model.FieldType))
|
||||
if (!string.IsNullOrEmpty(model.SqlSource) && !ControlType.IsNotLoadData(model.FieldType) && !IsSpecialReturnBox(model.FieldType))
|
||||
{
|
||||
Task<DataTable> sourceTask = new Task<DataTable>(() =>
|
||||
{
|
||||
@@ -1191,6 +1215,12 @@ namespace Lskj.Control
|
||||
case ControlType.LabModuleAddRowsText:
|
||||
InitModuleReturnLine(column, model);
|
||||
break;
|
||||
case ControlType.DictionarySearchBoxToId:
|
||||
case ControlType.DictionarySearchBoxToText:
|
||||
case ControlType.DictionarySearchBoxToIdParam:
|
||||
case ControlType.DictionarySearchBoxToTextParam:
|
||||
InitSpecialReturn(column, model);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
@@ -1201,6 +1231,567 @@ namespace Lskj.Control
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 初始化字典搜索框。表格显示阶段使用文本编辑器,进入编辑状态时再切换为搜索框。
|
||||
/// </summary>
|
||||
private void InitSpecialReturn(GridColumn column, GridColumnModel model)
|
||||
{
|
||||
RepositoryItemGridLookUpEdit searchEdit = CreateSpecialReturnSearchEdit(model);
|
||||
RepositoryItemTextEdit textEdit = new RepositoryItemTextEdit();
|
||||
|
||||
gridControl.RepositoryItems.Add(textEdit);
|
||||
gridControl.RepositoryItems.Add(searchEdit);
|
||||
column.ColumnEdit = textEdit;
|
||||
|
||||
mSpecialReturnEditDic[model.FieldName] = searchEdit;
|
||||
this.mControlList.Add(model);
|
||||
StartSpecialReturnSourceTask(model);
|
||||
|
||||
if (!mSpecialReturnDisplayEventAttached)
|
||||
{
|
||||
this.gridView.CustomColumnDisplayText += GridView_CustomColumnDisplayText_SpecialReturn;
|
||||
mSpecialReturnDisplayEventAttached = true;
|
||||
}
|
||||
if (!mSpecialReturnEditEventAttached)
|
||||
{
|
||||
this.gridView.CustomRowCellEditForEditing += GridView_CustomRowCellEditForEditing_SpecialReturn;
|
||||
mSpecialReturnEditEventAttached = true;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 判断是否为字典搜索框类型。
|
||||
/// </summary>
|
||||
private static bool IsSpecialReturnBox(int fieldType)
|
||||
{
|
||||
return fieldType == ControlType.DictionarySearchBoxToId
|
||||
|| fieldType == ControlType.DictionarySearchBoxToText
|
||||
|| fieldType == ControlType.DictionarySearchBoxToIdParam
|
||||
|| fieldType == ControlType.DictionarySearchBoxToTextParam;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 判断字典搜索框是否保存显示文本。
|
||||
/// </summary>
|
||||
private static bool IsSpecialReturnTextBox(int fieldType)
|
||||
{
|
||||
return fieldType == ControlType.DictionarySearchBoxToText
|
||||
|| fieldType == ControlType.DictionarySearchBoxToTextParam;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 判断字典搜索框是否为带参数类型。
|
||||
/// </summary>
|
||||
private static bool IsSpecialReturnParamBox(int fieldType)
|
||||
{
|
||||
return fieldType == ControlType.DictionarySearchBoxToIdParam
|
||||
|| fieldType == ControlType.DictionarySearchBoxToTextParam;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 创建字典搜索框编辑器。
|
||||
/// </summary>
|
||||
private RepositoryItemGridLookUpEdit CreateSpecialReturnSearchEdit(GridColumnModel model)
|
||||
{
|
||||
RepositoryItemGridLookUpEdit searchEdit = new RepositoryItemGridLookUpEdit();
|
||||
if (model.FontSize > 0) searchEdit.View.Appearance.Row.Font = new Font("微软雅黑", model.FontSize);
|
||||
searchEdit.View.OptionsView.ShowIndicator = false;
|
||||
searchEdit.View.OptionsView.ColumnAutoWidth = false;
|
||||
searchEdit.PopupSizeable = true;
|
||||
searchEdit.PopupResizeMode = ResizeMode.Default;
|
||||
searchEdit.AllowFocused = true;
|
||||
searchEdit.ImmediatePopup = true;
|
||||
searchEdit.ShowFooter = false;
|
||||
searchEdit.NullText = "";
|
||||
searchEdit.TextEditStyle = TextEditStyles.Standard;
|
||||
searchEdit.PopupBorderStyle = PopupBorderStyles.Flat;
|
||||
searchEdit.AllowNullInput = DefaultBoolean.False;
|
||||
searchEdit.ShowPopupShadow = true;
|
||||
searchEdit.DisplayMember = model.TextMember;
|
||||
searchEdit.ValueMember = IsSpecialReturnTextBox(model.FieldType) ? model.TextMember : model.ValueMember;
|
||||
searchEdit.Tag = model;
|
||||
searchEdit.View.Tag = searchEdit;
|
||||
searchEdit.View.Appearance.HeaderPanel.TextOptions.HAlignment = HorzAlignment.Center;
|
||||
searchEdit.View.PopupMenuShowing += new PopupMenuShowingEventHandler(OnAutoSearchEditPopupMenuShowing);
|
||||
searchEdit.KeyDown += OnsearchEditKeyDown;
|
||||
searchEdit.QueryPopUp += SpecialReturnEdit_QueryPopUp;
|
||||
searchEdit.CloseUp += SpecialReturnEdit_CloseUp;
|
||||
searchEdit.Closed += SpecialReturnEdit_Closed;
|
||||
searchEdit.CustomDisplayText += SpecialReturnEdit_CustomDisplayText;
|
||||
searchEdit.EditValueChanging += gridLookUpEdit1_EditValueChanging;
|
||||
searchEdit.View.CustomDrawFilterPanel += OnCustomDrawFilterPanel;
|
||||
|
||||
GridColumn valueColumn = new GridColumn();
|
||||
valueColumn.Name = valueColumn.FieldName = model.ValueMember;
|
||||
valueColumn.Caption = "编码";
|
||||
valueColumn.Visible = model.ValueMember.Substring(0, 1) != "_";
|
||||
|
||||
GridColumn textColumn = new GridColumn();
|
||||
textColumn.Name = textColumn.FieldName = model.TextMember;
|
||||
textColumn.Caption = "名称";
|
||||
textColumn.Visible = model.TextMember.Substring(0, 1) != "_";
|
||||
|
||||
searchEdit.View.Columns.AddRange(new GridColumn[] { valueColumn, textColumn });
|
||||
return searchEdit;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 字典搜索框显示文本事件,表格滚动显示时只查字典,不绑定下拉框大数据源。
|
||||
/// </summary>
|
||||
private void GridView_CustomColumnDisplayText_SpecialReturn(object sender, CustomColumnDisplayTextEventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
GridColumnModel model = e.Column.Tag as GridColumnModel;
|
||||
if (model == null || !IsSpecialReturnBox(model.FieldType)) return;
|
||||
|
||||
string value = e.Value + "";
|
||||
if (string.IsNullOrWhiteSpace(value)) return;
|
||||
|
||||
string displayText = string.Empty;
|
||||
bool sourceReady = EnsureSpecialReturnSourceReady(model);
|
||||
if (TryGetSpecialReturnDisplayText(model, value, out displayText))
|
||||
{
|
||||
e.DisplayText = displayText;
|
||||
}
|
||||
else if (sourceReady)
|
||||
{
|
||||
e.DisplayText = string.Empty;
|
||||
}
|
||||
}
|
||||
catch
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 字典搜索框编辑器替换事件,只有进入编辑状态时才使用搜索框控件。
|
||||
/// </summary>
|
||||
private void GridView_CustomRowCellEditForEditing_SpecialReturn(object sender, CustomRowCellEditEventArgs e)
|
||||
{
|
||||
GridColumnModel model = e.Column.Tag as GridColumnModel;
|
||||
if (model == null || !IsSpecialReturnBox(model.FieldType)) return;
|
||||
if (mSpecialReturnEditDic.ContainsKey(model.FieldName))
|
||||
{
|
||||
RepositoryItemGridLookUpEdit searchEdit = mSpecialReturnEditDic[model.FieldName];
|
||||
BindSpecialReturnCurrentValue(searchEdit, model, this.gridView.GetRowCellValue(e.RowHandle, e.Column));
|
||||
e.RepositoryItem = searchEdit;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 字典搜索框编辑态显示文本事件,避免编辑器未绑定数据源时当前值显示为空。
|
||||
/// </summary>
|
||||
private void SpecialReturnEdit_CustomDisplayText(object sender, CustomDisplayTextEventArgs e)
|
||||
{
|
||||
RepositoryItemGridLookUpEdit edit = sender as RepositoryItemGridLookUpEdit;
|
||||
if (edit == null || e.Value == null) return;
|
||||
|
||||
GridColumnModel model = edit.Tag as GridColumnModel;
|
||||
if (model == null || !IsSpecialReturnBox(model.FieldType)) return;
|
||||
|
||||
string value = e.Value + "";
|
||||
if (string.IsNullOrWhiteSpace(value)) return;
|
||||
|
||||
string displayText = string.Empty;
|
||||
bool sourceReady = EnsureSpecialReturnSourceReady(model);
|
||||
if (TryGetSpecialReturnDisplayText(model, value, out displayText))
|
||||
{
|
||||
e.DisplayText = displayText;
|
||||
}
|
||||
else if (sourceReady)
|
||||
{
|
||||
e.DisplayText = string.Empty;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 字典搜索框弹出事件。普通类型使用缓存数据源,带参数类型按当前行条件重新查询。
|
||||
/// </summary>
|
||||
private void SpecialReturnEdit_QueryPopUp(object sender, CancelEventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
GridLookUpEdit edit = sender as GridLookUpEdit;
|
||||
if (edit == null) return;
|
||||
GridColumnModel model = edit.Properties.Tag as GridColumnModel;
|
||||
if (model == null) return;
|
||||
|
||||
CurrentOperColumnKey = Model.ModuleCode + "_" + model.FieldName;
|
||||
CurrentOperModel = model;
|
||||
|
||||
DataTable table = IsSpecialReturnParamBox(model.FieldType) ? GetSpecialReturnParamSourceTable(model) : GetSpecialReturnSourceTable(model);
|
||||
if (IsSpecialReturnParamBox(model.FieldType))
|
||||
{
|
||||
AddSpecialReturnManualData(model, table);
|
||||
}
|
||||
edit.Properties.DataSource = table;
|
||||
AddSpecialReturnViewColumns(edit.Properties, table, model);
|
||||
SetSpecialReturnPopupWidth(edit.Properties, table, model);
|
||||
CacheSpecialReturnDisplayValues(model, table);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
string Message = ErrorMessage.PromptErrorMessage(ex, Model.ModuleCode);
|
||||
MessageUtil.Show(Message, ex.Message);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 字典搜索框关闭选择事件,把本次选择结果补入显示字典。
|
||||
/// </summary>
|
||||
private void SpecialReturnEdit_CloseUp(object sender, CloseUpEventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
GridLookUpEdit edit = sender as GridLookUpEdit;
|
||||
if (edit == null) return;
|
||||
GridColumnModel model = edit.Properties.Tag as GridColumnModel;
|
||||
if (model == null || e.Value == null) return;
|
||||
|
||||
DataTable table = edit.Properties.DataSource as DataTable;
|
||||
if (table == null) return;
|
||||
|
||||
string value = e.Value + "";
|
||||
string valueMember = IsSpecialReturnTextBox(model.FieldType) ? model.TextMember : model.ValueMember;
|
||||
if (!table.Columns.Contains(valueMember) || !table.Columns.Contains(model.TextMember)) return;
|
||||
|
||||
DataRow row = table.Rows.Cast<DataRow>().FirstOrDefault(item => (item[valueMember] + "").Equals(value));
|
||||
if (row != null)
|
||||
{
|
||||
GetSpecialReturnDisplayDic(model)[value] = row[model.TextMember] + "";
|
||||
}
|
||||
|
||||
edit.EditValue = e.Value;
|
||||
GridColumn column = this.gridView.Columns[model.FieldName];
|
||||
if (column != null)
|
||||
{
|
||||
this.gridView.SetFocusedRowCellValue(column, e.Value);
|
||||
}
|
||||
this.gridView.PostEditor();
|
||||
this.gridView.UpdateCurrentRow();
|
||||
}
|
||||
catch
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 字典搜索框关闭后清空临时数据源,避免编辑器长期持有大量数据。
|
||||
/// </summary>
|
||||
private void SpecialReturnEdit_Closed(object sender, ClosedEventArgs e)
|
||||
{
|
||||
GridLookUpEdit edit = sender as GridLookUpEdit;
|
||||
if (edit != null)
|
||||
{
|
||||
edit.Properties.DataSource = null;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取字典搜索框初始化数据源,用于普通弹出和显示字典缓存。
|
||||
/// </summary>
|
||||
private DataTable GetSpecialReturnSourceTable(GridColumnModel model)
|
||||
{
|
||||
string key = model.FieldName;
|
||||
if (mSpecialReturnSourceDic.ContainsKey(key))
|
||||
{
|
||||
return mSpecialReturnSourceDic[key];
|
||||
}
|
||||
if (mSpecialReturnSourceTaskDic.ContainsKey(key))
|
||||
{
|
||||
DataTable taskTable = mSpecialReturnSourceTaskDic[key].Result;
|
||||
mSpecialReturnSourceDic[key] = taskTable;
|
||||
CacheSpecialReturnDisplayValues(model, taskTable);
|
||||
return taskTable;
|
||||
}
|
||||
|
||||
DataTable table = BaseImpl.GetDataTableResult(model.SqlSource);
|
||||
mSpecialReturnSourceDic[key] = table;
|
||||
CacheSpecialReturnDisplayValues(model, table);
|
||||
return table;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取带参数字典搜索框弹出数据源,逻辑与原带参数搜索框弹出查询保持一致。
|
||||
/// </summary>
|
||||
private DataTable GetSpecialReturnParamSourceTable(GridColumnModel model)
|
||||
{
|
||||
DataRow[] dataRows = this.GetViewFocusedDataRows();
|
||||
DataRow rowItem = dataRows.Count() > 0 ? dataRows[0] : this.gridView.GetFocusedDataRow();
|
||||
if (rowItem == null && this.ParentControl == null)
|
||||
{
|
||||
return GetSpecialReturnSourceTable(model);
|
||||
}
|
||||
|
||||
string sqlValue = model.SqlSource;
|
||||
if (this.ParentControl != null)
|
||||
sqlValue = this.ParentControl.ReplaceParentControlValue(sqlValue);
|
||||
|
||||
sqlValue = sqlValue.Replace("#", "");
|
||||
|
||||
if (rowItem != null)
|
||||
{
|
||||
sqlValue = ReplaceHelper.ReplaceRowParam(rowItem, sqlValue);
|
||||
}
|
||||
|
||||
return MainImpl.GetDataTableResult(sqlValue);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 带参数字典搜索框保存文本时,把手动新增的数据追加到本次弹出数据源。
|
||||
/// </summary>
|
||||
private void AddSpecialReturnManualData(GridColumnModel model, DataTable table)
|
||||
{
|
||||
if (model == null || table == null || !model.SearchBoxAddition || !IsSpecialReturnTextBox(model.FieldType)) return;
|
||||
if (!this.ManuallyAddData.ContainsKey(model.FieldName)) return;
|
||||
|
||||
List<DataRow> dataRows = this.ManuallyAddData[model.FieldName];
|
||||
foreach (DataRow row in dataRows)
|
||||
{
|
||||
DataRow newrow = table.NewRow();
|
||||
newrow.ItemArray = row.ItemArray;
|
||||
table.Rows.Add(newrow);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 后台加载字典搜索框数据源并建立显示字典。
|
||||
/// </summary>
|
||||
private void StartSpecialReturnSourceTask(GridColumnModel model)
|
||||
{
|
||||
if (model == null || string.IsNullOrWhiteSpace(model.SqlSource) || mSpecialReturnSourceTaskDic.ContainsKey(model.FieldName)) return;
|
||||
|
||||
Task<DataTable> sourceTask = new Task<DataTable>(() =>
|
||||
{
|
||||
return BaseImpl.GetDataTableResult(model.SqlSource);
|
||||
});
|
||||
sourceTask.ContinueWith(task =>
|
||||
{
|
||||
if (task.Status != TaskStatus.RanToCompletion || task.Result == null) return;
|
||||
if (this.IsDisposed || !this.IsHandleCreated) return;
|
||||
this.BeginInvoke(new MethodInvoker(delegate ()
|
||||
{
|
||||
if (this.IsDisposed) return;
|
||||
mSpecialReturnSourceDic[model.FieldName] = task.Result;
|
||||
CacheSpecialReturnDisplayValues(model, task.Result);
|
||||
gridView.Invalidate();
|
||||
}));
|
||||
});
|
||||
mSpecialReturnSourceTaskDic.Add(model.FieldName, sourceTask);
|
||||
sourceTask.Start(DataTableExtend.SchedulerUtil);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取字段对应的显示文本字典。
|
||||
/// </summary>
|
||||
private Dictionary<string, string> GetSpecialReturnDisplayDic(GridColumnModel model)
|
||||
{
|
||||
if (!mSpecialReturnDisplayDic.ContainsKey(model.FieldName))
|
||||
{
|
||||
mSpecialReturnDisplayDic[model.FieldName] = new Dictionary<string, string>();
|
||||
}
|
||||
return mSpecialReturnDisplayDic[model.FieldName];
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 确认字典搜索框数据源是否已加载;后台任务已完成但回调未执行时,在这里补建显示字典。
|
||||
/// </summary>
|
||||
private bool EnsureSpecialReturnSourceReady(GridColumnModel model)
|
||||
{
|
||||
if (model == null) return false;
|
||||
if (mSpecialReturnSourceDic.ContainsKey(model.FieldName)) return true;
|
||||
|
||||
Task<DataTable> sourceTask = null;
|
||||
if (!mSpecialReturnSourceTaskDic.TryGetValue(model.FieldName, out sourceTask)) return false;
|
||||
if (!sourceTask.IsCompleted) return false;
|
||||
|
||||
if (sourceTask.Status == TaskStatus.RanToCompletion && sourceTask.Result != null)
|
||||
{
|
||||
mSpecialReturnSourceDic[model.FieldName] = sourceTask.Result;
|
||||
CacheSpecialReturnDisplayValues(model, sourceTask.Result);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 把数据源中的值和显示文本缓存到字典中。
|
||||
/// </summary>
|
||||
private void CacheSpecialReturnDisplayValues(GridColumnModel model, DataTable table)
|
||||
{
|
||||
if (table == null || !table.Columns.Contains(model.ValueMember) || !table.Columns.Contains(model.TextMember)) return;
|
||||
|
||||
Dictionary<string, string> displayDic = GetSpecialReturnDisplayDic(model);
|
||||
foreach (DataRow row in table.Rows)
|
||||
{
|
||||
string value = IsSpecialReturnTextBox(model.FieldType) ? row[model.TextMember] + "" : row[model.ValueMember] + "";
|
||||
if (!string.IsNullOrWhiteSpace(value) && !displayDic.ContainsKey(value))
|
||||
{
|
||||
displayDic.Add(value, row[model.TextMember] + "");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 根据单元格保存值获取显示文本。
|
||||
/// </summary>
|
||||
private string GetSpecialReturnDisplayText(GridColumnModel model, string value)
|
||||
{
|
||||
Dictionary<string, string> displayDic = GetSpecialReturnDisplayDic(model);
|
||||
string[] values = value.Trim(',').Split(',');
|
||||
StringBuilder result = new StringBuilder();
|
||||
foreach (string item in values)
|
||||
{
|
||||
string key = (item + "").Trim();
|
||||
if (string.IsNullOrWhiteSpace(key)) continue;
|
||||
|
||||
string displayText = string.Empty;
|
||||
result.Append(displayDic.TryGetValue(key, out displayText) ? displayText : key);
|
||||
result.Append(",");
|
||||
}
|
||||
return result.ToString().TrimEnd(',');
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 严格按字典获取显示文本,字典中不存在时返回false。
|
||||
/// </summary>
|
||||
private bool TryGetSpecialReturnDisplayText(GridColumnModel model, string value, out string displayText)
|
||||
{
|
||||
displayText = string.Empty;
|
||||
Dictionary<string, string> displayDic = GetSpecialReturnDisplayDic(model);
|
||||
string[] values = value.Trim(',').Split(',');
|
||||
StringBuilder result = new StringBuilder();
|
||||
foreach (string item in values)
|
||||
{
|
||||
string key = (item + "").Trim();
|
||||
if (string.IsNullOrWhiteSpace(key)) continue;
|
||||
|
||||
string itemText = string.Empty;
|
||||
if (!displayDic.TryGetValue(key, out itemText)) return false;
|
||||
|
||||
result.Append(itemText);
|
||||
result.Append(",");
|
||||
}
|
||||
|
||||
displayText = result.ToString().TrimEnd(',');
|
||||
return !string.IsNullOrWhiteSpace(displayText);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 进入编辑态时只给当前有效值绑定一行临时数据,避免未弹出下拉框时显示为空。
|
||||
/// </summary>
|
||||
private void BindSpecialReturnCurrentValue(RepositoryItemGridLookUpEdit searchEdit, GridColumnModel model, object cellValue)
|
||||
{
|
||||
if (searchEdit == null || model == null || cellValue == null) return;
|
||||
|
||||
string value = cellValue + "";
|
||||
if (string.IsNullOrWhiteSpace(value)) return;
|
||||
|
||||
string displayText = string.Empty;
|
||||
bool sourceReady = EnsureSpecialReturnSourceReady(model);
|
||||
if (!TryGetSpecialReturnDisplayText(model, value, out displayText))
|
||||
{
|
||||
if (sourceReady)
|
||||
{
|
||||
searchEdit.DataSource = null;
|
||||
return;
|
||||
}
|
||||
displayText = value;
|
||||
}
|
||||
|
||||
DataTable table = new DataTable();
|
||||
if (!table.Columns.Contains(model.ValueMember)) table.Columns.Add(model.ValueMember);
|
||||
if (!table.Columns.Contains(model.TextMember)) table.Columns.Add(model.TextMember);
|
||||
|
||||
DataRow row = table.NewRow();
|
||||
row[model.ValueMember] = IsSpecialReturnTextBox(model.FieldType) ? displayText : value;
|
||||
row[model.TextMember] = displayText;
|
||||
table.Rows.Add(row);
|
||||
|
||||
searchEdit.DataSource = table;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 根据弹出数据源补充搜索框显示列。
|
||||
/// </summary>
|
||||
private void AddSpecialReturnViewColumns(RepositoryItemGridLookUpEdit searchEdit, DataTable table, GridColumnModel model)
|
||||
{
|
||||
if (searchEdit == null || table == null) return;
|
||||
|
||||
foreach (DataColumn dcol in table.Columns)
|
||||
{
|
||||
if (string.IsNullOrEmpty(dcol.ColumnName) || dcol.ColumnName.Substring(0, 1) == "_") continue;
|
||||
if (searchEdit.View.Columns.FirstOrDefault(item => item.FieldName == dcol.ColumnName) != null) continue;
|
||||
|
||||
GridColumn otherColumn = new GridColumn();
|
||||
otherColumn.Name = otherColumn.FieldName = otherColumn.Caption = dcol.ColumnName;
|
||||
otherColumn.Visible = true;
|
||||
searchEdit.View.Columns.Add(otherColumn);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 设置字典搜索框弹出宽度,规则与普通自动搜索框保持一致。
|
||||
/// </summary>
|
||||
private void SetSpecialReturnPopupWidth(RepositoryItemGridLookUpEdit searchEdit, DataTable table, GridColumnModel model)
|
||||
{
|
||||
if (searchEdit == null || table == null || model == null) return;
|
||||
|
||||
int popWidth = 0;
|
||||
string[] columnsWidth = !string.IsNullOrWhiteSpace(model.LookUpFieldsWidth) ? model.LookUpFieldsWidth.Trim().TrimEnd(',').Split(',') : null;
|
||||
if (columnsWidth != null && columnsWidth.Length > 0)
|
||||
{
|
||||
int columnWidthIndex = 0;
|
||||
foreach (DataColumn dcol in table.Columns)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(dcol.ColumnName) && dcol.ColumnName.Substring(0, 1) != "_")
|
||||
{
|
||||
GridColumn gCol = searchEdit.View.Columns.FirstOrDefault(x => x.FieldName == dcol.ColumnName);
|
||||
if (gCol != null)
|
||||
{
|
||||
int width = 0;
|
||||
if (columnWidthIndex < columnsWidth.Length)
|
||||
{
|
||||
string widthStr = columnsWidth[columnWidthIndex];
|
||||
width = int.TryParse(widthStr, out width) ? width : GraphicsText.GetTextWidth(gCol.Caption);
|
||||
}
|
||||
else
|
||||
{
|
||||
width = GraphicsText.GetTextWidth(gCol.Caption);
|
||||
int maxWidth = CalcMaxColumnWidth(table, gCol.Name);
|
||||
width = width > maxWidth ? width : maxWidth;
|
||||
}
|
||||
gCol.Width = width;
|
||||
popWidth += gCol.Width;
|
||||
}
|
||||
}
|
||||
columnWidthIndex++;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
foreach (DataColumn dcol in table.Columns)
|
||||
{
|
||||
if (string.IsNullOrEmpty(dcol.ColumnName) || dcol.ColumnName.Substring(0, 1) == "_") continue;
|
||||
GridColumn gCol = searchEdit.View.Columns.FirstOrDefault(x => x.FieldName == dcol.ColumnName);
|
||||
if (gCol != null)
|
||||
{
|
||||
int columnWidth = GraphicsText.GetTextWidth(gCol.Caption);
|
||||
gCol.Width = CalcMaxColumnWidth(table, gCol.Name);
|
||||
gCol.Width = columnWidth > gCol.Width ? columnWidth : gCol.Width;
|
||||
popWidth += gCol.Width;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (model.LookUpWidth > 0)
|
||||
{
|
||||
popWidth = model.LookUpWidth + 5;
|
||||
}
|
||||
searchEdit.PopupFormSize = new Size(popWidth, searchEdit.PopupFormSize.Height);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
@@ -1457,6 +2048,7 @@ namespace Lskj.Control
|
||||
{
|
||||
if (this.DisableFieldSources && item.isVislble) continue;
|
||||
if (ControlType.IsNotLoadData(item.FieldType)) continue;
|
||||
if (IsSpecialReturnBox(item.FieldType)) continue;
|
||||
if (UpdateColumnRefresh && !string.IsNullOrWhiteSpace(UpdateColumns) && !UpdateColumns.Split(',').Contains(item.FieldName)) continue;
|
||||
if (!string.IsNullOrWhiteSpace(item.SqlSource))
|
||||
{
|
||||
@@ -4573,6 +5165,11 @@ namespace Lskj.Control
|
||||
if (SystemInfo.Instance.DisableCellAutoFiltering && edit.Properties != null) edit.Properties.AutoComplete = false;//设置是否启用自动完成功能
|
||||
RepositoryItemGridLookUpEdit searchEdit = edit.Properties;
|
||||
DataTable dt = (searchEdit.DataSource as DataTable);
|
||||
GridColumnModel model = searchEdit.Tag as GridColumnModel;
|
||||
if (dt == null && model != null && IsSpecialReturnBox(model.FieldType))
|
||||
{
|
||||
return;
|
||||
}
|
||||
BeginInvoke(new MethodInvoker(delegate ()
|
||||
{
|
||||
FilterLookup(sender, e.NewValue + "");
|
||||
@@ -8165,6 +8762,8 @@ namespace Lskj.Control
|
||||
Tag = normalCol,
|
||||
OptionsColumn = { AllowEdit = normalCol.Edit, FixedWidth = true }
|
||||
};
|
||||
col.OptionsFilter.AutoFilterCondition = AutoFilterCondition.Contains;
|
||||
col.OptionsFilter.FilterPopupMode = FilterPopupMode.CheckedList;
|
||||
if (!normalCol.Edit)
|
||||
{
|
||||
col.AppearanceHeader.Options.UseForeColor = true;
|
||||
@@ -8213,6 +8812,7 @@ namespace Lskj.Control
|
||||
|
||||
BandedGridColumn subColumn = new BandedGridColumn
|
||||
{
|
||||
Name = dynamicFieldName,
|
||||
FieldName = dynamicFieldName,
|
||||
Caption = subCaption,
|
||||
Width = subField.Width,
|
||||
@@ -8222,6 +8822,8 @@ namespace Lskj.Control
|
||||
MaxWidth = subField.Width,
|
||||
OptionsColumn = { AllowEdit = subField.Edit, FixedWidth = true }
|
||||
};
|
||||
subColumn.OptionsFilter.AutoFilterCondition = AutoFilterCondition.Contains;
|
||||
subColumn.OptionsFilter.FilterPopupMode = FilterPopupMode.CheckedList;
|
||||
if (!subField.Edit)
|
||||
{
|
||||
subColumn.AppearanceHeader.Options.UseForeColor = true;
|
||||
@@ -8302,6 +8904,8 @@ namespace Lskj.Control
|
||||
Tag = normalCol,
|
||||
OptionsColumn = { AllowEdit = normalCol.Edit, FixedWidth = true }
|
||||
};
|
||||
col.OptionsFilter.AutoFilterCondition = DevExpress.XtraTreeList.Columns.AutoFilterCondition.Contains;
|
||||
col.OptionsFilter.FilterPopupMode = DevExpress.XtraTreeList.FilterPopupMode.CheckedList;
|
||||
if (!normalCol.Edit)
|
||||
{
|
||||
col.AppearanceHeader.Options.UseForeColor = true;
|
||||
@@ -8355,6 +8959,7 @@ namespace Lskj.Control
|
||||
|
||||
DevExpress.XtraTreeList.Columns.TreeListColumn subColumn = new DevExpress.XtraTreeList.Columns.TreeListColumn
|
||||
{
|
||||
Name = dynamicFieldName,
|
||||
FieldName = dynamicFieldName,
|
||||
Caption = subCaption,
|
||||
Width = subField.Width,
|
||||
@@ -8363,6 +8968,8 @@ namespace Lskj.Control
|
||||
MinWidth = subField.Width,
|
||||
OptionsColumn = { AllowEdit = subField.Edit, FixedWidth = true }
|
||||
};
|
||||
subColumn.OptionsFilter.AutoFilterCondition = DevExpress.XtraTreeList.Columns.AutoFilterCondition.Contains;
|
||||
subColumn.OptionsFilter.FilterPopupMode = DevExpress.XtraTreeList.FilterPopupMode.CheckedList;
|
||||
if (!subField.Edit)
|
||||
{
|
||||
subColumn.AppearanceHeader.Options.UseForeColor = true;
|
||||
@@ -9252,6 +9859,16 @@ namespace Lskj.Control
|
||||
{
|
||||
this.mLoading = false;
|
||||
mControlSourceDic.Clear();
|
||||
mSpecialReturnSourceDic.Clear();
|
||||
mSpecialReturnSourceTaskDic.Clear();
|
||||
mSpecialReturnDisplayDic.Clear();
|
||||
foreach (GridColumnModel model in mControlList)
|
||||
{
|
||||
if (IsSpecialReturnBox(model.FieldType))
|
||||
{
|
||||
StartSpecialReturnSourceTask(model);
|
||||
}
|
||||
}
|
||||
SetColumnsSource(UpdateColumnRefresh);
|
||||
}
|
||||
|
||||
|
||||
@@ -18,6 +18,7 @@ using System.Windows.Forms;
|
||||
using DevExpress.XtraEditors;
|
||||
using DevExpress.XtraEditors.Controls;
|
||||
using Lskj.Control.Model;
|
||||
using Lskj.Business.Impl;
|
||||
|
||||
namespace Lskj.Control
|
||||
{
|
||||
@@ -51,12 +52,48 @@ namespace Lskj.Control
|
||||
/// </summary>
|
||||
/// <value>The label.</value>
|
||||
public Label Label { get { return lblText; } }
|
||||
/// <summary>
|
||||
/// The contro object
|
||||
/// </summary>
|
||||
public MyControl ControlObj;
|
||||
/// <summary>
|
||||
/// 数据源
|
||||
/// </summary>
|
||||
public string SourceSQL = string.Empty;
|
||||
/// <summary>
|
||||
/// 是否带参数
|
||||
/// </summary>
|
||||
public bool Isparameters = false;
|
||||
|
||||
|
||||
public LabelComboxEdit()
|
||||
{
|
||||
InitializeComponent();
|
||||
// 绑定事件
|
||||
txtEdit.QueryPopUp += TxtEdit_QueryPopUp;
|
||||
|
||||
}
|
||||
|
||||
private void TxtEdit_QueryPopUp(object sender, CancelEventArgs e)
|
||||
{
|
||||
this.RefreshData();
|
||||
}
|
||||
|
||||
public void RefreshData()
|
||||
{
|
||||
if (Isparameters && !string.IsNullOrWhiteSpace(this.SourceSQL) && this.ControlObj != null)
|
||||
{
|
||||
string oldValue = this.EditValue;
|
||||
|
||||
string sqlValue = this.ControlObj.ReplaceControlValue(this.SourceSQL);
|
||||
sqlValue = sqlValue.Replace("#", "");
|
||||
DataTable table = BaseImpl.GetDataTableResult(sqlValue);
|
||||
this.SetDataSource(table, true);
|
||||
this.EditText = oldValue;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// <para>说明:设置控件显示文本</para>
|
||||
@@ -261,9 +298,25 @@ namespace Lskj.Control
|
||||
/// </summary>
|
||||
/// <param name="dataSource">数据源</param>
|
||||
public void SetDataSource(DataTable dataSource)
|
||||
{
|
||||
SetDataSource(dataSource, false);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// <para>说明:设置数据源</para>
|
||||
/// </summary>
|
||||
/// <param name="dataSource">数据源</param>
|
||||
/// <param name="clearBeforeBind">绑定前是否清空原数据源</param>
|
||||
public void SetDataSource(DataTable dataSource, bool clearBeforeBind)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (clearBeforeBind)
|
||||
{
|
||||
ClearDataSource();
|
||||
}
|
||||
if (dataSource == null) return;
|
||||
|
||||
foreach (DataRow item in dataSource.Rows)
|
||||
{
|
||||
ComboBoxModel model = new ComboBoxModel
|
||||
@@ -282,6 +335,17 @@ namespace Lskj.Control
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 清空下拉数据源和已选项,避免带参数下拉每次弹出重复追加。
|
||||
/// </summary>
|
||||
private void ClearDataSource()
|
||||
{
|
||||
this._sources.Clear();
|
||||
this.txtEdit.SelectedItem = null;
|
||||
this.txtEdit.EditValue = null;
|
||||
this.txtEdit.Properties.Items.Clear();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 背景颜色
|
||||
/// </summary>
|
||||
@@ -347,4 +411,4 @@ namespace Lskj.Control
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -203,9 +203,29 @@ namespace Lskj.Control
|
||||
}
|
||||
set
|
||||
{
|
||||
this.txtEdit.Text = value;
|
||||
//this.txtEdit.Text = value;
|
||||
this.txtEdit.Text = NormalizeMemoText(value);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 处理换行 (\n的换行不会生效,必须要\r\n才行。这里会把\n转成\r\n)
|
||||
/// </summary>
|
||||
/// <param name="value"></param>
|
||||
/// <returns></returns>
|
||||
private static string NormalizeMemoText(string value)
|
||||
{
|
||||
if (string.IsNullOrEmpty(value)) return value;
|
||||
|
||||
return value
|
||||
.Replace("\r\n", "\n") // 先把 CRLF 压成 LF
|
||||
.Replace("\r", "\n") // 再把单独 CR 压成 LF
|
||||
.Replace("\n", Environment.NewLine); // 最后统一成 Windows CRLF
|
||||
}
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// <para>说明:设置控件提示文本</para>
|
||||
/// <para>创建人:龚宇超</para>
|
||||
|
||||
@@ -493,13 +493,21 @@ namespace Lskj.Control.Model
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 测试特殊搜索框返回id
|
||||
/// 快速搜索框返回id(字典模式)
|
||||
/// </summary>
|
||||
public const int SpecialSearchBoxToId = 181;
|
||||
public const int DictionarySearchBoxToId = 181;
|
||||
/// <summary>
|
||||
/// 测试特殊搜索框返回text
|
||||
/// 快速搜索框返回text(字典模式)
|
||||
/// </summary>
|
||||
public const int SpecialSearchBoxToText = 182;
|
||||
public const int DictionarySearchBoxToText = 182;
|
||||
/// <summary>
|
||||
/// 快速搜索框返回id 带参数(字典模式)
|
||||
/// </summary>
|
||||
public const int DictionarySearchBoxToIdParam = 183;
|
||||
/// <summary>
|
||||
/// 快速搜索框返回text 带参数(字典模式)
|
||||
/// </summary>
|
||||
public const int DictionarySearchBoxToTextParam = 184;
|
||||
|
||||
/// <summary>
|
||||
/// <para>说明:是否为Value类型</para>
|
||||
|
||||
@@ -423,7 +423,10 @@ namespace Lskj.Control.Model
|
||||
this._bandTitle = item.Table.Columns.Contains("bandTitle") ? item["bandTitle"] + "" : string.Empty;
|
||||
this._bandFields = item.Table.Columns.Contains("bandFields") ? item["bandFields"] + "" : string.Empty;
|
||||
this._fieldtype = item.Table.Columns.Contains("fieldsqltag") && !string.IsNullOrWhiteSpace(item["fieldsqltag"] + "") ? Convert.ToInt32(item["fieldsqltag"] + "") : 0;
|
||||
|
||||
//if (this._fieldtype == 5 || this._fieldtype == 15)
|
||||
//{
|
||||
// _fieldtype = 181;
|
||||
//}
|
||||
this._sqlSource = item.Table.Columns.Contains("fieldsql") && !string.IsNullOrWhiteSpace(item["fieldsql"] + "") ? item["fieldsql"] + "" : string.Empty;
|
||||
this._valueMember = item.Table.Columns.Contains("fieldsqlid") && !string.IsNullOrWhiteSpace(item["fieldsqlid"] + "") ? item["fieldsqlid"] + "" : "dm";
|
||||
this._textMember = item.Table.Columns.Contains("fieldsqlname") && !string.IsNullOrWhiteSpace(item["fieldsqlname"] + "") ? item["fieldsqlname"] + "" : "mc";
|
||||
|
||||
@@ -3048,7 +3048,18 @@ namespace Lskj.Control.Model
|
||||
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 快速导入
|
||||
/// </summary>
|
||||
/// <param name="gridView"></param>
|
||||
/// <param name="SysModel"></param>
|
||||
/// <param name="parmaryKey"></param>
|
||||
/// <param name="leftField"></param>
|
||||
/// <param name="leftValue"></param>
|
||||
/// <param name="ImportReturnName"></param>
|
||||
/// <param name="ImportReturnValue"></param>
|
||||
/// <param name="ParentGridEx"></param>
|
||||
/// <returns></returns>
|
||||
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();
|
||||
|
||||
@@ -485,6 +485,12 @@ namespace Lskj.Control.Model
|
||||
{
|
||||
tipOnlyOne = false;
|
||||
string prompt = ReplaceHelper.ReplaceRowParam(rowData, model.BeforeMsg);
|
||||
if (model.Mergeexec)
|
||||
{
|
||||
//替换[],替换的是多选行中的数据
|
||||
prompt = ReplaceHelper.ReplaceRowParam(rows, prompt.Replace("[", "{").Replace("]", "}"), "", "");
|
||||
}
|
||||
|
||||
if (prompt.StartsWith("@") || prompt.StartsWith("!"))
|
||||
{
|
||||
prompt = BaseImpl.GetDefaultValue(prompt);
|
||||
|
||||
@@ -42,6 +42,14 @@ namespace Lskj.Control.Model
|
||||
{
|
||||
int[] mSelectRows = this._gridView.GetSelectedRows();
|
||||
if (mSelectRows == null || mSelectRows.Length == 0) return;
|
||||
|
||||
DataRow[] dataRows = new DataRow[mSelectRows.Length];
|
||||
for (int i = 0; i < mSelectRows.Length; i++)
|
||||
{
|
||||
dataRows[i] = this._gridView.GetDataRow(mSelectRows[i]);
|
||||
}
|
||||
|
||||
|
||||
DataRow mSelectRow = this._gridView.GetDataRow(mSelectRows[0]);
|
||||
this._gridView.UpdateCurrentRow();
|
||||
this._gridView.ShowEditor();
|
||||
@@ -127,6 +135,13 @@ namespace Lskj.Control.Model
|
||||
cond = _control.ReplaceParentControlValue(model.MenuCond);
|
||||
}
|
||||
cond = ReplaceHelper.ReplaceRowParam(selectRow, model.MenuCond);
|
||||
|
||||
if (model.Mergeexec&& cond.StartsWith("@"))
|
||||
{
|
||||
//替换[],替换的是多选行中的数据
|
||||
cond = ReplaceHelper.ReplaceRowParam(dataRows, cond.Replace("[", "{").Replace("]", "}"), "", "");
|
||||
}
|
||||
|
||||
if (this._gridView != null)
|
||||
{
|
||||
if (cells != null && cells.Length > 0 && cond.Contains("{COLUMN_"))
|
||||
|
||||
@@ -134,37 +134,69 @@ namespace Lskj.Control.Model.MenuStrip
|
||||
{
|
||||
try
|
||||
{
|
||||
string cond = string.Empty;
|
||||
if (this._control != null)
|
||||
cond = _control.ReplaceParentControlValue(model.MenuCond);
|
||||
cond = ReplaceHelper.ReplaceRowParam(mSelectRow, model.MenuCond);
|
||||
if (this._treeView != null)
|
||||
bool condResult = false;
|
||||
StringBuilder condBuilder = new StringBuilder();
|
||||
StringBuilder sqlCondBuilder = new StringBuilder();
|
||||
List<TreeListCell> cells = this._treeView != null ? this._treeView.GetSelectedCells() : null;
|
||||
DataRow focusedRow = this.TreeGridControlObj.GetViewFocusedDataRow();
|
||||
foreach (DataRow selectRow in mSelectRows)
|
||||
{
|
||||
List<TreeListCell> cells = this._treeView.GetSelectedCells();
|
||||
if (selectRow == null) continue;
|
||||
|
||||
string cond = string.Empty;
|
||||
if (this._control != null)
|
||||
cond = _control.ReplaceParentControlValue(model.MenuCond);
|
||||
cond = ReplaceHelper.ReplaceRowParam(selectRow, model.MenuCond);
|
||||
|
||||
if (model.Mergeexec && cond.StartsWith("@"))
|
||||
{
|
||||
//替换[],替换的是多选行中的数据
|
||||
cond = ReplaceHelper.ReplaceRowParam(mSelectRows, cond.Replace("[", "{").Replace("]", "}"), "", "");
|
||||
}
|
||||
|
||||
if (cells != null && cells.Count > 0 && cond.Contains("{COLUMN_"))
|
||||
{
|
||||
TreeListCell cell = cells[0];
|
||||
DataRow focusedRow = this.BaseGridView.GetFocusedDataRow();
|
||||
string colValue = focusedRow == null || !focusedRow.Table.Columns.Contains(cell.Column.Name) ? "" : focusedRow[cell.Column.Name] + "";
|
||||
cond = cond.ReplaceColumnParam(cell.Column.Name, cell.Column.Caption, colValue);
|
||||
}
|
||||
}
|
||||
if (ControlObj != null)
|
||||
cond = ControlObj.ReplaceParentControlValue(cond);
|
||||
//cms.Enabled = ReplaceHelper.EvalCond(cond);
|
||||
|
||||
if (ControlObj != null)
|
||||
cond = ControlObj.ReplaceParentControlValue(cond);
|
||||
|
||||
if (cond.StartsWith("@"))
|
||||
{
|
||||
sqlCondBuilder.Append($"({cond.TrimStart('@')}) = '1' and ");
|
||||
}
|
||||
else
|
||||
{
|
||||
condBuilder.Append($"({cond}) and ");
|
||||
}
|
||||
}
|
||||
string condStr = "";
|
||||
if (model.MenuCond.StartsWith("@"))
|
||||
{
|
||||
condStr = $"@if({sqlCondBuilder.ToString().TrimEnd().TrimEnd('d', 'n', 'a')}) begin select '1' end else begin select '0' end";
|
||||
}
|
||||
else
|
||||
{
|
||||
condStr = condBuilder.ToString().TrimEnd().TrimEnd('d', 'n', 'a');
|
||||
}
|
||||
condResult = ValidateCond(condStr, null);
|
||||
//cms.Enabled = ReplaceHelper.EvalCond(cond);
|
||||
if (model.ForbiddenDisplay)
|
||||
{
|
||||
cms.Visible = ValidateCond(cond, null);
|
||||
cms.Visible = condResult;
|
||||
}
|
||||
|
||||
cms.Enabled = ValidateCond(cond, null); ;
|
||||
cms.Enabled = condResult;
|
||||
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
string Message = ErrorMessage.PromptErrorMessage(ex);
|
||||
MessageUtil.Show(ResourceKeys.SetRightMenuCondFault + "\r\n" + Message);
|
||||
e.Cancel = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -26,6 +26,10 @@ namespace Lskj.Control
|
||||
/// </summary>
|
||||
public sealed class MessageUtil
|
||||
{
|
||||
|
||||
public static string Prompt = string.IsNullOrWhiteSpace(SystemInfo.Instance.DeadlockPrompt) ? "网络连接超时,请稍候再试!" : SystemInfo.Instance.DeadlockPrompt;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// <para>说明:弹出Ok对话框</para>
|
||||
/// <para>创建人:龚宇超</para>
|
||||
@@ -51,7 +55,7 @@ namespace Lskj.Control
|
||||
}
|
||||
|
||||
if (!string.IsNullOrEmpty(msg) && msg.Contains("与另一个进程被死锁在")&& !SystemInfo.Instance.PromptDeadlock)
|
||||
msg = "网络连接超时,请稍候再试!";
|
||||
msg = Prompt;
|
||||
if (Business.Impl.LanguageTranslation.Translatable)
|
||||
{
|
||||
msg = Business.Impl.LanguageTranslation.GetTranslatedText(msg);
|
||||
@@ -87,7 +91,7 @@ namespace Lskj.Control
|
||||
|
||||
if (!string.IsNullOrEmpty(errorMessage) && errorMessage.Contains("与另一个进程被死锁在") && !SystemInfo.Instance.PromptDeadlock)
|
||||
{
|
||||
errorMessage = "网络连接超时,请稍候再试!";
|
||||
errorMessage = Prompt;
|
||||
if (Business.Impl.LanguageTranslation.Translatable)
|
||||
{
|
||||
errorMessage = Business.Impl.LanguageTranslation.GetTranslatedText(errorMessage);
|
||||
@@ -162,7 +166,7 @@ namespace Lskj.Control
|
||||
{
|
||||
string msg = ex == null ? ResourceKeys.UnKownErrorTip : ex.StackTrace;
|
||||
if (!string.IsNullOrEmpty(msg) && msg.Contains("与另一个进程被死锁在") && !SystemInfo.Instance.PromptDeadlock)
|
||||
msg = "网络连接超时,请稍候再试!";
|
||||
msg = Prompt;
|
||||
if (Business.Impl.LanguageTranslation.Translatable)
|
||||
{
|
||||
msg = Business.Impl.LanguageTranslation.GetTranslatedText(msg);
|
||||
@@ -173,7 +177,7 @@ namespace Lskj.Control
|
||||
{
|
||||
string msg = ex == null ? ResourceKeys.UnKownErrorTip : ex.Message; //ResourceKeys.SystemErrorTip + "\r\n" + ex.Message + "\r\n" + ex.StackTrace;
|
||||
if (!string.IsNullOrEmpty(msg) && msg.Contains("与另一个进程被死锁在") && !SystemInfo.Instance.PromptDeadlock)
|
||||
msg = "网络连接超时,请稍候再试!";
|
||||
msg = Prompt;
|
||||
if (Business.Impl.LanguageTranslation.Translatable)
|
||||
{
|
||||
msg = Business.Impl.LanguageTranslation.GetTranslatedText(msg);
|
||||
|
||||
@@ -1503,7 +1503,31 @@ namespace Lskj.Control.Model
|
||||
// 下拉框
|
||||
LabelComboxEdit comboxEdit = ctr as LabelComboxEdit;
|
||||
comboxEdit.SetDataSource(table);
|
||||
comboxEdit.TextEdit.SelectedIndex = 0;
|
||||
|
||||
if (comboxEdit.Isparameters)
|
||||
{
|
||||
List<string> condition = ReplaceHelper.GetParamFields(model.SourceSql);
|
||||
foreach (string item in condition)
|
||||
{
|
||||
string filename = item.Trim('{', '}');
|
||||
if (ParaContrlsDic.ContainsKey(filename))
|
||||
{
|
||||
if (!ParaContrlsDic[filename].Contains(model.FieldName))
|
||||
{
|
||||
ParaContrlsDic[filename].Add(model.FieldName);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
ParaContrlsDic[filename] = new List<string>() { model.FieldName };
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
//默认选中第一个,如果设置了带参数,就不默认选中
|
||||
comboxEdit.TextEdit.SelectedIndex = 0;
|
||||
}
|
||||
break;
|
||||
case ControlType.LabAutoCompleteValue:
|
||||
case ControlType.LabAutoCompleteText:
|
||||
@@ -3829,6 +3853,7 @@ namespace Lskj.Control.Model
|
||||
if (rowItem == null) return;
|
||||
foreach (ControlModel model in this.ControlModels)
|
||||
{
|
||||
|
||||
selectModel = model;
|
||||
|
||||
if (rowItem.Table.Columns.Contains(model.FieldName))
|
||||
@@ -3859,6 +3884,8 @@ namespace Lskj.Control.Model
|
||||
{
|
||||
SetControlValue(model, "****");
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
@@ -4212,6 +4239,27 @@ namespace Lskj.Control.Model
|
||||
model.FieldType = 161;
|
||||
model.IsRadio = true;
|
||||
}
|
||||
//快速搜索框在控件中转成普通搜索框
|
||||
if (model.FieldType == 181 || model.FieldType == 182 || model.FieldType == 183 || model.FieldType == 184)
|
||||
{
|
||||
switch (model.FieldType)
|
||||
{
|
||||
case ControlType.DictionarySearchBoxToId:
|
||||
model.FieldType = 5;
|
||||
break;
|
||||
case ControlType.DictionarySearchBoxToText:
|
||||
model.FieldType = 6;
|
||||
break;
|
||||
case ControlType.DictionarySearchBoxToIdParam:
|
||||
model.FieldType = 15;
|
||||
break;
|
||||
case ControlType.DictionarySearchBoxToTextParam:
|
||||
model.FieldType = 16;
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return model;
|
||||
}
|
||||
@@ -4340,6 +4388,13 @@ namespace Lskj.Control.Model
|
||||
comboxEdit.ValueMember = ControlType.LabComboxValue == model.FieldType || ControlType.LabComboxValueParam == model.FieldType ? model.ValueMember : model.TextMember;
|
||||
comboxEdit.ValueField = model.ValueMember;
|
||||
comboxEdit.TextField = model.TextMember;
|
||||
if (ControlType.LabComboxValueParam == model.FieldType || ControlType.LabComboxTextParam == model.FieldType)
|
||||
{
|
||||
comboxEdit.ControlObj = this;
|
||||
comboxEdit.SourceSQL = model.SourceSql;
|
||||
comboxEdit.Isparameters = true;
|
||||
}
|
||||
|
||||
//comboxEdit.SetDataSource(dataSource);
|
||||
// 假如为报表模式并且没有默认值,默认选择第一条记录
|
||||
if (model.IsSearchControl && string.IsNullOrEmpty(model.DefaultValue))
|
||||
@@ -5426,6 +5481,10 @@ namespace Lskj.Control.Model
|
||||
{
|
||||
labelAutoGridLook.HandPopupSqlValue(labelAutoGridLook.SourceSQL);
|
||||
}
|
||||
if (baseUserControl is LabelComboxEdit labelComboxEdit)
|
||||
{
|
||||
labelComboxEdit.RefreshData();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -6415,10 +6474,10 @@ namespace Lskj.Control.Model
|
||||
if (rowItem == null) return;
|
||||
foreach (ControlModel model in this.ControlModels)
|
||||
{
|
||||
if (rowItem.Table.Columns.Contains(model.FieldName)&&!string.IsNullOrWhiteSpace(model.DefaultValue))
|
||||
if (rowItem.Table.Columns.Contains(model.FieldName) && !string.IsNullOrWhiteSpace(model.DefaultValue))
|
||||
{
|
||||
string DefaultValue = ReplaceHelper.ReplaceUserInfo(model.DefaultValue);
|
||||
if (!DefaultValue.Equals(rowItem[model.FieldName] + ""))
|
||||
if (!DefaultValue.Equals(rowItem[model.FieldName] + ""))
|
||||
{
|
||||
BaseUserControl baseControl = FindControl(model.FieldName);
|
||||
if (baseControl == null) continue;
|
||||
@@ -6432,7 +6491,7 @@ namespace Lskj.Control.Model
|
||||
// baseControl.ForeColor = ColorTranslator.FromHtml("#000000");
|
||||
// baseControl.ContentBold = false;
|
||||
//}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -124,12 +124,19 @@ namespace Lskj.Control.Model
|
||||
form.IsMdiContainer = true;
|
||||
form.WindowState = System.Windows.Forms.FormWindowState.Maximized;
|
||||
|
||||
design.ReportObj.Prepare();
|
||||
design.ReportObj.Design(form);
|
||||
design.ReportObj.Designer.BorderStyle = BorderStyle.None;
|
||||
design.ReportObj.Designer.cmdPreview.CustomAction += OnCustomAction;
|
||||
try
|
||||
{
|
||||
design.ReportObj.Prepare();
|
||||
design.ReportObj.Design(form);
|
||||
design.ReportObj.Designer.BorderStyle = BorderStyle.None;
|
||||
design.ReportObj.Designer.cmdPreview.CustomAction += OnCustomAction;
|
||||
|
||||
form.ShowDialog();
|
||||
form.ShowDialog();
|
||||
}
|
||||
finally
|
||||
{
|
||||
ReleaseFastReportDesignerResource(design);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -156,13 +163,50 @@ namespace Lskj.Control.Model
|
||||
//MessageUtil.Show(ex);
|
||||
string Message = ErrorMessage.PromptErrorMessage(ex);
|
||||
MessageUtil.Show(Message, ex.Message);
|
||||
design.ReportObj.Design();
|
||||
if (design != null && design.ReportObj != null)
|
||||
{
|
||||
design.ReportObj.Design();
|
||||
}
|
||||
WaitForm.HideForm();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
private static void ReleaseFastReportDesignerResource(FrmFastReportDesign design)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (design != null && design.ReportObj != null && design.ReportObj.Designer != null)
|
||||
{
|
||||
try
|
||||
{
|
||||
design.ReportObj.Designer.StopAutoSave();
|
||||
}
|
||||
catch
|
||||
{
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
design.ReportObj.Designer.cmdPreview.CustomAction -= OnCustomAction;
|
||||
}
|
||||
catch
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
if (design != null && design.ReportObj != null)
|
||||
{
|
||||
design.ReportObj.Dispose();
|
||||
design.ReportObj = null;
|
||||
}
|
||||
}
|
||||
catch
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
private static void OnCustomAction(object sender, EventArgs e)
|
||||
{
|
||||
FastReport.Design.StandardDesigner.DesignerControl design = sender as FastReport.Design.StandardDesigner.DesignerControl;
|
||||
|
||||
@@ -1882,7 +1882,7 @@ namespace Lskj.Control
|
||||
/// </summary>
|
||||
public void InitializeTab()
|
||||
{
|
||||
DataTable table = BaseModuleImpl.GetBaseAttach(this.Model.ModuleCode);//查看是否有附加模块
|
||||
DataTable table = BaseModuleImpl.GetBaseAttachKey(this.SysModel.FormKey);//查看是否有附加模块
|
||||
if (table.Rows.Count > 0)
|
||||
{
|
||||
XtraTabPage MainTableTab = new XtraTabPage();
|
||||
|
||||
+5
-4
@@ -28,14 +28,15 @@
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.pm_print = new DevExpress.XtraBars.PopupMenu();
|
||||
this.barManager1 = new DevExpress.XtraBars.BarManager();
|
||||
this.components = new System.ComponentModel.Container();
|
||||
this.pm_print = new DevExpress.XtraBars.PopupMenu(this.components);
|
||||
this.barManager1 = new DevExpress.XtraBars.BarManager(this.components);
|
||||
this.barDockControlTop = new DevExpress.XtraBars.BarDockControl();
|
||||
this.barDockControlBottom = new DevExpress.XtraBars.BarDockControl();
|
||||
this.barDockControlLeft = new DevExpress.XtraBars.BarDockControl();
|
||||
this.barDockControlRight = new DevExpress.XtraBars.BarDockControl();
|
||||
this.pm_oper = new DevExpress.XtraBars.PopupMenu();
|
||||
this.pm_common = new DevExpress.XtraBars.PopupMenu();
|
||||
this.pm_oper = new DevExpress.XtraBars.PopupMenu(this.components);
|
||||
this.pm_common = new DevExpress.XtraBars.PopupMenu(this.components);
|
||||
this.grouptip = new System.Windows.Forms.GroupBox();
|
||||
this.TipsPanel = new System.Windows.Forms.Panel();
|
||||
this.scc_container = new DevExpress.XtraEditors.SplitContainerControl();
|
||||
|
||||
@@ -300,14 +300,18 @@ namespace Lskj.FastReportDesign
|
||||
{
|
||||
if (ERPInfo.Instance.IsUserManager || SystemInfo.Instance.PrintTemplate.Split(',').Contains(ERPInfo.Instance.UserName))
|
||||
{
|
||||
this.ReportObj.Prepare();
|
||||
this.ReportObj.Design(form);
|
||||
this.ReportObj.Designer.BorderStyle = BorderStyle.None;
|
||||
this.ReportObj.Designer.cmdPreview.CustomAction += OnCustomAction;
|
||||
form.ShowDialog();
|
||||
//this.ReportObj.Design(form);
|
||||
//this.ReportObj.Designer.cmdPreview.CustomAction += OnCustomAction;
|
||||
//form.ShowDialog();
|
||||
try
|
||||
{
|
||||
this.ReportObj.Prepare();
|
||||
this.ReportObj.Design(form);
|
||||
this.ReportObj.Designer.BorderStyle = BorderStyle.None;
|
||||
this.ReportObj.Designer.cmdPreview.CustomAction += OnCustomAction;
|
||||
form.ShowDialog();
|
||||
}
|
||||
finally
|
||||
{
|
||||
ReleaseDesignerResource();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -349,11 +353,53 @@ namespace Lskj.FastReportDesign
|
||||
MessageUtil.Show(Message, ex.Message);
|
||||
|
||||
//MessageUtil.Show(ex);
|
||||
this.ReportObj.Design();
|
||||
if (this.ReportObj != null)
|
||||
{
|
||||
this.ReportObj.Design();
|
||||
}
|
||||
WaitForm.HideForm();
|
||||
}
|
||||
}
|
||||
|
||||
private void ReleaseDesignerResource()
|
||||
{
|
||||
try
|
||||
{
|
||||
if (this.ReportObj != null && this.ReportObj.Designer != null)
|
||||
{
|
||||
try
|
||||
{
|
||||
this.ReportObj.Designer.StopAutoSave();
|
||||
}
|
||||
catch
|
||||
{
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
this.ReportObj.Designer.cmdPreview.CustomAction -= OnCustomAction;
|
||||
}
|
||||
catch
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
if (form != null && !form.IsDisposed)
|
||||
{
|
||||
form.Dispose();
|
||||
}
|
||||
|
||||
if (this.ReportObj != null)
|
||||
{
|
||||
this.ReportObj.Dispose();
|
||||
this.ReportObj = null;
|
||||
}
|
||||
}
|
||||
catch
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
private void OnCustomAction(object sender, EventArgs e)
|
||||
{
|
||||
FastReport.Design.StandardDesigner.DesignerControl design = sender as FastReport.Design.StandardDesigner.DesignerControl;
|
||||
@@ -402,4 +448,4 @@ namespace Lskj.FastReportDesign
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -267,6 +267,10 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Lskj.PubGroupSettings", "..
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Lskj.Main", "..\Lskj.Main\Lskj.Main.csproj", "{BCA1E2B3-C4AB-4D2C-B519-3DCFDB5B83D6}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Lskj.PubCodeDesign", "..\Lskj.PubCodeDesign\Lskj.PubCodeDesign.csproj", "{552308D8-450C-4ECA-9A3E-543AF0F8E150}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Lskj.PubBillManagement", "..\Lskj.PubBillManagement\Lskj.PubBillManagement.csproj", "{6CE319BA-1253-41F2-8B59-8173FD7BE3F3}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
@@ -1713,6 +1717,30 @@ Global
|
||||
{BCA1E2B3-C4AB-4D2C-B519-3DCFDB5B83D6}.Release|Mixed Platforms.Build.0 = Release|x86
|
||||
{BCA1E2B3-C4AB-4D2C-B519-3DCFDB5B83D6}.Release|x86.ActiveCfg = Release|x86
|
||||
{BCA1E2B3-C4AB-4D2C-B519-3DCFDB5B83D6}.Release|x86.Build.0 = Release|x86
|
||||
{552308D8-450C-4ECA-9A3E-543AF0F8E150}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{552308D8-450C-4ECA-9A3E-543AF0F8E150}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{552308D8-450C-4ECA-9A3E-543AF0F8E150}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
|
||||
{552308D8-450C-4ECA-9A3E-543AF0F8E150}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
|
||||
{552308D8-450C-4ECA-9A3E-543AF0F8E150}.Debug|x86.ActiveCfg = Debug|Any CPU
|
||||
{552308D8-450C-4ECA-9A3E-543AF0F8E150}.Debug|x86.Build.0 = Debug|Any CPU
|
||||
{552308D8-450C-4ECA-9A3E-543AF0F8E150}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{552308D8-450C-4ECA-9A3E-543AF0F8E150}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{552308D8-450C-4ECA-9A3E-543AF0F8E150}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
|
||||
{552308D8-450C-4ECA-9A3E-543AF0F8E150}.Release|Mixed Platforms.Build.0 = Release|Any CPU
|
||||
{552308D8-450C-4ECA-9A3E-543AF0F8E150}.Release|x86.ActiveCfg = Release|Any CPU
|
||||
{552308D8-450C-4ECA-9A3E-543AF0F8E150}.Release|x86.Build.0 = Release|Any CPU
|
||||
{6CE319BA-1253-41F2-8B59-8173FD7BE3F3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{6CE319BA-1253-41F2-8B59-8173FD7BE3F3}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{6CE319BA-1253-41F2-8B59-8173FD7BE3F3}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
|
||||
{6CE319BA-1253-41F2-8B59-8173FD7BE3F3}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
|
||||
{6CE319BA-1253-41F2-8B59-8173FD7BE3F3}.Debug|x86.ActiveCfg = Debug|Any CPU
|
||||
{6CE319BA-1253-41F2-8B59-8173FD7BE3F3}.Debug|x86.Build.0 = Debug|Any CPU
|
||||
{6CE319BA-1253-41F2-8B59-8173FD7BE3F3}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{6CE319BA-1253-41F2-8B59-8173FD7BE3F3}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{6CE319BA-1253-41F2-8B59-8173FD7BE3F3}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
|
||||
{6CE319BA-1253-41F2-8B59-8173FD7BE3F3}.Release|Mixed Platforms.Build.0 = Release|Any CPU
|
||||
{6CE319BA-1253-41F2-8B59-8173FD7BE3F3}.Release|x86.ActiveCfg = Release|Any CPU
|
||||
{6CE319BA-1253-41F2-8B59-8173FD7BE3F3}.Release|x86.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
|
||||
@@ -129,6 +129,12 @@ namespace Lskj.Main.Control
|
||||
/// 缓存分组控件
|
||||
/// </summary>
|
||||
private Dictionary<string, Panel> _groupItems = new Dictionary<string, Panel>();
|
||||
private TreeView _leftGroupTreeView;
|
||||
private ImageList _leftGroupTreeIcons;
|
||||
private Panel _leftGroupSeparator;
|
||||
private const string LeftGroupTreeNodeTypeMenu = "menu";
|
||||
private const string LeftGroupTreeNodeTypeGroup = "group";
|
||||
private const int GroupControlTopPadding = 8;
|
||||
/// <summary>
|
||||
/// 缓存右上菜单控件
|
||||
/// </summary>
|
||||
@@ -301,7 +307,7 @@ namespace Lskj.Main.Control
|
||||
if (HiddenAccountSet && (SystemInfo.Instance.DefaultMainTag == 3 || SystemInfo.Instance.DefaultMainTag == 4))
|
||||
{
|
||||
pl_top_right.Width = pl_top_right.Width - this.label1.Left - this.label1.Width;
|
||||
this.lblMenuTitle.Location= new Point(this.button3.Left , this.lblMenuTitle.Top);
|
||||
this.lblMenuTitle.Location = new Point(this.button3.Left, this.lblMenuTitle.Top);
|
||||
}
|
||||
if (SystemInfo.Instance.HideSkin)
|
||||
{
|
||||
@@ -332,7 +338,10 @@ namespace Lskj.Main.Control
|
||||
{
|
||||
this.SetMenus();
|
||||
this.SetSearchMenus();
|
||||
this.tv_left.Visible = false;
|
||||
if (!CanUseLeftGroupTreeMenu())
|
||||
{
|
||||
this.tv_left.Visible = false;
|
||||
}
|
||||
}
|
||||
if (SystemInfo.Instance.DefaultMainTag == 3 || SystemInfo.Instance.DefaultMainTag == 4)
|
||||
{
|
||||
@@ -671,6 +680,385 @@ namespace Lskj.Main.Control
|
||||
|
||||
return ctr is Form ? ctr as Form : GetParent(ctr.Parent);
|
||||
}
|
||||
|
||||
private DataTable CreateLeftGroupTreeTable()
|
||||
{
|
||||
DataTable table = new DataTable();
|
||||
table.Columns.Add("nodekey");
|
||||
table.Columns.Add("parentkey");
|
||||
table.Columns.Add("nodetext");
|
||||
table.Columns.Add("nodetype");
|
||||
table.Columns.Add("menustruct");
|
||||
table.Columns.Add("groupkey");
|
||||
table.Columns.Add("sortno", typeof(int));
|
||||
table.Columns.Add("iconindex", typeof(int));
|
||||
return table;
|
||||
}
|
||||
|
||||
private void AddLeftGroupTreeNode(DataTable table, string nodeKey, string nodeText, string nodeType, string menuStruct, string groupKey)
|
||||
{
|
||||
if (table == null || string.IsNullOrWhiteSpace(nodeKey)) return;
|
||||
if (table.Rows.Cast<DataRow>().Any(n => (n["nodekey"] + "").Equals(nodeKey))) return;
|
||||
|
||||
DataRow row = table.NewRow();
|
||||
row["nodekey"] = nodeKey;
|
||||
row["parentkey"] = nodeType.Equals(LeftGroupTreeNodeTypeGroup) ? menuStruct : string.Empty;
|
||||
row["nodetext"] = nodeText;
|
||||
row["nodetype"] = nodeType;
|
||||
row["menustruct"] = menuStruct;
|
||||
row["groupkey"] = groupKey;
|
||||
row["sortno"] = table.Rows.Count + 1;
|
||||
row["iconindex"] = table.Rows.Count;
|
||||
table.Rows.Add(row);
|
||||
}
|
||||
|
||||
private string GetGroupTreeKey(string menuStruct, int groupIndex)
|
||||
{
|
||||
return string.Format("{0}|{1:00}", menuStruct, groupIndex);
|
||||
}
|
||||
|
||||
private string GetLeftGroupTreeDefaultNode(DataTable treeTable, string defaultParentMenu)
|
||||
{
|
||||
if (treeTable == null || treeTable.Rows.Count == 0) return string.Empty;
|
||||
|
||||
DataRow defaultParentRow = treeTable.Rows.Cast<DataRow>()
|
||||
.FirstOrDefault(n => (n["nodetype"] + "").Equals(LeftGroupTreeNodeTypeMenu) && (n["menustruct"] + "").Equals(defaultParentMenu));
|
||||
if (defaultParentRow != null)
|
||||
{
|
||||
return defaultParentRow["nodekey"] + "";
|
||||
}
|
||||
|
||||
DataRow firstParentRow = treeTable.Rows.Cast<DataRow>()
|
||||
.FirstOrDefault(n => (n["nodetype"] + "").Equals(LeftGroupTreeNodeTypeMenu));
|
||||
if (firstParentRow != null) return firstParentRow["nodekey"] + "";
|
||||
|
||||
return treeTable.Rows[0]["nodekey"] + "";
|
||||
}
|
||||
|
||||
private string GetGroupCaptionText(string groupCaption)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(groupCaption)) return string.Empty;
|
||||
return groupCaption.Length > 2 ? groupCaption.Remove(0, 2) : groupCaption;
|
||||
}
|
||||
|
||||
private TreeView GetLeftGroupTreeView()
|
||||
{
|
||||
if (_leftGroupTreeView != null) return _leftGroupTreeView;
|
||||
|
||||
_leftGroupTreeView = new TreeView
|
||||
{
|
||||
Dock = DockStyle.Fill,
|
||||
BorderStyle = BorderStyle.None,
|
||||
BackColor = Color.FromArgb(250, 253, 255),
|
||||
DrawMode = TreeViewDrawMode.Normal,
|
||||
Font = new Font("微软雅黑", 10F),
|
||||
ForeColor = Color.FromArgb(38, 73, 98),
|
||||
HideSelection = false,
|
||||
Indent = 20,
|
||||
ImageList = GetLeftGroupTreeIcons(),
|
||||
ItemHeight = 29,
|
||||
LineColor = Color.FromArgb(198, 214, 226),
|
||||
ShowLines = false,
|
||||
ShowPlusMinus = false,
|
||||
ShowRootLines = false
|
||||
};
|
||||
_leftGroupTreeView.NodeMouseClick += OnLeftGroupTreeViewNodeMouseClick;
|
||||
|
||||
return _leftGroupTreeView;
|
||||
}
|
||||
|
||||
private Panel GetLeftGroupSeparator()
|
||||
{
|
||||
if (_leftGroupSeparator != null) return _leftGroupSeparator;
|
||||
|
||||
_leftGroupSeparator = new Panel
|
||||
{
|
||||
Dock = DockStyle.Left,
|
||||
Width = 2,
|
||||
BackColor = Color.FromArgb(198, 214, 226),
|
||||
Margin = Padding.Empty
|
||||
};
|
||||
return _leftGroupSeparator;
|
||||
}
|
||||
|
||||
private void SetLeftGroupSeparatorVisible(bool visible)
|
||||
{
|
||||
Panel separator = GetLeftGroupSeparator();
|
||||
this.FirstMain.SuspendLayout();
|
||||
try
|
||||
{
|
||||
if (!this.FirstMain.Controls.Contains(separator))
|
||||
{
|
||||
this.FirstMain.Controls.Add(separator);
|
||||
}
|
||||
|
||||
this.FirstMain.Controls.SetChildIndex(this.pl_center_main, 0);
|
||||
this.FirstMain.Controls.SetChildIndex(separator, 1);
|
||||
this.FirstMain.Controls.SetChildIndex(this.pl_center_left, 2);
|
||||
separator.Visible = visible;
|
||||
}
|
||||
finally
|
||||
{
|
||||
this.FirstMain.ResumeLayout();
|
||||
}
|
||||
}
|
||||
|
||||
private bool CanUseLeftGroupTreeMenu()
|
||||
{
|
||||
return "1".Equals((SystemInfo.Instance.MainLeftShowMode + "").Trim()) && this._allMenus.Columns.Contains("groupcaption") && !isFlowLayout;
|
||||
}
|
||||
|
||||
private void ResetLeftMenuBarPanel()
|
||||
{
|
||||
SetLeftGroupSeparatorVisible(false);
|
||||
this.pl_center_left.Padding = new Padding(4);
|
||||
this.pl_center_left.BackColor = Color.FromArgb(10, 87, 167);
|
||||
if (_leftGroupTreeView != null && this.pl_center_left.Controls.Contains(_leftGroupTreeView))
|
||||
{
|
||||
this.pl_center_left.Controls.Remove(_leftGroupTreeView);
|
||||
}
|
||||
if (this.pl_center_left.Controls.Contains(this.tv_left))
|
||||
{
|
||||
this.tv_left.Visible = false;
|
||||
}
|
||||
}
|
||||
|
||||
private ImageList GetLeftGroupTreeIcons()
|
||||
{
|
||||
if (_leftGroupTreeIcons != null) return _leftGroupTreeIcons;
|
||||
|
||||
_leftGroupTreeIcons = new ImageList();
|
||||
_leftGroupTreeIcons.ColorDepth = ColorDepth.Depth32Bit;
|
||||
_leftGroupTreeIcons.ImageSize = new Size(18, 18);
|
||||
|
||||
string iconPath = PubUtil.MainTreeviewImagePath;
|
||||
if (Directory.Exists(iconPath))
|
||||
{
|
||||
string[] files = Directory.GetFiles(iconPath, "*.png").OrderBy(n => n).ToArray();
|
||||
foreach (string file in files)
|
||||
{
|
||||
using (Image image = ImageHelper.ReadImage(file))
|
||||
{
|
||||
if (image != null)
|
||||
{
|
||||
_leftGroupTreeIcons.Images.Add(new Bitmap(image));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (_leftGroupTreeIcons.Images.Count == 0)
|
||||
{
|
||||
_leftGroupTreeIcons.Images.Add(new Bitmap(18, 18));
|
||||
}
|
||||
return _leftGroupTreeIcons;
|
||||
}
|
||||
private void BindLeftGroupTreeView(DataTable treeTable, string defaultNode)
|
||||
{
|
||||
TreeView treeView = GetLeftGroupTreeView();
|
||||
treeView.BeginUpdate();
|
||||
treeView.Nodes.Clear();
|
||||
|
||||
Dictionary<string, TreeNode> nodeMap = new Dictionary<string, TreeNode>();
|
||||
List<DataRow> rows = treeTable.Rows.Cast<DataRow>()
|
||||
.OrderBy(n => Convert.ToInt32(n["sortno"]))
|
||||
.ToList();
|
||||
int iconCount = GetLeftGroupTreeIcons().Images.Count;
|
||||
|
||||
foreach (DataRow row in rows)
|
||||
{
|
||||
TreeNode node = new TreeNode(row["nodetext"] + "");
|
||||
int iconIndex = 0;
|
||||
int.TryParse(row["iconindex"] + "", out iconIndex);
|
||||
iconIndex = Math.Abs(iconIndex) % iconCount;
|
||||
node.ImageIndex = iconIndex;
|
||||
node.SelectedImageIndex = iconIndex;
|
||||
node.Name = row["nodekey"] + "";
|
||||
node.Tag = row;
|
||||
nodeMap[node.Name] = node;
|
||||
}
|
||||
|
||||
foreach (DataRow row in rows)
|
||||
{
|
||||
string nodeKey = row["nodekey"] + "";
|
||||
string parentKey = row["parentkey"] + "";
|
||||
TreeNode node = nodeMap[nodeKey];
|
||||
|
||||
if (!string.IsNullOrEmpty(parentKey) && nodeMap.ContainsKey(parentKey))
|
||||
{
|
||||
nodeMap[parentKey].Nodes.Add(node);
|
||||
}
|
||||
else
|
||||
{
|
||||
treeView.Nodes.Add(node);
|
||||
}
|
||||
}
|
||||
|
||||
treeView.CollapseAll();
|
||||
FocusLeftGroupTreeNode(defaultNode);
|
||||
treeView.EndUpdate();
|
||||
}
|
||||
|
||||
private void FocusLeftGroupTreeNode(string nodeKey)
|
||||
{
|
||||
if (_leftGroupTreeView == null || string.IsNullOrEmpty(nodeKey)) return;
|
||||
|
||||
TreeNode node = FindLeftGroupTreeNode(_leftGroupTreeView.Nodes, nodeKey);
|
||||
if (node == null) return;
|
||||
|
||||
_leftGroupTreeView.SelectedNode = node;
|
||||
}
|
||||
|
||||
private TreeNode FindLeftGroupTreeNode(TreeNodeCollection nodes, string nodeKey)
|
||||
{
|
||||
foreach (TreeNode node in nodes)
|
||||
{
|
||||
if (node.Name.Equals(nodeKey)) return node;
|
||||
|
||||
TreeNode childNode = FindLeftGroupTreeNode(node.Nodes, nodeKey);
|
||||
if (childNode != null) return childNode;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private void OnLeftGroupTreeViewNodeMouseClick(object sender, TreeNodeMouseClickEventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
TreeView treeView = sender as TreeView;
|
||||
if (treeView == null || e.Node == null || e.Button != MouseButtons.Left) return;
|
||||
|
||||
treeView.SelectedNode = e.Node;
|
||||
if (e.Node.Nodes.Count > 0)
|
||||
{
|
||||
e.Node.Toggle();
|
||||
}
|
||||
|
||||
OnLeftGroupTreeRowClick(e.Node.Tag as DataRow);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
string Message = ErrorMessage.PromptErrorMessage(ex);
|
||||
MessageUtil.Show(Message, ex.Message);
|
||||
}
|
||||
}
|
||||
|
||||
private void BindLeftGroupTreeMenu(DataTable treeTable, string defaultParentMenu)
|
||||
{
|
||||
if (treeTable == null || treeTable.Rows.Count == 0) return;
|
||||
|
||||
string expandNode = GetLeftGroupTreeDefaultNode(treeTable, defaultParentMenu);
|
||||
this.pl_center_left.Controls.Clear();
|
||||
this.pl_center_left.Padding = Padding.Empty;
|
||||
this.pl_center_left.BackColor = Color.FromArgb(250, 253, 255);
|
||||
this.pl_center_main.Padding = Padding.Empty;
|
||||
this.pl_center_main.BackColor = Color.FromArgb(240, 240, 240);
|
||||
SetLeftGroupSeparatorVisible(true);
|
||||
TreeView treeView = GetLeftGroupTreeView();
|
||||
this.pl_center_left.Controls.Add(treeView);
|
||||
BindLeftGroupTreeView(treeTable, expandNode);
|
||||
|
||||
if (!string.IsNullOrEmpty(expandNode))
|
||||
{
|
||||
DataRow expandRow = treeTable.Rows.Cast<DataRow>().FirstOrDefault(n => (n["nodekey"] + "").Equals(expandNode));
|
||||
if (expandRow != null)
|
||||
{
|
||||
OnLeftGroupTreeRowClick(expandRow);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void ShowGroupMenuPanel(string menuStruct, string groupKey)
|
||||
{
|
||||
if (!_groupItems.ContainsKey(menuStruct)) return;
|
||||
|
||||
Panel groupPanel = _groupItems[menuStruct];
|
||||
groupPanel.SuspendLayout();
|
||||
foreach (System.Windows.Forms.Control control in groupPanel.Controls)
|
||||
{
|
||||
GroupControl groupControl = control as GroupControl;
|
||||
if (groupControl == null) continue;
|
||||
groupControl.Visible = string.IsNullOrEmpty(groupKey) || (groupControl.Name + "").Equals(groupKey);
|
||||
}
|
||||
NormalizeGroupPanelSpacing(groupPanel);
|
||||
groupPanel.ResumeLayout(true);
|
||||
groupPanel.AutoScrollPosition = Point.Empty;
|
||||
|
||||
this.allMenuPanel.Controls.Clear();
|
||||
this.allMenuPanel.Controls.Add(groupPanel);
|
||||
groupPanel.Visible = true;
|
||||
}
|
||||
|
||||
private void NormalizeGroupPanelSpacing(Panel groupPanel)
|
||||
{
|
||||
if (groupPanel == null) return;
|
||||
|
||||
List<GroupControl> groupControls = groupPanel.Controls.OfType<GroupControl>().ToList();
|
||||
int topPadding = groupControls.Count > 1 ? GroupControlTopPadding : 0;
|
||||
foreach (GroupControl groupControl in groupControls)
|
||||
{
|
||||
groupControl.Padding = new Padding(0, topPadding, 0, 0);
|
||||
}
|
||||
}
|
||||
|
||||
private void ShowShortcutPanels(string menuStruct)
|
||||
{
|
||||
if (!this._allMenus.Columns.Contains("menuposition") || (!SystemInfo.Instance.IsOpenWork && !SystemInfo.Instance.ShowGallerysFromMenu) || SystemInfo.Instance.HideGallerys)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
this.pl_center_main_bottom_right_main.Controls.Clear();
|
||||
this.pl_center_main_bottom_left_main.Controls.Clear();
|
||||
if (this.topLayoutPanelDic.ContainsKey(menuStruct))
|
||||
{
|
||||
TableLayoutPanel tableLayoutPanel = this.topLayoutPanelDic[menuStruct];
|
||||
this.pl_center_main_bottom_right_main.Controls.Add(tableLayoutPanel);
|
||||
string labelCaption = tableLayoutPanel.Tag + "";
|
||||
this.lblShortcutset.Text = !string.IsNullOrEmpty(labelCaption) ? string.Format(" {0}", labelCaption) : this.lblShortcutset.Tag + "";
|
||||
}
|
||||
if (this.botLayoutPanelDic.ContainsKey(menuStruct))
|
||||
{
|
||||
TableLayoutPanel tableLayoutPanel = this.botLayoutPanelDic[menuStruct];
|
||||
this.pl_center_main_bottom_left_main.Controls.Add(tableLayoutPanel);
|
||||
string labelCaption = tableLayoutPanel.Tag + "";
|
||||
this.lblReportcutset.Text = !string.IsNullOrEmpty(labelCaption) ? string.Format(" {0}", labelCaption) : this.lblReportcutset.Tag + "";
|
||||
}
|
||||
}
|
||||
|
||||
private void OnLeftGroupTreeMenuClick(Button button)
|
||||
{
|
||||
try
|
||||
{
|
||||
DataRow row = button == null ? null : button.Tag as DataRow;
|
||||
if (row == null) return;
|
||||
|
||||
OnLeftGroupTreeRowClick(row);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
string Message = ErrorMessage.PromptErrorMessage(ex);
|
||||
MessageUtil.Show(Message, ex.Message);
|
||||
}
|
||||
}
|
||||
|
||||
private void OnLeftGroupTreeRowClick(DataRow row)
|
||||
{
|
||||
if (row == null) return;
|
||||
|
||||
string menuStruct = row["menustruct"] + "";
|
||||
string nodeType = row["nodetype"] + "";
|
||||
string groupKey = nodeType.Equals(LeftGroupTreeNodeTypeGroup) ? row["groupkey"] + "" : string.Empty;
|
||||
ShowGroupMenuPanel(menuStruct, groupKey);
|
||||
ShowShortcutPanels(menuStruct);
|
||||
|
||||
if (SystemInfo.Instance.DesktopFormat && this.tabMain.SelectedTabPage == this.xtpDesktop)
|
||||
{
|
||||
this.webBrowser.Hide();
|
||||
this.webBrowser.SendToBack();
|
||||
this.tabMain.SelectedTabPage = this.xtpFirst;
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// <para>说明:设置左侧菜单</para>
|
||||
/// <para>创建人:龚宇超</para>
|
||||
@@ -683,6 +1071,7 @@ namespace Lskj.Main.Control
|
||||
private void SetMenus()
|
||||
{
|
||||
this._menus.Clear();
|
||||
this._firstMenuBar = null;
|
||||
var groupMenus = this._allMenus.AsEnumerable().Where(n => n.Table.Columns.Contains("groupcaption") && !string.IsNullOrEmpty(n["groupcaption"] + ""));
|
||||
if (groupMenus.Count() == 0 && this._allMenus.Columns.Contains("groupcaption"))
|
||||
{
|
||||
@@ -714,6 +1103,12 @@ namespace Lskj.Main.Control
|
||||
List<DataRow> rows = this._allMenus.AsEnumerable().Where(n => (n["subsysid"] + "").Equals(ERPInfo.Instance.SubSysId) && !string.IsNullOrEmpty(n["menustruct"] + "")).ToList();
|
||||
if (rows != null && rows.Count > 0)
|
||||
{
|
||||
bool useLeftGroupTreeMenu = CanUseLeftGroupTreeMenu();
|
||||
if (!useLeftGroupTreeMenu)
|
||||
{
|
||||
ResetLeftMenuBarPanel();
|
||||
}
|
||||
DataTable leftGroupTreeTable = useLeftGroupTreeMenu ? CreateLeftGroupTreeTable() : null;
|
||||
int buttonTop = Convert.ToInt32(0.05 * DpiY); // 按钮上边距
|
||||
int menuLeft = Convert.ToInt32(0.05 * DpiY), menuTop = Convert.ToInt32(0.05 * DpiY); // 模块距离左边距,模块距离顶部边距
|
||||
int menuWidthOld = Convert.ToInt32(1.14 * DpiX), menuHeightOld = Convert.ToInt32(1.32 * DpiY); // 旧模块宽度,模块高度
|
||||
@@ -923,7 +1318,6 @@ namespace Lskj.Main.Control
|
||||
// 加载左侧菜单
|
||||
if (menuStruct.Length == 2)
|
||||
{
|
||||
|
||||
DataTable childs = rows.Cast<DataRow>().Where(x => (x["MenuStruct"] + "").Substring(0, 2) == menuStruct).CopyToDataTable();
|
||||
if (childs != null && childs.Rows.Count > 1)
|
||||
{
|
||||
@@ -931,33 +1325,40 @@ namespace Lskj.Main.Control
|
||||
defaultParentMenu = menuStruct;
|
||||
// menuLeft = 5; menuTop = 5;
|
||||
menuLeft = Convert.ToInt32(0.05 * DpiX); menuTop = Convert.ToInt32(0.05 * DpiY);
|
||||
MenuBar button = new MenuBar();
|
||||
button.Size = new Size(Convert.ToInt32(1.52 * DpiX), Convert.ToInt32(0.46 * DpiX));
|
||||
button.Location = new Point(2, buttonTop);
|
||||
button.BackColor = System.Drawing.Color.Transparent;
|
||||
button.GetButton().Text = item["menucaption"] + "";
|
||||
button.GetButton().Tag = item;
|
||||
if (useLeftGroupTreeMenu)
|
||||
{
|
||||
AddLeftGroupTreeNode(leftGroupTreeTable, menuStruct, item["menucaption"] + "", LeftGroupTreeNodeTypeMenu, menuStruct, string.Empty);
|
||||
}
|
||||
else
|
||||
{
|
||||
MenuBar button = new MenuBar();
|
||||
button.Size = new Size(Convert.ToInt32(1.52 * DpiX), Convert.ToInt32(0.46 * DpiX));
|
||||
button.Location = new Point(2, buttonTop);
|
||||
button.BackColor = System.Drawing.Color.Transparent;
|
||||
button.GetButton().Text = item["menucaption"] + "";
|
||||
button.GetButton().Tag = item;
|
||||
|
||||
if (SystemInfo.Instance.MenuBarWidth > 0)
|
||||
{
|
||||
button.Size = new Size(SystemInfo.Instance.MenuBarWidth, Convert.ToInt32(0.46 * DpiX));
|
||||
button.GetButton().Width = SystemInfo.Instance.MenuBarWidth - 10;
|
||||
}
|
||||
if (SystemInfo.Instance.MenuBarWidth > 0)
|
||||
{
|
||||
button.Size = new Size(SystemInfo.Instance.MenuBarWidth, Convert.ToInt32(0.46 * DpiX));
|
||||
button.GetButton().Width = SystemInfo.Instance.MenuBarWidth - 10;
|
||||
}
|
||||
|
||||
if (_firstMenuBar == null)
|
||||
{
|
||||
_firstMenuBar = button;
|
||||
if (_firstMenuBar == null)
|
||||
{
|
||||
_firstMenuBar = button;
|
||||
}
|
||||
// 注册事件
|
||||
button.SetHoverEvent(hoverEvent, (MenuEventType)SystemInfo.Instance.MemuEventType);
|
||||
// 44
|
||||
buttonTop += Convert.ToInt32(0.45 * DpiY);
|
||||
if (menuStruct == defaultParentMenu)
|
||||
{
|
||||
button.SetDefaultSelectMenu(button);
|
||||
button.SetButtonState(MenuButtonState.selectState);
|
||||
}
|
||||
pl_center_left.Controls.Add(button);
|
||||
}
|
||||
// 注册事件
|
||||
button.SetHoverEvent(hoverEvent, (MenuEventType)SystemInfo.Instance.MemuEventType);
|
||||
// 44
|
||||
buttonTop += Convert.ToInt32(0.45 * DpiY);
|
||||
if (menuStruct == defaultParentMenu)
|
||||
{
|
||||
button.SetDefaultSelectMenu(button);
|
||||
button.SetButtonState(MenuButtonState.selectState);
|
||||
}
|
||||
pl_center_left.Controls.Add(button);
|
||||
|
||||
|
||||
// 缓存控件
|
||||
@@ -1091,23 +1492,34 @@ namespace Lskj.Main.Control
|
||||
}
|
||||
}
|
||||
IEnumerable<IGrouping<int, DataRow>> groupByDataRows = groupDataRows.GroupBy(n => Convert.ToInt32((n["groupcaption"] + "").Substring(0, 2))).OrderByDescending(n => n.Key);
|
||||
int groupByDataRowCount = groupByDataRows.Count();
|
||||
Panel groupPanel = new Panel();
|
||||
groupPanel.AutoScroll = true;
|
||||
groupPanel.Dock = DockStyle.Fill;
|
||||
int groupControlIndex = 0;
|
||||
foreach (IGrouping<int, DataRow> groupByDataRow in groupByDataRows)
|
||||
{
|
||||
string groupTreeKey = GetGroupTreeKey(menuStruct, groupByDataRow.Key);
|
||||
string groupTreeCaption = GetGroupCaptionText(groupByDataRow.First()["groupcaption"] + "");
|
||||
if (string.IsNullOrWhiteSpace(groupTreeCaption) || (groupByDataRowCount == 1 && groupTreeCaption.Equals("默认分组")))
|
||||
{
|
||||
groupTreeCaption = item["menucaption"] + "";
|
||||
}
|
||||
if (useLeftGroupTreeMenu && groupByDataRowCount > 1)
|
||||
{
|
||||
string leftGroupTreeGroupKey = menuStruct + groupByDataRow.Key.ToString("00");
|
||||
AddLeftGroupTreeNode(leftGroupTreeTable, leftGroupTreeGroupKey, groupTreeCaption, LeftGroupTreeNodeTypeGroup, menuStruct, groupTreeKey);
|
||||
}
|
||||
int nowRowCount = 1;//当前行数
|
||||
int minMenuRow = this._allMenus.Columns.Contains("menuRow") ? groupByDataRow.Min(n => Convert.ToInt32(n["menuRow"])) : 1;
|
||||
int menuGroupLeft = Convert.ToInt32(0.05 * DpiY);
|
||||
int menuGroupTop = 0; // 模块距离左边距,模块距离顶部边距
|
||||
GroupControl groupControl = new GroupControl();
|
||||
groupControl.Name = groupTreeKey;
|
||||
groupControl.Tag = groupTreeCaption;
|
||||
groupControl.TipsLabel.ForeColor = Color.DimGray;
|
||||
groupControl.Dock = DockStyle.Top;
|
||||
if (groupControlIndex == groupByDataRows.Count() - 1 && !isShowGrallyInTop)
|
||||
{
|
||||
groupControl.Padding = new Padding(0, 0, 0, 0);
|
||||
}
|
||||
groupControl.Padding = new Padding(0, GroupControlTopPadding, 0, 0);
|
||||
groupPanel.Controls.Add(groupControl);
|
||||
List<DataRow> groupOrderDataRow = groupByDataRow.ToList();
|
||||
if (this._allMenus.Columns.Contains("menuRow"))
|
||||
@@ -1231,12 +1643,13 @@ namespace Lskj.Main.Control
|
||||
}
|
||||
groupControlIndex += 1;
|
||||
groupControl.TipsText = $"{groupControl.TipsText}({count})";
|
||||
groupControl.Height = (int)(menuGroupTop + menuHeight + 28 + 16);
|
||||
groupControl.Height = (int)(menuGroupTop + menuHeight + 28 + GroupControlTopPadding);
|
||||
}
|
||||
if (groupPanel.Controls.Count == 1)
|
||||
{
|
||||
(groupPanel.Controls[0] as GroupControl).TipsVisable = false;
|
||||
}
|
||||
NormalizeGroupPanelSpacing(groupPanel);
|
||||
if (!_groupItems.ContainsKey(menuStruct))
|
||||
{
|
||||
_groupItems.Add(menuStruct, groupPanel);
|
||||
@@ -1331,6 +1744,10 @@ namespace Lskj.Main.Control
|
||||
}
|
||||
}
|
||||
}
|
||||
if (useLeftGroupTreeMenu)
|
||||
{
|
||||
BindLeftGroupTreeMenu(leftGroupTreeTable, defaultParentMenu);
|
||||
}
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
@@ -1599,9 +2016,27 @@ namespace Lskj.Main.Control
|
||||
private void InitLeftMenu()
|
||||
{
|
||||
DataTable dtLvTree = MainImpl.GetLeftTreeView();
|
||||
if (!pl_center_left.Controls.Contains(tv_left))
|
||||
{
|
||||
pl_center_left.Controls.Clear();
|
||||
pl_center_left.Padding = new Padding(4);
|
||||
pl_center_left.BackColor = Color.FromArgb(10, 87, 167);
|
||||
pl_center_main.Padding = Padding.Empty;
|
||||
pl_center_main.BackColor = Color.FromArgb(240, 240, 240);
|
||||
SetLeftGroupSeparatorVisible(false);
|
||||
pl_center_left.Controls.Add(tv_left);
|
||||
}
|
||||
tv_left.Dock = DockStyle.Fill;
|
||||
tv_left.Visible = true;
|
||||
tv_left.ParentField = "speciesno";
|
||||
tv_left.ParentKeyLength = 2;
|
||||
tv_left.TextField = "speciesname";
|
||||
//tv_left.RaiseClickEventOnAllNodes = false;
|
||||
//tv_left.ExpandAllNodes = false;
|
||||
//tv_left.AllowNodeCollapse = true;
|
||||
//tv_left.SwitchOnMouseMove = false;
|
||||
//tv_left.UseMenuBarTextStyle = false;
|
||||
//tv_left.UseGroupTreeImageStyle = false;
|
||||
tv_left.OnButtonClickEvent += new TreeViewCustom.ButtonClickEventHandler(OnMenuButtonClick);
|
||||
tv_left.SetDataSource(dtLvTree);
|
||||
}
|
||||
@@ -2484,6 +2919,13 @@ namespace Lskj.Main.Control
|
||||
if (this._groupItems.ContainsKey(item_after["menustruct"] + ""))
|
||||
{
|
||||
Panel groupPanel = this._groupItems[item_after["menustruct"] + ""];
|
||||
foreach (System.Windows.Forms.Control control in groupPanel.Controls)
|
||||
{
|
||||
GroupControl groupControl = control as GroupControl;
|
||||
if (groupControl != null) groupControl.Visible = true;
|
||||
}
|
||||
NormalizeGroupPanelSpacing(groupPanel);
|
||||
groupPanel.AutoScrollPosition = Point.Empty;
|
||||
groupPanel.Visible = true;
|
||||
allMenuPanel.Controls.Add(groupPanel);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace Lskj.Main.Hosting
|
||||
{
|
||||
/// <summary>
|
||||
/// 旧启动流程与可选新主界面之间的中立扩展点。
|
||||
/// 此接口只使用 .NET Framework 4.0/WinForms 基础类型,不引用 WPF 或 DevExpress 25.2。
|
||||
/// </summary>
|
||||
public interface IExternalMainShell
|
||||
{
|
||||
bool IsOpen { get; }
|
||||
|
||||
DialogResult ShowLoginDialog(object loginRuntime);
|
||||
|
||||
DialogResult ShowDialog();
|
||||
|
||||
void RequestRelogin();
|
||||
|
||||
void RequestLock();
|
||||
|
||||
void RequestSubscriptRefresh();
|
||||
|
||||
void RequestExit(string message);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,735 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using DevExpress.LookAndFeel;
|
||||
using Lskj.Business;
|
||||
using Lskj.Business.Impl;
|
||||
using Lskj.Control.Model;
|
||||
using Lskj.Core;
|
||||
using Lskj.Data;
|
||||
using Lskj.Main.Model;
|
||||
using Lskj.Model;
|
||||
using Lskj.Util;
|
||||
|
||||
namespace Lskj.Main.Hosting
|
||||
{
|
||||
public sealed class LegacyProcessStartResult
|
||||
{
|
||||
internal LegacyProcessStartResult(
|
||||
bool shouldRunApplication,
|
||||
int exitCode)
|
||||
{
|
||||
ShouldRunApplication = shouldRunApplication;
|
||||
ExitCode = exitCode;
|
||||
}
|
||||
|
||||
public bool ShouldRunApplication { get; private set; }
|
||||
|
||||
public int ExitCode { get; private set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 为独立的新启动程序公开原 Ls_ERP 初始化和登录流程。
|
||||
/// </summary>
|
||||
public static class LegacyApplicationHost
|
||||
{
|
||||
private static readonly object ProcessSync = new object();
|
||||
private static bool _mainProcessInitializationStarted;
|
||||
private static bool _mainProcessInitialized;
|
||||
private static bool _mainProcessShutdown;
|
||||
|
||||
public static LegacyProcessStartResult PrepareProcess(string[] args)
|
||||
{
|
||||
int code = Program.PrepareProcess(args ?? new string[0]);
|
||||
return new LegacyProcessStartResult(code == -1, code);
|
||||
}
|
||||
|
||||
public static void InitializeMainProcess(IExternalMainShell externalMainShell)
|
||||
{
|
||||
lock (ProcessSync)
|
||||
{
|
||||
if (_mainProcessInitialized)
|
||||
throw new InvalidOperationException(
|
||||
"旧主进程运行时已经初始化。");
|
||||
if (_mainProcessShutdown)
|
||||
throw new InvalidOperationException(
|
||||
"旧主进程运行时已经关闭。");
|
||||
|
||||
_mainProcessInitializationStarted = true;
|
||||
Manager.ExternalMainShell = externalMainShell;
|
||||
try
|
||||
{
|
||||
Program.InitializeMainProcess();
|
||||
_mainProcessInitialized = true;
|
||||
}
|
||||
catch
|
||||
{
|
||||
try
|
||||
{
|
||||
Program.ShutdownMainProcess();
|
||||
}
|
||||
finally
|
||||
{
|
||||
_mainProcessShutdown = true;
|
||||
Manager.ExternalMainShell = null;
|
||||
}
|
||||
throw;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void ShutdownMainProcess()
|
||||
{
|
||||
lock (ProcessSync)
|
||||
{
|
||||
if (!_mainProcessInitializationStarted ||
|
||||
_mainProcessShutdown)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
Manager.EndExternalSessionServices();
|
||||
Manager.ExitSystem();
|
||||
}
|
||||
finally
|
||||
{
|
||||
try
|
||||
{
|
||||
Program.ShutdownMainProcess();
|
||||
}
|
||||
finally
|
||||
{
|
||||
_mainProcessInitialized = false;
|
||||
_mainProcessShutdown = true;
|
||||
Manager.ExternalMainShell = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static object CreateLoginRuntime()
|
||||
{
|
||||
return new LegacyLoginRuntime();
|
||||
}
|
||||
|
||||
public static string PrepareAuthenticatedSession()
|
||||
{
|
||||
if (!ERPInfo.Instance.LoginResult)
|
||||
return ResourceKeys.LoginFault;
|
||||
|
||||
DataTable enabled = MainImpl.EnableSubSystem();
|
||||
ERPInfo.Instance.SubMenuCount = enabled == null
|
||||
? 0
|
||||
: enabled.Rows.Count;
|
||||
if (!Manager.TrySelectExternalMainShellSubSystem())
|
||||
return ResourceKeys.SubSystemUnEnabled;
|
||||
|
||||
LegacyLoginRuntime.RefreshDelphiParameters();
|
||||
Manager.BeginExternalSessionServices();
|
||||
return string.Empty;
|
||||
}
|
||||
|
||||
public static void CompleteAuthenticatedSession()
|
||||
{
|
||||
Manager.EndExternalSessionServices();
|
||||
}
|
||||
|
||||
public static void ActivateSubSystem(string id, string caption)
|
||||
{
|
||||
ERPInfo.Instance.SubSysId = id ?? string.Empty;
|
||||
ERPInfo.Instance.SubSysName = caption ?? string.Empty;
|
||||
LegacyLoginRuntime.RefreshDelphiParameters();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 向外部 WPF 登录页提供旧账套、用户、认证和会话状态写入能力。
|
||||
/// 该类型不创建 WinForms 控件,也不引用 WPF。
|
||||
/// </summary>
|
||||
public sealed partial class LegacyLoginRuntime
|
||||
{
|
||||
private DataTable _ledgerTable;
|
||||
private bool _connectionInitialized;
|
||||
|
||||
public LegacyLoginRuntime()
|
||||
{
|
||||
ERPInfo.Instance.LoginResult = false;
|
||||
}
|
||||
|
||||
public string SelectedLedgerName { get; private set; }
|
||||
|
||||
public string LoginName
|
||||
{
|
||||
get { return DBConfig.Instance.LoginName ?? string.Empty; }
|
||||
}
|
||||
|
||||
public bool RememberPasswordEnabled
|
||||
{
|
||||
get { return !SystemInfo.Instance.DisableRememberPassword; }
|
||||
}
|
||||
|
||||
public bool AutoUpdate
|
||||
{
|
||||
get
|
||||
{
|
||||
return SystemInfo.Instance.AutomaticUpdates ||
|
||||
DBConfig.Instance.UpdateSet;
|
||||
}
|
||||
}
|
||||
|
||||
public bool AutoUpdateEnabled
|
||||
{
|
||||
get { return !SystemInfo.Instance.AutomaticUpdates; }
|
||||
}
|
||||
|
||||
public bool SmartClient
|
||||
{
|
||||
get { return DBConfig.Instance.SmallClient; }
|
||||
}
|
||||
|
||||
public bool SmartClientEnabled
|
||||
{
|
||||
get { return !SystemInfo.Instance.HiddenIntelligentClient; }
|
||||
}
|
||||
|
||||
public bool SmartClientVisible
|
||||
{
|
||||
get { return !SystemInfo.Instance.HiddenIntelligentClient; }
|
||||
}
|
||||
|
||||
public bool Notice
|
||||
{
|
||||
get
|
||||
{
|
||||
return SystemInfo.Instance.AutoCheckedNotice ||
|
||||
SystemInfo.Instance.StartMessageBox ||
|
||||
DBConfig.Instance.NoticeClient;
|
||||
}
|
||||
}
|
||||
|
||||
public bool NoticeEnabled
|
||||
{
|
||||
get { return !SystemInfo.Instance.StartMessageBox; }
|
||||
}
|
||||
|
||||
public DataTable LoadLedgers()
|
||||
{
|
||||
EnsureInitialConnection();
|
||||
_ledgerTable = MainImpl.GetLedgerList() ?? new DataTable("Ledgers");
|
||||
SelectedLedgerName = ResolveSelectedLedgerName(_ledgerTable);
|
||||
return _ledgerTable;
|
||||
}
|
||||
|
||||
private void EnsureInitialConnection()
|
||||
{
|
||||
if (_connectionInitialized)
|
||||
return;
|
||||
|
||||
if (string.Equals(
|
||||
IniHelper.Read(SystemResourcesIniName, ConnectionModeKey),
|
||||
"1",
|
||||
StringComparison.Ordinal))
|
||||
{
|
||||
int port;
|
||||
string host = IniHelper.Read(
|
||||
SystemResourcesIniName,
|
||||
DirectLastHostKey);
|
||||
string name = IniHelper.Read(
|
||||
SystemResourcesIniName,
|
||||
DirectLastNameKey);
|
||||
if (!int.TryParse(
|
||||
IniHelper.Read(
|
||||
SystemResourcesIniName,
|
||||
DirectLastPortKey),
|
||||
out port))
|
||||
{
|
||||
throw new InvalidOperationException(
|
||||
"保存的直连端口无效,请重新设置连接。");
|
||||
}
|
||||
|
||||
string error = ApplyDirectConnection(host, port, name);
|
||||
if (!string.IsNullOrWhiteSpace(error))
|
||||
throw new InvalidOperationException(error);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!DBConfig.Instance.CreateConnection(
|
||||
DBConfig.Instance.Connection))
|
||||
{
|
||||
throw new InvalidOperationException(
|
||||
ResourceKeys.UnConnectServer);
|
||||
}
|
||||
if (!string.Equals(
|
||||
DBConfig.Instance.ServerType,
|
||||
"达梦数据库",
|
||||
StringComparison.Ordinal) &&
|
||||
DelphiHelper.Delphi_Init(new StringBuilder(
|
||||
DBConfig.Instance.GetDelphiConnection(
|
||||
DBConfig.Instance.dephiConnection))) == 0)
|
||||
{
|
||||
throw new InvalidOperationException(
|
||||
ResourceKeys.UnConnectServer + "[By Delphi]");
|
||||
}
|
||||
SystemInfo.RefreshSystemParam();
|
||||
}
|
||||
|
||||
BaseResources.Localization(LocalizationType.CHS);
|
||||
_connectionInitialized = true;
|
||||
}
|
||||
|
||||
public DataTable LoadUsers()
|
||||
{
|
||||
DataTable users = SystemInfo.Instance.DisplayUserCode
|
||||
? MainImpl.GetEmployeeListNew()
|
||||
: MainImpl.GetEmployeeList();
|
||||
return NormalizeUsersForLogin(
|
||||
users ?? new DataTable("Users"),
|
||||
SystemInfo.Instance.LoginUsername,
|
||||
SystemInfo.Instance.DisplayUserCode);
|
||||
}
|
||||
|
||||
public DataTable SelectLedger(string ledgerName)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(ledgerName))
|
||||
throw new InvalidOperationException("请选择账套。");
|
||||
if (_ledgerTable == null)
|
||||
LoadLedgers();
|
||||
|
||||
DataRow ledger = _ledgerTable.Rows.Cast<DataRow>().FirstOrDefault(
|
||||
row => string.Equals(
|
||||
Value(row, "ShowName"),
|
||||
ledgerName,
|
||||
StringComparison.OrdinalIgnoreCase));
|
||||
if (ledger == null)
|
||||
throw new InvalidOperationException("未找到所选账套,请重新选择。");
|
||||
|
||||
string serverName = Value(ledger, "IP");
|
||||
string database = Value(ledger, "DBName");
|
||||
string dataBook = Value(ledger, "ShowName");
|
||||
if (string.IsNullOrWhiteSpace(serverName) ||
|
||||
string.IsNullOrWhiteSpace(database))
|
||||
{
|
||||
throw new InvalidOperationException(ResourceKeys.UnSetServerAddress);
|
||||
}
|
||||
|
||||
string oldServerName = DBConfig.Instance.ServerName;
|
||||
string oldDatabase = DBConfig.Instance.DataBase;
|
||||
string oldDataBook = DBConfig.Instance.DataBook;
|
||||
string oldSelectedLedgerName = SelectedLedgerName;
|
||||
string oldAccountBook = ERPInfo.Instance.AccountBook;
|
||||
bool oldConnectionInitialized = _connectionInitialized;
|
||||
try
|
||||
{
|
||||
DBConfig.Instance.ServerName = serverName;
|
||||
DBConfig.Instance.DataBase = database;
|
||||
DBConfig.Instance.DataBook = dataBook;
|
||||
|
||||
if (!DBConfig.Instance.CreateConnection(DBConfig.Instance.Connection))
|
||||
throw new InvalidOperationException(ResourceKeys.ServerAddressFault);
|
||||
if (!DBConfig.Instance.ServerType.Equals("达梦数据库") &&
|
||||
DelphiHelper.Delphi_Init(new StringBuilder(
|
||||
DBConfig.Instance.GetDelphiConnection(
|
||||
DBConfig.Instance.dephiConnection))) == 0)
|
||||
{
|
||||
throw new InvalidOperationException(
|
||||
ResourceKeys.UnConnectServer + "[By Delphi]");
|
||||
}
|
||||
|
||||
SystemInfo.RefreshSystemParam();
|
||||
BaseResources.Localization(LocalizationType.CHS);
|
||||
DataTable users = LoadUsers();
|
||||
|
||||
SelectedLedgerName = dataBook;
|
||||
ERPInfo.Instance.AccountBook = dataBook;
|
||||
_connectionInitialized = true;
|
||||
return users;
|
||||
}
|
||||
catch (Exception switchException)
|
||||
{
|
||||
DBConfig.Instance.ServerName = oldServerName;
|
||||
DBConfig.Instance.DataBase = oldDatabase;
|
||||
DBConfig.Instance.DataBook = oldDataBook;
|
||||
SelectedLedgerName = oldSelectedLedgerName;
|
||||
ERPInfo.Instance.AccountBook = oldAccountBook;
|
||||
_connectionInitialized = oldConnectionInitialized;
|
||||
try
|
||||
{
|
||||
DBConfig.Instance.CreateConnection(DBConfig.Instance.Connection);
|
||||
if (!DBConfig.Instance.ServerType.Equals("达梦数据库"))
|
||||
{
|
||||
DelphiHelper.Delphi_Init(new StringBuilder(
|
||||
DBConfig.Instance.GetDelphiConnection(
|
||||
DBConfig.Instance.dephiConnection)));
|
||||
}
|
||||
SystemInfo.RefreshSystemParam();
|
||||
}
|
||||
catch (Exception restoreException)
|
||||
{
|
||||
LogHelper.Instance.WriteError(restoreException);
|
||||
}
|
||||
|
||||
LogHelper.Instance.WriteError(switchException);
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
public string LoadRememberedPassword(string loginName)
|
||||
{
|
||||
if (!RememberPasswordEnabled || string.IsNullOrWhiteSpace(loginName))
|
||||
return null;
|
||||
|
||||
try
|
||||
{
|
||||
string encrypted = IniHelper.Read(
|
||||
DBConfig.Instance.ServerName + loginName);
|
||||
if (string.IsNullOrWhiteSpace(encrypted))
|
||||
return null;
|
||||
|
||||
string[] parts = AESUtil.Decrypt(encrypted).Split('^');
|
||||
bool remember;
|
||||
if (parts.Length < 2 ||
|
||||
!bool.TryParse(parts[0], out remember) ||
|
||||
!remember)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
return string.Join("^", parts.Skip(1).ToArray());
|
||||
}
|
||||
catch
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public string Login(
|
||||
string loginName,
|
||||
string password,
|
||||
bool rememberPassword,
|
||||
bool forceLogin,
|
||||
bool autoUpdate,
|
||||
bool smartClient,
|
||||
bool notice)
|
||||
{
|
||||
ERPInfo.Instance.LoginResult = false;
|
||||
if (string.IsNullOrWhiteSpace(loginName))
|
||||
return ResourceKeys.UserNameNotNull;
|
||||
password = NormalizePassword(password);
|
||||
|
||||
try
|
||||
{
|
||||
DataTable users = MainImpl.GetEmployeeList();
|
||||
string displayColumn = ResolveDisplayColumn(users);
|
||||
List<DataRow> matches = users.Rows.Cast<DataRow>()
|
||||
.Where(row =>
|
||||
string.Equals(
|
||||
Value(row, displayColumn),
|
||||
loginName,
|
||||
StringComparison.OrdinalIgnoreCase) ||
|
||||
string.Equals(
|
||||
Value(row, "UserCode"),
|
||||
loginName,
|
||||
StringComparison.OrdinalIgnoreCase))
|
||||
.ToList();
|
||||
if (matches.Count == 0)
|
||||
return ResourceKeys.NameOrPasswordError;
|
||||
if (matches.Count > 1)
|
||||
return ResourceKeys.DuplicatedNameError;
|
||||
|
||||
DataRow user = matches[0];
|
||||
string userId = Value(user, "UserId");
|
||||
string userName = Value(user, "UserName");
|
||||
string loginAccount = Value(user, "UserCode");
|
||||
if (string.IsNullOrWhiteSpace(userId))
|
||||
return ResourceKeys.UserNotFound;
|
||||
|
||||
ERPInfo.Instance.LoginResult = false;
|
||||
if (SystemInfo.Instance.MacEnabled)
|
||||
{
|
||||
int macResult = MainImpl.CheckMacAddress(
|
||||
ERPInfo.Instance.MacAddress,
|
||||
userId);
|
||||
MainImpl.LoginAfterRegister(
|
||||
ERPInfo.Instance.MacAddress,
|
||||
userId);
|
||||
if (macResult == 0)
|
||||
return ResourceKeys.LoginFault + ResourceKeys.UnKownMacAddress;
|
||||
if (macResult == -1)
|
||||
return ResourceKeys.LoginFault + ResourceKeys.UnKownMacAddressTable;
|
||||
}
|
||||
|
||||
string keyError = VerifyEncryptionKey();
|
||||
if (!string.IsNullOrEmpty(keyError))
|
||||
return keyError;
|
||||
|
||||
if (!MainImpl.CheckingMacAddress(userId))
|
||||
return ResourceKeys.MacAddressError +
|
||||
",当前地址:" + ERPInfo.Instance.MacAddress;
|
||||
|
||||
int loginResult = MainImpl.Login(
|
||||
userId,
|
||||
password,
|
||||
forceLogin);
|
||||
if (loginResult != 0)
|
||||
return LoginError(loginResult);
|
||||
|
||||
CompleteLogin(
|
||||
userId,
|
||||
userName,
|
||||
loginAccount,
|
||||
loginName,
|
||||
password,
|
||||
rememberPassword,
|
||||
autoUpdate,
|
||||
smartClient,
|
||||
notice);
|
||||
ERPInfo.Instance.LoginResult = true;
|
||||
LogUtil.WriteDebug("", "登录软件", "进入操作", "系统登录");
|
||||
return string.Empty;
|
||||
}
|
||||
catch (Exception exception)
|
||||
{
|
||||
ERPInfo.Instance.LoginResult = false;
|
||||
LogUtil.WriteError(ResourceKeys.UserLogin, exception);
|
||||
return ResourceKeys.LoginFault;
|
||||
}
|
||||
}
|
||||
|
||||
private static string VerifyEncryptionKey()
|
||||
{
|
||||
if (!SystemInfo.Instance.IsEncrypt)
|
||||
return string.Empty;
|
||||
|
||||
int[] keyHandles = ERPInfo.Instance.keyHandles = new int[8];
|
||||
int[] keyNumbers = ERPInfo.Instance.keyNumber = new int[8];
|
||||
SmartX1Api.SmartX1Find(DBConfig.Instance.ServerName, keyHandles, keyNumbers);
|
||||
|
||||
int keyHandle = keyHandles[0];
|
||||
int pin1 = Convert.ToInt32("0x987F6BCD", 16);
|
||||
int pin2 = Convert.ToInt32("0xE193C5B2", 16);
|
||||
int pin3 = Convert.ToInt32("0xD507CC28", 16);
|
||||
int pin4 = Convert.ToInt32("0x4B125AF6", 16);
|
||||
return SmartX1Api.SmartX1Open(keyHandle, pin1, pin2, pin3, pin4) == 0
|
||||
? string.Empty
|
||||
: "U盾数据获取失败,请重试或联系管理员";
|
||||
}
|
||||
|
||||
private void CompleteLogin(
|
||||
string userId,
|
||||
string userName,
|
||||
string loginAccount,
|
||||
string enteredLoginName,
|
||||
string password,
|
||||
bool rememberPassword,
|
||||
bool autoUpdate,
|
||||
bool smartClient,
|
||||
bool notice)
|
||||
{
|
||||
if (!MainImpl.HasExistsColumn("p_employeetab", "MacAdress"))
|
||||
BaseImpl.ExecSqlValue("alter table p_employeetab add MacAdress varchar(100)");
|
||||
BaseImpl.ExecSqlValue(string.Format(
|
||||
"update p_employeetab set MacAdress = '{0}' where employeeid='{1}'",
|
||||
(ERPInfo.Instance.MacAddress ?? string.Empty).Replace("'", "''"),
|
||||
userId.Replace("'", "''")));
|
||||
|
||||
if (!MainImpl.HasExistsColumn("p_employeetab", "ClientIp"))
|
||||
BaseImpl.ExecSqlValue("alter table p_employeetab add ClientIp varchar(100)");
|
||||
BaseImpl.ExecSqlValue(string.Format(
|
||||
"update p_employeetab set ClientIp = '{0}' where employeeid='{1}'",
|
||||
(ERPInfo.Instance.LoginIPV4 ?? string.Empty).Replace("'", "''"),
|
||||
userId.Replace("'", "''")));
|
||||
|
||||
if (SystemInfo.Instance.AutoSystemDataFormat)
|
||||
{
|
||||
FormatSystemDatetime formatter = new FormatSystemDatetime();
|
||||
formatter.SetDateTimeFormat();
|
||||
}
|
||||
|
||||
string skinName = MainImpl.GetUserSkin(userId);
|
||||
skinName = string.IsNullOrEmpty(skinName)
|
||||
? ERPInfo.Instance.SkinName
|
||||
: skinName;
|
||||
UserLookAndFeel.Default.SetSkinStyle(skinName);
|
||||
|
||||
IniHelper.Write(
|
||||
DBConfig.Instance.ServerName + enteredLoginName,
|
||||
AESUtil.Encrypt(rememberPassword + "^" + password));
|
||||
|
||||
ERPInfo.Instance.SeriesId = SystemInfo.Instance.seriesid;
|
||||
ERPInfo.Instance.UserLinkPhone = MainImpl.GetUserPhone(userId);
|
||||
ERPInfo.Instance.UserId = userId;
|
||||
ERPInfo.Instance.UserName = userName;
|
||||
ERPInfo.Instance.Password = SHAHelper.EncryptPassword(password);
|
||||
ERPInfo.Instance.SkinName = skinName;
|
||||
string accountBook = string.IsNullOrWhiteSpace(SelectedLedgerName)
|
||||
? DBConfig.Instance.DataBook
|
||||
: SelectedLedgerName;
|
||||
ERPInfo.Instance.AccountBook = accountBook;
|
||||
ERPInfo.Instance.LoginAccount = loginAccount;
|
||||
ERPInfo.Instance.InPassWord = password;
|
||||
ERPInfo.Instance.PrimitiveBrowser = SystemInfo.Instance.PrimitiveBrowser;
|
||||
|
||||
DBConfig.Instance.LoginName = enteredLoginName;
|
||||
DBConfig.Instance.NoticeUserID = userId;
|
||||
DBConfig.Instance.NoticeUserName = userName;
|
||||
DBConfig.Instance.UpdateSet = autoUpdate;
|
||||
DBConfig.Instance.SmallClient = smartClient;
|
||||
DBConfig.Instance.NoticeClient = notice;
|
||||
DBConfig.Instance.DataBook = accountBook;
|
||||
DBConfig.Instance.WriteConfig();
|
||||
|
||||
if (userName.Equals("管理员") &&
|
||||
!string.IsNullOrWhiteSpace(loginAccount))
|
||||
{
|
||||
ERPInfo.Instance.Password = SqlHelper.ExecuteString(
|
||||
"Password",
|
||||
"select Password from P_EmployeeTab where LoginAccount='" +
|
||||
loginAccount.Replace("'", "''") + "'");
|
||||
}
|
||||
|
||||
ERPInfo.Instance.LanguageName = "中文";
|
||||
LanguageTranslation.GetLanguageComparisonTable();
|
||||
RefreshDelphiParameters();
|
||||
PubUtil.ClearFilesInDirectory(PubUtil.ImageDownloadPath);
|
||||
}
|
||||
|
||||
internal static void RefreshDelphiParameters()
|
||||
{
|
||||
try
|
||||
{
|
||||
DelphiHelper.Delphi_SetParams(
|
||||
Convert.ToInt32(ERPInfo.Instance.UserId),
|
||||
string.IsNullOrWhiteSpace(ERPInfo.Instance.SubSysId)
|
||||
? 0
|
||||
: Convert.ToInt32(ERPInfo.Instance.SubSysId),
|
||||
new StringBuilder(ERPInfo.Instance.UserName),
|
||||
new StringBuilder(ERPInfo.Instance.WindowName),
|
||||
new StringBuilder(ERPInfo.Instance.SkinName));
|
||||
}
|
||||
catch (Exception exception)
|
||||
{
|
||||
LogHelper.Instance.WriteError(exception);
|
||||
}
|
||||
}
|
||||
|
||||
private static string LoginError(int loginResult)
|
||||
{
|
||||
switch (loginResult)
|
||||
{
|
||||
case 1:
|
||||
return ResourceKeys.NameOrPasswordError;
|
||||
case 2:
|
||||
return ResourceKeys.AlreadyLogin;
|
||||
case -2:
|
||||
return ResourceKeys.MultiFailedLogin;
|
||||
default:
|
||||
return ResourceKeys.LoginFault;
|
||||
}
|
||||
}
|
||||
|
||||
private static string ResolveSelectedLedgerName(DataTable ledgers)
|
||||
{
|
||||
DataRow selected = ledgers.Rows.Cast<DataRow>().FirstOrDefault(
|
||||
row => string.Equals(
|
||||
Value(row, "DBName"),
|
||||
DBConfig.Instance.DataBase,
|
||||
StringComparison.OrdinalIgnoreCase));
|
||||
if (selected == null && !string.IsNullOrWhiteSpace(DBConfig.Instance.DataBook))
|
||||
{
|
||||
selected = ledgers.Rows.Cast<DataRow>().FirstOrDefault(
|
||||
row => string.Equals(
|
||||
Value(row, "ShowName"),
|
||||
DBConfig.Instance.DataBook,
|
||||
StringComparison.OrdinalIgnoreCase));
|
||||
}
|
||||
if (selected == null)
|
||||
selected = ledgers.Rows.Cast<DataRow>().FirstOrDefault();
|
||||
|
||||
return selected == null ? string.Empty : Value(selected, "ShowName");
|
||||
}
|
||||
|
||||
private static DataTable NormalizeUsersForLogin(
|
||||
DataTable users,
|
||||
string configuredLoginColumn,
|
||||
bool displayUserCode)
|
||||
{
|
||||
DataTable normalized = new DataTable("Users");
|
||||
normalized.Columns.Add("UserId", typeof(string));
|
||||
normalized.Columns.Add("LoginName", typeof(string));
|
||||
normalized.Columns.Add("DisplayName", typeof(string));
|
||||
|
||||
if (users == null)
|
||||
return normalized;
|
||||
|
||||
string loginColumn = ResolveLoginColumn(
|
||||
users,
|
||||
configuredLoginColumn);
|
||||
foreach (DataRow row in users.Rows)
|
||||
{
|
||||
string loginName = Value(row, loginColumn).Trim();
|
||||
string userCode = Value(row, "UserCode").Trim();
|
||||
if (string.IsNullOrWhiteSpace(loginName))
|
||||
loginName = userCode;
|
||||
if (string.IsNullOrWhiteSpace(loginName))
|
||||
continue;
|
||||
|
||||
string displayName = loginName;
|
||||
if (displayUserCode &&
|
||||
!string.IsNullOrWhiteSpace(userCode) &&
|
||||
!string.Equals(
|
||||
loginName,
|
||||
userCode,
|
||||
StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
displayName = loginName + "(" + userCode + ")";
|
||||
}
|
||||
|
||||
normalized.Rows.Add(
|
||||
Value(row, "UserId"),
|
||||
loginName,
|
||||
displayName);
|
||||
}
|
||||
|
||||
return normalized;
|
||||
}
|
||||
|
||||
private static string NormalizePassword(string password)
|
||||
{
|
||||
return (password ?? string.Empty).Trim();
|
||||
}
|
||||
|
||||
private static string ResolveDisplayColumn(DataTable users)
|
||||
{
|
||||
return ResolveLoginColumn(
|
||||
users,
|
||||
SystemInfo.Instance.LoginUsername);
|
||||
}
|
||||
|
||||
private static string ResolveLoginColumn(
|
||||
DataTable users,
|
||||
string configuredLoginColumn)
|
||||
{
|
||||
if (users != null &&
|
||||
!string.IsNullOrWhiteSpace(configuredLoginColumn) &&
|
||||
users.Columns.Contains(configuredLoginColumn))
|
||||
{
|
||||
return configuredLoginColumn;
|
||||
}
|
||||
|
||||
return users != null && users.Columns.Contains("UserName")
|
||||
? "UserName"
|
||||
: "UserCode";
|
||||
}
|
||||
|
||||
private static string Value(DataRow row, string columnName)
|
||||
{
|
||||
return row != null && row.Table.Columns.Contains(columnName)
|
||||
? row[columnName] + string.Empty
|
||||
: string.Empty;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,601 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data;
|
||||
using System.IO;
|
||||
using System.Net;
|
||||
using System.Text;
|
||||
using Microsoft.Win32;
|
||||
using Lskj.Business;
|
||||
using Lskj.Business.Impl;
|
||||
using Lskj.Control.Model;
|
||||
using Lskj.Core;
|
||||
using Lskj.Data;
|
||||
using Lskj.Main.Model;
|
||||
using Lskj.Model;
|
||||
using Lskj.Util;
|
||||
|
||||
namespace Lskj.Main.Hosting
|
||||
{
|
||||
public sealed partial class LegacyLoginRuntime
|
||||
{
|
||||
private const string RegistryFilePath = @"AA_LS_Erp V2.0\File";
|
||||
private const string SystemResourcesIniName = "SystemResources.ini";
|
||||
private const string SystemResourcesSection = "SystemResources";
|
||||
private const string DirectHistoryPrefix = "DownloadAESStr_";
|
||||
private const string DirectLastHostKey = "LocalLastIP";
|
||||
private const string DirectLastPortKey = "LocalLastPort";
|
||||
private const string DirectLastNameKey = "LocalLastPortName";
|
||||
private const string ConnectionModeKey = "FrmConfigFlag";
|
||||
private const int DirectRequestTimeoutMilliseconds = 5000;
|
||||
|
||||
public DataSet LoadConnectionSettings()
|
||||
{
|
||||
var result = new DataSet("LoginConnectionSettings");
|
||||
DataTable settings = CreateSettingsTable();
|
||||
DataTable savedConnections = CreateSavedConnectionsTable();
|
||||
|
||||
string directHost = IniHelper.Read(
|
||||
SystemResourcesIniName,
|
||||
DirectLastHostKey);
|
||||
string directPort = IniHelper.Read(
|
||||
SystemResourcesIniName,
|
||||
DirectLastPortKey);
|
||||
string directName = IniHelper.Read(
|
||||
SystemResourcesIniName,
|
||||
DirectLastNameKey);
|
||||
bool directMode = string.Equals(
|
||||
IniHelper.Read(SystemResourcesIniName, ConnectionModeKey),
|
||||
"1",
|
||||
StringComparison.Ordinal);
|
||||
|
||||
settings.Rows.Add(
|
||||
directMode ? "Direct" : "Database",
|
||||
ReadRegistryValue("ServerName"),
|
||||
ReadRegistryValue("datastr"),
|
||||
directHost,
|
||||
directPort,
|
||||
directName);
|
||||
|
||||
Dictionary<string, string> entries = IniHelper.GetSectionKeys(
|
||||
SystemResourcesIniName,
|
||||
SystemResourcesSection);
|
||||
foreach (KeyValuePair<string, string> entry in entries)
|
||||
{
|
||||
if (!entry.Key.StartsWith(
|
||||
DirectHistoryPrefix,
|
||||
StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
string endpoint = entry.Key.Substring(
|
||||
DirectHistoryPrefix.Length);
|
||||
string host;
|
||||
int port;
|
||||
if (!TrySplitEndpoint(endpoint, out host, out port))
|
||||
continue;
|
||||
|
||||
string displayName = ReadHistoryDisplayName(entry.Value);
|
||||
if (string.IsNullOrWhiteSpace(displayName))
|
||||
continue;
|
||||
|
||||
savedConnections.Rows.Add(
|
||||
entry.Key,
|
||||
displayName,
|
||||
host,
|
||||
port);
|
||||
}
|
||||
|
||||
result.Tables.Add(settings);
|
||||
result.Tables.Add(savedConnections);
|
||||
return result;
|
||||
}
|
||||
|
||||
public string ApplyDatabaseConnection(
|
||||
string serverName,
|
||||
string databaseName)
|
||||
{
|
||||
try
|
||||
{
|
||||
ConnectionCandidate candidate = CreateDatabaseCandidate(
|
||||
serverName,
|
||||
databaseName);
|
||||
return ApplyConnection(
|
||||
candidate,
|
||||
delegate { CommitDatabaseConnection(); });
|
||||
}
|
||||
catch (Exception exception)
|
||||
{
|
||||
LogSanitized(exception);
|
||||
return ToSafeConnectionError(exception);
|
||||
}
|
||||
}
|
||||
|
||||
public string ApplyDirectConnection(
|
||||
string host,
|
||||
int port,
|
||||
string accountBookName)
|
||||
{
|
||||
try
|
||||
{
|
||||
Uri resourceUri = BuildDirectResourceUri(host, port);
|
||||
string encryptedPayload = DownloadDirectPayload(resourceUri);
|
||||
string decryptedPayload = AESUtil.Decrypt(encryptedPayload);
|
||||
string[] parts = ParseDirectPayload(decryptedPayload);
|
||||
ConnectionCandidate candidate = CreateDirectCandidate(
|
||||
parts,
|
||||
host,
|
||||
port,
|
||||
accountBookName,
|
||||
encryptedPayload);
|
||||
return ApplyConnection(
|
||||
candidate,
|
||||
delegate { CommitDirectConnection(candidate); });
|
||||
}
|
||||
catch (Exception exception)
|
||||
{
|
||||
LogSanitized(exception);
|
||||
return ToSafeConnectionError(exception);
|
||||
}
|
||||
}
|
||||
|
||||
private string ApplyConnection(
|
||||
ConnectionCandidate candidate,
|
||||
Action commit)
|
||||
{
|
||||
LegacyConnectionStateSnapshot snapshot =
|
||||
LegacyConnectionStateSnapshot.Capture(this);
|
||||
try
|
||||
{
|
||||
ApplyCandidate(candidate);
|
||||
ValidateDatabase(candidate);
|
||||
ValidateDelphi(candidate);
|
||||
SystemInfo.RefreshSystemParam();
|
||||
BaseResources.Localization(LocalizationType.CHS);
|
||||
commit();
|
||||
|
||||
_ledgerTable = null;
|
||||
SelectedLedgerName = candidate.AccountBookName;
|
||||
ERPInfo.Instance.AccountBook = candidate.AccountBookName;
|
||||
_connectionInitialized = true;
|
||||
return string.Empty;
|
||||
}
|
||||
catch (Exception exception)
|
||||
{
|
||||
snapshot.Restore(this);
|
||||
LogSanitized(exception);
|
||||
return ToSafeConnectionError(exception);
|
||||
}
|
||||
}
|
||||
|
||||
private static ConnectionCandidate CreateDatabaseCandidate(
|
||||
string serverName,
|
||||
string databaseName)
|
||||
{
|
||||
serverName = (serverName ?? string.Empty).Trim();
|
||||
databaseName = (databaseName ?? string.Empty).Trim();
|
||||
if (string.IsNullOrWhiteSpace(serverName))
|
||||
throw new ArgumentException("请输入数据库服务器地址。");
|
||||
if (string.IsNullOrWhiteSpace(databaseName))
|
||||
throw new ArgumentException("请输入数据库名称。");
|
||||
|
||||
return new ConnectionCandidate
|
||||
{
|
||||
ServerName = serverName,
|
||||
DatabaseName = databaseName,
|
||||
AccountBookName = DBConfig.Instance.DataBook ?? string.Empty,
|
||||
ServerType = DBConfig.Instance.ServerType ?? "SqlServer",
|
||||
ConnectionTemplate = string.Empty,
|
||||
DelphiConnectionTemplate = string.Empty
|
||||
};
|
||||
}
|
||||
|
||||
private static ConnectionCandidate CreateDirectCandidate(
|
||||
string[] parts,
|
||||
string host,
|
||||
int port,
|
||||
string accountBookName,
|
||||
string encryptedPayload)
|
||||
{
|
||||
accountBookName = (accountBookName ?? string.Empty).Trim();
|
||||
if (string.IsNullOrWhiteSpace(accountBookName))
|
||||
throw new ArgumentException("请输入直连账套名称。");
|
||||
|
||||
string connectionTemplate =
|
||||
"Server={0};Database={1};Persist Security Info=True;" +
|
||||
"User ID=" + parts[2] + ";Password=" + parts[3] + ";" +
|
||||
"Connection Timeout=5;MultipleActiveResultSets=true";
|
||||
string delphiTemplate =
|
||||
"Provider=SQLOLEDB.1;Server={0};Database={1};" +
|
||||
"Persist Security Info=True;User ID=" + parts[2] +
|
||||
";Password=" + parts[3] + ";Connection Timeout=5";
|
||||
|
||||
return new ConnectionCandidate
|
||||
{
|
||||
ServerName = parts[0],
|
||||
DatabaseName = parts[1],
|
||||
AccountBookName = accountBookName,
|
||||
ServerType = DBConfig.Instance.ServerType ?? "SqlServer",
|
||||
ConnectionTemplate = AESUtil.Encrypt(connectionTemplate),
|
||||
DelphiConnectionTemplate = AESUtil.Encrypt(delphiTemplate),
|
||||
DirectHost = (host ?? string.Empty).Trim().TrimEnd('/'),
|
||||
DirectPort = port,
|
||||
DirectEncryptedPayload = encryptedPayload
|
||||
};
|
||||
}
|
||||
|
||||
private static void ApplyCandidate(ConnectionCandidate candidate)
|
||||
{
|
||||
DBConfig.Instance.ServerName = candidate.ServerName;
|
||||
DBConfig.Instance.DataBase = candidate.DatabaseName;
|
||||
DBConfig.Instance.DataBook = candidate.AccountBookName;
|
||||
DBConfig.Instance.ServerType = candidate.ServerType;
|
||||
DBConfig.Instance.Connection = candidate.ConnectionTemplate;
|
||||
DBConfig.Instance.dephiConnection =
|
||||
candidate.DelphiConnectionTemplate;
|
||||
}
|
||||
|
||||
private static void ValidateDatabase(ConnectionCandidate candidate)
|
||||
{
|
||||
if (!DBConfig.Instance.CreateConnection(
|
||||
candidate.ConnectionTemplate))
|
||||
{
|
||||
throw new LegacyConnectionSettingsException(
|
||||
"无法连接数据库,请检查服务器和数据库配置。");
|
||||
}
|
||||
}
|
||||
|
||||
private static void ValidateDelphi(ConnectionCandidate candidate)
|
||||
{
|
||||
if (string.Equals(
|
||||
candidate.ServerType,
|
||||
"达梦数据库",
|
||||
StringComparison.Ordinal))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
string connection = DBConfig.Instance.GetDelphiConnection(
|
||||
candidate.DelphiConnectionTemplate);
|
||||
if (DelphiHelper.Delphi_Init(new StringBuilder(connection)) == 0)
|
||||
{
|
||||
throw new LegacyConnectionSettingsException(
|
||||
"数据库已连接,但 Delphi 组件初始化失败。");
|
||||
}
|
||||
}
|
||||
|
||||
private static void CommitDatabaseConnection()
|
||||
{
|
||||
DBConfig.Instance.WriteConfig();
|
||||
IniHelper.Write(
|
||||
SystemResourcesIniName,
|
||||
ConnectionModeKey,
|
||||
"0");
|
||||
}
|
||||
|
||||
private static void CommitDirectConnection(
|
||||
ConnectionCandidate candidate)
|
||||
{
|
||||
string endpoint = candidate.DirectHost + ":" +
|
||||
candidate.DirectPort;
|
||||
string historyValue = candidate.AccountBookName + "^" +
|
||||
candidate.DirectEncryptedPayload;
|
||||
|
||||
IniHelper.Write(
|
||||
SystemResourcesIniName,
|
||||
DirectHistoryPrefix + endpoint,
|
||||
historyValue);
|
||||
IniHelper.Write(
|
||||
SystemResourcesIniName,
|
||||
DirectLastHostKey,
|
||||
candidate.DirectHost);
|
||||
IniHelper.Write(
|
||||
SystemResourcesIniName,
|
||||
DirectLastPortKey,
|
||||
candidate.DirectPort.ToString());
|
||||
IniHelper.Write(
|
||||
SystemResourcesIniName,
|
||||
DirectLastNameKey,
|
||||
candidate.AccountBookName);
|
||||
IniHelper.Write(
|
||||
SystemResourcesIniName,
|
||||
ConnectionModeKey,
|
||||
"1");
|
||||
|
||||
DBConfig.Instance.WriteConfig(
|
||||
DirectLastHostKey,
|
||||
candidate.DirectHost);
|
||||
DBConfig.Instance.WriteConfig(
|
||||
DirectLastPortKey,
|
||||
candidate.DirectPort.ToString());
|
||||
DBConfig.Instance.WriteConfig(
|
||||
DirectLastNameKey,
|
||||
candidate.AccountBookName);
|
||||
}
|
||||
|
||||
private static Uri BuildDirectResourceUri(string host, int port)
|
||||
{
|
||||
host = (host ?? string.Empty).Trim();
|
||||
if (string.IsNullOrWhiteSpace(host))
|
||||
throw new ArgumentException("请输入直连服务器地址。");
|
||||
if (port < 1 || port > 65535)
|
||||
throw new ArgumentOutOfRangeException(
|
||||
"port",
|
||||
"直连端口必须介于 1 和 65535 之间。");
|
||||
|
||||
if (!host.StartsWith("http://", StringComparison.OrdinalIgnoreCase) &&
|
||||
!host.StartsWith("https://", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
host = "http://" + host;
|
||||
}
|
||||
|
||||
Uri baseUri;
|
||||
if (!Uri.TryCreate(host, UriKind.Absolute, out baseUri) ||
|
||||
(baseUri.Scheme != Uri.UriSchemeHttp &&
|
||||
baseUri.Scheme != Uri.UriSchemeHttps))
|
||||
{
|
||||
throw new ArgumentException("直连服务器地址格式无效。");
|
||||
}
|
||||
|
||||
var builder = new UriBuilder(baseUri)
|
||||
{
|
||||
Port = port,
|
||||
Path = "/SystemResources.txt",
|
||||
Query = string.Empty,
|
||||
Fragment = string.Empty
|
||||
};
|
||||
return builder.Uri;
|
||||
}
|
||||
|
||||
private static string DownloadDirectPayload(Uri resourceUri)
|
||||
{
|
||||
var request = (HttpWebRequest)WebRequest.Create(resourceUri);
|
||||
request.Method = "GET";
|
||||
request.Timeout = DirectRequestTimeoutMilliseconds;
|
||||
request.ReadWriteTimeout = DirectRequestTimeoutMilliseconds;
|
||||
|
||||
using (var response = (HttpWebResponse)request.GetResponse())
|
||||
using (Stream stream = response.GetResponseStream())
|
||||
{
|
||||
if (stream == null)
|
||||
{
|
||||
throw new InvalidDataException(
|
||||
"直连服务器未返回连接配置。");
|
||||
}
|
||||
|
||||
using (var reader = new StreamReader(
|
||||
stream,
|
||||
Encoding.UTF8,
|
||||
true))
|
||||
{
|
||||
string payload = reader.ReadToEnd().Trim();
|
||||
if (string.IsNullOrWhiteSpace(payload))
|
||||
{
|
||||
throw new InvalidDataException(
|
||||
"直连服务器返回的连接配置为空。");
|
||||
}
|
||||
|
||||
return payload;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static string[] ParseDirectPayload(string decryptedPayload)
|
||||
{
|
||||
string[] parts = (decryptedPayload ?? string.Empty).Split('^');
|
||||
if (parts.Length != 5)
|
||||
{
|
||||
throw new InvalidDataException(
|
||||
"直连服务器返回的连接配置格式无效。");
|
||||
}
|
||||
|
||||
for (int index = 0; index < parts.Length; index++)
|
||||
{
|
||||
parts[index] = (parts[index] ?? string.Empty).Trim();
|
||||
if (string.IsNullOrWhiteSpace(parts[index]))
|
||||
{
|
||||
throw new InvalidDataException(
|
||||
"直连服务器返回的连接配置不完整。");
|
||||
}
|
||||
}
|
||||
|
||||
return parts;
|
||||
}
|
||||
|
||||
private static string ToSafeConnectionError(Exception exception)
|
||||
{
|
||||
if (exception is ArgumentException ||
|
||||
exception is InvalidDataException ||
|
||||
exception is LegacyConnectionSettingsException)
|
||||
{
|
||||
return exception.Message;
|
||||
}
|
||||
if (exception is WebException)
|
||||
{
|
||||
return "无法读取直连配置,请检查地址、端口和网络连接。";
|
||||
}
|
||||
|
||||
return "连接设置失败,请检查配置和网络连接。";
|
||||
}
|
||||
|
||||
private static void LogSanitized(Exception exception)
|
||||
{
|
||||
string exceptionType = exception == null
|
||||
? "Unknown"
|
||||
: exception.GetType().FullName;
|
||||
LogHelper.Instance.WriteLog(
|
||||
"WPF 登录连接设置失败。异常类型:" + exceptionType);
|
||||
}
|
||||
|
||||
private static DataTable CreateSettingsTable()
|
||||
{
|
||||
var table = new DataTable("Settings");
|
||||
table.Columns.Add("Mode", typeof(string));
|
||||
table.Columns.Add("ServerName", typeof(string));
|
||||
table.Columns.Add("DatabaseName", typeof(string));
|
||||
table.Columns.Add("DirectHost", typeof(string));
|
||||
table.Columns.Add("DirectPort", typeof(string));
|
||||
table.Columns.Add("DirectAccountBookName", typeof(string));
|
||||
return table;
|
||||
}
|
||||
|
||||
private static DataTable CreateSavedConnectionsTable()
|
||||
{
|
||||
var table = new DataTable("SavedDirectConnections");
|
||||
table.Columns.Add("Key", typeof(string));
|
||||
table.Columns.Add("DisplayName", typeof(string));
|
||||
table.Columns.Add("Host", typeof(string));
|
||||
table.Columns.Add("Port", typeof(int));
|
||||
return table;
|
||||
}
|
||||
|
||||
private static string ReadRegistryValue(string valueName)
|
||||
{
|
||||
try
|
||||
{
|
||||
using (RegistryKey key = Registry.CurrentUser.OpenSubKey(
|
||||
RegistryFilePath,
|
||||
false))
|
||||
{
|
||||
object value = key == null
|
||||
? null
|
||||
: key.GetValue(valueName, string.Empty);
|
||||
return value == null ? string.Empty : value.ToString();
|
||||
}
|
||||
}
|
||||
catch
|
||||
{
|
||||
return string.Empty;
|
||||
}
|
||||
}
|
||||
|
||||
private static bool TrySplitEndpoint(
|
||||
string endpoint,
|
||||
out string host,
|
||||
out int port)
|
||||
{
|
||||
host = string.Empty;
|
||||
port = 0;
|
||||
if (string.IsNullOrWhiteSpace(endpoint))
|
||||
return false;
|
||||
|
||||
int separatorIndex = endpoint.LastIndexOf(':');
|
||||
if (separatorIndex <= 0 ||
|
||||
separatorIndex >= endpoint.Length - 1)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
host = endpoint.Substring(0, separatorIndex).Trim();
|
||||
return !string.IsNullOrWhiteSpace(host) &&
|
||||
int.TryParse(endpoint.Substring(separatorIndex + 1), out port) &&
|
||||
port >= 1 &&
|
||||
port <= 65535;
|
||||
}
|
||||
|
||||
private static string ReadHistoryDisplayName(string value)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(value))
|
||||
return string.Empty;
|
||||
|
||||
int separatorIndex = value.IndexOf('^');
|
||||
return separatorIndex < 0
|
||||
? string.Empty
|
||||
: value.Substring(0, separatorIndex).Trim();
|
||||
}
|
||||
|
||||
private sealed class ConnectionCandidate
|
||||
{
|
||||
public string ServerName;
|
||||
public string DatabaseName;
|
||||
public string AccountBookName;
|
||||
public string ServerType;
|
||||
public string ConnectionTemplate;
|
||||
public string DelphiConnectionTemplate;
|
||||
public string DirectHost;
|
||||
public int DirectPort;
|
||||
public string DirectEncryptedPayload;
|
||||
}
|
||||
|
||||
private sealed class LegacyConnectionStateSnapshot
|
||||
{
|
||||
private string _serverName;
|
||||
private string _databaseName;
|
||||
private string _dataBook;
|
||||
private string _loginName;
|
||||
private string _serverType;
|
||||
private string _connectionTemplate;
|
||||
private string _delphiConnectionTemplate;
|
||||
private string _selectedLedgerName;
|
||||
private string _accountBook;
|
||||
private bool _connectionInitialized;
|
||||
|
||||
public static LegacyConnectionStateSnapshot Capture(
|
||||
LegacyLoginRuntime runtime)
|
||||
{
|
||||
return new LegacyConnectionStateSnapshot
|
||||
{
|
||||
_serverName = DBConfig.Instance.ServerName,
|
||||
_databaseName = DBConfig.Instance.DataBase,
|
||||
_dataBook = DBConfig.Instance.DataBook,
|
||||
_loginName = DBConfig.Instance.LoginName,
|
||||
_serverType = DBConfig.Instance.ServerType,
|
||||
_connectionTemplate = DBConfig.Instance.Connection,
|
||||
_delphiConnectionTemplate =
|
||||
DBConfig.Instance.dephiConnection,
|
||||
_selectedLedgerName = runtime.SelectedLedgerName,
|
||||
_accountBook = ERPInfo.Instance.AccountBook,
|
||||
_connectionInitialized = runtime._connectionInitialized
|
||||
};
|
||||
}
|
||||
|
||||
public void Restore(LegacyLoginRuntime runtime)
|
||||
{
|
||||
DBConfig.Instance.ServerName = _serverName;
|
||||
DBConfig.Instance.DataBase = _databaseName;
|
||||
DBConfig.Instance.DataBook = _dataBook;
|
||||
DBConfig.Instance.LoginName = _loginName;
|
||||
DBConfig.Instance.ServerType = _serverType;
|
||||
DBConfig.Instance.Connection = _connectionTemplate;
|
||||
DBConfig.Instance.dephiConnection =
|
||||
_delphiConnectionTemplate;
|
||||
runtime.SelectedLedgerName = _selectedLedgerName;
|
||||
runtime._ledgerTable = null;
|
||||
runtime._connectionInitialized = _connectionInitialized;
|
||||
ERPInfo.Instance.AccountBook = _accountBook;
|
||||
|
||||
try
|
||||
{
|
||||
if (!string.IsNullOrWhiteSpace(_serverName) &&
|
||||
!string.IsNullOrWhiteSpace(_databaseName))
|
||||
{
|
||||
DBConfig.Instance.CreateConnection(
|
||||
_connectionTemplate);
|
||||
if (!string.Equals(
|
||||
_serverType,
|
||||
"达梦数据库",
|
||||
StringComparison.Ordinal))
|
||||
{
|
||||
DelphiHelper.Delphi_Init(new StringBuilder(
|
||||
DBConfig.Instance.GetDelphiConnection(
|
||||
_delphiConnectionTemplate)));
|
||||
}
|
||||
SystemInfo.RefreshSystemParam();
|
||||
}
|
||||
}
|
||||
catch (Exception restoreException)
|
||||
{
|
||||
LogSanitized(restoreException);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private sealed class LegacyConnectionSettingsException : Exception
|
||||
{
|
||||
public LegacyConnectionSettingsException(string message)
|
||||
: base(message)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -276,6 +276,9 @@
|
||||
<Compile Include="Model\BitMapHelper.cs" />
|
||||
<Compile Include="Model\Manager.cs" />
|
||||
<Compile Include="Model\winApi.cs" />
|
||||
<Compile Include="Hosting\IExternalMainShell.cs" />
|
||||
<Compile Include="Hosting\LegacyApplicationHost.cs" />
|
||||
<Compile Include="Hosting\LegacyLoginRuntime.ConnectionSettings.cs" />
|
||||
<Compile Include="Program.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<EmbeddedResource Include="Control\AwaitScreenControl.resx">
|
||||
|
||||
+339
-176
@@ -15,6 +15,7 @@ using Lskj.Control;
|
||||
using Lskj.Control.Model;
|
||||
using Lskj.Core;
|
||||
using Lskj.Data;
|
||||
using Lskj.Main.Hosting;
|
||||
using Lskj.Model;
|
||||
using Lskj.Util;
|
||||
using Lskj.Web.Core.Util;
|
||||
@@ -55,6 +56,14 @@ namespace Lskj.Main.Model
|
||||
public static int isAwaitTime = 10;
|
||||
public static int RefreshTime = 0;
|
||||
/// <summary>
|
||||
/// 由外部启动程序提供的可选主界面。默认为 null,旧 Ls_ERP.exe 仍打开 FrmMain。
|
||||
/// </summary>
|
||||
public static IExternalMainShell ExternalMainShell { get; internal set; }
|
||||
private static readonly object SessionMonitorSync = new object();
|
||||
private static CancellationTokenSource _sessionMonitorCancellation;
|
||||
private static readonly List<Thread> SessionMonitorThreads =
|
||||
new List<Thread>();
|
||||
/// <summary>
|
||||
/// 默认下载地址
|
||||
/// </summary>
|
||||
private static string filePath = string.Empty;
|
||||
@@ -82,8 +91,12 @@ namespace Lskj.Main.Model
|
||||
public static void StartForm()
|
||||
{
|
||||
bool isStart = true;
|
||||
bool useLegacySplash = ExternalMainShell == null;
|
||||
// 加载Splash动画界面
|
||||
SplashForm.ShowForm();
|
||||
if (useLegacySplash)
|
||||
{
|
||||
SplashForm.ShowForm();
|
||||
}
|
||||
//CheckLocalConfig();
|
||||
// C#数据库连接检查
|
||||
bool isLocalConnect = false;
|
||||
@@ -103,27 +116,36 @@ namespace Lskj.Main.Model
|
||||
if (!DBConfig.Instance.CreateConnection(DBConfig.Instance.Connection))
|
||||
{
|
||||
MessageUtil.Show(ResourceKeys.UnConnectServer);
|
||||
SplashForm.HideForm();
|
||||
if (useLegacySplash)
|
||||
{
|
||||
SplashForm.HideForm();
|
||||
}
|
||||
DialogResult result = RunConfigForm();
|
||||
isStart = result == DialogResult.OK;
|
||||
}
|
||||
if (isStart)
|
||||
{
|
||||
// Delphi数据库连接检查
|
||||
if (!DBConfig.Instance.ServerType.Equals("达梦数据库"))
|
||||
if (!DBConfig.Instance.ServerType.Equals("达梦数据库"))
|
||||
{
|
||||
if (DelphiHelper.Delphi_Init(new StringBuilder(DBConfig.Instance.GetDelphiConnection(DBConfig.Instance.dephiConnection))) == 0)
|
||||
{
|
||||
MessageUtil.Show(ResourceKeys.UnConnectServer + "[By Delphi]");
|
||||
SplashForm.HideForm();
|
||||
if (useLegacySplash)
|
||||
{
|
||||
SplashForm.HideForm();
|
||||
}
|
||||
RunConfigForm();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
SplashForm.HideForm();
|
||||
|
||||
if (useLegacySplash)
|
||||
{
|
||||
SplashForm.HideForm();
|
||||
}
|
||||
// 汉化dev控件
|
||||
BaseResources.Localization(LocalizationType.CHS);
|
||||
// 启动登录页面
|
||||
@@ -145,7 +167,10 @@ namespace Lskj.Main.Model
|
||||
}
|
||||
else
|
||||
{
|
||||
SplashForm.HideForm();
|
||||
if (useLegacySplash)
|
||||
{
|
||||
SplashForm.HideForm();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -161,9 +186,7 @@ namespace Lskj.Main.Model
|
||||
/// <param name="skipMenu">是否跳过子系统选择(适用于切换用户).</param>
|
||||
public static void ReStartMain(bool skipMenu = false)
|
||||
{
|
||||
WhenConstraintLogin();
|
||||
LockApplication();
|
||||
if (SystemInfo.Instance.SubscriptRefreshTime > 0 && !SystemInfo.Instance.RefreshNotify) RefreshSubscript();
|
||||
StartSessionMonitors();
|
||||
if (_frmMain != null)
|
||||
{
|
||||
if (ERPInfo.Instance.WatermarkForm != null)
|
||||
@@ -180,7 +203,13 @@ namespace Lskj.Main.Model
|
||||
bool isOpenBs = false;
|
||||
DialogResult result;
|
||||
|
||||
if (ERPInfo.Instance.SubMenuCount > 1 && !skipMenu)
|
||||
if (ExternalMainShell != null)
|
||||
{
|
||||
// WPF 主框架已经提供顶部子系统导航,不再打开旧 FrmSubSystem。
|
||||
// 优先保留当前仍有权限的子系统,否则选择第一个可用子系统。
|
||||
isStart = TrySelectExternalMainShellSubSystem();
|
||||
}
|
||||
else if (ERPInfo.Instance.SubMenuCount > 1 && !skipMenu)
|
||||
{
|
||||
// 进入子系统界面
|
||||
result = RunSubSystemForm();
|
||||
@@ -190,8 +219,19 @@ namespace Lskj.Main.Model
|
||||
if (isStart)
|
||||
{
|
||||
// 直接进入主界面
|
||||
RunMainForm();
|
||||
if (ERPInfo.Instance.SubMenuCount > 1)
|
||||
result = RunMainForm();
|
||||
if (result == DialogResult.Retry)
|
||||
{
|
||||
StartForm();
|
||||
return;
|
||||
}
|
||||
if (ExternalMainShell != null)
|
||||
{
|
||||
// 外部主界面关闭即结束本次 WPF 入口,不返回旧子系统选择页。
|
||||
ExitSystem();
|
||||
return;
|
||||
}
|
||||
else if (ERPInfo.Instance.SubMenuCount > 1)
|
||||
{
|
||||
ReStartMain();
|
||||
}
|
||||
@@ -596,8 +636,9 @@ namespace Lskj.Main.Model
|
||||
}
|
||||
return dllName;
|
||||
}
|
||||
private static void ExitSystem()
|
||||
internal static void ExitSystem()
|
||||
{
|
||||
StopSessionMonitors();
|
||||
try
|
||||
{
|
||||
// 退出系统
|
||||
@@ -653,6 +694,9 @@ namespace Lskj.Main.Model
|
||||
/// <returns>DialogResult.</returns>
|
||||
private static DialogResult RunLoginForm()
|
||||
{
|
||||
if (ExternalMainShell != null)
|
||||
return ExternalMainShell.ShowLoginDialog(new LegacyLoginRuntime());
|
||||
|
||||
FrmLogin frmLogin = new FrmLogin();
|
||||
return frmLogin.ShowDialog();
|
||||
}
|
||||
@@ -674,6 +718,44 @@ namespace Lskj.Main.Model
|
||||
BsUrl = _frmSubSystem.BsUrl;
|
||||
return dialogResult;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 为外部 WPF 主框架选择登录后的初始子系统。
|
||||
/// 旧 WinForms 入口仍由 FrmSubSystem 完成人工选择。
|
||||
/// </summary>
|
||||
internal static bool TrySelectExternalMainShellSubSystem()
|
||||
{
|
||||
string where = string.IsNullOrEmpty(ERPInfo.Instance.SeriesId)
|
||||
? string.Empty
|
||||
: string.Format("and SeriesId={0}", ERPInfo.Instance.SeriesId);
|
||||
DataTable subSystems = MainImpl.GetSubSystems(where);
|
||||
if (subSystems == null || subSystems.Rows.Count == 0)
|
||||
return false;
|
||||
|
||||
DataRow selectedRow = subSystems.AsEnumerable().FirstOrDefault(row =>
|
||||
IsEnabledSubSystem(row) &&
|
||||
string.Equals(
|
||||
row["SubSysId"] + string.Empty,
|
||||
ERPInfo.Instance.SubSysId,
|
||||
StringComparison.OrdinalIgnoreCase));
|
||||
if (selectedRow == null)
|
||||
selectedRow = subSystems.AsEnumerable().FirstOrDefault(IsEnabledSubSystem);
|
||||
if (selectedRow == null)
|
||||
return false;
|
||||
|
||||
ERPInfo.Instance.SubMenuCount = subSystems.AsEnumerable().Count(IsEnabledSubSystem);
|
||||
ERPInfo.Instance.SubSysId = selectedRow["SubSysId"] + string.Empty;
|
||||
ERPInfo.Instance.SubSysName = selectedRow["SubSysName"] + string.Empty;
|
||||
return true;
|
||||
}
|
||||
|
||||
private static bool IsEnabledSubSystem(DataRow row)
|
||||
{
|
||||
return row != null &&
|
||||
row.Table.Columns.Contains("UseEd") &&
|
||||
row["UseEd"] != DBNull.Value &&
|
||||
Convert.ToBoolean(row["UseEd"]);
|
||||
}
|
||||
/// <summary>
|
||||
/// <para>说明:打开主程序</para>
|
||||
/// <para>创建人:龚宇超</para>
|
||||
@@ -686,6 +768,10 @@ namespace Lskj.Main.Model
|
||||
/// <returns>DialogResult.</returns>
|
||||
private static DialogResult RunMainForm()
|
||||
{
|
||||
IExternalMainShell externalMainShell = ExternalMainShell;
|
||||
if (externalMainShell != null)
|
||||
return externalMainShell.ShowDialog();
|
||||
|
||||
_frmMain = new FrmMain();
|
||||
return _frmMain.ShowDialog();
|
||||
}
|
||||
@@ -862,187 +948,247 @@ namespace Lskj.Main.Model
|
||||
return isSuccess;
|
||||
}
|
||||
#endregion
|
||||
/// <summary>
|
||||
/// <para>说明:强制登录下线</para>
|
||||
/// <para>创建人:唐德馨</para>
|
||||
/// <para>创建日期:2023-10-16 </para>
|
||||
/// <para>修改人:</para>
|
||||
/// <para>修改日期:</para>
|
||||
/// <para>修改备注:</para>
|
||||
/// <para>版本:1.0</para>
|
||||
/// </summary>
|
||||
private static void WhenConstraintLogin()
|
||||
internal static void BeginExternalSessionServices()
|
||||
{
|
||||
Thread thread = new Thread(() =>
|
||||
StartSessionMonitors();
|
||||
}
|
||||
|
||||
internal static void EndExternalSessionServices()
|
||||
{
|
||||
StopSessionMonitors();
|
||||
}
|
||||
|
||||
private static void StartSessionMonitors()
|
||||
{
|
||||
StopSessionMonitors();
|
||||
|
||||
CancellationTokenSource cancellation =
|
||||
new CancellationTokenSource();
|
||||
var threads = new List<Thread>();
|
||||
if (SystemInfo.Instance.IsConstraintExit)
|
||||
{
|
||||
bool isClose = false;
|
||||
while (SystemInfo.Instance.IsConstraintExit)
|
||||
threads.Add(CreateSessionMonitor(
|
||||
"ConstraintLoginMonitor",
|
||||
delegate { MonitorConstraintLogin(cancellation.Token); }));
|
||||
}
|
||||
if (SystemInfo.Instance.AwaitTime > 10)
|
||||
{
|
||||
threads.Add(CreateSessionMonitor(
|
||||
"ApplicationLockMonitor",
|
||||
delegate { MonitorApplicationLock(cancellation.Token); }));
|
||||
}
|
||||
if (SystemInfo.Instance.SubscriptRefreshTime > 0 &&
|
||||
!SystemInfo.Instance.RefreshNotify)
|
||||
{
|
||||
threads.Add(CreateSessionMonitor(
|
||||
"SubscriptRefreshMonitor",
|
||||
delegate { MonitorSubscriptRefresh(cancellation.Token); }));
|
||||
}
|
||||
|
||||
lock (SessionMonitorSync)
|
||||
{
|
||||
_sessionMonitorCancellation = cancellation;
|
||||
SessionMonitorThreads.AddRange(threads);
|
||||
isAwaitTime = 10;
|
||||
RefreshTime = 0;
|
||||
}
|
||||
foreach (Thread thread in threads)
|
||||
thread.Start();
|
||||
}
|
||||
|
||||
internal static void StopSessionMonitors()
|
||||
{
|
||||
CancellationTokenSource cancellation;
|
||||
Thread[] threads;
|
||||
lock (SessionMonitorSync)
|
||||
{
|
||||
cancellation = _sessionMonitorCancellation;
|
||||
_sessionMonitorCancellation = null;
|
||||
threads = SessionMonitorThreads.ToArray();
|
||||
SessionMonitorThreads.Clear();
|
||||
}
|
||||
|
||||
if (cancellation == null)
|
||||
return;
|
||||
|
||||
cancellation.Cancel();
|
||||
bool allStopped = true;
|
||||
foreach (Thread thread in threads)
|
||||
{
|
||||
if (thread != null &&
|
||||
thread != Thread.CurrentThread &&
|
||||
thread.IsAlive)
|
||||
{
|
||||
string hostName = "";
|
||||
string clientip = "";
|
||||
string loginMacAdress = "";
|
||||
DataTable loginTable = new DataTable();
|
||||
if (!thread.Join(2000))
|
||||
allStopped = false;
|
||||
}
|
||||
}
|
||||
if (allStopped)
|
||||
cancellation.Dispose();
|
||||
}
|
||||
|
||||
private static Thread CreateSessionMonitor(
|
||||
string name,
|
||||
ThreadStart monitor)
|
||||
{
|
||||
return new Thread(monitor)
|
||||
{
|
||||
Name = name,
|
||||
IsBackground = true
|
||||
};
|
||||
}
|
||||
|
||||
private static void MonitorConstraintLogin(CancellationToken token)
|
||||
{
|
||||
while (SystemInfo.Instance.IsConstraintExit &&
|
||||
!token.IsCancellationRequested)
|
||||
{
|
||||
string clientip = string.Empty;
|
||||
string loginMacAdress = string.Empty;
|
||||
try
|
||||
{
|
||||
clientip = SqlHelper.ExecuteScalar(string.Format(
|
||||
"select clientip from p_employeetab where employeeid = '{0}'",
|
||||
ERPInfo.Instance.UserId)) + string.Empty;
|
||||
loginMacAdress = SqlHelper.ExecuteScalar(string.Format(
|
||||
"select macAdress from p_employeetab where employeeid = '{0}'",
|
||||
ERPInfo.Instance.UserId)) + string.Empty;
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
}
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(loginMacAdress) &&
|
||||
!loginMacAdress.Equals(ERPInfo.Instance.MacAddress))
|
||||
{
|
||||
string message = string.Format(
|
||||
"当前用户在另一电脑登录\r\nClientIp:{0}\r\nMacAdress:{1}\r\n当前系统即将关闭",
|
||||
clientip,
|
||||
loginMacAdress);
|
||||
try
|
||||
{
|
||||
loginTable = SqlHelper.ExecuteDataTable("select rtrim(ltrim(substring(hostname,1,100))) as hostname from master.dbo.sysprocesses where loginame = 'lserpAdmin' and (program_name = '' or program_name = '.Net SqlClient Data Provider')");
|
||||
hostName = SqlHelper.ExecuteScalar(string.Format("select hostname from p_LoginHostInfotab where OperatorId = '{0}' and Tagid = 1", ERPInfo.Instance.UserId)) + "";
|
||||
clientip = SqlHelper.ExecuteScalar(string.Format("select clientip from p_employeetab where employeeid = '{0}'", ERPInfo.Instance.UserId)) + "";
|
||||
loginMacAdress = SqlHelper.ExecuteScalar(string.Format("select macAdress from p_employeetab where employeeid = '{0}'", ERPInfo.Instance.UserId)) + "";
|
||||
IExternalMainShell externalMainShell = ExternalMainShell;
|
||||
if (externalMainShell != null &&
|
||||
externalMainShell.IsOpen)
|
||||
{
|
||||
externalMainShell.RequestExit(message);
|
||||
return;
|
||||
}
|
||||
|
||||
bool isClose = false;
|
||||
if (_frmSubSystem != null && _frmSubSystem.Visible)
|
||||
{
|
||||
_frmSubSystem.Invoke(new Action(delegate
|
||||
{
|
||||
_frmSubSystem.Opacity = 0;
|
||||
MessageUtil.Show(message);
|
||||
isClose = true;
|
||||
}));
|
||||
}
|
||||
else if (_frmMain != null && _frmMain.Visible)
|
||||
{
|
||||
_frmMain.Invoke(new Action(delegate
|
||||
{
|
||||
_frmMain.Opacity = 0;
|
||||
MessageUtil.Show(message);
|
||||
isClose = true;
|
||||
}));
|
||||
}
|
||||
|
||||
if (isClose)
|
||||
{
|
||||
ExitSystem();
|
||||
LogUtil.WriteDebug(
|
||||
string.Empty,
|
||||
"退出软件",
|
||||
"软件退出",
|
||||
"系统登录");
|
||||
foreach (Process item in GetApplicationProcesses())
|
||||
{
|
||||
try
|
||||
{
|
||||
item.Kill();
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
}
|
||||
}
|
||||
Application.Exit();
|
||||
return;
|
||||
}
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
}
|
||||
//!string.IsNullOrEmpty(hostName) && loginTable.Select().Where(n => n["hostname"].Equals(hostName)).Count() > 0 && !loginMacAdress.Equals(ERPInfo.Instance.MacAddress)
|
||||
if (!loginMacAdress.Equals(ERPInfo.Instance.MacAddress))
|
||||
{
|
||||
try
|
||||
{
|
||||
if (_frmSubSystem != null && _frmSubSystem.Visible == true)
|
||||
{
|
||||
_frmSubSystem.Invoke(new Action(() =>
|
||||
{
|
||||
if (!isClose)
|
||||
{
|
||||
_frmSubSystem.Opacity = 0;
|
||||
MessageUtil.Show($"当前用户在另一电脑登录\r\nClientIp:{clientip}\r\nMacAdress:{loginMacAdress}\r\n当前系统即将关闭");
|
||||
isClose = true;
|
||||
}
|
||||
}));
|
||||
}
|
||||
else if (_frmMain != null && _frmMain.Visible == true)
|
||||
{
|
||||
_frmMain.Invoke(new Action(() =>
|
||||
{
|
||||
if (!isClose)
|
||||
{
|
||||
_frmMain.Opacity = 0;
|
||||
MessageUtil.Show($"当前用户在另一电脑登录\r\nClientIp:{clientip}\r\nMacAdress:{loginMacAdress}\r\n当前系统即将关闭");
|
||||
isClose = true;
|
||||
}
|
||||
}));
|
||||
}
|
||||
if (isClose)
|
||||
{
|
||||
if (DBConfig.Instance.NoticeExit)
|
||||
{
|
||||
Process[] p1 = Process.GetProcessesByName("Ls_Notice");
|
||||
foreach (Process item in p1)
|
||||
{
|
||||
try
|
||||
{
|
||||
item.Kill();
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
}
|
||||
}
|
||||
if (!string.IsNullOrWhiteSpace(SystemInfo.Instance.QuickMenuId))
|
||||
{
|
||||
Process[] p2 = Process.GetProcessesByName("Lskj.QuickModule");
|
||||
foreach (Process item in p2)
|
||||
{
|
||||
try
|
||||
{
|
||||
item.Kill();
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
//记录登出日志
|
||||
LogUtil.WriteDebug("", "退出软件", "软件退出", "系统登录");
|
||||
Process[] p = Process.GetProcessesByName("Ls_ERP");
|
||||
foreach (Process item in p)
|
||||
{
|
||||
try
|
||||
{
|
||||
item.Kill();
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
}
|
||||
}
|
||||
//Environment.Exit(0);
|
||||
Application.Exit();
|
||||
break;
|
||||
}
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
}
|
||||
}
|
||||
Thread.Sleep(1000);
|
||||
}
|
||||
});
|
||||
thread.Start();
|
||||
}
|
||||
/// <summary>
|
||||
/// 锁定程序
|
||||
/// </summary>
|
||||
private static void LockApplication()
|
||||
{
|
||||
Thread thread = new Thread(() =>
|
||||
{
|
||||
while (SystemInfo.Instance.AwaitTime > 10)
|
||||
{
|
||||
if (isAwaitTime == SystemInfo.Instance.AwaitTime)
|
||||
{
|
||||
isAwaitTime = 0;
|
||||
if (_frmMain != null && _frmMain.Visible == true)
|
||||
{
|
||||
_frmMain.Invoke(new Action(() =>
|
||||
{
|
||||
_frmMain.mainPanelControlEx.AwaitControl.BringToFront();
|
||||
_frmMain.mainPanelControlEx.AwaitControl.Visible = true;
|
||||
_frmMain.mainPanelControlEx.AwaitControl.OnFrmAwaitScreenLoad();
|
||||
}));
|
||||
}
|
||||
}
|
||||
isAwaitTime += 1;
|
||||
Thread.Sleep(1000);
|
||||
}
|
||||
});
|
||||
thread.Start();
|
||||
|
||||
if (token.WaitHandle.WaitOne(1000))
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 刷新数量角标
|
||||
/// </summary>
|
||||
private static void RefreshSubscript()
|
||||
private static void MonitorApplicationLock(CancellationToken token)
|
||||
{
|
||||
Thread thread = new Thread(() =>
|
||||
while (SystemInfo.Instance.AwaitTime > 10 &&
|
||||
!token.IsCancellationRequested)
|
||||
{
|
||||
while (SystemInfo.Instance.SubscriptRefreshTime > 0)
|
||||
if (isAwaitTime >= SystemInfo.Instance.AwaitTime)
|
||||
{
|
||||
if (RefreshTime >= SystemInfo.Instance.SubscriptRefreshTime)
|
||||
isAwaitTime = 0;
|
||||
IExternalMainShell externalMainShell = ExternalMainShell;
|
||||
if (externalMainShell != null && externalMainShell.IsOpen)
|
||||
{
|
||||
RefreshTime = 0;
|
||||
if (_frmMain != null && _frmMain.Visible == true)
|
||||
externalMainShell.RequestLock();
|
||||
return;
|
||||
}
|
||||
if (_frmMain != null && _frmMain.Visible)
|
||||
{
|
||||
_frmMain.Invoke(new Action(delegate
|
||||
{
|
||||
XtraTabPage tabPage = _frmMain.mainPanelControlEx.tabMain.SelectedTabPage;
|
||||
if (tabPage.TabIndex == 0)
|
||||
{
|
||||
if (!SystemInfo.Instance.RefreshNotify)
|
||||
{
|
||||
Thread threadnew = new Thread(_frmMain.mainPanelControlEx.RefreshSubscript);
|
||||
threadnew.IsBackground = true;
|
||||
threadnew.Start();
|
||||
}
|
||||
}
|
||||
_frmMain.mainPanelControlEx.AwaitControl.BringToFront();
|
||||
_frmMain.mainPanelControlEx.AwaitControl.Visible = true;
|
||||
_frmMain.mainPanelControlEx.AwaitControl.OnFrmAwaitScreenLoad();
|
||||
}));
|
||||
}
|
||||
}
|
||||
isAwaitTime += 1;
|
||||
if (token.WaitHandle.WaitOne(1000))
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
private static void MonitorSubscriptRefresh(CancellationToken token)
|
||||
{
|
||||
while (SystemInfo.Instance.SubscriptRefreshTime > 0 &&
|
||||
!token.IsCancellationRequested)
|
||||
{
|
||||
if (RefreshTime >= SystemInfo.Instance.SubscriptRefreshTime)
|
||||
{
|
||||
RefreshTime = 0;
|
||||
IExternalMainShell externalMainShell = ExternalMainShell;
|
||||
if (externalMainShell != null && externalMainShell.IsOpen)
|
||||
{
|
||||
externalMainShell.RequestSubscriptRefresh();
|
||||
}
|
||||
else if (_frmMain != null && _frmMain.Visible)
|
||||
{
|
||||
XtraTabPage tabPage =
|
||||
_frmMain.mainPanelControlEx.tabMain.SelectedTabPage;
|
||||
if (tabPage != null &&
|
||||
tabPage.TabIndex == 0 &&
|
||||
!SystemInfo.Instance.RefreshNotify)
|
||||
{
|
||||
Thread refreshThread = new Thread(
|
||||
_frmMain.mainPanelControlEx.RefreshSubscript);
|
||||
refreshThread.IsBackground = true;
|
||||
refreshThread.Start();
|
||||
}
|
||||
}
|
||||
RefreshTime += 1;
|
||||
Thread.Sleep(60000);
|
||||
}
|
||||
});
|
||||
thread.Start();
|
||||
RefreshTime += 1;
|
||||
if (token.WaitHandle.WaitOne(60000))
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1107,6 +1253,12 @@ namespace Lskj.Main.Model
|
||||
/// </summary>
|
||||
public static void ReLogin()
|
||||
{
|
||||
IExternalMainShell externalMainShell = ExternalMainShell;
|
||||
if (externalMainShell != null && externalMainShell.IsOpen)
|
||||
{
|
||||
externalMainShell.RequestRelogin();
|
||||
return;
|
||||
}
|
||||
if (_frmMain != null)
|
||||
{
|
||||
if (ERPInfo.Instance.WatermarkForm != null)
|
||||
@@ -1121,5 +1273,16 @@ namespace Lskj.Main.Model
|
||||
StartForm();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 返回当前启动路线需要退出的主进程。
|
||||
/// 旧入口保持原有 Ls_ERP 进程名语义,外部宿主只退出当前 WPF 进程。
|
||||
/// </summary>
|
||||
internal static Process[] GetApplicationProcesses()
|
||||
{
|
||||
return ExternalMainShell == null
|
||||
? Process.GetProcessesByName("Ls_ERP")
|
||||
: new[] { Process.GetCurrentProcess() };
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+158
-48
@@ -21,11 +21,22 @@ using System.Resources;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Resources;
|
||||
using System.Diagnostics;
|
||||
using Lskj.Main.Hosting;
|
||||
|
||||
namespace Lskj.Main
|
||||
{
|
||||
static class Program
|
||||
{
|
||||
private static CefMainArgs _mainArgs;
|
||||
private static DemoCefApp _cefApp;
|
||||
private static CefSettings _cefSettings;
|
||||
private static Messager _messageFilter;
|
||||
private static EventHandler _cefIdleHandler;
|
||||
private static AboutDevCompanion _devCompanion;
|
||||
private static bool _cefInitialized;
|
||||
private static bool _mainProcessInitialized;
|
||||
private static bool _mainProcessShutdown;
|
||||
|
||||
//[DllImport("user32.dll")]
|
||||
//private static extern bool SetProcessDpiAwarenessContext(IntPtr dpiContext);
|
||||
|
||||
@@ -36,61 +47,160 @@ namespace Lskj.Main
|
||||
/// 应用程序的主入口点。
|
||||
/// </summary>
|
||||
[STAThread]
|
||||
static void Main(string[] args)
|
||||
static int Main(string[] args)
|
||||
{
|
||||
//SetProcessDpiAwarenessContext(DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE_V2);
|
||||
CefRuntime.Load();//cef浏览器模块设置加载
|
||||
var mainArgs = new CefMainArgs(args);
|
||||
var app = new DemoCefApp();
|
||||
var settings = new CefSettings
|
||||
LegacyProcessStartResult processResult;
|
||||
try
|
||||
{
|
||||
processResult = LegacyApplicationHost.PrepareProcess(args);
|
||||
}
|
||||
catch (Exception exception)
|
||||
{
|
||||
LogHelper.Instance.WriteError(exception);
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (!processResult.ShouldRunApplication)
|
||||
return processResult.ExitCode;
|
||||
|
||||
try
|
||||
{
|
||||
LegacyApplicationHost.InitializeMainProcess(null);
|
||||
Manager.StartForm();
|
||||
return 0;
|
||||
}
|
||||
catch (Exception exception)
|
||||
{
|
||||
MessageUtil.Show(exception);
|
||||
LogHelper.Instance.WriteError(exception);
|
||||
return -1;
|
||||
}
|
||||
finally
|
||||
{
|
||||
LegacyApplicationHost.ShutdownMainProcess();
|
||||
}
|
||||
}
|
||||
|
||||
internal static int PrepareProcess(string[] args)
|
||||
{
|
||||
if (_mainArgs != null)
|
||||
throw new InvalidOperationException("CEF 进程分流已经执行。");
|
||||
|
||||
CefRuntime.Load();
|
||||
_mainArgs = new CefMainArgs(args ?? new string[0]);
|
||||
_cefApp = new DemoCefApp();
|
||||
_cefSettings = CreateCefSettings();
|
||||
int code = CefRuntime.ExecuteProcess(
|
||||
_mainArgs,
|
||||
_cefApp,
|
||||
IntPtr.Zero);
|
||||
Console.WriteLine(
|
||||
"CefRuntime.ExecuteProcess() returns {0}",
|
||||
code);
|
||||
return code;
|
||||
}
|
||||
|
||||
internal static void InitializeMainProcess()
|
||||
{
|
||||
if (_mainProcessInitialized)
|
||||
throw new InvalidOperationException("旧主进程环境已经初始化。");
|
||||
if (_mainProcessShutdown)
|
||||
throw new InvalidOperationException("旧主进程环境已经关闭。");
|
||||
if (_mainArgs == null || _cefApp == null || _cefSettings == null)
|
||||
throw new InvalidOperationException("尚未执行 CEF 进程分流。");
|
||||
|
||||
try
|
||||
{
|
||||
CefRuntime.Initialize(
|
||||
_mainArgs,
|
||||
_cefSettings,
|
||||
_cefApp,
|
||||
IntPtr.Zero);
|
||||
_cefInitialized = true;
|
||||
|
||||
Thread.CurrentThread.CurrentUICulture =
|
||||
new CultureInfo("zh-CN");
|
||||
BonusSkins.Register();
|
||||
SkinManager.EnableFormSkins();
|
||||
|
||||
Application.SetUnhandledExceptionMode(
|
||||
UnhandledExceptionMode.CatchException);
|
||||
Application.EnableVisualStyles();
|
||||
Application.SetCompatibleTextRenderingDefault(false);
|
||||
_messageFilter = new Messager();
|
||||
Application.AddMessageFilter(_messageFilter);
|
||||
Application.ThreadException += Application_ThreadException;
|
||||
AppDomain.CurrentDomain.UnhandledException +=
|
||||
CurrentDomain_UnhandledException;
|
||||
|
||||
if (!_cefSettings.MultiThreadedMessageLoop)
|
||||
{
|
||||
_cefIdleHandler = delegate
|
||||
{
|
||||
CefRuntime.DoMessageLoopWork();
|
||||
};
|
||||
Application.Idle += _cefIdleHandler;
|
||||
}
|
||||
|
||||
_devCompanion = new AboutDevCompanion(1, false);
|
||||
_devCompanion.Run();
|
||||
Register();
|
||||
_mainProcessInitialized = true;
|
||||
}
|
||||
catch
|
||||
{
|
||||
ShutdownMainProcess();
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
internal static void ShutdownMainProcess()
|
||||
{
|
||||
if (_mainProcessShutdown)
|
||||
return;
|
||||
_mainProcessShutdown = true;
|
||||
|
||||
try
|
||||
{
|
||||
if (_cefIdleHandler != null)
|
||||
{
|
||||
Application.Idle -= _cefIdleHandler;
|
||||
_cefIdleHandler = null;
|
||||
}
|
||||
Application.ThreadException -= Application_ThreadException;
|
||||
AppDomain.CurrentDomain.UnhandledException -=
|
||||
CurrentDomain_UnhandledException;
|
||||
if (_messageFilter != null)
|
||||
{
|
||||
Application.RemoveMessageFilter(_messageFilter);
|
||||
_messageFilter = null;
|
||||
}
|
||||
if (_devCompanion != null)
|
||||
{
|
||||
_devCompanion.Stop();
|
||||
_devCompanion = null;
|
||||
}
|
||||
}
|
||||
finally
|
||||
{
|
||||
if (_cefInitialized)
|
||||
{
|
||||
CefRuntime.Shutdown();
|
||||
_cefInitialized = false;
|
||||
}
|
||||
_mainProcessInitialized = false;
|
||||
}
|
||||
}
|
||||
|
||||
private static CefSettings CreateCefSettings()
|
||||
{
|
||||
return new CefSettings
|
||||
{
|
||||
MultiThreadedMessageLoop = true,
|
||||
LogSeverity = CefLogSeverity.Disable,
|
||||
LogFile = "CefGlue.log",
|
||||
Locale = "zh-CN"
|
||||
};
|
||||
try
|
||||
{
|
||||
var Code = CefRuntime.ExecuteProcess(mainArgs, app, IntPtr.Zero);
|
||||
Console.WriteLine("CefRuntime.ExecuteProcess() returns {0}", Code);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
}
|
||||
CefRuntime.Initialize(mainArgs, settings, app, IntPtr.Zero);
|
||||
try
|
||||
{
|
||||
// 汉化DevExpress界面
|
||||
Thread.CurrentThread.CurrentUICulture = new CultureInfo("zh-CN");
|
||||
// 设置皮肤
|
||||
BonusSkins.Register();
|
||||
SkinManager.EnableFormSkins();
|
||||
|
||||
//处理未捕获的异常
|
||||
Application.SetUnhandledExceptionMode(UnhandledExceptionMode.CatchException);
|
||||
Application.EnableVisualStyles();
|
||||
Application.SetCompatibleTextRenderingDefault(false);
|
||||
Application.AddMessageFilter(new Messager());
|
||||
Application.ThreadException += new ThreadExceptionEventHandler(Application_ThreadException);
|
||||
AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException);
|
||||
if (!settings.MultiThreadedMessageLoop)//消息循环
|
||||
{
|
||||
Application.Idle += (sender, e) => { CefRuntime.DoMessageLoopWork(); };
|
||||
}
|
||||
AboutDevCompanion DC = new AboutDevCompanion(1, false);
|
||||
DC.Run();
|
||||
Register();
|
||||
// 启动程序
|
||||
Manager.StartForm();
|
||||
CefRuntime.Shutdown();
|
||||
DC.Stop();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageUtil.Show(ex);
|
||||
LogHelper.Instance.WriteError(ex);
|
||||
}
|
||||
|
||||
}
|
||||
#region 浏览器处理类
|
||||
/// <summary>
|
||||
|
||||
@@ -463,7 +463,10 @@ namespace Lskj.Model
|
||||
/// 单据来源明细拖拽(双击)后是否背景颜色
|
||||
/// </summary>
|
||||
public bool IsSelectSourceColor { get { return !string.IsNullOrWhiteSpace(SelectSourceColor); } }
|
||||
|
||||
/// <summary>
|
||||
/// 单据横向模式
|
||||
/// </summary>
|
||||
public bool HorizontalMode;
|
||||
|
||||
|
||||
/// <summary>
|
||||
@@ -571,6 +574,7 @@ namespace Lskj.Model
|
||||
this.BillFinalReviewAdd = rowItem.Table.Columns.Contains("BillFinalReviewAdd") ? "1".Equals(rowItem["BillFinalReviewAdd"] + "") : false;
|
||||
this.SourceMainPushPullHide = rowItem.Table.Columns.Contains("SourceMainPushPullHide") ? "1".Equals(rowItem["SourceMainPushPullHide"] + "") : false;
|
||||
this.SelectSourceColor = rowItem.Table.Columns.Contains("SelectSourceColor") ? rowItem["SelectSourceColor"] + "" : "";
|
||||
this.HorizontalMode = rowItem.Table.Columns.Contains("HorizontalMode") ? "1".Equals(rowItem["HorizontalMode"] + "") : false;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -121,6 +121,8 @@ namespace Lskj.Notice
|
||||
/// </summary>
|
||||
void ReloadGridData()
|
||||
{
|
||||
DataTable data = null;
|
||||
string sqlStr = string.Empty;
|
||||
try
|
||||
{
|
||||
DBConfig.Instance.ReadConfig();
|
||||
@@ -144,13 +146,13 @@ namespace Lskj.Notice
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
data = NoticeImpl.GetNoticeData2(ERPInfo.Instance.UserId, out sqlStr);
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
}
|
||||
string sqlStr = string.Empty;
|
||||
DataTable data = NoticeImpl.GetNoticeData2(ERPInfo.Instance.UserId, out sqlStr);
|
||||
|
||||
//DataTable data = NoticeImpl.GetNoticeData2(ERPInfo.Instance.UserId, out sqlStr);
|
||||
|
||||
|
||||
int rowCount = data == null ? 0 : data.Rows.Count;
|
||||
|
||||
Generated
+130
-130
@@ -28,7 +28,18 @@
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.ssc_main = new DevExpress.XtraEditors.SplitContainerControl();
|
||||
this.components = new System.ComponentModel.Container();
|
||||
this.barManager1 = new DevExpress.XtraBars.BarManager(this.components);
|
||||
this.barDockControl1 = new DevExpress.XtraBars.BarDockControl();
|
||||
this.barDockControl2 = new DevExpress.XtraBars.BarDockControl();
|
||||
this.barDockControl3 = new DevExpress.XtraBars.BarDockControl();
|
||||
this.barDockControl5 = new DevExpress.XtraBars.BarDockControl();
|
||||
this.pmFP = new DevExpress.XtraBars.PopupMenu(this.components);
|
||||
this.pmBillExp = new DevExpress.XtraBars.PopupMenu(this.components);
|
||||
this.pmBill = new DevExpress.XtraBars.PopupMenu(this.components);
|
||||
this.pMprint = new DevExpress.XtraBars.PopupMenu(this.components);
|
||||
this.pMenu = new DevExpress.XtraBars.PopupMenu(this.components);
|
||||
this.tb_buttom = new Lskj.Control.TabControlEx();
|
||||
this.ssc_main_top = new DevExpress.XtraEditors.SplitContainerControl();
|
||||
this.pl_left = new DevExpress.XtraEditors.PanelControl();
|
||||
this.xtc_left_container = new DevExpress.XtraTab.XtraTabControl();
|
||||
@@ -40,17 +51,11 @@
|
||||
this.pl_treeview_detault_search = new DevExpress.XtraEditors.PanelControl();
|
||||
this.panelControl4 = new DevExpress.XtraEditors.PanelControl();
|
||||
this.textEdit1 = new DevExpress.XtraEditors.TextEdit();
|
||||
this.barManager1 = new DevExpress.XtraBars.BarManager();
|
||||
this.barDockControl1 = new DevExpress.XtraBars.BarDockControl();
|
||||
this.barDockControl2 = new DevExpress.XtraBars.BarDockControl();
|
||||
this.barDockControl3 = new DevExpress.XtraBars.BarDockControl();
|
||||
this.barDockControl5 = new DevExpress.XtraBars.BarDockControl();
|
||||
this.lceCombobox = new Lskj.Control.LabelComboxEdit();
|
||||
this.panelControl3 = new DevExpress.XtraEditors.PanelControl();
|
||||
this.btnTreeSearch = new DevExpress.XtraEditors.SimpleButton();
|
||||
this.pl_main_bottom = new DevExpress.XtraEditors.PanelControl();
|
||||
this.dbpFP = new DevExpress.XtraEditors.DropDownButton();
|
||||
this.pmFP = new DevExpress.XtraBars.PopupMenu();
|
||||
this.btnRefresh = new DevExpress.XtraEditors.SimpleButton();
|
||||
this.btnHiding = new DevExpress.XtraEditors.SimpleButton();
|
||||
this.btnHelp = new DevExpress.XtraEditors.SimpleButton();
|
||||
@@ -63,15 +68,11 @@
|
||||
this.labelControl2 = new DevExpress.XtraEditors.LabelControl();
|
||||
this.btn_input = new DevExpress.XtraEditors.SimpleButton();
|
||||
this.dpbImport = new DevExpress.XtraEditors.DropDownButton();
|
||||
this.pmBillExp = new DevExpress.XtraBars.PopupMenu();
|
||||
this.btnBillAdd = new DevExpress.XtraEditors.SimpleButton();
|
||||
this.btnBillApply = new DevExpress.XtraEditors.SimpleButton();
|
||||
this.dpCopyBill = new DevExpress.XtraEditors.DropDownButton();
|
||||
this.pmBill = new DevExpress.XtraBars.PopupMenu();
|
||||
this.btnPrint = new DevExpress.XtraEditors.DropDownButton();
|
||||
this.pMprint = new DevExpress.XtraBars.PopupMenu();
|
||||
this.dpbTools = new DevExpress.XtraEditors.DropDownButton();
|
||||
this.pMenu = new DevExpress.XtraBars.PopupMenu();
|
||||
this.btnDelete = new DevExpress.XtraEditors.SimpleButton();
|
||||
this.btnBillSave = new DevExpress.XtraEditors.SimpleButton();
|
||||
this.pl_main_top = new DevExpress.XtraEditors.PanelControl();
|
||||
@@ -85,9 +86,13 @@
|
||||
this.rdRed = new System.Windows.Forms.RadioButton();
|
||||
this.pl_blue = new DevExpress.XtraEditors.PanelControl();
|
||||
this.rdBlue = new System.Windows.Forms.RadioButton();
|
||||
this.tb_buttom = new Lskj.Control.TabControlEx();
|
||||
((System.ComponentModel.ISupportInitialize)(this.ssc_main)).BeginInit();
|
||||
this.ssc_main.SuspendLayout();
|
||||
this.ssc_main = new DevExpress.XtraEditors.SplitContainerControl();
|
||||
((System.ComponentModel.ISupportInitialize)(this.barManager1)).BeginInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.pmFP)).BeginInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.pmBillExp)).BeginInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.pmBill)).BeginInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.pMprint)).BeginInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.pMenu)).BeginInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.ssc_main_top)).BeginInit();
|
||||
this.ssc_main_top.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this.pl_left)).BeginInit();
|
||||
@@ -105,12 +110,10 @@
|
||||
((System.ComponentModel.ISupportInitialize)(this.panelControl4)).BeginInit();
|
||||
this.panelControl4.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this.textEdit1.Properties)).BeginInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.barManager1)).BeginInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.panelControl3)).BeginInit();
|
||||
this.panelControl3.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this.pl_main_bottom)).BeginInit();
|
||||
this.pl_main_bottom.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this.pmFP)).BeginInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.pl_templete)).BeginInit();
|
||||
this.pl_templete.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this.cb_templete.Properties)).BeginInit();
|
||||
@@ -118,10 +121,6 @@
|
||||
this.pl_input.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this.cb_input.Properties)).BeginInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.txt_input.Properties)).BeginInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.pmBillExp)).BeginInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.pmBill)).BeginInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.pMprint)).BeginInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.pMenu)).BeginInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.pl_main_top)).BeginInit();
|
||||
this.pl_main_top.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this.pl_main_top_center)).BeginInit();
|
||||
@@ -134,26 +133,80 @@
|
||||
this.pl_red.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this.pl_blue)).BeginInit();
|
||||
this.pl_blue.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this.ssc_main)).BeginInit();
|
||||
this.ssc_main.SuspendLayout();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// ssc_main
|
||||
// barManager1
|
||||
//
|
||||
this.ssc_main.Appearance.BackColor = System.Drawing.Color.Transparent;
|
||||
this.ssc_main.Appearance.Options.UseBackColor = true;
|
||||
this.ssc_main.CollapsePanel = DevExpress.XtraEditors.SplitCollapsePanel.Panel2;
|
||||
this.ssc_main.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.ssc_main.Horizontal = false;
|
||||
this.ssc_main.Location = new System.Drawing.Point(0, 0);
|
||||
this.ssc_main.Name = "ssc_main";
|
||||
this.ssc_main.Panel1.Controls.Add(this.ssc_main_top);
|
||||
this.ssc_main.Panel1.Text = "Panel1";
|
||||
this.ssc_main.Panel2.Controls.Add(this.tb_buttom);
|
||||
this.ssc_main.Panel2.Text = "Panel2";
|
||||
this.ssc_main.Size = new System.Drawing.Size(1511, 730);
|
||||
this.ssc_main.SplitterPosition = 445;
|
||||
this.ssc_main.TabIndex = 0;
|
||||
this.ssc_main.Text = "splitContainerControl1";
|
||||
this.ssc_main.SplitterMoved += new System.EventHandler(this.OnMainSplitterMoved);
|
||||
this.barManager1.DockControls.Add(this.barDockControl1);
|
||||
this.barManager1.DockControls.Add(this.barDockControl2);
|
||||
this.barManager1.DockControls.Add(this.barDockControl3);
|
||||
this.barManager1.DockControls.Add(this.barDockControl5);
|
||||
this.barManager1.Form = this;
|
||||
this.barManager1.MaxItemId = 0;
|
||||
//
|
||||
// barDockControl1
|
||||
//
|
||||
this.barDockControl1.CausesValidation = false;
|
||||
this.barDockControl1.Dock = System.Windows.Forms.DockStyle.Top;
|
||||
this.barDockControl1.Location = new System.Drawing.Point(0, 0);
|
||||
this.barDockControl1.Size = new System.Drawing.Size(1511, 0);
|
||||
//
|
||||
// barDockControl2
|
||||
//
|
||||
this.barDockControl2.CausesValidation = false;
|
||||
this.barDockControl2.Dock = System.Windows.Forms.DockStyle.Bottom;
|
||||
this.barDockControl2.Location = new System.Drawing.Point(0, 730);
|
||||
this.barDockControl2.Size = new System.Drawing.Size(1511, 0);
|
||||
//
|
||||
// barDockControl3
|
||||
//
|
||||
this.barDockControl3.CausesValidation = false;
|
||||
this.barDockControl3.Dock = System.Windows.Forms.DockStyle.Left;
|
||||
this.barDockControl3.Location = new System.Drawing.Point(0, 0);
|
||||
this.barDockControl3.Size = new System.Drawing.Size(0, 730);
|
||||
//
|
||||
// barDockControl5
|
||||
//
|
||||
this.barDockControl5.CausesValidation = false;
|
||||
this.barDockControl5.Dock = System.Windows.Forms.DockStyle.Right;
|
||||
this.barDockControl5.Location = new System.Drawing.Point(1511, 0);
|
||||
this.barDockControl5.Size = new System.Drawing.Size(0, 730);
|
||||
//
|
||||
// pmFP
|
||||
//
|
||||
this.pmFP.Manager = this.barManager1;
|
||||
this.pmFP.Name = "pmFP";
|
||||
//
|
||||
// pmBillExp
|
||||
//
|
||||
this.pmBillExp.Manager = this.barManager1;
|
||||
this.pmBillExp.Name = "pmBillExp";
|
||||
//
|
||||
// pmBill
|
||||
//
|
||||
this.pmBill.Manager = this.barManager1;
|
||||
this.pmBill.Name = "pmBill";
|
||||
//
|
||||
// pMprint
|
||||
//
|
||||
this.pMprint.Manager = this.barManager1;
|
||||
this.pMprint.Name = "pMprint";
|
||||
//
|
||||
// pMenu
|
||||
//
|
||||
this.pMenu.Manager = this.barManager1;
|
||||
this.pMenu.Name = "pMenu";
|
||||
//
|
||||
// tb_buttom
|
||||
//
|
||||
this.tb_buttom.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.tb_buttom.Location = new System.Drawing.Point(0, 0);
|
||||
this.tb_buttom.Name = "tb_buttom";
|
||||
this.tb_buttom.Size = new System.Drawing.Size(1511, 280);
|
||||
this.tb_buttom.TabIndex = 25;
|
||||
this.tb_buttom.Load += new System.EventHandler(this.tb_buttom_Load);
|
||||
//
|
||||
// ssc_main_top
|
||||
//
|
||||
@@ -296,43 +349,6 @@
|
||||
this.textEdit1.TabIndex = 5;
|
||||
this.textEdit1.KeyDown += new System.Windows.Forms.KeyEventHandler(this.OnTreeConditionKeyDown);
|
||||
//
|
||||
// barManager1
|
||||
//
|
||||
this.barManager1.DockControls.Add(this.barDockControl1);
|
||||
this.barManager1.DockControls.Add(this.barDockControl2);
|
||||
this.barManager1.DockControls.Add(this.barDockControl3);
|
||||
this.barManager1.DockControls.Add(this.barDockControl5);
|
||||
this.barManager1.Form = this;
|
||||
this.barManager1.MaxItemId = 0;
|
||||
//
|
||||
// barDockControl1
|
||||
//
|
||||
this.barDockControl1.CausesValidation = false;
|
||||
this.barDockControl1.Dock = System.Windows.Forms.DockStyle.Top;
|
||||
this.barDockControl1.Location = new System.Drawing.Point(0, 0);
|
||||
this.barDockControl1.Size = new System.Drawing.Size(1511, 0);
|
||||
//
|
||||
// barDockControl2
|
||||
//
|
||||
this.barDockControl2.CausesValidation = false;
|
||||
this.barDockControl2.Dock = System.Windows.Forms.DockStyle.Bottom;
|
||||
this.barDockControl2.Location = new System.Drawing.Point(0, 730);
|
||||
this.barDockControl2.Size = new System.Drawing.Size(1511, 0);
|
||||
//
|
||||
// barDockControl3
|
||||
//
|
||||
this.barDockControl3.CausesValidation = false;
|
||||
this.barDockControl3.Dock = System.Windows.Forms.DockStyle.Left;
|
||||
this.barDockControl3.Location = new System.Drawing.Point(0, 0);
|
||||
this.barDockControl3.Size = new System.Drawing.Size(0, 730);
|
||||
//
|
||||
// barDockControl5
|
||||
//
|
||||
this.barDockControl5.CausesValidation = false;
|
||||
this.barDockControl5.Dock = System.Windows.Forms.DockStyle.Right;
|
||||
this.barDockControl5.Location = new System.Drawing.Point(1511, 0);
|
||||
this.barDockControl5.Size = new System.Drawing.Size(0, 730);
|
||||
//
|
||||
// lceCombobox
|
||||
//
|
||||
this.lceCombobox.BackColor = System.Drawing.SystemColors.Control;
|
||||
@@ -416,11 +432,6 @@
|
||||
this.dbpFP.Text = "分配";
|
||||
this.dbpFP.Click += new System.EventHandler(this.OnBtnFPOldClick);
|
||||
//
|
||||
// pmFP
|
||||
//
|
||||
this.pmFP.Manager = this.barManager1;
|
||||
this.pmFP.Name = "pmFP";
|
||||
//
|
||||
// btnRefresh
|
||||
//
|
||||
this.btnRefresh.AllowFocus = false;
|
||||
@@ -565,11 +576,6 @@
|
||||
this.dpbImport.TabIndex = 26;
|
||||
this.dpbImport.Text = "导入导出";
|
||||
//
|
||||
// pmBillExp
|
||||
//
|
||||
this.pmBillExp.Manager = this.barManager1;
|
||||
this.pmBillExp.Name = "pmBillExp";
|
||||
//
|
||||
// btnBillAdd
|
||||
//
|
||||
this.btnBillAdd.AllowFocus = false;
|
||||
@@ -610,11 +616,6 @@
|
||||
this.dpCopyBill.TabIndex = 24;
|
||||
this.dpCopyBill.Text = "复制单据";
|
||||
//
|
||||
// pmBill
|
||||
//
|
||||
this.pmBill.Manager = this.barManager1;
|
||||
this.pmBill.Name = "pmBill";
|
||||
//
|
||||
// btnPrint
|
||||
//
|
||||
this.btnPrint.AllowFocus = false;
|
||||
@@ -629,11 +630,6 @@
|
||||
this.btnPrint.TabIndex = 23;
|
||||
this.btnPrint.Text = "打印单据";
|
||||
//
|
||||
// pMprint
|
||||
//
|
||||
this.pMprint.Manager = this.barManager1;
|
||||
this.pMprint.Name = "pMprint";
|
||||
//
|
||||
// dpbTools
|
||||
//
|
||||
this.dpbTools.AllowFocus = false;
|
||||
@@ -649,11 +645,6 @@
|
||||
this.dpbTools.Text = "常用工具";
|
||||
this.dpbTools.Click += new System.EventHandler(this.OnToolsClick);
|
||||
//
|
||||
// pMenu
|
||||
//
|
||||
this.pMenu.Manager = this.barManager1;
|
||||
this.pMenu.Name = "pMenu";
|
||||
//
|
||||
// btnDelete
|
||||
//
|
||||
this.btnDelete.AllowFocus = false;
|
||||
@@ -818,14 +809,24 @@
|
||||
this.rdBlue.UseVisualStyleBackColor = true;
|
||||
this.rdBlue.Click += new System.EventHandler(this.OnBlueStateClick);
|
||||
//
|
||||
// tb_buttom
|
||||
// ssc_main
|
||||
//
|
||||
this.tb_buttom.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.tb_buttom.Location = new System.Drawing.Point(0, 0);
|
||||
this.tb_buttom.Name = "tb_buttom";
|
||||
this.tb_buttom.Size = new System.Drawing.Size(1511, 280);
|
||||
this.tb_buttom.TabIndex = 25;
|
||||
this.tb_buttom.Load += new System.EventHandler(this.tb_buttom_Load);
|
||||
this.ssc_main.Appearance.BackColor = System.Drawing.Color.Transparent;
|
||||
this.ssc_main.Appearance.Options.UseBackColor = true;
|
||||
this.ssc_main.CollapsePanel = DevExpress.XtraEditors.SplitCollapsePanel.Panel2;
|
||||
this.ssc_main.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.ssc_main.Horizontal = false;
|
||||
this.ssc_main.Location = new System.Drawing.Point(0, 0);
|
||||
this.ssc_main.Name = "ssc_main";
|
||||
this.ssc_main.Panel1.Controls.Add(this.ssc_main_top);
|
||||
this.ssc_main.Panel1.Text = "Panel1";
|
||||
this.ssc_main.Panel2.Controls.Add(this.tb_buttom);
|
||||
this.ssc_main.Panel2.Text = "Panel2";
|
||||
this.ssc_main.Size = new System.Drawing.Size(1511, 730);
|
||||
this.ssc_main.SplitterPosition = 445;
|
||||
this.ssc_main.TabIndex = 0;
|
||||
this.ssc_main.Text = "splitContainerControl1";
|
||||
this.ssc_main.SplitterMoved += new System.EventHandler(this.OnMainSplitterMoved);
|
||||
//
|
||||
// BillModule
|
||||
//
|
||||
@@ -838,8 +839,12 @@
|
||||
this.Name = "BillModule";
|
||||
this.Size = new System.Drawing.Size(1511, 730);
|
||||
this.KeyDown += new System.Windows.Forms.KeyEventHandler(this.OnFrmMainKeyDown);
|
||||
((System.ComponentModel.ISupportInitialize)(this.ssc_main)).EndInit();
|
||||
this.ssc_main.ResumeLayout(false);
|
||||
((System.ComponentModel.ISupportInitialize)(this.barManager1)).EndInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.pmFP)).EndInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.pmBillExp)).EndInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.pmBill)).EndInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.pMprint)).EndInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.pMenu)).EndInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.ssc_main_top)).EndInit();
|
||||
this.ssc_main_top.ResumeLayout(false);
|
||||
((System.ComponentModel.ISupportInitialize)(this.pl_left)).EndInit();
|
||||
@@ -857,12 +862,10 @@
|
||||
((System.ComponentModel.ISupportInitialize)(this.panelControl4)).EndInit();
|
||||
this.panelControl4.ResumeLayout(false);
|
||||
((System.ComponentModel.ISupportInitialize)(this.textEdit1.Properties)).EndInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.barManager1)).EndInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.panelControl3)).EndInit();
|
||||
this.panelControl3.ResumeLayout(false);
|
||||
((System.ComponentModel.ISupportInitialize)(this.pl_main_bottom)).EndInit();
|
||||
this.pl_main_bottom.ResumeLayout(false);
|
||||
((System.ComponentModel.ISupportInitialize)(this.pmFP)).EndInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.pl_templete)).EndInit();
|
||||
this.pl_templete.ResumeLayout(false);
|
||||
this.pl_templete.PerformLayout();
|
||||
@@ -872,10 +875,6 @@
|
||||
this.pl_input.PerformLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this.cb_input.Properties)).EndInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.txt_input.Properties)).EndInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.pmBillExp)).EndInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.pmBill)).EndInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.pMprint)).EndInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.pMenu)).EndInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.pl_main_top)).EndInit();
|
||||
this.pl_main_top.ResumeLayout(false);
|
||||
((System.ComponentModel.ISupportInitialize)(this.pl_main_top_center)).EndInit();
|
||||
@@ -891,6 +890,8 @@
|
||||
((System.ComponentModel.ISupportInitialize)(this.pl_blue)).EndInit();
|
||||
this.pl_blue.ResumeLayout(false);
|
||||
this.pl_blue.PerformLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this.ssc_main)).EndInit();
|
||||
this.ssc_main.ResumeLayout(false);
|
||||
this.ResumeLayout(false);
|
||||
this.PerformLayout();
|
||||
|
||||
@@ -898,32 +899,42 @@
|
||||
|
||||
|
||||
#endregion
|
||||
|
||||
private DevExpress.XtraTab.XtraTabControl xtc_left_container;
|
||||
private DevExpress.XtraBars.PopupMenu pMenu;
|
||||
private DevExpress.XtraBars.BarManager barManager1;
|
||||
private DevExpress.XtraBars.BarDockControl barDockControl1;
|
||||
private DevExpress.XtraBars.BarDockControl barDockControl2;
|
||||
private DevExpress.XtraBars.BarDockControl barDockControl3;
|
||||
private DevExpress.XtraBars.BarDockControl barDockControl5;
|
||||
private DevExpress.XtraEditors.SplitContainerControl ssc_main;
|
||||
private DevExpress.XtraEditors.SplitContainerControl ssc_main_top;
|
||||
private DevExpress.XtraEditors.PanelControl pl_left;
|
||||
private DevExpress.XtraBars.PopupMenu pmBillExp;
|
||||
private DevExpress.XtraBars.PopupMenu pmBill;
|
||||
private DevExpress.XtraBars.PopupMenu pMprint;
|
||||
private DevExpress.XtraBars.PopupMenu pmFP;
|
||||
private DevExpress.XtraEditors.SplitContainerControl ssc_main;
|
||||
private DevExpress.XtraEditors.SplitContainerControl ssc_main_top;
|
||||
private DevExpress.XtraEditors.PanelControl pl_left;
|
||||
private DevExpress.XtraTab.XtraTabControl xtc_left_container;
|
||||
private DevExpress.XtraEditors.PanelControl pl_main;
|
||||
private DevExpress.XtraEditors.PanelControl pl_main_center;
|
||||
private DevExpress.XtraEditors.PanelControl pl_main_center_detail;
|
||||
private Control.GridControlEx gcMain;
|
||||
private DevExpress.XtraEditors.XtraScrollableControl pl_main_center_master;
|
||||
private DevExpress.XtraEditors.PanelControl pl_treeview_detault_search;
|
||||
private DevExpress.XtraEditors.PanelControl panelControl4;
|
||||
private DevExpress.XtraEditors.TextEdit textEdit1;
|
||||
private Control.LabelComboxEdit lceCombobox;
|
||||
private DevExpress.XtraEditors.PanelControl panelControl3;
|
||||
private DevExpress.XtraEditors.SimpleButton btnTreeSearch;
|
||||
public DevExpress.XtraEditors.PanelControl pl_main_bottom;
|
||||
private DevExpress.XtraEditors.DropDownButton dbpFP;
|
||||
private DevExpress.XtraEditors.SimpleButton btnRefresh;
|
||||
private DevExpress.XtraEditors.SimpleButton btnHiding;
|
||||
private DevExpress.XtraEditors.SimpleButton btnHelp;
|
||||
private DevExpress.XtraEditors.PanelControl pl_templete;
|
||||
private DevExpress.XtraEditors.ComboBoxEdit cb_templete;
|
||||
private DevExpress.XtraEditors.LabelControl lbl_templete;
|
||||
private DevExpress.XtraEditors.PanelControl pl_input;
|
||||
private DevExpress.XtraEditors.ComboBoxEdit cb_input;
|
||||
private DevExpress.XtraEditors.TextEdit txt_input;
|
||||
private DevExpress.XtraEditors.LabelControl labelControl2;
|
||||
private DevExpress.XtraEditors.SimpleButton btn_input;
|
||||
private DevExpress.XtraEditors.DropDownButton dpbImport;
|
||||
@@ -946,16 +957,5 @@
|
||||
private DevExpress.XtraEditors.PanelControl pl_blue;
|
||||
private System.Windows.Forms.RadioButton rdBlue;
|
||||
private Control.TabControlEx tb_buttom;
|
||||
private DevExpress.XtraEditors.TextEdit txt_input;
|
||||
private DevExpress.XtraEditors.SimpleButton btnHiding;
|
||||
private DevExpress.XtraEditors.SimpleButton btnRefresh;
|
||||
private Control.GridControlEx gcMain;
|
||||
private DevExpress.XtraEditors.DropDownButton dbpFP;
|
||||
private DevExpress.XtraBars.PopupMenu pmFP;
|
||||
private DevExpress.XtraEditors.PanelControl panelControl4;
|
||||
private DevExpress.XtraEditors.TextEdit textEdit1;
|
||||
private Control.LabelComboxEdit lceCombobox;
|
||||
private DevExpress.XtraEditors.PanelControl panelControl3;
|
||||
private DevExpress.XtraEditors.SimpleButton btnTreeSearch;
|
||||
}
|
||||
}
|
||||
|
||||
+330
-144
@@ -312,8 +312,7 @@ namespace Lskj.PubBill
|
||||
this.labelControl1.Text = Business.Impl.LanguageTranslation.GetTranslatedText(this.labelControl1.Text);
|
||||
}
|
||||
|
||||
|
||||
|
||||
if (this.BillModel.HorizontalMode) this.HorizontalInterface();
|
||||
|
||||
}
|
||||
catch (Exception ex)
|
||||
@@ -1317,7 +1316,7 @@ namespace Lskj.PubBill
|
||||
DataRow row = BillImpl.GetDataRowResult(this.SysModel.BillMasterSql);
|
||||
if (row != null)
|
||||
{
|
||||
if (row.Table.Columns.Contains(this.BillModel.RtagidKey))
|
||||
if (row.Table.Columns.Contains(this.BillModel.RtagidKey))
|
||||
{
|
||||
string Rtagid = row[this.BillModel.RtagidKey] + "";
|
||||
// 初始化红、蓝单
|
||||
@@ -2089,25 +2088,52 @@ namespace Lskj.PubBill
|
||||
GridControlEx gridDetail = new GridControlEx();
|
||||
|
||||
|
||||
if (model.sourceDetailType.Equals("1"))
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(model.DetailMenuCode))
|
||||
{
|
||||
//明细为树表格
|
||||
gridDetail = sourceDetailControl != null ? (TreeGridControlEx)sourceDetailControl : new TreeGridControlEx();
|
||||
gridDetail.Model = this.SysModel;
|
||||
gridDetail.Dock = DockStyle.Fill;
|
||||
gridDetail.SetReadOnlyColumns(detailColumns == null || detailColumns.Length == 0 ? new DataTable() : detailColumns.CopyToDataTable(), GridCustomColumnStruct.BillSourceDetailGridView + model.FormKey);
|
||||
if (!dataCaches.GetValue(gridDetail, "BaseGridRowColors", out DataTable dtBaseGridRowColors))
|
||||
//来源明细配置了模块号,根据模块号创建对应的ModuleGridEx
|
||||
//ModuleGridEx主要是用保存的功能,数据源sql还是根据配置的为准
|
||||
DataRow modelRow = MainImpl.GetSystemdllTab(model.DetailMenuCode);//获取模块信息
|
||||
if (modelRow == null)
|
||||
{
|
||||
dtBaseGridRowColors = BaseModuleImpl.GetBaseGridRowColors("SOURCEDETAIL_" + model.FormKey);
|
||||
MessageUtil.Show($"没有找到编号为 {model.DetailMenuCode} 的模块信息");
|
||||
gridDetail.Parent = gridDetail;
|
||||
continue;
|
||||
}
|
||||
if (!dataCaches.GetValue(gridDetail, "BaseGridRightMenus", out DataTable dtBaseGridRightMenus))
|
||||
|
||||
ModuleModel sysModel = new ModuleModel(modelRow);
|
||||
//设置主表sql
|
||||
//model.SourceSql = sysModel.MenuSql;
|
||||
|
||||
DynamicModuleModel dyncModel = new DynamicModuleModel(new[]
|
||||
{ sysModel.MenuName, ERPInfo.Instance.UserId, ERPInfo.Instance.UserName,
|
||||
this.SysModel.Privilege, sysModel.ModeCode, "0" });
|
||||
|
||||
ModuleGridEx gridEx = new ModuleGridEx();
|
||||
gridEx.Dock = DockStyle.Fill;
|
||||
if (model.SourceType == 1)
|
||||
{
|
||||
dtBaseGridRightMenus = BaseModuleImpl.GetBaseGridRightMenus("BILLSOURCEDT_" + model.FormKey);
|
||||
gridEx.LeftTreeViewEx = treeView;
|
||||
}
|
||||
gridDetail.SetGridRowColors(dtBaseGridRowColors);
|
||||
gridDetail.SetGridRightMenus(dtBaseGridRightMenus, this.SysModel, OnGridDetailRightMenuCallback);
|
||||
gridDetail.Parent = tabDetail;
|
||||
gridDetail.BorderStyle = System.Windows.Forms.BorderStyle.None;
|
||||
else
|
||||
{
|
||||
gridEx.LeftGridEx = gridControl;
|
||||
gridEx.ParentGridEx = gridControl;
|
||||
}
|
||||
gridEx.ParentKeyField = model.SourceKeyField;
|
||||
gridEx.ParentUnionField = model.SourceKeyField;
|
||||
|
||||
gridEx.VisibleSearchPanel = false;//禁止上方搜索
|
||||
gridEx.InitializeControl(sysModel, dyncModel);
|
||||
|
||||
|
||||
gridDetail = gridEx.GridControlObj;
|
||||
gridEx.Parent = tabDetail;
|
||||
unionModel.GridDetailModuleGridEx = gridEx;
|
||||
|
||||
if (sysModel.TreeAutoMultiHeader == 1) model.ChangeSourceDetailType("1");
|
||||
|
||||
|
||||
|
||||
if (i == 0)
|
||||
{
|
||||
@@ -2116,123 +2142,6 @@ namespace Lskj.PubBill
|
||||
if (attachModels.Count > 0)
|
||||
this.tb_buttom.TabControlObj.TabPages[0].Text = model.UserName + DetailedSuffix;
|
||||
}
|
||||
if (model.MainDetailsAddType != "2")
|
||||
{
|
||||
TreeGridDragGrid treeGridDragGrid = new TreeGridDragGrid((gridDetail as TreeGridControlEx).TreeListObj, this.gcMain.GridView);
|
||||
treeGridDragGrid.OnDragComplete += new TreeGridDragGridCompleteEventHandler(OnTreeGridDetailGridCompleted);
|
||||
}
|
||||
if (BillModel.IsBillDetailCheck == 1)//加载复选框
|
||||
{
|
||||
GridDragGrid.TreeListAddCheckBox((gridDetail as TreeGridControlEx).TreeListObj);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
gridDetail = sourceDetailControl != null ? (GridControlEx)sourceDetailControl : new GridControlEx();
|
||||
gridDetail.Model = this.SysModel;
|
||||
gridDetail.Dock = DockStyle.Fill;
|
||||
gridDetail.SetReadOnlyColumns(detailColumns == null || detailColumns.Length == 0 ? new DataTable() : detailColumns.CopyToDataTable(), GridCustomColumnStruct.BillSourceDetailGridView + model.FormKey);
|
||||
|
||||
if (model.DetailedLoadFilter)
|
||||
{
|
||||
gridDetail.GridView.OptionsView.ShowAutoFilterRow = true;
|
||||
}
|
||||
if (!dataCaches.GetValue(gridDetail, "BaseGridRowColors", out DataTable dtBaseGridRowColors))
|
||||
{
|
||||
dtBaseGridRowColors = BaseModuleImpl.GetBaseGridRowColors("SOURCEDETAIL_" + model.FormKey);
|
||||
}
|
||||
if (!dataCaches.GetValue(gridDetail, "BaseGridRightMenus", out DataTable dtBaseGridRightMenus))
|
||||
{
|
||||
dtBaseGridRightMenus = BaseModuleImpl.GetBaseGridRightMenus("BILLSOURCEDT_" + model.FormKey);
|
||||
}
|
||||
gridDetail.SetGridRowColors(dtBaseGridRowColors);
|
||||
gridDetail.SetGridRightMenus(dtBaseGridRightMenus, this.SysModel, OnGridDetailRightMenuCallback);
|
||||
if (BillModel.IsBillDetailCheck == 0)
|
||||
{
|
||||
if (model.MainDetailsAddType != "2") gridDetail.GridView.DoubleClick += new EventHandler(OnGridDetailDoubleClick);
|
||||
}
|
||||
//明细的明细(明细分成左右2个)
|
||||
if (!string.IsNullOrEmpty(model.SourceDetailsDetailsSql))
|
||||
{
|
||||
GridControlEx gridDetail_Details = sourceDetailDetailControl != null ? (GridControlEx)sourceDetailDetailControl : new GridControlEx();
|
||||
gridDetail_Details.Model = this.SysModel;
|
||||
gridDetail_Details.Dock = DockStyle.Fill;
|
||||
//创建只读列
|
||||
if (!dataCaches.GetValue(gridDetail_Details, "Detail_Details", out DataTable dataTable))
|
||||
{
|
||||
dataTable = BaseModuleImpl.getDetail_Details(model.FormKey);
|
||||
}
|
||||
gridDetail_Details.SetReadOnlyColumns(dataTable);
|
||||
//设置右键
|
||||
if (!dataCaches.GetValue(gridDetail_Details, "BaseGridRightMenus", out DataTable dttBaseGridRightMenus))
|
||||
{
|
||||
dttBaseGridRightMenus = BaseModuleImpl.GetBaseGridRightMenus("BILLSOURCEDTX_" + model.FormKey);
|
||||
}
|
||||
gridDetail_Details.SetGridRightMenus(dttBaseGridRightMenus, this.SysModel, OnGridDetailRightMenuCallback);
|
||||
//明细点击 更新 明细的明细
|
||||
gridDetail.GridView.FocusedRowObjectChanged += GridView_FocusedRowObjectChanged;
|
||||
gridDetail.GridView.Tag = model.SourceDetailsDetailsSql;
|
||||
//创建SplitContainerControl控件,让下方可以左右拖动
|
||||
SplitContainerControl splitContainerControl = new DevExpress.XtraEditors.SplitContainerControl();
|
||||
splitContainerControl.Dock = DockStyle.Fill;
|
||||
splitContainerControl.Panel1.Controls.Add(gridDetail);
|
||||
gridDetail.BorderStyle = System.Windows.Forms.BorderStyle.None;
|
||||
splitContainerControl.Panel2.Controls.Add(gridDetail_Details);
|
||||
gridDetail_Details.BorderStyle = System.Windows.Forms.BorderStyle.None;
|
||||
|
||||
splitContainerControl.SplitterMoved += new System.EventHandler(this.OnDetailsSplitterMoved);
|
||||
string newwidth = IniHelper.Read(string.Format("bill_Details_Width_{0}", this.SysModel.ModuleCode));//通过Key获取Value值
|
||||
if (!string.IsNullOrEmpty(newwidth))
|
||||
{
|
||||
splitContainerControl.SplitterPosition = Convert.ToInt32(newwidth);
|
||||
}
|
||||
else
|
||||
{
|
||||
int width = this.tb_buttom.Width;//获取控件宽度
|
||||
splitContainerControl.SplitterPosition = width / 2;//然后将分割位置设置在宽度一半位置
|
||||
}
|
||||
if (model.MainDetailsAddType != "1")
|
||||
{
|
||||
//明细的明细拖拽到上方
|
||||
if (this.BillModel.DetailTreeTable)
|
||||
{
|
||||
GridDragTreeGrid dragDetaigDetailGrid = new GridDragTreeGrid(gridDetail_Details.GridView, (this.gcMain as TreeGridControlEx).TreeListObj);
|
||||
dragDetaigDetailGrid.CanDragParentNode = true;
|
||||
dragDetaigDetailGrid.NeglectingNodes = true;
|
||||
dragDetaigDetailGrid.OnDragComplete += DragDetailGrid_OnDragComplete;
|
||||
}
|
||||
else
|
||||
{
|
||||
GridDragGrid dragDetaigDetailGrid = new GridDragGrid(gridDetail_Details.GridView, this.gcMain.GridView);
|
||||
dragDetaigDetailGrid.OnDragComplete += new GridFragGridCompleteEventHandler(OnDragDetailGridCompleted);
|
||||
}
|
||||
|
||||
if (BillModel.IsBillDetailCheck == 0)
|
||||
{
|
||||
//明细的明细双击加载到上方
|
||||
gridDetail_Details.GridView.DoubleClick += new EventHandler(OnGridDetailDetailDoubleClick);
|
||||
}
|
||||
}
|
||||
|
||||
splitContainerControl.Parent = tabDetail;
|
||||
unionModel.GridDetailDetailControlObj = gridDetail_Details;
|
||||
}
|
||||
else
|
||||
{
|
||||
gridDetail.Parent = tabDetail;
|
||||
gridDetail.BorderStyle = System.Windows.Forms.BorderStyle.None;
|
||||
|
||||
}
|
||||
|
||||
if (i == 0)
|
||||
{
|
||||
this.tb_buttom.TabControlObj.TabPages.Insert(0, tabDetail);
|
||||
this.tb_buttom.TabControlObj.SelectedTabPageIndex = 0;
|
||||
if (attachModels.Count > 0)
|
||||
this.tb_buttom.TabControlObj.TabPages[0].Text = model.UserName + DetailedSuffix;
|
||||
}
|
||||
|
||||
if (model.MainDetailsAddType != "2")
|
||||
{
|
||||
if (this.BillModel.DetailTreeTable)
|
||||
@@ -2247,21 +2156,202 @@ namespace Lskj.PubBill
|
||||
}
|
||||
else
|
||||
{
|
||||
GridDragGrid dragDetailGrid = new GridDragGrid(gridDetail.GridView, this.gcMain.GridView);
|
||||
dragDetailGrid.OnDragComplete += new GridFragGridCompleteEventHandler(OnDragDetailGridCompleted);
|
||||
if (this.BillModel.IsSelectSourceColor) gridDetail.GridView.CustomDrawCell += GridView_CustomDrawCell;
|
||||
if (sysModel.TreeAutoMultiHeader == 1)
|
||||
{
|
||||
TreeGridDragGrid treeGridDragGrid = new TreeGridDragGrid((gridDetail as TreeGridControlEx).TreeListObj, this.gcMain.GridView);
|
||||
treeGridDragGrid.OnDragComplete += new TreeGridDragGridCompleteEventHandler(OnTreeGridDetailGridCompleted);
|
||||
}
|
||||
else
|
||||
{
|
||||
GridDragGrid dragDetailGrid = new GridDragGrid(gridDetail.GridView, this.gcMain.GridView);
|
||||
dragDetailGrid.OnDragComplete += new GridFragGridCompleteEventHandler(OnDragDetailGridCompleted);
|
||||
if (this.BillModel.IsSelectSourceColor) gridDetail.GridView.CustomDrawCell += GridView_CustomDrawCell;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
if (BillModel.IsBillDetailCheck == 1)//加载复选框
|
||||
}
|
||||
else
|
||||
{
|
||||
if (model.sourceDetailType.Equals("1"))
|
||||
{
|
||||
GridDragGrid.GridAddCheckBox(gridDetail.GridView);
|
||||
//明细为树表格
|
||||
gridDetail = sourceDetailControl != null ? (TreeGridControlEx)sourceDetailControl : new TreeGridControlEx();
|
||||
gridDetail.Model = this.SysModel;
|
||||
gridDetail.Dock = DockStyle.Fill;
|
||||
gridDetail.SetReadOnlyColumns(detailColumns == null || detailColumns.Length == 0 ? new DataTable() : detailColumns.CopyToDataTable(), GridCustomColumnStruct.BillSourceDetailGridView + model.FormKey);
|
||||
if (!dataCaches.GetValue(gridDetail, "BaseGridRowColors", out DataTable dtBaseGridRowColors))
|
||||
{
|
||||
dtBaseGridRowColors = BaseModuleImpl.GetBaseGridRowColors("SOURCEDETAIL_" + model.FormKey);
|
||||
}
|
||||
if (!dataCaches.GetValue(gridDetail, "BaseGridRightMenus", out DataTable dtBaseGridRightMenus))
|
||||
{
|
||||
dtBaseGridRightMenus = BaseModuleImpl.GetBaseGridRightMenus("BILLSOURCEDT_" + model.FormKey);
|
||||
}
|
||||
gridDetail.SetGridRowColors(dtBaseGridRowColors);
|
||||
gridDetail.SetGridRightMenus(dtBaseGridRightMenus, this.SysModel, OnGridDetailRightMenuCallback);
|
||||
gridDetail.Parent = tabDetail;
|
||||
gridDetail.BorderStyle = System.Windows.Forms.BorderStyle.None;
|
||||
|
||||
if (i == 0)
|
||||
{
|
||||
this.tb_buttom.TabControlObj.TabPages.Insert(0, tabDetail);
|
||||
this.tb_buttom.TabControlObj.SelectedTabPageIndex = 0;
|
||||
if (attachModels.Count > 0)
|
||||
this.tb_buttom.TabControlObj.TabPages[0].Text = model.UserName + DetailedSuffix;
|
||||
}
|
||||
if (model.MainDetailsAddType != "2")
|
||||
{
|
||||
TreeGridDragGrid treeGridDragGrid = new TreeGridDragGrid((gridDetail as TreeGridControlEx).TreeListObj, this.gcMain.GridView);
|
||||
treeGridDragGrid.OnDragComplete += new TreeGridDragGridCompleteEventHandler(OnTreeGridDetailGridCompleted);
|
||||
}
|
||||
if (BillModel.IsBillDetailCheck == 1)//加载复选框
|
||||
{
|
||||
GridDragGrid.TreeListAddCheckBox((gridDetail as TreeGridControlEx).TreeListObj);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
gridDetail = sourceDetailControl != null ? (GridControlEx)sourceDetailControl : new GridControlEx();
|
||||
gridDetail.Model = this.SysModel;
|
||||
gridDetail.Dock = DockStyle.Fill;
|
||||
gridDetail.SetReadOnlyColumns(detailColumns == null || detailColumns.Length == 0 ? new DataTable() : detailColumns.CopyToDataTable(), GridCustomColumnStruct.BillSourceDetailGridView + model.FormKey);
|
||||
|
||||
if (model.DetailedLoadFilter)
|
||||
{
|
||||
gridDetail.GridView.OptionsView.ShowAutoFilterRow = true;
|
||||
}
|
||||
if (!dataCaches.GetValue(gridDetail, "BaseGridRowColors", out DataTable dtBaseGridRowColors))
|
||||
{
|
||||
dtBaseGridRowColors = BaseModuleImpl.GetBaseGridRowColors("SOURCEDETAIL_" + model.FormKey);
|
||||
}
|
||||
if (!dataCaches.GetValue(gridDetail, "BaseGridRightMenus", out DataTable dtBaseGridRightMenus))
|
||||
{
|
||||
dtBaseGridRightMenus = BaseModuleImpl.GetBaseGridRightMenus("BILLSOURCEDT_" + model.FormKey);
|
||||
}
|
||||
gridDetail.SetGridRowColors(dtBaseGridRowColors);
|
||||
gridDetail.SetGridRightMenus(dtBaseGridRightMenus, this.SysModel, OnGridDetailRightMenuCallback);
|
||||
if (BillModel.IsBillDetailCheck == 0)
|
||||
{
|
||||
if (model.MainDetailsAddType != "2") gridDetail.GridView.DoubleClick += new EventHandler(OnGridDetailDoubleClick);
|
||||
}
|
||||
//明细的明细(明细分成左右2个)
|
||||
if (!string.IsNullOrEmpty(model.SourceDetailsDetailsSql))
|
||||
{
|
||||
GridControlEx gridDetail_Details = sourceDetailDetailControl != null ? (GridControlEx)sourceDetailDetailControl : new GridControlEx();
|
||||
gridDetail_Details.Model = this.SysModel;
|
||||
gridDetail_Details.Dock = DockStyle.Fill;
|
||||
//创建只读列
|
||||
if (!dataCaches.GetValue(gridDetail_Details, "Detail_Details", out DataTable dataTable))
|
||||
{
|
||||
dataTable = BaseModuleImpl.getDetail_Details(model.FormKey);
|
||||
}
|
||||
gridDetail_Details.SetReadOnlyColumns(dataTable);
|
||||
//设置右键
|
||||
if (!dataCaches.GetValue(gridDetail_Details, "BaseGridRightMenus", out DataTable dttBaseGridRightMenus))
|
||||
{
|
||||
dttBaseGridRightMenus = BaseModuleImpl.GetBaseGridRightMenus("BILLSOURCEDTX_" + model.FormKey);
|
||||
}
|
||||
gridDetail_Details.SetGridRightMenus(dttBaseGridRightMenus, this.SysModel, OnGridDetailRightMenuCallback);
|
||||
//明细点击 更新 明细的明细
|
||||
gridDetail.GridView.FocusedRowObjectChanged += GridView_FocusedRowObjectChanged;
|
||||
gridDetail.GridView.Tag = model.SourceDetailsDetailsSql;
|
||||
//创建SplitContainerControl控件,让下方可以左右拖动
|
||||
SplitContainerControl splitContainerControl = new DevExpress.XtraEditors.SplitContainerControl();
|
||||
splitContainerControl.Dock = DockStyle.Fill;
|
||||
splitContainerControl.Panel1.Controls.Add(gridDetail);
|
||||
gridDetail.BorderStyle = System.Windows.Forms.BorderStyle.None;
|
||||
splitContainerControl.Panel2.Controls.Add(gridDetail_Details);
|
||||
gridDetail_Details.BorderStyle = System.Windows.Forms.BorderStyle.None;
|
||||
|
||||
splitContainerControl.SplitterMoved += new System.EventHandler(this.OnDetailsSplitterMoved);
|
||||
string newwidth = IniHelper.Read(string.Format("bill_Details_Width_{0}", this.SysModel.ModuleCode));//通过Key获取Value值
|
||||
if (!string.IsNullOrEmpty(newwidth))
|
||||
{
|
||||
splitContainerControl.SplitterPosition = Convert.ToInt32(newwidth);
|
||||
}
|
||||
else
|
||||
{
|
||||
int width = this.tb_buttom.Width;//获取控件宽度
|
||||
splitContainerControl.SplitterPosition = width / 2;//然后将分割位置设置在宽度一半位置
|
||||
}
|
||||
if (model.MainDetailsAddType != "1")
|
||||
{
|
||||
//明细的明细拖拽到上方
|
||||
if (this.BillModel.DetailTreeTable)
|
||||
{
|
||||
GridDragTreeGrid dragDetaigDetailGrid = new GridDragTreeGrid(gridDetail_Details.GridView, (this.gcMain as TreeGridControlEx).TreeListObj);
|
||||
dragDetaigDetailGrid.CanDragParentNode = true;
|
||||
dragDetaigDetailGrid.NeglectingNodes = true;
|
||||
dragDetaigDetailGrid.OnDragComplete += DragDetailGrid_OnDragComplete;
|
||||
}
|
||||
else
|
||||
{
|
||||
GridDragGrid dragDetaigDetailGrid = new GridDragGrid(gridDetail_Details.GridView, this.gcMain.GridView);
|
||||
dragDetaigDetailGrid.OnDragComplete += new GridFragGridCompleteEventHandler(OnDragDetailGridCompleted);
|
||||
}
|
||||
|
||||
if (BillModel.IsBillDetailCheck == 0)
|
||||
{
|
||||
//明细的明细双击加载到上方
|
||||
gridDetail_Details.GridView.DoubleClick += new EventHandler(OnGridDetailDetailDoubleClick);
|
||||
}
|
||||
}
|
||||
|
||||
splitContainerControl.Parent = tabDetail;
|
||||
unionModel.GridDetailDetailControlObj = gridDetail_Details;
|
||||
}
|
||||
else
|
||||
{
|
||||
gridDetail.Parent = tabDetail;
|
||||
gridDetail.BorderStyle = System.Windows.Forms.BorderStyle.None;
|
||||
|
||||
}
|
||||
|
||||
if (i == 0)
|
||||
{
|
||||
this.tb_buttom.TabControlObj.TabPages.Insert(0, tabDetail);
|
||||
this.tb_buttom.TabControlObj.SelectedTabPageIndex = 0;
|
||||
if (attachModels.Count > 0)
|
||||
this.tb_buttom.TabControlObj.TabPages[0].Text = model.UserName + DetailedSuffix;
|
||||
}
|
||||
|
||||
if (model.MainDetailsAddType != "2")
|
||||
{
|
||||
if (this.BillModel.DetailTreeTable)
|
||||
{
|
||||
GridDragTreeGrid dragDetailGrid = new GridDragTreeGrid(gridDetail.GridView, (this.gcMain as TreeGridControlEx).TreeListObj);
|
||||
dragDetailGrid.CanDragParentNode = true;
|
||||
dragDetailGrid.NeglectingNodes = true;
|
||||
dragDetailGrid.OnDragComplete += DragDetailGrid_OnDragComplete;
|
||||
|
||||
unionModel.AddDataSql = model.AddDataSql;
|
||||
unionModel.AddDataCondition = model.AddDataCondition;
|
||||
}
|
||||
else
|
||||
{
|
||||
GridDragGrid dragDetailGrid = new GridDragGrid(gridDetail.GridView, this.gcMain.GridView);
|
||||
dragDetailGrid.OnDragComplete += new GridFragGridCompleteEventHandler(OnDragDetailGridCompleted);
|
||||
if (this.BillModel.IsSelectSourceColor) gridDetail.GridView.CustomDrawCell += GridView_CustomDrawCell;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
if (BillModel.IsBillDetailCheck == 1)//加载复选框
|
||||
{
|
||||
GridDragGrid.GridAddCheckBox(gridDetail.GridView);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#endregion
|
||||
|
||||
#region 加载来源条件
|
||||
@@ -2315,6 +2405,7 @@ namespace Lskj.PubBill
|
||||
#endregion
|
||||
|
||||
unionModel.GridControlObj = gridControl;
|
||||
|
||||
if (model.sourceDetailType.Equals("1"))
|
||||
{
|
||||
unionModel.TreeGridDetailControlObj = (gridDetail as TreeGridControlEx);
|
||||
@@ -3855,6 +3946,11 @@ namespace Lskj.PubBill
|
||||
this.ClearHighlightRows(unionModel.GridDetailControlObj.GridView);
|
||||
}
|
||||
|
||||
if (unionModel.GridDetailModuleGridEx != null)
|
||||
{
|
||||
unionModel.GridDetailModuleGridEx.GridControlObj.LastSearchSql = DetailSql;
|
||||
}
|
||||
|
||||
|
||||
DataTable table = null;
|
||||
if (unionModel.ModelObj.sourceDetailType == "1")
|
||||
@@ -4764,7 +4860,18 @@ namespace Lskj.PubBill
|
||||
}
|
||||
else
|
||||
{
|
||||
this.AddRowsToGridView(table, unionModel);
|
||||
|
||||
if (!this.BillModel.IsFastDragAddDetail)
|
||||
{
|
||||
this.AddRowsToGridView(table, unionModel);
|
||||
}
|
||||
else
|
||||
{
|
||||
// 全部行转数组
|
||||
DataRow[] dragRows = table.Select();
|
||||
this.AddRowsToGridViewFast(dragRows);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -5860,6 +5967,11 @@ namespace Lskj.PubBill
|
||||
if (unionModel.SearchObj != null) sqlValue = unionModel.SearchObj.ReplaceControlValue(sqlValue);
|
||||
sqlValue = ReplaceHelper.ReplaceParamToValue(sqlValue, e.Node.Name);
|
||||
|
||||
if (unionModel.GridDetailModuleGridEx != null)
|
||||
{
|
||||
unionModel.GridDetailModuleGridEx.GridControlObj.LastSearchSql = sqlValue;
|
||||
}
|
||||
|
||||
if (unionModel.ModelObj.sourceDetailType == "1" && unionModel.TreeGridDetailControlObj.TreeListObj != null)
|
||||
{
|
||||
unionModel.TreeGridDetailControlObj.TreeListObj.DataSource = BillImpl.GetDataTableResult(sqlValue);
|
||||
@@ -5904,7 +6016,11 @@ namespace Lskj.PubBill
|
||||
{
|
||||
this.RefreshSelectedSource();
|
||||
this.tb_buttom.TabControlObj.TabPages[0].Controls.Clear();
|
||||
if (unionModel.GridDetailDetailControlObj == null)
|
||||
if (unionModel.GridDetailModuleGridEx != null)
|
||||
{
|
||||
this.tb_buttom.TabControlObj.TabPages[0].Controls.Add(unionModel.GridDetailModuleGridEx);
|
||||
}
|
||||
else if (unionModel.GridDetailDetailControlObj == null)
|
||||
{
|
||||
this.tb_buttom.TabControlObj.TabPages[0].Controls.Add(unionModel.GridDetailControlObj != null ? unionModel.GridDetailControlObj : unionModel.TreeGridDetailControlObj);
|
||||
}
|
||||
@@ -10066,5 +10182,75 @@ namespace Lskj.PubBill
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 设置横向界面
|
||||
/// </summary>
|
||||
public void HorizontalInterface()
|
||||
{
|
||||
//底部main 左侧是来源和来源明细 右侧是主表数据
|
||||
SplitContainerControl MainSplitContainerControl = new SplitContainerControl();
|
||||
MainSplitContainerControl.Dock = DockStyle.Fill;
|
||||
|
||||
//左侧控件 左侧是来源 右侧是来源明细
|
||||
SplitContainerControl LeftSplitContainerControl = new SplitContainerControl();
|
||||
LeftSplitContainerControl.Dock = DockStyle.Fill;
|
||||
|
||||
xtc_left_container.HeaderLocation = TabHeaderLocation.Top;
|
||||
tb_buttom.TabControlObj.HeaderLocation = TabHeaderLocation.Top;
|
||||
|
||||
LeftSplitContainerControl.Panel1.Controls.Add(this.xtc_left_container);
|
||||
LeftSplitContainerControl.Panel2.Controls.Add(this.tb_buttom);
|
||||
|
||||
MainSplitContainerControl.Panel1.Controls.Add(LeftSplitContainerControl);
|
||||
MainSplitContainerControl.Panel2.Controls.Add(this.pl_main);
|
||||
|
||||
this.Controls.Remove(this.ssc_main);
|
||||
this.Controls.Add(MainSplitContainerControl);
|
||||
|
||||
string MainWidth = IniHelper.Read(string.Format("bill_SpecialMain_Width_{0}", this.SysModel.ModuleCode));
|
||||
MainWidth = string.IsNullOrWhiteSpace(MainWidth) ? (MainSplitContainerControl.ClientSize.Width / 2) + "" : MainWidth;
|
||||
MainSplitContainerControl.SplitterPosition = Convert.ToInt32(MainWidth);
|
||||
|
||||
string LeftWidth = IniHelper.Read(string.Format("bill_SpecialLeft_Width_{0}", this.SysModel.ModuleCode));
|
||||
LeftWidth = string.IsNullOrWhiteSpace(LeftWidth) ? (LeftSplitContainerControl.ClientSize.Width / 2) + "" : LeftWidth;
|
||||
LeftSplitContainerControl.SplitterPosition = Convert.ToInt32(LeftWidth);
|
||||
|
||||
MainSplitContainerControl.SplitterMoved += new System.EventHandler(OnSpecialMainSplitterMoved);
|
||||
LeftSplitContainerControl.SplitterMoved += new System.EventHandler(OnSpecialLeftSplitterMoved);
|
||||
|
||||
MainSplitContainerControl.BringToFront();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 分割条移动
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
private void OnSpecialMainSplitterMoved(object sender, EventArgs e)
|
||||
{
|
||||
if (this._isInitFinish)
|
||||
{
|
||||
SplitContainerControl splitContainerControl = sender as SplitContainerControl;
|
||||
IniHelper.Write(string.Format("bill_SpecialMain_Width_{0}", this.SysModel.ModuleCode), splitContainerControl.SplitterPosition + "");
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 分割条移动
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
private void OnSpecialLeftSplitterMoved(object sender, EventArgs e)
|
||||
{
|
||||
if (this._isInitFinish)
|
||||
{
|
||||
SplitContainerControl splitContainerControl = sender as SplitContainerControl;
|
||||
IniHelper.Write(string.Format("bill_SpecialLeft_Width_{0}", this.SysModel.ModuleCode), splitContainerControl.SplitterPosition + "");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -61,6 +61,10 @@ namespace Lskj.PubBill.Model
|
||||
|
||||
public string Orderid;// 来源页签序号
|
||||
|
||||
public string DetailMenuCode;// 来源模块号
|
||||
|
||||
|
||||
|
||||
public BillSourceModel(DataRow item)
|
||||
{
|
||||
if (item == null) return;
|
||||
@@ -106,6 +110,7 @@ namespace Lskj.PubBill.Model
|
||||
this.DragAndSave = item.Table.Columns.Contains("DragAndSave") && "1".Equals(item["DragAndSave"] + "") ? true : false;
|
||||
this.TreeInhibitSort = item.Table.Columns.Contains("TreeInhibitSort") && "1".Equals(item["TreeInhibitSort"] + "") ? true : false;
|
||||
this.Orderid = item.Table.Columns.Contains("Orderid") ? item["Orderid"] + "" : "";
|
||||
this.DetailMenuCode = item.Table.Columns.Contains("DetailMenuCode") ? item["DetailMenuCode"] + "" : "";
|
||||
}
|
||||
/// <summary>
|
||||
/// 改变来源类型
|
||||
@@ -115,5 +120,14 @@ namespace Lskj.PubBill.Model
|
||||
{
|
||||
this.SourceType = sourceType;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 改变来源明细类型
|
||||
/// </summary>
|
||||
/// <param name="sourceType"></param>
|
||||
public void ChangeSourceDetailType(string sourceDetailType)
|
||||
{
|
||||
this.sourceDetailType = sourceDetailType;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -54,6 +54,10 @@ namespace Lskj.PubBill.Model
|
||||
/// 单据来源明细表格的明细
|
||||
/// </summary>
|
||||
public GridControlEx GridDetailDetailControlObj;
|
||||
/// <summary>
|
||||
/// 单据来源明细模块
|
||||
/// </summary>
|
||||
public ModuleGridEx GridDetailModuleGridEx;
|
||||
|
||||
|
||||
public bool IsChange = false;
|
||||
|
||||
@@ -0,0 +1,110 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Windows.Forms;
|
||||
using Lskj.Control;
|
||||
|
||||
namespace Lskj.PubCodeDesign
|
||||
{
|
||||
internal class CodeDesignModuleGridEx : ModuleGridEx
|
||||
{
|
||||
protected override void OnCreateControl()
|
||||
{
|
||||
base.OnCreateControl();
|
||||
HideTopToolPanel();
|
||||
}
|
||||
|
||||
public void HideTopToolPanel()
|
||||
{
|
||||
CollapseChildControl(this, "pl_top");
|
||||
HideChildControl(this, "pl_top_right");
|
||||
HideChildControl(this, "ddbOper");
|
||||
HideChildControl(this, "ddbPrint");
|
||||
HideChildControl(this, "btnRefresh");
|
||||
}
|
||||
|
||||
public void AddNewLogic()
|
||||
{
|
||||
this.ExternallyTriggeredAdd();
|
||||
}
|
||||
|
||||
public void EnsureHiddenSaveColumns(IEnumerable<string> fieldNames)
|
||||
{
|
||||
DataTable gridColumns = GetGridColumns();
|
||||
if (gridColumns == null || fieldNames == null) return;
|
||||
|
||||
foreach (string fieldName in fieldNames.Where(n => !string.IsNullOrWhiteSpace(n)))
|
||||
{
|
||||
EnsureHiddenGridColumn(gridColumns, fieldName);
|
||||
}
|
||||
}
|
||||
|
||||
private DataTable GetGridColumns()
|
||||
{
|
||||
FieldInfo field = typeof(ModuleGridEx).GetField("_gridColumns", BindingFlags.Instance | BindingFlags.NonPublic);
|
||||
return field == null ? null : field.GetValue(this) as DataTable;
|
||||
}
|
||||
|
||||
private static void EnsureHiddenGridColumn(DataTable gridColumns, string fieldName)
|
||||
{
|
||||
if (gridColumns.Rows.Cast<DataRow>().Any(n => string.Equals(n["fieldname"] + "", fieldName, StringComparison.OrdinalIgnoreCase)))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
DataRow row = gridColumns.NewRow();
|
||||
SetColumnValue(row, "fieldname", fieldName);
|
||||
SetColumnValue(row, "username", fieldName);
|
||||
SetColumnValue(row, "sysname", fieldName);
|
||||
SetColumnValue(row, "width", 0);
|
||||
SetColumnValue(row, "visible", 0);
|
||||
SetColumnValue(row, "fieldtype", 1);
|
||||
SetColumnValue(row, "fieldTypeId", 1);
|
||||
SetColumnValue(row, "nullable", 1);
|
||||
SetColumnValue(row, "edited", 1);
|
||||
SetColumnValue(row, "sortid", 9999);
|
||||
gridColumns.Rows.Add(row);
|
||||
}
|
||||
|
||||
private static void SetColumnValue(DataRow row, string columnName, object value)
|
||||
{
|
||||
if (row == null || row.Table == null || !row.Table.Columns.Contains(columnName)) return;
|
||||
row[columnName] = value ?? DBNull.Value;
|
||||
}
|
||||
|
||||
private static void CollapseChildControl(System.Windows.Forms.Control parent, string controlName)
|
||||
{
|
||||
if (parent == null || string.IsNullOrWhiteSpace(controlName)) return;
|
||||
|
||||
foreach (System.Windows.Forms.Control child in parent.Controls)
|
||||
{
|
||||
if (string.Equals(child.Name, controlName, StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
child.Visible = false;
|
||||
child.Height = 0;
|
||||
child.Margin = Padding.Empty;
|
||||
}
|
||||
|
||||
CollapseChildControl(child, controlName);
|
||||
}
|
||||
}
|
||||
|
||||
private static void HideChildControl(System.Windows.Forms.Control parent, string controlName)
|
||||
{
|
||||
if (parent == null || string.IsNullOrWhiteSpace(controlName)) return;
|
||||
|
||||
foreach (System.Windows.Forms.Control child in parent.Controls)
|
||||
{
|
||||
if (string.Equals(child.Name, controlName, StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
child.Visible = false;
|
||||
}
|
||||
|
||||
HideChildControl(child, controlName);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,74 @@
|
||||
using System;
|
||||
using System.Data;
|
||||
|
||||
namespace Lskj.PubCodeDesign
|
||||
{
|
||||
internal sealed class TreeNodeData
|
||||
{
|
||||
public string NodeType;
|
||||
public string MenuKey;
|
||||
public int MenuLevel;
|
||||
public DataRow MenuRow;
|
||||
public string MenuCaption;
|
||||
public string ModuleCode;
|
||||
public int SchemeId;
|
||||
public string SchemeCode;
|
||||
public string SchemeName;
|
||||
public bool BindModule;
|
||||
public string BindSubSysId;
|
||||
public string BindMenuStruct1;
|
||||
public string BindMenuStruct2;
|
||||
public string BindMenuId;
|
||||
public string BindModuleCode;
|
||||
}
|
||||
|
||||
internal sealed class MenuComboItem
|
||||
{
|
||||
public string Text;
|
||||
public string SubSysId;
|
||||
public string MenuStruct;
|
||||
public string MenuId;
|
||||
public string ModuleCode;
|
||||
public DataRow Row;
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return string.IsNullOrWhiteSpace(this.Text) ? base.ToString() : this.Text;
|
||||
}
|
||||
}
|
||||
|
||||
internal sealed class FieldDesignItem
|
||||
{
|
||||
public string UserName;
|
||||
public string FieldName;
|
||||
public string RuntimeFieldName;
|
||||
public int FieldTypeId;
|
||||
public int ControlWidth;
|
||||
public int ControlHeight;
|
||||
|
||||
public FieldDesignItem Clone()
|
||||
{
|
||||
return new FieldDesignItem
|
||||
{
|
||||
UserName = this.UserName,
|
||||
FieldName = this.FieldName,
|
||||
RuntimeFieldName = this.RuntimeFieldName,
|
||||
FieldTypeId = this.FieldTypeId,
|
||||
ControlWidth = this.ControlWidth,
|
||||
ControlHeight = this.ControlHeight
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
internal sealed class TableColumnSpec
|
||||
{
|
||||
public TableColumnSpec(string name, string definition)
|
||||
{
|
||||
this.Name = name;
|
||||
this.Definition = definition;
|
||||
}
|
||||
|
||||
public string Name;
|
||||
public string Definition;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,886 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data;
|
||||
using System.Data.SqlClient;
|
||||
using System.Linq;
|
||||
using Lskj.Business;
|
||||
using Lskj.Business.Impl;
|
||||
using Lskj.Control;
|
||||
using Lskj.Core;
|
||||
using Lskj.Util;
|
||||
|
||||
namespace Lskj.PubCodeDesign
|
||||
{
|
||||
internal static class CodeSchemeStorage
|
||||
{
|
||||
private const string SchemeTableName = "P_CodeSchemeTab";
|
||||
private const string SchemeControlTableName = "P_CodeSchemeControlTab";
|
||||
private const string CodeRecordTableName = "P_CodeSchemeRecordTab";
|
||||
private const string CodeGenerateProcedureName = "P_create_CodeSchemeDocumentPr";
|
||||
private const string NumberRuleTableName = "p_systemNumberRuleTab";
|
||||
private const string DesignRuleUseColumn = "UseEd";
|
||||
private const string DesignRuleSortColumn = "SortNo";
|
||||
private const string DesignRuleFieldNameColumn = "FieldName";
|
||||
private const string NumberRuleSchemeIdColumn = "SchemeId";
|
||||
private const string NumberRuleSchemeCodeColumn = "SchemeCode";
|
||||
private const string NumberRuleSchemeNameColumn = "SchemeName";
|
||||
private const string NumberRuleMenuKeyColumn = "MenuKey";
|
||||
private const string NumberRuleBindModuleColumn = "BindModule";
|
||||
private const string NumberRuleBindModuleCodeColumn = "BindModuleCode";
|
||||
private const string NumberRuleModIdColumn = "modid";
|
||||
|
||||
internal static void EnsureCodeSchemeStorage()
|
||||
{
|
||||
try
|
||||
{
|
||||
EnsureTable(SchemeTableName, GetCreateSchemeTableSql(), GetSchemeTableColumns());
|
||||
EnsureTable(SchemeControlTableName, GetCreateSchemeControlTableSql(), GetSchemeControlTableColumns());
|
||||
EnsureCodeRecordStorage();
|
||||
DropIndexIfExists(SchemeControlTableName, "UX_CodeSchemeControl_Field");
|
||||
DropIndexIfExists(SchemeControlTableName, "IX_CodeSchemeControl_Source");
|
||||
DropIndexIfExists(SchemeTableName, "IX_CodeScheme_Menu");
|
||||
DeleteDisabledCodeSchemes();
|
||||
DropColumnIfExists(SchemeTableName, DesignRuleUseColumn);
|
||||
RemoveLegacySchemeControlColumns();
|
||||
EnsureIndex("UX_CodeScheme_Code", "CREATE UNIQUE INDEX UX_CodeScheme_Code ON P_CodeSchemeTab(SchemeCode)");
|
||||
EnsureIndex("IX_CodeScheme_Menu", "CREATE INDEX IX_CodeScheme_Menu ON P_CodeSchemeTab(MenuKey)");
|
||||
EnsureRuleStorage();
|
||||
EnsureCodeGenerateProcedure();
|
||||
EnsureIndexIfColumnsExist(SchemeControlTableName, new string[] { NumberRuleSchemeIdColumn, DesignRuleSortColumn }, "IX_CodeSchemeControl_Scheme", "CREATE INDEX IX_CodeSchemeControl_Scheme ON P_CodeSchemeControlTab(SchemeId, SortNo)");
|
||||
EnsureIndexIfColumnsExist(SchemeControlTableName, new string[] { NumberRuleSchemeIdColumn, DesignRuleFieldNameColumn }, "IX_CodeSchemeControl_Field", "CREATE INDEX IX_CodeSchemeControl_Field ON P_CodeSchemeControlTab(SchemeId, FieldName)");
|
||||
EnsureConstraint("FK_CodeSchemeControl_Scheme", "ALTER TABLE P_CodeSchemeControlTab ADD CONSTRAINT FK_CodeSchemeControl_Scheme FOREIGN KEY (SchemeId) REFERENCES P_CodeSchemeTab(SchemeId)");
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
LogHelper.Instance.WriteError(ex);
|
||||
MessageUtil.Show("编码方案表结构初始化失败:" + ex.Message);
|
||||
}
|
||||
}
|
||||
|
||||
private static void EnsureTable(string tableName, string createSql, List<TableColumnSpec> columns)
|
||||
{
|
||||
if (!TableExists(tableName))
|
||||
{
|
||||
SqlHelper.ExecuteNonQuery(createSql);
|
||||
return;
|
||||
}
|
||||
|
||||
foreach (TableColumnSpec column in columns)
|
||||
{
|
||||
if (!ColumnExists(tableName, column.Name))
|
||||
{
|
||||
SqlHelper.ExecuteNonQuery(string.Format("ALTER TABLE {0} ADD {1} {2}", tableName, column.Name, column.Definition));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static void RemoveLegacySchemeControlColumns()
|
||||
{
|
||||
string[] legacyColumns =
|
||||
{
|
||||
"ControlType",
|
||||
"FieldTypeId",
|
||||
"ModuleCode",
|
||||
"SourceType",
|
||||
"SourceIndex",
|
||||
"LabelText",
|
||||
"UserName",
|
||||
"ControlConfig",
|
||||
"SchemeControlId",
|
||||
"ControlWidth",
|
||||
"ControlHeight",
|
||||
DesignRuleUseColumn
|
||||
};
|
||||
|
||||
foreach (string columnName in legacyColumns)
|
||||
{
|
||||
DropColumnIfExists(SchemeControlTableName, columnName);
|
||||
}
|
||||
}
|
||||
|
||||
private static void DeleteDisabledCodeSchemes()
|
||||
{
|
||||
if (!TableExists(SchemeTableName) || !ColumnExists(SchemeTableName, DesignRuleUseColumn)) return;
|
||||
|
||||
string sql = "SELECT SchemeId, BindModule, BindModuleCode FROM P_CodeSchemeTab WHERE ISNULL(UseEd, 1) = 0";
|
||||
DataTable table = SqlHelper.ExecuteDataTable(sql);
|
||||
if (table == null || table.Rows.Count == 0) return;
|
||||
|
||||
foreach (DataRow row in table.Rows)
|
||||
{
|
||||
int schemeId = ToInt(row["SchemeId"]);
|
||||
string bindModuleCode = ToBool(row["BindModule"]) ? row["BindModuleCode"] + "" : string.Empty;
|
||||
|
||||
DeleteRuleRows(SchemeControlTableName, schemeId);
|
||||
if (!string.IsNullOrWhiteSpace(bindModuleCode) && !BindModuleOwnedByEnabledScheme(bindModuleCode))
|
||||
{
|
||||
DeleteBindModuleNumberRuleRows(bindModuleCode);
|
||||
}
|
||||
|
||||
string deleteSql = "DELETE FROM P_CodeSchemeTab WHERE SchemeId = @SchemeId";
|
||||
SqlHelper.ExecuteNonQuery(CommandType.Text, deleteSql, new SqlParameter[] { new SqlParameter("@SchemeId", schemeId) });
|
||||
}
|
||||
}
|
||||
|
||||
private static bool BindModuleOwnedByEnabledScheme(string bindModuleCode)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(bindModuleCode) || !TableExists(SchemeTableName) || !ColumnExists(SchemeTableName, DesignRuleUseColumn)) return false;
|
||||
|
||||
string sql = @"
|
||||
SELECT COUNT(1)
|
||||
FROM P_CodeSchemeTab
|
||||
WHERE ISNULL(UseEd, 1) = 1
|
||||
AND ISNULL(BindModule, 0) = 1
|
||||
AND ISNULL(BindModuleCode, '') = @BindModuleCode";
|
||||
object result = SqlHelper.ExecuteScalar(CommandType.Text, sql, new SqlParameter[] { new SqlParameter("@BindModuleCode", bindModuleCode) });
|
||||
return ToInt(result) > 0;
|
||||
}
|
||||
|
||||
private static void DeleteRuleRows(string tableName, int schemeId)
|
||||
{
|
||||
if (schemeId <= 0 || string.IsNullOrWhiteSpace(tableName) || !TableExists(tableName) || !ColumnExists(tableName, NumberRuleSchemeIdColumn)) return;
|
||||
|
||||
string sql = string.Format("DELETE FROM {0} WHERE {1} = @SchemeId", QuoteSqlIdentifier(tableName), QuoteSqlIdentifier(NumberRuleSchemeIdColumn));
|
||||
SqlHelper.ExecuteNonQuery(CommandType.Text, sql, new SqlParameter[] { new SqlParameter("@SchemeId", schemeId) });
|
||||
}
|
||||
|
||||
private static void DeleteBindModuleNumberRuleRows(string bindModuleCode)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(bindModuleCode) || !TableExists(NumberRuleTableName)) return;
|
||||
|
||||
List<string> moduleConditions = new List<string>();
|
||||
if (ColumnExists(NumberRuleTableName, NumberRuleModIdColumn))
|
||||
{
|
||||
moduleConditions.Add(string.Format("ISNULL(CONVERT(NVARCHAR(100), {0}), '') = @BindModuleCode", QuoteSqlIdentifier(NumberRuleModIdColumn)));
|
||||
}
|
||||
if (ColumnExists(NumberRuleTableName, NumberRuleBindModuleCodeColumn))
|
||||
{
|
||||
moduleConditions.Add(string.Format("ISNULL(CONVERT(NVARCHAR(100), {0}), '') = @BindModuleCode", QuoteSqlIdentifier(NumberRuleBindModuleCodeColumn)));
|
||||
}
|
||||
if (moduleConditions.Count == 0) return;
|
||||
|
||||
string sql = string.Format("DELETE FROM {0} WHERE ({1})", QuoteSqlIdentifier(NumberRuleTableName), string.Join(" OR ", moduleConditions.ToArray()));
|
||||
SqlHelper.ExecuteNonQuery(CommandType.Text, sql, new SqlParameter[] { new SqlParameter("@BindModuleCode", bindModuleCode) });
|
||||
}
|
||||
|
||||
internal static bool TableExists(string tableName)
|
||||
{
|
||||
string sql = "SELECT COUNT(1) FROM sysobjects WHERE id = OBJECT_ID(@TableName) AND xtype = 'U'";
|
||||
object result = SqlHelper.ExecuteScalar(CommandType.Text, sql, new SqlParameter[] { new SqlParameter("@TableName", tableName) });
|
||||
return Convert.ToInt32(result) > 0;
|
||||
}
|
||||
|
||||
internal static bool ColumnExists(string tableName, string columnName)
|
||||
{
|
||||
string sql = "SELECT COUNT(1) FROM sys.columns WHERE object_id = OBJECT_ID(@TableName) AND name = @ColumnName";
|
||||
object result = SqlHelper.ExecuteScalar(CommandType.Text, sql, new SqlParameter[]
|
||||
{
|
||||
new SqlParameter("@TableName", tableName),
|
||||
new SqlParameter("@ColumnName", columnName)
|
||||
});
|
||||
return Convert.ToInt32(result) > 0;
|
||||
}
|
||||
|
||||
private static void EnsureIndex(string indexName, string createSql)
|
||||
{
|
||||
try
|
||||
{
|
||||
string sql = "SELECT COUNT(1) FROM sys.indexes WHERE name = @IndexName";
|
||||
object result = SqlHelper.ExecuteScalar(CommandType.Text, sql, new SqlParameter[] { new SqlParameter("@IndexName", indexName) });
|
||||
if (Convert.ToInt32(result) == 0)
|
||||
{
|
||||
SqlHelper.ExecuteNonQuery(createSql);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
LogHelper.Instance.WriteError(ex);
|
||||
}
|
||||
}
|
||||
|
||||
internal static void EnsureIndexIfColumnsExist(string tableName, string[] columnNames, string indexName, string createSql)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(tableName) || columnNames == null) return;
|
||||
foreach (string columnName in columnNames)
|
||||
{
|
||||
if (!ColumnExists(tableName, columnName)) return;
|
||||
}
|
||||
|
||||
EnsureIndex(indexName, createSql);
|
||||
}
|
||||
|
||||
private static void EnsureConstraint(string constraintName, string createSql)
|
||||
{
|
||||
try
|
||||
{
|
||||
string sql = "SELECT COUNT(1) FROM sys.objects WHERE name = @ConstraintName";
|
||||
object result = SqlHelper.ExecuteScalar(CommandType.Text, sql, new SqlParameter[] { new SqlParameter("@ConstraintName", constraintName) });
|
||||
if (Convert.ToInt32(result) == 0)
|
||||
{
|
||||
SqlHelper.ExecuteNonQuery(createSql);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
LogHelper.Instance.WriteError(ex);
|
||||
}
|
||||
}
|
||||
|
||||
private static void DropIndexIfExists(string tableName, string indexName)
|
||||
{
|
||||
try
|
||||
{
|
||||
string sql = "SELECT COUNT(1) FROM sys.indexes WHERE object_id = OBJECT_ID(@TableName) AND name = @IndexName";
|
||||
object result = SqlHelper.ExecuteScalar(CommandType.Text, sql, new SqlParameter[]
|
||||
{
|
||||
new SqlParameter("@TableName", tableName),
|
||||
new SqlParameter("@IndexName", indexName)
|
||||
});
|
||||
if (Convert.ToInt32(result) == 0) return;
|
||||
|
||||
SqlHelper.ExecuteNonQuery(string.Format("DROP INDEX {0} ON {1}", QuoteSqlIdentifier(indexName), QuoteSqlIdentifier(tableName)));
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
LogHelper.Instance.WriteError(ex);
|
||||
}
|
||||
}
|
||||
|
||||
private static void DropColumnIfExists(string tableName, string columnName)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (!ColumnExists(tableName, columnName)) return;
|
||||
|
||||
DropColumnIndexes(tableName, columnName);
|
||||
DropColumnDefaultConstraints(tableName, columnName);
|
||||
SqlHelper.ExecuteNonQuery(string.Format("ALTER TABLE {0} DROP COLUMN {1}", QuoteSqlIdentifier(tableName), QuoteSqlIdentifier(columnName)));
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
LogHelper.Instance.WriteError(ex);
|
||||
}
|
||||
}
|
||||
|
||||
private static void DropColumnIndexes(string tableName, string columnName)
|
||||
{
|
||||
string sql = @"
|
||||
DECLARE @sql NVARCHAR(MAX) = N'';
|
||||
SELECT @sql = @sql +
|
||||
CASE
|
||||
WHEN i.is_primary_key = 1 OR i.is_unique_constraint = 1 THEN
|
||||
N'ALTER TABLE ' + QUOTENAME(OBJECT_SCHEMA_NAME(i.object_id)) + N'.' + QUOTENAME(OBJECT_NAME(i.object_id)) + N' DROP CONSTRAINT ' + QUOTENAME(i.name) + N';'
|
||||
ELSE
|
||||
N'DROP INDEX ' + QUOTENAME(i.name) + N' ON ' + QUOTENAME(OBJECT_SCHEMA_NAME(i.object_id)) + N'.' + QUOTENAME(OBJECT_NAME(i.object_id)) + N';'
|
||||
END
|
||||
FROM sys.indexes i
|
||||
INNER JOIN sys.index_columns ic ON i.object_id = ic.object_id AND i.index_id = ic.index_id
|
||||
INNER JOIN sys.columns c ON ic.object_id = c.object_id AND ic.column_id = c.column_id
|
||||
WHERE i.object_id = OBJECT_ID(@TableName)
|
||||
AND c.name = @ColumnName
|
||||
AND i.name IS NOT NULL;
|
||||
IF LEN(@sql) > 0
|
||||
BEGIN
|
||||
EXEC sp_executesql @sql;
|
||||
END";
|
||||
SqlHelper.ExecuteNonQuery(CommandType.Text, sql, new SqlParameter[]
|
||||
{
|
||||
new SqlParameter("@TableName", tableName),
|
||||
new SqlParameter("@ColumnName", columnName)
|
||||
});
|
||||
}
|
||||
|
||||
private static void DropColumnDefaultConstraints(string tableName, string columnName)
|
||||
{
|
||||
string sql = @"
|
||||
DECLARE @sql NVARCHAR(MAX) = N'';
|
||||
SELECT @sql = @sql + N'ALTER TABLE ' + QUOTENAME(OBJECT_SCHEMA_NAME(parent_object_id)) + N'.' + QUOTENAME(OBJECT_NAME(parent_object_id)) + N' DROP CONSTRAINT ' + QUOTENAME(name) + N';'
|
||||
FROM sys.default_constraints
|
||||
WHERE parent_object_id = OBJECT_ID(@TableName)
|
||||
AND parent_column_id = COLUMNPROPERTY(OBJECT_ID(@TableName), @ColumnName, 'ColumnId');
|
||||
IF LEN(@sql) > 0
|
||||
BEGIN
|
||||
EXEC sp_executesql @sql;
|
||||
END";
|
||||
SqlHelper.ExecuteNonQuery(CommandType.Text, sql, new SqlParameter[]
|
||||
{
|
||||
new SqlParameter("@TableName", tableName),
|
||||
new SqlParameter("@ColumnName", columnName)
|
||||
});
|
||||
}
|
||||
|
||||
internal static string QuoteSqlIdentifier(string name)
|
||||
{
|
||||
return "[" + (name ?? string.Empty).Replace("]", "]]") + "]";
|
||||
}
|
||||
|
||||
private static string GetCreateSchemeTableSql()
|
||||
{
|
||||
return @"CREATE TABLE P_CodeSchemeTab (
|
||||
SchemeId INT IDENTITY(1,1) NOT NULL PRIMARY KEY,
|
||||
SchemeCode VARCHAR(50) NOT NULL,
|
||||
SchemeName NVARCHAR(100) NOT NULL,
|
||||
MenuKey VARCHAR(200) NOT NULL,
|
||||
SubSysId VARCHAR(50) NULL,
|
||||
MenuId VARCHAR(50) NULL,
|
||||
MenuStruct VARCHAR(50) NULL,
|
||||
MenuCaption NVARCHAR(100) NULL,
|
||||
ModuleCode VARCHAR(100) NOT NULL,
|
||||
BindModule BIT NOT NULL DEFAULT(0),
|
||||
BindSubSysId VARCHAR(50) NULL,
|
||||
BindMenuStruct1 VARCHAR(50) NULL,
|
||||
BindMenuStruct2 VARCHAR(50) NULL,
|
||||
BindMenuId VARCHAR(50) NULL,
|
||||
BindModuleCode VARCHAR(100) NULL,
|
||||
IsDefault BIT NOT NULL DEFAULT(0),
|
||||
Remark NVARCHAR(500) NULL,
|
||||
CreateUserId VARCHAR(50) NULL,
|
||||
CreateUserName NVARCHAR(50) NULL,
|
||||
CreateTime DATETIME NOT NULL DEFAULT(GETDATE()),
|
||||
ModifyUserId VARCHAR(50) NULL,
|
||||
ModifyUserName NVARCHAR(50) NULL,
|
||||
ModifyTime DATETIME NULL
|
||||
)";
|
||||
}
|
||||
|
||||
private static string GetCreateSchemeControlTableSql()
|
||||
{
|
||||
return @"CREATE TABLE P_CodeSchemeControlTab (
|
||||
SchemeId INT NOT NULL DEFAULT(0),
|
||||
SchemeCode VARCHAR(50) NOT NULL DEFAULT(''),
|
||||
SchemeName NVARCHAR(100) NULL,
|
||||
MenuKey VARCHAR(200) NULL,
|
||||
BindModule BIT NOT NULL DEFAULT(0),
|
||||
BindModuleCode VARCHAR(100) NULL,
|
||||
modid VARCHAR(100) NULL
|
||||
)";
|
||||
}
|
||||
|
||||
private static List<TableColumnSpec> GetSchemeTableColumns()
|
||||
{
|
||||
return new List<TableColumnSpec>
|
||||
{
|
||||
new TableColumnSpec("SchemeId", "INT IDENTITY(1,1) NOT NULL"),
|
||||
new TableColumnSpec("SchemeCode", "VARCHAR(50) NOT NULL DEFAULT('')"),
|
||||
new TableColumnSpec("SchemeName", "NVARCHAR(100) NOT NULL DEFAULT('')"),
|
||||
new TableColumnSpec("MenuKey", "VARCHAR(200) NOT NULL DEFAULT('')"),
|
||||
new TableColumnSpec("SubSysId", "VARCHAR(50) NULL"),
|
||||
new TableColumnSpec("MenuId", "VARCHAR(50) NULL"),
|
||||
new TableColumnSpec("MenuStruct", "VARCHAR(50) NULL"),
|
||||
new TableColumnSpec("MenuCaption", "NVARCHAR(100) NULL"),
|
||||
new TableColumnSpec("ModuleCode", "VARCHAR(100) NOT NULL DEFAULT('')"),
|
||||
new TableColumnSpec("BindModule", "BIT NOT NULL DEFAULT(0)"),
|
||||
new TableColumnSpec("BindSubSysId", "VARCHAR(50) NULL"),
|
||||
new TableColumnSpec("BindMenuStruct1", "VARCHAR(50) NULL"),
|
||||
new TableColumnSpec("BindMenuStruct2", "VARCHAR(50) NULL"),
|
||||
new TableColumnSpec("BindMenuId", "VARCHAR(50) NULL"),
|
||||
new TableColumnSpec("BindModuleCode", "VARCHAR(100) NULL"),
|
||||
new TableColumnSpec("IsDefault", "BIT NOT NULL DEFAULT(0)"),
|
||||
new TableColumnSpec("Remark", "NVARCHAR(500) NULL"),
|
||||
new TableColumnSpec("CreateUserId", "VARCHAR(50) NULL"),
|
||||
new TableColumnSpec("CreateUserName", "NVARCHAR(50) NULL"),
|
||||
new TableColumnSpec("CreateTime", "DATETIME NOT NULL DEFAULT(GETDATE())"),
|
||||
new TableColumnSpec("ModifyUserId", "VARCHAR(50) NULL"),
|
||||
new TableColumnSpec("ModifyUserName", "NVARCHAR(50) NULL"),
|
||||
new TableColumnSpec("ModifyTime", "DATETIME NULL")
|
||||
};
|
||||
}
|
||||
|
||||
private static List<TableColumnSpec> GetSchemeControlTableColumns()
|
||||
{
|
||||
return new List<TableColumnSpec>
|
||||
{
|
||||
new TableColumnSpec("SchemeId", "INT NOT NULL DEFAULT(0)"),
|
||||
new TableColumnSpec("SchemeCode", "VARCHAR(50) NOT NULL DEFAULT('')"),
|
||||
new TableColumnSpec("SchemeName", "NVARCHAR(100) NULL"),
|
||||
new TableColumnSpec("MenuKey", "VARCHAR(200) NULL"),
|
||||
new TableColumnSpec("BindModule", "BIT NOT NULL DEFAULT(0)"),
|
||||
new TableColumnSpec("BindModuleCode", "VARCHAR(100) NULL"),
|
||||
new TableColumnSpec("modid", "VARCHAR(100) NULL")
|
||||
};
|
||||
}
|
||||
|
||||
private static string GetCreateCodeRecordTableSql()
|
||||
{
|
||||
return @"CREATE TABLE P_CodeSchemeRecordTab (
|
||||
RecordId INT IDENTITY(1,1) NOT NULL PRIMARY KEY,
|
||||
SchemeId INT NOT NULL DEFAULT(0),
|
||||
SchemeCode VARCHAR(50) NOT NULL DEFAULT(''),
|
||||
SchemeName NVARCHAR(100) NULL,
|
||||
MenuKey VARCHAR(200) NULL,
|
||||
SequenceKey NVARCHAR(300) NOT NULL DEFAULT(''),
|
||||
SerialNo INT NOT NULL DEFAULT(0),
|
||||
CodeValue NVARCHAR(300) NOT NULL,
|
||||
RuleText NVARCHAR(MAX) NULL,
|
||||
CreateUserId VARCHAR(50) NULL,
|
||||
CreateUserName NVARCHAR(50) NULL,
|
||||
CreateTime DATETIME NOT NULL DEFAULT(GETDATE())
|
||||
)";
|
||||
}
|
||||
|
||||
private static List<TableColumnSpec> GetCodeRecordTableColumns()
|
||||
{
|
||||
return new List<TableColumnSpec>
|
||||
{
|
||||
new TableColumnSpec("RecordId", "INT IDENTITY(1,1) NOT NULL"),
|
||||
new TableColumnSpec("SchemeId", "INT NOT NULL DEFAULT(0)"),
|
||||
new TableColumnSpec("SchemeCode", "VARCHAR(50) NOT NULL DEFAULT('')"),
|
||||
new TableColumnSpec("SchemeName", "NVARCHAR(100) NULL"),
|
||||
new TableColumnSpec("MenuKey", "VARCHAR(200) NULL"),
|
||||
new TableColumnSpec("SequenceKey", "NVARCHAR(300) NOT NULL DEFAULT('')"),
|
||||
new TableColumnSpec("SerialNo", "INT NOT NULL DEFAULT(0)"),
|
||||
new TableColumnSpec("CodeValue", "NVARCHAR(300) NOT NULL DEFAULT('')"),
|
||||
new TableColumnSpec("RuleText", "NVARCHAR(MAX) NULL"),
|
||||
new TableColumnSpec("CreateUserId", "VARCHAR(50) NULL"),
|
||||
new TableColumnSpec("CreateUserName", "NVARCHAR(50) NULL"),
|
||||
new TableColumnSpec("CreateTime", "DATETIME NOT NULL DEFAULT(GETDATE())")
|
||||
};
|
||||
}
|
||||
|
||||
internal static void EnsureCodeRecordStorage()
|
||||
{
|
||||
EnsureTable(CodeRecordTableName, GetCreateCodeRecordTableSql(), GetCodeRecordTableColumns());
|
||||
EnsureIndexIfColumnsExist(CodeRecordTableName, new string[] { "SchemeId", "CodeValue" }, "UX_CodeSchemeRecord_Code", "CREATE UNIQUE INDEX UX_CodeSchemeRecord_Code ON P_CodeSchemeRecordTab(SchemeId, CodeValue)");
|
||||
EnsureIndexIfColumnsExist(CodeRecordTableName, new string[] { "SchemeId", "SequenceKey", "SerialNo" }, "IX_CodeSchemeRecord_Sequence", "CREATE INDEX IX_CodeSchemeRecord_Sequence ON P_CodeSchemeRecordTab(SchemeId, SequenceKey, SerialNo)");
|
||||
}
|
||||
|
||||
internal static void EnsureCodeGenerateProcedure()
|
||||
{
|
||||
string createSql = string.Format(@"
|
||||
IF OBJECT_ID(N'dbo.{0}', N'P') IS NULL
|
||||
BEGIN
|
||||
EXEC(N'CREATE PROCEDURE dbo.{0} AS BEGIN SET NOCOUNT ON; END')
|
||||
END", CodeGenerateProcedureName);
|
||||
SqlHelper.ExecuteNonQuery(CommandType.Text, createSql);
|
||||
SqlHelper.ExecuteNonQuery(CommandType.Text, GetAlterCodeGenerateProcedureSql());
|
||||
}
|
||||
|
||||
private static string GetAlterCodeGenerateProcedureSql()
|
||||
{
|
||||
return string.Format(@"
|
||||
ALTER PROCEDURE dbo.{0}
|
||||
@SchemeId INT,
|
||||
@CreateUserId VARCHAR(50) = '',
|
||||
@CreateUserName NVARCHAR(50) = '',
|
||||
@return_id NVARCHAR(300) OUTPUT
|
||||
AS
|
||||
BEGIN
|
||||
SET NOCOUNT ON;
|
||||
|
||||
DECLARE @SchemeCode VARCHAR(50);
|
||||
DECLARE @SchemeName NVARCHAR(100);
|
||||
DECLARE @MenuKey VARCHAR(200);
|
||||
DECLARE @BindModule BIT;
|
||||
|
||||
SELECT
|
||||
@SchemeCode = ISNULL(SchemeCode, ''),
|
||||
@SchemeName = ISNULL(SchemeName, N''),
|
||||
@MenuKey = ISNULL(MenuKey, ''),
|
||||
@BindModule = ISNULL(BindModule, 0)
|
||||
FROM P_CodeSchemeTab
|
||||
WHERE SchemeId = @SchemeId;
|
||||
|
||||
IF @SchemeCode IS NULL
|
||||
BEGIN
|
||||
RAISERROR(N'未找到编码方案。', 16, 1);
|
||||
RETURN;
|
||||
END
|
||||
|
||||
IF ISNULL(@BindModule, 0) = 1
|
||||
BEGIN
|
||||
RAISERROR(N'当前方案已绑定模块,view模式只支持未绑定方案生成编码。', 16, 1);
|
||||
RETURN;
|
||||
END
|
||||
|
||||
DECLARE @defaultValue VARCHAR(MAX),
|
||||
@defaultSql NVARCHAR(MAX),
|
||||
@likeValue VARCHAR(MAX),
|
||||
@likeSql NVARCHAR(MAX),
|
||||
@prefixSql NVARCHAR(MAX),
|
||||
@likePrefix VARCHAR(300),
|
||||
@orderlen INT,
|
||||
@emptyint INT,
|
||||
@orderNumber VARCHAR(300),
|
||||
@out_char VARCHAR(300),
|
||||
@tmpSql NVARCHAR(MAX),
|
||||
@tmpvar VARCHAR(100),
|
||||
@avalue VARCHAR(300),
|
||||
@RuleText NVARCHAR(MAX),
|
||||
@SerialNo INT;
|
||||
|
||||
BEGIN TRY
|
||||
SELECT CASE WHEN element=1 THEN QUOTENAME(RIGHT('0000000000'+ISNULL(LTRIM(defaultvalue),''),elementlen),'''')
|
||||
WHEN element=2 THEN 'CONVERT(varchar(4),'+defaultvalue+',120)'
|
||||
WHEN element=3 THEN 'RIGHT(CONVERT(varchar(4),'+defaultvalue+',120),2)'
|
||||
WHEN element=4 THEN 'RIGHT('+QUOTENAME('00','''')+'+cast(month('+defaultvalue+') as varchar),2)'
|
||||
WHEN element=5 THEN 'RIGHT('+QUOTENAME('00','''')+'+cast(day('+defaultvalue+') as varchar),2)'
|
||||
WHEN element=6 AND ISNULL(elementlen,0)>0 THEN 'RIGHT('+QUOTENAME('000000000000','''')+'+'+defaultvalue+','+CAST(elementlen AS varchar)+')'
|
||||
WHEN element=6 AND ISNULL(elementlen,0)=0 THEN defaultvalue
|
||||
WHEN element=999 THEN QUOTENAME(CASE WHEN ISNULL(LTRIM(defaultvalue),'')='' THEN '0000000000000001' ELSE defaultvalue END,'''')
|
||||
ELSE 'RIGHT('+QUOTENAME('000000000000','''')+'+'+defaultvalue+','+CAST(elementlen AS varchar)+')'
|
||||
END AS defaultvalue,
|
||||
ISNULL(splitchar,'') AS splitchar,
|
||||
CASE WHEN element=1 AND isrelated=1 THEN QUOTENAME(RIGHT('0000000000'+ISNULL(LTRIM(defaultvalue),''),elementlen),'''')
|
||||
WHEN element=2 AND isrelated=1 THEN 'CONVERT(varchar(4),'+defaultvalue+',120)'
|
||||
WHEN element=3 AND isrelated=1 THEN 'RIGHT(CONVERT(varchar(4),'+defaultvalue+',120),2)'
|
||||
WHEN element=4 AND isrelated=1 THEN 'RIGHT('+QUOTENAME('00','''')+'+cast(month('+defaultvalue+') as varchar),2)'
|
||||
WHEN element=5 AND isrelated=1 THEN 'RIGHT('+QUOTENAME('00','''')+'+cast(day('+defaultvalue+') as varchar),2)'
|
||||
WHEN element=6 AND isrelated=1 AND ISNULL(elementlen,0)>0 THEN 'RIGHT(''000000000000''+'+defaultvalue+','+CAST(elementlen AS varchar)+')'
|
||||
WHEN element=6 AND isrelated=1 AND ISNULL(elementlen,0)=0 THEN defaultvalue
|
||||
WHEN element=999 THEN ''
|
||||
WHEN isrelated=0 THEN QUOTENAME(RIGHT('__________',elementlen),'''')
|
||||
ELSE ''
|
||||
END AS likevalue,
|
||||
CASE WHEN element=999 THEN elementlen ELSE 0 END AS orderlen
|
||||
INTO #tempordernumber
|
||||
FROM (
|
||||
SELECT
|
||||
CASE WHEN ISNUMERIC(CONVERT(VARCHAR(20), element)) = 1 THEN CONVERT(INT, element) ELSE 0 END AS element,
|
||||
ISNULL(CONVERT(VARCHAR(MAX), defaultvalue), '') AS defaultvalue,
|
||||
ISNULL(CONVERT(VARCHAR(50), splitchar), '') AS splitchar,
|
||||
CASE WHEN ISNUMERIC(CONVERT(VARCHAR(20), elementlen)) = 1 THEN CONVERT(INT, elementlen) ELSE 0 END AS elementlen,
|
||||
CASE WHEN ISNULL(CONVERT(VARCHAR(20), isrelated), '0') IN ('1', 'True', 'true', '是') THEN 1 ELSE 0 END AS isrelated,
|
||||
CASE WHEN ISNUMERIC(CONVERT(VARCHAR(20), Orderid)) = 1 THEN CONVERT(INT, Orderid) ELSE 0 END AS Orderid,
|
||||
CASE WHEN ISNUMERIC(CONVERT(VARCHAR(20), ID)) = 1 THEN CONVERT(INT, ID) ELSE 0 END AS ID
|
||||
FROM P_CodeSchemeControlTab
|
||||
WHERE SchemeId=@SchemeId
|
||||
AND ISNULL(CONVERT(NVARCHAR(20), enableFlag), N'1') IN (N'1', N'True', N'true', N'是')
|
||||
) ruleSource
|
||||
ORDER BY Orderid, ID;
|
||||
|
||||
SET @defaultValue='';
|
||||
SET @defaultSql='';
|
||||
SET @likeValue='';
|
||||
SET @likeSql='';
|
||||
SET @prefixSql='';
|
||||
SET @likePrefix='';
|
||||
SET @orderlen=0;
|
||||
SET @emptyint=0;
|
||||
SET @orderNumber='';
|
||||
SET @out_char='';
|
||||
SET @tmpvar='';
|
||||
SET @avalue='';
|
||||
SET @SerialNo=0;
|
||||
|
||||
SELECT @emptyint=1,
|
||||
@defaultValue=@defaultValue+defaultvalue+'+'+QUOTENAME(splitchar,'''')+'+',
|
||||
@likeValue=@likeValue+CASE WHEN likevalue='' THEN '' ELSE likevalue+'+'+QUOTENAME(splitchar,'''')+'+' END,
|
||||
@orderlen=@orderlen+orderlen
|
||||
FROM #tempordernumber;
|
||||
|
||||
SET @defaultValue=REPLACE(@defaultValue,'{{&loginid&}}',CAST(ISNULL(@CreateUserId,'') AS VARCHAR));
|
||||
SET @likeValue=REPLACE(@likeValue,'{{&loginid&}}',CAST(ISNULL(@CreateUserId,'') AS VARCHAR));
|
||||
|
||||
IF ISNULL(@emptyint,0)=0
|
||||
BEGIN
|
||||
SET @defaultSql='select @out_char=replace(convert(varchar(10),getdate(),120),''-'','''')+''0001''';
|
||||
SET @likeSql='select @out_char=max(CodeValue) from P_CodeSchemeRecordTab with(updlock,holdlock) where SchemeId=@SchemeId and CodeValue like '+QUOTENAME(REPLACE(CONVERT(VARCHAR(10),GETDATE(),120),'-','')+'%','''');
|
||||
SET @prefixSql='select @out_char='+QUOTENAME(REPLACE(CONVERT(VARCHAR(10),GETDATE(),120),'-',''),'''');
|
||||
SET @orderlen=4;
|
||||
END
|
||||
ELSE
|
||||
BEGIN
|
||||
IF ISNULL(@orderlen,0)<=0
|
||||
BEGIN
|
||||
RAISERROR(N'当前方案未配置流水号规则。', 16, 1);
|
||||
RETURN;
|
||||
END
|
||||
|
||||
IF ISNULL(@defaultValue,'')<>''
|
||||
SET @defaultSql='select @out_char='+LEFT(@defaultValue,LEN(@defaultValue)-1);
|
||||
IF ISNULL(@likeValue,'')<>''
|
||||
BEGIN
|
||||
SET @likeSql='select @out_char=max(CodeValue) from P_CodeSchemeRecordTab with(updlock,holdlock) where SchemeId=@SchemeId and CodeValue like '+@likeValue+QUOTENAME('%','''');
|
||||
SET @prefixSql='select @out_char='+LEFT(@likeValue,LEN(@likeValue)-1);
|
||||
END
|
||||
ELSE
|
||||
BEGIN
|
||||
SET @likeSql='select @out_char=max(CodeValue) from P_CodeSchemeRecordTab with(updlock,holdlock) where SchemeId=@SchemeId';
|
||||
SET @prefixSql='select @out_char=''''';
|
||||
END
|
||||
END
|
||||
|
||||
WHILE CHARINDEX('{{&',@defaultSql)>0
|
||||
BEGIN
|
||||
IF CHARINDEX('&}}',@defaultSql)<1
|
||||
BEGIN
|
||||
RAISERROR(N'变量名缺少&}}号。', 16, 1);
|
||||
RETURN;
|
||||
END
|
||||
SET @tmpvar=SUBSTRING(@defaultSql,CHARINDEX('{{&',@defaultSql),CHARINDEX('&}}',@defaultSql)-CHARINDEX('{{&',@defaultSql)+2);
|
||||
RAISERROR(N'未绑定模块方案不支持字段变量:%s。', 16, 1, @tmpvar);
|
||||
RETURN;
|
||||
END
|
||||
|
||||
WHILE CHARINDEX('{{&',@likeSql)>0
|
||||
BEGIN
|
||||
IF CHARINDEX('&}}',@likeSql)<1
|
||||
BEGIN
|
||||
RAISERROR(N'变量名缺少&}}号。', 16, 1);
|
||||
RETURN;
|
||||
END
|
||||
SET @tmpvar=SUBSTRING(@likeSql,CHARINDEX('{{&',@likeSql),CHARINDEX('&}}',@likeSql)-CHARINDEX('{{&',@likeSql)+2);
|
||||
RAISERROR(N'未绑定模块方案不支持字段变量:%s。', 16, 1, @tmpvar);
|
||||
RETURN;
|
||||
END
|
||||
|
||||
SET @RuleText=ISNULL(@defaultSql,N'')+CHAR(13)+CHAR(10)+ISNULL(@likeSql,N'');
|
||||
|
||||
BEGIN TRANSACTION;
|
||||
|
||||
SET @out_char='';
|
||||
IF ISNULL(@likeSql,'')<>''
|
||||
EXEC sp_executesql @likeSql,N'@SchemeId int,@out_char varchar(300) output', @SchemeId, @out_char output;
|
||||
|
||||
IF ISNULL(LTRIM(@out_char),'')<>''
|
||||
BEGIN
|
||||
SET @orderNumber=LEFT(@out_char, LEN(@out_char)-@orderlen)+
|
||||
RIGHT('0000000000'+CAST(CAST(RIGHT(@out_char,@orderlen) AS INT)+1 AS VARCHAR),@orderlen);
|
||||
END
|
||||
ELSE
|
||||
BEGIN
|
||||
EXEC sp_executesql @defaultSql,N'@out_char varchar(300) output', @out_char output;
|
||||
SET @orderNumber=ISNULL(LTRIM(@out_char),'');
|
||||
END
|
||||
|
||||
SET @out_char='';
|
||||
IF ISNULL(@prefixSql,'')<>''
|
||||
BEGIN
|
||||
EXEC sp_executesql @prefixSql,N'@out_char varchar(300) output', @out_char output;
|
||||
SET @likePrefix=ISNULL(@out_char,'');
|
||||
END
|
||||
|
||||
IF LEN(ISNULL(@orderNumber,''))=0
|
||||
RAISERROR(N'生成编码为空,请检查方案规则。', 16, 1);
|
||||
|
||||
IF LEN(@orderNumber)>300
|
||||
RAISERROR(N'生成编码长度超过300,请检查方案规则。', 16, 1);
|
||||
|
||||
IF EXISTS (SELECT 1 FROM P_CodeSchemeRecordTab WITH (UPDLOCK, HOLDLOCK) WHERE SchemeId=@SchemeId AND CodeValue=@orderNumber)
|
||||
RAISERROR(N'生成编码重复,请检查方案规则。', 16, 1);
|
||||
|
||||
IF ISNUMERIC(RIGHT(@orderNumber,@orderlen))=1
|
||||
SET @SerialNo=CONVERT(INT,RIGHT(@orderNumber,@orderlen));
|
||||
|
||||
INSERT INTO P_CodeSchemeRecordTab
|
||||
(SchemeId, SchemeCode, SchemeName, MenuKey, SequenceKey, SerialNo, CodeValue, RuleText, CreateUserId, CreateUserName, CreateTime)
|
||||
VALUES
|
||||
(@SchemeId, @SchemeCode, @SchemeName, @MenuKey, ISNULL(@likePrefix,''), @SerialNo, @orderNumber, @RuleText, @CreateUserId, @CreateUserName, GETDATE());
|
||||
|
||||
SET @return_id=@orderNumber;
|
||||
|
||||
COMMIT TRANSACTION;
|
||||
END TRY
|
||||
BEGIN CATCH
|
||||
IF @@TRANCOUNT > 0 ROLLBACK TRANSACTION;
|
||||
DECLARE @ErrorMessage NVARCHAR(4000);
|
||||
SET @ErrorMessage = ERROR_MESSAGE();
|
||||
RAISERROR(@ErrorMessage, 16, 1);
|
||||
END CATCH
|
||||
END", CodeGenerateProcedureName);
|
||||
}
|
||||
|
||||
internal static void EnsureRuleStorage()
|
||||
{
|
||||
EnsureSchemeControlRuleStorage();
|
||||
}
|
||||
|
||||
private static void EnsureNumberRuleSchemeStorage()
|
||||
{
|
||||
}
|
||||
|
||||
private static void EnsureSchemeControlRuleStorage()
|
||||
{
|
||||
if (!TableExists(SchemeControlTableName)) return;
|
||||
|
||||
foreach (TableColumnSpec column in GetNumberRuleSchemeColumns())
|
||||
{
|
||||
if (!ColumnExists(SchemeControlTableName, column.Name))
|
||||
{
|
||||
SqlHelper.ExecuteNonQuery(string.Format("ALTER TABLE {0} ADD {1} {2}", QuoteSqlIdentifier(SchemeControlTableName), QuoteSqlIdentifier(column.Name), column.Definition));
|
||||
}
|
||||
}
|
||||
|
||||
if (TableExists(NumberRuleTableName))
|
||||
{
|
||||
List<TableColumnSpec> mirrorColumns = GetNumberRuleMirrorColumns();
|
||||
foreach (TableColumnSpec column in mirrorColumns)
|
||||
{
|
||||
if (!ColumnExists(SchemeControlTableName, column.Name))
|
||||
{
|
||||
SqlHelper.ExecuteNonQuery(string.Format("ALTER TABLE {0} ADD {1} {2}", QuoteSqlIdentifier(SchemeControlTableName), QuoteSqlIdentifier(column.Name), column.Definition));
|
||||
}
|
||||
}
|
||||
|
||||
RemoveSchemeControlUnusedRuleColumns(mirrorColumns);
|
||||
}
|
||||
|
||||
EnsureIndex("IX_CodeSchemeControl_Menu", "CREATE INDEX IX_CodeSchemeControl_Menu ON P_CodeSchemeControlTab(MenuKey, SchemeId)");
|
||||
}
|
||||
|
||||
private static void RemoveSchemeControlUnusedRuleColumns(List<TableColumnSpec> mirrorColumns)
|
||||
{
|
||||
if (!TableExists(SchemeControlTableName)) return;
|
||||
|
||||
HashSet<string> keepColumns = new HashSet<string>(StringComparer.OrdinalIgnoreCase);
|
||||
foreach (TableColumnSpec column in GetNumberRuleSchemeColumns())
|
||||
{
|
||||
keepColumns.Add(column.Name);
|
||||
}
|
||||
if (mirrorColumns != null)
|
||||
{
|
||||
foreach (TableColumnSpec column in mirrorColumns)
|
||||
{
|
||||
keepColumns.Add(column.Name);
|
||||
}
|
||||
}
|
||||
|
||||
foreach (string columnName in GetTableColumnNames(SchemeControlTableName))
|
||||
{
|
||||
if (keepColumns.Contains(columnName)) continue;
|
||||
|
||||
DropColumnIfExists(SchemeControlTableName, columnName);
|
||||
}
|
||||
}
|
||||
|
||||
private static List<string> GetTableColumnNames(string tableName)
|
||||
{
|
||||
List<string> columns = new List<string>();
|
||||
if (string.IsNullOrWhiteSpace(tableName) || !TableExists(tableName)) return columns;
|
||||
|
||||
string sql = @"SELECT name FROM sys.columns WHERE object_id = OBJECT_ID(@TableName) ORDER BY column_id";
|
||||
DataTable table = SqlHelper.ExecuteDataTable(sql, new SqlParameter[] { new SqlParameter("@TableName", tableName) });
|
||||
if (table == null) return columns;
|
||||
|
||||
foreach (DataRow row in table.Rows)
|
||||
{
|
||||
string columnName = row["name"] + "";
|
||||
if (!string.IsNullOrWhiteSpace(columnName))
|
||||
{
|
||||
columns.Add(columnName);
|
||||
}
|
||||
}
|
||||
return columns;
|
||||
}
|
||||
|
||||
private static List<TableColumnSpec> GetNumberRuleSchemeColumns()
|
||||
{
|
||||
return new List<TableColumnSpec>
|
||||
{
|
||||
new TableColumnSpec(NumberRuleSchemeIdColumn, "INT NOT NULL DEFAULT(0)"),
|
||||
new TableColumnSpec(NumberRuleSchemeCodeColumn, "VARCHAR(50) NOT NULL DEFAULT('')"),
|
||||
new TableColumnSpec(NumberRuleSchemeNameColumn, "NVARCHAR(100) NULL"),
|
||||
new TableColumnSpec(NumberRuleMenuKeyColumn, "VARCHAR(200) NULL"),
|
||||
new TableColumnSpec(NumberRuleBindModuleColumn, "BIT NOT NULL DEFAULT(0)"),
|
||||
new TableColumnSpec(NumberRuleBindModuleCodeColumn, "VARCHAR(100) NULL"),
|
||||
new TableColumnSpec(NumberRuleModIdColumn, "VARCHAR(100) NULL")
|
||||
};
|
||||
}
|
||||
|
||||
private static List<TableColumnSpec> GetNumberRuleMirrorColumns()
|
||||
{
|
||||
List<TableColumnSpec> columns = new List<TableColumnSpec>();
|
||||
string sql = @"
|
||||
SELECT
|
||||
c.COLUMN_NAME,
|
||||
c.DATA_TYPE,
|
||||
c.CHARACTER_MAXIMUM_LENGTH,
|
||||
c.NUMERIC_PRECISION,
|
||||
c.NUMERIC_SCALE,
|
||||
COLUMNPROPERTY(OBJECT_ID(c.TABLE_SCHEMA + '.' + c.TABLE_NAME), c.COLUMN_NAME, 'IsComputed') AS IsComputed
|
||||
FROM INFORMATION_SCHEMA.COLUMNS c
|
||||
WHERE c.TABLE_NAME = @TableName
|
||||
ORDER BY c.ORDINAL_POSITION";
|
||||
DataTable table = SqlHelper.ExecuteDataTable(sql, new SqlParameter[] { new SqlParameter("@TableName", NumberRuleTableName) });
|
||||
if (table == null) return columns;
|
||||
|
||||
foreach (DataRow row in table.Rows)
|
||||
{
|
||||
string columnName = row["COLUMN_NAME"] + "";
|
||||
if (string.IsNullOrWhiteSpace(columnName)) continue;
|
||||
if (string.Equals(columnName, DesignRuleUseColumn, StringComparison.OrdinalIgnoreCase)) continue;
|
||||
if (ToInt(row["IsComputed"]) == 1) continue;
|
||||
|
||||
string definition = GetColumnDefinitionFromSchemaRow(row);
|
||||
if (string.IsNullOrWhiteSpace(definition)) continue;
|
||||
|
||||
columns.Add(new TableColumnSpec(columnName, definition));
|
||||
}
|
||||
return columns;
|
||||
}
|
||||
|
||||
private static string GetColumnDefinitionFromSchemaRow(DataRow row)
|
||||
{
|
||||
string dataType = (row["DATA_TYPE"] + "").Trim();
|
||||
if (string.IsNullOrWhiteSpace(dataType)) return string.Empty;
|
||||
if (string.Equals(dataType, "timestamp", StringComparison.OrdinalIgnoreCase) ||
|
||||
string.Equals(dataType, "rowversion", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
return string.Empty;
|
||||
}
|
||||
|
||||
string typeText = dataType;
|
||||
int maxLength = ToInt(row["CHARACTER_MAXIMUM_LENGTH"]);
|
||||
if (IsLengthColumnType(dataType))
|
||||
{
|
||||
typeText += maxLength < 0 ? "(MAX)" : "(" + maxLength + ")";
|
||||
}
|
||||
else if (IsPrecisionColumnType(dataType))
|
||||
{
|
||||
int precision = ToInt(row["NUMERIC_PRECISION"]);
|
||||
int scale = ToInt(row["NUMERIC_SCALE"]);
|
||||
if (precision > 0)
|
||||
{
|
||||
typeText += "(" + precision + "," + Math.Max(0, scale) + ")";
|
||||
}
|
||||
}
|
||||
else if (IsDateTimePrecisionColumnType(dataType))
|
||||
{
|
||||
int scale = ToInt(row["NUMERIC_SCALE"]);
|
||||
if (scale > 0)
|
||||
{
|
||||
typeText += "(" + scale + ")";
|
||||
}
|
||||
}
|
||||
|
||||
return typeText + " NULL";
|
||||
}
|
||||
|
||||
private static int ToInt(object value)
|
||||
{
|
||||
int result;
|
||||
return int.TryParse(value + "", out result) ? result : 0;
|
||||
}
|
||||
|
||||
private static bool ToBool(object value)
|
||||
{
|
||||
if (value == null || value == DBNull.Value) return false;
|
||||
bool boolValue;
|
||||
if (bool.TryParse(value + "", out boolValue)) return boolValue;
|
||||
return ToInt(value) != 0;
|
||||
}
|
||||
|
||||
private static bool IsLengthColumnType(string dataType)
|
||||
{
|
||||
return string.Equals(dataType, "varchar", StringComparison.OrdinalIgnoreCase) ||
|
||||
string.Equals(dataType, "nvarchar", StringComparison.OrdinalIgnoreCase) ||
|
||||
string.Equals(dataType, "char", StringComparison.OrdinalIgnoreCase) ||
|
||||
string.Equals(dataType, "nchar", StringComparison.OrdinalIgnoreCase) ||
|
||||
string.Equals(dataType, "varbinary", StringComparison.OrdinalIgnoreCase) ||
|
||||
string.Equals(dataType, "binary", StringComparison.OrdinalIgnoreCase);
|
||||
}
|
||||
|
||||
private static bool IsPrecisionColumnType(string dataType)
|
||||
{
|
||||
return string.Equals(dataType, "decimal", StringComparison.OrdinalIgnoreCase) ||
|
||||
string.Equals(dataType, "numeric", StringComparison.OrdinalIgnoreCase);
|
||||
}
|
||||
|
||||
private static bool IsDateTimePrecisionColumnType(string dataType)
|
||||
{
|
||||
return string.Equals(dataType, "datetime2", StringComparison.OrdinalIgnoreCase) ||
|
||||
string.Equals(dataType, "datetimeoffset", StringComparison.OrdinalIgnoreCase) ||
|
||||
string.Equals(dataType, "time", StringComparison.OrdinalIgnoreCase);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,77 @@
|
||||
using Lskj.Business;
|
||||
using Lskj.Model;
|
||||
using Lskj.Util;
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data;
|
||||
using System.Linq;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace Lskj.PubCodeDesign
|
||||
{
|
||||
/// <summary>
|
||||
/// c#库被调用统一接口类
|
||||
/// </summary>
|
||||
public sealed class DllBaseClass : IForm
|
||||
{
|
||||
public DllBaseClass()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public DllBaseClass(string[] obj)
|
||||
{
|
||||
try
|
||||
{
|
||||
FrmMain main = new FrmMain();
|
||||
DynamicCodeDesign moduleModel = new DynamicCodeDesign(obj);// 基础档案上下结构动态链接库参数
|
||||
main.Model = moduleModel;
|
||||
this.SubForm = main;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
LogUtil.WriteError("Lskj.PubChart.dll--参数错误-->" + obj.ToString(), ex);
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// 窗口
|
||||
/// </summary>
|
||||
public Form SubForm { get; set; }
|
||||
}
|
||||
public class DynamicCodeDesign : DynamicModel
|
||||
{
|
||||
public string ExecType = "0";
|
||||
public DynamicCodeDesign(string[] args) : base(args)
|
||||
{
|
||||
// 右键菜单打开的模块没有moduleId,部分特殊模块没有moduleId比如添加界面.
|
||||
if (!string.IsNullOrEmpty(args[5]))
|
||||
{
|
||||
base.ModuleId = Convert.ToInt32(args[5]);
|
||||
}
|
||||
if (args.Length > 6 && !string.IsNullOrWhiteSpace(args[6]))
|
||||
{
|
||||
base.ModuleCode = args[6];
|
||||
}
|
||||
if (args.Length > 7 && !string.IsNullOrWhiteSpace(args[7]))
|
||||
{
|
||||
ExecType = args[7];
|
||||
}
|
||||
if (!string.IsNullOrEmpty(args[args.Length - 1]))
|
||||
{
|
||||
try
|
||||
{
|
||||
JObject rowObject = JsonConvert.DeserializeObject<JObject>(args[args.Length - 1]);
|
||||
JArray jArray = new JArray();
|
||||
jArray.Add(rowObject);
|
||||
DataTable dataTable = JsonConvert.DeserializeObject<DataTable>(JsonConvert.SerializeObject(jArray));
|
||||
this.MaintabFocusedRow = dataTable.Rows[0];
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+625
@@ -0,0 +1,625 @@
|
||||
|
||||
namespace Lskj.PubCodeDesign
|
||||
{
|
||||
partial class FrmMain
|
||||
{
|
||||
/// <summary>
|
||||
/// 必需的设计器变量。
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// 清理所有正在使用的资源。
|
||||
/// </summary>
|
||||
/// <param name="disposing">如果应释放托管资源,为 true;否则为 false。</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Windows 窗体设计器生成的代码
|
||||
|
||||
/// <summary>
|
||||
/// 设计器支持所需的方法 - 不要修改
|
||||
/// 使用代码编辑器修改此方法的内容。
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.splitRoot = new DevExpress.XtraEditors.SplitContainerControl();
|
||||
this.pnlTreeHost = new DevExpress.XtraEditors.PanelControl();
|
||||
this.treeMenu = new DevExpress.XtraTreeList.TreeList();
|
||||
this.treeColumnMenu = new DevExpress.XtraTreeList.Columns.TreeListColumn();
|
||||
this.imgMenuTree = new System.Windows.Forms.ImageList();
|
||||
this.pnlLeftHeader = new DevExpress.XtraEditors.PanelControl();
|
||||
this.lblMenuTitle = new DevExpress.XtraEditors.LabelControl();
|
||||
this.pnlDesignWork = new DevExpress.XtraEditors.PanelControl();
|
||||
this.gridDesignRules = new Lskj.PubCodeDesign.CodeDesignModuleGridEx();
|
||||
this.pnlDesignGridHeader = new DevExpress.XtraEditors.PanelControl();
|
||||
this.lblDesignGridTitle = new DevExpress.XtraEditors.LabelControl();
|
||||
this.pnlBindModule = new DevExpress.XtraEditors.PanelControl();
|
||||
this.cboBindLevel3 = new DevExpress.XtraEditors.ComboBoxEdit();
|
||||
this.lblBindLevel3 = new DevExpress.XtraEditors.LabelControl();
|
||||
this.cboBindLevel2 = new DevExpress.XtraEditors.ComboBoxEdit();
|
||||
this.lblBindLevel2 = new DevExpress.XtraEditors.LabelControl();
|
||||
this.cboBindLevel1 = new DevExpress.XtraEditors.ComboBoxEdit();
|
||||
this.lblBindLevel1 = new DevExpress.XtraEditors.LabelControl();
|
||||
this.chkBindModule = new DevExpress.XtraEditors.CheckEdit();
|
||||
this.pnlViewWork = new DevExpress.XtraEditors.XtraScrollableControl();
|
||||
this.pl_buttom = new DevExpress.XtraEditors.PanelControl();
|
||||
this.btnAddLogic = new DevExpress.XtraEditors.SimpleButton();
|
||||
this.btnDeleteLogic = new DevExpress.XtraEditors.SimpleButton();
|
||||
this.btnSave = new DevExpress.XtraEditors.SimpleButton();
|
||||
this.pnlDesignerHeader = new DevExpress.XtraEditors.PanelControl();
|
||||
this.btnDeleteScheme = new DevExpress.XtraEditors.SimpleButton();
|
||||
this.btnGenerateCode = new DevExpress.XtraEditors.SimpleButton();
|
||||
this.txtCodePreview = new DevExpress.XtraEditors.TextEdit();
|
||||
this.lblCodePreview = new DevExpress.XtraEditors.LabelControl();
|
||||
this.txtSchemeName = new DevExpress.XtraEditors.TextEdit();
|
||||
this.label1 = new DevExpress.XtraEditors.LabelControl();
|
||||
this.cmsMenuTree = new System.Windows.Forms.ContextMenuStrip();
|
||||
this.menuAddScheme = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.lblDesignerStatus = new DevExpress.XtraEditors.LabelControl();
|
||||
((System.ComponentModel.ISupportInitialize)(this.splitRoot)).BeginInit();
|
||||
this.splitRoot.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this.pnlTreeHost)).BeginInit();
|
||||
this.pnlTreeHost.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this.treeMenu)).BeginInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.pnlLeftHeader)).BeginInit();
|
||||
this.pnlLeftHeader.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this.pnlDesignWork)).BeginInit();
|
||||
this.pnlDesignWork.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this.pnlDesignGridHeader)).BeginInit();
|
||||
this.pnlDesignGridHeader.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this.pnlBindModule)).BeginInit();
|
||||
this.pnlBindModule.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this.cboBindLevel3.Properties)).BeginInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.cboBindLevel2.Properties)).BeginInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.cboBindLevel1.Properties)).BeginInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.chkBindModule.Properties)).BeginInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.pl_buttom)).BeginInit();
|
||||
this.pl_buttom.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this.pnlDesignerHeader)).BeginInit();
|
||||
this.pnlDesignerHeader.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this.txtCodePreview.Properties)).BeginInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.txtSchemeName.Properties)).BeginInit();
|
||||
this.cmsMenuTree.SuspendLayout();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// splitRoot
|
||||
//
|
||||
this.splitRoot.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.splitRoot.Location = new System.Drawing.Point(0, 0);
|
||||
this.splitRoot.Name = "splitRoot";
|
||||
this.splitRoot.Panel1.Controls.Add(this.pnlTreeHost);
|
||||
this.splitRoot.Panel1.Controls.Add(this.pnlLeftHeader);
|
||||
this.splitRoot.Panel2.Controls.Add(this.pnlDesignWork);
|
||||
this.splitRoot.Panel2.Controls.Add(this.pnlViewWork);
|
||||
this.splitRoot.Panel2.Controls.Add(this.pl_buttom);
|
||||
this.splitRoot.Panel2.Controls.Add(this.pnlDesignerHeader);
|
||||
this.splitRoot.Size = new System.Drawing.Size(1297, 681);
|
||||
this.splitRoot.SplitterPosition = 260;
|
||||
this.splitRoot.TabIndex = 0;
|
||||
this.splitRoot.Text = "splitRoot";
|
||||
//
|
||||
// pnlTreeHost
|
||||
//
|
||||
this.pnlTreeHost.Appearance.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(250)))), ((int)(((byte)(253)))), ((int)(((byte)(255)))));
|
||||
this.pnlTreeHost.Appearance.Options.UseBackColor = true;
|
||||
this.pnlTreeHost.BorderStyle = DevExpress.XtraEditors.Controls.BorderStyles.NoBorder;
|
||||
this.pnlTreeHost.Controls.Add(this.treeMenu);
|
||||
this.pnlTreeHost.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.pnlTreeHost.Location = new System.Drawing.Point(0, 38);
|
||||
this.pnlTreeHost.Name = "pnlTreeHost";
|
||||
this.pnlTreeHost.Size = new System.Drawing.Size(260, 643);
|
||||
this.pnlTreeHost.TabIndex = 1;
|
||||
//
|
||||
// treeMenu
|
||||
//
|
||||
this.treeMenu.Appearance.Empty.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(250)))), ((int)(((byte)(253)))), ((int)(((byte)(255)))));
|
||||
this.treeMenu.Appearance.Empty.Options.UseBackColor = true;
|
||||
this.treeMenu.Appearance.FocusedCell.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(207)))), ((int)(((byte)(226)))), ((int)(((byte)(243)))));
|
||||
this.treeMenu.Appearance.FocusedCell.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(38)))), ((int)(((byte)(73)))), ((int)(((byte)(98)))));
|
||||
this.treeMenu.Appearance.FocusedCell.Options.UseBackColor = true;
|
||||
this.treeMenu.Appearance.FocusedCell.Options.UseForeColor = true;
|
||||
this.treeMenu.Appearance.FocusedRow.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(207)))), ((int)(((byte)(226)))), ((int)(((byte)(243)))));
|
||||
this.treeMenu.Appearance.FocusedRow.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(38)))), ((int)(((byte)(73)))), ((int)(((byte)(98)))));
|
||||
this.treeMenu.Appearance.FocusedRow.Options.UseBackColor = true;
|
||||
this.treeMenu.Appearance.FocusedRow.Options.UseForeColor = true;
|
||||
this.treeMenu.Appearance.Row.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(250)))), ((int)(((byte)(253)))), ((int)(((byte)(255)))));
|
||||
this.treeMenu.Appearance.Row.Font = new System.Drawing.Font("微软雅黑", 9.5F);
|
||||
this.treeMenu.Appearance.Row.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(38)))), ((int)(((byte)(73)))), ((int)(((byte)(98)))));
|
||||
this.treeMenu.Appearance.Row.Options.UseBackColor = true;
|
||||
this.treeMenu.Appearance.Row.Options.UseFont = true;
|
||||
this.treeMenu.Appearance.Row.Options.UseForeColor = true;
|
||||
this.treeMenu.BorderStyle = DevExpress.XtraEditors.Controls.BorderStyles.NoBorder;
|
||||
this.treeMenu.Columns.AddRange(new DevExpress.XtraTreeList.Columns.TreeListColumn[] {
|
||||
this.treeColumnMenu});
|
||||
this.treeMenu.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.treeMenu.Location = new System.Drawing.Point(0, 0);
|
||||
this.treeMenu.Name = "treeMenu";
|
||||
this.treeMenu.OptionsBehavior.Editable = false;
|
||||
this.treeMenu.OptionsSelection.EnableAppearanceFocusedCell = false;
|
||||
this.treeMenu.OptionsView.ShowColumns = false;
|
||||
this.treeMenu.OptionsView.ShowHorzLines = false;
|
||||
this.treeMenu.OptionsView.ShowIndicator = false;
|
||||
this.treeMenu.OptionsView.ShowVertLines = false;
|
||||
this.treeMenu.RowHeight = 28;
|
||||
this.treeMenu.SelectImageList = this.imgMenuTree;
|
||||
this.treeMenu.Size = new System.Drawing.Size(260, 643);
|
||||
this.treeMenu.TabIndex = 0;
|
||||
//
|
||||
// treeColumnMenu
|
||||
//
|
||||
this.treeColumnMenu.Caption = "编码分类";
|
||||
this.treeColumnMenu.FieldName = "Text";
|
||||
this.treeColumnMenu.MinWidth = 35;
|
||||
this.treeColumnMenu.Name = "treeColumnMenu";
|
||||
this.treeColumnMenu.Visible = true;
|
||||
this.treeColumnMenu.VisibleIndex = 0;
|
||||
//
|
||||
// imgMenuTree
|
||||
//
|
||||
this.imgMenuTree.ColorDepth = System.Windows.Forms.ColorDepth.Depth32Bit;
|
||||
this.imgMenuTree.ImageSize = new System.Drawing.Size(18, 18);
|
||||
this.imgMenuTree.TransparentColor = System.Drawing.Color.Transparent;
|
||||
//
|
||||
// pnlLeftHeader
|
||||
//
|
||||
this.pnlLeftHeader.Appearance.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(245)))), ((int)(((byte)(248)))), ((int)(((byte)(250)))));
|
||||
this.pnlLeftHeader.Appearance.Options.UseBackColor = true;
|
||||
this.pnlLeftHeader.BorderStyle = DevExpress.XtraEditors.Controls.BorderStyles.NoBorder;
|
||||
this.pnlLeftHeader.Controls.Add(this.lblMenuTitle);
|
||||
this.pnlLeftHeader.Dock = System.Windows.Forms.DockStyle.Top;
|
||||
this.pnlLeftHeader.Location = new System.Drawing.Point(0, 0);
|
||||
this.pnlLeftHeader.Name = "pnlLeftHeader";
|
||||
this.pnlLeftHeader.Padding = new System.Windows.Forms.Padding(10, 0, 0, 0);
|
||||
this.pnlLeftHeader.Size = new System.Drawing.Size(260, 38);
|
||||
this.pnlLeftHeader.TabIndex = 0;
|
||||
//
|
||||
// lblMenuTitle
|
||||
//
|
||||
this.lblMenuTitle.Appearance.Font = new System.Drawing.Font("微软雅黑", 10F, System.Drawing.FontStyle.Bold);
|
||||
this.lblMenuTitle.Appearance.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(38)))), ((int)(((byte)(73)))), ((int)(((byte)(98)))));
|
||||
this.lblMenuTitle.Appearance.TextOptions.HAlignment = DevExpress.Utils.HorzAlignment.Near;
|
||||
this.lblMenuTitle.Appearance.TextOptions.VAlignment = DevExpress.Utils.VertAlignment.Center;
|
||||
this.lblMenuTitle.AutoSizeMode = DevExpress.XtraEditors.LabelAutoSizeMode.None;
|
||||
this.lblMenuTitle.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.lblMenuTitle.Location = new System.Drawing.Point(10, 0);
|
||||
this.lblMenuTitle.Name = "lblMenuTitle";
|
||||
this.lblMenuTitle.Size = new System.Drawing.Size(250, 38);
|
||||
this.lblMenuTitle.TabIndex = 3;
|
||||
this.lblMenuTitle.Text = "编码分类";
|
||||
//
|
||||
// pnlDesignWork
|
||||
//
|
||||
this.pnlDesignWork.Appearance.BackColor = System.Drawing.Color.White;
|
||||
this.pnlDesignWork.Appearance.Options.UseBackColor = true;
|
||||
this.pnlDesignWork.BorderStyle = DevExpress.XtraEditors.Controls.BorderStyles.NoBorder;
|
||||
this.pnlDesignWork.Controls.Add(this.gridDesignRules);
|
||||
this.pnlDesignWork.Controls.Add(this.pnlDesignGridHeader);
|
||||
this.pnlDesignWork.Controls.Add(this.pnlBindModule);
|
||||
this.pnlDesignWork.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.pnlDesignWork.Location = new System.Drawing.Point(0, 38);
|
||||
this.pnlDesignWork.Name = "pnlDesignWork";
|
||||
this.pnlDesignWork.Size = new System.Drawing.Size(760, 607);
|
||||
this.pnlDesignWork.TabIndex = 24;
|
||||
this.pnlDesignWork.Visible = false;
|
||||
//
|
||||
// gridDesignRules
|
||||
//
|
||||
this.gridDesignRules.BackColor = System.Drawing.Color.Transparent;
|
||||
this.gridDesignRules.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.gridDesignRules.Location = new System.Drawing.Point(0, 116);
|
||||
this.gridDesignRules.Margin = new System.Windows.Forms.Padding(4);
|
||||
this.gridDesignRules.Name = "gridDesignRules";
|
||||
this.gridDesignRules.OperShortMode = true;
|
||||
this.gridDesignRules.Size = new System.Drawing.Size(760, 491);
|
||||
this.gridDesignRules.TabIndex = 2;
|
||||
this.gridDesignRules.VisibleMrpSearchPanel = false;
|
||||
this.gridDesignRules.VisibleOperPanel = false;
|
||||
this.gridDesignRules.VisibleSearchPanel = false;
|
||||
//
|
||||
// pnlDesignGridHeader
|
||||
//
|
||||
this.pnlDesignGridHeader.Appearance.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(245)))), ((int)(((byte)(248)))), ((int)(((byte)(250)))));
|
||||
this.pnlDesignGridHeader.Appearance.Options.UseBackColor = true;
|
||||
this.pnlDesignGridHeader.BorderStyle = DevExpress.XtraEditors.Controls.BorderStyles.NoBorder;
|
||||
this.pnlDesignGridHeader.Controls.Add(this.lblDesignGridTitle);
|
||||
this.pnlDesignGridHeader.Dock = System.Windows.Forms.DockStyle.Top;
|
||||
this.pnlDesignGridHeader.Location = new System.Drawing.Point(0, 86);
|
||||
this.pnlDesignGridHeader.Name = "pnlDesignGridHeader";
|
||||
this.pnlDesignGridHeader.Padding = new System.Windows.Forms.Padding(10, 0, 0, 0);
|
||||
this.pnlDesignGridHeader.Size = new System.Drawing.Size(760, 30);
|
||||
this.pnlDesignGridHeader.TabIndex = 1;
|
||||
//
|
||||
// lblDesignGridTitle
|
||||
//
|
||||
this.lblDesignGridTitle.Appearance.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Bold);
|
||||
this.lblDesignGridTitle.Appearance.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(38)))), ((int)(((byte)(73)))), ((int)(((byte)(98)))));
|
||||
this.lblDesignGridTitle.Appearance.TextOptions.HAlignment = DevExpress.Utils.HorzAlignment.Near;
|
||||
this.lblDesignGridTitle.Appearance.TextOptions.VAlignment = DevExpress.Utils.VertAlignment.Center;
|
||||
this.lblDesignGridTitle.AutoSizeMode = DevExpress.XtraEditors.LabelAutoSizeMode.None;
|
||||
this.lblDesignGridTitle.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.lblDesignGridTitle.Location = new System.Drawing.Point(10, 0);
|
||||
this.lblDesignGridTitle.Name = "lblDesignGridTitle";
|
||||
this.lblDesignGridTitle.Size = new System.Drawing.Size(750, 30);
|
||||
this.lblDesignGridTitle.TabIndex = 0;
|
||||
this.lblDesignGridTitle.Text = "方案明细";
|
||||
//
|
||||
// pnlBindModule
|
||||
//
|
||||
this.pnlBindModule.Appearance.BackColor = System.Drawing.Color.White;
|
||||
this.pnlBindModule.Appearance.Options.UseBackColor = true;
|
||||
this.pnlBindModule.BorderStyle = DevExpress.XtraEditors.Controls.BorderStyles.NoBorder;
|
||||
this.pnlBindModule.Controls.Add(this.cboBindLevel3);
|
||||
this.pnlBindModule.Controls.Add(this.lblBindLevel3);
|
||||
this.pnlBindModule.Controls.Add(this.cboBindLevel2);
|
||||
this.pnlBindModule.Controls.Add(this.lblBindLevel2);
|
||||
this.pnlBindModule.Controls.Add(this.cboBindLevel1);
|
||||
this.pnlBindModule.Controls.Add(this.lblBindLevel1);
|
||||
this.pnlBindModule.Controls.Add(this.chkBindModule);
|
||||
this.pnlBindModule.Dock = System.Windows.Forms.DockStyle.Top;
|
||||
this.pnlBindModule.Location = new System.Drawing.Point(0, 0);
|
||||
this.pnlBindModule.Name = "pnlBindModule";
|
||||
this.pnlBindModule.Size = new System.Drawing.Size(760, 86);
|
||||
this.pnlBindModule.TabIndex = 0;
|
||||
//
|
||||
// cboBindLevel3
|
||||
//
|
||||
this.cboBindLevel3.Location = new System.Drawing.Point(548, 45);
|
||||
this.cboBindLevel3.Name = "cboBindLevel3";
|
||||
this.cboBindLevel3.Properties.Appearance.Font = new System.Drawing.Font("微软雅黑", 9F);
|
||||
this.cboBindLevel3.Properties.Appearance.Options.UseFont = true;
|
||||
this.cboBindLevel3.Properties.Buttons.AddRange(new DevExpress.XtraEditors.Controls.EditorButton[] {
|
||||
new DevExpress.XtraEditors.Controls.EditorButton(DevExpress.XtraEditors.Controls.ButtonPredefines.Combo)});
|
||||
this.cboBindLevel3.Properties.TextEditStyle = DevExpress.XtraEditors.Controls.TextEditStyles.DisableTextEditor;
|
||||
this.cboBindLevel3.Size = new System.Drawing.Size(170, 24);
|
||||
this.cboBindLevel3.TabIndex = 6;
|
||||
//
|
||||
// lblBindLevel3
|
||||
//
|
||||
this.lblBindLevel3.Appearance.Font = new System.Drawing.Font("微软雅黑", 9F);
|
||||
this.lblBindLevel3.Appearance.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(38)))), ((int)(((byte)(73)))), ((int)(((byte)(98)))));
|
||||
this.lblBindLevel3.Appearance.TextOptions.HAlignment = DevExpress.Utils.HorzAlignment.Near;
|
||||
this.lblBindLevel3.Appearance.TextOptions.VAlignment = DevExpress.Utils.VertAlignment.Center;
|
||||
this.lblBindLevel3.AutoSizeMode = DevExpress.XtraEditors.LabelAutoSizeMode.None;
|
||||
this.lblBindLevel3.Location = new System.Drawing.Point(482, 42);
|
||||
this.lblBindLevel3.Name = "lblBindLevel3";
|
||||
this.lblBindLevel3.Size = new System.Drawing.Size(66, 26);
|
||||
this.lblBindLevel3.TabIndex = 5;
|
||||
this.lblBindLevel3.Text = "三级菜单:";
|
||||
//
|
||||
// cboBindLevel2
|
||||
//
|
||||
this.cboBindLevel2.Location = new System.Drawing.Point(312, 45);
|
||||
this.cboBindLevel2.Name = "cboBindLevel2";
|
||||
this.cboBindLevel2.Properties.Appearance.Font = new System.Drawing.Font("微软雅黑", 9F);
|
||||
this.cboBindLevel2.Properties.Appearance.Options.UseFont = true;
|
||||
this.cboBindLevel2.Properties.Buttons.AddRange(new DevExpress.XtraEditors.Controls.EditorButton[] {
|
||||
new DevExpress.XtraEditors.Controls.EditorButton(DevExpress.XtraEditors.Controls.ButtonPredefines.Combo)});
|
||||
this.cboBindLevel2.Properties.TextEditStyle = DevExpress.XtraEditors.Controls.TextEditStyles.DisableTextEditor;
|
||||
this.cboBindLevel2.Size = new System.Drawing.Size(150, 24);
|
||||
this.cboBindLevel2.TabIndex = 4;
|
||||
//
|
||||
// lblBindLevel2
|
||||
//
|
||||
this.lblBindLevel2.Appearance.Font = new System.Drawing.Font("微软雅黑", 9F);
|
||||
this.lblBindLevel2.Appearance.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(38)))), ((int)(((byte)(73)))), ((int)(((byte)(98)))));
|
||||
this.lblBindLevel2.Appearance.TextOptions.HAlignment = DevExpress.Utils.HorzAlignment.Near;
|
||||
this.lblBindLevel2.Appearance.TextOptions.VAlignment = DevExpress.Utils.VertAlignment.Center;
|
||||
this.lblBindLevel2.AutoSizeMode = DevExpress.XtraEditors.LabelAutoSizeMode.None;
|
||||
this.lblBindLevel2.Location = new System.Drawing.Point(246, 42);
|
||||
this.lblBindLevel2.Name = "lblBindLevel2";
|
||||
this.lblBindLevel2.Size = new System.Drawing.Size(66, 26);
|
||||
this.lblBindLevel2.TabIndex = 3;
|
||||
this.lblBindLevel2.Text = "二级菜单:";
|
||||
//
|
||||
// cboBindLevel1
|
||||
//
|
||||
this.cboBindLevel1.Location = new System.Drawing.Point(76, 45);
|
||||
this.cboBindLevel1.Name = "cboBindLevel1";
|
||||
this.cboBindLevel1.Properties.Appearance.Font = new System.Drawing.Font("微软雅黑", 9F);
|
||||
this.cboBindLevel1.Properties.Appearance.Options.UseFont = true;
|
||||
this.cboBindLevel1.Properties.Buttons.AddRange(new DevExpress.XtraEditors.Controls.EditorButton[] {
|
||||
new DevExpress.XtraEditors.Controls.EditorButton(DevExpress.XtraEditors.Controls.ButtonPredefines.Combo)});
|
||||
this.cboBindLevel1.Properties.TextEditStyle = DevExpress.XtraEditors.Controls.TextEditStyles.DisableTextEditor;
|
||||
this.cboBindLevel1.Size = new System.Drawing.Size(150, 24);
|
||||
this.cboBindLevel1.TabIndex = 2;
|
||||
//
|
||||
// lblBindLevel1
|
||||
//
|
||||
this.lblBindLevel1.Appearance.Font = new System.Drawing.Font("微软雅黑", 9F);
|
||||
this.lblBindLevel1.Appearance.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(38)))), ((int)(((byte)(73)))), ((int)(((byte)(98)))));
|
||||
this.lblBindLevel1.Appearance.TextOptions.HAlignment = DevExpress.Utils.HorzAlignment.Near;
|
||||
this.lblBindLevel1.Appearance.TextOptions.VAlignment = DevExpress.Utils.VertAlignment.Center;
|
||||
this.lblBindLevel1.AutoSizeMode = DevExpress.XtraEditors.LabelAutoSizeMode.None;
|
||||
this.lblBindLevel1.Location = new System.Drawing.Point(10, 42);
|
||||
this.lblBindLevel1.Name = "lblBindLevel1";
|
||||
this.lblBindLevel1.Size = new System.Drawing.Size(66, 26);
|
||||
this.lblBindLevel1.TabIndex = 1;
|
||||
this.lblBindLevel1.Text = "一级菜单:";
|
||||
//
|
||||
// chkBindModule
|
||||
//
|
||||
this.chkBindModule.Location = new System.Drawing.Point(10, 12);
|
||||
this.chkBindModule.Name = "chkBindModule";
|
||||
this.chkBindModule.Properties.Appearance.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Bold);
|
||||
this.chkBindModule.Properties.Appearance.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(38)))), ((int)(((byte)(73)))), ((int)(((byte)(98)))));
|
||||
this.chkBindModule.Properties.Appearance.Options.UseFont = true;
|
||||
this.chkBindModule.Properties.Appearance.Options.UseForeColor = true;
|
||||
this.chkBindModule.Properties.Caption = "绑定模块";
|
||||
this.chkBindModule.Size = new System.Drawing.Size(95, 21);
|
||||
this.chkBindModule.TabIndex = 0;
|
||||
//
|
||||
// pnlViewWork
|
||||
//
|
||||
this.pnlViewWork.Appearance.BackColor = System.Drawing.Color.White;
|
||||
this.pnlViewWork.Appearance.Options.UseBackColor = true;
|
||||
this.pnlViewWork.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.pnlViewWork.Location = new System.Drawing.Point(0, 38);
|
||||
this.pnlViewWork.Name = "pnlViewWork";
|
||||
this.pnlViewWork.Padding = new System.Windows.Forms.Padding(10);
|
||||
this.pnlViewWork.Size = new System.Drawing.Size(760, 607);
|
||||
this.pnlViewWork.TabIndex = 1;
|
||||
this.pnlViewWork.Visible = false;
|
||||
//
|
||||
// pl_buttom
|
||||
//
|
||||
this.pl_buttom.Appearance.BackColor = System.Drawing.SystemColors.Control;
|
||||
this.pl_buttom.Appearance.Options.UseBackColor = true;
|
||||
this.pl_buttom.BorderStyle = DevExpress.XtraEditors.Controls.BorderStyles.NoBorder;
|
||||
this.pl_buttom.Controls.Add(this.btnAddLogic);
|
||||
this.pl_buttom.Controls.Add(this.btnDeleteLogic);
|
||||
this.pl_buttom.Controls.Add(this.btnSave);
|
||||
this.pl_buttom.Dock = System.Windows.Forms.DockStyle.Bottom;
|
||||
this.pl_buttom.Location = new System.Drawing.Point(0, 645);
|
||||
this.pl_buttom.Name = "pl_buttom";
|
||||
this.pl_buttom.Size = new System.Drawing.Size(760, 36);
|
||||
this.pl_buttom.TabIndex = 23;
|
||||
//
|
||||
// btnAddLogic
|
||||
//
|
||||
this.btnAddLogic.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.btnAddLogic.Appearance.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
||||
this.btnAddLogic.Appearance.Options.UseFont = true;
|
||||
this.btnAddLogic.Enabled = false;
|
||||
this.btnAddLogic.Location = new System.Drawing.Point(558, 6);
|
||||
this.btnAddLogic.Name = "btnAddLogic";
|
||||
this.btnAddLogic.Size = new System.Drawing.Size(58, 26);
|
||||
this.btnAddLogic.TabIndex = 35;
|
||||
this.btnAddLogic.Text = "增加(&A)";
|
||||
//
|
||||
// btnDeleteLogic
|
||||
//
|
||||
this.btnDeleteLogic.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.btnDeleteLogic.Appearance.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
||||
this.btnDeleteLogic.Appearance.Options.UseFont = true;
|
||||
this.btnDeleteLogic.Enabled = false;
|
||||
this.btnDeleteLogic.Location = new System.Drawing.Point(622, 6);
|
||||
this.btnDeleteLogic.Name = "btnDeleteLogic";
|
||||
this.btnDeleteLogic.Size = new System.Drawing.Size(62, 26);
|
||||
this.btnDeleteLogic.TabIndex = 36;
|
||||
this.btnDeleteLogic.Text = "删除(&D)";
|
||||
//
|
||||
// btnSave
|
||||
//
|
||||
this.btnSave.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.btnSave.Appearance.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
||||
this.btnSave.Appearance.Options.UseFont = true;
|
||||
this.btnSave.Location = new System.Drawing.Point(690, 6);
|
||||
this.btnSave.Name = "btnSave";
|
||||
this.btnSave.Size = new System.Drawing.Size(62, 26);
|
||||
this.btnSave.TabIndex = 37;
|
||||
this.btnSave.Text = "保存(&S)";
|
||||
//
|
||||
// pnlDesignerHeader
|
||||
//
|
||||
this.pnlDesignerHeader.Appearance.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(245)))), ((int)(((byte)(248)))), ((int)(((byte)(250)))));
|
||||
this.pnlDesignerHeader.Appearance.Options.UseBackColor = true;
|
||||
this.pnlDesignerHeader.BorderStyle = DevExpress.XtraEditors.Controls.BorderStyles.NoBorder;
|
||||
this.pnlDesignerHeader.Controls.Add(this.btnDeleteScheme);
|
||||
this.pnlDesignerHeader.Controls.Add(this.btnGenerateCode);
|
||||
this.pnlDesignerHeader.Controls.Add(this.txtCodePreview);
|
||||
this.pnlDesignerHeader.Controls.Add(this.lblCodePreview);
|
||||
this.pnlDesignerHeader.Controls.Add(this.txtSchemeName);
|
||||
this.pnlDesignerHeader.Controls.Add(this.label1);
|
||||
this.pnlDesignerHeader.Dock = System.Windows.Forms.DockStyle.Top;
|
||||
this.pnlDesignerHeader.Location = new System.Drawing.Point(0, 0);
|
||||
this.pnlDesignerHeader.Name = "pnlDesignerHeader";
|
||||
this.pnlDesignerHeader.Padding = new System.Windows.Forms.Padding(10, 0, 0, 0);
|
||||
this.pnlDesignerHeader.Size = new System.Drawing.Size(760, 38);
|
||||
this.pnlDesignerHeader.TabIndex = 0;
|
||||
//
|
||||
// btnDeleteScheme
|
||||
//
|
||||
this.btnDeleteScheme.Appearance.Font = new System.Drawing.Font("微软雅黑", 9F);
|
||||
this.btnDeleteScheme.Appearance.Options.UseFont = true;
|
||||
this.btnDeleteScheme.Enabled = false;
|
||||
this.btnDeleteScheme.Location = new System.Drawing.Point(280, 6);
|
||||
this.btnDeleteScheme.Name = "btnDeleteScheme";
|
||||
this.btnDeleteScheme.Size = new System.Drawing.Size(72, 26);
|
||||
this.btnDeleteScheme.TabIndex = 5;
|
||||
this.btnDeleteScheme.Text = "删除方案";
|
||||
//
|
||||
// btnGenerateCode
|
||||
//
|
||||
this.btnGenerateCode.Appearance.Font = new System.Drawing.Font("微软雅黑", 9F);
|
||||
this.btnGenerateCode.Appearance.Options.UseFont = true;
|
||||
this.btnGenerateCode.Enabled = false;
|
||||
this.btnGenerateCode.Location = new System.Drawing.Point(620, 6);
|
||||
this.btnGenerateCode.Name = "btnGenerateCode";
|
||||
this.btnGenerateCode.Size = new System.Drawing.Size(72, 24);
|
||||
this.btnGenerateCode.TabIndex = 8;
|
||||
this.btnGenerateCode.Text = "生成编码";
|
||||
this.btnGenerateCode.Visible = false;
|
||||
//
|
||||
// txtCodePreview
|
||||
//
|
||||
this.txtCodePreview.Location = new System.Drawing.Point(372, 6);
|
||||
this.txtCodePreview.Margin = new System.Windows.Forms.Padding(0);
|
||||
this.txtCodePreview.Name = "txtCodePreview";
|
||||
this.txtCodePreview.Properties.Appearance.BackColor = System.Drawing.Color.White;
|
||||
this.txtCodePreview.Properties.Appearance.Font = new System.Drawing.Font("微软雅黑", 9F);
|
||||
this.txtCodePreview.Properties.Appearance.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(42)))), ((int)(((byte)(54)))), ((int)(((byte)(66)))));
|
||||
this.txtCodePreview.Properties.Appearance.Options.UseBackColor = true;
|
||||
this.txtCodePreview.Properties.Appearance.Options.UseFont = true;
|
||||
this.txtCodePreview.Properties.Appearance.Options.UseForeColor = true;
|
||||
this.txtCodePreview.Properties.BorderStyle = DevExpress.XtraEditors.Controls.BorderStyles.Simple;
|
||||
this.txtCodePreview.Properties.ReadOnly = true;
|
||||
this.txtCodePreview.Size = new System.Drawing.Size(240, 24);
|
||||
this.txtCodePreview.TabIndex = 7;
|
||||
this.txtCodePreview.Visible = false;
|
||||
//
|
||||
// lblCodePreview
|
||||
//
|
||||
this.lblCodePreview.Appearance.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(245)))), ((int)(((byte)(248)))), ((int)(((byte)(250)))));
|
||||
this.lblCodePreview.Appearance.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Bold);
|
||||
this.lblCodePreview.Appearance.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(38)))), ((int)(((byte)(73)))), ((int)(((byte)(98)))));
|
||||
this.lblCodePreview.Appearance.TextOptions.HAlignment = DevExpress.Utils.HorzAlignment.Near;
|
||||
this.lblCodePreview.Appearance.TextOptions.VAlignment = DevExpress.Utils.VertAlignment.Center;
|
||||
this.lblCodePreview.AutoSizeMode = DevExpress.XtraEditors.LabelAutoSizeMode.None;
|
||||
this.lblCodePreview.Location = new System.Drawing.Point(292, 0);
|
||||
this.lblCodePreview.Name = "lblCodePreview";
|
||||
this.lblCodePreview.Size = new System.Drawing.Size(78, 38);
|
||||
this.lblCodePreview.TabIndex = 6;
|
||||
this.lblCodePreview.Text = "编码预览:";
|
||||
this.lblCodePreview.Visible = false;
|
||||
//
|
||||
// txtSchemeName
|
||||
//
|
||||
this.txtSchemeName.Enabled = false;
|
||||
this.txtSchemeName.Location = new System.Drawing.Point(85, 6);
|
||||
this.txtSchemeName.Margin = new System.Windows.Forms.Padding(0);
|
||||
this.txtSchemeName.Name = "txtSchemeName";
|
||||
this.txtSchemeName.Properties.Appearance.Font = new System.Drawing.Font("微软雅黑", 9F);
|
||||
this.txtSchemeName.Properties.Appearance.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(42)))), ((int)(((byte)(54)))), ((int)(((byte)(66)))));
|
||||
this.txtSchemeName.Properties.Appearance.Options.UseFont = true;
|
||||
this.txtSchemeName.Properties.Appearance.Options.UseForeColor = true;
|
||||
this.txtSchemeName.Properties.BorderStyle = DevExpress.XtraEditors.Controls.BorderStyles.Simple;
|
||||
this.txtSchemeName.Size = new System.Drawing.Size(188, 24);
|
||||
this.txtSchemeName.TabIndex = 4;
|
||||
//
|
||||
// label1
|
||||
//
|
||||
this.label1.Appearance.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(245)))), ((int)(((byte)(248)))), ((int)(((byte)(250)))));
|
||||
this.label1.Appearance.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Bold);
|
||||
this.label1.Appearance.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(38)))), ((int)(((byte)(73)))), ((int)(((byte)(98)))));
|
||||
this.label1.Appearance.TextOptions.HAlignment = DevExpress.Utils.HorzAlignment.Near;
|
||||
this.label1.Appearance.TextOptions.VAlignment = DevExpress.Utils.VertAlignment.Center;
|
||||
this.label1.AutoSizeMode = DevExpress.XtraEditors.LabelAutoSizeMode.None;
|
||||
this.label1.Dock = System.Windows.Forms.DockStyle.Left;
|
||||
this.label1.Location = new System.Drawing.Point(10, 0);
|
||||
this.label1.Name = "label1";
|
||||
this.label1.Size = new System.Drawing.Size(72, 38);
|
||||
this.label1.TabIndex = 3;
|
||||
this.label1.Text = "方案名称:";
|
||||
//
|
||||
// cmsMenuTree
|
||||
//
|
||||
this.cmsMenuTree.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||
this.menuAddScheme});
|
||||
this.cmsMenuTree.Name = "cmsMenuTree";
|
||||
this.cmsMenuTree.Size = new System.Drawing.Size(125, 26);
|
||||
//
|
||||
// menuAddScheme
|
||||
//
|
||||
this.menuAddScheme.Name = "menuAddScheme";
|
||||
this.menuAddScheme.Size = new System.Drawing.Size(124, 22);
|
||||
this.menuAddScheme.Text = "添加方案";
|
||||
//
|
||||
// lblDesignerStatus
|
||||
//
|
||||
this.lblDesignerStatus.Appearance.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(245)))), ((int)(((byte)(248)))), ((int)(((byte)(250)))));
|
||||
this.lblDesignerStatus.Appearance.Font = new System.Drawing.Font("微软雅黑", 9F);
|
||||
this.lblDesignerStatus.Appearance.ForeColor = System.Drawing.Color.DimGray;
|
||||
this.lblDesignerStatus.Appearance.TextOptions.HAlignment = DevExpress.Utils.HorzAlignment.Near;
|
||||
this.lblDesignerStatus.Appearance.TextOptions.VAlignment = DevExpress.Utils.VertAlignment.Center;
|
||||
this.lblDesignerStatus.AutoSizeMode = DevExpress.XtraEditors.LabelAutoSizeMode.None;
|
||||
this.lblDesignerStatus.Dock = System.Windows.Forms.DockStyle.Bottom;
|
||||
this.lblDesignerStatus.Location = new System.Drawing.Point(0, 655);
|
||||
this.lblDesignerStatus.Name = "lblDesignerStatus";
|
||||
this.lblDesignerStatus.Padding = new System.Windows.Forms.Padding(10, 0, 0, 0);
|
||||
this.lblDesignerStatus.Size = new System.Drawing.Size(560, 26);
|
||||
this.lblDesignerStatus.TabIndex = 2;
|
||||
this.lblDesignerStatus.Text = "请选择左侧末级菜单并添加方案";
|
||||
this.lblDesignerStatus.Visible = false;
|
||||
//
|
||||
// FrmMain
|
||||
//
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
|
||||
this.BackColor = System.Drawing.SystemColors.Control;
|
||||
this.ClientSize = new System.Drawing.Size(1297, 681);
|
||||
this.Controls.Add(this.splitRoot);
|
||||
this.Name = "FrmMain";
|
||||
this.Text = "编码生成设计";
|
||||
((System.ComponentModel.ISupportInitialize)(this.splitRoot)).EndInit();
|
||||
this.splitRoot.ResumeLayout(false);
|
||||
((System.ComponentModel.ISupportInitialize)(this.pnlTreeHost)).EndInit();
|
||||
this.pnlTreeHost.ResumeLayout(false);
|
||||
((System.ComponentModel.ISupportInitialize)(this.treeMenu)).EndInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.pnlLeftHeader)).EndInit();
|
||||
this.pnlLeftHeader.ResumeLayout(false);
|
||||
((System.ComponentModel.ISupportInitialize)(this.pnlDesignWork)).EndInit();
|
||||
this.pnlDesignWork.ResumeLayout(false);
|
||||
((System.ComponentModel.ISupportInitialize)(this.pnlDesignGridHeader)).EndInit();
|
||||
this.pnlDesignGridHeader.ResumeLayout(false);
|
||||
((System.ComponentModel.ISupportInitialize)(this.pnlBindModule)).EndInit();
|
||||
this.pnlBindModule.ResumeLayout(false);
|
||||
((System.ComponentModel.ISupportInitialize)(this.cboBindLevel3.Properties)).EndInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.cboBindLevel2.Properties)).EndInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.cboBindLevel1.Properties)).EndInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.chkBindModule.Properties)).EndInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.pl_buttom)).EndInit();
|
||||
this.pl_buttom.ResumeLayout(false);
|
||||
((System.ComponentModel.ISupportInitialize)(this.pnlDesignerHeader)).EndInit();
|
||||
this.pnlDesignerHeader.ResumeLayout(false);
|
||||
((System.ComponentModel.ISupportInitialize)(this.txtCodePreview.Properties)).EndInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.txtSchemeName.Properties)).EndInit();
|
||||
this.cmsMenuTree.ResumeLayout(false);
|
||||
this.ResumeLayout(false);
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private DevExpress.XtraEditors.SplitContainerControl splitRoot;
|
||||
private DevExpress.XtraEditors.PanelControl pnlLeftHeader;
|
||||
private DevExpress.XtraEditors.PanelControl pnlTreeHost;
|
||||
private System.Windows.Forms.ImageList imgMenuTree;
|
||||
private System.Windows.Forms.ContextMenuStrip cmsMenuTree;
|
||||
private System.Windows.Forms.ToolStripMenuItem menuAddScheme;
|
||||
private DevExpress.XtraEditors.PanelControl pnlDesignerHeader;
|
||||
private DevExpress.XtraEditors.LabelControl lblDesignerStatus;
|
||||
private DevExpress.XtraEditors.PanelControl pl_buttom;
|
||||
private DevExpress.XtraEditors.SimpleButton btnSave;
|
||||
private DevExpress.XtraEditors.SimpleButton btnDeleteScheme;
|
||||
private DevExpress.XtraEditors.SimpleButton btnGenerateCode;
|
||||
private DevExpress.XtraEditors.TextEdit txtCodePreview;
|
||||
private DevExpress.XtraEditors.LabelControl lblCodePreview;
|
||||
private DevExpress.XtraTreeList.TreeList treeMenu;
|
||||
private DevExpress.XtraTreeList.Columns.TreeListColumn treeColumnMenu;
|
||||
private DevExpress.XtraEditors.TextEdit txtSchemeName;
|
||||
private DevExpress.XtraEditors.LabelControl label1;
|
||||
private DevExpress.XtraEditors.LabelControl lblMenuTitle;
|
||||
private DevExpress.XtraEditors.XtraScrollableControl pnlViewWork;
|
||||
private DevExpress.XtraEditors.PanelControl pnlDesignWork;
|
||||
private Lskj.PubCodeDesign.CodeDesignModuleGridEx gridDesignRules;
|
||||
private DevExpress.XtraEditors.PanelControl pnlDesignGridHeader;
|
||||
private DevExpress.XtraEditors.LabelControl lblDesignGridTitle;
|
||||
private DevExpress.XtraEditors.PanelControl pnlBindModule;
|
||||
private DevExpress.XtraEditors.ComboBoxEdit cboBindLevel3;
|
||||
private DevExpress.XtraEditors.LabelControl lblBindLevel3;
|
||||
private DevExpress.XtraEditors.ComboBoxEdit cboBindLevel2;
|
||||
private DevExpress.XtraEditors.LabelControl lblBindLevel2;
|
||||
private DevExpress.XtraEditors.ComboBoxEdit cboBindLevel1;
|
||||
private DevExpress.XtraEditors.LabelControl lblBindLevel1;
|
||||
private DevExpress.XtraEditors.CheckEdit chkBindModule;
|
||||
private DevExpress.XtraEditors.SimpleButton btnAddLogic;
|
||||
private DevExpress.XtraEditors.SimpleButton btnDeleteLogic;
|
||||
}
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,126 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<metadata name="imgMenuTree.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>17, 17</value>
|
||||
</metadata>
|
||||
<metadata name="cmsMenuTree.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>151, 17</value>
|
||||
</metadata>
|
||||
</root>
|
||||
@@ -0,0 +1,134 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProductVersion>8.0.30703</ProductVersion>
|
||||
<SchemaVersion>2.0</SchemaVersion>
|
||||
<ProjectGuid>{552308D8-450C-4ECA-9A3E-543AF0F8E150}</ProjectGuid>
|
||||
<OutputType>Library</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>Lskj.PubCodeDesign</RootNamespace>
|
||||
<AssemblyName>Lskj.PubCodeDesign</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<PlatformTarget>x86</PlatformTarget>
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>..\..\Debug\Lib\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<DocumentationFile>..\..\Debug\AllMethodXml\Lskj.PubCodeDesign.XML</DocumentationFile>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<PlatformTarget>x86</PlatformTarget>
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<StartupObject />
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="Newtonsoft.Json, Version=13.0.1.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\..\引用DLL\Newtonsoft.Json.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="DevExpress.Data.v15.2, Version=15.2.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
</Reference>
|
||||
<Reference Include="DevExpress.Utils.v15.2, Version=15.2.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
</Reference>
|
||||
<Reference Include="DevExpress.XtraEditors.v15.2, Version=15.2.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
</Reference>
|
||||
<Reference Include="DevExpress.XtraGrid.v15.2, Version=15.2.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
</Reference>
|
||||
<Reference Include="DevExpress.XtraTreeList.v15.2, Version=15.2.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.Xml.Linq" />
|
||||
<Reference Include="System.Data.DataSetExtensions" />
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Deployment" />
|
||||
<Reference Include="System.Drawing" />
|
||||
<Reference Include="System.Windows.Forms" />
|
||||
<Reference Include="System.Xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="CodeDesignModuleGridEx.cs">
|
||||
<SubType>UserControl</SubType>
|
||||
</Compile>
|
||||
<Compile Include="DllBaseClass.cs" />
|
||||
<Compile Include="FrmMain.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
<Compile Include="CodeSchemeModels.cs" />
|
||||
<Compile Include="CodeSchemeStorage.cs" />
|
||||
<Compile Include="FrmMain.Designer.cs">
|
||||
<DependentUpon>FrmMain.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<EmbeddedResource Include="FrmMain.resx">
|
||||
<DependentUpon>FrmMain.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="Properties\licenses.licx" />
|
||||
<EmbeddedResource Include="Properties\Resources.resx">
|
||||
<Generator>ResXFileCodeGenerator</Generator>
|
||||
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
|
||||
<SubType>Designer</SubType>
|
||||
</EmbeddedResource>
|
||||
<Compile Include="Properties\Resources.Designer.cs">
|
||||
<AutoGen>True</AutoGen>
|
||||
<DependentUpon>Resources.resx</DependentUpon>
|
||||
</Compile>
|
||||
<None Include="Properties\Settings.settings">
|
||||
<Generator>SettingsSingleFileGenerator</Generator>
|
||||
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
|
||||
</None>
|
||||
<Compile Include="Properties\Settings.Designer.cs">
|
||||
<AutoGen>True</AutoGen>
|
||||
<DependentUpon>Settings.settings</DependentUpon>
|
||||
<DesignTimeSharedInput>True</DesignTimeSharedInput>
|
||||
</Compile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\Lskj.Business\Lskj.Business.csproj">
|
||||
<Project>{7eafccc2-a18f-49e9-85c6-a984966cfd01}</Project>
|
||||
<Name>Lskj.Business</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\Lskj.Control\Lskj.Control.csproj">
|
||||
<Project>{447cdc40-659f-4cca-9ed6-8e818b4cf8bf}</Project>
|
||||
<Name>Lskj.Control</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\Lskj.Core\Lskj.Core.csproj">
|
||||
<Project>{2a1be6ac-1077-491b-a754-c5822fe8121e}</Project>
|
||||
<Name>Lskj.Core</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\Lskj.Main\Lskj.Main.csproj">
|
||||
<Project>{BCA1E2B3-C4AB-4D2C-B519-3DCFDB5B83D6}</Project>
|
||||
<Name>Lskj.Main</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\Lskj.Model\Lskj.Model.csproj">
|
||||
<Project>{52bc40e0-c0c6-4f78-996b-cae028d209ca}</Project>
|
||||
<Name>Lskj.Model</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\Lskj.Util\Lskj.Util.csproj">
|
||||
<Project>{a51bf642-6543-4de3-8948-83f558b72bd4}</Project>
|
||||
<Name>Lskj.Util</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
</Project>
|
||||
@@ -0,0 +1,36 @@
|
||||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
// 有关程序集的一般信息由以下
|
||||
// 控制。更改这些特性值可修改
|
||||
// 与程序集关联的信息。
|
||||
[assembly: AssemblyTitle("Lskj.PubCodeDesign")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("")]
|
||||
[assembly: AssemblyProduct("Lskj.PubCodeDesign")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2026")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
// 将 ComVisible 设置为 false 会使此程序集中的类型
|
||||
//对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型
|
||||
//请将此类型的 ComVisible 特性设置为 true。
|
||||
[assembly: ComVisible(false)]
|
||||
|
||||
// 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID
|
||||
[assembly: Guid("552308d8-450c-4eca-9a3e-543af0f8e150")]
|
||||
|
||||
// 程序集的版本信息由下列四个值组成:
|
||||
//
|
||||
// 主版本
|
||||
// 次版本
|
||||
// 生成号
|
||||
// 修订号
|
||||
//
|
||||
//可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值
|
||||
//通过使用 "*",如下所示:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("1.0.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
||||
@@ -0,0 +1,70 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// 此代码由工具生成。
|
||||
// 运行时版本: 4.0.30319.42000
|
||||
//
|
||||
// 对此文件的更改可能导致不正确的行为,如果
|
||||
// 重新生成代码,则所做更改将丢失。
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
|
||||
namespace Lskj.PubCodeDesign.Properties
|
||||
{
|
||||
/// <summary>
|
||||
/// 强类型资源类,用于查找本地化字符串等。
|
||||
/// </summary>
|
||||
// 此类是由 StronglyTypedResourceBuilder
|
||||
// 类通过类似于 ResGen 或 Visual Studio 的工具自动生成的。
|
||||
// 若要添加或删除成员,请编辑 .ResX 文件,然后重新运行 ResGen
|
||||
// (以 /str 作为命令选项),或重新生成 VS 项目。
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||
internal class Resources
|
||||
{
|
||||
|
||||
private static global::System.Resources.ResourceManager resourceMan;
|
||||
|
||||
private static global::System.Globalization.CultureInfo resourceCulture;
|
||||
|
||||
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
|
||||
internal Resources()
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 返回此类使用的缓存 ResourceManager 实例。
|
||||
/// </summary>
|
||||
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
||||
internal static global::System.Resources.ResourceManager ResourceManager
|
||||
{
|
||||
get
|
||||
{
|
||||
if ((resourceMan == null))
|
||||
{
|
||||
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Lskj.PubCodeDesign.Properties.Resources", typeof(Resources).Assembly);
|
||||
resourceMan = temp;
|
||||
}
|
||||
return resourceMan;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 重写当前线程的 CurrentUICulture 属性,对
|
||||
/// 使用此强类型资源类的所有资源查找执行重写。
|
||||
/// </summary>
|
||||
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
||||
internal static global::System.Globalization.CultureInfo Culture
|
||||
{
|
||||
get
|
||||
{
|
||||
return resourceCulture;
|
||||
}
|
||||
set
|
||||
{
|
||||
resourceCulture = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,117 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
</root>
|
||||
@@ -0,0 +1,29 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by a tool.
|
||||
// Runtime Version:4.0.30319.42000
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
|
||||
namespace Lskj.PubCodeDesign.Properties
|
||||
{
|
||||
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")]
|
||||
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase
|
||||
{
|
||||
|
||||
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
|
||||
|
||||
public static Settings Default
|
||||
{
|
||||
get
|
||||
{
|
||||
return defaultInstance;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
<?xml version='1.0' encoding='utf-8'?>
|
||||
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)">
|
||||
<Profiles>
|
||||
<Profile Name="(Default)" />
|
||||
</Profiles>
|
||||
<Settings />
|
||||
</SettingsFile>
|
||||
@@ -0,0 +1,4 @@
|
||||
DevExpress.XtraEditors.TextEdit, DevExpress.XtraEditors.v15.2, Version=15.2.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a
|
||||
DevExpress.XtraTreeList.TreeList, DevExpress.XtraTreeList.v15.2, Version=15.2.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a
|
||||
DevExpress.XtraEditors.CheckEdit, DevExpress.XtraEditors.v15.2, Version=15.2.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a
|
||||
DevExpress.XtraEditors.ComboBoxEdit, DevExpress.XtraEditors.v15.2, Version=15.2.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a
|
||||
@@ -106,6 +106,7 @@ namespace Lskj.PubMrpAnalyze
|
||||
/// 是否已经执行行改变事件并刷新明细数据
|
||||
/// </summary>
|
||||
private bool isFocusedRowChanged = true;
|
||||
private HashSet<GridView> mrpDragCopyViews = new HashSet<GridView>();
|
||||
#endregion
|
||||
public MrpAnalyzeMain()
|
||||
{
|
||||
@@ -659,6 +660,8 @@ namespace Lskj.PubMrpAnalyze
|
||||
this.gd_LeftBottom.SetGridViewDataSource(detailTable);
|
||||
}
|
||||
this.SetDetailGridDataSource();
|
||||
this.EnsureRightGridFocusedCellCopy(gridControlEx);
|
||||
this.RestoreRightGridCellSelection(gridControlEx);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
@@ -666,6 +669,83 @@ namespace Lskj.PubMrpAnalyze
|
||||
MessageUtil.Show(Message, ex.Message);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
private void EnsureRightGridFocusedCellCopy(GridControlEx gridControlEx)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (gridControlEx == null || gridControlEx.GridView == null) return;
|
||||
|
||||
GridView view = gridControlEx.GridView;
|
||||
if (mrpDragCopyViews.Contains(view)) return;
|
||||
|
||||
view.KeyDown += OnRightGridViewKeyDown;
|
||||
mrpDragCopyViews.Add(view);
|
||||
}
|
||||
catch
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
private void OnRightGridViewKeyDown(object sender, KeyEventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (!e.Control || e.KeyCode != Keys.C) return;
|
||||
|
||||
GridView view = sender as GridView;
|
||||
if (view == null || view.OptionsSelection.MultiSelectMode != GridMultiSelectMode.CellSelect) return;
|
||||
|
||||
var cells = view.GetSelectedCells();
|
||||
if (cells.Length != 0 || view.GetSelectedRows().Length == 0) return;
|
||||
if (view.FocusedRowHandle < 0 || view.FocusedColumn == null) return;
|
||||
|
||||
object obj = view.GetFocusedRowCellDisplayText(view.FocusedColumn);
|
||||
Clipboard.SetDataObject(obj == null ? string.Empty : obj + "");
|
||||
e.Handled = true;
|
||||
}
|
||||
catch
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
private void RestoreRightGridCellSelection(GridControlEx gridControlEx)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (gridControlEx == null || gridControlEx.GridView == null || gridControlEx.IsDisposed || !gridControlEx.IsHandleCreated) return;
|
||||
|
||||
gridControlEx.BeginInvoke(new Action(() =>
|
||||
{
|
||||
try
|
||||
{
|
||||
if (gridControlEx.IsDisposed || gridControlEx.GridView == null) return;
|
||||
|
||||
GridView view = gridControlEx.GridView;
|
||||
if (view.RowCount <= 0) return;
|
||||
|
||||
int rowHandle = view.FocusedRowHandle >= 0 ? view.FocusedRowHandle : 0;
|
||||
GridColumn column = view.FocusedColumn ?? view.VisibleColumns.FirstOrDefault();
|
||||
if (column == null) return;
|
||||
|
||||
view.ClearSelection();
|
||||
view.FocusedRowHandle = rowHandle;
|
||||
view.FocusedColumn = column;
|
||||
view.SelectCell(rowHandle, column);
|
||||
}
|
||||
catch
|
||||
{
|
||||
}
|
||||
}));
|
||||
}
|
||||
catch
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// <para>说明:数据行发生改变加载明细</para>
|
||||
/// <para>创建人:王一帆</para>
|
||||
|
||||
+2
@@ -109,6 +109,7 @@
|
||||
this.gridLeft.Name = "gridLeft";
|
||||
this.gridLeft.SiftEnumObj = Lskj.Control.GridControlEx.HeaderSiftEnum.Sum;
|
||||
this.gridLeft.Size = new System.Drawing.Size(250, 702);
|
||||
this.gridLeft.SysModel = null;
|
||||
this.gridLeft.TabIndex = 7;
|
||||
//
|
||||
// splitRightContainer
|
||||
@@ -265,6 +266,7 @@
|
||||
this.gcMain.Name = "gcMain";
|
||||
this.gcMain.SiftEnumObj = Lskj.Control.GridControlEx.HeaderSiftEnum.Sum;
|
||||
this.gcMain.Size = new System.Drawing.Size(1192, 215);
|
||||
this.gcMain.SysModel = null;
|
||||
this.gcMain.TabIndex = 0;
|
||||
//
|
||||
// plm_top_cond
|
||||
|
||||
@@ -76,6 +76,18 @@ namespace Lskj.PubProductSysMge
|
||||
/// </summary>
|
||||
private List<SysSetModel> ControlList = new List<SysSetModel>();
|
||||
/// <summary>
|
||||
/// 左侧树节点正在加载,防止连续点击重复进入加载流程。
|
||||
/// </summary>
|
||||
private bool _isTreeNodeLoading = false;
|
||||
/// <summary>
|
||||
/// 左侧树当前正在加载的节点,用于加载期间恢复选中状态。
|
||||
/// </summary>
|
||||
private TreeNode _loadingTreeNode = null;
|
||||
/// <summary>
|
||||
/// 程序内部切换方案下拉框时,屏蔽 SelectedIndexChanged 的嵌套加载。
|
||||
/// </summary>
|
||||
private bool _suppressProjectSelectedIndexChanged = false;
|
||||
/// <summary>
|
||||
/// 规格控件
|
||||
/// </summary>
|
||||
private BaseUserControl _SpecBaseControl;
|
||||
@@ -553,8 +565,9 @@ namespace Lskj.PubProductSysMge
|
||||
this.ControlList.Clear();
|
||||
try
|
||||
{
|
||||
if (projectComBoEdit.SelectedItem == "" || treeNode == null) return;
|
||||
string projectId = (projectComBoEdit.SelectedItem as ComboBoxModel).Value;
|
||||
ComboBoxModel selectedProject = projectComBoEdit.SelectedItem as ComboBoxModel;
|
||||
if (selectedProject == null || treeNode == null) return;
|
||||
string projectId = selectedProject.Value;
|
||||
if (treeNode != null && !string.IsNullOrEmpty(projectId))
|
||||
{
|
||||
DataTable dataTable = new DataTable();
|
||||
@@ -1004,6 +1017,11 @@ namespace Lskj.PubProductSysMge
|
||||
/// <param name="e"></param>
|
||||
private void OnProjectSelectedIndexChanged(object sender, EventArgs e)
|
||||
{
|
||||
if (_suppressProjectSelectedIndexChanged || _isTreeNodeLoading)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
WaitForm.ShowForm();
|
||||
try
|
||||
{
|
||||
@@ -1027,24 +1045,38 @@ namespace Lskj.PubProductSysMge
|
||||
/// <param name="e"></param>
|
||||
private void OnTreeLeftTreeNodeSelected(object sender, TreeNodeMouseClickEventArgs e)
|
||||
{
|
||||
WaitForm.ShowForm();
|
||||
if (e.Node == null)
|
||||
if (_isTreeNodeLoading)
|
||||
{
|
||||
MessageUtil.Show("请选择节点");
|
||||
if (_loadingTreeNode != null && this.treeLeftViewEx.TreeView.SelectedNode != _loadingTreeNode)
|
||||
{
|
||||
this.treeLeftViewEx.TreeView.SelectedNode = _loadingTreeNode;
|
||||
}
|
||||
return;
|
||||
}
|
||||
this.treeLeftViewEx.TreeView.SelectedNode = e.Node;
|
||||
string nodeName = this.treeLeftViewEx.TreeView.SelectedNode != null ? this.treeLeftViewEx.TreeView.SelectedNode.Name : "";
|
||||
this.speciesNoEdit.Text = "";
|
||||
this.speciesNameEdit.Text = "";
|
||||
//this.projectComBoEdit.Text = "";
|
||||
//this.projectComBoEdit.Tag = "";
|
||||
this.btnUpdate.Enabled = false;
|
||||
this.btnSave.Enabled = true;
|
||||
this.MainControlObj.ResetControlValue();
|
||||
this.pl_Top.Controls.Clear();
|
||||
this.ControlList.Clear();
|
||||
|
||||
_isTreeNodeLoading = true;
|
||||
_loadingTreeNode = e.Node;
|
||||
try
|
||||
{
|
||||
WaitForm.ShowForm();
|
||||
if (e.Node == null)
|
||||
{
|
||||
MessageUtil.Show("请选择节点");
|
||||
return;
|
||||
}
|
||||
this.treeLeftViewEx.TreeView.SelectedNode = e.Node;
|
||||
string nodeName = this.treeLeftViewEx.TreeView.SelectedNode != null ? this.treeLeftViewEx.TreeView.SelectedNode.Name : "";
|
||||
this.speciesNoEdit.Text = "";
|
||||
this.speciesNameEdit.Text = "";
|
||||
//this.projectComBoEdit.Text = "";
|
||||
//this.projectComBoEdit.Tag = "";
|
||||
this.btnUpdate.Enabled = false;
|
||||
this.btnSave.Enabled = true;
|
||||
this.MainControlObj.ResetControlValue();
|
||||
//this.pl_Top.Controls.Clear();
|
||||
this.DisposeTopControls();
|
||||
this.ControlList.Clear();
|
||||
|
||||
//string projectId = MainImpl.GetResult(string.Format("select BmFaID from P_ProductSpeciesTab where speciesno = '{0}'", e.Node.Name)) + "";
|
||||
//string projectName = MainImpl.GetResult(string.Format("select ItemName from p_productsyssetGrouptab where id = '{0}'", projectId)) + "";
|
||||
string sql = "select id,ItemName from p_productsyssetGrouptab where speciesno = '{0}'";
|
||||
@@ -1055,23 +1087,40 @@ namespace Lskj.PubProductSysMge
|
||||
this.speciesNameEdit.Text = e.Node.Text;
|
||||
//this.projectComBoEdit.Text = projectName;
|
||||
//this.projectComBoEdit.Tag = projectId;
|
||||
this.projectComBoEdit.Text = "";
|
||||
this.projectComBoEdit.Properties.Items.Clear();
|
||||
if (e.Node.Nodes.Count == 0)
|
||||
bool hasProjectItem = false;
|
||||
_suppressProjectSelectedIndexChanged = true;
|
||||
try
|
||||
{
|
||||
foreach (DataRow item in dataTable.Rows)
|
||||
this.projectComBoEdit.Text = "";
|
||||
this.projectComBoEdit.Properties.Items.Clear();
|
||||
if (e.Node.Nodes.Count == 0)
|
||||
{
|
||||
|
||||
ComboBoxModel comboBoxModel = new ComboBoxModel(item)
|
||||
foreach (DataRow item in dataTable.Rows)
|
||||
{
|
||||
ValueMember = dataTable.Columns[0].ColumnName,
|
||||
DisplayMember = dataTable.Columns[1].ColumnName,
|
||||
};
|
||||
this.projectComBoEdit.Properties.Items.Add(comboBoxModel);
|
||||
|
||||
ComboBoxModel comboBoxModel = new ComboBoxModel(item)
|
||||
{
|
||||
ValueMember = dataTable.Columns[0].ColumnName,
|
||||
DisplayMember = dataTable.Columns[1].ColumnName,
|
||||
};
|
||||
this.projectComBoEdit.Properties.Items.Add(comboBoxModel);
|
||||
}
|
||||
if (this.projectComBoEdit.Properties.Items.Count > 0)
|
||||
{
|
||||
this.projectComBoEdit.SelectedIndex = 0;
|
||||
hasProjectItem = true;
|
||||
}
|
||||
}
|
||||
this.projectComBoEdit.SelectedIndex = 0;
|
||||
}
|
||||
//SetDynamicControl(e.Node);
|
||||
finally
|
||||
{
|
||||
_suppressProjectSelectedIndexChanged = false;
|
||||
}
|
||||
|
||||
if (hasProjectItem)
|
||||
{
|
||||
SetDynamicControl(e.Node);
|
||||
}
|
||||
string where = null;
|
||||
if (string.IsNullOrWhiteSpace(this.ParentUnionField))
|
||||
{
|
||||
@@ -1099,9 +1148,34 @@ namespace Lskj.PubProductSysMge
|
||||
}
|
||||
finally
|
||||
{
|
||||
_loadingTreeNode = null;
|
||||
_isTreeNodeLoading = false;
|
||||
WaitForm.HideForm();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 清空并释放顶部动态控件,避免 Controls.Clear 只移除不释放导致资源累积。
|
||||
/// </summary>
|
||||
private void DisposeTopControls()
|
||||
{
|
||||
if (this.pl_Top == null || this.pl_Top.IsDisposed)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
for (int i = this.pl_Top.Controls.Count - 1; i >= 0; i--)
|
||||
{
|
||||
System.Windows.Forms.Control control = this.pl_Top.Controls[i];
|
||||
this.pl_Top.Controls.RemoveAt(i);
|
||||
control.Dispose();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 控件面板点击时切换焦点,实现隐藏弹出框
|
||||
/// </summary>
|
||||
|
||||
@@ -52,6 +52,11 @@ namespace Lskj.Util
|
||||
{
|
||||
DllFileName = "Lskj.PubBrowerXp.dll";
|
||||
}
|
||||
if (DllFileName.Equals("Lskj.PubCodeDesign1.dll"))
|
||||
{
|
||||
DllFileName = "Lskj.PubCodeDesign.dll";
|
||||
args = args.Concat(new string[] { "", "1" }).ToArray();
|
||||
}
|
||||
//DllFileName = "Lskj.PubTabDll.dll";
|
||||
string libPath = DllFileName.Trim().ToLower().Equals("lskj.pubbrowser.dll") ? PubUtil.AbsolutelyBrowserPath + DllFileName : PubUtil.AbsolutelyLibPath + DllFileName;
|
||||
Assembly _Assembly = Assembly.UnsafeLoadFrom(libPath);
|
||||
|
||||
@@ -36,10 +36,9 @@ namespace Lskj.Util
|
||||
{
|
||||
if (bytes == null) return null;
|
||||
using (System.IO.MemoryStream ms = new System.IO.MemoryStream(bytes))
|
||||
using (System.Drawing.Image sourceImage = System.Drawing.Image.FromStream(ms))
|
||||
{
|
||||
System.Drawing.Image returnImage = System.Drawing.Image.FromStream(ms);
|
||||
ms.Flush();
|
||||
return returnImage;
|
||||
return new Bitmap(sourceImage);
|
||||
}
|
||||
}
|
||||
catch (Exception)
|
||||
@@ -56,14 +55,9 @@ namespace Lskj.Util
|
||||
{
|
||||
try
|
||||
{
|
||||
FileStream fs = File.OpenRead(path); //OpenRead
|
||||
int filelength = 0;
|
||||
filelength = (int)fs.Length; //获得文件长度
|
||||
Byte[] image = new Byte[filelength]; //建立一个字节数组
|
||||
fs.Read(image, 0, filelength); //按字节流读取
|
||||
System.Drawing.Image result = System.Drawing.Image.FromStream(fs);
|
||||
fs.Close();
|
||||
return result;
|
||||
if (string.IsNullOrWhiteSpace(path) || !File.Exists(path)) return null;
|
||||
byte[] image = File.ReadAllBytes(path);
|
||||
return ReadImage(image);
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
|
||||
@@ -203,6 +203,21 @@ namespace Lskj.Util
|
||||
{
|
||||
get { return BitMapPath + "Main/Module/"; }
|
||||
}
|
||||
/// <summary>
|
||||
/// 主界面左侧树图标路径
|
||||
/// </summary>
|
||||
public static string MainTreeviewImagePath
|
||||
{
|
||||
get
|
||||
{
|
||||
string path = BitMapPath + "Main\\MainTreeview\\";
|
||||
if (!Directory.Exists(path))
|
||||
{
|
||||
Directory.CreateDirectory(path);
|
||||
}
|
||||
return path;
|
||||
}
|
||||
}
|
||||
public static string MesItemImage
|
||||
{
|
||||
get { return BitMapPath + "MesItem/"; }
|
||||
|
||||
Reference in New Issue
Block a user