using BPASmartClient.JXJFoodSmallStation.Model.GVL; using BPASmartClient.JXJFoodSmallStation.Model.HK_PLC; using BPASmartClient.JXJFoodSmallStation.Model.Siemens; using BPASmartClient.JXJFoodSmallStation.Model.WindSend; using System; using System.Collections.Concurrent; using System.Collections.Generic; using System.Collections.ObjectModel; using System.Linq; using System.Text; using System.Threading.Tasks; namespace BPASmartClient.JXJFoodSmallStation.Model { public class GVL_SmallStation { private volatile static GVL_SmallStation SmallStation; public static GVL_SmallStation GetInstance => SmallStation ?? (SmallStation = new GVL_SmallStation()); private GVL_SmallStation() { } public PlcReadAddressDB3 plcReadDataDB3 { get; set; } = new PlcReadAddressDB3(); public WindSend_Write WindSendDB95 { get; set; } = new WindSend_Write(); public WindSend_Read WindSendDB94 { get; set; } = new WindSend_Read(); /// /// 配料站料仓数目 /// public const int Max_DosingSotckBinNum = 15; /// /// 风送料仓数目 /// public const int Max_PowderSotckBinNum = 5; [VarComm("Global", "订单取消")] /// /// 订单取消 /// public bool Order_Cancel { get; set; } [VarComm("Global", "订单取消的配方编号")] /// /// 订单取消的配方编号 /// public string Order_CancelRecipeCode { get; set; } = ""; [VarComm("Global", "柔性配料料仓配料下发情况")] /// /// 料仓配料情况 /// public bool[] PlcAllowIssueRecipe { get; set; } = new bool[5] { false, false, false, false,false }; [VarComm("Global", "柔性配料料仓,气缸顶起状态")] /// /// 柔性配料料仓,气缸顶起状态 /// public ushort StockBinCylinderStatus { get; set; } /// /// 料仓配料情况 /// [VarComm("Global", "柔性配料料仓配料下发情况")] public ushort[] StockBinDosingIssue { get; set; } = new ushort[5] { 0, 0, 0, 0, 0 }; /// /// 料仓配料情况 /// [VarComm("Global", "柔性配料料仓配料下发情况")] public ushort[] RecipeStockBinDosing { get; set; } = new ushort[5] { 0, 0, 0, 0, 0 }; [VarComm("Global", "柔性配料料仓配料情况")] /// /// 料仓配料情况 /// public ushort StockBinDosing { get; set; } = 0; [VarComm("Global", "托盘1托盘到位情况0:未到位,1=AGV到位,2=托盘有货架,3=AGV取托盘完成")] /// /// 托盘1托盘到位情况 /// public int Tray1LogicFinish { get; set; } = 0; [VarComm("Global", "托盘1托盘到位情况0:未到位,1=AGV到位,2=托盘有货架,3=AGV取托盘完成")] /// /// 托盘1托盘到位情况 /// public int[] Tray_AGVLogic { get; set; } = new int[5] { 0, 0, 0, 0, 0 }; [VarComm("Global", "托盘2托盘到位情况0:未到位,1=AGV到位,2=托盘有货架,3=AGV取托盘完成")] /// /// 托盘2托盘到位 逻辑完成 /// public int Tray2LogicFinish { get; set; } = 0; /// /// 托盘1有货架 /// [VarComm("Global", "托盘1有货架")] public bool Station1HaveTray { get; set; } /// /// 托盘2有货架 /// [VarComm("Global", "托盘2有货架")] public bool Station2HaveTray { get; set; } /// /// 托盘1传感器信号 /// [VarComm("Global", "托盘1传感器信号")] public bool Station1Sensor { get; set; } /// /// 托盘2传感器信号 /// [VarComm("Global", "托盘2传感器信号")] public bool Station2Sensor { get; set; } /// /// 托盘1气缸信号 /// [VarComm("Global", "托盘1气缸信号")] public bool Station1Cylinder { get; set; } /// /// 托盘2气缸信号 /// [VarComm("Global", "托盘2气缸信号")] public bool Station2Cylinder { get; set; } /// /// AGV放托盘1完成 /// [VarComm("Global", "AGV放托盘1完成")] public bool AGV_PutTray1Finish { get; set; } /// /// AGV取托盘1完成 /// [VarComm("Global", "AGV取托盘1完成")] public bool AGV_GetTray1Finish { get; set; } /// /// AGV放托盘1完成 /// [VarComm("Global", "AGV放托盘2完成")] public bool AGV_PutTray2Finish { get; set; } /// /// AGV取托盘2完成 /// [VarComm("Global", "AGV取托盘2完成")] public bool AGV_GetTray2Finish { get; set; } /// /// 托盘1气缸复位 /// [VarComm("Global", "托盘1气缸复位")] public bool CylinderReset { get; set; } /// /// 发送给plc的心跳 /// [VarComm("Global", "发送给plc的心跳")] public bool HeartBeatToPlc { get; set; } = false; [VarComm("Global", "屏蔽小料站料仓不足15个报警")] public bool DisEnableStockAlarm { get; set; } = false; /// /// 配方制作完成数量 /// [VarComm("Global", "配方制作完成数量")] public int RecipeDosingCompleNum { get; set; } = 0; /// /// 来自plc的心跳 /// [VarComm("Global", "来自plc的心跳")] public bool HeartBeatFromPlc { get; set; } = false; /// /// 是否允许西门子下发配方 /// [VarComm("Global", "是否允许西门子下发配方")] public bool IsAllowSiemensSendRecipe { get; set; } = false; /// /// 西门子下发配方状态 0:等待下发配方 1:请求下发配方 2:上位机接收配方 3:配方接收配方完成 4:上位机向西门子请求配料 5:西门子确认开始配料 6:西门子确认开始配料 信号复位 /// [VarComm("Global", "西门子下发配方状态0=等待下发配方 1=请求下发配方 2=接收配方 3=配方接收配方完成 4=请求配料 5=西门子确认开始配料 6=西门子确认开始配料信号复位")] public int SiemensSendRecipeStatus { get; set; } = 0; /// /// 配方下发状态 =0:配方未下发 ,1:配方下发给plc ,2:plc成功接收配方,正在配料 /// [VarComm("Global", "配方1下发状态 =0:配方未下发 ,1:配方下发给plc ,2:plc成功接收配方,正在配料")] public int RecipeStatusIDTray1 { get; set; } = 0; /// /// 配方下发状态 =0:配方未下发 ,1:配方下发给plc ,2:plc成功接收配方,正在配料 /// [VarComm("Global", "配方1下发状态 =0:配方未下发 ,1:配方下发给plc ,2:plc成功接收配方,正在配料")] public int[] RecipeProcessStatus { get; set; } = new int[5] { 0, 0, 0, 0, 0 }; /// /// 配方下发状态 =0:配方未下发 ,1:配方下发给plc ,2:plc成功接收配方,正在配料 /// [VarComm("Global", "配方1下发状态 =0:配方未下发 ,1:配方下发给plc ,2:plc成功接收配方,正在配料")] public bool AGVIsGetTray { get; set; } = false; /// /// 配方下发状态 =0:配方未下发 ,1:配方下发给plc ,2:plc成功接收配方,正在配料 /// [VarComm("Global", "配方2下发状态 =0:配方未下发 ,1:配方下发给plc ,2:plc成功接收配方,正在配料")] public int RecipeStatusIDTray2 { get; set; } = 0; /// /// 当前料仓的位置 /// [VarComm("Global", "当前配方正在配料位置")] public int StockInIsWork { get; set; } = 0; /// /// 当前料仓的位置 /// [VarComm("Global", "设置料仓配料完成")] public bool[] StockInDosingComple { get; set; } = new bool[15]; /// /// 是否使用粉仓配料 /// [VarComm("Global", "是否使用粉仓配料")] public bool IsUseWindSend { get; set; } = false; /// /// 粉仓正在配料 /// [VarComm("Global", "粉仓正在配料")] public bool WindSendDosing { get; set; } = false; /// /// 所有气缸的信号 /// public bool[] Cylinder_JackInfo { get; set; } = new bool[30]; #region 本地模拟配方 /// /// 是否使用本地模拟配方 /// [VarComm("Global", "是否使用本地模拟配方")] public bool IsUseLocalRecipe { get; set; } /// /// 不使用小料站配料 /// [VarComm("Global", "是否使用本地模拟配方")] public bool NotUseSmallStation { get; set; } /// /// 配料时间 /// public DateTime time1; /// /// 配料时间 /// public DateTime[] DosingTime = new DateTime[5] { DateTime.Now, DateTime.Now, DateTime.Now, DateTime.Now, DateTime.Now }; /// /// 原料的名称和原料编号对应,Mes提供的信息 /// public ConcurrentDictionary RawMaterialsNameCode { get; set; } = new ConcurrentDictionary(); [VarComm("Global", "风送是否允许AGV到工站")] /// /// 风送是否允许AGV到工站 /// public bool WindSendAllowAGVPutGet { get; set; } = false; [VarComm("Global", "粉料仓配料完成")] /// /// 粉料仓配料完成 /// public bool WindSendDosingComple { get; set; } = false; /// /// 粉料仓配料状态(0:无意义,1:粉料仓下配方,2:plc接收配方完成,3:粉料仓配料完成,4:粉料仓配料完成信号复位,5:排料完成) /// [VarComm("Global", "粉料仓配料状态")] public int WindSendDosingStatus { get; set; } = 0; /// /// PLC的系统模式 DB44.DBX0.1 /// [VarComm("Global", "PLC的系统模式 DB44.DBX0.1")] public bool PlcSystemMode { get; set; } = false; [VarComm("Global", "PLC的系统模式 DB44.DBX0.1")] /// /// 不使用15个料仓报警 /// public bool DisEnableStockBinAlarm { get; set; } = false; [VarComm("Global", "PLC的系统自动启停 DB44.DBX0.0")] /// /// PLC的系统自动启停 DB44.DBX0.0 /// public bool PlcSystemIsAutoRun { get; set; } = false; [VarComm("Global", "PLC的系统自动暂停/开始 DB44.DBX0.2")] /// /// PLC的系统自动暂停/开始 DB44.DBX0.2 /// public bool PlcSystemIsPause { get; set; } = false; [VarComm("Global", "延迟采集料仓的配料完成重量")] /// /// 延迟采集料仓的配料完成重量 /// public int Time { get; set; } = 2000; [VarComm("Global", "取消订单的步骤号")] /// /// 取消订单的步骤: 1-9:配料过程中配方1取消配方 10-19:配料过程中配方2取消配方 20-29:下发订单的过程中取消订单(订单未到达上位机) 30-39:下发订单的过程中取消订单(订单未到达PLC) /// public int OrderCancelStep { get; set; } = 0; [VarComm("Global", "机器人的状态")] /// /// 机器人的状态 /// public ushort RobotStatus { get; set; } = 0; [VarComm("Global", "机器人的程序号")] /// /// 机器人的程序号 /// public byte RobotProgramNum { get; set; } = 0; /// /// 最近一次下发订单的时间 /// public DateTime LatestIssueRecipe { get; set; } = new DateTime(2023, 5, 1, 00, 00, 00); #endregion } public enum IssueRecipeCondition { 等待小料站PLC允许下配方, 等待西门子下发配方, 等待西门子下发配方信号复位, 等待上位机请求配料, 等待西门子确认配料, 等待西门子确认配料信号复位, } public enum ProcessCondition { 等待AGV到位, 等待小料站PLC接受配方完成, 等待配方配料完成, 等待AGV取托盘完成 } }