SVN r650
SVN-Revision: r650
This commit is contained in:
@@ -28,6 +28,7 @@ namespace Lskj.Control.Model
|
||||
private bool _autoRefresh;
|
||||
private bool _rightVisible;
|
||||
private bool _isSearch;
|
||||
private bool _isDownloadRelated;
|
||||
private string _detailName;
|
||||
private string _detailSql;
|
||||
private string _formKey;
|
||||
@@ -203,6 +204,10 @@ namespace Lskj.Control.Model
|
||||
/// </summary>
|
||||
public bool IsMrpDrag { get { return this._isMrpDrag; } }
|
||||
/// <summary>
|
||||
/// 批量关联明细
|
||||
/// </summary>
|
||||
public bool IsDownloadRelated { get { return this._isDownloadRelated; } }
|
||||
/// <summary>
|
||||
/// Mrp拖拽标记
|
||||
/// </summary>
|
||||
public string MrpDragTag { get { return this._mrpDragTag; } }
|
||||
@@ -296,6 +301,7 @@ namespace Lskj.Control.Model
|
||||
this._unionValue = item.Table.Columns.Contains("unionValue") ? (item["unionValue"] + "").Replace("{", "").Replace("}", "") : string.Empty;
|
||||
this._unionParentField = item.Table.Columns.Contains("unionParentField") ? (item["unionParentField"] + "").Replace("{", "").Replace("}", "") : string.Empty;
|
||||
this._columns = gridColumns;
|
||||
this._isDownloadRelated = item.Table.Columns.Contains("IsDownloadRelated") ? "True".Equals(item["IsDownloadRelated"] + "") : false;
|
||||
this._isSearch = isSearch;
|
||||
this._isUnioDetail = item.Table.Columns.Contains("IsUnioDetail") ? "1".Equals(item["IsUnioDetail"] + "") : false;
|
||||
this.AutoMultiHeader = item.Table.Columns.Contains("AutoMultiHeader") && !string.IsNullOrEmpty(item["AutoMultiHeader"] + "") ? Convert.ToInt32(item["AutoMultiHeader"] + "") : 0;
|
||||
|
||||
@@ -588,10 +588,11 @@ namespace Lskj.Control.Model
|
||||
string fileTitle = szName[szName.Length - 1];
|
||||
//设置文件存放路径
|
||||
string DownloadFileDirectory = string.Format("{0}\\{1}", Application.StartupPath, "RightDownloadFile");
|
||||
if (!Directory.Exists(DownloadFileDirectory))
|
||||
if (Directory.Exists(DownloadFileDirectory))
|
||||
{
|
||||
Directory.CreateDirectory(DownloadFileDirectory);
|
||||
Directory.Delete(DownloadFileDirectory, true);
|
||||
}
|
||||
Directory.CreateDirectory(DownloadFileDirectory);
|
||||
DownloadFileDirectory = string.Format("{0}\\{1}", DownloadFileDirectory, fileTitle);
|
||||
|
||||
FrmDownload frm = new FrmDownload(url, fileTitle, DownloadFileDirectory, true, false);
|
||||
@@ -1113,22 +1114,45 @@ namespace Lskj.Control.Model
|
||||
string procName = model.Action;
|
||||
if (string.IsNullOrWhiteSpace(procName))
|
||||
{
|
||||
if (rows.Length > 0 && rows[0].Table.Columns.Contains("webpath"))
|
||||
if (rows.Length > 0 && !string.IsNullOrWhiteSpace(Model.ModuleCode))
|
||||
{
|
||||
int filequency = 0;
|
||||
bool isOpenvisble = rows.Count() > 0;
|
||||
string parmaryKey = BaseImpl.GetBasePrimaryKey(this.Model.ModuleCode);//获取主键
|
||||
//string detailparmaryKey = parmaryKey;
|
||||
List <GridDetailModel> details = GetDetails(Model.ModuleCode);//捕获所有明细 // 2. 筛选出 “关联下载” 的明细
|
||||
List<GridDetailModel> downloadRelated = details
|
||||
.Where(d => d.IsDownloadRelated) // 只保留 IsDownloadRelated 为 true 的项
|
||||
.ToList();
|
||||
if (downloadRelated.Count > 0)
|
||||
{
|
||||
foreach (DataRow dataRow in rows)
|
||||
{
|
||||
StringBuilder urlsBuilder = new StringBuilder();
|
||||
foreach (DataRow row in rows)
|
||||
string filenameheader = dataRow[parmaryKey] + "";//头部文件数据
|
||||
foreach (GridDetailModel gridDetailModel in downloadRelated)
|
||||
{
|
||||
//detailparmaryKey = BaseImpl.GetBasePrimaryKey(gridDetailModel.UnionModule);//获取主键
|
||||
string searchSql = this.GetSearchSql(gridDetailModel, dataRow, parmaryKey);
|
||||
DataTable dataTable = SqlHelper.ExecuteDataTable(searchSql);
|
||||
if (dataTable.Rows.Count > 0 && dataTable.Columns.Contains("webpath"))
|
||||
{
|
||||
foreach (DataRow row in dataTable.Rows)
|
||||
{
|
||||
|
||||
string url = row["webpath"] + "";
|
||||
if (!string.IsNullOrEmpty(url))
|
||||
{
|
||||
urlsBuilder.Append($"{url},");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
try
|
||||
{
|
||||
string urls = urlsBuilder.ToString().TrimEnd(',');
|
||||
string idvalue = rows[0].Table.Columns.Contains("keyvalue") ? rows[0]["keyvalue"] + "" : "";
|
||||
string fileDownTitle = rows[0].Table.Columns.Contains("fileTitle") ? rows[0]["fileTitle"] + "" : "";
|
||||
string idvalue = parmaryKey;
|
||||
//string fileDownTitle = rows[0].Table.Columns.Contains("fileTitle") ? rows[0]["fileTitle"] + "" : "";
|
||||
if (!string.IsNullOrWhiteSpace(urls))
|
||||
{
|
||||
string token = "";
|
||||
@@ -1180,17 +1204,18 @@ namespace Lskj.Control.Model
|
||||
string zipPathUrl = jsonObject["data"] + "";
|
||||
string downLoadUrl = string.Format("{0}{1}", SystemInfo.Instance.OAUrl, zipPathUrl.TrimStart('/'));
|
||||
FrmSelectDownload frmSelectDownload = new FrmSelectDownload();
|
||||
if (filequency > 0) frmSelectDownload.isMultiple = true;
|
||||
frmSelectDownload.isprompt = filequency + 1 == rows.Count();
|
||||
frmSelectDownload.URL = downLoadUrl;
|
||||
|
||||
frmSelectDownload.isOpenvisble = isOpenvisble;
|
||||
frmSelectDownload.ModelId = model.MenuTabName;
|
||||
frmSelectDownload.MenuName = model.MenuName;
|
||||
frmSelectDownload.MenuId = model.Id + "";
|
||||
|
||||
string[] szName = zipPathUrl.Split('/');
|
||||
string fileTitle = !string.IsNullOrWhiteSpace(fileDownTitle) ? fileDownTitle : szName[szName.Length - 1];
|
||||
string fileTitle = !string.IsNullOrWhiteSpace(filenameheader) ? filenameheader + ".zip" : szName[szName.Length - 1];
|
||||
frmSelectDownload.FileName = fileTitle;
|
||||
//frmSelectDownload.TopMost = true;
|
||||
frmSelectDownload.Show();
|
||||
frmSelectDownload.ShowDialog();
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -1220,9 +1245,17 @@ namespace Lskj.Control.Model
|
||||
{
|
||||
MessageUtil.Show(ex.Message);
|
||||
}
|
||||
filequency++;
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
MessageUtil.Show("未配置关联明细数据");
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
||||
MessageUtil.Show("没有需要下载的数据");
|
||||
}
|
||||
return reaultValue;
|
||||
@@ -1375,6 +1408,59 @@ namespace Lskj.Control.Model
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// <para>说明:获取查询条件</para>
|
||||
/// <para>创建人:龚宇超</para>
|
||||
/// <para>创建日期:2017-11-22 </para>
|
||||
/// <para>修改人:</para>
|
||||
/// <para>修改日期:</para>
|
||||
/// <para>修改备注:</para>
|
||||
/// <para>版本:1.0</para>
|
||||
/// </summary>
|
||||
/// <param name="model">The model.</param>
|
||||
/// <param name="rowItem">The row item.</param>
|
||||
/// <returns>System.String.</returns>
|
||||
protected string GetSearchSql(GridDetailModel model, DataRow rowItem,string ParmaryKey)
|
||||
{
|
||||
string fieldName = !string.IsNullOrEmpty(model.UnionParentField) && rowItem.Table.Columns.Contains(model.UnionParentField) ? model.UnionParentField : ParmaryKey;
|
||||
string sqlValue = model.IsReadOnly || model.IsChart ? model.DetailSql : model.SystemModel.MenuSql;
|
||||
|
||||
|
||||
sqlValue = ReplaceHelper.ReplaceRowParam(rowItem, sqlValue);
|
||||
|
||||
if (ReplaceHelper.IsSelect(sqlValue) && !string.IsNullOrEmpty(model.UnionValue))
|
||||
{
|
||||
string Conditions = string.Empty;
|
||||
sqlValue = ReplaceHelper.ReplaceWhereCond(sqlValue) + string.Format(" and {0}='{1}'", model.UnionValue, Conditions);
|
||||
}
|
||||
if (!string.IsNullOrEmpty(model.UnionCond))
|
||||
{
|
||||
string UnionCond = ReplaceHelper.ReplaceRowParam(rowItem, model.UnionCond);
|
||||
sqlValue += UnionCond;
|
||||
}
|
||||
return sqlValue;
|
||||
}
|
||||
/// <summary>
|
||||
/// <para>说明:右键捕获明细</para>
|
||||
/// <para>创建人:龚宇超</para>
|
||||
/// <para>创建日期:2017-11-21 </para>
|
||||
/// <para>修改人:</para>
|
||||
/// <para>修改日期:</para>
|
||||
/// <para>修改备注:</para>
|
||||
/// <para>版本:1.0</para>
|
||||
/// </summary>
|
||||
/// <returns>List<GridDetailModel>.</returns>
|
||||
private List<GridDetailModel> GetDetails(string ModuleCode)
|
||||
{
|
||||
List<GridDetailModel> details = new List<GridDetailModel>();//表格明细对象的集合
|
||||
DataTable table = BaseModuleImpl.GetBaseDetailPages(ModuleCode);// 根据传入的模块编号获得基础档案底部标签的数据
|
||||
foreach (DataRow item in table.Rows)
|
||||
{
|
||||
DataTable gridColumns = ReportImpl.GetReportDetailColumns(ModuleCode, item["id"] + "");//获取报表明细列
|
||||
details.Add(new GridDetailModel(item, gridColumns, GridCustomColumnStruct.BaseDetailGridView));
|
||||
}
|
||||
return details;
|
||||
}
|
||||
/// <summary>
|
||||
/// 调用主程序右键直接添加到page上页面自动关闭后执行刷新
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
|
||||
Reference in New Issue
Block a user