From a53e32297d028de1809c2343de5cc48900952b71 Mon Sep 17 00:00:00 2001
From: pengliangyang <1406009520@qq.com>
Date: Thu, 13 Apr 2023 13:36:49 +0800
Subject: [PATCH] =?UTF-8?q?=E4=BB=A3=E7=A0=81=E6=9B=B4=E6=96=B0?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../Pages/Model/AlarmHelper.cs | 1 -
BPASmartClient.Device/BaseDevice.cs | 2 +-
BPASmartClient.Helper/ExpandMethod.cs | 120 ++
BPASmartClient.Helper/ThreadManage.cs | 1 -
.../Model/GVL_BigStation.cs | 10 +
.../Model/HK_PLC/DB_Write.cs | 19 +
.../Model/HK_PLC/HKPlcCommAddress.cs | 13 +
.../Model/ProcessControl.cs | 1133 ++++++-----
.../Model/RawMaterial/RecipeData.cs | 8 +
.../Model/RecipeDosing.cs | 25 +
.../Model/Siemens/SiemensDeviceStatus.cs | 23 +-
.../View/HardwareStatusView.xaml | 17 +-
.../View/ManualFlowView.xaml | 111 +-
.../View/RecipeReceiveView.xaml | 14 +-
.../View/RecipeSendDownView.xaml | 9 +-
.../View/RecipeSendDownView.xaml.cs | 16 +-
.../ViewModel/HardwareStatusViewModel.cs | 107 +-
.../ViewModel/ManualFlowViewModel.cs | 64 +-
.../ViewModel/RecipeReceiveViewModel.cs | 24 +
.../ViewModel/RecipeSendDownViewModel.cs | 6 +-
.../App.xaml.cs | 49 +-
.../BPASmartClient.JXJFoodSmallStation.csproj | 7 +
.../Model/Bom/BomMaterial.cs | 21 +
.../Model/Bom/BomMaterialData.cs | 16 +
...lcCommAttribute.cs => VarCommAttribute.cs} | 4 +-
.../Model/GVL_SmallStation.cs | 230 ++-
.../Model/HK_PLC/DataComm.cs | 41 +
.../Model/HK_PLC/HKDeviceStatus.cs | 3 +-
.../Model/HK_PLC/HKDeviceWrite.cs | 23 +
.../Model/HK_PLC/PlcReadAddressDB3.cs | 156 +-
.../Model/HK_PLC/PlcWriteAddressDB7.cs | 13 +
.../Model/ProcessControl.cs | 1650 ++++++++++-------
.../Model/RawMaterial/DeviceInquire.cs | 1 -
.../Model/RawMaterial/DevicePar.cs | 2 +
.../Model/Siemens/SiemensDeviceStatus.cs | 23 +-
.../Model/WindSend/WindSendDeviceStatus.cs | 7 +-
.../Model/WindSend/WindSendRawMaterial.cs | 4 +-
.../View/BomOfMaterialView.xaml | 250 +++
.../View/BomOfMaterialView.xaml.cs | 28 +
.../View/ManualFlowView.xaml | 51 +-
.../View/ManualFlowView.xaml.cs | 5 +
.../View/PlcVarMonitorView.xaml | 7 +-
.../View/ProcessMonitorView.xaml | 90 +
.../View/ProcessMonitorView.xaml.cs | 28 +
.../View/RecipeReceiveView.xaml | 20 +-
.../View/RecipeReceiveView.xaml.cs | 2 +
.../View/RobotView.xaml | 4 +-
.../View/StockBinRawMaterialView.xaml | 14 +-
.../View/WindSendParView.xaml | 6 +-
.../View/WindSendParView.xaml.cs | 3 +-
.../ViewModel/BomOfMaterialViewModel.cs | 85 +
.../ViewModel/HardwareStatusViewModel.cs | 4 +-
.../ViewModel/ManualControlViewModel.cs | 216 ++-
.../ViewModel/ManualFlowViewModel.cs | 41 +-
.../ViewModel/ProcessMonitorViewModel.cs | 23 +
.../ViewModel/RecipeReceiveViewModel.cs | 12 +
.../ViewModel/RobotViewModel.cs | 24 +-
.../ViewModel/SystemParViewModel.cs | 17 +-
.../ViewModel/WindSendParViewModel.cs | 5 +-
BPASmartClient.MorkS/Control_Morks.cs | 9 +-
BPASmartClient.MorkS/GVL_MORKS.cs | 3 +
BPASmartClient.MorkS/Model/MorksPar.cs | 4 +
BPASmartClient.MorkS/View/ParSet.xaml | 27 +-
.../ViewModel/ParSetViewModel.cs | 4 +
BPASmartClient/App.config | 8 +-
DosingSystem/Model/par/LocaPar.cs | 18 +
.../ViewModel/RecipeControlViewModel.cs | 536 +++---
67 files changed, 3589 insertions(+), 1928 deletions(-)
create mode 100644 BPASmartClient.JXJFoodBigStation/Model/HK_PLC/HKPlcCommAddress.cs
create mode 100644 BPASmartClient.JXJFoodBigStation/Model/RecipeDosing.cs
create mode 100644 BPASmartClient.JXJFoodSmallStation/Model/Bom/BomMaterial.cs
create mode 100644 BPASmartClient.JXJFoodSmallStation/Model/Bom/BomMaterialData.cs
rename BPASmartClient.JXJFoodSmallStation/Model/GVL/{PlcCommAttribute.cs => VarCommAttribute.cs} (78%)
create mode 100644 BPASmartClient.JXJFoodSmallStation/Model/HK_PLC/DataComm.cs
create mode 100644 BPASmartClient.JXJFoodSmallStation/Model/HK_PLC/HKDeviceWrite.cs
create mode 100644 BPASmartClient.JXJFoodSmallStation/Model/HK_PLC/PlcWriteAddressDB7.cs
create mode 100644 BPASmartClient.JXJFoodSmallStation/View/BomOfMaterialView.xaml
create mode 100644 BPASmartClient.JXJFoodSmallStation/View/BomOfMaterialView.xaml.cs
create mode 100644 BPASmartClient.JXJFoodSmallStation/View/ProcessMonitorView.xaml
create mode 100644 BPASmartClient.JXJFoodSmallStation/View/ProcessMonitorView.xaml.cs
create mode 100644 BPASmartClient.JXJFoodSmallStation/ViewModel/BomOfMaterialViewModel.cs
create mode 100644 BPASmartClient.JXJFoodSmallStation/ViewModel/ProcessMonitorViewModel.cs
create mode 100644 DosingSystem/Model/par/LocaPar.cs
diff --git a/BPASmartClient.CustomResource/Pages/Model/AlarmHelper.cs b/BPASmartClient.CustomResource/Pages/Model/AlarmHelper.cs
index a1aa60c6..e504cf29 100644
--- a/BPASmartClient.CustomResource/Pages/Model/AlarmHelper.cs
+++ b/BPASmartClient.CustomResource/Pages/Model/AlarmHelper.cs
@@ -67,7 +67,6 @@ namespace BPASmartClient.CustomResource.Pages.Model
}
Thread.Sleep(100);
}), $"{typeof(AlarmT).Name},报警通用模块监听");
-
}
///
diff --git a/BPASmartClient.Device/BaseDevice.cs b/BPASmartClient.Device/BaseDevice.cs
index e5b10552..be2eea4b 100644
--- a/BPASmartClient.Device/BaseDevice.cs
+++ b/BPASmartClient.Device/BaseDevice.cs
@@ -284,7 +284,7 @@ namespace BPASmartClient.Device
foreach (var faces in res)
{
if (faces.Name == "IStatus")
- {
+ {
InterfaceStatus = item.GetValue(this) as IStatus;
GetMonitorData(InterfaceStatus);
}
diff --git a/BPASmartClient.Helper/ExpandMethod.cs b/BPASmartClient.Helper/ExpandMethod.cs
index e3df2666..050ca1c3 100644
--- a/BPASmartClient.Helper/ExpandMethod.cs
+++ b/BPASmartClient.Helper/ExpandMethod.cs
@@ -185,6 +185,126 @@ namespace BPASmartClient.Helper
return false;
}
+ public static string ToBinString(this object value)
+ {
+ int num = 0;
+ int num2 = 0;
+ int num3 = 0;
+ string text = "";
+ long num4 = 0L;
+ try
+ {
+ if (value.GetType().Name.IndexOf("[]") < 0)
+ {
+ string a = value.GetType().Name;
+ switch (a)
+ {
+ case "Byte":
+ num3 = 7;
+ num4 = (byte)value;
+ break;
+ case "UInt16":
+ num3 = 15;
+ num4 = (ushort)value;
+ break;
+ case "Int16":
+ num3 = 15;
+ num4 = (short)value;
+ break;
+ case "UInt32":
+ num3 = 31;
+ num4 = (uint)value;
+ break;
+ case "Int32":
+ num3 = 31;
+ num4 = (int)value;
+ break;
+ case "Int64":
+ num3 = 63;
+ num4 = (long)value;
+ break;
+ default:
+ throw new Exception();
+ }
+
+ for (num = num3; num >= 0; num += -1)
+ {
+ if ((num + 1) % 4 == 0) text = text + " ";
+ text = (((num4 & (long)Math.Pow(2.0, num)) <= 0) ? (text + "0") : (text + "1"));
+ }
+ }
+ else
+ {
+ switch (value.GetType().Name)
+ {
+ case "Byte[]":
+ {
+ num3 = 7;
+ byte[] array4 = (byte[])value;
+ for (num2 = 0; num2 <= array4.Length - 1; num2++)
+ {
+ for (num = num3; num >= 0; num += -1)
+ {
+ text = (((array4[num2] & (byte)Math.Pow(2.0, num)) <= 0) ? (text + "0") : (text + "1"));
+ }
+ }
+
+ break;
+ }
+ case "Int16[]":
+ {
+ num3 = 15;
+ short[] array2 = (short[])value;
+ for (num2 = 0; num2 <= array2.Length - 1; num2++)
+ {
+ for (num = num3; num >= 0; num += -1)
+ {
+ text = (((array2[num2] & (byte)Math.Pow(2.0, num)) <= 0) ? (text + "0") : (text + "1"));
+ }
+ }
+
+ break;
+ }
+ case "Int32[]":
+ {
+ num3 = 31;
+ int[] array3 = (int[])value;
+ for (num2 = 0; num2 <= array3.Length - 1; num2++)
+ {
+ for (num = num3; num >= 0; num += -1)
+ {
+ text = (((array3[num2] & (byte)Math.Pow(2.0, num)) <= 0) ? (text + "0") : (text + "1"));
+ }
+ }
+
+ break;
+ }
+ case "Int64[]":
+ {
+ num3 = 63;
+ byte[] array = (byte[])value;
+ for (num2 = 0; num2 <= array.Length - 1; num2++)
+ {
+ for (num = num3; num >= 0; num += -1)
+ {
+ text = (((array[num2] & (byte)Math.Pow(2.0, num)) <= 0) ? (text + "0") : (text + "1"));
+ }
+ }
+
+ break;
+ }
+ default:
+ throw new Exception();
+ }
+ }
+
+ return text;
+ }
+ catch
+ {
+ return "";
+ }
+ }
diff --git a/BPASmartClient.Helper/ThreadManage.cs b/BPASmartClient.Helper/ThreadManage.cs
index 25f0cd24..33d37d20 100644
--- a/BPASmartClient.Helper/ThreadManage.cs
+++ b/BPASmartClient.Helper/ThreadManage.cs
@@ -201,5 +201,4 @@ namespace BPASmartClient.Helper
return false;
}
}
-
}
diff --git a/BPASmartClient.JXJFoodBigStation/Model/GVL_BigStation.cs b/BPASmartClient.JXJFoodBigStation/Model/GVL_BigStation.cs
index 624df1bd..ff7f543e 100644
--- a/BPASmartClient.JXJFoodBigStation/Model/GVL_BigStation.cs
+++ b/BPASmartClient.JXJFoodBigStation/Model/GVL_BigStation.cs
@@ -62,6 +62,16 @@ namespace BPASmartClient.JXJFoodBigStation.Model
/// 配方下发状态 =0:配方未下发 ,1:配方下发给plc ,2:plc成功接收配方
///
public static int Recipe4DosingStatus { get; set; }
+
+
+ public static int[] RecipeDosingStatus { get; set; } = new int[4] { 0, 0, 0, 0 };
+ public static bool[] AllowIssueRecipe { get; set; } = new bool[4] { false, false, false, false };
+ public static bool[] ReceviceFinishRecipe { get; set; } = new bool[4] { false, false, false, false };
+ public static bool[] DosingFinishRecipe { get; set; } = new bool[4] { false, false, false, false };
+
+ public static bool[] IsTrayArrive { get; set; } = new bool[5] { false, false, false, false,false };
+ public static DateTime[] RecipeDosingTime { get; set; } = new DateTime[4] { DateTime.Now, DateTime.Now, DateTime.Now, DateTime.Now };
+
///
/// 是否处于手动下发配方
///
diff --git a/BPASmartClient.JXJFoodBigStation/Model/HK_PLC/DB_Write.cs b/BPASmartClient.JXJFoodBigStation/Model/HK_PLC/DB_Write.cs
index 82c4d8dd..4d12381e 100644
--- a/BPASmartClient.JXJFoodBigStation/Model/HK_PLC/DB_Write.cs
+++ b/BPASmartClient.JXJFoodBigStation/Model/HK_PLC/DB_Write.cs
@@ -58,6 +58,25 @@ namespace BPASmartClient.JXJFoodBigStation.Model.HK_PLC
///
public bool Tray5InPlace { get; set; }
///
+ /// 配方1配料完成
+ ///
+ public bool Recipe1DoisngFinish { get; set; }
+
+ ///
+ /// 配方2配料完成
+ ///
+ public bool Recipe2DoisngFinish { get; set; }
+
+ ///
+ /// 配方3配料完成
+ ///
+ public bool Recipe3DoisngFinish { get; set; }
+
+ ///
+ /// 配方4配料完成
+ ///
+ public bool Recipe4DoisngFinish { get; set; }
+ ///
/// 配方编码
///
public short RecipeCode { get; set; }
diff --git a/BPASmartClient.JXJFoodBigStation/Model/HK_PLC/HKPlcCommAddress.cs b/BPASmartClient.JXJFoodBigStation/Model/HK_PLC/HKPlcCommAddress.cs
new file mode 100644
index 00000000..b571013d
--- /dev/null
+++ b/BPASmartClient.JXJFoodBigStation/Model/HK_PLC/HKPlcCommAddress.cs
@@ -0,0 +1,13 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace BPASmartClient.JXJFoodBigStation.Model.HK_PLC
+{
+ public class HKPlcCommAddress
+ {
+
+ }
+}
diff --git a/BPASmartClient.JXJFoodBigStation/Model/ProcessControl.cs b/BPASmartClient.JXJFoodBigStation/Model/ProcessControl.cs
index b5f1a742..b1962f34 100644
--- a/BPASmartClient.JXJFoodBigStation/Model/ProcessControl.cs
+++ b/BPASmartClient.JXJFoodBigStation/Model/ProcessControl.cs
@@ -27,27 +27,27 @@ namespace BPASmartClient.JXJFoodBigStation.Model
///
/// 西门子配方数据
///
- public ObservableCollection SiemensRecipes = new ObservableCollection();
+ public ObservableCollection SiemensRecipes { get; set; } = new ObservableCollection();
///
/// 本地配方数据
///
- public ObservableCollection LocalRecipes = new ObservableCollection();
+ public ObservableCollection LocalRecipes { get; set; } = new ObservableCollection();
///
/// 配方等待执行
///
- public ObservableCollection RecipeWaitExecute = new ObservableCollection();
+ public ObservableCollection RecipeWaitExecute { get; set; } = new ObservableCollection();
///
/// 配方正在执行
///
- public ObservableCollection RecipeExecuting = new ObservableCollection();
+ public ObservableCollection RecipeExecuting { get; set; } = new ObservableCollection();
///
/// 配方执行完成
///
- public ObservableCollection RecipeExecuteComple = new ObservableCollection();
+ public ObservableCollection RecipeExecuteComple { get; set; } = new ObservableCollection();
///
/// 原料的名称和料仓的位置对应
///
- public ConcurrentDictionary RawMaterialsNamePos = new ConcurrentDictionary();
+ public ConcurrentDictionary RawMaterialsNamePos { get; set; } = new ConcurrentDictionary();
///
/// 硬件料仓的原料信息
///
@@ -60,6 +60,9 @@ namespace BPASmartClient.JXJFoodBigStation.Model
public ConcurrentQueue SiemensRecipeQueue2 = new ConcurrentQueue();
public ConcurrentQueue SiemensRecipeQueue3 = new ConcurrentQueue();
public ConcurrentQueue SiemensRecipeQueue4 = new ConcurrentQueue();
+
+ public ConcurrentDictionary> SiemensRecipeQueue = new ConcurrentDictionary>();
+ public ObservableCollection recipe = new ObservableCollection();
///
/// 本地配方队列
///
@@ -89,7 +92,7 @@ namespace BPASmartClient.JXJFoodBigStation.Model
for (int i = 0; i < GVL_BigStation.Max_DosingSotckBinNum; i++)
{
int index = RawMaterialsNamePos.Values.ToList().IndexOf(recipe.Material[i].Material_Name);
- if (index>=0)
+ if (index >= 0)
{
RawMaterials.Add(new RawMaterial()
{
@@ -101,7 +104,7 @@ namespace BPASmartClient.JXJFoodBigStation.Model
}
else
{
- MessageNotify.GetInstance.ShowAlarmLog($"本地原料名称和西门子下发的原料名称无法对应,原料名称:{recipe.Material[i].Material_Name},");
+ MessageNotify.GetInstance.ShowAlarmLog($"本地缺少原料{recipe.Material[i].Material_Name},和西门子下发的原料名称无法对应,");
}
}
App.Current.Dispatcher.Invoke(() =>
@@ -118,11 +121,11 @@ namespace BPASmartClient.JXJFoodBigStation.Model
}
}
}), "SiemensSendRecipe", true);
- //testRawMaterialNameData();//自定义料仓名称
DeviceConnectInit();//设备连接初始化
ThreadInit();//线程初始化
VarResetInit();//变量初始化
}
+ #region 本地配方--暂时不使用
private void LocalRecipeRecevice()
{
if (LocalRecipes.Count > 0)
@@ -223,7 +226,7 @@ namespace BPASmartClient.JXJFoodBigStation.Model
MessageNotify.GetInstance.ShowRunLog($"配方编号:{code},托盘编号:{trayCode},下发完成");
}
}
- else
+ else
{
HKDevice.StockBinPar(LocalRecipes.ElementAt(index));
HKDevice.HK_PLC_S7.Write("DB99.DBX0.3", true);
@@ -249,7 +252,7 @@ namespace BPASmartClient.JXJFoodBigStation.Model
{
GVL_BigStation.BarrelWasherSign = false;
}
- GVL_BigStation.Recipe1DosingStatus = 3;
+ GVL_BigStation.Recipe1DosingStatus = 3;
switch (trayCode)
{
case 1:
@@ -331,7 +334,6 @@ namespace BPASmartClient.JXJFoodBigStation.Model
}
}
LocalRecipeQueue1.TryDequeue(out code);
- RecipeExecuteComple.Add(LocalRecipes.ElementAt(index));//将配方添加到完成列表
//App.Current.Dispatcher.Invoke(() => {
// Json.Data.Recipes.RemoveAt(index);//制作完成,移除当前配方
//});
@@ -373,7 +375,7 @@ namespace BPASmartClient.JXJFoodBigStation.Model
default:
break;
}
- if (HKDevice.PlcRead.IsAllowIssueRecipe2 && GVL_BigStation.Recipe2DosingStatus == 0 &&Inplace)//配方2是否允许下发配发
+ if (HKDevice.PlcRead.IsAllowIssueRecipe2 && GVL_BigStation.Recipe2DosingStatus == 0 && Inplace)//配方2是否允许下发配发
{
if (LocalRecipes.ElementAt(index).IsWashingBarrel)
{
@@ -497,10 +499,6 @@ namespace BPASmartClient.JXJFoodBigStation.Model
}
}
LocalRecipeQueue2.TryDequeue(out code);
- RecipeExecuteComple.Add(LocalRecipes.ElementAt(index));//将该配方添加到下
- //App.Current.Dispatcher.Invoke(() => {
- // Json.Data.Recipes.RemoveAt(index);//制作完成,移除当前配方
- //});
LocalRecipes.RemoveAt(index);
GVL_BigStation.Recipe2DosingStatus = 0;
}
@@ -555,7 +553,7 @@ namespace BPASmartClient.JXJFoodBigStation.Model
MessageNotify.GetInstance.ShowRunLog($"配方状态:{code}下发完成");
}
}
- else
+ else
{
HKDevice.StockBinPar(LocalRecipes.ElementAt(index));
HKDevice.HK_PLC_S7.Write("DB99.DBX0.5", true);
@@ -664,10 +662,6 @@ namespace BPASmartClient.JXJFoodBigStation.Model
}
HKDevice.HK_PLC_S7.Write("DB98.DBX1.1", false);
LocalRecipeQueue3.TryDequeue(out code);
- RecipeExecuteComple.Add(LocalRecipes.ElementAt(index));//将该配方添加到下
- //App.Current.Dispatcher.Invoke(() => {
- // Json.Data.Recipes.RemoveAt(index);//制作完成,移除当前配方
- //});
LocalRecipes.RemoveAt(index);
GVL_BigStation.Recipe3DosingStatus = 0;
}
@@ -722,7 +716,7 @@ namespace BPASmartClient.JXJFoodBigStation.Model
MessageNotify.GetInstance.ShowRunLog($"配方状态:{code}下发完成");
}
}
- else
+ else
{
HKDevice.StockBinPar(LocalRecipes.ElementAt(index));
HKDevice.HK_PLC_S7.Write("DB99.DBX0.6", true);
@@ -828,19 +822,16 @@ namespace BPASmartClient.JXJFoodBigStation.Model
{
item.Laying_Off_Weight = HKDevice.PlcRead.StockBin14ActualWeight;
}
- }
+ }
HKDevice.HK_PLC_S7.Write("DB98.DBX1.3", false);
LocalRecipeQueue4.TryDequeue(out code);
- RecipeExecuteComple.Add(LocalRecipes.ElementAt(index));//将该配方添加到下
- //App.Current.Dispatcher.Invoke(() => {
- // Json.Data.Recipes.RemoveAt(index);//制作完成,移除当前配方
- //});
LocalRecipes.RemoveAt(index);
GVL_BigStation.Recipe4DosingStatus = 0;
}
}
}
}
+ #endregion
private void ReceviceData()
{
SiemensRecipes = Json.Data.Recipes;
@@ -848,151 +839,178 @@ namespace BPASmartClient.JXJFoodBigStation.Model
{
foreach (var data in SiemensRecipes)
{
- if (SiemensRecipeQueue1.Count == 0 && !SiemensRecipeQueue2.Contains(data.RecipeCode) && !SiemensRecipeQueue3.Contains(data.RecipeCode) && !SiemensRecipeQueue4.Contains(data.RecipeCode) && HKDevice.PlcRead.IsAllowIssueRecipe1)
+ if (data.RecipesSource == RecipeSource.远程)
{
- if (!(SiemensRecipeQueue1.Contains(data.RecipeCode)))
+ if (SiemensRecipeQueue1.Count == 0 && !SiemensRecipeQueue2.Contains(data.RecipeCode) && !SiemensRecipeQueue3.Contains(data.RecipeCode) && !SiemensRecipeQueue4.Contains(data.RecipeCode) && HKDevice.PlcRead.IsAllowIssueRecipe1)
{
- if (SiemensDevice.DL_Status is DL_Status_DB status)
+ if (!(SiemensRecipeQueue1.Contains(data.RecipeCode)))
{
- switch (GVL_BigStation.SiemensSendRecipeStatus)
+ if (SiemensDevice.DL_Status is DL_Status_DB status)
{
- case 3:
+ switch (GVL_BigStation.SiemensSendRecipeStatus)
+ {
+ case 3:
+ SiemensDevice.Siemens_PLC_S7.WriteString(2331, data.RecipeCode, 10);
+ SiemensDevice.Siemens_PLC_S7.Write("DB2331.DBX28.0", true);
+ MessageNotify.GetInstance.ShowRunLog($"配方1,发送配方编号和请求配料标志给西门子");
+ GVL_BigStation.SiemensSendRecipeStatus = 4;
+ break;
+ case 4:
+ if (SiemensDevice.DL_Status.Dosing_Start_ACK)
+ {
+ SiemensDevice.Siemens_PLC_S7.WriteString(2331, "", 10);
+ SiemensDevice.Siemens_PLC_S7.Write("DB2331.DBX28.0", false);
+ MessageNotify.GetInstance.ShowRunLog($"配方1,西门子确认开始配料");
+ GVL_BigStation.SiemensSendRecipeStatus = 5;
+ }
+ break;
+ case 5:
+ if (SiemensDevice.DL_Status.Dosing_Start_ACK == false)
+ {
+ SiemensRecipeQueue1.Enqueue(data.RecipeCode);
+ MessageNotify.GetInstance.ShowRunLog($"配方1,配方:{data.RecipeCode},加入队列");
+ GVL_BigStation.SiemensSendRecipeStatus = 0;
+ }
+ break;
+ default:
+ break;
+ }
+ }
+ }
+ }
+ else if (SiemensRecipeQueue2.Count == 0 && !SiemensRecipeQueue1.Contains(data.RecipeCode) && !SiemensRecipeQueue3.Contains(data.RecipeCode) && !SiemensRecipeQueue4.Contains(data.RecipeCode) && HKDevice.PlcRead.IsAllowIssueRecipe2)
+ {
+ if (!(SiemensRecipeQueue2.Contains(data.RecipeCode)))
+ {
+ if (SiemensDevice.DL_Status is DL_Status_DB status)
+ {
+ if (GVL_BigStation.SiemensSendRecipeStatus == 3)
+ {
SiemensDevice.Siemens_PLC_S7.WriteString(2331, data.RecipeCode, 10);
SiemensDevice.Siemens_PLC_S7.Write("DB2331.DBX28.0", true);
- MessageNotify.GetInstance.ShowRunLog($"配方1,发送配方编号和请求配料标志给西门子");
+ MessageNotify.GetInstance.ShowRunLog($"配方2,发送配方编号和请求配料标志给西门子");
GVL_BigStation.SiemensSendRecipeStatus = 4;
- break;
- case 4:
+ }
+ if (GVL_BigStation.SiemensSendRecipeStatus == 4)
+ {
if (SiemensDevice.DL_Status.Dosing_Start_ACK)
{
SiemensDevice.Siemens_PLC_S7.WriteString(2331, "", 10);
SiemensDevice.Siemens_PLC_S7.Write("DB2331.DBX28.0", false);
- MessageNotify.GetInstance.ShowRunLog($"配方1,西门子确认开始配料");
+ MessageNotify.GetInstance.ShowRunLog($"配方2,西门子确认开始配料");
GVL_BigStation.SiemensSendRecipeStatus = 5;
}
- break;
- case 5:
+ }
+ if (GVL_BigStation.SiemensSendRecipeStatus == 5)
+ {
if (SiemensDevice.DL_Status.Dosing_Start_ACK == false)
{
- SiemensRecipeQueue1.Enqueue(data.RecipeCode);
- MessageNotify.GetInstance.ShowRunLog($"配方1,配方:{data.RecipeCode},加入队列");
+ SiemensRecipeQueue2.Enqueue(data.RecipeCode);
+ MessageNotify.GetInstance.ShowRunLog($"配方2,配方:{data.RecipeCode},加入队列");
GVL_BigStation.SiemensSendRecipeStatus = 0;
}
- break;
- default:
- break;
+ }
}
}
}
- }
- else if (SiemensRecipeQueue2.Count == 0 && !SiemensRecipeQueue1.Contains(data.RecipeCode) && !SiemensRecipeQueue3.Contains(data.RecipeCode) && !SiemensRecipeQueue4.Contains(data.RecipeCode) && HKDevice.PlcRead.IsAllowIssueRecipe2)
- {
- if (!(SiemensRecipeQueue2.Contains(data.RecipeCode)))
+ else if (SiemensRecipeQueue3.Count == 0 && !SiemensRecipeQueue1.Contains(data.RecipeCode) && !SiemensRecipeQueue2.Contains(data.RecipeCode) && !SiemensRecipeQueue4.Contains(data.RecipeCode) && HKDevice.PlcRead.IsAllowIssueRecipe3)
{
- if (SiemensDevice.DL_Status is DL_Status_DB status)
+ if (!(SiemensRecipeQueue3.Contains(data.RecipeCode)))
{
- if (GVL_BigStation.SiemensSendRecipeStatus == 3)
+ if (SiemensDevice.DL_Status is DL_Status_DB status)
{
- SiemensDevice.Siemens_PLC_S7.WriteString(2331, data.RecipeCode, 10);
- SiemensDevice.Siemens_PLC_S7.Write("DB2331.DBX28.0", true);
- MessageNotify.GetInstance.ShowRunLog($"配方2,发送配方编号和请求配料标志给西门子");
- GVL_BigStation.SiemensSendRecipeStatus = 4;
- }
- if (GVL_BigStation.SiemensSendRecipeStatus == 4)
- {
- if (SiemensDevice.DL_Status.Dosing_Start_ACK)
+ if (GVL_BigStation.SiemensSendRecipeStatus == 3)
+ {
+ SiemensDevice.Siemens_PLC_S7.WriteString(2331, data.RecipeCode, 10);
+ SiemensDevice.Siemens_PLC_S7.Write("DB2331.DBX28.0", true);
+ MessageNotify.GetInstance.ShowRunLog($"配方3,发送配方编号和请求配料标志给西门子");
+ GVL_BigStation.SiemensSendRecipeStatus = 4;
+ }
+ if (GVL_BigStation.SiemensSendRecipeStatus == 4)
{
- SiemensDevice.Siemens_PLC_S7.WriteString(2331, "", 10);
- SiemensDevice.Siemens_PLC_S7.Write("DB2331.DBX28.0", false);
- MessageNotify.GetInstance.ShowRunLog($"配方2,西门子确认开始配料");
- GVL_BigStation.SiemensSendRecipeStatus = 5;
+ if (SiemensDevice.DL_Status.Dosing_Start_ACK)
+ {
+ SiemensDevice.Siemens_PLC_S7.WriteString(2331, "", 10);
+ SiemensDevice.Siemens_PLC_S7.Write("DB2331.DBX28.0", false);
+ MessageNotify.GetInstance.ShowRunLog($"配方3,西门子确认开始配料");
+ GVL_BigStation.SiemensSendRecipeStatus = 5;
+ }
}
- }
- if (GVL_BigStation.SiemensSendRecipeStatus == 5)
- {
- if (SiemensDevice.DL_Status.Dosing_Start_ACK == false)
+ if (GVL_BigStation.SiemensSendRecipeStatus == 5)
{
- SiemensRecipeQueue2.Enqueue(data.RecipeCode);
- MessageNotify.GetInstance.ShowRunLog($"配方2,配方:{data.RecipeCode},加入队列");
- GVL_BigStation.SiemensSendRecipeStatus = 0;
+ if (SiemensDevice.DL_Status.Dosing_Start_ACK == false)
+ {
+ SiemensRecipeQueue3.Enqueue(data.RecipeCode);
+ MessageNotify.GetInstance.ShowRunLog($"配方3,配方:{data.RecipeCode},加入队列");
+ GVL_BigStation.SiemensSendRecipeStatus = 0;
+ }
}
}
}
}
- }
- else if (SiemensRecipeQueue3.Count == 0 && !SiemensRecipeQueue1.Contains(data.RecipeCode) && !SiemensRecipeQueue2.Contains(data.RecipeCode) && !SiemensRecipeQueue4.Contains(data.RecipeCode) && HKDevice.PlcRead.IsAllowIssueRecipe3)
- {
- if (!(SiemensRecipeQueue3.Contains(data.RecipeCode)))
+ else if (SiemensRecipeQueue4.Count == 0 && !SiemensRecipeQueue1.Contains(data.RecipeCode) && !SiemensRecipeQueue2.Contains(data.RecipeCode) && !SiemensRecipeQueue3.Contains(data.RecipeCode) && HKDevice.PlcRead.IsAllowIssueRecipe4)
{
- if (SiemensDevice.DL_Status is DL_Status_DB status)
+ if (!(SiemensRecipeQueue4.Contains(data.RecipeCode)))
{
- if (GVL_BigStation.SiemensSendRecipeStatus == 3)
- {
- SiemensDevice.Siemens_PLC_S7.WriteString(2331, data.RecipeCode, 10);
- SiemensDevice.Siemens_PLC_S7.Write("DB2331.DBX28.0", true);
- MessageNotify.GetInstance.ShowRunLog($"配方3,发送配方编号和请求配料标志给西门子");
- GVL_BigStation.SiemensSendRecipeStatus = 4;
- }
- if (GVL_BigStation.SiemensSendRecipeStatus == 4)
+ if (SiemensDevice.DL_Status is DL_Status_DB status)
{
- if (SiemensDevice.DL_Status.Dosing_Start_ACK)
+ if (GVL_BigStation.SiemensSendRecipeStatus == 3)
{
- SiemensDevice.Siemens_PLC_S7.WriteString(2331, "", 10);
- SiemensDevice.Siemens_PLC_S7.Write("DB2331.DBX28.0", false);
- MessageNotify.GetInstance.ShowRunLog($"配方3,西门子确认开始配料");
- GVL_BigStation.SiemensSendRecipeStatus = 5;
+ SiemensDevice.Siemens_PLC_S7.WriteString(2331, data.RecipeCode, 10);
+ SiemensDevice.Siemens_PLC_S7.Write("DB2331.DBX28.0", true);
+ MessageNotify.GetInstance.ShowRunLog($"配方4,发送配方编号和请求配料标志给西门子");
+ GVL_BigStation.SiemensSendRecipeStatus = 4;
}
- }
- if (GVL_BigStation.SiemensSendRecipeStatus == 5)
- {
- if (SiemensDevice.DL_Status.Dosing_Start_ACK == false)
+ if (GVL_BigStation.SiemensSendRecipeStatus == 4)
+ {
+ if (SiemensDevice.DL_Status.Dosing_Start_ACK)
+ {
+ SiemensDevice.Siemens_PLC_S7.WriteString(2331, "", 10);
+ SiemensDevice.Siemens_PLC_S7.Write("DB2331.DBX28.0", false);
+ MessageNotify.GetInstance.ShowRunLog($"配方4,西门子确认开始配料");
+ GVL_BigStation.SiemensSendRecipeStatus = 5;
+ }
+ }
+ if (GVL_BigStation.SiemensSendRecipeStatus == 5)
{
- SiemensRecipeQueue3.Enqueue(data.RecipeCode);
- MessageNotify.GetInstance.ShowRunLog($"配方3,配方:{data.RecipeCode},加入队列");
- GVL_BigStation.SiemensSendRecipeStatus = 0;
+ if (SiemensDevice.DL_Status.Dosing_Start_ACK == false)
+ {
+ SiemensRecipeQueue4.Enqueue(data.RecipeCode);
+ MessageNotify.GetInstance.ShowRunLog($"配方4,配方:{data.RecipeCode},加入队列");
+ GVL_BigStation.SiemensSendRecipeStatus = 0;
+ }
}
}
}
}
}
- else if (SiemensRecipeQueue4.Count == 0 && !SiemensRecipeQueue1.Contains(data.RecipeCode) && !SiemensRecipeQueue2.Contains(data.RecipeCode) && !SiemensRecipeQueue3.Contains(data.RecipeCode) && HKDevice.PlcRead.IsAllowIssueRecipe4)
+ else
{
- if (!(SiemensRecipeQueue4.Contains(data.RecipeCode)))
+ if (SiemensRecipeQueue1.Count == 0 && !SiemensRecipeQueue2.Contains(data.RecipeCode) && !SiemensRecipeQueue3.Contains(data.RecipeCode) && !SiemensRecipeQueue4.Contains(data.RecipeCode) && HKDevice.PlcRead.IsAllowIssueRecipe1)
{
- if (SiemensDevice.DL_Status is DL_Status_DB status)
- {
- if (GVL_BigStation.SiemensSendRecipeStatus == 3)
- {
- SiemensDevice.Siemens_PLC_S7.WriteString(2331, data.RecipeCode, 10);
- SiemensDevice.Siemens_PLC_S7.Write("DB2331.DBX28.0", true);
- MessageNotify.GetInstance.ShowRunLog($"配方4,发送配方编号和请求配料标志给西门子");
- GVL_BigStation.SiemensSendRecipeStatus = 4;
- }
- if (GVL_BigStation.SiemensSendRecipeStatus == 4)
- {
- if (SiemensDevice.DL_Status.Dosing_Start_ACK)
- {
- SiemensDevice.Siemens_PLC_S7.WriteString(2331, "", 10);
- SiemensDevice.Siemens_PLC_S7.Write("DB2331.DBX28.0", false);
- MessageNotify.GetInstance.ShowRunLog($"配方4,西门子确认开始配料");
- GVL_BigStation.SiemensSendRecipeStatus = 5;
- }
- }
- if (GVL_BigStation.SiemensSendRecipeStatus == 5)
- {
- if (SiemensDevice.DL_Status.Dosing_Start_ACK == false)
- {
- SiemensRecipeQueue4.Enqueue(data.RecipeCode);
- MessageNotify.GetInstance.ShowRunLog($"配方4,配方:{data.RecipeCode},加入队列");
- GVL_BigStation.SiemensSendRecipeStatus = 0;
- }
- }
- }
+ SiemensRecipeQueue1.Enqueue(data.RecipeCode);
+ MessageNotify.GetInstance.ShowRunLog($"本地配方,配方:{data.RecipeCode},加入队列1");
+ }
+ else if (SiemensRecipeQueue2.Count == 0 && !SiemensRecipeQueue1.Contains(data.RecipeCode) && !SiemensRecipeQueue3.Contains(data.RecipeCode) && !SiemensRecipeQueue4.Contains(data.RecipeCode) && HKDevice.PlcRead.IsAllowIssueRecipe2)
+ {
+ SiemensRecipeQueue2.Enqueue(data.RecipeCode);
+ MessageNotify.GetInstance.ShowRunLog($"本地配方,配方:{data.RecipeCode},加入队列2");
+ }
+ else if(SiemensRecipeQueue3.Count == 0 && !SiemensRecipeQueue1.Contains(data.RecipeCode) && !SiemensRecipeQueue2.Contains(data.RecipeCode) && !SiemensRecipeQueue4.Contains(data.RecipeCode) && HKDevice.PlcRead.IsAllowIssueRecipe3)
+ {
+ SiemensRecipeQueue3.Enqueue(data.RecipeCode);
+ MessageNotify.GetInstance.ShowRunLog($"本地配方,配方:{data.RecipeCode},加入队列3");
+ }
+ else if (SiemensRecipeQueue4.Count == 0 && !SiemensRecipeQueue1.Contains(data.RecipeCode) && !SiemensRecipeQueue2.Contains(data.RecipeCode) && !SiemensRecipeQueue3.Contains(data.RecipeCode) && HKDevice.PlcRead.IsAllowIssueRecipe4)
+ {
+ SiemensRecipeQueue4.Enqueue(data.RecipeCode);
+ MessageNotify.GetInstance.ShowRunLog($"本地配方,配方:{data.RecipeCode},加入队列4");
+
}
}
}
}
- else
+ else
{
SiemensRecipeQueue1.Clear();
SiemensRecipeQueue2.Clear();
@@ -1004,10 +1022,8 @@ namespace BPASmartClient.JXJFoodBigStation.Model
GVL_BigStation.Recipe3DosingStatus = 0;
GVL_BigStation.Recipe4DosingStatus = 0;
}
-
-
}
- public void Order_Cancel()
+ public void Order_Cancel()
{
if (GVL_BigStation.Order_Cancel) //订单取消
{
@@ -1126,6 +1142,8 @@ namespace BPASmartClient.JXJFoodBigStation.Model
});
SiemensRecipeQueue1.TryDequeue(out code);
GVL_BigStation.Order_CancelStep = 0;
+ GVL_BigStation.Order_Cancel = false;
+ GVL_BigStation.Order_CancelRecipeCode = "";
MessageNotify.GetInstance.ShowRunLog($"队列1,西门子取消订单完成,订单号:{code}");
}
break;
@@ -1158,6 +1176,8 @@ namespace BPASmartClient.JXJFoodBigStation.Model
});
SiemensRecipeQueue2.TryDequeue(out code);
GVL_BigStation.Order_CancelStep = 0;
+ GVL_BigStation.Order_Cancel = false;
+ GVL_BigStation.Order_CancelRecipeCode = "";
MessageNotify.GetInstance.ShowRunLog($"队列2,西门子取消订单完成,订单号:{code}");
}
break;
@@ -1190,6 +1210,8 @@ namespace BPASmartClient.JXJFoodBigStation.Model
});
SiemensRecipeQueue3.TryDequeue(out code);
GVL_BigStation.Order_CancelStep = 0;
+ GVL_BigStation.Order_Cancel = false;
+ GVL_BigStation.Order_CancelRecipeCode = "";
MessageNotify.GetInstance.ShowRunLog($"队列3,西门子取消订单完成,订单号:{code}");
}
break;
@@ -1222,6 +1244,8 @@ namespace BPASmartClient.JXJFoodBigStation.Model
});
SiemensRecipeQueue4.TryDequeue(out code);
GVL_BigStation.Order_CancelStep = 0;
+ GVL_BigStation.Order_Cancel = false;
+ GVL_BigStation.Order_CancelRecipeCode = "";
MessageNotify.GetInstance.ShowRunLog($"队列4,西门子取消订单完成,订单号:{code}");
}
break;
@@ -1263,42 +1287,42 @@ namespace BPASmartClient.JXJFoodBigStation.Model
}
if (HKDevice.PlcRead.IsAllowIssueRecipe1 && GVL_BigStation.Recipe1DosingStatus == 0 && Inplace)//配方1是否允许下发配发
{
-
+
if (SiemensRecipes.ElementAt(index).IsWashingBarrel)
{
if (!GVL_BigStation.BarrelWasherSign)
{
GVL_BigStation.BarrelWasherSign = true;
HKDevice.HK_PLC_S7.Write("DB99.DBX0.1", true);//洗桶
- MessageNotify.GetInstance.ShowRunLog($"配方编号:{code},托盘编号:{trayCode},订单类型为洗桶");
-
+ MessageNotify.GetInstance.ShowRunLog($"配方1,配方编号:{code},托盘编号:{trayCode},订单类型为洗桶");
+
GVL_BigStation.DosingRecipe1Time = DateTime.Now;
HKDevice.StockBinPar(SiemensRecipes.ElementAt(index));
HKDevice.HK_PLC_S7.Write("DB99.DBX0.3", true);
GVL_BigStation.Recipe1DosingStatus = 1;
- MessageNotify.GetInstance.ShowRunLog($"配方编号:{code},托盘编号:{trayCode},下发完成");
+ MessageNotify.GetInstance.ShowRunLog($"配方1,配方编号:{code},托盘编号:{trayCode},下发完成");
}
}
- else
+ else
{
GVL_BigStation.DosingRecipe1Time = DateTime.Now;
HKDevice.StockBinPar(SiemensRecipes.ElementAt(index));
HKDevice.HK_PLC_S7.Write("DB99.DBX0.3", true);
GVL_BigStation.Recipe1DosingStatus = 1;
- MessageNotify.GetInstance.ShowRunLog($"配方编号:{code},托盘编号:{trayCode},下发完成");
+ MessageNotify.GetInstance.ShowRunLog($"配方1,配方编号:{code},托盘编号:{trayCode},下发完成");
}
-
+
}
if (HKDevice.PlcRead.ReceiveFinishRecipe1 && GVL_BigStation.Recipe1DosingStatus == 1)
{
if (SiemensRecipes.ElementAt(index).IsWashingBarrel)
{
HKDevice.HK_PLC_S7.Write("DB99.DBX0.1", false);//洗桶
- MessageNotify.GetInstance.ShowRunLog($"配方编号:{code},托盘编号:{trayCode},洗桶复位");
+ MessageNotify.GetInstance.ShowRunLog($"配方1,配方编号:{code},托盘编号:{trayCode},洗桶复位");
}
HKDevice.HK_PLC_S7.Write("DB99.DBX0.3", false);
StockBinParReset();
- MessageNotify.GetInstance.ShowRunLog($"配方编号:{code},托盘编号:{trayCode},PLC接收配方完成");
+ MessageNotify.GetInstance.ShowRunLog($"配方1,配方编号:{code},托盘编号:{trayCode},PLC接收配方完成");
GVL_BigStation.Recipe1DosingStatus = 2;
}
if (GVL_BigStation.Recipe1DosingStatus == 2 && HKDevice.PlcRead.Recipe1DosingFinish)
@@ -1309,67 +1333,9 @@ namespace BPASmartClient.JXJFoodBigStation.Model
}
GVL_BigStation.Recipe1DosingFinish = true;
GVL_BigStation.Recipe1DosingStatus = 3;
- MessageNotify.GetInstance.ShowRunLog($"配方状态:{code}配料完成");
- foreach (var item in SiemensRecipes.ElementAt(index).RawMaterial)
- {
- if (item.RawMaterialLocation == 1)
- {
- item.Laying_Off_Weight = HKDevice.PlcRead.StockBin1ActualWeight;
- }
- else if (item.RawMaterialLocation == 2)
- {
- item.Laying_Off_Weight = HKDevice.PlcRead.StockBin2ActualWeight;
- }
- else if (item.RawMaterialLocation == 3)
- {
- item.Laying_Off_Weight = HKDevice.PlcRead.StockBin3ActualWeight;
- }
- else if (item.RawMaterialLocation == 4)
- {
- item.Laying_Off_Weight = HKDevice.PlcRead.StockBin4ActualWeight;
- }
- else if (item.RawMaterialLocation == 5)
- {
- item.Laying_Off_Weight = HKDevice.PlcRead.StockBin5ActualWeight;
- }
- else if (item.RawMaterialLocation == 6)
- {
- item.Laying_Off_Weight = HKDevice.PlcRead.StockBin6ActualWeight;
- }
- else if (item.RawMaterialLocation == 7)
- {
- item.Laying_Off_Weight = HKDevice.PlcRead.StockBin7ActualWeight;
- }
- else if (item.RawMaterialLocation == 8)
- {
- item.Laying_Off_Weight = HKDevice.PlcRead.StockBin8ActualWeight;
- }
- else if (item.RawMaterialLocation == 9)
- {
- item.Laying_Off_Weight = HKDevice.PlcRead.StockBin9ActualWeight;
- }
- else if (item.RawMaterialLocation == 10)
- {
- item.Laying_Off_Weight = HKDevice.PlcRead.StockBin10ActualWeight;
- }
- else if (item.RawMaterialLocation == 11)
- {
- item.Laying_Off_Weight = HKDevice.PlcRead.StockBin11ActualWeight;
- }
- else if (item.RawMaterialLocation == 12)
- {
- item.Laying_Off_Weight = HKDevice.PlcRead.StockBin12ActualWeight;
- }
- else if (item.RawMaterialLocation == 13)
- {
- item.Laying_Off_Weight = HKDevice.PlcRead.StockBin13ActualWeight;
- }
- else if (item.RawMaterialLocation == 14)
- {
- item.Laying_Off_Weight = HKDevice.PlcRead.StockBin14ActualWeight;
- }
- }
- if (SiemensDevice.IsConnected)
+ MessageNotify.GetInstance.ShowRunLog($"配方1,配方状态:{code}配料完成");
+ ReadStockBinDosingWeight(SiemensRecipes.ElementAt(index));
+ if (SiemensDevice.IsConnected && !GVL_BigStation.IsUseLocalRecipe)
{
FinishData.Order_No = SiemensRecipes.ElementAt(index).RecipeCode;
FinishData.Product_Code = SiemensRecipes.ElementAt(index).RecipeName;
@@ -1383,30 +1349,27 @@ namespace BPASmartClient.JXJFoodBigStation.Model
FinishData.Material[i].Material_Name = SiemensRecipes.ElementAt(index).RawMaterial.ElementAt(i).RawMaterialName;
FinishData.Material[i].Material_BarrelNum = (short)SiemensRecipes.ElementAt(index).RawMaterial.ElementAt(i).RawMaterialBarrelNum;
FinishData.Material[i].Material_Laying_Off_Weight = Math.Abs(SiemensRecipes.ElementAt(index).RawMaterial.ElementAt(i).Laying_Off_Weight);
+ MessageNotify.GetInstance.ShowRunLog($"配方4,配方编号:{code},托盘编号:{trayCode},原料名称:{FinishData.Material[i].Material_Name},原料桶号:{FinishData.Material[i].Material_BarrelNum},配料重量:{FinishData.Material[i].Material_Laying_Off_Weight }kg");
}
FinishData.Ask_For_Finish = true;
double a = DateTime.Now.Subtract(GVL_BigStation.DosingRecipe1Time).TotalSeconds;
FinishData.ProcessTime = Convert.ToInt16(a);
SiemensDevice.Siemens_PLC_S7.WriteClass(FinishData, 2361);
- MessageNotify.GetInstance.ShowRunLog($"配方配料完成,将信号反馈给西门子");
+ MessageNotify.GetInstance.ShowRunLog($"配方1,{code}配方配料完成,将信号反馈给西门子");
}
+ HKDevice.HK_PLC_S7.Write("DB99.DBX1.4", true);
+ GVL_BigStation.Recipe1DosingStatus = 3;
+ }
+ if (GVL_BigStation.Recipe1DosingStatus == 3 && HKDevice.PlcRead.Recipe1DosingFinish == false)
+ {
+ HKDevice.HK_PLC_S7.Write("DB99.DBX1.4", false);
SiemensRecipeQueue1.TryDequeue(out code);
- RecipeExecuteComple.Add(SiemensRecipes.ElementAt(index));//将配方添加到完成列表
- if (!GVL_BigStation.IsUseLocalRecipe)
- {
- App.Current.Dispatcher.Invoke(() =>
- {
- Json.Data.Recipes.RemoveAt(index);//制作完成,移除当前配方
- });
- }
- else
+ App.Current.Dispatcher.Invoke(() =>
{
- App.Current.Dispatcher.Invoke(() =>
- {
- Json.Data.Recipes.RemoveAt(index);//制作完成,移除当前配方
- });
- }
+ Json.Data.Recipes.RemoveAt(index);//制作完成,移除当前配方
+ });
GVL_BigStation.Recipe1DosingStatus = 0;
+ MessageNotify.GetInstance.ShowRunLog($"配方1,{code}配方配料完成,复位plc配料完成信号");
}
}
}
@@ -1438,7 +1401,7 @@ namespace BPASmartClient.JXJFoodBigStation.Model
default:
break;
}
- if (HKDevice.PlcRead.IsAllowIssueRecipe2 && GVL_BigStation.Recipe2DosingStatus == 0 && Inplace )//配方2是否允许下发配发
+ if (HKDevice.PlcRead.IsAllowIssueRecipe2 && GVL_BigStation.Recipe2DosingStatus == 0 && Inplace)//配方2是否允许下发配发
{
if (SiemensRecipes.ElementAt(index).IsWashingBarrel)
{
@@ -1446,22 +1409,22 @@ namespace BPASmartClient.JXJFoodBigStation.Model
{
GVL_BigStation.BarrelWasherSign = true;
HKDevice.HK_PLC_S7.Write("DB99.DBX0.1", true);//洗桶
- MessageNotify.GetInstance.ShowRunLog($"配方编号:{code},托盘编号:{trayCode},订单类型为洗桶");
+ MessageNotify.GetInstance.ShowRunLog($"配方2,配方编号:{code},托盘编号:{trayCode},订单类型为洗桶");
GVL_BigStation.DosingRecipe2Time = DateTime.Now;
HKDevice.StockBinPar(SiemensRecipes.ElementAt(index));
HKDevice.HK_PLC_S7.Write("DB99.DBX0.4", true);
GVL_BigStation.Recipe2DosingStatus = 1;
- MessageNotify.GetInstance.ShowRunLog($"配方编号:{code},托盘编号:{trayCode},下发完成");
+ MessageNotify.GetInstance.ShowRunLog($"配方2,配方编号:{code},托盘编号:{trayCode},下发完成");
}
}
- else
+ else
{
GVL_BigStation.DosingRecipe2Time = DateTime.Now;
HKDevice.StockBinPar(SiemensRecipes.ElementAt(index));
HKDevice.HK_PLC_S7.Write("DB99.DBX0.4", true);
GVL_BigStation.Recipe2DosingStatus = 1;
- MessageNotify.GetInstance.ShowRunLog($"配方编号:{code},托盘编号:{trayCode},下发完成");
+ MessageNotify.GetInstance.ShowRunLog($"配方2,配方编号:{code},托盘编号:{trayCode},下发完成");
}
}
if (HKDevice.PlcRead.ReceiveFinishRecipe2 && GVL_BigStation.Recipe2DosingStatus == 1)
@@ -1469,12 +1432,12 @@ namespace BPASmartClient.JXJFoodBigStation.Model
if (SiemensRecipes.ElementAt(index).IsWashingBarrel)
{
HKDevice.HK_PLC_S7.Write("DB99.DBX0.1", false);//洗桶
- MessageNotify.GetInstance.ShowRunLog($"配方编号:{code},托盘编号:{trayCode},洗桶复位");
+ MessageNotify.GetInstance.ShowRunLog($"配方2,配方编号:{code},托盘编号:{trayCode},洗桶复位");
}
HKDevice.HK_PLC_S7.Write("DB99.DBX0.4", false);
StockBinParReset();
GVL_BigStation.Recipe2DosingStatus = 2;
- MessageNotify.GetInstance.ShowRunLog($"配方编号:{code},托盘编号:{trayCode},PLC接收配方完成");
+ MessageNotify.GetInstance.ShowRunLog($"配方2,配方编号:{code},托盘编号:{trayCode},PLC接收配方完成");
}
if (GVL_BigStation.Recipe2DosingStatus == 2 && HKDevice.PlcRead.Recipe2DosingFinish)
{
@@ -1483,105 +1446,44 @@ namespace BPASmartClient.JXJFoodBigStation.Model
GVL_BigStation.BarrelWasherSign = false;
}
GVL_BigStation.Recipe2DosingFinish = true;
- GVL_BigStation.Recipe2DosingStatus = 3;
- MessageNotify.GetInstance.ShowRunLog($"配方状态:{code}配料完成");
- foreach (var item in SiemensRecipes.ElementAt(index).RawMaterial)
+ MessageNotify.GetInstance.ShowRunLog($"配方2,配方状态:{code}配料完成");
+ ReadStockBinDosingWeight(SiemensRecipes.ElementAt(index));
+ if (SiemensDevice.IsConnected && !GVL_BigStation.IsUseLocalRecipe)
{
- if (item.RawMaterialLocation == 1)
- {
- item.Laying_Off_Weight = HKDevice.PlcRead.StockBin1ActualWeight;
- }
- else if (item.RawMaterialLocation == 2)
- {
- item.Laying_Off_Weight = HKDevice.PlcRead.StockBin2ActualWeight;
- }
- else if (item.RawMaterialLocation == 3)
- {
- item.Laying_Off_Weight = HKDevice.PlcRead.StockBin3ActualWeight;
- }
- else if (item.RawMaterialLocation == 4)
- {
- item.Laying_Off_Weight = HKDevice.PlcRead.StockBin4ActualWeight;
- }
- else if (item.RawMaterialLocation == 5)
- {
- item.Laying_Off_Weight = HKDevice.PlcRead.StockBin5ActualWeight;
- }
- else if (item.RawMaterialLocation == 6)
- {
- item.Laying_Off_Weight = HKDevice.PlcRead.StockBin6ActualWeight;
- }
- else if (item.RawMaterialLocation == 7)
- {
- item.Laying_Off_Weight = HKDevice.PlcRead.StockBin7ActualWeight;
- }
- else if (item.RawMaterialLocation == 8)
- {
- item.Laying_Off_Weight = HKDevice.PlcRead.StockBin8ActualWeight;
- }
- else if (item.RawMaterialLocation == 9)
- {
- item.Laying_Off_Weight = HKDevice.PlcRead.StockBin9ActualWeight;
- }
- else if (item.RawMaterialLocation == 10)
- {
- item.Laying_Off_Weight = HKDevice.PlcRead.StockBin10ActualWeight;
- }
- else if (item.RawMaterialLocation == 11)
+ FinishData.Order_No = SiemensRecipes.ElementAt(index).RecipeCode;
+ FinishData.Product_Code = SiemensRecipes.ElementAt(index).RecipeName;
+ FinishData.job_No = (short)SiemensRecipes.ElementAt(index).TrayCode;
+ for (int i = 0; i < FinishData.Material.Length; i++)
{
- item.Laying_Off_Weight = HKDevice.PlcRead.StockBin11ActualWeight;
+ FinishData.Material[i] = new UDT1();
}
- else if (item.RawMaterialLocation == 12)
+ for (int i = 0; i < SiemensRecipes.ElementAt(index).RawMaterial.Count; i++)
{
- item.Laying_Off_Weight = HKDevice.PlcRead.StockBin12ActualWeight;
- }
- else if (item.RawMaterialLocation == 13)
- {
- item.Laying_Off_Weight = HKDevice.PlcRead.StockBin13ActualWeight;
- }
- else if (item.RawMaterialLocation == 14)
- {
- item.Laying_Off_Weight = HKDevice.PlcRead.StockBin14ActualWeight;
- }
- }
- if (SiemensDevice.IsConnected)
- {
- FinishData.Order_No = SiemensRecipes.ElementAt(index).RecipeCode;
- FinishData.Product_Code = SiemensRecipes.ElementAt(index).RecipeName;
- FinishData.job_No = (short)SiemensRecipes.ElementAt(index).TrayCode;
- for (int i = 0; i < FinishData.Material.Length; i++)
- {
- FinishData.Material[i] = new UDT1();
- }
- for (int i = 0; i < SiemensRecipes.ElementAt(index).RawMaterial.Count; i++)
- {
- FinishData.Material[i].Material_Name = SiemensRecipes.ElementAt(index).RawMaterial.ElementAt(i).RawMaterialName;
- FinishData.Material[i].Material_BarrelNum = (short)SiemensRecipes.ElementAt(index).RawMaterial.ElementAt(i).RawMaterialBarrelNum;
- FinishData.Material[i].Material_Laying_Off_Weight = Math.Abs(SiemensRecipes.ElementAt(index).RawMaterial.ElementAt(i).Laying_Off_Weight);
+ FinishData.Material[i].Material_Name = SiemensRecipes.ElementAt(index).RawMaterial.ElementAt(i).RawMaterialName;
+ FinishData.Material[i].Material_BarrelNum = (short)SiemensRecipes.ElementAt(index).RawMaterial.ElementAt(i).RawMaterialBarrelNum;
+ FinishData.Material[i].Material_Laying_Off_Weight = Math.Abs(SiemensRecipes.ElementAt(index).RawMaterial.ElementAt(i).Laying_Off_Weight);
+ MessageNotify.GetInstance.ShowRunLog($"配方4,配方编号:{code},托盘编号:{trayCode},原料名称:{FinishData.Material[i].Material_Name},原料桶号:{FinishData.Material[i].Material_BarrelNum},配料重量:{FinishData.Material[i].Material_Laying_Off_Weight }kg");
}
FinishData.Ask_For_Finish = true;
double a = DateTime.Now.Subtract(GVL_BigStation.DosingRecipe2Time).TotalSeconds;
FinishData.ProcessTime = Convert.ToInt16(a);
SiemensDevice.Siemens_PLC_S7.WriteClass(FinishData, 2361);
- MessageNotify.GetInstance.ShowRunLog($"配方配料完成,将信号反馈给西门子");
+ MessageNotify.GetInstance.ShowRunLog($"配方2,{code}配方配料完成,将信号反馈给西门子");
}
+ HKDevice.HK_PLC_S7.Write("DB99.DBX1.5", true);
+ GVL_BigStation.Recipe2DosingStatus = 3;
+ }
+ if (GVL_BigStation.Recipe2DosingStatus == 3 && HKDevice.PlcRead.Recipe2DosingFinish == false)
+ {
+ HKDevice.HK_PLC_S7.Write("DB99.DBX1.5", false);
SiemensRecipeQueue2.TryDequeue(out code);
RecipeExecuteComple.Add(SiemensRecipes.ElementAt(index));
- if (!GVL_BigStation.IsUseLocalRecipe)
- {
- App.Current.Dispatcher.Invoke(() =>
- {
- Json.Data.Recipes.RemoveAt(index);//制作完成,移除当前配方
- });
- }
- else
+ App.Current.Dispatcher.Invoke(() =>
{
- App.Current.Dispatcher.Invoke(() =>
- {
- Json.Data.Recipes.RemoveAt(index);//制作完成,移除当前配方
- });
- }
+ Json.Data.Recipes.RemoveAt(index);//制作完成,移除当前配方
+ });
GVL_BigStation.Recipe2DosingStatus = 0;
+ MessageNotify.GetInstance.ShowRunLog($"配方2,{code}配方配料完成,复位plc配料完成信号");
}
}
}
@@ -1621,21 +1523,21 @@ namespace BPASmartClient.JXJFoodBigStation.Model
{
GVL_BigStation.BarrelWasherSign = true;
HKDevice.HK_PLC_S7.Write("DB99.DBX0.1", true);//洗桶
- MessageNotify.GetInstance.ShowRunLog($"配方编号:{code},托盘编号:{trayCode},订单类型为洗桶");
+ MessageNotify.GetInstance.ShowRunLog($"配方3,配方编号:{code},托盘编号:{trayCode},订单类型为洗桶");
GVL_BigStation.DosingRecipe3Time = DateTime.Now;
HKDevice.StockBinPar(SiemensRecipes.ElementAt(index));
HKDevice.HK_PLC_S7.Write("DB99.DBX0.5", true);
GVL_BigStation.Recipe3DosingStatus = 1;
- MessageNotify.GetInstance.ShowRunLog($"配方编号:{code},托盘编号:{trayCode},下发完成");
+ MessageNotify.GetInstance.ShowRunLog($"配方3,配方编号:{code},托盘编号:{trayCode},下发完成");
}
}
- else
+ else
{
GVL_BigStation.DosingRecipe3Time = DateTime.Now;
HKDevice.StockBinPar(SiemensRecipes.ElementAt(index));
HKDevice.HK_PLC_S7.Write("DB99.DBX0.5", true);
GVL_BigStation.Recipe3DosingStatus = 1;
- MessageNotify.GetInstance.ShowRunLog($"配方编号:{code},托盘编号:{trayCode},下发完成");
+ MessageNotify.GetInstance.ShowRunLog($"配方3,配方编号:{code},托盘编号:{trayCode},下发完成");
}
}
if (HKDevice.PlcRead.ReceiveFinishRecipe3 && GVL_BigStation.Recipe3DosingStatus == 1)
@@ -1643,12 +1545,12 @@ namespace BPASmartClient.JXJFoodBigStation.Model
if (SiemensRecipes.ElementAt(index).IsWashingBarrel)
{
HKDevice.HK_PLC_S7.Write("DB99.DBX0.1", false);//洗桶
- MessageNotify.GetInstance.ShowRunLog($"配方编号:{code},托盘编号:{trayCode},洗桶复位");
+ MessageNotify.GetInstance.ShowRunLog($"配方3,配方编号:{code},托盘编号:{trayCode},洗桶复位");
}
HKDevice.HK_PLC_S7.Write("DB99.DBX0.5", false);
StockBinParReset();
GVL_BigStation.Recipe3DosingStatus = 2;
- MessageNotify.GetInstance.ShowRunLog($"配方编号:{code},托盘编号:{trayCode},PLC接收配方完成");
+ MessageNotify.GetInstance.ShowRunLog($"配方3,配方编号:{code},托盘编号:{trayCode},PLC接收配方完成");
}
if (HKDevice.PlcRead.Recipe3DosingFinish && GVL_BigStation.Recipe3DosingStatus == 2)
{
@@ -1658,67 +1560,9 @@ namespace BPASmartClient.JXJFoodBigStation.Model
}
GVL_BigStation.Recipe3DosingFinish = true;
GVL_BigStation.Recipe3DosingStatus = 3;
- MessageNotify.GetInstance.ShowRunLog($"配方状态:{code}配料完成");
- foreach (var item in SiemensRecipes.ElementAt(index).RawMaterial)
- {
- if (item.RawMaterialLocation == 1)
- {
- item.Laying_Off_Weight = HKDevice.PlcRead.StockBin1ActualWeight;
- }
- else if (item.RawMaterialLocation == 2)
- {
- item.Laying_Off_Weight = HKDevice.PlcRead.StockBin2ActualWeight;
- }
- else if (item.RawMaterialLocation == 3)
- {
- item.Laying_Off_Weight = HKDevice.PlcRead.StockBin3ActualWeight;
- }
- else if (item.RawMaterialLocation == 4)
- {
- item.Laying_Off_Weight = HKDevice.PlcRead.StockBin4ActualWeight;
- }
- else if (item.RawMaterialLocation == 5)
- {
- item.Laying_Off_Weight = HKDevice.PlcRead.StockBin5ActualWeight;
- }
- else if (item.RawMaterialLocation == 6)
- {
- item.Laying_Off_Weight = HKDevice.PlcRead.StockBin6ActualWeight;
- }
- else if (item.RawMaterialLocation == 7)
- {
- item.Laying_Off_Weight = HKDevice.PlcRead.StockBin7ActualWeight;
- }
- else if (item.RawMaterialLocation == 8)
- {
- item.Laying_Off_Weight = HKDevice.PlcRead.StockBin8ActualWeight;
- }
- else if (item.RawMaterialLocation == 9)
- {
- item.Laying_Off_Weight = HKDevice.PlcRead.StockBin9ActualWeight;
- }
- else if (item.RawMaterialLocation == 10)
- {
- item.Laying_Off_Weight = HKDevice.PlcRead.StockBin10ActualWeight;
- }
- else if (item.RawMaterialLocation == 11)
- {
- item.Laying_Off_Weight = HKDevice.PlcRead.StockBin11ActualWeight;
- }
- else if (item.RawMaterialLocation == 12)
- {
- item.Laying_Off_Weight = HKDevice.PlcRead.StockBin12ActualWeight;
- }
- else if (item.RawMaterialLocation == 13)
- {
- item.Laying_Off_Weight = HKDevice.PlcRead.StockBin13ActualWeight;
- }
- else if (item.RawMaterialLocation == 14)
- {
- item.Laying_Off_Weight = HKDevice.PlcRead.StockBin14ActualWeight;
- }
- }
- if (SiemensDevice.IsConnected)
+ MessageNotify.GetInstance.ShowRunLog($"配方3,配方状态:{code}配料完成");
+ ReadStockBinDosingWeight(SiemensRecipes.ElementAt(index));
+ if (SiemensDevice.IsConnected && !GVL_BigStation.IsUseLocalRecipe)
{
FinishData.Order_No = SiemensRecipes.ElementAt(index).RecipeCode;
FinishData.Product_Code = SiemensRecipes.ElementAt(index).RecipeName;
@@ -1732,30 +1576,27 @@ namespace BPASmartClient.JXJFoodBigStation.Model
FinishData.Material[i].Material_Name = SiemensRecipes.ElementAt(index).RawMaterial.ElementAt(i).RawMaterialName;
FinishData.Material[i].Material_BarrelNum = (short)SiemensRecipes.ElementAt(index).RawMaterial.ElementAt(i).RawMaterialBarrelNum;
FinishData.Material[i].Material_Laying_Off_Weight = Math.Abs(SiemensRecipes.ElementAt(index).RawMaterial.ElementAt(i).Laying_Off_Weight);
+ MessageNotify.GetInstance.ShowRunLog($"配方3,配方编号:{code},托盘编号:{trayCode},原料名称:{FinishData.Material[i].Material_Name},原料桶号:{FinishData.Material[i].Material_BarrelNum},配料重量:{FinishData.Material[i].Material_Laying_Off_Weight }kg");
}
FinishData.Ask_For_Finish = true;
double a = DateTime.Now.Subtract(GVL_BigStation.DosingRecipe3Time).TotalSeconds;
FinishData.ProcessTime = Convert.ToInt16(a);
SiemensDevice.Siemens_PLC_S7.WriteClass(FinishData, 2361);
- MessageNotify.GetInstance.ShowRunLog($"配方配料完成,将信号反馈给西门子");
+ MessageNotify.GetInstance.ShowRunLog($"配方3,{code}配方配料完成,将信号反馈给西门子");
}
+ HKDevice.HK_PLC_S7.Write("DB99.DBX1.6", true);
+ GVL_BigStation.Recipe3DosingStatus = 3;
+ }
+ if (GVL_BigStation.Recipe3DosingStatus == 3 && HKDevice.PlcRead.Recipe3DosingFinish == false)
+ {
+ HKDevice.HK_PLC_S7.Write("DB99.DBX1.6", false);
SiemensRecipeQueue3.TryDequeue(out code);
- RecipeExecuteComple.Add(SiemensRecipes.ElementAt(index));//将该配方添加到下
- if (!GVL_BigStation.IsUseLocalRecipe)
- {
- App.Current.Dispatcher.Invoke(() =>
- {
- Json.Data.Recipes.RemoveAt(index);//制作完成,移除当前配方
- });
- }
- else
+ App.Current.Dispatcher.Invoke(() =>
{
- App.Current.Dispatcher.Invoke(() =>
- {
- Json.Data.Recipes.RemoveAt(index);//制作完成,移除当前配方
- });
- }
+ Json.Data.Recipes.RemoveAt(index);//制作完成,移除当前配方
+ });
GVL_BigStation.Recipe3DosingStatus = 0;
+ MessageNotify.GetInstance.ShowRunLog($"配方3,{code}配方配料完成,复位plc配料完成信号");
}
}
}
@@ -1795,12 +1636,12 @@ namespace BPASmartClient.JXJFoodBigStation.Model
{
GVL_BigStation.BarrelWasherSign = true;
HKDevice.HK_PLC_S7.Write("DB99.DBX0.1", true);//洗桶
- MessageNotify.GetInstance.ShowRunLog($"配方编号:{code},托盘编号:{trayCode},订单类型为洗桶");
+ MessageNotify.GetInstance.ShowRunLog($"配方4,配方编号:{code},托盘编号:{trayCode},订单类型为洗桶");
GVL_BigStation.DosingRecipe4Time = DateTime.Now;
HKDevice.StockBinPar(SiemensRecipes.ElementAt(index));
HKDevice.HK_PLC_S7.Write("DB99.DBX0.6", true);
GVL_BigStation.Recipe4DosingStatus = 1;
- MessageNotify.GetInstance.ShowRunLog($"配方编号:{code},托盘编号:{trayCode},下发完成");
+ MessageNotify.GetInstance.ShowRunLog($"配方4,配方编号:{code},托盘编号:{trayCode},下发完成");
}
}
else
@@ -1809,7 +1650,7 @@ namespace BPASmartClient.JXJFoodBigStation.Model
HKDevice.StockBinPar(SiemensRecipes.ElementAt(index));
HKDevice.HK_PLC_S7.Write("DB99.DBX0.6", true);
GVL_BigStation.Recipe4DosingStatus = 1;
- MessageNotify.GetInstance.ShowRunLog($"配方编号:{code},托盘编号:{trayCode},下发完成");
+ MessageNotify.GetInstance.ShowRunLog($"配方4,配方编号:{code},托盘编号:{trayCode},下发完成");
}
}
if (HKDevice.PlcRead.ReceiveFinishRecipe4 && GVL_BigStation.Recipe4DosingStatus == 1)
@@ -1817,12 +1658,12 @@ namespace BPASmartClient.JXJFoodBigStation.Model
if (SiemensRecipes.ElementAt(index).IsWashingBarrel)
{
HKDevice.HK_PLC_S7.Write("DB99.DBX0.1", false);//洗桶
- MessageNotify.GetInstance.ShowRunLog($"配方编号:{code},托盘编号:{trayCode},洗桶复位");
+ MessageNotify.GetInstance.ShowRunLog($"配方4,配方编号:{code},托盘编号:{trayCode},洗桶复位");
}
GVL_BigStation.Recipe4DosingStatus = 2;
HKDevice.HK_PLC_S7.Write("DB99.DBX0.6", false);
StockBinParReset();
- MessageNotify.GetInstance.ShowRunLog($"配方编号:{code},托盘编号:{trayCode},PLC接收配方完成");
+ MessageNotify.GetInstance.ShowRunLog($"配方4,配方编号:{code},托盘编号:{trayCode},PLC接收配方完成");
}
if (GVL_BigStation.Recipe4DosingStatus == 2 && HKDevice.PlcRead.Recipe4DosingFinish)
{
@@ -1832,67 +1673,9 @@ namespace BPASmartClient.JXJFoodBigStation.Model
}
GVL_BigStation.Recipe4DosingFinish = true;
GVL_BigStation.Recipe4DosingStatus = 3;
- MessageNotify.GetInstance.ShowRunLog($"配方状态:{code}配料完成");
- foreach (var item in SiemensRecipes.ElementAt(index).RawMaterial)
- {
- if (item.RawMaterialLocation == 1)
- {
- item.Laying_Off_Weight = HKDevice.PlcRead.StockBin1ActualWeight;
- }
- else if (item.RawMaterialLocation == 2)
- {
- item.Laying_Off_Weight = HKDevice.PlcRead.StockBin2ActualWeight;
- }
- else if (item.RawMaterialLocation == 3)
- {
- item.Laying_Off_Weight = HKDevice.PlcRead.StockBin3ActualWeight;
- }
- else if (item.RawMaterialLocation == 4)
- {
- item.Laying_Off_Weight = HKDevice.PlcRead.StockBin4ActualWeight;
- }
- else if (item.RawMaterialLocation == 5)
- {
- item.Laying_Off_Weight = HKDevice.PlcRead.StockBin5ActualWeight;
- }
- else if (item.RawMaterialLocation == 6)
- {
- item.Laying_Off_Weight = HKDevice.PlcRead.StockBin6ActualWeight;
- }
- else if (item.RawMaterialLocation == 7)
- {
- item.Laying_Off_Weight = HKDevice.PlcRead.StockBin7ActualWeight;
- }
- else if (item.RawMaterialLocation == 8)
- {
- item.Laying_Off_Weight = HKDevice.PlcRead.StockBin8ActualWeight;
- }
- else if (item.RawMaterialLocation == 9)
- {
- item.Laying_Off_Weight = HKDevice.PlcRead.StockBin9ActualWeight;
- }
- else if (item.RawMaterialLocation == 10)
- {
- item.Laying_Off_Weight = HKDevice.PlcRead.StockBin10ActualWeight;
- }
- else if (item.RawMaterialLocation == 11)
- {
- item.Laying_Off_Weight = HKDevice.PlcRead.StockBin11ActualWeight;
- }
- else if (item.RawMaterialLocation == 12)
- {
- item.Laying_Off_Weight = HKDevice.PlcRead.StockBin12ActualWeight;
- }
- else if (item.RawMaterialLocation == 13)
- {
- item.Laying_Off_Weight = HKDevice.PlcRead.StockBin13ActualWeight;
- }
- else if (item.RawMaterialLocation == 14)
- {
- item.Laying_Off_Weight = HKDevice.PlcRead.StockBin14ActualWeight;
- }
- }
- if (SiemensDevice.IsConnected)
+ MessageNotify.GetInstance.ShowRunLog($"配方4,配方状态:{code}配料完成");
+ ReadStockBinDosingWeight(SiemensRecipes.ElementAt(index));
+ if (SiemensDevice.IsConnected && !GVL_BigStation.IsUseLocalRecipe)
{
FinishData.Order_No = SiemensRecipes.ElementAt(index).RecipeCode;
FinishData.Product_Code = SiemensRecipes.ElementAt(index).RecipeName;
@@ -1906,30 +1689,27 @@ namespace BPASmartClient.JXJFoodBigStation.Model
FinishData.Material[i].Material_Name = SiemensRecipes.ElementAt(index).RawMaterial.ElementAt(i).RawMaterialName;
FinishData.Material[i].Material_BarrelNum = (short)SiemensRecipes.ElementAt(index).RawMaterial.ElementAt(i).RawMaterialBarrelNum;
FinishData.Material[i].Material_Laying_Off_Weight = Math.Abs(SiemensRecipes.ElementAt(index).RawMaterial.ElementAt(i).Laying_Off_Weight);
+ MessageNotify.GetInstance.ShowRunLog($"配方4,配方编号:{code},托盘编号:{trayCode},原料名称:{FinishData.Material[i].Material_Name},原料桶号:{FinishData.Material[i].Material_BarrelNum},配料重量:{FinishData.Material[i].Material_Laying_Off_Weight }kg");
}
FinishData.Ask_For_Finish = true;
double a = DateTime.Now.Subtract(GVL_BigStation.DosingRecipe4Time).TotalSeconds;
FinishData.ProcessTime = Convert.ToInt16(a);
SiemensDevice.Siemens_PLC_S7.WriteClass(FinishData, 2361);
- MessageNotify.GetInstance.ShowRunLog($"配方配料完成,将信号反馈给西门子");
+ MessageNotify.GetInstance.ShowRunLog($"配方4,{code}配方配料完成,将信号反馈给西门子");
}
+ HKDevice.HK_PLC_S7.Write("DB99.DBX1.7", true);
+ GVL_BigStation.Recipe4DosingStatus = 3;
+ }
+ if (GVL_BigStation.Recipe4DosingStatus == 3 && HKDevice.PlcRead.Recipe4DosingFinish == false)
+ {
+ HKDevice.HK_PLC_S7.Write("DB99.DBX1.7", false);
SiemensRecipeQueue4.TryDequeue(out code);
- RecipeExecuteComple.Add(SiemensRecipes.ElementAt(index));//将该配方添加到下
- if (!GVL_BigStation.IsUseLocalRecipe)
- {
- App.Current.Dispatcher.Invoke(() =>
- {
- Json.Data.Recipes.RemoveAt(index);//制作完成,移除当前配方
- });
- }
- else
+ App.Current.Dispatcher.Invoke(() =>
{
- App.Current.Dispatcher.Invoke(() =>
- {
- Json.Data.Recipes.RemoveAt(index);//制作完成,移除当前配方
- });
- }
+ Json.Data.Recipes.RemoveAt(index);//制作完成,移除当前配方
+ });
GVL_BigStation.Recipe4DosingStatus = 0;
+ MessageNotify.GetInstance.ShowRunLog($"配方4,{code}配方配料完成,复位plc配料完成信号");
}
}
}
@@ -1950,39 +1730,25 @@ namespace BPASmartClient.JXJFoodBigStation.Model
private void testRawMaterialNameData()
{
//RawMaterialsInfo = Json.Data.RawMaterial;
- //foreach (var material in RawMaterialsInfo)
- //{
- // if (!string.IsNullOrEmpty(material.RawMaterialName))
- // {
- // if (!RawMaterialsNamePos.ContainsKey(material.RawMaterialName))
- // {
- // RawMaterialsNamePos.Add(material.RawMaterialName, (short)material.RawMaterialLocation);
- // }
- // }
- //}
+ /*foreach (var material in RawMaterialsInfo)
+ {
+ if (!string.IsNullOrEmpty(material.RawMaterialName))
+ {
+ if (!RawMaterialsNamePos.ContainsKey(material.RawMaterialName))
+ {
+ RawMaterialsNamePos.Add(material.RawMaterialName, (short)material.RawMaterialLocation);
+ }
+ }
+ }*/
if (RawMaterialsNamePos.Count == 14)
{
- for (int i = 0; i < typeof(StockBinName).GetProperties().Length; i++)
+ for (int i = 0; i < typeof(StockBinName).GetProperties().Length; i++)
{
PropertyInfo pro = GVL_BigStation.stockBinName.GetType().GetProperty(typeof(StockBinName).GetProperties()[i].Name);
- RawMaterialsNamePos[i+1] = pro.GetValue(GVL_BigStation.stockBinName, null).ToString();
+ RawMaterialsNamePos[i + 1] = pro.GetValue(GVL_BigStation.stockBinName, null).ToString();
}
- /* RawMaterialsNamePos[1] = GVL_BigStation.stockBinName.RawMaterialName1;
- RawMaterialsNamePos[2] = GVL_BigStation.stockBinName.RawMaterialName2;
- RawMaterialsNamePos[3] = GVL_BigStation.stockBinName.RawMaterialName3;
- RawMaterialsNamePos[4] = GVL_BigStation.stockBinName.RawMaterialName4;
- RawMaterialsNamePos[5] = GVL_BigStation.stockBinName.RawMaterialName5;
- RawMaterialsNamePos[6] = GVL_BigStation.stockBinName.RawMaterialName6;
- RawMaterialsNamePos[7] = GVL_BigStation.stockBinName.RawMaterialName7;
- RawMaterialsNamePos[8] = GVL_BigStation.stockBinName.RawMaterialName8;
- RawMaterialsNamePos[9] = GVL_BigStation.stockBinName.RawMaterialName9;
- RawMaterialsNamePos[10] = GVL_BigStation.stockBinName.RawMaterialName10;
- RawMaterialsNamePos[11] = GVL_BigStation.stockBinName.RawMaterialName11;
- RawMaterialsNamePos[12] = GVL_BigStation.stockBinName.RawMaterialName12;
- RawMaterialsNamePos[13] = GVL_BigStation.stockBinName.RawMaterialName13;
- RawMaterialsNamePos[14] = GVL_BigStation.stockBinName.RawMaterialName14;*/
}
- else
+ else
{
RawMaterialsNamePos.TryAdd(1, GVL_BigStation.stockBinName.RawMaterialName1);
RawMaterialsNamePos.TryAdd(2, GVL_BigStation.stockBinName.RawMaterialName2);
@@ -2018,13 +1784,15 @@ namespace BPASmartClient.JXJFoodBigStation.Model
HardWareRawMaterialInfo.ElementAt(index).RawMaterialName = item.Value;
HardWareRawMaterialInfo.ElementAt(index).RawMaterialChineseName = name;
}
- else if (num == -1)
+ else if (num == -1)
{
HardWareRawMaterialInfo.ElementAt(index).RawMaterialLocation = item.Key;
HardWareRawMaterialInfo.ElementAt(index).RawMaterialName = "";
HardWareRawMaterialInfo.ElementAt(index).RawMaterialChineseName = "";
}
}
+
+ RawMaterialsInfo = HardWareRawMaterialInfo;
}
///
/// MES的物料名称和物料编码对应
@@ -2095,7 +1863,7 @@ namespace BPASmartClient.JXJFoodBigStation.Model
///
/// 设备连接 西门子和海科PLC
///
- public void DeviceConnectInit()
+ public void DeviceConnectInit()
{
GVL_BigStation.IsAllowHKPlcConnect = ConfigurationManager.AppSettings["HKPlc_Connect"].ToLower() == "true" ? true : false;
GVL_BigStation.IsAllowSiemensConnect = ConfigurationManager.AppSettings["Siemens_Connect"].ToLower() == "true" ? true : false;
@@ -2141,7 +1909,7 @@ namespace BPASmartClient.JXJFoodBigStation.Model
}
}
- public void ThreadInit()
+ public void ThreadInit()
{
ThreadManage.GetInstance().StartLong(new Action(() =>
{
@@ -2238,16 +2006,16 @@ namespace BPASmartClient.JXJFoodBigStation.Model
}
else
{
- if (GVL_BigStation.IsUseLocalRecipe)
+ /*if (GVL_BigStation.IsUseLocalRecipe)
{
LocalRecipeRecevice();
LocalRecipeDosing();
}
else
- {
+ {*/
ReceviceData();
RecipeInfoToHKPLC();
- }
+ /* }*/
}
Thread.Sleep(10);
}), "配方数据执行流程", true);
@@ -2255,7 +2023,7 @@ namespace BPASmartClient.JXJFoodBigStation.Model
///
/// 初始化变量复位
///
- public void VarResetInit()
+ public void VarResetInit()
{
LocalRecipeQueue1.Clear();
LocalRecipeQueue2.Clear();
@@ -2266,5 +2034,364 @@ namespace BPASmartClient.JXJFoodBigStation.Model
SiemensRecipeQueue3.Clear();
SiemensRecipeQueue4.Clear();
}
+ public void RecipeDosing()
+ {
+ GVL_BigStation.AllowIssueRecipe[0] = HKDevice.PlcRead.IsAllowIssueRecipe1;
+ GVL_BigStation.AllowIssueRecipe[1] = HKDevice.PlcRead.IsAllowIssueRecipe2;
+ GVL_BigStation.AllowIssueRecipe[2] = HKDevice.PlcRead.IsAllowIssueRecipe3;
+ GVL_BigStation.AllowIssueRecipe[3] = HKDevice.PlcRead.IsAllowIssueRecipe4;
+ GVL_BigStation.ReceviceFinishRecipe[0] = HKDevice.PlcRead.ReceiveFinishRecipe1;
+ GVL_BigStation.ReceviceFinishRecipe[1] = HKDevice.PlcRead.ReceiveFinishRecipe2;
+ GVL_BigStation.ReceviceFinishRecipe[2] = HKDevice.PlcRead.ReceiveFinishRecipe3;
+ GVL_BigStation.ReceviceFinishRecipe[3] = HKDevice.PlcRead.ReceiveFinishRecipe4;
+ GVL_BigStation.DosingFinishRecipe[0] = HKDevice.PlcRead.Recipe1DosingFinish;
+ GVL_BigStation.DosingFinishRecipe[1] = HKDevice.PlcRead.Recipe2DosingFinish;
+ GVL_BigStation.DosingFinishRecipe[2] = HKDevice.PlcRead.Recipe3DosingFinish;
+ GVL_BigStation.DosingFinishRecipe[3] = HKDevice.PlcRead.Recipe4DosingFinish;
+ GVL_BigStation.IsTrayArrive[0] = HKDevice.PlcRead.Tray1InPlace;
+ GVL_BigStation.IsTrayArrive[1] = HKDevice.PlcRead.Tray2InPlace;
+ GVL_BigStation.IsTrayArrive[2] = HKDevice.PlcRead.Tray3InPlace;
+ GVL_BigStation.IsTrayArrive[3] = HKDevice.PlcRead.Tray4InPlace;
+ GVL_BigStation.IsTrayArrive[4] = HKDevice.PlcRead.Tray5InPlace;
+ #region 接收配方
+ SiemensRecipes = Json.Data.Recipes;
+ if (SiemensRecipes.Count > 0)
+ {
+ foreach (var data in SiemensRecipes)
+ {
+ foreach (var item in SiemensRecipeQueue)
+ {
+ if (item.Value.Count == 0 && item.Key == data.TrayCode && GVL_BigStation.AllowIssueRecipe[item.Key-1])
+ {
+ if (SiemensDevice.DL_Status is DL_Status_DB status)
+ {
+ switch (GVL_BigStation.SiemensSendRecipeStatus)
+ {
+ case 3:
+ SiemensDevice.Siemens_PLC_S7.WriteString(2331, data.RecipeCode, 10);
+ SiemensDevice.Siemens_PLC_S7.Write("DB2331.DBX28.0", true);
+ MessageNotify.GetInstance.ShowRunLog($"配方1,发送配方编号和请求配料标志给西门子");
+ GVL_BigStation.SiemensSendRecipeStatus = 4;
+ break;
+ case 4:
+ if (SiemensDevice.DL_Status.Dosing_Start_ACK)
+ {
+ SiemensDevice.Siemens_PLC_S7.WriteString(2331, "", 10);
+ SiemensDevice.Siemens_PLC_S7.Write("DB2331.DBX28.0", false);
+ MessageNotify.GetInstance.ShowRunLog($"配方1,西门子确认开始配料");
+ GVL_BigStation.SiemensSendRecipeStatus = 5;
+ }
+ break;
+ case 5:
+ if (SiemensDevice.DL_Status.Dosing_Start_ACK == false)
+ {
+ item.Value.Enqueue(data.RecipeCode);
+ MessageNotify.GetInstance.ShowRunLog($"配方1,配方:{data.RecipeCode},加入队列");
+ GVL_BigStation.SiemensSendRecipeStatus = 0;
+ }
+ break;
+ default:
+ break;
+ }
+ }
+ }
+ }
+ }
+ }
+ else
+ {
+ SiemensRecipeQueue.Clear();
+ GVL_BigStation.BarrelWasherSign = false;
+ for (int i = 0; i < GVL_BigStation.RecipeDosingStatus.Length; i++)
+ {
+ GVL_BigStation.RecipeDosingStatus[i] = 0;
+ }
+ }
+ #endregion
+ #region 取消配方
+ if (GVL_BigStation.Order_Cancel) //订单取消
+ {
+ if (!string.IsNullOrEmpty(GVL_BigStation.Order_CancelRecipeCode))
+ {
+ string code = GVL_BigStation.Order_CancelRecipeCode;
+ int index = Array.FindIndex(Json.Data.Recipes.ToArray(), p => p.RecipeCode == GVL_BigStation.Order_CancelRecipeCode);
+ short TrayCode = 0;
+ if (index >= 0)
+ {
+ TrayCode = (short)Json.Data.Recipes.ElementAt(index).TrayCode;
+ }
+ switch (GVL_BigStation.Order_CancelStep)
+ {
+ case 0:
+ if (index == -1)
+ {
+ GVL_BigStation.Order_CancelStep = 10;
+ }
+ else
+ {
+ GVL_BigStation.Order_CancelStep = 20;
+ foreach (var item in SiemensRecipeQueue)
+ {
+ if (item.Value.Contains(code))
+ {
+ GVL_BigStation.Order_CancelStep = 30;
+ }
+ }
+ }
+ break;
+ case 10:
+ SiemensDevice.Siemens_PLC_S7.Write("DB2301.DBX330.1", true);
+ GVL_BigStation.Order_CancelStep = 11;
+ break;
+ case 11:
+ if (SiemensDevice.Siemens_PLC_S7.Read("DB2301.DBX320.2") == false)
+ {
+ SiemensDevice.Siemens_PLC_S7.Write("DB2301.DBX330.1", false);
+ GVL_BigStation.Order_CancelStep = 12;
+ }
+ break;
+ case 12:
+ MessageNotify.GetInstance.ShowRunLog($"西门子取消订单,但未找到订单:{GVL_BigStation.Order_CancelRecipeCode}");
+ GVL_BigStation.Order_Cancel = false;
+ GVL_BigStation.Order_CancelRecipeCode = "";
+ GVL_BigStation.Order_CancelStep = 0;
+ break;
+
+ case 20:
+ SiemensDevice.Siemens_PLC_S7.Write("DB2301.DBX330.1", true);
+ GVL_BigStation.Order_CancelStep = 21;
+ break;
+ case 21:
+ if (SiemensDevice.Siemens_PLC_S7.Read("DB2301.DBX320.2") == false)
+ {
+ SiemensDevice.Siemens_PLC_S7.Write("DB2301.DBX330.1", false);
+ GVL_BigStation.Order_CancelStep = 22;
+ }
+ break;
+ case 22:
+ GVL_BigStation.SiemensSendRecipeStatus = 0;
+ App.Current.Dispatcher.Invoke(() =>
+ {
+ Json.Data.Recipes.RemoveAt(index);
+ });
+ MessageNotify.GetInstance.ShowRunLog($"正在执行请求订单流程,配方还未到PLC,订单号:{GVL_BigStation.Order_CancelRecipeCode}");
+ GVL_BigStation.Order_Cancel = false;
+ GVL_BigStation.Order_CancelRecipeCode = "";
+ GVL_BigStation.Order_CancelStep = 0;
+ break;
+
+ case 30:
+ foreach (var item in SiemensRecipeQueue)
+ {
+ if (item.Value.Contains(code))
+ {
+ if (GVL_BigStation.RecipeDosingStatus[item.Key-1] != 0)
+ {
+ HKDevice.HK_PLC_S7.Write("DB99.DBX230.0", true);
+ HKDevice.HK_PLC_S7.Write("DB99.DBW232", (short)TrayCode);
+ GVL_BigStation.RecipeDosingStatus[item.Key - 1] = 0;
+ item.Value.TryDequeue(out code);
+ GVL_BigStation.Order_CancelStep = 32;
+ MessageNotify.GetInstance.ShowRunLog($"PLC正在执行配料流程,取消订单:{code}");
+ }
+ else
+ {
+ GVL_BigStation.Order_CancelStep = 32;
+ MessageNotify.GetInstance.ShowRunLog($"AGV未到达工站前,未给plc下发配方,取消订单:{code}");
+ }
+ }
+ }
+ break;
+ case 32:
+ SiemensDevice.Siemens_PLC_S7.Write("DB2301.DBX330.1", true);
+ GVL_BigStation.Order_CancelStep = 33;
+ break;
+ case 33:
+ if (SiemensDevice.Siemens_PLC_S7.Read("DB2301.DBX320.2") == false)
+ {
+ SiemensDevice.Siemens_PLC_S7.Write("DB2301.DBX330.1", false);
+ App.Current.Dispatcher.Invoke(() =>
+ {
+ Json.Data.Recipes.RemoveAt(index);
+ });
+ GVL_BigStation.Order_CancelStep = 0;
+ MessageNotify.GetInstance.ShowRunLog($"队列1,西门子取消订单完成,订单号:{code}");
+ }
+ break;
+ default:
+ break;
+ }
+ }
+ }
+ #endregion
+ #region 配料
+ foreach (var data in SiemensRecipeQueue)
+ {
+ int index = Array.FindIndex(SiemensRecipes.ToArray(), p => p.RecipeCode == data.Value.ElementAt(0));
+ if (index >= 0 && index < SiemensRecipes.Count)
+ {
+ string code = SiemensRecipes.ElementAt(index).RecipeCode;
+ int trayCode = SiemensRecipes.ElementAt(index).TrayCode;
+ if (GVL_BigStation.RecipeDosingStatus[data.Key] == 0 && GVL_BigStation.AllowIssueRecipe[data.Key] && GVL_BigStation.IsTrayArrive[trayCode - 1])//配方4是否允许下发配发
+ {
+ if (SiemensRecipes.ElementAt(index).IsWashingBarrel)
+ {
+ if (!GVL_BigStation.BarrelWasherSign)//其他配方在洗桶时,等待其他配方洗完,在发送数据
+ {
+ GVL_BigStation.BarrelWasherSign = true;
+ HKDevice.HK_PLC_S7.Write("DB99.DBX0.1", true);//洗桶
+ MessageNotify.GetInstance.ShowRunLog($"配方编号:{code},托盘编号:{trayCode},订单类型为洗桶");
+
+ GVL_BigStation.RecipeDosingTime[data.Key] = DateTime.Now;
+ HKDevice.StockBinPar(SiemensRecipes.ElementAt(index));
+ HKDevice.HK_PLC_S7.Write($"DB99.DBX0.{2 + data.Key}", true);
+ GVL_BigStation.RecipeDosingStatus[data.Key] = 1;
+ MessageNotify.GetInstance.ShowRunLog($"配方编号:{code},托盘编号:{trayCode},下发完成");
+ }
+ }
+ else
+ {
+ GVL_BigStation.RecipeDosingTime[data.Key] = DateTime.Now;
+ HKDevice.StockBinPar(SiemensRecipes.ElementAt(index));
+ HKDevice.HK_PLC_S7.Write($"DB99.DBX0.{2 + data.Key}", true);
+ GVL_BigStation.RecipeDosingStatus[data.Key] = 1;
+ MessageNotify.GetInstance.ShowRunLog($"配方编号:{code},托盘编号:{trayCode},下发完成");
+ }
+ }
+ if (GVL_BigStation.RecipeDosingStatus[data.Key] == 1 && GVL_BigStation.ReceviceFinishRecipe[data.Key])
+ {
+ if (SiemensRecipes.ElementAt(index).IsWashingBarrel)
+ {
+ HKDevice.HK_PLC_S7.Write("DB99.DBX0.1", false);//洗桶
+ MessageNotify.GetInstance.ShowRunLog($"配方编号:{code},托盘编号:{trayCode},洗桶复位");
+ }
+ GVL_BigStation.RecipeDosingStatus[data.Key] = 2;
+ HKDevice.HK_PLC_S7.Write($"DB99.DBX0.{2 + data.Key}", true);
+ StockBinParReset();
+ MessageNotify.GetInstance.ShowRunLog($"配方编号:{code},托盘编号:{trayCode},PLC接收配方完成");
+ }
+ if (GVL_BigStation.RecipeDosingStatus[data.Key] == 2 && GVL_BigStation.DosingFinishRecipe[data.Key])
+ {
+ if (SiemensRecipes.ElementAt(index).IsWashingBarrel)
+ {
+ GVL_BigStation.BarrelWasherSign = false;
+ }
+ MessageNotify.GetInstance.ShowRunLog($"配方状态:{code}配料完成");
+ ReadStockBinDosingWeight(SiemensRecipes.ElementAt(index));
+ if (SiemensDevice.IsConnected)
+ {
+ FinishData.Order_No = SiemensRecipes.ElementAt(index).RecipeCode;
+ FinishData.Product_Code = SiemensRecipes.ElementAt(index).RecipeName;
+ FinishData.job_No = (short)SiemensRecipes.ElementAt(index).TrayCode;
+ for (int i = 0; i < FinishData.Material.Length; i++)
+ {
+ FinishData.Material[i] = new UDT1();
+ }
+ for (int i = 0; i < SiemensRecipes.ElementAt(index).RawMaterial.Count; i++)
+ {
+ FinishData.Material[i].Material_Name = SiemensRecipes.ElementAt(index).RawMaterial.ElementAt(i).RawMaterialName;
+ FinishData.Material[i].Material_BarrelNum = (short)SiemensRecipes.ElementAt(index).RawMaterial.ElementAt(i).RawMaterialBarrelNum;
+ FinishData.Material[i].Material_Laying_Off_Weight = Math.Abs(SiemensRecipes.ElementAt(index).RawMaterial.ElementAt(i).Laying_Off_Weight);
+ MessageNotify.GetInstance.ShowRunLog($"配方{data.Key},配方编号:{code},托盘编号:{trayCode},原料名称:{FinishData.Material[i].Material_Name},原料桶号:{FinishData.Material[i].Material_BarrelNum},配料重量:{FinishData.Material[i].Material_Laying_Off_Weight }kg");
+ }
+ FinishData.Ask_For_Finish = true;
+ double a = DateTime.Now.Subtract(GVL_BigStation.RecipeDosingTime[data.Key]).TotalSeconds;
+ FinishData.ProcessTime = Convert.ToInt16(a);
+ SiemensDevice.Siemens_PLC_S7.WriteClass(FinishData, 2361);
+ MessageNotify.GetInstance.ShowRunLog($"{code}配方配料完成,将信号反馈给西门子");
+ }
+ data.Value.TryDequeue(out code);
+ if (!GVL_BigStation.IsUseLocalRecipe)
+ {
+ App.Current.Dispatcher.Invoke(() =>
+ {
+ Json.Data.Recipes.RemoveAt(index);//制作完成,移除当前配方
+ });
+ }
+ else
+ {
+ App.Current.Dispatcher.Invoke(() =>
+ {
+ Json.Data.Recipes.RemoveAt(index);//制作完成,移除当前配方
+ });
+ }
+ HKDevice.HK_PLC_S7.Write($"DB99.DBX1.{data.Key + 3}", true);
+ GVL_BigStation.RecipeDosingStatus[data.Key] = 3;
+ }
+ if (GVL_BigStation.RecipeDosingStatus[data.Key] == 3 && GVL_BigStation.DosingFinishRecipe[data.Key] == false)
+ {
+ HKDevice.HK_PLC_S7.Write($"DB99.DBX1.{data.Key + 3}", false);
+ GVL_BigStation.RecipeDosingStatus[data.Key] = 0;
+ }
+ }
+ }
+ #endregion
+ }
+ ///
+ /// 读取配料完成时,每个料仓的配料重量
+ ///
+ ///
+ public void ReadStockBinDosingWeight(RecipeData recipes)
+ {
+ foreach (var item in recipes.RawMaterial)
+ {
+ if (item.RawMaterialLocation == 1)
+ {
+ item.Laying_Off_Weight = HKDevice.PlcRead.StockBin1ActualWeight;
+ }
+ else if (item.RawMaterialLocation == 2)
+ {
+ item.Laying_Off_Weight = HKDevice.PlcRead.StockBin2ActualWeight;
+ }
+ else if (item.RawMaterialLocation == 3)
+ {
+ item.Laying_Off_Weight = HKDevice.PlcRead.StockBin3ActualWeight;
+ }
+ else if (item.RawMaterialLocation == 4)
+ {
+ item.Laying_Off_Weight = HKDevice.PlcRead.StockBin4ActualWeight;
+ }
+ else if (item.RawMaterialLocation == 5)
+ {
+ item.Laying_Off_Weight = HKDevice.PlcRead.StockBin5ActualWeight;
+ }
+ else if (item.RawMaterialLocation == 6)
+ {
+ item.Laying_Off_Weight = HKDevice.PlcRead.StockBin6ActualWeight;
+ }
+ else if (item.RawMaterialLocation == 7)
+ {
+ item.Laying_Off_Weight = HKDevice.PlcRead.StockBin7ActualWeight;
+ }
+ else if (item.RawMaterialLocation == 8)
+ {
+ item.Laying_Off_Weight = HKDevice.PlcRead.StockBin8ActualWeight;
+ }
+ else if (item.RawMaterialLocation == 9)
+ {
+ item.Laying_Off_Weight = HKDevice.PlcRead.StockBin9ActualWeight;
+ }
+ else if (item.RawMaterialLocation == 10)
+ {
+ item.Laying_Off_Weight = HKDevice.PlcRead.StockBin10ActualWeight;
+ }
+ else if (item.RawMaterialLocation == 11)
+ {
+ item.Laying_Off_Weight = HKDevice.PlcRead.StockBin11ActualWeight;
+ }
+ else if (item.RawMaterialLocation == 12)
+ {
+ item.Laying_Off_Weight = HKDevice.PlcRead.StockBin12ActualWeight;
+ }
+ else if (item.RawMaterialLocation == 13)
+ {
+ item.Laying_Off_Weight = HKDevice.PlcRead.StockBin13ActualWeight;
+ }
+ else if (item.RawMaterialLocation == 14)
+ {
+ item.Laying_Off_Weight = HKDevice.PlcRead.StockBin14ActualWeight;
+ }
+ }
+ }
}
}
diff --git a/BPASmartClient.JXJFoodBigStation/Model/RawMaterial/RecipeData.cs b/BPASmartClient.JXJFoodBigStation/Model/RawMaterial/RecipeData.cs
index dc05bc4f..9d1a21c9 100644
--- a/BPASmartClient.JXJFoodBigStation/Model/RawMaterial/RecipeData.cs
+++ b/BPASmartClient.JXJFoodBigStation/Model/RawMaterial/RecipeData.cs
@@ -44,5 +44,13 @@ namespace BPASmartClient.JXJFoodBigStation.Model
/// 原料数据
///
public ObservableCollection RawMaterial { get; set; } = new ObservableCollection();
+
+ public RecipeSource RecipesSource { get { return _mRecipesSource; } set { _mRecipesSource = value; OnPropertyChanged(); } }
+ private RecipeSource _mRecipesSource = RecipeSource.远程;
+ }
+ public enum RecipeSource
+ {
+ 本地,
+ 远程
}
}
diff --git a/BPASmartClient.JXJFoodBigStation/Model/RecipeDosing.cs b/BPASmartClient.JXJFoodBigStation/Model/RecipeDosing.cs
new file mode 100644
index 00000000..d55082c1
--- /dev/null
+++ b/BPASmartClient.JXJFoodBigStation/Model/RecipeDosing.cs
@@ -0,0 +1,25 @@
+using System;
+using System.Collections.Generic;
+using System.Collections.ObjectModel;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace BPASmartClient.JXJFoodBigStation.Model
+{
+ public class RecipeDosing
+ {
+ public string RecipeCode { get; set; }
+ public int RecipeTray { get; set; }
+ public int DosingStatus { get; set; }
+
+
+ public bool IsAllowIssue { get; set; }
+ public bool IsAGVArrive { get; set; }
+ public bool IsReceviceFinish { get; set; }
+ public bool IsDosingFinish { get; set; }
+
+ public DateTime DosingStartTime { get; set; }
+
+ }
+}
diff --git a/BPASmartClient.JXJFoodBigStation/Model/Siemens/SiemensDeviceStatus.cs b/BPASmartClient.JXJFoodBigStation/Model/Siemens/SiemensDeviceStatus.cs
index 1456067a..2bc9ba0b 100644
--- a/BPASmartClient.JXJFoodBigStation/Model/Siemens/SiemensDeviceStatus.cs
+++ b/BPASmartClient.JXJFoodBigStation/Model/Siemens/SiemensDeviceStatus.cs
@@ -17,7 +17,7 @@ namespace BPASmartClient.JXJFoodBigStation.Model.Siemens
public bool IsConnected => Siemens_PLC_S7.IsConnected;
public DL_Status_DB DL_Status = new DL_Status_DB();
- bool a = false;
+ bool printFirstLog = false;
public void Init()
{
ThreadManage.GetInstance().StartLong(new Action(() =>
@@ -30,14 +30,27 @@ namespace BPASmartClient.JXJFoodBigStation.Model.Siemens
//var res3 = this.Siemens_PLC_S7.ReadClass(2391);
if (res != null && res is DL_Start_DB start)
{
- if (GVL_BigStation.Order_Request && GVL_BigStation.SiemensSendRecipeStatus == 0)
+ if (GVL_BigStation.SiemensSendRecipeStatus == 0)
{
- this.Siemens_PLC_S7.Write("DB2301.DBX330.0", true);
- MessageNotify.GetInstance.ShowRunLog($"向西门子请求订单");
- GVL_BigStation.SiemensSendRecipeStatus = 1;
+ if (GVL_BigStation.Order_Request)
+ {
+ this.Siemens_PLC_S7.Write("DB2301.DBX330.0", true);
+ MessageNotify.GetInstance.ShowRunLog($"向西门子请求订单");
+ GVL_BigStation.SiemensSendRecipeStatus = 1;
+ }
+ else
+ {
+ this.Siemens_PLC_S7.Write("DB2301.DBX330.0", false);
+ if (!printFirstLog)
+ {
+ printFirstLog = true;
+ MessageNotify.GetInstance.ShowRunLog($"plc不允许下发订单");
+ }
+ }
}
if (RTrig.GetInstance("Order_Request_Ack").Start(start.Order_Request_Ack) && GVL_BigStation.SiemensSendRecipeStatus == 1)
{
+ printFirstLog = false;
ActionManage.GetInstance.Send("SiemensSendRecipe", start);
this.Siemens_PLC_S7.Write("DB2301.DBX330.0", false);
MessageNotify.GetInstance.ShowRunLog($"西门子下发订单:{start.RecipeCode}");
diff --git a/BPASmartClient.JXJFoodBigStation/View/HardwareStatusView.xaml b/BPASmartClient.JXJFoodBigStation/View/HardwareStatusView.xaml
index ae8c420d..e0d3a366 100644
--- a/BPASmartClient.JXJFoodBigStation/View/HardwareStatusView.xaml
+++ b/BPASmartClient.JXJFoodBigStation/View/HardwareStatusView.xaml
@@ -374,7 +374,7 @@
@@ -386,7 +386,7 @@
-
+
@@ -568,7 +568,6 @@
-
@@ -637,7 +636,7 @@
Foreground="#FF0084FF"
Text=" 号仓" />
-
+ Style="{StaticResource ImageButtonStyle}">-->
+
+
@@ -23,7 +25,8 @@
Width="200"
Height="40"
Margin="5,0,5,0"
- Command="{Binding Tray1InPlace}"
+ Command="{Binding TrayInPlace}"
+ CommandParameter="1"
Content="AGV到达工位1"
FontSize="20"
Panel.ZIndex="0"
@@ -32,7 +35,8 @@
Width="200"
Height="40"
Margin="5,0,5,0"
- Command="{Binding Tray2InPlace}"
+ Command="{Binding TrayInPlace}"
+ CommandParameter="2"
Content="AGV到达工位2"
FontSize="20"
Panel.ZIndex="0"
@@ -41,7 +45,8 @@
Width="200"
Height="40"
Margin="5,0,5,0"
- Command="{Binding Tray3InPlace}"
+ Command="{Binding TrayInPlace}"
+ CommandParameter="3"
Content="AGV到达工位3"
FontSize="20"
Panel.ZIndex="0"
@@ -50,7 +55,8 @@
Width="200"
Height="40"
Margin="5,0,5,0"
- Command="{Binding Tray4InPlace}"
+ Command="{Binding TrayInPlace}"
+ CommandParameter="4"
Content="AGV到达工位4"
FontSize="20"
Panel.ZIndex="0"
@@ -59,11 +65,71 @@
Width="200"
Height="40"
Margin="5,0,5,0"
- Command="{Binding Tray5InPlace}"
+ Command="{Binding TrayInPlace}"
+ CommandParameter="5"
Content="AGV到达工位5"
FontSize="20"
Panel.ZIndex="0"
Style="{StaticResource ImageButtonStyle}">
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+
+
@@ -100,66 +167,66 @@
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
diff --git a/BPASmartClient.JXJFoodBigStation/View/RecipeReceiveView.xaml b/BPASmartClient.JXJFoodBigStation/View/RecipeReceiveView.xaml
index 1c3603c8..3c220ef4 100644
--- a/BPASmartClient.JXJFoodBigStation/View/RecipeReceiveView.xaml
+++ b/BPASmartClient.JXJFoodBigStation/View/RecipeReceiveView.xaml
@@ -159,11 +159,23 @@
+
+
+
-
@@ -822,7 +821,7 @@
-
@@ -924,11 +923,11 @@
-
-
+
diff --git a/BPASmartClient.JXJFoodBigStation/View/RecipeSendDownView.xaml.cs b/BPASmartClient.JXJFoodBigStation/View/RecipeSendDownView.xaml.cs
index a5099747..66464759 100644
--- a/BPASmartClient.JXJFoodBigStation/View/RecipeSendDownView.xaml.cs
+++ b/BPASmartClient.JXJFoodBigStation/View/RecipeSendDownView.xaml.cs
@@ -28,24 +28,24 @@ namespace BPASmartClient.JXJFoodBigStation.View
private void RadioButtonCompelete_Click(object sender, RoutedEventArgs e)
{
- repiceList.ItemsSource = RecipeSendDownViewModel.UserTreeCompelete;
- repiceList.Visibility = Visibility.Visible;
- repiceListMaking.Visibility = Visibility.Hidden;
+ //repiceList.ItemsSource = RecipeSendDownViewModel.UserTreeCompelete;
+ //repiceList.Visibility = Visibility.Visible;
+ //repiceListMaking.Visibility = Visibility.Hidden;
}
private void RadioButtonWait_Click(object sender, RoutedEventArgs e)
{
- repiceList.ItemsSource = RecipeSendDownViewModel.UserTreeWait;
- repiceList.Visibility = Visibility.Visible;
- repiceListMaking.Visibility = Visibility.Hidden;
+ //repiceList.ItemsSource = RecipeSendDownViewModel.UserTreeWait;
+ //repiceList.Visibility = Visibility.Visible;
+ //repiceListMaking.Visibility = Visibility.Hidden;
}
private void RadioButtonMaking_Click(object sender, RoutedEventArgs e)
{
- repiceListMaking.Visibility = Visibility.Visible;
- repiceList.Visibility = Visibility.Hidden;
+ //repiceListMaking.Visibility = Visibility.Visible;
+ //repiceList.Visibility = Visibility.Hidden;
}
}
diff --git a/BPASmartClient.JXJFoodBigStation/ViewModel/HardwareStatusViewModel.cs b/BPASmartClient.JXJFoodBigStation/ViewModel/HardwareStatusViewModel.cs
index 2118adfb..cd1e96f6 100644
--- a/BPASmartClient.JXJFoodBigStation/ViewModel/HardwareStatusViewModel.cs
+++ b/BPASmartClient.JXJFoodBigStation/ViewModel/HardwareStatusViewModel.cs
@@ -12,6 +12,8 @@ using Microsoft.Toolkit.Mvvm.Input;
using BPASmartClient.JXJFoodBigStation.Model;
using BPASmartClient.JXJFoodBigStation.View;
using System.Windows.Forms;
+using BPASmartClient.JXJFoodBigStation.Model.HK_PLC;
+using System.Reflection;
namespace BPASmartClient.JXJFoodBigStation.ViewModel
{
@@ -19,101 +21,30 @@ namespace BPASmartClient.JXJFoodBigStation.ViewModel
{
public HardwareStatusViewModel()
{
-
- for (int i = 6; i > 0; i--)
- {
- TopDeviceCurrentStatuses.Add(new DeviceCurrentStatus()
- {
- DeviceName = i.ToString(),
- DeviceNum = i,
- RunStatus = true,
- Weight = new Random().Next(0, 100)
- });
- }
- for (int i = 7; i < 13; i++)
+ foreach (PropertyInfo mi in typeof(StockBinName).GetProperties())
{
- BottomDeviceCurrentStatuses.Add(new DeviceCurrentStatus()
+ object ab = GVL_BigStation.stockBinName.GetType().GetProperty(mi.Name).GetValue(GVL_BigStation.stockBinName, null);
+ if (mi.Name=="RawMaterialName1" || mi.Name == "RawMaterialName2" || mi.Name == "RawMaterialName3" || mi.Name == "RawMaterialName4" || mi.Name == "RawMaterialName5" || mi.Name == "RawMaterialName6" || mi.Name == "RawMaterialName7")
{
- DeviceName = i.ToString(),
- DeviceNum = i,
- RunStatus = false,
- Weight = new Random().Next(0, 100)
- });
- }
- StartCommand = new RelayCommand((deviceName) =>
- {
- if (deviceName != null)
- {
- var top = TopDeviceCurrentStatuses.FirstOrDefault(p => p.DeviceName == deviceName);
- if (top != null)
- {
- ActionManage.GetInstance.Send("StartTopDevice", deviceName);
- }
- var bottom = BottomDeviceCurrentStatuses.FirstOrDefault(p => p.DeviceName == deviceName);
- if (bottom != null)
+ TopDeviceCurrentStatuses.Add(new DeviceCurrentStatus()
{
- ActionManage.GetInstance.Send("StartBottomDevice", deviceName);
- }
+ DeviceName = ab.ToString(),
+ DeviceNum = TopDeviceCurrentStatuses.Count + 1,
+ RunStatus = true,
+ Weight = new Random().Next(0, 100)
+ });
}
- });
- StopCommand = new RelayCommand((deviceName) =>
- {
- if (deviceName != null)
+ else
{
- var top = TopDeviceCurrentStatuses.FirstOrDefault(p => p.DeviceName == deviceName);
- if (top != null)
- {
- ActionManage.GetInstance.Send("StopTopDevice", deviceName);
- }
- var bottom = BottomDeviceCurrentStatuses.FirstOrDefault(p => p.DeviceName == deviceName);
- if (bottom != null)
+ BottomDeviceCurrentStatuses.Add(new DeviceCurrentStatus()
{
- ActionManage.GetInstance.Send("StopBottomDevice", deviceName);
- }
+ DeviceName = ab.ToString(),
+ DeviceNum = BottomDeviceCurrentStatuses.Count + 8,
+ RunStatus = false,
+ Weight = new Random().Next(0, 100)
+ });
}
- });
-
- UpdateRawMaterName = new RelayCommand((deviceName) =>
- {
- ActionManage.GetInstance.CancelRegister("UpdateDeviceName");
- ActionManage.GetInstance.Register(new Action