|
|
@@ -401,12 +401,13 @@ namespace BPASmartClient.JXJFoodSmallStation.Model |
|
|
|
if (index == -1) |
|
|
|
{ |
|
|
|
GVL_SmallStation.GetInstance.OrderCancelStep = 30; |
|
|
|
MessageNotify.GetInstance.ShowRunLog($"配方中并未找到订单{code}"); |
|
|
|
MessageNotify.GetInstance.ShowRunLog($"配方中并未找到订单配方号:【{code}】"); |
|
|
|
} |
|
|
|
else |
|
|
|
{ |
|
|
|
if (index1 >= 0) |
|
|
|
{ |
|
|
|
//在配方执行列表中找到此配方。 |
|
|
|
GVL_SmallStation.GetInstance.OrderCancelStep = 1; |
|
|
|
} |
|
|
|
else |
|
|
@@ -422,7 +423,7 @@ namespace BPASmartClient.JXJFoodSmallStation.Model |
|
|
|
{ |
|
|
|
GVL_SmallStation.GetInstance.RecipeProcessStatus[index] = 0; |
|
|
|
HKDevice.HK_PLC_S7.Write("DB4.DBX6." + index1, true); |
|
|
|
MessageNotify.GetInstance.ShowRunLog($"PLC正在执行配料流程,正在取消订单:{code}"); |
|
|
|
MessageNotify.GetInstance.ShowRunLog($"PLC正在执行配料流程,正在申请取消订单:{code}"); |
|
|
|
GVL_SmallStation.GetInstance.OrderCancelStep = 2; |
|
|
|
} |
|
|
|
else |
|
|
@@ -432,17 +433,20 @@ namespace BPASmartClient.JXJFoodSmallStation.Model |
|
|
|
} |
|
|
|
break; |
|
|
|
case 2: |
|
|
|
if (HKDevice.HK_PLC_S7.Read<bool>("DB3.DBX42." + index1)) |
|
|
|
//2023年8月18日: PLC无取消订单反馈,直接发送取消订单的BOOL量即可。 |
|
|
|
//if (HKDevice.HK_PLC_S7.Read<bool>("DB3.DBX42." + index1)) |
|
|
|
{ |
|
|
|
if (GVL_SmallStation.GetInstance.Station1Cylinder == false) |
|
|
|
{ |
|
|
|
GVL_SmallStation.GetInstance.OrderCancelStep = 3; |
|
|
|
MessageNotify.GetInstance.ShowRunLog($"PLC正在执行配料流程,取消订单:{code}"); |
|
|
|
//MessageNotify.GetInstance.ShowRunLog($"PLC正在执行配料流程,取消订单:{code}"); |
|
|
|
MessageNotify.GetInstance.ShowRunLog($"检测到配料PLC气缸信号为False,已取消订单:【{code}】"); |
|
|
|
} |
|
|
|
} |
|
|
|
break; |
|
|
|
case 3: |
|
|
|
SiemensDevice.Siemens_PLC_S7.Write("DB2201.DBX450.1", true); |
|
|
|
MessageNotify.GetInstance.ShowRunLog($"向主控PLC写入订单取消确认信号。"); |
|
|
|
GVL_SmallStation.GetInstance.OrderCancelStep = 4; |
|
|
|
break; |
|
|
|
case 4: |
|
|
@@ -450,7 +454,7 @@ namespace BPASmartClient.JXJFoodSmallStation.Model |
|
|
|
{ |
|
|
|
SiemensDevice.Siemens_PLC_S7.Write("DB2201.DBX450.1", false); |
|
|
|
GVL_SmallStation.GetInstance.OrderCancelStep = 9; |
|
|
|
MessageNotify.GetInstance.ShowRunLog($"队列1,西门子取消订单完成,订单号:{code}"); |
|
|
|
MessageNotify.GetInstance.ShowRunLog($"检测到主控PLC为False,已向主控PLC写入订单取消确认信号为False.配方队列【{index1}】,西门子取消订单完成,订单号:【{code}】。"); |
|
|
|
} |
|
|
|
break; |
|
|
|
case 9: |
|
|
@@ -463,6 +467,7 @@ namespace BPASmartClient.JXJFoodSmallStation.Model |
|
|
|
GVL_SmallStation.GetInstance.Order_Cancel = false; |
|
|
|
GVL_SmallStation.GetInstance.Order_CancelRecipeCode = ""; |
|
|
|
GVL_SmallStation.GetInstance.OrderCancelStep = 0; |
|
|
|
MessageNotify.GetInstance.ShowRunLog($"取消订单流程结束,已复位流程相关变量。"); |
|
|
|
break; |
|
|
|
case 20: |
|
|
|
SiemensDevice.Siemens_PLC_S7.Write("DB2201.DBX450.1", true); |
|
|
@@ -531,7 +536,7 @@ namespace BPASmartClient.JXJFoodSmallStation.Model |
|
|
|
SiemensDevice.Siemens_PLC_S7.WriteString(2231, data.RecipeCode, 10); |
|
|
|
SiemensDevice.Siemens_PLC_S7.Write("DB2231.DBX28.0", true); |
|
|
|
GVL_SmallStation.GetInstance.SiemensSendRecipeStatus = 4; |
|
|
|
MessageNotify.GetInstance.ShowRunLog($"配方{data.RecipeCode},请求配料"); |
|
|
|
MessageNotify.GetInstance.ShowRunLog($"配方【{data.RecipeCode}】,请求配料"); |
|
|
|
break; |
|
|
|
case 4: |
|
|
|
if (SiemensDevice.XL_Status.Dosing_Confirm) |
|
|
@@ -539,17 +544,18 @@ namespace BPASmartClient.JXJFoodSmallStation.Model |
|
|
|
SiemensDevice.Siemens_PLC_S7.WriteString(2231, "", 10);//复位字符串 |
|
|
|
SiemensDevice.Siemens_PLC_S7.Write("DB2231.DBX28.0", false); |
|
|
|
GVL_SmallStation.GetInstance.SiemensSendRecipeStatus = 5; |
|
|
|
MessageNotify.GetInstance.ShowRunLog($"配方{data.RecipeCode},西门子确认配料"); |
|
|
|
MessageNotify.GetInstance.ShowRunLog($"配方【{data.RecipeCode}】,西门子确认配料"); |
|
|
|
} |
|
|
|
break; |
|
|
|
case 5: |
|
|
|
if (SiemensDevice.XL_Status.Dosing_Confirm == false) |
|
|
|
{ |
|
|
|
GVL_SmallStation.GetInstance.SiemensSendRecipeStatus = 6; |
|
|
|
MessageNotify.GetInstance.ShowRunLog($"配方{data.RecipeCode},西门子确认配料信号复位完成"); |
|
|
|
MessageNotify.GetInstance.ShowRunLog($"配方【{data.RecipeCode}】,西门子确认配料信号复位完成"); |
|
|
|
} |
|
|
|
break; |
|
|
|
case 6: |
|
|
|
//TODO:这里多订单时可能需要修改为i<2,大于等于2的情况下 无法下发配方到配料PLC。。 |
|
|
|
for (int i = 0; i < 5; i++) |
|
|
|
{ |
|
|
|
if (GVL_SmallStation.GetInstance.NotUseSmallStation) |
|
|
@@ -558,7 +564,7 @@ namespace BPASmartClient.JXJFoodSmallStation.Model |
|
|
|
{ |
|
|
|
RecipeQueueTray[i].Enqueue(data.RecipeCode); |
|
|
|
GVL_SmallStation.GetInstance.SiemensSendRecipeStatus = 0; |
|
|
|
MessageNotify.GetInstance.ShowRunLog($"西门子配方配料 ,不使用小料配料,配方{data.RecipeCode},加入配方{i}"); |
|
|
|
MessageNotify.GetInstance.ShowRunLog($"西门子配方配料 ,不使用小料配料,配方ID:【{data.RecipeCode}】,加入配方队列【{i+1}】"); |
|
|
|
} |
|
|
|
} |
|
|
|
else if (GVL_SmallStation.GetInstance.PlcAllowIssueRecipe[i]) |
|
|
@@ -567,7 +573,7 @@ namespace BPASmartClient.JXJFoodSmallStation.Model |
|
|
|
{ |
|
|
|
RecipeQueueTray[i].Enqueue(data.RecipeCode); |
|
|
|
GVL_SmallStation.GetInstance.SiemensSendRecipeStatus = 0; |
|
|
|
MessageNotify.GetInstance.ShowRunLog($"西门子配方配料 ,等待plc允许配料,配方{data.RecipeCode},加入配方{i}"); |
|
|
|
MessageNotify.GetInstance.ShowRunLog($"西门子配方配料 ,等待PLC允许配料,配方ID:【{data.RecipeCode}】,加入配方队列【{i+1}】"); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
@@ -607,7 +613,7 @@ namespace BPASmartClient.JXJFoodSmallStation.Model |
|
|
|
if (RecipeQueueTray[i].Count == 0 && !RecipeQueueTray[0].Contains(data.RecipeCode) && !RecipeQueueTray[1].Contains(data.RecipeCode) && !RecipeQueueTray[2].Contains(data.RecipeCode) && !RecipeQueueTray[3].Contains(data.RecipeCode) && !RecipeQueueTray[4].Contains(data.RecipeCode)) |
|
|
|
{ |
|
|
|
RecipeQueueTray[i].Enqueue(data.RecipeCode); |
|
|
|
MessageNotify.GetInstance.ShowRunLog($"本地配方配料 ,不使用小料配料,配方{data.RecipeCode},加入配方{i}"); |
|
|
|
MessageNotify.GetInstance.ShowRunLog($"本地配方配料 ,不使用小料配料,配方ID:【{data.RecipeCode}】,加入配方队列【{i}】"); |
|
|
|
} |
|
|
|
} |
|
|
|
else if (GVL_SmallStation.GetInstance.PlcAllowIssueRecipe[i]) |
|
|
@@ -615,7 +621,7 @@ namespace BPASmartClient.JXJFoodSmallStation.Model |
|
|
|
if (RecipeQueueTray[i].Count == 0 && !RecipeQueueTray[0].Contains(data.RecipeCode) && !RecipeQueueTray[1].Contains(data.RecipeCode) && !RecipeQueueTray[2].Contains(data.RecipeCode) && !RecipeQueueTray[3].Contains(data.RecipeCode) && !RecipeQueueTray[4].Contains(data.RecipeCode)) |
|
|
|
{ |
|
|
|
RecipeQueueTray[i].Enqueue(data.RecipeCode); |
|
|
|
MessageNotify.GetInstance.ShowRunLog($"本地配方配料 ,等待plc允许配料,配方{data.RecipeCode},加入配方{i}"); |
|
|
|
MessageNotify.GetInstance.ShowRunLog($"本地配方配料 ,等待PLC允许配料,配方ID:【{data.RecipeCode}】,加入配方队列【{i}】"); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
@@ -641,46 +647,47 @@ namespace BPASmartClient.JXJFoodSmallStation.Model |
|
|
|
{ |
|
|
|
if (!GVL_SmallStation.GetInstance.NotUseSmallStation) |
|
|
|
{ |
|
|
|
for (int i = 0; i < 5; i++) |
|
|
|
//2023-8-18:i<5--> i<1 。只有一个工位,只发一个工位的信号即可。 |
|
|
|
for (int i = 0; i < 1; i++) |
|
|
|
{ |
|
|
|
switch (GVL_SmallStation.GetInstance.Tray_AGVLogic[i]) |
|
|
|
{ |
|
|
|
case 0: |
|
|
|
if (GVL_SmallStation.GetInstance.AGV_PutTray1Finish && (RecipeQueueTray[i].Count > 0) && GVL_SmallStation.GetInstance.AGVIsGetTray == false) |
|
|
|
if (GVL_SmallStation.GetInstance.AGV_PutTray1Finish /*&& (RecipeQueueTray[i].Count > 0) && GVL_SmallStation.GetInstance.AGVIsGetTray == false*/) |
|
|
|
{ |
|
|
|
GVL_SmallStation.GetInstance.AGVIsGetTray = true; |
|
|
|
HKDevice.HK_PLC_S7.Write("DB4.DBX8." + i, true); |
|
|
|
GVL_SmallStation.GetInstance.AGV_PutTray1Finish = false; |
|
|
|
GVL_SmallStation.GetInstance.Tray_AGVLogic[i] = 1; |
|
|
|
MessageNotify.GetInstance.ShowRunLog("AGV到位 发送到位信号给plc"); |
|
|
|
MessageNotify.GetInstance.ShowRunLog($"AGV到位,发送到位信号【{"DB4.DBX8." + i}】给PLC。"); |
|
|
|
} |
|
|
|
break; |
|
|
|
case 1: |
|
|
|
if (GVL_SmallStation.GetInstance.Station1HaveTray) |
|
|
|
|
|
|
|
{ |
|
|
|
HKDevice.HK_PLC_S7.Write("DB4.DBX8." + i, false); |
|
|
|
GVL_SmallStation.GetInstance.Tray_AGVLogic[i] = 2; |
|
|
|
MessageNotify.GetInstance.ShowRunLog("托盘1有货架"); |
|
|
|
MessageNotify.GetInstance.ShowRunLog($"海科PLC写入货架信号【{"DB4.DBX8." + i}】托盘【{1}】有货架"); |
|
|
|
} |
|
|
|
break; |
|
|
|
case 2: |
|
|
|
if (GVL_SmallStation.GetInstance.AGV_GetTray1Finish && GVL_SmallStation.GetInstance.RecipeProcessStatus[i] == 0) |
|
|
|
//2023-8-18:注释。 |
|
|
|
if (GVL_SmallStation.GetInstance.AGV_GetTray1Finish/* && GVL_SmallStation.GetInstance.RecipeProcessStatus[i] == 0*/) |
|
|
|
{ |
|
|
|
GVL_SmallStation.GetInstance.AGVIsGetTray = false; |
|
|
|
HKDevice.HK_PLC_S7.Write("DB4.DBX10." + i, true); |
|
|
|
GVL_SmallStation.GetInstance.Tray_AGVLogic[i] = 3; |
|
|
|
MessageNotify.GetInstance.ShowRunLog("AGV取托盘1完成,发送给海科信号后1s后复位"); |
|
|
|
MessageNotify.GetInstance.ShowRunLog($"AGV取托盘【{1}】完成,发送给小料配料PLC的取托盘完成【{"DB4.DBX10." + i}】信号1s后复位。"); |
|
|
|
} |
|
|
|
break; |
|
|
|
case 3: |
|
|
|
if (HKDevice.HK_PLC_S7.Read<bool>("DB4.DBX10." + i) == true) |
|
|
|
//if (HKDevice.HK_PLC_S7.Read<bool>("DB4.DBX10." + i) == true) |
|
|
|
{ |
|
|
|
Thread.Sleep(1000); |
|
|
|
HKDevice.HK_PLC_S7.Write("DB4.DBX10." + i, false); |
|
|
|
GVL_SmallStation.GetInstance.Tray_AGVLogic[i] = 0; |
|
|
|
GVL_SmallStation.GetInstance.AGV_GetTray1Finish = false; |
|
|
|
MessageNotify.GetInstance.ShowRunLog("AGV取托盘1完成,信号复位"); |
|
|
|
MessageNotify.GetInstance.ShowRunLog($"AGV取托盘【{1}】完成,信号【{"DB4.DBX10." + i}】复位。"); |
|
|
|
} |
|
|
|
break; |
|
|
|
default: |
|
|
@@ -735,11 +742,11 @@ namespace BPASmartClient.JXJFoodSmallStation.Model |
|
|
|
RecipeFinishInfo.DosingTime = Convert.ToInt16(0); |
|
|
|
SiemensDevice.Siemens_PLC_S7.WriteClass<XL_Finish_DB>(RecipeFinishInfo, 2261); |
|
|
|
|
|
|
|
MessageNotify.GetInstance.ShowRunLog($"托盘1,配方{res.RecipeName},配料完成,数据反馈给西门子"); |
|
|
|
MessageNotify.GetInstance.ShowRunLog($"托盘【{trayCode}】,配方【{res.RecipeCode}】,配料完成,数据反馈给西门子"); |
|
|
|
} |
|
|
|
else |
|
|
|
{ |
|
|
|
MessageNotify.GetInstance.ShowRunLog($"托盘1,配方{res.RecipeName},配料完成,数据无法反馈给西门子,西门子设备未连接或处于本地配方"); |
|
|
|
MessageNotify.GetInstance.ShowRunLog($"托盘【{trayCode}】,配方【{res.RecipeCode}】,配料完成,数据无法反馈给西门子,西门子设备未连接或处于本地配方"); |
|
|
|
} |
|
|
|
GVL_SmallStation.GetInstance.WindSendDosing = false; |
|
|
|
App.Current.Dispatcher.Invoke(() => |
|
|
@@ -754,78 +761,108 @@ namespace BPASmartClient.JXJFoodSmallStation.Model |
|
|
|
else |
|
|
|
{ |
|
|
|
//粉料仓下发配方 |
|
|
|
if (GVL_SmallStation.GetInstance.IsUseWindSend && GVL_SmallStation.GetInstance.WindSendDosing == false /*&& GVL_SmallStation.GetInstance.Tray_AGVLogic[recipeNum] == 2*/) |
|
|
|
#region 粉料仓配料 |
|
|
|
if (GVL_SmallStation.GetInstance.IsUseWindSend && GVL_SmallStation.GetInstance.WindSendDosing == false /*&& GVL_SmallStation.GetInstance.Tray_AGVLogic[recipeNum] == 2*/) |
|
|
|
{ |
|
|
|
if (WindSendDevice.IsConnected) |
|
|
|
{ |
|
|
|
if (GVL_SmallStation.GetInstance.WindSendDosingStatus == 1) |
|
|
|
{ |
|
|
|
|
|
|
|
WindSend_Write WindSendData111 = new WindSend_Write(); |
|
|
|
WindSendDevice.Siemens_PLC_S7.WriteClass<WindSend_Write>(WindSendData111, 95); |
|
|
|
Thread.Sleep(200); |
|
|
|
WindSendData111.TargetRecipeCode = code; |
|
|
|
WindSendData111.IsAllowDosing = true; |
|
|
|
|
|
|
|
MessageNotify.GetInstance.ShowRunLog($"开始写入风送料仓配方【{code}】。"); |
|
|
|
|
|
|
|
foreach (var item in RemoteRecipes.ElementAt(index).WindSend) |
|
|
|
{ |
|
|
|
if (item.RawMaterialName == Json<DevicePar>.Data.windSendRawMaterial.ElementAt(0).RawMaterialName || item.Location == 1) |
|
|
|
{ |
|
|
|
WindSendData111.RawMaterial1_SetWeight = item.RawMaterialWeight; |
|
|
|
MessageNotify.GetInstance.ShowRunLog($"风送料仓{item.RawMaterialName},设定重量{item.RawMaterialWeight}"); |
|
|
|
MessageNotify.GetInstance.ShowRunLog($"风送料仓【{item.RawMaterialName}】,设定重量【{item.RawMaterialWeight}】"); |
|
|
|
continue; |
|
|
|
} |
|
|
|
if (item.RawMaterialName == Json<DevicePar>.Data.windSendRawMaterial.ElementAt(1).RawMaterialName || item.Location == 2) |
|
|
|
{ |
|
|
|
WindSendData111.RawMaterial2_SetWeight = item.RawMaterialWeight; |
|
|
|
MessageNotify.GetInstance.ShowRunLog($"风送料仓{item.RawMaterialName},设定重量{item.RawMaterialWeight}"); |
|
|
|
MessageNotify.GetInstance.ShowRunLog($"风送料仓【{item.RawMaterialName}】,设定重量【{item.RawMaterialWeight}】"); |
|
|
|
continue; |
|
|
|
} |
|
|
|
if (item.RawMaterialName == Json<DevicePar>.Data.windSendRawMaterial.ElementAt(2).RawMaterialName || item.Location == 3) |
|
|
|
{ |
|
|
|
WindSendData111.RawMaterial3_SetWeight = item.RawMaterialWeight; |
|
|
|
MessageNotify.GetInstance.ShowRunLog($"风送料仓{item.RawMaterialName},设定重量{item.RawMaterialWeight}"); |
|
|
|
MessageNotify.GetInstance.ShowRunLog($"风送料仓【{item.RawMaterialName}】,设定重量【{item.RawMaterialWeight}】"); |
|
|
|
continue; |
|
|
|
} |
|
|
|
if (item.RawMaterialName == Json<DevicePar>.Data.windSendRawMaterial.ElementAt(3).RawMaterialName || item.Location == 4) |
|
|
|
{ |
|
|
|
WindSendData111.RawMaterial4_SetWeight = item.RawMaterialWeight; |
|
|
|
MessageNotify.GetInstance.ShowRunLog($"风送料仓{item.RawMaterialName},设定重量{item.RawMaterialWeight}"); |
|
|
|
MessageNotify.GetInstance.ShowRunLog($"风送料仓【{item.RawMaterialName}】,设定重量【{item.RawMaterialWeight}】"); |
|
|
|
continue; |
|
|
|
} |
|
|
|
if (item.RawMaterialName == Json<DevicePar>.Data.windSendRawMaterial.ElementAt(4).RawMaterialName || item.Location == 5) |
|
|
|
{ |
|
|
|
WindSendData111.RawMaterial5_SetWeight = item.RawMaterialWeight; |
|
|
|
MessageNotify.GetInstance.ShowRunLog($"风送料仓{item.RawMaterialName},设定重量{item.RawMaterialWeight}"); |
|
|
|
MessageNotify.GetInstance.ShowRunLog($"风送料仓【{item.RawMaterialName}】,设定重量【{item.RawMaterialWeight}】"); |
|
|
|
continue; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
WindSendDevice.Siemens_PLC_S7.WriteClass<WindSend_Write>(WindSendData111, 95); |
|
|
|
GVL_SmallStation.GetInstance.WindSendDosing = true; |
|
|
|
GVL_SmallStation.GetInstance.WindSendDosingStatus = 2; |
|
|
|
WindSendDevice.Siemens_PLC_S7.WriteClass<WindSend_Write>(WindSendData111, 95); |
|
|
|
MessageNotify.GetInstance.ShowRunLog($"风送系统配方【{code}】写入完成。"); |
|
|
|
} |
|
|
|
} |
|
|
|
else |
|
|
|
{ |
|
|
|
if (Delay.GetInstance("delayTime").Start(true,60)) |
|
|
|
if (Delay.GetInstance("delayTime").Start(true, 60)) |
|
|
|
{ |
|
|
|
Delay.GetInstance("delayTime").Start(false, 60); |
|
|
|
MessageNotify.GetInstance.ShowRunLog($"风送设备PLC未连接"); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
#endregion |
|
|
|
|
|
|
|
|
|
|
|
if (GVL_SmallStation.GetInstance.RecipeProcessStatus[recipeNum] == 0) |
|
|
|
{ |
|
|
|
GVL_SmallStation.GetInstance.RecipeStockBinDosing[recipeNum] = 0; |
|
|
|
|
|
|
|
#region 向配料PLC下发配方数据。 |
|
|
|
HKDevice.IssueRecipeToPlc(RemoteRecipes.ElementAt(index).RawMaterial, recipeNum); |
|
|
|
HKDevice.HK_PLC_S7.Write("DB4.DBX2." + recipeNum, true); |
|
|
|
|
|
|
|
//2023.8.16:如果没有粉料仓需要配料的数据,发送一下信号给配料PLC判断粉料仓完成。 |
|
|
|
if (RemoteRecipes.ElementAt(index).WindSend.Count==0) |
|
|
|
{ |
|
|
|
HKDevice.HK_PLC_S7.Write<bool>("DB4.DBX44."+recipeNum, true); |
|
|
|
} |
|
|
|
HKDevice.HK_PLC_S7.Write("DB4.DBX2." + recipeNum, true); |
|
|
|
#endregion |
|
|
|
|
|
|
|
GVL_SmallStation.GetInstance.DosingTime[recipeNum] = DateTime.Now; |
|
|
|
GVL_SmallStation.GetInstance.RecipeProcessStatus[recipeNum] = 1; |
|
|
|
MessageNotify.GetInstance.ShowRunLog($"托盘1,配方编号{code},配方号{recipeNum + 1},下发完成"); |
|
|
|
MessageNotify.GetInstance.ShowRunLog($"托盘1,配方编号【{code}】,配方号【{recipeNum + 1}】,下发完成"); |
|
|
|
} |
|
|
|
|
|
|
|
//等待配料PLC反馈配方收到。 |
|
|
|
bool recipeReceviceFinish = HKDevice.HK_PLC_S7.Read<bool>("DB3.DBX4." + recipeNum); |
|
|
|
if (recipeReceviceFinish && GVL_SmallStation.GetInstance.RecipeProcessStatus[recipeNum] == 1) |
|
|
|
{ |
|
|
|
HKDevice.HK_PLC_S7.Write("DB4.DBX2." + recipeNum, false); |
|
|
|
GVL_SmallStation.GetInstance.RecipeProcessStatus[recipeNum] = 2; |
|
|
|
GVL_SmallStation.GetInstance.StockBinDosingIssue[recipeNum] = 0; |
|
|
|
MessageNotify.GetInstance.ShowRunLog($"托盘1,配方编号{code},配方号{recipeNum + 1},配方接收完成"); |
|
|
|
MessageNotify.GetInstance.ShowRunLog($"托盘1,配方编号【{code}】,配方号【{recipeNum + 1}】,配方接收完成"); |
|
|
|
} |
|
|
|
|
|
|
|
if (GVL_SmallStation.GetInstance.RecipeProcessStatus[recipeNum] == 2) |
|
|
|
{ |
|
|
|
#region 味魔方配料,并验证误差。 |
|
|
|
|
|
|
|
for (byte i = 1; i < 16; i++) |
|
|
|
{ |
|
|
|
int indexArr = -1; |
|
|
@@ -924,14 +961,22 @@ namespace BPASmartClient.JXJFoodSmallStation.Model |
|
|
|
MessageNotify.GetInstance.ShowRunLog(commInfo1); |
|
|
|
} |
|
|
|
GVL_SmallStation.GetInstance.RecipeStockBinDosing[recipeNum] = GVL_SmallStation.GetInstance.RecipeStockBinDosing[recipeNum].SetBitValue((byte)i, false);//配料完成设备写成false |
|
|
|
MessageNotify.GetInstance.ShowRunLog($"配方{recipeNum},{GVL_SmallStation.GetInstance.RecipeStockBinDosing[recipeNum].ToBinString()}"); |
|
|
|
MessageNotify.GetInstance.ShowRunLog($"配方队列:【{recipeNum+1}】,配方ID:【{code}】,{GVL_SmallStation.GetInstance.RecipeStockBinDosing[recipeNum].ToBinString()}"); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
bool DosingComple = HKDevice.HK_PLC_S7.Read<bool>("DB3.DBX6." + recipeNum); |
|
|
|
if ((RTrig.GetInstance("配方配料完成").Start(DosingComple)) || (GVL_SmallStation.GetInstance.StockBinDosingIssue[recipeNum] > 0 && DosingComple)) |
|
|
|
|
|
|
|
#endregion |
|
|
|
|
|
|
|
//等待配料PLC反馈配料完成信号。 |
|
|
|
var completedSingleAddr = "DB3.DBX6." + recipeNum; |
|
|
|
bool DosingComple = HKDevice.HK_PLC_S7.Read<bool>(completedSingleAddr); |
|
|
|
var dosingCompleTrig = RTrig.GetInstance("配方配料完成").Start(DosingComple); |
|
|
|
//2023-8-18:删除通过小料仓下发情况和配料完成信号判断配料完成。只通过配料完成上升沿作为判断配料结束信号。 |
|
|
|
if (GVL_SmallStation.GetInstance.StockBinDosingIssue[recipeNum] > 0 && dosingCompleTrig /*&& DosingComple)*/) |
|
|
|
{ |
|
|
|
MessageNotify.GetInstance.ShowRunLog($"接收到配料PLC配料完成信号【{completedSingleAddr}】上升沿,配方ID:【{code}】,配方队列【{recipeNum + 1}】。"); |
|
|
|
GVL_SmallStation.GetInstance.RecipeDosingCompleNum = GVL_SmallStation.GetInstance.RecipeDosingCompleNum + 1; |
|
|
|
GVL_SmallStation.GetInstance.StockBinDosingIssue[recipeNum] = 0; |
|
|
|
if (GVL_SmallStation.GetInstance.RecipeStockBinDosing[recipeNum] > 0) |
|
|
@@ -940,7 +985,7 @@ namespace BPASmartClient.JXJFoodSmallStation.Model |
|
|
|
{ |
|
|
|
if (GVL_SmallStation.GetInstance.RecipeStockBinDosing[recipeNum].Get16bitValue((byte)i)) |
|
|
|
{ |
|
|
|
MessageNotify.GetInstance.ShowRunLog($"料仓配料完成,但存在料仓未配料:{i}号仓"); |
|
|
|
MessageNotify.GetInstance.ShowRunLog($"配方ID:【{code}】,配方队列【{recipeNum+1}】,料仓配料完成,但存在料仓未配料:{i}号仓"); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
@@ -948,8 +993,10 @@ namespace BPASmartClient.JXJFoodSmallStation.Model |
|
|
|
double a = DateTime.Now.Subtract(GVL_SmallStation.GetInstance.DosingTime[recipeNum]).TotalSeconds; |
|
|
|
foreach (var item in RemoteRecipes.ElementAt(index).RawMaterial) |
|
|
|
{ |
|
|
|
MessageNotify.GetInstance.ShowRunLog($"{item.RawMaterialName},下料重量:{item.Laying_Off_Weight}g"); |
|
|
|
MessageNotify.GetInstance.ShowRunLog($"配方ID:【{code}】:【{item.RawMaterialName}】,下料重量:【{item.Laying_Off_Weight}】g"); |
|
|
|
} |
|
|
|
|
|
|
|
#region 给主控PLC发送配料完成数据信号。 |
|
|
|
if (SiemensDevice.IsConnected && !GVL_SmallStation.GetInstance.IsUseLocalRecipe) |
|
|
|
{ |
|
|
|
RecipeFinishInfo.Order_No = RemoteRecipes.ElementAt(index).RecipeCode; |
|
|
@@ -977,14 +1024,16 @@ namespace BPASmartClient.JXJFoodSmallStation.Model |
|
|
|
RecipeFinishInfo.DosingTime = Convert.ToInt16(a); |
|
|
|
SiemensDevice.Siemens_PLC_S7.WriteClass<XL_Finish_DB>(RecipeFinishInfo, 2261); |
|
|
|
|
|
|
|
MessageNotify.GetInstance.ShowRunLog($"托盘1,配方{res.RecipeName},配料完成,数据反馈给西门子"); |
|
|
|
MessageNotify.GetInstance.ShowRunLog($"托盘1,配方【{res.RecipeCode}】,配料完成,数据反馈给西门子"); |
|
|
|
MessageNotify.GetInstance.ShowRecipeLog(res.RecipeName); |
|
|
|
} |
|
|
|
else |
|
|
|
{ |
|
|
|
MessageNotify.GetInstance.ShowRunLog($"托盘1,配方{res.RecipeName},配料完成,数据无法反馈给西门子,西门子设备未连接或处于本地配方"); |
|
|
|
MessageNotify.GetInstance.ShowRunLog($"托盘1,配方【{res.RecipeCode}】,配料完成,数据无法反馈给西门子,西门子设备未连接或处于本地配方"); |
|
|
|
MessageNotify.GetInstance.ShowRecipeLog(res.RecipeName); |
|
|
|
} |
|
|
|
} |
|
|
|
#endregion |
|
|
|
|
|
|
|
GVL_SmallStation.GetInstance.WindSendDosing = false; |
|
|
|
App.Current.Dispatcher.Invoke(() => |
|
|
|
{ |
|
|
@@ -993,6 +1042,7 @@ namespace BPASmartClient.JXJFoodSmallStation.Model |
|
|
|
RecipeQueueTray[recipeNum].TryDequeue(out code); |
|
|
|
GVL_SmallStation.GetInstance.RecipeStockBinDosing[recipeNum] = 0; |
|
|
|
GVL_SmallStation.GetInstance.RecipeProcessStatus[recipeNum] = 0; |
|
|
|
MessageNotify.GetInstance.ShowRunLog($"配方【{res.RecipeCode}】,配料流程完成。"); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
@@ -1303,7 +1353,8 @@ namespace BPASmartClient.JXJFoodSmallStation.Model |
|
|
|
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] |
|
|
|
RawMaterialLocation = (int)RawMaterialsNamePos[recipe.Material[i].Material_Name], |
|
|
|
RawMaterialType="小料" |
|
|
|
}); |
|
|
|
} |
|
|
|
else |
|
|
@@ -1318,12 +1369,16 @@ namespace BPASmartClient.JXJFoodSmallStation.Model |
|
|
|
} |
|
|
|
for (int i = 0; i < GVL_SmallStation.Max_PowderSotckBinNum; i++) |
|
|
|
{ |
|
|
|
if (!string.IsNullOrEmpty(recipe.Powder[i].Powder_Name)) |
|
|
|
var rawMaterialName = recipe.Powder[i].Powder_Name; |
|
|
|
if (!string.IsNullOrEmpty(rawMaterialName)) |
|
|
|
{ |
|
|
|
WindSendData.Add(new WindSendRawMaterial() |
|
|
|
{ |
|
|
|
RawMaterialName = recipe.Powder[i].Powder_Name, |
|
|
|
RawMaterialWeight = recipe.Powder[i].Powder_Weight |
|
|
|
RawMaterialName = rawMaterialName, |
|
|
|
RawMaterialWeight = recipe.Powder[i].Powder_Weight, |
|
|
|
RawMaterialBarrelNum=3, |
|
|
|
Location=Json<DevicePar>.Data.windSendRawMaterial.FirstOrDefault(raw=>raw.RawMaterialName== rawMaterialName).Location, |
|
|
|
RawMaterialType="粉料" |
|
|
|
}); |
|
|
|
} |
|
|
|
else |
|
|
|