|
|
@@ -864,7 +864,7 @@ namespace BPASmartClient.JXJFoodBigStation.Model |
|
|
|
case 3: |
|
|
|
SiemensDevice.Siemens_PLC_S7.WriteString(2331, data.RecipeCode, 10); |
|
|
|
SiemensDevice.Siemens_PLC_S7.Write("DB2331.DBX28.0", true); |
|
|
|
MessageNotify.GetInstance.ShowRunLog($"配方1,发送配方编号和请求配料标志给西门子"); |
|
|
|
MessageNotify.GetInstance.ShowRunLog($"配方队列【1】,配方:【{data.RecipeCode}】发送配方编号和请求配料标志给西门子"); |
|
|
|
GVL_BigStation.SiemensSendRecipeStatus = 4; |
|
|
|
break; |
|
|
|
case 4: |
|
|
@@ -872,7 +872,7 @@ namespace BPASmartClient.JXJFoodBigStation.Model |
|
|
|
{ |
|
|
|
SiemensDevice.Siemens_PLC_S7.WriteString(2331, "", 10); |
|
|
|
SiemensDevice.Siemens_PLC_S7.Write("DB2331.DBX28.0", false); |
|
|
|
MessageNotify.GetInstance.ShowRunLog($"配方1,西门子确认开始配料"); |
|
|
|
MessageNotify.GetInstance.ShowRunLog($"配方队列【1】,配方:【{data.RecipeCode}】西门子确认开始配料"); |
|
|
|
GVL_BigStation.SiemensSendRecipeStatus = 5; |
|
|
|
} |
|
|
|
break; |
|
|
@@ -880,7 +880,7 @@ namespace BPASmartClient.JXJFoodBigStation.Model |
|
|
|
if (SiemensDevice.DL_Status.Dosing_Start_ACK == false) |
|
|
|
{ |
|
|
|
SiemensRecipeQueue1.Enqueue(data.RecipeCode); |
|
|
|
MessageNotify.GetInstance.ShowRunLog($"配方1,配方:【{data.RecipeCode}】,加入队列"); |
|
|
|
MessageNotify.GetInstance.ShowRunLog($"配方队列【1】,配方:【{data.RecipeCode}】,加入队列"); |
|
|
|
GVL_BigStation.SiemensSendRecipeStatus = 0; |
|
|
|
} |
|
|
|
break; |
|
|
@@ -900,7 +900,7 @@ namespace BPASmartClient.JXJFoodBigStation.Model |
|
|
|
{ |
|
|
|
SiemensDevice.Siemens_PLC_S7.WriteString(2331, data.RecipeCode, 10); |
|
|
|
SiemensDevice.Siemens_PLC_S7.Write("DB2331.DBX28.0", true); |
|
|
|
MessageNotify.GetInstance.ShowRunLog($"配方2,发送配方编号和请求配料标志给西门子"); |
|
|
|
MessageNotify.GetInstance.ShowRunLog($"配方队列【2】,配方:【{data.RecipeCode}】发送配方编号和请求配料标志给西门子"); |
|
|
|
GVL_BigStation.SiemensSendRecipeStatus = 4; |
|
|
|
} |
|
|
|
if (GVL_BigStation.SiemensSendRecipeStatus == 4) |
|
|
@@ -909,7 +909,7 @@ namespace BPASmartClient.JXJFoodBigStation.Model |
|
|
|
{ |
|
|
|
SiemensDevice.Siemens_PLC_S7.WriteString(2331, "", 10); |
|
|
|
SiemensDevice.Siemens_PLC_S7.Write("DB2331.DBX28.0", false); |
|
|
|
MessageNotify.GetInstance.ShowRunLog($"配方2,西门子确认开始配料"); |
|
|
|
MessageNotify.GetInstance.ShowRunLog($"配方队列【2】,配方:【{data.RecipeCode}】西门子确认开始配料"); |
|
|
|
GVL_BigStation.SiemensSendRecipeStatus = 5; |
|
|
|
} |
|
|
|
} |
|
|
@@ -918,7 +918,7 @@ namespace BPASmartClient.JXJFoodBigStation.Model |
|
|
|
if (SiemensDevice.DL_Status.Dosing_Start_ACK == false) |
|
|
|
{ |
|
|
|
SiemensRecipeQueue2.Enqueue(data.RecipeCode); |
|
|
|
MessageNotify.GetInstance.ShowRunLog($"配方2,配方:【{data.RecipeCode}】,加入队列"); |
|
|
|
MessageNotify.GetInstance.ShowRunLog($"配方队列【2】,配方:【{data.RecipeCode}】,加入队列"); |
|
|
|
GVL_BigStation.SiemensSendRecipeStatus = 0; |
|
|
|
} |
|
|
|
} |
|
|
@@ -935,7 +935,7 @@ namespace BPASmartClient.JXJFoodBigStation.Model |
|
|
|
{ |
|
|
|
SiemensDevice.Siemens_PLC_S7.WriteString(2331, data.RecipeCode, 10); |
|
|
|
SiemensDevice.Siemens_PLC_S7.Write("DB2331.DBX28.0", true); |
|
|
|
MessageNotify.GetInstance.ShowRunLog($"配方3,发送配方编号和请求配料标志给西门子"); |
|
|
|
MessageNotify.GetInstance.ShowRunLog($"配方队列【3】,配方:【{data.RecipeCode}】发送配方编号和请求配料标志给西门子"); |
|
|
|
GVL_BigStation.SiemensSendRecipeStatus = 4; |
|
|
|
} |
|
|
|
if (GVL_BigStation.SiemensSendRecipeStatus == 4) |
|
|
@@ -944,7 +944,7 @@ namespace BPASmartClient.JXJFoodBigStation.Model |
|
|
|
{ |
|
|
|
SiemensDevice.Siemens_PLC_S7.WriteString(2331, "", 10); |
|
|
|
SiemensDevice.Siemens_PLC_S7.Write("DB2331.DBX28.0", false); |
|
|
|
MessageNotify.GetInstance.ShowRunLog($"配方3,西门子确认开始配料"); |
|
|
|
MessageNotify.GetInstance.ShowRunLog($"配方队列【3】,配方:【{data.RecipeCode}】西门子确认开始配料"); |
|
|
|
GVL_BigStation.SiemensSendRecipeStatus = 5; |
|
|
|
} |
|
|
|
} |
|
|
@@ -953,7 +953,7 @@ namespace BPASmartClient.JXJFoodBigStation.Model |
|
|
|
if (SiemensDevice.DL_Status.Dosing_Start_ACK == false) |
|
|
|
{ |
|
|
|
SiemensRecipeQueue3.Enqueue(data.RecipeCode); |
|
|
|
MessageNotify.GetInstance.ShowRunLog($"配方3,配方:【{data.RecipeCode}】,加入队列"); |
|
|
|
MessageNotify.GetInstance.ShowRunLog($"配方队列【3】,配方:【{data.RecipeCode}】,加入队列"); |
|
|
|
GVL_BigStation.SiemensSendRecipeStatus = 0; |
|
|
|
} |
|
|
|
} |
|
|
@@ -970,7 +970,7 @@ namespace BPASmartClient.JXJFoodBigStation.Model |
|
|
|
{ |
|
|
|
SiemensDevice.Siemens_PLC_S7.WriteString(2331, data.RecipeCode, 10); |
|
|
|
SiemensDevice.Siemens_PLC_S7.Write("DB2331.DBX28.0", true); |
|
|
|
MessageNotify.GetInstance.ShowRunLog($"配方4,发送配方编号和请求配料标志给西门子"); |
|
|
|
MessageNotify.GetInstance.ShowRunLog($"配方4,配方:【{data.RecipeCode}】发送配方编号和请求配料标志给西门子"); |
|
|
|
GVL_BigStation.SiemensSendRecipeStatus = 4; |
|
|
|
} |
|
|
|
if (GVL_BigStation.SiemensSendRecipeStatus == 4) |
|
|
@@ -979,7 +979,7 @@ namespace BPASmartClient.JXJFoodBigStation.Model |
|
|
|
{ |
|
|
|
SiemensDevice.Siemens_PLC_S7.WriteString(2331, "", 10); |
|
|
|
SiemensDevice.Siemens_PLC_S7.Write("DB2331.DBX28.0", false); |
|
|
|
MessageNotify.GetInstance.ShowRunLog($"配方4,西门子确认开始配料"); |
|
|
|
MessageNotify.GetInstance.ShowRunLog($"配方队列【4】,配方:【{data.RecipeCode}】西门子确认开始配料"); |
|
|
|
GVL_BigStation.SiemensSendRecipeStatus = 5; |
|
|
|
} |
|
|
|
} |
|
|
@@ -988,7 +988,7 @@ namespace BPASmartClient.JXJFoodBigStation.Model |
|
|
|
if (SiemensDevice.DL_Status.Dosing_Start_ACK == false) |
|
|
|
{ |
|
|
|
SiemensRecipeQueue4.Enqueue(data.RecipeCode); |
|
|
|
MessageNotify.GetInstance.ShowRunLog($"配方4,配方:【{data.RecipeCode}】,加入队列"); |
|
|
|
MessageNotify.GetInstance.ShowRunLog($"配方队列【4】,配方:【{data.RecipeCode}】,加入队列"); |
|
|
|
GVL_BigStation.SiemensSendRecipeStatus = 0; |
|
|
|
} |
|
|
|
} |
|
|
@@ -1001,22 +1001,22 @@ namespace BPASmartClient.JXJFoodBigStation.Model |
|
|
|
if (SiemensRecipeQueue1.Count == 0 && !SiemensRecipeQueue2.Contains(data.RecipeCode) && !SiemensRecipeQueue3.Contains(data.RecipeCode) && !SiemensRecipeQueue4.Contains(data.RecipeCode) && HKDevice.PlcRead.IsAllowIssueRecipe1 && data.TrayCode == 1) |
|
|
|
{ |
|
|
|
SiemensRecipeQueue1.Enqueue(data.RecipeCode); |
|
|
|
MessageNotify.GetInstance.ShowRunLog($"本地配方,配方:【{data.RecipeCode}】,加入队列1"); |
|
|
|
MessageNotify.GetInstance.ShowRunLog($"本地配方,配方:【{data.RecipeCode}】,加入队列【1】"); |
|
|
|
} |
|
|
|
else if (SiemensRecipeQueue2.Count == 0 && !SiemensRecipeQueue1.Contains(data.RecipeCode) && !SiemensRecipeQueue3.Contains(data.RecipeCode) && !SiemensRecipeQueue4.Contains(data.RecipeCode) && HKDevice.PlcRead.IsAllowIssueRecipe2 && data.TrayCode == 2) |
|
|
|
{ |
|
|
|
SiemensRecipeQueue2.Enqueue(data.RecipeCode); |
|
|
|
MessageNotify.GetInstance.ShowRunLog($"本地配方,配方:【{data.RecipeCode}】,加入队列2"); |
|
|
|
MessageNotify.GetInstance.ShowRunLog($"本地配方,配方:【{data.RecipeCode}】,加入队列【2】"); |
|
|
|
} |
|
|
|
else if (SiemensRecipeQueue3.Count == 0 && !SiemensRecipeQueue1.Contains(data.RecipeCode) && !SiemensRecipeQueue2.Contains(data.RecipeCode) && !SiemensRecipeQueue4.Contains(data.RecipeCode) && HKDevice.PlcRead.IsAllowIssueRecipe3 && data.TrayCode == 3) |
|
|
|
{ |
|
|
|
SiemensRecipeQueue3.Enqueue(data.RecipeCode); |
|
|
|
MessageNotify.GetInstance.ShowRunLog($"本地配方,配方:【{data.RecipeCode}】,加入队列3"); |
|
|
|
MessageNotify.GetInstance.ShowRunLog($"本地配方,配方:【{data.RecipeCode}】,加入队列【3】"); |
|
|
|
} |
|
|
|
else if (SiemensRecipeQueue4.Count == 0 && !SiemensRecipeQueue1.Contains(data.RecipeCode) && !SiemensRecipeQueue2.Contains(data.RecipeCode) && !SiemensRecipeQueue3.Contains(data.RecipeCode) && HKDevice.PlcRead.IsAllowIssueRecipe4 && data.TrayCode == 4) |
|
|
|
{ |
|
|
|
SiemensRecipeQueue4.Enqueue(data.RecipeCode); |
|
|
|
MessageNotify.GetInstance.ShowRunLog($"本地配方,配方:【{data.RecipeCode}】,加入队列4"); |
|
|
|
MessageNotify.GetInstance.ShowRunLog($"本地配方,配方:【{data.RecipeCode}】,加入队列【4】"); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
@@ -1307,7 +1307,7 @@ namespace BPASmartClient.JXJFoodBigStation.Model |
|
|
|
default: |
|
|
|
break; |
|
|
|
} |
|
|
|
if (HKDevice.PlcRead.IsAllowIssueRecipe1 && GVL_BigStation.Recipe1DosingStatus == 0 && Inplace)//配方1是否允许下发配发 |
|
|
|
if (HKDevice.PlcRead.IsAllowIssueRecipe1 && GVL_BigStation.Recipe1DosingStatus == 0 && Inplace)//配方队列【1】是否允许下发配发 |
|
|
|
{ |
|
|
|
if (SiemensRecipes.ElementAt(index).IsWashingBarrel) |
|
|
|
{ |
|
|
@@ -1315,13 +1315,13 @@ namespace BPASmartClient.JXJFoodBigStation.Model |
|
|
|
{ |
|
|
|
GVL_BigStation.BarrelWasherSign = true; |
|
|
|
HKDevice.HK_PLC_S7.Write("DB99.DBX0.1", true);//洗桶 |
|
|
|
MessageNotify.GetInstance.ShowRunLog($"配方1,配方编号:{code},托盘编号:{trayCode},订单类型为洗桶"); |
|
|
|
MessageNotify.GetInstance.ShowRunLog($"配方队列【1】,配方编号:{code},托盘编号:{trayCode},订单类型为洗桶"); |
|
|
|
|
|
|
|
GVL_BigStation.DosingRecipe1Time = DateTime.Now; |
|
|
|
HKDevice.WritePlcRecipeData(SiemensRecipes.ElementAt(index)); |
|
|
|
HKDevice.HK_PLC_S7.Write("DB99.DBX0.3", true); |
|
|
|
GVL_BigStation.Recipe1DosingStatus = 1; |
|
|
|
MessageNotify.GetInstance.ShowRunLog($"配方1,配方编号:{code},托盘编号:{trayCode},下发完成"); |
|
|
|
MessageNotify.GetInstance.ShowRunLog($"配方队列【1】,配方编号:{code},托盘编号:{trayCode},下发完成"); |
|
|
|
} |
|
|
|
} |
|
|
|
else |
|
|
@@ -1330,7 +1330,7 @@ namespace BPASmartClient.JXJFoodBigStation.Model |
|
|
|
HKDevice.WritePlcRecipeData(SiemensRecipes.ElementAt(index)); |
|
|
|
HKDevice.HK_PLC_S7.Write("DB99.DBX0.3", true); |
|
|
|
GVL_BigStation.Recipe1DosingStatus = 1; |
|
|
|
MessageNotify.GetInstance.ShowRunLog($"配方1,配方编号:{code},托盘编号:{trayCode},下发完成"); |
|
|
|
MessageNotify.GetInstance.ShowRunLog($"配方队列【1】,配方编号:{code},托盘编号:{trayCode},下发完成"); |
|
|
|
} |
|
|
|
} |
|
|
|
if (HKDevice.PlcRead.ReceiveFinishRecipe1 && GVL_BigStation.Recipe1DosingStatus == 1) |
|
|
@@ -1338,11 +1338,11 @@ namespace BPASmartClient.JXJFoodBigStation.Model |
|
|
|
if (SiemensRecipes.ElementAt(index).IsWashingBarrel) |
|
|
|
{ |
|
|
|
HKDevice.HK_PLC_S7.Write("DB99.DBX0.1", false);//洗桶 |
|
|
|
MessageNotify.GetInstance.ShowRunLog($"配方1,配方编号:{code},托盘编号:{trayCode},洗桶复位"); |
|
|
|
MessageNotify.GetInstance.ShowRunLog($"配方队列【1】,配方编号:{code},托盘编号:{trayCode},洗桶复位"); |
|
|
|
} |
|
|
|
HKDevice.HK_PLC_S7.Write("DB99.DBX0.3", false); |
|
|
|
StockBinParReset(); |
|
|
|
MessageNotify.GetInstance.ShowRunLog($"配方1,配方编号:{code},托盘编号:{trayCode},PLC接收配方完成"); |
|
|
|
MessageNotify.GetInstance.ShowRunLog($"配方队列【1】,配方编号:{code},托盘编号:{trayCode},PLC接收配方完成"); |
|
|
|
GVL_BigStation.Recipe1DosingStatus = 2; |
|
|
|
} |
|
|
|
if (GVL_BigStation.Recipe1DosingStatus == 2 && HKDevice.PlcRead.Recipe1DosingFinish) |
|
|
@@ -1352,11 +1352,11 @@ namespace BPASmartClient.JXJFoodBigStation.Model |
|
|
|
GVL_BigStation.BarrelWasherSign = false; |
|
|
|
} |
|
|
|
GVL_BigStation.Recipe1DosingFinish = true; |
|
|
|
GVL_BigStation.Recipe1DosingStatus = 3; |
|
|
|
MessageNotify.GetInstance.ShowRunLog($"配方1,配方编号:{code},托盘编号:{trayCode},配料完成"); |
|
|
|
//GVL_BigStation.Recipe1DosingStatus = 3; |
|
|
|
MessageNotify.GetInstance.ShowRunLog($"配方队列【1】,配方编号:{code},托盘编号:{trayCode},配料完成"); |
|
|
|
ReadStockBinDosingWeight(SiemensRecipes.ElementAt(index)); |
|
|
|
//2023-8-21:如果不是MES系统下发的配方,不要返回结束数据。 |
|
|
|
if (SiemensDevice.IsConnected && SiemensRecipes.ElementAt(index).RecipesSource==RecipeSource.远程 /*!GVL_BigStation.IsUseLocalRecipe*/) |
|
|
|
if (SiemensRecipes.ElementAt(index).RecipesSource==RecipeSource.远程 /*!GVL_BigStation.IsUseLocalRecipe*/) |
|
|
|
{ |
|
|
|
FinishData.Order_No = SiemensRecipes.ElementAt(index).RecipeCode; |
|
|
|
FinishData.Product_Code = SiemensRecipes.ElementAt(index).RecipeName; |
|
|
@@ -1370,18 +1370,37 @@ namespace BPASmartClient.JXJFoodBigStation.Model |
|
|
|
FinishData.Material[i].Material_Name = SiemensRecipes.ElementAt(index).RawMaterial.ElementAt(i).RawMaterialName; |
|
|
|
FinishData.Material[i].Material_BarrelNum = (short)SiemensRecipes.ElementAt(index).RawMaterial.ElementAt(i).RawMaterialBarrelNum; |
|
|
|
FinishData.Material[i].Material_Laying_Off_Weight = Math.Abs(SiemensRecipes.ElementAt(index).RawMaterial.ElementAt(i).Laying_Off_Weight); |
|
|
|
MessageNotify.GetInstance.ShowRunLog($"配方1,配方编号:{code},托盘编号:{trayCode},原料名称:{FinishData.Material[i].Material_Name},原料桶号:{FinishData.Material[i].Material_BarrelNum},配料重量:{FinishData.Material[i].Material_Laying_Off_Weight}kg"); |
|
|
|
MessageNotify.GetInstance.ShowRunLog($"配方队列【1】,配方编号:{code},托盘编号:{trayCode},原料名称:{FinishData.Material[i].Material_Name},原料桶号:{FinishData.Material[i].Material_BarrelNum},配料重量:{FinishData.Material[i].Material_Laying_Off_Weight}kg"); |
|
|
|
} |
|
|
|
FinishData.Ask_For_Finish = true; |
|
|
|
double a = DateTime.Now.Subtract(GVL_BigStation.DosingRecipe1Time).TotalSeconds; |
|
|
|
FinishData.ProcessTime = Convert.ToInt16(a); |
|
|
|
SiemensDevice.Siemens_PLC_S7.WriteClass<DL_Finish_DB>(FinishData, 2361); |
|
|
|
MessageNotify.GetInstance.ShowRunLog($"配方1,配方编号:{code},托盘编号:{trayCode},配料完成,将信号反馈给西门子。"); |
|
|
|
//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"); |
|
|
|
}); |
|
|
|
|
|
|
|
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 |
|
|
|
{ |
|
|
|
MessageNotify.GetInstance.ShowRunLog($"配方队列【1】,托盘编号:【{trayCode}】,配方编号:【{code}】,配料完成,已发送数据,但复位请求完成信号失败。"); |
|
|
|
} |
|
|
|
} |
|
|
|
else |
|
|
|
{ |
|
|
|
MessageNotify.GetInstance.ShowRunLog($"配方1,配方编号:【{code}】,托盘编号:【{trayCode}】,配料完成,西门子未连接或配方为本地下发未将完成数据反馈至MES系统。"); |
|
|
|
MessageNotify.GetInstance.ShowRunLog($"配方队列【1】,配方编号:【{code}】,托盘编号:【{trayCode}】,配料完成,配方为本地下发未将完成数据反馈至MES系统。"); |
|
|
|
} |
|
|
|
|
|
|
|
HKDevice.HK_PLC_S7.Write("DB99.DBX1.4", true); |
|
|
|
GVL_BigStation.Recipe1DosingStatus = 3; |
|
|
|
} |
|
|
@@ -1394,7 +1413,7 @@ namespace BPASmartClient.JXJFoodBigStation.Model |
|
|
|
Json<RemoteRecipe>.Data.Recipes.RemoveAt(index);//制作完成,移除当前配方 |
|
|
|
}); |
|
|
|
GVL_BigStation.Recipe1DosingStatus = 0; |
|
|
|
MessageNotify.GetInstance.ShowRunLog($"配方1,配方编号:{code},托盘编号:{trayCode},复位plc配料完成信号"); |
|
|
|
MessageNotify.GetInstance.ShowRunLog($"配方队列【1】,配方编号:{code},托盘编号:{trayCode},复位plc配料完成信号"); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
@@ -1426,7 +1445,7 @@ namespace BPASmartClient.JXJFoodBigStation.Model |
|
|
|
default: |
|
|
|
break; |
|
|
|
} |
|
|
|
if (HKDevice.PlcRead.IsAllowIssueRecipe2 && GVL_BigStation.Recipe2DosingStatus == 0 && Inplace)//配方2是否允许下发配发 |
|
|
|
if (HKDevice.PlcRead.IsAllowIssueRecipe2 && GVL_BigStation.Recipe2DosingStatus == 0 && Inplace)//配方队列【2】是否允许下发配发 |
|
|
|
{ |
|
|
|
if (SiemensRecipes.ElementAt(index).IsWashingBarrel) |
|
|
|
{ |
|
|
@@ -1434,13 +1453,13 @@ namespace BPASmartClient.JXJFoodBigStation.Model |
|
|
|
{ |
|
|
|
GVL_BigStation.BarrelWasherSign = true; |
|
|
|
HKDevice.HK_PLC_S7.Write("DB99.DBX0.1", true);//洗桶 |
|
|
|
MessageNotify.GetInstance.ShowRunLog($"配方2,配方编号:{code},托盘编号:{trayCode},订单类型为洗桶"); |
|
|
|
MessageNotify.GetInstance.ShowRunLog($"配方队列【2】,配方编号:{code},托盘编号:{trayCode},订单类型为洗桶"); |
|
|
|
|
|
|
|
GVL_BigStation.DosingRecipe2Time = DateTime.Now; |
|
|
|
HKDevice.WritePlcRecipeData(SiemensRecipes.ElementAt(index)); |
|
|
|
HKDevice.HK_PLC_S7.Write("DB99.DBX0.4", true); |
|
|
|
GVL_BigStation.Recipe2DosingStatus = 1; |
|
|
|
MessageNotify.GetInstance.ShowRunLog($"配方2,配方编号:{code},托盘编号:{trayCode},下发完成"); |
|
|
|
MessageNotify.GetInstance.ShowRunLog($"配方队列【2】,配方编号:{code},托盘编号:{trayCode},下发完成"); |
|
|
|
} |
|
|
|
} |
|
|
|
else |
|
|
@@ -1449,7 +1468,7 @@ namespace BPASmartClient.JXJFoodBigStation.Model |
|
|
|
HKDevice.WritePlcRecipeData(SiemensRecipes.ElementAt(index)); |
|
|
|
HKDevice.HK_PLC_S7.Write("DB99.DBX0.4", true); |
|
|
|
GVL_BigStation.Recipe2DosingStatus = 1; |
|
|
|
MessageNotify.GetInstance.ShowRunLog($"配方2,配方编号:{code},托盘编号:{trayCode},下发完成"); |
|
|
|
MessageNotify.GetInstance.ShowRunLog($"配方队列【2】,配方编号:{code},托盘编号:{trayCode},下发完成"); |
|
|
|
} |
|
|
|
} |
|
|
|
if (HKDevice.PlcRead.ReceiveFinishRecipe2 && GVL_BigStation.Recipe2DosingStatus == 1) |
|
|
@@ -1457,12 +1476,12 @@ namespace BPASmartClient.JXJFoodBigStation.Model |
|
|
|
if (SiemensRecipes.ElementAt(index).IsWashingBarrel) |
|
|
|
{ |
|
|
|
HKDevice.HK_PLC_S7.Write("DB99.DBX0.1", false);//洗桶 |
|
|
|
MessageNotify.GetInstance.ShowRunLog($"配方2,配方编号:{code},托盘编号:{trayCode},洗桶复位"); |
|
|
|
MessageNotify.GetInstance.ShowRunLog($"配方队列【2】,配方编号:{code},托盘编号:{trayCode},洗桶复位"); |
|
|
|
} |
|
|
|
HKDevice.HK_PLC_S7.Write("DB99.DBX0.4", false); |
|
|
|
StockBinParReset(); |
|
|
|
GVL_BigStation.Recipe2DosingStatus = 2; |
|
|
|
MessageNotify.GetInstance.ShowRunLog($"配方2,配方编号:{code},托盘编号:{trayCode},PLC接收配方完成"); |
|
|
|
MessageNotify.GetInstance.ShowRunLog($"配方队列【2】,配方编号:{code},托盘编号:{trayCode},PLC接收配方完成"); |
|
|
|
} |
|
|
|
if (GVL_BigStation.Recipe2DosingStatus == 2 && HKDevice.PlcRead.Recipe2DosingFinish) |
|
|
|
{ |
|
|
@@ -1471,10 +1490,10 @@ namespace BPASmartClient.JXJFoodBigStation.Model |
|
|
|
GVL_BigStation.BarrelWasherSign = false; |
|
|
|
} |
|
|
|
GVL_BigStation.Recipe2DosingFinish = true; |
|
|
|
MessageNotify.GetInstance.ShowRunLog($"配方2,配方编号:{code},托盘编号:{trayCode},配料完成"); |
|
|
|
MessageNotify.GetInstance.ShowRunLog($"配方队列【2】,配方编号:{code},托盘编号:{trayCode},配料完成"); |
|
|
|
ReadStockBinDosingWeight(SiemensRecipes.ElementAt(index)); |
|
|
|
|
|
|
|
if (SiemensDevice.IsConnected && SiemensRecipes.ElementAt(index).RecipesSource == RecipeSource.远程 /*!GVL_BigStation.IsUseLocalRecipe*/) |
|
|
|
if (SiemensRecipes.ElementAt(index).RecipesSource == RecipeSource.远程 /*!GVL_BigStation.IsUseLocalRecipe*/) |
|
|
|
{ |
|
|
|
FinishData.Order_No = SiemensRecipes.ElementAt(index).RecipeCode; |
|
|
|
FinishData.Product_Code = SiemensRecipes.ElementAt(index).RecipeName; |
|
|
@@ -1488,17 +1507,36 @@ namespace BPASmartClient.JXJFoodBigStation.Model |
|
|
|
FinishData.Material[i].Material_Name = SiemensRecipes.ElementAt(index).RawMaterial.ElementAt(i).RawMaterialName; |
|
|
|
FinishData.Material[i].Material_BarrelNum = (short)SiemensRecipes.ElementAt(index).RawMaterial.ElementAt(i).RawMaterialBarrelNum; |
|
|
|
FinishData.Material[i].Material_Laying_Off_Weight = Math.Abs(SiemensRecipes.ElementAt(index).RawMaterial.ElementAt(i).Laying_Off_Weight); |
|
|
|
MessageNotify.GetInstance.ShowRunLog($"配方2,配方编号:{code},托盘编号:{trayCode},原料名称:{FinishData.Material[i].Material_Name},原料桶号:{FinishData.Material[i].Material_BarrelNum},配料重量:{FinishData.Material[i].Material_Laying_Off_Weight}kg"); |
|
|
|
MessageNotify.GetInstance.ShowRunLog($"配方队列【2】,配方编号:{code},托盘编号:{trayCode},原料名称:{FinishData.Material[i].Material_Name},原料桶号:{FinishData.Material[i].Material_BarrelNum},配料重量:{FinishData.Material[i].Material_Laying_Off_Weight}kg"); |
|
|
|
} |
|
|
|
FinishData.Ask_For_Finish = true; |
|
|
|
double a = DateTime.Now.Subtract(GVL_BigStation.DosingRecipe2Time).TotalSeconds; |
|
|
|
FinishData.ProcessTime = Convert.ToInt16(a); |
|
|
|
SiemensDevice.Siemens_PLC_S7.WriteClass<DL_Finish_DB>(FinishData, 2361); |
|
|
|
MessageNotify.GetInstance.ShowRunLog($"配方2,配方编号:{code},托盘编号:{trayCode},配料完成,将信号反馈给西门子"); |
|
|
|
//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); |
|
|
|
}, () => |
|
|
|
{ |
|
|
|
return SiemensDevice.Siemens_PLC_S7.Read<bool>("DB2361.DBX0.0"); |
|
|
|
}); |
|
|
|
|
|
|
|
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}】,配料完成,已发送数据,但复位请求完成信号失败。"); |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
else |
|
|
|
{ |
|
|
|
MessageNotify.GetInstance.ShowRunLog($"配方2,配方编号:【{code}】,托盘编号:【{trayCode}】,配料完成,西门子未连接或配方为本地下发未将完成数据反馈至MES系统。"); |
|
|
|
MessageNotify.GetInstance.ShowRunLog($"配方队列【2】,配方编号:【{code}】,托盘编号:【{trayCode}】,配料完成,西门子未连接或配方为本地下发未将完成数据反馈至MES系统。"); |
|
|
|
} |
|
|
|
|
|
|
|
HKDevice.HK_PLC_S7.Write("DB99.DBX1.5", true); |
|
|
@@ -1515,7 +1553,7 @@ namespace BPASmartClient.JXJFoodBigStation.Model |
|
|
|
Json<RemoteRecipe>.Data.Recipes.RemoveAt(index);//制作完成,移除当前配方 |
|
|
|
}); |
|
|
|
GVL_BigStation.Recipe2DosingStatus = 0; |
|
|
|
MessageNotify.GetInstance.ShowRunLog($"配方2,配方编号:{code},托盘编号:{trayCode},,复位plc配料完成信号"); |
|
|
|
MessageNotify.GetInstance.ShowRunLog($"配方队列【2】,配方编号:{code},托盘编号:{trayCode},,复位plc配料完成信号"); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
@@ -1547,7 +1585,7 @@ namespace BPASmartClient.JXJFoodBigStation.Model |
|
|
|
default: |
|
|
|
break; |
|
|
|
} |
|
|
|
if (HKDevice.PlcRead.IsAllowIssueRecipe3 && GVL_BigStation.Recipe3DosingStatus == 0 && Inplace)//配方3是否允许下发配发 |
|
|
|
if (HKDevice.PlcRead.IsAllowIssueRecipe3 && GVL_BigStation.Recipe3DosingStatus == 0 && Inplace)//配方队列【3】是否允许下发配发 |
|
|
|
{ |
|
|
|
if (SiemensRecipes.ElementAt(index).IsWashingBarrel) |
|
|
|
{ |
|
|
@@ -1555,12 +1593,12 @@ namespace BPASmartClient.JXJFoodBigStation.Model |
|
|
|
{ |
|
|
|
GVL_BigStation.BarrelWasherSign = true; |
|
|
|
HKDevice.HK_PLC_S7.Write("DB99.DBX0.1", true);//洗桶 |
|
|
|
MessageNotify.GetInstance.ShowRunLog($"配方3,配方编号:{code},托盘编号:{trayCode},订单类型为洗桶"); |
|
|
|
MessageNotify.GetInstance.ShowRunLog($"配方队列【3】,配方编号:{code},托盘编号:{trayCode},订单类型为洗桶"); |
|
|
|
GVL_BigStation.DosingRecipe3Time = DateTime.Now; |
|
|
|
HKDevice.WritePlcRecipeData(SiemensRecipes.ElementAt(index)); |
|
|
|
HKDevice.HK_PLC_S7.Write("DB99.DBX0.5", true); |
|
|
|
GVL_BigStation.Recipe3DosingStatus = 1; |
|
|
|
MessageNotify.GetInstance.ShowRunLog($"配方3,配方编号:{code},托盘编号:{trayCode},下发完成"); |
|
|
|
MessageNotify.GetInstance.ShowRunLog($"配方队列【3】,配方编号:{code},托盘编号:{trayCode},下发完成"); |
|
|
|
} |
|
|
|
} |
|
|
|
else |
|
|
@@ -1569,7 +1607,7 @@ namespace BPASmartClient.JXJFoodBigStation.Model |
|
|
|
HKDevice.WritePlcRecipeData(SiemensRecipes.ElementAt(index)); |
|
|
|
HKDevice.HK_PLC_S7.Write("DB99.DBX0.5", true); |
|
|
|
GVL_BigStation.Recipe3DosingStatus = 1; |
|
|
|
MessageNotify.GetInstance.ShowRunLog($"配方3,配方编号:{code},托盘编号:{trayCode},下发完成"); |
|
|
|
MessageNotify.GetInstance.ShowRunLog($"配方队列【3】,配方编号:{code},托盘编号:{trayCode},下发完成"); |
|
|
|
} |
|
|
|
} |
|
|
|
if (HKDevice.PlcRead.ReceiveFinishRecipe3 && GVL_BigStation.Recipe3DosingStatus == 1) |
|
|
@@ -1577,12 +1615,12 @@ namespace BPASmartClient.JXJFoodBigStation.Model |
|
|
|
if (SiemensRecipes.ElementAt(index).IsWashingBarrel) |
|
|
|
{ |
|
|
|
HKDevice.HK_PLC_S7.Write("DB99.DBX0.1", false);//洗桶 |
|
|
|
MessageNotify.GetInstance.ShowRunLog($"配方3,配方编号:{code},托盘编号:{trayCode},洗桶复位"); |
|
|
|
MessageNotify.GetInstance.ShowRunLog($"配方队列【3】,配方编号:{code},托盘编号:{trayCode},洗桶复位"); |
|
|
|
} |
|
|
|
HKDevice.HK_PLC_S7.Write("DB99.DBX0.5", false); |
|
|
|
StockBinParReset(); |
|
|
|
GVL_BigStation.Recipe3DosingStatus = 2; |
|
|
|
MessageNotify.GetInstance.ShowRunLog($"配方3,配方编号:{code},托盘编号:{trayCode},PLC接收配方完成"); |
|
|
|
MessageNotify.GetInstance.ShowRunLog($"配方队列【3】,配方编号:{code},托盘编号:{trayCode},PLC接收配方完成"); |
|
|
|
} |
|
|
|
if (HKDevice.PlcRead.Recipe3DosingFinish && GVL_BigStation.Recipe3DosingStatus == 2) |
|
|
|
{ |
|
|
@@ -1591,8 +1629,8 @@ namespace BPASmartClient.JXJFoodBigStation.Model |
|
|
|
GVL_BigStation.BarrelWasherSign = false; |
|
|
|
} |
|
|
|
GVL_BigStation.Recipe3DosingFinish = true; |
|
|
|
GVL_BigStation.Recipe3DosingStatus = 3; |
|
|
|
MessageNotify.GetInstance.ShowRunLog($"配方3,配方编号:{code},托盘编号:{trayCode},配料完成"); |
|
|
|
//GVL_BigStation.Recipe3DosingStatus = 3; |
|
|
|
MessageNotify.GetInstance.ShowRunLog($"配方队列【3】,配方编号:{code},托盘编号:{trayCode},配料完成"); |
|
|
|
ReadStockBinDosingWeight(SiemensRecipes.ElementAt(index)); |
|
|
|
if (SiemensDevice.IsConnected && SiemensRecipes.ElementAt(index).RecipesSource == RecipeSource.远程 /*!GVL_BigStation.IsUseLocalRecipe*/) |
|
|
|
{ |
|
|
@@ -1608,17 +1646,36 @@ namespace BPASmartClient.JXJFoodBigStation.Model |
|
|
|
FinishData.Material[i].Material_Name = SiemensRecipes.ElementAt(index).RawMaterial.ElementAt(i).RawMaterialName; |
|
|
|
FinishData.Material[i].Material_BarrelNum = (short)SiemensRecipes.ElementAt(index).RawMaterial.ElementAt(i).RawMaterialBarrelNum; |
|
|
|
FinishData.Material[i].Material_Laying_Off_Weight = Math.Abs(SiemensRecipes.ElementAt(index).RawMaterial.ElementAt(i).Laying_Off_Weight); |
|
|
|
MessageNotify.GetInstance.ShowRunLog($"配方3,配方编号:{code},托盘编号:{trayCode},原料名称:{FinishData.Material[i].Material_Name},原料桶号:{FinishData.Material[i].Material_BarrelNum},配料重量:{FinishData.Material[i].Material_Laying_Off_Weight}kg"); |
|
|
|
MessageNotify.GetInstance.ShowRunLog($"配方队列【3】,配方编号:{code},托盘编号:{trayCode},原料名称:{FinishData.Material[i].Material_Name},原料桶号:{FinishData.Material[i].Material_BarrelNum},配料重量:{FinishData.Material[i].Material_Laying_Off_Weight}kg"); |
|
|
|
} |
|
|
|
FinishData.Ask_For_Finish = true; |
|
|
|
double a = DateTime.Now.Subtract(GVL_BigStation.DosingRecipe3Time).TotalSeconds; |
|
|
|
FinishData.ProcessTime = Convert.ToInt16(a); |
|
|
|
SiemensDevice.Siemens_PLC_S7.WriteClass<DL_Finish_DB>(FinishData, 2361); |
|
|
|
MessageNotify.GetInstance.ShowRunLog($"配方3,配方编号:{code},托盘编号:{trayCode},配料完成,将信号反馈给西门子"); |
|
|
|
//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"); |
|
|
|
}); |
|
|
|
|
|
|
|
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 |
|
|
|
{ |
|
|
|
MessageNotify.GetInstance.ShowRunLog($"配方队列【3】,托盘编号:【{trayCode}】,配方编号:【{code}】,配料完成,已发送数据,但复位请求完成信号失败。"); |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
else |
|
|
|
{ |
|
|
|
MessageNotify.GetInstance.ShowRunLog($"配方3,配方编号:【{code}】,托盘编号:【{trayCode}】,配料完成,西门子未连接或配方为本地下发未将完成数据反馈至MES系统。"); |
|
|
|
MessageNotify.GetInstance.ShowRunLog($"配方队列【3】,配方编号:【{code}】,托盘编号:【{trayCode}】,配料完成,西门子未连接或配方为本地下发未将完成数据反馈至MES系统。"); |
|
|
|
} |
|
|
|
HKDevice.HK_PLC_S7.Write("DB99.DBX1.6", true); |
|
|
|
GVL_BigStation.Recipe3DosingStatus = 3; |
|
|
@@ -1632,7 +1689,7 @@ namespace BPASmartClient.JXJFoodBigStation.Model |
|
|
|
Json<RemoteRecipe>.Data.Recipes.RemoveAt(index);//制作完成,移除当前配方 |
|
|
|
}); |
|
|
|
GVL_BigStation.Recipe3DosingStatus = 0; |
|
|
|
MessageNotify.GetInstance.ShowRunLog($"配方3,配方编号:{code},托盘编号:{trayCode},复位plc配料完成信号"); |
|
|
|
MessageNotify.GetInstance.ShowRunLog($"配方队列【3】,配方编号:{code},托盘编号:{trayCode},复位plc配料完成信号"); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
@@ -1664,7 +1721,7 @@ namespace BPASmartClient.JXJFoodBigStation.Model |
|
|
|
default: |
|
|
|
break; |
|
|
|
} |
|
|
|
if (HKDevice.PlcRead.IsAllowIssueRecipe4 && GVL_BigStation.Recipe4DosingStatus == 0 && Inplace)//配方4是否允许下发配发 |
|
|
|
if (HKDevice.PlcRead.IsAllowIssueRecipe4 && GVL_BigStation.Recipe4DosingStatus == 0 && Inplace)//配方队列【4】是否允许下发配发 |
|
|
|
{ |
|
|
|
if (SiemensRecipes.ElementAt(index).IsWashingBarrel) |
|
|
|
{ |
|
|
@@ -1672,12 +1729,12 @@ namespace BPASmartClient.JXJFoodBigStation.Model |
|
|
|
{ |
|
|
|
GVL_BigStation.BarrelWasherSign = true; |
|
|
|
HKDevice.HK_PLC_S7.Write("DB99.DBX0.1", true);//洗桶 |
|
|
|
MessageNotify.GetInstance.ShowRunLog($"配方4,配方编号:{code},托盘编号:{trayCode},订单类型为洗桶"); |
|
|
|
MessageNotify.GetInstance.ShowRunLog($"配方队列【4】,配方编号:{code},托盘编号:{trayCode},订单类型为洗桶"); |
|
|
|
GVL_BigStation.DosingRecipe4Time = DateTime.Now; |
|
|
|
HKDevice.WritePlcRecipeData(SiemensRecipes.ElementAt(index)); |
|
|
|
HKDevice.HK_PLC_S7.Write("DB99.DBX0.6", true); |
|
|
|
GVL_BigStation.Recipe4DosingStatus = 1; |
|
|
|
MessageNotify.GetInstance.ShowRunLog($"配方4,配方编号:{code},托盘编号:{trayCode},下发完成"); |
|
|
|
MessageNotify.GetInstance.ShowRunLog($"配方队列【4】,配方编号:{code},托盘编号:{trayCode},下发完成"); |
|
|
|
} |
|
|
|
} |
|
|
|
else |
|
|
@@ -1686,7 +1743,7 @@ namespace BPASmartClient.JXJFoodBigStation.Model |
|
|
|
HKDevice.WritePlcRecipeData(SiemensRecipes.ElementAt(index)); |
|
|
|
HKDevice.HK_PLC_S7.Write("DB99.DBX0.6", true); |
|
|
|
GVL_BigStation.Recipe4DosingStatus = 1; |
|
|
|
MessageNotify.GetInstance.ShowRunLog($"配方4,配方编号:{code},托盘编号:{trayCode},下发完成"); |
|
|
|
MessageNotify.GetInstance.ShowRunLog($"配方队列【4】,配方编号:{code},托盘编号:{trayCode},下发完成"); |
|
|
|
} |
|
|
|
} |
|
|
|
if (HKDevice.PlcRead.ReceiveFinishRecipe4 && GVL_BigStation.Recipe4DosingStatus == 1) |
|
|
@@ -1694,12 +1751,12 @@ namespace BPASmartClient.JXJFoodBigStation.Model |
|
|
|
if (SiemensRecipes.ElementAt(index).IsWashingBarrel) |
|
|
|
{ |
|
|
|
HKDevice.HK_PLC_S7.Write("DB99.DBX0.1", false);//洗桶 |
|
|
|
MessageNotify.GetInstance.ShowRunLog($"配方4,配方编号:{code},托盘编号:{trayCode},洗桶复位"); |
|
|
|
MessageNotify.GetInstance.ShowRunLog($"配方队列【4】,配方编号:{code},托盘编号:{trayCode},洗桶复位"); |
|
|
|
} |
|
|
|
GVL_BigStation.Recipe4DosingStatus = 2; |
|
|
|
HKDevice.HK_PLC_S7.Write("DB99.DBX0.6", false); |
|
|
|
StockBinParReset(); |
|
|
|
MessageNotify.GetInstance.ShowRunLog($"配方4,配方编号:{code},托盘编号:{trayCode},PLC接收配方完成"); |
|
|
|
MessageNotify.GetInstance.ShowRunLog($"配方队列【4】,配方编号:{code},托盘编号:{trayCode},PLC接收配方完成"); |
|
|
|
} |
|
|
|
if (GVL_BigStation.Recipe4DosingStatus == 2 && HKDevice.PlcRead.Recipe4DosingFinish) |
|
|
|
{ |
|
|
@@ -1708,8 +1765,8 @@ namespace BPASmartClient.JXJFoodBigStation.Model |
|
|
|
GVL_BigStation.BarrelWasherSign = false; |
|
|
|
} |
|
|
|
GVL_BigStation.Recipe4DosingFinish = true; |
|
|
|
GVL_BigStation.Recipe4DosingStatus = 3; |
|
|
|
MessageNotify.GetInstance.ShowRunLog($"配方4,配方编号:{code},托盘编号:{trayCode},配料完成"); |
|
|
|
//GVL_BigStation.Recipe4DosingStatus = 3; |
|
|
|
MessageNotify.GetInstance.ShowRunLog($"配方队列【4】,配方编号:{code},托盘编号:{trayCode},配料完成"); |
|
|
|
ReadStockBinDosingWeight(SiemensRecipes.ElementAt(index)); |
|
|
|
if (SiemensDevice.IsConnected && SiemensRecipes.ElementAt(index).RecipesSource == RecipeSource.远程 /*!GVL_BigStation.IsUseLocalRecipe*/) |
|
|
|
{ |
|
|
@@ -1725,17 +1782,35 @@ namespace BPASmartClient.JXJFoodBigStation.Model |
|
|
|
FinishData.Material[i].Material_Name = SiemensRecipes.ElementAt(index).RawMaterial.ElementAt(i).RawMaterialName; |
|
|
|
FinishData.Material[i].Material_BarrelNum = (short)SiemensRecipes.ElementAt(index).RawMaterial.ElementAt(i).RawMaterialBarrelNum; |
|
|
|
FinishData.Material[i].Material_Laying_Off_Weight = Math.Abs(SiemensRecipes.ElementAt(index).RawMaterial.ElementAt(i).Laying_Off_Weight); |
|
|
|
MessageNotify.GetInstance.ShowRunLog($"配方4,配方编号:{code},托盘编号:{trayCode},原料名称:{FinishData.Material[i].Material_Name},原料桶号:{FinishData.Material[i].Material_BarrelNum},配料重量:{FinishData.Material[i].Material_Laying_Off_Weight}kg"); |
|
|
|
MessageNotify.GetInstance.ShowRunLog($"配方队列【4】,配方编号:{code},托盘编号:{trayCode},原料名称:{FinishData.Material[i].Material_Name},原料桶号:{FinishData.Material[i].Material_BarrelNum},配料重量:{FinishData.Material[i].Material_Laying_Off_Weight}kg"); |
|
|
|
} |
|
|
|
FinishData.Ask_For_Finish = true; |
|
|
|
double a = DateTime.Now.Subtract(GVL_BigStation.DosingRecipe4Time).TotalSeconds; |
|
|
|
FinishData.ProcessTime = Convert.ToInt16(a); |
|
|
|
SiemensDevice.Siemens_PLC_S7.WriteClass<DL_Finish_DB>(FinishData, 2361); |
|
|
|
MessageNotify.GetInstance.ShowRunLog($"配方4,配方编号:{code},托盘编号:{trayCode},配料完成,将信号反馈给西门子"); |
|
|
|
//SiemensDevice.Siemens_PLC_S7.WriteClass<DL_Finish_DB>(FinishData, 2361); |
|
|
|
MessageNotify.GetInstance.ShowRunLog($"配方队列【4】,配方编号:{code},托盘编号:{trayCode},配料完成,将信号反馈给西门子"); |
|
|
|
|
|
|
|
SendDataOperation(() => |
|
|
|
{ |
|
|
|
SiemensDevice.Siemens_PLC_S7.WriteClass<DL_Finish_DB>(FinishData, 2361); |
|
|
|
}, () => |
|
|
|
{ |
|
|
|
return SiemensDevice.Siemens_PLC_S7.Read<bool>("DB2361.DBX0.0"); |
|
|
|
}); |
|
|
|
|
|
|
|
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}】,配料完成,已发送数据,但复位请求完成信号失败。"); |
|
|
|
} |
|
|
|
} |
|
|
|
else |
|
|
|
{ |
|
|
|
MessageNotify.GetInstance.ShowRunLog($"配方4,配方编号:【{code}】,托盘编号:【{trayCode}】,配料完成,西门子未连接或配方为本地下发未将完成数据反馈至MES系统。"); |
|
|
|
MessageNotify.GetInstance.ShowRunLog($"配方队列【4】,配方编号:【{code}】,托盘编号:【{trayCode}】,配料完成,西门子未连接或配方为本地下发未将完成数据反馈至MES系统。"); |
|
|
|
} |
|
|
|
HKDevice.HK_PLC_S7.Write("DB99.DBX1.7", true); |
|
|
|
GVL_BigStation.Recipe4DosingStatus = 3; |
|
|
@@ -1749,7 +1824,7 @@ namespace BPASmartClient.JXJFoodBigStation.Model |
|
|
|
Json<RemoteRecipe>.Data.Recipes.RemoveAt(index);//制作完成,移除当前配方 |
|
|
|
}); |
|
|
|
GVL_BigStation.Recipe4DosingStatus = 0; |
|
|
|
MessageNotify.GetInstance.ShowRunLog($"配方4,配方编号:{code},托盘编号:{trayCode},复位plc配料完成信号"); |
|
|
|
MessageNotify.GetInstance.ShowRunLog($"配方队列【4】,配方编号:{code},托盘编号:{trayCode},复位plc配料完成信号"); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
@@ -2434,5 +2509,46 @@ namespace BPASmartClient.JXJFoodBigStation.Model |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/// <summary> |
|
|
|
/// 发送操作,直到收到确认信号 |
|
|
|
/// </summary> |
|
|
|
/// <param name="operate"></param> |
|
|
|
/// <param name="ack"></param> |
|
|
|
/// <param name="retrySecond"></param> |
|
|
|
/// <returns></returns> |
|
|
|
/// <exception cref="ArgumentNullException"></exception> |
|
|
|
private bool SendDataOperation(Action operate, Func<bool> ack, int retrySecond = 3) |
|
|
|
{ |
|
|
|
if (operate is null) |
|
|
|
{ |
|
|
|
throw new ArgumentNullException("operate", "需要执行的操作不可为Null。"); |
|
|
|
} |
|
|
|
|
|
|
|
if (ack is null) |
|
|
|
{ |
|
|
|
throw new ArgumentNullException("ack", "验证确认的委托不可为Null。"); |
|
|
|
} |
|
|
|
|
|
|
|
var isSuccess = false; |
|
|
|
var isConnected = SiemensDevice.IsConnected; |
|
|
|
var retryDelay = TimeSpan.FromSeconds(retrySecond); |
|
|
|
|
|
|
|
operate?.Invoke(); |
|
|
|
|
|
|
|
isSuccess = ack.Invoke(); |
|
|
|
while (!isSuccess) |
|
|
|
{ |
|
|
|
if (isConnected) |
|
|
|
{ |
|
|
|
Thread.Sleep(retryDelay); |
|
|
|
operate?.Invoke(); |
|
|
|
isSuccess = isSuccess && ack.Invoke(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
return isSuccess; |
|
|
|
} |
|
|
|
} |
|
|
|
} |