using Lskj.Business; using Lskj.Business.Impl; using Lskj.Model; using Lskj.Util; using Newtonsoft.Json; using Newtonsoft.Json.Linq; using System; using System.Collections; using System.Collections.Generic; using System.Data; using System.Linq; using System.Windows.Forms; namespace Lskj.ProductSched { /// /// 基础档案审批模板入口 /// /// /// c#库被调用统一接口类 /// public sealed class DllBaseClass : IForm { public DllBaseClass() { } public DllBaseClass(string[] obj) { try { FrmMain main = new FrmMain(); DynamicProductSchedModel moduleModel = new DynamicProductSchedModel(obj); main.Model = moduleModel; moduleModel.DataCaches = new Dictionary(); //if (SystemInfo.Instance.OptimizationSpeed) main.GetDataCaches(moduleModel.DataCaches); GridEnum gridEnum = GridEnum.GridView; if (!moduleModel.DataCaches.GetValue(main, "FormType", out int formType)) { formType = BaseImpl.GetBaseType(moduleModel.ModuleCode); } if (formType == 1) { gridEnum = GridEnum.BandedGridView; } if (formType == 2) { gridEnum = GridEnum.TreeListGridView; // 基础档案暂时注释GridEnum.TreeListGridView此类型,TrcReport和手机端显示卡片冲突. } main.Model.GridEnumObj = gridEnum; this.SubForm = main; } catch (Exception ex) { LogUtil.WriteError("Lskj.ProductSched.dll--参数错误-->" + obj.ToString(), ex); } } /// /// 窗口 /// public Form SubForm { get; set; } } /// /// 入口模型 /// public class DynamicProductSchedModel : DynamicModel { public override string[] OtherParams() { return this.Params; } /// /// 初始化默认参数(1.标题、2、用户ID、3.用户名、4.权限、5.模块编号、6.菜单ID) /// /// The arguments. public DynamicProductSchedModel(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 > 10) { this.Params = new string[args.Length]; for (int i = 10; i < args.Length; i++) { Params[i - 10] = args[i]; } } if (!string.IsNullOrEmpty(args[args.Length - 1])) { try { JObject rowObject = JsonConvert.DeserializeObject(args[args.Length - 1]); JArray jArray = new JArray(); jArray.Add(rowObject); DataTable dataTable = JsonConvert.DeserializeObject(JsonConvert.SerializeObject(jArray)); this.MaintabFocusedRow = dataTable.Rows[0]; } catch (Exception) { } } } } }