ソースを参照

1. 调试日志界面添加滚动条。2. 修改完成数据的传送方式,避免阻塞线程。

master
ZhaoGang 1年前
コミット
4c1cf03809
3個のファイルの変更161行の追加132行の削除
  1. +1
    -1
      BPASmartClient.CustomResource/Pages/View/DebugLogView.xaml
  2. +114
    -86
      BPASmartClient.JXJFoodBigStation/Model/ProcessControl.cs
  3. +46
    -45
      BPASmartClient.JXJFoodSmallStation/Model/ProcessControl.cs

+ 1
- 1
BPASmartClient.CustomResource/Pages/View/DebugLogView.xaml ファイルの表示

@@ -18,7 +18,7 @@
<ScrollViewer
Margin="20"
HorizontalScrollBarVisibility="Hidden"
VerticalScrollBarVisibility="Hidden">
VerticalScrollBarVisibility="Auto">

<ItemsControl ItemsSource="{Binding MessageModels}">
<ItemsControl.ItemTemplate>


+ 114
- 86
BPASmartClient.JXJFoodBigStation/Model/ProcessControl.cs ファイルの表示

@@ -1,4 +1,5 @@
using BPASmartClient.CustomResource.Pages.Model;
using BPA.Message;
using BPASmartClient.CustomResource.Pages.Model;
using BPASmartClient.Helper;
using BPASmartClient.JXJFoodBigStation.Model.HK_PLC;
using BPASmartClient.JXJFoodBigStation.Model.Siemens;
@@ -1069,9 +1070,7 @@ namespace BPASmartClient.JXJFoodBigStation.Model
}
//以下为新增,复位DB99托盘号,配方号,桶重量参数,以及配方下发确认和配料完成。
StockBinParReset();
HKDevice.HK_PLC_S7.Write("DB99.DBX0.3", false);
HKDevice.HK_PLC_S7.Write("DB99.DBX1.4", false);
GVL_BigStation.Recipe1DosingFinish = false;
}
break;
case 10:
@@ -1137,6 +1136,9 @@ namespace BPASmartClient.JXJFoodBigStation.Model
{
MessageNotify.GetInstance.ShowRunLog($"海科PLC写入{HKDevice.HK_PLC_S7.Write("DB99.DBX230.0", true)}");
MessageNotify.GetInstance.ShowRunLog($"海科PLC写入{HKDevice.HK_PLC_S7.Write("DB99.DBW232", (short)TrayCode)}");
HKDevice.HK_PLC_S7.Write("DB99.DBX0.3", false);
HKDevice.HK_PLC_S7.Write("DB99.DBX1.4", false);
GVL_BigStation.Recipe1DosingFinish = false;
GVL_BigStation.Recipe1DosingStatus = 0;
GVL_BigStation.Order_CancelStep = 32;
MessageNotify.GetInstance.ShowRunLog($"PLC正在执行配料流程,取消订单:{code}");
@@ -1171,6 +1173,9 @@ namespace BPASmartClient.JXJFoodBigStation.Model
{
MessageNotify.GetInstance.ShowRunLog($"海科PLC写入{HKDevice.HK_PLC_S7.Write("DB99.DBX230.0", true)}");
MessageNotify.GetInstance.ShowRunLog($"海科PLC写入{HKDevice.HK_PLC_S7.Write("DB99.DBW232", (short)TrayCode)}");
HKDevice.HK_PLC_S7.Write("DB99.DBX0.4", false);
HKDevice.HK_PLC_S7.Write("DB99.DBX1.5", false);
GVL_BigStation.Recipe2DosingFinish = false;
GVL_BigStation.Recipe2DosingStatus = 0;
GVL_BigStation.Order_CancelStep = 42;
MessageNotify.GetInstance.ShowRunLog($"PLC正在执行配料流程,取消订单:【{code}】");
@@ -1205,6 +1210,9 @@ namespace BPASmartClient.JXJFoodBigStation.Model
{
MessageNotify.GetInstance.ShowRunLog($"海科PLC写入{HKDevice.HK_PLC_S7.Write("DB99.DBX230.0", true)}");
MessageNotify.GetInstance.ShowRunLog($"海科PLC写入{HKDevice.HK_PLC_S7.Write("DB99.DBW232", (short)TrayCode)}");
HKDevice.HK_PLC_S7.Write("DB99.DBX0.5", false);
HKDevice.HK_PLC_S7.Write("DB99.DBX1.6", false);
GVL_BigStation.Recipe3DosingFinish = false;
GVL_BigStation.Recipe3DosingStatus = 0;
GVL_BigStation.Order_CancelStep = 52;
MessageNotify.GetInstance.ShowRunLog($"PLC正在执行配料流程,取消订单:【{code}】");
@@ -1239,6 +1247,9 @@ namespace BPASmartClient.JXJFoodBigStation.Model
{
MessageNotify.GetInstance.ShowRunLog($"海科PLC写入{HKDevice.HK_PLC_S7.Write("DB99.DBX230.0", true)}");
MessageNotify.GetInstance.ShowRunLog($"海科PLC写入{HKDevice.HK_PLC_S7.Write("DB99.DBW232", (short)TrayCode)}");
HKDevice.HK_PLC_S7.Write("DB99.DBX0.6", false);
HKDevice.HK_PLC_S7.Write("DB99.DBX1.7", false);
GVL_BigStation.Recipe4DosingFinish = false;
GVL_BigStation.Recipe4DosingStatus = 0;
GVL_BigStation.Order_CancelStep = 62;
MessageNotify.GetInstance.ShowRunLog($"PLC正在执行配料流程,取消订单:【{code}】");
@@ -1376,35 +1387,39 @@ namespace BPASmartClient.JXJFoodBigStation.Model
double a = DateTime.Now.Subtract(GVL_BigStation.DosingRecipe1Time).TotalSeconds;
FinishData.ProcessTime = Convert.ToInt16(a);
//SiemensDevice.Siemens_PLC_S7.WriteClass<DL_Finish_DB>(FinishData, 2361);
MessageNotify.GetInstance.ShowRunLog($"配方队列【1】,配方编号:{code},托盘编号:{trayCode},配料完成,将信号反馈给西门子。");

SendDataOperation(() =>
{
SiemensDevice.Siemens_PLC_S7.WriteClass<DL_Finish_DB>(FinishData, 2361);
}, () =>
{
return SiemensDevice.Siemens_PLC_S7.Read<bool>("DB2361.DBX0.0");
});
}
GVL_BigStation.Recipe1DosingStatus = 30;
HKDevice.HK_PLC_S7.Write("DB99.DBX1.4", true);
}

var result = SiemensDevice.Siemens_PLC_S7.Write<bool>("DB2361.DBX330.0", false, 5);
if (!string.IsNullOrEmpty(result) && result.Contains("成功"))
{
MessageNotify.GetInstance.ShowRunLog($"配方队列【1】,托盘编号:【{trayCode}】,配方编号:【{code}】,配料完成信号写入复位。");
}
else
if (GVL_BigStation.Recipe1DosingStatus == 30)
{
if (SiemensRecipes.ElementAt(index).RecipesSource == RecipeSource.远程)
{
if (SiemensDevice.IsConnected)
{
MessageNotify.GetInstance.ShowRunLog($"配方队列【1】,托盘编号:【{trayCode}】,配方编号:【{code}】,配料完成,已发送数据,但复位请求完成信号失败。");
if (SiemensDevice.Siemens_PLC_S7.Read<bool>("DB2361.DBX0.0"))
{
SiemensDevice.Siemens_PLC_S7.Write<bool>("DB2361.DBX330.0", false, 5);
MessageNotify.GetInstance.ShowRunLog($"配方队列【1】,配方编号:【{code}】,托盘编号:【{trayCode}】,配料完成,已将完成数据反馈至MES系统。");
GVL_BigStation.Recipe1DosingStatus = 40;
}
else
{
SiemensDevice.Siemens_PLC_S7.WriteClass<DL_Finish_DB>(FinishData, 2361);
Thread.Sleep(3000);
}
}
}
else
{
MessageNotify.GetInstance.ShowRunLog($"配方队列【1】,配方编号:【{code}】,托盘编号:【{trayCode}】,配料完成,配方为本地下发未将完成数据反馈至MES系统。");
GVL_BigStation.Recipe1DosingStatus = 40;
}

HKDevice.HK_PLC_S7.Write("DB99.DBX1.4", true);
GVL_BigStation.Recipe1DosingStatus = 3;
}
if (GVL_BigStation.Recipe1DosingStatus == 3 && HKDevice.PlcRead.Recipe1DosingFinish == false)
if (GVL_BigStation.Recipe1DosingStatus == 40 && HKDevice.PlcRead.Recipe1DosingFinish == false)
{
HKDevice.HK_PLC_S7.Write("DB99.DBX1.4", false);
SiemensRecipeQueue1.TryDequeue(out code);
@@ -1513,37 +1528,40 @@ namespace BPASmartClient.JXJFoodBigStation.Model
double a = DateTime.Now.Subtract(GVL_BigStation.DosingRecipe2Time).TotalSeconds;
FinishData.ProcessTime = Convert.ToInt16(a);
//SiemensDevice.Siemens_PLC_S7.WriteClass<DL_Finish_DB>(FinishData, 2361);
MessageNotify.GetInstance.ShowRunLog($"配方队列【2】,配方编号:{code},托盘编号:{trayCode},配料完成,将信号反馈给西门子");
}

SendDataOperation(() =>
{
SiemensDevice.Siemens_PLC_S7.WriteClass<DL_Finish_DB>(FinishData, 2361);
}, () =>
HKDevice.HK_PLC_S7.Write("DB99.DBX1.5", true);
GVL_BigStation.Recipe2DosingStatus = 30;
}
if (GVL_BigStation.Recipe2DosingStatus == 30)
{
if (SiemensRecipes.ElementAt(index).RecipesSource == RecipeSource.远程)
{
if (SiemensDevice.IsConnected)
{
return SiemensDevice.Siemens_PLC_S7.Read<bool>("DB2361.DBX0.0");
});
if (SiemensDevice.Siemens_PLC_S7.Read<bool>("DB2361.DBX0.0"))
{
SiemensDevice.Siemens_PLC_S7.Write<bool>("DB2361.DBX330.0", false, 5);

var result = SiemensDevice.Siemens_PLC_S7.Write<bool>("DB2361.DBX330.0", false, 5);
if (!string.IsNullOrEmpty(result) && result.Contains("成功"))
{
MessageNotify.GetInstance.ShowRunLog($"配方队列【2】,托盘编号:【{trayCode}】,配方编号:【{code}】,配料完成信号写入复位。");
}
else
{
MessageNotify.GetInstance.ShowRunLog($"配方队列【2】,托盘编号:【{trayCode}】,配方编号:【{code}】,配料完成,已发送数据,但复位请求完成信号失败。");
MessageNotify.GetInstance.ShowRunLog($"配方队列【2】,配方编号:【{code}】,托盘编号:【{trayCode}】,配料完成,已将完成数据反馈至MES系统。");
GVL_BigStation.Recipe2DosingStatus = 40;
}
else
{
SiemensDevice.Siemens_PLC_S7.WriteClass<DL_Finish_DB>(FinishData, 2361);
Thread.Sleep(3000);
}
}

}
else
{
MessageNotify.GetInstance.ShowRunLog($"配方队列【2】,配方编号:【{code}】,托盘编号:【{trayCode}】,配料完成,西门子未连接或配方为本地下发未将完成数据反馈至MES系统。");
MessageNotify.GetInstance.ShowRunLog($"配方队列【2】,配方编号:【{code}】,托盘编号:【{trayCode}】,配料完成,配方为本地下发未将完成数据反馈至MES系统。");
GVL_BigStation.Recipe2DosingStatus = 40;
}

HKDevice.HK_PLC_S7.Write("DB99.DBX1.5", true);
GVL_BigStation.Recipe2DosingStatus = 3;
}
if (GVL_BigStation.Recipe2DosingStatus == 3 && HKDevice.PlcRead.Recipe2DosingFinish == false)

if (GVL_BigStation.Recipe2DosingStatus == 40 && HKDevice.PlcRead.Recipe2DosingFinish == false)
{
HKDevice.HK_PLC_S7.Write("DB99.DBX1.5", false);
SiemensRecipeQueue2.TryDequeue(out code);
@@ -1652,35 +1670,39 @@ namespace BPASmartClient.JXJFoodBigStation.Model
double a = DateTime.Now.Subtract(GVL_BigStation.DosingRecipe3Time).TotalSeconds;
FinishData.ProcessTime = Convert.ToInt16(a);
//SiemensDevice.Siemens_PLC_S7.WriteClass<DL_Finish_DB>(FinishData, 2361);
MessageNotify.GetInstance.ShowRunLog($"配方队列【3】,配方编号:{code},托盘编号:{trayCode},配料完成,将信号反馈给西门子");
SendDataOperation(() =>
{
SiemensDevice.Siemens_PLC_S7.WriteClass<DL_Finish_DB>(FinishData, 2361);
}, () =>
{
return SiemensDevice.Siemens_PLC_S7.Read<bool>("DB2361.DBX0.0");
});
}
HKDevice.HK_PLC_S7.Write("DB99.DBX1.6", true);
GVL_BigStation.Recipe3DosingStatus = 30;
}

var result = SiemensDevice.Siemens_PLC_S7.Write<bool>("DB2361.DBX330.0", false, 5);
if (!string.IsNullOrEmpty(result) && result.Contains("成功"))
{
MessageNotify.GetInstance.ShowRunLog($"配方队列【3】,托盘编号:【{trayCode}】,配方编号:【{code}】,配料完成信号写入复位。");
}
else
if (GVL_BigStation.Recipe3DosingStatus == 30)
{
if (SiemensRecipes.ElementAt(index).RecipesSource == RecipeSource.远程)
{
if (SiemensDevice.IsConnected)
{
MessageNotify.GetInstance.ShowRunLog($"配方队列【3】,托盘编号:【{trayCode}】,配方编号:【{code}】,配料完成,已发送数据,但复位请求完成信号失败。");
}
if (SiemensDevice.Siemens_PLC_S7.Read<bool>("DB2361.DBX0.0"))
{
SiemensDevice.Siemens_PLC_S7.Write<bool>("DB2361.DBX330.0", false, 5);

MessageNotify.GetInstance.ShowRunLog($"配方队列【3】,配方编号:【{code}】,托盘编号:【{trayCode}】,配料完成,已将完成数据反馈至MES系统。");
GVL_BigStation.Recipe3DosingStatus = 40;
}
else
{
SiemensDevice.Siemens_PLC_S7.WriteClass<DL_Finish_DB>(FinishData, 2361);
Thread.Sleep(3000);
}
}
}
else
{
MessageNotify.GetInstance.ShowRunLog($"配方队列【3】,配方编号:【{code}】,托盘编号:【{trayCode}】,配料完成,西门子未连接或配方为本地下发未将完成数据反馈至MES系统。");
MessageNotify.GetInstance.ShowRunLog($"配方队列【3】,配方编号:【{code}】,托盘编号:【{trayCode}】,配料完成,配方为本地下发未将完成数据反馈至MES系统。");
GVL_BigStation.Recipe3DosingStatus = 40;
}
HKDevice.HK_PLC_S7.Write("DB99.DBX1.6", true);
GVL_BigStation.Recipe3DosingStatus = 3;
}
if (GVL_BigStation.Recipe3DosingStatus == 3 && HKDevice.PlcRead.Recipe3DosingFinish == false)

