diff --git a/BPASmartClient.Business/BPASmartClient.Business.csproj b/BPASmartClient.Business/BPASmartClient.Business.csproj
index b7492b30..b32e9dc1 100644
--- a/BPASmartClient.Business/BPASmartClient.Business.csproj
+++ b/BPASmartClient.Business/BPASmartClient.Business.csproj
@@ -8,7 +8,7 @@
-
+
diff --git a/BPASmartClient.Business/LocalMqtt.cs b/BPASmartClient.Business/LocalMqtt.cs
index a629d7a9..7a8cefb9 100644
--- a/BPASmartClient.Business/LocalMqtt.cs
+++ b/BPASmartClient.Business/LocalMqtt.cs
@@ -33,7 +33,7 @@ namespace BPASmartClient.Business
{
MqttPushs.Name = DeviceType;
LocDeviceType = DeviceType;
- mQTTProxy.ConnectOk = new Action(() =>
+ mQTTProxy.Connected = new Action(() =>
{
mQTTProxy.Subscrib(ScreenTOPIC.GetInstance.GetTopic(DeviceType));
diff --git a/BPASmartClient.Business/Plugin/MQTTMgr.cs b/BPASmartClient.Business/Plugin/MQTTMgr.cs
index 7fedd3f7..2479de0d 100644
--- a/BPASmartClient.Business/Plugin/MQTTMgr.cs
+++ b/BPASmartClient.Business/Plugin/MQTTMgr.cs
@@ -44,7 +44,7 @@ namespace BPASmartClient.Business
//主题初始化
TopicDefine.GetInstance().Initialize(Plugin.GetInstance().GetPlugin().GetDevices());
- mqttProxy.ConnectOk = () =>
+ mqttProxy.Connected = () =>
{
mqttProxy.Subscrib(TopicDefine.GetInstance().SubscribTopics.ToArray());
};
@@ -55,7 +55,11 @@ namespace BPASmartClient.Business
var MqttServerConfig = Plugin.GetInstance().GetPlugin().MQTT_Config;
var MqttServerAccount = Plugin.GetInstance().GetPlugin().Mqtt_Account;
var deviceConfig = Plugin.GetInstance().GetPlugin().deviceConfigModelJsons;
- string deviceId = deviceConfig[0].deviceModels[0].DeviceId;
+ string deviceId = "";
+ if (deviceConfig.Count > 0 && deviceConfig[0].deviceModels.Count > 0)
+ {
+ deviceId = deviceConfig[0].deviceModels[0].DeviceId;
+ }
clientId = Plugin.GetInstance().GetPlugin().ClientId;
//MQTT 初始化
mqttProxy.Connect(new BPA.Communication.Base.ConfigurationOptions()
diff --git a/BPASmartClient.CustomResource/BPASmartClient.CustomResource.csproj b/BPASmartClient.CustomResource/BPASmartClient.CustomResource.csproj
index 767b8ea8..f04be251 100644
--- a/BPASmartClient.CustomResource/BPASmartClient.CustomResource.csproj
+++ b/BPASmartClient.CustomResource/BPASmartClient.CustomResource.csproj
@@ -463,7 +463,7 @@
-
+
diff --git a/BPASmartClient.CustomResource/Pages/Model/AlarmHelper.cs b/BPASmartClient.CustomResource/Pages/Model/AlarmHelper.cs
index efa5fb98..696a7922 100644
--- a/BPASmartClient.CustomResource/Pages/Model/AlarmHelper.cs
+++ b/BPASmartClient.CustomResource/Pages/Model/AlarmHelper.cs
@@ -106,9 +106,16 @@ namespace BPASmartClient.CustomResource.Pages.Model
Value = value.ToString(),
Time = DateTime.Now.ToString("HH:mm:ss"),
};
+ try
+ {
+ var res = Sqlite.GetInstance.Base.Add(tempAlarm);
+
+ Sqlite.GetInstance.Save();
+ }
+ catch (Exception)
+ {
+ }
- var res = Sqlite.GetInstance.Base.Add(tempAlarm);
- Sqlite.GetInstance.Save();
if (Alarms.FirstOrDefault(p => p.Info == AlarmInfo) == null)
{
diff --git a/BPASmartClient.CustomResource/Pages/Model/MessageNotify.cs b/BPASmartClient.CustomResource/Pages/Model/MessageNotify.cs
index 99fded33..8274acf9 100644
--- a/BPASmartClient.CustomResource/Pages/Model/MessageNotify.cs
+++ b/BPASmartClient.CustomResource/Pages/Model/MessageNotify.cs
@@ -41,10 +41,18 @@ namespace BPASmartClient.CustomResource.Pages.Model
public void LogSave()
{
- Sqlite.GetInstance.Save();
- Sqlite.GetInstance.Save();
- Sqlite.GetInstance.Save();
- Sqlite.GetInstance.Save();
+ try
+ {
+ Sqlite.GetInstance.Save();
+ Sqlite.GetInstance.Save();
+ Sqlite.GetInstance.Save();
+ Sqlite.GetInstance.Save();
+ }
+ catch (Exception)
+ {
+
+ // throw;
+ }
}
public void ShowRecipeLog(string info)
diff --git a/BPASmartClient.CustomResource/Pages/ViewModel/MainViewModel.cs b/BPASmartClient.CustomResource/Pages/ViewModel/MainViewModel.cs
index 378cb5f2..87bc7ea1 100644
--- a/BPASmartClient.CustomResource/Pages/ViewModel/MainViewModel.cs
+++ b/BPASmartClient.CustomResource/Pages/ViewModel/MainViewModel.cs
@@ -57,19 +57,27 @@ namespace BPASmartClient.CustomResource.Pages.ViewModel
BPA.Helper.MessageLog.GetInstance.NotifyShow = new Action((o) =>
{
- Application.Current?.Dispatcher?.Invoke(() =>
+ try
{
- //ff20aefe
- var temp = new MessageModel()
- {
- LogInfo = o,
- Forground = new SolidColorBrush(Color.FromArgb(255, 32, 174, 254))
- };
- if (DebugLogViewModel.MessageModels.Count > 0)
- DebugLogViewModel.MessageModels.Insert(0, temp);
- else
- DebugLogViewModel.MessageModels.Add(temp);
- });
+ Application.Current?.Dispatcher?.Invoke(() =>
+ {
+ //ff20aefe
+ var temp = new MessageModel()
+ {
+ LogInfo = o,
+ Forground = new SolidColorBrush(Color.FromArgb(255, 32, 174, 254))
+ };
+ if (DebugLogViewModel.MessageModels.Count > 0)
+ DebugLogViewModel.MessageModels.Insert(0, temp);
+ else
+ DebugLogViewModel.MessageModels.Add(temp);
+ });
+ }
+ catch (Exception)
+ {
+
+ //throw;
+ }
});
BPA.Helper.MessageLog.GetInstance.NotifyShowEx = new Action((o) =>
{
diff --git a/BPASmartClient.Device/BaseDevice.cs b/BPASmartClient.Device/BaseDevice.cs
index 072e3f50..c19bcca2 100644
--- a/BPASmartClient.Device/BaseDevice.cs
+++ b/BPASmartClient.Device/BaseDevice.cs
@@ -162,7 +162,7 @@ namespace BPASmartClient.Device
///
public void DeviceProcessLogShow(string info)
{
- Log.Insert(0, new { Time = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), Type = "流程", Text = info });
+ Log.Insert(0, new { Time = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss:fff"), Type = "流程", Text = info });
MessageLog.GetInstance.DeviceProcessLogShow(DeviceId.ToString(), info);
if (Log.Count > 100) { Log.RemoveAt(Log.Count - 1); }
}
diff --git a/BPASmartClient.Device/VariableMonitorAttribute.cs b/BPASmartClient.Device/VariableMonitorAttribute.cs
index 8d4ba870..7eb17b4b 100644
--- a/BPASmartClient.Device/VariableMonitorAttribute.cs
+++ b/BPASmartClient.Device/VariableMonitorAttribute.cs
@@ -28,7 +28,12 @@ namespace BPASmartClient.Device
if (address.Length > 0)
{
address = address.Trim();
- if (address.ToUpper().Contains("M") && address.Length >= 4)
+ if (address.ToUpper().Contains("GM") && address.Length >= 3)
+ {
+ var res = address.Remove(0, 2);
+ if (res != null && res.Length > 0) return (int.Parse(res) + 4096).ToString();
+ }
+ else if (address.ToUpper().Contains("M") && address.Length >= 4)
{
var res = address.Substring(1).Split('.');
if (res != null && res.Length == 2)
@@ -42,6 +47,19 @@ namespace BPASmartClient.Device
}
}
}
+ else if (address.ToUpper().Contains("GI") && address.Length >= 3)
+ {
+ var res = address.Remove(0, 2);
+ if (res != null && res.Length > 0) return res;
+ }
+ else if (address.ToUpper().Contains("LB") && address.Length >= 3)
+ {
+ var res = address.Substring(2);
+ if (res != null && res.Length > 0)
+ {
+ if (int.TryParse(res, out int firstAddress)) return firstAddress.ToString();
+ }
+ }
else if ((address.ToUpper().Contains("VW") || address.ToUpper().Contains("VD")) && address.Length >= 3)
{
var res = address.Substring(2);
@@ -50,8 +68,44 @@ namespace BPASmartClient.Device
return ((tempAddress / 2) + 100).ToString();
}
}
+ else if (address.ToUpper().Contains("LW") && address.Length >= 3)
+ {
+ var res = address.Substring(2);
+ if (res != null && int.TryParse(res, out int LwAddress))
+ {
+ return LwAddress.ToString();
+ }
+ }
}
return "";
+ //if (address == null) return "";
+ //if (address.Length > 0)
+ //{
+ // address = address.Trim();
+ // if (address.ToUpper().Contains("M") && address.Length >= 4)
+ // {
+ // var res = address.Substring(1).Split('.');
+ // if (res != null && res.Length == 2)
+ // {
+ // if (int.TryParse(res[0], out int firstAddress) && int.TryParse(res[1], out int ExitAddress))
+ // {
+ // if (ExitAddress >= 0 && ExitAddress <= 7)
+ // {
+ // return ((firstAddress * 8) + 320 + ExitAddress).ToString();
+ // }
+ // }
+ // }
+ // }
+ // else if ((address.ToUpper().Contains("VW") || address.ToUpper().Contains("VD")) && address.Length >= 3)
+ // {
+ // var res = address.Substring(2);
+ // if (res != null && int.TryParse(res, out int tempAddress))
+ // {
+ // return ((tempAddress / 2) + 100).ToString();
+ // }
+ // }
+ //}
+ //return "";
}
///
diff --git a/BPASmartClient.DosingSystemSingle/BPASmartClient.DosingSystemSingle.csproj b/BPASmartClient.DosingSystemSingle/BPASmartClient.DosingSystemSingle.csproj
index 465ab84c..4ff09e8b 100644
--- a/BPASmartClient.DosingSystemSingle/BPASmartClient.DosingSystemSingle.csproj
+++ b/BPASmartClient.DosingSystemSingle/BPASmartClient.DosingSystemSingle.csproj
@@ -16,7 +16,7 @@
-
+
diff --git a/BPASmartClient.FoodStationTest/BPASmartClient.FoodStationTest.csproj b/BPASmartClient.FoodStationTest/BPASmartClient.FoodStationTest.csproj
index 49bd8a14..4f950498 100644
--- a/BPASmartClient.FoodStationTest/BPASmartClient.FoodStationTest.csproj
+++ b/BPASmartClient.FoodStationTest/BPASmartClient.FoodStationTest.csproj
@@ -16,7 +16,7 @@
-
+
diff --git a/BPASmartClient.FoodStationTest/Model/RawMaterial/DeviceInquire.cs b/BPASmartClient.FoodStationTest/Model/RawMaterial/DeviceInquire.cs
index fe350ef6..e8b73391 100644
--- a/BPASmartClient.FoodStationTest/Model/RawMaterial/DeviceInquire.cs
+++ b/BPASmartClient.FoodStationTest/Model/RawMaterial/DeviceInquire.cs
@@ -185,7 +185,7 @@ namespace BPASmartClient.FoodStationTest.Model
DeviceStatus DS = new DeviceStatus();
DS.modbusTcp.IsReconnect = false;
- DS.modbusTcp.ConnectOk = new Action(() =>
+ DS.modbusTcp.Connected = new Action(() =>
{
string DeviceName = DS.modbusTcp.Read(DeviceAddress.DeviceName, 20).Content.Trim()?.Replace(" ", "");//读取设备名称
if (DeviceName.Length > 0)
diff --git a/BPASmartClient.IoT/Model/DataVReport.cs b/BPASmartClient.IoT/Model/DataVReport.cs
index 543696c9..517c1671 100644
--- a/BPASmartClient.IoT/Model/DataVReport.cs
+++ b/BPASmartClient.IoT/Model/DataVReport.cs
@@ -199,7 +199,7 @@ namespace BPASmartDatavDeviceClient.IoT
//json = APIHelper.GetInstance.GetRequest($"{url}/api/Device/Query?clientId={clientId}&deviceId={deviceId}");
json = APIHelper.GetInstance.GetRequest($"{url}/api/Device/Query?clientId={clientId}&deviceId={deviceId}");
JsonMsg> jsonMsg = Tools.JsonToObjectTools>>(json);
- if (jsonMsg.obj != null && jsonMsg.obj.data != null)
+ if (jsonMsg != null && jsonMsg.obj != null && jsonMsg.obj.data != null)
{
device = jsonMsg.obj.data.FirstOrDefault();
if (device == null) return false;
diff --git a/BPASmartClient.JXJFoodBigStation/App.config b/BPASmartClient.JXJFoodBigStation/App.config
index 35b80a6d..5ce280c3 100644
--- a/BPASmartClient.JXJFoodBigStation/App.config
+++ b/BPASmartClient.JXJFoodBigStation/App.config
@@ -2,8 +2,12 @@
-
-
+
+
+
+
+
+
\ No newline at end of file
diff --git a/BPASmartClient.JXJFoodBigStation/App.xaml.cs b/BPASmartClient.JXJFoodBigStation/App.xaml.cs
index 6b0da0f3..8497fc7c 100644
--- a/BPASmartClient.JXJFoodBigStation/App.xaml.cs
+++ b/BPASmartClient.JXJFoodBigStation/App.xaml.cs
@@ -181,6 +181,13 @@ namespace BPASmartClient.JXJFoodBigStation
ToggleWindowPath = "View.HKPlcCommMonitorView"
});
DeviceMonitor.Add(new SubMenumodel()
+ {
+ SubMenuName = "全局变量",
+ SubMenuPermission = new Permission[] { Permission.管理员, Permission.操作员, Permission.技术员 },
+ AssemblyName = "BPASmartClient.JXJFoodBigStation",
+ ToggleWindowPath = "View.GlobalVarMonitorView"
+ });
+ DeviceMonitor.Add(new SubMenumodel()
{
SubMenuName = "手动流程",
SubMenuPermission = new Permission[] { Permission.管理员 },
diff --git a/BPASmartClient.JXJFoodBigStation/BPASmartClient.JXJFoodBigStation.csproj b/BPASmartClient.JXJFoodBigStation/BPASmartClient.JXJFoodBigStation.csproj
index b9be36f1..8d391c88 100644
--- a/BPASmartClient.JXJFoodBigStation/BPASmartClient.JXJFoodBigStation.csproj
+++ b/BPASmartClient.JXJFoodBigStation/BPASmartClient.JXJFoodBigStation.csproj
@@ -17,8 +17,8 @@
-
-
+
+
diff --git a/BPASmartClient.JXJFoodBigStation/Model/GVL_BigStation.cs b/BPASmartClient.JXJFoodBigStation/Model/GVL_BigStation.cs
index ff7f543e..72a12cae 100644
--- a/BPASmartClient.JXJFoodBigStation/Model/GVL_BigStation.cs
+++ b/BPASmartClient.JXJFoodBigStation/Model/GVL_BigStation.cs
@@ -15,58 +15,76 @@ namespace BPASmartClient.JXJFoodBigStation.Model
///
/// plc心跳上传
///
+ [PlcComm("plc心跳上传")]
public static bool HeartBeatFromPlc { get; set; }
///
/// 订单取消的状态位
///
+ [PlcComm("订单取消的状态位")]
public static bool Order_Cancel { get; set; }
///
/// 订单取消的配方号
///
+ [PlcComm("订单取消的配方号")]
public static string Order_CancelRecipeCode { get; set; } = "";
+ ///
+ /// 订单取消的状态步
+ ///
+ [PlcComm("订单取消的状态步")]
public static int Order_CancelStep { get; set; }
///
/// 第一个配方的配料时间
///
+ [PlcComm("第一个配方的配料时间")]
public static DateTime DosingRecipe1Time { get; set; }
///
/// 第二个配方的配料时间
///
+ [PlcComm("第二个配方的配料时间")]
public static DateTime DosingRecipe2Time { get; set; }
///
/// 第三个配方的配料时间
///
+ [PlcComm("第三个配方的配料时间")]
public static DateTime DosingRecipe3Time { get; set; }
///
/// 第四个配方的配料时间
///
+ [PlcComm("第四个配方的配料时间")]
public static DateTime DosingRecipe4Time { get; set; }
///
/// plc心跳下发
///
+ [PlcComm("plc心跳下发")]
public static bool HeartBeatToPlc { get; set; }
///
/// 配方下发状态 =0:配方未下发 ,1:配方下发给plc ,2:plc成功接收配方
///
+ [PlcComm("配方1下发状态 =0:配方未下发 ,1:配方下发给plc ,2:plc成功接收配方")]
public static int Recipe1DosingStatus { get; set; }
///
/// 配方下发状态 =0:配方未下发 ,1:配方下发给plc ,2:plc成功接收配方
///
+ [PlcComm("配方2下发状态 =0:配方未下发 ,1:配方下发给plc ,2:plc成功接收配方")]
public static int Recipe2DosingStatus { get; set; }
///
/// 配方下发状态 =0:配方未下发 ,1:配方下发给plc ,2:plc成功接收配方
///
+ [PlcComm("配方3下发状态 =0:配方未下发 ,1:配方下发给plc ,2:plc成功接收配方")]
public static int Recipe3DosingStatus { get; set; }
///
/// 配方下发状态 =0:配方未下发 ,1:配方下发给plc ,2:plc成功接收配方
///
+ [PlcComm("配方4下发状态 =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 };
@@ -75,19 +93,23 @@ namespace BPASmartClient.JXJFoodBigStation.Model
///
/// 是否处于手动下发配方
///
+ [PlcComm("是否处于手动下发配方")]
public static bool IsUseLocalRecipe { get; set; } = false;
///
/// 洗桶的标识符
///
+ [PlcComm("洗桶的标识符")]
public static bool BarrelWasherSign { get; set; }
///
/// 订单请求
///
+ [PlcComm("订单请求")]
public static bool Order_Request { get; set; } = false;
///
/// 下发配方的状态位
///
+ [PlcComm("下发配方的状态位")]
public static int SiemensSendRecipeStatus { get; set; } = 0;
///
@@ -101,10 +123,14 @@ namespace BPASmartClient.JXJFoodBigStation.Model
///
public static Dictionary RawMaterialsNameCode { get; set; } = new Dictionary();
+ [PlcComm("AGV送托盘")]
public static ushort AGVPutTray { get; set; }
+ [PlcComm("AGV取托盘")]
public static ushort AGVGetTray { get; set; }
+ [PlcComm("托盘传感器信号")]
public static ushort TraySensor { get; set; }
+ [PlcComm("托盘气缸信号")]
public static ushort TrayCylinder { get; set; }
public static DB_Read HKPlc_Read = new DB_Read();
@@ -112,33 +138,41 @@ namespace BPASmartClient.JXJFoodBigStation.Model
///
/// 是否连接海科PLC
///
+ [PlcComm("是否连接海科PLC")]
public static bool IsAllowHKPlcConnect { get; set; }
///
/// 是否连接西门子PLC
///
+ [PlcComm("是否连接西门子PLC")]
public static bool IsAllowSiemensConnect { get; set; }
///
/// 配方1配料完成
///
+ [PlcComm("配方1配料完成")]
public static bool Recipe1DosingFinish { get; set; } = false;
///
/// 配方2配料完成
///
+ [PlcComm("配方2配料完成")]
public static bool Recipe2DosingFinish { get; set; } = false;
///
/// 配方3配料完成
///
+ [PlcComm("配方3配料完成")]
public static bool Recipe3DosingFinish { get; set; } = false;
///
/// 配方4配料完成
///
+ [PlcComm("配方4配料完成")]
public static bool Recipe4DosingFinish { get; set; } = false;
///
/// 订单是否是洗桶
///
+ [PlcComm("订单是否是洗桶")]
public static bool Order_IsWashingBarrel { get; set; } = false;
+ [PlcComm("TrayEnable")]
public static int TrayEnable { get; set; } = 15;
}
}
diff --git a/BPASmartClient.JXJFoodBigStation/Model/HK_PLC/DB_Write.cs b/BPASmartClient.JXJFoodBigStation/Model/HK_PLC/DB_Write.cs
index 4d12381e..c003b788 100644
--- a/BPASmartClient.JXJFoodBigStation/Model/HK_PLC/DB_Write.cs
+++ b/BPASmartClient.JXJFoodBigStation/Model/HK_PLC/DB_Write.cs
@@ -7,6 +7,9 @@ using System.Threading.Tasks;
namespace BPASmartClient.JXJFoodBigStation.Model.HK_PLC
{
+ ///
+ /// 上位机只写的DB99。
+ ///
public class DB_Write
{
///
diff --git a/BPASmartClient.JXJFoodBigStation/Model/HK_PLC/HKDeviceStatus.cs b/BPASmartClient.JXJFoodBigStation/Model/HK_PLC/HKDeviceStatus.cs
index e8aaa5dc..a6ccba15 100644
--- a/BPASmartClient.JXJFoodBigStation/Model/HK_PLC/HKDeviceStatus.cs
+++ b/BPASmartClient.JXJFoodBigStation/Model/HK_PLC/HKDeviceStatus.cs
@@ -78,7 +78,6 @@ namespace BPASmartClient.JXJFoodBigStation.Model.HK_PLC
{
int index = Array.FindIndex(recipe.RawMaterial.ToArray(), p => p.RawMaterialBarrelNum == barrel && p.RawMaterialLocation == loc);
- #region 新版本
int x = 0;
if (barrel < 3) x = (barrel - 1) * 56 + 6;
else if (barrel > 3) x = (barrel - 2) * 56 + 6;
@@ -93,64 +92,6 @@ namespace BPASmartClient.JXJFoodBigStation.Model.HK_PLC
HK_PLC_S7.Write(address, recipe.RawMaterial.ElementAt(index).RawMaterialWeight);
MessageNotify.GetInstance.ShowRunLog($"配方编号:{recipe.RecipeCode},托盘编号:{recipe.TrayCode},桶号:{barrel},位置:{loc},重量:{recipe.RawMaterial.ElementAt(index).RawMaterialWeight}");
}
- #endregion
-
- #region 旧版本
- //if (index == -1)
- //{
- // switch (barrel)
- // {
- // case 1:
- // string address = "DB99.DBD" + (6 + 4 * (loc - 1));
- // HK_PLC_S7.Write(address, 0);
- // break;
- // case 2:
- // string address1 = "DB99.DBD" + (62 + 4 * (loc - 1));
- // HK_PLC_S7.Write(address1, 0);
- // break;
- // case 4:
- // string address2 = "DB99.DBD" + (118 + 4 * (loc - 1));
- // HK_PLC_S7.Write(address2, 0);
- // break;
- // case 5:
- // string address3 = "DB99.DBD" + (174 + 4 * (loc - 1));
- // HK_PLC_S7.Write(address3, 0);
- // break;
- // default:
- // break;
-
- // }
- //}
- //else
- //{
- // switch (barrel)
- // {
- // case 1:
- // string address = "DB99.DBD" + (6 + 4 * (loc - 1));
- // HK_PLC_S7.Write(address, recipe.RawMaterial.ElementAt(index).RawMaterialWeight);
- // MessageNotify.GetInstance.ShowRunLog($"配方编号:{recipe.RecipeCode},托盘编号:{recipe.TrayCode},桶号:{barrel},位置:{loc},重量:{recipe.RawMaterial.ElementAt(index).RawMaterialWeight}");
- // break;
- // case 2:
- // string address1 = "DB99.DBD" + (62 + 4 * (loc - 1));
- // HK_PLC_S7.Write(address1, recipe.RawMaterial.ElementAt(index).RawMaterialWeight);
- // MessageNotify.GetInstance.ShowRunLog($"配方编号:{recipe.RecipeCode},托盘编号:{recipe.TrayCode},桶号:{barrel},位置:{loc},重量:{recipe.RawMaterial.ElementAt(index).RawMaterialWeight}");
- // break;
- // case 4:
- // string address2 = "DB99.DBD" + (118 + 4 * (loc - 1));
- // HK_PLC_S7.Write(address2, recipe.RawMaterial.ElementAt(index).RawMaterialWeight);
- // MessageNotify.GetInstance.ShowRunLog($"配方编号:{recipe.RecipeCode},托盘编号:{recipe.TrayCode},桶号:{barrel},位置:{loc},重量:{recipe.RawMaterial.ElementAt(index).RawMaterialWeight}");
- // break;
- // case 5:
- // string address3 = "DB99.DBD" + (174 + 4 * (loc - 1));
- // HK_PLC_S7.Write(address3, recipe.RawMaterial.ElementAt(index).RawMaterialWeight);
- // MessageNotify.GetInstance.ShowRunLog($"配方编号:{recipe.RecipeCode},托盘编号:{recipe.TrayCode},桶号:{barrel},位置:{loc},重量:{recipe.RawMaterial.ElementAt(index).RawMaterialWeight}");
- // break;
- // default:
- // break;
- // }
- //}
- #endregion
-
}
}
}
diff --git a/BPASmartClient.JXJFoodBigStation/Model/HK_PLC/HKPlcCommAddress.cs b/BPASmartClient.JXJFoodBigStation/Model/HK_PLC/HKPlcCommAddress.cs
deleted file mode 100644
index b571013d..00000000
--- a/BPASmartClient.JXJFoodBigStation/Model/HK_PLC/HKPlcCommAddress.cs
+++ /dev/null
@@ -1,13 +0,0 @@
-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/HK_PLC/PlcReceviceRecipe.cs b/BPASmartClient.JXJFoodBigStation/Model/HK_PLC/PlcReceviceRecipe.cs
deleted file mode 100644
index c2855676..00000000
--- a/BPASmartClient.JXJFoodBigStation/Model/HK_PLC/PlcReceviceRecipe.cs
+++ /dev/null
@@ -1,19 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-
-namespace BPASmartClient.JXJFoodBigStation.Model.HK_PLC
-{
- public class PlcReceviceRecipe
- {
- public short TrayNum { get; set; }
- public short RecipeNum { get; set; }
- public float[] Barrel1Weight { get; set; } = new float[14];
- public float[] Barrel2Weight { get; set; } = new float[14];
- public float[] Barrel4Weight { get; set; } = new float[14];
- public float[] Barrel5Weight { get; set; } = new float[14];
-
- }
-}
diff --git a/BPASmartClient.JXJFoodBigStation/Model/ProcessControl.cs b/BPASmartClient.JXJFoodBigStation/Model/ProcessControl.cs
index f41de36f..e8a85ecc 100644
--- a/BPASmartClient.JXJFoodBigStation/Model/ProcessControl.cs
+++ b/BPASmartClient.JXJFoodBigStation/Model/ProcessControl.cs
@@ -13,6 +13,7 @@ using System.Reflection;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
+using System.Windows.Markup;
namespace BPASmartClient.JXJFoodBigStation.Model
{
@@ -21,25 +22,25 @@ namespace BPASmartClient.JXJFoodBigStation.Model
private volatile static ProcessControl _Instance;
public static ProcessControl GetInstance => _Instance ?? (_Instance = new ProcessControl());
private ProcessControl() { }
- public SiemensDeviceStatus SiemensDevice = new SiemensDeviceStatus();
+ //public SiemensDeviceStatus SiemensDevice = new SiemensDeviceStatus();
public HKDeviceStatus HKDevice = new HKDeviceStatus();
DL_Finish_DB FinishData = new DL_Finish_DB();
///
- /// 西门子配方数据
+ /// MES配方数据
///
public ObservableCollection SiemensRecipes { get; set; } = new ObservableCollection();
///
/// 本地配方数据
///
- public ObservableCollection LocalRecipes { get; set; } = new ObservableCollection();
+ //public ObservableCollection LocalRecipes { get; set; } = new ObservableCollection();
///
/// 配方等待执行
///
- public ObservableCollection RecipeWaitExecute { get; set; } = new ObservableCollection();
+ //public ObservableCollection RecipeWaitExecute { get; set; } = new ObservableCollection();
///
/// 配方正在执行
///
- public ObservableCollection RecipeExecuting { get; set; } = new ObservableCollection();
+ //public ObservableCollection RecipeExecuting { get; set; } = new ObservableCollection();
///
/// 配方执行完成
///
@@ -54,7 +55,7 @@ namespace BPASmartClient.JXJFoodBigStation.Model
public ObservableCollection HardWareRawMaterialInfo { get; set; } = new ObservableCollection();
public ObservableCollection RawMaterialsInfo { get; set; } = new ObservableCollection();
///
- /// 西门子配方队列
+ /// MES配方队列
///
public ConcurrentQueue SiemensRecipeQueue1 = new ConcurrentQueue();
public ConcurrentQueue SiemensRecipeQueue2 = new ConcurrentQueue();
@@ -62,785 +63,787 @@ namespace BPASmartClient.JXJFoodBigStation.Model
public ConcurrentQueue SiemensRecipeQueue4 = new ConcurrentQueue();
public ConcurrentDictionary> SiemensRecipeQueue = new ConcurrentDictionary>();
- public ObservableCollection recipe = new ObservableCollection();
+ //public ObservableCollection recipe = new ObservableCollection();
///
/// 本地配方队列
///
- public ConcurrentQueue LocalRecipeQueue1 = new ConcurrentQueue();
- public ConcurrentQueue LocalRecipeQueue2 = new ConcurrentQueue();
- public ConcurrentQueue LocalRecipeQueue3 = new ConcurrentQueue();
- public ConcurrentQueue LocalRecipeQueue4 = new ConcurrentQueue();
+ //public ConcurrentQueue LocalRecipeQueue1 = new ConcurrentQueue();
+ //public ConcurrentQueue LocalRecipeQueue2 = new ConcurrentQueue();
+ //public ConcurrentQueue LocalRecipeQueue3 = new ConcurrentQueue();
+ //public ConcurrentQueue LocalRecipeQueue4 = new ConcurrentQueue();
///
/// 海科PLC的IP
///
public string HK_PLC_IP = ConfigurationManager.AppSettings["HKPlc_IP"];
///
- /// 西门子PLC的IP
+ /// MESPLC的IP
///
public string Siemens_PLC_IP = ConfigurationManager.AppSettings["Siemens_IP"];
public void Init()
{
+ //TODO:下发订单数据处理修改
ActionManage.GetInstance.Register(new Action
public void VarResetInit()
{
- LocalRecipeQueue1.Clear();
- LocalRecipeQueue2.Clear();
- LocalRecipeQueue3.Clear();
- LocalRecipeQueue4.Clear();
+ //LocalRecipeQueue1.Clear();
+ //LocalRecipeQueue2.Clear();
+ //LocalRecipeQueue3.Clear();
+ //LocalRecipeQueue4.Clear();
SiemensRecipeQueue1.Clear();
SiemensRecipeQueue2.Clear();
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;
+ #region 舍弃 - 不用
+ //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,发送配方编号和请求配料标志给MES");
+ // 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,MES确认开始配料");
+ // 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($"MES取消订单,但未找到订单:{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 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},订单类型为洗桶");
+ // 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,MES取消订单完成,订单号:{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.WritePlcRecipeData(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.WritePlcRecipeData(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
- }
+ // GVL_BigStation.RecipeDosingTime[data.Key] = DateTime.Now;
+ // HKDevice.WritePlcRecipeData(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.WritePlcRecipeData(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}配方配料完成,将信号反馈给MES");
+ // }
+ // 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
+ //}
+ #endregion
///
/// 读取配料完成时,每个料仓的配料重量
///
@@ -2412,5 +2321,52 @@ namespace BPASmartClient.JXJFoodBigStation.Model
}
}
}
+
+ ///
+ /// 配方添加到执行队列
+ ///
+ /// 执行队列
+ /// 配方编码
+ /// 队列名称
+ ///
+ private void ReceiveRecipe(ConcurrentQueue recipeQueue,string recipeCode,string queueName)
+ {
+ if (!(recipeQueue.Contains(recipeCode)))
+ {
+ //if (SiemensDevice.DL_Status is DL_Status_DB status)
+ //{
+ switch (GVL_BigStation.SiemensSendRecipeStatus)
+ {
+ case 3:
+ //SiemensDevice.Siemens_PLC_S7.WriteString(2331, recipeCode, 10);
+ //SiemensDevice.Siemens_PLC_S7.Write("DB2331.DBX28.0", true);
+ MessageNotify.GetInstance.ShowRunLog($"{queueName},发送配方编号和请求配料标志给MES");
+ 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($"{queueName},MES确认开始配料");
+ GVL_BigStation.SiemensSendRecipeStatus = 5;
+ //}
+ break;
+ case 5:
+ //if (SiemensDevice.DL_Status.Dosing_Start_ACK == false)
+ //{
+ recipeQueue.Enqueue(recipeCode);
+ MessageNotify.GetInstance.ShowRunLog($"{queueName},配方:{recipeCode},加入队列");
+ GVL_BigStation.SiemensSendRecipeStatus = 0;
+ //}
+ break;
+ default:
+ break;
+ }
+ //}
+ }
+ }
+
+
}
}
diff --git a/BPASmartClient.JXJFoodBigStation/Model/Siemens/DL_DataColl_DB.cs b/BPASmartClient.JXJFoodBigStation/Model/Siemens/DL_DataColl_DB.cs
index 41e36e69..fd884d52 100644
--- a/BPASmartClient.JXJFoodBigStation/Model/Siemens/DL_DataColl_DB.cs
+++ b/BPASmartClient.JXJFoodBigStation/Model/Siemens/DL_DataColl_DB.cs
@@ -7,7 +7,7 @@ using System.Threading.Tasks;
namespace BPASmartClient.JXJFoodBigStation.Model.Siemens
{
- public class DL_DataColl_DB
+ public class DL_DataColl_DB
{
[Siemens(16)]
public string RecipeCode { get; set; } = "";
diff --git a/BPASmartClient.JXJFoodBigStation/Model/Siemens/DL_Finish_DB.cs b/BPASmartClient.JXJFoodBigStation/Model/Siemens/DL_Finish_DB.cs
index 2a9b2928..40b50cd5 100644
--- a/BPASmartClient.JXJFoodBigStation/Model/Siemens/DL_Finish_DB.cs
+++ b/BPASmartClient.JXJFoodBigStation/Model/Siemens/DL_Finish_DB.cs
@@ -1,4 +1,5 @@
-using BPASmartClient.S7Net;
+using BPASmartClient.JXJFoodBigStation.Model.MQTT.Message;
+using BPASmartClient.S7Net;
using System;
using System.Collections.Generic;
using System.Linq;
diff --git a/BPASmartClient.JXJFoodBigStation/Model/Siemens/SiemensCommAddress.cs b/BPASmartClient.JXJFoodBigStation/Model/Siemens/SiemensCommAddress.cs
deleted file mode 100644
index 0ffa682a..00000000
--- a/BPASmartClient.JXJFoodBigStation/Model/Siemens/SiemensCommAddress.cs
+++ /dev/null
@@ -1,14 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-
-namespace BPASmartClient.JXJFoodBigStation.Model.Siemens
-{
- public class SiemensCommAddress
- {
-
- }
-
-}
diff --git a/BPASmartClient.JXJFoodBigStation/Properties/Settings.Designer.cs b/BPASmartClient.JXJFoodBigStation/Properties/Settings.Designer.cs
index 02053c8a..7762a389 100644
--- a/BPASmartClient.JXJFoodBigStation/Properties/Settings.Designer.cs
+++ b/BPASmartClient.JXJFoodBigStation/Properties/Settings.Designer.cs
@@ -12,7 +12,7 @@ namespace BPASmartClient.JXJFoodBigStation.Properties {
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
- [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "17.3.0.0")]
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "17.4.0.0")]
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
diff --git a/BPASmartClient.JXJFoodBigStation/View/HardwareStatusView.xaml b/BPASmartClient.JXJFoodBigStation/View/HardwareStatusView.xaml
index c98b2429..e363b3a1 100644
--- a/BPASmartClient.JXJFoodBigStation/View/HardwareStatusView.xaml
+++ b/BPASmartClient.JXJFoodBigStation/View/HardwareStatusView.xaml
@@ -383,10 +383,11 @@
-
@@ -562,10 +563,12 @@
-
+
+
@@ -716,6 +720,7 @@
+
diff --git a/BPASmartClient.JXJFoodBigStation/View/RecipeInfosView.xaml b/BPASmartClient.JXJFoodBigStation/View/RecipeInfosView.xaml
index a1d57384..2d8468b8 100644
--- a/BPASmartClient.JXJFoodBigStation/View/RecipeInfosView.xaml
+++ b/BPASmartClient.JXJFoodBigStation/View/RecipeInfosView.xaml
@@ -322,7 +322,11 @@
Text="{Binding TrayCode}" />
-
+
+
+
diff --git a/BPASmartClient.JXJFoodBigStation/View/RecipeReceiveView.xaml b/BPASmartClient.JXJFoodBigStation/View/RecipeReceiveView.xaml
index 0dc1e74c..6f25cbe7 100644
--- a/BPASmartClient.JXJFoodBigStation/View/RecipeReceiveView.xaml
+++ b/BPASmartClient.JXJFoodBigStation/View/RecipeReceiveView.xaml
@@ -160,8 +160,10 @@
x:Name="IsUseLocalRecipe"
Margin="0,0,10,0"
VerticalAlignment="Center"
+ VerticalContentAlignment="Center"
Content="使用本地配方配料"
FontFamily="楷体"
+ FontSize="20"
Foreground="Aqua"
IsChecked="{Binding IsUseLocalRecipe}" />
@@ -293,7 +295,7 @@
FontSize="12"
Foreground="#FF2AB2E7"
Text="{Binding RecipeName}" />
-
+ Text="配方类别:" />-->
diff --git a/BPASmartClient.JXJFoodBigStation/ViewModel/RecipeInfosViewModel.cs b/BPASmartClient.JXJFoodBigStation/ViewModel/RecipeInfosViewModel.cs
index a3970fb1..da03c158 100644
--- a/BPASmartClient.JXJFoodBigStation/ViewModel/RecipeInfosViewModel.cs
+++ b/BPASmartClient.JXJFoodBigStation/ViewModel/RecipeInfosViewModel.cs
@@ -62,6 +62,34 @@ namespace BPASmartClient.JXJFoodBigStation.ViewModel
{
return;
}
+ if (string.IsNullOrWhiteSpace(RecipeName) )
+ {
+ MessageNotify.GetInstance.ShowDialog("配方名称不可为空,请修改后再试。",DialogType.Error);
+ return;
+ }
+ if (TrayCode is <=0 or >5)
+ {
+ MessageNotify.GetInstance.ShowDialog("请输入正确的托盘编号,请修改后再试。", DialogType.Error);
+ return;
+ }
+ foreach (RawMaterial item in RawMaterialsInfo)
+ {
+ if (item.RawMaterialLocation ==0)
+ {
+ MessageNotify.GetInstance.ShowDialog("请输入正确的原料位置,请修改后再试。", DialogType.Error);
+ return;
+ }
+ if (item.RawMaterialBarrelNum is <=0 or >4)
+ {
+ MessageNotify.GetInstance.ShowDialog("请输入正确的托盘桶号,请修改后再试。", DialogType.Error);
+ return;
+ }
+ if (item.RawMaterialWeight <=0)
+ {
+ MessageNotify.GetInstance.ShowDialog("请输入正确的原料重量,请修改后再试。", DialogType.Error);
+ return;
+ }
+ }
var bom= Json.Data.Recipes.FirstOrDefault(p => p.RecipeCode == RecipeCode);
if (bom == null)//新配方
{
diff --git a/BPASmartClient.JXJFoodBigStation/ViewModel/RecipeReceiveViewModel.cs b/BPASmartClient.JXJFoodBigStation/ViewModel/RecipeReceiveViewModel.cs
index 776bf485..bc720586 100644
--- a/BPASmartClient.JXJFoodBigStation/ViewModel/RecipeReceiveViewModel.cs
+++ b/BPASmartClient.JXJFoodBigStation/ViewModel/RecipeReceiveViewModel.cs
@@ -113,8 +113,8 @@ namespace BPASmartClient.JXJFoodBigStation.ViewModel
}
Json.Data.Recipes.Clear();
- Json.Save();
Json.Data.SelectedRecipes.Clear();
+ Json.Save();
NoticeDemoViewModel.OpenMsg(EnumPromptType.Success, App.MainWindow, "成功", $"本地配方已全部删除!");
MessageNotify.GetInstance.ShowUserLog($"手动清除所有配方。");
});
@@ -126,6 +126,11 @@ namespace BPASmartClient.JXJFoodBigStation.ViewModel
return;
}
var res = Recipes.FirstOrDefault(p => p.RecipeCode == recipeCode);
+ var res1 = Json.Data.SelectedRecipes.FirstOrDefault(p => p.RecipeCode == recipeCode);
+ if (res1 is not null)
+ {
+ Json.Data.SelectedRecipes.Remove(res1);
+ }
if (res != null)
{
Recipes.Remove(res);
diff --git a/BPASmartClient.JXJFoodBigStation/ViewModel/SelectRecipesViewModel.cs b/BPASmartClient.JXJFoodBigStation/ViewModel/SelectRecipesViewModel.cs
index ac07886c..c55c7299 100644
--- a/BPASmartClient.JXJFoodBigStation/ViewModel/SelectRecipesViewModel.cs
+++ b/BPASmartClient.JXJFoodBigStation/ViewModel/SelectRecipesViewModel.cs
@@ -17,6 +17,7 @@ namespace BPASmartClient.JXJFoodBigStation.ViewModel
public SelectRecipesViewModel()
{
AllRecipes = new();
+ SelectRecipes.Clear();
foreach (var item in Json.Data.SelectedRecipes)
{
SelectRecipes.Add(item);
diff --git a/BPASmartClient.JXJFoodSmallStation/Model/Bom/BomMaterialData.cs b/BPASmartClient.JXJFoodSmallStation/Model/Bom/BomMaterialData.cs
deleted file mode 100644
index b7051d4c..00000000
--- a/BPASmartClient.JXJFoodSmallStation/Model/Bom/BomMaterialData.cs
+++ /dev/null
@@ -1,16 +0,0 @@
-using BPA.Helper;
-using System;
-using System.Collections.Generic;
-using System.Collections.ObjectModel;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-
-namespace BPASmartClient.JXJFoodSmallStation.Model.Bom
-{
- public class BomMaterialData
- {
- public ObservableCollection Materials { get; set; } = new ObservableCollection();
-
- }
-}
diff --git a/BPASmartClient.JXJFoodSmallStation/Model/GVL/GVL.cs b/BPASmartClient.JXJFoodSmallStation/Model/GVL/GVL.cs
deleted file mode 100644
index a138cf60..00000000
--- a/BPASmartClient.JXJFoodSmallStation/Model/GVL/GVL.cs
+++ /dev/null
@@ -1,12 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-
-namespace BPASmartClient.JXJFoodSmallStation.Model.GVL
-{
- public class GVL
- {
- }
-}
diff --git a/BPASmartClient.JXJFoodSmallStation/Model/GVL/ReadSmallMaterial.cs b/BPASmartClient.JXJFoodSmallStation/Model/GVL/ReadSmallMaterial.cs
deleted file mode 100644
index 6e9ccdf6..00000000
--- a/BPASmartClient.JXJFoodSmallStation/Model/GVL/ReadSmallMaterial.cs
+++ /dev/null
@@ -1,117 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-
-namespace BPASmartClient.JXJFoodSmallStation.Model.GVL
-{
- public class ReadSmallMaterial
- {
- ///
- /// PLC到上位机心跳
- ///
- public bool Heart { get; set; }
- public bool Agv1 { get; set; }
- public bool Agv2 { get; set; }
- public bool Agv3 { get; set; }
- public bool Agv4 { get; set; }
- public bool Agv5 { get; set; }
- public bool Agv6 { get; set; }
- ///
- /// 1#托盘工位占用
- ///
- public bool Tray1BeOccupied { get; set; }
- ///
- /// 2#托盘工位占用
- ///
- public bool Tray2BeOccupied { get; set; }
- ///
- /// 1#托盘工位配料完成
- ///
- public bool Tray1MaterialFinish { get; set; }
- ///
- /// 2#托盘工位配料完成
- ///
- public bool Tray2MaterialFinish { get; set; }
- ///
- /// 接收托盘1配方数据完成
- ///
- public bool Tray1ReceiveFinish { get; set; }
- ///
- /// 接收托盘2配方数据完成
- ///
- public bool Tray2ReceiveFinish { get; set; }
-
- public int Reserve1 { get; set; }
- public int Receive2 { get; set; }
- ///
- /// 托盘1_1#桶位置反馈
- ///
- public float Tray1Barrel1Location { get; set; }
- ///
- /// 托盘1_2#桶位置反馈
- ///
- public float Tray1Barrel2Location { get; set; }
- ///
- /// 托盘1_3#桶位置反馈
- ///
- public float Tray1Barrel3Location { get; set; }
- ///
- /// 托盘1_4#桶位置反馈
- ///
- public float Tray1Barrel4Location { get; set; }
- ///
- /// 托盘2_1#桶位置反馈
- ///
- public float Tray2Barrel1Location { get; set; }
- ///
- /// 托盘2_2#桶位置反馈
- ///
- public float Tray2Barrel2Location { get; set; }
- ///
- /// 托盘2_3#桶位置反馈
- ///
- public float Tray2Barrel3Location { get; set; }
- ///
- /// 托盘2_4#桶位置反馈
- ///
- public float Tray2Barrel4Location { get; set; }
-
- public int Reserve3 { get; set; }
- public int Receive4 { get; set; }
- ///
- /// 托盘1_1#桶允许配料
- ///
- public float Tray1Barrel1AllowDosing { get; set; }
- ///
- /// 托盘1_2#桶允许配料
- ///
- public float Tray1Barrel2AllowDosing { get; set; }
- ///
- /// 托盘1_3#桶允许配料
- ///
- public float Tray1Barrel3AllowDosing { get; set; }
- ///
- /// 托盘1_4#桶允许配料
- ///
- public float Tray1Barrel4AllowDosing { get; set; }
- ///
- /// 托盘2_1#桶允许配料
- ///
- public float Tray2Barrel1AllowDosing { get; set; }
- ///
- /// 托盘2_2#桶允许配料
- ///
- public float Tray2Barrel2AllowDosing { get; set; }
- ///
- /// 托盘2_3#桶允许配料
- ///
- public float Tray2Barrel3AllowDosing { get; set; }
- ///
- /// 托盘2_4#桶允许配料
- ///
- public float Tray2Barrel4AllowDosing { get; set; }
-
- }
-}
diff --git a/BPASmartClient.JXJFoodSmallStation/Model/GVL/WriteSmallMaterial.cs b/BPASmartClient.JXJFoodSmallStation/Model/GVL/WriteSmallMaterial.cs
deleted file mode 100644
index 0dd86460..00000000
--- a/BPASmartClient.JXJFoodSmallStation/Model/GVL/WriteSmallMaterial.cs
+++ /dev/null
@@ -1,185 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-
-namespace BPASmartClient.JXJFoodSmallStation.Model.GVL
-{
- public class WriteSmallMaterial
- {
- ///
- /// PLC到上位机心跳
- ///
- public bool Heart { get; set; }
- public bool Agv1 { get; set; }
- public bool Agv2 { get; set; }
- public bool Agv3 { get; set; }
- public bool Agv4{ get; set; }
- public bool Agv5 { get; set; }
- public bool Agv6 { get; set; }
- public bool Agv7 { get; set; }
- public bool Agv8 { get; set; }
- public bool Agv9 { get; set; }
- public bool Agv10 { get; set; }
- ///
- /// 下发配方到托盘1
- ///
- public bool Tray1IssueRecipe { get; set; }
- ///
- /// 下发配方到托盘2
- ///
- public bool Tray2IssueRecipe { get; set; }
- public int Reserve1 { get; set; }
- public int Receive2 { get; set; }
-
-
- public bool Tray1Barrel1IsDosing1;
- public bool Tray1Barrel1IsDosing2;
- public bool Tray1Barrel1IsDosing3;
- public bool Tray1Barrel1IsDosing4;
- public bool Tray1Barrel1IsDosing5;
- public bool Tray1Barrel1IsDosing6;
- public bool Tray1Barrel1IsDosing7;
- public bool Tray1Barrel1IsDosing8;
- public bool Tray1Barrel1IsDosing9;
- public bool Tray1Barrel1IsDosing10;
- public bool Tray1Barrel1IsDosing11;
- public bool Tray1Barrel1IsDosing12;
- public bool Tray1Barrel1IsDosing13;
- public bool Tray1Barrel1IsDosing14;
- public bool Tray1Barrel1IsDosing15;
- public bool Receive3;
- public bool Tray1Barrel2IsDosing1;
- public bool Tray1Barrel2IsDosing2;
- public bool Tray1Barrel2IsDosing3;
- public bool Tray1Barrel2IsDosing4;
- public bool Tray1Barrel2IsDosing5;
- public bool Tray1Barrel2IsDosing6;
- public bool Tray1Barrel2IsDosing7;
- public bool Tray1Barrel2IsDosing8;
- public bool Tray1Barrel2IsDosing9;
- public bool Tray1Barrel2IsDosing10;
- public bool Tray1Barrel2IsDosing11;
- public bool Tray1Barrel2IsDosing12;
- public bool Tray1Barrel2IsDosing13;
- public bool Tray1Barrel2IsDosing14;
- public bool Tray1Barrel2IsDosing15;
- public bool Receive4;
- public bool Tray1Barrel3IsDosing1;
- public bool Tray1Barrel3IsDosing2;
- public bool Tray1Barrel3IsDosing3;
- public bool Tray1Barrel3IsDosing4;
- public bool Tray1Barrel3IsDosing5;
- public bool Tray1Barrel3IsDosing6;
- public bool Tray1Barrel3IsDosing7;
- public bool Tray1Barrel3IsDosing8;
- public bool Tray1Barrel3IsDosing9;
- public bool Tray1Barrel3IsDosing10;
- public bool Tray1Barrel3IsDosing11;
- public bool Tray1Barrel3IsDosing12;
- public bool Tray1Barrel3IsDosing13;
- public bool Tray1Barrel3IsDosing14;
- public bool Tray1Barrel3IsDosing15;
- public bool Receive5;
- public bool Tray1Barrel4IsDosing1;
- public bool Tray1Barrel4IsDosing2;
- public bool Tray1Barrel4IsDosing3;
- public bool Tray1Barrel4IsDosing4;
- public bool Tray1Barrel4IsDosing5;
- public bool Tray1Barrel4IsDosing6;
- public bool Tray1Barrel4IsDosing7;
- public bool Tray1Barrel4IsDosing8;
- public bool Tray1Barrel4IsDosing9;
- public bool Tray1Barrel4IsDosing10;
- public bool Tray1Barrel4IsDosing11;
- public bool Tray1Barrel4IsDosing12;
- public bool Tray1Barrel4IsDosing13;
- public bool Tray1Barrel4IsDosing14;
- public bool Tray1Barrel4IsDosing15;
- public bool Receive6;
-
- public bool Tray2Barrel1IsDosing1;
- public bool Tray2Barrel1IsDosing2;
- public bool Tray2Barrel1IsDosing3;
- public bool Tray2Barrel1IsDosing4;
- public bool Tray2Barrel1IsDosing5;
- public bool Tray2Barrel1IsDosing6;
- public bool Tray2Barrel1IsDosing7;
- public bool Tray2Barrel1IsDosing8;
- public bool Tray2Barrel1IsDosing9;
- public bool Tray2Barrel1IsDosing10;
- public bool Tray2Barrel1IsDosing11;
- public bool Tray2Barrel1IsDosing12;
- public bool Tray2Barrel1IsDosing13;
- public bool Tray2Barrel1IsDosing14;
- public bool Tray2Barrel1IsDosing15;
- public bool Receive7;
- public bool Tray2Barrel2IsDosing1;
- public bool Tray2Barrel2IsDosing2;
- public bool Tray2Barrel2IsDosing3;
- public bool Tray2Barrel2IsDosing4;
- public bool Tray2Barrel2IsDosing5;
- public bool Tray2Barrel2IsDosing6;
- public bool Tray2Barrel2IsDosing7;
- public bool Tray2Barrel2IsDosing8;
- public bool Tray2Barrel2IsDosing9;
- public bool Tray2Barrel2IsDosing10;
- public bool Tray2Barrel2IsDosing11;
- public bool Tray2Barrel2IsDosing12;
- public bool Tray2Barrel2IsDosing13;
- public bool Tray2Barrel2IsDosing14;
- public bool Tray2Barrel2IsDosing15;
- public bool Receive8;
- public bool Tray2Barrel3IsDosing1;
- public bool Tray2Barrel3IsDosing2;
- public bool Tray2Barrel3IsDosing3;
- public bool Tray2Barrel3IsDosing4;
- public bool Tray2Barrel3IsDosing5;
- public bool Tray2Barrel3IsDosing6;
- public bool Tray2Barrel3IsDosing7;
- public bool Tray2Barrel3IsDosing8;
- public bool Tray2Barrel3IsDosing9;
- public bool Tray2Barrel3IsDosing10;
- public bool Tray2Barrel3IsDosing11;
- public bool Tray2Barrel3IsDosing12;
- public bool Tray2Barrel3IsDosing13;
- public bool Tray2Barrel3IsDosing14;
- public bool Tray2Barrel3IsDosing15;
- public bool Receive9;
- public bool Tray2Barrel4IsDosing1;
- public bool Tray2Barrel4IsDosing2;
- public bool Tray2Barrel4IsDosing3;
- public bool Tray2Barrel4IsDosing4;
- public bool Tray2Barrel4IsDosing5;
- public bool Tray2Barrel4IsDosing6;
- public bool Tray2Barrel4IsDosing7;
- public bool Tray2Barrel4IsDosing8;
- public bool Tray2Barrel4IsDosing9;
- public bool Tray2Barrel4IsDosing10;
- public bool Tray2Barrel4IsDosing11;
- public bool Tray2Barrel4IsDosing12;
- public bool Tray2Barrel4IsDosing13;
- public bool Tray2Barrel4IsDosing14;
- public bool Tray2Barrel4IsDosing15;
- public bool Receive10;
- public int Receive11;
-
- public bool StockIn1DosingFinish;
- public bool StockIn2DosingFinish;
- public bool StockIn3DosingFinish;
- public bool StockIn4DosingFinish;
- public bool StockIn5DosingFinish;
- public bool StockIn6DosingFinish;
- public bool StockIn7DosingFinish;
- public bool StockIn8DosingFinish;
- public bool StockIn9DosingFinish;
- public bool StockIn10DosingFinish;
- public bool StockIn11DosingFinish;
- public bool StockIn12DosingFinish;
- public bool StockIn13DosingFinish;
- public bool StockIn14DosingFinish;
- public bool StockIn15DosingFinish;
- public bool Receive12;
- }
-}
diff --git a/BPASmartClient.JXJFoodSmallStation/Model/GVL_SmallStation.cs b/BPASmartClient.JXJFoodSmallStation/Model/GVL_SmallStation.cs
index b8660926..054aa0fd 100644
--- a/BPASmartClient.JXJFoodSmallStation/Model/GVL_SmallStation.cs
+++ b/BPASmartClient.JXJFoodSmallStation/Model/GVL_SmallStation.cs
@@ -57,15 +57,15 @@ namespace BPASmartClient.JXJFoodSmallStation.Model
///
public ushort StockBinCylinderStatus { get; set; }
- [VarComm("Global", "柔性配料料仓配料下发情况")]
///
/// 料仓配料情况
///
- public ushort[] StockBinDosingIssue { get; set; } = new ushort[5] { 0, 0, 0, 0, 0 };
[VarComm("Global", "柔性配料料仓配料下发情况")]
+ public ushort[] StockBinDosingIssue { get; set; } = new ushort[5] { 0, 0, 0, 0, 0 };
///
/// 料仓配料情况
///
+ [VarComm("Global", "柔性配料料仓配料下发情况")]
public ushort[] RecipeStockBinDosing { get; set; } = new ushort[5] { 0, 0, 0, 0, 0 };
[VarComm("Global", "柔性配料料仓配料情况")]
@@ -92,163 +92,161 @@ namespace BPASmartClient.JXJFoodSmallStation.Model
///
public int Tray2LogicFinish { get; set; } = 0;
- [VarComm("Global", "托盘1有货架")]
///
/// 托盘1有货架
///
+ [VarComm("Global", "托盘1有货架")]
public bool Station1HaveTray { get; set; }
- [VarComm("Global", "托盘2有货架")]
///
/// 托盘2有货架
///
+ [VarComm("Global", "托盘2有货架")]
public bool Station2HaveTray { get; set; }
- [VarComm("Global", "托盘1传感器信号")]
///
/// 托盘1传感器信号
///
+ [VarComm("Global", "托盘1传感器信号")]
public bool Station1Sensor { get; set; }
- [VarComm("Global", "托盘2传感器信号")]
///
/// 托盘2传感器信号
///
+ [VarComm("Global", "托盘2传感器信号")]
public bool Station2Sensor { get; set; }
- [VarComm("Global", "托盘1气缸信号")]
///
/// 托盘1气缸信号
///
+ [VarComm("Global", "托盘1气缸信号")]
public bool Station1Cylinder { get; set; }
- [VarComm("Global", "托盘2气缸信号")]
///
/// 托盘2气缸信号
///
+ [VarComm("Global", "托盘2气缸信号")]
public bool Station2Cylinder { get; set; }
- [VarComm("Global", "AGV放托盘1完成")]
+
///
/// AGV放托盘1完成
///
+ [VarComm("Global", "AGV放托盘1完成")]
public bool AGV_PutTray1Finish { get; set; }
- [VarComm("Global", "AGV取托盘1完成")]
///
/// AGV取托盘1完成
///
+ [VarComm("Global", "AGV取托盘1完成")]
public bool AGV_GetTray1Finish { get; set; }
- [VarComm("Global", "AGV放托盘2完成")]
///
/// AGV放托盘1完成
///
+ [VarComm("Global", "AGV放托盘2完成")]
public bool AGV_PutTray2Finish { get; set; }
- [VarComm("Global", "AGV取托盘2完成")]
///
/// AGV取托盘2完成
///
+ [VarComm("Global", "AGV取托盘2完成")]
public bool AGV_GetTray2Finish { get; set; }
- [VarComm("Global", "托盘1气缸复位")]
///
/// 托盘1气缸复位
///
+ [VarComm("Global", "托盘1气缸复位")]
public bool CylinderReset { get; set; }
- [VarComm("Global", "发送给plc的心跳")]
///
/// 发送给plc的心跳
///
+ [VarComm("Global", "发送给plc的心跳")]
public bool HeartBeatToPlc { get; set; } = false;
[VarComm("Global", "屏蔽小料站料仓不足15个报警")]
-
-
public bool DisEnableStockAlarm { get; set; } = false;
- [VarComm("Global", "配方制作完成数量")]
///
/// 配方制作完成数量
///
+ [VarComm("Global", "配方制作完成数量")]
public int RecipeDosingCompleNum { get; set; } = 0;
- [VarComm("Global", "来自plc的心跳")]
///
/// 来自plc的心跳
///
+ [VarComm("Global", "来自plc的心跳")]
public bool HeartBeatFromPlc { get; set; } = false;
- [VarComm("Global", "是否允许西门子下发配方")]
///
/// 是否允许西门子下发配方
///
+ [VarComm("Global", "是否允许西门子下发配方")]
public bool IsAllowSiemensSendRecipe { get; set; } = false;
- [VarComm("Global", "西门子下发配方状态0=等待下发配方 1=请求下发配方 2=接收配方 3=配方接收配方完成 4=请求配料 5=西门子确认开始配料 6=西门子确认开始配料信号复位")]
///
/// 西门子下发配方状态 0:等待下发配方 1:请求下发配方 2:上位机接收配方 3:配方接收配方完成 4:上位机向西门子请求配料 5:西门子确认开始配料 6:西门子确认开始配料 信号复位
///
+ [VarComm("Global", "西门子下发配方状态0=等待下发配方 1=请求下发配方 2=接收配方 3=配方接收配方完成 4=请求配料 5=西门子确认开始配料 6=西门子确认开始配料信号复位")]
public int SiemensSendRecipeStatus { get; set; } = 0;
- [VarComm("Global", "配方1下发状态 =0:配方未下发 ,1:配方下发给plc ,2:plc成功接收配方,正在配料")]
///
/// 配方下发状态 =0:配方未下发 ,1:配方下发给plc ,2:plc成功接收配方,正在配料
///
+ [VarComm("Global", "配方1下发状态 =0:配方未下发 ,1:配方下发给plc ,2:plc成功接收配方,正在配料")]
public int RecipeStatusIDTray1 { get; set; } = 0;
- [VarComm("Global", "配方1下发状态 =0:配方未下发 ,1:配方下发给plc ,2:plc成功接收配方,正在配料")]
///
/// 配方下发状态 =0:配方未下发 ,1:配方下发给plc ,2:plc成功接收配方,正在配料
///
+ [VarComm("Global", "配方1下发状态 =0:配方未下发 ,1:配方下发给plc ,2:plc成功接收配方,正在配料")]
public int[] RecipeProcessStatus { get; set; } = new int[5] { 0, 0, 0, 0, 0 };
- [VarComm("Global", "配方1下发状态 =0:配方未下发 ,1:配方下发给plc ,2:plc成功接收配方,正在配料")]
///
/// 配方下发状态 =0:配方未下发 ,1:配方下发给plc ,2:plc成功接收配方,正在配料
///
+ [VarComm("Global", "配方1下发状态 =0:配方未下发 ,1:配方下发给plc ,2:plc成功接收配方,正在配料")]
public bool AGVIsGetTray { get; set; } = false;
- [VarComm("Global", "配方2下发状态 =0:配方未下发 ,1:配方下发给plc ,2:plc成功接收配方,正在配料")]
///
/// 配方下发状态 =0:配方未下发 ,1:配方下发给plc ,2:plc成功接收配方,正在配料
///
+ [VarComm("Global", "配方2下发状态 =0:配方未下发 ,1:配方下发给plc ,2:plc成功接收配方,正在配料")]
public int RecipeStatusIDTray2 { get; set; } = 0;
- [VarComm("Global", "当前配方正在配料位置")]
///
/// 当前料仓的位置
///
+ [VarComm("Global", "当前配方正在配料位置")]
public int StockInIsWork { get; set; } = 0;
-
- [VarComm("Global", "设置料仓配料完成")]
///
/// 当前料仓的位置
///
+ [VarComm("Global", "设置料仓配料完成")]
public bool[] StockInDosingComple { get; set; } = new bool[15];
- [VarComm("Global", "是否使用粉仓配料")]
///
/// 是否使用粉仓配料
///
+ [VarComm("Global", "是否使用粉仓配料")]
public bool IsUseWindSend { get; set; } = false;
- [VarComm("Global", "粉仓正在配料")]
///
/// 粉仓正在配料
///
+ [VarComm("Global", "粉仓正在配料")]
public bool WindSendDosing { get; set; } = false;
@@ -259,16 +257,17 @@ namespace BPASmartClient.JXJFoodSmallStation.Model
#region 本地模拟配方
- [VarComm("Global", "是否使用本地模拟配方")]
///
/// 是否使用本地模拟配方
///
+ [VarComm("Global", "是否使用本地模拟配方")]
public bool IsUseLocalRecipe { get; set; }
- [VarComm("Global", "是否使用本地模拟配方")]
+
///
- /// 是否使用本地模拟配方
+ /// 不使用小料站配料
///
+ [VarComm("Global", "是否使用本地模拟配方")]
public bool NotUseSmallStation { get; set; }
///
@@ -299,16 +298,16 @@ namespace BPASmartClient.JXJFoodSmallStation.Model
public bool WindSendDosingComple { get; set; } = false;
- [VarComm("Global", "粉料仓配料状态")]
///
/// 粉料仓配料状态(0:无意义,1:粉料仓下配方,2:plc接收配方完成,3:粉料仓配料完成,4:粉料仓配料完成信号复位,5:排料完成)
///
+ [VarComm("Global", "粉料仓配料状态")]
public int WindSendDosingStatus { get; set; } = 0;
- [VarComm("Global", "PLC的系统模式 DB44.DBX0.1")]
///
/// PLC的系统模式 DB44.DBX0.1
///
+ [VarComm("Global", "PLC的系统模式 DB44.DBX0.1")]
public bool PlcSystemMode { get; set; } = false;
[VarComm("Global", "PLC的系统模式 DB44.DBX0.1")]
diff --git a/BPASmartClient.JXJFoodSmallStation/Model/HK_PLC/HKDeviceRead.cs b/BPASmartClient.JXJFoodSmallStation/Model/HK_PLC/HKDeviceRead.cs
deleted file mode 100644
index dee7a188..00000000
--- a/BPASmartClient.JXJFoodSmallStation/Model/HK_PLC/HKDeviceRead.cs
+++ /dev/null
@@ -1,16 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-
-namespace BPASmartClient.JXJFoodSmallStation.Model.HK_PLC
-{
- public class HKDeviceRead
- {
- public bool HeartBeat { get; set; }
- public bool SystemMode { get; set; }
- public bool SystemStart { get; set; }
- public bool SystemPause { get; set; }
- }
-}
diff --git a/BPASmartClient.JXJFoodSmallStation/Model/HK_PLC/HKPlcCommAddress.cs b/BPASmartClient.JXJFoodSmallStation/Model/HK_PLC/HKPlcCommAddress.cs
deleted file mode 100644
index 56bebdb7..00000000
--- a/BPASmartClient.JXJFoodSmallStation/Model/HK_PLC/HKPlcCommAddress.cs
+++ /dev/null
@@ -1,140 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-
-namespace BPASmartClient.JXJFoodSmallStation.Model.HK_PLC
-{
- public class HKPlcCommAddress
- {
- #region 海科PLC ==> 上位机
- ///
- /// 是否允许配料
- ///
- 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 SingleDosingFinishToPLC { get; set; } = "";
- ///
- /// 当前配料料仓的位置
- ///
- public static string SingleStockBinLocationToPLC { get; set; } = "";
-
- public static string RecipeDosingFinish { get; set; } = "";
- #endregion
-
- #region AGV进出站1
- ///
- /// Agv送货 进站申请
- ///
- public static string DeliveryAGVApply { get; set; } = "DB3.DBX0.1";
- ///
- /// Agv送货 进站申请
- ///
- public static string DeliveryAGVIsApply { get; set; } = "";
- ///
- /// Agv送货 进站顶升申请
- ///
- public static string DeliveryAGVApplyJack { get; set; } = "";
- ///
- /// Agv送货 进站顶升申请
- ///
- public static string DeliveryAGVIsApplyJack { get; set; } = "";
- ///
- /// Agv送货 送货完成
- ///
- public static string DeliveryAGVFinsih { get; set; } = "";
- ///
- /// Agv送货 工位上有货架
- ///
- public static string StationHaveCargo { get; set; } = "";
- ///
- /// Agv送货 进站申请
- ///
- public static string PickAGVApply { get; set; } = "";
- ///
- /// Agv送货 进站申请
- ///
- public static string PickAGVIsApply { get; set; } = "";
- ///
- /// Agv送货 取货架完成
- ///
- public static string PickCargoAGVFinish { get; set; } = "";
- ///
- /// Agv送货 取料完成
- ///
- public static string PickAGVFinish { get; set; } = "";
- ///
- /// 工位上是否有小车
- ///
- public static string StationIsExistTray { get; set; } = "";
- #endregion
- #region AGV进出站2
- ///
- /// Agv送货 进站申请
- ///
- public static string DeliveryAGVApplyStation2 { get; set; } = "";
- ///
- /// Agv送货 进站申请
- ///
- public static string DeliveryAGVIsApplyStation2 { get; set; } = "";
- ///
- /// Agv送货 进站顶升申请
- ///
- public static string DeliveryAGVApplyJackStation2 { get; set; } = "";
- ///
- /// Agv送货 进站顶升申请
- ///
- public static string DeliveryAGVIsApplyJackStation2 { get; set; } = "";
- ///
- /// Agv送货 送货完成
- ///
- public static string DeliveryAGVFinsihStation2 { get; set; } = "";
- ///
- /// Agv送货 工位上有货架
- ///
- public static string StationHaveCargoStation2 { get; set; } = "";
- ///
- /// Agv送货 进站申请
- ///
- public static string PickAGVApplyStation2 { get; set; } = "";
- ///
- /// Agv送货 进站申请
- ///
- public static string PickAGVIsApplyStation2 { get; set; } = "";
- ///
- /// Agv送货 取货架完成
- ///
- public static string PickCargoAGVFinishStation2 { get; set; } = "";
- ///
- /// Agv送货 取料完成
- ///
- public static string PickAGVFinishStation2 { get; set; } = "";
- ///
- /// 工位上是否有货架
- ///
- public static string StationIsExistTrayStation2 { get; set; } = "";
- #endregion
- }
-}
diff --git a/BPASmartClient.JXJFoodSmallStation/Model/ProcessControl.cs b/BPASmartClient.JXJFoodSmallStation/Model/ProcessControl.cs
index c84feeea..f01eb63b 100644
--- a/BPASmartClient.JXJFoodSmallStation/Model/ProcessControl.cs
+++ b/BPASmartClient.JXJFoodSmallStation/Model/ProcessControl.cs
@@ -28,7 +28,7 @@ namespace BPASmartClient.JXJFoodSmallStation.Model
///
/// 配方数据
///
- public ObservableCollection RemoteRecipes = new ObservableCollection();
+ public ObservableCollection RemoteRecipes = new ObservableCollection();
///
/// 原料的名称和料仓的位置对应
///
@@ -41,29 +41,26 @@ namespace BPASmartClient.JXJFoodSmallStation.Model
///
- /// 物料集合
+ /// 物料集合(工位配方集合,五个键分别对应五个工位)
///
public Dictionary> RecipeQueueTray { get; set; } = new Dictionary>();
public ConcurrentQueue RecipeQueueTray2 = new ConcurrentQueue();
-
- public SiemensDeviceStatus SiemensDevice = new SiemensDeviceStatus();
+ //XL_Finish_DB RecipeFinishInfo = new XL_Finish_DB();
+ //public SiemensDeviceStatus SiemensDevice = new SiemensDeviceStatus();
public HKDeviceStatus HKDevice = new HKDeviceStatus();
public WindSendDeviceStatus WindSendDevice = new WindSendDeviceStatus();
public ObservableCollection CommData { get; set; } = new ObservableCollection();
public ObservableCollection ProcessVar { get; set; } = new ObservableCollection();
- XL_Finish_DB RecipeFinishInfo = new XL_Finish_DB();
+
///
/// 风送PLC的DB块
///
WindSend_Write WindSendData = new WindSend_Write();
- ///
- /// 接收原料数据
- ///
- public RecipeRawMaterial RawMaterial;
+
public DateTime StockBinAlarmTime = DateTime.Now;
public string? HK_PLC_IP = ConfigurationManager.AppSettings["HKPlc_IP"];
@@ -72,17 +69,16 @@ namespace BPASmartClient.JXJFoodSmallStation.Model
public void Init()
{
- RecipeQueueTray.TryAdd(0, new ConcurrentQueue());
- RecipeQueueTray.TryAdd(1, new ConcurrentQueue());
- RecipeQueueTray.TryAdd(2, new ConcurrentQueue());
- RecipeQueueTray.TryAdd(3, new ConcurrentQueue());
- RecipeQueueTray.TryAdd(4, new ConcurrentQueue());
+ for (int i = 0; i < 5; i++)
+ {
+ RecipeQueueTray.TryAdd(i, new());
+ }
PlcVarMonitor();
StockBinNameWithPos();
RawMaterialNameWithCode();
RegisterInit();
DeviceConnect();
- //Json.Data.Recipes = TestData.GetInstance.Recipes;//添加测试数据
+ //Json.Data.RemoteRecipes = TestData.GetInstance.RemoteRecipes;//添加测试数据
TaskManage.GetInstance.StartLong(new Action(() =>
{
GVL_SmallStation.GetInstance.DisEnableStockAlarm = Json.Data.deviceConnectPar.ShieldStockbinAlarm;
@@ -91,7 +87,7 @@ namespace BPASmartClient.JXJFoodSmallStation.Model
GVL_SmallStation.GetInstance.HeartBeatToPlc = !GVL_SmallStation.GetInstance.HeartBeatToPlc;
HKDevice.HK_PLC_S7.Write("DB4.DBX0.0", GVL_SmallStation.GetInstance.HeartBeatToPlc);
GVL_SmallStation.GetInstance.HeartBeatFromPlc = HKDevice.HK_PLC_S7.Read("DB45.DBX0.0");
- if (DeviceInquire.GetInstance.devices.Count < 15 && HKDevice.IsConnected && Json.Data.Recipes.Count > 0 && GVL_SmallStation.GetInstance.DisEnableStockBinAlarm == false && DateTime.Now.Subtract(StockBinAlarmTime).TotalSeconds >= 60 & !GVL_SmallStation.GetInstance.DisEnableStockAlarm)
+ if (DeviceInquire.GetInstance.devices.Count < 15 && HKDevice.IsConnected && Json.Data.RemoteRecipes.Count > 0 && GVL_SmallStation.GetInstance.DisEnableStockBinAlarm == false && DateTime.Now.Subtract(StockBinAlarmTime).TotalSeconds >= 60 & !GVL_SmallStation.GetInstance.DisEnableStockAlarm)
{
HKDevice.HK_PLC_S7.Write("DB44.DBX3.0", true);
App.Current.Dispatcher.Invoke(() =>
@@ -168,6 +164,7 @@ namespace BPASmartClient.JXJFoodSmallStation.Model
///
private void HKPlcRead()
{
+ //读取配料PLC的DB3的值
if (HKDevice.IsConnected)
{
foreach (PropertyInfo item in typeof(PlcReadAddressDB3).GetProperties())
@@ -322,7 +319,7 @@ namespace BPASmartClient.JXJFoodSmallStation.Model
//GVL_SmallStation.GetInstance.Station2Cylinder = HKDevice.HK_PLC_S7.Read("DB3.DBX2.4");
//GVL_SmallStation.GetInstance.RobotStatus = HKDevice.HK_PLC_S7.Read("DB3.DBW100");
//GVL_SmallStation.GetInstance.RobotProgramNum = HKDevice.HK_PLC_S7.Read("DB3.DBB102");
- if (Json.Data.Recipes.Count <= 3)
+ if (Json.Data.RemoteRecipes.Count <= 3)
{
GVL_SmallStation.GetInstance.IsAllowSiemensSendRecipe = true;
}
@@ -333,8 +330,8 @@ namespace BPASmartClient.JXJFoodSmallStation.Model
GVL_SmallStation.GetInstance.RobotStatus = HKDevice.HK_PLC_S7.Read("DB3.DBB0");
GVL_SmallStation.GetInstance.RobotProgramNum = HKDevice.HK_PLC_S7.Read("DB3.DBB1");
}
- if (SiemensDevice.IsConnected)
- {
+ //if (SiemensDevice.IsConnected)
+ //{
ushort TrayCylinder = 0;
ushort TraySensor = 0;
if (GVL_SmallStation.GetInstance.Station1Sensor)
@@ -353,10 +350,10 @@ namespace BPASmartClient.JXJFoodSmallStation.Model
{
TrayCylinder = TrayCylinder.SetBitValue(0, false);
}
- this.SiemensDevice.Siemens_PLC_S7.Write("DB2231.DBX28.4", GVL_SmallStation.GetInstance.WindSendAllowAGVPutGet);
- this.SiemensDevice.Siemens_PLC_S7.Write("DB2231.DBW190", TraySensor);//添加工位传感器的信号
- this.SiemensDevice.Siemens_PLC_S7.Write("DB2231.DBW192", TrayCylinder);//添加工位气缸的信号
- ushort AGV_Put = (ushort)SiemensDevice.XL_Status.AgvFinishPut;
+ //this.SiemensDevice.Siemens_PLC_S7.Write("DB2231.DBX28.4", GVL_SmallStation.GetInstance.WindSendAllowAGVPutGet);
+ //this.SiemensDevice.Siemens_PLC_S7.Write("DB2231.DBW190", TraySensor);//添加工位传感器的信号
+ //this.SiemensDevice.Siemens_PLC_S7.Write("DB2231.DBW192", TrayCylinder);//添加工位气缸的信号
+ ushort AGV_Put =0 /*(ushort)SiemensDevice.XL_Status.AgvFinishPut*/;
if (AGV_Put.GetBitValue(1))
{
GVL_SmallStation.GetInstance.AGV_PutTray1Finish = true;
@@ -365,7 +362,7 @@ namespace BPASmartClient.JXJFoodSmallStation.Model
{
GVL_SmallStation.GetInstance.AGV_PutTray1Finish = false;
}
- ushort AGV_Get = (ushort)SiemensDevice.XL_Status.AgvFinishGet;
+ ushort AGV_Get =0/* (ushort)SiemensDevice.XL_Status.AgvFinishGet*/;
if (AGV_Get.GetBitValue(1))
{
GVL_SmallStation.GetInstance.AGV_GetTray1Finish = true;
@@ -374,7 +371,7 @@ namespace BPASmartClient.JXJFoodSmallStation.Model
{
GVL_SmallStation.GetInstance.AGV_GetTray1Finish = false;
}
- }
+ //}
}
public void CancelOrder()
@@ -384,7 +381,7 @@ namespace BPASmartClient.JXJFoodSmallStation.Model
if (!string.IsNullOrEmpty(GVL_SmallStation.GetInstance.Order_CancelRecipeCode))
{
string code = GVL_SmallStation.GetInstance.Order_CancelRecipeCode;
- int index = Array.FindIndex(Json.Data.Recipes.ToArray(), p => p.RecipeCode == code);
+ int index = Array.FindIndex(Json.Data.RemoteRecipes.ToArray(), p => p.RecipeCode == code);
int[] cnt = new int[5] { -1, -1, -1, -1, -1 };
int index1 = -1;
for (int i = 0; i < 5; i++)
@@ -442,21 +439,21 @@ namespace BPASmartClient.JXJFoodSmallStation.Model
}
break;
case 3:
- SiemensDevice.Siemens_PLC_S7.Write("DB2201.DBX450.1", true);
+ //SiemensDevice.Siemens_PLC_S7.Write("DB2201.DBX450.1", true);
GVL_SmallStation.GetInstance.OrderCancelStep = 4;
break;
case 4:
- if (SiemensDevice.Siemens_PLC_S7.Read("DB2201.DBX440.1") == false)
- {
- SiemensDevice.Siemens_PLC_S7.Write("DB2201.DBX450.1", false);
+ //if (SiemensDevice.Siemens_PLC_S7.Read("DB2201.DBX440.1") == false)
+ //{
+ // SiemensDevice.Siemens_PLC_S7.Write("DB2201.DBX450.1", false);
GVL_SmallStation.GetInstance.OrderCancelStep = 9;
MessageNotify.GetInstance.ShowRunLog($"队列1,西门子取消订单完成,订单号:{code}");
- }
+ //}
break;
case 9:
App.Current.Dispatcher.Invoke(() =>
{
- Json.Data.Recipes.RemoveAt(index);
+ Json.Data.RemoteRecipes.RemoveAt(index);
});
RecipeQueueTray1.TryDequeue(out code);
GVL_SmallStation.GetInstance.RecipeProcessStatus[index] = 0;
@@ -465,21 +462,21 @@ namespace BPASmartClient.JXJFoodSmallStation.Model
GVL_SmallStation.GetInstance.OrderCancelStep = 0;
break;
case 20:
- SiemensDevice.Siemens_PLC_S7.Write("DB2201.DBX450.1", true);
+ //SiemensDevice.Siemens_PLC_S7.Write("DB2201.DBX450.1", true);
GVL_SmallStation.GetInstance.OrderCancelStep = 21;
break;
case 21:
- if (SiemensDevice.Siemens_PLC_S7.Read("DB2201.DBX440.1") == false)
- {
- SiemensDevice.Siemens_PLC_S7.Write("DB2201.DBX450.1", false);
+ //if (SiemensDevice.Siemens_PLC_S7.Read("DB2201.DBX440.1") == false)
+ //{
+ // SiemensDevice.Siemens_PLC_S7.Write("DB2201.DBX450.1", false);
GVL_SmallStation.GetInstance.OrderCancelStep = 29;
MessageNotify.GetInstance.ShowRunLog($"队列1,西门子取消订单完成,订单号:{code}");
- }
+ //}
break;
case 29:
App.Current.Dispatcher.Invoke(() =>
{
- Json.Data.Recipes.RemoveAt(index);
+ Json.Data.RemoteRecipes.RemoveAt(index);
});
GVL_SmallStation.GetInstance.Order_Cancel = false;
GVL_SmallStation.GetInstance.Order_CancelRecipeCode = "";
@@ -489,16 +486,16 @@ namespace BPASmartClient.JXJFoodSmallStation.Model
//30-39为订单还未下发至上位机
case 30:
- SiemensDevice.Siemens_PLC_S7.Write("DB2201.DBX450.1", true);
+ //SiemensDevice.Siemens_PLC_S7.Write("DB2201.DBX450.1", true);
GVL_SmallStation.GetInstance.OrderCancelStep = 31;
break;
case 31:
- if (SiemensDevice.Siemens_PLC_S7.Read("DB2201.DBX440.1") == false)
- {
- SiemensDevice.Siemens_PLC_S7.Write("DB2201.DBX450.1", false);
+ //if (SiemensDevice.Siemens_PLC_S7.Read("DB2201.DBX440.1") == false)
+ //{
+ // SiemensDevice.Siemens_PLC_S7.Write("DB2201.DBX450.1", false);
GVL_SmallStation.GetInstance.OrderCancelStep = 39;
MessageNotify.GetInstance.ShowRunLog($"西门子取消订单完成,订单号:{code}");
- }
+ //}
break;
case 39:
GVL_SmallStation.GetInstance.Order_Cancel = false;
@@ -516,38 +513,38 @@ namespace BPASmartClient.JXJFoodSmallStation.Model
{
if (!GVL_SmallStation.GetInstance.IsUseLocalRecipe)
{
- RemoteRecipes = Json.Data.Recipes;
+ RemoteRecipes = Json.Data.RemoteRecipes;
if (RemoteRecipes.Count > 0)
{
foreach (var data in RemoteRecipes)
{
- if (data.TrayCode == 1)
- {
- if (SiemensDevice.XL_Status is XL_Status_DB status)
- {
+ //if (data.TrayCode == 1)
+ //{
+ //if (SiemensDevice.XL_Status is XL_Status_DB status)
+ //{
switch (GVL_SmallStation.GetInstance.SiemensSendRecipeStatus)
{
case 3:
- SiemensDevice.Siemens_PLC_S7.WriteString(2231, data.RecipeCode, 10);
- SiemensDevice.Siemens_PLC_S7.Write("DB2231.DBX28.0", true);
+ // SiemensDevice.Siemens_PLC_S7.WriteString(2231, data.RecipeCode, 10);
+ //SiemensDevice.Siemens_PLC_S7.Write("DB2231.DBX28.0", true);
GVL_SmallStation.GetInstance.SiemensSendRecipeStatus = 4;
MessageNotify.GetInstance.ShowRunLog($"配方{data.RecipeCode},请求配料");
break;
case 4:
- if (SiemensDevice.XL_Status.Dosing_Confirm)
- {
- SiemensDevice.Siemens_PLC_S7.WriteString(2231, "", 10);//复位字符串
- SiemensDevice.Siemens_PLC_S7.Write("DB2231.DBX28.0", false);
+ //if (SiemensDevice.XL_Status.Dosing_Confirm)
+ //{
+ // SiemensDevice.Siemens_PLC_S7.WriteString(2231, "", 10);//复位字符串
+ // SiemensDevice.Siemens_PLC_S7.Write("DB2231.DBX28.0", false);
GVL_SmallStation.GetInstance.SiemensSendRecipeStatus = 5;
MessageNotify.GetInstance.ShowRunLog($"配方{data.RecipeCode},西门子确认配料");
- }
+ // }
break;
case 5:
- if (SiemensDevice.XL_Status.Dosing_Confirm == false)
- {
+ //if (SiemensDevice.XL_Status.Dosing_Confirm == false)
+ //{
GVL_SmallStation.GetInstance.SiemensSendRecipeStatus = 6;
MessageNotify.GetInstance.ShowRunLog($"配方{data.RecipeCode},西门子确认配料信号复位完成");
- }
+ //}
break;
case 6:
for (int i = 0; i < 5; i++)
@@ -574,10 +571,10 @@ namespace BPASmartClient.JXJFoodSmallStation.Model
break;
default:
break;
- }
+ //}
}
- }
+ //}
}
}
else
@@ -593,13 +590,13 @@ namespace BPASmartClient.JXJFoodSmallStation.Model
}
else
{
- RemoteRecipes = Json.Data.Recipes;
+ RemoteRecipes = Json.Data.RemoteRecipes;
if (RemoteRecipes.Count > 0)
{
foreach (var data in RemoteRecipes)
{
- if (data.TrayCode == 1)
- {
+ //if (data.TrayCode == 1)
+ //{
for (int i = 0; i < 5; i++)
{
if (GVL_SmallStation.GetInstance.NotUseSmallStation)
@@ -619,7 +616,7 @@ namespace BPASmartClient.JXJFoodSmallStation.Model
}
}
}
- }
+ //}
}
}
else
@@ -639,6 +636,7 @@ namespace BPASmartClient.JXJFoodSmallStation.Model
///
private void RecipeInfoToHKPLC()
{
+ //五个工位AGV控制请求流程。
if (!GVL_SmallStation.GetInstance.NotUseSmallStation)
{
for (int i = 0; i < 5; i++)
@@ -657,7 +655,6 @@ namespace BPASmartClient.JXJFoodSmallStation.Model
break;
case 1:
if (GVL_SmallStation.GetInstance.Station1HaveTray)
-
{
HKDevice.HK_PLC_S7.Write("DB4.DBX8." + i, false);
GVL_SmallStation.GetInstance.Tray_AGVLogic[i] = 2;
@@ -688,11 +685,16 @@ namespace BPASmartClient.JXJFoodSmallStation.Model
}
}
}
+
+ //工位配料流程
foreach (var recipe in RecipeQueueTray)
{
+ //recipeNum就是托盘号,也就是工位号。
int recipeNum = recipe.Key;
+ //判断工位是否有配方。
if (RecipeQueueTray[recipeNum].Count > 0)
{
+ //从配方列表里根据配方号查找配方
int index = Array.FindIndex(RemoteRecipes.ToArray(), p => p.RecipeCode == RecipeQueueTray[recipeNum].ElementAt(0));
if (index >= 0 && index < RemoteRecipes.Count)
{
@@ -700,51 +702,53 @@ namespace BPASmartClient.JXJFoodSmallStation.Model
int trayCode = RemoteRecipes.ElementAt(index).TrayCode;
string recipeName = RemoteRecipes.ElementAt(index).RecipeName;
string windSend = RemoteRecipes.ElementAt(index).ToString();
+ //当前只配托盘号为1 ,即工位1 的配方。
if (trayCode == 1)
{
+ //如果不使用小料站配料,目前没有这种工作情况。
if (GVL_SmallStation.GetInstance.NotUseSmallStation)
{
if (GVL_SmallStation.GetInstance.AGV_PutTray1Finish)
{
Thread.Sleep(5000);
- var res = Json.Data.Recipes.FirstOrDefault(p => p.RecipeCode == code);
- if (SiemensDevice.IsConnected && !GVL_SmallStation.GetInstance.IsUseLocalRecipe)
- {
- RecipeFinishInfo.Order_No = RemoteRecipes.ElementAt(index).RecipeCode;
- RecipeFinishInfo.Product_Code = RemoteRecipes.ElementAt(index).RecipeName;
- RecipeFinishInfo.Job_No = (short)trayCode;
- for (int i = 0; i < 20; i++)
- {
- RecipeFinishInfo.Material[i] = new UDT1();
- }
- for (int i = 0; i < 10; i++)
- {
- RecipeFinishInfo.Powder[i] = new UDT2();
- }
- for (int i = 0; i < RemoteRecipes.ElementAt(index).RawMaterial.Count; i++)
- {
- RecipeFinishInfo.Material[i].Material_Name = RemoteRecipes.ElementAt(index).RawMaterial.ElementAt(i).RawMaterialName;
- RecipeFinishInfo.Material[i].Material_BarrelNum = RemoteRecipes.ElementAt(index).RawMaterial.ElementAt(i).RawMaterialBarrelNum;
- RecipeFinishInfo.Material[i].Material_Laying_Off_Weight = RemoteRecipes.ElementAt(index).RawMaterial.ElementAt(i).Laying_Off_Weight * (float)0.001;
- }
- for (int i = 0; i < RemoteRecipes.ElementAt(index).WindSend.Count; i++)
- {
- RecipeFinishInfo.Powder[i].Powder_Weight = RemoteRecipes.ElementAt(index).WindSend.ElementAt(i).DosingCompleWeight;
- }
- RecipeFinishInfo.Ask_For_Finish = true;
- RecipeFinishInfo.DosingTime = Convert.ToInt16(0);
- SiemensDevice.Siemens_PLC_S7.WriteClass(RecipeFinishInfo, 2261);
+ var res = Json.Data.RemoteRecipes.FirstOrDefault(p => p.RecipeCode == code);
+ //if (SiemensDevice.IsConnected && !GVL_SmallStation.GetInstance.IsUseLocalRecipe)
+ //{
+ // RecipeFinishInfo.Order_No = RemoteRecipes.ElementAt(index).RecipeCode;
+ // RecipeFinishInfo.Product_Code = RemoteRecipes.ElementAt(index).RecipeName;
+ // RecipeFinishInfo.Job_No = (short)trayCode;
+ // for (int i = 0; i < 20; i++)
+ // {
+ // RecipeFinishInfo.Material[i] = new UDT1();
+ // }
+ // for (int i = 0; i < 10; i++)
+ // {
+ // RecipeFinishInfo.Powder[i] = new UDT2();
+ // }
+ // for (int i = 0; i < RemoteRecipes.ElementAt(index).RawMaterial.Count; i++)
+ // {
+ // RecipeFinishInfo.Material[i].Material_Name = RemoteRecipes.ElementAt(index).RawMaterial.ElementAt(i).RawMaterialName;
+ // RecipeFinishInfo.Material[i].Material_BarrelNum = RemoteRecipes.ElementAt(index).RawMaterial.ElementAt(i).RawMaterialBarrelNum;
+ // RecipeFinishInfo.Material[i].Material_Laying_Off_Weight = RemoteRecipes.ElementAt(index).RawMaterial.ElementAt(i).Laying_Off_Weight * (float)0.001;
+ // }
+ // for (int i = 0; i < RemoteRecipes.ElementAt(index).WindSend.Count; i++)
+ // {
+ // RecipeFinishInfo.Powder[i].Powder_Weight = RemoteRecipes.ElementAt(index).WindSend.ElementAt(i).DosingCompleWeight;
+ // }
+ // RecipeFinishInfo.Ask_For_Finish = true;
+ // RecipeFinishInfo.DosingTime = Convert.ToInt16(0);
+ // SiemensDevice.Siemens_PLC_S7.WriteClass(RecipeFinishInfo, 2261);
- MessageNotify.GetInstance.ShowRunLog($"托盘1,配方{res.RecipeName},配料完成,数据反馈给西门子");
- }
- else
+ // MessageNotify.GetInstance.ShowRunLog($"托盘1,配方{res.RecipeName},配料完成,数据反馈给西门子");
+ //}
+ //else
{
MessageNotify.GetInstance.ShowRunLog($"托盘1,配方{res.RecipeName},配料完成,数据无法反馈给西门子,西门子设备未连接或处于本地配方");
}
GVL_SmallStation.GetInstance.WindSendDosing = false;
App.Current.Dispatcher.Invoke(() =>
{
- Json.Data.Recipes.Remove(res);
+ Json.Data.RemoteRecipes.Remove(res);
});
RecipeQueueTray[recipeNum].TryDequeue(out code);
GVL_SmallStation.GetInstance.RecipeStockBinDosing[recipeNum] = 0;
@@ -760,9 +764,11 @@ namespace BPASmartClient.JXJFoodSmallStation.Model
{
if (GVL_SmallStation.GetInstance.WindSendDosingStatus == 1)
{
+ //清空风送配料数据
WindSend_Write WindSendData111 = new WindSend_Write();
WindSendDevice.Siemens_PLC_S7.WriteClass(WindSendData111, 95);
Thread.Sleep(200);
+ //设置DB95数据并下发。
WindSendData111.TargetRecipeCode = code;
WindSendData111.IsAllowDosing = true;
foreach (var item in RemoteRecipes.ElementAt(index).WindSend)
@@ -795,6 +801,7 @@ namespace BPASmartClient.JXJFoodSmallStation.Model
}
GVL_SmallStation.GetInstance.WindSendDosing = true;
GVL_SmallStation.GetInstance.WindSendDosingStatus = 2;
+ //下发配料数据
WindSendDevice.Siemens_PLC_S7.WriteClass(WindSendData111, 95);
}
}
@@ -807,30 +814,39 @@ namespace BPASmartClient.JXJFoodSmallStation.Model
}
}
}
+ //如果小料仓配方下发状态为0(未下发),则下发配方。并清除该工位配方的配料情况信号。
if (GVL_SmallStation.GetInstance.RecipeProcessStatus[recipeNum] == 0)
{
GVL_SmallStation.GetInstance.RecipeStockBinDosing[recipeNum] = 0;
+ //下发工单,并置位工单下发确认。
HKDevice.IssueRecipeToPlc(RemoteRecipes.ElementAt(index).RawMaterial, recipeNum);
HKDevice.HK_PLC_S7.Write("DB4.DBX2." + recipeNum, true);
+ //下发完成,等待开始制作。
GVL_SmallStation.GetInstance.DosingTime[recipeNum] = DateTime.Now;
GVL_SmallStation.GetInstance.RecipeProcessStatus[recipeNum] = 1;
MessageNotify.GetInstance.ShowRunLog($"托盘1,配方编号{code},配方号{recipeNum + 1},下发完成");
}
+ //确认是否收到工单
bool recipeReceviceFinish = HKDevice.HK_PLC_S7.Read("DB3.DBX4." + recipeNum);
if (recipeReceviceFinish && GVL_SmallStation.GetInstance.RecipeProcessStatus[recipeNum] == 1)
{
+ //确认PLC收到工单后,复位下发确认信号。
HKDevice.HK_PLC_S7.Write("DB4.DBX2." + recipeNum, false);
GVL_SmallStation.GetInstance.RecipeProcessStatus[recipeNum] = 2;
GVL_SmallStation.GetInstance.StockBinDosingIssue[recipeNum] = 0;
MessageNotify.GetInstance.ShowRunLog($"托盘1,配方编号{code},配方号{recipeNum + 1},配方接收完成");
}
+ //粉料仓完毕,开始控制小料仓味魔方配料。
if (GVL_SmallStation.GetInstance.RecipeProcessStatus[recipeNum] == 2)
{
+ //味魔方配料。
for (byte i = 1; i < 16; i++)
{
+ //indexArr是各配方位置反馈。
int indexArr = -1;
if (GVL_SmallStation.GetInstance.plcReadDataDB3.StockBinAllowIssue[i - 1])
{
+ //根据配方号查找各配方的三个桶的位置反馈。位置反馈用的是ushort转16位2进制表示。
switch (recipeNum)
{
case 0:
@@ -849,10 +865,12 @@ namespace BPASmartClient.JXJFoodSmallStation.Model
indexArr = Array.FindIndex(GVL_SmallStation.GetInstance.plcReadDataDB3.Recipe5BarrelPosReserve.ToArray(), p => p == i);
break;
}
+ //如果料桶已经到位但没有配料完成信号。
if (indexArr >= 0 && GVL_SmallStation.GetInstance.StockBinDosingIssue[recipeNum].GetBitValue((byte)i) == false)
{
int loc_index = Array.FindIndex(RemoteRecipes.ElementAt(index).RawMaterial.ToArray(), p => p.RawMaterialLocation == i);
float weight = RemoteRecipes.ElementAt(index).RawMaterial.ElementAt(loc_index).RawMaterialWeight * 1000;//单位g转换kg
+ //如果重量为0,即不需要配料。则直接设为配料完成。
if (weight <= 0)
{
if (i >= 1 && i <= 8)
@@ -870,6 +888,7 @@ namespace BPASmartClient.JXJFoodSmallStation.Model
}
else
{
+ //下发小料仓味魔方配料指令。
if (loc_index >= 0)
{
DeviceInquire.GetInstance.GetDevice((int)i)?.Start(weight);//根据料仓编号 启动并写入每个原料重量
@@ -886,6 +905,7 @@ namespace BPASmartClient.JXJFoodSmallStation.Model
{
//MessageNotify.GetInstance.ShowRunLog($"错误,有允许配料信号,但没有相应的位置 和桶号");
}
+ //味魔方配料完成后处理。
if ((DeviceInquire.GetInstance.GetDevice(i).deviceStatus.RunStatus == 3) && indexArr >= 0 && GVL_SmallStation.GetInstance.RecipeStockBinDosing[recipeNum].GetBitValue((byte)i))
{
int res = Array.FindIndex(RemoteRecipes.ElementAt(index).RawMaterial.ToArray(), p => p.RawMaterialLocation == i);
@@ -895,10 +915,15 @@ namespace BPASmartClient.JXJFoodSmallStation.Model
}
else
{
+ //配料完成后,先延时一段时间再复位。
Thread.Sleep(GVL_SmallStation.GetInstance.Time);
+ //获取实际下料重量后复位配料完成状态。
RemoteRecipes.ElementAt(index).RawMaterial.ElementAt(res).Laying_Off_Weight = DeviceInquire.GetInstance.GetDevice(i).deviceStatus.NowWeightFeedback;
bool info = DeviceInquire.GetInstance.GetDevice(i).StatusReset();
+
MessageNotify.GetInstance.ShowRunLog($"柔性味魔方,托盘1,配方:{recipeName},{i}号仓,配料完成,下料完成重量:{RemoteRecipes.ElementAt(index).RawMaterial.ElementAt(res).Laying_Off_Weight}");
+
+ //计算误差范围是否在允许范围内,如果超出范围,则报警。
float AlarmRange = Math.Abs(RemoteRecipes.ElementAt(index).RawMaterial.ElementAt(res).Laying_Off_Weight - RemoteRecipes.ElementAt(index).RawMaterial.ElementAt(res).RawMaterialWeight * 1000);
int iIndex = Array.FindIndex(Json.Data.deviceParModels.ToArray(), p => p.MaterialName == DeviceInquire.GetInstance.GetDevice(i).DeviceName);
if (iIndex >= 0)
@@ -913,6 +938,7 @@ namespace BPASmartClient.JXJFoodSmallStation.Model
});
}
}
+ //置位味魔方配料完成信号。
if (i >= 1 && i <= 8)
{
string commInfo = HKDevice.HK_PLC_S7.Write("DB4.DBX12." + (i - 1), true);
@@ -929,6 +955,8 @@ namespace BPASmartClient.JXJFoodSmallStation.Model
}
}
}
+
+ //接收到工单配料完成上升沿后。
bool DosingComple = HKDevice.HK_PLC_S7.Read("DB3.DBX6." + recipeNum);
if ((RTrig.GetInstance("配方配料完成").Start(DosingComple)) || (GVL_SmallStation.GetInstance.StockBinDosingIssue[recipeNum] > 0 && DosingComple))
{
@@ -937,50 +965,52 @@ namespace BPASmartClient.JXJFoodSmallStation.Model
if (GVL_SmallStation.GetInstance.RecipeStockBinDosing[recipeNum] > 0)
{
for (int i = 1; i < 17; i++)
- {
+ {//看不懂
if (GVL_SmallStation.GetInstance.RecipeStockBinDosing[recipeNum].GetBitValue((byte)i))
{
MessageNotify.GetInstance.ShowRunLog($"料仓配料完成,但存在料仓未配料:{i}号仓");
}
}
}
- var res = Json.Data.Recipes.FirstOrDefault(p => p.RecipeCode == code);
+ var res = Json.Data.RemoteRecipes.FirstOrDefault(p => p.RecipeCode == code);
double a = DateTime.Now.Subtract(GVL_SmallStation.GetInstance.DosingTime[recipeNum]).TotalSeconds;
foreach (var item in RemoteRecipes.ElementAt(index).RawMaterial)
{
MessageNotify.GetInstance.ShowRunLog($"{item.RawMaterialName},下料重量:{item.Laying_Off_Weight}g");
}
- if (SiemensDevice.IsConnected && !GVL_SmallStation.GetInstance.IsUseLocalRecipe)
- {
- RecipeFinishInfo.Order_No = RemoteRecipes.ElementAt(index).RecipeCode;
- RecipeFinishInfo.Product_Code = RemoteRecipes.ElementAt(index).RecipeName;
- RecipeFinishInfo.Job_No = (short)trayCode;
- for (int i = 0; i < 20; i++)
- {
- RecipeFinishInfo.Material[i] = new UDT1();
- }
- for (int i = 0; i < 10; i++)
- {
- RecipeFinishInfo.Powder[i] = new UDT2();
- }
- for (int i = 0; i < RemoteRecipes.ElementAt(index).RawMaterial.Count; i++)
- {
- RecipeFinishInfo.Material[i].Material_Name = RemoteRecipes.ElementAt(index).RawMaterial.ElementAt(i).RawMaterialName;
- RecipeFinishInfo.Material[i].Material_BarrelNum = RemoteRecipes.ElementAt(index).RawMaterial.ElementAt(i).RawMaterialBarrelNum;
- RecipeFinishInfo.Material[i].Material_Laying_Off_Weight = RemoteRecipes.ElementAt(index).RawMaterial.ElementAt(i).Laying_Off_Weight * (float)0.001;
- }
- for (int i = 0; i < RemoteRecipes.ElementAt(index).WindSend.Count; i++)
- {
- RecipeFinishInfo.Powder[i].Powder_Weight = RemoteRecipes.ElementAt(index).WindSend.ElementAt(i).DosingCompleWeight;
- }
- RecipeFinishInfo.Ask_For_Finish = true;
- RecipeFinishInfo.DosingTime = Convert.ToInt16(a);
- SiemensDevice.Siemens_PLC_S7.WriteClass(RecipeFinishInfo, 2261);
+ //if (SiemensDevice.IsConnected && !GVL_SmallStation.GetInstance.IsUseLocalRecipe)
+ //{
+ // RecipeFinishInfo.Order_No = RemoteRecipes.ElementAt(index).RecipeCode;
+ // RecipeFinishInfo.Product_Code = RemoteRecipes.ElementAt(index).RecipeName;
+ // RecipeFinishInfo.Job_No = (short)trayCode;
+ // for (int i = 0; i < 20; i++)
+ // {
+ // RecipeFinishInfo.Material[i] = new UDT1();
+ // }
+ // for (int i = 0; i < 10; i++)
+ // {
+ // RecipeFinishInfo.Powder[i] = new UDT2();
+ // }
+ // for (int i = 0; i < RemoteRecipes.ElementAt(index).RawMaterial.Count; i++)
+ // {
+ // RecipeFinishInfo.Material[i].Material_Name = RemoteRecipes.ElementAt(index).RawMaterial.ElementAt(i).RawMaterialName;
+ // RecipeFinishInfo.Material[i].Material_BarrelNum = RemoteRecipes.ElementAt(index).RawMaterial.ElementAt(i).RawMaterialBarrelNum;
+ // RecipeFinishInfo.Material[i].Material_Laying_Off_Weight = RemoteRecipes.ElementAt(index).RawMaterial.ElementAt(i).Laying_Off_Weight * (float)0.001;
+ // }
+ // for (int i = 0; i < RemoteRecipes.ElementAt(index).WindSend.Count; i++)
+ // {
+ // RecipeFinishInfo.Powder[i].Powder_Weight = RemoteRecipes.ElementAt(index).WindSend.ElementAt(i).DosingCompleWeight;
+ // }
+ // RecipeFinishInfo.Ask_For_Finish = true;
+ // RecipeFinishInfo.DosingTime = Convert.ToInt16(a);
+ // SiemensDevice.Siemens_PLC_S7.WriteClass(RecipeFinishInfo, 2261);
- MessageNotify.GetInstance.ShowRunLog($"托盘1,配方{res.RecipeName},配料完成,数据反馈给西门子");
- MessageNotify.GetInstance.ShowRecipeLog(res.RecipeName);
- }
- else
+ // MessageNotify.GetInstance.ShowRunLog($"托盘1,配方{res.RecipeName},配料完成,数据反馈给西门子");
+ // MessageNotify.GetInstance.ShowRecipeLog(res.RecipeName);
+ //}
+ //else
+
+ //TODO:发送配方制作完成反馈到服务系统。
{
MessageNotify.GetInstance.ShowRunLog($"托盘1,配方{res.RecipeName},配料完成,数据无法反馈给西门子,西门子设备未连接或处于本地配方");
MessageNotify.GetInstance.ShowRecipeLog(res.RecipeName);
@@ -988,7 +1018,7 @@ namespace BPASmartClient.JXJFoodSmallStation.Model
GVL_SmallStation.GetInstance.WindSendDosing = false;
App.Current.Dispatcher.Invoke(() =>
{
- Json.Data.Recipes.Remove(res);
+ Json.Data.RemoteRecipes.Remove(res);
});
RecipeQueueTray[recipeNum].TryDequeue(out code);
GVL_SmallStation.GetInstance.RecipeStockBinDosing[recipeNum] = 0;
@@ -1001,6 +1031,9 @@ namespace BPASmartClient.JXJFoodSmallStation.Model
}
}
}
+ ///
+ /// 复位料仓状态。
+ ///
private void StockBinInit()
{
for (int i = 1; i < 16; i++)
@@ -1029,10 +1062,11 @@ namespace BPASmartClient.JXJFoodSmallStation.Model
}
}
///
- /// PLC的DB3变量列表
+ /// PLC的变量列表
///
public void PlcVarMonitor()
{
+ //海科的DB3
foreach (PropertyInfo item in typeof(PlcReadAddressDB3).GetProperties())
{
if (Attribute.IsDefined(item, typeof(VarCommAttribute)))
@@ -1049,7 +1083,7 @@ namespace BPASmartClient.JXJFoodSmallStation.Model
});
}
}
-
+ //风送PLC的DB94状态反馈
foreach (PropertyInfo item in typeof(WindSend_Read).GetProperties())
{
if (Attribute.IsDefined(item, typeof(VarCommAttribute)))
@@ -1101,6 +1135,9 @@ namespace BPASmartClient.JXJFoodSmallStation.Model
}
}
}
+ ///
+ /// 操作委托注册。
+ ///
public void RegisterInit()
{
//手动控制气缸 DB5.DBX0.0~DB5.DBX4.5
@@ -1285,8 +1322,8 @@ namespace BPASmartClient.JXJFoodSmallStation.Model
{
ObservableCollection RawMaterials = new ObservableCollection();
ObservableCollection WindSendData = new ObservableCollection();
- if (SiemensDevice.IsConnected)
- {
+ //if (SiemensDevice.IsConnected)
+ //{
if (res != null && res is XL_Start_DB recipe)
{
if (!string.IsNullOrEmpty(recipe.RecipeCode))
@@ -1333,7 +1370,7 @@ namespace BPASmartClient.JXJFoodSmallStation.Model
}
App.Current.Dispatcher.Invoke(() =>
{
- Json.Data.Recipes.Add(new RemoteRecipeData()
+ Json.Data.RemoteRecipes.Add(new RecipeData()
{
RecipeName = recipe.RecipeName,
RecipeCode = recipe.RecipeCode,
@@ -1344,16 +1381,16 @@ namespace BPASmartClient.JXJFoodSmallStation.Model
});
}
}
- }
+ //}
}), "SiemensRecipeRecive", true);
//将本地配方发送到西门子配方里,执行配料
ActionManage.GetInstance.Register(new Action