ab56a9bcf7
SVN-Revision: r240
252 lines
9.9 KiB
C#
252 lines
9.9 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.ComponentModel;
|
|
using System.Data;
|
|
using System.Drawing;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Windows.Forms;
|
|
using Lskj.Control;
|
|
using Lskj.Control.Model;
|
|
using Lskj.Business.Impl;
|
|
using Lskj.Model;
|
|
using Lskj.Core;
|
|
using Gecko.Events;
|
|
using Lskj.Util;
|
|
using Lskj.Data;
|
|
using Lskj.Business;
|
|
using System.IO;
|
|
|
|
namespace Lskj.MesStart
|
|
{
|
|
public partial class FrmMain : BaseForm
|
|
{
|
|
public string mScanCode;
|
|
public string MenuCode = "MESCS01_1";
|
|
/// <summary>
|
|
/// 左侧附件地址
|
|
/// </summary>
|
|
public string mLeftUrl;
|
|
/// <summary>
|
|
/// 中间流程地址
|
|
/// </summary>
|
|
public string mMainUrl;
|
|
public string PrimaryKey;
|
|
public string PrimaryValue;
|
|
public ModuleModel ModuleModelObj = null;
|
|
public DynamicMesStartModel SysModel;
|
|
public DataTable MainRightMenu = new DataTable();
|
|
public DataTable MainTable = new DataTable();
|
|
public MyControl MyControlObj = new MyControl();
|
|
|
|
public FrmMain()
|
|
{
|
|
InitializeComponent();
|
|
}
|
|
|
|
#region 方法相关
|
|
/// <summary>
|
|
/// <para>说明:重新加载左侧网页</para>
|
|
/// <para>创建人:龚宇超</para>
|
|
/// <para>创建日期: </para>
|
|
/// <para>修改人:</para>
|
|
/// <para>修改日期:</para>
|
|
/// <para>修改备注:</para>
|
|
/// <para>版本:1.0</para>
|
|
/// </summary>
|
|
/// <param name="url">The URL.</param>
|
|
public void ResetLeftBrowser(string url)
|
|
{
|
|
this.moduleWebView1.Navigate(url);
|
|
}
|
|
/// <summary>
|
|
/// <para>说明:重新加载中间网页</para>
|
|
/// <para>创建人:龚宇超</para>
|
|
/// <para>创建日期: </para>
|
|
/// <para>修改人:</para>
|
|
/// <para>修改日期:</para>
|
|
/// <para>修改备注:</para>
|
|
/// <para>版本:1.0</para>
|
|
/// </summary>
|
|
/// <param name="url">The URL.</param>
|
|
public void ResetMainBrowser(string url)
|
|
{
|
|
if (this.moduleWebView2.OnNavigating == null)
|
|
this.moduleWebView2.OnNavigating += OnNavigating;
|
|
this.moduleWebView2.Navigate(url);
|
|
}
|
|
/// <summary>
|
|
/// <para>说明:加载底部多标签数据</para>
|
|
/// <para>创建人:龚宇超</para>
|
|
/// <para>创建日期: </para>
|
|
/// <para>修改人:</para>
|
|
/// <para>修改日期:</para>
|
|
/// <para>修改备注:</para>
|
|
/// <para>版本:1.0</para>
|
|
/// </summary>
|
|
public void InitDetailTabs()
|
|
{
|
|
this.tabControlEx1.InitTabPages(GetDetails());
|
|
}
|
|
/// <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()
|
|
{
|
|
List<GridDetailModel> details = new List<GridDetailModel>();
|
|
|
|
DataTable table = BaseModuleImpl.GetBaseDetailPages(MenuCode);
|
|
foreach (DataRow item in table.Rows)
|
|
{
|
|
DataTable gridColumns = ReportImpl.GetReportDetailColumns(MenuCode, item["id"] + "");
|
|
details.Add(new GridDetailModel(item, gridColumns, GridCustomColumnStruct.BaseDetailGridView, true));
|
|
}
|
|
|
|
return details;
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region 事件相关
|
|
/// <summary>
|
|
/// <para>说明:窗口加载</para>
|
|
/// <para>创建人:龚宇超</para>
|
|
/// <para>创建日期: </para>
|
|
/// <para>修改人:</para>
|
|
/// <para>修改日期:</para>
|
|
/// <para>修改备注:</para>
|
|
/// <para>版本:1.0</para>
|
|
/// </summary>
|
|
/// <param name="sender">The sender.</param>
|
|
/// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
|
|
void OnFrmMainLoad(object sender, EventArgs e)
|
|
{
|
|
try
|
|
{
|
|
if (DBConfig.Instance.CreateConnection())
|
|
{
|
|
this.MenuCode = this.SysModel.ModuleCode;
|
|
this.mLeftUrl = SystemInfo.Instance.OAUrl + "pages/PhotoView_sim.html?username={0}&password={1}&id=HT201911010001&dllcoid={2}";
|
|
this.mMainUrl = SystemInfo.Instance.OAUrl + "pages/customer/PrintProcess.html?username={0}&password={1}&dllcoid={2}";
|
|
this.mLeftUrl = string.Format(mLeftUrl, ERPInfo.Instance.UserName, "lserpAdmin", MenuCode);
|
|
this.mMainUrl = string.Format(mMainUrl, ERPInfo.Instance.UserName, "lserpAdmin", MenuCode);
|
|
|
|
this.ResetLeftBrowser(this.mLeftUrl);
|
|
this.ResetMainBrowser(this.mMainUrl);
|
|
|
|
this.PrimaryKey = BaseImpl.GetBasePrimaryKey(this.MenuCode);
|
|
this.ModuleModelObj = new ModuleModel(MainImpl.GetSystemdllTab(this.MenuCode));
|
|
this.MainTable = BaseModuleImpl.GetControlLocation(this.ModuleModelObj.FormKey, this.SysModel.ModuleCode);
|
|
this.MainRightMenu = BaseModuleImpl.GetBaseGridRightMenus(this.MenuCode);
|
|
this.plTop.Height = this.MyControlObj.InitControl(this.MainTable, this.xtraScrollableControl1);
|
|
|
|
this.InitDetailTabs();
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
string Message = ErrorMessage.PromptErrorMessage(ex);
|
|
MessageUtil.Show(Message,ex.Message);
|
|
}
|
|
finally
|
|
{
|
|
Lskj.Control.Model.AutoSizeChange.ControllInitializeSize(this);
|
|
}
|
|
}
|
|
/// <summary>
|
|
/// <para>说明:</para>
|
|
/// <para>创建人:龚宇超</para>
|
|
/// <para>创建日期:2019-12-24 </para>
|
|
/// <para>修改人:</para>
|
|
/// <para>修改日期:</para>
|
|
/// <para>修改备注:</para>
|
|
/// <para>版本:1.0</para>
|
|
/// </summary>
|
|
/// <param name="sender">The sender.</param>
|
|
/// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
|
|
void OnNavigating(object sender, GeckoNavigatingEventArgs e)
|
|
{
|
|
try
|
|
{
|
|
if (e.Uri != null && e.Uri.AbsoluteUri.Contains("rightid="))
|
|
{
|
|
e.Cancel = true;
|
|
string id = string.Empty;
|
|
string rightid = string.Empty;
|
|
string[] paramList = e.Uri.AbsoluteUri.Split('?')[1].Split('&');
|
|
foreach (var item in paramList)
|
|
{
|
|
if (item.Contains("rightid"))
|
|
{
|
|
rightid = item.Replace("rightid=", "");
|
|
}
|
|
if (item.Contains("popupid"))
|
|
{
|
|
id = item.Replace("popupid=", "");
|
|
}
|
|
}
|
|
// 1.扫码、2.
|
|
switch (rightid)
|
|
{
|
|
case "1":
|
|
FrmScan frmScan = new FrmScan();
|
|
frmScan.MenuCode = this.MenuCode;
|
|
frmScan.PopupID = id;
|
|
frmScan.RightMenuTable = this.MainRightMenu;
|
|
if (frmScan.ShowDialog() == System.Windows.Forms.DialogResult.OK)
|
|
{
|
|
this.ResetMainBrowser(mMainUrl + "&backrightid=" + rightid + "&value=" + frmScan.ScanCode);
|
|
}
|
|
break;
|
|
default:
|
|
// 根据配置打开模块
|
|
DataRow rowItem = this.MainRightMenu.Rows.Cast<DataRow>().FirstOrDefault(x => id.Equals(x["id"] + ""));
|
|
|
|
if (rowItem != null)
|
|
{
|
|
CommonMenu menu = new CommonMenu(this.SysModel, this.MyControlObj);
|
|
menu.ApplyBefore += new CommonToolApplyEventHandler(OnMenuApplyBefore);
|
|
menu.Apply(rowItem);
|
|
}
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
string Message = ErrorMessage.PromptErrorMessage(ex);
|
|
MessageUtil.Show(Message,ex.Message);
|
|
}
|
|
}
|
|
/// <summary>
|
|
/// <para>说明:执行前单独替换BilldocumentId</para>
|
|
/// <para>创建人:龚宇超</para>
|
|
/// <para>创建日期:2018-03-07 </para>
|
|
/// <para>修改人:</para>
|
|
/// <para>修改日期:</para>
|
|
/// <para>修改备注:</para>
|
|
/// <para>版本:1.0</para>
|
|
/// </summary>
|
|
/// <param name="e">The e.</param>
|
|
protected void OnMenuApplyBefore(ApplyArgs e)
|
|
{
|
|
DataRow rowItem = BaseImpl.GetDataRowResult(string.Format(string.Format("select top 1 * from {0} where {1}='{2}'", this.ModuleModelObj.MenuTable, this.PrimaryKey, this.PrimaryValue)));
|
|
string[] paramList = new string[e.MemuModel.ParamList.Count];
|
|
|
|
for (int i = 0; i < e.MemuModel.ParamList.Count; i++)
|
|
{
|
|
string item = e.MemuModel.ParamList[i];
|
|
paramList[i] = ReplaceHelper.ReplaceRowParam(rowItem, item);
|
|
}
|
|
e.MemuModel.ParamList = paramList.ToList();
|
|
}
|
|
#endregion
|
|
}
|
|
} |