From 799a5e0dc998c8c5e57b65f244e68e9dcdb85e34 Mon Sep 17 00:00:00 2001 From: pengliangyang <1406009520@qq.com> Date: Thu, 29 Sep 2022 16:44:22 +0800 Subject: [PATCH] =?UTF-8?q?=E5=90=89=E9=A6=99=E5=B1=85=E4=BB=A3=E7=A0=81?= =?UTF-8?q?=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- BPASmartClient.JXJFoodBigStation/App.xaml.cs | 1 - .../Model/GVL_BigStation.cs | 4 +- .../Model/HK_PLC/HKDeviceStatus.cs | 72 ++-- .../Model/HK_PLC/HKPlcCommAddress.cs | 90 ----- .../Model/LocalRecipeDataColl.cs | 2 +- .../Model/ProcessControl.cs | 132 +++---- .../Model/RawMaterial/DeviceAddress.cs | 92 ----- .../{LocaPar.cs => LocalRecipe.cs} | 4 +- .../RawMaterial.cs} | 6 +- .../RawMaterial/RawMaterialDeviceStatus.cs | 44 --- .../Model/RawMaterial/RawMaterialModel.cs | 48 --- .../RecipeData.cs} | 4 +- .../Model/RawMaterial/RecipeModel.cs | 45 --- .../Model/Siemens/DL_Status_DB.cs | 2 +- .../Model/Siemens/RemoteRecipe.cs | 14 + .../Model/Siemens/SiemensDeviceStatus.cs | 17 +- .../Model/TestData.cs | 32 +- .../View/HardwareStatusView.xaml | 50 ++- .../ViewModel/ChangeDeviceNameViewModel.cs | 2 +- .../ViewModel/HardwareStatusViewModel.cs | 57 ++- .../ViewModel/RecipeInfosViewModel.cs | 31 +- .../ViewModel/RecipeReceiveViewModel.cs | 18 +- .../ViewModel/RecipeSendDownViewModel.cs | 9 +- .../App.xaml.cs | 9 +- .../BPASmartClient.JXJFoodSmallStation.csproj | 10 +- .../Model/GVL/GVL.cs | 13 + .../Model/GVL/ReadSmallMaterial.cs | 117 ++++++ .../Model/GVL/WriteSmallMaterial.cs | 185 +++++++++ .../Model/ProcessControl.cs | 21 +- .../Model/Siemens/LocalRecipeDataColl.cs | 4 +- .../Model/Siemens/RemoteRecipeRawMaterial.cs | 8 +- .../Model/TestData.cs | 12 +- .../View/NewLocalRecipeView.xaml | 235 +++++++++++ ...iew.xaml.cs => NewLocalRecipeView.xaml.cs} | 5 +- .../View/NewRemoteRecipeView.xaml | 236 ----------- .../View/RecipeInfosView.xaml | 68 ++-- .../View/RecipeInfosView.xaml.cs | 1 + .../View/RecipeReceiveView.xaml | 34 +- .../View/SiemensRecipeReceiveView.xaml | 150 +++++++ .../View/SiemensRecipeReceiveView.xaml.cs | 29 ++ .../View/WindSendParView.xaml | 370 ++++++++++++++++++ .../View/WindSendParView.xaml.cs | 28 ++ ...iewModel.cs => NewLocalRecipeViewModel.cs} | 37 +- .../ViewModel/RecipeInfosViewModel.cs | 3 - .../ViewModel/RecipeReceiveViewModel.cs | 43 +- .../SiemensRecipeReceiveViewModel.cs | 53 +++ .../ViewModel/WindSendParViewModel.cs | 69 ++++ 47 files changed, 1659 insertions(+), 857 deletions(-) delete mode 100644 BPASmartClient.JXJFoodBigStation/Model/RawMaterial/DeviceAddress.cs rename BPASmartClient.JXJFoodBigStation/Model/RawMaterial/{LocaPar.cs => LocalRecipe.cs} (65%) rename BPASmartClient.JXJFoodBigStation/Model/{Siemens/RemoteRecipeRawMaterial.cs => RawMaterial/RawMaterial.cs} (85%) delete mode 100644 BPASmartClient.JXJFoodBigStation/Model/RawMaterial/RawMaterialDeviceStatus.cs delete mode 100644 BPASmartClient.JXJFoodBigStation/Model/RawMaterial/RawMaterialModel.cs rename BPASmartClient.JXJFoodBigStation/Model/{Siemens/RemoteRecipeData.cs => RawMaterial/RecipeData.cs} (83%) delete mode 100644 BPASmartClient.JXJFoodBigStation/Model/RawMaterial/RecipeModel.cs create mode 100644 BPASmartClient.JXJFoodBigStation/Model/Siemens/RemoteRecipe.cs create mode 100644 BPASmartClient.JXJFoodSmallStation/Model/GVL/GVL.cs create mode 100644 BPASmartClient.JXJFoodSmallStation/Model/GVL/ReadSmallMaterial.cs create mode 100644 BPASmartClient.JXJFoodSmallStation/Model/GVL/WriteSmallMaterial.cs rename BPASmartClient.JXJFoodBigStation/Model/Siemens/RemoteRecipeDataColl.cs => BPASmartClient.JXJFoodSmallStation/Model/Siemens/LocalRecipeDataColl.cs (75%) create mode 100644 BPASmartClient.JXJFoodSmallStation/View/NewLocalRecipeView.xaml rename BPASmartClient.JXJFoodSmallStation/View/{NewRemoteRecipeView.xaml.cs => NewLocalRecipeView.xaml.cs} (80%) delete mode 100644 BPASmartClient.JXJFoodSmallStation/View/NewRemoteRecipeView.xaml create mode 100644 BPASmartClient.JXJFoodSmallStation/View/SiemensRecipeReceiveView.xaml create mode 100644 BPASmartClient.JXJFoodSmallStation/View/SiemensRecipeReceiveView.xaml.cs create mode 100644 BPASmartClient.JXJFoodSmallStation/View/WindSendParView.xaml create mode 100644 BPASmartClient.JXJFoodSmallStation/View/WindSendParView.xaml.cs rename BPASmartClient.JXJFoodSmallStation/ViewModel/{NewRemoteRecipeViewModel.cs => NewLocalRecipeViewModel.cs} (72%) create mode 100644 BPASmartClient.JXJFoodSmallStation/ViewModel/SiemensRecipeReceiveViewModel.cs create mode 100644 BPASmartClient.JXJFoodSmallStation/ViewModel/WindSendParViewModel.cs diff --git a/BPASmartClient.JXJFoodBigStation/App.xaml.cs b/BPASmartClient.JXJFoodBigStation/App.xaml.cs index a244f722..338f5f3c 100644 --- a/BPASmartClient.JXJFoodBigStation/App.xaml.cs +++ b/BPASmartClient.JXJFoodBigStation/App.xaml.cs @@ -128,7 +128,6 @@ namespace BPASmartClient.JXJFoodBigStation AssemblyName = "BPASmartClient.JXJFoodBigStation", ToggleWindowPath = "View.HardwareStatusView" }); - MenuManage.GetInstance.menuModels.Add(new MenuModel() { MainMenuIcon = "", diff --git a/BPASmartClient.JXJFoodBigStation/Model/GVL_BigStation.cs b/BPASmartClient.JXJFoodBigStation/Model/GVL_BigStation.cs index 67038353..28d2c8ca 100644 --- a/BPASmartClient.JXJFoodBigStation/Model/GVL_BigStation.cs +++ b/BPASmartClient.JXJFoodBigStation/Model/GVL_BigStation.cs @@ -33,9 +33,9 @@ namespace BPASmartClient.JXJFoodBigStation.Model public int AgvPickUpPosition { get; set; } /// - /// 配方配料的状态 0:无意义 ,1:plc允许下发配方 2:上位机下发配方 3:plc接收到配方(配料中) 4:配料完成 + /// 配方下发状态 =0:配方未下发 ,1:配方下发给plc ,2:plc成功接收配方 /// - public int RecipeDosingStatus { get; set; } + public int RecipeDosingStatus { get; set; } /// /// 是否处于手动下发配方 /// diff --git a/BPASmartClient.JXJFoodBigStation/Model/HK_PLC/HKDeviceStatus.cs b/BPASmartClient.JXJFoodBigStation/Model/HK_PLC/HKDeviceStatus.cs index 5397868f..35c7e144 100644 --- a/BPASmartClient.JXJFoodBigStation/Model/HK_PLC/HKDeviceStatus.cs +++ b/BPASmartClient.JXJFoodBigStation/Model/HK_PLC/HKDeviceStatus.cs @@ -24,50 +24,44 @@ namespace BPASmartClient.JXJFoodBigStation.Model.HK_PLC } } /// - /// 单个配料机配料完成 - /// - /// - public void SingleDosing(uint value) - { - if (IsConnected) - { - HK_PLC_S7.Write(HKPlcCommAddress.SingleStockBinLocationToPLC, value); - HK_PLC_S7.Write(HKPlcCommAddress.SingleDosingFinishToPLC, (ushort)1); - } - } - /// - /// 复位plc允许接料信号 - /// - public void AllowDosingSignReset() - { - HK_PLC_S7.Write(HKPlcCommAddress.IsAllowDosing,(ushort)0); - } - /// - /// 复位plc到达某料仓信号 - /// - public void StockStateSignReset() - { - HK_PLC_S7.Write(HKPlcCommAddress.StockState, (ushort)0); - } - /// - /// 复位一个配方配料完成信号 - /// - public void RecipeDosingFinishReset() - { - HK_PLC_S7.Write(HKPlcCommAddress.RecipeDosingFinish, (ushort)0); - } - /// /// 下发配方数据 /// - /// 单个桶的编号 - /// 单个桶对应的料仓位置 - public void StockBinPar(short[] Num, short[] Location,short[] Weight) + public void StockBinPar(RecipeData recipe) { if (IsConnected) { - HK_PLC_S7.Write(HKPlcCommAddress.BarrelNumToPLC, Num); - HK_PLC_S7.Write(HKPlcCommAddress.StockBinLocationToPLC, Location); - HK_PLC_S7.Write(HKPlcCommAddress.WeightToPLC, Weight); + if (recipe != null) + { + for (int barrel = 1; barrel < 6; barrel++) + { + for (int loc = 1; loc < 13; loc++) + { + int index = Array.FindIndex(recipe.RawMaterial.ToArray(), p => p.RawMaterialBarrelNum == barrel && p.RawMaterialLocation == loc); + if (barrel >= 3)//PLC没有3号桶的重量位置,故4,5号桶地址向前偏移48个位置 + { + if (index != -1) + { + HK_PLC_S7.Write("MD" + 4120 + (loc - 1) * 4 + (barrel - 1 - 1) * 48, recipe.RawMaterial.ElementAt(index).RawMaterialWeight); + } + else//不存在的原料信息,重量写0 + { + HK_PLC_S7.Write("MD" + 4120 + (loc - 1) * 4 + (barrel - 1 - 1) * 48, 0); + } + } + else + { + if (index != -1) + { + HK_PLC_S7.Write("MD" + 4120 + (loc - 1) * 4 + (barrel - 1) * 48, recipe.RawMaterial.ElementAt(index).RawMaterialWeight); + } + else//不存在的原料信息,重量写0 + { + HK_PLC_S7.Write("MD" + 4120 + (loc - 1) * 4 + (barrel - 1) * 48, 0); + } + } + } + } + } } } } diff --git a/BPASmartClient.JXJFoodBigStation/Model/HK_PLC/HKPlcCommAddress.cs b/BPASmartClient.JXJFoodBigStation/Model/HK_PLC/HKPlcCommAddress.cs index d223e113..b571013d 100644 --- a/BPASmartClient.JXJFoodBigStation/Model/HK_PLC/HKPlcCommAddress.cs +++ b/BPASmartClient.JXJFoodBigStation/Model/HK_PLC/HKPlcCommAddress.cs @@ -8,96 +8,6 @@ namespace BPASmartClient.JXJFoodBigStation.Model.HK_PLC { public class HKPlcCommAddress { - #region 海科PLC ==> 上位机 - public static string HeartHealth { get; set; } = "M5000.0"; - /// - /// 是否允许配料 - /// - public static string IsAllowDosing { get; set; } = ""; - /// - /// - /// - public static string StockBinLocation { get; set; } = ""; - /// - /// 当前料仓的状态(0:无意义,1:到达接料位置) - /// - public static string StockState { get; set; } = ""; - #endregion - #region 上位机 ==> 海科PLC - /// - /// 料仓位置(配置该配方,所需要多个原料桶,每个原料桶有多个料仓位置) - /// - public static string StockBinLocationToPLC { get; set; } = ""; - /// - /// 对应桶号 - /// - public static string BarrelNumToPLC { get; set; } = ""; - /// - /// 对应桶号 - /// - public static string WeightToPLC { get; set; } = ""; - /// - /// 当前配料机配料完成 - /// - public static string SingleDosingFinishToPLC { get; set; } = ""; - /// - /// 当前配料料仓的位置 - /// - public static string SingleStockBinLocationToPLC { get; set; } = ""; - /// - /// 配方配料完成 - /// - public static string RecipeDosingFinish { 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 StationIsExistTray { get; set; } = "M4007"; - #endregion - - public static string StationIsExistCar { get; set; } } } diff --git a/BPASmartClient.JXJFoodBigStation/Model/LocalRecipeDataColl.cs b/BPASmartClient.JXJFoodBigStation/Model/LocalRecipeDataColl.cs index 40957ee5..52920363 100644 --- a/BPASmartClient.JXJFoodBigStation/Model/LocalRecipeDataColl.cs +++ b/BPASmartClient.JXJFoodBigStation/Model/LocalRecipeDataColl.cs @@ -9,6 +9,6 @@ namespace BPASmartClient.JXJFoodBigStation.Model { public class LocalRecipeDataColl { - public ObservableCollection Recipes { get; set; } = new ObservableCollection(); + public ObservableCollection Recipes { get; set; } = new ObservableCollection(); } } diff --git a/BPASmartClient.JXJFoodBigStation/Model/ProcessControl.cs b/BPASmartClient.JXJFoodBigStation/Model/ProcessControl.cs index ec7af286..22d04b0f 100644 --- a/BPASmartClient.JXJFoodBigStation/Model/ProcessControl.cs +++ b/BPASmartClient.JXJFoodBigStation/Model/ProcessControl.cs @@ -21,7 +21,7 @@ namespace BPASmartClient.JXJFoodBigStation.Model public static ProcessControl GetInstance => _Instance ?? (_Instance = new ProcessControl()); private ProcessControl() { } - public ObservableCollection RawMaterials { get; set; } = new ObservableCollection(); + public SiemensDeviceStatus SiemensDevice = new SiemensDeviceStatus(); public HKDeviceStatus HKDevice = new HKDeviceStatus(); GVL_BigStation BigStation = new GVL_BigStation(); @@ -29,11 +29,11 @@ namespace BPASmartClient.JXJFoodBigStation.Model /// /// 配方数据 /// - public ObservableCollection RemoteRecipes = new ObservableCollection(); + public ObservableCollection RemoteRecipes = new ObservableCollection(); /// /// 配方数据 /// - public ObservableCollection IssuedComplete = new ObservableCollection(); + public ObservableCollection IssuedComplete = new ObservableCollection(); /// /// 原料的名称和料仓的位置对应 /// @@ -52,74 +52,41 @@ namespace BPASmartClient.JXJFoodBigStation.Model public RecipeRawMaterial RawMaterial; public void Init() { - ActionManage.GetInstance.Register(new Action((res) => + ActionManage.GetInstance.Register(new Action((res) => { + ObservableCollection RawMaterials = new ObservableCollection(); if (SiemensDevice.IsConnected) { - if (res != null) + if (res != null && res is DL_Start_DB recipe) { RawMaterials.Clear(); for (int i = 0; i < 15; i++) { - if (RawMaterialsNamePos.ContainsKey(res.RecipeName)) + if (RawMaterialsNamePos.ContainsKey(recipe.RecipeName)) { - RawMaterials.Add(new RemoteRecipeRawMaterial() + RawMaterials.Add(new RawMaterial() { - RawMaterialName = res.Material[i].Material_Name, - RawMaterialBarrelNum = res.Material[i].Material_BarrelNum, - RawMaterialWeight = res.Material[i].Material_Weight, - RawMaterialLocation = (int)RawMaterialsNamePos[res.Material[i].Material_Name] - }); + RawMaterialName = recipe.Material[i].Material_Name, + RawMaterialBarrelNum = recipe.Material[i].Material_BarrelNum, + RawMaterialWeight = recipe.Material[i].Material_Weight, + RawMaterialLocation = (int)RawMaterialsNamePos[recipe.Material[i].Material_Name] + }); } else { //报警,配方的原料名称下发和设备不一致 } } - Json.Data.Recipes.Add(new RemoteRecipeData() + Json.Data.Recipes.Add(new RecipeData() { - RecipeName = res.RecipeName, - RecipeCode = res.RecipeCode, + RecipeName = recipe.RecipeName, + RecipeCode = recipe.RecipeCode, RawMaterial = RawMaterials, - TrayCode = res.TrayCode + TrayCode = recipe.TrayCode }); } } - }), "西门子下发配方", true); - ActionManage.GetInstance.Register(new Action((res) => - { - if (SiemensDevice.IsConnected) - { - if (res != null) - { - RawMaterials.Clear(); - for (int i = 0; i < 15; i++) - { - if (RawMaterialsNamePos.ContainsKey(res.Material[i].Material_Name)) - { - RawMaterials.Add(new RemoteRecipeRawMaterial() - { - RawMaterialName = res.Material[i].Material_Name, - RawMaterialBarrelNum = res.Material[i].Material_BarrelNum, - RawMaterialWeight = res.Material[i].Material_Weight, - RawMaterialLocation = (int)RawMaterialsNamePos[res.Material[i].Material_Name] - }); - } - else - { - //报警,配方的原料名称下发和设备不一致 - } - } - Json.Data.Recipes.Add(new RemoteRecipeData() - { - RecipeName = res.RecipeName, - RecipeCode = res.RecipeCode, - RawMaterial = RawMaterials, - TrayCode = res.TrayCode - }); - } - } - }), "西门子下发配方", true); + }), "SiemensSendRecipe", true); string HK_PLC_IP = ConfigurationManager.AppSettings["HKPlc_IP"]; string Siemens_PLC_IP = ConfigurationManager.AppSettings["Siemens_IP"]; try @@ -143,6 +110,7 @@ namespace BPASmartClient.JXJFoodBigStation.Model //Json.Data.Recipes = TestData.GetInstance.Recipes;//添加测试数据 ThreadManage.GetInstance().StartLong(new Action(() => { + ReadPLCDeviceInfo(); ReceviceData(); RecipeInfoToHKPLC(); Thread.Sleep(10); @@ -240,8 +208,8 @@ namespace BPASmartClient.JXJFoodBigStation.Model private void AgvGetInOut() { //获取工位上是否有小车 - SiemensDevice.Siemens_PLC_S7.Write(SiemensCommAddress.StationIsExistCar, (bool) - HKDevice.HK_PLC_S7.Read(HKPlcCommAddress.StationIsExistTray)); + SiemensDevice.Siemens_PLC_S7.Write(SiemensCommAddress.StationIsExistCar, (bool) + HKDevice.HK_PLC_S7.Read("M4007.0")); //检测AGV到站信号 if (AGVToWorkStationQueue.Count > 0) { @@ -254,7 +222,6 @@ namespace BPASmartClient.JXJFoodBigStation.Model if (BigStation.AgvDeliveryPosition == 5) { BigStation.AgvDeliveryPosition = 0; - //AGVToWorkStationQueue.TryDequeue(out RecipeCode); } AGV_Pick(TrayLocation - 1); if (BigStation.AgvPickUpPosition == 3) @@ -269,7 +236,7 @@ namespace BPASmartClient.JXJFoodBigStation.Model { if (!BigStation.IsAllowManual && RemoteRecipes.Count == 0)//一个配方执行完成后,再获取配方数据 { - RemoteRecipes = Json.Data.Recipes; + RemoteRecipes = Json.Data.Recipes; } else if (BigStation.IsAllowManual && RemoteRecipes.Count == 0) { @@ -283,41 +250,36 @@ namespace BPASmartClient.JXJFoodBigStation.Model RecipeQueue.Enqueue(data.RecipeCode); } } + else + { + RecipeQueue.Clear(); + BigStation.RecipeDosingStatus = 0; + } } - short[] BarrelNum = new short[15]; - short[] Location = new short[15]; - short[] Weight = new short[15]; private void RecipeInfoToHKPLC() { if (RecipeQueue.Count > 0) { int index = Array.FindIndex(RemoteRecipes.ToArray(), p => p.RecipeCode == RecipeQueue.ElementAt(0)); - if (index >= 0 && index <= RemoteRecipes.Count) + if (index >= 0 && index < RemoteRecipes.Count) { string code = RemoteRecipes.ElementAt(index).RecipeCode; - if (HKDevice.HK_PLC_S7.Read("M5001.0") && BigStation.RecipeDosingStatus == 0)//配方1是否允许下发配发 + int trayCode = RemoteRecipes.ElementAt(index).TrayCode; + if (RTrig.GetInstance("M5001.0").Start(HKDevice.HK_PLC_S7.Read("M5001.0")) && BigStation.RecipeDosingStatus == 0)//配方1是否允许下发配发 { - MessageLog.GetInstance.ShowRunLog($"配方状态:{code}允许下发"); + HKDevice.StockBinPar(RemoteRecipes.ElementAt(index)); + HKDevice.HK_PLC_S7.Write("M4001.0", true);//配发下发完成,to plc + HKDevice.HK_PLC_S7.Write("M5001.0", false);//复位允许下发配方1信号 BigStation.RecipeDosingStatus = 1; - for (int i = 0; i < RemoteRecipes.ElementAt(index).RawMaterial.Count; i++) - { - BarrelNum[i] = (short)RemoteRecipes.ElementAt(index).RawMaterial.ElementAt(i).RawMaterialBarrelNum; - Location[i] = (short)RemoteRecipes.ElementAt(index).RawMaterial.ElementAt(i).RawMaterialLocation; - Weight[i] = (short)RemoteRecipes.ElementAt(index).RawMaterial.ElementAt(i).RawMaterialWeight; - } - HKDevice.StockBinPar(BarrelNum, Location, Weight); - HKDevice.HK_PLC_S7.Write("M4001.0", 1);//配发下发完成,to plc - HKDevice.HK_PLC_S7.Write("M5001.0", 0);//复位允许下发配方1信号 - BigStation.RecipeDosingStatus = 2; MessageLog.GetInstance.ShowRunLog($"配方状态:{code}下发完成"); } - if (HKDevice.HK_PLC_S7.Read("M5001.4") && BigStation.RecipeDosingStatus == 2) + if (HKDevice.HK_PLC_S7.Read("M5001.4") && BigStation.RecipeDosingStatus == 1) { - BigStation.RecipeDosingStatus = 3; - HKDevice.HK_PLC_S7.Write("M5001.4", 0);//复位允许下发配方1信号 + BigStation.RecipeDosingStatus = 2; + HKDevice.HK_PLC_S7.Write("M5001.4", false);// MessageLog.GetInstance.ShowRunLog($"配方状态:{code}配方配料"); } - if (BigStation.RecipeDosingStatus == 3) + if (BigStation.RecipeDosingStatus == 2) { for (int i = 0; i < 12; i++) { @@ -325,12 +287,12 @@ namespace BPASmartClient.JXJFoodBigStation.Model { if (HKDevice.HK_PLC_S7.Read("M5008." + (i)))//根据配料完成信号, { - int a = Array.FindIndex(RemoteRecipes.ElementAt(index).RawMaterial.ToArray(), p => p.RawMaterialLocation == i); + int a = Array.FindIndex(RemoteRecipes.ElementAt(index).RawMaterial.ToArray(), p => p.RawMaterialLocation == (i+1)); if (a >= 0) { int barrelNum = RemoteRecipes.ElementAt(index).RawMaterial.ElementAt(a).RawMaterialBarrelNum; string address = "MD" + 5060 + i * 4 + (barrelNum - 1) * 48; - float weight = HKDevice.HK_PLC_S7.Read(address); + RemoteRecipes.ElementAt(index).RawMaterial.ElementAt(a).Laying_Off_Weight = HKDevice.HK_PLC_S7.Read(address);//料仓配料完成后的出料重量 } } } @@ -343,21 +305,21 @@ namespace BPASmartClient.JXJFoodBigStation.Model { int barrelNum = RemoteRecipes.ElementAt(index).RawMaterial.ElementAt(a).RawMaterialBarrelNum; string address = "MD" + 5060 + i * 4 + (barrelNum - 1) * 48; - float weight = HKDevice.HK_PLC_S7.Read(address); + RemoteRecipes.ElementAt(index).RawMaterial.ElementAt(a).Laying_Off_Weight = HKDevice.HK_PLC_S7.Read(address); } } } } - if (RTrig.GetInstance("StockState").Start(HKDevice.HK_PLC_S7.Read(HKPlcCommAddress.RecipeDosingFinish)) || true) + if (RTrig.GetInstance("StockState").Start(HKDevice.HK_PLC_S7.Read("M5007.0"))) { - BigStation.RecipeDosingStatus = 4; + BigStation.RecipeDosingStatus = 3; MessageLog.GetInstance.ShowRunLog($"配方状态:{code}配料完成"); - HKDevice.RecipeDosingFinishReset(); + HKDevice.HK_PLC_S7.Write("M5007.0",false); RecipeQueue.TryDequeue(out code); IssuedComplete.Add(RemoteRecipes.ElementAt(index));//将该配方添加到下 if (!BigStation.IsAllowManual) { - Json.Data.Recipes.RemoveAt(index);//制作完成,移除当前配方 + Json.Data.Recipes.RemoveAt(index);//制作完成,移除当前配方 } else { @@ -390,7 +352,7 @@ namespace BPASmartClient.JXJFoodBigStation.Model { if (HKDevice.IsConnected) { - GetSiemensStatus("", new Action((obj) => + GetHKStatus("", new Action((obj) => { if (obj is bool[] bools && bools.Length > 0) { @@ -424,12 +386,12 @@ namespace BPASmartClient.JXJFoodBigStation.Model { if (SiemensDevice.IsConnected) { - SiemensDevice.Siemens_PLC_S7.Write(Address, Value); + SiemensDevice.Siemens_PLC_S7.Write(Address, Value); } } private void WriteHKPLC(string Address, object Value) { - HKDevice.HK_PLC_S7.Write(Address, Value); + HKDevice.HK_PLC_S7.Write(Address, Value); } private object ReadSiemens(string Address) { diff --git a/BPASmartClient.JXJFoodBigStation/Model/RawMaterial/DeviceAddress.cs b/BPASmartClient.JXJFoodBigStation/Model/RawMaterial/DeviceAddress.cs deleted file mode 100644 index 12eff44a..00000000 --- a/BPASmartClient.JXJFoodBigStation/Model/RawMaterial/DeviceAddress.cs +++ /dev/null @@ -1,92 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace BPASmartClient.JXJFoodBigStation.Model -{ - public class DeviceAddress - { - #region 源地址 - ///// - ///// 设备名称起始地址 - ///// - //public static string DeviceName { get; set; } = "LW0"; - - ///// - ///// 料仓重量反馈起始地址 - ///// - //public static string WeightFeedback { get; set; } = "LW52";//LW204 - - ///// - ///// 重量设置地址 - ///// - //public static string WeightSet { get; set; } = "LW21";//LW200 - - ///// - ///// 启动信号地址 - ///// - //public static string Start { get; set; } = "LW20";//LW210 - - ///// - ///// 下料重量反馈地址 - ///// - //public static string CutWeightFeedback { get; set; } = "LW54";//LW202 - - ///// - ///// 设备运行状态地址 - ///// - //public static string RunStatus { get; set; } = "LW55";//LW206 - - ///// - ///// 料仓的位置 - ///// - //public static string Location { get; set; } = "LW53"; - #endregion - #region 上位机下发 - /// - /// 原料出料重量 - /// - public static string WeightSet { get; set; } = "LW11"; - /// - /// 启动开始配料 - /// - public static string Start { get; set; } = "LW12"; - #endregion - #region 上位机读取 - /// - /// 设备运行状态地址 - /// - public static string RunStatus { get; set; } = "LW50"; - /// - /// 报警字 - /// - public static string AlarmInfo { get; set; } = "LW51"; - /// - /// 原料名称 - /// - public static string DeviceName { get; set; } = "LW52"; - /// - /// 料仓的位置 - /// - public static string Location { get; set; } = "LW53"; - /// - /// 原料类型 - /// - public static string RawMaterialType { get; set; } = "LW54"; - /// - /// 出料完成信号 - /// - public static string OutRawMaterialFinish { get; set; } = "LW55"; - /// - /// 料仓重量反馈起始地址 - /// - public static string WeightFeedback { get; set; } = "LW56"; - /// - /// 下料重量反馈地址 - /// - public static string CutWeightFeedback { get; set; } = "LW57"; - #endregion - } -} diff --git a/BPASmartClient.JXJFoodBigStation/Model/RawMaterial/LocaPar.cs b/BPASmartClient.JXJFoodBigStation/Model/RawMaterial/LocalRecipe.cs similarity index 65% rename from BPASmartClient.JXJFoodBigStation/Model/RawMaterial/LocaPar.cs rename to BPASmartClient.JXJFoodBigStation/Model/RawMaterial/LocalRecipe.cs index 9736b46d..b00c6b2f 100644 --- a/BPASmartClient.JXJFoodBigStation/Model/RawMaterial/LocaPar.cs +++ b/BPASmartClient.JXJFoodBigStation/Model/RawMaterial/LocalRecipe.cs @@ -8,8 +8,8 @@ using BPASmartClient.JXJFoodBigStation.ViewModel; namespace BPASmartClient.JXJFoodBigStation.Model { - public class LocaPar + public class LocalRecipe { - public ObservableCollection Recipes { get; set; } = new ObservableCollection(); + public ObservableCollection Recipes { get; set; } = new ObservableCollection(); } } diff --git a/BPASmartClient.JXJFoodBigStation/Model/Siemens/RemoteRecipeRawMaterial.cs b/BPASmartClient.JXJFoodBigStation/Model/RawMaterial/RawMaterial.cs similarity index 85% rename from BPASmartClient.JXJFoodBigStation/Model/Siemens/RemoteRecipeRawMaterial.cs rename to BPASmartClient.JXJFoodBigStation/Model/RawMaterial/RawMaterial.cs index f73a00d8..dda4a0ad 100644 --- a/BPASmartClient.JXJFoodBigStation/Model/Siemens/RemoteRecipeRawMaterial.cs +++ b/BPASmartClient.JXJFoodBigStation/Model/RawMaterial/RawMaterial.cs @@ -7,7 +7,7 @@ using System.Threading.Tasks; namespace BPASmartClient.JXJFoodBigStation.Model { - public class RemoteRecipeRawMaterial :ObservableObject + public class RawMaterial :ObservableObject { private int _mIp; public int DeviceIp { get { return _mIp; } set { _mIp = value; }} @@ -27,8 +27,8 @@ namespace BPASmartClient.JXJFoodBigStation.Model /// /// 需要原料重量 /// - public double RawMaterialWeight { get { return _mRawMaterialWeight; } set { _mRawMaterialWeight = value; OnPropertyChanged(); } } - private double _mRawMaterialWeight; + public float RawMaterialWeight { get { return _mRawMaterialWeight; } set { _mRawMaterialWeight = value; OnPropertyChanged(); } } + private float _mRawMaterialWeight; /// /// 实际的下料中重量 diff --git a/BPASmartClient.JXJFoodBigStation/Model/RawMaterial/RawMaterialDeviceStatus.cs b/BPASmartClient.JXJFoodBigStation/Model/RawMaterial/RawMaterialDeviceStatus.cs deleted file mode 100644 index 5aa423ab..00000000 --- a/BPASmartClient.JXJFoodBigStation/Model/RawMaterial/RawMaterialDeviceStatus.cs +++ /dev/null @@ -1,44 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace BPASmartClient.JXJFoodBigStation.Model -{ - public class RawMaterialDeviceStatus - { - /// - /// 原料类型 - /// 1:液体 - /// 2:膏体 - /// 3:粉体 - /// - public ushort RawMaterialType { get; set; } - - /// - /// 料仓重量反馈 - /// - public float WeightFeedback { get; set; } - - /// - /// 上限反馈 - /// - public bool UpLimitFeedback { get; set; } - - /// - /// 下限反馈 - /// - public bool DownLimitFeedback { get; set; } - - /// - /// 下料重量反馈 - /// - public float CutWeightFeedback { get; set; } - - /// - /// 设备运行状态 - /// - public ushort RunStatus { get; set; } - } -} diff --git a/BPASmartClient.JXJFoodBigStation/Model/RawMaterial/RawMaterialModel.cs b/BPASmartClient.JXJFoodBigStation/Model/RawMaterial/RawMaterialModel.cs deleted file mode 100644 index 881e20c3..00000000 --- a/BPASmartClient.JXJFoodBigStation/Model/RawMaterial/RawMaterialModel.cs +++ /dev/null @@ -1,48 +0,0 @@ -using Microsoft.Toolkit.Mvvm.ComponentModel; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace BPASmartClient.JXJFoodBigStation.Model -{ - /// - /// 原料模块 - /// - public class RawMaterialModel : ObservableObject - { - private int _mIp; - public int DeviceIp { get { return _mIp; } set { _mIp = value; } } - /// - /// 原料名称 - /// - public string RawMaterialName { get { return _mRawMaterialName; } set { _mRawMaterialName = value; } } - private string _mRawMaterialName; - - /// - /// 原料对应的桶号 - /// - public int RawMaterialBarrelNum { get { return _mRawMaterialBarrelNum; } set { _mRawMaterialBarrelNum = value; OnPropertyChanged(); } } - private int _mRawMaterialBarrelNum; - - /// - /// 需要原料重量 - /// - public double RawMaterialWeight { get { return _mRawMaterialWeight; } set { _mRawMaterialWeight = value; OnPropertyChanged(); } } - private double _mRawMaterialWeight; - - /// - /// 实际的下料中重量 - /// - public float Laying_Off_Weight { get { return _mLaying_Off_Weight; } set { _mLaying_Off_Weight = value; } } - private float _mLaying_Off_Weight; - - /// - /// 原料对应料仓的位置/名称 - /// - public int RawMaterialLocation { get { return _mRawMaterialLocation; } set { _mRawMaterialLocation = value; OnPropertyChanged(); } } - private int _mRawMaterialLocation; - - } -} diff --git a/BPASmartClient.JXJFoodBigStation/Model/Siemens/RemoteRecipeData.cs b/BPASmartClient.JXJFoodBigStation/Model/RawMaterial/RecipeData.cs similarity index 83% rename from BPASmartClient.JXJFoodBigStation/Model/Siemens/RemoteRecipeData.cs rename to BPASmartClient.JXJFoodBigStation/Model/RawMaterial/RecipeData.cs index 5623d108..fc6f595a 100644 --- a/BPASmartClient.JXJFoodBigStation/Model/Siemens/RemoteRecipeData.cs +++ b/BPASmartClient.JXJFoodBigStation/Model/RawMaterial/RecipeData.cs @@ -8,7 +8,7 @@ using System.Threading.Tasks; namespace BPASmartClient.JXJFoodBigStation.Model { - public class RemoteRecipeData : ObservableObject + public class RecipeData : ObservableObject { /// /// 配方名称 @@ -31,7 +31,7 @@ namespace BPASmartClient.JXJFoodBigStation.Model /// /// 原料数据 /// - public ObservableCollection RawMaterial { get; set; } = new ObservableCollection(); + public ObservableCollection RawMaterial { get; set; } = new ObservableCollection(); } diff --git a/BPASmartClient.JXJFoodBigStation/Model/RawMaterial/RecipeModel.cs b/BPASmartClient.JXJFoodBigStation/Model/RawMaterial/RecipeModel.cs deleted file mode 100644 index d73f5fb2..00000000 --- a/BPASmartClient.JXJFoodBigStation/Model/RawMaterial/RecipeModel.cs +++ /dev/null @@ -1,45 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Collections.ObjectModel; -using System.Linq; -using System.Text; -using System.Threading; -using System.Threading.Tasks; -using BPASmartClient.JXJFoodBigStation.ViewModel; -using Microsoft.Toolkit.Mvvm.ComponentModel; - -namespace BPASmartClient.JXJFoodBigStation.Model -{ - /// - /// 配方模块 - /// - public class RecipeModel : ObservableObject - { - /// - /// 配方名称 - /// - public string RecipeName { get { return _mRecipeName; } set { _mRecipeName = value; OnPropertyChanged(); } } - private string _mRecipeName; - - /// - /// 配方ID - /// - public string RecipeCode { get { return _mRecipCode; } set { _mRecipCode = value; OnPropertyChanged(); } } - private string _mRecipCode; - - /// - /// 托盘编号 - /// - public int TrayCode { get { return _mTrayCode; } set { _mTrayCode = value; OnPropertyChanged(); } } - private int _mTrayCode; - - [Newtonsoft.Json.JsonIgnore] - public AutoResetEvent Are { get; set; } = new AutoResetEvent(false); - - /// - /// 原料集合 - /// - public ObservableCollection RawMaterial { get; set; } = new ObservableCollection(); - - } -} diff --git a/BPASmartClient.JXJFoodBigStation/Model/Siemens/DL_Status_DB.cs b/BPASmartClient.JXJFoodBigStation/Model/Siemens/DL_Status_DB.cs index 562da3bf..88126d64 100644 --- a/BPASmartClient.JXJFoodBigStation/Model/Siemens/DL_Status_DB.cs +++ b/BPASmartClient.JXJFoodBigStation/Model/Siemens/DL_Status_DB.cs @@ -11,7 +11,7 @@ namespace BPASmartClient.JXJFoodBigStation.Model.Siemens /// /// 生产工单 /// - public string Order_No; + public string RecipeCode; /// /// 配料开始 /// diff --git a/BPASmartClient.JXJFoodBigStation/Model/Siemens/RemoteRecipe.cs b/BPASmartClient.JXJFoodBigStation/Model/Siemens/RemoteRecipe.cs new file mode 100644 index 00000000..eb03c2b0 --- /dev/null +++ b/BPASmartClient.JXJFoodBigStation/Model/Siemens/RemoteRecipe.cs @@ -0,0 +1,14 @@ +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace BPASmartClient.JXJFoodBigStation.Model.Siemens +{ + public class RemoteRecipe + { + public ObservableCollection Recipes { get; set; } = new ObservableCollection(); + } +} diff --git a/BPASmartClient.JXJFoodBigStation/Model/Siemens/SiemensDeviceStatus.cs b/BPASmartClient.JXJFoodBigStation/Model/Siemens/SiemensDeviceStatus.cs index a6b9db25..a3361db3 100644 --- a/BPASmartClient.JXJFoodBigStation/Model/Siemens/SiemensDeviceStatus.cs +++ b/BPASmartClient.JXJFoodBigStation/Model/Siemens/SiemensDeviceStatus.cs @@ -26,44 +26,45 @@ namespace BPASmartClient.JXJFoodBigStation.Model.Siemens var res2 = this.Siemens_PLC_S7.ReadClass(3); if (res != null && RTrig.GetInstance("RecipeTrig").Start(res.Ask_For_Send_Bit)) { - ActionManage.GetInstance.Send("西门子下发配方", res); - res.Ask_For_Send_Bit = false; + ActionManage.GetInstance.Send("SiemensSendRecipe", res); + res.Ask_For_Send_Bit = false;//接受配方信号复位 + res.Ack_Ask_For_Send_Bit = true;//配方接受完成 this.Siemens_PLC_S7.WriteClass(res, 1); } if (res1 != null && RTrig.GetInstance("Allow_AGV_Put[0]").Start(res1.Allow_AGV_Put[0])) { - ActionManage.GetInstance.Send("AGV到工位1信号", res1); + ActionManage.GetInstance.Send("AGVToStation1Sign", res1); res1.Allow_AGV_Put[0] = false; this.Siemens_PLC_S7.WriteClass(res1, 2); } if (res1 != null && RTrig.GetInstance("Allow_AGV_Put[1]").Start(res1.Allow_AGV_Put[1])) { - ActionManage.GetInstance.Send("AGV到工位2信号", res1); + ActionManage.GetInstance.Send("AGVToStation2Sign", res1); res1.Allow_AGV_Put[1] = false; this.Siemens_PLC_S7.WriteClass(res1, 2); } if (res1 != null && RTrig.GetInstance("Allow_AGV_Put[2]").Start(res1.Allow_AGV_Put[2])) { - ActionManage.GetInstance.Send("AGV到工位3信号", res1); + ActionManage.GetInstance.Send("AGVToStation3Sign", res1); res1.Allow_AGV_Put[2] = false; this.Siemens_PLC_S7.WriteClass(res1, 2); } if (res1 != null && RTrig.GetInstance("Allow_AGV_Put[3]").Start(res1.Allow_AGV_Put[3])) { - ActionManage.GetInstance.Send("AGV到工位4信号", res1); + ActionManage.GetInstance.Send("AGVToStation4Sign", res1); res1.Allow_AGV_Put[3] = false; this.Siemens_PLC_S7.WriteClass(res1, 2); } if (res1 != null && RTrig.GetInstance("Allow_AGV_Put[4]").Start(res1.Allow_AGV_Put[4])) { - ActionManage.GetInstance.Send("AGV到工位5信号", res1); + ActionManage.GetInstance.Send("AGVToStation5Sign", res1); res1.Allow_AGV_Put[4] = false; this.Siemens_PLC_S7.WriteClass(res1, 2); } if (res1 != null && RTrig.GetInstance("Allow_AGV_Put[5]").Start(res1.Allow_AGV_Put[5])) { - ActionManage.GetInstance.Send("AGV到工位6信号", res1); + ActionManage.GetInstance.Send("AGVToStation6Sign", res1); res1.Allow_AGV_Put[5] = false; this.Siemens_PLC_S7.WriteClass(res1, 2); } diff --git a/BPASmartClient.JXJFoodBigStation/Model/TestData.cs b/BPASmartClient.JXJFoodBigStation/Model/TestData.cs index 44c7bfa7..a3fb8bc5 100644 --- a/BPASmartClient.JXJFoodBigStation/Model/TestData.cs +++ b/BPASmartClient.JXJFoodBigStation/Model/TestData.cs @@ -13,40 +13,40 @@ namespace BPASmartClient.JXJFoodBigStation.Model { public volatile static TestData Instance; public static TestData GetInstance => Instance ?? (Instance = new TestData()); - public ObservableCollection Recipes { get; set; } = new ObservableCollection(); - public ObservableCollection RawMaterials { get; set; } = new ObservableCollection(); + public ObservableCollection Recipes { get; set; } = new ObservableCollection(); + public ObservableCollection RawMaterials { get; set; } = new ObservableCollection(); public TestData() { string recipeName = "配方1"; string recipeCode = "10001"; int Traycode = 1; - double RawmaterialWeight = 10; + float RawmaterialWeight = 10; short RawMaterialbarrelNum = 1; int RawMaterialLocation = 5; - double RawmaterialWeight1 = 20; + float RawmaterialWeight1 = 20; short RawMaterialbarrelNum1 = 2; int RawMaterialLocation1 = 7; - double RawmaterialWeight2 = 30; + float RawmaterialWeight2 = 30; short RawMaterialbarrelNum2 = 3; int RawMaterialLocation2 = 9; - RawMaterials.Add(new RemoteRecipeRawMaterial() + RawMaterials.Add(new RawMaterial() { DeviceIp = RawMaterials.Count + 1, RawMaterialWeight = RawmaterialWeight, RawMaterialBarrelNum = RawMaterialbarrelNum, RawMaterialLocation = RawMaterialLocation }); - RawMaterials.Add(new RemoteRecipeRawMaterial() + RawMaterials.Add(new RawMaterial() { DeviceIp = RawMaterials.Count + 1, RawMaterialWeight = RawmaterialWeight1, RawMaterialBarrelNum = RawMaterialbarrelNum1, RawMaterialLocation = RawMaterialLocation1 }); - RawMaterials.Add(new RemoteRecipeRawMaterial() + RawMaterials.Add(new RawMaterial() { DeviceIp = RawMaterials.Count + 1, RawMaterialWeight = RawmaterialWeight2, @@ -54,7 +54,7 @@ namespace BPASmartClient.JXJFoodBigStation.Model RawMaterialLocation = RawMaterialLocation2 }); - Recipes.Add(new Model.RemoteRecipeData() + Recipes.Add(new Model.RecipeData() { RecipeName = recipeName, RecipeCode = recipeCode, @@ -67,32 +67,32 @@ namespace BPASmartClient.JXJFoodBigStation.Model string recipeCode_2 = "20001"; int Traycode_2 = 3; - double RawmaterialWeight_2 = 10; + float RawmaterialWeight_2 = 10; short RawMaterialbarrelNum_2 = 1; int RawMaterialLocation_2 = 5; - double RawmaterialWeight1_2 = 20; + float RawmaterialWeight1_2 = 20; short RawMaterialbarrelNum1_2 = 2; int RawMaterialLocation1_2 = 7; - double RawmaterialWeight2_2 = 30; + float RawmaterialWeight2_2 = 30; short RawMaterialbarrelNum2_2 = 3; int RawMaterialLocation2_2 = 9; - RawMaterials.Add(new RemoteRecipeRawMaterial() + RawMaterials.Add(new RawMaterial() { DeviceIp = RawMaterials.Count + 1, RawMaterialWeight = RawmaterialWeight_2, RawMaterialBarrelNum = RawMaterialbarrelNum_2, RawMaterialLocation = RawMaterialLocation_2 }); - RawMaterials.Add(new RemoteRecipeRawMaterial() + RawMaterials.Add(new RawMaterial() { DeviceIp = RawMaterials.Count + 1, RawMaterialWeight = RawmaterialWeight1_2, RawMaterialBarrelNum = RawMaterialbarrelNum1_2, RawMaterialLocation = RawMaterialLocation1_2 }); - RawMaterials.Add(new RemoteRecipeRawMaterial() + RawMaterials.Add(new RawMaterial() { DeviceIp = RawMaterials.Count + 1, RawMaterialWeight = RawmaterialWeight2_2, @@ -100,7 +100,7 @@ namespace BPASmartClient.JXJFoodBigStation.Model RawMaterialLocation = RawMaterialLocation2_2 }); - Recipes.Add(new Model.RemoteRecipeData() + Recipes.Add(new Model.RecipeData() { RecipeName = recipeName_2, RecipeCode = recipeCode_2, diff --git a/BPASmartClient.JXJFoodBigStation/View/HardwareStatusView.xaml b/BPASmartClient.JXJFoodBigStation/View/HardwareStatusView.xaml index 89977ed2..ae8c420d 100644 --- a/BPASmartClient.JXJFoodBigStation/View/HardwareStatusView.xaml +++ b/BPASmartClient.JXJFoodBigStation/View/HardwareStatusView.xaml @@ -374,7 +374,7 @@ @@ -384,25 +384,34 @@ + - + + Text="{Binding DeviceName}" + /> - + @@ -425,7 +434,7 @@ + + + @@ -547,6 +568,7 @@ + @@ -585,7 +607,7 @@ - + 0; i--) { TopDeviceCurrentStatuses.Add(new DeviceCurrentStatus() { DeviceName = i.ToString(), DeviceNum=i, - RunStatus = false, + RunStatus = true, Weight = new Random().Next(0, 100) }); } - for (int i = 8; i < 16; i++) + for (int i = 7; i < 13; i++) { BottomDeviceCurrentStatuses.Add(new DeviceCurrentStatus() { @@ -37,7 +40,6 @@ namespace BPASmartClient.JXJFoodBigStation.ViewModel Weight = new Random().Next(0, 100) }); } - StartCommand = new RelayCommand((deviceName) => { //PLC控制 @@ -74,11 +76,54 @@ namespace BPASmartClient.JXJFoodBigStation.ViewModel } } }); - } + UpdateRawMaterName = new RelayCommand((deviceName) => + { + ActionManage.GetInstance.CancelRegister("UpdateDeviceName"); + ActionManage.GetInstance.Register(new Action((res) => + { + if (res != null && res is string newName) + { + int cnt = Array.FindIndex(TopDeviceCurrentStatuses.ToArray(), p => p.DeviceName == deviceName); + if (cnt >= 0) + { + + int index = Array.FindIndex(BottomDeviceCurrentStatuses.ToArray(), p => p.DeviceName == newName); + int index1 = Array.FindIndex(TopDeviceCurrentStatuses.ToArray(), p => p.DeviceName == newName); + if (index == -1 && index1 == -1) + { + var obj = TopDeviceCurrentStatuses.FirstOrDefault(p => p.DeviceName == deviceName); + obj.DeviceName = newName; + } + else + { + System.Windows.Forms.MessageBox.Show("设备名称与其他名称冲突", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); + } + } + else + { + int index = Array.FindIndex(TopDeviceCurrentStatuses.ToArray(), p => p.DeviceName == newName); + int index1 = Array.FindIndex(BottomDeviceCurrentStatuses.ToArray(), p => p.DeviceName == newName); + if (index == -1 && index1 == -1) + { + var obj = BottomDeviceCurrentStatuses.FirstOrDefault(p => p.DeviceName == deviceName); + obj.DeviceName = newName; + } + else + { + System.Windows.Forms.MessageBox.Show("设备名称与其他名称冲突", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); + } + } + } + }), "UpdateDeviceName"); + ChangeDeviceNameView view = new ChangeDeviceNameView(); + view.ShowDialog(); + }); + } + public ObservableCollection AllDeviceCurrentStatuses; public ObservableCollection TopDeviceCurrentStatuses { get; set; } = new ObservableCollection(); public ObservableCollection BottomDeviceCurrentStatuses { get; set; } = new ObservableCollection(); - + public RelayCommand UpdateRawMaterName { get; set; } public RelayCommand StartCommand { get; set; } public RelayCommand StopCommand { get; set; } diff --git a/BPASmartClient.JXJFoodBigStation/ViewModel/RecipeInfosViewModel.cs b/BPASmartClient.JXJFoodBigStation/ViewModel/RecipeInfosViewModel.cs index 35010f84..e2bfe01d 100644 --- a/BPASmartClient.JXJFoodBigStation/ViewModel/RecipeInfosViewModel.cs +++ b/BPASmartClient.JXJFoodBigStation/ViewModel/RecipeInfosViewModel.cs @@ -20,7 +20,7 @@ namespace BPASmartClient.JXJFoodBigStation.ViewModel { ActionManage.GetInstance.Register(new Action((o) => { - if (o != null && o is RecipeModel rm) + if (o != null && o is RecipeData rm) { RecipeName = rm.RecipeName; RecipeCode = rm.RecipeCode; @@ -36,23 +36,23 @@ namespace BPASmartClient.JXJFoodBigStation.ViewModel }), "RecipeInfo"); AddRecipe = new RelayCommand(() => { - RawMaterialsInfo.Add(new RawMaterialModel()); + RawMaterialsInfo.Add(new RawMaterial()); }); Comfirm = new RelayCommand(() => { - var bom= Json.Data.Recipes.FirstOrDefault(p => p.RecipeCode == RecipeCode); + var bom= Json.Data.Recipes.FirstOrDefault(p => p.RecipeCode == RecipeCode); if (bom == null)//新配方 { - var name= Json.Data.Recipes.FirstOrDefault(p => p.RecipeName == RecipeName); + var name= Json.Data.Recipes.FirstOrDefault(p => p.RecipeName == RecipeName); if (name == null) { go: string recipeCode = new Random().Next(10000, 99999).ToString(); - var res = Json.Data.Recipes.FirstOrDefault(p => p.RecipeCode == recipeCode); + var res = Json.Data.Recipes.FirstOrDefault(p => p.RecipeCode == recipeCode); if (res == null) { - Json.Data.Recipes.Add(new RecipeModel { RecipeCode = recipeCode, RawMaterial= RawMaterialsInfo,RecipeName=RecipeName,TrayCode=TrayCode}); - Json.Save(); + Json.Data.Recipes.Add(new RecipeData { RecipeCode = recipeCode, RawMaterial= RawMaterialsInfo,RecipeName=RecipeName,TrayCode=TrayCode}); + Json.Save(); } else { @@ -74,24 +74,24 @@ namespace BPASmartClient.JXJFoodBigStation.ViewModel } bom.RecipeName = RecipeName; bom.TrayCode = TrayCode; - Json.Save(); + Json.Save(); ActionManage.GetInstance.Send("CloseRecipeInfosView"); } }); SaveAs = new RelayCommand(() => { - var bom = Json.Data.Recipes.FirstOrDefault(p => p.RecipeName == RecipeName); - var rec = Json.Data.Recipes.FirstOrDefault(p => p.RecipeCode == RecipeCode); + var bom = Json.Data.Recipes.FirstOrDefault(p => p.RecipeName == RecipeName); + var rec = Json.Data.Recipes.FirstOrDefault(p => p.RecipeCode == RecipeCode); if (bom == null && rec != null)//配方名称更改 { prop: string recipeCode = new Random().Next(10000, 99999).ToString();//配方唯一ID,后期根据实际要求更改 - var res = Json.Data.Recipes.FirstOrDefault(p => p.RecipeCode == recipeCode); + var res = Json.Data.Recipes.FirstOrDefault(p => p.RecipeCode == recipeCode); if (res == null) { - Json.Data.Recipes.Add(new RecipeModel { RecipeCode = recipeCode, RawMaterial = RawMaterialsInfo, RecipeName = RecipeName, TrayCode = TrayCode });//配方添加 - Json.Save(); + Json.Data.Recipes.Add(new RecipeData { RecipeCode = recipeCode, RawMaterial = RawMaterialsInfo, RecipeName = RecipeName, TrayCode = TrayCode });//配方添加 + Json.Save(); } else { @@ -107,8 +107,7 @@ namespace BPASmartClient.JXJFoodBigStation.ViewModel }); RemoveRecipe = new RelayCommand((materilaName) => { - - var res= RawMaterialsInfo.FirstOrDefault(p=>p.RawMaterialName==materilaName); + var res = RawMaterialsInfo.FirstOrDefault(p => p.RawMaterialName == materilaName); if (res != null) RawMaterialsInfo.Remove(res); }); @@ -133,6 +132,6 @@ namespace BPASmartClient.JXJFoodBigStation.ViewModel public RelayCommand RemoveRecipe { get; set; } - public ObservableCollection RawMaterialsInfo { get; set; } = new ObservableCollection() ; + public ObservableCollection RawMaterialsInfo { get; set; } = new ObservableCollection() ; } } diff --git a/BPASmartClient.JXJFoodBigStation/ViewModel/RecipeReceiveViewModel.cs b/BPASmartClient.JXJFoodBigStation/ViewModel/RecipeReceiveViewModel.cs index 2e4b30a0..e9b32f3a 100644 --- a/BPASmartClient.JXJFoodBigStation/ViewModel/RecipeReceiveViewModel.cs +++ b/BPASmartClient.JXJFoodBigStation/ViewModel/RecipeReceiveViewModel.cs @@ -23,18 +23,18 @@ namespace BPASmartClient.JXJFoodBigStation.ViewModel { public class RecipeReceiveViewModel : ObservableObject { - public ObservableCollection RawMaterials { get; set; } = new ObservableCollection(); + public ObservableCollection RawMaterials { get; set; } = new ObservableCollection(); public RecipeReceiveViewModel() { - Json.Read(); - Recipes = Json.Data.Recipes; + Json.Read(); + Recipes = Json.Data.Recipes; DetailsCommand = new RelayCommand((o) => { if (o != null && o is string num) { ActionManage.GetInstance.CancelRegister("RecipeInfo"); RecipeInfosView nrv = new RecipeInfosView(); - var res = Json.Data.Recipes.FirstOrDefault(p => p.RecipeCode == num); + var res = Json.Data.Recipes.FirstOrDefault(p => p.RecipeCode == num); ActionManage.GetInstance.Send("RecipeInfo", res); nrv.Show(); MessageLog.GetInstance.ShowUserLog($"查看配方——{res.RecipeName}"); @@ -85,17 +85,17 @@ namespace BPASmartClient.JXJFoodBigStation.ViewModel //}); ClearAllRecipe = new RelayCommand(() => { - Json.Data.Recipes.Clear(); - Json.Save(); + Json.Data.Recipes.Clear(); + Json.Save(); }); RemoveCommand = new RelayCommand((recipeCode) => { var res = Recipes.FirstOrDefault(p=>p.RecipeCode==recipeCode); - if(res!=null) + if (res != null) { Recipes.Remove(res); - Json.Save(); + Json.Save(); } }); @@ -109,6 +109,6 @@ namespace BPASmartClient.JXJFoodBigStation.ViewModel public RelayCommand RemoveCommand { get; set; } - public ObservableCollection Recipes { get; set; } = new ObservableCollection(); + public ObservableCollection Recipes { get; set; } = new ObservableCollection(); } } diff --git a/BPASmartClient.JXJFoodBigStation/ViewModel/RecipeSendDownViewModel.cs b/BPASmartClient.JXJFoodBigStation/ViewModel/RecipeSendDownViewModel.cs index a2fee385..cbefe1df 100644 --- a/BPASmartClient.JXJFoodBigStation/ViewModel/RecipeSendDownViewModel.cs +++ b/BPASmartClient.JXJFoodBigStation/ViewModel/RecipeSendDownViewModel.cs @@ -14,19 +14,19 @@ namespace BPASmartClient.JXJFoodBigStation.ViewModel internal class RecipeSendDownViewModel:ObservableObject { - public ObservableCollection Recipes { get; set; } = Json.Data.Recipes; + public ObservableCollection Recipes { get; set; } = Json.Data.Recipes; /// /// 当前正在制作的配方 /// - public static ObservableCollection recipeProcesses { get; set; } = new ObservableCollection(); + public static ObservableCollection recipeProcesses { get; set; } = new ObservableCollection(); /// /// 等待制作的配方 /// - public static ObservableCollection UserTreeWait { get; set; } = new ObservableCollection(); + public static ObservableCollection UserTreeWait { get; set; } = new ObservableCollection(); /// /// 已完成的配方 /// - public static ObservableCollection UserTreeCompelete { get; set; } = new ObservableCollection(); + public static ObservableCollection UserTreeCompelete { get; set; } = new ObservableCollection(); public RelayCommand StartCommand { get; set; } @@ -41,7 +41,6 @@ namespace BPASmartClient.JXJFoodBigStation.ViewModel ActionManage.GetInstance.Send("手动下发本地配方", res); } }); - } } } diff --git a/BPASmartClient.JXJFoodSmallStation/App.xaml.cs b/BPASmartClient.JXJFoodSmallStation/App.xaml.cs index 1f300b21..c7c342b4 100644 --- a/BPASmartClient.JXJFoodSmallStation/App.xaml.cs +++ b/BPASmartClient.JXJFoodSmallStation/App.xaml.cs @@ -73,11 +73,18 @@ namespace BPASmartClient.JXJFoodSmallStation }); RecipeManage.Add(new SubMenumodel() { - SubMenuName = "服务配方管理", + SubMenuName = "本地配方管理", SubMenuPermission = new Permission[] { Permission.管理员 }, AssemblyName = "BPASmartClient.JXJFoodSmallStation", ToggleWindowPath = "View.RecipeReceiveView" }); + RecipeManage.Add(new SubMenumodel() + { + SubMenuName = "西门子配方管理", + SubMenuPermission = new Permission[] { Permission.管理员 }, + AssemblyName = "BPASmartClient.JXJFoodSmallStation", + ToggleWindowPath = "View.SiemensRecipeReceiveView" + }); MenuManage.GetInstance.menuModels.Add(new MenuModel() { MainMenuIcon = "", diff --git a/BPASmartClient.JXJFoodSmallStation/BPASmartClient.JXJFoodSmallStation.csproj b/BPASmartClient.JXJFoodSmallStation/BPASmartClient.JXJFoodSmallStation.csproj index 03639a59..b07ffa11 100644 --- a/BPASmartClient.JXJFoodSmallStation/BPASmartClient.JXJFoodSmallStation.csproj +++ b/BPASmartClient.JXJFoodSmallStation/BPASmartClient.JXJFoodSmallStation.csproj @@ -26,7 +26,15 @@ $(DefaultXamlRuntime) - + + $(DefaultXamlRuntime) + Designer + + + $(DefaultXamlRuntime) + Designer + + $(DefaultXamlRuntime) Designer diff --git a/BPASmartClient.JXJFoodSmallStation/Model/GVL/GVL.cs b/BPASmartClient.JXJFoodSmallStation/Model/GVL/GVL.cs new file mode 100644 index 00000000..6db2311b --- /dev/null +++ b/BPASmartClient.JXJFoodSmallStation/Model/GVL/GVL.cs @@ -0,0 +1,13 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace BPASmartClient.JXJFoodSmallStation.Model.GVL +{ + public class GVL + { + public static bool IsUseLocalRecipe { get; set; } + } +} diff --git a/BPASmartClient.JXJFoodSmallStation/Model/GVL/ReadSmallMaterial.cs b/BPASmartClient.JXJFoodSmallStation/Model/GVL/ReadSmallMaterial.cs new file mode 100644 index 00000000..6e9ccdf6 --- /dev/null +++ b/BPASmartClient.JXJFoodSmallStation/Model/GVL/ReadSmallMaterial.cs @@ -0,0 +1,117 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace BPASmartClient.JXJFoodSmallStation.Model.GVL +{ + public class ReadSmallMaterial + { + /// + /// PLC到上位机心跳 + /// + public bool Heart { get; set; } + public bool Agv1 { get; set; } + public bool Agv2 { get; set; } + public bool Agv3 { get; set; } + public bool Agv4 { get; set; } + public bool Agv5 { get; set; } + public bool Agv6 { get; set; } + /// + /// 1#托盘工位占用 + /// + public bool Tray1BeOccupied { get; set; } + /// + /// 2#托盘工位占用 + /// + public bool Tray2BeOccupied { get; set; } + /// + /// 1#托盘工位配料完成 + /// + public bool Tray1MaterialFinish { get; set; } + /// + /// 2#托盘工位配料完成 + /// + public bool Tray2MaterialFinish { get; set; } + /// + /// 接收托盘1配方数据完成 + /// + public bool Tray1ReceiveFinish { get; set; } + /// + /// 接收托盘2配方数据完成 + /// + public bool Tray2ReceiveFinish { get; set; } + + public int Reserve1 { get; set; } + public int Receive2 { get; set; } + /// + /// 托盘1_1#桶位置反馈 + /// + public float Tray1Barrel1Location { get; set; } + /// + /// 托盘1_2#桶位置反馈 + /// + public float Tray1Barrel2Location { get; set; } + /// + /// 托盘1_3#桶位置反馈 + /// + public float Tray1Barrel3Location { get; set; } + /// + /// 托盘1_4#桶位置反馈 + /// + public float Tray1Barrel4Location { get; set; } + /// + /// 托盘2_1#桶位置反馈 + /// + public float Tray2Barrel1Location { get; set; } + /// + /// 托盘2_2#桶位置反馈 + /// + public float Tray2Barrel2Location { get; set; } + /// + /// 托盘2_3#桶位置反馈 + /// + public float Tray2Barrel3Location { get; set; } + /// + /// 托盘2_4#桶位置反馈 + /// + public float Tray2Barrel4Location { get; set; } + + public int Reserve3 { get; set; } + public int Receive4 { get; set; } + /// + /// 托盘1_1#桶允许配料 + /// + public float Tray1Barrel1AllowDosing { get; set; } + /// + /// 托盘1_2#桶允许配料 + /// + public float Tray1Barrel2AllowDosing { get; set; } + /// + /// 托盘1_3#桶允许配料 + /// + public float Tray1Barrel3AllowDosing { get; set; } + /// + /// 托盘1_4#桶允许配料 + /// + public float Tray1Barrel4AllowDosing { get; set; } + /// + /// 托盘2_1#桶允许配料 + /// + public float Tray2Barrel1AllowDosing { get; set; } + /// + /// 托盘2_2#桶允许配料 + /// + public float Tray2Barrel2AllowDosing { get; set; } + /// + /// 托盘2_3#桶允许配料 + /// + public float Tray2Barrel3AllowDosing { get; set; } + /// + /// 托盘2_4#桶允许配料 + /// + public float Tray2Barrel4AllowDosing { get; set; } + + } +} diff --git a/BPASmartClient.JXJFoodSmallStation/Model/GVL/WriteSmallMaterial.cs b/BPASmartClient.JXJFoodSmallStation/Model/GVL/WriteSmallMaterial.cs new file mode 100644 index 00000000..0dd86460 --- /dev/null +++ b/BPASmartClient.JXJFoodSmallStation/Model/GVL/WriteSmallMaterial.cs @@ -0,0 +1,185 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace BPASmartClient.JXJFoodSmallStation.Model.GVL +{ + public class WriteSmallMaterial + { + /// + /// PLC到上位机心跳 + /// + public bool Heart { get; set; } + public bool Agv1 { get; set; } + public bool Agv2 { get; set; } + public bool Agv3 { get; set; } + public bool Agv4{ get; set; } + public bool Agv5 { get; set; } + public bool Agv6 { get; set; } + public bool Agv7 { get; set; } + public bool Agv8 { get; set; } + public bool Agv9 { get; set; } + public bool Agv10 { get; set; } + /// + /// 下发配方到托盘1 + /// + public bool Tray1IssueRecipe { get; set; } + /// + /// 下发配方到托盘2 + /// + public bool Tray2IssueRecipe { get; set; } + public int Reserve1 { get; set; } + public int Receive2 { get; set; } + + + public bool Tray1Barrel1IsDosing1; + public bool Tray1Barrel1IsDosing2; + public bool Tray1Barrel1IsDosing3; + public bool Tray1Barrel1IsDosing4; + public bool Tray1Barrel1IsDosing5; + public bool Tray1Barrel1IsDosing6; + public bool Tray1Barrel1IsDosing7; + public bool Tray1Barrel1IsDosing8; + public bool Tray1Barrel1IsDosing9; + public bool Tray1Barrel1IsDosing10; + public bool Tray1Barrel1IsDosing11; + public bool Tray1Barrel1IsDosing12; + public bool Tray1Barrel1IsDosing13; + public bool Tray1Barrel1IsDosing14; + public bool Tray1Barrel1IsDosing15; + public bool Receive3; + public bool Tray1Barrel2IsDosing1; + public bool Tray1Barrel2IsDosing2; + public bool Tray1Barrel2IsDosing3; + public bool Tray1Barrel2IsDosing4; + public bool Tray1Barrel2IsDosing5; + public bool Tray1Barrel2IsDosing6; + public bool Tray1Barrel2IsDosing7; + public bool Tray1Barrel2IsDosing8; + public bool Tray1Barrel2IsDosing9; + public bool Tray1Barrel2IsDosing10; + public bool Tray1Barrel2IsDosing11; + public bool Tray1Barrel2IsDosing12; + public bool Tray1Barrel2IsDosing13; + public bool Tray1Barrel2IsDosing14; + public bool Tray1Barrel2IsDosing15; + public bool Receive4; + public bool Tray1Barrel3IsDosing1; + public bool Tray1Barrel3IsDosing2; + public bool Tray1Barrel3IsDosing3; + public bool Tray1Barrel3IsDosing4; + public bool Tray1Barrel3IsDosing5; + public bool Tray1Barrel3IsDosing6; + public bool Tray1Barrel3IsDosing7; + public bool Tray1Barrel3IsDosing8; + public bool Tray1Barrel3IsDosing9; + public bool Tray1Barrel3IsDosing10; + public bool Tray1Barrel3IsDosing11; + public bool Tray1Barrel3IsDosing12; + public bool Tray1Barrel3IsDosing13; + public bool Tray1Barrel3IsDosing14; + public bool Tray1Barrel3IsDosing15; + public bool Receive5; + public bool Tray1Barrel4IsDosing1; + public bool Tray1Barrel4IsDosing2; + public bool Tray1Barrel4IsDosing3; + public bool Tray1Barrel4IsDosing4; + public bool Tray1Barrel4IsDosing5; + public bool Tray1Barrel4IsDosing6; + public bool Tray1Barrel4IsDosing7; + public bool Tray1Barrel4IsDosing8; + public bool Tray1Barrel4IsDosing9; + public bool Tray1Barrel4IsDosing10; + public bool Tray1Barrel4IsDosing11; + public bool Tray1Barrel4IsDosing12; + public bool Tray1Barrel4IsDosing13; + public bool Tray1Barrel4IsDosing14; + public bool Tray1Barrel4IsDosing15; + public bool Receive6; + + public bool Tray2Barrel1IsDosing1; + public bool Tray2Barrel1IsDosing2; + public bool Tray2Barrel1IsDosing3; + public bool Tray2Barrel1IsDosing4; + public bool Tray2Barrel1IsDosing5; + public bool Tray2Barrel1IsDosing6; + public bool Tray2Barrel1IsDosing7; + public bool Tray2Barrel1IsDosing8; + public bool Tray2Barrel1IsDosing9; + public bool Tray2Barrel1IsDosing10; + public bool Tray2Barrel1IsDosing11; + public bool Tray2Barrel1IsDosing12; + public bool Tray2Barrel1IsDosing13; + public bool Tray2Barrel1IsDosing14; + public bool Tray2Barrel1IsDosing15; + public bool Receive7; + public bool Tray2Barrel2IsDosing1; + public bool Tray2Barrel2IsDosing2; + public bool Tray2Barrel2IsDosing3; + public bool Tray2Barrel2IsDosing4; + public bool Tray2Barrel2IsDosing5; + public bool Tray2Barrel2IsDosing6; + public bool Tray2Barrel2IsDosing7; + public bool Tray2Barrel2IsDosing8; + public bool Tray2Barrel2IsDosing9; + public bool Tray2Barrel2IsDosing10; + public bool Tray2Barrel2IsDosing11; + public bool Tray2Barrel2IsDosing12; + public bool Tray2Barrel2IsDosing13; + public bool Tray2Barrel2IsDosing14; + public bool Tray2Barrel2IsDosing15; + public bool Receive8; + public bool Tray2Barrel3IsDosing1; + public bool Tray2Barrel3IsDosing2; + public bool Tray2Barrel3IsDosing3; + public bool Tray2Barrel3IsDosing4; + public bool Tray2Barrel3IsDosing5; + public bool Tray2Barrel3IsDosing6; + public bool Tray2Barrel3IsDosing7; + public bool Tray2Barrel3IsDosing8; + public bool Tray2Barrel3IsDosing9; + public bool Tray2Barrel3IsDosing10; + public bool Tray2Barrel3IsDosing11; + public bool Tray2Barrel3IsDosing12; + public bool Tray2Barrel3IsDosing13; + public bool Tray2Barrel3IsDosing14; + public bool Tray2Barrel3IsDosing15; + public bool Receive9; + public bool Tray2Barrel4IsDosing1; + public bool Tray2Barrel4IsDosing2; + public bool Tray2Barrel4IsDosing3; + public bool Tray2Barrel4IsDosing4; + public bool Tray2Barrel4IsDosing5; + public bool Tray2Barrel4IsDosing6; + public bool Tray2Barrel4IsDosing7; + public bool Tray2Barrel4IsDosing8; + public bool Tray2Barrel4IsDosing9; + public bool Tray2Barrel4IsDosing10; + public bool Tray2Barrel4IsDosing11; + public bool Tray2Barrel4IsDosing12; + public bool Tray2Barrel4IsDosing13; + public bool Tray2Barrel4IsDosing14; + public bool Tray2Barrel4IsDosing15; + public bool Receive10; + public int Receive11; + + public bool StockIn1DosingFinish; + public bool StockIn2DosingFinish; + public bool StockIn3DosingFinish; + public bool StockIn4DosingFinish; + public bool StockIn5DosingFinish; + public bool StockIn6DosingFinish; + public bool StockIn7DosingFinish; + public bool StockIn8DosingFinish; + public bool StockIn9DosingFinish; + public bool StockIn10DosingFinish; + public bool StockIn11DosingFinish; + public bool StockIn12DosingFinish; + public bool StockIn13DosingFinish; + public bool StockIn14DosingFinish; + public bool StockIn15DosingFinish; + public bool Receive12; + } +} diff --git a/BPASmartClient.JXJFoodSmallStation/Model/ProcessControl.cs b/BPASmartClient.JXJFoodSmallStation/Model/ProcessControl.cs index c9e6cfce..4f590352 100644 --- a/BPASmartClient.JXJFoodSmallStation/Model/ProcessControl.cs +++ b/BPASmartClient.JXJFoodSmallStation/Model/ProcessControl.cs @@ -21,7 +21,6 @@ namespace BPASmartClient.JXJFoodSmallStation.Model public static ProcessControl GetInstance => _Instance ?? (_Instance = new ProcessControl()); private ProcessControl() { } - public ObservableCollection RawMaterials { get; set; } = new ObservableCollection(); /// /// 配方数据 /// @@ -54,12 +53,12 @@ namespace BPASmartClient.JXJFoodSmallStation.Model { RawMaterialsNamePos.Add(DeviceInquire.GetInstance.GetDevice(i).DeviceName, (short)DeviceInquire.GetInstance.GetDevice(i).deviceStatus.DeviceNum); } - } } ActionManage.GetInstance.CancelRegister("SiemensRecipeRecive"); ActionManage.GetInstance.Register(new Action((res) => { + ObservableCollection RawMaterials = new ObservableCollection(); if (SiemensDevice.IsConnected) { if (res != null && res is XL_Start_DB recipe) @@ -96,7 +95,7 @@ namespace BPASmartClient.JXJFoodSmallStation.Model string Siemens_PLC_IP = ConfigurationManager.AppSettings["Siemens_IP"]; try { - HKDevice.HK_PLC_S7.Connect(S7.Net.CpuType.S71200, HK_PLC_IP); + //HKDevice.HK_PLC_S7.Connect(S7.Net.CpuType.S71200, HK_PLC_IP); //SiemensDevice.Siemens_PLC_S7.Connect(S7.Net.CpuType.S71500, Siemens_PLC_IP); if (HKDevice.IsConnected) { @@ -627,10 +626,10 @@ namespace BPASmartClient.JXJFoodSmallStation.Model { //int decimalNum = Convert.ToInt32(loc.ToString().Substring(loc.ToString().IndexOf(".") + 1)); int loc_index = Array.FindIndex(RemoteRecipes.ElementAt(index).RawMaterial.ToArray(), p => p.RawMaterialLocation == loc); - double weight = RemoteRecipes.ElementAt(index).RawMaterial.ElementAt(loc_index).RawMaterialWeight; + float weight = RemoteRecipes.ElementAt(index).RawMaterial.ElementAt(loc_index).RawMaterialWeight; if (loc_index >= 0) { - DeviceInquire.GetInstance.GetDevice((int)loc)?.Start((uint)weight);//根据料仓编号 启动并写入每个原料重量 + DeviceInquire.GetInstance.GetDevice((int)loc)?.Start(weight);//根据料仓编号 启动并写入每个原料重量 SmallStation.StockInIsWork = (int)loc; //HKDevice.HK_PLC_S7.Write("DB3.DBX50.0", false); } @@ -645,10 +644,10 @@ namespace BPASmartClient.JXJFoodSmallStation.Model if (res > 0 && res is float loc) { int loc_index = Array.FindIndex(RemoteRecipes.ElementAt(index).RawMaterial.ToArray(), p => p.RawMaterialLocation == loc); - double weight = RemoteRecipes.ElementAt(index).RawMaterial.ElementAt(loc_index).RawMaterialWeight; + float weight = RemoteRecipes.ElementAt(index).RawMaterial.ElementAt(loc_index).RawMaterialWeight; if (loc_index >= 0) { - DeviceInquire.GetInstance.GetDevice((int)loc)?.Start((uint)weight);//启动并写入每个原料重量 + DeviceInquire.GetInstance.GetDevice((int)loc)?.Start(weight);//启动并写入每个原料重量 SmallStation.StockInIsWork = (int)loc; //HKDevice.HK_PLC_S7.Write("DB3.DBX50.1", false); } @@ -663,10 +662,10 @@ namespace BPASmartClient.JXJFoodSmallStation.Model if (res > 0 && res is float loc) { int loc_index = Array.FindIndex(RemoteRecipes.ElementAt(index).RawMaterial.ToArray(), p => p.RawMaterialLocation == loc); - double weight = RemoteRecipes.ElementAt(index).RawMaterial.ElementAt(loc_index).RawMaterialWeight; + float weight = RemoteRecipes.ElementAt(index).RawMaterial.ElementAt(loc_index).RawMaterialWeight; if (loc_index >= 0) { - DeviceInquire.GetInstance.GetDevice((int)loc)?.Start((uint)weight);//启动并写入每个原料重量 + DeviceInquire.GetInstance.GetDevice((int)loc)?.Start(weight);//启动并写入每个原料重量 SmallStation.StockInIsWork = (int)loc; //HKDevice.HK_PLC_S7.Write("DB3.DBX50.2", false); } @@ -681,10 +680,10 @@ namespace BPASmartClient.JXJFoodSmallStation.Model if (res > 0 && res is float loc) { int loc_index = Array.FindIndex(RemoteRecipes.ElementAt(index).RawMaterial.ToArray(), p => p.RawMaterialLocation == loc); - double weight = RemoteRecipes.ElementAt(index).RawMaterial.ElementAt(loc_index).RawMaterialWeight; + float weight = RemoteRecipes.ElementAt(index).RawMaterial.ElementAt(loc_index).RawMaterialWeight; if (loc_index >= 0) { - DeviceInquire.GetInstance.GetDevice((int)loc)?.Start((uint)weight);//启动并写入每个原料重量 + DeviceInquire.GetInstance.GetDevice((int)loc)?.Start(weight);//启动并写入每个原料重量 SmallStation.StockInIsWork = (int)loc; //HKDevice.HK_PLC_S7.Write("DB3.DBX50.3", false); } diff --git a/BPASmartClient.JXJFoodBigStation/Model/Siemens/RemoteRecipeDataColl.cs b/BPASmartClient.JXJFoodSmallStation/Model/Siemens/LocalRecipeDataColl.cs similarity index 75% rename from BPASmartClient.JXJFoodBigStation/Model/Siemens/RemoteRecipeDataColl.cs rename to BPASmartClient.JXJFoodSmallStation/Model/Siemens/LocalRecipeDataColl.cs index 0d65fdad..90e6184c 100644 --- a/BPASmartClient.JXJFoodBigStation/Model/Siemens/RemoteRecipeDataColl.cs +++ b/BPASmartClient.JXJFoodSmallStation/Model/Siemens/LocalRecipeDataColl.cs @@ -5,9 +5,9 @@ using System.Linq; using System.Text; using System.Threading.Tasks; -namespace BPASmartClient.JXJFoodBigStation.Model.Siemens +namespace BPASmartClient.JXJFoodSmallStation.Model.Siemens { - public class RemoteRecipeDataColl + internal class LocalRecipeDataColl { public ObservableCollection Recipes { get; set; } = new ObservableCollection(); } diff --git a/BPASmartClient.JXJFoodSmallStation/Model/Siemens/RemoteRecipeRawMaterial.cs b/BPASmartClient.JXJFoodSmallStation/Model/Siemens/RemoteRecipeRawMaterial.cs index 586a7f0e..0e7a8317 100644 --- a/BPASmartClient.JXJFoodSmallStation/Model/Siemens/RemoteRecipeRawMaterial.cs +++ b/BPASmartClient.JXJFoodSmallStation/Model/Siemens/RemoteRecipeRawMaterial.cs @@ -23,8 +23,8 @@ namespace BPASmartClient.JXJFoodSmallStation.Model /// /// 需要原料重量 /// - public double RawMaterialWeight { get { return _mRawMaterialWeight; } set { _mRawMaterialWeight = value; } } - private double _mRawMaterialWeight; + public float RawMaterialWeight { get { return _mRawMaterialWeight; } set { _mRawMaterialWeight = value; } } + private float _mRawMaterialWeight; /// /// 实际的下料中重量 @@ -35,8 +35,8 @@ namespace BPASmartClient.JXJFoodSmallStation.Model /// /// 料仓剩余重量 /// - public double StockBinRemainingWeight { get { return _mStockBinRemainingWeight; } set { _mStockBinRemainingWeight = value; } } - private double _mStockBinRemainingWeight; + public float StockBinRemainingWeight { get { return _mStockBinRemainingWeight; } set { _mStockBinRemainingWeight = value; } } + private float _mStockBinRemainingWeight; /// /// 原料对应料仓的位置 diff --git a/BPASmartClient.JXJFoodSmallStation/Model/TestData.cs b/BPASmartClient.JXJFoodSmallStation/Model/TestData.cs index 8f96ff0d..4a7c5c99 100644 --- a/BPASmartClient.JXJFoodSmallStation/Model/TestData.cs +++ b/BPASmartClient.JXJFoodSmallStation/Model/TestData.cs @@ -21,15 +21,15 @@ namespace BPASmartClient.JXJFoodSmallStation.Model string recipeCode = "10001"; int Traycode = 1; - double RawmaterialWeight = 10; + float RawmaterialWeight = 10; short RawMaterialbarrelNum = 1; int RawMaterialLocation = 5; - double RawmaterialWeight1 = 20; + float RawmaterialWeight1 = 20; short RawMaterialbarrelNum1 = 2; int RawMaterialLocation1 = 7; - double RawmaterialWeight2 = 30; + float RawmaterialWeight2 = 30; short RawMaterialbarrelNum2 = 3; int RawMaterialLocation2 = 9; RawMaterials.Add(new RemoteRecipeRawMaterial() @@ -67,15 +67,15 @@ namespace BPASmartClient.JXJFoodSmallStation.Model string recipeCode_2 = "20001"; int Traycode_2 = 3; - double RawmaterialWeight_2 = 10; + float RawmaterialWeight_2 = 10; short RawMaterialbarrelNum_2 = 1; int RawMaterialLocation_2 = 5; - double RawmaterialWeight1_2 = 20; + float RawmaterialWeight1_2 = 20; short RawMaterialbarrelNum1_2 = 2; int RawMaterialLocation1_2 = 7; - double RawmaterialWeight2_2 = 30; + float RawmaterialWeight2_2 = 30; short RawMaterialbarrelNum2_2 = 3; int RawMaterialLocation2_2 = 9; RawMaterials.Add(new RemoteRecipeRawMaterial() diff --git a/BPASmartClient.JXJFoodSmallStation/View/NewLocalRecipeView.xaml b/BPASmartClient.JXJFoodSmallStation/View/NewLocalRecipeView.xaml new file mode 100644 index 00000000..d65ecb47 --- /dev/null +++ b/BPASmartClient.JXJFoodSmallStation/View/NewLocalRecipeView.xaml @@ -0,0 +1,235 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + @@ -100,12 +105,12 @@ - 原料桶号 - 原料位置 + 原料位置 + 原料桶号 原料重量 - - + + @@ -114,8 +119,8 @@ - - + + @@ -129,9 +134,6 @@ - - - diff --git a/BPASmartClient.JXJFoodSmallStation/View/RecipeInfosView.xaml.cs b/BPASmartClient.JXJFoodSmallStation/View/RecipeInfosView.xaml.cs index 837df838..1df76fea 100644 --- a/BPASmartClient.JXJFoodSmallStation/View/RecipeInfosView.xaml.cs +++ b/BPASmartClient.JXJFoodSmallStation/View/RecipeInfosView.xaml.cs @@ -23,6 +23,7 @@ namespace BPASmartClient.JXJFoodSmallStation.View public RecipeInfosView() { InitializeComponent(); + this.br.MouseLeftButtonDown += (o, e) => { if (e.LeftButton == MouseButtonState.Pressed) this.DragMove(); }; ActionManage.GetInstance.CancelRegister("CloseRecipeInfosView"); ActionManage.GetInstance.Register(new Action(() => { this.Close(); }), "CloseRecipeInfosView"); } diff --git a/BPASmartClient.JXJFoodSmallStation/View/RecipeReceiveView.xaml b/BPASmartClient.JXJFoodSmallStation/View/RecipeReceiveView.xaml index 6afc56ac..af6084d6 100644 --- a/BPASmartClient.JXJFoodSmallStation/View/RecipeReceiveView.xaml +++ b/BPASmartClient.JXJFoodSmallStation/View/RecipeReceiveView.xaml @@ -48,11 +48,17 @@ - + + - + + + - diff --git a/BPASmartClient.JXJFoodSmallStation/View/SiemensRecipeReceiveView.xaml b/BPASmartClient.JXJFoodSmallStation/View/SiemensRecipeReceiveView.xaml new file mode 100644 index 00000000..fff5a9cd --- /dev/null +++ b/BPASmartClient.JXJFoodSmallStation/View/SiemensRecipeReceiveView.xaml @@ -0,0 +1,150 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/BPASmartClient.JXJFoodSmallStation/View/SiemensRecipeReceiveView.xaml.cs b/BPASmartClient.JXJFoodSmallStation/View/SiemensRecipeReceiveView.xaml.cs new file mode 100644 index 00000000..0aaf75a3 --- /dev/null +++ b/BPASmartClient.JXJFoodSmallStation/View/SiemensRecipeReceiveView.xaml.cs @@ -0,0 +1,29 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Reflection; +using System.Text; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Data; +using System.Windows.Documents; +using System.Windows.Input; +using System.Windows.Media; +using System.Windows.Media.Imaging; +using System.Windows.Navigation; +using System.Windows.Shapes; + +namespace BPASmartClient.JXJFoodSmallStation.View +{ + /// + /// RecipeSettingsView.xaml 的交互逻辑 + /// + public partial class SiemensRecipeReceiveView : UserControl + { + public SiemensRecipeReceiveView() + { + InitializeComponent(); + } + } +} diff --git a/BPASmartClient.JXJFoodSmallStation/View/WindSendParView.xaml b/BPASmartClient.JXJFoodSmallStation/View/WindSendParView.xaml new file mode 100644 index 00000000..00e4ef34 --- /dev/null +++ b/BPASmartClient.JXJFoodSmallStation/View/WindSendParView.xaml @@ -0,0 +1,370 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +