瀏覽代碼

海科调试。

master
ZhaoGang 1 年之前
父節點
當前提交
278f382a13
共有 9 個文件被更改,包括 148 次插入81 次删除
  1. +5
    -2
      BPASmartClient.JXJFoodBigStation/Model/HK_PLC/HKDeviceStatus.cs
  2. +25
    -23
      BPASmartClient.JXJFoodBigStation/Model/ProcessControl.cs
  3. +2
    -1
      BPASmartClient.JXJFoodBigStation/View/HardwareStatusView.xaml
  4. +4
    -4
      BPASmartClient.JXJFoodSmallStation/Model/HK_PLC/HKDeviceStatus.cs
  5. +102
    -47
      BPASmartClient.JXJFoodSmallStation/Model/ProcessControl.cs
  6. +1
    -1
      BPASmartClient.JXJFoodSmallStation/Model/Siemens/SiemensDeviceStatus.cs
  7. +3
    -1
      BPASmartClient.JXJFoodSmallStation/Model/Siemens/XL_Start_DB.cs
  8. +1
    -1
      BPASmartClient.JXJFoodSmallStation/Model/WindSend/WindSendRawMaterial.cs
  9. +5
    -1
      BPASmartClient.JXJFoodSmallStation/View/RecipeReceiveView.xaml

+ 5
- 2
BPASmartClient.JXJFoodBigStation/Model/HK_PLC/HKDeviceStatus.cs 查看文件

@@ -161,10 +161,13 @@ namespace BPASmartClient.JXJFoodBigStation.Model.HK_PLC
{
App.Current.Dispatcher.Invoke(() =>
{
MessageNotify.GetInstance.ShowDialog($"配方{recipe.RecipeCode},plc配方数据和西门子配方数据不一致!", DialogType.Error);
MessageNotify.GetInstance.ShowDialog($"配方{recipe.RecipeCode},PLC配方数据和西门子配方数据不一致!", DialogType.Error);
});
MessageNotify.GetInstance.ShowRunLog($"配方编号:{recipe.RecipeCode},PLC配方数据和西门子配方数据不一致");
}
MessageNotify.GetInstance.ShowRunLog($"配方编号:{recipe.RecipeCode},配方数据验证成功");
else
MessageNotify.GetInstance.ShowRunLog($"配方编号:{recipe.RecipeCode},配方数据验证成功");

}
}
/// <summary>


+ 25
- 23
BPASmartClient.JXJFoodBigStation/Model/ProcessControl.cs 查看文件

