SVN r1159

SVN-Revision: r1159
This commit is contained in:
tdx
2026-04-23 09:09:17 +00:00
parent 8265c719ad
commit 951e59ea26
+107 -118
View File
@@ -4,6 +4,7 @@ using DevExpress.XtraGrid;
using DevExpress.XtraGrid.Views.Grid;
using DevExpress.XtraGrid.Views.Layout;
using DevExpress.XtraTab;
using Kdbndp;
using Lskj.Business;
using Lskj.Business.Impl;
using Lskj.Core;
@@ -157,10 +158,7 @@ namespace Lskj.Control.Model
///单据特殊模块id(单据来源控件)
/// </summary>
public string BillSourceControlId = string.Empty;
/// <summary>
///特殊左侧表
/// </summary>
public GridControlEx SpecialLeftTable;
/// <summary>
/// 执行查询之前验证
@@ -863,10 +861,6 @@ namespace Lskj.Control.Model
{
return BaseImpl.GetDefaultValue(item["defaultValue"] + "", ParentKey, OtherParams);
}));
Task<string> LookupSqlTask = cachesDic.AddTask(item, "LookupSql", new Task<string>(() =>
{
return BaseImpl.SpecialReplacement(item["lookupSql"] + "", OtherParams);
}));
Task<ControlModel> controlModelTask = cachesDic.AddTask(item, "ControlModel", new Task<ControlModel>(() =>
{
ControlModel controlModel = GetControlModel(item);//获取控件对象
@@ -1263,10 +1257,6 @@ namespace Lskj.Control.Model
{
return BaseImpl.GetDefaultValue(item["defaultValue"] + "", ParentKey, OtherParams);
}));
Task<string> LookupSqlTask = cachesDic.AddTask(item, "LookupSql", new Task<string>(() =>
{
return BaseImpl.SpecialReplacement(item["lookupSql"] + "", OtherParams);
}));
Task<ControlModel> controlModelTask = cachesDic.AddTask(item, "ControlModel", new Task<ControlModel>(() =>
{
ControlModel controlModel = GetControlModel(item);//获取控件对象
@@ -1596,8 +1586,6 @@ namespace Lskj.Control.Model
break;
case ControlType.LabCheckAutoSeacherValue:
case ControlType.LabCheckAutoSeacherText:
case ControlType.LabAutoCompleteCheckParamValue:
case ControlType.LabAutoCompleteCheckParamText:
// 带复选框自动搜索框
LabelCheckAutoTextEdit checkAutoTextEdit = ctr as LabelCheckAutoTextEdit;
checkAutoTextEdit.AutoTextEdit.SetDataSource(table);
@@ -1624,8 +1612,8 @@ namespace Lskj.Control.Model
LabelCheckText labelCheckText = ctr as LabelCheckText;
break;
case ControlType.LabBillSource:
LabelBillSourceComboxEdit billSourceComboxEdit = ctr as LabelBillSourceComboxEdit;
billSourceComboxEdit.SetDataSource(table);
//LabelBillSourceComboxEdit billSourceComboxEdit = ctr as LabelBillSourceComboxEdit;
//billSourceComboxEdit.SetDataSource(table);
break;
default:
break;
@@ -1654,7 +1642,6 @@ namespace Lskj.Control.Model
string defaultValue = this.SystemModel != null ? ReplaceHelper.ReplaceRowParam(this.SystemModel.maintabFocusedRow, model.DefaultValue) : model.DefaultValue;
SetControlValue(model, defaultValue);
}
}
//智能搜索框第一次加载时手动触发
if (changeLabelAutoGridLooks.Count > 0)
@@ -1705,7 +1692,7 @@ namespace Lskj.Control.Model
/// </summary>
/// <param name="rowItem">The row item.</param>
/// <returns><c>true</c> if XXXX, <c>false</c> otherwise.</returns>
public void CopyControlValue(bool Association = true,bool refreshSearchSource = false)
public void CopyControlValue(bool refreshSearchSource = false)
{
try
{
@@ -1771,19 +1758,15 @@ namespace Lskj.Control.Model
}
}
if (Association)
foreach (ControlModel model in this.ControlModels)
{
foreach (ControlModel model in this.ControlModels)
BaseUserControl control = FindControl(model);
// 树结构节点不清空数据
if (control != null && model.FieldType != ControlType.LabTreeType)
{
BaseUserControl control = FindControl(model);
// 树结构节点不清空数据
if (control != null && model.FieldType != ControlType.LabTreeType)
{
this.SetUnionAncCalcControl(control);
}
this.SetUnionAncCalcControl(control);
}
}
}
catch (Exception ex)
{
@@ -2136,8 +2119,6 @@ namespace Lskj.Control.Model
break;
case ControlType.LabCheckAutoSeacherValue:
case ControlType.LabCheckAutoSeacherText:
case ControlType.LabAutoCompleteCheckParamValue:
case ControlType.LabAutoCompleteCheckParamText:
// 带复选框自动搜索框
LabelCheckAutoTextEdit checkAutoTextEdit = ctr as LabelCheckAutoTextEdit;
if (checkAutoTextEdit.CheckEdit.Checked)
@@ -2895,8 +2876,8 @@ namespace Lskj.Control.Model
MessageUtil.Show(ResourceKeys.NotSettingTableName);
return false;
}
string Autogrowcolumn = BaseImpl.GetResult(string.Format("SELECT COLUMN_NAME FROM INFORMATION_SCHEMA.columns WHERE TABLE_NAME='{0}' AND COLUMNPROPERTY(OBJECT_ID('{0}'),COLUMN_NAME,'IsIdentity')=1", tableName)) + "";
DataTable DatabasePropertySheet = BaseImpl.GetDataTableResult(string.Format("select COLUMN_NAME,DATA_TYPE,CHARACTER_MAXIMUM_LENGTH from information_schema.columns where table_name = '{0}'", tableName));//数据库属性表
string Autogrowcolumn = MainImpl.GetAutogrowcolumn(tableName);
DataTable DatabasePropertySheet = MainImpl.GetDatabaseProperty(tableName);//数据库属性表
string SaveErrorMessage = string.Empty;
StringBuilder fieldBuilder = new StringBuilder();
StringBuilder valueBuilder = new StringBuilder();
@@ -2940,8 +2921,7 @@ namespace Lskj.Control.Model
leftField.Equals(model.FieldName) ||
"ID".Equals(model.FieldName, StringComparison.CurrentCultureIgnoreCase) ||
model.FieldType == ControlType.LabPic ||
model.FieldType == ControlType.LabPicEx ||
model.FieldType == ControlType.LabPrompt || !tableColumns.Columns.Contains(model.FieldName) ||
model.FieldType == ControlType.LabPicEx || !tableColumns.Columns.Contains(model.FieldName) ||
Autogrowcolumn.ToLower() == model.FieldName.ToLower())
continue;
string fieldValue = this.GetControlValue(model);
@@ -2983,8 +2963,7 @@ namespace Lskj.Control.Model
leftField.Equals(model.FieldName) ||
"ID".Equals(model.FieldName, StringComparison.CurrentCultureIgnoreCase) ||
model.FieldType == ControlType.LabPic ||
model.FieldType == ControlType.LabPicEx ||
model.FieldType == ControlType.LabPrompt || !tableColumns.Columns.Contains(model.FieldName) ||
model.FieldType == ControlType.LabPicEx || !tableColumns.Columns.Contains(model.FieldName) ||
Autogrowcolumn.ToLower() == model.FieldName.ToLower())
continue;
BaseUserControl userControl = this.FindControl(model);
@@ -3101,9 +3080,21 @@ namespace Lskj.Control.Model
HttpHelper.Post(deleteUrl, fileStream, null, deleteHeaderDic, out string deleteResult);
}
}
string postUrl = "{0}Api/FileUploadApi.ashx?moduleId={1}&idValue={2}&speciesno={8}&folder={3}&totsize={4}&position={5}&filename={6}&method={7}&comfirm=1";
postUrl = string.Format(postUrl, SystemInfo.Instance.OAUrl, Model.ModuleCode, HttpUtility.UrlEncode(idValue), "file", fileBytes.Length, 0, HttpUtility.UrlEncode(Path.GetFileName(filePath)), "DoWebUpload", speciesno);
bool isUpload = UploadFileUtil.UploadFile(token, postUrl, fileStream, out string fileId, out string rtnMsg);
string postUrl = SystemInfo.Instance.OAUrl + "Api/FileUploadApi.ashx?moduleId={0}&idValue={1}&speciesno={7}&folder={2}&totsize={3}&position={4}&filename={5}&method={6}&comfirm={8}&encode={9}&gzip=true&uploadToken={10}&__tsp={10}";
string fileId = "";
string rtnMsg = "";
bool isUpload = UploadFileUtil.UploadFile(
token,
postUrl,
filePath,
Model.ModuleCode,
idValue,
speciesno,
out fileId,
out rtnMsg
);
if (!isUpload)
{
throw new Exception($"自动上传失败\r\n{rtnMsg}");
@@ -3446,22 +3437,35 @@ namespace Lskj.Control.Model
// 窗口加载完成搜索,采用异步加载
_mainGridEx.Invoke((EventHandler)delegate
{
//if (this._mainGridEx.AdapterObj == null)
//{
// this.GridRowCount = this._mainGridEx.SetGridViewDataSource(MainImpl.GetAdapterResult(sqlValue));
//}
//else
//{
// DataTable dataTable = this._mainGridEx.GridControl.DataSource as DataTable;
// dataTable.PrimaryKey = new DataColumn[] { dataTable.Columns[this._mainGridEx.GridView.VisibleColumns[0].FieldName] };
// this._mainGridEx.AdapterObj.Fill(dataTable);
//}
this.GridRowCount = this._mainGridEx.SetGridViewDataSource(MainImpl.GetAdapterResult(sqlValue));
//this._mainGridEx.GridView.BestFitColumns();
});
}
else
{
if (_mainGridEx != null) this.GridRowCount = this._mainGridEx.SetGridViewDataSource(MainImpl.GetAdapterResult(sqlValue));
}
if (RememberRow)
{
if (this.GridRowCount <= oldRowHandle && SystemInfo.Instance.DeleteSelectedEndOf)
if (_mainGridEx != null)
{
oldRowHandle = this.GridRowCount - 1;
this.GridRowCount = this._mainGridEx.SetGridViewDataSource(MainImpl.GetAdapterResult(sqlValue));
}
SetFocusedRowHandle(oldRowHandle);
}
//if (RememberRow)
//{
// if (this.GridRowCount <= oldRowHandle && SystemInfo.Instance.DeleteSelectedEndOf)
// {
// oldRowHandle = this.GridRowCount - 1;
// }
// SetFocusedRowHandle(oldRowHandle);
//}
}
}
else
@@ -3576,10 +3580,6 @@ namespace Lskj.Control.Model
if (baseControl is LabelImageEdit)
{
LabelImageEdit imageEdit = baseControl as LabelImageEdit;
if (imageEdit.TextEdit.Image != null)
{
imageEdit.TextEdit.Image.Dispose();
}
imageEdit.LoadImage(controlValue + "");
}
else if (baseControl is LabelPictureEdit)
@@ -3962,7 +3962,7 @@ namespace Lskj.Control.Model
foreach (DataRow item in _schemes.Rows)
{
BarButtonItem bbi_item = new BarButtonItem();
bbi_item.Caption = Business.Impl.LanguageTranslation.Translatable ? Business.Impl.LanguageTranslation.GetTranslatedText(item["ProjectName"] + "") : item["ProjectName"] + "";
bbi_item.Caption = item["ProjectName"] + "";
bbi_item.Tag = item["SearchValue"] + "";
bbi_item.ItemClick += new ItemClickEventHandler(OnPopupItemClick);
@@ -3970,11 +3970,11 @@ namespace Lskj.Control.Model
}
BarButtonItem bbi_save = new BarButtonItem();
bbi_save.Caption = Business.Impl.LanguageTranslation.Translatable ? Business.Impl.LanguageTranslation.GetTranslatedText("保存方案") : "保存方案";
bbi_save.Caption = "保存方案";
bbi_save.ItemClick += new ItemClickEventHandler(OnPopupSaveItemClick);
BarButtonItem bbi_manager = new BarButtonItem();
bbi_manager.Caption = Business.Impl.LanguageTranslation.Translatable ? Business.Impl.LanguageTranslation.GetTranslatedText("方案管理") : "方案管理";
bbi_manager.Caption = "方案管理";
bbi_manager.ItemClick += new ItemClickEventHandler(OnPopupManagerItemClick);
_popupMenu.AddItem(bbi_save);
@@ -4026,7 +4026,13 @@ namespace Lskj.Control.Model
model.Default = item["defaultValue"] + "";
if (!dataCaches.GetValue(item, "DefaultValue", out string defaultValue))
{
defaultValue = BaseImpl.GetDefaultValue(item["defaultValue"] + "", ParentKey, OtherParams);
try
{
defaultValue = BaseImpl.GetDefaultValue(item["defaultValue"] + "", ParentKey, OtherParams);
}
catch (Exception ex)
{
}
}
model.DefaultValue = defaultValue;
model.Location = new Point(left, top);
@@ -4034,14 +4040,7 @@ namespace Lskj.Control.Model
model.Sign = item.Table.Columns.Contains("TM_tagID") && !string.IsNullOrEmpty(item["TM_tagID"] + "") ? Convert.ToInt32(item["TM_tagID"] + "") : 0;
model.TextMember = item["lookupResult"] + "";
model.ValueMember = item["lookupKeyField"] + "";
if (!dataCaches.GetValue(item, "LookupSql", out string lookupSql))
{
lookupSql=BaseImpl.SpecialReplacement(item["lookupSql"] + "",OtherParams);
}
//model.SourceSql = item["lookupSql"] + "";
model.SourceSql = lookupSql;
model.SourceSql = item["lookupSql"] + "";
model.NullText = item.Table.Columns.Contains("InputHintText") ? item["InputHintText"] + "" : string.Empty;
model.TabOrder = item.Table.Columns.Contains("TabOrder") && !string.IsNullOrEmpty(item["TabOrder"] + "") ? Convert.ToInt32(item["TabOrder"] + "") : 0;
model.CalcExpr = item.Table.Columns.Contains("CalcExpr") ? item["CalcExpr"] + "" : string.Empty;
@@ -4209,7 +4208,6 @@ namespace Lskj.Control.Model
{
dateEdit.TextEdit.Properties.VistaCalendarViewStyle = DevExpress.XtraEditors.VistaCalendarViewStyle.YearView;
}
baseControl = dateEdit;
break;
case ControlType.LabComboxValue:
@@ -4472,8 +4470,6 @@ namespace Lskj.Control.Model
break;
case ControlType.LabCheckAutoSeacherValue:
case ControlType.LabCheckAutoSeacherText:
case ControlType.LabAutoCompleteCheckParamValue:
case ControlType.LabAutoCompleteCheckParamText:
// 带复选框自动搜索框
LabelCheckAutoTextEdit checkAutoTextEdit = new LabelCheckAutoTextEdit();
checkAutoTextEdit.clickAfterEmpty = model.clickAfterEmpty;
@@ -4481,7 +4477,6 @@ namespace Lskj.Control.Model
checkAutoTextEdit.AutoTextEdit.ValueField = model.ValueMember;
checkAutoTextEdit.AutoTextEdit.TextField = model.TextMember;
//checkAutoTextEdit.AutoTextEdit.SetDataSource(dataSource);
if(ControlType.LabAutoCompleteCheckParamValue == model.FieldType || ControlType.LabAutoCompleteCheckParamText == model.FieldType) checkAutoTextEdit.TextEdit.ControlObj = this;
checkAutoTextEdit.TextEdit.SourceSQL = model.SourceSql;
checkAutoTextEdit.TextEdit.KeyDown += new KeyEventHandler(OnTextEditKeyDown);
@@ -4683,30 +4678,26 @@ namespace Lskj.Control.Model
baseControl = labApiButtonEdit;
break;
case ControlType.LabBillSource:
LabelBillSourceComboxEdit billSourceComboxEdit = new LabelBillSourceComboxEdit();
//LabelBillSourceComboxEdit billSourceComboxEdit = new LabelBillSourceComboxEdit();
billSourceComboxEdit.Button.Visible = true;
billSourceComboxEdit.OpenDocumentSource += new EventHandler(OpenDocumentSource);
//billSourceComboxEdit.Button.Visible = true;
//billSourceComboxEdit.OpenDocumentSource += new EventHandler(OpenDocumentSource);
billSourceComboxEdit.clickAfterEmpty = model.clickAfterEmpty;
billSourceComboxEdit.ValueMember = model.ValueMember;
billSourceComboxEdit.ValueField = model.ValueMember;
billSourceComboxEdit.TextField = model.TextMember;
billSourceComboxEdit.FormKey = model.FieldName + "_" + model.FormKey;
//billSourceComboxEdit.SetDataSource(dataSource);
billSourceComboxEdit.TextEdit.SourceSQL = model.SourceSql;
billSourceComboxEdit.TextEdit.SpeciesValue = ParentKey;
billSourceComboxEdit.TextEdit.ControlObj = this;
billSourceComboxEdit.TextEdit.KeyDown += new KeyEventHandler(OnTextEditKeyDown);
//billSourceComboxEdit.TextEdit.TextChanged += new EventHandler(GetAutoSearcher_HandleSQL);
//billSourceComboxEdit.TextEdit.TextChanged += new EventHandler(OnTextEditTextChanged);
billSourceComboxEdit.TextEdit.HiddenValueChange += new EventHandler(OnTextEditTextChanged);
if (!isLoadBorder) billSourceComboxEdit.TextEdit.BorderStyle = DevExpress.XtraEditors.Controls.BorderStyles.NoBorder;
baseControl = billSourceComboxEdit;
break;
case ControlType.LabPrompt:
LabelPrompt labelPrompt = new LabelPrompt();
baseControl = labelPrompt;
//billSourceComboxEdit.clickAfterEmpty = model.clickAfterEmpty;
//billSourceComboxEdit.ValueMember =model.ValueMember;
//billSourceComboxEdit.ValueField = model.ValueMember;
//billSourceComboxEdit.TextField = model.TextMember;
//billSourceComboxEdit.FormKey = model.FieldName + "_" + model.FormKey;
////billSourceComboxEdit.SetDataSource(dataSource);
//billSourceComboxEdit.TextEdit.SourceSQL = model.SourceSql;
//billSourceComboxEdit.TextEdit.SpeciesValue = ParentKey;
//billSourceComboxEdit.TextEdit.ControlObj = this;
//billSourceComboxEdit.TextEdit.KeyDown += new KeyEventHandler(OnTextEditKeyDown);
////billSourceComboxEdit.TextEdit.TextChanged += new EventHandler(GetAutoSearcher_HandleSQL);
////billSourceComboxEdit.TextEdit.TextChanged += new EventHandler(OnTextEditTextChanged);
//billSourceComboxEdit.TextEdit.HiddenValueChange += new EventHandler(OnTextEditTextChanged);
//if (!isLoadBorder) billSourceComboxEdit.TextEdit.BorderStyle = DevExpress.XtraEditors.Controls.BorderStyles.NoBorder;
//baseControl = billSourceComboxEdit;
break;
case ControlType.LabText:
case ControlType.LabTextInt:
@@ -4716,7 +4707,6 @@ namespace Lskj.Control.Model
LabelTextEdit textEdit = new LabelTextEdit();
if (model.FieldType == ControlType.LabTextInt)
{
textEdit.TextEdit.Tag = model;
textEdit.TextEdit.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.OnIntKeyPress);
textEdit.TextEdit.EditValueChanging += new DevExpress.XtraEditors.Controls.ChangingEventHandler(this.OnIntEditValueChanging);
}
@@ -4808,17 +4798,8 @@ namespace Lskj.Control.Model
private void OnIntEditValueChanging(object sender, DevExpress.XtraEditors.Controls.ChangingEventArgs e)
{
string newText = e.NewValue as string;
if (sender is TextEdit)
{
TextEdit textEdit = sender as TextEdit;
if (textEdit.Tag is ControlModel)
{
//没有浏览权限默认显示****
ControlModel model = textEdit.Tag as ControlModel;
if (model.Visible && newText.Equals("****")) return;
}
}
// 第一个输入负号不会取消,出现了千位分隔符不会取消更改,末尾为百分号不会取消
if (!newText.Equals("-") && !string.IsNullOrEmpty(newText) && !Regex.IsMatch(newText, @"^(?:-(?:[0-9]+(?:,[0-9]{3})*(?:\.[0-9]*)?)|[0-9]+(?:,[0-9]{3})*(?:\.[0-9]*)?)(?:%)?$"))
{
@@ -5483,24 +5464,6 @@ namespace Lskj.Control.Model
}
}
if (SpecialLeftTable != null)
{
GridView gridview = SpecialLeftTable.GridControl.DefaultView as GridView;
DataRow rowItem = gridview.GetFocusedDataRow();
if (rowItem != null)
{
sqlValue = ReplaceHelper.ReplaceRowParam(rowItem, sqlValue);
}
if (SpecialLeftTable is TreeGridControlEx)
{
rowItem = SpecialLeftTable.GetViewFocusedDataRow();
if (rowItem != null)
{
sqlValue = ReplaceHelper.ReplaceRowParam(rowItem, sqlValue);
}
}
}
return ReplaceHelper.ReplaceWhereCond(sqlValue) + WhereCond;
}
/// <summary>
@@ -6220,4 +6183,30 @@ namespace Lskj.Control.Model
LabelDateEdit dateEdit = controlObj as LabelDateEdit;
value = dateEdit.TextEdit.EditValue == null ? dateEdit.EditText : dateEdit.TextEdit.DateTime.ToString("yyyy-MM-dd");
}
else if
else if (controlObj is LabelCheckEdit)
{
LabelCheckEdit checkEdit = controlObj as LabelCheckEdit;
value = checkEdit.EditText;
}
else if (controlObj is LabelComboxEdit)
{
LabelComboxEdit autoEdit = controlObj as LabelComboxEdit;
value = autoEdit.EditValue;
}
else if (controlObj is LabelTextEdit)
{
LabelTextEdit textIntEdit = controlObj as LabelTextEdit;
if (textIntEdit != null) value = string.IsNullOrEmpty(textIntEdit.EditText) ? "0" : textIntEdit.EditText;
}
defaultValue = defaultValue.Replace(item, value);
}
}
}
return defaultValue;
}
}
}