using System; using System.Collections.Generic; using System.Linq; using System.Text; using Lskj.Util; using Lskj.Business; using System.Windows.Forms; using Lskj.Model; namespace mes_BzUsedby { /// /// c#库被调用统一接口类 /// /// public sealed class DllBaseClass : IForm { public DllBaseClass() { } public static string Goperatorname = ""; public static string Gjtid = "0"; public static string GjtName = ""; public static string workshop = ""; public static string planlistid = ""; public static string YzProductid = ""; public static int YsHour = 0; public static int jtlsj = 0; public DllBaseClass(string[] obj) { try { FrmMain main = new FrmMain(); this.SubForm = main; main.Model = new DynamicDemoModel(obj); Goperatorname = obj[2]; planlistid = obj[5]; Gjtid = obj[6]; YzProductid = obj[7]; main.t1.Text = obj[0] + "->" + obj[1] + "->" + obj[2] + "->" + obj[3] + "->" + obj[4]; // 对应右键惨淡参数1 main.t2.Text = obj[5] + "->" + obj[6] + "->" + obj[7]; } catch (Exception ex) { LogUtil.WriteError("--参数错误-->" + obj.ToString(), ex); } } /// /// 窗口 /// public Form SubForm { get; set; } } /// /// 类库-入口类 /// public class DynamicDemoModel : DynamicModel { /// /// 主键值 /// /// The object identifier. public string ObjectId { get; private set; } /// /// 初始化动态链接库参数 /// /// The arguments. public DynamicDemoModel(string[] args) : base(args) { // 入口参数前面5个参数系统自动增加分别是(窗口名称、用户ID、用户名称、权限(0\1)、当前窗口的模块编号) if (args.Length > 5 && !string.IsNullOrWhiteSpace(args[5]) && !"0".Equals(args[5])) { base.ModuleId = Convert.ToInt32(args[5]); } // 参数6对应右键菜单的参数1,比如需要传入调用模块的模块编号,一次类推为当前模块需要使用的一些参数 if (args.Length > 6 && !string.IsNullOrWhiteSpace(args[6])) { base.ModuleCode = args[6]; } //this.IsView = args[6]; //this.ObjectId = args[7]; //this.ParentKey = args.Length > 8 ? args[8] : string.Empty; //this.ParentValue = args.Length > 9 ? args[9] : string.Empty; //this.ControlSql = args.Length > 10 && !string.IsNullOrWhiteSpace(args[10]) ? args[10].TrimStart('#') : string.Empty; //this.SearchObject = args.Length > 13 ? args[13] : string.Empty; //this.DataObj = args.Length > 14 ? args[14] : string.Empty; //// UnionKey、UnionValue 此2个值通过程序传递,外部调用无法传递 //this.UnionKey = args.Length > 15 ? args[15] : string.Empty; //this.UnionValue = args.Length > 16 ? args[16] : string.Empty; //this.SaveState = args.Length > 17 ? args[17] : string.Empty; } } }