@@ -110,7 +110,7 @@ namespace BPASmartClient.JXJFoodBigStation.Model
}
else
{
MessageNotify.GetInstance.ShowAlarmLog($"本地缺少原料{recipe.Material[i].Material_Name},和西门子下发的原料名称无法对应,");
MessageNotify.GetInstance.ShowRunLog($"本地缺少原料【{recipe.Material[i].Material_Name}】,和西门子下发的原料名称无法对应。");
}
}
}
@@ -122,7 +122,9 @@ namespace BPASmartClient.JXJFoodBigStation.Model
RecipeCode = recipe.RecipeCode,
RawMaterial = RawMaterials,
TrayCode = recipe.Job_No,
IsWashingBarrel = recipe.Order_Type
IsWashingBarrel = recipe.Order_Type,
//OrderType=recipe.Order_Type?"洗桶":"配料",
RecipesSource=RecipeSource.远程
});
});
}
@@ -878,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;
@@ -916,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;
}
}
@@ -951,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;
}
}
@@ -986,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;
}
}
@@ -999,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");
}
}
}
@@ -1084,7 +1086,7 @@ namespace BPASmartClient.JXJFoodBigStation.Model
}
break;
case 12:
MessageNotify.GetInstance.ShowRunLog($"西门子取消订单,但未找到订单:{GVL_BigStation.Order_CancelRecipeCode}");
MessageNotify.GetInstance.ShowRunLog($"西门子取消订单,但未找到订单:{GVL_BigStation.Order_CancelRecipeCode}");
GVL_BigStation.Order_Cancel = false;
GVL_BigStation.Order_CancelRecipeCode = "";
GVL_BigStation.Order_CancelStep = 0;
@@ -1107,7 +1109,7 @@ namespace BPASmartClient.JXJFoodBigStation.Model
{
Json<RemoteRecipe>.Data.Recipes.RemoveAt(index);
});
MessageNotify.GetInstance.ShowRunLog($"正在执行请求取消订单流程,配方还未到PLC,订单号:{GVL_BigStation.Order_CancelRecipeCode}");
MessageNotify.GetInstance.ShowRunLog($"正在执行请求取消订单流程,配方还未到PLC,订单号:{GVL_BigStation.Order_CancelRecipeCode}");
GVL_BigStation.Order_Cancel = false;
GVL_BigStation.Order_CancelRecipeCode = "";
GVL_BigStation.Order_CancelStep = 0;
@@ -1142,7 +1144,7 @@ namespace BPASmartClient.JXJFoodBigStation.Model
else
{
GVL_BigStation.Order_CancelStep = 32;
MessageNotify.GetInstance.ShowRunLog($"AGV未到达工站前,未给plc下发配方,取消订单:{code}");
MessageNotify.GetInstance.ShowRunLog($"AGV未到达工站前,未给plc下发配方,取消订单:{code}");
}
break;
case 32:
@@ -1161,7 +1163,7 @@ namespace BPASmartClient.JXJFoodBigStation.Model
GVL_BigStation.Order_CancelStep = 0;
GVL_BigStation.Order_Cancel = false;
GVL_BigStation.Order_CancelRecipeCode = "";
MessageNotify.GetInstance.ShowRunLog($"队列1,西门子取消订单完成,订单号:{code}");
MessageNotify.GetInstance.ShowRunLog($"队列1,西门子取消订单完成,订单号:{code}");
}
break;
case 41:
@@ -1171,12 +1173,12 @@ namespace BPASmartClient.JXJFoodBigStation.Model
MessageNotify.GetInstance.ShowRunLog($"海科PLC写入{HKDevice.HK_PLC_S7.Write("DB99.DBW232", (short)TrayCode)}");
GVL_BigStation.Recipe2DosingStatus = 0;
GVL_BigStation.Order_CancelStep = 42;
MessageNotify.GetInstance.ShowRunLog($"PLC正在执行配料流程,取消订单:{code}");
MessageNotify.GetInstance.ShowRunLog($"PLC正在执行配料流程,取消订单:{code}");
}
else
{
GVL_BigStation.Order_CancelStep = 42;
MessageNotify.GetInstance.ShowRunLog($"AGV未到达工站前,未给plc下发配方,取消订单:{code}");
MessageNotify.GetInstance.ShowRunLog($"AGV未到达工站前,未给plc下发配方,取消订单:{code}");
}
break;
case 42:
@@ -1195,7 +1197,7 @@ namespace BPASmartClient.JXJFoodBigStation.Model
GVL_BigStation.Order_CancelStep = 0;
GVL_BigStation.Order_Cancel = false;
GVL_BigStation.Order_CancelRecipeCode = "";
MessageNotify.GetInstance.ShowRunLog($"队列2,西门子取消订单完成,订单号:{code}");
MessageNotify.GetInstance.ShowRunLog($"队列2,西门子取消订单完成,订单号:{code}");
}
break;
case 51:
@@ -1205,12 +1207,12 @@ namespace BPASmartClient.JXJFoodBigStation.Model
MessageNotify.GetInstance.ShowRunLog($"海科PLC写入{HKDevice.HK_PLC_S7.Write("DB99.DBW232", (short)TrayCode)}");
GVL_BigStation.Recipe3DosingStatus = 0;
GVL_BigStation.Order_CancelStep = 52;
MessageNotify.GetInstance.ShowRunLog($"PLC正在执行配料流程,取消订单:{code}");
MessageNotify.GetInstance.ShowRunLog($"PLC正在执行配料流程,取消订单:{code}");
}
else
{
GVL_BigStation.Order_CancelStep = 52;
MessageNotify.GetInstance.ShowRunLog($"AGV未到达工站前,未给plc下发配方,取消订单:{code}");
MessageNotify.GetInstance.ShowRunLog($"AGV未到达工站前,未给plc下发配方,取消订单:{code}");
}
break;
case 52:
@@ -1229,7 +1231,7 @@ namespace BPASmartClient.JXJFoodBigStation.Model
GVL_BigStation.Order_CancelStep = 0;
GVL_BigStation.Order_Cancel = false;
GVL_BigStation.Order_CancelRecipeCode = "";
MessageNotify.GetInstance.ShowRunLog($"队列3,西门子取消订单完成,订单号:{code}");
MessageNotify.GetInstance.ShowRunLog($"队列3,西门子取消订单完成,订单号:{code}");
}
break;
case 61:
@@ -1239,12 +1241,12 @@ namespace BPASmartClient.JXJFoodBigStation.Model
MessageNotify.GetInstance.ShowRunLog($"海科PLC写入{HKDevice.HK_PLC_S7.Write("DB99.DBW232", (short)TrayCode)}");
GVL_BigStation.Recipe4DosingStatus = 0;
GVL_BigStation.Order_CancelStep = 62;
MessageNotify.GetInstance.ShowRunLog($"PLC正在执行配料流程,取消订单:{code}");
MessageNotify.GetInstance.ShowRunLog($"PLC正在执行配料流程,取消订单:{code}");
}
else
{
GVL_BigStation.Order_CancelStep = 62;
MessageNotify.GetInstance.ShowRunLog($"AGV未到达工站前,未给plc下发配方,取消订单:{code}");
MessageNotify.GetInstance.ShowRunLog($"AGV未到达工站前,未给plc下发配方,取消订单:{code}");
}
break;
case 62:
@@ -1263,7 +1265,7 @@ namespace BPASmartClient.JXJFoodBigStation.Model
GVL_BigStation.Order_CancelStep = 0;
GVL_BigStation.Order_Cancel = false;
GVL_BigStation.Order_CancelRecipeCode = "";
MessageNotify.GetInstance.ShowRunLog($"队列4,西门子取消订单完成,订单号:{code}");
MessageNotify.GetInstance.ShowRunLog($"队列4,西门子取消订单完成,订单号:{code}");
}
break;
default:


