@@ -3,5 +3,7 @@ | |||||
<appSettings> | <appSettings> | ||||
<add key="HKPlc_IP" value="107.107.2.17"/> | <add key="HKPlc_IP" value="107.107.2.17"/> | ||||
<add key="Siemens_IP" value="107.107.2.200"/> | <add key="Siemens_IP" value="107.107.2.200"/> | ||||
<add key="HKPlc_Connect" value="false"/> | |||||
<add key="Siemens_Connect" value="false"/> | |||||
</appSettings> | </appSettings> | ||||
</configuration> | </configuration> |
@@ -13,6 +13,7 @@ using BPASmartClient.CustomResource.Pages.View; | |||||
using BPASmartClient.CustomResource.Pages.ViewModel; | using BPASmartClient.CustomResource.Pages.ViewModel; | ||||
using BPASmartClient.Helper; | using BPASmartClient.Helper; | ||||
using BPASmartClient.JXJFoodBigStation.Model; | using BPASmartClient.JXJFoodBigStation.Model; | ||||
using BPASmartClient.JXJFoodBigStation.Model.Siemens; | |||||
namespace BPASmartClient.JXJFoodBigStation | namespace BPASmartClient.JXJFoodBigStation | ||||
{ | { | ||||
@@ -53,6 +54,9 @@ namespace BPASmartClient.JXJFoodBigStation | |||||
protected override void OnExit(ExitEventArgs e) | protected override void OnExit(ExitEventArgs e) | ||||
{ | { | ||||
Json<LocalRecipe>.Save(); | |||||
Json<RemoteRecipe>.Save(); | |||||
Json<RawMaterialData>.Save(); | |||||
base.OnExit(e); | base.OnExit(e); | ||||
MessageNotify.GetInstance.LogSave(); | MessageNotify.GetInstance.LogSave(); | ||||
ThreadManage.GetInstance().Dispose(); | ThreadManage.GetInstance().Dispose(); | ||||
@@ -217,6 +221,8 @@ namespace BPASmartClient.JXJFoodBigStation | |||||
//Config.GetInstance.Init(); | //Config.GetInstance.Init(); | ||||
//Json<LocaPar>.Read(); | //Json<LocaPar>.Read(); | ||||
Json<LocalRecipe>.Read(); | Json<LocalRecipe>.Read(); | ||||
Json<RemoteRecipe>.Read(); | |||||
Json<RawMaterialData>.Read(); | |||||
} | } | ||||
} | } | ||||
@@ -5,6 +5,7 @@ | |||||
<TargetFramework>net6.0-windows</TargetFramework> | <TargetFramework>net6.0-windows</TargetFramework> | ||||
<Nullable>enable</Nullable> | <Nullable>enable</Nullable> | ||||
<UseWPF>true</UseWPF> | <UseWPF>true</UseWPF> | ||||
<ApplicationIcon>hbl.ico</ApplicationIcon> | |||||
</PropertyGroup> | </PropertyGroup> | ||||
<ItemGroup> | <ItemGroup> | ||||
@@ -16,8 +16,13 @@ namespace BPASmartClient.JXJFoodBigStation.Model | |||||
/// plc心跳上传 | /// plc心跳上传 | ||||
/// </summary> | /// </summary> | ||||
public static bool HeartBeatFromPlc { get; set; } | public static bool HeartBeatFromPlc { get; set; } | ||||
public static bool Order_Cancel { get; set; } | |||||
public static DateTime DosingTime { get; set; } | |||||
public static string Order_CancelRecipeCode { get; set; } = ""; | |||||
public static DateTime DosingRecipe1Time { get; set; } | |||||
public static DateTime DosingRecipe2Time { get; set; } | |||||
public static DateTime DosingRecipe3Time { get; set; } | |||||
public static DateTime DosingRecipe4Time { get; set; } | |||||
/// <summary> | /// <summary> | ||||
/// plc心跳下发 | /// plc心跳下发 | ||||
/// </summary> | /// </summary> | ||||
@@ -58,5 +63,29 @@ namespace BPASmartClient.JXJFoodBigStation.Model | |||||
public static DB_Read HKPlc_Read = new DB_Read(); | public static DB_Read HKPlc_Read = new DB_Read(); | ||||
public static bool IsUseLocalName { get; set; } = true; | public static bool IsUseLocalName { get; set; } = true; | ||||
public static bool IsAllowHKPlcConnect { get; set; } | |||||
public static bool IsAllowSiemensConnect { get; set; } | |||||
/// <summary> | |||||
/// 海科plc初始化完成标志 | |||||
/// </summary> | |||||
public static bool HKPlcInitComple { get; set; } | |||||
/// <summary> | |||||
/// 西门子plc初始化完成标志 | |||||
/// </summary> | |||||
public static bool SiemensInitComple { get; set; } | |||||
/// <summary> | |||||
/// | |||||
/// </summary> | |||||
public static bool Recipe1DosingFinish { get; set; } = false; | |||||
public static bool Recipe2DosingFinish { get; set; } = false; | |||||
public static bool Recipe3DosingFinish { get; set; } = false; | |||||
public static bool Recipe4DosingFinish { get; set; } = false; | |||||
/// <summary> | |||||
/// 订单是否是洗桶 | |||||
/// </summary> | |||||
public static bool Order_IsWashingBarrel { get; set; } = false; | |||||
} | } | ||||
} | } |
@@ -1,4 +1,5 @@ | |||||
using System; | |||||
using BPASmartClient.S7Net; | |||||
using System; | |||||
using System.Collections.Generic; | using System.Collections.Generic; | ||||
using System.Linq; | using System.Linq; | ||||
using System.Text; | using System.Text; | ||||
@@ -123,5 +124,7 @@ namespace BPASmartClient.JXJFoodBigStation.Model.HK_PLC | |||||
public float Bareel5Bin12SetWeight { get; set; } | public float Bareel5Bin12SetWeight { get; set; } | ||||
public float Bareel5Bin13SetWeight { get; set; } | public float Bareel5Bin13SetWeight { get; set; } | ||||
public float Bareel5Bin14SetWeight { get; set; } | public float Bareel5Bin14SetWeight { get; set; } | ||||
public bool OrderCancel_Sign { get; set; } | |||||
public short OrderCancel_TrayCode { get; set; } | |||||
} | } | ||||
} | } |
@@ -21,8 +21,14 @@ namespace BPASmartClient.JXJFoodBigStation.Model.HK_PLC | |||||
public StockBinName StockBinName = new StockBinName(); | public StockBinName StockBinName = new StockBinName(); | ||||
public void Init() | public void Init() | ||||
{ | { | ||||
DB_Write PlcWrite = new DB_Write(); | |||||
HK_PLC_S7.WriteClass<DB_Write>(PlcWrite, 99); | |||||
try | |||||
{ | |||||
DB_Write PlcWrite = new DB_Write(); | |||||
HK_PLC_S7.WriteClass<DB_Write>(PlcWrite, 99); | |||||
} | |||||
catch (Exception ex) { | |||||
MessageNotify.GetInstance.ShowRunLog("DB99块初始化值 失败"); | |||||
} | |||||
ThreadManage.GetInstance().StartLong(new Action(() => | ThreadManage.GetInstance().StartLong(new Action(() => | ||||
{ | { | ||||
if (IsConnected) | if (IsConnected) | ||||
@@ -45,7 +51,7 @@ namespace BPASmartClient.JXJFoodBigStation.Model.HK_PLC | |||||
} | } | ||||
} | } | ||||
Thread.Sleep(10); | Thread.Sleep(10); | ||||
}),"信号收发处理",true); | |||||
}),"海科数据交互",true); | |||||
} | } | ||||
/// <summary> | /// <summary> | ||||
/// 下发配方数据 | /// 下发配方数据 | ||||
@@ -47,7 +47,7 @@ namespace BPASmartClient.JXJFoodBigStation.Model | |||||
/// 原料的名称和料仓的位置对应 | /// 原料的名称和料仓的位置对应 | ||||
/// </summary> | /// </summary> | ||||
public Dictionary<string, short> RawMaterialsNamePos = new Dictionary<string, short>(); | public Dictionary<string, short> RawMaterialsNamePos = new Dictionary<string, short>(); | ||||
public ObservableCollection<RawMaterial> RawMaterialsInfo = new ObservableCollection<RawMaterial>(); | |||||
public ObservableCollection<RawMaterial> RawMaterialsInfo => Json<RawMaterialData>.Data.RawMaterial; | |||||
/// <summary> | /// <summary> | ||||
/// 西门子配方队列 | /// 西门子配方队列 | ||||
/// </summary> | /// </summary> | ||||
@@ -99,6 +99,7 @@ namespace BPASmartClient.JXJFoodBigStation.Model | |||||
RecipeCode = recipe.RecipeCode, | RecipeCode = recipe.RecipeCode, | ||||
RawMaterial = RawMaterials, | RawMaterial = RawMaterials, | ||||
TrayCode = recipe.Job_No, | TrayCode = recipe.Job_No, | ||||
IsWashingBarrel = recipe.Order_Type | |||||
}); | }); | ||||
}); | }); | ||||
} | } | ||||
@@ -106,33 +107,56 @@ namespace BPASmartClient.JXJFoodBigStation.Model | |||||
}), "SiemensSendRecipe", true); | }), "SiemensSendRecipe", true); | ||||
string HK_PLC_IP = ConfigurationManager.AppSettings["HKPlc_IP"]; | string HK_PLC_IP = ConfigurationManager.AppSettings["HKPlc_IP"]; | ||||
string Siemens_PLC_IP = ConfigurationManager.AppSettings["Siemens_IP"]; | string Siemens_PLC_IP = ConfigurationManager.AppSettings["Siemens_IP"]; | ||||
GVL_BigStation.IsAllowHKPlcConnect = ConfigurationManager.AppSettings["HKPlc_Connect"].ToLower() == "true" ? true : false; | |||||
GVL_BigStation.IsAllowSiemensConnect = ConfigurationManager.AppSettings["Siemens_Connect"].ToLower() == "true" ? true : false; | |||||
try | try | ||||
{ | { | ||||
HKDevice.HK_PLC_S7.Connect(S7.Net.CpuType.S71500, HK_PLC_IP); | |||||
SiemensDevice.Siemens_PLC_S7.Connect(S7.Net.CpuType.S71500, Siemens_PLC_IP); | |||||
if (HKDevice.IsConnected) | |||||
if (GVL_BigStation.IsAllowHKPlcConnect) | |||||
{ | |||||
HKDevice.HK_PLC_S7.Connect(S7.Net.CpuType.S71500, HK_PLC_IP); | |||||
} | |||||
} | |||||
catch (Exception ex) | |||||
{ | |||||
MessageNotify.GetInstance.ShowAlarmLog("海科plc连接失败,等待重新连接"); | |||||
} | |||||
finally | |||||
{ | |||||
HKDevice.Init(); | |||||
MessageNotify.GetInstance.ShowRunLog("海科plc初始化"); | |||||
if (HKDevice.IsConnected && GVL_BigStation.IsAllowHKPlcConnect) | |||||
{ | { | ||||
HKDevice.Init(); | |||||
MessageNotify.GetInstance.ShowRunLog("海科plc连接成功"); | MessageNotify.GetInstance.ShowRunLog("海科plc连接成功"); | ||||
} | } | ||||
if (SiemensDevice.IsConnected) | |||||
} | |||||
try | |||||
{ | |||||
if (GVL_BigStation.IsAllowSiemensConnect) | |||||
{ | { | ||||
SiemensDevice.Init(); | |||||
MessageNotify.GetInstance.ShowRunLog("西门子plc连接成功"); | |||||
SiemensDevice.Siemens_PLC_S7.Connect(S7.Net.CpuType.S71500, Siemens_PLC_IP); | |||||
} | } | ||||
} | } | ||||
catch (Exception ex) | catch (Exception ex) | ||||
{ | { | ||||
MessageNotify.GetInstance.ShowAlarmLog("西门子plc连接失败,等待重新连接"); | |||||
} | |||||
finally | |||||
{ | |||||
SiemensDevice.Init(); | |||||
MessageNotify.GetInstance.ShowRunLog("西门子plc初始化"); | |||||
if (SiemensDevice.IsConnected && GVL_BigStation.IsAllowSiemensConnect) | |||||
{ | |||||
MessageNotify.GetInstance.ShowRunLog("西门子plc连接成功"); | |||||
} | |||||
} | } | ||||
ThreadManage.GetInstance().StartLong(new Action(() => | ThreadManage.GetInstance().StartLong(new Action(() => | ||||
{ | { | ||||
if (!HKDevice.IsConnected) | |||||
if (!HKDevice.IsConnected && GVL_BigStation.IsAllowHKPlcConnect) | |||||
{ | { | ||||
HKDevice.HK_PLC_S7.Connect(S7.Net.CpuType.S71500, HK_PLC_IP); | HKDevice.HK_PLC_S7.Connect(S7.Net.CpuType.S71500, HK_PLC_IP); | ||||
MessageNotify.GetInstance.ShowRunLog("海科plc重新连接成功"); | MessageNotify.GetInstance.ShowRunLog("海科plc重新连接成功"); | ||||
} | } | ||||
if (!SiemensDevice.IsConnected) | |||||
if (!SiemensDevice.IsConnected && GVL_BigStation.IsAllowSiemensConnect) | |||||
{ | { | ||||
SiemensDevice.Siemens_PLC_S7.Connect(S7.Net.CpuType.S71500, Siemens_PLC_IP); | SiemensDevice.Siemens_PLC_S7.Connect(S7.Net.CpuType.S71500, Siemens_PLC_IP); | ||||
MessageNotify.GetInstance.ShowRunLog("西门子plc重新连接"); | MessageNotify.GetInstance.ShowRunLog("西门子plc重新连接"); | ||||
@@ -203,10 +227,10 @@ namespace BPASmartClient.JXJFoodBigStation.Model | |||||
GVL_BigStation.AGVGetTray = SiemensDevice.DL_Status.AGV_Get_Done; | GVL_BigStation.AGVGetTray = SiemensDevice.DL_Status.AGV_Get_Done; | ||||
SiemensDevice.Siemens_PLC_S7.Write("DB2331.DBW30", GVL_BigStation.TraySensor); | SiemensDevice.Siemens_PLC_S7.Write("DB2331.DBW30", GVL_BigStation.TraySensor); | ||||
SiemensDevice.Siemens_PLC_S7.Write("DB2331.DBW32", GVL_BigStation.TrayCylinder); | SiemensDevice.Siemens_PLC_S7.Write("DB2331.DBW32", GVL_BigStation.TrayCylinder); | ||||
SiemensDevice.Siemens_PLC_S7.Write("DB2331.DBW34", (ushort)13); | |||||
SiemensDevice.Siemens_PLC_S7.Write("DB2331.DBW34", (ushort)15); | |||||
} | } | ||||
Thread.Sleep(10); | Thread.Sleep(10); | ||||
}),"设备连接",true); | |||||
}),"海科plc和西门子数据交互",true); | |||||
LocalRecipeQueue1.Clear(); | LocalRecipeQueue1.Clear(); | ||||
LocalRecipeQueue2.Clear(); | LocalRecipeQueue2.Clear(); | ||||
LocalRecipeQueue3.Clear(); | LocalRecipeQueue3.Clear(); | ||||
@@ -217,6 +241,7 @@ namespace BPASmartClient.JXJFoodBigStation.Model | |||||
SiemensRecipeQueue4.Clear(); | SiemensRecipeQueue4.Clear(); | ||||
ThreadManage.GetInstance().StartLong(new Action(() => | ThreadManage.GetInstance().StartLong(new Action(() => | ||||
{ | { | ||||
testRawMaterialNameData();//自定义料仓名称 | |||||
if (GVL_BigStation.IsUseLocalRecipe) | if (GVL_BigStation.IsUseLocalRecipe) | ||||
{ | { | ||||
LocalRecipeRecevice(); | LocalRecipeRecevice(); | ||||
@@ -228,7 +253,7 @@ namespace BPASmartClient.JXJFoodBigStation.Model | |||||
RecipeInfoToHKPLC(); | RecipeInfoToHKPLC(); | ||||
} | } | ||||
Thread.Sleep(10); | Thread.Sleep(10); | ||||
}), "西门子配方执行流程", true); | |||||
}), "配方数据执行流程", true); | |||||
} | } | ||||
private void LocalRecipeRecevice() | private void LocalRecipeRecevice() | ||||
{ | { | ||||
@@ -292,18 +317,23 @@ namespace BPASmartClient.JXJFoodBigStation.Model | |||||
{ | { | ||||
case 1: | case 1: | ||||
Inplace = HKDevice.PlcRead.Tray1InPlace; | Inplace = HKDevice.PlcRead.Tray1InPlace; | ||||
HKDevice.HK_PLC_S7.Write("DB99.DBX0.7", GVL_BigStation.AGVPutTray.GetBitValue(1)); | |||||
break; | break; | ||||
case 2: | case 2: | ||||
Inplace = HKDevice.PlcRead.Tray2InPlace; | Inplace = HKDevice.PlcRead.Tray2InPlace; | ||||
HKDevice.HK_PLC_S7.Write("DB99.DBX1.0", GVL_BigStation.AGVPutTray.GetBitValue(2)); | |||||
break; | break; | ||||
case 3: | case 3: | ||||
Inplace = HKDevice.PlcRead.Tray3InPlace; | Inplace = HKDevice.PlcRead.Tray3InPlace; | ||||
HKDevice.HK_PLC_S7.Write("DB99.DBX1.1", GVL_BigStation.AGVPutTray.GetBitValue(3)); | |||||
break; | break; | ||||
case 4: | case 4: | ||||
Inplace = HKDevice.PlcRead.Tray4InPlace; | Inplace = HKDevice.PlcRead.Tray4InPlace; | ||||
HKDevice.HK_PLC_S7.Write("DB99.DBX1.2", GVL_BigStation.AGVPutTray.GetBitValue(4)); | |||||
break; | break; | ||||
case 5: | case 5: | ||||
Inplace = HKDevice.PlcRead.Tray5InPlace; | Inplace = HKDevice.PlcRead.Tray5InPlace; | ||||
HKDevice.HK_PLC_S7.Write("DB99.DBX1.3", GVL_BigStation.AGVPutTray.GetBitValue(5)); | |||||
break; | break; | ||||
default: | default: | ||||
break; | break; | ||||
@@ -427,18 +457,23 @@ namespace BPASmartClient.JXJFoodBigStation.Model | |||||
{ | { | ||||
case 1: | case 1: | ||||
Inplace = HKDevice.PlcRead.Tray1InPlace; | Inplace = HKDevice.PlcRead.Tray1InPlace; | ||||
HKDevice.HK_PLC_S7.Write("DB99.DBX0.7", GVL_BigStation.AGVPutTray.GetBitValue(1)); | |||||
break; | break; | ||||
case 2: | case 2: | ||||
Inplace = HKDevice.PlcRead.Tray2InPlace; | Inplace = HKDevice.PlcRead.Tray2InPlace; | ||||
HKDevice.HK_PLC_S7.Write("DB99.DBX1.0", GVL_BigStation.AGVPutTray.GetBitValue(2)); | |||||
break; | break; | ||||
case 3: | case 3: | ||||
Inplace = HKDevice.PlcRead.Tray3InPlace; | Inplace = HKDevice.PlcRead.Tray3InPlace; | ||||
HKDevice.HK_PLC_S7.Write("DB99.DBX1.1", GVL_BigStation.AGVPutTray.GetBitValue(3)); | |||||
break; | break; | ||||
case 4: | case 4: | ||||
Inplace = HKDevice.PlcRead.Tray4InPlace; | Inplace = HKDevice.PlcRead.Tray4InPlace; | ||||
HKDevice.HK_PLC_S7.Write("DB99.DBX1.2", GVL_BigStation.AGVPutTray.GetBitValue(4)); | |||||
break; | break; | ||||
case 5: | case 5: | ||||
Inplace = HKDevice.PlcRead.Tray5InPlace; | Inplace = HKDevice.PlcRead.Tray5InPlace; | ||||
HKDevice.HK_PLC_S7.Write("DB99.DBX1.3", GVL_BigStation.AGVPutTray.GetBitValue(5)); | |||||
break; | break; | ||||
default: | default: | ||||
break; | break; | ||||
@@ -459,6 +494,26 @@ namespace BPASmartClient.JXJFoodBigStation.Model | |||||
} | } | ||||
if (GVL_BigStation.Recipe2DosingStatus == 2 && HKDevice.PlcRead.Recipe2DosingFinish) | if (GVL_BigStation.Recipe2DosingStatus == 2 && HKDevice.PlcRead.Recipe2DosingFinish) | ||||
{ | { | ||||
switch (trayCode) | |||||
{ | |||||
case 1: | |||||
HKDevice.HK_PLC_S7.Write("DB99.DBX0.7", false); | |||||
break; | |||||
case 2: | |||||
HKDevice.HK_PLC_S7.Write("DB99.DBX1.0", false); | |||||
break; | |||||
case 3: | |||||
HKDevice.HK_PLC_S7.Write("DB99.DBX1.1", false); | |||||
break; | |||||
case 4: | |||||
HKDevice.HK_PLC_S7.Write("DB99.DBX1.2", false); | |||||
break; | |||||
case 5: | |||||
HKDevice.HK_PLC_S7.Write("DB99.DBX1.3", false); | |||||
break; | |||||
default: | |||||
break; | |||||
} | |||||
GVL_BigStation.Recipe2DosingStatus = 3; | GVL_BigStation.Recipe2DosingStatus = 3; | ||||
MessageNotify.GetInstance.ShowRunLog($"配方状态:{code}配料完成"); | MessageNotify.GetInstance.ShowRunLog($"配方状态:{code}配料完成"); | ||||
foreach (var item in LocalRecipes.ElementAt(index).RawMaterial) | foreach (var item in LocalRecipes.ElementAt(index).RawMaterial) | ||||
@@ -579,6 +634,26 @@ namespace BPASmartClient.JXJFoodBigStation.Model | |||||
} | } | ||||
if (HKDevice.PlcRead.Recipe3DosingFinish && GVL_BigStation.Recipe3DosingStatus == 2) | if (HKDevice.PlcRead.Recipe3DosingFinish && GVL_BigStation.Recipe3DosingStatus == 2) | ||||
{ | { | ||||
switch (trayCode) | |||||
{ | |||||
case 1: | |||||
HKDevice.HK_PLC_S7.Write("DB99.DBX0.7", false); | |||||
break; | |||||
case 2: | |||||
HKDevice.HK_PLC_S7.Write("DB99.DBX1.0", false); | |||||
break; | |||||
case 3: | |||||
HKDevice.HK_PLC_S7.Write("DB99.DBX1.1", false); | |||||
break; | |||||
case 4: | |||||
HKDevice.HK_PLC_S7.Write("DB99.DBX1.2", false); | |||||
break; | |||||
case 5: | |||||
HKDevice.HK_PLC_S7.Write("DB99.DBX1.3", false); | |||||
break; | |||||
default: | |||||
break; | |||||
} | |||||
GVL_BigStation.Recipe3DosingStatus = 3; | GVL_BigStation.Recipe3DosingStatus = 3; | ||||
MessageNotify.GetInstance.ShowRunLog($"配方状态:{code}配料完成"); | MessageNotify.GetInstance.ShowRunLog($"配方状态:{code}配料完成"); | ||||
foreach (var item in LocalRecipes.ElementAt(index).RawMaterial) | foreach (var item in LocalRecipes.ElementAt(index).RawMaterial) | ||||
@@ -700,6 +775,26 @@ namespace BPASmartClient.JXJFoodBigStation.Model | |||||
} | } | ||||
if (GVL_BigStation.Recipe4DosingStatus == 2 && HKDevice.PlcRead.Recipe4DosingFinish) | if (GVL_BigStation.Recipe4DosingStatus == 2 && HKDevice.PlcRead.Recipe4DosingFinish) | ||||
{ | { | ||||
switch (trayCode) | |||||
{ | |||||
case 1: | |||||
HKDevice.HK_PLC_S7.Write("DB99.DBX0.7", false); | |||||
break; | |||||
case 2: | |||||
HKDevice.HK_PLC_S7.Write("DB99.DBX1.0", false); | |||||
break; | |||||
case 3: | |||||
HKDevice.HK_PLC_S7.Write("DB99.DBX1.1", false); | |||||
break; | |||||
case 4: | |||||
HKDevice.HK_PLC_S7.Write("DB99.DBX1.2", false); | |||||
break; | |||||
case 5: | |||||
HKDevice.HK_PLC_S7.Write("DB99.DBX1.3", false); | |||||
break; | |||||
default: | |||||
break; | |||||
} | |||||
GVL_BigStation.Recipe4DosingStatus = 3; | GVL_BigStation.Recipe4DosingStatus = 3; | ||||
MessageNotify.GetInstance.ShowRunLog($"配方状态:{code}配料完成"); | MessageNotify.GetInstance.ShowRunLog($"配方状态:{code}配料完成"); | ||||
foreach (var item in LocalRecipes.ElementAt(index).RawMaterial) | foreach (var item in LocalRecipes.ElementAt(index).RawMaterial) | ||||
@@ -788,25 +883,28 @@ namespace BPASmartClient.JXJFoodBigStation.Model | |||||
{ | { | ||||
if (GVL_BigStation.SiemensSendRecipeStatus == 3) | if (GVL_BigStation.SiemensSendRecipeStatus == 3) | ||||
{ | { | ||||
GVL_BigStation.SiemensSendRecipeStatus = 4; | |||||
SiemensDevice.Siemens_PLC_S7.WriteString(2331, data.RecipeCode, 10); | SiemensDevice.Siemens_PLC_S7.WriteString(2331, data.RecipeCode, 10); | ||||
SiemensDevice.Siemens_PLC_S7.Write("DB2331.DBX28.0", true); | SiemensDevice.Siemens_PLC_S7.Write("DB2331.DBX28.0", true); | ||||
MessageNotify.GetInstance.ShowRunLog($"配方1,发送配方编号和请求配料标志给西门子"); | |||||
GVL_BigStation.SiemensSendRecipeStatus = 4; | |||||
} | } | ||||
if (GVL_BigStation.SiemensSendRecipeStatus == 4) | if (GVL_BigStation.SiemensSendRecipeStatus == 4) | ||||
{ | { | ||||
if (SiemensDevice.DL_Status.Dosing_Start_ACK) | if (SiemensDevice.DL_Status.Dosing_Start_ACK) | ||||
{ | { | ||||
GVL_BigStation.SiemensSendRecipeStatus = 5; | |||||
SiemensDevice.Siemens_PLC_S7.WriteString(2331, "", 10); | SiemensDevice.Siemens_PLC_S7.WriteString(2331, "", 10); | ||||
SiemensDevice.Siemens_PLC_S7.Write("DB2331.DBX28.0", false); | SiemensDevice.Siemens_PLC_S7.Write("DB2331.DBX28.0", false); | ||||
MessageNotify.GetInstance.ShowRunLog($"配方1,西门子确认开始配料"); | |||||
GVL_BigStation.SiemensSendRecipeStatus = 5; | |||||
} | } | ||||
} | } | ||||
if (GVL_BigStation.SiemensSendRecipeStatus == 5) | if (GVL_BigStation.SiemensSendRecipeStatus == 5) | ||||
{ | { | ||||
if (SiemensDevice.DL_Status.Dosing_Start_ACK == false) | if (SiemensDevice.DL_Status.Dosing_Start_ACK == false) | ||||
{ | { | ||||
GVL_BigStation.SiemensSendRecipeStatus = 6; | |||||
SiemensRecipeQueue1.Enqueue(data.RecipeCode); | SiemensRecipeQueue1.Enqueue(data.RecipeCode); | ||||
MessageNotify.GetInstance.ShowRunLog($"配方1,配方:{data.RecipeCode},加入队列"); | |||||
GVL_BigStation.SiemensSendRecipeStatus = 0; | |||||
} | } | ||||
} | } | ||||
} | } | ||||
@@ -820,25 +918,28 @@ namespace BPASmartClient.JXJFoodBigStation.Model | |||||
{ | { | ||||
if (GVL_BigStation.SiemensSendRecipeStatus == 3) | if (GVL_BigStation.SiemensSendRecipeStatus == 3) | ||||
{ | { | ||||
GVL_BigStation.SiemensSendRecipeStatus = 4; | |||||
SiemensDevice.Siemens_PLC_S7.WriteString(2331, data.RecipeCode, 10); | SiemensDevice.Siemens_PLC_S7.WriteString(2331, data.RecipeCode, 10); | ||||
SiemensDevice.Siemens_PLC_S7.Write("DB2331.DBX28.0", true); | SiemensDevice.Siemens_PLC_S7.Write("DB2331.DBX28.0", true); | ||||
MessageNotify.GetInstance.ShowRunLog($"配方2,发送配方编号和请求配料标志给西门子"); | |||||
GVL_BigStation.SiemensSendRecipeStatus = 4; | |||||
} | } | ||||
if (GVL_BigStation.SiemensSendRecipeStatus == 4) | if (GVL_BigStation.SiemensSendRecipeStatus == 4) | ||||
{ | { | ||||
if (SiemensDevice.DL_Status.Dosing_Start_ACK) | if (SiemensDevice.DL_Status.Dosing_Start_ACK) | ||||
{ | { | ||||
GVL_BigStation.SiemensSendRecipeStatus = 5; | |||||
SiemensDevice.Siemens_PLC_S7.WriteString(2331, "", 10); | SiemensDevice.Siemens_PLC_S7.WriteString(2331, "", 10); | ||||
SiemensDevice.Siemens_PLC_S7.Write("DB3231.DBX28.0", false); | |||||
SiemensDevice.Siemens_PLC_S7.Write("DB2331.DBX28.0", false); | |||||
MessageNotify.GetInstance.ShowRunLog($"配方2,西门子确认开始配料"); | |||||
GVL_BigStation.SiemensSendRecipeStatus = 5; | |||||
} | } | ||||
} | } | ||||
if (GVL_BigStation.SiemensSendRecipeStatus == 5) | if (GVL_BigStation.SiemensSendRecipeStatus == 5) | ||||
{ | { | ||||
if (SiemensDevice.DL_Status.Dosing_Start_ACK == false) | if (SiemensDevice.DL_Status.Dosing_Start_ACK == false) | ||||
{ | { | ||||
GVL_BigStation.SiemensSendRecipeStatus = 6; | |||||
SiemensRecipeQueue2.Enqueue(data.RecipeCode); | SiemensRecipeQueue2.Enqueue(data.RecipeCode); | ||||
MessageNotify.GetInstance.ShowRunLog($"配方2,配方:{data.RecipeCode},加入队列"); | |||||
GVL_BigStation.SiemensSendRecipeStatus = 0; | |||||
} | } | ||||
} | } | ||||
} | } | ||||
@@ -852,25 +953,28 @@ namespace BPASmartClient.JXJFoodBigStation.Model | |||||
{ | { | ||||
if (GVL_BigStation.SiemensSendRecipeStatus == 3) | if (GVL_BigStation.SiemensSendRecipeStatus == 3) | ||||
{ | { | ||||
GVL_BigStation.SiemensSendRecipeStatus = 4; | |||||
SiemensDevice.Siemens_PLC_S7.WriteString(2331, data.RecipeCode, 10); | SiemensDevice.Siemens_PLC_S7.WriteString(2331, data.RecipeCode, 10); | ||||
SiemensDevice.Siemens_PLC_S7.Write("DB2331.DBX28.0", true); | SiemensDevice.Siemens_PLC_S7.Write("DB2331.DBX28.0", true); | ||||
MessageNotify.GetInstance.ShowRunLog($"配方3,发送配方编号和请求配料标志给西门子"); | |||||
GVL_BigStation.SiemensSendRecipeStatus = 4; | |||||
} | } | ||||
if (GVL_BigStation.SiemensSendRecipeStatus == 4) | if (GVL_BigStation.SiemensSendRecipeStatus == 4) | ||||
{ | { | ||||
if (SiemensDevice.DL_Status.Dosing_Start_ACK) | if (SiemensDevice.DL_Status.Dosing_Start_ACK) | ||||
{ | { | ||||
GVL_BigStation.SiemensSendRecipeStatus = 5; | |||||
SiemensDevice.Siemens_PLC_S7.WriteString(2331, "", 10); | SiemensDevice.Siemens_PLC_S7.WriteString(2331, "", 10); | ||||
SiemensDevice.Siemens_PLC_S7.Write("DB3231.DBX28.0", false); | |||||
SiemensDevice.Siemens_PLC_S7.Write("DB2331.DBX28.0", false); | |||||
MessageNotify.GetInstance.ShowRunLog($"配方3,西门子确认开始配料"); | |||||
GVL_BigStation.SiemensSendRecipeStatus = 5; | |||||
} | } | ||||
} | } | ||||
if (GVL_BigStation.SiemensSendRecipeStatus == 5) | if (GVL_BigStation.SiemensSendRecipeStatus == 5) | ||||
{ | { | ||||
if (SiemensDevice.DL_Status.Dosing_Start_ACK == false) | if (SiemensDevice.DL_Status.Dosing_Start_ACK == false) | ||||
{ | { | ||||
GVL_BigStation.SiemensSendRecipeStatus = 6; | |||||
SiemensRecipeQueue3.Enqueue(data.RecipeCode); | SiemensRecipeQueue3.Enqueue(data.RecipeCode); | ||||
MessageNotify.GetInstance.ShowRunLog($"配方3,配方:{data.RecipeCode},加入队列"); | |||||
GVL_BigStation.SiemensSendRecipeStatus = 0; | |||||
} | } | ||||
} | } | ||||
} | } | ||||
@@ -884,25 +988,28 @@ namespace BPASmartClient.JXJFoodBigStation.Model | |||||
{ | { | ||||
if (GVL_BigStation.SiemensSendRecipeStatus == 3) | if (GVL_BigStation.SiemensSendRecipeStatus == 3) | ||||
{ | { | ||||
GVL_BigStation.SiemensSendRecipeStatus = 4; | |||||
SiemensDevice.Siemens_PLC_S7.WriteString(2331, data.RecipeCode, 10); | SiemensDevice.Siemens_PLC_S7.WriteString(2331, data.RecipeCode, 10); | ||||
SiemensDevice.Siemens_PLC_S7.Write("DB2331.DBX28.0", true); | SiemensDevice.Siemens_PLC_S7.Write("DB2331.DBX28.0", true); | ||||
MessageNotify.GetInstance.ShowRunLog($"配方4,发送配方编号和请求配料标志给西门子"); | |||||
GVL_BigStation.SiemensSendRecipeStatus = 4; | |||||
} | } | ||||
if (GVL_BigStation.SiemensSendRecipeStatus == 4) | if (GVL_BigStation.SiemensSendRecipeStatus == 4) | ||||
{ | { | ||||
if (SiemensDevice.DL_Status.Dosing_Start_ACK) | if (SiemensDevice.DL_Status.Dosing_Start_ACK) | ||||
{ | { | ||||
GVL_BigStation.SiemensSendRecipeStatus = 5; | |||||
SiemensDevice.Siemens_PLC_S7.WriteString(2331, "", 10); | SiemensDevice.Siemens_PLC_S7.WriteString(2331, "", 10); | ||||
SiemensDevice.Siemens_PLC_S7.Write("DB3231.DBX28.0", false); | |||||
SiemensDevice.Siemens_PLC_S7.Write("DB2331.DBX28.0", false); | |||||
MessageNotify.GetInstance.ShowRunLog($"配方4,西门子确认开始配料"); | |||||
GVL_BigStation.SiemensSendRecipeStatus = 5; | |||||
} | } | ||||
} | } | ||||
if (GVL_BigStation.SiemensSendRecipeStatus == 5) | if (GVL_BigStation.SiemensSendRecipeStatus == 5) | ||||
{ | { | ||||
if (SiemensDevice.DL_Status.Dosing_Start_ACK == false) | if (SiemensDevice.DL_Status.Dosing_Start_ACK == false) | ||||
{ | { | ||||
GVL_BigStation.SiemensSendRecipeStatus = 6; | |||||
SiemensRecipeQueue4.Enqueue(data.RecipeCode); | SiemensRecipeQueue4.Enqueue(data.RecipeCode); | ||||
MessageNotify.GetInstance.ShowRunLog($"配方4,配方:{data.RecipeCode},加入队列"); | |||||
GVL_BigStation.SiemensSendRecipeStatus = 0; | |||||
} | } | ||||
} | } | ||||
} | } | ||||
@@ -921,6 +1028,144 @@ namespace BPASmartClient.JXJFoodBigStation.Model | |||||
GVL_BigStation.Recipe3DosingStatus = 0; | GVL_BigStation.Recipe3DosingStatus = 0; | ||||
GVL_BigStation.Recipe4DosingStatus = 0; | GVL_BigStation.Recipe4DosingStatus = 0; | ||||
} | } | ||||
if (GVL_BigStation.Order_Cancel) //订单取消 | |||||
{ | |||||
if (!string.IsNullOrEmpty(GVL_BigStation.Order_CancelRecipeCode)) | |||||
{ | |||||
int index = Array.FindIndex(Json<RemoteRecipe>.Data.Recipes.ToArray(), p => p.RecipeCode == GVL_BigStation.Order_CancelRecipeCode); | |||||
if (index >= 0) | |||||
{ | |||||
string code = GVL_BigStation.Order_CancelRecipeCode; | |||||
short TrayCode = (short)Json<RemoteRecipe>.Data.Recipes.ElementAt(index).TrayCode; | |||||
if (SiemensRecipeQueue1.Contains(code) || SiemensRecipeQueue2.Contains(code) || SiemensRecipeQueue3.Contains(code) || SiemensRecipeQueue4.Contains(code)) | |||||
{ | |||||
if (SiemensRecipeQueue1.Contains(code)) | |||||
{ | |||||
App.Current.Dispatcher.Invoke(() => | |||||
{ | |||||
Json<RemoteRecipe>.Data.Recipes.RemoveAt(index); | |||||
}); | |||||
if (GVL_BigStation.Recipe1DosingStatus != 0) | |||||
{ | |||||
HKDevice.HK_PLC_S7.Write("DB99.DBX230.0", true); | |||||
HKDevice.HK_PLC_S7.Write("DB99.DBW232", (short)TrayCode); | |||||
MessageNotify.GetInstance.ShowRunLog($"PLC正在执行配料流程,取消订单:{code}"); | |||||
} | |||||
else | |||||
{ | |||||
MessageNotify.GetInstance.ShowRunLog($"AGV未到达工站前,未给plc下发配方,取消订单:{code}"); | |||||
} | |||||
GVL_BigStation.Recipe1DosingStatus = 0; | |||||
SiemensRecipeQueue1.TryDequeue(out code); | |||||
SiemensDevice.Siemens_PLC_S7.Write("DB2301.DBX320.2", false); | |||||
SiemensDevice.Siemens_PLC_S7.Write("DB2301.DBX330.1", true); | |||||
MessageNotify.GetInstance.ShowRunLog($"队列1,西门子取消订单完成,订单号:{code}"); | |||||
} | |||||
if (SiemensRecipeQueue2.Contains(code)) | |||||
{ | |||||
GVL_BigStation.Recipe2DosingStatus = 0; | |||||
App.Current.Dispatcher.Invoke(() => | |||||
{ | |||||
Json<RemoteRecipe>.Data.Recipes.RemoveAt(index); | |||||
}); | |||||
if (GVL_BigStation.Recipe2DosingStatus != 0) | |||||
{ | |||||
HKDevice.HK_PLC_S7.Write("DB99.DBX230.0", true); | |||||
HKDevice.HK_PLC_S7.Write("DB99.DBW232", (short)TrayCode); | |||||
MessageNotify.GetInstance.ShowRunLog($"PLC正在执行配料流程,取消订单:{code}"); | |||||
} | |||||
else | |||||
{ | |||||
MessageNotify.GetInstance.ShowRunLog($"AGV未到达工站前,未给plc下发配方,取消订单:{code}"); | |||||
} | |||||
GVL_BigStation.Recipe2DosingStatus = 0; | |||||
SiemensRecipeQueue2.TryDequeue(out code); | |||||
SiemensDevice.Siemens_PLC_S7.Write("DB2301.DBX320.2", false); | |||||
SiemensDevice.Siemens_PLC_S7.Write("DB2301.DBX330.1", true); | |||||
MessageNotify.GetInstance.ShowRunLog($"队列2,西门子取消订单完成,订单号:{code}"); | |||||
} | |||||
if (SiemensRecipeQueue3.Contains(code)) | |||||
{ | |||||
GVL_BigStation.Recipe3DosingStatus = 0; | |||||
App.Current.Dispatcher.Invoke(() => | |||||
{ | |||||
Json<RemoteRecipe>.Data.Recipes.RemoveAt(index); | |||||
}); | |||||
if (GVL_BigStation.Recipe3DosingStatus != 0) | |||||
{ | |||||
HKDevice.HK_PLC_S7.Write("DB99.DBX230.0", true); | |||||
HKDevice.HK_PLC_S7.Write("DB99.DBW232", (short)TrayCode); | |||||
MessageNotify.GetInstance.ShowRunLog($"PLC正在执行配料流程,取消订单:{code}"); | |||||
} | |||||
else | |||||
{ | |||||
MessageNotify.GetInstance.ShowRunLog($"AGV未到达工站前,未给plc下发配方,取消订单:{code}"); | |||||
} | |||||
GVL_BigStation.Recipe3DosingStatus = 0; | |||||
SiemensRecipeQueue3.TryDequeue(out code); | |||||
SiemensDevice.Siemens_PLC_S7.Write("DB2301.DBX320.2", false); | |||||
SiemensDevice.Siemens_PLC_S7.Write("DB2301.DBX330.1", true); | |||||
MessageNotify.GetInstance.ShowRunLog($"队列3,西门子取消订单完成,订单号:{code}"); | |||||
} | |||||
if (SiemensRecipeQueue4.Contains(code)) | |||||
{ | |||||
GVL_BigStation.Recipe4DosingStatus = 0; | |||||
App.Current.Dispatcher.Invoke(() => | |||||
{ | |||||
Json<RemoteRecipe>.Data.Recipes.RemoveAt(index); | |||||
}); | |||||
if (GVL_BigStation.Recipe4DosingStatus != 0) | |||||
{ | |||||
HKDevice.HK_PLC_S7.Write("DB99.DBX230.0", true); | |||||
HKDevice.HK_PLC_S7.Write("DB99.DBW232", (short)TrayCode); | |||||
MessageNotify.GetInstance.ShowRunLog($"PLC正在执行配料流程,取消订单:{code}"); | |||||
} | |||||
else | |||||
{ | |||||
MessageNotify.GetInstance.ShowRunLog($"AGV未到达工站前,未给plc下发配方,取消订单:{code}"); | |||||
} | |||||
GVL_BigStation.Recipe4DosingStatus = 0; | |||||
SiemensRecipeQueue4.TryDequeue(out code); | |||||
SiemensDevice.Siemens_PLC_S7.Write("DB2301.DBX320.2", false); | |||||
SiemensDevice.Siemens_PLC_S7.Write("DB2301.DBX330.1", true); | |||||
MessageNotify.GetInstance.ShowRunLog($"队列4,西门子取消订单完成,订单号:{code}"); | |||||
} | |||||
GVL_BigStation.Order_Cancel = false; | |||||
GVL_BigStation.Order_CancelRecipeCode = ""; | |||||
} | |||||
else | |||||
{ | |||||
if (GVL_BigStation.SiemensSendRecipeStatus != 0 || GVL_BigStation.SiemensSendRecipeStatus != 1) | |||||
{ | |||||
GVL_BigStation.SiemensSendRecipeStatus = 0; | |||||
App.Current.Dispatcher.Invoke(() => | |||||
{ | |||||
Json<RemoteRecipe>.Data.Recipes.RemoveAt(index); | |||||
}); | |||||
MessageNotify.GetInstance.ShowRunLog($"正在执行请求订单流程,配方还未到PLC,订单号:{GVL_BigStation.Order_CancelRecipeCode}"); | |||||
} | |||||
else | |||||
{ | |||||
MessageNotify.GetInstance.ShowRunLog($"订单取消异常,订单号:{GVL_BigStation.Order_CancelRecipeCode}"); | |||||
} | |||||
GVL_BigStation.Order_Cancel = false; | |||||
GVL_BigStation.Order_CancelRecipeCode = ""; | |||||
SiemensDevice.Siemens_PLC_S7.Write("DB2301.DBX320.2", false); | |||||
SiemensDevice.Siemens_PLC_S7.Write("DB2301.DBX330.1", true); | |||||
} | |||||
} | |||||
else | |||||
{ | |||||
GVL_BigStation.Order_Cancel = false; | |||||
GVL_BigStation.Order_CancelRecipeCode = ""; | |||||
SiemensDevice.Siemens_PLC_S7.Write("DB2301.DBX320.2", false); | |||||
SiemensDevice.Siemens_PLC_S7.Write("DB2301.DBX330.1", true); | |||||
MessageNotify.GetInstance.ShowRunLog($"西门子取消订单,但未找到订单:{GVL_BigStation.Order_CancelRecipeCode}"); | |||||
} | |||||
} | |||||
} | |||||
} | } | ||||
private void RecipeInfoToHKPLC() | private void RecipeInfoToHKPLC() | ||||
{ | { | ||||
@@ -954,21 +1199,27 @@ namespace BPASmartClient.JXJFoodBigStation.Model | |||||
} | } | ||||
if (HKDevice.PlcRead.IsAllowIssueRecipe1 && GVL_BigStation.Recipe1DosingStatus == 0 && Inplace)//配方1是否允许下发配发 | if (HKDevice.PlcRead.IsAllowIssueRecipe1 && GVL_BigStation.Recipe1DosingStatus == 0 && Inplace)//配方1是否允许下发配发 | ||||
{ | { | ||||
GVL_BigStation.DosingTime = DateTime.Now; | |||||
GVL_BigStation.DosingRecipe1Time = DateTime.Now; | |||||
HKDevice.StockBinPar(SiemensRecipes.ElementAt(index)); | HKDevice.StockBinPar(SiemensRecipes.ElementAt(index)); | ||||
if (SiemensRecipes.ElementAt(index).IsWashingBarrel) | |||||
{ | |||||
HKDevice.HK_PLC_S7.Write("DB99.DBX0.1", true);//洗桶 | |||||
MessageNotify.GetInstance.ShowRunLog($"配方编号:{code},托盘编号:{trayCode},订单类型为洗桶"); | |||||
} | |||||
HKDevice.HK_PLC_S7.Write("DB99.DBX0.3", true); | HKDevice.HK_PLC_S7.Write("DB99.DBX0.3", true); | ||||
GVL_BigStation.Recipe1DosingStatus = 1; | GVL_BigStation.Recipe1DosingStatus = 1; | ||||
MessageNotify.GetInstance.ShowRunLog($"配方编号:{code},托盘编号:{trayCode},下发完成"); | MessageNotify.GetInstance.ShowRunLog($"配方编号:{code},托盘编号:{trayCode},下发完成"); | ||||
} | } | ||||
if (HKDevice.PlcRead.ReceiveFinishRecipe1 && GVL_BigStation.Recipe1DosingStatus == 1) | if (HKDevice.PlcRead.ReceiveFinishRecipe1 && GVL_BigStation.Recipe1DosingStatus == 1) | ||||
{ | { | ||||
GVL_BigStation.Recipe1DosingStatus = 2; | |||||
HKDevice.HK_PLC_S7.Write("DB99.DBX0.3", false); | HKDevice.HK_PLC_S7.Write("DB99.DBX0.3", false); | ||||
StockBinParReset(); | StockBinParReset(); | ||||
MessageNotify.GetInstance.ShowRunLog($"配方编号:{code},托盘编号:{trayCode},PLC接收配方完成"); | MessageNotify.GetInstance.ShowRunLog($"配方编号:{code},托盘编号:{trayCode},PLC接收配方完成"); | ||||
GVL_BigStation.Recipe1DosingStatus = 2; | |||||
} | } | ||||
if (GVL_BigStation.Recipe1DosingStatus == 2 && HKDevice.PlcRead.Recipe1DosingFinish) | if (GVL_BigStation.Recipe1DosingStatus == 2 && HKDevice.PlcRead.Recipe1DosingFinish) | ||||
{ | { | ||||
GVL_BigStation.Recipe1DosingFinish = true; | |||||
GVL_BigStation.Recipe1DosingStatus = 3; | GVL_BigStation.Recipe1DosingStatus = 3; | ||||
MessageNotify.GetInstance.ShowRunLog($"配方状态:{code}配料完成"); | MessageNotify.GetInstance.ShowRunLog($"配方状态:{code}配料完成"); | ||||
foreach (var item in SiemensRecipes.ElementAt(index).RawMaterial) | foreach (var item in SiemensRecipes.ElementAt(index).RawMaterial) | ||||
@@ -1043,13 +1294,13 @@ namespace BPASmartClient.JXJFoodBigStation.Model | |||||
{ | { | ||||
FinishData.Material[i].Material_Name = SiemensRecipes.ElementAt(index).RawMaterial.ElementAt(i).RawMaterialName; | FinishData.Material[i].Material_Name = SiemensRecipes.ElementAt(index).RawMaterial.ElementAt(i).RawMaterialName; | ||||
FinishData.Material[i].Material_BarrelNum = (short)SiemensRecipes.ElementAt(index).RawMaterial.ElementAt(i).RawMaterialBarrelNum; | FinishData.Material[i].Material_BarrelNum = (short)SiemensRecipes.ElementAt(index).RawMaterial.ElementAt(i).RawMaterialBarrelNum; | ||||
FinishData.Material[i].Material_Laying_Off_Weight = SiemensRecipes.ElementAt(index).RawMaterial.ElementAt(i).Laying_Off_Weight; | |||||
FinishData.Material[i].Material_Laying_Off_Weight = Math.Abs(SiemensRecipes.ElementAt(index).RawMaterial.ElementAt(i).Laying_Off_Weight); | |||||
} | } | ||||
FinishData.Ask_For_Finish = true; | FinishData.Ask_For_Finish = true; | ||||
GVL_BigStation.SiemensSendRecipeStatus = 7; | |||||
double a = DateTime.Now.Subtract(GVL_BigStation.DosingTime).TotalSeconds; | |||||
double a = DateTime.Now.Subtract(GVL_BigStation.DosingRecipe1Time).TotalSeconds; | |||||
FinishData.ProcessTime = Convert.ToInt16(a); | FinishData.ProcessTime = Convert.ToInt16(a); | ||||
SiemensDevice.Siemens_PLC_S7.WriteClass<DL_Finish_DB>(FinishData, 2361); | SiemensDevice.Siemens_PLC_S7.WriteClass<DL_Finish_DB>(FinishData, 2361); | ||||
MessageNotify.GetInstance.ShowRunLog($"配方配料完成,将信号反馈给西门子"); | |||||
} | } | ||||
SiemensRecipeQueue1.TryDequeue(out code); | SiemensRecipeQueue1.TryDequeue(out code); | ||||
RecipeExecuteComple.Add(SiemensRecipes.ElementAt(index));//将配方添加到完成列表 | RecipeExecuteComple.Add(SiemensRecipes.ElementAt(index));//将配方添加到完成列表 | ||||
@@ -1101,20 +1352,27 @@ namespace BPASmartClient.JXJFoodBigStation.Model | |||||
} | } | ||||
if (HKDevice.PlcRead.IsAllowIssueRecipe2 && GVL_BigStation.Recipe2DosingStatus == 0 && Inplace)//配方2是否允许下发配发 | if (HKDevice.PlcRead.IsAllowIssueRecipe2 && GVL_BigStation.Recipe2DosingStatus == 0 && Inplace)//配方2是否允许下发配发 | ||||
{ | { | ||||
GVL_BigStation.DosingRecipe2Time = DateTime.Now; | |||||
HKDevice.StockBinPar(SiemensRecipes.ElementAt(index)); | HKDevice.StockBinPar(SiemensRecipes.ElementAt(index)); | ||||
if (SiemensRecipes.ElementAt(index).IsWashingBarrel) | |||||
{ | |||||
HKDevice.HK_PLC_S7.Write("DB99.DBX0.1", true);//洗桶 | |||||
MessageNotify.GetInstance.ShowRunLog($"配方编号:{code},托盘编号:{trayCode},订单类型为洗桶"); | |||||
} | |||||
HKDevice.HK_PLC_S7.Write("DB99.DBX0.4", true); | HKDevice.HK_PLC_S7.Write("DB99.DBX0.4", true); | ||||
GVL_BigStation.Recipe2DosingStatus = 1; | GVL_BigStation.Recipe2DosingStatus = 1; | ||||
MessageNotify.GetInstance.ShowRunLog($"配方状态:{code}下发完成"); | |||||
MessageNotify.GetInstance.ShowRunLog($"配方编号:{code},托盘编号:{trayCode},下发完成"); | |||||
} | } | ||||
if (HKDevice.PlcRead.ReceiveFinishRecipe2 && GVL_BigStation.Recipe2DosingStatus == 1) | if (HKDevice.PlcRead.ReceiveFinishRecipe2 && GVL_BigStation.Recipe2DosingStatus == 1) | ||||
{ | { | ||||
GVL_BigStation.Recipe2DosingStatus = 2; | GVL_BigStation.Recipe2DosingStatus = 2; | ||||
HKDevice.HK_PLC_S7.Write("DB99.DBX0.4", false); | HKDevice.HK_PLC_S7.Write("DB99.DBX0.4", false); | ||||
StockBinParReset(); | StockBinParReset(); | ||||
MessageNotify.GetInstance.ShowRunLog($"配方状态:{code}配方配料"); | |||||
MessageNotify.GetInstance.ShowRunLog($"配方编号:{code},托盘编号:{trayCode},PLC接收配方完成"); | |||||
} | } | ||||
if (GVL_BigStation.Recipe2DosingStatus == 2 && HKDevice.PlcRead.Recipe2DosingFinish) | if (GVL_BigStation.Recipe2DosingStatus == 2 && HKDevice.PlcRead.Recipe2DosingFinish) | ||||
{ | { | ||||
GVL_BigStation.Recipe2DosingFinish = true; | |||||
GVL_BigStation.Recipe2DosingStatus = 3; | GVL_BigStation.Recipe2DosingStatus = 3; | ||||
MessageNotify.GetInstance.ShowRunLog($"配方状态:{code}配料完成"); | MessageNotify.GetInstance.ShowRunLog($"配方状态:{code}配料完成"); | ||||
foreach (var item in SiemensRecipes.ElementAt(index).RawMaterial) | foreach (var item in SiemensRecipes.ElementAt(index).RawMaterial) | ||||
@@ -1175,8 +1433,12 @@ namespace BPASmartClient.JXJFoodBigStation.Model | |||||
{ | { | ||||
item.Laying_Off_Weight = HKDevice.PlcRead.StockBin14ActualWeight; | item.Laying_Off_Weight = HKDevice.PlcRead.StockBin14ActualWeight; | ||||
} | } | ||||
} | |||||
if (SiemensDevice.IsConnected) | |||||
{ | |||||
FinishData.Order_No = SiemensRecipes.ElementAt(index).RecipeCode; | FinishData.Order_No = SiemensRecipes.ElementAt(index).RecipeCode; | ||||
FinishData.Product_Code = SiemensRecipes.ElementAt(index).RecipeName; | FinishData.Product_Code = SiemensRecipes.ElementAt(index).RecipeName; | ||||
FinishData.job_No = (short)SiemensRecipes.ElementAt(index).TrayCode; | |||||
for (int i = 0; i < FinishData.Material.Length; i++) | for (int i = 0; i < FinishData.Material.Length; i++) | ||||
{ | { | ||||
FinishData.Material[i] = new UDT1(); | FinishData.Material[i] = new UDT1(); | ||||
@@ -1185,25 +1447,31 @@ namespace BPASmartClient.JXJFoodBigStation.Model | |||||
{ | { | ||||
FinishData.Material[i].Material_Name = SiemensRecipes.ElementAt(index).RawMaterial.ElementAt(i).RawMaterialName; | FinishData.Material[i].Material_Name = SiemensRecipes.ElementAt(index).RawMaterial.ElementAt(i).RawMaterialName; | ||||
FinishData.Material[i].Material_BarrelNum = (short)SiemensRecipes.ElementAt(index).RawMaterial.ElementAt(i).RawMaterialBarrelNum; | FinishData.Material[i].Material_BarrelNum = (short)SiemensRecipes.ElementAt(index).RawMaterial.ElementAt(i).RawMaterialBarrelNum; | ||||
FinishData.Material[i].Material_Laying_Off_Weight = SiemensRecipes.ElementAt(index).RawMaterial.ElementAt(i).Laying_Off_Weight; | |||||
FinishData.Material[i].Material_Laying_Off_Weight = Math.Abs(SiemensRecipes.ElementAt(index).RawMaterial.ElementAt(i).Laying_Off_Weight); | |||||
} | } | ||||
if (SiemensDevice.IsConnected) | |||||
{ | |||||
SiemensDevice.Siemens_PLC_S7.WriteClass<DL_Finish_DB>(FinishData, 2361); | |||||
MessageNotify.GetInstance.ShowRunLog($"配方配料完成,将信号反馈给西门子"); | |||||
} | |||||
SiemensRecipeQueue2.TryDequeue(out code); | |||||
RecipeExecuteComple.Add(SiemensRecipes.ElementAt(index)); | |||||
if (!GVL_BigStation.IsUseLocalRecipe) | |||||
FinishData.Ask_For_Finish = true; | |||||
double a = DateTime.Now.Subtract(GVL_BigStation.DosingRecipe2Time).TotalSeconds; | |||||
FinishData.ProcessTime = Convert.ToInt16(a); | |||||
SiemensDevice.Siemens_PLC_S7.WriteClass<DL_Finish_DB>(FinishData, 2361); | |||||
MessageNotify.GetInstance.ShowRunLog($"配方配料完成,将信号反馈给西门子"); | |||||
} | |||||
SiemensRecipeQueue2.TryDequeue(out code); | |||||
RecipeExecuteComple.Add(SiemensRecipes.ElementAt(index)); | |||||
if (!GVL_BigStation.IsUseLocalRecipe) | |||||
{ | |||||
App.Current.Dispatcher.Invoke(() => | |||||
{ | { | ||||
Json<RemoteRecipe>.Data.Recipes.RemoveAt(index);//制作完成,移除当前配方 | Json<RemoteRecipe>.Data.Recipes.RemoveAt(index);//制作完成,移除当前配方 | ||||
} | |||||
else | |||||
}); | |||||
} | |||||
else | |||||
{ | |||||
App.Current.Dispatcher.Invoke(() => | |||||
{ | { | ||||
Json<LocalRecipe>.Data.Recipes.RemoveAt(index);//制作完成,移除当前配方 | Json<LocalRecipe>.Data.Recipes.RemoveAt(index);//制作完成,移除当前配方 | ||||
} | |||||
GVL_BigStation.Recipe2DosingStatus = 0; | |||||
}); | |||||
} | } | ||||
GVL_BigStation.Recipe2DosingStatus = 0; | |||||
} | } | ||||
} | } | ||||
} | } | ||||
@@ -1237,26 +1505,30 @@ namespace BPASmartClient.JXJFoodBigStation.Model | |||||
} | } | ||||
if (HKDevice.PlcRead.IsAllowIssueRecipe3 && GVL_BigStation.Recipe3DosingStatus == 0 && Inplace)//配方3是否允许下发配发 | if (HKDevice.PlcRead.IsAllowIssueRecipe3 && GVL_BigStation.Recipe3DosingStatus == 0 && Inplace)//配方3是否允许下发配发 | ||||
{ | { | ||||
GVL_BigStation.DosingRecipe3Time = DateTime.Now; | |||||
HKDevice.StockBinPar(SiemensRecipes.ElementAt(index)); | HKDevice.StockBinPar(SiemensRecipes.ElementAt(index)); | ||||
if (SiemensRecipes.ElementAt(index).IsWashingBarrel) | |||||
{ | |||||
HKDevice.HK_PLC_S7.Write("DB99.DBX0.1", true);//洗桶 | |||||
MessageNotify.GetInstance.ShowRunLog($"配方编号:{code},托盘编号:{trayCode},订单类型为洗桶"); | |||||
} | |||||
HKDevice.HK_PLC_S7.Write("DB99.DBX0.5", true); | HKDevice.HK_PLC_S7.Write("DB99.DBX0.5", true); | ||||
GVL_BigStation.Recipe3DosingStatus = 1; | GVL_BigStation.Recipe3DosingStatus = 1; | ||||
MessageNotify.GetInstance.ShowRunLog($"配方状态:{code}下发完成"); | |||||
MessageNotify.GetInstance.ShowRunLog($"配方编号:{code},托盘编号:{trayCode},下发完成"); | |||||
} | } | ||||
if (HKDevice.PlcRead.ReceiveFinishRecipe3 && GVL_BigStation.Recipe3DosingStatus == 1) | if (HKDevice.PlcRead.ReceiveFinishRecipe3 && GVL_BigStation.Recipe3DosingStatus == 1) | ||||
{ | { | ||||
GVL_BigStation.Recipe3DosingStatus = 2; | GVL_BigStation.Recipe3DosingStatus = 2; | ||||
HKDevice.HK_PLC_S7.Write("DB99.DBX0.5", false); | HKDevice.HK_PLC_S7.Write("DB99.DBX0.5", false); | ||||
StockBinParReset(); | StockBinParReset(); | ||||
MessageNotify.GetInstance.ShowRunLog($"配方状态:{code}配方配料"); | |||||
MessageNotify.GetInstance.ShowRunLog($"配方编号:{code},托盘编号:{trayCode},PLC接收配方完成"); | |||||
} | } | ||||
if (HKDevice.PlcRead.Recipe3DosingFinish && GVL_BigStation.Recipe3DosingStatus == 2) | if (HKDevice.PlcRead.Recipe3DosingFinish && GVL_BigStation.Recipe3DosingStatus == 2) | ||||
{ | { | ||||
GVL_BigStation.Recipe3DosingFinish = true; | |||||
GVL_BigStation.Recipe3DosingStatus = 3; | GVL_BigStation.Recipe3DosingStatus = 3; | ||||
MessageNotify.GetInstance.ShowRunLog($"配方状态:{code}配料完成"); | MessageNotify.GetInstance.ShowRunLog($"配方状态:{code}配料完成"); | ||||
if (HKDevice.PlcRead.Recipe3TrayCode > 0) | |||||
{ | |||||
foreach (var item in SiemensRecipes.ElementAt(index).RawMaterial) | |||||
foreach (var item in SiemensRecipes.ElementAt(index).RawMaterial) | |||||
{ | { | ||||
if (item.RawMaterialLocation == 1) | if (item.RawMaterialLocation == 1) | ||||
{ | { | ||||
@@ -1315,8 +1587,11 @@ namespace BPASmartClient.JXJFoodBigStation.Model | |||||
item.Laying_Off_Weight = HKDevice.PlcRead.StockBin14ActualWeight; | item.Laying_Off_Weight = HKDevice.PlcRead.StockBin14ActualWeight; | ||||
} | } | ||||
} | } | ||||
if (SiemensDevice.IsConnected) | |||||
{ | |||||
FinishData.Order_No = SiemensRecipes.ElementAt(index).RecipeCode; | FinishData.Order_No = SiemensRecipes.ElementAt(index).RecipeCode; | ||||
FinishData.Product_Code = SiemensRecipes.ElementAt(index).RecipeName; | FinishData.Product_Code = SiemensRecipes.ElementAt(index).RecipeName; | ||||
FinishData.job_No = (short)SiemensRecipes.ElementAt(index).TrayCode; | |||||
for (int i = 0; i < FinishData.Material.Length; i++) | for (int i = 0; i < FinishData.Material.Length; i++) | ||||
{ | { | ||||
FinishData.Material[i] = new UDT1(); | FinishData.Material[i] = new UDT1(); | ||||
@@ -1325,23 +1600,29 @@ namespace BPASmartClient.JXJFoodBigStation.Model | |||||
{ | { | ||||
FinishData.Material[i].Material_Name = SiemensRecipes.ElementAt(index).RawMaterial.ElementAt(i).RawMaterialName; | FinishData.Material[i].Material_Name = SiemensRecipes.ElementAt(index).RawMaterial.ElementAt(i).RawMaterialName; | ||||
FinishData.Material[i].Material_BarrelNum = (short)SiemensRecipes.ElementAt(index).RawMaterial.ElementAt(i).RawMaterialBarrelNum; | FinishData.Material[i].Material_BarrelNum = (short)SiemensRecipes.ElementAt(index).RawMaterial.ElementAt(i).RawMaterialBarrelNum; | ||||
FinishData.Material[i].Material_Laying_Off_Weight = SiemensRecipes.ElementAt(index).RawMaterial.ElementAt(i).Laying_Off_Weight; | |||||
FinishData.Material[i].Material_Laying_Off_Weight = Math.Abs(SiemensRecipes.ElementAt(index).RawMaterial.ElementAt(i).Laying_Off_Weight); | |||||
} | } | ||||
} | |||||
if (SiemensDevice.IsConnected) | |||||
{ | |||||
FinishData.Ask_For_Finish = true; | |||||
double a = DateTime.Now.Subtract(GVL_BigStation.DosingRecipe3Time).TotalSeconds; | |||||
FinishData.ProcessTime = Convert.ToInt16(a); | |||||
SiemensDevice.Siemens_PLC_S7.WriteClass<DL_Finish_DB>(FinishData, 2361); | SiemensDevice.Siemens_PLC_S7.WriteClass<DL_Finish_DB>(FinishData, 2361); | ||||
MessageNotify.GetInstance.ShowRunLog($"配方配料完成,将信号反馈给西门子"); | |||||
} | } | ||||
HKDevice.HK_PLC_S7.Write<bool>("DB98.DBX1.1", false); | |||||
SiemensRecipeQueue3.TryDequeue(out code); | SiemensRecipeQueue3.TryDequeue(out code); | ||||
RecipeExecuteComple.Add(SiemensRecipes.ElementAt(index));//将该配方添加到下 | RecipeExecuteComple.Add(SiemensRecipes.ElementAt(index));//将该配方添加到下 | ||||
if (!GVL_BigStation.IsUseLocalRecipe) | if (!GVL_BigStation.IsUseLocalRecipe) | ||||
{ | { | ||||
Json<RemoteRecipe>.Data.Recipes.RemoveAt(index);//制作完成,移除当前配方 | |||||
App.Current.Dispatcher.Invoke(() => | |||||
{ | |||||
Json<RemoteRecipe>.Data.Recipes.RemoveAt(index);//制作完成,移除当前配方 | |||||
}); | |||||
} | } | ||||
else | else | ||||
{ | { | ||||
Json<LocalRecipe>.Data.Recipes.RemoveAt(index);//制作完成,移除当前配方 | |||||
App.Current.Dispatcher.Invoke(() => | |||||
{ | |||||
Json<LocalRecipe>.Data.Recipes.RemoveAt(index);//制作完成,移除当前配方 | |||||
}); | |||||
} | } | ||||
GVL_BigStation.Recipe3DosingStatus = 0; | GVL_BigStation.Recipe3DosingStatus = 0; | ||||
} | } | ||||
@@ -1371,27 +1652,33 @@ namespace BPASmartClient.JXJFoodBigStation.Model | |||||
break; | break; | ||||
case 5: | case 5: | ||||
Inplace = HKDevice.PlcRead.Tray5InPlace; | Inplace = HKDevice.PlcRead.Tray5InPlace; | ||||
HKDevice.HK_PLC_S7.Write("DB99.DBX1.3", GVL_BigStation.AGVPutTray.GetBitValue(5)); | |||||
break; | break; | ||||
default: | default: | ||||
break; | break; | ||||
} | } | ||||
if (HKDevice.PlcRead.IsAllowIssueRecipe4 && GVL_BigStation.Recipe4DosingStatus == 0 && Inplace)//配方4是否允许下发配发 | if (HKDevice.PlcRead.IsAllowIssueRecipe4 && GVL_BigStation.Recipe4DosingStatus == 0 && Inplace)//配方4是否允许下发配发 | ||||
{ | { | ||||
GVL_BigStation.DosingRecipe4Time = DateTime.Now; | |||||
HKDevice.StockBinPar(SiemensRecipes.ElementAt(index)); | HKDevice.StockBinPar(SiemensRecipes.ElementAt(index)); | ||||
if (SiemensRecipes.ElementAt(index).IsWashingBarrel) | |||||
{ | |||||
HKDevice.HK_PLC_S7.Write("DB99.DBX0.1", true);//洗桶 | |||||
MessageNotify.GetInstance.ShowRunLog($"配方编号:{code},托盘编号:{trayCode},订单类型为洗桶"); | |||||
} | |||||
HKDevice.HK_PLC_S7.Write("DB99.DBX0.6", true); | HKDevice.HK_PLC_S7.Write("DB99.DBX0.6", true); | ||||
GVL_BigStation.Recipe4DosingStatus = 1; | GVL_BigStation.Recipe4DosingStatus = 1; | ||||
MessageNotify.GetInstance.ShowRunLog($"配方状态:{code}下发完成"); | |||||
MessageNotify.GetInstance.ShowRunLog($"配方编号:{code},托盘编号:{trayCode},下发完成"); | |||||
} | } | ||||
if (HKDevice.PlcRead.ReceiveFinishRecipe4 && GVL_BigStation.Recipe4DosingStatus == 1) | if (HKDevice.PlcRead.ReceiveFinishRecipe4 && GVL_BigStation.Recipe4DosingStatus == 1) | ||||
{ | { | ||||
GVL_BigStation.Recipe4DosingStatus = 2; | GVL_BigStation.Recipe4DosingStatus = 2; | ||||
HKDevice.HK_PLC_S7.Write("DB99.DBX0.6", false); | HKDevice.HK_PLC_S7.Write("DB99.DBX0.6", false); | ||||
StockBinParReset(); | StockBinParReset(); | ||||
MessageNotify.GetInstance.ShowRunLog($"配方状态:{code}配方配料"); | |||||
MessageNotify.GetInstance.ShowRunLog($"配方编号:{code},托盘编号:{trayCode},PLC接收配方完成"); | |||||
} | } | ||||
if (GVL_BigStation.Recipe4DosingStatus == 2 && HKDevice.PlcRead.Recipe4DosingFinish) | if (GVL_BigStation.Recipe4DosingStatus == 2 && HKDevice.PlcRead.Recipe4DosingFinish) | ||||
{ | { | ||||
GVL_BigStation.Recipe1DosingFinish = true; | |||||
GVL_BigStation.Recipe4DosingStatus = 3; | GVL_BigStation.Recipe4DosingStatus = 3; | ||||
MessageNotify.GetInstance.ShowRunLog($"配方状态:{code}配料完成"); | MessageNotify.GetInstance.ShowRunLog($"配方状态:{code}配料完成"); | ||||
foreach (var item in SiemensRecipes.ElementAt(index).RawMaterial) | foreach (var item in SiemensRecipes.ElementAt(index).RawMaterial) | ||||
@@ -1453,32 +1740,42 @@ namespace BPASmartClient.JXJFoodBigStation.Model | |||||
item.Laying_Off_Weight = HKDevice.PlcRead.StockBin14ActualWeight; | item.Laying_Off_Weight = HKDevice.PlcRead.StockBin14ActualWeight; | ||||
} | } | ||||
} | } | ||||
FinishData.Order_No = SiemensRecipes.ElementAt(index).RecipeCode; | |||||
FinishData.Product_Code = SiemensRecipes.ElementAt(index).RecipeName; | |||||
for (int i = 0; i < FinishData.Material.Length; i++) | |||||
{ | |||||
FinishData.Material[i] = new UDT1(); | |||||
} | |||||
for (int i = 0; i < SiemensRecipes.ElementAt(index).RawMaterial.Count; i++) | |||||
{ | |||||
FinishData.Material[i].Material_Name = SiemensRecipes.ElementAt(index).RawMaterial.ElementAt(i).RawMaterialName; | |||||
FinishData.Material[i].Material_BarrelNum = (short)SiemensRecipes.ElementAt(index).RawMaterial.ElementAt(i).RawMaterialBarrelNum; | |||||
FinishData.Material[i].Material_Laying_Off_Weight = SiemensRecipes.ElementAt(index).RawMaterial.ElementAt(i).Laying_Off_Weight; | |||||
} | |||||
if (SiemensDevice.IsConnected) | if (SiemensDevice.IsConnected) | ||||
{ | { | ||||
FinishData.Order_No = SiemensRecipes.ElementAt(index).RecipeCode; | |||||
FinishData.Product_Code = SiemensRecipes.ElementAt(index).RecipeName; | |||||
FinishData.job_No = (short)SiemensRecipes.ElementAt(index).TrayCode; | |||||
for (int i = 0; i < FinishData.Material.Length; i++) | |||||
{ | |||||
FinishData.Material[i] = new UDT1(); | |||||
} | |||||
for (int i = 0; i < SiemensRecipes.ElementAt(index).RawMaterial.Count; i++) | |||||
{ | |||||
FinishData.Material[i].Material_Name = SiemensRecipes.ElementAt(index).RawMaterial.ElementAt(i).RawMaterialName; | |||||
FinishData.Material[i].Material_BarrelNum = (short)SiemensRecipes.ElementAt(index).RawMaterial.ElementAt(i).RawMaterialBarrelNum; | |||||
FinishData.Material[i].Material_Laying_Off_Weight = Math.Abs(SiemensRecipes.ElementAt(index).RawMaterial.ElementAt(i).Laying_Off_Weight); | |||||
} | |||||
FinishData.Ask_For_Finish = true; | |||||
double a = DateTime.Now.Subtract(GVL_BigStation.DosingRecipe4Time).TotalSeconds; | |||||
FinishData.ProcessTime = Convert.ToInt16(a); | |||||
SiemensDevice.Siemens_PLC_S7.WriteClass<DL_Finish_DB>(FinishData, 2361); | SiemensDevice.Siemens_PLC_S7.WriteClass<DL_Finish_DB>(FinishData, 2361); | ||||
MessageNotify.GetInstance.ShowRunLog($"配方配料完成,将信号反馈给西门子"); | |||||
} | } | ||||
HKDevice.HK_PLC_S7.Write<bool>("DB98.DBX1.3", false); | |||||
SiemensRecipeQueue4.TryDequeue(out code); | SiemensRecipeQueue4.TryDequeue(out code); | ||||
RecipeExecuteComple.Add(SiemensRecipes.ElementAt(index));//将该配方添加到下 | RecipeExecuteComple.Add(SiemensRecipes.ElementAt(index));//将该配方添加到下 | ||||
if (!GVL_BigStation.IsUseLocalRecipe) | if (!GVL_BigStation.IsUseLocalRecipe) | ||||
{ | { | ||||
Json<RemoteRecipe>.Data.Recipes.RemoveAt(index);//制作完成,移除当前配方 | |||||
App.Current.Dispatcher.Invoke(() => | |||||
{ | |||||
Json<RemoteRecipe>.Data.Recipes.RemoveAt(index);//制作完成,移除当前配方 | |||||
}); | |||||
} | } | ||||
else | else | ||||
{ | { | ||||
Json<LocalRecipe>.Data.Recipes.RemoveAt(index);//制作完成,移除当前配方 | |||||
App.Current.Dispatcher.Invoke(() => | |||||
{ | |||||
Json<LocalRecipe>.Data.Recipes.RemoveAt(index);//制作完成,移除当前配方 | |||||
}); | |||||
} | } | ||||
GVL_BigStation.Recipe4DosingStatus = 0; | GVL_BigStation.Recipe4DosingStatus = 0; | ||||
} | } | ||||
@@ -1500,32 +1797,25 @@ namespace BPASmartClient.JXJFoodBigStation.Model | |||||
} | } | ||||
private void testRawMaterialNameData() | private void testRawMaterialNameData() | ||||
{ | { | ||||
RawMaterialsNamePos.Clear(); | |||||
RawMaterialsInfo.Clear(); | |||||
if (GVL_BigStation.IsUseLocalName) | |||||
/* RawMaterialsInfo.Clear(); | |||||
RawMaterialsInfo.Add(new RawMaterial() { RawMaterialName = "0007", RawMaterialLocation = 1 });//备料大蒜 | |||||
RawMaterialsInfo.Add(new RawMaterial() { RawMaterialName = "0015", RawMaterialLocation = 2 });//花椒酱 | |||||
RawMaterialsInfo.Add(new RawMaterial() { RawMaterialName = "0005", RawMaterialLocation = 3 });//榨菜丁 | |||||
RawMaterialsInfo.Add(new RawMaterial() { RawMaterialName = "0018", RawMaterialLocation = 4 });//炸豌豆 | |||||
RawMaterialsInfo.Add(new RawMaterial() { RawMaterialName = "0019", RawMaterialLocation = 5 });//高水分糍粑海椒 | |||||
RawMaterialsInfo.Add(new RawMaterial() { RawMaterialName = "0033", RawMaterialLocation = 6 });//辣豆瓣*/ | |||||
/*RawMaterialsInfo.Add(new RawMaterial() { RawMaterialName = "0030", RawMaterialLocation = 11 });//备用生姜 | |||||
RawMaterialsInfo.Add(new RawMaterial() { RawMaterialName = "0012", RawMaterialLocation = 12 });//豆豉细粒*/ | |||||
foreach (var material in RawMaterialsInfo) | |||||
{ | { | ||||
RawMaterialsInfo.Add(new RawMaterial() { RawMaterialName = "0007", RawMaterialLocation = 1 });//香菇丁 | |||||
RawMaterialsInfo.Add(new RawMaterial() { RawMaterialName = "0015", RawMaterialLocation = 2 });//竹笋丁 | |||||
RawMaterialsInfo.Add(new RawMaterial() { RawMaterialName = "0005", RawMaterialLocation = 3 });//卤牛肉丁 | |||||
RawMaterialsInfo.Add(new RawMaterial() { RawMaterialName = "0014", RawMaterialLocation = 4 });//野山椒粒 | |||||
RawMaterialsInfo.Add(new RawMaterial() { RawMaterialName = "0031", RawMaterialLocation = 1 });//备料大蒜 | |||||
RawMaterialsInfo.Add(new RawMaterial() { RawMaterialName = "0040", RawMaterialLocation = 2 });//花椒酱 | |||||
RawMaterialsInfo.Add(new RawMaterial() { RawMaterialName = "0018", RawMaterialLocation = 4 });//榨菜丁 | |||||
RawMaterialsInfo.Add(new RawMaterial() { RawMaterialName = "0033", RawMaterialLocation = 5 });//炸豌豆 | |||||
RawMaterialsInfo.Add(new RawMaterial() { RawMaterialName = "0008", RawMaterialLocation = 8 });//高水分糍粑海椒 | |||||
RawMaterialsInfo.Add(new RawMaterial() { RawMaterialName = "0010", RawMaterialLocation = 9 });//辣豆瓣 | |||||
RawMaterialsInfo.Add(new RawMaterial() { RawMaterialName = "0030", RawMaterialLocation = 11 });//备用生姜 | |||||
RawMaterialsInfo.Add(new RawMaterial() { RawMaterialName = "0012", RawMaterialLocation = 12 });//豆豉细粒 | |||||
foreach (var material in RawMaterialsInfo) | |||||
if (!string.IsNullOrEmpty(material.RawMaterialName)) | |||||
{ | { | ||||
RawMaterialsNamePos.Add(material.RawMaterialName,(short)material.RawMaterialLocation); | |||||
if (!RawMaterialsNamePos.ContainsKey(material.RawMaterialName)) | |||||
{ | |||||
RawMaterialsNamePos.Add(material.RawMaterialName, (short)material.RawMaterialLocation); | |||||
} | |||||
} | } | ||||
} | } | ||||
else | |||||
{ | |||||
if ((!string.IsNullOrEmpty(HKDevice.StockBinName.RawMaterialName1)) && !RawMaterialsNamePos.ContainsKey(HKDevice.StockBinName.RawMaterialName1)) RawMaterialsNamePos.Add(HKDevice.StockBinName.RawMaterialName1, 1); | |||||
} | |||||
} | } | ||||
} | } | ||||
} | } |
@@ -0,0 +1,16 @@ | |||||
using Microsoft.Toolkit.Mvvm.ComponentModel; | |||||
using System; | |||||
using System.Collections.Generic; | |||||
using System.Collections.ObjectModel; | |||||
using System.Linq; | |||||
using System.Text; | |||||
using System.Threading.Tasks; | |||||
namespace BPASmartClient.JXJFoodBigStation.Model | |||||
{ | |||||
public class RawMaterialData | |||||
{ | |||||
public ObservableCollection<RawMaterial> RawMaterial { get; set; } = new ObservableCollection<RawMaterial>(); | |||||
} | |||||
} |
@@ -28,6 +28,8 @@ namespace BPASmartClient.JXJFoodBigStation.Model | |||||
public int TrayCode { get { return _mTrayCode; } set { _mTrayCode = value; OnPropertyChanged(); } } | public int TrayCode { get { return _mTrayCode; } set { _mTrayCode = value; OnPropertyChanged(); } } | ||||
private int _mTrayCode; | private int _mTrayCode; | ||||
public bool IsWashingBarrel { get { return _mIsWashingBarrel; } set { _mIsWashingBarrel = value; OnPropertyChanged(); } } | |||||
private bool _mIsWashingBarrel; | |||||
/// <summary> | /// <summary> | ||||
/// 原料数据 | /// 原料数据 | ||||
/// </summary> | /// </summary> | ||||
@@ -40,6 +40,10 @@ namespace BPASmartClient.JXJFoodBigStation.Model.Siemens | |||||
/// </summary> | /// </summary> | ||||
public bool Order_Request_Ack { get; set; } | public bool Order_Request_Ack { get; set; } | ||||
/// <summary> | /// <summary> | ||||
/// 订单取消 | |||||
/// </summary> | |||||
public bool Order_Cancel { get; set; } | |||||
/// <summary> | |||||
/// 备用 | /// 备用 | ||||
/// </summary> | /// </summary> | ||||
public short[] Standby { get; set; } = new short[4]; | public short[] Standby { get; set; } = new short[4]; | ||||
@@ -48,6 +52,10 @@ namespace BPASmartClient.JXJFoodBigStation.Model.Siemens | |||||
/// </summary> | /// </summary> | ||||
public bool Order_Request { get; set; } | public bool Order_Request { get; set; } | ||||
/// <summary> | /// <summary> | ||||
/// 订单取消回复 | |||||
/// </summary> | |||||
public bool Order_Cancel_Ack { get; set; } | |||||
/// <summary> | |||||
/// 备用 | /// 备用 | ||||
/// </summary> | /// </summary> | ||||
public short[] Standby1 { get; set; } = new short[4]; | public short[] Standby1 { get; set; } = new short[4]; | ||||
@@ -7,6 +7,7 @@ using System.Text; | |||||
using System.Threading.Tasks; | using System.Threading.Tasks; | ||||
using BPASmartClient.S7Net; | using BPASmartClient.S7Net; | ||||
using System.Threading; | using System.Threading; | ||||
using BPASmartClient.CustomResource.Pages.Model; | |||||
namespace BPASmartClient.JXJFoodBigStation.Model.Siemens | namespace BPASmartClient.JXJFoodBigStation.Model.Siemens | ||||
{ | { | ||||
@@ -31,19 +32,28 @@ namespace BPASmartClient.JXJFoodBigStation.Model.Siemens | |||||
{ | { | ||||
if (GVL_BigStation.Order_Request && GVL_BigStation.SiemensSendRecipeStatus == 0) | if (GVL_BigStation.Order_Request && GVL_BigStation.SiemensSendRecipeStatus == 0) | ||||
{ | { | ||||
GVL_BigStation.SiemensSendRecipeStatus = 1; | |||||
this.Siemens_PLC_S7.Write("DB2301.DBX330.0", true); | this.Siemens_PLC_S7.Write("DB2301.DBX330.0", true); | ||||
MessageNotify.GetInstance.ShowRunLog($"向西门子请求订单"); | |||||
GVL_BigStation.SiemensSendRecipeStatus = 1; | |||||
} | } | ||||
if (RTrig.GetInstance("Order_Request_Ack").Start(start.Order_Request_Ack) && GVL_BigStation.SiemensSendRecipeStatus == 1) | if (RTrig.GetInstance("Order_Request_Ack").Start(start.Order_Request_Ack) && GVL_BigStation.SiemensSendRecipeStatus == 1) | ||||
{ | { | ||||
GVL_BigStation.SiemensSendRecipeStatus = 2; | |||||
ActionManage.GetInstance.Send("SiemensSendRecipe", start); | ActionManage.GetInstance.Send("SiemensSendRecipe", start); | ||||
this.Siemens_PLC_S7.Write("DB2301.DBX330.0", false); | this.Siemens_PLC_S7.Write("DB2301.DBX330.0", false); | ||||
MessageNotify.GetInstance.ShowRunLog($"西门子下发订单:{start.RecipeCode}"); | |||||
GVL_BigStation.SiemensSendRecipeStatus = 2; | |||||
} | } | ||||
if (TTrig.GetInstance("Order_Request_Ack").Start(start.Order_Request_Ack) && GVL_BigStation.SiemensSendRecipeStatus == 2) | if (TTrig.GetInstance("Order_Request_Ack").Start(start.Order_Request_Ack) && GVL_BigStation.SiemensSendRecipeStatus == 2) | ||||
{ | { | ||||
GVL_BigStation.SiemensSendRecipeStatus = 3; | |||||
GVL_BigStation.Order_Request = false; | GVL_BigStation.Order_Request = false; | ||||
MessageNotify.GetInstance.ShowRunLog($"西门子确认上位机接收到订单:{start.RecipeName}"); | |||||
GVL_BigStation.SiemensSendRecipeStatus = 3; | |||||
} | |||||
if (RTrig.GetInstance("Order_Cancel").Start(start.Order_Cancel)) //订单取消 | |||||
{ | |||||
GVL_BigStation.Order_Cancel = true; | |||||
GVL_BigStation.Order_CancelRecipeCode = start.RecipeCode; | |||||
MessageNotify.GetInstance.ShowRunLog($"西门子下发取消工单指令:{start.RecipeName}"); | |||||
} | } | ||||
} | } | ||||
if (res1 != null && res1 is DL_Status_DB status) | if (res1 != null && res1 is DL_Status_DB status) | ||||
@@ -52,19 +62,73 @@ namespace BPASmartClient.JXJFoodBigStation.Model.Siemens | |||||
} | } | ||||
if (res2 != null && res2 is DL_Finish_DB finish) | if (res2 != null && res2 is DL_Finish_DB finish) | ||||
{ | { | ||||
if (RTrig.GetInstance("Ask_For_Finish_PLC").Start(finish.Ask_For_Finish_PLC) && GVL_BigStation.SiemensSendRecipeStatus == 7) | |||||
if (GVL_BigStation.Recipe1DosingFinish == true) | |||||
{ | |||||
if (RTrig.GetInstance("Ask_For_Finish_PLC").Start(finish.Ask_For_Finish_PLC)) | |||||
{ | |||||
finish.Order_No = ""; | |||||
finish.Product_Code = ""; | |||||
finish.job_No = 0; | |||||
for (int i = 0; i < 20; i++) | |||||
{ | |||||
finish.Material[i] = new UDT1(); | |||||
} | |||||
finish.Ask_For_Finish = false; | |||||
finish.ProcessTime = 0; | |||||
this.Siemens_PLC_S7.WriteClass<DL_Finish_DB>(finish, 2361); | |||||
GVL_BigStation.Recipe1DosingFinish = false; | |||||
} | |||||
} | |||||
else if (GVL_BigStation.Recipe2DosingFinish == true) | |||||
{ | |||||
if (RTrig.GetInstance("Ask_For_Finish_PLC").Start(finish.Ask_For_Finish_PLC)) | |||||
{ | |||||
finish.Order_No = ""; | |||||
finish.Product_Code = ""; | |||||
finish.job_No = 0; | |||||
for (int i = 0; i < 20; i++) | |||||
{ | |||||
finish.Material[i] = new UDT1(); | |||||
} | |||||
finish.Ask_For_Finish = false; | |||||
finish.ProcessTime = 0; | |||||
this.Siemens_PLC_S7.WriteClass<DL_Finish_DB>(finish, 2361); | |||||
GVL_BigStation.Recipe2DosingFinish = false; | |||||
} | |||||
} | |||||
else if (GVL_BigStation.Recipe3DosingFinish == true) | |||||
{ | |||||
if (RTrig.GetInstance("Ask_For_Finish_PLC").Start(finish.Ask_For_Finish_PLC)) | |||||
{ | |||||
finish.Order_No = ""; | |||||
finish.Product_Code = ""; | |||||
finish.job_No = 0; | |||||
for (int i = 0; i < 20; i++) | |||||
{ | |||||
finish.Material[i] = new UDT1(); | |||||
} | |||||
finish.Ask_For_Finish = false; | |||||
finish.ProcessTime = 0; | |||||
this.Siemens_PLC_S7.WriteClass<DL_Finish_DB>(finish, 2361); | |||||
GVL_BigStation.Recipe3DosingFinish = false; | |||||
} | |||||
} | |||||
else if (GVL_BigStation.Recipe4DosingFinish == true) | |||||
{ | { | ||||
finish.Order_No = ""; | |||||
finish.Product_Code = ""; | |||||
finish.job_No = 0; | |||||
for (int i = 0; i < 20; i++) | |||||
if (RTrig.GetInstance("Ask_For_Finish_PLC").Start(finish.Ask_For_Finish_PLC)) | |||||
{ | { | ||||
finish.Material[i] = new UDT1(); | |||||
finish.Order_No = ""; | |||||
finish.Product_Code = ""; | |||||
finish.job_No = 0; | |||||
for (int i = 0; i < 20; i++) | |||||
{ | |||||
finish.Material[i] = new UDT1(); | |||||
} | |||||
finish.Ask_For_Finish = false; | |||||
finish.ProcessTime = 0; | |||||
this.Siemens_PLC_S7.WriteClass<DL_Finish_DB>(finish, 2361); | |||||
GVL_BigStation.Recipe4DosingFinish = false; | |||||
} | } | ||||
GVL_BigStation.SiemensSendRecipeStatus = 0; | |||||
finish.Ask_For_Finish = false; | |||||
finish.ProcessTime = 0; | |||||
this.Siemens_PLC_S7.WriteClass<DL_Finish_DB>(finish, 2361); | |||||
} | } | ||||
} | } | ||||
Thread.Sleep(10); | Thread.Sleep(10); | ||||
@@ -75,7 +139,7 @@ namespace BPASmartClient.JXJFoodBigStation.Model.Siemens | |||||
} | } | ||||
} | } | ||||
Thread.Sleep(10); | Thread.Sleep(10); | ||||
}), "监听服务数据"); | |||||
}), "西门子数据交互",true); | |||||
} | } | ||||
} | } | ||||
} | } |
@@ -69,11 +69,19 @@ | |||||
Height="40" | Height="40" | ||||
Margin="5,0,5,0" | Margin="5,0,5,0" | ||||
Command="{Binding ClearTrayInPlace}" | Command="{Binding ClearTrayInPlace}" | ||||
Content="清楚AGV到位信号" | |||||
Content="清除AGV到位信号" | |||||
FontSize="20" | |||||
Panel.ZIndex="0" | |||||
Style="{StaticResource ImageButtonStyle}"></Button> | |||||
<Button | |||||
Width="200" | |||||
Height="40" | |||||
Margin="5,0,5,0" | |||||
Command="{Binding ClearAllRecipe}" | |||||
Content="清除所有配方" | |||||
FontSize="20" | FontSize="20" | ||||
Panel.ZIndex="0" | Panel.ZIndex="0" | ||||
Style="{StaticResource ImageButtonStyle}"></Button> | Style="{StaticResource ImageButtonStyle}"></Button> | ||||
</StackPanel> | </StackPanel> | ||||
@@ -82,8 +82,10 @@ | |||||
</Grid> | </Grid> | ||||
<Grid Grid.Column="1" Margin="5"> | <Grid Grid.Column="1" Margin="5"> | ||||
<TextBlock | |||||
<TextBox | |||||
Width="50" | |||||
FontSize="16" | FontSize="16" | ||||
TextAlignment="Center" | |||||
HorizontalAlignment="Center" | HorizontalAlignment="Center" | ||||
VerticalAlignment="Center" | VerticalAlignment="Center" | ||||
Text="{Binding RawMaterialLocation}" /> | Text="{Binding RawMaterialLocation}" /> | ||||
@@ -93,7 +95,8 @@ | |||||
</Grid> | </Grid> | ||||
<Grid Grid.Column="2" Margin="5"> | <Grid Grid.Column="2" Margin="5"> | ||||
<TextBlock | |||||
<TextBox | |||||
Width="50" | |||||
FontSize="16" | FontSize="16" | ||||
HorizontalAlignment="Center" | HorizontalAlignment="Center" | ||||
VerticalAlignment="Center" | VerticalAlignment="Center" | ||||
@@ -104,26 +107,13 @@ | |||||
</Grid> | </Grid> | ||||
<Grid Grid.Column="3"> | <Grid Grid.Column="3"> | ||||
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center"> | <StackPanel Orientation="Horizontal" HorizontalAlignment="Center"> | ||||
<pry:IcoButton | |||||
Margin="3,4,4,0" | |||||
HorizontalAlignment="Center" | |||||
VerticalAlignment="Center" | |||||
Background="#112AB2E7" | |||||
BorderThickness="0" | |||||
Command="{Binding DataContext.DetailsCommand, RelativeSource={RelativeSource AncestorType=ListBox, Mode=FindAncestor}}" | |||||
CommandParameter="{Binding RawMaterialLocation}" | |||||
Content="编辑" | |||||
EnterBackground="#222AB2E7" | |||||
Foreground="#FF2AB2E7" | |||||
IcoText="" | |||||
Style="{StaticResource IcoButtonStyle}" /> | |||||
<pry:IcoButton | <pry:IcoButton | ||||
Margin="3,4,4,0" | Margin="3,4,4,0" | ||||
HorizontalAlignment="Center" | HorizontalAlignment="Center" | ||||
VerticalAlignment="Center" | VerticalAlignment="Center" | ||||
Background="#11F53F62" | Background="#11F53F62" | ||||
BorderThickness="0" | BorderThickness="0" | ||||
Command="{Binding DataContext.RemoveCommand, RelativeSource={RelativeSource AncestorType=ListBox, Mode=FindAncestor}}" | |||||
Command="{Binding DataContext.RemoveCommand, RelativeSource={RelativeSource AncestorType=ItemsControl, Mode=FindAncestor}}" | |||||
CommandParameter="{Binding RawMaterialLocation}" | CommandParameter="{Binding RawMaterialLocation}" | ||||
Content="删除" | Content="删除" | ||||
EnterBackground="#22F53F62" | EnterBackground="#22F53F62" | ||||
@@ -110,7 +110,7 @@ namespace BPASmartClient.JXJFoodBigStation.ViewModel | |||||
int index = Array.FindIndex(PlcInfo.ToArray(), p => p.Address == address); | int index = Array.FindIndex(PlcInfo.ToArray(), p => p.Address == address); | ||||
if (index != -1) | if (index != -1) | ||||
{ | { | ||||
if(ProcessControl.GetInstance.HKDevice.IsConnected) ProcessControl.GetInstance.HKDevice.HK_PLC_S7.Write(address , PlcInfo.ElementAt(index).SetValue); | |||||
if (ProcessControl.GetInstance.HKDevice.IsConnected) ProcessControl.GetInstance.HKDevice.HK_PLC_S7.Write(address, PlcInfo.ElementAt(index).SetValue); | |||||
} | } | ||||
}*/ | }*/ | ||||
}); | }); | ||||
@@ -121,7 +121,7 @@ namespace BPASmartClient.JXJFoodBigStation.ViewModel | |||||
Type type = typeof(T); | Type type = typeof(T); | ||||
}*/ | }*/ | ||||
public ObservableCollection<PlcVarMonitor> PlcInfo { get; set; } = new ObservableCollection<PlcVarMonitor>(); | |||||
public static ObservableCollection<PlcVarMonitor> PlcInfo { get; set; } = new ObservableCollection<PlcVarMonitor>(); | |||||
public RelayCommand<object> SetValueCommand { get; set; } | public RelayCommand<object> SetValueCommand { get; set; } | ||||
} | } | ||||
@@ -83,7 +83,6 @@ namespace BPASmartClient.JXJFoodBigStation.ViewModel | |||||
int cnt = Array.FindIndex(TopDeviceCurrentStatuses.ToArray(), p => p.DeviceName == deviceName); | int cnt = Array.FindIndex(TopDeviceCurrentStatuses.ToArray(), p => p.DeviceName == deviceName); | ||||
if (cnt >= 0) | if (cnt >= 0) | ||||
{ | { | ||||
int index = Array.FindIndex(BottomDeviceCurrentStatuses.ToArray(), p => p.DeviceName == newName); | int index = Array.FindIndex(BottomDeviceCurrentStatuses.ToArray(), p => p.DeviceName == newName); | ||||
int index1 = Array.FindIndex(TopDeviceCurrentStatuses.ToArray(), p => p.DeviceName == newName); | int index1 = Array.FindIndex(TopDeviceCurrentStatuses.ToArray(), p => p.DeviceName == newName); | ||||
if (index == -1 && index1 == -1) | if (index == -1 && index1 == -1) | ||||
@@ -1,6 +1,7 @@ | |||||
using BPASmartClient.Helper; | using BPASmartClient.Helper; | ||||
using BPASmartClient.JXJFoodBigStation.Model; | using BPASmartClient.JXJFoodBigStation.Model; | ||||
using BPASmartClient.JXJFoodBigStation.Model.HK_PLC; | using BPASmartClient.JXJFoodBigStation.Model.HK_PLC; | ||||
using BPASmartClient.JXJFoodBigStation.Model.Siemens; | |||||
using Microsoft.Toolkit.Mvvm.ComponentModel; | using Microsoft.Toolkit.Mvvm.ComponentModel; | ||||
using Microsoft.Toolkit.Mvvm.Input; | using Microsoft.Toolkit.Mvvm.Input; | ||||
using System; | using System; | ||||
@@ -43,6 +44,10 @@ namespace BPASmartClient.JXJFoodBigStation.ViewModel | |||||
{ | { | ||||
GVL_BigStation.AGVPutTray = 0; | GVL_BigStation.AGVPutTray = 0; | ||||
}); | }); | ||||
ClearAllRecipe = new RelayCommand(() => | |||||
{ | |||||
Json<RemoteRecipe>.Data.Recipes.Clear(); | |||||
}); | |||||
ThreadManage.GetInstance().StartLong(new Action(() => | ThreadManage.GetInstance().StartLong(new Action(() => | ||||
{ | { | ||||
Heartbeat = GVL_BigStation.HeartBeatFromPlc; | Heartbeat = GVL_BigStation.HeartBeatFromPlc; | ||||
@@ -55,6 +60,7 @@ namespace BPASmartClient.JXJFoodBigStation.ViewModel | |||||
public RelayCommand Tray4InPlace { get; set; } | public RelayCommand Tray4InPlace { get; set; } | ||||
public RelayCommand Tray5InPlace { get; set; } | public RelayCommand Tray5InPlace { get; set; } | ||||
public RelayCommand ClearTrayInPlace { get; set; } | public RelayCommand ClearTrayInPlace { get; set; } | ||||
public RelayCommand ClearAllRecipe { get; set; } | |||||
public bool Heartbeat { get { return _mHeartbeat; } set { _mHeartbeat = value; OnPropertyChanged(); } } | public bool Heartbeat { get { return _mHeartbeat; } set { _mHeartbeat = value; OnPropertyChanged(); } } | ||||
private bool _mHeartbeat; | private bool _mHeartbeat; | ||||
} | } | ||||
@@ -1,4 +1,7 @@ | |||||
using BPASmartClient.Helper; | |||||
using BPASmartClient.CustomResource.Pages.Model; | |||||
using BPASmartClient.CustomResource.UserControls; | |||||
using BPASmartClient.CustomResource.UserControls.MessageShow; | |||||
using BPASmartClient.Helper; | |||||
using BPASmartClient.JXJFoodBigStation.Model; | using BPASmartClient.JXJFoodBigStation.Model; | ||||
using BPASmartClient.JXJFoodBigStation.Model.HK_PLC; | using BPASmartClient.JXJFoodBigStation.Model.HK_PLC; | ||||
using Microsoft.Toolkit.Mvvm.ComponentModel; | using Microsoft.Toolkit.Mvvm.ComponentModel; | ||||
@@ -19,24 +22,29 @@ namespace BPASmartClient.JXJFoodBigStation.ViewModel | |||||
{ | { | ||||
public StockBinRawMaterialViewModel() | public StockBinRawMaterialViewModel() | ||||
{ | { | ||||
RawMaterialInfo = ProcessControl.GetInstance.RawMaterialsInfo; | |||||
int serialNum = 0; | |||||
foreach (var rawMaterialInfo in RawMaterialInfo) | |||||
RawMaterialInfo = Json<RawMaterialData>.Data.RawMaterial; | |||||
RemoveCommand = new RelayCommand<Object>((loc) => | |||||
{ | { | ||||
serialNum = serialNum + 1; | |||||
rawMaterialInfo.RawMaterialCount = (short)serialNum; | |||||
} | |||||
RemoveCommand = new RelayCommand<int>((loc) => | |||||
if (loc is int pos) | |||||
{ | |||||
var res = RawMaterialInfo.FirstOrDefault(p => p.RawMaterialLocation == pos); | |||||
if (res != null) RawMaterialInfo.Remove(res); | |||||
} | |||||
}); | |||||
SaveRawMaterialPara = new RelayCommand(() => | |||||
{ | |||||
Json<RawMaterialData>.Save(); | |||||
MessageNotify.GetInstance.ShowUserLog($"原料与料仓对应关系保存成功"); | |||||
NoticeDemoViewModel.OpenMsg(EnumPromptType.Success, App.MainWindow, "成功", $"原料与料仓对应关系保存成功"); | |||||
}); | |||||
UpdateRawMaterial = new RelayCommand(() => | |||||
{ | { | ||||
var res = RawMaterialInfo.FirstOrDefault(p => p.RawMaterialLocation == loc); | |||||
if(res!= null) RawMaterialInfo.Remove(res); | |||||
RawMaterialInfo.Add(new RawMaterial() { RawMaterialCount = (short)(RawMaterialInfo.Count + 1)}); | |||||
}); | }); | ||||
} | } | ||||
public ObservableCollection<RawMaterial> RawMaterialInfo { get; set; } = new ObservableCollection<RawMaterial>(); | public ObservableCollection<RawMaterial> RawMaterialInfo { get; set; } = new ObservableCollection<RawMaterial>(); | ||||
public RelayCommand<int> DetailsCommand { get; set; } | |||||
public RelayCommand<int> RemoveCommand { get; set; } | |||||
public RelayCommand<Object> RemoveCommand { get; set; } | |||||
public RelayCommand SaveRawMaterialPara { get; set; } | public RelayCommand SaveRawMaterialPara { get; set; } | ||||
public RelayCommand UpdateMaterial { get; set; } | |||||
public RelayCommand UpdateRawMaterial { get; set; } | |||||
} | } | ||||
} | } |
@@ -39,9 +39,8 @@ namespace BPASmartClient.JXJFoodSmallStation | |||||
base.OnStartup(e); | base.OnStartup(e); | ||||
MenuInit(); | MenuInit(); | ||||
DataInit(); | DataInit(); | ||||
DeviceInquire.GetInstance.Init();//配料机设备上线监听,设备列表初始化 | |||||
Init(); | |||||
MainView mv = new MainView(); | MainView mv = new MainView(); | ||||
ProcessControl.GetInstance.Init(); | |||||
LoginView lv = new LoginView(); | LoginView lv = new LoginView(); | ||||
var res = lv.ShowDialog(); | var res = lv.ShowDialog(); | ||||
if (res != null && res == true) | if (res != null && res == true) | ||||
@@ -53,6 +52,14 @@ namespace BPASmartClient.JXJFoodSmallStation | |||||
mv.Close(); | mv.Close(); | ||||
MainWindow = mv; | MainWindow = mv; | ||||
} | } | ||||
private async void Init() | |||||
{ | |||||
await Task.Run(new Action(() => | |||||
{ | |||||
DeviceInquire.GetInstance.Init();//配料机设备上线监听,设备列表初始化 | |||||
ProcessControl.GetInstance.Init(); | |||||
})); | |||||
} | |||||
protected override void OnExit(ExitEventArgs e) | protected override void OnExit(ExitEventArgs e) | ||||
{ | { | ||||
@@ -165,8 +172,16 @@ namespace BPASmartClient.JXJFoodSmallStation | |||||
AssemblyName = "BPASmartClient.JXJFoodSmallStation", | AssemblyName = "BPASmartClient.JXJFoodSmallStation", | ||||
ToggleWindowPath = "View.ManualFlowView" | ToggleWindowPath = "View.ManualFlowView" | ||||
}); | |||||
ManualControl.Add(new SubMenumodel() | |||||
{ | |||||
SubMenuName = "机器人设备控制", | |||||
SubMenuPermission = new Permission[] { Permission.管理员, Permission.操作员, Permission.技术员 }, | |||||
AssemblyName = "BPASmartClient.JXJFoodSmallStation", | |||||
ToggleWindowPath = "View.RobotView" | |||||
}); | }); | ||||
MenuManage.GetInstance.menuModels.Add(new MenuModel() | MenuManage.GetInstance.menuModels.Add(new MenuModel() | ||||
{ | { | ||||
MainMenuIcon = "", | MainMenuIcon = "", | ||||
@@ -26,6 +26,9 @@ | |||||
</ItemGroup> | </ItemGroup> | ||||
<ItemGroup> | <ItemGroup> | ||||
<Compile Update="View\RobotView.xaml.cs"> | |||||
<SubType>Code</SubType> | |||||
</Compile> | |||||
<Compile Update="View\ManualFlowView.xaml.cs"> | <Compile Update="View\ManualFlowView.xaml.cs"> | ||||
<SubType>Code</SubType> | <SubType>Code</SubType> | ||||
</Compile> | </Compile> | ||||
@@ -42,6 +45,10 @@ | |||||
<XamlRuntime>$(DefaultXamlRuntime)</XamlRuntime> | <XamlRuntime>$(DefaultXamlRuntime)</XamlRuntime> | ||||
<SubType>Designer</SubType> | <SubType>Designer</SubType> | ||||
</Page> | </Page> | ||||
<Page Update="View\RobotView.xaml"> | |||||
<XamlRuntime>$(DefaultXamlRuntime)</XamlRuntime> | |||||
<SubType>Designer</SubType> | |||||
</Page> | |||||
<Page Update="View\ManualFlowView.xaml"> | <Page Update="View\ManualFlowView.xaml"> | ||||
<XamlRuntime>$(DefaultXamlRuntime)</XamlRuntime> | <XamlRuntime>$(DefaultXamlRuntime)</XamlRuntime> | ||||
<SubType>Designer</SubType> | <SubType>Designer</SubType> | ||||
@@ -14,6 +14,9 @@ namespace BPASmartClient.JXJFoodSmallStation.Model | |||||
private volatile static GVL_SmallStation SmallStation; | private volatile static GVL_SmallStation SmallStation; | ||||
public static GVL_SmallStation GetInstance => SmallStation ?? (SmallStation = new GVL_SmallStation()); | public static GVL_SmallStation GetInstance => SmallStation ?? (SmallStation = new GVL_SmallStation()); | ||||
private GVL_SmallStation() { } | private GVL_SmallStation() { } | ||||
public static bool Order_Cancel { get; set; } | |||||
public static string Order_CancelRecipeCode { get; set; } = ""; | |||||
/// <summary> | /// <summary> | ||||
/// 托盘1托盘到位 逻辑完成 | /// 托盘1托盘到位 逻辑完成 | ||||
/// </summary> | /// </summary> | ||||
@@ -33,7 +33,7 @@ namespace BPASmartClient.JXJFoodSmallStation.Model | |||||
/// <summary> | /// <summary> | ||||
/// 配方队列 | /// 配方队列 | ||||
/// </summary> | /// </summary> | ||||
public ConcurrentQueue<string> RecipeQueue = new ConcurrentQueue<string>(); | |||||
public ConcurrentQueue<string> RecipeQueueTray1 = new ConcurrentQueue<string>(); | |||||
public ConcurrentQueue<string> RecipeQueueTray2 = new ConcurrentQueue<string>(); | public ConcurrentQueue<string> RecipeQueueTray2 = new ConcurrentQueue<string>(); | ||||
public SiemensDeviceStatus SiemensDevice = new SiemensDeviceStatus(); | public SiemensDeviceStatus SiemensDevice = new SiemensDeviceStatus(); | ||||
@@ -51,7 +51,6 @@ namespace BPASmartClient.JXJFoodSmallStation.Model | |||||
public void Init() | public void Init() | ||||
{ | { | ||||
testData(); | testData(); | ||||
//Json<RemoteRecipeDataColl>.Data.Recipes = Json<LocalRecipeDataColl>.Data.Recipes; | |||||
for (int i = 0; i < 16; i++) | for (int i = 0; i < 16; i++) | ||||
{ | { | ||||
if (DeviceInquire.GetInstance.GetDevice(i).DeviceName != null) | if (DeviceInquire.GetInstance.GetDevice(i).DeviceName != null) | ||||
@@ -166,65 +165,106 @@ namespace BPASmartClient.JXJFoodSmallStation.Model | |||||
Json<RemoteRecipeDataColl>.Data.Recipes.Add(recipe); | Json<RemoteRecipeDataColl>.Data.Recipes.Add(recipe); | ||||
} | } | ||||
}), "LocalSimulationRecipeIssue", true); | }), "LocalSimulationRecipeIssue", true); | ||||
ActionManage.GetInstance.Register(new Action(() => | |||||
{ | |||||
Json<RemoteRecipeDataColl>.Data.Recipes.Clear(); | |||||
GVL_SmallStation.SiemensSendRecipeStatus = 0; | |||||
MessageNotify.GetInstance.ShowRunLog("系统流程复位,等待西门子重新下发订单"); | |||||
}), "BPASystemReset",true); | |||||
string HK_PLC_IP = ConfigurationManager.AppSettings["HKPlc_IP"]; | string HK_PLC_IP = ConfigurationManager.AppSettings["HKPlc_IP"]; | ||||
string Siemens_PLC_IP = ConfigurationManager.AppSettings["Siemens_IP"]; | string Siemens_PLC_IP = ConfigurationManager.AppSettings["Siemens_IP"]; | ||||
string WindSend_PLC_IP = ConfigurationManager.AppSettings["WindSend_IP"]; | string WindSend_PLC_IP = ConfigurationManager.AppSettings["WindSend_IP"]; | ||||
try | try | ||||
{ | { | ||||
if (Json<DevicePar>.Data.deviceConnectPar.HKPlcConnect) | if (Json<DevicePar>.Data.deviceConnectPar.HKPlcConnect) | ||||
{ | { | ||||
HKDevice.HK_PLC_S7.Connect(S7.Net.CpuType.S71200, HK_PLC_IP); | HKDevice.HK_PLC_S7.Connect(S7.Net.CpuType.S71200, HK_PLC_IP); | ||||
if (HKDevice.IsConnected) MessageNotify.GetInstance.ShowRunLog("海科plc连接成功"); | |||||
} | } | ||||
} | |||||
catch (Exception ex) | |||||
{ | |||||
MessageNotify.GetInstance.ShowAlarmLog("海科plc连接失败,等待重新连接"); | |||||
} | |||||
finally | |||||
{ | |||||
HKDevice.Init(); | |||||
MessageNotify.GetInstance.ShowRunLog("海科plc初始化完成"); | |||||
} | |||||
try | |||||
{ | |||||
if (Json<DevicePar>.Data.deviceConnectPar.SiemensConnect) | if (Json<DevicePar>.Data.deviceConnectPar.SiemensConnect) | ||||
{ | { | ||||
SiemensDevice.Siemens_PLC_S7.Connect(S7.Net.CpuType.S71500, Siemens_PLC_IP); | SiemensDevice.Siemens_PLC_S7.Connect(S7.Net.CpuType.S71500, Siemens_PLC_IP); | ||||
if (SiemensDevice.IsConnected) MessageNotify.GetInstance.ShowRunLog("西门子plc连接成功"); | |||||
} | } | ||||
} | |||||
catch (Exception ex) | |||||
{ | |||||
MessageNotify.GetInstance.ShowAlarmLog("西门子plc连接失败,等待重新连接"); | |||||
} | |||||
finally | |||||
{ | |||||
SiemensDevice.Init(); | |||||
MessageNotify.GetInstance.ShowRunLog("西门子plc初始化完成"); | |||||
} | |||||
try | |||||
{ | |||||
if (Json<DevicePar>.Data.deviceConnectPar.WindSendConnect) | if (Json<DevicePar>.Data.deviceConnectPar.WindSendConnect) | ||||
{ | { | ||||
WindSendDevice.Siemens_PLC_S7.Connect(S7.Net.CpuType.S71200, WindSend_PLC_IP); | WindSendDevice.Siemens_PLC_S7.Connect(S7.Net.CpuType.S71200, WindSend_PLC_IP); | ||||
if (WindSendDevice.IsConnected) MessageNotify.GetInstance.ShowRunLog("风送plc连接成功"); | |||||
} | } | ||||
if (HKDevice.IsConnected) | |||||
} | |||||
catch (Exception ex) | |||||
{ | |||||
MessageNotify.GetInstance.ShowAlarmLog("粉料plc连接失败,等待重新连接"); | |||||
} | |||||
finally | |||||
{ | |||||
WindSendDevice.Init(); | |||||
MessageNotify.GetInstance.ShowRunLog("风送粉料plc初始化完成"); | |||||
} | |||||
ThreadManage.GetInstance().StartLong(new Action(() => | |||||
{ | |||||
try | |||||
{ | { | ||||
HKDevice.Init(); | |||||
MessageNotify.GetInstance.ShowRunLog("海科plc连接成功,并初始化完成"); | |||||
if (!HKDevice.IsConnected && Json<DevicePar>.Data.deviceConnectPar.HKPlcConnect) | |||||
{ | |||||
HKDevice.HK_PLC_S7.Connect(S7.Net.CpuType.S71200, HK_PLC_IP); | |||||
if (HKDevice.IsConnected) MessageNotify.GetInstance.ShowRunLog("海科PLC重新连接成功"); | |||||
} | |||||
} | } | ||||
if (SiemensDevice.IsConnected) | |||||
catch (Exception ex) | |||||
{ | { | ||||
SiemensDevice.Init(); | |||||
MessageNotify.GetInstance.ShowRunLog("西门子plc连接成功,并初始化完成"); | |||||
} | } | ||||
if (WindSendDevice.IsConnected) | |||||
try | |||||
{ | { | ||||
WindSendDevice.Init(); | |||||
MessageNotify.GetInstance.ShowRunLog("风送plc连接成功,并初始化完成"); | |||||
if (!SiemensDevice.IsConnected && Json<DevicePar>.Data.deviceConnectPar.SiemensConnect) | |||||
{ | |||||
SiemensDevice.Siemens_PLC_S7.Connect(S7.Net.CpuType.S71500, Siemens_PLC_IP); | |||||
if (SiemensDevice.IsConnected) MessageNotify.GetInstance.ShowRunLog("西门子PLC重新连接成功"); | |||||
} | |||||
} | } | ||||
} | |||||
catch (Exception ex) | |||||
{ | |||||
} | |||||
ThreadManage.GetInstance().StartLong(new Action(() => | |||||
{ | |||||
if (!HKDevice.IsConnected && Json<DevicePar>.Data.deviceConnectPar.HKPlcConnect) | |||||
catch (Exception ex) | |||||
{ | { | ||||
HKDevice.HK_PLC_S7.Connect(S7.Net.CpuType.S71200, HK_PLC_IP); | |||||
MessageNotify.GetInstance.ShowRunLog("海科PLC重新连接"); | |||||
if (HKDevice.IsConnected) MessageNotify.GetInstance.ShowRunLog("海科PLC重新连接成功"); | |||||
} | } | ||||
if (!SiemensDevice.IsConnected && Json<DevicePar>.Data.deviceConnectPar.SiemensConnect) | |||||
try | |||||
{ | { | ||||
SiemensDevice.Siemens_PLC_S7.Connect(S7.Net.CpuType.S71500, Siemens_PLC_IP); | |||||
MessageNotify.GetInstance.ShowRunLog("海科PLC重新连接"); | |||||
if (SiemensDevice.IsConnected) MessageNotify.GetInstance.ShowRunLog("海科PLC重新连接成功"); | |||||
if (!WindSendDevice.IsConnected && Json<DevicePar>.Data.deviceConnectPar.WindSendConnect) | |||||
{ | |||||
WindSendDevice.Siemens_PLC_S7.Connect(S7.Net.CpuType.S71200, WindSend_PLC_IP); | |||||
if (WindSendDevice.IsConnected) MessageNotify.GetInstance.ShowRunLog("风送plc重新连接成功"); | |||||
} | |||||
} | } | ||||
if (!WindSendDevice.IsConnected && Json<DevicePar>.Data.deviceConnectPar.WindSendConnect) | |||||
catch (Exception ex) | |||||
{ | { | ||||
WindSendDevice.Siemens_PLC_S7.Connect(S7.Net.CpuType.S71200, WindSend_PLC_IP); | |||||
MessageNotify.GetInstance.ShowRunLog("风送plc重新连接成功"); | |||||
} | } | ||||
Thread.Sleep(50); | Thread.Sleep(50); | ||||
}), "设备连接", true); | }), "设备连接", true); | ||||
RecipeQueue.Clear(); | |||||
RecipeQueueTray1.Clear(); | |||||
//手动控制系统模式 | //手动控制系统模式 | ||||
ActionManage.GetInstance.Register(new Action(() => { HKDevice.HK_PLC_S7.Write<bool>("DB44.DBX0.0", true); }), "SystemStart", true); | ActionManage.GetInstance.Register(new Action(() => { HKDevice.HK_PLC_S7.Write<bool>("DB44.DBX0.0", true); }), "SystemStart", true); | ||||
ActionManage.GetInstance.Register(new Action(() => { HKDevice.HK_PLC_S7.Write<bool>("DB44.DBX0.0", false); }), "SystemStop", true); | ActionManage.GetInstance.Register(new Action(() => { HKDevice.HK_PLC_S7.Write<bool>("DB44.DBX0.0", false); }), "SystemStop", true); | ||||
@@ -283,7 +323,6 @@ namespace BPASmartClient.JXJFoodSmallStation.Model | |||||
HKDevice.HK_PLC_S7.Write("DB47.DBD4", value); | HKDevice.HK_PLC_S7.Write("DB47.DBD4", value); | ||||
} | } | ||||
}), "Axis2SpeedSet", true); | }), "Axis2SpeedSet", true); | ||||
RecipeQueue.Clear(); | |||||
//Json<RemoteRecipeDataColl>.Data.Recipes = TestData.GetInstance.Recipes;//添加测试数据 | //Json<RemoteRecipeDataColl>.Data.Recipes = TestData.GetInstance.Recipes;//添加测试数据 | ||||
ThreadManage.GetInstance().StartLong(new Action(() => | ThreadManage.GetInstance().StartLong(new Action(() => | ||||
{ | { | ||||
@@ -308,7 +347,7 @@ namespace BPASmartClient.JXJFoodSmallStation.Model | |||||
}), "西门子配发下发流程处理", true); | }), "西门子配发下发流程处理", true); | ||||
ThreadManage.GetInstance().StartLong(new Action(() => | ThreadManage.GetInstance().StartLong(new Action(() => | ||||
{ | { | ||||
if (HKDevice.IsConnected) | |||||
if (!HKDevice.IsConnected) | |||||
{ | { | ||||
ManualOpen(); | ManualOpen(); | ||||
ManualClose(); | ManualClose(); | ||||
@@ -335,110 +374,36 @@ namespace BPASmartClient.JXJFoodSmallStation.Model | |||||
{ | { | ||||
if (o.ToString().Contains("升降气缸")) | if (o.ToString().Contains("升降气缸")) | ||||
{ | { | ||||
int index = Convert.ToInt16(o.ToString().Substring(o.ToString().Length - 1)); | |||||
switch (index) | |||||
int index = Convert.ToInt16(o.ToString().Substring(o.ToString().Length - 2)); | |||||
if (index >= 1 && index <= 15) | |||||
{ | { | ||||
case 1: | |||||
HKDevice.HK_PLC_S7.Write<bool>("DB5.DBX0.0", true); | |||||
break; | |||||
case 2: | |||||
HKDevice.HK_PLC_S7.Write<bool>("DB5.DBX0.1", true); | |||||
break; | |||||
case 3: | |||||
HKDevice.HK_PLC_S7.Write<bool>("DB5.DBX0.2", true); | |||||
break; | |||||
case 4: | |||||
HKDevice.HK_PLC_S7.Write<bool>("DB5.DBX0.3", true); | |||||
break; | |||||
case 5: | |||||
HKDevice.HK_PLC_S7.Write<bool>("DB5.DBX0.4", true); | |||||
break; | |||||
case 6: | |||||
HKDevice.HK_PLC_S7.Write<bool>("DB5.DBX0.5", true); | |||||
break; | |||||
case 7: | |||||
HKDevice.HK_PLC_S7.Write<bool>("DB5.DBX0.6", true); | |||||
break; | |||||
case 8: | |||||
HKDevice.HK_PLC_S7.Write<bool>("DB5.DBX0.7", true); | |||||
break; | |||||
case 9: | |||||
HKDevice.HK_PLC_S7.Write<bool>("DB5.DBX1.0", true); | |||||
break; | |||||
case 10: | |||||
HKDevice.HK_PLC_S7.Write<bool>("DB5.DBX1.1", true); | |||||
break; | |||||
case 11: | |||||
HKDevice.HK_PLC_S7.Write<bool>("DB5.DBX1.2", true); | |||||
break; | |||||
case 12: | |||||
HKDevice.HK_PLC_S7.Write<bool>("DB5.DBX1.3", true); | |||||
break; | |||||
case 13: | |||||
HKDevice.HK_PLC_S7.Write<bool>("DB5.DBX1.4", true); | |||||
break; | |||||
case 14: | |||||
HKDevice.HK_PLC_S7.Write<bool>("DB5.DBX1.5", true); | |||||
break; | |||||
case 15: | |||||
HKDevice.HK_PLC_S7.Write<bool>("DB5.DBX1.6", true); | |||||
break; | |||||
default: | |||||
break; | |||||
string address = "DB5.DBX" + (index / 8) + "." + (index % 8 - 1); | |||||
if (index == 8) address = "DB5.DBX0.7"; | |||||
HKDevice.HK_PLC_S7.Write<bool>(address, true); | |||||
} | } | ||||
} | } | ||||
else if (o.ToString().Contains("阻挡气缸")) | else if (o.ToString().Contains("阻挡气缸")) | ||||
{ | { | ||||
int index = Convert.ToInt16(o.ToString().Substring(o.ToString().Length - 1)); | |||||
switch (index) | |||||
int index = Convert.ToInt16(o.ToString().Substring(o.ToString().Length - 2)); | |||||
if (index >= 1 && index <= 15) | |||||
{ | { | ||||
case 1: | |||||
HKDevice.HK_PLC_S7.Write<bool>("DB5.DBX1.7", true); | |||||
break; | |||||
case 2: | |||||
HKDevice.HK_PLC_S7.Write<bool>("DB5.DBX2.0", true); | |||||
break; | |||||
case 3: | |||||
HKDevice.HK_PLC_S7.Write<bool>("DB5.DBX2.1", true); | |||||
break; | |||||
case 4: | |||||
HKDevice.HK_PLC_S7.Write<bool>("DB5.DBX2.2", true); | |||||
break; | |||||
case 5: | |||||
HKDevice.HK_PLC_S7.Write<bool>("DB5.DBX2.3", true); | |||||
break; | |||||
case 6: | |||||
HKDevice.HK_PLC_S7.Write<bool>("DB5.DBX2.4", true); | |||||
break; | |||||
case 7: | |||||
HKDevice.HK_PLC_S7.Write<bool>("DB5.DBX2.5", true); | |||||
break; | |||||
case 8: | |||||
HKDevice.HK_PLC_S7.Write<bool>("DB5.DBX2.6", true); | |||||
break; | |||||
case 9: | |||||
HKDevice.HK_PLC_S7.Write<bool>("DB5.DBX2.7", true); | |||||
break; | |||||
case 10: | |||||
HKDevice.HK_PLC_S7.Write<bool>("DB5.DBX3.0", true); | |||||
break; | |||||
case 11: | |||||
HKDevice.HK_PLC_S7.Write<bool>("DB5.DBX3.1", true); | |||||
break; | |||||
case 12: | |||||
HKDevice.HK_PLC_S7.Write<bool>("DB5.DBX3.2", true); | |||||
break; | |||||
case 13: | |||||
HKDevice.HK_PLC_S7.Write<bool>("DB5.DBX3.3", true); | |||||
break; | |||||
case 14: | |||||
HKDevice.HK_PLC_S7.Write<bool>("DB5.DBX3.4", true); | |||||
break; | |||||
case 15: | |||||
HKDevice.HK_PLC_S7.Write<bool>("DB5.DBX3.5", true); | |||||
break; | |||||
default: | |||||
break; | |||||
string address = ""; | |||||
if (index == 1) address = "DB5.DBX1.7"; | |||||
if (index == 2) address = "DB5.DBX2.0"; | |||||
if (index == 3) address = "DB5.DBX2.1"; | |||||
if (index == 4) address = "DB5.DBX2.2"; | |||||
if (index == 5) address = "DB5.DBX2.3"; | |||||
if (index == 6) address = "DB5.DBX2.4"; | |||||
if (index == 7) address = "DB5.DBX2.5"; | |||||
if (index == 8) address = "DB5.DBX2.6"; | |||||
if (index == 9) address = "DB5.DBX2.7"; | |||||
if (index == 10) address = "DB5.DBX3.0"; | |||||
if (index == 11) address = "DB5.DBX3.1"; | |||||
if (index == 12) address = "DB5.DBX3.2"; | |||||
if (index == 13) address = "DB5.DBX3.3"; | |||||
if (index == 14) address = "DB5.DBX3.4"; | |||||
if (index == 15) address = "DB5.DBX3.5"; | |||||
HKDevice.HK_PLC_S7.Write<bool>(address, true); | |||||
} | } | ||||
} | } | ||||
else if (o.ToString().Contains("进料桶顶升气缸")) | else if (o.ToString().Contains("进料桶顶升气缸")) | ||||
@@ -484,112 +449,36 @@ namespace BPASmartClient.JXJFoodSmallStation.Model | |||||
{ | { | ||||
if (o.ToString().Contains("升降气缸")) | if (o.ToString().Contains("升降气缸")) | ||||
{ | { | ||||
int index = Convert.ToInt16(o.ToString().Substring(o.ToString().Length - 1)); | |||||
switch (index) | |||||
int index = Convert.ToInt16(o.ToString().Substring(o.ToString().Length - 2)); | |||||
if (index >= 1 && index <= 15) | |||||
{ | { | ||||
case 1: | |||||
HKDevice.HK_PLC_S7.Write("DB5.DBX0.0", false); | |||||
break; | |||||
case 2: | |||||
HKDevice.HK_PLC_S7.Write("DB5.DBX0.1", false); | |||||
break; | |||||
case 3: | |||||
HKDevice.HK_PLC_S7.Write("DB5.DBX0.2", false); | |||||
break; | |||||
case 4: | |||||
HKDevice.HK_PLC_S7.Write("DB5.DBX0.3", false); | |||||
break; | |||||
case 5: | |||||
HKDevice.HK_PLC_S7.Write("DB5.DBX0.4", false); | |||||
break; | |||||
case 6: | |||||
HKDevice.HK_PLC_S7.Write("DB5.DBX0.5", false); | |||||
break; | |||||
case 7: | |||||
HKDevice.HK_PLC_S7.Write("DB5.DBX0.6", false); | |||||
break; | |||||
case 8: | |||||
HKDevice.HK_PLC_S7.Write("DB5.DBX0.7", false); | |||||
break; | |||||
case 9: | |||||
HKDevice.HK_PLC_S7.Write("DB5.DBX1.0", false); | |||||
break; | |||||
case 10: | |||||
HKDevice.HK_PLC_S7.Write("DB5.DBX1.1", false); | |||||
break; | |||||
case 11: | |||||
HKDevice.HK_PLC_S7.Write("DB5.DBX1.2", false); | |||||
break; | |||||
case 12: | |||||
HKDevice.HK_PLC_S7.Write("DB5.DBX1.3", false); | |||||
break; | |||||
case 13: | |||||
HKDevice.HK_PLC_S7.Write("DB5.DBX1.4", false); | |||||
break; | |||||
case 14: | |||||
HKDevice.HK_PLC_S7.Write("DB5.DBX1.5", false); | |||||
break; | |||||
case 15: | |||||
HKDevice.HK_PLC_S7.Write("DB5.DBX1.6", false); | |||||
break; | |||||
default: | |||||
break; | |||||
string address = "DB5.DBX" + (index / 8) + "." + (index % 8 - 1); | |||||
if (index == 8) address = "DB5.DBX0.7"; | |||||
HKDevice.HK_PLC_S7.Write<bool>(address, false); | |||||
} | } | ||||
} | } | ||||
else if (o.ToString().Contains("阻挡气缸")) | else if (o.ToString().Contains("阻挡气缸")) | ||||
{ | { | ||||
int index = Convert.ToInt16(o.ToString().Substring(o.ToString().Length - 1)); | |||||
switch (index) | |||||
int index = Convert.ToInt16(o.ToString().Substring(o.ToString().Length - 2)); | |||||
if (index >= 1 && index <= 15) | |||||
{ | { | ||||
case 1: | |||||
HKDevice.HK_PLC_S7.Write("DB5.DBX1.7", false); | |||||
break; | |||||
case 2: | |||||
HKDevice.HK_PLC_S7.Write("DB5.DBX2.0", false); | |||||
break; | |||||
case 3: | |||||
HKDevice.HK_PLC_S7.Write("DB5.DBX2.1", false); | |||||
break; | |||||
case 4: | |||||
HKDevice.HK_PLC_S7.Write("DB5.DBX2.2", false); | |||||
break; | |||||
case 5: | |||||
HKDevice.HK_PLC_S7.Write("DB5.DBX2.3", false); | |||||
break; | |||||
case 6: | |||||
HKDevice.HK_PLC_S7.Write("DB5.DBX2.4", false); | |||||
break; | |||||
case 7: | |||||
HKDevice.HK_PLC_S7.Write("DB5.DBX2.5", false); | |||||
break; | |||||
case 8: | |||||
HKDevice.HK_PLC_S7.Write("DB5.DBX2.6", false); | |||||
break; | |||||
case 9: | |||||
HKDevice.HK_PLC_S7.Write("DB5.DBX2.7", false); | |||||
break; | |||||
case 10: | |||||
HKDevice.HK_PLC_S7.Write("DB5.DBX3.0", false); | |||||
break; | |||||
case 11: | |||||
HKDevice.HK_PLC_S7.Write("DB5.DBX3.1", false); | |||||
break; | |||||
case 12: | |||||
HKDevice.HK_PLC_S7.Write("DB5.DBX3.2", false); | |||||
break; | |||||
case 13: | |||||
HKDevice.HK_PLC_S7.Write("DB5.DBX3.3", false); | |||||
break; | |||||
case 14: | |||||
HKDevice.HK_PLC_S7.Write("DB5.DBX3.4", false); | |||||
break; | |||||
case 15: | |||||
HKDevice.HK_PLC_S7.Write("DB5.DBX3.5", false); | |||||
break; | |||||
default: | |||||
break; | |||||
string address = ""; | |||||
if (index == 1) address = "DB5.DBX1.7"; | |||||
if (index == 2) address = "DB5.DBX2.0"; | |||||
if (index == 3) address = "DB5.DBX2.1"; | |||||
if (index == 4) address = "DB5.DBX2.2"; | |||||
if (index == 5) address = "DB5.DBX2.3"; | |||||
if (index == 6) address = "DB5.DBX2.4"; | |||||
if (index == 7) address = "DB5.DBX2.5"; | |||||
if (index == 8) address = "DB5.DBX2.6"; | |||||
if (index == 9) address = "DB5.DBX2.7"; | |||||
if (index == 10) address = "DB5.DBX3.0"; | |||||
if (index == 11) address = "DB5.DBX3.1"; | |||||
if (index == 12) address = "DB5.DBX3.2"; | |||||
if (index == 13) address = "DB5.DBX3.3"; | |||||
if (index == 14) address = "DB5.DBX3.4"; | |||||
if (index == 15) address = "DB5.DBX3.5"; | |||||
HKDevice.HK_PLC_S7.Write<bool>(address, false); | |||||
} | } | ||||
} | } | ||||
else if (o.ToString().Contains("进料桶顶升气缸")) | else if (o.ToString().Contains("进料桶顶升气缸")) | ||||
@@ -624,7 +513,6 @@ namespace BPASmartClient.JXJFoodSmallStation.Model | |||||
{ | { | ||||
HKDevice.HK_PLC_S7.Write("DB5.DBX4.5", true); | HKDevice.HK_PLC_S7.Write("DB5.DBX4.5", true); | ||||
} | } | ||||
} | } | ||||
}), "ManualClose", true);//根据下发的配方ID将 托盘的位置信息添加到配方中 | }), "ManualClose", true);//根据下发的配方ID将 托盘的位置信息添加到配方中 | ||||
} | } | ||||
@@ -650,7 +538,6 @@ namespace BPASmartClient.JXJFoodSmallStation.Model | |||||
if (HKDevice.HK_PLC_S7.Read<bool>("DB3.DBX1.7"))//允许下配方1或者允许下配方2 | if (HKDevice.HK_PLC_S7.Read<bool>("DB3.DBX1.7"))//允许下配方1或者允许下配方2 | ||||
{ | { | ||||
GVL_SmallStation.IsAllowSiemensSendRecipe = true; | GVL_SmallStation.IsAllowSiemensSendRecipe = true; | ||||
//MessageNotify.GetInstance.ShowRunLog("Plc允许下发配方"); | |||||
} | } | ||||
GVL_SmallStation.Station1Sensor = HKDevice.HK_PLC_S7.Read<bool>("DB3.DBX2.1"); | GVL_SmallStation.Station1Sensor = HKDevice.HK_PLC_S7.Read<bool>("DB3.DBX2.1"); | ||||
@@ -699,7 +586,6 @@ namespace BPASmartClient.JXJFoodSmallStation.Model | |||||
GVL_SmallStation.AGV_GetTray1Finish = false; | GVL_SmallStation.AGV_GetTray1Finish = false; | ||||
} | } | ||||
} | } | ||||
} | } | ||||
} | } | ||||
if (SiemensDevice.IsConnected) | if (SiemensDevice.IsConnected) | ||||
@@ -750,7 +636,7 @@ namespace BPASmartClient.JXJFoodSmallStation.Model | |||||
{ | { | ||||
if (data.TrayCode == 1) | if (data.TrayCode == 1) | ||||
{ | { | ||||
if (!(RecipeQueue.Contains(data.RecipeCode))) | |||||
if (!(RecipeQueueTray1.Contains(data.RecipeCode))) | |||||
{ | { | ||||
if (SiemensDevice.XL_Status is XL_Status_DB status) | if (SiemensDevice.XL_Status is XL_Status_DB status) | ||||
{ | { | ||||
@@ -766,7 +652,7 @@ namespace BPASmartClient.JXJFoodSmallStation.Model | |||||
if (SiemensDevice.XL_Status.Dosing_Confirm) | if (SiemensDevice.XL_Status.Dosing_Confirm) | ||||
{ | { | ||||
GVL_SmallStation.SiemensSendRecipeStatus = 5; | GVL_SmallStation.SiemensSendRecipeStatus = 5; | ||||
SiemensDevice.Siemens_PLC_S7.WriteString(2231, "", 10); | |||||
SiemensDevice.Siemens_PLC_S7.WriteString(2231, "", 10);//复位字符串 | |||||
SiemensDevice.Siemens_PLC_S7.Write("DB2231.DBX28.0", false); | SiemensDevice.Siemens_PLC_S7.Write("DB2231.DBX28.0", false); | ||||
MessageNotify.GetInstance.ShowRunLog($"配方{data.RecipeCode},配料信号复位"); | MessageNotify.GetInstance.ShowRunLog($"配方{data.RecipeCode},配料信号复位"); | ||||
} | } | ||||
@@ -776,7 +662,7 @@ namespace BPASmartClient.JXJFoodSmallStation.Model | |||||
MessageNotify.GetInstance.ShowRunLog($"配方{data.RecipeCode},西门子确认配料"); | MessageNotify.GetInstance.ShowRunLog($"配方{data.RecipeCode},西门子确认配料"); | ||||
if (SiemensDevice.XL_Status.Dosing_Confirm == false) | if (SiemensDevice.XL_Status.Dosing_Confirm == false) | ||||
{ | { | ||||
RecipeQueue.Enqueue(data.RecipeCode); | |||||
RecipeQueueTray1.Enqueue(data.RecipeCode); | |||||
GVL_SmallStation.SiemensSendRecipeStatus = 6; | GVL_SmallStation.SiemensSendRecipeStatus = 6; | ||||
MessageNotify.GetInstance.ShowRunLog($"配方{data.RecipeCode},加入队列"); | MessageNotify.GetInstance.ShowRunLog($"配方{data.RecipeCode},加入队列"); | ||||
} | } | ||||
@@ -820,7 +706,7 @@ namespace BPASmartClient.JXJFoodSmallStation.Model | |||||
} | } | ||||
else | else | ||||
{ | { | ||||
RecipeQueue.Clear(); | |||||
RecipeQueueTray1.Clear(); | |||||
RecipeQueueTray2.Clear(); | RecipeQueueTray2.Clear(); | ||||
GVL_SmallStation.GetInstance.RecipeStatusID = 0; | GVL_SmallStation.GetInstance.RecipeStatusID = 0; | ||||
GVL_SmallStation.GetInstance.RecipeStatusIDTray2 = 0; | GVL_SmallStation.GetInstance.RecipeStatusIDTray2 = 0; | ||||
@@ -835,9 +721,9 @@ namespace BPASmartClient.JXJFoodSmallStation.Model | |||||
{ | { | ||||
if (data.TrayCode == 1) | if (data.TrayCode == 1) | ||||
{ | { | ||||
if (!(RecipeQueue.Contains(data.RecipeCode))) | |||||
if (!(RecipeQueueTray1.Contains(data.RecipeCode))) | |||||
{ | { | ||||
RecipeQueue.Enqueue(data.RecipeCode); | |||||
RecipeQueueTray1.Enqueue(data.RecipeCode); | |||||
} | } | ||||
} | } | ||||
else if (data.TrayCode == 2) | else if (data.TrayCode == 2) | ||||
@@ -852,7 +738,7 @@ namespace BPASmartClient.JXJFoodSmallStation.Model | |||||
} | } | ||||
else | else | ||||
{ | { | ||||
RecipeQueue.Clear(); | |||||
RecipeQueueTray1.Clear(); | |||||
RecipeQueueTray2.Clear(); | RecipeQueueTray2.Clear(); | ||||
GVL_SmallStation.GetInstance.DosingTray1 = false; | GVL_SmallStation.GetInstance.DosingTray1 = false; | ||||
@@ -865,15 +751,121 @@ namespace BPASmartClient.JXJFoodSmallStation.Model | |||||
GVL_SmallStation.GetInstance.RecipeStatusIDTray2 = 0; | GVL_SmallStation.GetInstance.RecipeStatusIDTray2 = 0; | ||||
} | } | ||||
} | } | ||||
if (GVL_SmallStation.Order_Cancel) //订单取消 | |||||
{ | |||||
if (!string.IsNullOrEmpty(GVL_SmallStation.Order_CancelRecipeCode)) | |||||
{ | |||||
string code = GVL_SmallStation.Order_CancelRecipeCode; | |||||
int index = Array.FindIndex(Json<RemoteRecipeDataColl>.Data.Recipes.ToArray(), p => p.RecipeCode == code); | |||||
if (index >= 0) | |||||
{ | |||||
short TrayCode = (short)Json<RemoteRecipeDataColl>.Data.Recipes.ElementAt(index).TrayCode; | |||||
if (RecipeQueueTray1.Contains(code) || RecipeQueueTray1.Contains(code)) | |||||
{ | |||||
if (RecipeQueueTray1.Contains(code)) | |||||
{ | |||||
App.Current.Dispatcher.Invoke(() => | |||||
{ | |||||
Json<RemoteRecipeDataColl>.Data.Recipes.RemoveAt(index); | |||||
}); | |||||
if (GVL_SmallStation.GetInstance.RecipeStatusID != 0) | |||||
{ | |||||
HKDevice.HK_PLC_S7.Write("DB4.DBX2.1", true); | |||||
DateTime dateTime = DateTime.Now; | |||||
MessageNotify.GetInstance.ShowRunLog($"PLC正在执行配料流程,正在取消订单:{code}"); | |||||
while (!(HKDevice.HK_PLC_S7.Read<bool>("DB3.DBX2.5") || DateTime.Now.Subtract(dateTime).TotalSeconds >= 10)) | |||||
{ | |||||
if (DateTime.Now.Subtract(dateTime).TotalSeconds > 1) | |||||
{ | |||||
MessageNotify.GetInstance.ShowRunLog($"等待PLC取消订单完成:{code}"); | |||||
} | |||||
} | |||||
MessageNotify.GetInstance.ShowRunLog($"PLC正在执行配料流程,取消订单:{code}"); | |||||
} | |||||
else | |||||
{ | |||||
MessageNotify.GetInstance.ShowRunLog($"AGV未到达工站前,未给plc下发配方,取消订单:{code}"); | |||||
} | |||||
GVL_SmallStation.GetInstance.RecipeStatusID = 0; | |||||
RecipeQueueTray1.TryDequeue(out code); | |||||
SiemensDevice.Siemens_PLC_S7.Write("DB2201.DBX440.1", false); | |||||
SiemensDevice.Siemens_PLC_S7.Write("DB2201.DBX450.1", true); | |||||
MessageNotify.GetInstance.ShowRunLog($"队列1,西门子取消订单完成,订单号:{code}"); | |||||
} | |||||
else if (RecipeQueueTray2.Contains(code)) | |||||
{ | |||||
App.Current.Dispatcher.Invoke(() => | |||||
{ | |||||
Json<RemoteRecipeDataColl>.Data.Recipes.RemoveAt(index); | |||||
}); | |||||
if (GVL_SmallStation.GetInstance.RecipeStatusID != 0) | |||||
{ | |||||
HKDevice.HK_PLC_S7.Write("DB4.DBX2.2", true); | |||||
DateTime dateTime = DateTime.Now; | |||||
MessageNotify.GetInstance.ShowRunLog($"PLC正在执行配料流程,正在取消订单:{code}"); | |||||
while (!(HKDevice.HK_PLC_S7.Read<bool>("DB3.DBX2.6") || DateTime.Now.Subtract(dateTime).TotalSeconds >= 10)) | |||||
{ | |||||
if (DateTime.Now.Subtract(dateTime).TotalSeconds > 1) | |||||
{ | |||||
MessageNotify.GetInstance.ShowRunLog($"等待PLC取消订单完成:{code}"); | |||||
} | |||||
} | |||||
MessageNotify.GetInstance.ShowRunLog($"PLC正在执行配料流程,已经取消订单:{code}"); | |||||
} | |||||
else | |||||
{ | |||||
MessageNotify.GetInstance.ShowRunLog($"AGV未到达工站前,未给plc下发配方,取消订单:{code}"); | |||||
} | |||||
GVL_SmallStation.GetInstance.RecipeStatusID = 0; | |||||
RecipeQueueTray2.TryDequeue(out code); | |||||
SiemensDevice.Siemens_PLC_S7.Write("DB2201.DBX440.1", false); | |||||
SiemensDevice.Siemens_PLC_S7.Write("DB2201.DBX450.1", true); | |||||
MessageNotify.GetInstance.ShowRunLog($"队列2,西门子取消订单完成,订单号:{code}"); | |||||
} | |||||
GVL_SmallStation.Order_Cancel = false; | |||||
GVL_SmallStation.Order_CancelRecipeCode = ""; | |||||
} | |||||
else | |||||
{ | |||||
if (GVL_SmallStation.SiemensSendRecipeStatus != 0 || GVL_SmallStation.SiemensSendRecipeStatus != 1) | |||||
{ | |||||
GVL_SmallStation.SiemensSendRecipeStatus = 0; | |||||
App.Current.Dispatcher.Invoke(() => | |||||
{ | |||||
Json<RemoteRecipeDataColl>.Data.Recipes.RemoveAt(index); | |||||
}); | |||||
MessageNotify.GetInstance.ShowRunLog($"正在执行请求订单流程,配方还未到PLC,订单号:{code}"); | |||||
} | |||||
else | |||||
{ | |||||
MessageNotify.GetInstance.ShowRunLog($"订单取消异常,订单号:{code}"); | |||||
} | |||||
GVL_SmallStation.Order_Cancel = false; | |||||
GVL_SmallStation.Order_CancelRecipeCode = ""; | |||||
SiemensDevice.Siemens_PLC_S7.Write("DB2201.DBX440.1", false); | |||||
SiemensDevice.Siemens_PLC_S7.Write("DB2201.DBX450.1", true); | |||||
} | |||||
} | |||||
else | |||||
{ | |||||
GVL_SmallStation.Order_Cancel = false; | |||||
GVL_SmallStation.Order_CancelRecipeCode = ""; | |||||
SiemensDevice.Siemens_PLC_S7.Write("DB2201.DBX440.1", false); | |||||
SiemensDevice.Siemens_PLC_S7.Write("DB2201.DBX450.1", true); | |||||
MessageNotify.GetInstance.ShowRunLog($"西门子取消订单,但未找到订单:{code}"); | |||||
} | |||||
} | |||||
} | |||||
} | } | ||||
/// <summary> | /// <summary> | ||||
/// 执行配方队列中的第一个配方 | /// 执行配方队列中的第一个配方 | ||||
/// </summary> | /// </summary> | ||||
private void RecipeInfoToHKPLC() | private void RecipeInfoToHKPLC() | ||||
{ | { | ||||
if (RecipeQueue.Count > 0 && GVL_SmallStation.TrayLogicFinish) | |||||
if (RecipeQueueTray1.Count > 0 && GVL_SmallStation.TrayLogicFinish) | |||||
{ | { | ||||
int index = Array.FindIndex(RemoteRecipes.ToArray(), p => p.RecipeCode == RecipeQueue.ElementAt(0)); | |||||
int index = Array.FindIndex(RemoteRecipes.ToArray(), p => p.RecipeCode == RecipeQueueTray1.ElementAt(0)); | |||||
if (index >= 0 && index < RemoteRecipes.Count) | if (index >= 0 && index < RemoteRecipes.Count) | ||||
{ | { | ||||
string code = RemoteRecipes.ElementAt(index).RecipeCode; | string code = RemoteRecipes.ElementAt(index).RecipeCode; | ||||
@@ -955,7 +947,7 @@ namespace BPASmartClient.JXJFoodSmallStation.Model | |||||
{ | { | ||||
var res = HKDevice.HK_PLC_S7.Read<float>("DB3.DBD14"); | var res = HKDevice.HK_PLC_S7.Read<float>("DB3.DBD14"); | ||||
MessageNotify.GetInstance.ShowRunLog($"托盘1,配方:{recipeName},2号桶,{res}料仓,允许配料"); | MessageNotify.GetInstance.ShowRunLog($"托盘1,配方:{recipeName},2号桶,{res}料仓,允许配料"); | ||||
if (res > 0 && res is float loc) | |||||
if (res > 0 && res is float loc) | |||||
{ | { | ||||
int loc_index = Array.FindIndex(RemoteRecipes.ElementAt(index).RawMaterial.ToArray(), p => p.RawMaterialLocation == loc); | int loc_index = Array.FindIndex(RemoteRecipes.ElementAt(index).RawMaterial.ToArray(), p => p.RawMaterialLocation == loc); | ||||
float weight = RemoteRecipes.ElementAt(index).RawMaterial.ElementAt(loc_index).RawMaterialWeight * 1000; | float weight = RemoteRecipes.ElementAt(index).RawMaterial.ElementAt(loc_index).RawMaterialWeight * 1000; | ||||
@@ -976,7 +968,7 @@ namespace BPASmartClient.JXJFoodSmallStation.Model | |||||
if (res > 0 && res is float loc) | if (res > 0 && res is float loc) | ||||
{ | { | ||||
int loc_index = Array.FindIndex(RemoteRecipes.ElementAt(index).RawMaterial.ToArray(), p => p.RawMaterialLocation == loc); | int loc_index = Array.FindIndex(RemoteRecipes.ElementAt(index).RawMaterial.ToArray(), p => p.RawMaterialLocation == loc); | ||||
float weight = RemoteRecipes.ElementAt(index).RawMaterial.ElementAt(loc_index).RawMaterialWeight*1000; | |||||
float weight = RemoteRecipes.ElementAt(index).RawMaterial.ElementAt(loc_index).RawMaterialWeight * 1000; | |||||
if (loc_index >= 0) | if (loc_index >= 0) | ||||
{ | { | ||||
DeviceInquire.GetInstance.GetDevice((int)loc)?.Start(weight);//启动并写入每个原料重量 | DeviceInquire.GetInstance.GetDevice((int)loc)?.Start(weight);//启动并写入每个原料重量 | ||||
@@ -994,7 +986,7 @@ namespace BPASmartClient.JXJFoodSmallStation.Model | |||||
if (res > 0 && res is float loc) | if (res > 0 && res is float loc) | ||||
{ | { | ||||
int loc_index = Array.FindIndex(RemoteRecipes.ElementAt(index).RawMaterial.ToArray(), p => p.RawMaterialLocation == loc); | int loc_index = Array.FindIndex(RemoteRecipes.ElementAt(index).RawMaterial.ToArray(), p => p.RawMaterialLocation == loc); | ||||
float weight = RemoteRecipes.ElementAt(index).RawMaterial.ElementAt(loc_index).RawMaterialWeight*1000; | |||||
float weight = RemoteRecipes.ElementAt(index).RawMaterial.ElementAt(loc_index).RawMaterialWeight * 1000; | |||||
if (loc_index >= 0) | if (loc_index >= 0) | ||||
{ | { | ||||
DeviceInquire.GetInstance.GetDevice((int)loc)?.Start(weight);//启动并写入每个原料重量 | DeviceInquire.GetInstance.GetDevice((int)loc)?.Start(weight);//启动并写入每个原料重量 | ||||
@@ -1082,7 +1074,7 @@ namespace BPASmartClient.JXJFoodSmallStation.Model | |||||
{ | { | ||||
Json<RemoteRecipeDataColl>.Data.Recipes.Remove(res); | Json<RemoteRecipeDataColl>.Data.Recipes.Remove(res); | ||||
}); | }); | ||||
RecipeQueue.TryDequeue(out code); | |||||
RecipeQueueTray1.TryDequeue(out code); | |||||
HKDevice.HK_PLC_S7.Write("DB3.DBX1.1", false); | HKDevice.HK_PLC_S7.Write("DB3.DBX1.1", false); | ||||
GVL_SmallStation.GetInstance.RecipeStatusID = 0; | GVL_SmallStation.GetInstance.RecipeStatusID = 0; | ||||
} | } | ||||
@@ -60,7 +60,7 @@ namespace BPASmartClient.JXJFoodSmallStation.Model | |||||
} | } | ||||
} | } | ||||
Thread.Sleep(200); | Thread.Sleep(200); | ||||
}), "设备状态监听"); | |||||
}), "设备状态监听",true); | |||||
} | } | ||||
private void TestData() | private void TestData() | ||||
{ | { | ||||
@@ -7,6 +7,7 @@ using System.Text; | |||||
using System.Threading.Tasks; | using System.Threading.Tasks; | ||||
using BPASmartClient.S7Net; | using BPASmartClient.S7Net; | ||||
using System.Threading; | using System.Threading; | ||||
using BPASmartClient.CustomResource.Pages.Model; | |||||
namespace BPASmartClient.JXJFoodSmallStation.Model.Siemens | namespace BPASmartClient.JXJFoodSmallStation.Model.Siemens | ||||
{ | { | ||||
@@ -47,6 +48,12 @@ namespace BPASmartClient.JXJFoodSmallStation.Model.Siemens | |||||
GVL_SmallStation.IsAllowSiemensSendRecipe = false; | GVL_SmallStation.IsAllowSiemensSendRecipe = false; | ||||
GVL_SmallStation.SiemensSendRecipeStatus = 3; | GVL_SmallStation.SiemensSendRecipeStatus = 3; | ||||
} | } | ||||
if (RTrig.GetInstance("Order_Cancel").Start(st.Order_Cancel)) //订单取消 | |||||
{ | |||||
GVL_SmallStation.Order_Cancel = true; | |||||
GVL_SmallStation.Order_CancelRecipeCode = st.RecipeCode; | |||||
MessageNotify.GetInstance.ShowRunLog($"西门子下发取消工单指令:{st.RecipeName}"); | |||||
} | |||||
} | } | ||||
if (Finish != null && Finish is XL_Finish_DB FinishData) | if (Finish != null && Finish is XL_Finish_DB FinishData) | ||||
{ | { | ||||
@@ -76,8 +83,6 @@ namespace BPASmartClient.JXJFoodSmallStation.Model.Siemens | |||||
XL_Status.Powder[i] = new PowderStatus(); | XL_Status.Powder[i] = new PowderStatus(); | ||||
} | } | ||||
XL_Status = state; | XL_Status = state; | ||||
} | } | ||||
var res = ProcessControl.GetInstance.HKDevice.DeviceStatus; | var res = ProcessControl.GetInstance.HKDevice.DeviceStatus; | ||||
@@ -37,11 +37,13 @@ namespace BPASmartClient.JXJFoodSmallStation.Model.Siemens | |||||
/// 西门子下发订单 | /// 西门子下发订单 | ||||
/// </summary> | /// </summary> | ||||
public bool Order_Request_ACK { get; set; } | public bool Order_Request_ACK { get; set; } | ||||
public bool Order_Cancel { get; set; } | |||||
public short[] Standby { get; set; } = new short[4]; | public short[] Standby { get; set; } = new short[4]; | ||||
/// <summary> | /// <summary> | ||||
/// 上位机订单请求 | /// 上位机订单请求 | ||||
/// </summary> | /// </summary> | ||||
public bool Order_Request { get; set; } | public bool Order_Request { get; set; } | ||||
public bool Order_Cancel_ACK { get; set; } | |||||
public short[] Standby1 { get; set; } = new short[4]; | public short[] Standby1 { get; set; } = new short[4]; | ||||
} | } | ||||
@@ -0,0 +1,32 @@ | |||||
using System; | |||||
using System.Collections.Generic; | |||||
using System.Linq; | |||||
using System.Text; | |||||
using System.Threading.Tasks; | |||||
namespace BPASmartClient.JXJFoodSmallStation.Model | |||||
{ | |||||
public class VarMonitor | |||||
{ | |||||
/// <summary> | |||||
/// 序号 | |||||
/// </summary> | |||||
public int SerialNum { get; set; } | |||||
/// <summary> | |||||
/// 变量地址 | |||||
/// </summary> | |||||
public string Address { get; set; } | |||||
/// <summary> | |||||
/// 变量描述 | |||||
/// </summary> | |||||
public string Describe { get; set; } | |||||
/// <summary> | |||||
/// 变量值当前值 | |||||
/// </summary> | |||||
public string NowValue { get; set; } | |||||
/// <summary> | |||||
/// 变量值设定值 | |||||
/// </summary> | |||||
public string SetValue { get; set; } | |||||
} | |||||
} |
@@ -66,11 +66,11 @@ | |||||
<Grid.ColumnDefinitions> | <Grid.ColumnDefinitions> | ||||
<ColumnDefinition Width="1*"/> | <ColumnDefinition Width="1*"/> | ||||
<ColumnDefinition Width="1*"/> | |||||
<ColumnDefinition Width="1*"/> | |||||
<ColumnDefinition Width="1*"/> | |||||
<ColumnDefinition Width="1*"/> | |||||
<ColumnDefinition Width="1*"/> | |||||
<ColumnDefinition Width="3*"/> | |||||
<ColumnDefinition Width="4*"/> | |||||
<ColumnDefinition Width="2*"/> | |||||
<ColumnDefinition Width="2*"/> | |||||
<ColumnDefinition Width="2*"/> | |||||
</Grid.ColumnDefinitions> | </Grid.ColumnDefinitions> | ||||
<Grid Grid.Column="0"> | <Grid Grid.Column="0"> | ||||
<TextBlock Text="序号" HorizontalAlignment="Center" VerticalAlignment="Center" Foreground="Aqua"/> | <TextBlock Text="序号" HorizontalAlignment="Center" VerticalAlignment="Center" Foreground="Aqua"/> | ||||
@@ -96,12 +96,12 @@ | |||||
<DataTemplate> | <DataTemplate> | ||||
<Grid Name="gr" > | <Grid Name="gr" > | ||||
<Grid.ColumnDefinitions> | <Grid.ColumnDefinitions> | ||||
<ColumnDefinition /> | |||||
<ColumnDefinition /> | |||||
<ColumnDefinition /> | |||||
<ColumnDefinition /> | |||||
<ColumnDefinition /> | |||||
<ColumnDefinition /> | |||||
<ColumnDefinition Width="1*"/> | |||||
<ColumnDefinition Width="3*"/> | |||||
<ColumnDefinition Width="4*"/> | |||||
<ColumnDefinition Width="2*"/> | |||||
<ColumnDefinition Width="2*"/> | |||||
<ColumnDefinition Width="2*"/> | |||||
</Grid.ColumnDefinitions> | </Grid.ColumnDefinitions> | ||||
<Grid Grid.Column="0"> | <Grid Grid.Column="0"> | ||||
<TextBlock | <TextBlock | ||||
@@ -142,7 +142,8 @@ | |||||
</Grid> | </Grid> | ||||
<Grid Grid.Column="5"> | <Grid Grid.Column="5"> | ||||
<pry:IcoButton | <pry:IcoButton | ||||
Command="{Binding EStopCommand}" | |||||
Command="{Binding DataContext.SetParCommand, RelativeSource={RelativeSource AncestorType=ItemsControl, Mode=FindAncestor}}" | |||||
CommandParameter="{Binding Address}" | |||||
Grid.Column="0" | Grid.Column="0" | ||||
Margin="40,5,40,5" | Margin="40,5,40,5" | ||||
Content="设置" | Content="设置" | ||||
@@ -74,6 +74,15 @@ | |||||
FontSize="20" | FontSize="20" | ||||
Panel.ZIndex="0" | Panel.ZIndex="0" | ||||
Style="{StaticResource ImageButtonStyle}"></Button> | Style="{StaticResource ImageButtonStyle}"></Button> | ||||
<Button | |||||
Width="200" | |||||
Height="40" | |||||
Margin="50,0,50,0" | |||||
Command="{Binding BPAResetCommand}" | |||||
Content="上位机初始化" | |||||
FontSize="20" | |||||
Panel.ZIndex="0" | |||||
Style="{StaticResource ImageButtonStyle}"></Button> | |||||
</StackPanel> | </StackPanel> | ||||
@@ -0,0 +1,349 @@ | |||||
<UserControl x:Class="BPASmartClient.JXJFoodSmallStation.View.RobotView" | |||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | |||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | |||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" | |||||
xmlns:pry="clr-namespace:BPASmartClient.CustomResource.UserControls;assembly=BPASmartClient.CustomResource" | |||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" | |||||
xmlns:vm="clr-namespace:BPASmartClient.JXJFoodSmallStation.ViewModel" | |||||
mc:Ignorable="d" | |||||
d:DesignHeight="1080" d:DesignWidth="1920"> | |||||
<UserControl.Resources> | |||||
<Style x:Key="radioButtonStyle" TargetType="RadioButton"> | |||||
<Setter Property="Template"> | |||||
<Setter.Value> | |||||
<ControlTemplate TargetType="RadioButton"> | |||||
<Grid Name="gr" Opacity="0.8"> | |||||
<ContentControl | |||||
Margin="{TemplateBinding Margin}" | |||||
HorizontalAlignment="Center" | |||||
VerticalAlignment="Center" | |||||
HorizontalContentAlignment="Center" | |||||
VerticalContentAlignment="Center" | |||||
Content="{TemplateBinding Content}" | |||||
FontSize="{TemplateBinding FontSize}" | |||||
Foreground="{TemplateBinding Foreground}" /> | |||||
<Image | |||||
Name="image" | |||||
Source="/BPASmartClient.CustomResource;component/Image/边框线.png" | |||||
Stretch="Fill" /> | |||||
</Grid> | |||||
<ControlTemplate.Triggers> | |||||
<Trigger Property="IsChecked" Value="False"> | |||||
<Setter TargetName="image" Property="Source" Value="/BPASmartClient.CustomResource;component/Image/边框线.png" /> | |||||
</Trigger> | |||||
<Trigger Property="IsChecked" Value="True"> | |||||
<Setter TargetName="image" Property="Source" Value="/BPASmartClient.CustomResource;component/Image/透明背景.png" /> | |||||
</Trigger> | |||||
<Trigger Property="IsMouseOver" Value="True"> | |||||
<Setter TargetName="gr" Property="Opacity" Value="1" /> | |||||
</Trigger> | |||||
</ControlTemplate.Triggers> | |||||
</ControlTemplate> | |||||
</Setter.Value> | |||||
</Setter> | |||||
</Style> | |||||
</UserControl.Resources> | |||||
<UserControl.DataContext> | |||||
<vm:RobotViewModel/> | |||||
</UserControl.DataContext> | |||||
<Grid Margin="10"> | |||||
<Grid.ColumnDefinitions> | |||||
<ColumnDefinition Width="7*"/> | |||||
<ColumnDefinition Width="3*"/> | |||||
</Grid.ColumnDefinitions> | |||||
<!--#region 表格标题栏设置--> | |||||
<!--<Grid> | |||||
<StackPanel Orientation="Horizontal" HorizontalAlignment="left" VerticalAlignment="Center"> | |||||
<Button | |||||
Width="200" | |||||
Height="40" | |||||
Margin="5,0,5,0" | |||||
Command="{Binding Test1Command}" | |||||
Content="AGV送托盘完成" | |||||
FontSize="20" | |||||
Panel.ZIndex="0" | |||||
Style="{StaticResource ImageButtonStyle}"></Button> | |||||
<Button | |||||
Width="200" | |||||
Height="40" | |||||
Margin="5,0,5,0" | |||||
Command="{Binding Test2Command}" | |||||
Content="粉料仓配料完成" | |||||
FontSize="20" | |||||
Panel.ZIndex="0" | |||||
Style="{StaticResource ImageButtonStyle}"></Button> | |||||
<Button | |||||
Width="200" | |||||
Height="40" | |||||
Margin="5,0,5,0" | |||||
Command="{Binding Test3Command}" | |||||
Content="AGV取托盘完成" | |||||
FontSize="20" | |||||
Panel.ZIndex="0" | |||||
Style="{StaticResource ImageButtonStyle}"></Button> | |||||
<Button | |||||
Width="200" | |||||
Height="40" | |||||
Margin="5,0,5,0" | |||||
Command="{Binding Test4Command}" | |||||
Content="气缸收紧错位复位" | |||||
FontSize="20" | |||||
Panel.ZIndex="0" | |||||
Style="{StaticResource ImageButtonStyle}"></Button> | |||||
<Button | |||||
Width="200" | |||||
Height="40" | |||||
Margin="5,0,5,0" | |||||
Command="{Binding Test5Command}" | |||||
Content="粉料仓提升到位" | |||||
FontSize="20" | |||||
Panel.ZIndex="0" | |||||
Style="{StaticResource ImageButtonStyle}"></Button> | |||||
<Button | |||||
Width="200" | |||||
Height="40" | |||||
Margin="5,0,5,0" | |||||
Command="{Binding Test6Command}" | |||||
Content="AGV放货架流程完成" | |||||
FontSize="20" | |||||
Panel.ZIndex="0" | |||||
Style="{StaticResource ImageButtonStyle}"></Button> | |||||
<Button | |||||
Width="200" | |||||
Height="40" | |||||
Margin="50,0,50,0" | |||||
Command="{Binding BPAResetCommand}" | |||||
Content="上位机初始化" | |||||
FontSize="20" | |||||
Panel.ZIndex="0" | |||||
Style="{StaticResource ImageButtonStyle}"></Button> | |||||
</StackPanel> | |||||
</Grid> | |||||
<Grid Grid.Row="1"> | |||||
<StackPanel Orientation="Horizontal" HorizontalAlignment="left" VerticalAlignment="Center"> | |||||
<Button | |||||
Width="200" | |||||
Height="40" | |||||
Margin="5,0,5,0" | |||||
Command="{Binding SystemReset}" | |||||
Content="系统复位" | |||||
FontSize="20" | |||||
Panel.ZIndex="0" | |||||
Style="{StaticResource ImageButtonStyle}"></Button> | |||||
<Button | |||||
Width="200" | |||||
Height="40" | |||||
Margin="5,0,5,0" | |||||
Command="{Binding CLearRecipeInfo}" | |||||
Content="配方清零" | |||||
FontSize="20" | |||||
Panel.ZIndex="0" | |||||
Style="{StaticResource ImageButtonStyle}"></Button> | |||||
</StackPanel> | |||||
</Grid> | |||||
<Grid Grid.Row="2"> | |||||
<WrapPanel> | |||||
<TextBlock Text="心跳:" Foreground="#FF2AB2E7" FontSize="25" Margin="10,0,5,0" VerticalAlignment="Center"></TextBlock> | |||||
<TextBlock Text="{Binding Heartbeat}" HorizontalAlignment="Center" VerticalAlignment="Center" Foreground="#FF2AB2E7" FontSize="25" Margin="10"></TextBlock> | |||||
</WrapPanel> | |||||
</Grid>--> | |||||
<Grid> | |||||
<Grid.RowDefinitions> | |||||
<RowDefinition Height="1*"></RowDefinition> | |||||
<RowDefinition Height="7*"></RowDefinition> | |||||
</Grid.RowDefinitions> | |||||
<Grid> | |||||
<Grid.ColumnDefinitions> | |||||
<ColumnDefinition></ColumnDefinition> | |||||
<ColumnDefinition></ColumnDefinition> | |||||
<ColumnDefinition></ColumnDefinition> | |||||
<ColumnDefinition></ColumnDefinition> | |||||
</Grid.ColumnDefinitions> | |||||
<Button | |||||
Margin="20,15" | |||||
Command="{Binding SystemStart}" | |||||
Content="启动" | |||||
FontSize="40" | |||||
Background="LightGreen"></Button> | |||||
<Button | |||||
Grid.Column="1" | |||||
Margin="20,15" | |||||
Command="{Binding SystemStop}" | |||||
Content="停止" | |||||
FontSize="40" | |||||
Background="OrangeRed"></Button> | |||||
<Button | |||||
Grid.Column="2" | |||||
Margin="20,15" | |||||
Command="{Binding AlarmReset}" | |||||
Content="故障复位" | |||||
FontSize="40" | |||||
Background="LightYellow"></Button> | |||||
<Button | |||||
Grid.Column="3" | |||||
Margin="20,15" | |||||
Command="{Binding SystemReset}" | |||||
Content="设备复位" | |||||
FontSize="40" | |||||
Background="DodgerBlue"></Button> | |||||
</Grid> | |||||
</Grid> | |||||
<Grid Grid.Column="1"> | |||||
<Grid.RowDefinitions> | |||||
<RowDefinition></RowDefinition> | |||||
<RowDefinition></RowDefinition> | |||||
<RowDefinition></RowDefinition> | |||||
</Grid.RowDefinitions> | |||||
<Grid> | |||||
<Grid.ColumnDefinitions> | |||||
<ColumnDefinition></ColumnDefinition> | |||||
<ColumnDefinition></ColumnDefinition> | |||||
</Grid.ColumnDefinitions> | |||||
<Grid.RowDefinitions> | |||||
<RowDefinition></RowDefinition> | |||||
<RowDefinition></RowDefinition> | |||||
<RowDefinition></RowDefinition> | |||||
</Grid.RowDefinitions> | |||||
<Button | |||||
Margin="20,5" | |||||
Command="{Binding AutoMode}" | |||||
Content="自动模式" | |||||
FontSize="32" | |||||
Panel.ZIndex="0" | |||||
Style="{StaticResource ImageButtonStyle}"></Button> | |||||
<Button | |||||
Grid.Column="1" | |||||
Margin="20,5" | |||||
Command="{Binding TestMode}" | |||||
Content="测试模式" | |||||
FontSize="32" | |||||
Panel.ZIndex="0" | |||||
Style="{StaticResource ImageButtonStyle}"></Button> | |||||
<Grid Grid.Row="1" Grid.ColumnSpan="2"> | |||||
<WrapPanel Orientation="Vertical"> | |||||
<WrapPanel Orientation="Horizontal"> | |||||
<TextBlock Text="机器人正在运行程序号:" Foreground="#FF2AB2E7" FontSize="25" Margin="10" HorizontalAlignment="Left"></TextBlock> | |||||
<TextBlock Text="{Binding IsRunProgramNum}" Foreground="#FF2AB2E7" FontSize="25" Margin="10" HorizontalAlignment="Left" TextAlignment="Center"></TextBlock> | |||||
</WrapPanel> | |||||
<WrapPanel Orientation="Horizontal" VerticalAlignment="Center"> | |||||
<TextBlock Text="机器人需要运行程序号:" Foreground="#FF2AB2E7" FontSize="25" Margin="10" HorizontalAlignment="Left"></TextBlock> | |||||
<TextBox Text="{Binding SetProgramNum}" Foreground="#FF2AB2E7" FontSize="25" Margin="10" HorizontalAlignment="Left" TextAlignment="Center"></TextBox> | |||||
</WrapPanel> | |||||
</WrapPanel> | |||||
</Grid> | |||||
<Button | |||||
Grid.Row="2" | |||||
Grid.ColumnSpan="2" | |||||
Margin="20,15" | |||||
Command="{Binding TestRobotRun}" | |||||
Content="测试抓桶程序" | |||||
Width="300" | |||||
FontSize="32" | |||||
Style="{StaticResource ImageButtonStyle}"></Button> | |||||
</Grid> | |||||
<!--<ListView | |||||
Grid.Row="1" | |||||
Background="Transparent" | |||||
BorderBrush="#00BEFA" | |||||
BorderThickness="0" | |||||
ItemsSource="{Binding cylinderModels}" | |||||
ScrollViewer.HorizontalScrollBarVisibility="Disabled"> | |||||
<ListView.ItemsPanel> | |||||
<ItemsPanelTemplate> | |||||
<UniformGrid | |||||
HorizontalAlignment="Left" | |||||
VerticalAlignment="Top" | |||||
Columns="8" /> | |||||
</ItemsPanelTemplate> | |||||
</ListView.ItemsPanel> | |||||
<ListView.ItemTemplate> | |||||
<DataTemplate> | |||||
<Grid | |||||
Width="200" | |||||
Height="100" | |||||
Margin="0,0,0,15" | |||||
Background="Transparent"> | |||||
<Grid.RowDefinitions> | |||||
<RowDefinition Height="30" /> | |||||
<RowDefinition /> | |||||
<RowDefinition Height="30" /> | |||||
</Grid.RowDefinitions> | |||||
<Grid.ColumnDefinitions> | |||||
<ColumnDefinition Width="0.5*" /> | |||||
<ColumnDefinition /> | |||||
<ColumnDefinition /> | |||||
</Grid.ColumnDefinitions> | |||||
<TextBlock | |||||
Grid.Column="1" | |||||
Grid.ColumnSpan="2" | |||||
HorizontalAlignment="Center" | |||||
VerticalAlignment="Center" | |||||
Foreground="Aqua" | |||||
Text="{Binding Name}" /> | |||||
<pry:Cylinder | |||||
Grid.Row="1" | |||||
Grid.ColumnSpan="3" | |||||
Width="200" | |||||
Height="50" | |||||
HorizontalAlignment="Center" | |||||
VerticalAlignment="Center" | |||||
LeftTogIsChecked="{Binding LeftTog}" | |||||
RightTogIsChecked="{Binding RightTog}" /> | |||||
<RadioButton | |||||
Grid.Row="2" | |||||
Grid.Column="1" | |||||
Command="{Binding DataContext.Open, RelativeSource={RelativeSource AncestorType=ListView, Mode=FindAncestor}}" | |||||
CommandParameter="{Binding Name}" | |||||
Content="伸出" | |||||
Foreground="Aqua" | |||||
IsChecked="True" | |||||
Style="{StaticResource radioButtonStyle}" /> | |||||
<RadioButton | |||||
Grid.Row="2" | |||||
Grid.Column="2" | |||||
Command="{Binding DataContext.Close, RelativeSource={RelativeSource AncestorType=ListView, Mode=FindAncestor}}" | |||||
CommandParameter="{Binding Name}" | |||||
Content="缩回" | |||||
Foreground="Aqua" | |||||
IsChecked="False" | |||||
Style="{StaticResource radioButtonStyle}" /> | |||||
</Grid> | |||||
</DataTemplate> | |||||
</ListView.ItemTemplate> | |||||
</ListView>--> | |||||
<Grid Grid.Row="1"> | |||||
<Grid.ColumnDefinitions> | |||||
<ColumnDefinition></ColumnDefinition> | |||||
<ColumnDefinition></ColumnDefinition> | |||||
</Grid.ColumnDefinitions> | |||||
<Grid.RowDefinitions> | |||||
<RowDefinition></RowDefinition> | |||||
<RowDefinition></RowDefinition> | |||||
<RowDefinition></RowDefinition> | |||||
</Grid.RowDefinitions> | |||||
<Grid Grid.ColumnSpan="2"> | |||||
<TextBlock Text="托盘气缸控制" Foreground="#FF2AB2E7" FontSize="25" Margin="20,15" HorizontalAlignment="Center" VerticalAlignment="Center"></TextBlock> | |||||
</Grid> | |||||
<Grid Grid.Row="1"> | |||||
<Button | |||||
Margin="20,5" | |||||
Command="{Binding Tray1Cylinder}" | |||||
Content="1#托盘气缸" | |||||
FontSize="32" | |||||
Style="{StaticResource ImageButtonStyle}"></Button> | |||||
</Grid> | |||||
</Grid> | |||||
</Grid> | |||||
</Grid> | |||||
</UserControl> |
@@ -0,0 +1,28 @@ | |||||
using System; | |||||
using System.Collections.Generic; | |||||
using System.Linq; | |||||
using System.Text; | |||||
using System.Threading.Tasks; | |||||
using System.Windows; | |||||
using System.Windows.Controls; | |||||
using System.Windows.Data; | |||||
using System.Windows.Documents; | |||||
using System.Windows.Input; | |||||
using System.Windows.Media; | |||||
using System.Windows.Media.Imaging; | |||||
using System.Windows.Navigation; | |||||
using System.Windows.Shapes; | |||||
namespace BPASmartClient.JXJFoodSmallStation.View | |||||
{ | |||||
/// <summary> | |||||
/// HKPlcCommMonitor.xaml 的交互逻辑 | |||||
/// </summary> | |||||
public partial class RobotView : UserControl | |||||
{ | |||||
public RobotView() | |||||
{ | |||||
InitializeComponent(); | |||||
} | |||||
} | |||||
} |
@@ -20,36 +20,18 @@ namespace BPASmartClient.JXJFoodSmallStation.ViewModel | |||||
{ | { | ||||
public ManualCommViewModel() | public ManualCommViewModel() | ||||
{ | { | ||||
for (int i = 0; i < 8; i++) | |||||
PlcDataColl.Add(new VarMonitor() { SerialNum = PlcDataColl.Count , Address="",}); | |||||
SetParCommand = new RelayCommand<object>((o) => | |||||
{ | { | ||||
if (i < 4) | |||||
{ | |||||
PlcInfo.Add(new PlcManualComm() | |||||
{ | |||||
SerialNum = PlcInfo.Count + 1, | |||||
Address = "DB3.DBD" + (10 + 4 * i), | |||||
Describe = $"托盘1_{i + 1}#桶位置反馈", | |||||
}); | |||||
} | |||||
else | |||||
if (o != null && o is string address) | |||||
{ | { | ||||
PlcInfo.Add(new PlcManualComm() | |||||
{ | |||||
SerialNum = PlcInfo.Count + 1, | |||||
Address = "DB3.DBD" + (10 + 4 * i), | |||||
Describe = $"托盘2_{i-3}#桶位置反馈", | |||||
}); | |||||
var res = PlcDataColl.FirstOrDefault(p =>p.Address == address); | |||||
} | } | ||||
} | |||||
SetParCommand = new RelayCommand<object>((o) => | |||||
{ | |||||
}); | }); | ||||
} | } | ||||
public ObservableCollection<PlcManualComm> PlcInfo { get; set; } = new ObservableCollection<PlcManualComm>(); | |||||
public static ObservableCollection<VarMonitor> PlcDataColl { get; set; } = new ObservableCollection<VarMonitor>(); | |||||
public RelayCommand<object> SetParCommand { get; set; } | public RelayCommand<object> SetParCommand { get; set; } | ||||
public RelayCommand Connect { get; set; } | public RelayCommand Connect { get; set; } | ||||
@@ -20,7 +20,7 @@ namespace BPASmartClient.JXJFoodSmallStation.ViewModel | |||||
{ | { | ||||
ThreadManage.GetInstance().StartLong(new Action(() => | ThreadManage.GetInstance().StartLong(new Action(() => | ||||
{ | { | ||||
SystemMode = GVL_SmallStation.SystemMode ? "自动" : "手动"; | |||||
SystemMode = GVL_SmallStation.SystemMode ? "手动" : "自动"; | |||||
if (GVL_SmallStation.SystemStatus) | if (GVL_SmallStation.SystemStatus) | ||||
{ | { | ||||
if (GVL_SmallStation.SystemRunStatus) | if (GVL_SmallStation.SystemRunStatus) | ||||
@@ -55,6 +55,10 @@ namespace BPASmartClient.JXJFoodSmallStation.ViewModel | |||||
{ | { | ||||
ActionManage.GetInstance.Send("ManualSystemReset"); | ActionManage.GetInstance.Send("ManualSystemReset"); | ||||
}); | }); | ||||
BPAResetCommand = new RelayCommand(() => | |||||
{ | |||||
ActionManage.GetInstance.Send("BPASystemReset"); | |||||
}); | |||||
ThreadManage.GetInstance().StartLong(new Action(() => | ThreadManage.GetInstance().StartLong(new Action(() => | ||||
{ | { | ||||
Heartbeat = GVL_SmallStation.GetInstance.HeartBeatFromPlc; | Heartbeat = GVL_SmallStation.GetInstance.HeartBeatFromPlc; | ||||
@@ -66,7 +70,6 @@ namespace BPASmartClient.JXJFoodSmallStation.ViewModel | |||||
public RelayCommand Test3Command { get; set; } | public RelayCommand Test3Command { get; set; } | ||||
public RelayCommand Test4Command { get; set; } | public RelayCommand Test4Command { get; set; } | ||||
public RelayCommand Test5Command { get; set; } | public RelayCommand Test5Command { get; set; } | ||||
public RelayCommand Test6Command { get; set; } | public RelayCommand Test6Command { get; set; } | ||||
public static bool Heartbeat { get { return _mHeartbeat; } set { _mHeartbeat = value; OnStaticPropertyChanged(); } } | public static bool Heartbeat { get { return _mHeartbeat; } set { _mHeartbeat = value; OnStaticPropertyChanged(); } } | ||||
private static bool _mHeartbeat; | private static bool _mHeartbeat; | ||||
@@ -78,5 +81,6 @@ namespace BPASmartClient.JXJFoodSmallStation.ViewModel | |||||
} | } | ||||
public RelayCommand CLearRecipeInfo { get; set; } | public RelayCommand CLearRecipeInfo { get; set; } | ||||
public RelayCommand SystemReset { get; set; } | public RelayCommand SystemReset { get; set; } | ||||
public RelayCommand BPAResetCommand { get; set; } | |||||
} | } | ||||
} | } |
@@ -154,7 +154,7 @@ namespace BPASmartClient.JXJFoodSmallStation.ViewModel | |||||
} | } | ||||
} | } | ||||
Thread.Sleep(100); | Thread.Sleep(100); | ||||
}), "RecipeControlViewModelStatusInquire"); | |||||
}), "RecipeControlViewModelStatusInquire",true); | |||||
//测试数据 | //测试数据 | ||||
/* RawMaterialModel rawMaterial_1 = new RawMaterialModel { RawMaterialName = "香料_1" }; | /* RawMaterialModel rawMaterial_1 = new RawMaterialModel { RawMaterialName = "香料_1" }; | ||||
RawMaterialModel rawMaterial_2 = new RawMaterialModel { RawMaterialName = "香料_2" }; | RawMaterialModel rawMaterial_2 = new RawMaterialModel { RawMaterialName = "香料_2" }; | ||||
@@ -0,0 +1,45 @@ | |||||
using System; | |||||
using System.Collections.Generic; | |||||
using System.Linq; | |||||
using System.Text; | |||||
using System.Threading.Tasks; | |||||
using Microsoft.Toolkit.Mvvm.ComponentModel; | |||||
using System.Collections.ObjectModel; | |||||
using BPASmartClient.JXJFoodSmallStation.Model; | |||||
using BPASmartClient.Helper; | |||||
using Microsoft.Toolkit.Mvvm.Input; | |||||
using BPASmartClient.CustomResource.UserControls.MessageShow; | |||||
using BPASmartClient.CustomResource.UserControls; | |||||
using System.Diagnostics; | |||||
using BPASmartClient.JXJFoodSmallStation.Model.Siemens; | |||||
using BPASmartClient.JXJFoodSmallStation.Model.HK_PLC; | |||||
using System.Threading; | |||||
using System.ComponentModel; | |||||
using System.Runtime.CompilerServices; | |||||
namespace BPASmartClient.JXJFoodSmallStation.ViewModel | |||||
{ | |||||
public class RobotViewModel : ObservableObject | |||||
{ | |||||
public RobotViewModel() | |||||
{ | |||||
} | |||||
public RelayCommand SystemStart { get; set; } | |||||
public RelayCommand SystemStop { get; set; } | |||||
public RelayCommand SystemReset { get; set; } | |||||
public RelayCommand AlarmReset { get; set; } | |||||
public RelayCommand TestRobotRun { get; set; } | |||||
public RelayCommand Tray1Cylinder { get; set; } | |||||
public short IsRunProgramNum { get { return _runProgramNum; } set { _runProgramNum = value;OnPropertyChanged(); } } | |||||
private short _runProgramNum; | |||||
public short SetProgramNum { get { return _SetProgramNum; } set { _SetProgramNum = value; OnPropertyChanged(); } } | |||||
private short _SetProgramNum; | |||||
public static event EventHandler<PropertyChangedEventArgs> StaticPropertyChanged; | |||||
public static void OnStaticPropertyChanged([CallerMemberName] string PropName = "") | |||||
{ | |||||
StaticPropertyChanged?.Invoke(null, new PropertyChangedEventArgs(PropName)); | |||||
} | |||||
} | |||||
} |
@@ -44,7 +44,6 @@ namespace BPASmartClient.MorkBF | |||||
GlobalFoodMenu.LocalFoodMenus.Add(new FoodMenuModel { GoodKey = item.GoodKey, GoodName = item.GoodName }); | GlobalFoodMenu.LocalFoodMenus.Add(new FoodMenuModel { GoodKey = item.GoodKey, GoodName = item.GoodName }); | ||||
} | } | ||||
} | } | ||||
}), "更新菜单"); | }), "更新菜单"); | ||||
CommandRegist();//调试 | CommandRegist();//调试 | ||||
ServerInit(); | ServerInit(); | ||||
@@ -126,7 +125,6 @@ namespace BPASmartClient.MorkBF | |||||
#endregion | #endregion | ||||
} | } | ||||
public override void MainTask() | public override void MainTask() | ||||
@@ -269,7 +269,156 @@ namespace BPASmartClient.MorkBF | |||||
public int FirePot2_FlipSpeed { get; set; } = 0; | public int FirePot2_FlipSpeed { get; set; } = 0; | ||||
#endregion | #endregion | ||||
#region 机器人数据读取 | |||||
//public bool Robot_IsBusy; | |||||
///// <summary> | |||||
///// 机器人倒料完成 | |||||
///// </summary> | |||||
//[VariableMonitor("机器人倒料完成", "GM500", "4596")] | |||||
//public bool Robot_OutMaterialCompleted { get; set; } | |||||
///// <summary> | |||||
///// 机器人上使能 | |||||
///// </summary> | |||||
//[VariableMonitor("机器人上使能", "GM600.0", "4596")] | |||||
//public bool Robot_Enable { get; set; } | |||||
///// <summary> | |||||
///// 机器人复位 | |||||
///// </summary> | |||||
//[VariableMonitor("机器人复位", "GM600.1", "4597")] | |||||
//public bool Robot_Reset { get; set; } | |||||
///// <summary> | |||||
///// 机器人启动 | |||||
///// </summary> | |||||
//[VariableMonitor("机器人启动", "GM600.2", "4598")] | |||||
//public bool Robot_Start { get; set; } | |||||
///// <summary> | |||||
///// 机器人停止 | |||||
///// </summary> | |||||
//[VariableMonitor("机器人停止", "GM600.3", "4599")] | |||||
//public bool Robot_Stop { get; set; } | |||||
///// <summary> | |||||
///// 机器人动作反馈GI0 | |||||
///// </summary> | |||||
//[VariableMonitor("机器人动作反馈GI0", "GI0", "0")] | |||||
//public int Robot_GI0ActionCallback { get; set; } | |||||
///// <summary> | |||||
///// 机器人动作反馈GI1 | |||||
///// </summary> | |||||
//[VariableMonitor("机器人动作反馈GI1", "GI1", "1")] | |||||
//public int Robot_GI1ActionCallback { get; set; } | |||||
///// <summary> | |||||
///// 机器人动作反馈GI2 | |||||
///// </summary> | |||||
//[VariableMonitor("机器人动作反馈GI2", "GI2", "2")] | |||||
//public int Robot_GI2ActionCallback { get; set; } | |||||
///// <summary> | |||||
///// 机器人动作反馈GI3 | |||||
///// </summary> | |||||
//[VariableMonitor("机器人动作反馈GI3", "GI3", "3")] | |||||
//public int Robot_GI3ActionCallback { get; set; } | |||||
///// <summary> | |||||
///// 机器人动作反馈GI4 | |||||
///// </summary> | |||||
//[VariableMonitor("机器人动作反馈GI4", "GI4", "4")] | |||||
//public int Robot_GI4ActionCallback { get; set; } | |||||
#endregion | |||||
//新版大炒的通讯协议 2023/01/15 | |||||
#region 炒锅1读取数据 | |||||
[VariableMonitor("1#炒锅初始化完成", "M40.0")] | |||||
public bool FryPan1_InitComplete { get; set; } | |||||
[VariableMonitor("1#炒锅手动/自动模式切换", "M40.1")] | |||||
public bool FryPan1_ManualOrAutoMode { get; set; } | |||||
[VariableMonitor("1#炒锅急停", "M40.2")] | |||||
public bool FryPan1_EStop { get; set; } | |||||
[VariableMonitor("1#炒锅在位置1反馈", "M40.3")] | |||||
public bool FryPan1_InPosition1 { get; set; } | |||||
[VariableMonitor("1#炒锅在位置2反馈", "M40.4")] | |||||
public bool FryPan1_InPosition2 { get; set; } | |||||
[VariableMonitor("1#炒锅在位置3反馈", "M40.5")] | |||||
public bool FryPan1_InPosition3 { get; set; } | |||||
[VariableMonitor("1#炒锅在位置4反馈", "M40.6")] | |||||
public bool FryPan1_InPosition4 { get; set; } | |||||
[VariableMonitor("1#炒锅在出餐口倒料位置", "M40.7")] | |||||
public bool FryPan1_InPositionUnload { get; set; } | |||||
[VariableMonitor("1#炒锅在进料口位置", "M41.0")] | |||||
public bool FryPan1_InPositionload { get; set; } | |||||
[VariableMonitor("1#炒锅在洗锅位置", "M41.1")] | |||||
public bool FryPan1_InPositionWashPot { get; set; } | |||||
[VariableMonitor("1#炒锅通道1出料完成", "M41.2")] | |||||
public bool FryPan1_UnloadFinishCH1 { get; set; } | |||||
[VariableMonitor("1#炒锅通道2出料完成", "M41.3")] | |||||
public bool FryPan1_UnloadFinishCH2 { get; set; } | |||||
[VariableMonitor("1#炒锅通道3出料完成", "M41.4")] | |||||
public bool FryPan1_UnloadFinishCH3 { get; set; } | |||||
[VariableMonitor("1#炒锅通道4出料完成", "M41.5")] | |||||
public bool FryPan1_UnloadFinishCH4 { get; set; } | |||||
[VariableMonitor("1#炒锅通道5出料完成", "M41.6")] | |||||
public bool FryPan1_UnloadFinishCH5 { get; set; } | |||||
[VariableMonitor("1#炒锅通道6出料完成", "M41.7")] | |||||
public bool FryPan1_UnloadFinishCH6 { get; set; } | |||||
[VariableMonitor("1#炒锅通道7出料完成", "M42.0")] | |||||
public bool FryPan1_UnloadFinishCH7 { get; set; } | |||||
[VariableMonitor("1#炒锅通道8出料完成", "M42.1")] | |||||
public bool FryPan1_UnloadFinishCH8 { get; set; } | |||||
[VariableMonitor("1#炒锅当前温度", "VM200")] | |||||
public short FryPan1_TemperatureNow { get; set; } | |||||
[VariableMonitor("1#炒锅当前搅拌转速", "VM202")] | |||||
public short FryPan1_MixingSpeedNow { get; set; } | |||||
[VariableMonitor("1#炒锅当前炒制角度", "VM204")] | |||||
public short FryPan1_FryAngle{ get; set; } | |||||
[VariableMonitor("1#炒锅当前加热挡位", "VM206")] | |||||
public short FryPan1_HeatingGearNow{ get; set; } | |||||
#endregion | |||||
#region 炒锅2读取数据 | |||||
[VariableMonitor("2#炒锅初始化完成", "M40.0")] | |||||
public bool FryPan2_InitComplete { get; set; } | |||||
[VariableMonitor("2#炒锅手动/自动模式切换", "M40.1")] | |||||
public bool FryPan2_ManualOrAutoMode { get; set; } | |||||
[VariableMonitor("2#炒锅急停", "M40.2")] | |||||
public bool FryPan2_EStop { get; set; } | |||||
[VariableMonitor("2#炒锅在位置1反馈", "M40.3")] | |||||
public bool FryPan2_InPosition1 { get; set; } | |||||
[VariableMonitor("2#炒锅在位置2反馈", "M40.4")] | |||||
public bool FryPan2_InPosition2 { get; set; } | |||||
[VariableMonitor("2#炒锅在位置3反馈", "M40.5")] | |||||
public bool FryPan2_InPosition3 { get; set; } | |||||
[VariableMonitor("2#炒锅在位置4反馈", "M40.6")] | |||||
public bool FryPan2_InPosition4 { get; set; } | |||||
[VariableMonitor("2#炒锅在出餐口倒料位置", "M40.7")] | |||||
public bool FryPan2_InPositionUnload { get; set; } | |||||
[VariableMonitor("2#炒锅在进料口位置", "M41.0")] | |||||
public bool FryPan2_InPositionload { get; set; } | |||||
[VariableMonitor("2#炒锅在洗锅位置", "M41.1")] | |||||
public bool FryPan2_InPositionWashPot { get; set; } | |||||
[VariableMonitor("2#炒锅通道1出料完成", "M41.2")] | |||||
public bool FryPan2_UnloadFinishCH1 { get; set; } | |||||
[VariableMonitor("2#炒锅通道2出料完成", "M41.3")] | |||||
public bool FryPan2_UnloadFinishCH2 { get; set; } | |||||
[VariableMonitor("2#炒锅通道3出料完成", "M41.4")] | |||||
public bool FryPan2_UnloadFinishCH3 { get; set; } | |||||
[VariableMonitor("2#炒锅通道4出料完成", "M41.5")] | |||||
public bool FryPan2_UnloadFinishCH4 { get; set; } | |||||
[VariableMonitor("2#炒锅通道5出料完成", "M41.6")] | |||||
public bool FryPan2_UnloadFinishCH5 { get; set; } | |||||
[VariableMonitor("2#炒锅通道6出料完成", "M41.7")] | |||||
public bool FryPan2_UnloadFinishCH6 { get; set; } | |||||
[VariableMonitor("2#炒锅通道7出料完成", "M42.0")] | |||||
public bool FryPan2_UnloadFinishCH7 { get; set; } | |||||
[VariableMonitor("2#炒锅通道8出料完成", "M42.1")] | |||||
public bool FryPan2_UnloadFinishCH8 { get; set; } | |||||
[VariableMonitor("2#炒锅当前温度", "VM200")] | |||||
public short FryPan2_TemperatureNow { get; set; } | |||||
[VariableMonitor("2#炒锅当前搅拌转速", "VM202")] | |||||
public short FryPan2_MixingSpeedNow { get; set; } | |||||
[VariableMonitor("2#炒锅当前炒制角度", "VM204")] | |||||
public short FryPan2_FryAngle { get; set; } | |||||
[VariableMonitor("2#炒锅当前加热挡位", "VM206")] | |||||
public short FryPan2_HeatingGearNow { get; set; } | |||||
#endregion | |||||
#region 机器人数据读取 | #region 机器人数据读取 | ||||
public bool Robot_IsBusy; | public bool Robot_IsBusy; | ||||
@@ -303,31 +452,30 @@ namespace BPASmartClient.MorkBF | |||||
/// <summary> | /// <summary> | ||||
/// 机器人动作反馈GI0 | /// 机器人动作反馈GI0 | ||||
/// </summary> | /// </summary> | ||||
[VariableMonitor("机器人动作反馈GI0", "GI0", "0")] | |||||
[VariableMonitor("机器人动作反馈GI5", "GI5", "5")] | |||||
public int Robot_GI0ActionCallback { get; set; } | public int Robot_GI0ActionCallback { get; set; } | ||||
/// <summary> | /// <summary> | ||||
/// 机器人动作反馈GI1 | /// 机器人动作反馈GI1 | ||||
/// </summary> | /// </summary> | ||||
[VariableMonitor("机器人动作反馈GI1", "GI1", "1")] | |||||
[VariableMonitor("机器人动作反馈GI6", "GI6", "6")] | |||||
public int Robot_GI1ActionCallback { get; set; } | public int Robot_GI1ActionCallback { get; set; } | ||||
/// <summary> | /// <summary> | ||||
/// 机器人动作反馈GI2 | /// 机器人动作反馈GI2 | ||||
/// </summary> | /// </summary> | ||||
[VariableMonitor("机器人动作反馈GI2", "GI2", "2")] | |||||
[VariableMonitor("机器人动作反馈GI7", "GI7", "7")] | |||||
public int Robot_GI2ActionCallback { get; set; } | public int Robot_GI2ActionCallback { get; set; } | ||||
/// <summary> | /// <summary> | ||||
/// 机器人动作反馈GI3 | /// 机器人动作反馈GI3 | ||||
/// </summary> | /// </summary> | ||||
[VariableMonitor("机器人动作反馈GI3", "GI3", "3")] | |||||
[VariableMonitor("机器人动作反馈GI8", "GI8", "8")] | |||||
public int Robot_GI3ActionCallback { get; set; } | public int Robot_GI3ActionCallback { get; set; } | ||||
/// <summary> | /// <summary> | ||||
/// 机器人动作反馈GI4 | /// 机器人动作反馈GI4 | ||||
/// </summary> | /// </summary> | ||||
[VariableMonitor("机器人动作反馈GI4", "GI4", "4")] | |||||
[VariableMonitor("机器人动作反馈GI9", "GI9", "9")] | |||||
public int Robot_GI4ActionCallback { get; set; } | public int Robot_GI4ActionCallback { get; set; } | ||||
#endregion | #endregion | ||||
public Dictionary<int, bool> FirePot1_CompleteSingle { get; set; } | public Dictionary<int, bool> FirePot1_CompleteSingle { get; set; } | ||||
public Dictionary<int, bool> FirePot2_CompleteSingle { get; set; } | public Dictionary<int, bool> FirePot2_CompleteSingle { get; set; } | ||||
@@ -27,25 +27,30 @@ namespace BPASmartClient.S7Net | |||||
numBytes += 0.125; | numBytes += 0.125; | ||||
break; | break; | ||||
case "Byte": | case "Byte": | ||||
IncrementToEven(ref numBytes); | |||||
numBytes += 1.0; | numBytes += 1.0; | ||||
break; | break; | ||||
case "Int16": | case "Int16": | ||||
case "UInt16": | case "UInt16": | ||||
case "Ushort": | case "Ushort": | ||||
case "Short": | case "Short": | ||||
IncrementToEven(ref numBytes); | |||||
numBytes += 2.0; | numBytes += 2.0; | ||||
break; | break; | ||||
case "Int32": | case "Int32": | ||||
case "UInt32": | case "UInt32": | ||||
case "Single": | case "Single": | ||||
case "float": | case "float": | ||||
IncrementToEven(ref numBytes); | |||||
numBytes += 4.0; | numBytes += 4.0; | ||||
break; | break; | ||||
case "Double": | case "Double": | ||||
IncrementToEven(ref numBytes); | |||||
numBytes += 8.0; | numBytes += 8.0; | ||||
break; | break; | ||||
case "String": | case "String": | ||||
//numBytes += 256.0; | //numBytes += 256.0; | ||||
IncrementToEven(ref numBytes); | |||||
double len = 256.0; | double len = 256.0; | ||||
if (propertyInfo.CustomAttributes.Count() > 0) | if (propertyInfo.CustomAttributes.Count() > 0) | ||||
{ | { | ||||
@@ -202,7 +207,7 @@ namespace BPASmartClient.S7Net | |||||
//Array.Copy(bytes, (int)numBytes, sarray, 0, 256); | //Array.Copy(bytes, (int)numBytes, sarray, 0, 256); | ||||
//obj = GetGb2312()?.GetString(sarray).Trim().Replace(" ", "").Replace("\n", ""); | //obj = GetGb2312()?.GetString(sarray).Trim().Replace(" ", "").Replace("\n", ""); | ||||
//numBytes += 256.0; | //numBytes += 256.0; | ||||
IncrementToEven(ref numBytes); | |||||
int len = 256; | int len = 256; | ||||
if (propertyInfo.CustomAttributes.Count() > 0) | if (propertyInfo.CustomAttributes.Count() > 0) | ||||
{ | { | ||||
@@ -38,10 +38,7 @@ namespace BPASmartClient.DosingSystem | |||||
BPASmartClient.Helper.SystemHelper.GetInstance.CreateDesktopShortcut(); | BPASmartClient.Helper.SystemHelper.GetInstance.CreateDesktopShortcut(); | ||||
MenuInit(); | MenuInit(); | ||||
DataInit(); | DataInit(); | ||||
ThreadManage.GetInstance().Start(new Action(() => | |||||
{ | |||||
DeviceInquire.GetInstance.Init();//配料机设备上线监听,设备列表初始化 | |||||
}), "设备初始化"); | |||||
DeviceInquire.GetInstance.Init();//配料机设备上线监听,设备列表初始化 | |||||
MainView mv = new MainView(); | MainView mv = new MainView(); | ||||
mv.TitleName = "味魔方管理系统软件[简称:味魔方] 1.0.1"; | mv.TitleName = "味魔方管理系统软件[简称:味魔方] 1.0.1"; | ||||
LoginView lv = new LoginView(); | LoginView lv = new LoginView(); | ||||
@@ -61,6 +58,7 @@ namespace BPASmartClient.DosingSystem | |||||
base.OnExit(e); | base.OnExit(e); | ||||
Json<LocaPar>.Save(); | Json<LocaPar>.Save(); | ||||
Json<DevicePar>.Save(); | Json<DevicePar>.Save(); | ||||
Json<LocaMaterial>.Save(); | |||||
BPASmartClient.CustomResource.Pages.Model.MessageNotify.GetInstance.LogSave(); | BPASmartClient.CustomResource.Pages.Model.MessageNotify.GetInstance.LogSave(); | ||||
ThreadManage.GetInstance().Dispose(); | ThreadManage.GetInstance().Dispose(); | ||||
} | } | ||||
@@ -0,0 +1,6 @@ | |||||
<?xml version="1.0" encoding="utf-8" ?> | |||||
<configuration> | |||||
<appSettings> | |||||
<add key="" value=""/> | |||||
</appSettings> | |||||
</configuration> |
@@ -59,7 +59,7 @@ namespace BPASmartClient.DosingSystem | |||||
} | } | ||||
} | } | ||||
Thread.Sleep(200); | Thread.Sleep(200); | ||||
}), "设备状态监听"); | |||||
}), "设备状态监听",true); | |||||
} | } | ||||
private void TestData() | private void TestData() | ||||
@@ -156,7 +156,7 @@ namespace BPASmartClient.DosingSystem | |||||
{ | { | ||||
IPLists.Clear(); | IPLists.Clear(); | ||||
IPQueues.Clear(); | IPQueues.Clear(); | ||||
for (int i = 1; i <= 255; i++) | |||||
/*for (int i = 1; i <= 255; i++) | |||||
{ | { | ||||
if (!InvalidIP.Contains($"{IPSegment}{i}") && !DeviceLists.ContainsKey($"{IPSegment}{i}")) | if (!InvalidIP.Contains($"{IPSegment}{i}") && !DeviceLists.ContainsKey($"{IPSegment}{i}")) | ||||
{ | { | ||||
@@ -166,6 +166,10 @@ namespace BPASmartClient.DosingSystem | |||||
IPLists.Add($"{IPSegment}{i}"); | IPLists.Add($"{IPSegment}{i}"); | ||||
} | } | ||||
} | } | ||||
}*/ | |||||
for (int i = 0; i < 15; i++) | |||||
{ | |||||
IPLists.Add($"{IPSegment}{(i+1)*10}"); | |||||
} | } | ||||
IPLists.ForEach((item) => | IPLists.ForEach((item) => | ||||
@@ -230,13 +234,13 @@ namespace BPASmartClient.DosingSystem | |||||
} | } | ||||
else | else | ||||
{ | { | ||||
if (!InvalidIP.Contains(ip)) InvalidIP.Add(ip); | |||||
//if (!InvalidIP.Contains(ip)) InvalidIP.Add(ip); | |||||
} | } | ||||
}); | }); | ||||
DS.modbusTcp.ConnectFail = new Action(() => | DS.modbusTcp.ConnectFail = new Action(() => | ||||
{ | { | ||||
if (!InvalidIP.Contains(ip)) InvalidIP.Add(ip); | |||||
//if (!InvalidIP.Contains(ip)) InvalidIP.Add(ip); | |||||
}); | }); | ||||
DS.modbusTcp.Disconnect = new Action(() => | DS.modbusTcp.Disconnect = new Action(() => | ||||
@@ -258,7 +262,12 @@ namespace BPASmartClient.DosingSystem | |||||
})); | })); | ||||
} | } | ||||
if (DeviceLists.ContainsKey(ip)) DeviceLists[ip].Dispose(); | |||||
if (DeviceLists.ContainsKey(ip)) | |||||
{ | |||||
DeviceLists[ip].Dispose(); | |||||
var res11 = DeviceLists[ip]; | |||||
DeviceLists.TryRemove(ip, out res11); | |||||
} | |||||
}); | }); | ||||
Task.Run(new Action(() => | Task.Run(new Action(() => | ||||
@@ -44,7 +44,6 @@ namespace BPASmartClient.DosingSystem | |||||
public string RecipStatus { get { return _mRecipStatus; } set { _mRecipStatus = value; OnPropertyChanged(); } } | public string RecipStatus { get { return _mRecipStatus; } set { _mRecipStatus = value; OnPropertyChanged(); } } | ||||
private string _mRecipStatus; | private string _mRecipStatus; | ||||
/// <summary> | /// <summary> | ||||
/// 原料集合 | /// 原料集合 | ||||
/// </summary> | /// </summary> | ||||
@@ -20,32 +20,33 @@ namespace BPASmartClient.DosingSystem | |||||
public SiemensHelper MySiemens { get; set; } = new SiemensHelper(); | public SiemensHelper MySiemens { get; set; } = new SiemensHelper(); | ||||
private bool IsConnect { get; set; } | private bool IsConnect { get; set; } | ||||
bool tempValue = false; | |||||
public bool tempValue = false; | |||||
public void Connect(string ip) | public void Connect(string ip) | ||||
{ | { | ||||
try | |||||
ThreadManage.GetInstance().StartLong(new Action(() => | |||||
{ | { | ||||
while (!MySiemens.IsConnected) | |||||
if (IsConnect) | |||||
{ | { | ||||
MySiemens.Connect(S7.Net.CpuType.S71200, ip); | |||||
Thread.Sleep(2000); | |||||
MySiemens.Write("DB4.DBX0.0", tempValue);//设备心跳 | |||||
tempValue = !tempValue; | |||||
} | } | ||||
} | |||||
catch (Exception ex) | |||||
{ | |||||
} | |||||
IsConnect = MySiemens.IsConnected; | |||||
ThreadManage.GetInstance().StartLong(new Action(() => | |||||
{ | |||||
if (IsConnect) MySiemens.Write("DB4.DBX0.0", tempValue);//设备心跳 | |||||
tempValue = !tempValue; | |||||
//MessageNotify.GetInstance.ShowUserLog($"心跳发送{tempValue}"); | |||||
Thread.Sleep(100); | |||||
Thread.Sleep(200); | |||||
}), "设备心跳", true); | }), "设备心跳", true); | ||||
ThreadManage.GetInstance().StartLong(new Action(() => | ThreadManage.GetInstance().StartLong(new Action(() => | ||||
{ | { | ||||
try | |||||
{ | |||||
while (!MySiemens.IsConnected) | |||||
{ | |||||
MySiemens.Connect(S7.Net.CpuType.S71200, ip); | |||||
Thread.Sleep(2000); | |||||
} | |||||
} | |||||
catch (Exception ex) | |||||
{ | |||||
} | |||||
IsConnect = MySiemens.IsConnected; | |||||
if (IsConnect) | if (IsConnect) | ||||
{ | { | ||||
GlobalDevice.PlcData = MySiemens.ReadClass<PlcToComputer>(3);//获取PLC到上位机的数据 | GlobalDevice.PlcData = MySiemens.ReadClass<PlcToComputer>(3);//获取PLC到上位机的数据 | ||||
@@ -54,13 +55,12 @@ namespace BPASmartClient.DosingSystem | |||||
{ | { | ||||
GlobalDevice.MotorSpeed = ushorts; | GlobalDevice.MotorSpeed = ushorts; | ||||
} | } | ||||
GlobalDevice.MotorControl = MySiemens.Read<uint>("DB5.DBD6");//获取输送带控制信号 | |||||
//GlobalDevice.MotorControlFeedback = MySiemens.Read<uint>("DB3.DBD0");//获取当前输送带运行状态 | |||||
GlobalDevice.MotorControl = (uint)(GlobalDevice.MotorControl.ToBytes(BPA.Helper.DataFormat.ABCD)).ToInt(); | |||||
Thread.Sleep(50); | |||||
uint data = MySiemens.Read<uint>("DB5.DBD6");//获取输送带控制信号 | |||||
//GlobalDevice.MotorControlFeedback = MySiemens.Read<uint>("DB3.DBD0");//获取当前输送带运行状态 | |||||
GlobalDevice.MotorControl = (uint)(data.ToBytes(BPA.Helper.DataFormat.ABCD)).ToInt(); | |||||
} | } | ||||
Thread.Sleep(50); | |||||
}), "读取输送线设备数据", true); | }), "读取输送线设备数据", true); | ||||
} | } | ||||
/// <summary> | /// <summary> | ||||
@@ -25,34 +25,34 @@ namespace BPASmartClient.DosingSystem.ViewModel | |||||
AddCommand = new BPARelayCommand(() => { deviceParModels.Add(new DeviceParModel()); }); | AddCommand = new BPARelayCommand(() => { deviceParModels.Add(new DeviceParModel()); }); | ||||
SaveCommand = new BPARelayCommand(() => | SaveCommand = new BPARelayCommand(() => | ||||
{ | |||||
if (deviceParModels == null || deviceParModels.Count <= 0) | |||||
{ | |||||
NoticeDemoViewModel.OpenMsg(EnumPromptType.Warn, App.MainWindow, "警告", $"没有可保存的参数!"); | |||||
return; | |||||
} | |||||
{ | |||||
if (deviceParModels == null || deviceParModels.Count <= 0) | |||||
{ | |||||
NoticeDemoViewModel.OpenMsg(EnumPromptType.Warn, App.MainWindow, "警告", $"没有可保存的参数!"); | |||||
return; | |||||
} | |||||
for (int i = 0; i < deviceParModels.Count; i++) | |||||
{ | |||||
if (deviceParModels.Where(p => p.MaterialName == deviceParModels.ElementAt(i).MaterialName)?.ToList()?.Count >= 2) | |||||
deviceParModels.ElementAt(i).IsRedundant = true; | |||||
else | |||||
deviceParModels.ElementAt(i).IsRedundant = false; | |||||
} | |||||
for (int i = 0; i < deviceParModels.Count; i++) | |||||
{ | |||||
if (deviceParModels.Where(p => p.MaterialName == deviceParModels.ElementAt(i).MaterialName)?.ToList()?.Count >= 2) | |||||
deviceParModels.ElementAt(i).IsRedundant = true; | |||||
else | |||||
deviceParModels.ElementAt(i).IsRedundant = false; | |||||
} | |||||
if (deviceParModels.FirstOrDefault(p => p.IsRedundant == true) != null) | |||||
{ | |||||
NoticeDemoViewModel.OpenMsg(EnumPromptType.Error, App.MainWindow, "错误", $"原料名称冲突,请检查后重试!"); | |||||
return; | |||||
} | |||||
if (deviceParModels.FirstOrDefault(p => p.IsRedundant == true) != null) | |||||
{ | |||||
NoticeDemoViewModel.OpenMsg(EnumPromptType.Error, App.MainWindow, "错误", $"原料名称冲突,请检查后重试!"); | |||||
return; | |||||
} | |||||
deviceParModels.Where(P => P.MaterialName.Length <= 0)?.ToList()?.ForEach(item => | |||||
{ | |||||
Json<DevicePar>.Data.deviceParModels.Remove(item); | |||||
}); | |||||
Json<DevicePar>.Save(); | |||||
NoticeDemoViewModel.OpenMsg(EnumPromptType.Success, App.MainWindow, "提示", $"原料参数保存成功!"); | |||||
}); | |||||
deviceParModels.Where(P => P.MaterialName.Length <= 0)?.ToList()?.ForEach(item => | |||||
{ | |||||
Json<DevicePar>.Data.deviceParModels.Remove(item); | |||||
}); | |||||
Json<DevicePar>.Save(); | |||||
NoticeDemoViewModel.OpenMsg(EnumPromptType.Success, App.MainWindow, "提示", $"原料参数保存成功!"); | |||||
}); | |||||
} | } | ||||
public ObservableCollection<DeviceParModel> deviceParModels { get; set; } | public ObservableCollection<DeviceParModel> deviceParModels { get; set; } | ||||
@@ -60,7 +60,7 @@ namespace BPASmartClient.DosingSystem.ViewModel | |||||
UnderDetection = GlobalDevice.PlcData.UnderDetection; | UnderDetection = GlobalDevice.PlcData.UnderDetection; | ||||
ConveyerBeltStatus = GlobalDevice.MotorControlFeedback > 0; | ConveyerBeltStatus = GlobalDevice.MotorControlFeedback > 0; | ||||
Thread.Sleep(100); | Thread.Sleep(100); | ||||
}), "输送带料仓状态监控"); | |||||
}), "输送带料仓状态监控",true); | |||||
RecipeControlCommand = new BPARelayCommand<object>((o) => | RecipeControlCommand = new BPARelayCommand<object>((o) => | ||||
{ | { | ||||
@@ -136,7 +136,7 @@ namespace BPASmartClient.DosingSystem.ViewModel | |||||
SystemMode = GlobalDevice.PlcData.HandOrAuto ? "自动" : "手动"; | SystemMode = GlobalDevice.PlcData.HandOrAuto ? "自动" : "手动"; | ||||
Thread.Sleep(100); | Thread.Sleep(100); | ||||
}), "手动气缸状态监控"); | |||||
}), "手动气缸状态监控",true); | |||||
} | } | ||||
private void Init() | private void Init() | ||||
@@ -278,7 +278,7 @@ namespace BPASmartClient.DosingSystem.ViewModel | |||||
} | } | ||||
} | } | ||||
Thread.Sleep(100); | Thread.Sleep(100); | ||||
}), "启动配方下发"); | |||||
}), "启动配方下发",true); | |||||
} | } | ||||
/// <summary> | /// <summary> | ||||
@@ -308,100 +308,273 @@ namespace BPASmartClient.DosingSystem.ViewModel | |||||
} | } | ||||
for (int j = 0; j < GlobalDevice.PlcData.IsAllowIngredients.Length; j++) | for (int j = 0; j < GlobalDevice.PlcData.IsAllowIngredients.Length; j++) | ||||
{ | { | ||||
//if (GlobalDevice.PlcData.IsAllowIngredients[j]) | |||||
//{ | |||||
// int barrel = j + 1;//桶号 | |||||
// int cnt = GlobalDevice.PlcData.LocationFeedback[j];//允许配料的位置 0~6 | |||||
// if (RTrig.GetInstance("a").Start(GlobalDevice.PlcData.IsAllowIngredients[j])) | |||||
// { | |||||
// MessageNotify.GetInstance.ShowRunLog($"桶号:{barrel},位置:{cnt},允许配料"); | |||||
// } | |||||
// int Location1 = 0; | |||||
// int Location2 = 0; | |||||
// if (cnt == -1) | |||||
// { | |||||
// MessageNotify.GetInstance.ShowRunLog("错误"); | |||||
// return; | |||||
// } | |||||
// else | |||||
// { | |||||
// switch (cnt) | |||||
// { | |||||
// case 1: | |||||
// int a1 = Array.FindIndex(DeviceInquire.GetInstance.devices.ToArray(), p => p.DeviceNum == 1); | |||||
// int b1 = Array.FindIndex(DeviceInquire.GetInstance.devices.ToArray(), p => p.DeviceNum == 2); | |||||
// if (a1 >= 0) | |||||
// { | |||||
// Location1 = Array.FindIndex(Recipes.ElementAt(i).RawMaterials.ToArray(), p => p.RawMaterialName == DeviceInquire.GetInstance.devices.ElementAt(a1).DeviceName && p.Loc == barrel); | |||||
// } | |||||
// if (b1 >= 0) | |||||
// { | |||||
// Location2 = Array.FindIndex(Recipes.ElementAt(i).RawMaterials.ToArray(), p => p.RawMaterialName == DeviceInquire.GetInstance.devices.ElementAt(b1).DeviceName && p.Loc == barrel); | |||||
// } | |||||
// break; | |||||
// case 2: | |||||
// int a2 = Array.FindIndex(DeviceInquire.GetInstance.devices.ToArray(), p => p.DeviceNum == 3); | |||||
// int b2 = Array.FindIndex(DeviceInquire.GetInstance.devices.ToArray(), p => p.DeviceNum == 4); | |||||
// if (a2 >= 0) | |||||
// { | |||||
// Location1 = Array.FindIndex(Recipes.ElementAt(i).RawMaterials.ToArray(), p => p.RawMaterialName == DeviceInquire.GetInstance.devices.ElementAt(a2).DeviceName && p.Loc == barrel); | |||||
// } | |||||
// if (b2 >= 0) | |||||
// { | |||||
// Location2 = Array.FindIndex(Recipes.ElementAt(i).RawMaterials.ToArray(), p => p.RawMaterialName == DeviceInquire.GetInstance.devices.ElementAt(b2).DeviceName && p.Loc == barrel); | |||||
// } | |||||
// break; | |||||
// case 3: | |||||
// int a3 = Array.FindIndex(DeviceInquire.GetInstance.devices.ToArray(), p => p.DeviceNum == 5); | |||||
// int b3 = Array.FindIndex(DeviceInquire.GetInstance.devices.ToArray(), p => p.DeviceNum == 6); | |||||
// if (a3 >= 0) | |||||
// { | |||||
// Location1 = Array.FindIndex(Recipes.ElementAt(i).RawMaterials.ToArray(), p => p.RawMaterialName == DeviceInquire.GetInstance.devices.ElementAt(a3).DeviceName && p.Loc == barrel); | |||||
// } | |||||
// if (b3 >= 0) | |||||
// { | |||||
// Location2 = Array.FindIndex(Recipes.ElementAt(i).RawMaterials.ToArray(), p => p.RawMaterialName == DeviceInquire.GetInstance.devices.ElementAt(b3).DeviceName && p.Loc == barrel); | |||||
// } | |||||
// break; | |||||
// case 4: | |||||
// int a4 = Array.FindIndex(DeviceInquire.GetInstance.devices.ToArray(), p => p.DeviceNum == 7); | |||||
// int b4 = Array.FindIndex(DeviceInquire.GetInstance.devices.ToArray(), p => p.DeviceNum == 8); | |||||
// if (a4 >= 0) | |||||
// { | |||||
// Location1 = Array.FindIndex(Recipes.ElementAt(i).RawMaterials.ToArray(), p => p.RawMaterialName == DeviceInquire.GetInstance.devices.ElementAt(a4).DeviceName && p.Loc == barrel); | |||||
// } | |||||
// if (b4 >= 0) | |||||
// { | |||||
// Location2 = Array.FindIndex(Recipes.ElementAt(i).RawMaterials.ToArray(), p => p.RawMaterialName == DeviceInquire.GetInstance.devices.ElementAt(b4).DeviceName && p.Loc == barrel); | |||||
// } | |||||
// break; | |||||
// case 5: | |||||
// int a5 = Array.FindIndex(DeviceInquire.GetInstance.devices.ToArray(), p => p.DeviceNum == 9); | |||||
// int b5 = Array.FindIndex(DeviceInquire.GetInstance.devices.ToArray(), p => p.DeviceNum == 10); | |||||
// if (a5 >= 0) | |||||
// { | |||||
// Location1 = Array.FindIndex(Recipes.ElementAt(i).RawMaterials.ToArray(), p => p.RawMaterialName == DeviceInquire.GetInstance.devices.ElementAt(a5).DeviceName && p.Loc == barrel); | |||||
// } | |||||
// if (b5 >= 0) | |||||
// { | |||||
// Location2 = Array.FindIndex(Recipes.ElementAt(i).RawMaterials.ToArray(), p => p.RawMaterialName == DeviceInquire.GetInstance.devices.ElementAt(b5).DeviceName && p.Loc == barrel); | |||||
// } | |||||
// break; | |||||
// case 6: | |||||
// int a6 = Array.FindIndex(DeviceInquire.GetInstance.devices.ToArray(), p => p.DeviceNum == 11); | |||||
// int b6 = Array.FindIndex(DeviceInquire.GetInstance.devices.ToArray(), p => p.DeviceNum == 12); | |||||
// if (a6 >= 0) | |||||
// { | |||||
// Location1 = Array.FindIndex(Recipes.ElementAt(i).RawMaterials.ToArray(), p => p.RawMaterialName == DeviceInquire.GetInstance.devices.ElementAt(a6).DeviceName && p.Loc == barrel); | |||||
// } | |||||
// if (b6 >= 0) | |||||
// { | |||||
// Location2 = Array.FindIndex(Recipes.ElementAt(i).RawMaterials.ToArray(), p => p.RawMaterialName == DeviceInquire.GetInstance.devices.ElementAt(b6).DeviceName && p.Loc == barrel); | |||||
// } | |||||
// break; | |||||
// default: | |||||
// break; | |||||
// } | |||||
// } | |||||
// if (Location1 >= 0) | |||||
// { | |||||
// string RawName = Recipes.ElementAt(i).RawMaterials.ElementAt(Location1).RawMaterialName; | |||||
// int abc = Array.FindIndex(DeviceInquire.GetInstance.devices.ToArray(), p => p.DeviceName == RawName); | |||||
// int DeviceNum = DeviceInquire.GetInstance.devices.ElementAt(abc).DeviceNum; | |||||
// if (DeviceNum > 0) | |||||
// { | |||||
// float weight = Recipes.ElementAt(i).RawMaterials.ElementAt(Location1).RawMaterialWeight; | |||||
// int loc = Array.FindIndex(Recipes.ElementAt(i).RawMaterials.ToArray(), p => p.RawMaterialName == RawName); | |||||
// if (loc >= 0 && RawName != null && weight >= 0) | |||||
// { | |||||
// int St_index = Array.FindIndex(StockStatus.ToArray(), p => p.MaterialName == RawName); | |||||
// if (St_index < 0) | |||||
// { | |||||
// StockStatus.Add(new StockStatusModel() | |||||
// { | |||||
// MaterialName = RawName, | |||||
// IssueWeight = weight, | |||||
// IssueStatus = 0, | |||||
// }); | |||||
// } | |||||
// St_index = Array.FindIndex(StockStatus.ToArray(), p => p.MaterialName == RawName); | |||||
// if (St_index >= 0) | |||||
// { | |||||
// if (recipeProcesses.ElementAt(recIndex).RawMaterials.ElementAt(loc).RecipeStatus == 1 && StockStatus.ElementAt(St_index).IssueStatus == 0) | |||||
// { | |||||
// StockStatus.ElementAt(St_index).IssueStatus = 1; | |||||
// DeviceInquire.GetInstance.GetDevice(Recipes.ElementAt(i).RawMaterials.ElementAt(loc).DeviceIp).Start(weight); | |||||
// MessageNotify.GetInstance.ShowRunLog($"柔性味魔方{Recipes.ElementAt(i).RawMaterials.ElementAt(loc).DeviceIp},开始出料"); | |||||
// } | |||||
// if (recipeProcesses.ElementAt(recIndex).RawMaterials.ElementAt(loc).RecipeStatus == 3 && StockStatus.ElementAt(St_index).IssueStatus == 1) | |||||
// { | |||||
// //GlobalDevice.PlcData.IsAllowIngredients[j] = false;//测试使用 | |||||
// StockStatus.ElementAt(St_index).IssueStatus = 2; | |||||
// DeviceInquire.GetInstance.GetDevice(Recipes.ElementAt(i).RawMaterials.ElementAt(loc).DeviceIp).StatusReset(); | |||||
// int a = 0.SetBitValue((byte)(DeviceNum), true); | |||||
// byte[] test1 = a.ToBytes(BPA.Helper.DataFormat.ABCD); | |||||
// int item = test1.ToInt(); | |||||
// string res = SiemensDevice.GetInstance.MySiemens.Write("DB4.DBD130", item,2); | |||||
// MessageNotify.GetInstance.ShowRunLog($"{res}"); | |||||
// MessageNotify.GetInstance.ShowRunLog($"DB4.DBD130:{item.ToBinString()}"); | |||||
// MessageNotify.GetInstance.ShowRunLog($"柔性味魔方{Recipes.ElementAt(i).RawMaterials.ElementAt(loc).DeviceIp},出料完成,状态复位"); | |||||
// } | |||||
// } | |||||
// } | |||||
// } | |||||
// } | |||||
// if (Location1 >= 0) | |||||
// { | |||||
// string RawName111 = Recipes.ElementAt(i).RawMaterials.ElementAt(Location1).RawMaterialName; | |||||
// int St_index111 = Array.FindIndex(StockStatus.ToArray(), p => p.MaterialName == RawName111); | |||||
// if (Location2 >= 0 && ((Location1 >= 0 && StockStatus.ElementAt(St_index111).IssueStatus == 2))) | |||||
// { | |||||
// string RawName = Recipes.ElementAt(i).RawMaterials.ElementAt(Location2).RawMaterialName; | |||||
// int abc = Array.FindIndex(DeviceInquire.GetInstance.devices.ToArray(), p => p.DeviceName == RawName); | |||||
// int DeviceNum = DeviceInquire.GetInstance.devices.ElementAt(abc).DeviceNum; | |||||
// if (DeviceNum > 0) | |||||
// { | |||||
// float weight = Recipes.ElementAt(i).RawMaterials.ElementAt(Location2).RawMaterialWeight; | |||||
// int loc = Array.FindIndex(Recipes.ElementAt(i).RawMaterials.ToArray(), p => p.RawMaterialName == RawName); | |||||
// if (loc >= 0 && RawName != null && weight >= 0) | |||||
// { | |||||
// int St_index = Array.FindIndex(StockStatus.ToArray(), p => p.MaterialName == RawName); | |||||
// if (St_index < 0) | |||||
// { | |||||
// StockStatus.Add(new StockStatusModel() | |||||
// { | |||||
// MaterialName = RawName, | |||||
// IssueWeight = weight, | |||||
// IssueStatus = 0, | |||||
// }); | |||||
// } | |||||
// St_index = Array.FindIndex(StockStatus.ToArray(), p => p.MaterialName == RawName); | |||||
// if (St_index >= 0) | |||||
// { | |||||
// if (recipeProcesses.ElementAt(recIndex).RawMaterials.ElementAt(loc).RecipeStatus == 1 && StockStatus.ElementAt(St_index).IssueStatus == 0) | |||||
// { | |||||
// StockStatus.ElementAt(St_index).IssueStatus = 1; | |||||
// DeviceInquire.GetInstance.GetDevice(Recipes.ElementAt(i).RawMaterials.ElementAt(loc).DeviceIp).Start(weight); | |||||
// MessageNotify.GetInstance.ShowRunLog($"柔性味魔方{Recipes.ElementAt(i).RawMaterials.ElementAt(loc).DeviceIp},开始出料"); | |||||
// } | |||||
// if (recipeProcesses.ElementAt(recIndex).RawMaterials.ElementAt(loc).RecipeStatus == 3 && StockStatus.ElementAt(St_index).IssueStatus == 1) | |||||
// { | |||||
// //GlobalDevice.PlcData.IsAllowIngredients[j] = false;//测试使用 | |||||
// StockStatus.ElementAt(St_index).IssueStatus = 2; | |||||
// DeviceInquire.GetInstance.GetDevice(Recipes.ElementAt(i).RawMaterials.ElementAt(loc).DeviceIp).StatusReset(); | |||||
// int a = 0.SetBitValue((byte)(DeviceNum), true); | |||||
// byte[] test1 = a.ToBytes(BPA.Helper.DataFormat.ABCD); | |||||
// int item = test1.ToInt(); | |||||
// string res = SiemensDevice.GetInstance.MySiemens.Write("DB4.DBD130", item, 5); | |||||
// MessageNotify.GetInstance.ShowRunLog($"{res}"); | |||||
// //MessageNotify.GetInstance.ShowRunLog($"DB4.DBD130:{item.ToBinString()}"); | |||||
// MessageNotify.GetInstance.ShowRunLog($"DB4.DBD130:{item}"); | |||||
// MessageNotify.GetInstance.ShowRunLog($"柔性味魔方{Recipes.ElementAt(i).RawMaterials.ElementAt(loc).DeviceIp},出料完成,状态复位"); | |||||
// } | |||||
// } | |||||
// } | |||||
// } | |||||
// } | |||||
// } | |||||
// else | |||||
// { | |||||
// if (Location2 >= 0) | |||||
// { | |||||
// string RawName = Recipes.ElementAt(i).RawMaterials.ElementAt(Location2).RawMaterialName; | |||||
// int abc = Array.FindIndex(DeviceInquire.GetInstance.devices.ToArray(), p => p.DeviceName == RawName); | |||||
// int DeviceNum = DeviceInquire.GetInstance.devices.ElementAt(abc).DeviceNum; | |||||
// if (DeviceNum >= 0) | |||||
// { | |||||
// float weight = Recipes.ElementAt(i).RawMaterials.ElementAt(Location2).RawMaterialWeight; | |||||
// int loc = Array.FindIndex(Recipes.ElementAt(i).RawMaterials.ToArray(), p => p.RawMaterialName == RawName); | |||||
// if (cnt > 0 && loc >= 0 && RawName != null && weight >= 0) | |||||
// { | |||||
// int St_index = Array.FindIndex(StockStatus.ToArray(), p => p.MaterialName == RawName); | |||||
// if (St_index < 0) | |||||
// { | |||||
// StockStatus.Add(new StockStatusModel() | |||||
// { | |||||
// MaterialName = RawName, | |||||
// IssueWeight = weight, | |||||
// IssueStatus = 0, | |||||
// }); | |||||
// } | |||||
// St_index = Array.FindIndex(StockStatus.ToArray(), p => p.MaterialName == RawName); | |||||
// if (St_index >= 0) | |||||
// { | |||||
// if (recipeProcesses.ElementAt(recIndex).RawMaterials.ElementAt(loc).RecipeStatus == 1 && StockStatus.ElementAt(St_index).IssueStatus == 0) | |||||
// { | |||||
// StockStatus.ElementAt(St_index).IssueStatus = 1; | |||||
// DeviceInquire.GetInstance.GetDevice(Recipes.ElementAt(i).RawMaterials.ElementAt(loc).DeviceIp).Start(weight); | |||||
// MessageNotify.GetInstance.ShowRunLog($"柔性味魔方{Recipes.ElementAt(i).RawMaterials.ElementAt(loc).DeviceIp},开始出料"); | |||||
// } | |||||
// if (recipeProcesses.ElementAt(recIndex).RawMaterials.ElementAt(loc).RecipeStatus == 3 && StockStatus.ElementAt(St_index).IssueStatus == 1) | |||||
// { | |||||
// //GlobalDevice.PlcData.IsAllowIngredients[j] = false;//测试使用 | |||||
// StockStatus.ElementAt(St_index).IssueStatus = 2; | |||||
// DeviceInquire.GetInstance.GetDevice(Recipes.ElementAt(i).RawMaterials.ElementAt(loc).DeviceIp).StatusReset(); | |||||
// int a = 0.SetBitValue((byte)(DeviceNum), true); | |||||
// byte[] test1 = a.ToBytes(BPA.Helper.DataFormat.ABCD); | |||||
// int item = test1.ToInt(); | |||||
// string res = SiemensDevice.GetInstance.MySiemens.Write("DB4.DBD130", item, 5); | |||||
// recipeProcesses.ElementAt(recIndex).RawMaterials.ElementAt(loc).UpLimtWeightFeedback = DeviceInquire.GetInstance.GetDevice(Recipes.ElementAt(i).RawMaterials.ElementAt(loc).DeviceIp).deviceStatus.NowWeightFeedback; | |||||
// MessageNotify.GetInstance.ShowRunLog($"{res}"); | |||||
// MessageNotify.GetInstance.ShowRunLog($"DB4.DBD130:{item.ToBinString()}"); | |||||
// MessageNotify.GetInstance.ShowRunLog($"柔性味魔方{Recipes.ElementAt(i).RawMaterials.ElementAt(loc).DeviceIp},出料完成,状态复位"); | |||||
// } | |||||
// } | |||||
// } | |||||
// } | |||||
// } | |||||
// } | |||||
//} | |||||
//508配料项目代码 | |||||
if (GlobalDevice.PlcData.IsAllowIngredients[j]) | if (GlobalDevice.PlcData.IsAllowIngredients[j]) | ||||
{ | { | ||||
int barrel = j + 1;//桶号 | int barrel = j + 1;//桶号 | ||||
int cnt = GlobalDevice.PlcData.LocationFeedback[j];//允许配料的位置 0~6 | |||||
if (RTrig.GetInstance("a").Start(GlobalDevice.PlcData.IsAllowIngredients[j])) | |||||
int cnt = GlobalDevice.PlcData.LocationFeedback[j];//允许配料的位置 1~10 | |||||
if (RTrig.GetInstance("a").Start(GlobalDevice.PlcData.IsAllowIngredients[j])) | |||||
{ | { | ||||
MessageNotify.GetInstance.ShowRunLog($"桶号:{barrel},位置:{cnt},允许配料"); | MessageNotify.GetInstance.ShowRunLog($"桶号:{barrel},位置:{cnt},允许配料"); | ||||
} | } | ||||
int Location1 = 0; | int Location1 = 0; | ||||
int Location2 = 0; | |||||
if (cnt == -1) | if (cnt == -1) | ||||
{ | { | ||||
MessageNotify.GetInstance.ShowRunLog("错误"); | |||||
MessageNotify.GetInstance.ShowRunLog("没有读取到配料的位置"); | |||||
return; | return; | ||||
} | } | ||||
else | else | ||||
{ | { | ||||
switch (cnt) | |||||
{ | |||||
case 1: | |||||
int a1 = Array.FindIndex(DeviceInquire.GetInstance.devices.ToArray(), p => p.DeviceNum == 1); | |||||
int b1 = Array.FindIndex(DeviceInquire.GetInstance.devices.ToArray(), p => p.DeviceNum == 2); | |||||
if (a1 >= 0) | |||||
{ | |||||
Location1 = Array.FindIndex(Recipes.ElementAt(i).RawMaterials.ToArray(), p => p.RawMaterialName == DeviceInquire.GetInstance.devices.ElementAt(a1).DeviceName && p.Loc == barrel); | |||||
} | |||||
if (b1 >= 0) | |||||
{ | |||||
Location2 = Array.FindIndex(Recipes.ElementAt(i).RawMaterials.ToArray(), p => p.RawMaterialName == DeviceInquire.GetInstance.devices.ElementAt(b1).DeviceName && p.Loc == barrel); | |||||
} | |||||
break; | |||||
case 2: | |||||
int a2 = Array.FindIndex(DeviceInquire.GetInstance.devices.ToArray(), p => p.DeviceNum == 3); | |||||
int b2 = Array.FindIndex(DeviceInquire.GetInstance.devices.ToArray(), p => p.DeviceNum == 4); | |||||
if (a2 >= 0) | |||||
{ | |||||
Location1 = Array.FindIndex(Recipes.ElementAt(i).RawMaterials.ToArray(), p => p.RawMaterialName == DeviceInquire.GetInstance.devices.ElementAt(a2).DeviceName && p.Loc == barrel); | |||||
} | |||||
if (b2 >= 0) | |||||
{ | |||||
Location2 = Array.FindIndex(Recipes.ElementAt(i).RawMaterials.ToArray(), p => p.RawMaterialName == DeviceInquire.GetInstance.devices.ElementAt(b2).DeviceName && p.Loc == barrel); | |||||
} | |||||
break; | |||||
case 3: | |||||
int a3 = Array.FindIndex(DeviceInquire.GetInstance.devices.ToArray(), p => p.DeviceNum == 5); | |||||
int b3 = Array.FindIndex(DeviceInquire.GetInstance.devices.ToArray(), p => p.DeviceNum == 6); | |||||
if (a3 >= 0) | |||||
{ | |||||
Location1 = Array.FindIndex(Recipes.ElementAt(i).RawMaterials.ToArray(), p => p.RawMaterialName == DeviceInquire.GetInstance.devices.ElementAt(a3).DeviceName && p.Loc == barrel); | |||||
} | |||||
if (b3 >= 0) | |||||
{ | |||||
Location2 = Array.FindIndex(Recipes.ElementAt(i).RawMaterials.ToArray(), p => p.RawMaterialName == DeviceInquire.GetInstance.devices.ElementAt(b3).DeviceName && p.Loc == barrel); | |||||
} | |||||
break; | |||||
case 4: | |||||
int a4 = Array.FindIndex(DeviceInquire.GetInstance.devices.ToArray(), p => p.DeviceNum == 7); | |||||
int b4 = Array.FindIndex(DeviceInquire.GetInstance.devices.ToArray(), p => p.DeviceNum == 8); | |||||
if (a4 >= 0) | |||||
{ | |||||
Location1 = Array.FindIndex(Recipes.ElementAt(i).RawMaterials.ToArray(), p => p.RawMaterialName == DeviceInquire.GetInstance.devices.ElementAt(a4).DeviceName && p.Loc == barrel); | |||||
} | |||||
if (b4 >= 0) | |||||
{ | |||||
Location2 = Array.FindIndex(Recipes.ElementAt(i).RawMaterials.ToArray(), p => p.RawMaterialName == DeviceInquire.GetInstance.devices.ElementAt(b4).DeviceName && p.Loc == barrel); | |||||
} | |||||
break; | |||||
case 5: | |||||
int a5 = Array.FindIndex(DeviceInquire.GetInstance.devices.ToArray(), p => p.DeviceNum == 9); | |||||
int b5 = Array.FindIndex(DeviceInquire.GetInstance.devices.ToArray(), p => p.DeviceNum == 10); | |||||
if (a5 >= 0) | |||||
{ | |||||
Location1 = Array.FindIndex(Recipes.ElementAt(i).RawMaterials.ToArray(), p => p.RawMaterialName == DeviceInquire.GetInstance.devices.ElementAt(a5).DeviceName && p.Loc == barrel); | |||||
} | |||||
if (b5 >= 0) | |||||
{ | |||||
Location2 = Array.FindIndex(Recipes.ElementAt(i).RawMaterials.ToArray(), p => p.RawMaterialName == DeviceInquire.GetInstance.devices.ElementAt(b5).DeviceName && p.Loc == barrel); | |||||
} | |||||
break; | |||||
case 6: | |||||
int a6 = Array.FindIndex(DeviceInquire.GetInstance.devices.ToArray(), p => p.DeviceNum == 11); | |||||
int b6 = Array.FindIndex(DeviceInquire.GetInstance.devices.ToArray(), p => p.DeviceNum == 12); | |||||
if (a6 >= 0) | |||||
{ | |||||
Location1 = Array.FindIndex(Recipes.ElementAt(i).RawMaterials.ToArray(), p => p.RawMaterialName == DeviceInquire.GetInstance.devices.ElementAt(a6).DeviceName && p.Loc == barrel); | |||||
} | |||||
if (b6 >= 0) | |||||
{ | |||||
Location2 = Array.FindIndex(Recipes.ElementAt(i).RawMaterials.ToArray(), p => p.RawMaterialName == DeviceInquire.GetInstance.devices.ElementAt(b6).DeviceName && p.Loc == barrel); | |||||
} | |||||
break; | |||||
default: | |||||
break; | |||||
} | |||||
int a1 = Array.FindIndex(DeviceInquire.GetInstance.devices.ToArray(), p => p.DeviceNum == cnt); | |||||
Location1 = Array.FindIndex(Recipes.ElementAt(i).RawMaterials.ToArray(), p => p.RawMaterialName == DeviceInquire.GetInstance.devices.ElementAt(a1).DeviceName && p.Loc == barrel); | |||||
} | } | ||||
if (Location1 >= 0) | if (Location1 >= 0) | ||||
{ | { | ||||
@@ -438,118 +611,28 @@ namespace BPASmartClient.DosingSystem.ViewModel | |||||
//GlobalDevice.PlcData.IsAllowIngredients[j] = false;//测试使用 | //GlobalDevice.PlcData.IsAllowIngredients[j] = false;//测试使用 | ||||
StockStatus.ElementAt(St_index).IssueStatus = 2; | StockStatus.ElementAt(St_index).IssueStatus = 2; | ||||
DeviceInquire.GetInstance.GetDevice(Recipes.ElementAt(i).RawMaterials.ElementAt(loc).DeviceIp).StatusReset(); | DeviceInquire.GetInstance.GetDevice(Recipes.ElementAt(i).RawMaterials.ElementAt(loc).DeviceIp).StatusReset(); | ||||
int a = 0.SetBitValue((byte)(DeviceNum), true); | |||||
/*int a = 0.SetBitValue((byte)(DeviceNum), true); | |||||
byte[] test1 = a.ToBytes(BPA.Helper.DataFormat.ABCD); | byte[] test1 = a.ToBytes(BPA.Helper.DataFormat.ABCD); | ||||
int item = test1.ToInt(); | |||||
string res = SiemensDevice.GetInstance.MySiemens.Write("DB4.DBD130", item,2); | |||||
MessageNotify.GetInstance.ShowRunLog($"{res}"); | |||||
MessageNotify.GetInstance.ShowRunLog($"DB4.DBD130:{item.ToBinString()}"); | |||||
MessageNotify.GetInstance.ShowRunLog($"柔性味魔方{Recipes.ElementAt(i).RawMaterials.ElementAt(loc).DeviceIp},出料完成,状态复位"); | |||||
} | |||||
} | |||||
} | |||||
} | |||||
} | |||||
if (Location1 >= 0) | |||||
{ | |||||
string RawName111 = Recipes.ElementAt(i).RawMaterials.ElementAt(Location1).RawMaterialName; | |||||
int St_index111 = Array.FindIndex(StockStatus.ToArray(), p => p.MaterialName == RawName111); | |||||
if (Location2 >= 0 && ((Location1 >= 0 && StockStatus.ElementAt(St_index111).IssueStatus == 2))) | |||||
{ | |||||
string RawName = Recipes.ElementAt(i).RawMaterials.ElementAt(Location2).RawMaterialName; | |||||
int abc = Array.FindIndex(DeviceInquire.GetInstance.devices.ToArray(), p => p.DeviceName == RawName); | |||||
int DeviceNum = DeviceInquire.GetInstance.devices.ElementAt(abc).DeviceNum; | |||||
if (DeviceNum > 0) | |||||
{ | |||||
float weight = Recipes.ElementAt(i).RawMaterials.ElementAt(Location2).RawMaterialWeight; | |||||
int loc = Array.FindIndex(Recipes.ElementAt(i).RawMaterials.ToArray(), p => p.RawMaterialName == RawName); | |||||
if (loc >= 0 && RawName != null && weight >= 0) | |||||
{ | |||||
int St_index = Array.FindIndex(StockStatus.ToArray(), p => p.MaterialName == RawName); | |||||
if (St_index < 0) | |||||
{ | |||||
StockStatus.Add(new StockStatusModel() | |||||
int item = test1.ToInt();*/ | |||||
if (DeviceNum >= 1 && DeviceNum <= 8) | |||||
{ | { | ||||
MaterialName = RawName, | |||||
IssueWeight = weight, | |||||
IssueStatus = 0, | |||||
}); | |||||
} | |||||
St_index = Array.FindIndex(StockStatus.ToArray(), p => p.MaterialName == RawName); | |||||
if (St_index >= 0) | |||||
{ | |||||
if (recipeProcesses.ElementAt(recIndex).RawMaterials.ElementAt(loc).RecipeStatus == 1 && StockStatus.ElementAt(St_index).IssueStatus == 0) | |||||
SiemensDevice.GetInstance.MySiemens.Write("DB4.DBX130." + (DeviceNum - 1), true); | |||||
}else if (DeviceNum >= 9 && DeviceNum <= 16) | |||||
{ | { | ||||
StockStatus.ElementAt(St_index).IssueStatus = 1; | |||||
DeviceInquire.GetInstance.GetDevice(Recipes.ElementAt(i).RawMaterials.ElementAt(loc).DeviceIp).Start(weight); | |||||
MessageNotify.GetInstance.ShowRunLog($"柔性味魔方{Recipes.ElementAt(i).RawMaterials.ElementAt(loc).DeviceIp},开始出料"); | |||||
SiemensDevice.GetInstance.MySiemens.Write("DB4.DBX131." + (DeviceNum - 9), true); | |||||
} | } | ||||
if (recipeProcesses.ElementAt(recIndex).RawMaterials.ElementAt(loc).RecipeStatus == 3 && StockStatus.ElementAt(St_index).IssueStatus == 1) | |||||
else if (DeviceNum >=17 && DeviceNum <= 24) | |||||
{ | { | ||||
//GlobalDevice.PlcData.IsAllowIngredients[j] = false;//测试使用 | |||||
StockStatus.ElementAt(St_index).IssueStatus = 2; | |||||
DeviceInquire.GetInstance.GetDevice(Recipes.ElementAt(i).RawMaterials.ElementAt(loc).DeviceIp).StatusReset(); | |||||
int a = 0.SetBitValue((byte)(DeviceNum), true); | |||||
byte[] test1 = a.ToBytes(BPA.Helper.DataFormat.ABCD); | |||||
int item = test1.ToInt(); | |||||
string res = SiemensDevice.GetInstance.MySiemens.Write("DB4.DBD130", item, 5); | |||||
MessageNotify.GetInstance.ShowRunLog($"{res}"); | |||||
//MessageNotify.GetInstance.ShowRunLog($"DB4.DBD130:{item.ToBinString()}"); | |||||
MessageNotify.GetInstance.ShowRunLog($"DB4.DBD130:{item}"); | |||||
MessageNotify.GetInstance.ShowRunLog($"柔性味魔方{Recipes.ElementAt(i).RawMaterials.ElementAt(loc).DeviceIp},出料完成,状态复位"); | |||||
} | |||||
} | |||||
} | |||||
} | |||||
} | |||||
} | |||||
else | |||||
{ | |||||
if (Location2 >= 0) | |||||
{ | |||||
string RawName = Recipes.ElementAt(i).RawMaterials.ElementAt(Location2).RawMaterialName; | |||||
int abc = Array.FindIndex(DeviceInquire.GetInstance.devices.ToArray(), p => p.DeviceName == RawName); | |||||
int DeviceNum = DeviceInquire.GetInstance.devices.ElementAt(abc).DeviceNum; | |||||
if (DeviceNum >= 0) | |||||
{ | |||||
float weight = Recipes.ElementAt(i).RawMaterials.ElementAt(Location2).RawMaterialWeight; | |||||
int loc = Array.FindIndex(Recipes.ElementAt(i).RawMaterials.ToArray(), p => p.RawMaterialName == RawName); | |||||
if (cnt > 0 && loc >= 0 && RawName != null && weight >= 0) | |||||
{ | |||||
int St_index = Array.FindIndex(StockStatus.ToArray(), p => p.MaterialName == RawName); | |||||
if (St_index < 0) | |||||
{ | |||||
StockStatus.Add(new StockStatusModel() | |||||
SiemensDevice.GetInstance.MySiemens.Write("DB4.DBX132." + (DeviceNum - 17), true); | |||||
}else if (DeviceNum >= 25 && DeviceNum <= 32) | |||||
{ | { | ||||
MaterialName = RawName, | |||||
IssueWeight = weight, | |||||
IssueStatus = 0, | |||||
}); | |||||
} | |||||
St_index = Array.FindIndex(StockStatus.ToArray(), p => p.MaterialName == RawName); | |||||
if (St_index >= 0) | |||||
{ | |||||
if (recipeProcesses.ElementAt(recIndex).RawMaterials.ElementAt(loc).RecipeStatus == 1 && StockStatus.ElementAt(St_index).IssueStatus == 0) | |||||
{ | |||||
StockStatus.ElementAt(St_index).IssueStatus = 1; | |||||
DeviceInquire.GetInstance.GetDevice(Recipes.ElementAt(i).RawMaterials.ElementAt(loc).DeviceIp).Start(weight); | |||||
MessageNotify.GetInstance.ShowRunLog($"柔性味魔方{Recipes.ElementAt(i).RawMaterials.ElementAt(loc).DeviceIp},开始出料"); | |||||
} | |||||
if (recipeProcesses.ElementAt(recIndex).RawMaterials.ElementAt(loc).RecipeStatus == 3 && StockStatus.ElementAt(St_index).IssueStatus == 1) | |||||
{ | |||||
//GlobalDevice.PlcData.IsAllowIngredients[j] = false;//测试使用 | |||||
StockStatus.ElementAt(St_index).IssueStatus = 2; | |||||
DeviceInquire.GetInstance.GetDevice(Recipes.ElementAt(i).RawMaterials.ElementAt(loc).DeviceIp).StatusReset(); | |||||
int a = 0.SetBitValue((byte)(DeviceNum), true); | |||||
byte[] test1 = a.ToBytes(BPA.Helper.DataFormat.ABCD); | |||||
int item = test1.ToInt(); | |||||
string res = SiemensDevice.GetInstance.MySiemens.Write("DB4.DBD130", item, 5); | |||||
recipeProcesses.ElementAt(recIndex).RawMaterials.ElementAt(loc).UpLimtWeightFeedback = DeviceInquire.GetInstance.GetDevice(Recipes.ElementAt(i).RawMaterials.ElementAt(loc).DeviceIp).deviceStatus.NowWeightFeedback; | |||||
MessageNotify.GetInstance.ShowRunLog($"{res}"); | |||||
MessageNotify.GetInstance.ShowRunLog($"DB4.DBD130:{item.ToBinString()}"); | |||||
MessageNotify.GetInstance.ShowRunLog($"柔性味魔方{Recipes.ElementAt(i).RawMaterials.ElementAt(loc).DeviceIp},出料完成,状态复位"); | |||||
SiemensDevice.GetInstance.MySiemens.Write("DB4.DBX133." + (DeviceNum - 25), true); | |||||
} | } | ||||
MessageNotify.GetInstance.ShowRunLog($"料仓:{DeviceNum},配料完成"); | |||||
/*string res = SiemensDevice.GetInstance.MySiemens.Write("DB4.DBD130", item, 2); | |||||
MessageNotify.GetInstance.ShowRunLog($"{res}"); | |||||
MessageNotify.GetInstance.ShowRunLog($"DB4.DBD130:{item.ToBinString()}");*/ | |||||
MessageNotify.GetInstance.ShowRunLog($"柔性味魔方{Recipes.ElementAt(i).RawMaterials.ElementAt(loc).DeviceIp},出料完成,状态复位"); | |||||
} | } | ||||
} | } | ||||
} | } | ||||
@@ -580,7 +663,7 @@ namespace BPASmartClient.DosingSystem.ViewModel | |||||
} | } | ||||
} | } | ||||
Thread.Sleep(100); | Thread.Sleep(100); | ||||
}), "RecipeControlViewModelStatusInquire"); | |||||
}), "RecipeControlViewModelStatusInquire",true); | |||||
} | } | ||||
public BPARelayCommand<object> StartCommand { get; set; } | public BPARelayCommand<object> StartCommand { get; set; } | ||||