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