+ 2
- 1
BPASmartClient.JXJFoodBigStation/View/HardwareStatusView.xaml 查看文件

@@ -387,6 +387,7 @@
HorizontalAlignment="Left"
VerticalAlignment="Top"
Columns="7"
FlowDirection="RightToLeft"
Rows="1" />
</ItemsPanelTemplate>
</ListView.ItemsPanel>
@@ -394,7 +395,7 @@
<ListView.ItemTemplate>
<DataTemplate>
<Border Margin="5" Background="Transparent">
<Grid Height="220">
<Grid Height="220" FlowDirection="LeftToRight">
<Grid.RowDefinitions>
<RowDefinition />
<RowDefinition />


+ 4
- 4
BPASmartClient.JXJFoodSmallStation/Model/HK_PLC/HKDeviceStatus.cs 查看文件

@@ -286,10 +286,10 @@ namespace BPASmartClient.JXJFoodSmallStation.Model.HK_PLC
//HK_PLC_S7.Write<bool[]>(AddresBarrel1, barrel1);
//HK_PLC_S7.Write<bool[]>(AddresBarrel2, barrel2);
//HK_PLC_S7.Write<bool[]>(AddresBarrel3, barrel3);
MessageNotify.GetInstance.ShowRunLog($"配方下发,plc配方位置{recipeLoction},桶1料仓配料{barrel1_short},配料位置{barrel1_short.ToBinString()}");
MessageNotify.GetInstance.ShowRunLog($"配方下发,plc配方位置{recipeLoction},桶2料仓配料{barrel2_short},配料位置{barrel2_short.ToBinString()}");
MessageNotify.GetInstance.ShowRunLog($"配方下发,plc配方位置{recipeLoction},桶3料仓配料{barrel3_short},配料位置{barrel3_short.ToBinString()}");
MessageNotify.GetInstance.ShowRunLog($"配方下发,plc配方位置{recipeLoction},料仓配料{GVL_SmallStation.GetInstance.RecipeStockBinDosing[recipeLoction]},配料位置{GVL_SmallStation.GetInstance.RecipeStockBinDosing[recipeLoction].ToBinString()}");
MessageNotify.GetInstance.ShowRunLog($"小料仓配方下发,plc配方位置{recipeLoction},桶1料仓配料{barrel1_short},配料位置{barrel1_short.ToBinString()}");
MessageNotify.GetInstance.ShowRunLog($"小料仓配方下发,plc配方位置{recipeLoction},桶2料仓配料{barrel2_short},配料位置{barrel2_short.ToBinString()}");
MessageNotify.GetInstance.ShowRunLog($"小料仓配方下发,plc配方位置{recipeLoction},桶3料仓配料{barrel3_short},配料位置{barrel3_short.ToBinString()}");
MessageNotify.GetInstance.ShowRunLog($"小料仓配方下发,plc配方位置{recipeLoction},料仓配料{GVL_SmallStation.GetInstance.RecipeStockBinDosing[recipeLoction]},配料位置{GVL_SmallStation.GetInstance.RecipeStockBinDosing[recipeLoction].ToBinString()}");

}
}

