@@ -1401,15 +1401,17 @@ namespace BPASmartClient.JXJFoodBigStation.Model | |||||
{ | { | ||||
if (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); | |||||
//SiemensDevice.Siemens_PLC_S7.Write<bool>("DB2361.DBX330.0", false, 5); | |||||
CleanFinishData(); | |||||
if (GVL_BigStation.Recipe1DosingFinish) | |||||
GVL_BigStation.Recipe1DosingFinish = false; | |||||
MessageNotify.GetInstance.ShowRunLog($"配方队列【1】,配方编号:【{code}】,托盘编号:【{trayCode}】,配料完成,已将完成数据反馈至MES系统。"); | MessageNotify.GetInstance.ShowRunLog($"配方队列【1】,配方编号:【{code}】,托盘编号:【{trayCode}】,配料完成,已将完成数据反馈至MES系统。"); | ||||
GVL_BigStation.Recipe1DosingStatus = 40; | GVL_BigStation.Recipe1DosingStatus = 40; | ||||
} | } | ||||
else | else | ||||
{ | { | ||||
SiemensDevice.Siemens_PLC_S7.WriteClass<DL_Finish_DB>(FinishData, 2361); | SiemensDevice.Siemens_PLC_S7.WriteClass<DL_Finish_DB>(FinishData, 2361); | ||||
Thread.Sleep(3000); | |||||
Thread.Sleep(1500); | |||||
} | } | ||||
} | } | ||||
} | } | ||||
@@ -1542,15 +1544,17 @@ namespace BPASmartClient.JXJFoodBigStation.Model | |||||
{ | { | ||||
if (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); | |||||
// SiemensDevice.Siemens_PLC_S7.Write<bool>("DB2361.DBX330.0", false, 5); | |||||
CleanFinishData(); | |||||
if (GVL_BigStation.Recipe2DosingFinish) | |||||
GVL_BigStation.Recipe2DosingFinish = false; | |||||
MessageNotify.GetInstance.ShowRunLog($"配方队列【2】,配方编号:【{code}】,托盘编号:【{trayCode}】,配料完成,已将完成数据反馈至MES系统。"); | MessageNotify.GetInstance.ShowRunLog($"配方队列【2】,配方编号:【{code}】,托盘编号:【{trayCode}】,配料完成,已将完成数据反馈至MES系统。"); | ||||
GVL_BigStation.Recipe2DosingStatus = 40; | GVL_BigStation.Recipe2DosingStatus = 40; | ||||
} | } | ||||
else | else | ||||
{ | { | ||||
SiemensDevice.Siemens_PLC_S7.WriteClass<DL_Finish_DB>(FinishData, 2361); | SiemensDevice.Siemens_PLC_S7.WriteClass<DL_Finish_DB>(FinishData, 2361); | ||||
Thread.Sleep(3000); | |||||
Thread.Sleep(1500); | |||||
} | } | ||||
} | } | ||||
} | } | ||||
@@ -1683,15 +1687,18 @@ namespace BPASmartClient.JXJFoodBigStation.Model | |||||
{ | { | ||||
if (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); | |||||
//SiemensDevice.Siemens_PLC_S7.Write<bool>("DB2361.DBX330.0", false, 5); | |||||
CleanFinishData(); | |||||
if (GVL_BigStation.Recipe3DosingFinish) | |||||
GVL_BigStation.Recipe3DosingFinish = false; | |||||
MessageNotify.GetInstance.ShowRunLog($"配方队列【3】,配方编号:【{code}】,托盘编号:【{trayCode}】,配料完成,已将完成数据反馈至MES系统。"); | MessageNotify.GetInstance.ShowRunLog($"配方队列【3】,配方编号:【{code}】,托盘编号:【{trayCode}】,配料完成,已将完成数据反馈至MES系统。"); | ||||
GVL_BigStation.Recipe3DosingStatus = 40; | GVL_BigStation.Recipe3DosingStatus = 40; | ||||
} | } | ||||
else | else | ||||
{ | { | ||||
SiemensDevice.Siemens_PLC_S7.WriteClass<DL_Finish_DB>(FinishData, 2361); | SiemensDevice.Siemens_PLC_S7.WriteClass<DL_Finish_DB>(FinishData, 2361); | ||||
Thread.Sleep(3000); | |||||
Thread.Sleep(1500); | |||||
} | } | ||||
} | } | ||||
} | } | ||||
@@ -1824,15 +1831,17 @@ namespace BPASmartClient.JXJFoodBigStation.Model | |||||
{ | { | ||||
if (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); | |||||
// SiemensDevice.Siemens_PLC_S7.Write<bool>("DB2361.DBX330.0", false, 5); | |||||
CleanFinishData(); | |||||
if (GVL_BigStation.Recipe4DosingFinish) | |||||
GVL_BigStation.Recipe4DosingFinish = false; | |||||
MessageNotify.GetInstance.ShowRunLog($"配方队列【4】,配方编号:【{code}】,托盘编号:【{trayCode}】,配料完成,已将完成数据反馈至MES系统。"); | MessageNotify.GetInstance.ShowRunLog($"配方队列【4】,配方编号:【{code}】,托盘编号:【{trayCode}】,配料完成,已将完成数据反馈至MES系统。"); | ||||
GVL_BigStation.Recipe4DosingStatus = 40; | GVL_BigStation.Recipe4DosingStatus = 40; | ||||
} | } | ||||
else | else | ||||
{ | { | ||||
SiemensDevice.Siemens_PLC_S7.WriteClass<DL_Finish_DB>(FinishData, 2361); | SiemensDevice.Siemens_PLC_S7.WriteClass<DL_Finish_DB>(FinishData, 2361); | ||||
Thread.Sleep(3000); | |||||
Thread.Sleep(1500); | |||||
} | } | ||||
} | } | ||||
} | } | ||||
@@ -2578,5 +2587,23 @@ namespace BPASmartClient.JXJFoodBigStation.Model | |||||
return isSuccess; | return isSuccess; | ||||
} | } | ||||
private void CleanFinishData() | |||||
{ | |||||
if ((GVL_BigStation.Recipe1DosingFinish || GVL_BigStation.Recipe2DosingFinish || GVL_BigStation.Recipe3DosingFinish || GVL_BigStation.Recipe4DosingFinish)) | |||||
{ | |||||
FinishData.Order_No = ""; | |||||
FinishData.Product_Code = ""; | |||||
FinishData.job_No = 0; | |||||
for (int i = 0; i < 20; i++) | |||||
{ | |||||
FinishData.Material[i] = new UDT1(); | |||||
} | |||||
FinishData.Ask_For_Finish = false; | |||||
FinishData.ProcessTime = 0; | |||||
SiemensDevice.Siemens_PLC_S7.WriteClass<DL_Finish_DB>(FinishData, 2361); | |||||
} | |||||
} | |||||
} | } | ||||
} | } |
@@ -73,26 +73,26 @@ namespace BPASmartClient.JXJFoodBigStation.Model.Siemens | |||||
{ | { | ||||
DL_Status = status; | DL_Status = status; | ||||
} | } | ||||
if (res2 != null && res2 is DL_Finish_DB finish) | |||||
{ | |||||
if (finish.Ask_For_Finish_PLC &&(GVL_BigStation.Recipe1DosingFinish || GVL_BigStation.Recipe2DosingFinish || GVL_BigStation.Recipe3DosingFinish || GVL_BigStation.Recipe4DosingFinish)) | |||||
{ | |||||
finish.Order_No = ""; | |||||
finish.Product_Code = ""; | |||||
finish.job_No = 0; | |||||
for (int i = 0; i < 20; i++) | |||||
{ | |||||
finish.Material[i] = new UDT1(); | |||||
} | |||||
finish.Ask_For_Finish = false; | |||||
finish.ProcessTime = 0; | |||||
this.Siemens_PLC_S7.WriteClass<DL_Finish_DB>(finish, 2361); | |||||
if (GVL_BigStation.Recipe1DosingFinish) GVL_BigStation.Recipe1DosingFinish = false; | |||||
if (GVL_BigStation.Recipe2DosingFinish) GVL_BigStation.Recipe2DosingFinish = false; | |||||
if (GVL_BigStation.Recipe3DosingFinish) GVL_BigStation.Recipe3DosingFinish = false; | |||||
if (GVL_BigStation.Recipe4DosingFinish) GVL_BigStation.Recipe4DosingFinish = false; | |||||
} | |||||
} | |||||
//if (res2 != null && res2 is DL_Finish_DB finish) | |||||
//{ | |||||
// if (finish.Ask_For_Finish_PLC &&(GVL_BigStation.Recipe1DosingFinish || GVL_BigStation.Recipe2DosingFinish || GVL_BigStation.Recipe3DosingFinish || GVL_BigStation.Recipe4DosingFinish)) | |||||
// { | |||||
// finish.Order_No = ""; | |||||
// finish.Product_Code = ""; | |||||
// finish.job_No = 0; | |||||
// for (int i = 0; i < 20; i++) | |||||
// { | |||||
// finish.Material[i] = new UDT1(); | |||||
// } | |||||
// finish.Ask_For_Finish = false; | |||||
// finish.ProcessTime = 0; | |||||
// this.Siemens_PLC_S7.WriteClass<DL_Finish_DB>(finish, 2361); | |||||
// if (GVL_BigStation.Recipe1DosingFinish) GVL_BigStation.Recipe1DosingFinish = false; | |||||
// if (GVL_BigStation.Recipe2DosingFinish) GVL_BigStation.Recipe2DosingFinish = false; | |||||
// if (GVL_BigStation.Recipe3DosingFinish) GVL_BigStation.Recipe3DosingFinish = false; | |||||
// if (GVL_BigStation.Recipe4DosingFinish) GVL_BigStation.Recipe4DosingFinish = false; | |||||
// } | |||||
//} | |||||
Thread.Sleep(10); | Thread.Sleep(10); | ||||
var dataColl = ProcessControl.GetInstance.HKDevice.DataColl; | var dataColl = ProcessControl.GetInstance.HKDevice.DataColl; | ||||
if (dataColl != null && dataColl is DL_DataColl_DB data) | if (dataColl != null && dataColl is DL_DataColl_DB data) | ||||
@@ -543,7 +543,7 @@ namespace BPASmartClient.JXJFoodSmallStation.Model | |||||
{ | { | ||||
foreach (var data in RemoteRecipes) | foreach (var data in RemoteRecipes) | ||||
{ | { | ||||
if (data.TrayCode == 1 && IsInQueue(data.RecipeCode)) | |||||
if (data.TrayCode == 1 &&!IsInQueue(data.RecipeCode)) | |||||
{ | { | ||||
if (SiemensDevice.XL_Status is XL_Status_DB status) | if (SiemensDevice.XL_Status is XL_Status_DB status) | ||||
{ | { | ||||
@@ -888,6 +888,7 @@ namespace BPASmartClient.JXJFoodSmallStation.Model | |||||
if (RemoteRecipes.ElementAt(index).WindSend.Count==0) | if (RemoteRecipes.ElementAt(index).WindSend.Count==0) | ||||
{ | { | ||||
HKDevice.HK_PLC_S7.Write<bool>("DB4.DBX44."+recipeNum, true); | HKDevice.HK_PLC_S7.Write<bool>("DB4.DBX44."+recipeNum, true); | ||||
MessageNotify.GetInstance.ShowRunLog($"托盘1,配方编号【{code}】,配方号【{recipeNum + 1}】,该配方无风送料,已向配料PLC下发信号。"); | |||||
} | } | ||||
HKDevice.HK_PLC_S7.Write("DB4.DBX2." + recipeNum, true); | HKDevice.HK_PLC_S7.Write("DB4.DBX2." + recipeNum, true); | ||||
#endregion | #endregion | ||||
@@ -1053,7 +1054,7 @@ namespace BPASmartClient.JXJFoodSmallStation.Model | |||||
if (RemoteRecipes.ElementAt(index).RecipesSource == RecipeSource.远程 /*!GVL_SmallStation.GetInstance.IsUseLocalRecipe*/) | if (RemoteRecipes.ElementAt(index).RecipesSource == RecipeSource.远程 /*!GVL_SmallStation.GetInstance.IsUseLocalRecipe*/) | ||||
{ | { | ||||
double totalMakeTime = DateTime.Now.Subtract(GVL_SmallStation.GetInstance.DosingTime[recipeNum]).TotalSeconds; | double totalMakeTime = DateTime.Now.Subtract(GVL_SmallStation.GetInstance.DosingTime[recipeNum]).TotalSeconds; | ||||
RecipeFinishInfo[recipeNum] = new(); | |||||
RecipeFinishInfo[recipeNum].Order_No = RemoteRecipes.ElementAt(index).RecipeCode; | RecipeFinishInfo[recipeNum].Order_No = RemoteRecipes.ElementAt(index).RecipeCode; | ||||
RecipeFinishInfo[recipeNum].Product_Code = RemoteRecipes.ElementAt(index).RecipeName; | RecipeFinishInfo[recipeNum].Product_Code = RemoteRecipes.ElementAt(index).RecipeName; | ||||
RecipeFinishInfo[recipeNum].Job_No = (short)trayCode; | RecipeFinishInfo[recipeNum].Job_No = (short)trayCode; | ||||
@@ -1108,14 +1109,17 @@ namespace BPASmartClient.JXJFoodSmallStation.Model | |||||
//TODO:多配方队列单反馈变量,不知道到时候会不会有数据抢占的现象。 | //TODO:多配方队列单反馈变量,不知道到时候会不会有数据抢占的现象。 | ||||
if (SiemensDevice.Siemens_PLC_S7.Read<bool>("DB2261.DBX0.0")) | if (SiemensDevice.Siemens_PLC_S7.Read<bool>("DB2261.DBX0.0")) | ||||
{ | { | ||||
CleanFinishData(recipeNum); | |||||
GVL_SmallStation.GetInstance.RecipeProcessStatus[recipeNum] = 40; | GVL_SmallStation.GetInstance.RecipeProcessStatus[recipeNum] = 40; | ||||
SiemensDevice.Siemens_PLC_S7.Write<bool>("DB2261.DBX450.0", false); | |||||
//SiemensDevice.Siemens_PLC_S7.Write<bool>("DB2261.DBX450.0", false); | |||||
MessageNotify.GetInstance.ShowRunLog($"托盘1,配方【{code}】,MES系统确认收到完成数据。"); | MessageNotify.GetInstance.ShowRunLog($"托盘1,配方【{code}】,MES系统确认收到完成数据。"); | ||||
} | } | ||||
else | else | ||||
{ | { | ||||
SiemensDevice.Siemens_PLC_S7.WriteClass<XL_Finish_DB>(RecipeFinishInfo[recipeNum], 2261); | SiemensDevice.Siemens_PLC_S7.WriteClass<XL_Finish_DB>(RecipeFinishInfo[recipeNum], 2261); | ||||
Thread.Sleep(3000); | Thread.Sleep(3000); | ||||
} | } | ||||
} | } | ||||
} | } | ||||
@@ -1140,6 +1144,7 @@ namespace BPASmartClient.JXJFoodSmallStation.Model | |||||
RecipeQueueTray[recipeNum].TryDequeue(out code); | RecipeQueueTray[recipeNum].TryDequeue(out code); | ||||
GVL_SmallStation.GetInstance.RecipeStockBinDosing[recipeNum] = 0; | GVL_SmallStation.GetInstance.RecipeStockBinDosing[recipeNum] = 0; | ||||
GVL_SmallStation.GetInstance.RecipeProcessStatus[recipeNum] = 0; | GVL_SmallStation.GetInstance.RecipeProcessStatus[recipeNum] = 0; | ||||
MessageNotify.GetInstance.ShowRecipeLog($"配方名称:【{res.RecipeName}】\t 配方号:【{res.RecipeCode}】"); | |||||
MessageNotify.GetInstance.ShowRunLog($"配方【{code}】,配料流程完成。"); | MessageNotify.GetInstance.ShowRunLog($"配方【{code}】,配料流程完成。"); | ||||
} | } | ||||
#endregion | #endregion | ||||
@@ -1927,5 +1932,24 @@ namespace BPASmartClient.JXJFoodSmallStation.Model | |||||
return isSuccess; | return isSuccess; | ||||
} | } | ||||
private void CleanFinishData(int recipeNum) | |||||
{ | |||||
RecipeFinishInfo[recipeNum].Order_No = ""; | |||||
RecipeFinishInfo[recipeNum].Product_Code = ""; | |||||
RecipeFinishInfo[recipeNum].Job_No = 0; | |||||
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(); | |||||
} | |||||
RecipeFinishInfo[recipeNum].Ask_For_Finish = false; | |||||
RecipeFinishInfo[recipeNum].DosingTime = 0; | |||||
SiemensDevice.Siemens_PLC_S7.WriteClass<XL_Finish_DB>(RecipeFinishInfo[recipeNum], 2261); | |||||
} | |||||
} | } | ||||
} | } |
@@ -76,26 +76,26 @@ namespace BPASmartClient.JXJFoodSmallStation.Model.Siemens | |||||
} | } | ||||
} | } | ||||
} | } | ||||
if (Finish != null && Finish is XL_Finish_DB FinishData) | |||||
{ | |||||
if (FinishData.Ask_For_Finish_PLC) | |||||
{ | |||||
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(); | |||||
} | |||||
FinishData.Ask_For_Finish = false; | |||||
FinishData.DosingTime = 0; | |||||
this.Siemens_PLC_S7.WriteClass<XL_Finish_DB>(FinishData, 2261); | |||||
} | |||||
} | |||||
//if (Finish != null && Finish is XL_Finish_DB FinishData) | |||||
//{ | |||||
// if (FinishData.Ask_For_Finish_PLC) | |||||
// { | |||||
// 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(); | |||||
// } | |||||
// 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) | if (Status != null && Status is XL_Status_DB state) | ||||
{ | { | ||||
for (int i = 0; i < XL_Status.Powder.Length; i++) | for (int i = 0; i < XL_Status.Powder.Length; i++) | ||||