/****************************** * 说明:PubSpec 模块 * 创建人:龚宇超 * 创建日期:2018-01-02 * 修改人: * 修改日期: * 修改备注: * 版本:1.0.0.0 ******************************/ 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; using DevExpress.XtraGrid.Views.Grid; using Newtonsoft.Json.Linq; using Newtonsoft.Json; using System.Data; using Lskj.Business.Impl; namespace Lskj.PubBomImport { /// /// PubSpec 模块 /// public class DllBaseClass : IForm { public DllBaseClass() { } public DllBaseClass(string[] obj) { try { FrmMain main = new FrmMain(); this.SubForm = main; main.Model = new DynamicBomImport(obj); } catch (Exception ex) { LogUtil.WriteError("Lskj.PubSpecialImport.dll--参数错误-->" + obj.ToString(), ex); } } public Form SubForm { get; set; } } /// /// PubSpecialImport入库参数 /// public class DynamicBomImport : DynamicModel { public string PupupMenuId = ""; public string MenuName = ""; public string FirstRowIndex = ""; public string MainFieldDic = ""; public string SheetName = ""; /// /// 读取筛选条件 /// public string ReadTableCond = ""; /// /// 忽略合并明细列标题行 /// public bool CustomerServiceApp = false; /// /// 显示模式,如果为1则隐藏配置界面 /// public string ShowType = ""; /// /// 单据 BillMasterSql /// public string BillMasterSql = ""; /// /// 单据 BillDetailSql /// public string BillDetailSql = ""; /// /// 原始物料名称字段 /// public string BeforeBomFieldName = ""; /// /// 修改后物料名称字段 /// public string AfterBomFieldName = ""; /// /// 新增后的修改数据sql /// public string AfterAddBomSql = ""; public DynamicBomImport(string[] args) : base(args) { // 右键菜单打开的模块没有moduleId,部分特殊模块没有moduleId比如添加界面. MenuName = args[0]; if (args.Length > 5 && !string.IsNullOrWhiteSpace(args[5])) { PupupMenuId = args[5] + ""; } if (args.Length > 6 && !string.IsNullOrWhiteSpace(args[6])) { base.ModuleCode = args[6] + ""; } if (args.Length > 7 && !string.IsNullOrWhiteSpace(args[7])) { FirstRowIndex = args[7] + ""; } if (args.Length > 8 && !string.IsNullOrWhiteSpace(args[8])) { MainFieldDic = args[8] + ""; } if (args.Length > 9 && !string.IsNullOrWhiteSpace(args[9])) { SheetName = args[9] + ""; } if (args.Length > 10 && !string.IsNullOrWhiteSpace(args[10])) { ReadTableCond = args[10] + ""; } if (args.Length > 11 && !string.IsNullOrWhiteSpace(args[11])) { CustomerServiceApp = (args[11] + "").Equals("1"); } if (args.Length > 12 && !string.IsNullOrWhiteSpace(args[12])) { ShowType = args[12] + ""; } if (args.Length > 13 && !string.IsNullOrWhiteSpace(args[13])) { BillMasterSql = args[13] + ""; } if (args.Length > 14 && !string.IsNullOrWhiteSpace(args[14])) { BillDetailSql = args[14] + ""; } 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) { } } if (BaseImpl.HasExistsTable("p_systemPopupPmsTab")) { DataTable pmsTable = BaseImpl.GetDataTableResult($"select * from p_systemPopupPmsTab where unionId='{PupupMenuId}'"); EnumerableRowCollection dataRows = pmsTable.AsEnumerable(); DataRow pmsRow = dataRows.Where(n => (n["pmsName"] + "").Equals("BeforeBomFieldName")).FirstOrDefault(); if (pmsRow != null) { BeforeBomFieldName = pmsRow["pmsValue"] + ""; } pmsRow = dataRows.Where(n => (n["pmsName"] + "").Equals("AfterBomFieldName")).FirstOrDefault(); if (pmsRow != null) { AfterBomFieldName = pmsRow["pmsValue"] + ""; } pmsRow = dataRows.Where(n => (n["pmsName"] + "").Equals("AfterAddBomSql")).FirstOrDefault(); if (pmsRow != null) { AfterAddBomSql = pmsRow["pmsValue"] + ""; } } } /// /// 设置模块编号 /// /// public void ChangeModuleCode(string moduleCode) { base.ModuleCode = moduleCode; } } }