+ 102
- 47
BPASmartClient.JXJFoodSmallStation/Model/ProcessControl.cs 查看文件

@@ -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


+ 1
- 1
BPASmartClient.JXJFoodSmallStation/Model/Siemens/SiemensDeviceStatus.cs 查看文件

@@ -65,9 +65,9 @@ namespace BPASmartClient.JXJFoodSmallStation.Model.Siemens
{
if (GVL_SmallStation.GetInstance.Order_Cancel == false)
{
GVL_SmallStation.GetInstance.Order_Cancel = true;
GVL_SmallStation.GetInstance.Order_CancelRecipeCode = st.RecipeCode;
GVL_SmallStation.GetInstance.OrderCancelStep = 0;
GVL_SmallStation.GetInstance.Order_Cancel = true;
MessageNotify.GetInstance.ShowRunLog($"西门子下发取消工单指令:{st.RecipeName}");
}
else


+ 3
- 1
BPASmartClient.JXJFoodSmallStation/Model/Siemens/XL_Start_DB.cs 查看文件

@@ -27,7 +27,9 @@ namespace BPASmartClient.JXJFoodSmallStation.Model.Siemens
/// 托盘编号
/// </summary>
public short TrayCode { get; set; }

/// <summary>
/// 粉料配料信息
/// </summary>
public UDT2Start[] Powder { get; set; } = new UDT2Start[10];
/// <summary>
/// 物料信息


+ 1
- 1
BPASmartClient.JXJFoodSmallStation/Model/WindSend/WindSendRawMaterial.cs 查看文件

@@ -26,7 +26,7 @@ namespace BPASmartClient.JXJFoodSmallStation.Model
public float RawMaterialWeight { get { return _mRawMaterialWeight; } set { _mRawMaterialWeight = value; OnPropertyChanged(); } }
private float _mRawMaterialWeight;
/// <summary>
/// 需要原料重量
/// 下发原料重量
/// </summary>
public float DosingCompleWeight { get { return _mDosingCompleWeight; } set { _mDosingCompleWeight = value; OnPropertyChanged(); } }
private float _mDosingCompleWeight;


+ 5
- 1
BPASmartClient.JXJFoodSmallStation/View/RecipeReceiveView.xaml 查看文件

@@ -112,7 +112,11 @@
IsEnabled="True"
Style="{StaticResource IcoButtonStyle}" />
</StackPanel>
<Button Content="筛选配方" Style="{StaticResource ButtonStyle}" Command="{Binding SelectRecipesCommand}" Grid.Row="1"/>
<Button
Grid.Row="1"
Command="{Binding SelectRecipesCommand}"
Content="筛选配方"
Style="{StaticResource ButtonStyle}" />
<ScrollViewer Grid.Row="2">
<ListView
Margin="5"


Loading…
取消
儲存