if (GVL_BigStation.Recipe3DosingStatus == 40 && HKDevice.PlcRead.Recipe3DosingFinish == false)
{
HKDevice.HK_PLC_S7.Write("DB99.DBX1.6", false);
SiemensRecipeQueue3.TryDequeue(out code);
@@ -1788,34 +1810,40 @@ namespace BPASmartClient.JXJFoodBigStation.Model
double a = DateTime.Now.Subtract(GVL_BigStation.DosingRecipe4Time).TotalSeconds;
FinishData.ProcessTime = Convert.ToInt16(a);
//SiemensDevice.Siemens_PLC_S7.WriteClass<DL_Finish_DB>(FinishData, 2361);
MessageNotify.GetInstance.ShowRunLog($"配方队列【4】,配方编号:{code},托盘编号:{trayCode},配料完成,将信号反馈给西门子");
}
HKDevice.HK_PLC_S7.Write("DB99.DBX1.7", true);
GVL_BigStation.Recipe4DosingStatus = 30;
}

SendDataOperation(() =>
{
SiemensDevice.Siemens_PLC_S7.WriteClass<DL_Finish_DB>(FinishData, 2361);
}, () =>
if (GVL_BigStation.Recipe4DosingStatus == 30)
{
if (SiemensRecipes.ElementAt(index).RecipesSource == RecipeSource.远程)
{
if (SiemensDevice.IsConnected)
{
return SiemensDevice.Siemens_PLC_S7.Read<bool>("DB2361.DBX0.0");
});
if (SiemensDevice.Siemens_PLC_S7.Read<bool>("DB2361.DBX0.0"))
{
SiemensDevice.Siemens_PLC_S7.Write<bool>("DB2361.DBX330.0", false, 5);

var result = SiemensDevice.Siemens_PLC_S7.Write<bool>("DB2361.DBX330.0", false, 5);
if (!string.IsNullOrEmpty(result) && result.Contains("成功"))
{
MessageNotify.GetInstance.ShowRunLog($"配方队列【4】,托盘编号:【{trayCode}】,配方编号:【{code}】,配料完成信号写入复位。");
}
else
{
MessageNotify.GetInstance.ShowRunLog($"配方队列【4】,托盘编号:【{trayCode}】,配方编号:【{code}】,配料完成,已发送数据,但复位请求完成信号失败。");
MessageNotify.GetInstance.ShowRunLog($"配方队列【4】,配方编号:【{code}】,托盘编号:【{trayCode}】,配料完成,已将完成数据反馈至MES系统。");
GVL_BigStation.Recipe4DosingStatus = 40;
}
else
{
SiemensDevice.Siemens_PLC_S7.WriteClass<DL_Finish_DB>(FinishData, 2361);
Thread.Sleep(3000);
}
}
}
else
{
MessageNotify.GetInstance.ShowRunLog($"配方队列【4】,配方编号:【{code}】,托盘编号:【{trayCode}】,配料完成,西门子未连接或配方为本地下发未将完成数据反馈至MES系统。");
MessageNotify.GetInstance.ShowRunLog($"配方队列【4】,配方编号:【{code}】,托盘编号:【{trayCode}】,配料完成,配方为本地下发未将完成数据反馈至MES系统。");
GVL_BigStation.Recipe4DosingStatus = 40;
}
HKDevice.HK_PLC_S7.Write("DB99.DBX1.7", true);
GVL_BigStation.Recipe4DosingStatus = 3;
}
if (GVL_BigStation.Recipe4DosingStatus == 3 && HKDevice.PlcRead.Recipe4DosingFinish == false)

