@@ -35,7 +35,12 @@ namespace BPASmartClient.JXJFoodBigStation.Model | |||
/// <summary> | |||
/// 配方下发状态 =0:配方未下发 ,1:配方下发给plc ,2:plc成功接收配方 | |||
/// </summary> | |||
public int RecipeDosingStatus { get; set; } | |||
public int Recipe1DosingStatus { get; set; } | |||
public int Recipe2DosingStatus { get; set; } | |||
public int Recipe3DosingStatus { get; set; } | |||
public int Recipe4DosingStatus { get; set; } | |||
public int Recipe5DosingStatus { get; set; } | |||
/// <summary> | |||
/// 是否处于手动下发配方 | |||
/// </summary> | |||
@@ -6,7 +6,41 @@ using System.Threading.Tasks; | |||
namespace BPASmartClient.JXJFoodBigStation.Model.HK_PLC | |||
{ | |||
internal class DB_Read | |||
public class DB_Read | |||
{ | |||
public bool HeartBeat { get; set; } | |||
public bool IsAllowIssueRecipe1 { get; set; } | |||
public bool IsAllowIssueRecipe2 { get; set; } | |||
public bool IsAllowIssueRecipe3 { get; set; } | |||
public bool IsAllowIssueRecipe4 { get; set; } | |||
public bool ReceiveFinishRecipe1 { get; set; } | |||
public bool ReceiveFinishRecipe2 { get; set; } | |||
public bool ReceiveFinishRecipe3 { get; set; } | |||
public bool ReceiveFinishRecipe4 { get; set; } | |||
public bool Recipe1DosingFinish { get; set; } | |||
public bool Recipe2DosingFinish { get; set; } | |||
public bool Recipe3DosingFinish { get; set; } | |||
public bool Recipe4DosingFinish { get; set; } | |||
public short Recipe1TrayCode { get; set; } | |||
public short Recipe2TrayCode { get; set; } | |||
public short Recipe3TrayCode { get; set; } | |||
public short Recipe4TrayCode { get; set; } | |||
public float StockBin1ActualWeight { get; set; } | |||
public float StockBin2ActualWeight { get; set; } | |||
public float StockBin3ActualWeight { get; set; } | |||
public float StockBin4ActualWeight { get; set; } | |||
public float StockBin5ActualWeight { get; set; } | |||
public float StockBin6ActualWeight { get; set; } | |||
public float StockBin7ActualWeight { get; set; } | |||
public float StockBin8ActualWeight { get; set; } | |||
public float StockBin9ActualWeight { get; set; } | |||
public float StockBin10ActualWeight { get; set; } | |||
public float StockBin11ActualWeight { get; set; } | |||
public float StockBin12ActualWeight { get; set; } | |||
public float StockBin13ActualWeight { get; set; } | |||
public float StockBin14ActualWeight { get; set; } | |||
} | |||
} |
@@ -59,88 +59,70 @@ namespace BPASmartClient.JXJFoodBigStation.Model.HK_PLC | |||
/// <summary> | |||
/// 配方编码 | |||
/// </summary> | |||
public bool RecipeCode { get; set; } | |||
public short RecipeCode { get; set; } | |||
/// <summary> | |||
/// 托盘编码 | |||
/// </summary> | |||
public bool TrayCode { get; set; } | |||
public bool Bareel1Bin1SetWeight { get; set; } | |||
public bool Bareel1Bin2SetWeight { get; set; } | |||
public bool Bareel1Bin3SetWeight { get; set; } | |||
public bool Bareel1Bin4SetWeight { get; set; } | |||
public bool Bareel1Bin5SetWeight { get; set; } | |||
public bool Bareel1Bin6SetWeight { get; set; } | |||
public bool Bareel1Bin7SetWeight { get; set; } | |||
public bool Bareel1Bin8SetWeight { get; set; } | |||
public bool Bareel1Bin9SetWeight { get; set; } | |||
public bool Bareel1Bin10SetWeight { get; set; } | |||
public bool Bareel1Bin11SetWeight { get; set; } | |||
public bool Bareel1Bin12SetWeight { get; set; } | |||
public bool Bareel1Bin13SetWeight { get; set; } | |||
public bool Bareel1Bin14SetWeight { get; set; } | |||
public short TrayCode { get; set; } | |||
public float Bareel1Bin1SetWeight { get; set; } | |||
public float Bareel1Bin2SetWeight { get; set; } | |||
public float Bareel1Bin3SetWeight { get; set; } | |||
public float Bareel1Bin4SetWeight { get; set; } | |||
public float Bareel1Bin5SetWeight { get; set; } | |||
public float Bareel1Bin6SetWeight { get; set; } | |||
public float Bareel1Bin7SetWeight { get; set; } | |||
public float Bareel1Bin8SetWeight { get; set; } | |||
public float Bareel1Bin9SetWeight { get; set; } | |||
public float Bareel1Bin10SetWeight { get; set; } | |||
public float Bareel1Bin11SetWeight { get; set; } | |||
public float Bareel1Bin12SetWeight { get; set; } | |||
public float Bareel1Bin13SetWeight { get; set; } | |||
public float Bareel1Bin14SetWeight { get; set; } | |||
public bool Bareel2Bin1SetWeight { get; set; } | |||
public bool Bareel2Bin2SetWeight { get; set; } | |||
public bool Bareel2Bin3SetWeight { get; set; } | |||
public bool Bareel2Bin4SetWeight { get; set; } | |||
public bool Bareel2Bin5SetWeight { get; set; } | |||
public bool Bareel2Bin6SetWeight { get; set; } | |||
public bool Bareel2Bin7SetWeight { get; set; } | |||
public bool Bareel2Bin8SetWeight { get; set; } | |||
public bool Bareel2Bin9SetWeight { get; set; } | |||
public bool Bareel2Bin10SetWeight { get; set; } | |||
public bool Bareel2Bin11SetWeight { get; set; } | |||
public bool Bareel2Bin12SetWeight { get; set; } | |||
public bool Bareel2Bin13SetWeight { get; set; } | |||
public bool Bareel2Bin14SetWeight { get; set; } | |||
public bool Bareel3Bin1SetWeight { get; set; } | |||
public bool Bareel3Bin2SetWeight { get; set; } | |||
public bool Bareel3Bin3SetWeight { get; set; } | |||
public bool Bareel3Bin4SetWeight { get; set; } | |||
public bool Bareel3Bin5SetWeight { get; set; } | |||
public bool Bareel3Bin6SetWeight { get; set; } | |||
public bool Bareel3Bin7SetWeight { get; set; } | |||
public bool Bareel3Bin8SetWeight { get; set; } | |||
public bool Bareel3Bin9SetWeight { get; set; } | |||
public bool Bareel3Bin10SetWeight { get; set; } | |||
public bool Bareel3Bin11SetWeight { get; set; } | |||
public bool Bareel3Bin12SetWeight { get; set; } | |||
public bool Bareel3Bin13SetWeight { get; set; } | |||
public bool Bareel3Bin14SetWeight { get; set; } | |||
public float Bareel2Bin1SetWeight { get; set; } | |||
public float Bareel2Bin2SetWeight { get; set; } | |||
public float Bareel2Bin3SetWeight { get; set; } | |||
public float Bareel2Bin4SetWeight { get; set; } | |||
public float Bareel2Bin5SetWeight { get; set; } | |||
public float Bareel2Bin6SetWeight { get; set; } | |||
public float Bareel2Bin7SetWeight { get; set; } | |||
public float Bareel2Bin8SetWeight { get; set; } | |||
public float Bareel2Bin9SetWeight { get; set; } | |||
public float Bareel2Bin10SetWeight { get; set; } | |||
public float Bareel2Bin11SetWeight { get; set; } | |||
public float Bareel2Bin12SetWeight { get; set; } | |||
public float Bareel2Bin13SetWeight { get; set; } | |||
public float Bareel2Bin14SetWeight { get; set; } | |||
public bool Bareel4Bin1SetWeight { get; set; } | |||
public bool Bareel4Bin2SetWeight { get; set; } | |||
public bool Bareel4Bin3SetWeight { get; set; } | |||
public bool Bareel4Bin4SetWeight { get; set; } | |||
public bool Bareel4Bin5SetWeight { get; set; } | |||
public bool Bareel4Bin6SetWeight { get; set; } | |||
public bool Bareel4Bin7SetWeight { get; set; } | |||
public bool Bareel4Bin8SetWeight { get; set; } | |||
public bool Bareel4Bin9SetWeight { get; set; } | |||
public bool Bareel4Bin10SetWeight { get; set; } | |||
public bool Bareel4Bin11SetWeight { get; set; } | |||
public bool Bareel4Bin12SetWeight { get; set; } | |||
public bool Bareel4Bin13SetWeight { get; set; } | |||
public bool Bareel4Bin14SetWeight { get; set; } | |||
public bool Bareel5Bin1SetWeight { get; set; } | |||
public bool Bareel5Bin2SetWeight { get; set; } | |||
public bool Bareel5Bin3SetWeight { get; set; } | |||
public bool Bareel5Bin4SetWeight { get; set; } | |||
public bool Bareel5Bin5SetWeight { get; set; } | |||
public bool Bareel5Bin6SetWeight { get; set; } | |||
public bool Bareel5Bin7SetWeight { get; set; } | |||
public bool Bareel5Bin8SetWeight { get; set; } | |||
public bool Bareel5Bin9SetWeight { get; set; } | |||
public bool Bareel5Bin10SetWeight { get; set; } | |||
public bool Bareel5Bin11SetWeight { get; set; } | |||
public bool Bareel5Bin12SetWeight { get; set; } | |||
public bool Bareel5Bin13SetWeight { get; set; } | |||
public bool Bareel5Bin14SetWeight { get; set; } | |||
public float Bareel4Bin1SetWeight { get; set; } | |||
public float Bareel4Bin2SetWeight { get; set; } | |||
public float Bareel4Bin3SetWeight { get; set; } | |||
public float Bareel4Bin4SetWeight { get; set; } | |||
public float Bareel4Bin5SetWeight { get; set; } | |||
public float Bareel4Bin6SetWeight { get; set; } | |||
public float Bareel4Bin7SetWeight { get; set; } | |||
public float Bareel4Bin8SetWeight { get; set; } | |||
public float Bareel4Bin9SetWeight { get; set; } | |||
public float Bareel4Bin10SetWeight { get; set; } | |||
public float Bareel4Bin11SetWeight { get; set; } | |||
public float Bareel4Bin12SetWeight { get; set; } | |||
public float Bareel4Bin13SetWeight { get; set; } | |||
public float Bareel4Bin14SetWeight { get; set; } | |||
public float Bareel5Bin1SetWeight { get; set; } | |||
public float Bareel5Bin2SetWeight { get; set; } | |||
public float Bareel5Bin3SetWeight { get; set; } | |||
public float Bareel5Bin4SetWeight { get; set; } | |||
public float Bareel5Bin5SetWeight { get; set; } | |||
public float Bareel5Bin6SetWeight { get; set; } | |||
public float Bareel5Bin7SetWeight { get; set; } | |||
public float Bareel5Bin8SetWeight { get; set; } | |||
public float Bareel5Bin9SetWeight { get; set; } | |||
public float Bareel5Bin10SetWeight { get; set; } | |||
public float Bareel5Bin11SetWeight { get; set; } | |||
public float Bareel5Bin12SetWeight { get; set; } | |||
public float Bareel5Bin13SetWeight { get; set; } | |||
public float Bareel5Bin14SetWeight { get; set; } | |||
} | |||
} |
@@ -7,6 +7,7 @@ using System.Text; | |||
using BPASmartClient.CustomResource.Pages.Model; | |||
using System.Threading.Tasks; | |||
using BPASmartClient.S7Net; | |||
using System.Threading; | |||
namespace BPASmartClient.JXJFoodBigStation.Model.HK_PLC | |||
{ | |||
@@ -14,16 +15,23 @@ namespace BPASmartClient.JXJFoodBigStation.Model.HK_PLC | |||
{ | |||
public SiemensHelper HK_PLC_S7 = new SiemensHelper(); | |||
public bool IsConnected => HK_PLC_S7.IsConnected; | |||
public DB_Write PlcWrite = new DB_Write(); | |||
public DB_Read PlcRead = new DB_Read(); | |||
public void Init() | |||
{ | |||
if (IsConnected) | |||
{ | |||
ThreadManage.GetInstance().StartLong(new Action(() => | |||
{ | |||
//var res1 = HK_PLC_S7.ReadClass<DB_Write>(99); | |||
//var res1 = HK_PLC_S7.Read<String>("DB46.DBX10.0"); | |||
var res = HK_PLC_S7.ReadClass<Test1>(46); | |||
int a = 1; | |||
HK_PLC_S7.WriteClass<DB_Write>(PlcWrite, 99); | |||
var res1 = HK_PLC_S7.ReadClass<DB_Read>(98); | |||
var res2 = HK_PLC_S7.ReadClass<Test1>(97); | |||
if (res1 != null && res1 is DB_Read data1) | |||
{ | |||
PlcRead = data1; | |||
} | |||
Thread.Sleep(10); | |||
}),"信号收发处理"); | |||
} | |||
} | |||
@@ -36,46 +44,433 @@ namespace BPASmartClient.JXJFoodBigStation.Model.HK_PLC | |||
{ | |||
if (recipe != null) | |||
{ | |||
string recipecode = "MW4040"; | |||
string recipeTrayCode = "MW4042"; | |||
short recipecode1 = Convert.ToInt16(recipe.RecipeCode); | |||
HK_PLC_S7.Write<short>(recipecode, recipecode1); | |||
HK_PLC_S7.Write<short>(recipeTrayCode, (short)recipe.TrayCode); | |||
PlcWrite.RecipeCode = Convert.ToInt16(recipe.RecipeCode); | |||
PlcWrite.TrayCode = Convert.ToInt16(recipe.TrayCode); | |||
for (int barrel = 1; barrel < 6; barrel++) | |||
{ | |||
if (barrel != 3) | |||
{ | |||
for (int loc = 1; loc < 13; loc++) | |||
for (int loc = 1; loc < 15; loc++) | |||
{ | |||
int index = Array.FindIndex(recipe.RawMaterial.ToArray(), p => p.RawMaterialBarrelNum == barrel && p.RawMaterialLocation == loc); | |||
if (barrel >= 3)//PLC没有3号桶的重量位置,故4,5号桶地址向前偏移48个位置 | |||
if (index == -1) | |||
{ | |||
if (index != -1) | |||
{ | |||
string address = "MD" + (4120 + (loc - 1) * 4 + (barrel - 1 - 1) * 48); | |||
HK_PLC_S7.Write<float>(address, recipe.RawMaterial.ElementAt(index).RawMaterialWeight); | |||
MessageLog.GetInstance.ShowRunLog($"配方数据下发完成,地址:{address},重量:{recipe.RawMaterial.ElementAt(index).RawMaterialWeight}"); | |||
} | |||
else//不存在的原料信息,重量写0 | |||
switch (barrel) | |||
{ | |||
string address = "MD" + (4120 + (loc - 1) * 4 + (barrel - 1 - 1) * 48); | |||
HK_PLC_S7.Write<float>(address, 0); | |||
case 1: | |||
switch (loc) | |||
{ | |||
case 1: | |||
PlcWrite.Bareel1Bin1SetWeight = 0; | |||
break; | |||
case 2: | |||
PlcWrite.Bareel1Bin2SetWeight = 0; | |||
break; | |||
case 3: | |||
PlcWrite.Bareel1Bin3SetWeight = 0; | |||
break; | |||
case 4: | |||
PlcWrite.Bareel1Bin4SetWeight = 0; | |||
break; | |||
case 5: | |||
PlcWrite.Bareel1Bin5SetWeight = 0; | |||
break; | |||
case 6: | |||
PlcWrite.Bareel1Bin6SetWeight = 0; | |||
break; | |||
case 7: | |||
PlcWrite.Bareel1Bin7SetWeight = 0; | |||
break; | |||
case 8: | |||
PlcWrite.Bareel1Bin8SetWeight = 0; | |||
break; | |||
case 9: | |||
PlcWrite.Bareel1Bin9SetWeight = 0; | |||
break; | |||
case 10: | |||
PlcWrite.Bareel1Bin10SetWeight = 0; | |||
break; | |||
case 11: | |||
PlcWrite.Bareel1Bin11SetWeight = 0; | |||
break; | |||
case 12: | |||
PlcWrite.Bareel1Bin12SetWeight = 0; | |||
break; | |||
case 13: | |||
PlcWrite.Bareel1Bin13SetWeight = 0; | |||
break; | |||
case 14: | |||
PlcWrite.Bareel1Bin14SetWeight = 0; | |||
break; | |||
default: | |||
break; | |||
} | |||
break; | |||
case 2: | |||
switch (loc) | |||
{ | |||
case 1: | |||
PlcWrite.Bareel2Bin1SetWeight = 0; | |||
break; | |||
case 2: | |||
PlcWrite.Bareel2Bin2SetWeight = 0; | |||
break; | |||
case 3: | |||
PlcWrite.Bareel2Bin3SetWeight = 0; | |||
break; | |||
case 4: | |||
PlcWrite.Bareel2Bin4SetWeight = 0; | |||
break; | |||
case 5: | |||
PlcWrite.Bareel2Bin5SetWeight = 0; | |||
break; | |||
case 6: | |||
PlcWrite.Bareel2Bin6SetWeight = 0; | |||
break; | |||
case 7: | |||
PlcWrite.Bareel2Bin7SetWeight = 0; | |||
break; | |||
case 8: | |||
PlcWrite.Bareel2Bin8SetWeight = 0; | |||
break; | |||
case 9: | |||
PlcWrite.Bareel2Bin9SetWeight = 0; | |||
break; | |||
case 10: | |||
PlcWrite.Bareel2Bin10SetWeight = 0; | |||
break; | |||
case 11: | |||
PlcWrite.Bareel2Bin11SetWeight = 0; | |||
break; | |||
case 12: | |||
PlcWrite.Bareel2Bin12SetWeight = 0; | |||
break; | |||
case 13: | |||
PlcWrite.Bareel2Bin13SetWeight = 0; | |||
break; | |||
case 14: | |||
PlcWrite.Bareel2Bin14SetWeight = 0; | |||
break; | |||
default: | |||
break; | |||
} | |||
break; | |||
case 4: | |||
switch (loc) | |||
{ | |||
case 1: | |||
PlcWrite.Bareel4Bin1SetWeight = 0; | |||
break; | |||
case 2: | |||
PlcWrite.Bareel4Bin2SetWeight = 0; | |||
break; | |||
case 3: | |||
PlcWrite.Bareel4Bin3SetWeight = 0; | |||
break; | |||
case 4: | |||
PlcWrite.Bareel4Bin4SetWeight = 0; | |||
break; | |||
case 5: | |||
PlcWrite.Bareel4Bin5SetWeight = 0; | |||
break; | |||
case 6: | |||
PlcWrite.Bareel4Bin6SetWeight = 0; | |||
break; | |||
case 7: | |||
PlcWrite.Bareel4Bin7SetWeight = 0; | |||
break; | |||
case 8: | |||
PlcWrite.Bareel4Bin8SetWeight = 0; | |||
break; | |||
case 9: | |||
PlcWrite.Bareel4Bin9SetWeight = 0; | |||
break; | |||
case 10: | |||
PlcWrite.Bareel4Bin10SetWeight = 0; | |||
break; | |||
case 11: | |||
PlcWrite.Bareel4Bin11SetWeight = 0; | |||
break; | |||
case 12: | |||
PlcWrite.Bareel4Bin12SetWeight = 0; | |||
break; | |||
case 13: | |||
PlcWrite.Bareel4Bin13SetWeight = 0; | |||
break; | |||
case 14: | |||
PlcWrite.Bareel4Bin14SetWeight = 0; | |||
break; | |||
default: | |||
break; | |||
} | |||
break; | |||
case 5: | |||
switch (loc) | |||
{ | |||
case 1: | |||
PlcWrite.Bareel5Bin1SetWeight = 0; | |||
break; | |||
case 2: | |||
PlcWrite.Bareel5Bin2SetWeight = 0; | |||
break; | |||
case 3: | |||
PlcWrite.Bareel5Bin3SetWeight = 0; | |||
break; | |||
case 4: | |||
PlcWrite.Bareel5Bin4SetWeight = 0; | |||
break; | |||
case 5: | |||
PlcWrite.Bareel5Bin5SetWeight = 0; | |||
break; | |||
case 6: | |||
PlcWrite.Bareel5Bin6SetWeight = 0; | |||
break; | |||
case 7: | |||
PlcWrite.Bareel5Bin7SetWeight = 0; | |||
break; | |||
case 8: | |||
PlcWrite.Bareel5Bin8SetWeight = 0; | |||
break; | |||
case 9: | |||
PlcWrite.Bareel5Bin9SetWeight = 0; | |||
break; | |||
case 10: | |||
PlcWrite.Bareel5Bin10SetWeight = 0; | |||
break; | |||
case 11: | |||
PlcWrite.Bareel5Bin11SetWeight = 0; | |||
break; | |||
case 12: | |||
PlcWrite.Bareel5Bin12SetWeight = 0; | |||
break; | |||
case 13: | |||
PlcWrite.Bareel5Bin13SetWeight = 0; | |||
break; | |||
case 14: | |||
PlcWrite.Bareel5Bin14SetWeight = 0; | |||
break; | |||
default: | |||
break; | |||
} | |||
break; | |||
default: | |||
break; | |||
} | |||
} | |||
else | |||
{ | |||
if (index != -1) | |||
{ | |||
string address = "MD" + (4120 + (loc - 1) * 4 + (barrel - 1) * 48); | |||
HK_PLC_S7.Write<float>(address, recipe.RawMaterial.ElementAt(index).RawMaterialWeight); | |||
MessageLog.GetInstance.ShowRunLog($"配方数据下发完成,地址:{address},重量:{recipe.RawMaterial.ElementAt(index).RawMaterialWeight}"); | |||
} | |||
else//不存在的原料信息,重量写0 | |||
MessageLog.GetInstance.ShowRunLog($"桶号:{barrel},位置:{loc},重量:{recipe.RawMaterial.ElementAt(index).RawMaterialWeight}"); | |||
switch (barrel) | |||
{ | |||
string address = "MD" + (4120 + (loc - 1) * 4 + (barrel - 1) * 48); | |||
HK_PLC_S7.Write<float>(address, 0); | |||
case 1: | |||
switch (loc) | |||
{ | |||
case 1: | |||
PlcWrite.Bareel1Bin1SetWeight = recipe.RawMaterial.ElementAt(index).RawMaterialWeight; | |||
break; | |||
case 2: | |||
PlcWrite.Bareel1Bin2SetWeight = recipe.RawMaterial.ElementAt(index).RawMaterialWeight; | |||
break; | |||
case 3: | |||
PlcWrite.Bareel1Bin3SetWeight = recipe.RawMaterial.ElementAt(index).RawMaterialWeight; | |||
break; | |||
case 4: | |||
PlcWrite.Bareel1Bin4SetWeight = recipe.RawMaterial.ElementAt(index).RawMaterialWeight; | |||
break; | |||
case 5: | |||
PlcWrite.Bareel1Bin5SetWeight = recipe.RawMaterial.ElementAt(index).RawMaterialWeight; | |||
break; | |||
case 6: | |||
PlcWrite.Bareel1Bin6SetWeight = recipe.RawMaterial.ElementAt(index).RawMaterialWeight; | |||
break; | |||
case 7: | |||
PlcWrite.Bareel1Bin7SetWeight = recipe.RawMaterial.ElementAt(index).RawMaterialWeight; | |||
break; | |||
case 8: | |||
PlcWrite.Bareel1Bin8SetWeight = recipe.RawMaterial.ElementAt(index).RawMaterialWeight; | |||
break; | |||
case 9: | |||
PlcWrite.Bareel1Bin9SetWeight = recipe.RawMaterial.ElementAt(index).RawMaterialWeight; | |||
break; | |||
case 10: | |||
PlcWrite.Bareel1Bin10SetWeight = recipe.RawMaterial.ElementAt(index).RawMaterialWeight; | |||
break; | |||
case 11: | |||
PlcWrite.Bareel1Bin11SetWeight = recipe.RawMaterial.ElementAt(index).RawMaterialWeight; | |||
break; | |||
case 12: | |||
PlcWrite.Bareel1Bin12SetWeight = recipe.RawMaterial.ElementAt(index).RawMaterialWeight; | |||
break; | |||
case 13: | |||
PlcWrite.Bareel1Bin13SetWeight = recipe.RawMaterial.ElementAt(index).RawMaterialWeight; | |||
break; | |||
case 14: | |||
PlcWrite.Bareel1Bin14SetWeight = recipe.RawMaterial.ElementAt(index).RawMaterialWeight; | |||
break; | |||
default: | |||
break; | |||
} | |||
break; | |||
case 2: | |||
switch (loc) | |||
{ | |||
case 1: | |||
PlcWrite.Bareel2Bin1SetWeight = recipe.RawMaterial.ElementAt(index).RawMaterialWeight; | |||
break; | |||
case 2: | |||
PlcWrite.Bareel2Bin2SetWeight = recipe.RawMaterial.ElementAt(index).RawMaterialWeight; | |||
break; | |||
case 3: | |||
PlcWrite.Bareel2Bin3SetWeight = recipe.RawMaterial.ElementAt(index).RawMaterialWeight; | |||
break; | |||
case 4: | |||
PlcWrite.Bareel2Bin4SetWeight = recipe.RawMaterial.ElementAt(index).RawMaterialWeight; | |||
break; | |||
case 5: | |||
PlcWrite.Bareel2Bin5SetWeight = recipe.RawMaterial.ElementAt(index).RawMaterialWeight; | |||
break; | |||
case 6: | |||
PlcWrite.Bareel2Bin6SetWeight = recipe.RawMaterial.ElementAt(index).RawMaterialWeight; | |||
break; | |||
case 7: | |||
PlcWrite.Bareel2Bin7SetWeight = recipe.RawMaterial.ElementAt(index).RawMaterialWeight; | |||
break; | |||
case 8: | |||
PlcWrite.Bareel2Bin8SetWeight = recipe.RawMaterial.ElementAt(index).RawMaterialWeight; | |||
break; | |||
case 9: | |||
PlcWrite.Bareel2Bin9SetWeight = recipe.RawMaterial.ElementAt(index).RawMaterialWeight; | |||
break; | |||
case 10: | |||
PlcWrite.Bareel2Bin10SetWeight = recipe.RawMaterial.ElementAt(index).RawMaterialWeight; | |||
break; | |||
case 11: | |||
PlcWrite.Bareel2Bin11SetWeight = recipe.RawMaterial.ElementAt(index).RawMaterialWeight; | |||
break; | |||
case 12: | |||
PlcWrite.Bareel2Bin12SetWeight = recipe.RawMaterial.ElementAt(index).RawMaterialWeight; | |||
break; | |||
case 13: | |||
PlcWrite.Bareel2Bin13SetWeight = recipe.RawMaterial.ElementAt(index).RawMaterialWeight; | |||
break; | |||
case 14: | |||
PlcWrite.Bareel2Bin14SetWeight = recipe.RawMaterial.ElementAt(index).RawMaterialWeight; | |||
break; | |||
default: | |||
break; | |||
} | |||
break; | |||
case 4: | |||
switch (loc) | |||
{ | |||
case 1: | |||
PlcWrite.Bareel4Bin1SetWeight = recipe.RawMaterial.ElementAt(index).RawMaterialWeight; | |||
break; | |||
case 2: | |||
PlcWrite.Bareel4Bin2SetWeight = recipe.RawMaterial.ElementAt(index).RawMaterialWeight; | |||
break; | |||
case 3: | |||
PlcWrite.Bareel4Bin3SetWeight = recipe.RawMaterial.ElementAt(index).RawMaterialWeight; | |||
break; | |||
case 4: | |||
PlcWrite.Bareel4Bin4SetWeight = recipe.RawMaterial.ElementAt(index).RawMaterialWeight; | |||
break; | |||
case 5: | |||
PlcWrite.Bareel4Bin5SetWeight = recipe.RawMaterial.ElementAt(index).RawMaterialWeight; | |||
break; | |||
case 6: | |||
PlcWrite.Bareel4Bin6SetWeight = recipe.RawMaterial.ElementAt(index).RawMaterialWeight; | |||
break; | |||
case 7: | |||
PlcWrite.Bareel4Bin7SetWeight = recipe.RawMaterial.ElementAt(index).RawMaterialWeight; | |||
break; | |||
case 8: | |||
PlcWrite.Bareel4Bin8SetWeight = recipe.RawMaterial.ElementAt(index).RawMaterialWeight; | |||
break; | |||
case 9: | |||
PlcWrite.Bareel4Bin9SetWeight = recipe.RawMaterial.ElementAt(index).RawMaterialWeight; | |||
break; | |||
case 10: | |||
PlcWrite.Bareel4Bin10SetWeight = recipe.RawMaterial.ElementAt(index).RawMaterialWeight; | |||
break; | |||
case 11: | |||
PlcWrite.Bareel4Bin11SetWeight = recipe.RawMaterial.ElementAt(index).RawMaterialWeight; | |||
break; | |||
case 12: | |||
PlcWrite.Bareel4Bin12SetWeight = recipe.RawMaterial.ElementAt(index).RawMaterialWeight; | |||
break; | |||
case 13: | |||
PlcWrite.Bareel4Bin13SetWeight = recipe.RawMaterial.ElementAt(index).RawMaterialWeight; | |||
break; | |||
case 14: | |||
PlcWrite.Bareel4Bin14SetWeight = recipe.RawMaterial.ElementAt(index).RawMaterialWeight; | |||
break; | |||
default: | |||
break; | |||
} | |||
break; | |||
case 5: | |||
switch (loc) | |||
{ | |||
case 1: | |||
PlcWrite.Bareel5Bin1SetWeight = recipe.RawMaterial.ElementAt(index).RawMaterialWeight; | |||
break; | |||
case 2: | |||
PlcWrite.Bareel5Bin2SetWeight = recipe.RawMaterial.ElementAt(index).RawMaterialWeight; | |||
break; | |||
case 3: | |||
PlcWrite.Bareel5Bin3SetWeight = recipe.RawMaterial.ElementAt(index).RawMaterialWeight; | |||
break; | |||
case 4: | |||
PlcWrite.Bareel5Bin4SetWeight = recipe.RawMaterial.ElementAt(index).RawMaterialWeight; | |||
break; | |||
case 5: | |||
PlcWrite.Bareel5Bin5SetWeight = recipe.RawMaterial.ElementAt(index).RawMaterialWeight; | |||
break; | |||
case 6: | |||
PlcWrite.Bareel5Bin6SetWeight = recipe.RawMaterial.ElementAt(index).RawMaterialWeight; | |||
break; | |||
case 7: | |||
PlcWrite.Bareel5Bin7SetWeight = recipe.RawMaterial.ElementAt(index).RawMaterialWeight; | |||
break; | |||
case 8: | |||
PlcWrite.Bareel5Bin8SetWeight = recipe.RawMaterial.ElementAt(index).RawMaterialWeight; | |||
break; | |||
case 9: | |||
PlcWrite.Bareel5Bin9SetWeight = recipe.RawMaterial.ElementAt(index).RawMaterialWeight; | |||
break; | |||
case 10: | |||
PlcWrite.Bareel5Bin10SetWeight = recipe.RawMaterial.ElementAt(index).RawMaterialWeight; | |||
break; | |||
case 11: | |||
PlcWrite.Bareel5Bin11SetWeight = recipe.RawMaterial.ElementAt(index).RawMaterialWeight; | |||
break; | |||
case 12: | |||
PlcWrite.Bareel5Bin12SetWeight = recipe.RawMaterial.ElementAt(index).RawMaterialWeight; | |||
break; | |||
case 13: | |||
PlcWrite.Bareel5Bin13SetWeight = recipe.RawMaterial.ElementAt(index).RawMaterialWeight; | |||
break; | |||
case 14: | |||
PlcWrite.Bareel5Bin14SetWeight = recipe.RawMaterial.ElementAt(index).RawMaterialWeight; | |||
break; | |||
default: | |||
break; | |||
} | |||
break; | |||
default: | |||
break; | |||
} | |||
} | |||
} | |||
} | |||
} | |||
} | |||
@@ -1,4 +1,5 @@ | |||
using System; | |||
using BPASmartClient.S7Net; | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Text; | |||
@@ -8,23 +9,33 @@ namespace BPASmartClient.JXJFoodBigStation.Model.HK_PLC | |||
{ | |||
internal class Test1 | |||
{ | |||
public string[] name1 { get; set; } = new string[8]; | |||
public string[] name2 { get; set; }=new string[8]; | |||
/*public string name3 { get; set; } | |||
public string name4 { get; set; } | |||
public string name5 { get; set; } | |||
public string name6 { get; set; } | |||
public string name7 { get; set; } | |||
public string name8 { get; set; } | |||
public string name9 { get; set; } | |||
public string name10 { get; set; } | |||
public string name11 { get; set; } | |||
public string name12 { get; set; } | |||
public string name13 { get; set; } | |||
public string name14 { get; set; } | |||
public string name15 { get; set; } | |||
public string name16 { get; set; } | |||
public string name17 { get; set; } | |||
public string name18 { get; set; }*/ | |||
[Siemens(6)] | |||
public string RawMaterialName1 { get; set; } | |||
[Siemens(6)] | |||
public string RawMaterialName2 { get; set; } | |||
[Siemens(6)] | |||
public string RawMaterialName3 { get; set; } | |||
[Siemens(6)] | |||
public string RawMaterialName4 { get; set; } | |||
[Siemens(6)] | |||
public string RawMaterialName5 { get; set; } | |||
[Siemens(6)] | |||
public string RawMaterialName6 { get; set; } | |||
[Siemens(6)] | |||
public string RawMaterialName7 { get; set; } | |||
[Siemens(6)] | |||
public string RawMaterialName8 { get; set; } | |||
[Siemens(6)] | |||
public string RawMaterialName9 { get; set; } | |||
[Siemens(6)] | |||
public string RawMaterialName10 { get; set; } | |||
[Siemens(6)] | |||
public string RawMaterialName11 { get; set; } | |||
[Siemens(6)] | |||
public string RawMaterialName12 { get; set; } | |||
[Siemens(6)] | |||
public string RawMaterialName13 { get; set; } | |||
[Siemens(6)] | |||
public string RawMaterialName14 { get; set; } | |||
} | |||
} |
@@ -25,6 +25,7 @@ namespace BPASmartClient.JXJFoodBigStation.Model | |||
public SiemensDeviceStatus SiemensDevice = new SiemensDeviceStatus(); | |||
public HKDeviceStatus HKDevice = new HKDeviceStatus(); | |||
GVL_BigStation BigStation = new GVL_BigStation(); | |||
DL_Finish_DB FinishData = new DL_Finish_DB(); | |||
/// <summary> | |||
/// 配方数据 | |||
@@ -41,7 +42,11 @@ namespace BPASmartClient.JXJFoodBigStation.Model | |||
/// <summary> | |||
/// 配方队列 | |||
/// </summary> | |||
public ConcurrentQueue<string> RecipeQueue = new ConcurrentQueue<string>(); | |||
public ConcurrentQueue<string> RecipeQueue1 = new ConcurrentQueue<string>(); | |||
public ConcurrentQueue<string> RecipeQueue2 = new ConcurrentQueue<string>(); | |||
public ConcurrentQueue<string> RecipeQueue3 = new ConcurrentQueue<string>(); | |||
public ConcurrentQueue<string> RecipeQueue4 = new ConcurrentQueue<string>(); | |||
public ConcurrentQueue<string> RecipeQueue5 = new ConcurrentQueue<string>(); | |||
/// <summary> | |||
/// AGV到达工站队列 | |||
/// </summary> | |||
@@ -126,13 +131,17 @@ namespace BPASmartClient.JXJFoodBigStation.Model | |||
if (o !=null && o is RecipeData a) | |||
{ | |||
Json<LocalRecipeDataColl>.Data.Recipes.Add(a); | |||
foreach (var item in Json<LocalRecipeDataColl>.Data.Recipes.ElementAt(0).RawMaterial) | |||
for (int i = 0; i < Json<LocalRecipeDataColl>.Data.Recipes.Count; i++) | |||
{ | |||
item.RawMaterialLocation = Convert.ToInt32(item.RawMaterialName); | |||
foreach (var item in Json<LocalRecipeDataColl>.Data.Recipes.ElementAt(i).RawMaterial) | |||
{ | |||
item.RawMaterialLocation = Convert.ToInt32(item.RawMaterialName); | |||
} | |||
} | |||
} | |||
}), "ManualSendRecipe", true); | |||
RecipeQueue.Clear(); | |||
RecipeQueue1.Clear(); | |||
//Json<RemoteRecipeDataColl>.Data.Recipes = TestData.GetInstance.Recipes;//添加测试数据 | |||
@@ -274,58 +283,518 @@ namespace BPASmartClient.JXJFoodBigStation.Model | |||
{ | |||
foreach (var data in RemoteRecipes) | |||
{ | |||
if (!(RecipeQueue.Contains(data.RecipeCode))) | |||
RecipeQueue.Enqueue(data.RecipeCode); | |||
if (data.TrayCode == 1) | |||
{ | |||
if (!(RecipeQueue1.Contains(data.RecipeCode))) | |||
RecipeQueue1.Enqueue(data.RecipeCode); | |||
} | |||
else if (data.TrayCode == 2) | |||
{ | |||
if (!(RecipeQueue2.Contains(data.RecipeCode))) | |||
RecipeQueue2.Enqueue(data.RecipeCode); | |||
} | |||
else if (data.TrayCode == 3) | |||
{ | |||
if (!(RecipeQueue3.Contains(data.RecipeCode))) | |||
RecipeQueue3.Enqueue(data.RecipeCode); | |||
} | |||
else if (data.TrayCode == 4) | |||
{ | |||
if (!(RecipeQueue4.Contains(data.RecipeCode))) | |||
RecipeQueue4.Enqueue(data.RecipeCode); | |||
} | |||
else if (data.TrayCode == 5) | |||
{ | |||
if (!(RecipeQueue5.Contains(data.RecipeCode))) | |||
RecipeQueue5.Enqueue(data.RecipeCode); | |||
} | |||
} | |||
} | |||
else | |||
{ | |||
RecipeQueue.Clear(); | |||
BigStation.RecipeDosingStatus = 0; | |||
RecipeQueue1.Clear(); | |||
RecipeQueue2.Clear(); | |||
RecipeQueue3.Clear(); | |||
RecipeQueue4.Clear(); | |||
RecipeQueue5.Clear(); | |||
BigStation.Recipe1DosingStatus = 0; | |||
} | |||
} | |||
private void RecipeInfoToHKPLC() | |||
{ | |||
if (RecipeQueue.Count > 0) | |||
if (RecipeQueue1.Count > 0) | |||
{ | |||
int index = Array.FindIndex(RemoteRecipes.ToArray(), p => p.RecipeCode == RecipeQueue.ElementAt(0)); | |||
int index = Array.FindIndex(RemoteRecipes.ToArray(), p => p.RecipeCode == RecipeQueue1.ElementAt(0)); | |||
if (index >= 0 && index < RemoteRecipes.Count) | |||
{ | |||
string code = RemoteRecipes.ElementAt(index).RecipeCode; | |||
int trayCode = RemoteRecipes.ElementAt(index).TrayCode; | |||
if (RTrig.GetInstance("M5001.0").Start(HKDevice.HK_PLC_S7.Read<bool>("M5001.0")) && BigStation.RecipeDosingStatus == 0)//配方1是否允许下发配发 | |||
if (HKDevice.PlcRead.IsAllowIssueRecipe1 && BigStation.Recipe1DosingStatus == 0)//配方1是否允许下发配发 | |||
{ | |||
HKDevice.StockBinPar(RemoteRecipes.ElementAt(index)); | |||
HKDevice.HK_PLC_S7.Write<bool>("M4001.0", true);//配发下发完成,to plc | |||
HKDevice.HK_PLC_S7.Write<bool>("M5001.0", false);//复位允许下发配方1信号 | |||
BigStation.RecipeDosingStatus = 1; | |||
HKDevice.PlcWrite.Recipe1IssuedFinish = true; | |||
//HKDevice.HK_PLC_S7.Write<bool>("DB98.DBX0.1", false);//复位允许下发配方1信号 | |||
BigStation.Recipe1DosingStatus = 1; | |||
MessageLog.GetInstance.ShowRunLog($"配方状态:{code}下发完成"); | |||
} | |||
if (HKDevice.HK_PLC_S7.Read<bool>("M5001.4") && BigStation.RecipeDosingStatus == 1) | |||
if (HKDevice.PlcRead.ReceiveFinishRecipe1 && BigStation.Recipe1DosingStatus == 1) | |||
{ | |||
BigStation.RecipeDosingStatus = 2; | |||
HKDevice.HK_PLC_S7.Write<bool>("M5001.4", false);// | |||
BigStation.Recipe1DosingStatus = 2; | |||
HKDevice.PlcWrite.Recipe1IssuedFinish = false; | |||
HKDevice.PlcWrite.RecipeCode = 0; | |||
HKDevice.PlcWrite.TrayCode = 0; | |||
WeightReset(); | |||
MessageLog.GetInstance.ShowRunLog($"配方状态:{code}配方配料"); | |||
} | |||
if (BigStation.RecipeDosingStatus == 2) | |||
if (BigStation.Recipe1DosingStatus == 2 && HKDevice.PlcRead.Recipe1DosingFinish) | |||
{ | |||
if (RTrig.GetInstance("StockState").Start(HKDevice.HK_PLC_S7.Read<bool>("M5007.0"))) | |||
BigStation.Recipe1DosingStatus = 3; | |||
MessageLog.GetInstance.ShowRunLog($"配方状态:{code}配料完成"); | |||
if (HKDevice.PlcRead.Recipe1TrayCode == 1) | |||
{ | |||
BigStation.RecipeDosingStatus = 3; | |||
MessageLog.GetInstance.ShowRunLog($"配方状态:{code}配料完成"); | |||
HKDevice.HK_PLC_S7.Write<bool>("M5007.0",false); | |||
RecipeQueue.TryDequeue(out code); | |||
IssuedComplete.Add(RemoteRecipes.ElementAt(index));//将该配方添加到下 | |||
if (!BigStation.IsAllowManual) | |||
foreach (var item in RemoteRecipes.ElementAt(index).RawMaterial) | |||
{ | |||
Json<RemoteRecipe>.Data.Recipes.RemoveAt(index);//制作完成,移除当前配方 | |||
if (item.RawMaterialLocation == 1) | |||
{ | |||
item.Laying_Off_Weight = HKDevice.PlcRead.StockBin1ActualWeight; | |||
} | |||
else if (item.RawMaterialLocation == 2) | |||
{ | |||
item.Laying_Off_Weight = HKDevice.PlcRead.StockBin2ActualWeight; | |||
} | |||
else if (item.RawMaterialLocation == 3) | |||
{ | |||
item.Laying_Off_Weight = HKDevice.PlcRead.StockBin3ActualWeight; | |||
} | |||
else if (item.RawMaterialLocation == 4) | |||
{ | |||
item.Laying_Off_Weight = HKDevice.PlcRead.StockBin4ActualWeight; | |||
} | |||
else if (item.RawMaterialLocation == 5) | |||
{ | |||
item.Laying_Off_Weight = HKDevice.PlcRead.StockBin5ActualWeight; | |||
} | |||
else if (item.RawMaterialLocation == 6) | |||
{ | |||
item.Laying_Off_Weight = HKDevice.PlcRead.StockBin6ActualWeight; | |||
} | |||
else if (item.RawMaterialLocation == 7) | |||
{ | |||
item.Laying_Off_Weight = HKDevice.PlcRead.StockBin7ActualWeight; | |||
} | |||
else if (item.RawMaterialLocation == 8) | |||
{ | |||
item.Laying_Off_Weight = HKDevice.PlcRead.StockBin8ActualWeight; | |||
} | |||
else if (item.RawMaterialLocation == 9) | |||
{ | |||
item.Laying_Off_Weight = HKDevice.PlcRead.StockBin9ActualWeight; | |||
} | |||
else if (item.RawMaterialLocation == 10) | |||
{ | |||
item.Laying_Off_Weight = HKDevice.PlcRead.StockBin10ActualWeight; | |||
} | |||
else if (item.RawMaterialLocation == 11) | |||
{ | |||
item.Laying_Off_Weight = HKDevice.PlcRead.StockBin11ActualWeight; | |||
} | |||
else if (item.RawMaterialLocation == 12) | |||
{ | |||
item.Laying_Off_Weight = HKDevice.PlcRead.StockBin12ActualWeight; | |||
} | |||
else if (item.RawMaterialLocation == 13) | |||
{ | |||
item.Laying_Off_Weight = HKDevice.PlcRead.StockBin13ActualWeight; | |||
} | |||
else if (item.RawMaterialLocation == 14) | |||
{ | |||
item.Laying_Off_Weight = HKDevice.PlcRead.StockBin14ActualWeight; | |||
} | |||
} | |||
else | |||
FinishData.Order_No = RemoteRecipes.ElementAt(index).RecipeCode; | |||
FinishData.Product_Code = RemoteRecipes.ElementAt(index).RecipeName; | |||
for (int i = 0; i < RemoteRecipes.ElementAt(index).RawMaterial.Count; i++) | |||
{ | |||
FinishData.Material[i] = new UDT1(); | |||
FinishData.Material[i].Material_Name = RemoteRecipes.ElementAt(index).RawMaterial.ElementAt(i).RawMaterialName; | |||
FinishData.Material[i].Material_BarrelNum = (short)RemoteRecipes.ElementAt(index).RawMaterial.ElementAt(i).RawMaterialBarrelNum; | |||
FinishData.Material[i].Material_Laying_Off_Weight = RemoteRecipes.ElementAt(index).RawMaterial.ElementAt(i).Laying_Off_Weight; | |||
} | |||
} | |||
if (SiemensDevice.IsConnected) | |||
{ | |||
SiemensDevice.Siemens_PLC_S7.WriteClass<DL_Finish_DB>(FinishData, 3); | |||
} | |||
//HKDevice.HK_PLC_S7.Write<bool>("DB98.DBX1.1",false); | |||
RecipeQueue1.TryDequeue(out code); | |||
IssuedComplete.Add(RemoteRecipes.ElementAt(index));//将该配方添加到下 | |||
if (!BigStation.IsAllowManual) | |||
{ | |||
Json<RemoteRecipe>.Data.Recipes.RemoveAt(index);//制作完成,移除当前配方 | |||
} | |||
else | |||
{ | |||
Json<LocalRecipeDataColl>.Data.Recipes.RemoveAt(index);//制作完成,移除当前配方 | |||
} | |||
BigStation.Recipe1DosingStatus = 0; | |||
} | |||
} | |||
} | |||
if (RecipeQueue2.Count > 0) | |||
{ | |||
int index = Array.FindIndex(RemoteRecipes.ToArray(), p => p.RecipeCode == RecipeQueue2.ElementAt(0)); | |||
if (index >= 0 && index < RemoteRecipes.Count) | |||
{ | |||
string code = RemoteRecipes.ElementAt(index).RecipeCode; | |||
int trayCode = RemoteRecipes.ElementAt(index).TrayCode; | |||
if (HKDevice.PlcRead.IsAllowIssueRecipe2 && BigStation.Recipe2DosingStatus == 0)//配方1是否允许下发配发 | |||
{ | |||
HKDevice.StockBinPar(RemoteRecipes.ElementAt(index)); | |||
HKDevice.PlcWrite.Recipe2IssuedFinish = true; | |||
BigStation.Recipe2DosingStatus = 1; | |||
MessageLog.GetInstance.ShowRunLog($"配方状态:{code}下发完成"); | |||
} | |||
if (HKDevice.PlcRead.ReceiveFinishRecipe2 && BigStation.Recipe2DosingStatus == 1) | |||
{ | |||
BigStation.Recipe2DosingStatus = 2; | |||
HKDevice.PlcWrite.Recipe2IssuedFinish = false; | |||
HKDevice.PlcWrite.RecipeCode = 0; | |||
HKDevice.PlcWrite.TrayCode = 0; | |||
WeightReset(); | |||
MessageLog.GetInstance.ShowRunLog($"配方状态:{code}配方配料"); | |||
} | |||
if (BigStation.Recipe2DosingStatus == 2 && HKDevice.PlcRead.Recipe2DosingFinish) | |||
{ | |||
BigStation.Recipe2DosingStatus = 3; | |||
MessageLog.GetInstance.ShowRunLog($"配方状态:{code}配料完成"); | |||
if (HKDevice.PlcRead.Recipe2TrayCode > 0) | |||
{ | |||
foreach (var item in RemoteRecipes.ElementAt(index).RawMaterial) | |||
{ | |||
Json<LocalRecipeDataColl>.Data.Recipes.RemoveAt(index);//制作完成,移除当前配方 | |||
if (item.RawMaterialLocation == 1) | |||
{ | |||
item.Laying_Off_Weight = HKDevice.PlcRead.StockBin1ActualWeight; | |||
} | |||
else if (item.RawMaterialLocation == 2) | |||
{ | |||
item.Laying_Off_Weight = HKDevice.PlcRead.StockBin2ActualWeight; | |||
} | |||
else if (item.RawMaterialLocation == 3) | |||
{ | |||
item.Laying_Off_Weight = HKDevice.PlcRead.StockBin3ActualWeight; | |||
} | |||
else if (item.RawMaterialLocation == 4) | |||
{ | |||
item.Laying_Off_Weight = HKDevice.PlcRead.StockBin4ActualWeight; | |||
} | |||
else if (item.RawMaterialLocation == 5) | |||
{ | |||
item.Laying_Off_Weight = HKDevice.PlcRead.StockBin5ActualWeight; | |||
} | |||
else if (item.RawMaterialLocation == 6) | |||
{ | |||
item.Laying_Off_Weight = HKDevice.PlcRead.StockBin6ActualWeight; | |||
} | |||
else if (item.RawMaterialLocation == 7) | |||
{ | |||
item.Laying_Off_Weight = HKDevice.PlcRead.StockBin7ActualWeight; | |||
} | |||
else if (item.RawMaterialLocation == 8) | |||
{ | |||
item.Laying_Off_Weight = HKDevice.PlcRead.StockBin8ActualWeight; | |||
} | |||
else if (item.RawMaterialLocation == 9) | |||
{ | |||
item.Laying_Off_Weight = HKDevice.PlcRead.StockBin9ActualWeight; | |||
} | |||
else if (item.RawMaterialLocation == 10) | |||
{ | |||
item.Laying_Off_Weight = HKDevice.PlcRead.StockBin10ActualWeight; | |||
} | |||
else if (item.RawMaterialLocation == 11) | |||
{ | |||
item.Laying_Off_Weight = HKDevice.PlcRead.StockBin11ActualWeight; | |||
} | |||
else if (item.RawMaterialLocation == 12) | |||
{ | |||
item.Laying_Off_Weight = HKDevice.PlcRead.StockBin12ActualWeight; | |||
} | |||
else if (item.RawMaterialLocation == 13) | |||
{ | |||
item.Laying_Off_Weight = HKDevice.PlcRead.StockBin13ActualWeight; | |||
} | |||
else if (item.RawMaterialLocation == 14) | |||
{ | |||
item.Laying_Off_Weight = HKDevice.PlcRead.StockBin14ActualWeight; | |||
} | |||
} | |||
FinishData.Order_No = RemoteRecipes.ElementAt(index).RecipeCode; | |||
FinishData.Product_Code = RemoteRecipes.ElementAt(index).RecipeName; | |||
for (int i = 0; i < RemoteRecipes.ElementAt(index).RawMaterial.Count; i++) | |||
{ | |||
FinishData.Material[i] = new UDT1(); | |||
FinishData.Material[i].Material_Name = RemoteRecipes.ElementAt(index).RawMaterial.ElementAt(i).RawMaterialName; | |||
FinishData.Material[i].Material_BarrelNum = (short)RemoteRecipes.ElementAt(index).RawMaterial.ElementAt(i).RawMaterialBarrelNum; | |||
FinishData.Material[i].Material_Laying_Off_Weight = RemoteRecipes.ElementAt(index).RawMaterial.ElementAt(i).Laying_Off_Weight; | |||
} | |||
BigStation.RecipeDosingStatus = 0; | |||
} | |||
if (SiemensDevice.IsConnected) | |||
{ | |||
SiemensDevice.Siemens_PLC_S7.WriteClass<DL_Finish_DB>(FinishData, 3); | |||
} | |||
RecipeQueue2.TryDequeue(out code); | |||
IssuedComplete.Add(RemoteRecipes.ElementAt(index));//将该配方添加到下 | |||
if (!BigStation.IsAllowManual) | |||
{ | |||
Json<RemoteRecipe>.Data.Recipes.RemoveAt(index);//制作完成,移除当前配方 | |||
} | |||
else | |||
{ | |||
Json<LocalRecipeDataColl>.Data.Recipes.RemoveAt(index);//制作完成,移除当前配方 | |||
} | |||
BigStation.Recipe2DosingStatus = 0; | |||
} | |||
} | |||
} | |||
if (RecipeQueue3.Count > 0) | |||
{ | |||
int index = Array.FindIndex(RemoteRecipes.ToArray(), p => p.RecipeCode == RecipeQueue3.ElementAt(0)); | |||
if (index >= 0 && index < RemoteRecipes.Count) | |||
{ | |||
string code = RemoteRecipes.ElementAt(index).RecipeCode; | |||
int trayCode = RemoteRecipes.ElementAt(index).TrayCode; | |||
if (HKDevice.PlcRead.IsAllowIssueRecipe3 && BigStation.Recipe3DosingStatus == 0)//配方1是否允许下发配发 | |||
{ | |||
HKDevice.StockBinPar(RemoteRecipes.ElementAt(index)); | |||
HKDevice.PlcWrite.Recipe3IssuedFinish = true; | |||
BigStation.Recipe3DosingStatus = 1; | |||
MessageLog.GetInstance.ShowRunLog($"配方状态:{code}下发完成"); | |||
} | |||
if (HKDevice.PlcRead.ReceiveFinishRecipe3 && BigStation.Recipe3DosingStatus == 1) | |||
{ | |||
BigStation.Recipe3DosingStatus = 2; | |||
HKDevice.PlcWrite.RecipeCode = 0; | |||
HKDevice.PlcWrite.TrayCode = 0; | |||
WeightReset(); | |||
MessageLog.GetInstance.ShowRunLog($"配方状态:{code}配方配料"); | |||
} | |||
if (HKDevice.PlcRead.Recipe3DosingFinish && BigStation.Recipe3DosingStatus == 2) | |||
{ | |||
BigStation.Recipe3DosingStatus = 3; | |||
MessageLog.GetInstance.ShowRunLog($"配方状态:{code}配料完成"); | |||
if (HKDevice.PlcRead.Recipe3TrayCode > 0) | |||
{ | |||
foreach (var item in RemoteRecipes.ElementAt(index).RawMaterial) | |||
{ | |||
if (item.RawMaterialLocation == 1) | |||
{ | |||
item.Laying_Off_Weight = HKDevice.PlcRead.StockBin1ActualWeight; | |||
} | |||
else if (item.RawMaterialLocation == 2) | |||
{ | |||
item.Laying_Off_Weight = HKDevice.PlcRead.StockBin2ActualWeight; | |||
} | |||
else if (item.RawMaterialLocation == 3) | |||
{ | |||
item.Laying_Off_Weight = HKDevice.PlcRead.StockBin3ActualWeight; | |||
} | |||
else if (item.RawMaterialLocation == 4) | |||
{ | |||
item.Laying_Off_Weight = HKDevice.PlcRead.StockBin4ActualWeight; | |||
} | |||
else if (item.RawMaterialLocation == 5) | |||
{ | |||
item.Laying_Off_Weight = HKDevice.PlcRead.StockBin5ActualWeight; | |||
} | |||
else if (item.RawMaterialLocation == 6) | |||
{ | |||
item.Laying_Off_Weight = HKDevice.PlcRead.StockBin6ActualWeight; | |||
} | |||
else if (item.RawMaterialLocation == 7) | |||
{ | |||
item.Laying_Off_Weight = HKDevice.PlcRead.StockBin7ActualWeight; | |||
} | |||
else if (item.RawMaterialLocation == 8) | |||
{ | |||
item.Laying_Off_Weight = HKDevice.PlcRead.StockBin8ActualWeight; | |||
} | |||
else if (item.RawMaterialLocation == 9) | |||
{ | |||
item.Laying_Off_Weight = HKDevice.PlcRead.StockBin9ActualWeight; | |||
} | |||
else if (item.RawMaterialLocation == 10) | |||
{ | |||
item.Laying_Off_Weight = HKDevice.PlcRead.StockBin10ActualWeight; | |||
} | |||
else if (item.RawMaterialLocation == 11) | |||
{ | |||
item.Laying_Off_Weight = HKDevice.PlcRead.StockBin11ActualWeight; | |||
} | |||
else if (item.RawMaterialLocation == 12) | |||
{ | |||
item.Laying_Off_Weight = HKDevice.PlcRead.StockBin12ActualWeight; | |||
} | |||
else if (item.RawMaterialLocation == 13) | |||
{ | |||
item.Laying_Off_Weight = HKDevice.PlcRead.StockBin13ActualWeight; | |||
} | |||
else if (item.RawMaterialLocation == 14) | |||
{ | |||
item.Laying_Off_Weight = HKDevice.PlcRead.StockBin14ActualWeight; | |||
} | |||
} | |||
FinishData.Order_No = RemoteRecipes.ElementAt(index).RecipeCode; | |||
FinishData.Product_Code = RemoteRecipes.ElementAt(index).RecipeName; | |||
for (int i = 0; i < RemoteRecipes.ElementAt(index).RawMaterial.Count; i++) | |||
{ | |||
FinishData.Material[i] = new UDT1(); | |||
FinishData.Material[i].Material_Name = RemoteRecipes.ElementAt(index).RawMaterial.ElementAt(i).RawMaterialName; | |||
FinishData.Material[i].Material_BarrelNum = (short)RemoteRecipes.ElementAt(index).RawMaterial.ElementAt(i).RawMaterialBarrelNum; | |||
FinishData.Material[i].Material_Laying_Off_Weight = RemoteRecipes.ElementAt(index).RawMaterial.ElementAt(i).Laying_Off_Weight; | |||
} | |||
} | |||
if (SiemensDevice.IsConnected) | |||
{ | |||
SiemensDevice.Siemens_PLC_S7.WriteClass<DL_Finish_DB>(FinishData, 3); | |||
} | |||
HKDevice.HK_PLC_S7.Write<bool>("DB98.DBX1.1", false); | |||
RecipeQueue3.TryDequeue(out code); | |||
IssuedComplete.Add(RemoteRecipes.ElementAt(index));//将该配方添加到下 | |||
if (!BigStation.IsAllowManual) | |||
{ | |||
Json<RemoteRecipe>.Data.Recipes.RemoveAt(index);//制作完成,移除当前配方 | |||
} | |||
else | |||
{ | |||
Json<LocalRecipeDataColl>.Data.Recipes.RemoveAt(index);//制作完成,移除当前配方 | |||
} | |||
BigStation.Recipe3DosingStatus = 0; | |||
} | |||
} | |||
} | |||
if (RecipeQueue4.Count > 0) | |||
{ | |||
int index = Array.FindIndex(RemoteRecipes.ToArray(), p => p.RecipeCode == RecipeQueue4.ElementAt(0)); | |||
if (index >= 0 && index < RemoteRecipes.Count) | |||
{ | |||
string code = RemoteRecipes.ElementAt(index).RecipeCode; | |||
int trayCode = RemoteRecipes.ElementAt(index).TrayCode; | |||
if (HKDevice.PlcRead.IsAllowIssueRecipe4 && BigStation.Recipe4DosingStatus == 0)//配方1是否允许下发配发 | |||
{ | |||
HKDevice.StockBinPar(RemoteRecipes.ElementAt(index)); | |||
HKDevice.PlcWrite.Recipe4IssuedFinish = true; | |||
BigStation.Recipe4DosingStatus = 1; | |||
MessageLog.GetInstance.ShowRunLog($"配方状态:{code}下发完成"); | |||
} | |||
if (HKDevice.PlcRead.ReceiveFinishRecipe4 && BigStation.Recipe4DosingStatus == 1) | |||
{ | |||
BigStation.Recipe4DosingStatus = 2; | |||
HKDevice.PlcWrite.Recipe4IssuedFinish = false; | |||
HKDevice.PlcWrite.RecipeCode = 0; | |||
HKDevice.PlcWrite.TrayCode = 0; | |||
WeightReset(); | |||
MessageLog.GetInstance.ShowRunLog($"配方状态:{code}配方配料"); | |||
} | |||
if (BigStation.Recipe4DosingStatus == 2 && HKDevice.PlcRead.Recipe4DosingFinish) | |||
{ | |||
BigStation.Recipe4DosingStatus = 3; | |||
MessageLog.GetInstance.ShowRunLog($"配方状态:{code}配料完成"); | |||
if (HKDevice.PlcRead.Recipe4TrayCode > 0) | |||
{ | |||
foreach (var item in RemoteRecipes.ElementAt(index).RawMaterial) | |||
{ | |||
if (item.RawMaterialLocation == 1) | |||
{ | |||
item.Laying_Off_Weight = HKDevice.PlcRead.StockBin1ActualWeight; | |||
} | |||
else if (item.RawMaterialLocation == 2) | |||
{ | |||
item.Laying_Off_Weight = HKDevice.PlcRead.StockBin2ActualWeight; | |||
} | |||
else if (item.RawMaterialLocation == 3) | |||
{ | |||
item.Laying_Off_Weight = HKDevice.PlcRead.StockBin3ActualWeight; | |||
} | |||
else if (item.RawMaterialLocation == 4) | |||
{ | |||
item.Laying_Off_Weight = HKDevice.PlcRead.StockBin4ActualWeight; | |||
} | |||
else if (item.RawMaterialLocation == 5) | |||
{ | |||
item.Laying_Off_Weight = HKDevice.PlcRead.StockBin5ActualWeight; | |||
} | |||
else if (item.RawMaterialLocation == 6) | |||
{ | |||
item.Laying_Off_Weight = HKDevice.PlcRead.StockBin6ActualWeight; | |||
} | |||
else if (item.RawMaterialLocation == 7) | |||
{ | |||
item.Laying_Off_Weight = HKDevice.PlcRead.StockBin7ActualWeight; | |||
} | |||
else if (item.RawMaterialLocation == 8) | |||
{ | |||
item.Laying_Off_Weight = HKDevice.PlcRead.StockBin8ActualWeight; | |||
} | |||
else if (item.RawMaterialLocation == 9) | |||
{ | |||
item.Laying_Off_Weight = HKDevice.PlcRead.StockBin9ActualWeight; | |||
} | |||
else if (item.RawMaterialLocation == 10) | |||
{ | |||
item.Laying_Off_Weight = HKDevice.PlcRead.StockBin10ActualWeight; | |||
} | |||
else if (item.RawMaterialLocation == 11) | |||
{ | |||
item.Laying_Off_Weight = HKDevice.PlcRead.StockBin11ActualWeight; | |||
} | |||
else if (item.RawMaterialLocation == 12) | |||
{ | |||
item.Laying_Off_Weight = HKDevice.PlcRead.StockBin12ActualWeight; | |||
} | |||
else if (item.RawMaterialLocation == 13) | |||
{ | |||
item.Laying_Off_Weight = HKDevice.PlcRead.StockBin13ActualWeight; | |||
} | |||
else if (item.RawMaterialLocation == 14) | |||
{ | |||
item.Laying_Off_Weight = HKDevice.PlcRead.StockBin14ActualWeight; | |||
} | |||
} | |||
FinishData.Order_No = RemoteRecipes.ElementAt(index).RecipeCode; | |||
FinishData.Product_Code = RemoteRecipes.ElementAt(index).RecipeName; | |||
for (int i = 0; i < RemoteRecipes.ElementAt(index).RawMaterial.Count; i++) | |||
{ | |||
FinishData.Material[i] = new UDT1(); | |||
FinishData.Material[i].Material_Name = RemoteRecipes.ElementAt(index).RawMaterial.ElementAt(i).RawMaterialName; | |||
FinishData.Material[i].Material_BarrelNum = (short)RemoteRecipes.ElementAt(index).RawMaterial.ElementAt(i).RawMaterialBarrelNum; | |||
FinishData.Material[i].Material_Laying_Off_Weight = RemoteRecipes.ElementAt(index).RawMaterial.ElementAt(i).Laying_Off_Weight; | |||
} | |||
} | |||
if (SiemensDevice.IsConnected) | |||
{ | |||
SiemensDevice.Siemens_PLC_S7.WriteClass<DL_Finish_DB>(FinishData, 3); | |||
} | |||
HKDevice.HK_PLC_S7.Write<bool>("DB98.DBX1.3", false); | |||
RecipeQueue4.TryDequeue(out code); | |||
IssuedComplete.Add(RemoteRecipes.ElementAt(index));//将该配方添加到下 | |||
if (!BigStation.IsAllowManual) | |||
{ | |||
Json<RemoteRecipe>.Data.Recipes.RemoveAt(index);//制作完成,移除当前配方 | |||
} | |||
else | |||
{ | |||
Json<LocalRecipeDataColl>.Data.Recipes.RemoveAt(index);//制作完成,移除当前配方 | |||
} | |||
BigStation.Recipe4DosingStatus = 0; | |||
} | |||
} | |||
} | |||
@@ -450,5 +919,68 @@ namespace BPASmartClient.JXJFoodBigStation.Model | |||
}*/ | |||
} | |||
private void WeightReset() | |||
{ | |||
HKDevice.PlcWrite.Bareel1Bin1SetWeight = 0; | |||
HKDevice.PlcWrite.Bareel1Bin2SetWeight = 0; | |||
HKDevice.PlcWrite.Bareel1Bin3SetWeight = 0; | |||
HKDevice.PlcWrite.Bareel1Bin4SetWeight = 0; | |||
HKDevice.PlcWrite.Bareel1Bin5SetWeight = 0; | |||
HKDevice.PlcWrite.Bareel1Bin6SetWeight = 0; | |||
HKDevice.PlcWrite.Bareel1Bin7SetWeight = 0; | |||
HKDevice.PlcWrite.Bareel1Bin8SetWeight = 0; | |||
HKDevice.PlcWrite.Bareel1Bin9SetWeight = 0; | |||
HKDevice.PlcWrite.Bareel1Bin10SetWeight = 0; | |||
HKDevice.PlcWrite.Bareel1Bin11SetWeight = 0; | |||
HKDevice.PlcWrite.Bareel1Bin12SetWeight = 0; | |||
HKDevice.PlcWrite.Bareel1Bin13SetWeight = 0; | |||
HKDevice.PlcWrite.Bareel1Bin14SetWeight = 0; | |||
HKDevice.PlcWrite.Bareel2Bin1SetWeight = 0; | |||
HKDevice.PlcWrite.Bareel2Bin2SetWeight = 0; | |||
HKDevice.PlcWrite.Bareel2Bin3SetWeight = 0; | |||
HKDevice.PlcWrite.Bareel2Bin4SetWeight = 0; | |||
HKDevice.PlcWrite.Bareel2Bin5SetWeight = 0; | |||
HKDevice.PlcWrite.Bareel2Bin6SetWeight = 0; | |||
HKDevice.PlcWrite.Bareel2Bin7SetWeight = 0; | |||
HKDevice.PlcWrite.Bareel2Bin8SetWeight = 0; | |||
HKDevice.PlcWrite.Bareel2Bin9SetWeight = 0; | |||
HKDevice.PlcWrite.Bareel2Bin10SetWeight = 0; | |||
HKDevice.PlcWrite.Bareel2Bin11SetWeight = 0; | |||
HKDevice.PlcWrite.Bareel2Bin12SetWeight = 0; | |||
HKDevice.PlcWrite.Bareel2Bin13SetWeight = 0; | |||
HKDevice.PlcWrite.Bareel2Bin14SetWeight = 0; | |||
HKDevice.PlcWrite.Bareel4Bin1SetWeight = 0; | |||
HKDevice.PlcWrite.Bareel4Bin2SetWeight = 0; | |||
HKDevice.PlcWrite.Bareel4Bin3SetWeight = 0; | |||
HKDevice.PlcWrite.Bareel4Bin4SetWeight = 0; | |||
HKDevice.PlcWrite.Bareel4Bin5SetWeight = 0; | |||
HKDevice.PlcWrite.Bareel4Bin6SetWeight = 0; | |||
HKDevice.PlcWrite.Bareel4Bin7SetWeight = 0; | |||
HKDevice.PlcWrite.Bareel4Bin8SetWeight = 0; | |||
HKDevice.PlcWrite.Bareel4Bin9SetWeight = 0; | |||
HKDevice.PlcWrite.Bareel4Bin10SetWeight = 0; | |||
HKDevice.PlcWrite.Bareel4Bin11SetWeight = 0; | |||
HKDevice.PlcWrite.Bareel4Bin12SetWeight = 0; | |||
HKDevice.PlcWrite.Bareel4Bin13SetWeight = 0; | |||
HKDevice.PlcWrite.Bareel4Bin14SetWeight = 0; | |||
HKDevice.PlcWrite.Bareel5Bin1SetWeight = 0; | |||
HKDevice.PlcWrite.Bareel5Bin2SetWeight = 0; | |||
HKDevice.PlcWrite.Bareel5Bin3SetWeight = 0; | |||
HKDevice.PlcWrite.Bareel5Bin4SetWeight = 0; | |||
HKDevice.PlcWrite.Bareel5Bin5SetWeight = 0; | |||
HKDevice.PlcWrite.Bareel5Bin6SetWeight = 0; | |||
HKDevice.PlcWrite.Bareel5Bin7SetWeight = 0; | |||
HKDevice.PlcWrite.Bareel5Bin8SetWeight = 0; | |||
HKDevice.PlcWrite.Bareel5Bin9SetWeight = 0; | |||
HKDevice.PlcWrite.Bareel5Bin10SetWeight = 0; | |||
HKDevice.PlcWrite.Bareel5Bin11SetWeight = 0; | |||
HKDevice.PlcWrite.Bareel5Bin12SetWeight = 0; | |||
HKDevice.PlcWrite.Bareel5Bin13SetWeight = 0; | |||
HKDevice.PlcWrite.Bareel5Bin14SetWeight = 0; | |||
} | |||
} | |||
} |
@@ -2,7 +2,7 @@ | |||
<configuration> | |||
<appSettings> | |||
<add key="HKPlc_IP" value="192.168.0.15"/> | |||
<add key="Siemens_IP" value="192.168.0.30"/> | |||
<add key="Siemens_IP" value="107.107.2.200"/> | |||
<add key="WindSend_IP" value="192.168.0.40"/> | |||
</appSettings> | |||
</configuration> |
@@ -28,7 +28,7 @@ namespace BPASmartClient.JXJFoodSmallStation | |||
base.OnStartup(e); | |||
MenuInit(); | |||
DataInit(); | |||
DeviceInquire.GetInstance.Init();//配料机设备上线监听,设备列表初始化 | |||
//DeviceInquire.GetInstance.Init();//配料机设备上线监听,设备列表初始化 | |||
ProcessControl.GetInstance.Init(); | |||
MainView mv = new MainView(); | |||
LoginView lv = new LoginView(); | |||
@@ -111,8 +111,8 @@ namespace BPASmartClient.JXJFoodSmallStation.Model | |||
string WindSend_PLC_IP = ConfigurationManager.AppSettings["WindSend_IP"]; | |||
try | |||
{ | |||
HKDevice.HK_PLC_S7.Connect(S7.Net.CpuType.S71200, HK_PLC_IP); | |||
//SiemensDevice.Siemens_PLC_S7.Connect(S7.Net.CpuType.S71500, Siemens_PLC_IP); | |||
//HKDevice.HK_PLC_S7.Connect(S7.Net.CpuType.S71200, HK_PLC_IP); | |||
SiemensDevice.Siemens_PLC_S7.Connect(S7.Net.CpuType.S71500, Siemens_PLC_IP); | |||
//WindSendDevice.Siemens_PLC_S7.Connect(S7.Net.CpuType.S71200,WindSend_PLC_IP); | |||
if (HKDevice.IsConnected) | |||
{ | |||
@@ -341,7 +341,7 @@ namespace BPASmartClient.JXJFoodSmallStation.Model | |||
public bool StatusReset() | |||
{ | |||
return this.modbusTcp.Write(DeviceAddress.FinfishStatus, (ushort)1).ToString(); | |||
return this.modbusTcp.Write(DeviceAddress.FinfishStatus, (ushort)1); | |||
//var res = modbusTcp.Read(DeviceAddress.RunStatus); | |||
} | |||
@@ -21,31 +21,31 @@ namespace BPASmartClient.JXJFoodSmallStation.Model.Siemens | |||
{ | |||
ThreadManage.GetInstance().StartLong(new Action(() => | |||
{ | |||
var res = this.Siemens_PLC_S7.ReadClass<XL_Start_DB>(1); | |||
var res1 = this.Siemens_PLC_S7.ReadClass<XL_Status_DB>(2); | |||
var res2 = this.Siemens_PLC_S7.ReadClass<XL_Finish_DB>(3); | |||
if (res != null && res.Ask_For_Send_Bit == false && GVL_SmallStation.GetInstance.IsAllowSiemensSendRecipe) | |||
var res = this.Siemens_PLC_S7.ReadClass<XL_Start_DB>(2201); | |||
var res1 = this.Siemens_PLC_S7.ReadClass<XL_Status_DB>(2231); | |||
var res2 = this.Siemens_PLC_S7.ReadClass<XL_Finish_DB>(2261); | |||
if (res != null && res.Order_Request_ACK == false && GVL_SmallStation.GetInstance.IsAllowSiemensSendRecipe) | |||
{ | |||
res.Ask_For_Send_Bit = true; | |||
res.Order_Request_ACK = true; | |||
this.Siemens_PLC_S7.WriteClass<XL_Start_DB>(res, 1); | |||
} | |||
if (res != null && RTrig.GetInstance("RecipeTrig").Start(res.Ack_Ask_For_Send_Bit)) | |||
if (res != null && RTrig.GetInstance("RecipeTrig").Start(res.Order_Request_ACK)) | |||
{ | |||
ActionManage.GetInstance.Send("SiemensRecipeRecive", res); | |||
res.Ack_Ask_For_Send_Bit = false; | |||
res.Order_Request_ACK = false; | |||
this.Siemens_PLC_S7.WriteClass<XL_Start_DB>(res, 1); | |||
} | |||
if (res1 != null && RTrig.GetInstance("Allow_AGV_Put[0]").Start(res1.Allow_AGV_Put[0])) | |||
if (res1 != null && RTrig.GetInstance("Allow_AGV_Put[0]").Start(res1.Agv1)) | |||
{ | |||
ActionManage.GetInstance.Send("AGV到工位1信号",res1); | |||
res1.Allow_AGV_Put[0] = false; | |||
res1.Agv1 = false; | |||
this.Siemens_PLC_S7.WriteClass<XL_Status_DB>(res1, 2); | |||
} | |||
if (res1 != null && RTrig.GetInstance("Allow_AGV_Put[1]").Start(res1.Allow_AGV_Put[1])) | |||
if (res1 != null && RTrig.GetInstance("Allow_AGV_Put[1]").Start(res1.Agv2)) | |||
{ | |||
ActionManage.GetInstance.Send("AGV到工位2信号",res1); | |||
res1.Allow_AGV_Put[1] = false; | |||
res1.Agv1 = false; | |||
this.Siemens_PLC_S7.WriteClass<XL_Status_DB>(res1, 2); | |||
} | |||
@@ -1,4 +1,5 @@ | |||
using System; | |||
using BPASmartClient.S7Net; | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Text; | |||
@@ -8,32 +9,46 @@ namespace BPASmartClient.JXJFoodSmallStation.Model.Siemens | |||
{ | |||
internal class XL_Finish_DB | |||
{ | |||
[Siemens(6)] | |||
/// <summary> | |||
/// 生产工单编码 | |||
/// </summary> | |||
public string Order_No; | |||
/// </summary | |||
public string Order_No { get; set; } | |||
[Siemens(6)] | |||
/// <summary> | |||
/// 产品名称 | |||
/// </summary> | |||
public string Product_Code; | |||
public string Product_Code { get; set; } | |||
public short Job_No { get; set; } | |||
public UDT2[] Powder = new UDT2[10]; | |||
/// <summary> | |||
/// 原料信息 | |||
/// </summary> | |||
public UDT1[] Material = new UDT1[20]; | |||
public short DosingTime { get; set; } | |||
/// <summary> | |||
/// 配料完成信号 | |||
/// </summary> | |||
public bool Ask_For_Finish; | |||
public bool Ask_For_Finish { get; set; } | |||
/// <summary> | |||
/// 配料完成信号确认 | |||
/// </summary> | |||
public bool Ask_For_Finish_PLC; | |||
public bool Ask_For_Finish_PLC { get; set; } | |||
} | |||
public class UDT1 | |||
{ | |||
public string Material_Name; | |||
public float Material_Laying_Off_Weight; | |||
public short Material_BarrelNum; | |||
[Siemens(6)] | |||
public string Material_Name { get; set; } | |||
public float Material_Laying_Off_Weight { get; set; } | |||
public short Material_BarrelNum { get; set; } | |||
} | |||
public class UDT2 | |||
{ | |||
[Siemens(6)] | |||
public string Powder_Name { get; set; } | |||
public float Powder_Weight { get; set; } | |||
} | |||
} |
@@ -1,4 +1,5 @@ | |||
using System; | |||
using BPASmartClient.S7Net; | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Text; | |||
@@ -8,45 +9,57 @@ namespace BPASmartClient.JXJFoodSmallStation.Model.Siemens | |||
{ | |||
internal class XL_Start_DB | |||
{ | |||
[Siemens(16)] | |||
/// <summary> | |||
/// 配方编码 | |||
/// </summary> | |||
public string RecipeCode; | |||
public string RecipeCode { get; set; } | |||
[Siemens(16)] | |||
/// <summary> | |||
/// 配发名称 | |||
/// </summary> | |||
public string RecipeName; | |||
public string RecipeName { get; set; } | |||
public short StockCode { get; set; } | |||
public short TrayCode { get; set; } | |||
public UDT2Start[] Powder = new UDT2Start[10]; | |||
/// <summary> | |||
/// 物料信息 | |||
/// </summary> | |||
public UDT[] Material = new UDT[20]; | |||
/// <summary> | |||
/// 托盘编号 | |||
/// </summary> | |||
public int TrayCode; | |||
/// <summary> | |||
/// 配方发送请求 | |||
/// </summary> | |||
public bool Ask_For_Send_Bit; | |||
public UDTStart[] Material = new UDTStart[20]; | |||
/// <summary> | |||
/// 上位机确认配方接收完成 | |||
/// plc确认配方接收完成 | |||
/// </summary> | |||
public bool Ack_Ask_For_Send_Bit; | |||
public bool Order_Request_ACK { get; set; } | |||
public short[] Standby = new short[4]; | |||
public bool Order_Request { get; set; } | |||
public short[] Standby1 = new short[4]; | |||
} | |||
public class UDT | |||
public class UDTStart | |||
{ | |||
[Siemens(6)] | |||
/// <summary> | |||
/// 原料名称 | |||
/// </summary> | |||
public string Material_Name; | |||
public string Material_Name { get; set; } | |||
/// <summary> | |||
/// 原料重量 | |||
/// </summary> | |||
public float Material_Weight; | |||
public float Material_Weight { get; set; } | |||
/// <summary> | |||
/// 原料桶号 | |||
/// </summary> | |||
public short Material_BarrelNum; | |||
public short Material_BarrelNum { get; set; } | |||
} | |||
public class UDT2Start | |||
{ | |||
[Siemens(6)] | |||
public string Powder_Name { get; set; } | |||
public float Powder_Weight { get; set; } | |||
} | |||
} | |||
} |
@@ -1,4 +1,5 @@ | |||
using System; | |||
using BPASmartClient.S7Net; | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Text; | |||
@@ -8,53 +9,38 @@ namespace BPASmartClient.JXJFoodSmallStation.Model.Siemens | |||
{ | |||
internal class XL_Status_DB | |||
{ | |||
[Siemens(16)] | |||
/// <summary> | |||
/// 生产工单 | |||
/// </summary> | |||
public string Order_No; | |||
public string Order_No { get; set; } | |||
/// <summary> | |||
/// 配料开始 | |||
/// </summary> | |||
public bool Dosing_Start; | |||
public bool Dosing_Start { get; set; } | |||
/// <summary> | |||
/// 配料开始确认 | |||
/// </summary> | |||
public bool Dosing_Confirm; | |||
/// <summary> | |||
/// 托盘占位情况 | |||
/// </summary> | |||
public bool[] Pallet_Position_Occ = new bool[16]; | |||
/// <summary> | |||
/// 工位允许放货架 | |||
/// </summary> | |||
public bool[] Allow_AGV_Put = new bool[16]; | |||
/// <summary> | |||
/// 工位允许取货架 | |||
/// </summary> | |||
public bool[] Allow_AGV_Get = new bool[16]; | |||
/// <summary> | |||
/// AGV请求放货架 | |||
/// </summary> | |||
public bool[] AGV_Request_Put = new bool[16]; | |||
/// <summary> | |||
/// AGV请求取货架 | |||
/// </summary> | |||
public bool[] AGV_Request_Get = new bool[16]; | |||
/// <summary> | |||
/// AGV放托盘完成 | |||
/// </summary> | |||
public bool[] AGV_Put_Done = new bool[16]; | |||
/// <summary> | |||
/// 托盘号 | |||
/// </summary> | |||
public short[] Pan_No = new short[16]; | |||
/// <summary> | |||
/// 配料时间 | |||
/// </summary> | |||
public int DosingTime; | |||
/// <summary> | |||
/// 备用 | |||
/// </summary> | |||
public byte Reserve; | |||
public bool Agv1 { get; set; } | |||
public bool Agv2 { get; set; } | |||
public bool Agv3 { get; set; } | |||
public bool Agv4 { get; set; } | |||
public short AgvPos { get; set; } | |||
public UDTStatus[] Powder = new UDTStatus[10]; | |||
public bool Agv5{ get; set; } | |||
public bool Agv6 { get; set; } | |||
public bool Agv7 { get; set; } | |||
public int Agv8 { get; set; } | |||
public short AgvUse { get; set; } | |||
} | |||
public class UDTStatus | |||
{ | |||
[Siemens(6)] | |||
public string Powder_Name { get; set; } | |||
public float Powder_Weight { get; set; } | |||
public float Powder_LayingOff_Weight { get; set; } | |||
} | |||
} |