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