From cc3c9cd2244232cc06fb0728ead67a3f520e6e30 Mon Sep 17 00:00:00 2001
From: pengliangyang <1406009520@qq.com>
Date: Fri, 21 Oct 2022 11:10:52 +0800
Subject: [PATCH] =?UTF-8?q?=E4=BB=A3=E7=A0=81=E6=9B=B4=E6=96=B0?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../Model/GVL_BigStation.cs | 7 +-
.../Model/HK_PLC/DB_Read.cs | 36 +-
.../Model/HK_PLC/DB_Write.cs | 134 ++--
.../Model/HK_PLC/HKDeviceStatus.cs | 455 +++++++++++++-
.../Model/HK_PLC/Test1.cs | 49 +-
.../Model/ProcessControl.cs | 590 +++++++++++++++++-
BPASmartClient.JXJFoodSmallStation/App.config | 2 +-
.../App.xaml.cs | 2 +-
.../Model/ProcessControl.cs | 4 +-
.../Model/RawMaterial/DeviceInquire.cs | 2 +-
.../Model/Siemens/SiemensDeviceStatus.cs | 22 +-
.../Model/Siemens/XL_Finish_DB.cs | 33 +-
.../Model/Siemens/XL_Start_DB.cs | 51 +-
.../Model/Siemens/XL_Status_DB.cs | 64 +-
14 files changed, 1212 insertions(+), 239 deletions(-)
diff --git a/BPASmartClient.JXJFoodBigStation/Model/GVL_BigStation.cs b/BPASmartClient.JXJFoodBigStation/Model/GVL_BigStation.cs
index 4096510d..74dd61bb 100644
--- a/BPASmartClient.JXJFoodBigStation/Model/GVL_BigStation.cs
+++ b/BPASmartClient.JXJFoodBigStation/Model/GVL_BigStation.cs
@@ -35,7 +35,12 @@ namespace BPASmartClient.JXJFoodBigStation.Model
///
/// 配方下发状态 =0:配方未下发 ,1:配方下发给plc ,2:plc成功接收配方
///
- 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; }
+
///
/// 是否处于手动下发配方
///
diff --git a/BPASmartClient.JXJFoodBigStation/Model/HK_PLC/DB_Read.cs b/BPASmartClient.JXJFoodBigStation/Model/HK_PLC/DB_Read.cs
index d4294cdf..9cc544b6 100644
--- a/BPASmartClient.JXJFoodBigStation/Model/HK_PLC/DB_Read.cs
+++ b/BPASmartClient.JXJFoodBigStation/Model/HK_PLC/DB_Read.cs
@@ -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; }
}
}
diff --git a/BPASmartClient.JXJFoodBigStation/Model/HK_PLC/DB_Write.cs b/BPASmartClient.JXJFoodBigStation/Model/HK_PLC/DB_Write.cs
index dca2d6f3..f03a21f0 100644
--- a/BPASmartClient.JXJFoodBigStation/Model/HK_PLC/DB_Write.cs
+++ b/BPASmartClient.JXJFoodBigStation/Model/HK_PLC/DB_Write.cs
@@ -59,88 +59,70 @@ namespace BPASmartClient.JXJFoodBigStation.Model.HK_PLC
///
/// 配方编码
///
- public bool RecipeCode { get; set; }
+ public short RecipeCode { get; set; }
///
/// 托盘编码
///
- 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; }
}
}
diff --git a/BPASmartClient.JXJFoodBigStation/Model/HK_PLC/HKDeviceStatus.cs b/BPASmartClient.JXJFoodBigStation/Model/HK_PLC/HKDeviceStatus.cs
index 2181fb20..102503c9 100644
--- a/BPASmartClient.JXJFoodBigStation/Model/HK_PLC/HKDeviceStatus.cs
+++ b/BPASmartClient.JXJFoodBigStation/Model/HK_PLC/HKDeviceStatus.cs
@@ -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(99);
- //var res1 = HK_PLC_S7.Read("DB46.DBX10.0");
- var res = HK_PLC_S7.ReadClass(46);
- int a = 1;
+ HK_PLC_S7.WriteClass(PlcWrite, 99);
+ var res1 = HK_PLC_S7.ReadClass(98);
+ var res2 = HK_PLC_S7.ReadClass(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(recipecode, recipecode1);
- HK_PLC_S7.Write(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(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(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(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(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;
}
- }
+ }
}
}
}
diff --git a/BPASmartClient.JXJFoodBigStation/Model/HK_PLC/Test1.cs b/BPASmartClient.JXJFoodBigStation/Model/HK_PLC/Test1.cs
index d4caa9bd..0a9f0d6c 100644
--- a/BPASmartClient.JXJFoodBigStation/Model/HK_PLC/Test1.cs
+++ b/BPASmartClient.JXJFoodBigStation/Model/HK_PLC/Test1.cs
@@ -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; }
}
}
diff --git a/BPASmartClient.JXJFoodBigStation/Model/ProcessControl.cs b/BPASmartClient.JXJFoodBigStation/Model/ProcessControl.cs
index 3b19daa8..2ea24d68 100644
--- a/BPASmartClient.JXJFoodBigStation/Model/ProcessControl.cs
+++ b/BPASmartClient.JXJFoodBigStation/Model/ProcessControl.cs
@@ -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();
///
/// 配方数据
@@ -41,7 +42,11 @@ namespace BPASmartClient.JXJFoodBigStation.Model
///
/// 配方队列
///
- public ConcurrentQueue RecipeQueue = new ConcurrentQueue();
+ public ConcurrentQueue RecipeQueue1 = new ConcurrentQueue();
+ public ConcurrentQueue RecipeQueue2 = new ConcurrentQueue();
+ public ConcurrentQueue RecipeQueue3 = new ConcurrentQueue();
+ public ConcurrentQueue RecipeQueue4 = new ConcurrentQueue();
+ public ConcurrentQueue RecipeQueue5 = new ConcurrentQueue();
///
/// AGV到达工站队列
///
@@ -126,13 +131,17 @@ namespace BPASmartClient.JXJFoodBigStation.Model
if (o !=null && o is RecipeData a)
{
Json.Data.Recipes.Add(a);
- foreach (var item in Json.Data.Recipes.ElementAt(0).RawMaterial)
+ for (int i = 0; i < Json.Data.Recipes.Count; i++)
{
- item.RawMaterialLocation = Convert.ToInt32(item.RawMaterialName);
+ foreach (var item in Json.Data.Recipes.ElementAt(i).RawMaterial)
+ {
+ item.RawMaterialLocation = Convert.ToInt32(item.RawMaterialName);
+ }
}
+
}
}), "ManualSendRecipe", true);
- RecipeQueue.Clear();
+ RecipeQueue1.Clear();
//Json.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("M5001.0")) && BigStation.RecipeDosingStatus == 0)//配方1是否允许下发配发
+ if (HKDevice.PlcRead.IsAllowIssueRecipe1 && BigStation.Recipe1DosingStatus == 0)//配方1是否允许下发配发
{
HKDevice.StockBinPar(RemoteRecipes.ElementAt(index));
- HKDevice.HK_PLC_S7.Write("M4001.0", true);//配发下发完成,to plc
- HKDevice.HK_PLC_S7.Write("M5001.0", false);//复位允许下发配方1信号
- BigStation.RecipeDosingStatus = 1;
+ HKDevice.PlcWrite.Recipe1IssuedFinish = true;
+ //HKDevice.HK_PLC_S7.Write("DB98.DBX0.1", false);//复位允许下发配方1信号
+ BigStation.Recipe1DosingStatus = 1;
MessageLog.GetInstance.ShowRunLog($"配方状态:{code}下发完成");
}
- if (HKDevice.HK_PLC_S7.Read("M5001.4") && BigStation.RecipeDosingStatus == 1)
+ if (HKDevice.PlcRead.ReceiveFinishRecipe1 && BigStation.Recipe1DosingStatus == 1)
{
- BigStation.RecipeDosingStatus = 2;
- HKDevice.HK_PLC_S7.Write("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("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("M5007.0",false);
- RecipeQueue.TryDequeue(out code);
- IssuedComplete.Add(RemoteRecipes.ElementAt(index));//将该配方添加到下
- if (!BigStation.IsAllowManual)
+ foreach (var item in RemoteRecipes.ElementAt(index).RawMaterial)
{
- Json.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(FinishData, 3);
+ }
+ //HKDevice.HK_PLC_S7.Write("DB98.DBX1.1",false);
+ RecipeQueue1.TryDequeue(out code);
+ IssuedComplete.Add(RemoteRecipes.ElementAt(index));//将该配方添加到下
+ if (!BigStation.IsAllowManual)
+ {
+ Json.Data.Recipes.RemoveAt(index);//制作完成,移除当前配方
+ }
+ else
+ {
+ Json.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.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(FinishData, 3);
+ }
+ RecipeQueue2.TryDequeue(out code);
+ IssuedComplete.Add(RemoteRecipes.ElementAt(index));//将该配方添加到下
+ if (!BigStation.IsAllowManual)
+ {
+ Json.Data.Recipes.RemoveAt(index);//制作完成,移除当前配方
+ }
+ else
+ {
+ Json.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(FinishData, 3);
+ }
+ HKDevice.HK_PLC_S7.Write("DB98.DBX1.1", false);
+ RecipeQueue3.TryDequeue(out code);
+ IssuedComplete.Add(RemoteRecipes.ElementAt(index));//将该配方添加到下
+ if (!BigStation.IsAllowManual)
+ {
+ Json.Data.Recipes.RemoveAt(index);//制作完成,移除当前配方
+ }
+ else
+ {
+ Json.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(FinishData, 3);
+ }
+ HKDevice.HK_PLC_S7.Write("DB98.DBX1.3", false);
+ RecipeQueue4.TryDequeue(out code);
+ IssuedComplete.Add(RemoteRecipes.ElementAt(index));//将该配方添加到下
+ if (!BigStation.IsAllowManual)
+ {
+ Json.Data.Recipes.RemoveAt(index);//制作完成,移除当前配方
+ }
+ else
+ {
+ Json.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;
+ }
}
}
diff --git a/BPASmartClient.JXJFoodSmallStation/App.config b/BPASmartClient.JXJFoodSmallStation/App.config
index 649f2420..8dadfd80 100644
--- a/BPASmartClient.JXJFoodSmallStation/App.config
+++ b/BPASmartClient.JXJFoodSmallStation/App.config
@@ -2,7 +2,7 @@
-
+
\ No newline at end of file
diff --git a/BPASmartClient.JXJFoodSmallStation/App.xaml.cs b/BPASmartClient.JXJFoodSmallStation/App.xaml.cs
index b7ad1236..a7c69020 100644
--- a/BPASmartClient.JXJFoodSmallStation/App.xaml.cs
+++ b/BPASmartClient.JXJFoodSmallStation/App.xaml.cs
@@ -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();
diff --git a/BPASmartClient.JXJFoodSmallStation/Model/ProcessControl.cs b/BPASmartClient.JXJFoodSmallStation/Model/ProcessControl.cs
index 56795827..116bf6a3 100644
--- a/BPASmartClient.JXJFoodSmallStation/Model/ProcessControl.cs
+++ b/BPASmartClient.JXJFoodSmallStation/Model/ProcessControl.cs
@@ -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)
{
diff --git a/BPASmartClient.JXJFoodSmallStation/Model/RawMaterial/DeviceInquire.cs b/BPASmartClient.JXJFoodSmallStation/Model/RawMaterial/DeviceInquire.cs
index 0041ebfb..d4e379d2 100644
--- a/BPASmartClient.JXJFoodSmallStation/Model/RawMaterial/DeviceInquire.cs
+++ b/BPASmartClient.JXJFoodSmallStation/Model/RawMaterial/DeviceInquire.cs
@@ -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);
}
diff --git a/BPASmartClient.JXJFoodSmallStation/Model/Siemens/SiemensDeviceStatus.cs b/BPASmartClient.JXJFoodSmallStation/Model/Siemens/SiemensDeviceStatus.cs
index 236eea54..107f2920 100644
--- a/BPASmartClient.JXJFoodSmallStation/Model/Siemens/SiemensDeviceStatus.cs
+++ b/BPASmartClient.JXJFoodSmallStation/Model/Siemens/SiemensDeviceStatus.cs
@@ -21,31 +21,31 @@ namespace BPASmartClient.JXJFoodSmallStation.Model.Siemens
{
ThreadManage.GetInstance().StartLong(new Action(() =>
{
- var res = this.Siemens_PLC_S7.ReadClass(1);
- var res1 = this.Siemens_PLC_S7.ReadClass(2);
- var res2 = this.Siemens_PLC_S7.ReadClass(3);
- if (res != null && res.Ask_For_Send_Bit == false && GVL_SmallStation.GetInstance.IsAllowSiemensSendRecipe)
+ var res = this.Siemens_PLC_S7.ReadClass(2201);
+ var res1 = this.Siemens_PLC_S7.ReadClass(2231);
+ var res2 = this.Siemens_PLC_S7.ReadClass(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(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(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(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(res1, 2);
}
diff --git a/BPASmartClient.JXJFoodSmallStation/Model/Siemens/XL_Finish_DB.cs b/BPASmartClient.JXJFoodSmallStation/Model/Siemens/XL_Finish_DB.cs
index 24e7608d..0e977bde 100644
--- a/BPASmartClient.JXJFoodSmallStation/Model/Siemens/XL_Finish_DB.cs
+++ b/BPASmartClient.JXJFoodSmallStation/Model/Siemens/XL_Finish_DB.cs
@@ -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)]
///
/// 生产工单编码
- ///
- public string Order_No;
+ ///
/// 产品名称
///
- public string Product_Code;
+ public string Product_Code { get; set; }
+ public short Job_No { get; set; }
+ public UDT2[] Powder = new UDT2[10];
///
/// 原料信息
///
public UDT1[] Material = new UDT1[20];
+ public short DosingTime { get; set; }
///
/// 配料完成信号
///
- public bool Ask_For_Finish;
+ public bool Ask_For_Finish { get; set; }
///
/// 配料完成信号确认
///
- 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; }
}
}
diff --git a/BPASmartClient.JXJFoodSmallStation/Model/Siemens/XL_Start_DB.cs b/BPASmartClient.JXJFoodSmallStation/Model/Siemens/XL_Start_DB.cs
index 9dcb5ac9..5109c0cf 100644
--- a/BPASmartClient.JXJFoodSmallStation/Model/Siemens/XL_Start_DB.cs
+++ b/BPASmartClient.JXJFoodSmallStation/Model/Siemens/XL_Start_DB.cs
@@ -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)]
///
/// 配方编码
///
- public string RecipeCode;
+ public string RecipeCode { get; set; }
+ [Siemens(16)]
///
/// 配发名称
///
- public string RecipeName;
+ public string RecipeName { get; set; }
+
+ public short StockCode { get; set; }
+ public short TrayCode { get; set; }
+
+ public UDT2Start[] Powder = new UDT2Start[10];
///
/// 物料信息
///
- public UDT[] Material = new UDT[20];
- ///
- /// 托盘编号
- ///
- public int TrayCode;
- ///
- /// 配方发送请求
- ///
- public bool Ask_For_Send_Bit;
+ public UDTStart[] Material = new UDTStart[20];
///
- /// 上位机确认配方接收完成
+ /// plc确认配方接收完成
///
- 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)]
///
/// 原料名称
///
- public string Material_Name;
+ public string Material_Name { get; set; }
///
/// 原料重量
///
- public float Material_Weight;
+ public float Material_Weight { get; set; }
///
/// 原料桶号
///
- 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; }
}
-}
+}
\ No newline at end of file
diff --git a/BPASmartClient.JXJFoodSmallStation/Model/Siemens/XL_Status_DB.cs b/BPASmartClient.JXJFoodSmallStation/Model/Siemens/XL_Status_DB.cs
index fc06a44a..8e454427 100644
--- a/BPASmartClient.JXJFoodSmallStation/Model/Siemens/XL_Status_DB.cs
+++ b/BPASmartClient.JXJFoodSmallStation/Model/Siemens/XL_Status_DB.cs
@@ -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)]
///
/// 生产工单
///
- public string Order_No;
+ public string Order_No { get; set; }
///
/// 配料开始
///
- public bool Dosing_Start;
+ public bool Dosing_Start { get; set; }
///
/// 配料开始确认
///
public bool Dosing_Confirm;
- ///
- /// 托盘占位情况
- ///
- public bool[] Pallet_Position_Occ = new bool[16];
- ///
- /// 工位允许放货架
- ///
- public bool[] Allow_AGV_Put = new bool[16];
- ///
- /// 工位允许取货架
- ///
- public bool[] Allow_AGV_Get = new bool[16];
- ///
- /// AGV请求放货架
- ///
- public bool[] AGV_Request_Put = new bool[16];
- ///
- /// AGV请求取货架
- ///
- public bool[] AGV_Request_Get = new bool[16];
- ///
- /// AGV放托盘完成
- ///
- public bool[] AGV_Put_Done = new bool[16];
- ///
- /// 托盘号
- ///
- public short[] Pan_No = new short[16];
- ///
- /// 配料时间
- ///
- public int DosingTime;
- ///
- /// 备用
- ///
- 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; }
}
}