using JinYuan.Models; using JinYuan.VirtualDataLibrary; using MiniExcelLibs; using System; using System.Collections.Generic; using System.IO; using System.Linq; using System.Windows.Forms; namespace JinYuan.VirtualDataLibrary { public class MesConfig { /// /// 工厂代码 /// public string siteCode = ""; /// /// 产线编号 /// public string lineCode = ""; /// /// 设备编号 /// public string equipNum = ""; /// /// 客户料号 /// public string CustomerPartNum = ""; /// MES密码 /// public string mesPwd = ""; /// /// MES账户 /// public string mesUserName = ""; /// /// 将电池等级转换成下发PLC的等级编号 /// /// /// public static string GetLocGrade(int stationNo, FDConfig fdconfig) { string grade = ""; switch (stationNo) { case 1: grade = fdconfig.Grade1; break; case 2: grade = fdconfig.Grade2; break; case 3: grade = fdconfig.Grade3; break; } return grade; } // 组盘PLC 机架-工位对应的寄存器 public Dictionary> gw_loc_plcAddr = new Dictionary>() { // 机架1:loc1-loc3 对应PLC地址段D21600-D21602 { 1, new Dictionary() { {1, "D21600"}, {2, "D21601"}, {3, "D21602"} } }, // 机架2:loc1-loc3 对应PLC地址段D23600-D23602 { 2, new Dictionary() { {1, "D23600"}, {2, "D23601"}, {3, "D23602"} } }, // 机架3:loc1-loc3 对应PLC地址段D25600-D25602 { 3, new Dictionary() { {1, "D25600"}, {2, "D25601"}, {3, "D25602"} } } }; //// 电池等级,PLC等级关系 //private static Dictionary gradeDic = new Dictionary() //{ // { "V1", 1 }, // { "A", 2 }, // { "A-", 3 }, // { "B", 4 }, // { "NG", 0}, // { "不设置", 0}, //}; //public static List GetGrades() //{ // var validGradeKeys = gradeDic.Keys.ToList(); // return validGradeKeys; //} /// /// 将电池等级转换成下发PLC的等级编号 /// /// /// //public int GetGradeNo(string strGrade) //{ // if (gradeDic.TryGetValue(strGrade, out int result)) // { // return result; // 键存在,返回对应值 // } // // 键不存在,返回0 // return 0; //} /// /// 电表编号 /// public List electricMeterNum = new List(); /// /// 风速仪个数 /// public int AntiDustAirSpeedCount = 0; /// /// 风速仪编号 /// public List listAntiDustAirSpeedNum = new List(); /// /// 权限 /// public string userLevel = ""; /// /// mes返回权限 /// public string mesUserLevel = ""; /// /// 物料编码 /// public string MaterialCode = ""; /// /// 生产型号 /// public string ModelName = ""; // 产品型号转plc值 private Dictionary modelMapping = new Dictionary() { { "LF350S", 1 }, //MB36 { "LF314", 2 }, //MB31 { "LF628", 3 }, //MB56 { "LF668", 3 }, //MB56 { "MB36", 1 }, //MB36 { "MB31", 2 }, //MB31 { "MB56", 3 }, //MB56 }; /// /// 将电池型号转换成下发PLC的型号编号 /// /// /// public int GetModel(string modelName) { if (modelMapping.TryGetValue(modelName, out int result)) { return result; // 键存在,返回对应值 } // 键不存在,返回0 return 0; } // 物流线各工位,生产型号写PLC地址 private Dictionary modelPLCAddr_Mapping = new Dictionary() { { "2-1", "D2009" }, { "2-2", "D2109" }, { "2-3", "D2209" }, { "1-1", "D2309" }, { "1-2", "D2409" }, { "1-3", "D2509" } }; public string GetWuliuModelAddr() { if (modelPLCAddr_Mapping.TryGetValue(CommonMethods.sysConfig.GongWei, out string plcAdrr)) { return plcAdrr; // 键存在,返回对应值 } // 键不存在,返回"" return ""; } // 物流线各工位,等级写PLC地址 private Dictionary> gradePLCAddr_Mapping = new Dictionary>() { { "2-1", new Dictionary {{1, "D2006"}, {2, "D2007"}, {3, "D2008"}} }, { "2-2", new Dictionary {{1, "D2106"}, {2, "D2107"}, {3, "D2108"}} }, { "2-3", new Dictionary {{1, "D2206"}, {2, "D2207"}, {3, "D2208"}} }, { "1-1", new Dictionary {{1, "D2306"}, {2, "D2307"}, {3, "D2308"}} }, { "1-2", new Dictionary {{1, "D2406"}, {2, "D2407"}, {3, "D2408"}} }, { "1-3", new Dictionary {{1, "D2506"}, {2, "D2507"}, {3, "D2508"}} } }; public Dictionary GetWuliuGradeAddr() { if (gradePLCAddr_Mapping.TryGetValue(CommonMethods.sysConfig.GongWei, out Dictionary plc_addrs)) { return plc_addrs; } return new Dictionary(); } // PLC触摸屏用户名称与权限 private Dictionary> userPLCAddr_Mapping = new Dictionary>() { { "1-1", new Dictionary {{"user", "D22"}, {"right", "D21"}} }, { "1-2", new Dictionary {{"user", "D22"}, {"right", "D21"}} }, { "1-3", new Dictionary {{"user", "D22"}, {"right", "D21"}} }, { "2-1", new Dictionary {{"user", "D22"}, {"right", "D21"}} }, { "2-2", new Dictionary {{"user", "D22"}, {"right", "D21"}} }, { "2-3", new Dictionary {{"user", "D22"}, {"right", "D21"}} }, }; public Dictionary GetHMIUserRightAddr() { if (userPLCAddr_Mapping.TryGetValue(CommonMethods.sysConfig.GongWei, out Dictionary plc_addrs)) { return plc_addrs; } return new Dictionary(); } /// /// 是否上传MES /// public bool isUpMes = false; /// /// MES接口URL地址中的IP地址 /// public string MESURLAddressIP = "10.100.111.81"; /// /// MES接口URL地址中的端口号 /// public string MESURLAddressPort = "80"; /// /// 是否连接MES /// public bool isConnected = false; /// /// 是否刷卡? /// public bool Isshuaka = false; /// /// 是否登录成功? /// public bool IsLoginOK = false; /// /// 是否登录MES成功? /// public bool IsLoginMesOK = false; /// /// 获取MES参数 /// public bool IsMesParam = false; /// /// MES超时 /// public long MesOutTime = 0; /// /// 焊接点个数 /// public int weldNum = 0; /// /// 是否2个电表(此功能仅适用于908-6负极焊接两台设备共用一台敢接机只有一个电表) /// public bool IsTwoDianBiao = false; /// /// 电表编号 /// public string ElectricMeterNum = ""; /// /// 除尘风速 /// public decimal antiDustAirSpeed = 0; /// /// 电机旋转速度 /// public decimal dianjiXzSpeed = 0; /// /// 设备状态上传时间 /// public int EquStatuasTime = 0; /// /// 获取服务器数据 /// public bool IsGet_Server = true; /// /// 生成假数据 /// public bool IsDebug = true; /// /// 钢壳码计数 /// public int SteelshellCount = 0; ///// ///// 每个档位最大电芯数量 ///// //public int maxBatteriesPerGrade = 240; /// /// 电芯装箱层数 /// public int packLayers = 4; /// /// 电芯装箱每层行数 /// public int rowsPerLayer = 5; /// /// 电芯装箱每层列数 /// public int colsPerLayer = 12; /// /// 卡板托盘计数 /// public int CoreCount = 0; /// /// 卡板托盘生成时间 /// public string CardTime = ""; /// /// 卡板码是否发送成功 /// public bool CardSuccess = false; /// /// 原材料上料位置 /// public string materialLotCodeLocator = ""; /// /// 存储服务器IP地址 /// public string RotueServerIP = "192.168.2.108"; /// /// 员工权限校验 /// public string EmployeeAuthCheck = "http://10.100.111.81/core/api/public/equipment/base/user/permission/verify"; ///// ///// 原材料投入信息 ///// //public string MaterialInputInfo = "http://10.100.111.81/core/api/public/raw/material/input/un/first/process"; /// /// 设备参数设定值请求 /// public string DeviceParamRequest = "http://10.100.111.81/core/api/public/param/setting/request"; /// /// 设备参数设定值变更 /// public string DeviceParamChange = "http://10.100.111.81/core/api/public/param/setting/change"; /// /// 料盘信息获取 /// public string queryTrayUrl = "http://10.22.160.9/prod-api/produce/trayQuery/trayComposeInfo"; public string queryGradeUrl = "http://10.22.160.141:8080/core/api/public/equip/auto/gradequery"; public string upResultParamUrl = "http://10.22.160.3/core/api/public/process/param/new/result"; /// /// 解绑料框码 /// public string unbindTrayUrl = "http://10.22.160.9/prod-api/api/fms/mp/unbindWholeTray"; /// /// 半成品电池绑盘 /// public string packLoadUrl = "http://10.54.50.1:8082/core/api/public/equip/auto/pack/load"; /// /// 成品电池绑盘 /// public string finishedPackUrl = "http://10.54.50.1:8082/core/api/public/equip/auto/pack/load"; /// /// 设备报警信息 /// public string DeviceAlarm = "http://10.100.111.81/core/api/public/equipment/alarm/currency"; /// /// 设备运行状态 /// public string DeviceStatus = "http://10.100.111.81/core/api/public/eve/pm/eqm/run/status/operation"; /// /// 能耗数据 /// public string EnergyConsumption = "http://10.100.111.81/core/api/public/eve/pm/energy/consumption/collection/submit"; /// /// 设备风速接口 /// public string Anemometer = "https://iot.eveportal.com:9470/eve_api/ems/iot/upload_device_collect_data"; ///// ///// 进出站一体模式× ///// //public string InAndOutStationMesUrl = "http://10.17.96.73/core/api/public/14j/out/station/process/turn-in-out"; /// /// appId /// public string AppID = "e36ef900320d442f850913e2ebc1d7a1"; /// /// AppKey /// public string AppKey = "8279ce76217245f48c0cc495c09124a3"; /// /// 获取TOKEN /// public string GetTokenUrl = "https://esb.evebattery.com:13502/gateway/ewms-eu/openapi/oauth/token"; } }