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