@@ -0,0 +1,31 @@ | |||||
using System; | |||||
using System.Collections.Generic; | |||||
using System.Globalization; | |||||
using System.Linq; | |||||
using System.Text; | |||||
using System.Threading.Tasks; | |||||
using System.Windows.Data; | |||||
using System.Windows.Media; | |||||
namespace BPASmartClient.CustomResource.Converters | |||||
{ | |||||
public class RecipeStatusConvert : IValueConverter | |||||
{ | |||||
public object Convert(object value, Type targetType, object parameter, CultureInfo culture) | |||||
{ | |||||
if (value != null) | |||||
{ | |||||
if (value.ToString() == "等待制作") | |||||
return Brushes.Yellow; | |||||
else if (value.ToString() == "制作完成") | |||||
return Brushes.Green; | |||||
} | |||||
return default; | |||||
} | |||||
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) | |||||
{ | |||||
throw new NotImplementedException(); | |||||
} | |||||
} | |||||
} |
@@ -39,7 +39,8 @@ namespace BPASmartClient.JXJFoodBigStation.Model | |||||
/// 订单请求 | /// 订单请求 | ||||
/// </summary> | /// </summary> | ||||
public static bool Order_Request { get; set; } = false; | public static bool Order_Request { get; set; } = false; | ||||
public static int SiemensSendRecipeStatus { get; set; } = 0; | |||||
public const int StockBinNum = 12; | |||||
public const int Max_DosingSotckBinNum = 14; | |||||
} | } | ||||
} | } |
@@ -49,12 +49,12 @@ namespace BPASmartClient.JXJFoodBigStation.Model | |||||
ActionManage.GetInstance.Register(new Action<object>((res) => | ActionManage.GetInstance.Register(new Action<object>((res) => | ||||
{ | { | ||||
ObservableCollection<RawMaterial> RawMaterials = new ObservableCollection<RawMaterial>(); | ObservableCollection<RawMaterial> RawMaterials = new ObservableCollection<RawMaterial>(); | ||||
if (SiemensDevice.IsConnected ||true) | |||||
if (SiemensDevice.IsConnected) | |||||
{ | { | ||||
if (res != null && res is DL_Start_DB recipe) | if (res != null && res is DL_Start_DB recipe) | ||||
{ | { | ||||
RawMaterials.Clear(); | RawMaterials.Clear(); | ||||
for (int i = 0; i < 12; i++) | |||||
for (int i = 0; i < GVL_BigStation.Max_DosingSotckBinNum; i++) | |||||
{ | { | ||||
if (RawMaterialsNamePos.ContainsKey(recipe.Material[i].Material_Name)) | if (RawMaterialsNamePos.ContainsKey(recipe.Material[i].Material_Name)) | ||||
{ | { | ||||
@@ -71,12 +71,15 @@ namespace BPASmartClient.JXJFoodBigStation.Model | |||||
//报警,配方的原料名称下发和设备不一致 | //报警,配方的原料名称下发和设备不一致 | ||||
} | } | ||||
} | } | ||||
Json<RemoteRecipe>.Data.Recipes.Add(new RecipeData() | |||||
App.Current.Dispatcher.Invoke(() => | |||||
{ | { | ||||
RecipeName = recipe.RecipeName, | |||||
RecipeCode = recipe.RecipeCode, | |||||
RawMaterial = RawMaterials, | |||||
//TrayCode = recipe.Order_No, | |||||
Json<RemoteRecipe>.Data.Recipes.Add(new RecipeData() | |||||
{ | |||||
RecipeName = recipe.RecipeName, | |||||
RecipeCode = recipe.RecipeCode, | |||||
RawMaterial = RawMaterials, | |||||
TrayCode = recipe.Job_No, | |||||
}); | |||||
}); | }); | ||||
} | } | ||||
} | } | ||||
@@ -86,7 +89,7 @@ namespace BPASmartClient.JXJFoodBigStation.Model | |||||
try | try | ||||
{ | { | ||||
//HKDevice.HK_PLC_S7.Connect(S7.Net.CpuType.S71500, HK_PLC_IP); | //HKDevice.HK_PLC_S7.Connect(S7.Net.CpuType.S71500, HK_PLC_IP); | ||||
//SiemensDevice.Siemens_PLC_S7.Connect(S7.Net.CpuType.S71500, Siemens_PLC_IP); | |||||
SiemensDevice.Siemens_PLC_S7.Connect(S7.Net.CpuType.S71500, Siemens_PLC_IP); | |||||
if (HKDevice.IsConnected) | if (HKDevice.IsConnected) | ||||
{ | { | ||||
HKDevice.Init(); | HKDevice.Init(); | ||||
@@ -132,25 +135,134 @@ namespace BPASmartClient.JXJFoodBigStation.Model | |||||
{ | { | ||||
foreach (var data in Recipes) | foreach (var data in Recipes) | ||||
{ | { | ||||
if (RecipeQueue1.Count == 0 && !RecipeQueue2.Contains(data.RecipeCode) && !RecipeQueue3.Contains(data.RecipeCode) && !RecipeQueue4.Contains(data.RecipeCode)) | |||||
if (RecipeQueue1.Count == 0 && !RecipeQueue2.Contains(data.RecipeCode) && !RecipeQueue3.Contains(data.RecipeCode) && !RecipeQueue4.Contains(data.RecipeCode)) | |||||
{ | { | ||||
if (!(RecipeQueue1.Contains(data.RecipeCode))) | if (!(RecipeQueue1.Contains(data.RecipeCode))) | ||||
RecipeQueue1.Enqueue(data.RecipeCode); | |||||
{ | |||||
if (SiemensDevice.DL_Status is DL_Status_DB status) | |||||
{ | |||||
if (GVL_BigStation.SiemensSendRecipeStatus == 3) | |||||
{ | |||||
GVL_BigStation.SiemensSendRecipeStatus = 4; | |||||
SiemensDevice.Siemens_PLC_S7.WriteString(2331, data.RecipeCode, 10); | |||||
SiemensDevice.Siemens_PLC_S7.Write("DB2331.DBX28.0", true); | |||||
} | |||||
if (GVL_BigStation.SiemensSendRecipeStatus == 4) | |||||
{ | |||||
if (SiemensDevice.DL_Status.Dosing_Start_ACK) | |||||
{ | |||||
GVL_BigStation.SiemensSendRecipeStatus = 5; | |||||
SiemensDevice.Siemens_PLC_S7.WriteString(2331, "", 10); | |||||
SiemensDevice.Siemens_PLC_S7.Write("DB2331.DBX28.0", false); | |||||
} | |||||
} | |||||
if (GVL_BigStation.SiemensSendRecipeStatus == 5) | |||||
{ | |||||
if (SiemensDevice.DL_Status.Dosing_Start_ACK == false) | |||||
{ | |||||
GVL_BigStation.SiemensSendRecipeStatus = 6; | |||||
RecipeQueue1.Enqueue(data.RecipeCode); | |||||
} | |||||
} | |||||
} | |||||
} | |||||
} | } | ||||
else if (RecipeQueue2.Count == 0 && !RecipeQueue1.Contains(data.RecipeCode) && !RecipeQueue3.Contains(data.RecipeCode) && !RecipeQueue4.Contains(data.RecipeCode)) | |||||
else if (RecipeQueue2.Count == 0 && !RecipeQueue1.Contains(data.RecipeCode) && !RecipeQueue3.Contains(data.RecipeCode) && !RecipeQueue4.Contains(data.RecipeCode)) | |||||
{ | { | ||||
if (!(RecipeQueue2.Contains(data.RecipeCode))) | if (!(RecipeQueue2.Contains(data.RecipeCode))) | ||||
RecipeQueue2.Enqueue(data.RecipeCode); | |||||
{ | |||||
if (SiemensDevice.DL_Status is DL_Status_DB status) | |||||
{ | |||||
if (GVL_BigStation.SiemensSendRecipeStatus == 3) | |||||
{ | |||||
GVL_BigStation.SiemensSendRecipeStatus = 4; | |||||
SiemensDevice.Siemens_PLC_S7.WriteString(2331, data.RecipeCode, 10); | |||||
SiemensDevice.Siemens_PLC_S7.Write("DB2331.DBX28.0", true); | |||||
} | |||||
if (GVL_BigStation.SiemensSendRecipeStatus == 4) | |||||
{ | |||||
if (SiemensDevice.DL_Status.Dosing_Start_ACK) | |||||
{ | |||||
GVL_BigStation.SiemensSendRecipeStatus = 5; | |||||
SiemensDevice.Siemens_PLC_S7.WriteString(2331, "", 10); | |||||
SiemensDevice.Siemens_PLC_S7.Write("DB3231.DBX28.0", false); | |||||
} | |||||
} | |||||
if (GVL_BigStation.SiemensSendRecipeStatus == 5) | |||||
{ | |||||
if (SiemensDevice.DL_Status.Dosing_Start_ACK == false) | |||||
{ | |||||
GVL_BigStation.SiemensSendRecipeStatus = 6; | |||||
RecipeQueue2.Enqueue(data.RecipeCode); | |||||
} | |||||
} | |||||
} | |||||
} | |||||
} | } | ||||
else if (RecipeQueue3.Count == 0 && !RecipeQueue1.Contains(data.RecipeCode) && !RecipeQueue2.Contains(data.RecipeCode) && !RecipeQueue4.Contains(data.RecipeCode)) | else if (RecipeQueue3.Count == 0 && !RecipeQueue1.Contains(data.RecipeCode) && !RecipeQueue2.Contains(data.RecipeCode) && !RecipeQueue4.Contains(data.RecipeCode)) | ||||
{ | { | ||||
if (!(RecipeQueue3.Contains(data.RecipeCode))) | |||||
RecipeQueue3.Enqueue(data.RecipeCode); | |||||
if (!(RecipeQueue3.Contains(data.RecipeCode))) | |||||
{ | |||||
if (SiemensDevice.DL_Status is DL_Status_DB status) | |||||
{ | |||||
if (GVL_BigStation.SiemensSendRecipeStatus == 3) | |||||
{ | |||||
GVL_BigStation.SiemensSendRecipeStatus = 4; | |||||
SiemensDevice.Siemens_PLC_S7.WriteString(2331, data.RecipeCode, 10); | |||||
SiemensDevice.Siemens_PLC_S7.Write("DB2331.DBX28.0", true); | |||||
} | |||||
if (GVL_BigStation.SiemensSendRecipeStatus == 4) | |||||
{ | |||||
if (SiemensDevice.DL_Status.Dosing_Start_ACK) | |||||
{ | |||||
GVL_BigStation.SiemensSendRecipeStatus = 5; | |||||
SiemensDevice.Siemens_PLC_S7.WriteString(2331, "", 10); | |||||
SiemensDevice.Siemens_PLC_S7.Write("DB3231.DBX28.0", false); | |||||
} | |||||
} | |||||
if (GVL_BigStation.SiemensSendRecipeStatus == 5) | |||||
{ | |||||
if (SiemensDevice.DL_Status.Dosing_Start_ACK == false) | |||||
{ | |||||
GVL_BigStation.SiemensSendRecipeStatus = 6; | |||||
RecipeQueue3.Enqueue(data.RecipeCode); | |||||
} | |||||
} | |||||
} | |||||
} | |||||
} | } | ||||
else if (RecipeQueue4.Count == 0 && !RecipeQueue1.Contains(data.RecipeCode) && !RecipeQueue2.Contains(data.RecipeCode) && !RecipeQueue3.Contains(data.RecipeCode)) | else if (RecipeQueue4.Count == 0 && !RecipeQueue1.Contains(data.RecipeCode) && !RecipeQueue2.Contains(data.RecipeCode) && !RecipeQueue3.Contains(data.RecipeCode)) | ||||
{ | { | ||||
if (!(RecipeQueue4.Contains(data.RecipeCode))) | |||||
RecipeQueue4.Enqueue(data.RecipeCode); | |||||
if (!(RecipeQueue4.Contains(data.RecipeCode))) | |||||
{ | |||||
if (SiemensDevice.DL_Status is DL_Status_DB status) | |||||
{ | |||||
if (GVL_BigStation.SiemensSendRecipeStatus == 3) | |||||
{ | |||||
GVL_BigStation.SiemensSendRecipeStatus = 4; | |||||
SiemensDevice.Siemens_PLC_S7.WriteString(2331, data.RecipeCode, 10); | |||||
SiemensDevice.Siemens_PLC_S7.Write("DB2331.DBX28.0", true); | |||||
} | |||||
if (GVL_BigStation.SiemensSendRecipeStatus == 4) | |||||
{ | |||||
if (SiemensDevice.DL_Status.Dosing_Start_ACK) | |||||
{ | |||||
GVL_BigStation.SiemensSendRecipeStatus = 5; | |||||
SiemensDevice.Siemens_PLC_S7.WriteString(2331, "", 10); | |||||
SiemensDevice.Siemens_PLC_S7.Write("DB3231.DBX28.0", false); | |||||
} | |||||
} | |||||
if (GVL_BigStation.SiemensSendRecipeStatus == 5) | |||||
{ | |||||
if (SiemensDevice.DL_Status.Dosing_Start_ACK == false) | |||||
{ | |||||
GVL_BigStation.SiemensSendRecipeStatus = 6; | |||||
RecipeQueue4.Enqueue(data.RecipeCode); | |||||
} | |||||
} | |||||
} | |||||
} | |||||
} | } | ||||
} | } | ||||
} | } | ||||
@@ -266,6 +378,8 @@ namespace BPASmartClient.JXJFoodBigStation.Model | |||||
} | } | ||||
if (SiemensDevice.IsConnected) | if (SiemensDevice.IsConnected) | ||||
{ | { | ||||
FinishData.Ask_For_Finish = true; | |||||
GVL_BigStation.SiemensSendRecipeStatus = 7; | |||||
SiemensDevice.Siemens_PLC_S7.WriteClass<DL_Finish_DB>(FinishData, 2361); | SiemensDevice.Siemens_PLC_S7.WriteClass<DL_Finish_DB>(FinishData, 2361); | ||||
} | } | ||||
RecipeQueue1.TryDequeue(out code); | RecipeQueue1.TryDequeue(out code); | ||||
@@ -705,6 +819,22 @@ namespace BPASmartClient.JXJFoodBigStation.Model | |||||
RawMaterialsNamePos.Clear(); | RawMaterialsNamePos.Clear(); | ||||
if (!HKDevice.IsConnected) | if (!HKDevice.IsConnected) | ||||
{ | { | ||||
RawMaterialsNamePos.Add("A10", 1); | |||||
RawMaterialsNamePos.Add("A20", 2); | |||||
RawMaterialsNamePos.Add("A30", 3); | |||||
RawMaterialsNamePos.Add("A40", 4); | |||||
RawMaterialsNamePos.Add("A50", 5); | |||||
RawMaterialsNamePos.Add("A60", 6); | |||||
RawMaterialsNamePos.Add("A70", 7); | |||||
RawMaterialsNamePos.Add("A80", 8); | |||||
RawMaterialsNamePos.Add("A90", 9); | |||||
RawMaterialsNamePos.Add("A100", 10); | |||||
RawMaterialsNamePos.Add("A110", 11); | |||||
RawMaterialsNamePos.Add("A120", 12); | |||||
RawMaterialsNamePos.Add("A130", 13); | |||||
RawMaterialsNamePos.Add("A140", 14); | |||||
} | |||||
/* | |||||
HKDevice.StockBinName.RawMaterialName1 = "1"; | HKDevice.StockBinName.RawMaterialName1 = "1"; | ||||
HKDevice.StockBinName.RawMaterialName2 = "2"; | HKDevice.StockBinName.RawMaterialName2 = "2"; | ||||
HKDevice.StockBinName.RawMaterialName3 = "3"; | HKDevice.StockBinName.RawMaterialName3 = "3"; | ||||
@@ -775,7 +905,7 @@ namespace BPASmartClient.JXJFoodBigStation.Model | |||||
if (!RawMaterialsNamePos.ContainsKey(HKDevice.StockBinName.RawMaterialName14)) | if (!RawMaterialsNamePos.ContainsKey(HKDevice.StockBinName.RawMaterialName14)) | ||||
{ | { | ||||
RawMaterialsNamePos.Add(HKDevice.StockBinName.RawMaterialName14, 14); | RawMaterialsNamePos.Add(HKDevice.StockBinName.RawMaterialName14, 14); | ||||
} | |||||
}*/ | |||||
} | } | ||||
} | } | ||||
} | } |
@@ -7,12 +7,12 @@ using System.Threading.Tasks; | |||||
namespace BPASmartClient.JXJFoodBigStation.Model.Siemens | namespace BPASmartClient.JXJFoodBigStation.Model.Siemens | ||||
{ | { | ||||
internal class DL_Status_DB | |||||
public class DL_Status_DB | |||||
{ | { | ||||
/// <summary> | /// <summary> | ||||
/// 配料开始 | |||||
/// 配料开始确认 | |||||
/// </summary> | /// </summary> | ||||
public bool Dosing_Start { get; set; } | |||||
public bool Dosing_Start_ACK { get; set; } | |||||
/// <summary> | /// <summary> | ||||
/// 配料开始确认 | /// 配料开始确认 | ||||
/// </summary> | /// </summary> | ||||
@@ -29,18 +29,21 @@ namespace BPASmartClient.JXJFoodBigStation.Model.Siemens | |||||
/// 生产工单 | /// 生产工单 | ||||
/// </summary> | /// </summary> | ||||
public string RecipeCode { get; set; } | public string RecipeCode { get; set; } | ||||
public bool Dosing_Cancel4 { get; set; } | |||||
/// <summary> | |||||
/// 配料开始 | |||||
/// </summary> | |||||
public bool Dosing_Start { get; set; } | |||||
public bool Dosing_Cancel5 { get; set; } | |||||
public bool Allow_Agv_Put { get; set; } | |||||
public bool Dosing_Cancel6 { get; set; } | |||||
public bool Allow_Agv_Get { get; set; } | |||||
public bool Dosing_Cancel7 { get; set; } | |||||
public bool Allow_Agv_Get_Empty { get; set; } | |||||
public short Dosing_Cancel8 { get; set; } | |||||
public short Pallet_Position_Occ { get; set; } | |||||
public short Dosing_Cancel9 { get; set; } | public short Dosing_Cancel9 { get; set; } | ||||
public short[] Standby2 { get; set; } = new short[4]; | |||||
public short[] Standby2 { get; set; } = new short[3]; | |||||
} | } | ||||
} | } |
@@ -15,6 +15,7 @@ namespace BPASmartClient.JXJFoodBigStation.Model.Siemens | |||||
public SiemensHelper Siemens_PLC_S7 = new SiemensHelper(); | public SiemensHelper Siemens_PLC_S7 = new SiemensHelper(); | ||||
public bool IsConnected => Siemens_PLC_S7.IsConnected; | public bool IsConnected => Siemens_PLC_S7.IsConnected; | ||||
public DL_Status_DB DL_Status = new DL_Status_DB(); | |||||
bool a = false; | bool a = false; | ||||
public void Init() | public void Init() | ||||
{ | { | ||||
@@ -34,7 +35,7 @@ namespace BPASmartClient.JXJFoodBigStation.Model.Siemens | |||||
start.RecipeCode = "1201"; | start.RecipeCode = "1201"; | ||||
start.Order_Request_Ack = true; | start.Order_Request_Ack = true; | ||||
for (int i = 0; i < GVL_BigStation.StockBinNum ; i++) | |||||
for (int i = 0; i < GVL_BigStation.Max_DosingSotckBinNum ; i++) | |||||
{ | { | ||||
start.Material[i] = new UDT(); | start.Material[i] = new UDT(); | ||||
start.Material[i].Material_Name = "" + (i +1); | start.Material[i].Material_Name = "" + (i +1); | ||||
@@ -42,25 +43,43 @@ namespace BPASmartClient.JXJFoodBigStation.Model.Siemens | |||||
start.Material[i].Material_BarrelNum = (short)(i + 1); | start.Material[i].Material_BarrelNum = (short)(i + 1); | ||||
} | } | ||||
} | } | ||||
if (RTrig.GetInstance("Order_Request").Start(GVL_BigStation.Order_Request)) | |||||
if (RTrig.GetInstance("Order_Request").Start(GVL_BigStation.Order_Request) && GVL_BigStation.SiemensSendRecipeStatus == 0) | |||||
{ | { | ||||
start.Order_Request = true; | |||||
Siemens_PLC_S7.WriteClass<DL_Start_DB>(start, 2301); | |||||
GVL_BigStation.SiemensSendRecipeStatus = 1; | |||||
this.Siemens_PLC_S7.Write("DB2301.DBX330.0", true); | |||||
} | } | ||||
if (RTrig.GetInstance("Order_Request_Ack").Start(start.Order_Request_Ack)) | |||||
if (RTrig.GetInstance("Order_Request_Ack").Start(start.Order_Request_Ack) && GVL_BigStation.SiemensSendRecipeStatus == 1) | |||||
{ | { | ||||
GVL_BigStation.SiemensSendRecipeStatus = 2; | |||||
ActionManage.GetInstance.Send("SiemensSendRecipe", start); | ActionManage.GetInstance.Send("SiemensSendRecipe", start); | ||||
this.Siemens_PLC_S7.Write("DB2301.DBX330.0", false); | |||||
} | |||||
if (TTrig.GetInstance("Order_Request_Ack").Start(start.Order_Request_Ack) && GVL_BigStation.SiemensSendRecipeStatus == 2) | |||||
{ | |||||
GVL_BigStation.SiemensSendRecipeStatus = 3; | |||||
GVL_BigStation.Order_Request = false; | |||||
} | } | ||||
} | } | ||||
if (res1 != null && res1 is DL_Status_DB status) | if (res1 != null && res1 is DL_Status_DB status) | ||||
{ | { | ||||
DL_Status = status; | |||||
} | } | ||||
if (res2 != null && res2.Ask_For_Finish_PLC) | |||||
if (res2 != null && res2 is DL_Finish_DB finish) | |||||
{ | { | ||||
ActionManage.GetInstance.Send("配料完成信号确认完成"); | |||||
res2.Ask_For_Finish_PLC = false; | |||||
this.Siemens_PLC_S7.WriteClass<DL_Finish_DB>(res2, 3); | |||||
if (RTrig.GetInstance("Ask_For_Finish_PLC").Start(finish.Ask_For_Finish_PLC) && GVL_BigStation.SiemensSendRecipeStatus == 7) | |||||
{ | |||||
finish.Order_No = ""; | |||||
finish.Product_Code = ""; | |||||
finish.job_No = 0; | |||||
for (int i = 0; i < 20; i++) | |||||
{ | |||||
finish.Material[i] = new UDT1(); | |||||
} | |||||
GVL_BigStation.SiemensSendRecipeStatus = 0; | |||||
finish.Ask_For_Finish = false; | |||||
finish.ProcessTime = 0; | |||||
this.Siemens_PLC_S7.WriteClass<DL_Finish_DB>(finish, 2261); | |||||
} | |||||
} | } | ||||
Thread.Sleep(10); | Thread.Sleep(10); | ||||
}), "监听服务数据"); | }), "监听服务数据"); | ||||
@@ -48,6 +48,7 @@ namespace BPASmartClient.JXJFoodSmallStation | |||||
base.OnExit(e); | base.OnExit(e); | ||||
Json<LocaPar>.Save(); | Json<LocaPar>.Save(); | ||||
Json<LocalRecipeDataColl>.Save(); | Json<LocalRecipeDataColl>.Save(); | ||||
Json<RemoteRecipeDataColl>.Save(); | |||||
MessageNotify.GetInstance.LogSave(); | MessageNotify.GetInstance.LogSave(); | ||||
ThreadManage.GetInstance().Dispose(); | ThreadManage.GetInstance().Dispose(); | ||||
} | } | ||||
@@ -268,6 +269,7 @@ namespace BPASmartClient.JXJFoodSmallStation | |||||
Json<DevicePar>.Read(); | Json<DevicePar>.Read(); | ||||
Json<WindSendDevicePar>.Read(); | Json<WindSendDevicePar>.Read(); | ||||
Json<LocalRecipeDataColl>.Read(); | Json<LocalRecipeDataColl>.Read(); | ||||
Json<RemoteRecipeDataColl>.Read(); | |||||
} | } | ||||
} | } | ||||
@@ -23,14 +23,17 @@ namespace BPASmartClient.JXJFoodSmallStation.Model | |||||
/// <summary> | /// <summary> | ||||
/// 风送料仓数目 | /// 风送料仓数目 | ||||
/// </summary> | /// </summary> | ||||
public const int Max_PowderSotckBinNum = 15; | |||||
public const int Max_PowderSotckBinNum = 5; | |||||
public bool HeartBeatToPlc { get; set; } = false; | public bool HeartBeatToPlc { get; set; } = false; | ||||
public bool HeartBeatFromPlc { get; set; } = false; | public bool HeartBeatFromPlc { get; set; } = false; | ||||
/// <summary> | /// <summary> | ||||
/// 是否允许西门子下发配方 | /// 是否允许西门子下发配方 | ||||
/// </summary> | /// </summary> | ||||
public static bool IsAllowSiemensSendRecipe { get; set; } = false; | public static bool IsAllowSiemensSendRecipe { get; set; } = false; | ||||
/// <summary> | |||||
/// 西门子下发配方状态 0:等待下发配方 1:请求下发配方 2:上位机接收配方 3:配方接收完成 4:请求配料 5:西门子开始配料确认 6:配方配料完成 7:配料完成确认 | |||||
/// </summary> | |||||
public static int SiemensSendRecipeStatus { get; set; } = 0; | |||||
/// <summary> | /// <summary> | ||||
/// 往输送带下发配方完成 | /// 往输送带下发配方完成 | ||||
/// </summary> | /// </summary> | ||||
@@ -114,6 +117,7 @@ namespace BPASmartClient.JXJFoodSmallStation.Model | |||||
/// 是否使用本地模拟订单+风送配方 | /// 是否使用本地模拟订单+风送配方 | ||||
/// </summary> | /// </summary> | ||||
public bool IsUseWindSendDosing { get; set; } | public bool IsUseWindSendDosing { get; set; } | ||||
public static int test1 = 1; | |||||
#endregion | #endregion | ||||
} | } | ||||
} | } |
@@ -50,6 +50,7 @@ namespace BPASmartClient.JXJFoodSmallStation.Model | |||||
public RecipeRawMaterial RawMaterial; | public RecipeRawMaterial RawMaterial; | ||||
public void Init() | public void Init() | ||||
{ | { | ||||
testData(); | |||||
for (int i = 0; i < 16; i++) | for (int i = 0; i < 16; i++) | ||||
{ | { | ||||
if (DeviceInquire.GetInstance.GetDevice(i).DeviceName != null) | if (DeviceInquire.GetInstance.GetDevice(i).DeviceName != null) | ||||
@@ -69,57 +70,91 @@ namespace BPASmartClient.JXJFoodSmallStation.Model | |||||
{ | { | ||||
if (res != null && res is XL_Start_DB recipe) | if (res != null && res is XL_Start_DB recipe) | ||||
{ | { | ||||
RawMaterials.Clear(); | |||||
for (int i = 0; i < GVL_SmallStation.Max_DosingSotckBinNum; i++) | |||||
{ | |||||
if (!string.IsNullOrEmpty(recipe.Material[i].Material_Name)) | |||||
if (!string.IsNullOrEmpty(recipe.RecipeCode)) { | |||||
RawMaterials.Clear(); | |||||
for (int i = 0; i < GVL_SmallStation.Max_DosingSotckBinNum; i++) | |||||
{ | { | ||||
if (RawMaterialsNamePos.ContainsKey(recipe.Material[i].Material_Name)) | |||||
if (!string.IsNullOrEmpty(recipe.Material[i].Material_Name)) | |||||
{ | { | ||||
RawMaterials.Add(new RemoteRecipeRawMaterial() | |||||
if (RawMaterialsNamePos.ContainsKey(recipe.Material[i].Material_Name)) | |||||
{ | { | ||||
RawMaterialName = recipe.Material[i].Material_Name, | |||||
RawMaterialBarrelNum = recipe.Material[i].Material_BarrelNum, | |||||
RawMaterialWeight = recipe.Material[i].Material_Weight, | |||||
RawMaterialLocation = (int)RawMaterialsNamePos[recipe.Material[i].Material_Name] | |||||
}); | |||||
RawMaterials.Add(new RemoteRecipeRawMaterial() | |||||
{ | |||||
RawMaterialName = recipe.Material[i].Material_Name, | |||||
RawMaterialBarrelNum = recipe.Material[i].Material_BarrelNum, | |||||
RawMaterialWeight = recipe.Material[i].Material_Weight, | |||||
RawMaterialLocation = (int)RawMaterialsNamePos[recipe.Material[i].Material_Name] | |||||
}); | |||||
} | |||||
else | |||||
{ | |||||
//MessageNotify.GetInstance.AlarmLog("配方名称与本地不符合"); | |||||
} | |||||
} | } | ||||
else | else | ||||
{ | { | ||||
//MessageNotify.GetInstance.AlarmLog("配方名称与本地不符合"); | |||||
break; | |||||
} | } | ||||
} | } | ||||
else | |||||
for (int i = 0; i < GVL_SmallStation.Max_PowderSotckBinNum; i++) | |||||
{ | { | ||||
break; | |||||
if (!string.IsNullOrEmpty(recipe.Powder[i].Powder_Name)) | |||||
{ | |||||
WindSendData.Add(new WindSendRawMaterial() | |||||
{ | |||||
RawMaterialName = recipe.Powder[i].Powder_Name, | |||||
RawMaterialWeight = recipe.Powder[i].Powder_Weight | |||||
}); | |||||
} | |||||
else | |||||
{ | |||||
break; | |||||
} | |||||
} | } | ||||
} | |||||
for (int i = 0; i < GVL_SmallStation.Max_PowderSotckBinNum; i++) | |||||
{ | |||||
if (!string.IsNullOrEmpty(recipe.Powder[i].Powder_Name)) | |||||
{ | |||||
WindSendData.Add(new WindSendRawMaterial() | |||||
App.Current.Dispatcher.Invoke(() => { | |||||
Json<RemoteRecipeDataColl>.Data.Recipes.Add(new RemoteRecipeData() | |||||
{ | { | ||||
RawMaterialName = recipe.Powder[i].Powder_Name, | |||||
RawMaterialWeight = recipe.Powder[i].Powder_Weight | |||||
RecipeName = recipe.RecipeName, | |||||
RecipeCode = recipe.RecipeCode, | |||||
RawMaterial = RawMaterials, | |||||
TrayCode = recipe.StockCode, | |||||
WindSend = WindSendData | |||||
}); | }); | ||||
} | |||||
else | |||||
{ | |||||
break; | |||||
} | |||||
}); | |||||
} | } | ||||
Json<RemoteRecipeDataColl>.Data.Recipes.Add(new RemoteRecipeData() | |||||
{ | |||||
RecipeName = recipe.RecipeName, | |||||
RecipeCode = recipe.RecipeCode, | |||||
RawMaterial = RawMaterials, | |||||
TrayCode = recipe.TrayCode, | |||||
WindSend = WindSendData | |||||
}); | |||||
} | } | ||||
} | } | ||||
}), "SiemensRecipeRecive", true); | }), "SiemensRecipeRecive", true); | ||||
ActionManage.GetInstance.CancelRegister("SiemensRecipeFinish"); | |||||
ActionManage.GetInstance.Register(new Action<object>((res) => | |||||
{ | |||||
if (SiemensDevice.IsConnected) | |||||
{ | |||||
if (res != null && res is RemoteRecipeData recipe) | |||||
{ | |||||
RecipeFinishInfo.Order_No = recipe.RecipeCode; | |||||
RecipeFinishInfo.Product_Code = recipe.RecipeName; | |||||
RecipeFinishInfo.Job_No = (short)recipe.TrayCode; | |||||
for (int i = 0; i < recipe.RawMaterial.Count; i++) | |||||
{ | |||||
RecipeFinishInfo.Material[i] = new UDT1(); | |||||
RecipeFinishInfo.Material[i].Material_Name = recipe.RawMaterial.ElementAt(i).RawMaterialName; | |||||
RecipeFinishInfo.Material[i].Material_BarrelNum = recipe.RawMaterial.ElementAt(i).RawMaterialBarrelNum; | |||||
RecipeFinishInfo.Material[i].Material_Laying_Off_Weight = recipe.RawMaterial.ElementAt(i).Laying_Off_Weight; | |||||
} | |||||
for (int i = 0; i < recipe.WindSend.Count; i++) | |||||
{ | |||||
RecipeFinishInfo.Powder[i] = new UDT2(); | |||||
} | |||||
if (GVL_SmallStation.SiemensSendRecipeStatus == 6) | |||||
{ | |||||
GVL_SmallStation.SiemensSendRecipeStatus = 7; | |||||
RecipeFinishInfo.Ask_For_Finish = true; | |||||
SiemensDevice.Siemens_PLC_S7.WriteClass<XL_Finish_DB>(RecipeFinishInfo, 2261); | |||||
} | |||||
} | |||||
} | |||||
}), "SiemensRecipeFinish", true); | |||||
ActionManage.GetInstance.CancelRegister("WindSendDosingFinish"); | ActionManage.GetInstance.CancelRegister("WindSendDosingFinish"); | ||||
ActionManage.GetInstance.Register(new Action(() => | ActionManage.GetInstance.Register(new Action(() => | ||||
{ | { | ||||
@@ -644,7 +679,6 @@ namespace BPASmartClient.JXJFoodSmallStation.Model | |||||
GVL_SmallStation.GetInstance.HeartBeatToPlc = !GVL_SmallStation.GetInstance.HeartBeatToPlc; | GVL_SmallStation.GetInstance.HeartBeatToPlc = !GVL_SmallStation.GetInstance.HeartBeatToPlc; | ||||
HKDevice.HK_PLC_S7.Write("DB4.DBX0.0", 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<bool>("DB3.DBX0.0"); | GVL_SmallStation.GetInstance.HeartBeatFromPlc = HKDevice.HK_PLC_S7.Read<bool>("DB3.DBX0.0"); | ||||
} | } | ||||
} | } | ||||
/// <summary> | /// <summary> | ||||
@@ -661,14 +695,66 @@ namespace BPASmartClient.JXJFoodSmallStation.Model | |||||
{ | { | ||||
if (!(RecipeQueue.Contains(data.RecipeCode))) | if (!(RecipeQueue.Contains(data.RecipeCode))) | ||||
{ | { | ||||
RecipeQueue.Enqueue(data.RecipeCode); | |||||
if (SiemensDevice.XL_Status is XL_Status_DB status) | |||||
{ | |||||
if (GVL_SmallStation.SiemensSendRecipeStatus == 3) | |||||
{ | |||||
GVL_SmallStation.SiemensSendRecipeStatus = 4; | |||||
SiemensDevice.Siemens_PLC_S7.WriteString(2231, data.RecipeCode,10); | |||||
SiemensDevice.Siemens_PLC_S7.Write("DB2231.DBX28.0",true); | |||||
} | |||||
if (GVL_SmallStation.SiemensSendRecipeStatus == 4) | |||||
{ | |||||
if (SiemensDevice.XL_Status.Dosing_Confirm) | |||||
{ | |||||
GVL_SmallStation.SiemensSendRecipeStatus = 5; | |||||
SiemensDevice.Siemens_PLC_S7.WriteString(2231, "", 10); | |||||
SiemensDevice.Siemens_PLC_S7.Write("DB2231.DBX28.0", false); | |||||
} | |||||
} | |||||
if (GVL_SmallStation.SiemensSendRecipeStatus == 5) | |||||
{ | |||||
if (SiemensDevice.XL_Status.Dosing_Confirm == false) | |||||
{ | |||||
GVL_SmallStation.SiemensSendRecipeStatus = 6; | |||||
RecipeQueue.Enqueue(data.RecipeCode); | |||||
} | |||||
} | |||||
} | |||||
} | } | ||||
} | } | ||||
else if(data.TrayCode == 2) | |||||
else if (data.TrayCode == 2) | |||||
{ | { | ||||
if (!(RecipeQueueTray2.Contains(data.RecipeCode))) | if (!(RecipeQueueTray2.Contains(data.RecipeCode))) | ||||
{ | { | ||||
RecipeQueueTray2.Enqueue(data.RecipeCode); | |||||
if (SiemensDevice.XL_Status is XL_Status_DB status) | |||||
{ | |||||
if (GVL_SmallStation.SiemensSendRecipeStatus == 3) | |||||
{ | |||||
GVL_SmallStation.SiemensSendRecipeStatus = 4; | |||||
SiemensDevice.Siemens_PLC_S7.WriteString(2231, data.RecipeCode, 10); | |||||
SiemensDevice.Siemens_PLC_S7.Write("DB2231.DBX28.0", true); | |||||
} | |||||
if (GVL_SmallStation.SiemensSendRecipeStatus == 4) | |||||
{ | |||||
if (SiemensDevice.XL_Status.Dosing_Confirm) | |||||
{ | |||||
GVL_SmallStation.SiemensSendRecipeStatus = 5; | |||||
SiemensDevice.Siemens_PLC_S7.WriteString(2231, "", 10); | |||||
SiemensDevice.Siemens_PLC_S7.Write("DB2231.DBX28.0", false); | |||||
} | |||||
} | |||||
if (GVL_SmallStation.SiemensSendRecipeStatus == 5) | |||||
{ | |||||
if (SiemensDevice.XL_Status.Dosing_Confirm == false) | |||||
{ | |||||
GVL_SmallStation.SiemensSendRecipeStatus = 0; | |||||
RecipeQueueTray2.Enqueue(data.RecipeCode); | |||||
} | |||||
} | |||||
} | |||||
} | } | ||||
} | } | ||||
} | } | ||||
@@ -851,23 +937,39 @@ namespace BPASmartClient.JXJFoodSmallStation.Model | |||||
} | } | ||||
} | } | ||||
if (RTrig.GetInstance("配方配料完成").Start(HKDevice.HK_PLC_S7.Read<bool>("DB3.DBX1.1")) && (GVL_SmallStation.GetInstance.WindSendDosingFinish || !GVL_SmallStation.GetInstance.IsUseWindSend)) | |||||
if ((RTrig.GetInstance("配方配料完成").Start(HKDevice.HK_PLC_S7.Read<bool>("DB3.DBX1.1")) && (GVL_SmallStation.GetInstance.WindSendDosingFinish || !GVL_SmallStation.GetInstance.IsUseWindSend)) || GVL_SmallStation.GetInstance.RecipeStatusID == 5) | |||||
{ | { | ||||
var res = Json<RemoteRecipeDataColl>.Data.Recipes.FirstOrDefault(p => p.RecipeCode == code); | var res = Json<RemoteRecipeDataColl>.Data.Recipes.FirstOrDefault(p => p.RecipeCode == code); | ||||
MessageNotify.GetInstance.ShowRunLog($"托盘1,配方{res.RecipeName},配料完成"); | MessageNotify.GetInstance.ShowRunLog($"托盘1,配方{res.RecipeName},配料完成"); | ||||
RecipeFinishInfo.Order_No = RemoteRecipes.ElementAt(index).RecipeCode; | |||||
RecipeFinishInfo.Product_Code = RemoteRecipes.ElementAt(index).RecipeName; | |||||
for (int i = 0; i < RemoteRecipes.ElementAt(index).RawMaterial.Count; i++) | |||||
{ | |||||
RecipeFinishInfo.Material[i] = new UDT1(); | |||||
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; | |||||
} | |||||
if (SiemensDevice.IsConnected) | if (SiemensDevice.IsConnected) | ||||
{ | { | ||||
RecipeFinishInfo.Ask_For_Finish = true; | |||||
SiemensDevice.Siemens_PLC_S7.WriteClass<XL_Finish_DB>(RecipeFinishInfo, 2261); | |||||
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; | |||||
} | |||||
for (int i = 0; i < RemoteRecipes.ElementAt(index).WindSend.Count; i++) | |||||
{ | |||||
} | |||||
if (GVL_SmallStation.SiemensSendRecipeStatus == 6) | |||||
{ | |||||
GVL_SmallStation.SiemensSendRecipeStatus = 7; | |||||
RecipeFinishInfo.Ask_For_Finish = true; | |||||
SiemensDevice.Siemens_PLC_S7.WriteClass<XL_Finish_DB>(RecipeFinishInfo, 2261); | |||||
} | |||||
} | } | ||||
App.Current.Dispatcher.Invoke(() => | App.Current.Dispatcher.Invoke(() => | ||||
{ | { | ||||
@@ -1079,5 +1181,23 @@ namespace BPASmartClient.JXJFoodSmallStation.Model | |||||
} | } | ||||
} | } | ||||
} | } | ||||
private void testData() | |||||
{ | |||||
RawMaterialsNamePos.Add("A10", 1); | |||||
RawMaterialsNamePos.Add("A20", 2); | |||||
RawMaterialsNamePos.Add("A30", 3); | |||||
RawMaterialsNamePos.Add("A40", 4); | |||||
RawMaterialsNamePos.Add("A50", 5); | |||||
RawMaterialsNamePos.Add("A60", 6); | |||||
RawMaterialsNamePos.Add("A70", 7); | |||||
RawMaterialsNamePos.Add("A80", 8); | |||||
RawMaterialsNamePos.Add("A90", 9); | |||||
RawMaterialsNamePos.Add("A100", 10); | |||||
RawMaterialsNamePos.Add("A110", 11); | |||||
RawMaterialsNamePos.Add("A120", 12); | |||||
RawMaterialsNamePos.Add("A130", 13); | |||||
RawMaterialsNamePos.Add("A140", 14); | |||||
RawMaterialsNamePos.Add("A150", 15); | |||||
} | |||||
} | } | ||||
} | } |
@@ -14,34 +14,79 @@ namespace BPASmartClient.JXJFoodSmallStation.Model.Siemens | |||||
{ | { | ||||
public SiemensHelper Siemens_PLC_S7 = new SiemensHelper(); | public SiemensHelper Siemens_PLC_S7 = new SiemensHelper(); | ||||
public bool IsConnected => Siemens_PLC_S7.IsConnected; | public bool IsConnected => Siemens_PLC_S7.IsConnected; | ||||
public XL_Status_DB XL_Status = new XL_Status_DB(); | |||||
bool test; | |||||
public void Init() | public void Init() | ||||
{ | { | ||||
if (IsConnected) | if (IsConnected) | ||||
{ | { | ||||
ThreadManage.GetInstance().StartLong(new Action(() => | |||||
ThreadManage.GetInstance().StartLong(new Action(() => | |||||
{ | { | ||||
var Start = this.Siemens_PLC_S7.ReadClass<XL_Start_DB>(2201); | var Start = this.Siemens_PLC_S7.ReadClass<XL_Start_DB>(2201); | ||||
var Status = this.Siemens_PLC_S7.ReadClass<XL_Status_DB>(2231); | var Status = this.Siemens_PLC_S7.ReadClass<XL_Status_DB>(2231); | ||||
var Finish = this.Siemens_PLC_S7.ReadClass<XL_Finish_DB>(2261); | var Finish = this.Siemens_PLC_S7.ReadClass<XL_Finish_DB>(2261); | ||||
var DataColl = this.Siemens_PLC_S7.ReadClass<XL_DataColl_DB>(2291); | var DataColl = this.Siemens_PLC_S7.ReadClass<XL_DataColl_DB>(2291); | ||||
if (Start != null && Start.Order_Request == false && GVL_SmallStation.IsAllowSiemensSendRecipe) | |||||
if (test) | |||||
{ | { | ||||
Start.Order_Request = true; | |||||
this.Siemens_PLC_S7.WriteClass<XL_Start_DB>(Start, 1); | |||||
for (int i = 0; i < XL_Status.Powder.Length; i++) { | |||||
XL_Status.Powder.ElementAt(i).Powder_Name = ""+i; | |||||
} | |||||
Siemens_PLC_S7.WriteClass<XL_Status_DB>(XL_Status, 2231); | |||||
} | } | ||||
if (Start != null && RTrig.GetInstance("RecipeTrig").Start(Start.Order_Request_ACK)) | |||||
if (Start != null && Start is XL_Start_DB st) | |||||
{ | { | ||||
ActionManage.GetInstance.Send("SiemensRecipeRecive", Start); | |||||
Start.Order_Request_ACK = false; | |||||
this.Siemens_PLC_S7.WriteClass<XL_Start_DB>(Start, 1); | |||||
if (RTrig.GetInstance("DB2201.DBX450.0").Start(GVL_SmallStation.IsAllowSiemensSendRecipe) && GVL_SmallStation.SiemensSendRecipeStatus == 0) | |||||
{ | |||||
GVL_SmallStation.SiemensSendRecipeStatus = 1; | |||||
this.Siemens_PLC_S7.Write("DB2201.DBX450.0", true); | |||||
} | |||||
if (RTrig.GetInstance("Order_Request_ACK").Start(Start.Order_Request_ACK) && GVL_SmallStation.SiemensSendRecipeStatus == 1) | |||||
{ | |||||
if (!string.IsNullOrEmpty(st.RecipeCode)) | |||||
{ | |||||
GVL_SmallStation.SiemensSendRecipeStatus = 2; | |||||
ActionManage.GetInstance.Send("SiemensRecipeRecive", st); | |||||
this.Siemens_PLC_S7.Write("DB2201.DBX450.0", false); | |||||
} | |||||
} | |||||
if (TTrig.GetInstance("Order_Request_ACK_").Start(Start.Order_Request_ACK) && GVL_SmallStation.SiemensSendRecipeStatus == 2) | |||||
{ | |||||
GVL_SmallStation.IsAllowSiemensSendRecipe = false; | |||||
GVL_SmallStation.SiemensSendRecipeStatus = 3; | |||||
//需要等待请求信号复位才能认为接收配方完成 | |||||
} | |||||
} | } | ||||
if (Status != null && RTrig.GetInstance("Allow_AGV_Put[0]").Start(Status.AgvRequestPut)) | |||||
if (Finish != null && Finish is XL_Finish_DB FinishData) | |||||
{ | { | ||||
ActionManage.GetInstance.Send("AGV放货架到位",Status); | |||||
Status.AgvRequestPut = false; | |||||
this.Siemens_PLC_S7.WriteClass<XL_Status_DB>(Status, 2); | |||||
if (RTrig.GetInstance("Ask_For_Finish_PLC").Start(FinishData.Ask_For_Finish_PLC) && GVL_SmallStation.SiemensSendRecipeStatus == 7) | |||||
{ | |||||
FinishData.Order_No = ""; | |||||
FinishData.Product_Code = ""; | |||||
FinishData.Job_No = 0; | |||||
for (int i = 0; i < 20; i++) | |||||
{ | |||||
FinishData.Material[i] = new UDT1(); | |||||
} | |||||
for (int i = 0; i < 10; i++) | |||||
{ | |||||
FinishData.Powder[i] = new UDT2(); | |||||
} | |||||
GVL_SmallStation.SiemensSendRecipeStatus = 0; | |||||
FinishData.Ask_For_Finish = false; | |||||
FinishData.DosingTime = 0; | |||||
this.Siemens_PLC_S7.WriteClass<XL_Finish_DB>(FinishData, 2261); | |||||
} | |||||
} | |||||
if (Status != null && Status is XL_Status_DB state) | |||||
{ | |||||
XL_Status = state; | |||||
if (RTrig.GetInstance("Allow_AGV_Put[0]").Start(Status.AgvRequestPut)) | |||||
{ | |||||
ActionManage.GetInstance.Send("AGV放货架到位", Status); | |||||
Status.AgvRequestPut = false; | |||||
this.Siemens_PLC_S7.WriteClass<XL_Status_DB>(Status, 2); | |||||
} | |||||
} | } | ||||
if (Status != null && RTrig.GetInstance("Allow_AGV_Put[1]").Start(Status.AgvRequestGet)) | if (Status != null && RTrig.GetInstance("Allow_AGV_Put[1]").Start(Status.AgvRequestGet)) | ||||
{ | { | ||||
@@ -49,7 +94,6 @@ namespace BPASmartClient.JXJFoodSmallStation.Model.Siemens | |||||
Status.AgvRequestGet = false; | Status.AgvRequestGet = false; | ||||
this.Siemens_PLC_S7.WriteClass<XL_Status_DB>(Status, 2); | this.Siemens_PLC_S7.WriteClass<XL_Status_DB>(Status, 2); | ||||
} | } | ||||
Thread.Sleep(10); | Thread.Sleep(10); | ||||
}),"监听服务数据"); | }),"监听服务数据"); | ||||
} | } | ||||
@@ -7,7 +7,7 @@ using System.Threading.Tasks; | |||||
namespace BPASmartClient.JXJFoodSmallStation.Model.Siemens | namespace BPASmartClient.JXJFoodSmallStation.Model.Siemens | ||||
{ | { | ||||
internal class XL_Finish_DB | |||||
public class XL_Finish_DB | |||||
{ | { | ||||
/// <summary> | /// <summary> | ||||
/// 配料完成信号确认 | /// 配料完成信号确认 | ||||
@@ -52,7 +52,7 @@ namespace BPASmartClient.JXJFoodSmallStation.Model.Siemens | |||||
/// 原料名称 | /// 原料名称 | ||||
/// </summary> | /// </summary> | ||||
[Siemens(6)] | [Siemens(6)] | ||||
public string Material_Name { get; set; } | |||||
public string Material_Name { get; set; } = ""; | |||||
/// <summary> | /// <summary> | ||||
/// 原料下料重量 | /// 原料下料重量 | ||||
/// </summary> | /// </summary> | ||||
@@ -68,7 +68,7 @@ namespace BPASmartClient.JXJFoodSmallStation.Model.Siemens | |||||
/// 粉料仓名称 | /// 粉料仓名称 | ||||
/// </summary> | /// </summary> | ||||
[Siemens(6)] | [Siemens(6)] | ||||
public string Powder_Name { get; set; } | |||||
public string Powder_Name { get; set; } = ""; | |||||
/// <summary> | /// <summary> | ||||
/// 粉料仓重量 | /// 粉料仓重量 | ||||
/// </summary> | /// </summary> | ||||
@@ -51,7 +51,7 @@ namespace BPASmartClient.JXJFoodSmallStation.Model.Siemens | |||||
/// <summary> | /// <summary> | ||||
/// 原料名称 | /// 原料名称 | ||||
/// </summary> | /// </summary> | ||||
public string Material_Name { get; set; } | |||||
public string Material_Name { get; set; } = ""; | |||||
/// <summary> | /// <summary> | ||||
/// 原料重量 | /// 原料重量 | ||||
/// </summary> | /// </summary> | ||||
@@ -69,7 +69,7 @@ namespace BPASmartClient.JXJFoodSmallStation.Model.Siemens | |||||
/// 粉料仓名称 | /// 粉料仓名称 | ||||
/// </summary> | /// </summary> | ||||
[Siemens(6)] | [Siemens(6)] | ||||
public string Powder_Name { get; set; } | |||||
public string Powder_Name { get; set; } = ""; | |||||
/// <summary> | /// <summary> | ||||
/// 粉料仓重量 | /// 粉料仓重量 | ||||
/// </summary> | /// </summary> | ||||
@@ -78,7 +78,7 @@ namespace BPASmartClient.JXJFoodSmallStation.Model.Siemens | |||||
/// 粉料名称 | /// 粉料名称 | ||||
/// </summary> | /// </summary> | ||||
[Siemens(6)] | [Siemens(6)] | ||||
public string Powder_Name { get; set; } | |||||
public string Powder_Name { get; set; } = ""; | |||||
/// <summary> | /// <summary> | ||||
/// 粉料仓剩余重量 | /// 粉料仓剩余重量 | ||||
/// </summary> | /// </summary> | ||||
@@ -114,7 +114,7 @@ namespace BPASmartClient.Model | |||||
set | set | ||||
{ | { | ||||
_mRecipeStatus = value; | _mRecipeStatus = value; | ||||
if (value == 1) Status = Status.等待配料; | |||||
if (value == 1 && Status != Status.配料完成) Status = Status.等待配料; | |||||
else if (value == 2) Status = Status.正在配料; | else if (value == 2) Status = Status.正在配料; | ||||
else if (value == 3) Status = Status.配料完成; | else if (value == 3) Status = Status.配料完成; | ||||
OnPropertyChanged(); | OnPropertyChanged(); | ||||
@@ -9,6 +9,7 @@ | |||||
</PropertyGroup> | </PropertyGroup> | ||||
<ItemGroup> | <ItemGroup> | ||||
<PackageReference Include="BPA.Message" Version="1.0.77" /> | |||||
<PackageReference Include="BPA.Models" Version="1.0.34" /> | <PackageReference Include="BPA.Models" Version="1.0.34" /> | ||||
<PackageReference Include="Microsoft.Toolkit.Mvvm" Version="7.1.2" /> | <PackageReference Include="Microsoft.Toolkit.Mvvm" Version="7.1.2" /> | ||||
<PackageReference Include="System.Speech" Version="6.0.0" /> | <PackageReference Include="System.Speech" Version="6.0.0" /> | ||||
@@ -34,13 +34,11 @@ namespace BPASmartClient.MorkS | |||||
public override void DoMain() | public override void DoMain() | ||||
{ | { | ||||
MonitorViewModel.DeviceId = DeviceId; | MonitorViewModel.DeviceId = DeviceId; | ||||
ServerInit(); | ServerInit(); | ||||
DataParse(); | DataParse(); | ||||
Json<MorksPar>.Read(); | Json<MorksPar>.Read(); | ||||
Json<OrderStatistics>.Read(); | |||||
if (Json<MorksPar>.Data.parSets == null) Json<MorksPar>.Data.parSets = new ObservableCollection<ParSet>(); | if (Json<MorksPar>.Data.parSets == null) Json<MorksPar>.Data.parSets = new ObservableCollection<ParSet>(); | ||||
if (Json<MorksPar>.Data.parSets.Count < 6) | if (Json<MorksPar>.Data.parSets.Count < 6) | ||||
{ | { | ||||
@@ -138,7 +136,43 @@ namespace BPASmartClient.MorkS | |||||
goodName = res.MorkOrder.GoodsName; | goodName = res.MorkOrder.GoodsName; | ||||
SortNum = res.MorkOrder.SortNum.ToString(); | SortNum = res.MorkOrder.SortNum.ToString(); | ||||
} | } | ||||
EventBus.EventBus.GetInstance().Publish(new OrderStatusChangedEvent() { SortNum = SortNum, GoodName = goodName, Status = oRDER_STATUS, SubOrderId = subid, deviceClientType = DeviceType }); | EventBus.EventBus.GetInstance().Publish(new OrderStatusChangedEvent() { SortNum = SortNum, GoodName = goodName, Status = oRDER_STATUS, SubOrderId = subid, deviceClientType = DeviceType }); | ||||
var index = DataServer.GetInstance.morkS.MakeOrder.FindIndex(p => p.SortNum == SortNum); | |||||
if (index >= 0 && index < DataServer.GetInstance.morkS.MakeOrder.Count) | |||||
{ | |||||
if (oRDER_STATUS == ORDER_STATUS.COMPLETED_COOK) | |||||
{ | |||||
DataServer.GetInstance.morkS.MakeOrder.RemoveAt(index); | |||||
DataServer.GetInstance.morkS.MakeOrderOver.Add(new OrderMakeModel() | |||||
{ | |||||
Status = oRDER_STATUS, | |||||
GoodName = goodName, | |||||
SortNum = SortNum, | |||||
StopTime = DateTime.Now.ToString("HH:mm:ss") | |||||
}); | |||||
} | |||||
else if (oRDER_STATUS == ORDER_STATUS.COMPLETED_TAKE) | |||||
{ | |||||
var temp = DataServer.GetInstance.morkS.MakeOrderOver.FirstOrDefault(p => p.SortNum == SortNum); | |||||
if (temp != null) DataServer.GetInstance.morkS.MakeOrderOver.Remove(temp); | |||||
} | |||||
else | |||||
{ | |||||
DataServer.GetInstance.morkS.MakeOrder.ElementAt(index).Status = oRDER_STATUS; | |||||
} | |||||
} | |||||
else | |||||
{ | |||||
DataServer.GetInstance.morkS.MakeOrder.Add(new OrderMakeModel() | |||||
{ | |||||
Status = oRDER_STATUS, | |||||
GoodName = goodName, | |||||
SortNum = SortNum, | |||||
StartTime = DateTime.Now.ToString("HH:mm:ss") | |||||
}); | |||||
} | |||||
} | } | ||||
private void GetStatus(string key, Action<object> action) | private void GetStatus(string key, Action<object> action) | ||||
@@ -154,6 +188,16 @@ namespace BPASmartClient.MorkS | |||||
public override void ReadData() | public override void ReadData() | ||||
{ | { | ||||
DataServer.GetInstance.morkS.Alarm.Clear(); | |||||
alarms.ForEach(item => | |||||
{ | |||||
DataServer.GetInstance.morkS.Alarm.Add(new AlarmModel() | |||||
{ | |||||
AlarmTime = $"{item.Date} {item.Time}", | |||||
AlarmMs = item.Info | |||||
}); | |||||
}); | |||||
GetStatus("M230.0", new Action<object>((obj) => | GetStatus("M230.0", new Action<object>((obj) => | ||||
{ | { | ||||
if (obj is bool[] bools && bools.Length > 0 && bools.Length <= 24) | if (obj is bool[] bools && bools.Length > 0 && bools.Length <= 24) | ||||
@@ -215,6 +259,11 @@ namespace BPASmartClient.MorkS | |||||
mORKS.TurntableUpLimit = bools[13]; | mORKS.TurntableUpLimit = bools[13]; | ||||
mORKS.FeedComplete = bools[14]; | mORKS.FeedComplete = bools[14]; | ||||
mORKS.TurntableMoveInPlace = bools[15]; | mORKS.TurntableMoveInPlace = bools[15]; | ||||
DataServer.GetInstance.morkS.MorkS_Temp = mORKS.TemperatureReached; | |||||
DataServer.GetInstance.morkS.Morks_SiloMeasUp = mORKS.TurntableUpLimit; | |||||
DataServer.GetInstance.morkS.Morks_SiloMeasDown = mORKS.TurntableLowerLimit; | |||||
DataServer.GetInstance.morkS.MorkS_NoBowMeas1 = mORKS.MissingBowl; | |||||
DataServer.GetInstance.morkS.MorkS_NoBowMeas2 = mORKS.MissingBowlSignal2; | |||||
} | } | ||||
})); | })); | ||||
@@ -247,6 +296,7 @@ namespace BPASmartClient.MorkS | |||||
for (int i = 0; i < 6; i++) | for (int i = 0; i < 6; i++) | ||||
{ | { | ||||
mORKS.CookNoodlesComplete[i] = bools[i]; | mORKS.CookNoodlesComplete[i] = bools[i]; | ||||
DataServer.GetInstance.morkS.Morks_NoodleUpOrDown[i] = bools[i]; | |||||
} | } | ||||
} | } | ||||
@@ -256,6 +306,7 @@ namespace BPASmartClient.MorkS | |||||
{ | { | ||||
if (obj is ushort[] UshortValue && UshortValue.Length > 0 && UshortValue.Length <= 1) | if (obj is ushort[] UshortValue && UshortValue.Length > 0 && UshortValue.Length <= 1) | ||||
mORKS.TurntableFeedbackloc = UshortValue[0]; | mORKS.TurntableFeedbackloc = UshortValue[0]; | ||||
DataServer.GetInstance.morkS.MorkS_BinLocation = mORKS.TurntableFeedbackloc; | |||||
})); | })); | ||||
} | } | ||||
@@ -273,8 +324,11 @@ namespace BPASmartClient.MorkS | |||||
if (order.MorkOrder.GoodBatchings == null) return; | if (order.MorkOrder.GoodBatchings == null) return; | ||||
if (mORKS.HistorySuborderId.Contains(order.MorkOrder.SuborderId)) return; | if (mORKS.HistorySuborderId.Contains(order.MorkOrder.SuborderId)) return; | ||||
OrderCount++; | OrderCount++; | ||||
Json<OrderStatistics>.Data.StatisticsTime=DateTime.Now; | |||||
if (DateTime.Now.Subtract(Json<OrderStatistics>.Data.StatisticsTime).Days != 0) | |||||
Json<OrderStatistics>.Data.Count = 0; | |||||
Json<OrderStatistics>.Data.StatisticsTime = DateTime.Now; | |||||
Json<OrderStatistics>.Data.Count++; | Json<OrderStatistics>.Data.Count++; | ||||
Json<OrderStatistics>.Save(); | |||||
OrderChange(order.MorkOrder.SuborderId, ORDER_STATUS.WAIT); | OrderChange(order.MorkOrder.SuborderId, ORDER_STATUS.WAIT); | ||||
DeviceProcessLogShow($"接收到{OrderCount}次订单,订单ID:{order.MorkOrder.SuborderId}"); | DeviceProcessLogShow($"接收到{OrderCount}次订单,订单ID:{order.MorkOrder.SuborderId}"); | ||||
mORKS.HistorySuborderId.Add(order.MorkOrder.SuborderId); | mORKS.HistorySuborderId.Add(order.MorkOrder.SuborderId); | ||||
@@ -600,7 +654,7 @@ namespace BPASmartClient.MorkS | |||||
} | } | ||||
//取餐完成逻辑处理 | //取餐完成逻辑处理 | ||||
if (Delay.GetInstance("CompleteChange1").Start( !mORKS.TakeMealDetect, 1)&&mORKS.CookCompleteFlatBit == true) | |||||
if (Delay.GetInstance("CompleteChange1").Start(!mORKS.TakeMealDetect, 1) && mORKS.CookCompleteFlatBit == true) | |||||
{ | { | ||||
OrderChange(mORKS.OutMealId, ORDER_STATUS.COMPLETED_TAKE); | OrderChange(mORKS.OutMealId, ORDER_STATUS.COMPLETED_TAKE); | ||||
DeviceProcessLogShow($"订单【{mORKS.OutMealId}】取餐完成"); | DeviceProcessLogShow($"订单【{mORKS.OutMealId}】取餐完成"); | ||||
@@ -814,7 +868,7 @@ namespace BPASmartClient.MorkS | |||||
mORKS.TakeBowlTask.Enqueue(new OrderLocInfo() { Loc = (ushort)msm.Bowloc, SuborderId = guid }); | mORKS.TakeBowlTask.Enqueue(new OrderLocInfo() { Loc = (ushort)msm.Bowloc, SuborderId = guid }); | ||||
MessageLog.GetInstance.Show($"添加订单:碗位置【{(ushort)msm.Bowloc}】"); | MessageLog.GetInstance.Show($"添加订单:碗位置【{(ushort)msm.Bowloc}】"); | ||||
} | } | ||||
} | } | ||||
}); | }); | ||||
} | } | ||||
@@ -6,6 +6,8 @@ using System.Threading; | |||||
using System.Threading.Tasks; | using System.Threading.Tasks; | ||||
using BPA.Helper; | using BPA.Helper; | ||||
using BPASmartClient.MQTT; | using BPASmartClient.MQTT; | ||||
using BPA.Message; | |||||
using BPASmartClient.Model; | |||||
namespace BPASmartClient.MorkS | namespace BPASmartClient.MorkS | ||||
{ | { | ||||
@@ -16,22 +18,27 @@ namespace BPASmartClient.MorkS | |||||
public static DataServer GetInstance => _Instance ?? (_Instance = new DataServer()); | public static DataServer GetInstance => _Instance ?? (_Instance = new DataServer()); | ||||
private DataServer() { } | private DataServer() { } | ||||
public ScreenModelMorkS morkS { get; set; } = new ScreenModelMorkS(); | |||||
MQTTProxy mQTTProxy = new MQTTProxy(); | |||||
public void Init() | public void Init() | ||||
{ | { | ||||
MQTTProxy mQTTProxy = new MQTTProxy(); | |||||
mQTTProxy.Connected = new Action(() => | mQTTProxy.Connected = new Action(() => | ||||
{ | { | ||||
mQTTProxy.Subscrib(""); | |||||
mQTTProxy.Subscrib(ScreenTOPIC.GetInstance.GetTopic(ScreenDeviceType.煮面机)); | |||||
ThreadManage.GetInstance().StartLong(new Action(() => | ThreadManage.GetInstance().StartLong(new Action(() => | ||||
{ | { | ||||
mQTTProxy.Publish("", ""); | |||||
morkS.MorkS_OrderCount = Json<OrderStatistics>.Data.Count; | |||||
SendScreenDataModel sendScreenDataModel = new SendScreenDataModel(); | |||||
sendScreenDataModel.Name = ScreenDeviceType.煮面机; | |||||
sendScreenDataModel.Value = morkS.ToJSON(); | |||||
mQTTProxy.Publish(ScreenTOPIC.GetInstance.GetTopic(ScreenDeviceType.煮面机), sendScreenDataModel.ToJSON()); | |||||
Thread.Sleep(100); | Thread.Sleep(100); | ||||
}), "海科食堂大屏监听"); | }), "海科食堂大屏监听"); | ||||
}); | }); | ||||
mQTTProxy.Connect("UserName", "Password", "Host", 1883, $"MORKS 设备监听数据{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")}"); | mQTTProxy.Connect("UserName", "Password", "Host", 1883, $"MORKS 设备监听数据{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")}"); | ||||
} | } | ||||
//订单信息(正在制作,等待制作,制作完成) | //订单信息(正在制作,等待制作,制作完成) | ||||
//煮面炉上下状态(6个煮面炉上或下) | //煮面炉上下状态(6个煮面炉上或下) | ||||
//温度状态(煮面炉温度是否到达) | //温度状态(煮面炉温度是否到达) | ||||
@@ -57,6 +57,7 @@ namespace BPASmartClient.S7Net | |||||
default: | default: | ||||
numBytes = GetClassSize(Activator.CreateInstance(type), numBytes, isInnerProperty: true); | numBytes = GetClassSize(Activator.CreateInstance(type), numBytes, isInnerProperty: true); | ||||
if (type.IsClass) IncrementToEven(ref numBytes); | if (type.IsClass) IncrementToEven(ref numBytes); | ||||
else if (!type.IsPrimitive && !type.IsEnum && type.IsValueType) IncrementToEven(ref numBytes); | |||||
break; | break; | ||||
} | } | ||||
@@ -401,7 +402,6 @@ namespace BPASmartClient.S7Net | |||||
{ | { | ||||
break; | break; | ||||
} | } | ||||
numBytes = SetBytesFromProperty(array.GetValue(i), bytes, numBytes, accessableProperty); | numBytes = SetBytesFromProperty(array.GetValue(i), bytes, numBytes, accessableProperty); | ||||
} | } | ||||
} | } | ||||
@@ -410,7 +410,6 @@ namespace BPASmartClient.S7Net | |||||
numBytes = SetBytesFromProperty(accessableProperty.GetValue(sourceClass, null), bytes, numBytes, accessableProperty); | numBytes = SetBytesFromProperty(accessableProperty.GetValue(sourceClass, null), bytes, numBytes, accessableProperty); | ||||
} | } | ||||
} | } | ||||
return numBytes; | return numBytes; | ||||
} | } | ||||
@@ -2,6 +2,7 @@ | |||||
using System.Net; | using System.Net; | ||||
using System.Text; | using System.Text; | ||||
using BPASmartClient.S7Net; | using BPASmartClient.S7Net; | ||||
using System.Text; | |||||
namespace BPASmartClient.S7Net | namespace BPASmartClient.S7Net | ||||
{ | { | ||||
@@ -106,6 +107,13 @@ namespace BPASmartClient.S7Net | |||||
} | } | ||||
} | } | ||||
public void WriteString(int db,string txt, int startAddress = 0) | |||||
{ | |||||
var temp = Encoding.ASCII.GetBytes(txt); | |||||
var bytes = S7.Net.Types.S7String.ToByteArray(txt, temp.Length); | |||||
myPlc.WriteBytes(DataType.DataBlock,db, startAddress, bytes); | |||||
} | |||||
public TResult ReadClass<TResult>(int db, int startByteAdr = 0) where TResult : class, new() | public TResult ReadClass<TResult>(int db, int startByteAdr = 0) where TResult : class, new() | ||||
{ | { | ||||
TResult sourceClass = new TResult(); | TResult sourceClass = new TResult(); | ||||
@@ -28,6 +28,7 @@ | |||||
<con:BoolToVisibilityConvert x:Key="BoolToVisibilityConvert" /> | <con:BoolToVisibilityConvert x:Key="BoolToVisibilityConvert" /> | ||||
<con:CountIsVisiableConvert x:Key="CountIsVisiableConvert" /> | <con:CountIsVisiableConvert x:Key="CountIsVisiableConvert" /> | ||||
<con:BoolToFillColorConverter x:Key="BoolToFillColorConverter" /> | <con:BoolToFillColorConverter x:Key="BoolToFillColorConverter" /> | ||||
<con:RecipeStatusConvert x:Key="RecipeStatusConvert" /> | |||||
</ResourceDictionary> | </ResourceDictionary> | ||||
<ResourceDictionary> | <ResourceDictionary> | ||||
@@ -28,8 +28,12 @@ namespace BPASmartClient.DosingSystem | |||||
BPASmartClient.Helper.SystemHelper.GetInstance.CreateDesktopShortcut(); | BPASmartClient.Helper.SystemHelper.GetInstance.CreateDesktopShortcut(); | ||||
MenuInit(); | MenuInit(); | ||||
DataInit(); | DataInit(); | ||||
DeviceInquire.GetInstance.Init();//配料机设备上线监听,设备列表初始化 | |||||
ThreadManage.GetInstance().Start(new Action(() => | |||||
{ | |||||
DeviceInquire.GetInstance.Init();//配料机设备上线监听,设备列表初始化 | |||||
}), "设备初始化"); | |||||
MainView mv = new MainView(); | MainView mv = new MainView(); | ||||
mv.TitleName = "味魔方管理系统软件[简称:味魔方] 1.0.1"; | |||||
LoginView lv = new LoginView(); | LoginView lv = new LoginView(); | ||||
var res = lv.ShowDialog(); | var res = lv.ShowDialog(); | ||||
if (res != null && res == true) | if (res != null && res == true) | ||||
@@ -307,7 +307,7 @@ namespace BPASmartClient.DosingSystem | |||||
modbusTcp.ShowEx = new Action<string>((s) => { MessageNotify.GetInstance.ShowRunLog(s); }); | modbusTcp.ShowEx = new Action<string>((s) => { MessageNotify.GetInstance.ShowRunLog(s); }); | ||||
this.DeviceName = DeviceName; | this.DeviceName = DeviceName; | ||||
AlarmHelper<AlarmInfo>.Init(); | AlarmHelper<AlarmInfo>.Init(); | ||||
if (modbusTcp.Connected) | if (modbusTcp.Connected) | ||||
{ | { | ||||
ThreadManage.GetInstance().StartLong(new Action(() => | ThreadManage.GetInstance().StartLong(new Action(() => | ||||
@@ -364,7 +364,7 @@ namespace BPASmartClient.DosingSystem | |||||
modbusTcp.SetUint(DeviceAddress.ServoManualSpeed, (uint)res.ServoManualSpeed); | modbusTcp.SetUint(DeviceAddress.ServoManualSpeed, (uint)res.ServoManualSpeed); | ||||
modbusTcp.SetUint(DeviceAddress.SiloUpperLimitWeight, (uint)res.SiloUpperLimitWeight); | modbusTcp.SetUint(DeviceAddress.SiloUpperLimitWeight, (uint)res.SiloUpperLimitWeight); | ||||
modbusTcp.SetUint(DeviceAddress.LowerLimitWeightOfSilo, (uint)res.LowerLimitWeightOfSilo); | modbusTcp.SetUint(DeviceAddress.LowerLimitWeightOfSilo, (uint)res.LowerLimitWeightOfSilo); | ||||
modbusTcp.SetUint(DeviceAddress.StirringSpeed, (uint)res.StirringSpeed * 100); | |||||
modbusTcp.SetUint(DeviceAddress.StirringSpeed, (uint)res.StirringSpeed); | |||||
MessageNotify.GetInstance.ShowRunLog($"{res.MaterialName},参数下发完成"); | MessageNotify.GetInstance.ShowRunLog($"{res.MaterialName},参数下发完成"); | ||||
} | } | ||||
} | } | ||||
@@ -40,6 +40,11 @@ namespace BPASmartClient.DosingSystem | |||||
[Newtonsoft.Json.JsonIgnore] | [Newtonsoft.Json.JsonIgnore] | ||||
public AutoResetEvent Are { get; set; } = new AutoResetEvent(false); | public AutoResetEvent Are { get; set; } = new AutoResetEvent(false); | ||||
[Newtonsoft.Json.JsonIgnore] | |||||
public string RecipStatus { get { return _mRecipStatus; } set { _mRecipStatus = value; OnPropertyChanged(); } } | |||||
private string _mRecipStatus; | |||||
/// <summary> | /// <summary> | ||||
/// 原料集合 | /// 原料集合 | ||||
/// </summary> | /// </summary> | ||||
@@ -1,5 +1,4 @@ | |||||
using BPASmartClient.Helper; | |||||
using System; | |||||
using System; | |||||
using System.Collections.Generic; | using System.Collections.Generic; | ||||
using System.Linq; | using System.Linq; | ||||
using System.Text; | using System.Text; | ||||
@@ -12,6 +11,7 @@ using System.Windows.Input; | |||||
using System.Windows.Media; | using System.Windows.Media; | ||||
using System.Windows.Media.Imaging; | using System.Windows.Media.Imaging; | ||||
using System.Windows.Shapes; | using System.Windows.Shapes; | ||||
using BPA.Helper; | |||||
namespace BPASmartClient.DosingSystem.View | namespace BPASmartClient.DosingSystem.View | ||||
{ | { | ||||
@@ -23,8 +23,8 @@ namespace BPASmartClient.DosingSystem.View | |||||
public ChangeDeviceNameView() | public ChangeDeviceNameView() | ||||
{ | { | ||||
InitializeComponent(); | InitializeComponent(); | ||||
ActionManage.GetInstance.CancelRegister("ChangeDeviceNameViewClose"); | |||||
ActionManage.GetInstance.Register(new Action(() => { this.Close(); }), "ChangeDeviceNameViewClose"); | |||||
//ActionManage.GetInstance.CancelRegister("ChangeDeviceNameViewClose"); | |||||
ActionManage.GetInstance.Register(new Action(() => { this.Close(); }), "ChangeDeviceNameViewClose", true); | |||||
this.br.MouseLeftButtonDown += (o, e) => { if (e.LeftButton == MouseButtonState.Pressed) this.DragMove(); }; | this.br.MouseLeftButtonDown += (o, e) => { if (e.LeftButton == MouseButtonState.Pressed) this.DragMove(); }; | ||||
} | } | ||||
} | } | ||||
@@ -880,8 +880,8 @@ | |||||
HorizontalAlignment="Center" | HorizontalAlignment="Center" | ||||
VerticalAlignment="Center" | VerticalAlignment="Center" | ||||
FontSize="16" | FontSize="16" | ||||
Foreground="Yellow" | |||||
Text="等待执行" /> | |||||
Foreground="{Binding RecipStatus,Converter={StaticResource RecipeStatusConvert}}" | |||||
Text="{Binding RecipStatus}" /> | |||||
<Border | <Border | ||||
Grid.ColumnSpan="10" | Grid.ColumnSpan="10" | ||||
BorderBrush="{StaticResource bordColor}" | BorderBrush="{StaticResource bordColor}" | ||||
@@ -54,15 +54,6 @@ namespace BPASmartClient.DosingSystem.ViewModel | |||||
private static string IpAddress = string.Empty; | private static string IpAddress = string.Empty; | ||||
//public BPARelayCommand ConfirmCommand { get; set; } | |||||
//public BPARelayCommand CancleCommand { get; set; } | |||||
//public string ErrorInfo { get { return _mErrorInfo; } set { _mErrorInfo = value; OnPropertyChanged(); } } | |||||
//private string _mErrorInfo; | |||||
public string DeviceName { get { return _mDeviceName; } set { _mDeviceName = value; OnPropertyChanged(); } } | public string DeviceName { get { return _mDeviceName; } set { _mDeviceName = value; OnPropertyChanged(); } } | ||||
private string _mDeviceName; | private string _mDeviceName; | ||||
@@ -59,7 +59,7 @@ namespace BPASmartClient.DosingSystem.ViewModel | |||||
RecipeNames.Enqueue(deviceName); | RecipeNames.Enqueue(deviceName); | ||||
var t = RecipeNames.GetHashCode(); | var t = RecipeNames.GetHashCode(); | ||||
var res = Recipes.FirstOrDefault(p => p.RecipeName == deviceName); | var res = Recipes.FirstOrDefault(p => p.RecipeName == deviceName); | ||||
UserTreeWait.Add(new RecipeModel { SerialNum = UserTreeWait.Count + 1, RecipeName = deviceName, RawMaterials = res.RawMaterials }); | |||||
UserTreeWait.Add(new RecipeModel { RecipStatus = "等待制作", SerialNum = UserTreeWait.Count + 1, RecipeName = deviceName, RawMaterials = res.RawMaterials }); | |||||
} | } | ||||
NoticeDemoViewModel.OpenMsg(EnumPromptType.Success, App.MainWindow, "提示", $"配方下发成功!"); | NoticeDemoViewModel.OpenMsg(EnumPromptType.Success, App.MainWindow, "提示", $"配方下发成功!"); | ||||
MessageNotify.GetInstance.ShowUserLog($"下发工单 {Guid.NewGuid().ToString()}"); | MessageNotify.GetInstance.ShowUserLog($"下发工单 {Guid.NewGuid().ToString()}"); | ||||
@@ -107,7 +107,7 @@ namespace BPASmartClient.DosingSystem.ViewModel | |||||
if (tempDevice != null) | if (tempDevice != null) | ||||
{ | { | ||||
/*data = data.SetBitValue((byte)tempDevice.DeviceNum, true);*/ | /*data = data.SetBitValue((byte)tempDevice.DeviceNum, true);*/ | ||||
if (tempDevice.DeviceNum > 0) | |||||
if (tempDevice.DeviceNum > 0) | |||||
{ | { | ||||
int a = data.SetBitValue((byte)tInfo.ElementAt(i).ElementAt(m).Loc, true); | int a = data.SetBitValue((byte)tInfo.ElementAt(i).ElementAt(m).Loc, true); | ||||
byte[] test1 = a.ToBytes(BPA.Helper.DataFormat.ABCD); | byte[] test1 = a.ToBytes(BPA.Helper.DataFormat.ABCD); | ||||
@@ -116,9 +116,9 @@ namespace BPASmartClient.DosingSystem.ViewModel | |||||
MessageNotify.GetInstance.ShowRunLog($"下发配方DB4.DBD{2 + (tempDevice.DeviceNum - 1) * 4} :{item.ToBinString()}"); | MessageNotify.GetInstance.ShowRunLog($"下发配方DB4.DBD{2 + (tempDevice.DeviceNum - 1) * 4} :{item.ToBinString()}"); | ||||
} | } | ||||
} | } | ||||
if (tInfo.ElementAt(i).ElementAt(m).Loc >0) | |||||
if (tInfo.ElementAt(i).ElementAt(m).Loc > 0) | |||||
{ | { | ||||
if (!BarrelNum.Contains(tInfo.ElementAt(i).ElementAt(m).Loc)) | |||||
if (!BarrelNum.Contains(tInfo.ElementAt(i).ElementAt(m).Loc)) | |||||
{ | { | ||||
BarrelNum.Add(tInfo.ElementAt(i).ElementAt(m).Loc); | BarrelNum.Add(tInfo.ElementAt(i).ElementAt(m).Loc); | ||||
} | } | ||||
@@ -232,6 +232,7 @@ namespace BPASmartClient.DosingSystem.ViewModel | |||||
RecipeName = recipeComple.RecipeName, | RecipeName = recipeComple.RecipeName, | ||||
SerialNum = UserTreeCompelete.Count + 1, | SerialNum = UserTreeCompelete.Count + 1, | ||||
RecipCode = recipeComple.RecipCode, | RecipCode = recipeComple.RecipCode, | ||||
RecipStatus = "制作完成" | |||||
}); | }); | ||||
}); | }); | ||||
App.Current.Dispatcher.Invoke(new Action(() => | App.Current.Dispatcher.Invoke(new Action(() => | ||||
@@ -283,14 +284,14 @@ namespace BPASmartClient.DosingSystem.ViewModel | |||||
MessageNotify.GetInstance.ShowRunLog("错误"); | MessageNotify.GetInstance.ShowRunLog("错误"); | ||||
return; | return; | ||||
} | } | ||||
else | |||||
else | |||||
{ | { | ||||
switch (cnt) | switch (cnt) | ||||
{ | { | ||||
case 1: | case 1: | ||||
int a1 = Array.FindIndex(DeviceInquire.GetInstance.devices.ToArray(), p => p.DeviceNum == 1); | int a1 = Array.FindIndex(DeviceInquire.GetInstance.devices.ToArray(), p => p.DeviceNum == 1); | ||||
int b1 = Array.FindIndex(DeviceInquire.GetInstance.devices.ToArray(), p => p.DeviceNum == 2); | int b1 = Array.FindIndex(DeviceInquire.GetInstance.devices.ToArray(), p => p.DeviceNum == 2); | ||||
if (a1 >= 0) | |||||
if (a1 >= 0) | |||||
{ | { | ||||
Location1 = Array.FindIndex(Recipes.ElementAt(i).RawMaterials.ToArray(), p => p.RawMaterialName == DeviceInquire.GetInstance.devices.ElementAt(a1).DeviceName && p.Loc == barrel); | Location1 = Array.FindIndex(Recipes.ElementAt(i).RawMaterials.ToArray(), p => p.RawMaterialName == DeviceInquire.GetInstance.devices.ElementAt(a1).DeviceName && p.Loc == barrel); | ||||
} | } | ||||
@@ -461,7 +462,7 @@ namespace BPASmartClient.DosingSystem.ViewModel | |||||
} | } | ||||
} | } | ||||
} | } | ||||
else | |||||
else | |||||
{ | { | ||||
if (Location2 >= 0) | if (Location2 >= 0) | ||||
{ | { | ||||