if (GVL_BigStation.Recipe4DosingStatus == 40 && HKDevice.PlcRead.Recipe4DosingFinish == false)
{
HKDevice.HK_PLC_S7.Write("DB99.DBX1.7", false);
SiemensRecipeQueue4.TryDequeue(out code);


+ 46
- 45
BPASmartClient.JXJFoodSmallStation/Model/ProcessControl.cs ファイルの表示

@@ -810,7 +810,7 @@ namespace BPASmartClient.JXJFoodSmallStation.Model
{
//粉料仓下发配方
#region 粉料仓配料
if (GVL_SmallStation.GetInstance.IsUseWindSend && GVL_SmallStation.GetInstance.WindSendDosing == false /*&& GVL_SmallStation.GetInstance.Tray_AGVLogic[recipeNum] == 2*/)
if (GVL_SmallStation.GetInstance.IsUseWindSend && GVL_SmallStation.GetInstance.WindSendDosing == false && RemoteRecipes.ElementAt(index).WindSend.Count != 0 /*&& GVL_SmallStation.GetInstance.Tray_AGVLogic[recipeNum] == 2*/)
{
if (WindSendDevice.IsConnected)
{
@@ -1049,51 +1049,51 @@ namespace BPASmartClient.JXJFoodSmallStation.Model
MessageNotify.GetInstance.ShowRunLog($"配方ID:【{code}】:【{item.RawMaterialName}】,下料重量:【{item.Laying_Off_Weight}】g");
}

}
}
#region 生成配方完成数据。
if (RemoteRecipes.ElementAt(index).RecipesSource == RecipeSource.远程 /*!GVL_SmallStation.GetInstance.IsUseLocalRecipe*/)
{
double totalMakeTime = DateTime.Now.Subtract(GVL_SmallStation.GetInstance.DosingTime[recipeNum]).TotalSeconds;

#region 生成配方完成数据。
if (RemoteRecipes.ElementAt(index).RecipesSource == RecipeSource.远程 /*!GVL_SmallStation.GetInstance.IsUseLocalRecipe*/)
{
double totalMakeTime = DateTime.Now.Subtract(GVL_SmallStation.GetInstance.DosingTime[recipeNum]).TotalSeconds;
RecipeFinishInfo[recipeNum].Order_No = RemoteRecipes.ElementAt(index).RecipeCode;
RecipeFinishInfo[recipeNum].Product_Code = RemoteRecipes.ElementAt(index).RecipeName;
RecipeFinishInfo[recipeNum].Job_No = (short)trayCode;
for (int i = 0; i < 20; i++)
{
RecipeFinishInfo[recipeNum].Material[i] = new UDT1();
}
for (int i = 0; i < 10; i++)
{
RecipeFinishInfo[recipeNum].Powder[i] = new UDT2();
}
for (int i = 0; i < RemoteRecipes.ElementAt(index).RawMaterial.Count; i++)
{
RecipeFinishInfo[recipeNum].Material[i].Material_Name = RemoteRecipes.ElementAt(index).RawMaterial.ElementAt(i).RawMaterialName;
RecipeFinishInfo[recipeNum].Material[i].Material_BarrelNum = RemoteRecipes.ElementAt(index).RawMaterial.ElementAt(i).RawMaterialBarrelNum;
RecipeFinishInfo[recipeNum].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[recipeNum].Powder[i].Powder_Weight = RemoteRecipes.ElementAt(index).WindSend.ElementAt(i).DosingCompleWeight;
}
RecipeFinishInfo[recipeNum].Ask_For_Finish = true;
RecipeFinishInfo[recipeNum].DosingTime = Convert.ToInt16(totalMakeTime);
//SiemensDevice.Siemens_PLC_S7.WriteClass<XL_Finish_DB>(RecipeFinishInfo[recipeNum], 2261);

RecipeFinishInfo[recipeNum].Order_No = RemoteRecipes.ElementAt(index).RecipeCode;
RecipeFinishInfo[recipeNum].Product_Code = RemoteRecipes.ElementAt(index).RecipeName;
RecipeFinishInfo[recipeNum].Job_No = (short)trayCode;
for (int i = 0; i < 20; i++)
{
RecipeFinishInfo[recipeNum].Material[i] = new UDT1();
}
for (int i = 0; i < 10; i++)
{
RecipeFinishInfo[recipeNum].Powder[i] = new UDT2();
}
for (int i = 0; i < RemoteRecipes.ElementAt(index).RawMaterial.Count; i++)
{
RecipeFinishInfo[recipeNum].Material[i].Material_Name = RemoteRecipes.ElementAt(index).RawMaterial.ElementAt(i).RawMaterialName;
RecipeFinishInfo[recipeNum].Material[i].Material_BarrelNum = RemoteRecipes.ElementAt(index).RawMaterial.ElementAt(i).RawMaterialBarrelNum;
RecipeFinishInfo[recipeNum].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[recipeNum].Powder[i].Powder_Weight = RemoteRecipes.ElementAt(index).WindSend.ElementAt(i).DosingCompleWeight;
//MessageNotify.GetInstance.ShowRunLog($"托盘1,配方【{res.RecipeCode}】,配料完成,数据反馈给西门子");
//MessageNotify.GetInstance.ShowRecipeLog($"配方名称:【{res.RecipeName}】\t 配方号:【{res.RecipeCode}】");
}
//else
//{
// MessageNotify.GetInstance.ShowRunLog($"托盘1,配方【{res.RecipeCode}】,配料完成,数据无法反馈给西门子,西门子设备未连接或处于本地配方");
// MessageNotify.GetInstance.ShowRecipeLog($"配方名称:【{res.RecipeName}】\t 配方号:【{res.RecipeCode}】");
//}
#endregion

GVL_SmallStation.GetInstance.RecipeProcessStatus[recipeNum] = 30;
}
RecipeFinishInfo[recipeNum].Ask_For_Finish = true;
RecipeFinishInfo[recipeNum].DosingTime = Convert.ToInt16(totalMakeTime);
//SiemensDevice.Siemens_PLC_S7.WriteClass<XL_Finish_DB>(RecipeFinishInfo[recipeNum], 2261);

//MessageNotify.GetInstance.ShowRunLog($"托盘1,配方【{res.RecipeCode}】,配料完成,数据反馈给西门子");
//MessageNotify.GetInstance.ShowRecipeLog($"配方名称:【{res.RecipeName}】\t 配方号:【{res.RecipeCode}】");
}
//else
//{
// MessageNotify.GetInstance.ShowRunLog($"托盘1,配方【{res.RecipeCode}】,配料完成,数据无法反馈给西门子,西门子设备未连接或处于本地配方");
// MessageNotify.GetInstance.ShowRecipeLog($"配方名称:【{res.RecipeName}】\t 配方号:【{res.RecipeCode}】");
//}

GVL_SmallStation.GetInstance.RecipeProcessStatus[recipeNum] = 30;

#endregion

#region 发送完成数据
if (GVL_SmallStation.GetInstance.RecipeProcessStatus[recipeNum] == 30)
@@ -1895,7 +1895,7 @@ namespace BPASmartClient.JXJFoodSmallStation.Model
/// <param name="retrySecond"></param>
/// <returns></returns>
/// <exception cref="ArgumentNullException"></exception>
private bool SendDataOperation(Action operate,Func<bool> ack,int retrySecond=3)
private bool SendDataOperation(Action operate,Func<bool> ack, int retrytimes = 3,int retryInterval=3)
{
if (operate is null)
{
@@ -1909,13 +1909,14 @@ namespace BPASmartClient.JXJFoodSmallStation.Model

var isSuccess = false;
var isConnected = SiemensDevice.IsConnected;
var retryDelay = TimeSpan.FromSeconds(retrySecond);
var retryDelay = TimeSpan.FromSeconds(retryInterval);
int count = 0;
operate?.Invoke();

isSuccess = ack.Invoke();
while (!isSuccess)
while (!isSuccess && count<retrytimes)
{
count++;
if (isConnected)
{
Thread.Sleep(retryDelay);


読み込み中…
キャンセル
保存