diff --git a/BPASmartClient.JXJFoodBigStation/App.xaml.cs b/BPASmartClient.JXJFoodBigStation/App.xaml.cs index 385985dc..6c30552b 100644 --- a/BPASmartClient.JXJFoodBigStation/App.xaml.cs +++ b/BPASmartClient.JXJFoodBigStation/App.xaml.cs @@ -29,7 +29,6 @@ namespace BPASmartClient.JXJFoodBigStation DataInit(); ProcessControl.GetInstance.Init(); MainView mv = new MainView(); - //mv.Show(); LoginView lv = new LoginView(); var res = lv.ShowDialog(); if (res != null && res == true) diff --git a/BPASmartClient.JXJFoodBigStation/Model/DeviceCurrentStatus.cs b/BPASmartClient.JXJFoodBigStation/Model/DeviceCurrentStatus.cs index 1b1be6ac..1a79f8d4 100644 --- a/BPASmartClient.JXJFoodBigStation/Model/DeviceCurrentStatus.cs +++ b/BPASmartClient.JXJFoodBigStation/Model/DeviceCurrentStatus.cs @@ -13,7 +13,9 @@ namespace BPASmartClient.JXJFoodBigStation.Model public double Weight { get { return _mWeight; } set { _mWeight = value; OnPropertyChanged(); } } private double _mWeight; - + /// + /// 运行状态 + /// public bool RunStatus { get { return _mRunStatus; } set { _mRunStatus = value; OnPropertyChanged(); } } private bool _mRunStatus; @@ -21,6 +23,9 @@ namespace BPASmartClient.JXJFoodBigStation.Model public string DeviceName { get { return _mDeviceName; } set { _mDeviceName = value; OnPropertyChanged(); } } private string _mDeviceName; + /// + /// 设备编号 + /// public int DeviceNum { get { return _mDeviceNum; } set { _mDeviceNum = value; OnPropertyChanged(); } } private int _mDeviceNum; diff --git a/BPASmartClient.JXJFoodBigStation/Model/GVL_BigStation.cs b/BPASmartClient.JXJFoodBigStation/Model/GVL_BigStation.cs index 6b1edda7..902b256c 100644 --- a/BPASmartClient.JXJFoodBigStation/Model/GVL_BigStation.cs +++ b/BPASmartClient.JXJFoodBigStation/Model/GVL_BigStation.cs @@ -16,37 +16,30 @@ namespace BPASmartClient.JXJFoodBigStation.Model /// public static bool HeartBeatFromPlc { get; set; } /// - /// 往输送带下发配方完成 - /// - public bool IssueRecipeFinish { get; set; } = false; - /// - /// 当前料仓的位置 - /// - public int StockInIsWork { get; set; } = 0; - /// - /// 单个配方执行完成标志 + /// 配方下发状态 =0:配方未下发 ,1:配方下发给plc ,2:plc成功接收配方 /// - public bool RecipeFinish { get; set; } = false; + public static int Recipe1DosingStatus { get; set; } /// - /// 记录AGV进站送货的指令顺序 + /// 配方下发状态 =0:配方未下发 ,1:配方下发给plc ,2:plc成功接收配方 /// - public int AgvDeliveryPosition { get; set; } + public static int Recipe2DosingStatus { get; set; } /// - /// 记录AGV进站取货的指令顺序 + /// 配方下发状态 =0:配方未下发 ,1:配方下发给plc ,2:plc成功接收配方 /// - public int AgvPickUpPosition { get; set; } - + public static int Recipe3DosingStatus { get; set; } /// /// 配方下发状态 =0:配方未下发 ,1:配方下发给plc ,2:plc成功接收配方 /// - public static int Recipe1DosingStatus { get; set; } - public static int Recipe2DosingStatus { get; set; } - public static int Recipe3DosingStatus { get; set; } public static int Recipe4DosingStatus { get; set; } - /// /// 是否处于手动下发配方 /// public static bool IsUseLocalRecipe { get; set; } = false; + /// + /// 订单请求 + /// + public static bool Order_Request { get; set; } = false; + + public const int StockBinNum = 12; } } diff --git a/BPASmartClient.JXJFoodBigStation/Model/HK_PLC/DB_Read.cs b/BPASmartClient.JXJFoodBigStation/Model/HK_PLC/DB_Read.cs index 57c738b1..a0138be2 100644 --- a/BPASmartClient.JXJFoodBigStation/Model/HK_PLC/DB_Read.cs +++ b/BPASmartClient.JXJFoodBigStation/Model/HK_PLC/DB_Read.cs @@ -8,20 +8,37 @@ namespace BPASmartClient.JXJFoodBigStation.Model.HK_PLC { public class DB_Read { + /// + /// plc心跳上报 + /// public bool HeartBeat { get; set; } + /// + /// 配方1允许下发配方 + /// public bool IsAllowIssueRecipe1 { get; set; } public bool IsAllowIssueRecipe2 { get; set; } public bool IsAllowIssueRecipe3 { get; set; } public bool IsAllowIssueRecipe4 { get; set; } + + /// + /// 配方1 接收配方完成 + /// public bool ReceiveFinishRecipe1 { get; set; } public bool ReceiveFinishRecipe2 { get; set; } public bool ReceiveFinishRecipe3 { get; set; } public bool ReceiveFinishRecipe4 { get; set; } + /// + /// 配方1 配料完成 + /// public bool Recipe1DosingFinish { get; set; } public bool Recipe2DosingFinish { get; set; } public bool Recipe3DosingFinish { get; set; } public bool Recipe4DosingFinish { get; set; } + + /// + /// 配方1 托盘编号 + /// public short Recipe1TrayCode { get; set; } public short Recipe2TrayCode { get; set; } public short Recipe3TrayCode { get; set; } diff --git a/BPASmartClient.JXJFoodBigStation/Model/HK_PLC/DataComm.cs b/BPASmartClient.JXJFoodBigStation/Model/HK_PLC/DataComm.cs deleted file mode 100644 index df85bc0c..00000000 --- a/BPASmartClient.JXJFoodBigStation/Model/HK_PLC/DataComm.cs +++ /dev/null @@ -1,41 +0,0 @@ -using BPASmartClient.Helper; -using BPASmartClient.Modbus; -using System; -using System.Collections.Concurrent; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace BPASmartClient.JXJFoodBigStation.Model.HK_PLC -{ - public class DataComm - { - public volatile static DataComm Instance; - public static DataComm GetInstance => Instance ?? (new DataComm()); - public DataComm() { } - /// - /// 是否允许配料 - /// - public bool IsAllowDosing { get { return _mIsAllowDosing; } set { _mIsAllowDosing = value; } } - private bool _mIsAllowDosing; - - public bool DosingFinishToPLC { get { return _mDosingFinishToPLC; } set { _mDosingFinishToPLC = value; } } - private bool _mDosingFinishToPLC; - - private int _mStockBinLocationToPLC; - public int StockBinLocationToPLC { get { return _mStockBinLocationToPLC; } set { _mStockBinLocationToPLC = value; } } - - public bool StatusSignToBPA { get { return _mStatusSignToBPA; } set { _mStatusSignToBPA = value; } } - private bool _mStatusSignToBPA; - - private int _mStockBinLocationToBPA; - public int StockBinLocationToBPA { get { return _mStockBinLocationToBPA; } set { _mStockBinLocationToBPA = value; } } - - private int _mBarrelNumToPLC; - public int BarrelNumToPLC { get { return _mBarrelNumToPLC; } set { _mBarrelNumToPLC = value; } } - - /*public ConcurrentDictionary DeviceLists = new ConcurrentDictionary();*/ - } - -} diff --git a/BPASmartClient.JXJFoodBigStation/Model/HK_PLC/HKDeviceStatus.cs b/BPASmartClient.JXJFoodBigStation/Model/HK_PLC/HKDeviceStatus.cs index 38cd6123..c056e608 100644 --- a/BPASmartClient.JXJFoodBigStation/Model/HK_PLC/HKDeviceStatus.cs +++ b/BPASmartClient.JXJFoodBigStation/Model/HK_PLC/HKDeviceStatus.cs @@ -52,7 +52,7 @@ namespace BPASmartClient.JXJFoodBigStation.Model.HK_PLC PlcWrite.TrayCode = Convert.ToInt16(recipe.TrayCode); for (int barrel = 1; barrel < 6; barrel++) { - if (barrel != 3) + if (barrel != 3)//桶的编号不为3 只为1,2,4,5号桶 { for (int loc = 1; loc < 15; loc++) { diff --git a/BPASmartClient.JXJFoodBigStation/Model/ProcessControl.cs b/BPASmartClient.JXJFoodBigStation/Model/ProcessControl.cs index 58d0629c..d312f5e9 100644 --- a/BPASmartClient.JXJFoodBigStation/Model/ProcessControl.cs +++ b/BPASmartClient.JXJFoodBigStation/Model/ProcessControl.cs @@ -20,12 +20,9 @@ namespace BPASmartClient.JXJFoodBigStation.Model private volatile static ProcessControl _Instance; public static ProcessControl GetInstance => _Instance ?? (_Instance = new ProcessControl()); private ProcessControl() { } - - public SiemensDeviceStatus SiemensDevice = new SiemensDeviceStatus(); public HKDeviceStatus HKDevice = new HKDeviceStatus(); DL_Finish_DB FinishData = new DL_Finish_DB(); - /// /// 配方数据 /// @@ -45,24 +42,21 @@ namespace BPASmartClient.JXJFoodBigStation.Model public ConcurrentQueue RecipeQueue2 = new ConcurrentQueue(); public ConcurrentQueue RecipeQueue3 = new ConcurrentQueue(); public ConcurrentQueue RecipeQueue4 = new ConcurrentQueue(); - /// - /// 接收原料数据 - /// - public RecipeRawMaterial RawMaterial; public void Init() { + testData(); ActionManage.GetInstance.CancelRegister("SiemensSendRecipe"); ActionManage.GetInstance.Register(new Action((res) => { ObservableCollection RawMaterials = new ObservableCollection(); - if (SiemensDevice.IsConnected) + if (SiemensDevice.IsConnected ||true) { if (res != null && res is DL_Start_DB recipe) { RawMaterials.Clear(); - for (int i = 0; i < 15; i++) + for (int i = 0; i < 12; i++) { - if (RawMaterialsNamePos.ContainsKey(recipe.RecipeName)) + if (RawMaterialsNamePos.ContainsKey(recipe.Material[i].Material_Name)) { RawMaterials.Add(new RawMaterial() { @@ -98,7 +92,7 @@ namespace BPASmartClient.JXJFoodBigStation.Model HKDevice.Init(); MessageNotify.GetInstance.ShowRunLog("海科plc连接成功"); } - if (SiemensDevice.IsConnected) + if (SiemensDevice.IsConnected || true) { SiemensDevice.Init(); MessageNotify.GetInstance.ShowRunLog("西门子plc连接成功"); @@ -108,24 +102,10 @@ namespace BPASmartClient.JXJFoodBigStation.Model { } - - ActionManage.GetInstance.CancelRegister("ManualSendRecipe"); - ActionManage.GetInstance.Register(new Action((o) => - { - if (o != null && o is RecipeData a) - { - Json.Data.Recipes.Add(a); - for (int i = 0; i < Json.Data.Recipes.Count; i++) - { - foreach (var item in Json.Data.Recipes.ElementAt(i).RawMaterial) - { - item.RawMaterialLocation = Convert.ToInt32(item.RawMaterialName); - } - } - MessageNotify.GetInstance.ShowAlarmLog("手动下发配方完成"); - } - }), "ManualSendRecipe", true); RecipeQueue1.Clear(); + RecipeQueue2.Clear(); + RecipeQueue3.Clear(); + RecipeQueue4.Clear(); ThreadManage.GetInstance().StartLong(new Action(() => { SystemStatus(); @@ -152,22 +132,22 @@ namespace BPASmartClient.JXJFoodBigStation.Model { foreach (var data in Recipes) { - if (RecipeQueue1.Count == 0) + if (RecipeQueue1.Count == 0 && !RecipeQueue2.Contains(data.RecipeCode) && !RecipeQueue3.Contains(data.RecipeCode) && !RecipeQueue4.Contains(data.RecipeCode)) { if (!(RecipeQueue1.Contains(data.RecipeCode))) RecipeQueue1.Enqueue(data.RecipeCode); } - else if (RecipeQueue2.Count == 0) + else if (RecipeQueue2.Count == 0 && !RecipeQueue1.Contains(data.RecipeCode) && !RecipeQueue3.Contains(data.RecipeCode) && !RecipeQueue4.Contains(data.RecipeCode)) { if (!(RecipeQueue2.Contains(data.RecipeCode))) RecipeQueue2.Enqueue(data.RecipeCode); } - else if (RecipeQueue3.Count == 0) + else if (RecipeQueue3.Count == 0 && !RecipeQueue1.Contains(data.RecipeCode) && !RecipeQueue2.Contains(data.RecipeCode) && !RecipeQueue4.Contains(data.RecipeCode)) { if (!(RecipeQueue3.Contains(data.RecipeCode))) RecipeQueue3.Enqueue(data.RecipeCode); } - else if (RecipeQueue4.Count == 0) + else if (RecipeQueue4.Count == 0 && !RecipeQueue1.Contains(data.RecipeCode) && !RecipeQueue2.Contains(data.RecipeCode) && !RecipeQueue3.Contains(data.RecipeCode)) { if (!(RecipeQueue4.Contains(data.RecipeCode))) RecipeQueue4.Enqueue(data.RecipeCode); @@ -292,11 +272,15 @@ namespace BPASmartClient.JXJFoodBigStation.Model IssuedComplete.Add(Recipes.ElementAt(index));//将配方添加到完成列表 if (!GVL_BigStation.IsUseLocalRecipe) { - Json.Data.Recipes.RemoveAt(index);//制作完成,移除当前配方 + App.Current.Dispatcher.Invoke(() => { + Json.Data.Recipes.RemoveAt(index);//制作完成,移除当前配方 + }); } else { - Json.Data.Recipes.RemoveAt(index);//制作完成,移除当前配方 + App.Current.Dispatcher.Invoke(() => { + Json.Data.Recipes.RemoveAt(index);//制作完成,移除当前配方 + }); } GVL_BigStation.Recipe1DosingStatus = 0; } @@ -529,7 +513,6 @@ namespace BPASmartClient.JXJFoodBigStation.Model } GVL_BigStation.Recipe3DosingStatus = 0; } - } } if (RecipeQueue4.Count > 0) @@ -653,7 +636,6 @@ namespace BPASmartClient.JXJFoodBigStation.Model /// private void StockBinParReset() { - HKDevice.PlcWrite.RecipeCode = 0; HKDevice.PlcWrite.TrayCode = 0; diff --git a/BPASmartClient.JXJFoodBigStation/Model/RawMaterial/RecipeData.cs b/BPASmartClient.JXJFoodBigStation/Model/RawMaterial/RecipeData.cs index 03ae60cf..aa3f42fa 100644 --- a/BPASmartClient.JXJFoodBigStation/Model/RawMaterial/RecipeData.cs +++ b/BPASmartClient.JXJFoodBigStation/Model/RawMaterial/RecipeData.cs @@ -32,7 +32,5 @@ namespace BPASmartClient.JXJFoodBigStation.Model /// 原料数据 /// public ObservableCollection RawMaterial { get; set; } = new ObservableCollection(); - - } } diff --git a/BPASmartClient.JXJFoodBigStation/Model/Siemens/DL_DataColl_DB.cs b/BPASmartClient.JXJFoodBigStation/Model/Siemens/DL_DataColl_DB.cs index f7279b1a..1089aa60 100644 --- a/BPASmartClient.JXJFoodBigStation/Model/Siemens/DL_DataColl_DB.cs +++ b/BPASmartClient.JXJFoodBigStation/Model/Siemens/DL_DataColl_DB.cs @@ -13,25 +13,50 @@ namespace BPASmartClient.JXJFoodBigStation.Model.Siemens public string RecipeCode { get; set; } [Siemens(16)] public string RecipeName { get; set; } - public bool var1 { get; set; } - public bool var2 { get; set; } - - public bool var3 { get; set; } - - public bool var4 { get; set; } - - public bool var5 { get; set; } - - public bool var6 { get; set; } - - public bool var7 { get; set; } - - public bool var8 { get; set; } - - public bool var9 { get; set; } - public short Mode { get; set; } - - public bool[] Alarm { get; set; } = new bool[24]; + /// + /// 缺料本机 + /// + public bool DeviceInComplete { get; set; } + /// + /// 上游缺料 + /// + public bool TopInComple { get; set; } + /// + /// 下游堵料 + /// + public bool DownWindrow { get; set; } + /// + /// 设备启动 + /// + public bool DeviceStart { get; set; } + /// + /// 设备停止 + /// + public bool DeviceStop { get; set; } + /// + /// 设备急停 + /// + public bool DeviceEStop { get; set; } + /// + /// 设备暂停 + /// + public bool DevicePause { get; set; } + /// + /// 设备故障 + /// + public bool DeviceAlarm { get; set; } + /// + /// 上位机给plc的心跳 + /// + public bool HeartBeat { get; set; } + /// + /// 设备模式 + /// + public short DeviceMode { get; set; } + /// + /// 设备报警 + /// + public bool[] AlarmInfo { get; set; } = new bool[24]; public int Reserved1 { get; set; } public int Reserved2 { get; set; } diff --git a/BPASmartClient.JXJFoodBigStation/Model/Siemens/DL_Start_DB.cs b/BPASmartClient.JXJFoodBigStation/Model/Siemens/DL_Start_DB.cs index a4a5c592..c90f5442 100644 --- a/BPASmartClient.JXJFoodBigStation/Model/Siemens/DL_Start_DB.cs +++ b/BPASmartClient.JXJFoodBigStation/Model/Siemens/DL_Start_DB.cs @@ -19,20 +19,37 @@ namespace BPASmartClient.JXJFoodBigStation.Model.Siemens /// 配发名称 /// public string RecipeName { get; set; } - public short Order_No { get; set; } + /// + /// 工位号 + /// + public short Job_No { get; set; } + /// + /// 托盘号 + /// public short Pallet_No { get; set; } /// /// 物料信息 /// public UDT[] Material { get; set; } = new UDT[20]; + /// + /// 订单类型(0.其他、 1.洗锅) + /// public bool Order_Type { get; set; } + /// + /// 订单请求确认 + /// public bool Order_Request_Ack { get; set; } - + /// + /// 备用 + /// public short[] Standby { get; set; } = new short[4]; /// /// 配方发送请求 /// - public bool Ask_For_Send_Bit { get; set; } + public bool Order_Request { get; set; } + /// + /// 备用 + /// public short[] Standby1 { get; set; } = new short[4]; } public class UDT diff --git a/BPASmartClient.JXJFoodBigStation/Model/Siemens/SiemensCommAddress.cs b/BPASmartClient.JXJFoodBigStation/Model/Siemens/SiemensCommAddress.cs index ceba7e2c..0ffa682a 100644 --- a/BPASmartClient.JXJFoodBigStation/Model/Siemens/SiemensCommAddress.cs +++ b/BPASmartClient.JXJFoodBigStation/Model/Siemens/SiemensCommAddress.cs @@ -8,380 +8,7 @@ namespace BPASmartClient.JXJFoodBigStation.Model.Siemens { public class SiemensCommAddress { - #region 配方地址 - /// - /// 配方状态 - /// - public static string RecipeState { get; set; } = ""; - /// - /// 配方名称 - /// - public static string RecipeName { get; set; } = ""; - /// - /// 配方ID - /// - public static string RecipeID { get; set; } = ""; - /// - /// 原料信息 - /// - public static string RawMaterial { get; set; } = ""; - #endregion - #region AGV到位(与西门子PLC交互)西门子PLC ==> 上位机 - /// - /// 托盘的位置编号 - /// - public static string TrayLocationNum { get; set; } = ""; - /// - /// 配方ID - /// - public static string TrayRecipeID { get; set; } = ""; - /// - /// 状态信号 - /// - public static string StateSign { get; set; } = ""; - #endregion - #region Tray配料完成(与西门子PLC交互)上位机 ==> 西门子PLC - public static string TrayLocationNumToSiemens { get; set; } = ""; - public static string TrayRecipeIDToSiemens { get; set; } = ""; - public static string TrayStateToSiemens { get; set; } = ""; - #endregion - /*#region AGV小车进出工站1 - /// - /// Agv送货 进站申请 从西门子读取 - /// - public static string DeliveryAGVApply1 { get; set; } = ""; - /// - /// Agv送货 进站申请 写给西门子 - /// - public static string DeliveryAGVIsApply1 { get; set; } = ""; - /// - /// Agv送货 进站顶升申请 从西门子读取 - /// - public static string DeliveryAGVApplyJack1 { get; set; } = ""; - /// - /// Agv送货 进站顶升申请 写给西门子 - /// - public static string DeliveryAGVIsApplyJack1 { get; set; } = ""; - /// - /// Agv送货 送货完成 从西门子读取 - /// - public static string DeliveryAGVFinsih1{ get; set; } = ""; - /// - /// Agv送货 工位上有货架 写给西门子 - /// - public static string StationHaveCargo1 { get; set; } = ""; - /// - /// Agv送货 进站申请 从西门子读取 - /// - public static string PickAGVApply1 { get; set; } = ""; - /// - /// Agv送货 进站申请 写给西门子 - /// - public static string PickAGVIsApply1 { get; set; } = ""; - /// - /// Agv送货 取货架完成 从西门子读取 - /// - public static string PickCargoAGVFinish1 { get; set; } = ""; - /// - /// Agv送货 取料完成 写给西门子 - /// - public static string PickAGVFinish1 { get; set; } = ""; - /// - /// 工位上是否有小车 - /// - public static string StationIsExistCar1 { get; set; } = ""; - #endregion - #region AGV小车进出工站2 - /// - /// Agv送货 进站申请 从西门子读取 - /// - public static string DeliveryAGVApply2 { get; set; } = ""; - /// - /// Agv送货 进站申请 写给西门子 - /// - public static string DeliveryAGVIsApply2 { get; set; } = ""; - /// - /// Agv送货 进站顶升申请 从西门子读取 - /// - public static string DeliveryAGVApplyJack2 { get; set; } = ""; - /// - /// Agv送货 进站顶升申请 写给西门子 - /// - public static string DeliveryAGVIsApplyJack2 { get; set; } = ""; - /// - /// Agv送货 送货完成 从西门子读取 - /// - public static string DeliveryAGVFinsih2 { get; set; } = ""; - /// - /// Agv送货 工位上有货架 写给西门子 - /// - public static string StationHaveCargo2 { get; set; } = ""; - /// - /// Agv送货 进站申请 从西门子读取 - /// - public static string PickAGVApply2 { get; set; } = ""; - /// - /// Agv送货 进站申请 写给西门子 - /// - public static string PickAGVIsApply2 { get; set; } = ""; - /// - /// Agv送货 取货架完成 从西门子读取 - /// - public static string PickCargoAGVFinish2 { get; set; } = ""; - /// - /// Agv送货 取料完成 写给西门子 - /// - public static string PickAGVFinish2 { get; set; } = ""; - /// - /// 工位上是否有小车 - /// - public static string StationIsExistCar2 { get; set; } = ""; - #endregion - #region AGV小车进出工站3 - /// - /// Agv送货 进站申请 从西门子读取 - /// - public static string DeliveryAGVApply3 { get; set; } = ""; - /// - /// Agv送货 进站申请 写给西门子 - /// - public static string DeliveryAGVIsApply3 { get; set; } = ""; - /// - /// Agv送货 进站顶升申请 从西门子读取 - /// - public static string DeliveryAGVApplyJack3 { get; set; } = ""; - /// - /// Agv送货 进站顶升申请 写给西门子 - /// - public static string DeliveryAGVIsApplyJack3 { get; set; } = ""; - /// - /// Agv送货 送货完成 从西门子读取 - /// - public static string DeliveryAGVFinsih3 { get; set; } = ""; - /// - /// Agv送货 工位上有货架 写给西门子 - /// - public static string StationHaveCargo3 { get; set; } = ""; - /// - /// Agv送货 进站申请 从西门子读取 - /// - public static string PickAGVApply3 { get; set; } = ""; - /// - /// Agv送货 进站申请 写给西门子 - /// - public static string PickAGVIsApply3 { get; set; } = ""; - /// - /// Agv送货 取货架完成 从西门子读取 - /// - public static string PickCargoAGVFinish3 { get; set; } = ""; - /// - /// Agv送货 取料完成 写给西门子 - /// - public static string PickAGVFinish3 { get; set; } = ""; - /// - /// 工位上是否有小车 - /// - public static string StationIsExistCar3 { get; set; } = ""; - #endregion - #region AGV小车进出工站4 - /// - /// Agv送货 进站申请 从西门子读取 - /// - public static string DeliveryAGVApply4 { get; set; } = ""; - /// - /// Agv送货 进站申请 写给西门子 - /// - public static string DeliveryAGVIsApply4 { get; set; } = ""; - /// - /// Agv送货 进站顶升申请 从西门子读取 - /// - public static string DeliveryAGVApplyJack4 { get; set; } = ""; - /// - /// Agv送货 进站顶升申请 写给西门子 - /// - public static string DeliveryAGVIsApplyJack4 { get; set; } = ""; - /// - /// Agv送货 送货完成 从西门子读取 - /// - public static string DeliveryAGVFinsih4 { get; set; } = ""; - /// - /// Agv送货 工位上有货架 写给西门子 - /// - public static string StationHaveCargo4 { get; set; } = ""; - /// - /// Agv送货 进站申请 从西门子读取 - /// - public static string PickAGVApply4 { get; set; } = ""; - /// - /// Agv送货 进站申请 写给西门子 - /// - public static string PickAGVIsApply4 { get; set; } = ""; - /// - /// Agv送货 取货架完成 从西门子读取 - /// - public static string PickCargoAGVFinish4 { get; set; } = ""; - /// - /// Agv送货 取料完成 写给西门子 - /// - public static string PickAGVFinish4 { get; set; } = ""; - /// - /// 工位上是否有小车 - /// - public static string StationIsExistCar4 { get; set; } = ""; - #endregion - #region AGV小车进出工站5 - /// - /// Agv送货 进站申请 从西门子读取 - /// - public static string DeliveryAGVApply5 { get; set; } = ""; - /// - /// Agv送货 进站申请 写给西门子 - /// - public static string DeliveryAGVIsApply5 { get; set; } = ""; - /// - /// Agv送货 进站顶升申请 从西门子读取 - /// - public static string DeliveryAGVApplyJack5 { get; set; } = ""; - /// - /// Agv送货 进站顶升申请 写给西门子 - /// - public static string DeliveryAGVIsApplyJack5 { get; set; } = ""; - /// - /// Agv送货 送货完成 从西门子读取 - /// - public static string DeliveryAGVFinsih5 { get; set; } = ""; - /// - /// Agv送货 工位上有货架 写给西门子 - /// - public static string StationHaveCargo5 { get; set; } = ""; - /// - /// Agv送货 进站申请 从西门子读取 - /// - public static string PickAGVApply5 { get; set; } = ""; - /// - /// Agv送货 进站申请 写给西门子 - /// - public static string PickAGVIsApply5 { get; set; } = ""; - /// - /// Agv送货 取货架完成 从西门子读取 - /// - public static string PickCargoAGVFinish5 { get; set; } = ""; - /// - /// Agv送货 取料完成 写给西门子 - /// - public static string PickAGVFinish5 { get; set; } = ""; - /// - /// 工位上是否有小车 - /// - public static string StationIsExistCar5 { get; set; } = ""; - #endregion - #region AGV小车进出工站6 - /// - /// Agv送货 进站申请 从西门子读取 - /// - public static string DeliveryAGVApply6 { get; set; } = ""; - /// - /// Agv送货 进站申请 写给西门子 - /// - public static string DeliveryAGVIsApply6 { get; set; } = ""; - /// - /// Agv送货 进站顶升申请 从西门子读取 - /// - public static string DeliveryAGVApplyJack6 { get; set; } = ""; - /// - /// Agv送货 进站顶升申请 写给西门子 - /// - public static string DeliveryAGVIsApplyJack6 { get; set; } = ""; - /// - /// Agv送货 送货完成 从西门子读取 - /// - public static string DeliveryAGVFinsih6 { get; set; } = ""; - /// - /// Agv送货 工位上有货架 写给西门子 - /// - public static string StationHaveCargo6 { get; set; } = ""; - /// - /// Agv送货 进站申请 从西门子读取 - /// - public static string PickAGVApply6 { get; set; } = ""; - /// - /// Agv送货 进站申请 写给西门子 - /// - public static string PickAGVIsApply6 { get; set; } = ""; - /// - /// Agv送货 取货架完成 从西门子读取 - /// - public static string PickCargoAGVFinish6 { get; set; } = ""; - /// - /// Agv送货 取料完成 写给西门子 - /// - public static string PickAGVFinish6 { get; set; } = ""; - /// - /// 工位上是否有小车 - /// - public static string StationIsExistCar6 { get; set; } = ""; - #endregion*/ - #region AGV进出站 - /// - /// Agv送货 进站申请 - /// - public static string DeliveryAGVApply { get; set; } = "M4002"; - /// - /// Agv送货 进站申请 - /// - public static string DeliveryAGVIsApply { get; set; } = "M5002"; - /// - /// Agv送货 进站顶升申请 - /// - public static string DeliveryAGVApplyJack { get; set; } = "M4004"; - /// - /// Agv送货 进站顶升申请 - /// - public static string DeliveryAGVIsApplyJack { get; set; } = "M5004"; - /// - /// Agv送货 送货完成 - /// - public static string DeliveryAGVFinsih { get; set; } = "M4005"; - /// - /// Agv送货 工位上有货架 - /// - public static string StationHaveCargo { get; set; } = "M5005"; - /// - /// Agv送货 进站申请 - /// - public static string PickAGVApply { get; set; } = "M4003"; - /// - /// Agv送货 进站申请 - /// - public static string PickAGVIsApply { get; set; } = "M5003"; - /// - /// Agv送货 取货架完成 - /// - public static string PickCargoAGVFinish { get; set; } = "M4006"; - /// - /// Agv送货 取料完成 - /// - public static string PickAGVFinish { get; set; } = "M5006"; - /// - /// 工位上是否有小车 - /// - public static string StationIsExistCar { get; set; } = "M4007"; - #endregion - } - public class RecipeRawMaterial - { - /// - /// 原料对应的桶号 - /// - public int[] RawMaterialBarrelNum = new int[15]; - /// - /// 需要原料重量 - /// - public double[] RawMaterialWeight = new double[15]; - /// - /// 原料对应料仓的位置 - /// - public int[] RawMaterialLocation = new int[15]; + } } diff --git a/BPASmartClient.JXJFoodBigStation/Model/Siemens/SiemensDeviceStatus.cs b/BPASmartClient.JXJFoodBigStation/Model/Siemens/SiemensDeviceStatus.cs index 4b6e425f..d02a7bab 100644 --- a/BPASmartClient.JXJFoodBigStation/Model/Siemens/SiemensDeviceStatus.cs +++ b/BPASmartClient.JXJFoodBigStation/Model/Siemens/SiemensDeviceStatus.cs @@ -15,9 +15,10 @@ namespace BPASmartClient.JXJFoodBigStation.Model.Siemens public SiemensHelper Siemens_PLC_S7 = new SiemensHelper(); public bool IsConnected => Siemens_PLC_S7.IsConnected; + bool a = false; public void Init() { - if (IsConnected) + if (IsConnected) { ThreadManage.GetInstance().StartLong(new Action(() => { @@ -25,6 +26,36 @@ namespace BPASmartClient.JXJFoodBigStation.Model.Siemens var res1 = this.Siemens_PLC_S7.ReadClass(2331); var res2 = this.Siemens_PLC_S7.ReadClass(2361); var res3 = this.Siemens_PLC_S7.ReadClass(2391); + if (res != null && res is DL_Start_DB start) + { + if (a) + { + start.RecipeName = "配方1"; + start.RecipeCode = "1201"; + start.Order_Request_Ack = true; + + for (int i = 0; i < GVL_BigStation.StockBinNum ; i++) + { + start.Material[i] = new UDT(); + start.Material[i].Material_Name = "" + (i +1); + start.Material[i].Material_Weight = 100 + (i + 1); + start.Material[i].Material_BarrelNum = (short)(i + 1); + } + } + if (RTrig.GetInstance("Order_Request").Start(GVL_BigStation.Order_Request)) + { + start.Order_Request = true; + Siemens_PLC_S7.WriteClass(start, 2301); + } + if (RTrig.GetInstance("Order_Request_Ack").Start(start.Order_Request_Ack)) + { + ActionManage.GetInstance.Send("SiemensSendRecipe", start); + } + } + if (res1 != null && res1 is DL_Status_DB status) + { + + } if (res2 != null && res2.Ask_For_Finish_PLC) { ActionManage.GetInstance.Send("配料完成信号确认完成"); diff --git a/BPASmartClient.JXJFoodBigStation/Model/TestData.cs b/BPASmartClient.JXJFoodBigStation/Model/TestData.cs index a3fb8bc5..db64053d 100644 --- a/BPASmartClient.JXJFoodBigStation/Model/TestData.cs +++ b/BPASmartClient.JXJFoodBigStation/Model/TestData.cs @@ -17,96 +17,26 @@ namespace BPASmartClient.JXJFoodBigStation.Model public ObservableCollection RawMaterials { get; set; } = new ObservableCollection(); public TestData() { - string recipeName = "配方1"; - string recipeCode = "10001"; - int Traycode = 1; - - float RawmaterialWeight = 10; - short RawMaterialbarrelNum = 1; - int RawMaterialLocation = 5; - - float RawmaterialWeight1 = 20; - short RawMaterialbarrelNum1 = 2; - int RawMaterialLocation1 = 7; - - float RawmaterialWeight2 = 30; - short RawMaterialbarrelNum2 = 3; - int RawMaterialLocation2 = 9; - RawMaterials.Add(new RawMaterial() - { - DeviceIp = RawMaterials.Count + 1, - RawMaterialWeight = RawmaterialWeight, - RawMaterialBarrelNum = RawMaterialbarrelNum, - RawMaterialLocation = RawMaterialLocation - }); - RawMaterials.Add(new RawMaterial() - { - DeviceIp = RawMaterials.Count + 1, - RawMaterialWeight = RawmaterialWeight1, - RawMaterialBarrelNum = RawMaterialbarrelNum1, - RawMaterialLocation = RawMaterialLocation1 - }); - RawMaterials.Add(new RawMaterial() - { - DeviceIp = RawMaterials.Count + 1, - RawMaterialWeight = RawmaterialWeight2, - RawMaterialBarrelNum = RawMaterialbarrelNum2, - RawMaterialLocation = RawMaterialLocation2 - }); - - Recipes.Add(new Model.RecipeData() - { - RecipeName = recipeName, - RecipeCode = recipeCode, - TrayCode = Traycode, - RawMaterial = RawMaterials - }); - - RawMaterials.Clear(); - string recipeName_2 = "配方2"; - string recipeCode_2 = "20001"; - int Traycode_2 = 3; - - float RawmaterialWeight_2 = 10; - short RawMaterialbarrelNum_2 = 1; - int RawMaterialLocation_2 = 5; - - float RawmaterialWeight1_2 = 20; - short RawMaterialbarrelNum1_2 = 2; - int RawMaterialLocation1_2 = 7; - - float RawmaterialWeight2_2 = 30; - short RawMaterialbarrelNum2_2 = 3; - int RawMaterialLocation2_2 = 9; - RawMaterials.Add(new RawMaterial() - { - DeviceIp = RawMaterials.Count + 1, - RawMaterialWeight = RawmaterialWeight_2, - RawMaterialBarrelNum = RawMaterialbarrelNum_2, - RawMaterialLocation = RawMaterialLocation_2 - }); - RawMaterials.Add(new RawMaterial() - { - DeviceIp = RawMaterials.Count + 1, - RawMaterialWeight = RawmaterialWeight1_2, - RawMaterialBarrelNum = RawMaterialbarrelNum1_2, - RawMaterialLocation = RawMaterialLocation1_2 - }); - RawMaterials.Add(new RawMaterial() - { - DeviceIp = RawMaterials.Count + 1, - RawMaterialWeight = RawmaterialWeight2_2, - RawMaterialBarrelNum = RawMaterialbarrelNum2_2, - RawMaterialLocation = RawMaterialLocation2_2 - }); - - Recipes.Add(new Model.RecipeData() - { - RecipeName = recipeName_2, - RecipeCode = recipeCode_2, - TrayCode = Traycode_2, - RawMaterial = RawMaterials - }); + for (int i = 0; i < 5; i++) + { + for (int j = 0; j < 10; i++) + { + RawMaterials.Add(new RawMaterial() + { + DeviceIp = RawMaterials.Count + 1, + RawMaterialWeight = new Random().Next(), + RawMaterialBarrelNum = j, + RawMaterialLocation = j + }); + } + Recipes.Add(new Model.RecipeData() + { + RecipeName = "配方" + i, + RecipeCode = new Random().Next(1000,9999) + "", + TrayCode = new Random().Next(1,3), + RawMaterial = RawMaterials + }); + } } } } diff --git a/BPASmartClient.JXJFoodBigStation/View/RecipeSendDownView.xaml b/BPASmartClient.JXJFoodBigStation/View/RecipeSendDownView.xaml index 6b05d7cf..f9553271 100644 --- a/BPASmartClient.JXJFoodBigStation/View/RecipeSendDownView.xaml +++ b/BPASmartClient.JXJFoodBigStation/View/RecipeSendDownView.xaml @@ -423,9 +423,7 @@ - - - - - - - - diff --git a/BPASmartClient.JXJFoodBigStation/View/SiemensRecipeSendDownView.xaml b/BPASmartClient.JXJFoodBigStation/View/SiemensRecipeSendDownView.xaml index 9ca42a87..945d9bdc 100644 --- a/BPASmartClient.JXJFoodBigStation/View/SiemensRecipeSendDownView.xaml +++ b/BPASmartClient.JXJFoodBigStation/View/SiemensRecipeSendDownView.xaml @@ -22,7 +22,7 @@ + Color="White" /> - - @@ -419,7 +407,7 @@ - + @@ -444,40 +432,97 @@ - - + - + - - - + + + + + + + + + + + + + + + + + + + + + Text="原料信息:" /> - + @@ -518,17 +563,12 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -