@@ -161,7 +161,30 @@ namespace BPASmartClient.Helper | |||||
return (data & 1 << offset - 1) == 0 ? false : true; | return (data & 1 << offset - 1) == 0 ? false : true; | ||||
} | } | ||||
public static ushort SetBitValue(this ushort data, byte offset, bool val) | |||||
{ | |||||
if (offset > 16 || offset < 1) | |||||
{ | |||||
return data; | |||||
} | |||||
int num = 1 << offset - 1; | |||||
return (ushort)(val ? (data | num) : (data & ~num)); | |||||
} | |||||
public static bool GetBitValue(this ushort data, byte offset) | |||||
{ | |||||
if (offset > 16 || offset < 1) | |||||
{ | |||||
return false; | |||||
} | |||||
if ((data & (1 << offset - 1)) != 0) | |||||
{ | |||||
return true; | |||||
} | |||||
return false; | |||||
} | |||||
@@ -22,8 +22,18 @@ namespace BPASmartClient.JXJFoodBigStation | |||||
public partial class App : Application | public partial class App : Application | ||||
{ | { | ||||
public static Window MainWindow; | public static Window MainWindow; | ||||
public EventWaitHandle ProgramStarted { get; set; } | |||||
protected override void OnStartup(StartupEventArgs e) | protected override void OnStartup(StartupEventArgs e) | ||||
{ | { | ||||
bool createNew; | |||||
ProgramStarted = new EventWaitHandle(false, EventResetMode.AutoReset, "BigStationApp", out createNew); | |||||
if (!createNew) | |||||
{ | |||||
MessageBox.Show("程序已启动"); | |||||
App.Current.Shutdown(); | |||||
Environment.Exit(0); | |||||
} | |||||
BPASmartClient.Helper.SystemHelper.GetInstance.CreateDesktopShortcut(); | |||||
base.OnStartup(e); | base.OnStartup(e); | ||||
MenuInit(); | MenuInit(); | ||||
DataInit(); | DataInit(); | ||||
@@ -141,6 +151,13 @@ namespace BPASmartClient.JXJFoodBigStation | |||||
AssemblyName = "BPASmartClient.JXJFoodBigStation", | AssemblyName = "BPASmartClient.JXJFoodBigStation", | ||||
ToggleWindowPath = "View.HKPlcCommMonitorView" | ToggleWindowPath = "View.HKPlcCommMonitorView" | ||||
}); | }); | ||||
DeviceMonitor.Add(new SubMenumodel() | |||||
{ | |||||
SubMenuName = "手动流程", | |||||
SubMenuPermission = new Permission[] { Permission.管理员 }, | |||||
AssemblyName = "BPASmartClient.JXJFoodBigStation", | |||||
ToggleWindowPath = "View.ManualFlowView" | |||||
}); | |||||
MenuManage.GetInstance.menuModels.Add(new MenuModel() | MenuManage.GetInstance.menuModels.Add(new MenuModel() | ||||
{ | { | ||||
@@ -23,6 +23,9 @@ | |||||
<AutoGen>True</AutoGen> | <AutoGen>True</AutoGen> | ||||
<DependentUpon>Settings.settings</DependentUpon> | <DependentUpon>Settings.settings</DependentUpon> | ||||
</Compile> | </Compile> | ||||
<Compile Update="View\ManualFlowView.xaml.cs"> | |||||
<SubType>Code</SubType> | |||||
</Compile> | |||||
</ItemGroup> | </ItemGroup> | ||||
<ItemGroup> | <ItemGroup> | ||||
@@ -37,6 +40,10 @@ | |||||
<XamlRuntime>$(DefaultXamlRuntime)</XamlRuntime> | <XamlRuntime>$(DefaultXamlRuntime)</XamlRuntime> | ||||
<SubType>Designer</SubType> | <SubType>Designer</SubType> | ||||
</Page> | </Page> | ||||
<Page Update="View\ManualFlowView.xaml"> | |||||
<XamlRuntime>$(DefaultXamlRuntime)</XamlRuntime> | |||||
<SubType>Designer</SubType> | |||||
</Page> | |||||
<Page Update="View\RecipeInfosView.xaml"> | <Page Update="View\RecipeInfosView.xaml"> | ||||
<XamlRuntime>$(DefaultXamlRuntime)</XamlRuntime> | <XamlRuntime>$(DefaultXamlRuntime)</XamlRuntime> | ||||
</Page> | </Page> | ||||
@@ -1,4 +1,5 @@ | |||||
using BPASmartClient.JXJFoodBigStation.Model.Siemens; | |||||
using BPASmartClient.JXJFoodBigStation.Model.HK_PLC; | |||||
using BPASmartClient.JXJFoodBigStation.Model.Siemens; | |||||
using System; | using System; | ||||
using System.Collections.Concurrent; | using System.Collections.Concurrent; | ||||
using System.Collections.Generic; | using System.Collections.Generic; | ||||
@@ -15,6 +16,11 @@ namespace BPASmartClient.JXJFoodBigStation.Model | |||||
/// plc心跳上传 | /// plc心跳上传 | ||||
/// </summary> | /// </summary> | ||||
public static bool HeartBeatFromPlc { get; set; } | public static bool HeartBeatFromPlc { get; set; } | ||||
/// <summary> | |||||
/// plc心跳下发 | |||||
/// </summary> | |||||
public static bool HeartBeatToPlc { get; set; } | |||||
/// <summary> | /// <summary> | ||||
/// 配方下发状态 =0:配方未下发 ,1:配方下发给plc ,2:plc成功接收配方 | /// 配方下发状态 =0:配方未下发 ,1:配方下发给plc ,2:plc成功接收配方 | ||||
/// </summary> | /// </summary> | ||||
@@ -42,5 +48,13 @@ namespace BPASmartClient.JXJFoodBigStation.Model | |||||
public static int SiemensSendRecipeStatus { get; set; } = 0; | public static int SiemensSendRecipeStatus { get; set; } = 0; | ||||
public const int Max_DosingSotckBinNum = 14; | public const int Max_DosingSotckBinNum = 14; | ||||
public static ushort AGVPutTray { get; set; } | |||||
public static ushort AGVGetTray { get; set; } | |||||
public static ushort TraySensor { get; set; } | |||||
public static ushort TrayCylinder { get; set; } | |||||
public static DB_Read HKPlc_Read = new DB_Read(); | |||||
} | } | ||||
} | } |
@@ -9,16 +9,9 @@ namespace BPASmartClient.JXJFoodBigStation.Model.HK_PLC | |||||
public class DB_Read | public class DB_Read | ||||
{ | { | ||||
[PlcComm("plc心跳上报")] | [PlcComm("plc心跳上报")] | ||||
/// <summary> | |||||
/// plc心跳上报 | |||||
/// </summary> | |||||
public bool HeartBeat { get; set; } | public bool HeartBeat { get; set; } | ||||
[PlcComm("配方1允许下发配方")] | [PlcComm("配方1允许下发配方")] | ||||
/// <summary> | |||||
/// 配方1允许下发配方 | |||||
/// </summary> | |||||
public bool IsAllowIssueRecipe1 { get; set; } | public bool IsAllowIssueRecipe1 { get; set; } | ||||
[PlcComm("配方2允许下发配方")] | [PlcComm("配方2允许下发配方")] | ||||
public bool IsAllowIssueRecipe2 { get; set; } | public bool IsAllowIssueRecipe2 { get; set; } | ||||
@@ -29,9 +22,6 @@ namespace BPASmartClient.JXJFoodBigStation.Model.HK_PLC | |||||
public bool IsAllowIssueRecipe4 { get; set; } | public bool IsAllowIssueRecipe4 { get; set; } | ||||
[PlcComm("配方1接收配方完成")] | [PlcComm("配方1接收配方完成")] | ||||
/// <summary> | |||||
/// 配方1 接收配方完成 | |||||
/// </summary> | |||||
public bool ReceiveFinishRecipe1 { get; set; } | public bool ReceiveFinishRecipe1 { get; set; } | ||||
[PlcComm("配方2接收配方完成")] | [PlcComm("配方2接收配方完成")] | ||||
public bool ReceiveFinishRecipe2 { get; set; } | public bool ReceiveFinishRecipe2 { get; set; } | ||||
@@ -40,9 +30,6 @@ namespace BPASmartClient.JXJFoodBigStation.Model.HK_PLC | |||||
[PlcComm("配方4接收配方完成")] | [PlcComm("配方4接收配方完成")] | ||||
public bool ReceiveFinishRecipe4 { get; set; } | public bool ReceiveFinishRecipe4 { get; set; } | ||||
[PlcComm("配方1配料完成")] | [PlcComm("配方1配料完成")] | ||||
/// <summary> | |||||
/// 配方1 配料完成 | |||||
/// </summary> | |||||
public bool Recipe1DosingFinish { get; set; } | public bool Recipe1DosingFinish { get; set; } | ||||
[PlcComm("配方2配料完成")] | [PlcComm("配方2配料完成")] | ||||
public bool Recipe2DosingFinish { get; set; } | public bool Recipe2DosingFinish { get; set; } | ||||
@@ -51,9 +38,6 @@ namespace BPASmartClient.JXJFoodBigStation.Model.HK_PLC | |||||
[PlcComm("配方4配料完成")] | [PlcComm("配方4配料完成")] | ||||
public bool Recipe4DosingFinish { get; set; } | public bool Recipe4DosingFinish { get; set; } | ||||
[PlcComm("配方1托盘编号")] | [PlcComm("配方1托盘编号")] | ||||
/// <summary> | |||||
/// 配方1 托盘编号 | |||||
/// </summary> | |||||
public short Recipe1TrayCode { get; set; } | public short Recipe1TrayCode { get; set; } | ||||
[PlcComm("配方2托盘编号")] | [PlcComm("配方2托盘编号")] | ||||
public short Recipe2TrayCode { get; set; } | public short Recipe2TrayCode { get; set; } | ||||
@@ -89,5 +73,41 @@ namespace BPASmartClient.JXJFoodBigStation.Model.HK_PLC | |||||
public float StockBin13ActualWeight { get; set; } | public float StockBin13ActualWeight { get; set; } | ||||
[PlcComm("料仓14实际下料重量")] | [PlcComm("料仓14实际下料重量")] | ||||
public float StockBin14ActualWeight { get; set; } | public float StockBin14ActualWeight { get; set; } | ||||
/*[PlcComm("托盘到位")] | |||||
public ushort TrayInPlace { get; set; } | |||||
[PlcComm("托盘传感器信号")] | |||||
public ushort TraySensor { get; set; } | |||||
[PlcComm("托盘1气缸信号")] | |||||
public ushort TrayCylinder { get; set; }*/ | |||||
[PlcComm("托盘1到位")] | |||||
public bool Tray1InPlace { get; set; } | |||||
[PlcComm("托盘2到位")] | |||||
public bool Tray2InPlace { get; set; } | |||||
[PlcComm("托盘3到位")] | |||||
public bool Tray3InPlace { get; set; } | |||||
[PlcComm("托盘4到位")] | |||||
public bool Tray4InPlace { get; set; } | |||||
[PlcComm("托盘5到位")] | |||||
public bool Tray5InPlace { get; set; } | |||||
[PlcComm("托盘1气缸信号")] | |||||
public bool Tray1Cylinder { get; set; } | |||||
[PlcComm("托盘2气缸信号")] | |||||
public bool Tray2Cylinder { get; set; } | |||||
[PlcComm("托盘3气缸信号")] | |||||
public bool Tray3Cylinder { get; set; } | |||||
[PlcComm("托盘4气缸信号")] | |||||
public bool Tray4Cylinder { get; set; } | |||||
[PlcComm("托盘5气缸信号")] | |||||
public bool Tray5Cylinder { get; set; } | |||||
[PlcComm("托盘1传感器信号")] | |||||
public bool Tray1Sensor { get; set; } | |||||
[PlcComm("托盘2传感器信号")] | |||||
public bool Tray2Sensor { get; set; } | |||||
[PlcComm("托盘3传感器信号")] | |||||
public bool Tray3Sensor { get; set; } | |||||
[PlcComm("托盘4传感器信号")] | |||||
public bool Tray4Sensor { get; set; } | |||||
[PlcComm("托盘5传感器信号")] | |||||
public bool Tray5Sensor { get; set; } | |||||
} | } | ||||
} | } |
@@ -8,6 +8,7 @@ using BPASmartClient.CustomResource.Pages.Model; | |||||
using System.Threading.Tasks; | using System.Threading.Tasks; | ||||
using BPASmartClient.S7Net; | using BPASmartClient.S7Net; | ||||
using System.Threading; | using System.Threading; | ||||
using BPASmartClient.JXJFoodBigStation.Model.Siemens; | |||||
namespace BPASmartClient.JXJFoodBigStation.Model.HK_PLC | namespace BPASmartClient.JXJFoodBigStation.Model.HK_PLC | ||||
{ | { | ||||
@@ -15,30 +16,37 @@ namespace BPASmartClient.JXJFoodBigStation.Model.HK_PLC | |||||
{ | { | ||||
public SiemensHelper HK_PLC_S7 = new SiemensHelper(); | public SiemensHelper HK_PLC_S7 = new SiemensHelper(); | ||||
public bool IsConnected => HK_PLC_S7.IsConnected; | public bool IsConnected => HK_PLC_S7.IsConnected; | ||||
public DB_Write PlcWrite = new DB_Write(); | |||||
public DB_Read PlcRead = new DB_Read(); | public DB_Read PlcRead = new DB_Read(); | ||||
public DL_DataColl_DB DataColl =new DL_DataColl_DB(); | |||||
public StockBinName StockBinName = new StockBinName(); | public StockBinName StockBinName = new StockBinName(); | ||||
public void Init() | public void Init() | ||||
{ | { | ||||
if (IsConnected) | |||||
DB_Write PlcWrite = new DB_Write(); | |||||
HK_PLC_S7.WriteClass<DB_Write>(PlcWrite, 99); | |||||
ThreadManage.GetInstance().StartLong(new Action(() => | |||||
{ | { | ||||
ThreadManage.GetInstance().StartLong(new Action(() => | |||||
if (IsConnected) | |||||
{ | { | ||||
HK_PLC_S7.WriteClass<DB_Write>(PlcWrite, 99); | |||||
var res1 = HK_PLC_S7.ReadClass<DB_Read>(98); | var res1 = HK_PLC_S7.ReadClass<DB_Read>(98); | ||||
var res2 = HK_PLC_S7.ReadClass<StockBinName>(97); | var res2 = HK_PLC_S7.ReadClass<StockBinName>(97); | ||||
if (res1 != null && res1 is DB_Read data1) | if (res1 != null && res1 is DB_Read data1) | ||||
{ | { | ||||
PlcRead = data1; | PlcRead = data1; | ||||
GVL_BigStation.HeartBeatFromPlc = data1.HeartBeat;//读取plc心跳 | |||||
GVL_BigStation.HKPlc_Read = data1; | |||||
} | } | ||||
if (res2 != null && res2 is StockBinName data2) | if (res2 != null && res2 is StockBinName data2) | ||||
{ | { | ||||
StockBinName = data2; | StockBinName = data2; | ||||
} | } | ||||
Thread.Sleep(10); | |||||
}),"信号收发处理"); | |||||
} | |||||
var res3 = HK_PLC_S7.ReadClass<DL_DataColl_DB>(48); | |||||
if (res3 != null && res3 is DL_DataColl_DB data) | |||||
{ | |||||
DataColl = data; | |||||
} | |||||
} | |||||
Thread.Sleep(10); | |||||
}),"信号收发处理"); | |||||
} | } | ||||
/// <summary> | /// <summary> | ||||
/// 下发配方数据 | /// 下发配方数据 | ||||
@@ -49,8 +57,8 @@ namespace BPASmartClient.JXJFoodBigStation.Model.HK_PLC | |||||
{ | { | ||||
if (recipe != null) | if (recipe != null) | ||||
{ | { | ||||
PlcWrite.RecipeCode = Convert.ToInt16(recipe.RecipeCode); | |||||
PlcWrite.TrayCode = Convert.ToInt16(recipe.TrayCode); | |||||
HK_PLC_S7.Write("DB99.DBW2.0",Convert.ToInt16(recipe.TrayCode)); | |||||
HK_PLC_S7.Write("DB99.DBW4.0", Convert.ToInt16(recipe.TrayCode)); | |||||
for (int barrel = 1; barrel < 6; barrel++) | for (int barrel = 1; barrel < 6; barrel++) | ||||
{ | { | ||||
if (barrel != 3)//桶的编号不为3 只为1,2,4,5号桶 | if (barrel != 3)//桶的编号不为3 只为1,2,4,5号桶 | ||||
@@ -63,204 +71,20 @@ namespace BPASmartClient.JXJFoodBigStation.Model.HK_PLC | |||||
switch (barrel) | switch (barrel) | ||||
{ | { | ||||
case 1: | case 1: | ||||
switch (loc) | |||||
{ | |||||
case 1: | |||||
PlcWrite.Bareel1Bin1SetWeight = 0; | |||||
break; | |||||
case 2: | |||||
PlcWrite.Bareel1Bin2SetWeight = 0; | |||||
break; | |||||
case 3: | |||||
PlcWrite.Bareel1Bin3SetWeight = 0; | |||||
break; | |||||
case 4: | |||||
PlcWrite.Bareel1Bin4SetWeight = 0; | |||||
break; | |||||
case 5: | |||||
PlcWrite.Bareel1Bin5SetWeight = 0; | |||||
break; | |||||
case 6: | |||||
PlcWrite.Bareel1Bin6SetWeight = 0; | |||||
break; | |||||
case 7: | |||||
PlcWrite.Bareel1Bin7SetWeight = 0; | |||||
break; | |||||
case 8: | |||||
PlcWrite.Bareel1Bin8SetWeight = 0; | |||||
break; | |||||
case 9: | |||||
PlcWrite.Bareel1Bin9SetWeight = 0; | |||||
break; | |||||
case 10: | |||||
PlcWrite.Bareel1Bin10SetWeight = 0; | |||||
break; | |||||
case 11: | |||||
PlcWrite.Bareel1Bin11SetWeight = 0; | |||||
break; | |||||
case 12: | |||||
PlcWrite.Bareel1Bin12SetWeight = 0; | |||||
break; | |||||
case 13: | |||||
PlcWrite.Bareel1Bin13SetWeight = 0; | |||||
break; | |||||
case 14: | |||||
PlcWrite.Bareel1Bin14SetWeight = 0; | |||||
break; | |||||
default: | |||||
break; | |||||
} | |||||
string address = "DB99.DBD" + (6 + 4 * (loc - 1)); | |||||
HK_PLC_S7.Write(address, 0); | |||||
break; | break; | ||||
case 2: | case 2: | ||||
switch (loc) | |||||
{ | |||||
case 1: | |||||
PlcWrite.Bareel2Bin1SetWeight = 0; | |||||
break; | |||||
case 2: | |||||
PlcWrite.Bareel2Bin2SetWeight = 0; | |||||
break; | |||||
case 3: | |||||
PlcWrite.Bareel2Bin3SetWeight = 0; | |||||
break; | |||||
case 4: | |||||
PlcWrite.Bareel2Bin4SetWeight = 0; | |||||
break; | |||||
case 5: | |||||
PlcWrite.Bareel2Bin5SetWeight = 0; | |||||
break; | |||||
case 6: | |||||
PlcWrite.Bareel2Bin6SetWeight = 0; | |||||
break; | |||||
case 7: | |||||
PlcWrite.Bareel2Bin7SetWeight = 0; | |||||
break; | |||||
case 8: | |||||
PlcWrite.Bareel2Bin8SetWeight = 0; | |||||
break; | |||||
case 9: | |||||
PlcWrite.Bareel2Bin9SetWeight = 0; | |||||
break; | |||||
case 10: | |||||
PlcWrite.Bareel2Bin10SetWeight = 0; | |||||
break; | |||||
case 11: | |||||
PlcWrite.Bareel2Bin11SetWeight = 0; | |||||
break; | |||||
case 12: | |||||
PlcWrite.Bareel2Bin12SetWeight = 0; | |||||
break; | |||||
case 13: | |||||
PlcWrite.Bareel2Bin13SetWeight = 0; | |||||
break; | |||||
case 14: | |||||
PlcWrite.Bareel2Bin14SetWeight = 0; | |||||
break; | |||||
default: | |||||
break; | |||||
} | |||||
string address1 = "DB99.DBD" + (62 + 4 * (loc - 1)); | |||||
HK_PLC_S7.Write(address1, 0); | |||||
break; | break; | ||||
case 4: | case 4: | ||||
switch (loc) | |||||
{ | |||||
case 1: | |||||
PlcWrite.Bareel4Bin1SetWeight = 0; | |||||
break; | |||||
case 2: | |||||
PlcWrite.Bareel4Bin2SetWeight = 0; | |||||
break; | |||||
case 3: | |||||
PlcWrite.Bareel4Bin3SetWeight = 0; | |||||
break; | |||||
case 4: | |||||
PlcWrite.Bareel4Bin4SetWeight = 0; | |||||
break; | |||||
case 5: | |||||
PlcWrite.Bareel4Bin5SetWeight = 0; | |||||
break; | |||||
case 6: | |||||
PlcWrite.Bareel4Bin6SetWeight = 0; | |||||
break; | |||||
case 7: | |||||
PlcWrite.Bareel4Bin7SetWeight = 0; | |||||
break; | |||||
case 8: | |||||
PlcWrite.Bareel4Bin8SetWeight = 0; | |||||
break; | |||||
case 9: | |||||
PlcWrite.Bareel4Bin9SetWeight = 0; | |||||
break; | |||||
case 10: | |||||
PlcWrite.Bareel4Bin10SetWeight = 0; | |||||
break; | |||||
case 11: | |||||
PlcWrite.Bareel4Bin11SetWeight = 0; | |||||
break; | |||||
case 12: | |||||
PlcWrite.Bareel4Bin12SetWeight = 0; | |||||
break; | |||||
case 13: | |||||
PlcWrite.Bareel4Bin13SetWeight = 0; | |||||
break; | |||||
case 14: | |||||
PlcWrite.Bareel4Bin14SetWeight = 0; | |||||
break; | |||||
default: | |||||
break; | |||||
} | |||||
string address2 = "DB99.DBD" + (118 + 4 * (loc - 1)); | |||||
HK_PLC_S7.Write(address2, 0); | |||||
break; | break; | ||||
case 5: | case 5: | ||||
switch (loc) | |||||
{ | |||||
case 1: | |||||
PlcWrite.Bareel5Bin1SetWeight = 0; | |||||
break; | |||||
case 2: | |||||
PlcWrite.Bareel5Bin2SetWeight = 0; | |||||
break; | |||||
case 3: | |||||
PlcWrite.Bareel5Bin3SetWeight = 0; | |||||
break; | |||||
case 4: | |||||
PlcWrite.Bareel5Bin4SetWeight = 0; | |||||
break; | |||||
case 5: | |||||
PlcWrite.Bareel5Bin5SetWeight = 0; | |||||
break; | |||||
case 6: | |||||
PlcWrite.Bareel5Bin6SetWeight = 0; | |||||
break; | |||||
case 7: | |||||
PlcWrite.Bareel5Bin7SetWeight = 0; | |||||
break; | |||||
case 8: | |||||
PlcWrite.Bareel5Bin8SetWeight = 0; | |||||
break; | |||||
case 9: | |||||
PlcWrite.Bareel5Bin9SetWeight = 0; | |||||
break; | |||||
case 10: | |||||
PlcWrite.Bareel5Bin10SetWeight = 0; | |||||
break; | |||||
case 11: | |||||
PlcWrite.Bareel5Bin11SetWeight = 0; | |||||
break; | |||||
case 12: | |||||
PlcWrite.Bareel5Bin12SetWeight = 0; | |||||
break; | |||||
case 13: | |||||
PlcWrite.Bareel5Bin13SetWeight = 0; | |||||
break; | |||||
case 14: | |||||
PlcWrite.Bareel5Bin14SetWeight = 0; | |||||
break; | |||||
default: | |||||
break; | |||||
} | |||||
string address3 = "DB99.DBD" + (174 + 4 * (loc - 1)); | |||||
HK_PLC_S7.Write(address3, 0); | |||||
break; | break; | ||||
default: | default: | ||||
break; | break; | ||||
@@ -273,204 +97,20 @@ namespace BPASmartClient.JXJFoodBigStation.Model.HK_PLC | |||||
switch (barrel) | switch (barrel) | ||||
{ | { | ||||
case 1: | case 1: | ||||
switch (loc) | |||||
{ | |||||
case 1: | |||||
PlcWrite.Bareel1Bin1SetWeight = recipe.RawMaterial.ElementAt(index).RawMaterialWeight; | |||||
break; | |||||
case 2: | |||||
PlcWrite.Bareel1Bin2SetWeight = recipe.RawMaterial.ElementAt(index).RawMaterialWeight; | |||||
break; | |||||
case 3: | |||||
PlcWrite.Bareel1Bin3SetWeight = recipe.RawMaterial.ElementAt(index).RawMaterialWeight; | |||||
break; | |||||
case 4: | |||||
PlcWrite.Bareel1Bin4SetWeight = recipe.RawMaterial.ElementAt(index).RawMaterialWeight; | |||||
break; | |||||
case 5: | |||||
PlcWrite.Bareel1Bin5SetWeight = recipe.RawMaterial.ElementAt(index).RawMaterialWeight; | |||||
break; | |||||
case 6: | |||||
PlcWrite.Bareel1Bin6SetWeight = recipe.RawMaterial.ElementAt(index).RawMaterialWeight; | |||||
break; | |||||
case 7: | |||||
PlcWrite.Bareel1Bin7SetWeight = recipe.RawMaterial.ElementAt(index).RawMaterialWeight; | |||||
break; | |||||
case 8: | |||||
PlcWrite.Bareel1Bin8SetWeight = recipe.RawMaterial.ElementAt(index).RawMaterialWeight; | |||||
break; | |||||
case 9: | |||||
PlcWrite.Bareel1Bin9SetWeight = recipe.RawMaterial.ElementAt(index).RawMaterialWeight; | |||||
break; | |||||
case 10: | |||||
PlcWrite.Bareel1Bin10SetWeight = recipe.RawMaterial.ElementAt(index).RawMaterialWeight; | |||||
break; | |||||
case 11: | |||||
PlcWrite.Bareel1Bin11SetWeight = recipe.RawMaterial.ElementAt(index).RawMaterialWeight; | |||||
break; | |||||
case 12: | |||||
PlcWrite.Bareel1Bin12SetWeight = recipe.RawMaterial.ElementAt(index).RawMaterialWeight; | |||||
break; | |||||
case 13: | |||||
PlcWrite.Bareel1Bin13SetWeight = recipe.RawMaterial.ElementAt(index).RawMaterialWeight; | |||||
break; | |||||
case 14: | |||||
PlcWrite.Bareel1Bin14SetWeight = recipe.RawMaterial.ElementAt(index).RawMaterialWeight; | |||||
break; | |||||
default: | |||||
break; | |||||
} | |||||
string address = "DB99.DBD" + (6 + 4 * (loc - 1)); | |||||
HK_PLC_S7.Write(address, recipe.RawMaterial.ElementAt(index).RawMaterialWeight); | |||||
break; | break; | ||||
case 2: | case 2: | ||||
switch (loc) | |||||
{ | |||||
case 1: | |||||
PlcWrite.Bareel2Bin1SetWeight = recipe.RawMaterial.ElementAt(index).RawMaterialWeight; | |||||
break; | |||||
case 2: | |||||
PlcWrite.Bareel2Bin2SetWeight = recipe.RawMaterial.ElementAt(index).RawMaterialWeight; | |||||
break; | |||||
case 3: | |||||
PlcWrite.Bareel2Bin3SetWeight = recipe.RawMaterial.ElementAt(index).RawMaterialWeight; | |||||
break; | |||||
case 4: | |||||
PlcWrite.Bareel2Bin4SetWeight = recipe.RawMaterial.ElementAt(index).RawMaterialWeight; | |||||
break; | |||||
case 5: | |||||
PlcWrite.Bareel2Bin5SetWeight = recipe.RawMaterial.ElementAt(index).RawMaterialWeight; | |||||
break; | |||||
case 6: | |||||
PlcWrite.Bareel2Bin6SetWeight = recipe.RawMaterial.ElementAt(index).RawMaterialWeight; | |||||
break; | |||||
case 7: | |||||
PlcWrite.Bareel2Bin7SetWeight = recipe.RawMaterial.ElementAt(index).RawMaterialWeight; | |||||
break; | |||||
case 8: | |||||
PlcWrite.Bareel2Bin8SetWeight = recipe.RawMaterial.ElementAt(index).RawMaterialWeight; | |||||
break; | |||||
case 9: | |||||
PlcWrite.Bareel2Bin9SetWeight = recipe.RawMaterial.ElementAt(index).RawMaterialWeight; | |||||
break; | |||||
case 10: | |||||
PlcWrite.Bareel2Bin10SetWeight = recipe.RawMaterial.ElementAt(index).RawMaterialWeight; | |||||
break; | |||||
case 11: | |||||
PlcWrite.Bareel2Bin11SetWeight = recipe.RawMaterial.ElementAt(index).RawMaterialWeight; | |||||
break; | |||||
case 12: | |||||
PlcWrite.Bareel2Bin12SetWeight = recipe.RawMaterial.ElementAt(index).RawMaterialWeight; | |||||
break; | |||||
case 13: | |||||
PlcWrite.Bareel2Bin13SetWeight = recipe.RawMaterial.ElementAt(index).RawMaterialWeight; | |||||
break; | |||||
case 14: | |||||
PlcWrite.Bareel2Bin14SetWeight = recipe.RawMaterial.ElementAt(index).RawMaterialWeight; | |||||
break; | |||||
default: | |||||
break; | |||||
} | |||||
string address1 = "DB99.DBD" + (62 + 4 * (loc - 1)); | |||||
HK_PLC_S7.Write(address1, recipe.RawMaterial.ElementAt(index).RawMaterialWeight); | |||||
break; | break; | ||||
case 4: | case 4: | ||||
switch (loc) | |||||
{ | |||||
case 1: | |||||
PlcWrite.Bareel4Bin1SetWeight = recipe.RawMaterial.ElementAt(index).RawMaterialWeight; | |||||
break; | |||||
case 2: | |||||
PlcWrite.Bareel4Bin2SetWeight = recipe.RawMaterial.ElementAt(index).RawMaterialWeight; | |||||
break; | |||||
case 3: | |||||
PlcWrite.Bareel4Bin3SetWeight = recipe.RawMaterial.ElementAt(index).RawMaterialWeight; | |||||
break; | |||||
case 4: | |||||
PlcWrite.Bareel4Bin4SetWeight = recipe.RawMaterial.ElementAt(index).RawMaterialWeight; | |||||
break; | |||||
case 5: | |||||
PlcWrite.Bareel4Bin5SetWeight = recipe.RawMaterial.ElementAt(index).RawMaterialWeight; | |||||
break; | |||||
case 6: | |||||
PlcWrite.Bareel4Bin6SetWeight = recipe.RawMaterial.ElementAt(index).RawMaterialWeight; | |||||
break; | |||||
case 7: | |||||
PlcWrite.Bareel4Bin7SetWeight = recipe.RawMaterial.ElementAt(index).RawMaterialWeight; | |||||
break; | |||||
case 8: | |||||
PlcWrite.Bareel4Bin8SetWeight = recipe.RawMaterial.ElementAt(index).RawMaterialWeight; | |||||
break; | |||||
case 9: | |||||
PlcWrite.Bareel4Bin9SetWeight = recipe.RawMaterial.ElementAt(index).RawMaterialWeight; | |||||
break; | |||||
case 10: | |||||
PlcWrite.Bareel4Bin10SetWeight = recipe.RawMaterial.ElementAt(index).RawMaterialWeight; | |||||
break; | |||||
case 11: | |||||
PlcWrite.Bareel4Bin11SetWeight = recipe.RawMaterial.ElementAt(index).RawMaterialWeight; | |||||
break; | |||||
case 12: | |||||
PlcWrite.Bareel4Bin12SetWeight = recipe.RawMaterial.ElementAt(index).RawMaterialWeight; | |||||
break; | |||||
case 13: | |||||
PlcWrite.Bareel4Bin13SetWeight = recipe.RawMaterial.ElementAt(index).RawMaterialWeight; | |||||
break; | |||||
case 14: | |||||
PlcWrite.Bareel4Bin14SetWeight = recipe.RawMaterial.ElementAt(index).RawMaterialWeight; | |||||
break; | |||||
default: | |||||
break; | |||||
} | |||||
string address2 = "DB99.DBD" + (118 + 4 * (loc - 1)); | |||||
HK_PLC_S7.Write(address2, recipe.RawMaterial.ElementAt(index).RawMaterialWeight); | |||||
break; | break; | ||||
case 5: | case 5: | ||||
switch (loc) | |||||
{ | |||||
case 1: | |||||
PlcWrite.Bareel5Bin1SetWeight = recipe.RawMaterial.ElementAt(index).RawMaterialWeight; | |||||
break; | |||||
case 2: | |||||
PlcWrite.Bareel5Bin2SetWeight = recipe.RawMaterial.ElementAt(index).RawMaterialWeight; | |||||
break; | |||||
case 3: | |||||
PlcWrite.Bareel5Bin3SetWeight = recipe.RawMaterial.ElementAt(index).RawMaterialWeight; | |||||
break; | |||||
case 4: | |||||
PlcWrite.Bareel5Bin4SetWeight = recipe.RawMaterial.ElementAt(index).RawMaterialWeight; | |||||
break; | |||||
case 5: | |||||
PlcWrite.Bareel5Bin5SetWeight = recipe.RawMaterial.ElementAt(index).RawMaterialWeight; | |||||
break; | |||||
case 6: | |||||
PlcWrite.Bareel5Bin6SetWeight = recipe.RawMaterial.ElementAt(index).RawMaterialWeight; | |||||
break; | |||||
case 7: | |||||
PlcWrite.Bareel5Bin7SetWeight = recipe.RawMaterial.ElementAt(index).RawMaterialWeight; | |||||
break; | |||||
case 8: | |||||
PlcWrite.Bareel5Bin8SetWeight = recipe.RawMaterial.ElementAt(index).RawMaterialWeight; | |||||
break; | |||||
case 9: | |||||
PlcWrite.Bareel5Bin9SetWeight = recipe.RawMaterial.ElementAt(index).RawMaterialWeight; | |||||
break; | |||||
case 10: | |||||
PlcWrite.Bareel5Bin10SetWeight = recipe.RawMaterial.ElementAt(index).RawMaterialWeight; | |||||
break; | |||||
case 11: | |||||
PlcWrite.Bareel5Bin11SetWeight = recipe.RawMaterial.ElementAt(index).RawMaterialWeight; | |||||
break; | |||||
case 12: | |||||
PlcWrite.Bareel5Bin12SetWeight = recipe.RawMaterial.ElementAt(index).RawMaterialWeight; | |||||
break; | |||||
case 13: | |||||
PlcWrite.Bareel5Bin13SetWeight = recipe.RawMaterial.ElementAt(index).RawMaterialWeight; | |||||
break; | |||||
case 14: | |||||
PlcWrite.Bareel5Bin14SetWeight = recipe.RawMaterial.ElementAt(index).RawMaterialWeight; | |||||
break; | |||||
default: | |||||
break; | |||||
} | |||||
string address3 = "DB99.DBD" + (174 + 4 * (loc - 1)); | |||||
HK_PLC_S7.Write(address3, recipe.RawMaterial.ElementAt(index).RawMaterialWeight); | |||||
break; | break; | ||||
default: | default: | ||||
break; | break; | ||||
@@ -0,0 +1,64 @@ | |||||
using BPASmartClient.S7Net; | |||||
using System; | |||||
using System.Collections.Generic; | |||||
using System.Linq; | |||||
using System.Text; | |||||
using System.Threading.Tasks; | |||||
namespace BPASmartClient.JXJFoodBigStation.Model.HK_PLC | |||||
{ | |||||
public class PlcReadAddressDB45 | |||||
{ | |||||
[Siemens(16)] | |||||
public string RecipeCode { get; set; } | |||||
[Siemens(16)] | |||||
public string RecipeName { get; set; } | |||||
/// <summary> | |||||
/// 缺料本机 | |||||
/// </summary> | |||||
public bool DeviceInComplete { get; set; } | |||||
/// <summary> | |||||
/// 上游缺料 | |||||
/// </summary> | |||||
public bool TopInComple { get; set; } | |||||
/// <summary> | |||||
/// 下游堵料 | |||||
/// </summary> | |||||
public bool DownWindrow { get; set; } | |||||
/// <summary> | |||||
/// 设备启动 | |||||
/// </summary> | |||||
public bool DeviceStart { get; set; } | |||||
/// <summary> | |||||
/// 设备停止 | |||||
/// </summary> | |||||
public bool DeviceStop { get; set; } | |||||
/// <summary> | |||||
/// 设备急停 | |||||
/// </summary> | |||||
public bool DeviceEStop { get; set; } | |||||
/// <summary> | |||||
/// 设备暂停 | |||||
/// </summary> | |||||
public bool DevicePause { get; set; } | |||||
/// <summary> | |||||
/// 设备故障 | |||||
/// </summary> | |||||
public bool DeviceAlarm { get; set; } | |||||
/// <summary> | |||||
/// 上位机给plc的心跳 | |||||
/// </summary> | |||||
public bool HeartBeat { get; set; } | |||||
/// <summary> | |||||
/// 设备模式 | |||||
/// </summary> | |||||
public short DeviceMode { get; set; } | |||||
/// <summary> | |||||
/// 设备报警 | |||||
/// </summary> | |||||
public bool[] AlarmInfo { get; set; } = new bool[24]; | |||||
public int Reserved1 { get; set; } | |||||
public int Reserved2 { get; set; } | |||||
} | |||||
} |
@@ -31,7 +31,6 @@ namespace BPASmartClient.JXJFoodBigStation.Model | |||||
/// 本地配方数据 | /// 本地配方数据 | ||||
/// </summary> | /// </summary> | ||||
public ObservableCollection<RecipeData> LocalRecipes = new ObservableCollection<RecipeData>(); | public ObservableCollection<RecipeData> LocalRecipes = new ObservableCollection<RecipeData>(); | ||||
/// <summary> | /// <summary> | ||||
/// 配方等待执行 | /// 配方等待执行 | ||||
/// </summary> | /// </summary> | ||||
@@ -108,8 +107,8 @@ namespace BPASmartClient.JXJFoodBigStation.Model | |||||
string Siemens_PLC_IP = ConfigurationManager.AppSettings["Siemens_IP"]; | string Siemens_PLC_IP = ConfigurationManager.AppSettings["Siemens_IP"]; | ||||
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); | |||||
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 (HKDevice.IsConnected) | ||||
{ | { | ||||
HKDevice.Init(); | HKDevice.Init(); | ||||
@@ -125,6 +124,91 @@ namespace BPASmartClient.JXJFoodBigStation.Model | |||||
{ | { | ||||
} | } | ||||
ThreadManage.GetInstance().StartLong(new Action(() => | |||||
{ | |||||
if (!HKDevice.IsConnected) | |||||
{ | |||||
HKDevice.HK_PLC_S7.Connect(S7.Net.CpuType.S71500, HK_PLC_IP); | |||||
MessageNotify.GetInstance.ShowRunLog("海科plc重新连接成功"); | |||||
} | |||||
if (!SiemensDevice.IsConnected) | |||||
{ | |||||
SiemensDevice.Siemens_PLC_S7.Connect(S7.Net.CpuType.S71500, Siemens_PLC_IP); | |||||
MessageNotify.GetInstance.ShowRunLog("西门子plc重新连接"); | |||||
} | |||||
GVL_BigStation.HeartBeatToPlc = !GVL_BigStation.HeartBeatToPlc; | |||||
HKDevice.HK_PLC_S7.Write("DB99.DBX0.0", GVL_BigStation.HeartBeatToPlc); | |||||
GVL_BigStation.HeartBeatFromPlc = HKDevice.PlcRead.HeartBeat;//读取plc心跳 | |||||
if (HKDevice.IsConnected) | |||||
{ | |||||
if (GVL_BigStation.AGVPutTray.GetBitValue(1)) | |||||
{ | |||||
HKDevice.HK_PLC_S7.Write("DB99.DBX0.7", true); | |||||
} | |||||
else | |||||
{ | |||||
HKDevice.HK_PLC_S7.Write("DB99.DBX0.7", false); | |||||
} | |||||
if (GVL_BigStation.AGVPutTray.GetBitValue(2)) | |||||
{ | |||||
HKDevice.HK_PLC_S7.Write("DB99.DBX1.0", true); | |||||
} | |||||
else | |||||
{ | |||||
HKDevice.HK_PLC_S7.Write("DB99.DBX1.0", false); | |||||
} | |||||
if (GVL_BigStation.AGVPutTray.GetBitValue(3)) | |||||
{ | |||||
HKDevice.HK_PLC_S7.Write("DB99.DBX1.1", true); | |||||
} | |||||
else | |||||
{ | |||||
HKDevice.HK_PLC_S7.Write("DB99.DBX1.1", false); | |||||
} | |||||
if (GVL_BigStation.AGVPutTray.GetBitValue(4)) | |||||
{ | |||||
HKDevice.HK_PLC_S7.Write("DB99.DBX1.2", true); | |||||
} | |||||
else | |||||
{ | |||||
HKDevice.HK_PLC_S7.Write("DB99.DBX1.2", false); | |||||
} | |||||
if (GVL_BigStation.AGVPutTray.GetBitValue(5)) | |||||
{ | |||||
HKDevice.HK_PLC_S7.Write("DB99.DBX1.3", true); | |||||
} | |||||
else | |||||
{ | |||||
HKDevice.HK_PLC_S7.Write("DB99.DBX1.3", false); | |||||
} | |||||
GVL_BigStation.TraySensor = GVL_BigStation.TraySensor.SetBitValue(1, HKDevice.PlcRead.Tray1Sensor); | |||||
GVL_BigStation.TraySensor = GVL_BigStation.TraySensor.SetBitValue(2, HKDevice.PlcRead.Tray2Sensor); | |||||
GVL_BigStation.TraySensor = GVL_BigStation.TraySensor.SetBitValue(3, HKDevice.PlcRead.Tray3Sensor); | |||||
GVL_BigStation.TraySensor = GVL_BigStation.TraySensor.SetBitValue(4, HKDevice.PlcRead.Tray4Sensor); | |||||
GVL_BigStation.TraySensor = GVL_BigStation.TraySensor.SetBitValue(5, HKDevice.PlcRead.Tray5Sensor); | |||||
GVL_BigStation.TrayCylinder = GVL_BigStation.TrayCylinder.SetBitValue(1, !HKDevice.PlcRead.Tray1Cylinder); | |||||
GVL_BigStation.TrayCylinder = GVL_BigStation.TrayCylinder.SetBitValue(2, !HKDevice.PlcRead.Tray2Cylinder); | |||||
GVL_BigStation.TrayCylinder = GVL_BigStation.TrayCylinder.SetBitValue(3, !HKDevice.PlcRead.Tray3Cylinder); | |||||
GVL_BigStation.TrayCylinder = GVL_BigStation.TrayCylinder.SetBitValue(4, !HKDevice.PlcRead.Tray4Cylinder); | |||||
GVL_BigStation.TrayCylinder = GVL_BigStation.TrayCylinder.SetBitValue(5, !HKDevice.PlcRead.Tray5Cylinder); | |||||
if (HKDevice.PlcRead.IsAllowIssueRecipe1 || HKDevice.PlcRead.IsAllowIssueRecipe2 || HKDevice.PlcRead.IsAllowIssueRecipe3 || HKDevice.PlcRead.IsAllowIssueRecipe4) | |||||
{ | |||||
GVL_BigStation.Order_Request = true; | |||||
} | |||||
} | |||||
if (SiemensDevice.IsConnected) | |||||
{ | |||||
GVL_BigStation.AGVPutTray = SiemensDevice.DL_Status.AGV_Put_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.DBW32", GVL_BigStation.TrayCylinder); | |||||
SiemensDevice.Siemens_PLC_S7.Write("DB2331.DBW34", (ushort)15); | |||||
} | |||||
Thread.Sleep(10); | |||||
}),"设备连接",true); | |||||
LocalRecipeQueue1.Clear(); | LocalRecipeQueue1.Clear(); | ||||
LocalRecipeQueue2.Clear(); | LocalRecipeQueue2.Clear(); | ||||
LocalRecipeQueue3.Clear(); | LocalRecipeQueue3.Clear(); | ||||
@@ -134,20 +218,19 @@ namespace BPASmartClient.JXJFoodBigStation.Model | |||||
SiemensRecipeQueue3.Clear(); | SiemensRecipeQueue3.Clear(); | ||||
SiemensRecipeQueue4.Clear(); | SiemensRecipeQueue4.Clear(); | ||||
ThreadManage.GetInstance().StartLong(new Action(() => | ThreadManage.GetInstance().StartLong(new Action(() => | ||||
{ | |||||
ReceviceData(); | |||||
RecipeInfoToHKPLC(); | |||||
Thread.Sleep(10); | |||||
}), "西门子配方执行流程", true); | |||||
ThreadManage.GetInstance().StartLong(new Action(() => | |||||
{ | { | ||||
if (GVL_BigStation.IsUseLocalRecipe) | if (GVL_BigStation.IsUseLocalRecipe) | ||||
{ | { | ||||
LocalRecipeRecevice(); | LocalRecipeRecevice(); | ||||
LocalRecipeDosing(); | LocalRecipeDosing(); | ||||
} | } | ||||
else | |||||
{ | |||||
ReceviceData(); | |||||
RecipeInfoToHKPLC(); | |||||
} | |||||
Thread.Sleep(10); | Thread.Sleep(10); | ||||
}), "本地配方执行流程", true); | |||||
}), "西门子配方执行流程", true); | |||||
} | } | ||||
private void LocalRecipeRecevice() | private void LocalRecipeRecevice() | ||||
{ | { | ||||
@@ -202,27 +285,72 @@ namespace BPASmartClient.JXJFoodBigStation.Model | |||||
if (LocalRecipeQueue1.Count > 0) | if (LocalRecipeQueue1.Count > 0) | ||||
{ | { | ||||
int index = Array.FindIndex(LocalRecipes.ToArray(), p => p.RecipeCode == LocalRecipeQueue1.ElementAt(0)); | int index = Array.FindIndex(LocalRecipes.ToArray(), p => p.RecipeCode == LocalRecipeQueue1.ElementAt(0)); | ||||
foreach (var item in LocalRecipes.ElementAt(0).RawMaterial) | |||||
{ | |||||
item.RawMaterialLocation = (int)RawMaterialsNamePos[item.RawMaterialName]; | |||||
} | |||||
if (index >= 0 && index < LocalRecipes.Count) | if (index >= 0 && index < LocalRecipes.Count) | ||||
{ | { | ||||
string code = LocalRecipes.ElementAt(index).RecipeCode; | string code = LocalRecipes.ElementAt(index).RecipeCode; | ||||
int trayCode = LocalRecipes.ElementAt(index).TrayCode; | int trayCode = LocalRecipes.ElementAt(index).TrayCode; | ||||
if (HKDevice.PlcRead.IsAllowIssueRecipe1 && GVL_BigStation.Recipe1DosingStatus == 0)//配方1是否允许下发配发 | |||||
bool Inplace = false; | |||||
switch (trayCode) | |||||
{ | |||||
case 1: | |||||
Inplace = HKDevice.PlcRead.Tray1InPlace; | |||||
break; | |||||
case 2: | |||||
Inplace = HKDevice.PlcRead.Tray2InPlace; | |||||
break; | |||||
case 3: | |||||
Inplace = HKDevice.PlcRead.Tray3InPlace; | |||||
break; | |||||
case 4: | |||||
Inplace = HKDevice.PlcRead.Tray4InPlace; | |||||
break; | |||||
case 5: | |||||
Inplace = HKDevice.PlcRead.Tray5InPlace; | |||||
break; | |||||
default: | |||||
break; | |||||
} | |||||
if (HKDevice.PlcRead.IsAllowIssueRecipe1 && GVL_BigStation.Recipe1DosingStatus == 0 && Inplace)//配方1是否允许下发配发 | |||||
{ | { | ||||
HKDevice.StockBinPar(LocalRecipes.ElementAt(index)); | HKDevice.StockBinPar(LocalRecipes.ElementAt(index)); | ||||
HKDevice.PlcWrite.Recipe1IssuedFinish = 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; | GVL_BigStation.Recipe1DosingStatus = 2; | ||||
HKDevice.PlcWrite.Recipe1IssuedFinish = false; | |||||
HKDevice.HK_PLC_S7.Write("DB99.DBX0.3", false); | |||||
StockBinParReset(); | StockBinParReset(); | ||||
MessageNotify.GetInstance.ShowRunLog($"配方编号:{code},托盘编号:{trayCode},PLC接收配方完成"); | MessageNotify.GetInstance.ShowRunLog($"配方编号:{code},托盘编号:{trayCode},PLC接收配方完成"); | ||||
} | } | ||||
if (GVL_BigStation.Recipe1DosingStatus == 2 && HKDevice.PlcRead.Recipe1DosingFinish) | if (GVL_BigStation.Recipe1DosingStatus == 2 && HKDevice.PlcRead.Recipe1DosingFinish) | ||||
{ | { | ||||
GVL_BigStation.Recipe1DosingStatus = 3; | |||||
GVL_BigStation.Recipe1DosingStatus = 3; | |||||
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; | |||||
} | |||||
MessageNotify.GetInstance.ShowRunLog($"配方状态:{code}配料完成"); | MessageNotify.GetInstance.ShowRunLog($"配方状态:{code}配料完成"); | ||||
if (HKDevice.PlcRead.Recipe1TrayCode == 1) | if (HKDevice.PlcRead.Recipe1TrayCode == 1) | ||||
{ | { | ||||
@@ -303,17 +431,38 @@ namespace BPASmartClient.JXJFoodBigStation.Model | |||||
{ | { | ||||
string code = LocalRecipes.ElementAt(index).RecipeCode; | string code = LocalRecipes.ElementAt(index).RecipeCode; | ||||
int trayCode = LocalRecipes.ElementAt(index).TrayCode; | int trayCode = LocalRecipes.ElementAt(index).TrayCode; | ||||
if (HKDevice.PlcRead.IsAllowIssueRecipe2 && GVL_BigStation.Recipe2DosingStatus == 0)//配方2是否允许下发配发 | |||||
bool Inplace = false; | |||||
switch (trayCode) | |||||
{ | |||||
case 1: | |||||
Inplace = HKDevice.PlcRead.Tray1InPlace; | |||||
break; | |||||
case 2: | |||||
Inplace = HKDevice.PlcRead.Tray2InPlace; | |||||
break; | |||||
case 3: | |||||
Inplace = HKDevice.PlcRead.Tray3InPlace; | |||||
break; | |||||
case 4: | |||||
Inplace = HKDevice.PlcRead.Tray4InPlace; | |||||
break; | |||||
case 5: | |||||
Inplace = HKDevice.PlcRead.Tray5InPlace; | |||||
break; | |||||
default: | |||||
break; | |||||
} | |||||
if (HKDevice.PlcRead.IsAllowIssueRecipe2 && GVL_BigStation.Recipe2DosingStatus == 0 &&Inplace)//配方2是否允许下发配发 | |||||
{ | { | ||||
HKDevice.StockBinPar(LocalRecipes.ElementAt(index)); | HKDevice.StockBinPar(LocalRecipes.ElementAt(index)); | ||||
HKDevice.PlcWrite.Recipe2IssuedFinish = 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}下发完成"); | ||||
} | } | ||||
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.PlcWrite.Recipe2IssuedFinish = false; | |||||
HKDevice.HK_PLC_S7.Write("DB99.DBX0.4", false); | |||||
StockBinParReset(); | StockBinParReset(); | ||||
MessageNotify.GetInstance.ShowRunLog($"配方状态:{code}配方配料"); | MessageNotify.GetInstance.ShowRunLog($"配方状态:{code}配方配料"); | ||||
} | } | ||||
@@ -400,16 +549,43 @@ namespace BPASmartClient.JXJFoodBigStation.Model | |||||
{ | { | ||||
string code = LocalRecipes.ElementAt(index).RecipeCode; | string code = LocalRecipes.ElementAt(index).RecipeCode; | ||||
int trayCode = LocalRecipes.ElementAt(index).TrayCode; | int trayCode = LocalRecipes.ElementAt(index).TrayCode; | ||||
if (HKDevice.PlcRead.IsAllowIssueRecipe3 && GVL_BigStation.Recipe3DosingStatus == 0)//配方3是否允许下发配发 | |||||
bool Inplace = false; | |||||
switch (trayCode) | |||||
{ | |||||
case 1: | |||||
Inplace = HKDevice.PlcRead.Tray1InPlace; | |||||
HKDevice.HK_PLC_S7.Write("DB99.DBX0.7", GVL_BigStation.AGVPutTray.GetBitValue(1)); | |||||
break; | |||||
case 2: | |||||
Inplace = HKDevice.PlcRead.Tray2InPlace; | |||||
HKDevice.HK_PLC_S7.Write("DB99.DBX1.0", GVL_BigStation.AGVPutTray.GetBitValue(2)); | |||||
break; | |||||
case 3: | |||||
Inplace = HKDevice.PlcRead.Tray3InPlace; | |||||
HKDevice.HK_PLC_S7.Write("DB99.DBX1.1", GVL_BigStation.AGVPutTray.GetBitValue(3)); | |||||
break; | |||||
case 4: | |||||
Inplace = HKDevice.PlcRead.Tray4InPlace; | |||||
HKDevice.HK_PLC_S7.Write("DB99.DBX1.2", GVL_BigStation.AGVPutTray.GetBitValue(4)); | |||||
break; | |||||
case 5: | |||||
Inplace = HKDevice.PlcRead.Tray5InPlace; | |||||
HKDevice.HK_PLC_S7.Write("DB99.DBX1.3", GVL_BigStation.AGVPutTray.GetBitValue(5)); | |||||
break; | |||||
default: | |||||
break; | |||||
} | |||||
if (HKDevice.PlcRead.IsAllowIssueRecipe3 && GVL_BigStation.Recipe3DosingStatus == 0 && Inplace)//配方3是否允许下发配发 | |||||
{ | { | ||||
HKDevice.StockBinPar(LocalRecipes.ElementAt(index)); | HKDevice.StockBinPar(LocalRecipes.ElementAt(index)); | ||||
HKDevice.PlcWrite.Recipe3IssuedFinish = 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}下发完成"); | ||||
} | } | ||||
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); | |||||
StockBinParReset(); | StockBinParReset(); | ||||
MessageNotify.GetInstance.ShowRunLog($"配方状态:{code}配方配料"); | MessageNotify.GetInstance.ShowRunLog($"配方状态:{code}配方配料"); | ||||
} | } | ||||
@@ -497,17 +673,43 @@ namespace BPASmartClient.JXJFoodBigStation.Model | |||||
{ | { | ||||
string code = LocalRecipes.ElementAt(index).RecipeCode; | string code = LocalRecipes.ElementAt(index).RecipeCode; | ||||
int trayCode = LocalRecipes.ElementAt(index).TrayCode; | int trayCode = LocalRecipes.ElementAt(index).TrayCode; | ||||
if (HKDevice.PlcRead.IsAllowIssueRecipe4 && GVL_BigStation.Recipe4DosingStatus == 0)//配方4是否允许下发配发 | |||||
bool Inplace = false; | |||||
switch (trayCode) | |||||
{ | { | ||||
HKDevice.StockBinPar(LocalRecipes.ElementAt(index)); | |||||
HKDevice.PlcWrite.Recipe4IssuedFinish = true; | |||||
case 1: | |||||
Inplace = HKDevice.PlcRead.Tray1InPlace; | |||||
HKDevice.HK_PLC_S7.Write("DB99.DBX0.7", GVL_BigStation.AGVPutTray.GetBitValue(1)); | |||||
break; | |||||
case 2: | |||||
Inplace = HKDevice.PlcRead.Tray2InPlace; | |||||
HKDevice.HK_PLC_S7.Write("DB99.DBX1.0", GVL_BigStation.AGVPutTray.GetBitValue(2)); | |||||
break; | |||||
case 3: | |||||
Inplace = HKDevice.PlcRead.Tray3InPlace; | |||||
HKDevice.HK_PLC_S7.Write("DB99.DBX1.1", GVL_BigStation.AGVPutTray.GetBitValue(3)); | |||||
break; | |||||
case 4: | |||||
Inplace = HKDevice.PlcRead.Tray4InPlace; | |||||
HKDevice.HK_PLC_S7.Write("DB99.DBX1.2", GVL_BigStation.AGVPutTray.GetBitValue(4)); | |||||
break; | |||||
case 5: | |||||
Inplace = HKDevice.PlcRead.Tray5InPlace; | |||||
HKDevice.HK_PLC_S7.Write("DB99.DBX1.3", GVL_BigStation.AGVPutTray.GetBitValue(5)); | |||||
break; | |||||
default: | |||||
break; | |||||
} | |||||
if (HKDevice.PlcRead.IsAllowIssueRecipe4 && GVL_BigStation.Recipe4DosingStatus == 0 && Inplace)//配方4是否允许下发配发 | |||||
{ | |||||
HKDevice.StockBinPar(LocalRecipes.ElementAt(index)); | |||||
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}下发完成"); | ||||
} | } | ||||
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.PlcWrite.Recipe4IssuedFinish = false; | |||||
HKDevice.HK_PLC_S7.Write("DB99.DBX0.6", false); | |||||
StockBinParReset(); | StockBinParReset(); | ||||
MessageNotify.GetInstance.ShowRunLog($"配方状态:{code}配方配料"); | MessageNotify.GetInstance.ShowRunLog($"配方状态:{code}配方配料"); | ||||
} | } | ||||
@@ -747,17 +949,43 @@ namespace BPASmartClient.JXJFoodBigStation.Model | |||||
{ | { | ||||
string code = SiemensRecipes.ElementAt(index).RecipeCode; | string code = SiemensRecipes.ElementAt(index).RecipeCode; | ||||
int trayCode = SiemensRecipes.ElementAt(index).TrayCode; | int trayCode = SiemensRecipes.ElementAt(index).TrayCode; | ||||
if (HKDevice.PlcRead.IsAllowIssueRecipe1 && GVL_BigStation.Recipe1DosingStatus == 0)//配方1是否允许下发配发 | |||||
bool Inplace = false; | |||||
switch (trayCode) | |||||
{ | |||||
case 1: | |||||
Inplace = HKDevice.PlcRead.Tray1InPlace; | |||||
HKDevice.HK_PLC_S7.Write("DB99.DBX0.7", GVL_BigStation.AGVPutTray.GetBitValue(1)); | |||||
break; | |||||
case 2: | |||||
Inplace = HKDevice.PlcRead.Tray2InPlace; | |||||
HKDevice.HK_PLC_S7.Write("DB99.DBX1.0", GVL_BigStation.AGVPutTray.GetBitValue(2)); | |||||
break; | |||||
case 3: | |||||
Inplace = HKDevice.PlcRead.Tray3InPlace; | |||||
HKDevice.HK_PLC_S7.Write("DB99.DBX1.1", GVL_BigStation.AGVPutTray.GetBitValue(3)); | |||||
break; | |||||
case 4: | |||||
Inplace = HKDevice.PlcRead.Tray4InPlace; | |||||
HKDevice.HK_PLC_S7.Write("DB99.DBX1.2", GVL_BigStation.AGVPutTray.GetBitValue(4)); | |||||
break; | |||||
case 5: | |||||
Inplace = HKDevice.PlcRead.Tray5InPlace; | |||||
HKDevice.HK_PLC_S7.Write("DB99.DBX1.3", GVL_BigStation.AGVPutTray.GetBitValue(5)); | |||||
break; | |||||
default: | |||||
break; | |||||
} | |||||
if (HKDevice.PlcRead.IsAllowIssueRecipe1 && GVL_BigStation.Recipe1DosingStatus == 0&&Inplace)//配方1是否允许下发配发 | |||||
{ | { | ||||
HKDevice.StockBinPar(SiemensRecipes.ElementAt(index)); | HKDevice.StockBinPar(SiemensRecipes.ElementAt(index)); | ||||
HKDevice.PlcWrite.Recipe1IssuedFinish = 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; | GVL_BigStation.Recipe1DosingStatus = 2; | ||||
HKDevice.PlcWrite.Recipe1IssuedFinish = false; | |||||
HKDevice.HK_PLC_S7.Write("DB99.DBX0.3", false); | |||||
StockBinParReset(); | StockBinParReset(); | ||||
MessageNotify.GetInstance.ShowRunLog($"配方编号:{code},托盘编号:{trayCode},PLC接收配方完成"); | MessageNotify.GetInstance.ShowRunLog($"配方编号:{code},托盘编号:{trayCode},PLC接收配方完成"); | ||||
} | } | ||||
@@ -871,17 +1099,43 @@ namespace BPASmartClient.JXJFoodBigStation.Model | |||||
{ | { | ||||
string code = SiemensRecipes.ElementAt(index).RecipeCode; | string code = SiemensRecipes.ElementAt(index).RecipeCode; | ||||
int trayCode = SiemensRecipes.ElementAt(index).TrayCode; | int trayCode = SiemensRecipes.ElementAt(index).TrayCode; | ||||
if (HKDevice.PlcRead.IsAllowIssueRecipe2 && GVL_BigStation.Recipe2DosingStatus == 0)//配方2是否允许下发配发 | |||||
bool Inplace = false; | |||||
switch (trayCode) | |||||
{ | { | ||||
HKDevice.StockBinPar(SiemensRecipes.ElementAt(index)); | |||||
HKDevice.PlcWrite.Recipe2IssuedFinish = true; | |||||
case 1: | |||||
Inplace = HKDevice.PlcRead.Tray1InPlace; | |||||
HKDevice.HK_PLC_S7.Write("DB99.DBX0.7", GVL_BigStation.AGVPutTray.GetBitValue(1)); | |||||
break; | |||||
case 2: | |||||
Inplace = HKDevice.PlcRead.Tray2InPlace; | |||||
HKDevice.HK_PLC_S7.Write("DB99.DBX1.0", GVL_BigStation.AGVPutTray.GetBitValue(2)); | |||||
break; | |||||
case 3: | |||||
Inplace = HKDevice.PlcRead.Tray3InPlace; | |||||
HKDevice.HK_PLC_S7.Write("DB99.DBX1.1", GVL_BigStation.AGVPutTray.GetBitValue(3)); | |||||
break; | |||||
case 4: | |||||
Inplace = HKDevice.PlcRead.Tray4InPlace; | |||||
HKDevice.HK_PLC_S7.Write("DB99.DBX1.2", GVL_BigStation.AGVPutTray.GetBitValue(4)); | |||||
break; | |||||
case 5: | |||||
Inplace = HKDevice.PlcRead.Tray5InPlace; | |||||
HKDevice.HK_PLC_S7.Write("DB99.DBX1.3", GVL_BigStation.AGVPutTray.GetBitValue(5)); | |||||
break; | |||||
default: | |||||
break; | |||||
} | |||||
if (HKDevice.PlcRead.IsAllowIssueRecipe2 && GVL_BigStation.Recipe2DosingStatus == 0 &&Inplace)//配方2是否允许下发配发 | |||||
{ | |||||
HKDevice.StockBinPar(SiemensRecipes.ElementAt(index)); | |||||
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}下发完成"); | ||||
} | } | ||||
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.PlcWrite.Recipe2IssuedFinish = false; | |||||
HKDevice.HK_PLC_S7.Write("DB99.DBX0.4", false); | |||||
StockBinParReset(); | StockBinParReset(); | ||||
MessageNotify.GetInstance.ShowRunLog($"配方状态:{code}配方配料"); | MessageNotify.GetInstance.ShowRunLog($"配方状态:{code}配方配料"); | ||||
} | } | ||||
@@ -989,16 +1243,44 @@ namespace BPASmartClient.JXJFoodBigStation.Model | |||||
{ | { | ||||
string code = SiemensRecipes.ElementAt(index).RecipeCode; | string code = SiemensRecipes.ElementAt(index).RecipeCode; | ||||
int trayCode = SiemensRecipes.ElementAt(index).TrayCode; | int trayCode = SiemensRecipes.ElementAt(index).TrayCode; | ||||
if (HKDevice.PlcRead.IsAllowIssueRecipe3 && GVL_BigStation.Recipe3DosingStatus == 0)//配方3是否允许下发配发 | |||||
bool Inplace = false; | |||||
switch (trayCode) | |||||
{ | |||||
case 1: | |||||
Inplace = HKDevice.PlcRead.Tray1InPlace; | |||||
HKDevice.HK_PLC_S7.Write("DB99.DBX0.7", GVL_BigStation.AGVPutTray.GetBitValue(1)); | |||||
break; | |||||
case 2: | |||||
Inplace = HKDevice.PlcRead.Tray2InPlace; | |||||
HKDevice.HK_PLC_S7.Write("DB99.DBX1.0", GVL_BigStation.AGVPutTray.GetBitValue(2)); | |||||
break; | |||||
case 3: | |||||
Inplace = HKDevice.PlcRead.Tray3InPlace; | |||||
HKDevice.HK_PLC_S7.Write("DB99.DBX1.1", GVL_BigStation.AGVPutTray.GetBitValue(3)); | |||||
break; | |||||
case 4: | |||||
Inplace = HKDevice.PlcRead.Tray4InPlace; | |||||
HKDevice.HK_PLC_S7.Write("DB99.DBX1.2", GVL_BigStation.AGVPutTray.GetBitValue(4)); | |||||
break; | |||||
case 5: | |||||
Inplace = HKDevice.PlcRead.Tray5InPlace; | |||||
HKDevice.HK_PLC_S7.Write("DB99.DBX1.3", GVL_BigStation.AGVPutTray.GetBitValue(5)); | |||||
break; | |||||
default: | |||||
break; | |||||
} | |||||
if (HKDevice.PlcRead.IsAllowIssueRecipe3 && GVL_BigStation.Recipe3DosingStatus == 0 && Inplace)//配方3是否允许下发配发 | |||||
{ | { | ||||
HKDevice.StockBinPar(SiemensRecipes.ElementAt(index)); | HKDevice.StockBinPar(SiemensRecipes.ElementAt(index)); | ||||
HKDevice.PlcWrite.Recipe3IssuedFinish = 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}下发完成"); | ||||
} | } | ||||
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); | |||||
StockBinParReset(); | StockBinParReset(); | ||||
MessageNotify.GetInstance.ShowRunLog($"配方状态:{code}配方配料"); | MessageNotify.GetInstance.ShowRunLog($"配方状态:{code}配方配料"); | ||||
} | } | ||||
@@ -1106,17 +1388,43 @@ namespace BPASmartClient.JXJFoodBigStation.Model | |||||
{ | { | ||||
string code = SiemensRecipes.ElementAt(index).RecipeCode; | string code = SiemensRecipes.ElementAt(index).RecipeCode; | ||||
int trayCode = SiemensRecipes.ElementAt(index).TrayCode; | int trayCode = SiemensRecipes.ElementAt(index).TrayCode; | ||||
if (HKDevice.PlcRead.IsAllowIssueRecipe4 && GVL_BigStation.Recipe4DosingStatus == 0)//配方4是否允许下发配发 | |||||
bool Inplace = false; | |||||
switch (trayCode) | |||||
{ | |||||
case 1: | |||||
Inplace = HKDevice.PlcRead.Tray1InPlace; | |||||
HKDevice.HK_PLC_S7.Write("DB99.DBX0.7", GVL_BigStation.AGVPutTray.GetBitValue(1)); | |||||
break; | |||||
case 2: | |||||
Inplace = HKDevice.PlcRead.Tray2InPlace; | |||||
HKDevice.HK_PLC_S7.Write("DB99.DBX1.0", GVL_BigStation.AGVPutTray.GetBitValue(2)); | |||||
break; | |||||
case 3: | |||||
Inplace = HKDevice.PlcRead.Tray3InPlace; | |||||
HKDevice.HK_PLC_S7.Write("DB99.DBX1.1", GVL_BigStation.AGVPutTray.GetBitValue(3)); | |||||
break; | |||||
case 4: | |||||
Inplace = HKDevice.PlcRead.Tray4InPlace; | |||||
HKDevice.HK_PLC_S7.Write("DB99.DBX1.2", GVL_BigStation.AGVPutTray.GetBitValue(4)); | |||||
break; | |||||
case 5: | |||||
Inplace = HKDevice.PlcRead.Tray5InPlace; | |||||
HKDevice.HK_PLC_S7.Write("DB99.DBX1.3", GVL_BigStation.AGVPutTray.GetBitValue(5)); | |||||
break; | |||||
default: | |||||
break; | |||||
} | |||||
if (HKDevice.PlcRead.IsAllowIssueRecipe4 && GVL_BigStation.Recipe4DosingStatus == 0 &&Inplace)//配方4是否允许下发配发 | |||||
{ | { | ||||
HKDevice.StockBinPar(SiemensRecipes.ElementAt(index)); | HKDevice.StockBinPar(SiemensRecipes.ElementAt(index)); | ||||
HKDevice.PlcWrite.Recipe4IssuedFinish = 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}下发完成"); | ||||
} | } | ||||
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.PlcWrite.Recipe4IssuedFinish = false; | |||||
HKDevice.HK_PLC_S7.Write("DB99.DBX0.6", false); | |||||
StockBinParReset(); | StockBinParReset(); | ||||
MessageNotify.GetInstance.ShowRunLog($"配方状态:{code}配方配料"); | MessageNotify.GetInstance.ShowRunLog($"配方状态:{code}配方配料"); | ||||
} | } | ||||
@@ -1223,73 +1531,47 @@ namespace BPASmartClient.JXJFoodBigStation.Model | |||||
/// </summary> | /// </summary> | ||||
private void StockBinParReset() | private void StockBinParReset() | ||||
{ | { | ||||
HKDevice.PlcWrite.RecipeCode = 0; | |||||
HKDevice.PlcWrite.TrayCode = 0; | |||||
HKDevice.PlcWrite.Bareel1Bin1SetWeight = 0; | |||||
HKDevice.PlcWrite.Bareel1Bin2SetWeight = 0; | |||||
HKDevice.PlcWrite.Bareel1Bin3SetWeight = 0; | |||||
HKDevice.PlcWrite.Bareel1Bin4SetWeight = 0; | |||||
HKDevice.PlcWrite.Bareel1Bin5SetWeight = 0; | |||||
HKDevice.PlcWrite.Bareel1Bin6SetWeight = 0; | |||||
HKDevice.PlcWrite.Bareel1Bin7SetWeight = 0; | |||||
HKDevice.PlcWrite.Bareel1Bin8SetWeight = 0; | |||||
HKDevice.PlcWrite.Bareel1Bin9SetWeight = 0; | |||||
HKDevice.PlcWrite.Bareel1Bin10SetWeight = 0; | |||||
HKDevice.PlcWrite.Bareel1Bin11SetWeight = 0; | |||||
HKDevice.PlcWrite.Bareel1Bin12SetWeight = 0; | |||||
HKDevice.PlcWrite.Bareel1Bin13SetWeight = 0; | |||||
HKDevice.PlcWrite.Bareel1Bin14SetWeight = 0; | |||||
HKDevice.PlcWrite.Bareel2Bin1SetWeight = 0; | |||||
HKDevice.PlcWrite.Bareel2Bin2SetWeight = 0; | |||||
HKDevice.PlcWrite.Bareel2Bin3SetWeight = 0; | |||||
HKDevice.PlcWrite.Bareel2Bin4SetWeight = 0; | |||||
HKDevice.PlcWrite.Bareel2Bin5SetWeight = 0; | |||||
HKDevice.PlcWrite.Bareel2Bin6SetWeight = 0; | |||||
HKDevice.PlcWrite.Bareel2Bin7SetWeight = 0; | |||||
HKDevice.PlcWrite.Bareel2Bin8SetWeight = 0; | |||||
HKDevice.PlcWrite.Bareel2Bin9SetWeight = 0; | |||||
HKDevice.PlcWrite.Bareel2Bin10SetWeight = 0; | |||||
HKDevice.PlcWrite.Bareel2Bin11SetWeight = 0; | |||||
HKDevice.PlcWrite.Bareel2Bin12SetWeight = 0; | |||||
HKDevice.PlcWrite.Bareel2Bin13SetWeight = 0; | |||||
HKDevice.PlcWrite.Bareel2Bin14SetWeight = 0; | |||||
HKDevice.PlcWrite.Bareel4Bin1SetWeight = 0; | |||||
HKDevice.PlcWrite.Bareel4Bin2SetWeight = 0; | |||||
HKDevice.PlcWrite.Bareel4Bin3SetWeight = 0; | |||||
HKDevice.PlcWrite.Bareel4Bin4SetWeight = 0; | |||||
HKDevice.PlcWrite.Bareel4Bin5SetWeight = 0; | |||||
HKDevice.PlcWrite.Bareel4Bin6SetWeight = 0; | |||||
HKDevice.PlcWrite.Bareel4Bin7SetWeight = 0; | |||||
HKDevice.PlcWrite.Bareel4Bin8SetWeight = 0; | |||||
HKDevice.PlcWrite.Bareel4Bin9SetWeight = 0; | |||||
HKDevice.PlcWrite.Bareel4Bin10SetWeight = 0; | |||||
HKDevice.PlcWrite.Bareel4Bin11SetWeight = 0; | |||||
HKDevice.PlcWrite.Bareel4Bin12SetWeight = 0; | |||||
HKDevice.PlcWrite.Bareel4Bin13SetWeight = 0; | |||||
HKDevice.PlcWrite.Bareel4Bin14SetWeight = 0; | |||||
HKDevice.PlcWrite.Bareel5Bin1SetWeight = 0; | |||||
HKDevice.PlcWrite.Bareel5Bin2SetWeight = 0; | |||||
HKDevice.PlcWrite.Bareel5Bin3SetWeight = 0; | |||||
HKDevice.PlcWrite.Bareel5Bin4SetWeight = 0; | |||||
HKDevice.PlcWrite.Bareel5Bin5SetWeight = 0; | |||||
HKDevice.PlcWrite.Bareel5Bin6SetWeight = 0; | |||||
HKDevice.PlcWrite.Bareel5Bin7SetWeight = 0; | |||||
HKDevice.PlcWrite.Bareel5Bin8SetWeight = 0; | |||||
HKDevice.PlcWrite.Bareel5Bin9SetWeight = 0; | |||||
HKDevice.PlcWrite.Bareel5Bin10SetWeight = 0; | |||||
HKDevice.PlcWrite.Bareel5Bin11SetWeight = 0; | |||||
HKDevice.PlcWrite.Bareel5Bin12SetWeight = 0; | |||||
HKDevice.PlcWrite.Bareel5Bin13SetWeight = 0; | |||||
HKDevice.PlcWrite.Bareel5Bin14SetWeight = 0; | |||||
HKDevice.HK_PLC_S7.Write("DB99.DBW2.0", 0);// | |||||
HKDevice.HK_PLC_S7.Write("DB99.DBW4.0", 0); | |||||
for (int i = 0; i < 56; i++) | |||||
{ | |||||
string address2 = "DB99.DBD" + (6 + 4 * i); | |||||
HKDevice.HK_PLC_S7.Write(address2, 0); | |||||
} | |||||
} | } | ||||
private void testRawMaterialNameData() | private void testRawMaterialNameData() | ||||
{ | { | ||||
RawMaterialsNamePos.Clear(); | RawMaterialsNamePos.Clear(); | ||||
if (!HKDevice.IsConnected) | |||||
RawMaterialsNamePos.Add("0031", 1); | |||||
RawMaterialsNamePos.Add("0040", 2); | |||||
RawMaterialsNamePos.Add("0007", 3); | |||||
RawMaterialsNamePos.Add("0038", 4); | |||||
RawMaterialsNamePos.Add("0033", 5); | |||||
RawMaterialsNamePos.Add("0005", 6); | |||||
RawMaterialsNamePos.Add("0015", 7); | |||||
RawMaterialsNamePos.Add("0008", 8); | |||||
RawMaterialsNamePos.Add("0010", 9); | |||||
RawMaterialsNamePos.Add("0014", 10); | |||||
RawMaterialsNamePos.Add("0030", 11); | |||||
RawMaterialsNamePos.Add("0012", 12); | |||||
if (HKDevice.IsConnected) | |||||
{ | |||||
if ((!string.IsNullOrEmpty(HKDevice.StockBinName.RawMaterialName1)) && !RawMaterialsNamePos.ContainsKey(HKDevice.StockBinName.RawMaterialName1)) RawMaterialsNamePos.Add(HKDevice.StockBinName.RawMaterialName1, 1); | |||||
if ((!string.IsNullOrEmpty(HKDevice.StockBinName.RawMaterialName2)) && !RawMaterialsNamePos.ContainsKey(HKDevice.StockBinName.RawMaterialName2)) RawMaterialsNamePos.Add(HKDevice.StockBinName.RawMaterialName2, 2); | |||||
if ((!string.IsNullOrEmpty(HKDevice.StockBinName.RawMaterialName3)) && !RawMaterialsNamePos.ContainsKey(HKDevice.StockBinName.RawMaterialName3)) RawMaterialsNamePos.Add(HKDevice.StockBinName.RawMaterialName3, 3); | |||||
if ((!string.IsNullOrEmpty(HKDevice.StockBinName.RawMaterialName4)) && !RawMaterialsNamePos.ContainsKey(HKDevice.StockBinName.RawMaterialName4)) RawMaterialsNamePos.Add(HKDevice.StockBinName.RawMaterialName4, 4); | |||||
if ((!string.IsNullOrEmpty(HKDevice.StockBinName.RawMaterialName5)) && !RawMaterialsNamePos.ContainsKey(HKDevice.StockBinName.RawMaterialName5)) RawMaterialsNamePos.Add(HKDevice.StockBinName.RawMaterialName5, 5); | |||||
if ((!string.IsNullOrEmpty(HKDevice.StockBinName.RawMaterialName6)) && !RawMaterialsNamePos.ContainsKey(HKDevice.StockBinName.RawMaterialName6)) RawMaterialsNamePos.Add(HKDevice.StockBinName.RawMaterialName6, 6); | |||||
if ((!string.IsNullOrEmpty(HKDevice.StockBinName.RawMaterialName7)) && !RawMaterialsNamePos.ContainsKey(HKDevice.StockBinName.RawMaterialName7)) RawMaterialsNamePos.Add(HKDevice.StockBinName.RawMaterialName7, 7); | |||||
if ((!string.IsNullOrEmpty(HKDevice.StockBinName.RawMaterialName8)) && !RawMaterialsNamePos.ContainsKey(HKDevice.StockBinName.RawMaterialName8)) RawMaterialsNamePos.Add(HKDevice.StockBinName.RawMaterialName8, 8); | |||||
if ((!string.IsNullOrEmpty(HKDevice.StockBinName.RawMaterialName9)) && !RawMaterialsNamePos.ContainsKey(HKDevice.StockBinName.RawMaterialName9)) RawMaterialsNamePos.Add(HKDevice.StockBinName.RawMaterialName9, 9); | |||||
if ((!string.IsNullOrEmpty(HKDevice.StockBinName.RawMaterialName10)) && !RawMaterialsNamePos.ContainsKey(HKDevice.StockBinName.RawMaterialName10)) RawMaterialsNamePos.Add(HKDevice.StockBinName.RawMaterialName10, 10); | |||||
if ((!string.IsNullOrEmpty(HKDevice.StockBinName.RawMaterialName11)) && !RawMaterialsNamePos.ContainsKey(HKDevice.StockBinName.RawMaterialName11)) RawMaterialsNamePos.Add(HKDevice.StockBinName.RawMaterialName11, 11); | |||||
if ((!string.IsNullOrEmpty(HKDevice.StockBinName.RawMaterialName12)) && !RawMaterialsNamePos.ContainsKey(HKDevice.StockBinName.RawMaterialName12)) RawMaterialsNamePos.Add(HKDevice.StockBinName.RawMaterialName12, 12); | |||||
if ((!string.IsNullOrEmpty(HKDevice.StockBinName.RawMaterialName13)) && !RawMaterialsNamePos.ContainsKey(HKDevice.StockBinName.RawMaterialName13)) RawMaterialsNamePos.Add(HKDevice.StockBinName.RawMaterialName13, 13); | |||||
if ((!string.IsNullOrEmpty(HKDevice.StockBinName.RawMaterialName14)) && !RawMaterialsNamePos.ContainsKey(HKDevice.StockBinName.RawMaterialName14)) RawMaterialsNamePos.Add(HKDevice.StockBinName.RawMaterialName14, 14); | |||||
} | |||||
/*if (!HKDevice.IsConnected) | |||||
{ | { | ||||
RawMaterialsNamePos.Add("0005", 1); | RawMaterialsNamePos.Add("0005", 1); | ||||
RawMaterialsNamePos.Add("0006", 2); | RawMaterialsNamePos.Add("0006", 2); | ||||
@@ -1323,8 +1605,8 @@ namespace BPASmartClient.JXJFoodBigStation.Model | |||||
RawMaterialsNamePos.Add("0034", 14); | RawMaterialsNamePos.Add("0034", 14); | ||||
RawMaterialsNamePos.Add("0035", 14); | RawMaterialsNamePos.Add("0035", 14); | ||||
RawMaterialsNamePos.Add("0040", 14); | RawMaterialsNamePos.Add("0040", 14); | ||||
} | |||||
/* | |||||
}*/ | |||||
/* | |||||
HKDevice.StockBinName.RawMaterialName1 = "1"; | HKDevice.StockBinName.RawMaterialName1 = "1"; | ||||
HKDevice.StockBinName.RawMaterialName2 = "2"; | HKDevice.StockBinName.RawMaterialName2 = "2"; | ||||
HKDevice.StockBinName.RawMaterialName3 = "3"; | HKDevice.StockBinName.RawMaterialName3 = "3"; | ||||
@@ -10,9 +10,9 @@ namespace BPASmartClient.JXJFoodBigStation.Model.Siemens | |||||
public class DL_DataColl_DB | public class DL_DataColl_DB | ||||
{ | { | ||||
[Siemens(16)] | [Siemens(16)] | ||||
public string RecipeCode { get; set; } | |||||
public string RecipeCode { get; set; } = ""; | |||||
[Siemens(16)] | [Siemens(16)] | ||||
public string RecipeName { get; set; } | |||||
public string RecipeName { get; set; } = ""; | |||||
/// <summary> | /// <summary> | ||||
/// 缺料本机 | /// 缺料本机 | ||||
/// </summary> | /// </summary> | ||||
@@ -7,7 +7,7 @@ using System.Threading.Tasks; | |||||
namespace BPASmartClient.JXJFoodBigStation.Model.Siemens | namespace BPASmartClient.JXJFoodBigStation.Model.Siemens | ||||
{ | { | ||||
internal class DL_Finish_DB | |||||
public class DL_Finish_DB | |||||
{ | { | ||||
/// <summary> | /// <summary> | ||||
@@ -18,12 +18,12 @@ namespace BPASmartClient.JXJFoodBigStation.Model.Siemens | |||||
/// </summary> | /// </summary> | ||||
public bool AGV_Request_Put { get; set; } | public bool AGV_Request_Put { get; set; } | ||||
public bool AGV_Request_Get { get; set; } | public bool AGV_Request_Get { get; set; } | ||||
public short AGV_Put_Done { get; set; } | |||||
public ushort AGV_Put_Done { get; set; } | |||||
public short AGV_Get_Done { get; set; } | |||||
public ushort AGV_Get_Done { get; set; } | |||||
public short AGV_GetPut_Pos { get; set; } | |||||
public short[] Standby { get; set; } = new short[1]; | |||||
public ushort AGV_GetPut_Pos { get; set; } | |||||
public ushort[] Standby { get; set; } = new ushort[1]; | |||||
[Siemens(16)] | [Siemens(16)] | ||||
/// <summary> | /// <summary> | ||||
/// 生产工单 | /// 生产工单 | ||||
@@ -40,10 +40,10 @@ namespace BPASmartClient.JXJFoodBigStation.Model.Siemens | |||||
public bool Allow_Agv_Get_Empty { get; set; } | public bool Allow_Agv_Get_Empty { get; set; } | ||||
public short Pallet_Position_Occ { get; set; } | |||||
public ushort Pallet_Position_Occ { get; set; } | |||||
public short Dosing_Cancel9 { get; set; } | |||||
public ushort Dosing_Cancel9 { get; set; } | |||||
public short[] Standby2 { get; set; } = new short[3]; | |||||
public ushort[] Standby2 { get; set; } = new ushort[3]; | |||||
} | } | ||||
} | } |
@@ -19,14 +19,14 @@ namespace BPASmartClient.JXJFoodBigStation.Model.Siemens | |||||
bool a = false; | bool a = false; | ||||
public void Init() | public void Init() | ||||
{ | { | ||||
if (IsConnected) | |||||
ThreadManage.GetInstance().StartLong(new Action(() => | |||||
{ | { | ||||
ThreadManage.GetInstance().StartLong(new Action(() => | |||||
if (IsConnected) | |||||
{ | { | ||||
var res = this.Siemens_PLC_S7.ReadClass<DL_Start_DB>(2301); | var res = this.Siemens_PLC_S7.ReadClass<DL_Start_DB>(2301); | ||||
var res1 = this.Siemens_PLC_S7.ReadClass<DL_Status_DB>(2331); | var res1 = this.Siemens_PLC_S7.ReadClass<DL_Status_DB>(2331); | ||||
var res2 = this.Siemens_PLC_S7.ReadClass<DL_Finish_DB>(2361); | var res2 = this.Siemens_PLC_S7.ReadClass<DL_Finish_DB>(2361); | ||||
var res3 = this.Siemens_PLC_S7.ReadClass<DL_DataColl_DB>(2391); | |||||
//var res3 = this.Siemens_PLC_S7.ReadClass<DL_DataColl_DB>(2391); | |||||
if (res != null && res is DL_Start_DB start) | if (res != null && res is DL_Start_DB start) | ||||
{ | { | ||||
if (RTrig.GetInstance("Order_Request").Start(GVL_BigStation.Order_Request) && GVL_BigStation.SiemensSendRecipeStatus == 0) | if (RTrig.GetInstance("Order_Request").Start(GVL_BigStation.Order_Request) && GVL_BigStation.SiemensSendRecipeStatus == 0) | ||||
@@ -34,7 +34,7 @@ namespace BPASmartClient.JXJFoodBigStation.Model.Siemens | |||||
GVL_BigStation.SiemensSendRecipeStatus = 1; | GVL_BigStation.SiemensSendRecipeStatus = 1; | ||||
this.Siemens_PLC_S7.Write("DB2301.DBX330.0", true); | this.Siemens_PLC_S7.Write("DB2301.DBX330.0", true); | ||||
} | } | ||||
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; | GVL_BigStation.SiemensSendRecipeStatus = 2; | ||||
ActionManage.GetInstance.Send("SiemensSendRecipe", start); | ActionManage.GetInstance.Send("SiemensSendRecipe", start); | ||||
@@ -68,8 +68,14 @@ namespace BPASmartClient.JXJFoodBigStation.Model.Siemens | |||||
} | } | ||||
} | } | ||||
Thread.Sleep(10); | Thread.Sleep(10); | ||||
}), "监听服务数据"); | |||||
} | |||||
var dataColl = ProcessControl.GetInstance.HKDevice.DataColl; | |||||
if (dataColl != null && dataColl is DL_DataColl_DB data) | |||||
{ | |||||
Siemens_PLC_S7.WriteClass<DL_DataColl_DB>(data, 2391); | |||||
} | |||||
} | |||||
Thread.Sleep(10); | |||||
}), "监听服务数据"); | |||||
} | } | ||||
} | } | ||||
} | } |
@@ -17,6 +17,7 @@ | |||||
<RowDefinition /> | <RowDefinition /> | ||||
</Grid.RowDefinitions> | </Grid.RowDefinitions> | ||||
<!--#region 表格标题栏设置--> | <!--#region 表格标题栏设置--> | ||||
<Grid | <Grid | ||||
Grid.Row="0" | Grid.Row="0" | ||||
Margin="0,10,0,0" | Margin="0,10,0,0" | ||||
@@ -126,7 +127,7 @@ | |||||
<pry:IcoButton | <pry:IcoButton | ||||
Width="100" | Width="100" | ||||
Command="{Binding DataContext.SetValueCommand, RelativeSource={RelativeSource AncestorType=ItemsControl, Mode=FindAncestor}}" | Command="{Binding DataContext.SetValueCommand, RelativeSource={RelativeSource AncestorType=ItemsControl, Mode=FindAncestor}}" | ||||
CommandParameter="{Binding SetValue}" | |||||
CommandParameter="{Binding Address}" | |||||
Grid.Column="0" | Grid.Column="0" | ||||
Margin="50,5,50,5" | Margin="50,5,50,5" | ||||
Content="设置" | Content="设置" | ||||
@@ -0,0 +1,88 @@ | |||||
<UserControl x:Class="BPASmartClient.JXJFoodBigStation.View.ManualFlowView" | |||||
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.JXJFoodBigStation.ViewModel" | |||||
mc:Ignorable="d" | |||||
d:DesignHeight="1080" d:DesignWidth="1920"> | |||||
<UserControl.DataContext> | |||||
<vm:ManualFlowViewModel /> | |||||
</UserControl.DataContext> | |||||
<Grid Margin="10"> | |||||
<Grid.RowDefinitions> | |||||
<RowDefinition Height="100" /> | |||||
<RowDefinition Height="1*" /> | |||||
</Grid.RowDefinitions> | |||||
<!--#region 表格标题栏设置--> | |||||
<Grid> | |||||
<StackPanel Orientation="Horizontal" HorizontalAlignment="left" VerticalAlignment="Center"> | |||||
<Button | |||||
Width="200" | |||||
Height="40" | |||||
Margin="5,0,5,0" | |||||
Command="{Binding Tray1InPlace}" | |||||
Content="AGV到达工位1" | |||||
FontSize="20" | |||||
Panel.ZIndex="0" | |||||
Style="{StaticResource ImageButtonStyle}"></Button> | |||||
<Button | |||||
Width="200" | |||||
Height="40" | |||||
Margin="5,0,5,0" | |||||
Command="{Binding Tray2InPlace}" | |||||
Content="AGV到达工位2" | |||||
FontSize="20" | |||||
Panel.ZIndex="0" | |||||
Style="{StaticResource ImageButtonStyle}"></Button> | |||||
<Button | |||||
Width="200" | |||||
Height="40" | |||||
Margin="5,0,5,0" | |||||
Command="{Binding Tray3InPlace}" | |||||
Content="AGV到达工位3" | |||||
FontSize="20" | |||||
Panel.ZIndex="0" | |||||
Style="{StaticResource ImageButtonStyle}"></Button> | |||||
<Button | |||||
Width="200" | |||||
Height="40" | |||||
Margin="5,0,5,0" | |||||
Command="{Binding Tray4InPlace}" | |||||
Content="AGV到达工位4" | |||||
FontSize="20" | |||||
Panel.ZIndex="0" | |||||
Style="{StaticResource ImageButtonStyle}"></Button> | |||||
<Button | |||||
Width="200" | |||||
Height="40" | |||||
Margin="5,0,5,0" | |||||
Command="{Binding Tray5InPlace}" | |||||
Content="AGV到达工位5" | |||||
FontSize="20" | |||||
Panel.ZIndex="0" | |||||
Style="{StaticResource ImageButtonStyle}"></Button> | |||||
<Button | |||||
Width="200" | |||||
Height="40" | |||||
Margin="5,0,5,0" | |||||
Command="{Binding ClearTrayInPlace}" | |||||
Content="清楚AGV到位信号" | |||||
FontSize="20" | |||||
Panel.ZIndex="0" | |||||
Style="{StaticResource ImageButtonStyle}"></Button> | |||||
</StackPanel> | |||||
</Grid> | |||||
<Grid Grid.Row="1"> | |||||
<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> | |||||
</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.JXJFoodBigStation.View | |||||
{ | |||||
/// <summary> | |||||
/// HKPlcCommMonitor.xaml 的交互逻辑 | |||||
/// </summary> | |||||
public partial class ManualFlowView : UserControl | |||||
{ | |||||
public ManualFlowView() | |||||
{ | |||||
InitializeComponent(); | |||||
} | |||||
} | |||||
} |
@@ -17,7 +17,6 @@ namespace BPASmartClient.JXJFoodBigStation.ViewModel | |||||
{ | { | ||||
public class HKPlcCommMonitorViewModel:ObservableObject | public class HKPlcCommMonitorViewModel:ObservableObject | ||||
{ | { | ||||
HKDeviceStatus DeviceStatus = new HKDeviceStatus(); | |||||
public HKPlcCommMonitorViewModel() | public HKPlcCommMonitorViewModel() | ||||
{ | { | ||||
Type type = typeof(DB_Read); | Type type = typeof(DB_Read); | ||||
@@ -28,24 +27,23 @@ namespace BPASmartClient.JXJFoodBigStation.ViewModel | |||||
{ | { | ||||
foreach (PropertyInfo mi in properties) | foreach (PropertyInfo mi in properties) | ||||
{ | { | ||||
PropertyInfo a = DeviceStatus.PlcRead.GetType().GetProperty(mi.Name); | |||||
object ab = a.GetValue(DeviceStatus.PlcRead, null); | |||||
int index = Array.FindIndex(PlcInfo.ToArray(), p => p.Describe == mi.Name); | |||||
PropertyInfo a = GVL_BigStation.HKPlc_Read.GetType().GetProperty(mi.Name); | |||||
object ab = a.GetValue(GVL_BigStation.HKPlc_Read, null); | |||||
int index = Array.FindIndex(PlcInfo.ToArray(), p => p.Variable == mi.Name); | |||||
if (index != -1) | if (index != -1) | ||||
{ | { | ||||
PlcInfo.ElementAt(index).NowValue = ab.ToString(); | PlcInfo.ElementAt(index).NowValue = ab.ToString(); | ||||
} | } | ||||
} | } | ||||
Thread.Sleep(10); | |||||
}), "plc变量读取"); | |||||
Thread.Sleep(100); | |||||
}), "plc变量读取",true); | |||||
foreach (PropertyInfo mi in properties) | foreach (PropertyInfo mi in properties) | ||||
{ | { | ||||
PropertyInfo a = DeviceStatus.PlcRead.GetType().GetProperty(mi.Name); | |||||
object ab = a.GetValue(DeviceStatus.PlcRead, null); | |||||
PropertyInfo a = GVL_BigStation.HKPlc_Read.GetType().GetProperty(mi.Name); | |||||
object ab = a.GetValue(GVL_BigStation.HKPlc_Read, null); | |||||
if (mi.PropertyType.Name == "Int16") | if (mi.PropertyType.Name == "Int16") | ||||
{ | { | ||||
addressPos = "DBD"; | |||||
addressPos = "DBW"; | |||||
Offset = Math.Ceiling(Offset); | Offset = Math.Ceiling(Offset); | ||||
if (Offset / 2.0 - Math.Floor(Offset / 2.0) > 0.0) | if (Offset / 2.0 - Math.Floor(Offset / 2.0) > 0.0) | ||||
{ | { | ||||
@@ -70,7 +68,7 @@ namespace BPASmartClient.JXJFoodBigStation.ViewModel | |||||
Offset += 1.0; | Offset += 1.0; | ||||
} | } | ||||
} | } | ||||
var num = DeviceStatus.PlcRead; | |||||
var num = GVL_BigStation.HKPlc_Read; | |||||
var res = a.GetCustomAttribute<PlcCommAttribute>(); | var res = a.GetCustomAttribute<PlcCommAttribute>(); | ||||
string describe = ""; | string describe = ""; | ||||
if (res != null) | if (res != null) | ||||
@@ -107,15 +105,16 @@ namespace BPASmartClient.JXJFoodBigStation.ViewModel | |||||
SetValueCommand = new RelayCommand<object>((o) => | SetValueCommand = new RelayCommand<object>((o) => | ||||
{ | { | ||||
if (o != null && o is String setValue) | |||||
/*if (o != null && o is String address) | |||||
{ | { | ||||
int index = Array.FindIndex(PlcInfo.ToArray(), p => p.SetValue == setValue); | |||||
int index = Array.FindIndex(PlcInfo.ToArray(), p => p.Address == address); | |||||
if (index != -1) | if (index != -1) | ||||
{ | { | ||||
DeviceStatus.HK_PLC_S7.Write(PlcInfo.ElementAt(index).Address, setValue); | |||||
if(ProcessControl.GetInstance.HKDevice.IsConnected) ProcessControl.GetInstance.HKDevice.HK_PLC_S7.Write(address , PlcInfo.ElementAt(index).SetValue); | |||||
} | } | ||||
} | |||||
}*/ | |||||
}); | }); | ||||
} | } | ||||
/*public static string GetPropertyValue<T>( T t,string PropertyName) | /*public static string GetPropertyValue<T>( T t,string PropertyName) | ||||
{ | { | ||||
@@ -125,7 +124,5 @@ namespace BPASmartClient.JXJFoodBigStation.ViewModel | |||||
public ObservableCollection<PlcVarMonitor> PlcInfo { get; set; } = new ObservableCollection<PlcVarMonitor>(); | public ObservableCollection<PlcVarMonitor> PlcInfo { get; set; } = new ObservableCollection<PlcVarMonitor>(); | ||||
public RelayCommand<object> SetValueCommand { get; set; } | public RelayCommand<object> SetValueCommand { get; set; } | ||||
public RelayCommand Connect { get; set; } | |||||
} | } | ||||
} | } |
@@ -0,0 +1,61 @@ | |||||
using BPASmartClient.Helper; | |||||
using BPASmartClient.JXJFoodBigStation.Model; | |||||
using BPASmartClient.JXJFoodBigStation.Model.HK_PLC; | |||||
using Microsoft.Toolkit.Mvvm.ComponentModel; | |||||
using Microsoft.Toolkit.Mvvm.Input; | |||||
using System; | |||||
using System.Collections.Generic; | |||||
using System.Collections.ObjectModel; | |||||
using System.ComponentModel; | |||||
using System.Linq; | |||||
using System.Reflection; | |||||
using System.Text; | |||||
using System.Threading; | |||||
using System.Threading.Tasks; | |||||
namespace BPASmartClient.JXJFoodBigStation.ViewModel | |||||
{ | |||||
public class ManualFlowViewModel:ObservableObject | |||||
{ | |||||
public ManualFlowViewModel() | |||||
{ | |||||
Tray1InPlace = new RelayCommand(() => | |||||
{ | |||||
GVL_BigStation.AGVPutTray = GVL_BigStation.AGVPutTray.SetBitValue(1, true); | |||||
}); | |||||
Tray2InPlace = new RelayCommand(() => | |||||
{ | |||||
GVL_BigStation.AGVPutTray = GVL_BigStation.AGVPutTray.SetBitValue(2, true); | |||||
}); | |||||
Tray3InPlace = new RelayCommand(() => | |||||
{ | |||||
GVL_BigStation.AGVPutTray = GVL_BigStation.AGVPutTray.SetBitValue(3, true); | |||||
}); | |||||
Tray4InPlace = new RelayCommand(() => | |||||
{ | |||||
GVL_BigStation.AGVPutTray = GVL_BigStation.AGVPutTray.SetBitValue(4, true); | |||||
}); | |||||
Tray5InPlace = new RelayCommand(() => | |||||
{ | |||||
GVL_BigStation.AGVPutTray = GVL_BigStation.AGVPutTray.SetBitValue(5, true); | |||||
}); | |||||
ClearTrayInPlace = new RelayCommand(() => | |||||
{ | |||||
GVL_BigStation.AGVPutTray = 0; | |||||
}); | |||||
ThreadManage.GetInstance().StartLong(new Action(() => | |||||
{ | |||||
Heartbeat = GVL_BigStation.HeartBeatFromPlc; | |||||
Thread.Sleep(100); | |||||
}), "设备状态读取",true); | |||||
} | |||||
public RelayCommand Tray1InPlace { get; set; } | |||||
public RelayCommand Tray2InPlace { get; set; } | |||||
public RelayCommand Tray3InPlace { get; set; } | |||||
public RelayCommand Tray4InPlace { get; set; } | |||||
public RelayCommand Tray5InPlace { get; set; } | |||||
public RelayCommand ClearTrayInPlace { get; set; } | |||||
public bool Heartbeat { get { return _mHeartbeat; } set { _mHeartbeat = value; OnPropertyChanged(); } } | |||||
private bool _mHeartbeat; | |||||
} | |||||
} |
@@ -1,8 +1,9 @@ | |||||
<?xml version="1.0" encoding="utf-8" ?> | <?xml version="1.0" encoding="utf-8" ?> | ||||
<configuration> | <configuration> | ||||
<appSettings> | <appSettings> | ||||
<add key="HKPlc_IP" value="192.168.0.15"/> | |||||
<add key="RawMaterial_IP" value="107.107.2."/> | |||||
<add key="HKPlc_IP" value="107.107.2.88"/> | |||||
<add key="Siemens_IP" value="107.107.2.200"/> | <add key="Siemens_IP" value="107.107.2.200"/> | ||||
<add key="WindSend_IP" value="192.168.0.40"/> | |||||
<add key="WindSend_IP" value="107.107.2.90"/> | |||||
</appSettings> | </appSettings> | ||||
</configuration> | </configuration> |
@@ -14,6 +14,7 @@ using BPASmartClient.CustomResource.Pages.ViewModel; | |||||
using BPASmartClient.Helper; | using BPASmartClient.Helper; | ||||
using BPASmartClient.JXJFoodSmallStation.Model.Siemens; | using BPASmartClient.JXJFoodSmallStation.Model.Siemens; | ||||
using BPASmartClient.JXJFoodSmallStation.Model.WindSend; | using BPASmartClient.JXJFoodSmallStation.Model.WindSend; | ||||
using System.Threading; | |||||
namespace BPASmartClient.JXJFoodSmallStation | namespace BPASmartClient.JXJFoodSmallStation | ||||
{ | { | ||||
@@ -23,12 +24,22 @@ namespace BPASmartClient.JXJFoodSmallStation | |||||
public partial class App : Application | public partial class App : Application | ||||
{ | { | ||||
public static Window MainWindow; | public static Window MainWindow; | ||||
public EventWaitHandle ProgramStarted { get; set; } | |||||
protected override void OnStartup(StartupEventArgs e) | protected override void OnStartup(StartupEventArgs e) | ||||
{ | { | ||||
bool createNew; | |||||
ProgramStarted = new EventWaitHandle(false, EventResetMode.AutoReset, "SmallStationApp", out createNew); | |||||
if (!createNew) | |||||
{ | |||||
MessageBox.Show("程序已启动"); | |||||
App.Current.Shutdown(); | |||||
Environment.Exit(0); | |||||
} | |||||
BPASmartClient.Helper.SystemHelper.GetInstance.CreateDesktopShortcut(); | |||||
base.OnStartup(e); | base.OnStartup(e); | ||||
MenuInit(); | MenuInit(); | ||||
DataInit(); | DataInit(); | ||||
//DeviceInquire.GetInstance.Init();//配料机设备上线监听,设备列表初始化 | |||||
DeviceInquire.GetInstance.Init();//配料机设备上线监听,设备列表初始化 | |||||
MainView mv = new MainView(); | MainView mv = new MainView(); | ||||
ProcessControl.GetInstance.Init(); | ProcessControl.GetInstance.Init(); | ||||
LoginView lv = new LoginView(); | LoginView lv = new LoginView(); | ||||
@@ -139,7 +150,15 @@ namespace BPASmartClient.JXJFoodSmallStation | |||||
ToggleWindowPath = "View.ManualCommView" | ToggleWindowPath = "View.ManualCommView" | ||||
}); | }); | ||||
ManualControl.Add(new SubMenumodel() | |||||
{ | |||||
SubMenuName = "手动控制流程", | |||||
SubMenuPermission = new Permission[] { Permission.管理员, Permission.操作员, Permission.技术员 }, | |||||
AssemblyName = "BPASmartClient.JXJFoodSmallStation", | |||||
ToggleWindowPath = "View.ManualFlowView" | |||||
}); | |||||
MenuManage.GetInstance.menuModels.Add(new MenuModel() | MenuManage.GetInstance.menuModels.Add(new MenuModel() | ||||
{ | { | ||||
MainMenuIcon = "", | MainMenuIcon = "", | ||||
@@ -232,7 +251,7 @@ namespace BPASmartClient.JXJFoodSmallStation | |||||
UserManager.Add(new SubMenumodel() | UserManager.Add(new SubMenumodel() | ||||
{ | { | ||||
SubMenuName = "密码修改", | SubMenuName = "密码修改", | ||||
SubMenuPermission = new Permission[] { Permission.管理员, Permission.操作员, Permission.技术员 }, | |||||
SubMenuPermission = new Permission[] { Permission.管理员, Permission.技术员 }, | |||||
AssemblyName = "BPASmartClient.CustomResource", | AssemblyName = "BPASmartClient.CustomResource", | ||||
ToggleWindowPath = "Pages.View.PasswordChangeView" | ToggleWindowPath = "Pages.View.PasswordChangeView" | ||||
}); | }); | ||||
@@ -19,6 +19,12 @@ | |||||
<ProjectReference Include="..\BPASmartClient.S7Net\BPASmartClient.S7Net.csproj" /> | <ProjectReference Include="..\BPASmartClient.S7Net\BPASmartClient.S7Net.csproj" /> | ||||
</ItemGroup> | </ItemGroup> | ||||
<ItemGroup> | |||||
<Compile Update="View\ManualFlowView.xaml.cs"> | |||||
<SubType>Code</SubType> | |||||
</Compile> | |||||
</ItemGroup> | |||||
<ItemGroup> | <ItemGroup> | ||||
<Page Update="View\ChangeDeviceNameView.xaml"> | <Page Update="View\ChangeDeviceNameView.xaml"> | ||||
<XamlRuntime>$(DefaultXamlRuntime)</XamlRuntime> | <XamlRuntime>$(DefaultXamlRuntime)</XamlRuntime> | ||||
@@ -30,6 +36,10 @@ | |||||
<XamlRuntime>$(DefaultXamlRuntime)</XamlRuntime> | <XamlRuntime>$(DefaultXamlRuntime)</XamlRuntime> | ||||
<SubType>Designer</SubType> | <SubType>Designer</SubType> | ||||
</Page> | </Page> | ||||
<Page Update="View\ManualFlowView.xaml"> | |||||
<XamlRuntime>$(DefaultXamlRuntime)</XamlRuntime> | |||||
<SubType>Designer</SubType> | |||||
</Page> | |||||
<Page Update="View\SiemensRecipeReceiveView.xaml"> | <Page Update="View\SiemensRecipeReceiveView.xaml"> | ||||
<XamlRuntime>$(DefaultXamlRuntime)</XamlRuntime> | <XamlRuntime>$(DefaultXamlRuntime)</XamlRuntime> | ||||
<SubType>Designer</SubType> | <SubType>Designer</SubType> | ||||
@@ -14,12 +14,37 @@ 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() { } | ||||
/// <summary> | |||||
/// 托盘1托盘到位 逻辑完成 | |||||
/// </summary> | |||||
public static bool TrayLogicFinish { get; set; } = false; | |||||
/// <summary> | |||||
/// 托盘1有货架 | |||||
/// </summary> | |||||
public static bool Station1HaveTray { get; set; } | |||||
/// <summary> | |||||
/// 托盘2有货架 | |||||
/// </summary> | |||||
public static bool Station2HaveTray { get; set; } | |||||
public static bool Station1Sensor { get; set; } | |||||
/// <summary> | |||||
/// 托盘2传感器信号 | |||||
/// </summary> | |||||
public static bool Station2Sensor { get; set; } | |||||
public static bool Station1Cylinder { get; set; } | |||||
/// <summary> | |||||
/// 托盘2气缸信号 | |||||
/// </summary> | |||||
public static bool Station2Cylinder { get; set; } | |||||
public static bool AGV_PutTray1Finish { get; set; } | |||||
public static bool AGV_GetTray1Finish { get; set; } | |||||
public static bool CylinderReset { get; set; } | |||||
/// <summary> | /// <summary> | ||||
/// 配料站料仓数目 | /// 配料站料仓数目 | ||||
/// </summary> | /// </summary> | ||||
public const int Max_DosingSotckBinNum = 15; | public const int Max_DosingSotckBinNum = 15; | ||||
/// <summary> | /// <summary> | ||||
/// 风送料仓数目 | /// 风送料仓数目 | ||||
/// </summary> | /// </summary> | ||||
@@ -38,43 +63,36 @@ namespace BPASmartClient.JXJFoodSmallStation.Model | |||||
/// 往输送带下发配方完成 | /// 往输送带下发配方完成 | ||||
/// </summary> | /// </summary> | ||||
public bool IssueRecipeFinishStation1 { get; set; } = false; | public bool IssueRecipeFinishStation1 { get; set; } = false; | ||||
/// <summary> | |||||
/// 往输送带下发配方完成 | |||||
/// </summary> | |||||
public bool IssueRecipeFinishStation2 { get; set; } = false; | |||||
/// <summary> | /// <summary> | ||||
/// 配方下发状态 =0:配方未下发 ,1:配方下发给plc ,2:plc成功接收配方 | /// 配方下发状态 =0:配方未下发 ,1:配方下发给plc ,2:plc成功接收配方 | ||||
/// </summary> | /// </summary> | ||||
public int RecipeStatusID { get; set; } = 0; | public int RecipeStatusID { get; set; } = 0; | ||||
/// <summary> | |||||
/// 配方下发状态 =0:配方未下发 ,1:配方下发给plc ,2:plc成功接收配方 | |||||
/// </summary> | |||||
public int RecipeStatusIDTray2 { get; set; } = 0; | |||||
/// <summary> | /// <summary> | ||||
/// Tray1的柔性味魔方配料标志(下发配方时,若柔性味魔方的状态=3,复位该状态) | /// Tray1的柔性味魔方配料标志(下发配方时,若柔性味魔方的状态=3,复位该状态) | ||||
/// </summary> | /// </summary> | ||||
public bool DosingTray1 { get; set; } = true;//默认为true,初始时,判断柔性味魔方的状态。 | |||||
public bool DosingTray1 { get; set; } = false;//默认为true,初始时,判断柔性味魔方的状态。 | |||||
/// <summary> | /// <summary> | ||||
/// Tray2的柔性味魔方配料标志 | /// Tray2的柔性味魔方配料标志 | ||||
/// </summary> | /// </summary> | ||||
public bool DosingTray2 { get; set; } = true; | |||||
public bool DosingTray2 { get; set; } = false; | |||||
public int DosingTray1Loc { get; set; } = 0; | public int DosingTray1Loc { get; set; } = 0; | ||||
public int DosingTray2Loc { get; set; } = 0; | public int DosingTray2Loc { get; set; } = 0; | ||||
/// <summary> | /// <summary> | ||||
/// 配方下发状态 =0:配方未下发 ,1:配方下发给plc ,2:plc成功接收配方 | |||||
/// </summary> | |||||
public int RecipeStatusIDTray2 { get; set; } = 0; | |||||
/// <summary> | |||||
/// 往输送带下发配方完成 | |||||
/// </summary> | |||||
public bool IssueRecipeFinishStation2 { get; set; } = false; | |||||
public bool IsAllow { get; set; } = false; | |||||
public bool IsAllowOut { set; get; } = false; | |||||
/// <summary> | |||||
/// 当前料仓的位置 | /// 当前料仓的位置 | ||||
/// </summary> | /// </summary> | ||||
public int StockInIsWork { get; set; } = 0; | public int StockInIsWork { get; set; } = 0; | ||||
/// <summary> | |||||
/// 单个配方执行完成标志 | |||||
/// </summary> | |||||
public bool RecipeFinish { get; set; } = false; | |||||
/// <summary> | /// <summary> | ||||
/// 记录AGV进站送货的指令顺序 | /// 记录AGV进站送货的指令顺序 | ||||
@@ -88,20 +106,11 @@ namespace BPASmartClient.JXJFoodSmallStation.Model | |||||
/// <summary> | /// <summary> | ||||
/// 是否使用粉仓 | /// 是否使用粉仓 | ||||
/// </summary> | /// </summary> | ||||
public bool IsUseWindSend; | |||||
public bool IsUseWindSend { get; set; } = false; | |||||
/// <summary> | /// <summary> | ||||
/// 风送配料完成标志 | /// 风送配料完成标志 | ||||
/// </summary> | /// </summary> | ||||
public bool WindSendDosingFinish; | |||||
/// <summary> | |||||
/// 是否占用托盘1 | |||||
/// </summary> | |||||
public bool IsOccupationTray1 { get; set; } = true; | |||||
/// <summary> | |||||
/// 是否占用托盘2 | |||||
/// </summary> | |||||
public bool IsOccupationTray2 { get; set; } = true; | |||||
public bool WindSendDosingFinish { get; set; } = false; | |||||
/// <summary> | /// <summary> | ||||
/// 顶升气缸的信号 | /// 顶升气缸的信号 | ||||
@@ -118,6 +127,16 @@ namespace BPASmartClient.JXJFoodSmallStation.Model | |||||
/// </summary> | /// </summary> | ||||
public bool IsUseWindSendDosing { get; set; } | public bool IsUseWindSendDosing { get; set; } | ||||
public static int test1 = 1; | public static int test1 = 1; | ||||
public DateTime time1; | |||||
/// <summary> | |||||
/// 风送是否允许AGV到工站 | |||||
/// </summary> | |||||
public static bool WindSendAllowAGVPutGet { get; set; } = false; | |||||
/// <summary> | |||||
/// 粉料仓配料完成 | |||||
/// </summary> | |||||
public static bool WindSendDosingComple { get; set; } = false; | |||||
#endregion | #endregion | ||||
} | } | ||||
} | } |
@@ -15,20 +15,20 @@ namespace BPASmartClient.JXJFoodSmallStation.Model.HK_PLC | |||||
{ | { | ||||
public SiemensHelper HK_PLC_S7 = new SiemensHelper(); | public SiemensHelper HK_PLC_S7 = new SiemensHelper(); | ||||
public bool IsConnected => HK_PLC_S7.IsConnected; | public bool IsConnected => HK_PLC_S7.IsConnected; | ||||
public PlcReadAddressDB45 DeviceStatus = new PlcReadAddressDB45(); | |||||
public void Init() | public void Init() | ||||
{ | { | ||||
if (IsConnected) | |||||
ThreadManage.GetInstance().StartLong(new Action(() => | |||||
{ | { | ||||
/*ThreadManage.GetInstance().StartLong(new Action(() => | |||||
if (IsConnected) | |||||
{ | { | ||||
if (!IsConnected) | |||||
var res = this.HK_PLC_S7.ReadClass<PlcReadAddressDB45>(45); | |||||
if ( res != null && res is PlcReadAddressDB45 data) | |||||
{ | { | ||||
MessageLog.GetInstance.ShowRunLog("海科PLC断开连接"); | |||||
DeviceStatus = data; | |||||
} | } | ||||
Thread.Sleep(10); | |||||
}),"信号收发处理");*/ | |||||
} | |||||
} | |||||
}),"海科PLC设备状态",true); | |||||
} | } | ||||
/// <summary> | /// <summary> | ||||
/// 单个配料机配料完成 | /// 单个配料机配料完成 | ||||
@@ -68,7 +68,7 @@ namespace BPASmartClient.JXJFoodSmallStation.Model.HK_PLC | |||||
/// </summary> | /// </summary> | ||||
/// <param name="BarrelNum">单个桶的编号</param> | /// <param name="BarrelNum">单个桶的编号</param> | ||||
/// <param name="StockBinLocation">单个桶对应的料仓位置</param> | /// <param name="StockBinLocation">单个桶对应的料仓位置</param> | ||||
public void StockBinPar(uint BarrelNum, ushort StockBinLocation, int TrayNum = 1) | |||||
public void StockBinPar(uint BarrelNum, ushort StockBinLocation, int TrayNum = 1) | |||||
{ | { | ||||
if (IsConnected) | if (IsConnected) | ||||
{ | { | ||||
@@ -0,0 +1,58 @@ | |||||
using System; | |||||
using System.Collections.Generic; | |||||
using System.Linq; | |||||
using System.Text; | |||||
using System.Threading.Tasks; | |||||
namespace BPASmartClient.JXJFoodSmallStation.Model.HK_PLC | |||||
{ | |||||
public class PlcReadAddressDB45 | |||||
{ | |||||
/// <summary> | |||||
/// 通信心跳 DB45.DBX0.0 | |||||
/// </summary> | |||||
public bool HeartBeat { get; set; } | |||||
/// <summary> | |||||
/// 设备运行 DB45.DBX0.1 | |||||
/// </summary> | |||||
public bool DeviceRun { get; set; } | |||||
/// <summary> | |||||
/// 设备停止 DB45.DBX0.2 | |||||
/// </summary> | |||||
public bool DeviceStop { get; set; } | |||||
/// <summary> | |||||
/// 设备急停 DB45.DBX0.3 | |||||
/// </summary> | |||||
public bool DeviceEStop { get; set; } | |||||
/// <summary> | |||||
/// 设备暂停 DB45.DBX0.4 | |||||
/// </summary> | |||||
public bool DevicePause { get; set; } | |||||
/// <summary> | |||||
/// 设备故障 DB45.DBX0.5 | |||||
/// </summary> | |||||
public bool DeviceAlarm { get; set; } | |||||
/// <summary> | |||||
/// 料仓缺料 DB45.DBX0.6 | |||||
/// </summary> | |||||
public bool StockBin { get; set; } | |||||
/// <summary> | |||||
/// 上游缺料 DB45.DBX0.7 | |||||
/// </summary> | |||||
public bool Top { get; set; } | |||||
/// <summary> | |||||
/// 上游缺料 DB45.DBX1.0 | |||||
/// </summary> | |||||
public bool TopDown { get; set; } | |||||
/// <summary> | |||||
/// 系统模式 | |||||
/// </summary> | |||||
public short Mode { get; set; } | |||||
/// <summary> | |||||
/// 报警 | |||||
/// </summary> | |||||
public bool[] Alarm { get; set; } = new bool[24]; | |||||
public int Standby1 { get; set; } | |||||
public int Standby2 { get; set; } | |||||
} | |||||
} |
@@ -0,0 +1,13 @@ | |||||
using System; | |||||
using System.Collections.Generic; | |||||
using System.Linq; | |||||
using System.Text; | |||||
using System.Threading.Tasks; | |||||
namespace BPASmartClient.JXJFoodSmallStation.Model.HK_PLC | |||||
{ | |||||
public class PlcWriteAddressDB7 | |||||
{ | |||||
} | |||||
} |
@@ -43,7 +43,7 @@ namespace BPASmartClient.JXJFoodSmallStation.Model | |||||
/// <summary> | /// <summary> | ||||
/// 风送PLC的DB块 | /// 风送PLC的DB块 | ||||
/// </summary> | /// </summary> | ||||
XL_WindSendData_DB WindSendData = new XL_WindSendData_DB(); | |||||
WindSend_Write WindSendData = new WindSend_Write(); | |||||
/// <summary> | /// <summary> | ||||
/// 接收原料数据 | /// 接收原料数据 | ||||
/// </summary> | /// </summary> | ||||
@@ -51,7 +51,7 @@ namespace BPASmartClient.JXJFoodSmallStation.Model | |||||
public void Init() | public void Init() | ||||
{ | { | ||||
testData(); | testData(); | ||||
Json<RemoteRecipeDataColl>.Data.Recipes = Json<LocalRecipeDataColl>.Data.Recipes; | |||||
//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) | ||||
@@ -156,11 +156,6 @@ namespace BPASmartClient.JXJFoodSmallStation.Model | |||||
} | } | ||||
} | } | ||||
}), "SiemensRecipeFinish", true); | }), "SiemensRecipeFinish", true); | ||||
ActionManage.GetInstance.CancelRegister("WindSendDosingFinish"); | |||||
ActionManage.GetInstance.Register(new Action(() => | |||||
{ | |||||
GVL_SmallStation.GetInstance.WindSendDosingFinish = true; | |||||
}),"WindSendDosingFinish",true); | |||||
ActionManage.GetInstance.CancelRegister("LocalSimulationRecipeIssue"); | ActionManage.GetInstance.CancelRegister("LocalSimulationRecipeIssue"); | ||||
ActionManage.GetInstance.Register(new Action<Object>((res) => | ActionManage.GetInstance.Register(new Action<Object>((res) => | ||||
{ | { | ||||
@@ -172,11 +167,12 @@ namespace BPASmartClient.JXJFoodSmallStation.Model | |||||
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 | ||||
{ | { | ||||
//HKDevice.HK_PLC_S7.Connect(S7.Net.CpuType.S71200, HK_PLC_IP); | //HKDevice.HK_PLC_S7.Connect(S7.Net.CpuType.S71200, HK_PLC_IP); | ||||
SiemensDevice.Siemens_PLC_S7.Connect(S7.Net.CpuType.S71500, Siemens_PLC_IP); | |||||
//WindSendDevice.Siemens_PLC_S7.Connect(S7.Net.CpuType.S71200,WindSend_PLC_IP); | |||||
//SiemensDevice.Siemens_PLC_S7.Connect(S7.Net.CpuType.S71500, Siemens_PLC_IP); | |||||
WindSendDevice.Siemens_PLC_S7.Connect(S7.Net.CpuType.S71200, WindSend_PLC_IP); | |||||
if (HKDevice.IsConnected) | if (HKDevice.IsConnected) | ||||
{ | { | ||||
HKDevice.Init(); | HKDevice.Init(); | ||||
@@ -187,16 +183,36 @@ namespace BPASmartClient.JXJFoodSmallStation.Model | |||||
SiemensDevice.Init(); | SiemensDevice.Init(); | ||||
MessageNotify.GetInstance.ShowRunLog("西门子plc连接成功,并初始化完成"); | MessageNotify.GetInstance.ShowRunLog("西门子plc连接成功,并初始化完成"); | ||||
} | } | ||||
if (WindSendDevice.IsConnected) | |||||
if (WindSendDevice.IsConnected) | |||||
{ | { | ||||
WindSendDevice.Init(); | WindSendDevice.Init(); | ||||
MessageNotify.GetInstance.ShowRunLog("风送plc连接成功,并初始化完成"); | MessageNotify.GetInstance.ShowRunLog("风送plc连接成功,并初始化完成"); | ||||
} | } | ||||
} | } | ||||
catch(Exception ex) | |||||
catch (Exception ex) | |||||
{ | { | ||||
} | } | ||||
ThreadManage.GetInstance().StartLong(new Action(() => | |||||
{ | |||||
/*if (!HKDevice.IsConnected) | |||||
{ | |||||
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) | |||||
{ | |||||
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) | |||||
{ | |||||
WindSendDevice.Siemens_PLC_S7.Connect(S7.Net.CpuType.S71200, WindSend_PLC_IP); | |||||
MessageNotify.GetInstance.ShowRunLog("风送plc重新连接成功"); | |||||
} | |||||
Thread.Sleep(50); | |||||
}), "设备连接", true); | |||||
ActionManage.GetInstance.CancelRegister("SystemStart"); | ActionManage.GetInstance.CancelRegister("SystemStart"); | ||||
ActionManage.GetInstance.Register(new Action(() => | ActionManage.GetInstance.Register(new Action(() => | ||||
{ | { | ||||
@@ -229,28 +245,38 @@ namespace BPASmartClient.JXJFoodSmallStation.Model | |||||
HKDevice.HK_PLC_S7.Write<bool>("DB44.DBX0.1", true); | HKDevice.HK_PLC_S7.Write<bool>("DB44.DBX0.1", true); | ||||
}), "SystemDebugMode", true); | }), "SystemDebugMode", true); | ||||
RecipeQueue.Clear(); | RecipeQueue.Clear(); | ||||
ActionManage.GetInstance.Register(new Action(() => | |||||
{ | |||||
HKDevice.HK_PLC_S7.Write<bool>("DB44.DBX0.3", true); | |||||
}), "SystemReset", true); | |||||
RecipeQueue.Clear(); | |||||
ActionManage.GetInstance.Register(new Action(() => | |||||
{ | |||||
HKDevice.HK_PLC_S7.Write<bool>("DB44.DBX0.4", true); | |||||
}), "CLearRecipeInfo", 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(() => | ||||
{ | { | ||||
HeartHKPlc(); | |||||
if (HKDevice.IsConnected) | |||||
{ | |||||
GVL_SmallStation.GetInstance.HeartBeatToPlc = !GVL_SmallStation.GetInstance.HeartBeatToPlc; | |||||
HKDevice.HK_PLC_S7.Write("DB4.DBX0.0", GVL_SmallStation.GetInstance.HeartBeatToPlc); | |||||
GVL_SmallStation.GetInstance.HeartBeatFromPlc = HKDevice.HK_PLC_S7.Read<bool>("DB45.DBX0.0"); | |||||
} | |||||
Thread.Sleep(200); | |||||
}), "通信心跳", true); | |||||
ThreadManage.GetInstance().StartLong(new Action(() => | |||||
{ | |||||
DeviceStatusDispose(); | |||||
ReceviceData(); | ReceviceData(); | ||||
RecipeInfoToHKPLC(); | RecipeInfoToHKPLC(); | ||||
Thread.Sleep(10); | Thread.Sleep(10); | ||||
}), "西门子配发下发流程处理", true); | }), "西门子配发下发流程处理", true); | ||||
/* ThreadManage.GetInstance().StartLong(new Action(() => | |||||
{ | |||||
if (SiemensDevice.IsConnected && HKDevice.IsConnected) | |||||
{ | |||||
*//*AgvGetInDelivery(); | |||||
AgvGetInPickUp();*//* | |||||
} | |||||
Thread.Sleep(10); | |||||
}), "AGV进站送取货", true);*/ | |||||
ThreadManage.GetInstance().StartLong(new Action(() => | ThreadManage.GetInstance().StartLong(new Action(() => | ||||
{ | { | ||||
if (HKDevice.IsConnected) | if (HKDevice.IsConnected) | ||||
{ | { | ||||
//GetStatus(); | |||||
ManualOpen(); | ManualOpen(); | ||||
ManualClose(); | ManualClose(); | ||||
} | } | ||||
@@ -266,7 +292,8 @@ namespace BPASmartClient.JXJFoodSmallStation.Model | |||||
for (int i = 0; i < 7; i++) | for (int i = 0; i < 7; i++) | ||||
{ | { | ||||
GVL_SmallStation.GetInstance.Cylinder_JackInfo[i + 8] = HKDevice.HK_PLC_S7.Read<bool>("DB5.DBX0." + i); | GVL_SmallStation.GetInstance.Cylinder_JackInfo[i + 8] = HKDevice.HK_PLC_S7.Read<bool>("DB5.DBX0." + i); | ||||
}/* | |||||
} | |||||
/* | |||||
ActionManage.GetInstance.Register(new Action(() => | ActionManage.GetInstance.Register(new Action(() => | ||||
{ | { | ||||
HKDevice.HK_PLC_S7.Write<bool>("M10.0", true); | HKDevice.HK_PLC_S7.Write<bool>("M10.0", true); | ||||
@@ -579,107 +606,111 @@ namespace BPASmartClient.JXJFoodSmallStation.Model | |||||
}), "ManualClose", true);//根据下发的配方ID将 托盘的位置信息添加到配方中 | }), "ManualClose", true);//根据下发的配方ID将 托盘的位置信息添加到配方中 | ||||
} | } | ||||
/// <summary> | /// <summary> | ||||
/// AGV进站送货 | |||||
/// </summary> | |||||
private void AgvGetInDelivery() | |||||
{ | |||||
switch (GVL_SmallStation.GetInstance.AgvDeliveryPosition) | |||||
{ | |||||
case 0: | |||||
if (RTrig.GetInstance("").Start(SiemensDevice.Siemens_PLC_S7.Read<object>(SiemensCommAddress.DeliveryAGVApply) is bool)) | |||||
{ | |||||
GVL_SmallStation.GetInstance.AgvDeliveryPosition = 1; | |||||
HKDevice.HK_PLC_S7.Write(HKPlcCommAddress.DeliveryAGVApply, true); | |||||
} | |||||
break; | |||||
case 1: | |||||
if (RTrig.GetInstance("").Start(HKDevice.HK_PLC_S7.Read<bool>(HKPlcCommAddress.DeliveryAGVIsApply))) | |||||
{ | |||||
GVL_SmallStation.GetInstance.AgvDeliveryPosition = 2; | |||||
SiemensDevice.Siemens_PLC_S7.Write(SiemensCommAddress.DeliveryAGVIsApply, true); | |||||
} | |||||
break; | |||||
case 2: | |||||
if (RTrig.GetInstance("").Start(SiemensDevice.Siemens_PLC_S7.Read<object>(SiemensCommAddress.DeliveryAGVApplyJack) is bool)) | |||||
{ | |||||
GVL_SmallStation.GetInstance.AgvDeliveryPosition = 3; | |||||
HKDevice.HK_PLC_S7.Write(HKPlcCommAddress.DeliveryAGVApplyJack, true); | |||||
} | |||||
break; | |||||
case 3: | |||||
if (RTrig.GetInstance("").Start(HKDevice.HK_PLC_S7.Read<bool>(HKPlcCommAddress.DeliveryAGVIsApplyJack))) | |||||
{ | |||||
GVL_SmallStation.GetInstance.AgvDeliveryPosition = 4; | |||||
SiemensDevice.Siemens_PLC_S7.Write(SiemensCommAddress.DeliveryAGVIsApplyJack, true); | |||||
} | |||||
break; | |||||
case 4: | |||||
if (RTrig.GetInstance("").Start(SiemensDevice.Siemens_PLC_S7.Read<object>(SiemensCommAddress.DeliveryAGVFinsih) is bool)) | |||||
{ | |||||
GVL_SmallStation.GetInstance.AgvDeliveryPosition = 5; | |||||
HKDevice.HK_PLC_S7.Write(HKPlcCommAddress.DeliveryAGVFinsih, true); | |||||
} | |||||
break; | |||||
case 5: | |||||
if (RTrig.GetInstance("").Start(HKDevice.HK_PLC_S7.Read<bool>(HKPlcCommAddress.StationHaveCargo))) | |||||
{ | |||||
GVL_SmallStation.GetInstance.AgvDeliveryPosition = 0; | |||||
SiemensDevice.Siemens_PLC_S7.Write(SiemensCommAddress.StationHaveCargo, true); | |||||
} | |||||
break; | |||||
default: | |||||
break; | |||||
} | |||||
//获取工位上是否有小车 | |||||
SiemensDevice.Siemens_PLC_S7.Write(SiemensCommAddress.StationIsExistCar, (bool) | |||||
HKDevice.HK_PLC_S7.Read<bool>(HKPlcCommAddress.StationIsExistTray)); | |||||
} | |||||
/// <summary> | |||||
/// AGV进站取货 | |||||
/// | |||||
/// </summary> | /// </summary> | ||||
private void AgvGetInPickUp() | |||||
private void DeviceStatusDispose() | |||||
{ | { | ||||
switch (GVL_SmallStation.GetInstance.AgvPickUpPosition) | |||||
if (HKDevice.IsConnected) | |||||
{ | { | ||||
case 0: | |||||
if (RTrig.GetInstance("").Start(SiemensDevice.Siemens_PLC_S7.Read<bool>(SiemensCommAddress.PickAGVApply))) | |||||
GVL_SmallStation.Station1HaveTray = HKDevice.HK_PLC_S7.Read<bool>("DB3.DBX0.7");//工站1 有货架 | |||||
GVL_SmallStation.Station2HaveTray = HKDevice.HK_PLC_S7.Read<bool>("DB3.DBX1.0");//工站1 有货架 | |||||
if (RTrig.GetInstance("WindSendDosingCompleToHKPLC").Start(GVL_SmallStation.WindSendDosingComple)) | |||||
{ | |||||
GVL_SmallStation.WindSendDosingComple = false; | |||||
HKDevice.HK_PLC_S7.Write<bool>("DB4.DBX1.7", true); | |||||
MessageNotify.GetInstance.ShowRunLog("风送配料完成信号,发给产线plc信号"); | |||||
} | |||||
if (HKDevice.HK_PLC_S7.Read<bool>("DB3.DBX1.1")) | |||||
{ | |||||
HKDevice.HK_PLC_S7.Write<bool>("DB4.DBX1.7", false); | |||||
} | |||||
if (RTrig.GetInstance("DB3.DBX1.7").Start(HKDevice.HK_PLC_S7.Read<bool>("DB3.DBX1.7")) )//允许下配方1或者允许下配方2 | |||||
{ | |||||
GVL_SmallStation.IsAllowSiemensSendRecipe = true; | |||||
MessageNotify.GetInstance.ShowRunLog("Plc允许下发配方"); | |||||
} | |||||
GVL_SmallStation.Station1Sensor = HKDevice.HK_PLC_S7.Read<bool>("DB3.DBX2.1"); | |||||
GVL_SmallStation.Station2Sensor = HKDevice.HK_PLC_S7.Read<bool>("DB3.DBX2.2"); | |||||
GVL_SmallStation.Station1Cylinder = HKDevice.HK_PLC_S7.Read<bool>("DB3.DBX2.3"); | |||||
GVL_SmallStation.Station2Cylinder = HKDevice.HK_PLC_S7.Read<bool>("DB3.DBX2.4"); | |||||
if (!GVL_SmallStation.TrayLogicFinish) | |||||
{ | |||||
if (GVL_SmallStation.AGV_PutTray1Finish) | |||||
{ | { | ||||
GVL_SmallStation.GetInstance.AgvPickUpPosition = 1; | |||||
HKDevice.HK_PLC_S7.Write(HKPlcCommAddress.PickAGVApply, true); | |||||
HKDevice.HK_PLC_S7.Write("DB4.DBX0.7", true); | |||||
GVL_SmallStation.AGV_PutTray1Finish = false; | |||||
//MessageNotify.GetInstance.ShowRunLog("AGV到位 发送到位信号给plc"); | |||||
} | } | ||||
break; | |||||
case 1: | |||||
if (RTrig.GetInstance("").Start(HKDevice.HK_PLC_S7.Read<bool>(HKPlcCommAddress.PickAGVIsApply))) | |||||
if (GVL_SmallStation.Station1HaveTray) | |||||
{ | { | ||||
GVL_SmallStation.GetInstance.AgvPickUpPosition = 2; | |||||
SiemensDevice.Siemens_PLC_S7.Write(SiemensCommAddress.PickAGVIsApply, true); | |||||
HKDevice.HK_PLC_S7.Write("DB4.DBX0.7", false); | |||||
GVL_SmallStation.TrayLogicFinish = true; | |||||
MessageNotify.GetInstance.ShowRunLog("托盘1有货架"); | |||||
} | } | ||||
break; | |||||
case 2: | |||||
if (RTrig.GetInstance("").Start(SiemensDevice.Siemens_PLC_S7.Read<bool>(SiemensCommAddress.PickCargoAGVFinish))) | |||||
else | |||||
{ | { | ||||
GVL_SmallStation.GetInstance.AgvPickUpPosition = 3; | |||||
HKDevice.HK_PLC_S7.Write(HKPlcCommAddress.PickCargoAGVFinish, true); | |||||
if (HKDevice.HK_PLC_S7.Read<bool>("DB3.DBX1.5") == true) | |||||
{ | |||||
if (GVL_SmallStation.CylinderReset) | |||||
{ | |||||
HKDevice.HK_PLC_S7.Write<bool>("DB4.DBX1.5", true); | |||||
} | |||||
MessageNotify.GetInstance.ShowRunLog("气缸收紧错位"); | |||||
} | |||||
else | |||||
{ | |||||
HKDevice.HK_PLC_S7.Write<bool>("DB4.DBX1.5", false); | |||||
} | |||||
} | } | ||||
break; | |||||
case 3: | |||||
if (RTrig.GetInstance("").Start(HKDevice.HK_PLC_S7.Read<bool>(HKPlcCommAddress.PickAGVFinish))) | |||||
} | |||||
else | |||||
{ | |||||
if (GVL_SmallStation.AGV_GetTray1Finish) | |||||
{ | { | ||||
GVL_SmallStation.GetInstance.AgvPickUpPosition = 0; | |||||
SiemensDevice.Siemens_PLC_S7.Write(SiemensCommAddress.PickAGVFinish, true); | |||||
HKDevice.HK_PLC_S7.Write("DB4.DBX1.1", true); | |||||
if (HKDevice.HK_PLC_S7.Read<bool>("DB3.DBX1.7") == true) | |||||
{ | |||||
HKDevice.HK_PLC_S7.Write("DB4.DBX1.1", false); | |||||
GVL_SmallStation.TrayLogicFinish = false; | |||||
GVL_SmallStation.AGV_GetTray1Finish = false; | |||||
} | |||||
} | } | ||||
break; | |||||
default: | |||||
break; | |||||
} | |||||
} | } | ||||
} | |||||
private void HeartHKPlc() | |||||
{ | |||||
if (HKDevice.IsConnected) | |||||
if (SiemensDevice.IsConnected) | |||||
{ | { | ||||
GVL_SmallStation.GetInstance.HeartBeatToPlc = !GVL_SmallStation.GetInstance.HeartBeatToPlc; | |||||
HKDevice.HK_PLC_S7.Write("DB4.DBX0.0", GVL_SmallStation.GetInstance.HeartBeatToPlc); | |||||
GVL_SmallStation.GetInstance.HeartBeatFromPlc = HKDevice.HK_PLC_S7.Read<bool>("DB3.DBX0.0"); | |||||
short TrayCylinder = 0; | |||||
short TraySensor = 0; | |||||
if (GVL_SmallStation.Station1Sensor) | |||||
{ | |||||
TraySensor = SetBitValue(TraySensor, 1, true); | |||||
} | |||||
else | |||||
{ | |||||
TraySensor = SetBitValue(TraySensor, 0, false); | |||||
} | |||||
if (!GVL_SmallStation.Station1Cylinder) | |||||
{ | |||||
TrayCylinder = SetBitValue(TrayCylinder, 1, true); | |||||
} | |||||
else | |||||
{ | |||||
TrayCylinder = SetBitValue(TrayCylinder, 0, false); | |||||
} | |||||
this.SiemensDevice.Siemens_PLC_S7.Write<bool>("DB2231.DBX28.4", GVL_SmallStation.WindSendAllowAGVPutGet); | |||||
this.SiemensDevice.Siemens_PLC_S7.Write<short>("DB2231.DBW190", TraySensor);//添加工位传感器的信号 | |||||
this.SiemensDevice.Siemens_PLC_S7.Write<short>("DB2231.DBW192", TrayCylinder);//添加工位气缸的信号 | |||||
if (SiemensDevice.XL_Status.AgvFinishPut == 1) | |||||
{ | |||||
GVL_SmallStation.AGV_PutTray1Finish = true; | |||||
} | |||||
if (SiemensDevice.XL_Status.AgvFinishGet == 1) | |||||
{ | |||||
GVL_SmallStation.AGV_GetTray1Finish = true; | |||||
} | |||||
} | } | ||||
} | } | ||||
/// <summary> | /// <summary> | ||||
@@ -687,85 +718,128 @@ namespace BPASmartClient.JXJFoodSmallStation.Model | |||||
/// </summary> | /// </summary> | ||||
private void ReceviceData() | private void ReceviceData() | ||||
{ | { | ||||
RemoteRecipes = Json<RemoteRecipeDataColl>.Data.Recipes; | |||||
if (RemoteRecipes.Count > 0) | |||||
if (!GVL_SmallStation.GetInstance.IsUseLocalRecipe) | |||||
{ | { | ||||
foreach (var data in RemoteRecipes) | |||||
RemoteRecipes = Json<RemoteRecipeDataColl>.Data.Recipes; | |||||
if (RemoteRecipes.Count > 0) | |||||
{ | { | ||||
if (data.TrayCode == 1) | |||||
foreach (var data in RemoteRecipes) | |||||
{ | { | ||||
if (!(RecipeQueue.Contains(data.RecipeCode))) | |||||
if (data.TrayCode == 1) | |||||
{ | { | ||||
if (SiemensDevice.XL_Status is XL_Status_DB status) | |||||
if (!(RecipeQueue.Contains(data.RecipeCode))) | |||||
{ | { | ||||
if (GVL_SmallStation.SiemensSendRecipeStatus == 3) | |||||
{ | |||||
GVL_SmallStation.SiemensSendRecipeStatus = 4; | |||||
SiemensDevice.Siemens_PLC_S7.WriteString(2231, data.RecipeCode,10); | |||||
SiemensDevice.Siemens_PLC_S7.Write("DB2231.DBX28.0",true); | |||||
} | |||||
if (GVL_SmallStation.SiemensSendRecipeStatus == 4) | |||||
if (SiemensDevice.XL_Status is XL_Status_DB status) | |||||
{ | { | ||||
if (SiemensDevice.XL_Status.Dosing_Confirm) | |||||
if (GVL_SmallStation.SiemensSendRecipeStatus == 3) | |||||
{ | { | ||||
GVL_SmallStation.SiemensSendRecipeStatus = 5; | |||||
SiemensDevice.Siemens_PLC_S7.WriteString(2231, "", 10); | |||||
SiemensDevice.Siemens_PLC_S7.Write("DB2231.DBX28.0", false); | |||||
GVL_SmallStation.SiemensSendRecipeStatus = 4; | |||||
SiemensDevice.Siemens_PLC_S7.WriteString(2231, data.RecipeCode, 10); | |||||
SiemensDevice.Siemens_PLC_S7.Write("DB2231.DBX28.0", true); | |||||
MessageNotify.GetInstance.ShowRunLog($"配方{data.RecipeCode},请求配料"); | |||||
} | } | ||||
} | |||||
if (GVL_SmallStation.SiemensSendRecipeStatus == 5) | |||||
{ | |||||
if (SiemensDevice.XL_Status.Dosing_Confirm == false) | |||||
if (GVL_SmallStation.SiemensSendRecipeStatus == 4) | |||||
{ | { | ||||
GVL_SmallStation.SiemensSendRecipeStatus = 6; | |||||
RecipeQueue.Enqueue(data.RecipeCode); | |||||
if (SiemensDevice.XL_Status.Dosing_Confirm) | |||||
{ | |||||
GVL_SmallStation.SiemensSendRecipeStatus = 5; | |||||
SiemensDevice.Siemens_PLC_S7.WriteString(2231, "", 10); | |||||
SiemensDevice.Siemens_PLC_S7.Write("DB2231.DBX28.0", false); | |||||
MessageNotify.GetInstance.ShowRunLog($"配方{data.RecipeCode},西门子确认配料"); | |||||
} | |||||
} | |||||
if (GVL_SmallStation.SiemensSendRecipeStatus == 5) | |||||
{ | |||||
if (SiemensDevice.XL_Status.Dosing_Confirm == false) | |||||
{ | |||||
RecipeQueue.Enqueue(data.RecipeCode); | |||||
GVL_SmallStation.SiemensSendRecipeStatus = 6; | |||||
MessageNotify.GetInstance.ShowRunLog($"配方{data.RecipeCode},加入队列"); | |||||
} | |||||
} | } | ||||
} | } | ||||
} | } | ||||
} | } | ||||
} | |||||
else if (data.TrayCode == 2) | |||||
{ | |||||
if (!(RecipeQueueTray2.Contains(data.RecipeCode))) | |||||
else if (data.TrayCode == 2) | |||||
{ | { | ||||
if (SiemensDevice.XL_Status is XL_Status_DB status) | |||||
if (!(RecipeQueueTray2.Contains(data.RecipeCode))) | |||||
{ | { | ||||
if (GVL_SmallStation.SiemensSendRecipeStatus == 3) | |||||
if (SiemensDevice.XL_Status is XL_Status_DB status) | |||||
{ | { | ||||
GVL_SmallStation.SiemensSendRecipeStatus = 4; | |||||
SiemensDevice.Siemens_PLC_S7.WriteString(2231, data.RecipeCode, 10); | |||||
SiemensDevice.Siemens_PLC_S7.Write("DB2231.DBX28.0", true); | |||||
} | |||||
if (GVL_SmallStation.SiemensSendRecipeStatus == 4) | |||||
{ | |||||
if (SiemensDevice.XL_Status.Dosing_Confirm) | |||||
if (GVL_SmallStation.SiemensSendRecipeStatus == 3) | |||||
{ | { | ||||
GVL_SmallStation.SiemensSendRecipeStatus = 5; | |||||
SiemensDevice.Siemens_PLC_S7.WriteString(2231, "", 10); | |||||
SiemensDevice.Siemens_PLC_S7.Write("DB2231.DBX28.0", false); | |||||
GVL_SmallStation.SiemensSendRecipeStatus = 4; | |||||
SiemensDevice.Siemens_PLC_S7.WriteString(2231, data.RecipeCode, 10); | |||||
SiemensDevice.Siemens_PLC_S7.Write("DB2231.DBX28.0", true); | |||||
} | } | ||||
} | |||||
if (GVL_SmallStation.SiemensSendRecipeStatus == 5) | |||||
{ | |||||
if (SiemensDevice.XL_Status.Dosing_Confirm == false) | |||||
if (GVL_SmallStation.SiemensSendRecipeStatus == 4) | |||||
{ | { | ||||
GVL_SmallStation.SiemensSendRecipeStatus = 0; | |||||
RecipeQueueTray2.Enqueue(data.RecipeCode); | |||||
if (SiemensDevice.XL_Status.Dosing_Confirm) | |||||
{ | |||||
GVL_SmallStation.SiemensSendRecipeStatus = 5; | |||||
SiemensDevice.Siemens_PLC_S7.WriteString(2231, "", 10); | |||||
SiemensDevice.Siemens_PLC_S7.Write("DB2231.DBX28.0", false); | |||||
} | |||||
} | |||||
if (GVL_SmallStation.SiemensSendRecipeStatus == 5) | |||||
{ | |||||
if (SiemensDevice.XL_Status.Dosing_Confirm == false) | |||||
{ | |||||
GVL_SmallStation.SiemensSendRecipeStatus = 0; | |||||
RecipeQueueTray2.Enqueue(data.RecipeCode); | |||||
} | |||||
} | } | ||||
} | } | ||||
} | } | ||||
} | } | ||||
} | } | ||||
} | } | ||||
else | |||||
{ | |||||
RecipeQueue.Clear(); | |||||
RecipeQueueTray2.Clear(); | |||||
GVL_SmallStation.GetInstance.RecipeStatusID = 0; | |||||
GVL_SmallStation.GetInstance.RecipeStatusIDTray2 = 0; | |||||
} | |||||
} | } | ||||
else | else | ||||
{ | { | ||||
RecipeQueue.Clear(); | |||||
RecipeQueueTray2.Clear(); | |||||
GVL_SmallStation.GetInstance.RecipeStatusID = 0; | |||||
GVL_SmallStation.GetInstance.RecipeStatusIDTray2 = 0; | |||||
RemoteRecipes = Json<RemoteRecipeDataColl>.Data.Recipes; | |||||
if (RemoteRecipes.Count > 0) | |||||
{ | |||||
foreach (var data in RemoteRecipes) | |||||
{ | |||||
if (data.TrayCode == 1) | |||||
{ | |||||
if (!(RecipeQueue.Contains(data.RecipeCode))) | |||||
{ | |||||
RecipeQueue.Enqueue(data.RecipeCode); | |||||
} | |||||
} | |||||
else if (data.TrayCode == 2) | |||||
{ | |||||
if (!(RecipeQueueTray2.Contains(data.RecipeCode))) | |||||
{ | |||||
RecipeQueueTray2.Enqueue(data.RecipeCode); | |||||
} | |||||
} | |||||
} | |||||
} | |||||
else | |||||
{ | |||||
RecipeQueue.Clear(); | |||||
RecipeQueueTray2.Clear(); | |||||
GVL_SmallStation.GetInstance.DosingTray1 = false; | |||||
GVL_SmallStation.GetInstance.DosingTray1Loc = 0; | |||||
GVL_SmallStation.GetInstance.DosingTray2 = false; | |||||
GVL_SmallStation.GetInstance.DosingTray2Loc = 0; | |||||
GVL_SmallStation.GetInstance.RecipeStatusID = 0; | |||||
GVL_SmallStation.GetInstance.RecipeStatusIDTray2 = 0; | |||||
} | |||||
} | } | ||||
} | } | ||||
/// <summary> | /// <summary> | ||||
@@ -773,7 +847,7 @@ namespace BPASmartClient.JXJFoodSmallStation.Model | |||||
/// </summary> | /// </summary> | ||||
private void RecipeInfoToHKPLC() | private void RecipeInfoToHKPLC() | ||||
{ | { | ||||
if (RecipeQueue.Count > 0) | |||||
if (RecipeQueue.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 == RecipeQueue.ElementAt(0)); | ||||
if (index >= 0 && index < RemoteRecipes.Count) | if (index >= 0 && index < RemoteRecipes.Count) | ||||
@@ -788,29 +862,29 @@ namespace BPASmartClient.JXJFoodSmallStation.Model | |||||
{ | { | ||||
if (GVL_SmallStation.GetInstance.IsUseWindSend) | if (GVL_SmallStation.GetInstance.IsUseWindSend) | ||||
{ | { | ||||
GVL_SmallStation.GetInstance.IsUseWindSend = false; | |||||
WindSendData.TargetRecipeCode = code; | WindSendData.TargetRecipeCode = code; | ||||
if (RemoteRecipes.ElementAt(index).WindSend.ElementAt(0).RawMaterialName == DeviceName.原料1.ToString()) | |||||
WindSendData.IsAllowDosing = true; | |||||
if (RemoteRecipes.ElementAt(index).WindSend.ElementAt(0).RawMaterialName == DeviceName.味精.ToString()) | |||||
{ | { | ||||
WindSendData.RawMaterial1_SetWeight = RemoteRecipes.ElementAt(index).WindSend.ElementAt(0).RawMaterialWeight; | WindSendData.RawMaterial1_SetWeight = RemoteRecipes.ElementAt(index).WindSend.ElementAt(0).RawMaterialWeight; | ||||
} | } | ||||
if (RemoteRecipes.ElementAt(index).WindSend.ElementAt(1).RawMaterialName == DeviceName.原料2.ToString()) | |||||
if (RemoteRecipes.ElementAt(index).WindSend.ElementAt(1).RawMaterialName == DeviceName.白糖.ToString()) | |||||
{ | { | ||||
WindSendData.RawMaterial2_SetWeight = RemoteRecipes.ElementAt(index).WindSend.ElementAt(1).RawMaterialWeight; | WindSendData.RawMaterial2_SetWeight = RemoteRecipes.ElementAt(index).WindSend.ElementAt(1).RawMaterialWeight; | ||||
} | } | ||||
if (RemoteRecipes.ElementAt(index).WindSend.ElementAt(2).RawMaterialName == DeviceName.原料3.ToString()) | |||||
if (RemoteRecipes.ElementAt(index).WindSend.ElementAt(2).RawMaterialName == DeviceName.食盐.ToString()) | |||||
{ | { | ||||
WindSendData.RawMaterial3_SetWeight = RemoteRecipes.ElementAt(index).WindSend.ElementAt(2).RawMaterialWeight; | WindSendData.RawMaterial3_SetWeight = RemoteRecipes.ElementAt(index).WindSend.ElementAt(2).RawMaterialWeight; | ||||
} | } | ||||
if (RemoteRecipes.ElementAt(index).WindSend.ElementAt(3).RawMaterialName == DeviceName.原料4.ToString()) | |||||
if (RemoteRecipes.ElementAt(index).WindSend.ElementAt(3).RawMaterialName == DeviceName.芽菜香料粉.ToString()) | |||||
{ | { | ||||
WindSendData.RawMaterial4_SetWeight = RemoteRecipes.ElementAt(index).WindSend.ElementAt(3).RawMaterialWeight; | WindSendData.RawMaterial4_SetWeight = RemoteRecipes.ElementAt(index).WindSend.ElementAt(3).RawMaterialWeight; | ||||
} | } | ||||
if (RemoteRecipes.ElementAt(index).WindSend.ElementAt(4).RawMaterialName == DeviceName.原料5.ToString()) | |||||
if (RemoteRecipes.ElementAt(index).WindSend.ElementAt(4).RawMaterialName == DeviceName.香料A.ToString()) | |||||
{ | { | ||||
WindSendData.RawMaterial5_SetWeight = RemoteRecipes.ElementAt(index).WindSend.ElementAt(4).RawMaterialWeight; | WindSendData.RawMaterial5_SetWeight = RemoteRecipes.ElementAt(index).WindSend.ElementAt(4).RawMaterialWeight; | ||||
} | } | ||||
WindSendDevice.Siemens_PLC_S7.WriteClass<XL_WindSendData_DB>(WindSendData, 5); | |||||
WindSendDevice.Siemens_PLC_S7.WriteClass<WindSend_Write>(WindSendData, 5); | |||||
} | } | ||||
foreach (var item in RemoteRecipes.ElementAt(index).RawMaterial) | foreach (var item in RemoteRecipes.ElementAt(index).RawMaterial) | ||||
{ | { | ||||
@@ -819,102 +893,102 @@ namespace BPASmartClient.JXJFoodSmallStation.Model | |||||
HKDevice.HK_PLC_S7.Write("DB4.DBX1.3", true); | HKDevice.HK_PLC_S7.Write("DB4.DBX1.3", true); | ||||
GVL_SmallStation.GetInstance.RecipeStatusID = 1; | GVL_SmallStation.GetInstance.RecipeStatusID = 1; | ||||
MessageNotify.GetInstance.ShowRunLog($"托盘1,配方:{recipeName},下发完成"); | MessageNotify.GetInstance.ShowRunLog($"托盘1,配方:{recipeName},下发完成"); | ||||
HKDevice.HK_PLC_S7.Write("DB3.DBX1.3", true); | |||||
GVL_SmallStation.GetInstance.time1 = DateTime.Now; | |||||
} | } | ||||
if (HKDevice.HK_PLC_S7.Read<bool>("DB3.DBX1.3") && GVL_SmallStation.GetInstance.RecipeStatusID == 1) | if (HKDevice.HK_PLC_S7.Read<bool>("DB3.DBX1.3") && GVL_SmallStation.GetInstance.RecipeStatusID == 1) | ||||
{ | { | ||||
HKDevice.HK_PLC_S7.Write("DB3.DBX1.3", false); | |||||
HKDevice.HK_PLC_S7.Write("DB4.DBX1.3", false); | |||||
GVL_SmallStation.GetInstance.RecipeStatusID = 2; | GVL_SmallStation.GetInstance.RecipeStatusID = 2; | ||||
MessageNotify.GetInstance.ShowRunLog($"托盘1,{ recipeName}plc端 配方接收完成"); | MessageNotify.GetInstance.ShowRunLog($"托盘1,{ recipeName}plc端 配方接收完成"); | ||||
} | } | ||||
if (GVL_SmallStation.GetInstance.RecipeStatusID == 2) | if (GVL_SmallStation.GetInstance.RecipeStatusID == 2) | ||||
{ | { | ||||
if (RTrig.GetInstance("DB3.DBX50.0").Start(HKDevice.HK_PLC_S7.Read<bool>("DB3.DBX50.0"))) | |||||
if (GVL_SmallStation.GetInstance.DosingTray1 == false && GVL_SmallStation.GetInstance.DosingTray1Loc == 0) | |||||
{ | { | ||||
var res = HKDevice.HK_PLC_S7.Read<float>("DB3.DBD10"); | |||||
MessageNotify.GetInstance.ShowRunLog($"托盘1,配方:{recipeName},1号桶,{res}料仓,允许配料"); | |||||
if (res > 0 && res is float loc) | |||||
if (RTrig.GetInstance("DB3.DBX50.0").Start(HKDevice.HK_PLC_S7.Read<bool>("DB3.DBX50.0"))) | |||||
{ | { | ||||
int loc_index = Array.FindIndex(RemoteRecipes.ElementAt(index).RawMaterial.ToArray(), p => p.RawMaterialLocation == loc); | |||||
float weight = RemoteRecipes.ElementAt(index).RawMaterial.ElementAt(loc_index).RawMaterialWeight; | |||||
if (loc_index >= 0) | |||||
var res = HKDevice.HK_PLC_S7.Read<float>("DB3.DBD10"); | |||||
MessageNotify.GetInstance.ShowRunLog($"托盘1,配方:{recipeName},1号桶,{res}料仓,允许配料"); | |||||
if (res > 0 && res is float loc) | |||||
{ | { | ||||
DeviceInquire.GetInstance.GetDevice((int)loc)?.Start(weight);//根据料仓编号 启动并写入每个原料重量 | |||||
GVL_SmallStation.GetInstance.StockInIsWork = (int)loc; | |||||
//HKDevice.HK_PLC_S7.Write("DB3.DBX50.0", false); | |||||
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;//单位g转换kg | |||||
if (loc_index >= 0) | |||||
{ | |||||
DeviceInquire.GetInstance.GetDevice((int)loc)?.Start(weight);//根据料仓编号 启动并写入每个原料重量 | |||||
GVL_SmallStation.GetInstance.StockInIsWork = (int)loc; | |||||
} | |||||
GVL_SmallStation.GetInstance.DosingTray1 = true; | |||||
GVL_SmallStation.GetInstance.DosingTray1Loc = (int)loc; | |||||
MessageNotify.GetInstance.ShowRunLog($"托盘1,配方:{recipeName},1号桶,{(int)loc}号仓,配料完成"); | |||||
} | } | ||||
GVL_SmallStation.GetInstance.DosingTray1 = true; | |||||
GVL_SmallStation.GetInstance.DosingTray1Loc = (int)loc; | |||||
MessageNotify.GetInstance.ShowRunLog($"托盘1,配方:{recipeName},1号桶,{(int)loc}号仓,配料完成"); | |||||
} | } | ||||
} | |||||
else if(RTrig.GetInstance("DB3.DBX50.1").Start(HKDevice.HK_PLC_S7.Read<bool>("DB3.DBX50.1"))) | |||||
{ | |||||
var res = HKDevice.HK_PLC_S7.Read<float>("DB3.DBD14"); | |||||
MessageNotify.GetInstance.ShowRunLog($"托盘1,配方:{recipeName},2号桶,{res}料仓,允许配料"); | |||||
if (res > 0 && res is float loc) | |||||
else if (RTrig.GetInstance("DB3.DBX50.1").Start(HKDevice.HK_PLC_S7.Read<bool>("DB3.DBX50.1"))) | |||||
{ | { | ||||
int loc_index = Array.FindIndex(RemoteRecipes.ElementAt(index).RawMaterial.ToArray(), p => p.RawMaterialLocation == loc); | |||||
float weight = RemoteRecipes.ElementAt(index).RawMaterial.ElementAt(loc_index).RawMaterialWeight; | |||||
if (loc_index >= 0) | |||||
var res = HKDevice.HK_PLC_S7.Read<float>("DB3.DBD14"); | |||||
MessageNotify.GetInstance.ShowRunLog($"托盘1,配方:{recipeName},2号桶,{res}料仓,允许配料"); | |||||
if (res > 0 && res is float loc) | |||||
{ | { | ||||
DeviceInquire.GetInstance.GetDevice((int)loc)?.Start(weight);//启动并写入每个原料重量 | |||||
GVL_SmallStation.GetInstance.StockInIsWork = (int)loc; | |||||
//HKDevice.HK_PLC_S7.Write("DB3.DBX50.1", false); | |||||
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; | |||||
if (loc_index >= 0) | |||||
{ | |||||
DeviceInquire.GetInstance.GetDevice((int)loc)?.Start(weight);//启动并写入每个原料重量 | |||||
GVL_SmallStation.GetInstance.StockInIsWork = (int)loc; | |||||
} | |||||
GVL_SmallStation.GetInstance.DosingTray1 = true; | |||||
GVL_SmallStation.GetInstance.DosingTray1Loc = (int)loc; | |||||
MessageNotify.GetInstance.ShowRunLog($"托盘1,配方:{recipeName},2号桶,{(int)loc}号仓,配料完成"); | |||||
} | } | ||||
GVL_SmallStation.GetInstance.DosingTray1 = true; | |||||
GVL_SmallStation.GetInstance.DosingTray1Loc = (int)loc; | |||||
MessageNotify.GetInstance.ShowRunLog($"托盘1,配方:{recipeName},2号桶,{(int)loc}号仓,配料完成"); | |||||
} | } | ||||
} | |||||
else if (RTrig.GetInstance("DB3.DBX50.2").Start(HKDevice.HK_PLC_S7.Read<bool>("DB3.DBX50.2"))) | |||||
{ | |||||
var res = HKDevice.HK_PLC_S7.Read<float>("DB3.DBD18"); | |||||
MessageNotify.GetInstance.ShowRunLog($"托盘1,配方:{recipeName},3号桶,{res}料仓,允许配料"); | |||||
if (res > 0 && res is float loc) | |||||
else if (RTrig.GetInstance("DB3.DBX50.2").Start(HKDevice.HK_PLC_S7.Read<bool>("DB3.DBX50.2"))) | |||||
{ | { | ||||
int loc_index = Array.FindIndex(RemoteRecipes.ElementAt(index).RawMaterial.ToArray(), p => p.RawMaterialLocation == loc); | |||||
float weight = RemoteRecipes.ElementAt(index).RawMaterial.ElementAt(loc_index).RawMaterialWeight; | |||||
if (loc_index >= 0) | |||||
var res = HKDevice.HK_PLC_S7.Read<float>("DB3.DBD18"); | |||||
MessageNotify.GetInstance.ShowRunLog($"托盘1,配方:{recipeName},3号桶,{res}料仓,允许配料"); | |||||
if (res > 0 && res is float loc) | |||||
{ | { | ||||
DeviceInquire.GetInstance.GetDevice((int)loc)?.Start(weight);//启动并写入每个原料重量 | |||||
GVL_SmallStation.GetInstance.StockInIsWork = (int)loc; | |||||
//HKDevice.HK_PLC_S7.Write("DB3.DBX50.2", false); | |||||
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; | |||||
if (loc_index >= 0) | |||||
{ | |||||
DeviceInquire.GetInstance.GetDevice((int)loc)?.Start(weight);//启动并写入每个原料重量 | |||||
GVL_SmallStation.GetInstance.StockInIsWork = (int)loc; | |||||
} | |||||
GVL_SmallStation.GetInstance.DosingTray1 = true; | |||||
GVL_SmallStation.GetInstance.DosingTray1Loc = (int)loc; | |||||
MessageNotify.GetInstance.ShowRunLog($"托盘1,配方:{recipeName},3号桶,{(int)loc}号仓,配料完成"); | |||||
} | } | ||||
GVL_SmallStation.GetInstance.DosingTray1 = true; | |||||
GVL_SmallStation.GetInstance.DosingTray1Loc = (int)loc; | |||||
MessageNotify.GetInstance.ShowRunLog($"托盘1,配方:{recipeName},3号桶,{(int)loc}号仓,配料完成"); | |||||
} | } | ||||
} | |||||
else if (RTrig.GetInstance("DB3.DBX50.3").Start(HKDevice.HK_PLC_S7.Read<bool>("DB3.DBX50.3"))) | |||||
{ | |||||
var res = HKDevice.HK_PLC_S7.Read<float>("DB3.DBD22"); | |||||
MessageNotify.GetInstance.ShowRunLog($"托盘1,配方:{recipeName},4号桶,{res}料仓,允许配料"); | |||||
if (res > 0 && res is float loc) | |||||
else if (RTrig.GetInstance("DB3.DBX50.3").Start(HKDevice.HK_PLC_S7.Read<bool>("DB3.DBX50.3"))) | |||||
{ | { | ||||
int loc_index = Array.FindIndex(RemoteRecipes.ElementAt(index).RawMaterial.ToArray(), p => p.RawMaterialLocation == loc); | |||||
float weight = RemoteRecipes.ElementAt(index).RawMaterial.ElementAt(loc_index).RawMaterialWeight; | |||||
if (loc_index >= 0) | |||||
var res = HKDevice.HK_PLC_S7.Read<float>("DB3.DBD22"); | |||||
MessageNotify.GetInstance.ShowRunLog($"托盘1,配方:{recipeName},4号桶,{res}料仓,允许配料"); | |||||
if (res > 0 && res is float loc) | |||||
{ | { | ||||
DeviceInquire.GetInstance.GetDevice((int)loc)?.Start(weight);//启动并写入每个原料重量 | |||||
GVL_SmallStation.GetInstance.StockInIsWork = (int)loc; | |||||
//HKDevice.HK_PLC_S7.Write("DB3.DBX50.3", false); | |||||
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; | |||||
if (loc_index >= 0) | |||||
{ | |||||
DeviceInquire.GetInstance.GetDevice((int)loc)?.Start(weight);//启动并写入每个原料重量 | |||||
GVL_SmallStation.GetInstance.StockInIsWork = (int)loc; | |||||
} | |||||
GVL_SmallStation.GetInstance.DosingTray1 = true; | |||||
GVL_SmallStation.GetInstance.DosingTray1Loc = (int)loc; | |||||
MessageNotify.GetInstance.ShowRunLog($"托盘1,配方:{recipeName},4号桶,{(int)loc}号仓,配料完成"); | |||||
} | } | ||||
GVL_SmallStation.GetInstance.DosingTray1 = true; | |||||
GVL_SmallStation.GetInstance.DosingTray1Loc = (int)loc; | |||||
MessageNotify.GetInstance.ShowRunLog($"托盘1,配方:{recipeName},4号桶,{(int)loc}号仓,配料完成"); | |||||
} | } | ||||
} | } | ||||
if (GVL_SmallStation.GetInstance.DosingTray1 && GVL_SmallStation.GetInstance.DosingTray1Loc > 0 && GVL_SmallStation.GetInstance.DosingTray1Loc < 16) | if (GVL_SmallStation.GetInstance.DosingTray1 && GVL_SmallStation.GetInstance.DosingTray1Loc > 0 && GVL_SmallStation.GetInstance.DosingTray1Loc < 16) | ||||
{ | { | ||||
int i = GVL_SmallStation.GetInstance.DosingTray1Loc; | int i = GVL_SmallStation.GetInstance.DosingTray1Loc; | ||||
if (RTrig.GetInstance("Tray1StatusDevice" + i).Start(DeviceInquire.GetInstance.GetDevice(i).deviceStatus.RunStatus == 3)) | |||||
if (DeviceInquire.GetInstance.GetDevice(i).deviceStatus.RunStatus == 3) | |||||
{ | { | ||||
MessageNotify.GetInstance.ShowRunLog($"柔性味魔方,托盘1,配方:{recipeName},{i}号仓,配料完成"); | MessageNotify.GetInstance.ShowRunLog($"柔性味魔方,托盘1,配方:{recipeName},{i}号仓,配料完成"); | ||||
int res = Array.FindIndex(RemoteRecipes.ElementAt(index).RawMaterial.ToArray(), p => p.RawMaterialLocation == i); | int res = Array.FindIndex(RemoteRecipes.ElementAt(index).RawMaterial.ToArray(), p => p.RawMaterialLocation == i); | ||||
RemoteRecipes.ElementAt(index).RawMaterial.ElementAt(res).Laying_Off_Weight = DeviceInquire.GetInstance.GetDevice(i).deviceStatus.CutWeightFeedback; | |||||
RemoteRecipes.ElementAt(index).RawMaterial.ElementAt(res).Laying_Off_Weight = DeviceInquire.GetInstance.GetDevice(i).deviceStatus.NowWeightFeedback; | |||||
bool info = DeviceInquire.GetInstance.GetDevice(i).StatusReset(); | bool info = DeviceInquire.GetInstance.GetDevice(i).StatusReset(); | ||||
MessageNotify.GetInstance.ShowRunLog($"柔性味魔方,托盘1,配方:{recipeName},{i}号仓,下料完成重量:{RemoteRecipes.ElementAt(index).RawMaterial.ElementAt(res).Laying_Off_Weight}"); | |||||
if (info) | if (info) | ||||
{ | { | ||||
MessageNotify.GetInstance.ShowRunLog($"柔性味魔方配料完成后复位 发送成功"); | MessageNotify.GetInstance.ShowRunLog($"柔性味魔方配料完成后复位 发送成功"); | ||||
@@ -936,12 +1010,15 @@ namespace BPASmartClient.JXJFoodSmallStation.Model | |||||
GVL_SmallStation.GetInstance.DosingTray1 = false; | GVL_SmallStation.GetInstance.DosingTray1 = false; | ||||
GVL_SmallStation.GetInstance.DosingTray1Loc = 0; | GVL_SmallStation.GetInstance.DosingTray1Loc = 0; | ||||
} | } | ||||
} | } | ||||
if ((RTrig.GetInstance("配方配料完成").Start(HKDevice.HK_PLC_S7.Read<bool>("DB3.DBX1.1")) && (GVL_SmallStation.GetInstance.WindSendDosingFinish || !GVL_SmallStation.GetInstance.IsUseWindSend)) || GVL_SmallStation.GetInstance.RecipeStatusID == 5) | |||||
if ((RTrig.GetInstance("配方配料完成").Start(HKDevice.HK_PLC_S7.Read<bool>("DB3.DBX1.1")))) | |||||
{ | { | ||||
var res = Json<RemoteRecipeDataColl>.Data.Recipes.FirstOrDefault(p => p.RecipeCode == code); | var res = Json<RemoteRecipeDataColl>.Data.Recipes.FirstOrDefault(p => p.RecipeCode == code); | ||||
MessageNotify.GetInstance.ShowRunLog($"托盘1,配方{res.RecipeName},配料完成"); | MessageNotify.GetInstance.ShowRunLog($"托盘1,配方{res.RecipeName},配料完成"); | ||||
foreach (var item in RemoteRecipes.ElementAt(index).RawMaterial) | |||||
{ | |||||
MessageNotify.GetInstance.ShowRunLog($"{item.RawMaterialName},下料重量:{item.Laying_Off_Weight}g"); | |||||
} | |||||
if (SiemensDevice.IsConnected) | if (SiemensDevice.IsConnected) | ||||
{ | { | ||||
RecipeFinishInfo.Order_No = RemoteRecipes.ElementAt(index).RecipeCode; | RecipeFinishInfo.Order_No = RemoteRecipes.ElementAt(index).RecipeCode; | ||||
@@ -959,16 +1036,18 @@ namespace BPASmartClient.JXJFoodSmallStation.Model | |||||
{ | { | ||||
RecipeFinishInfo.Material[i].Material_Name = RemoteRecipes.ElementAt(index).RawMaterial.ElementAt(i).RawMaterialName; | RecipeFinishInfo.Material[i].Material_Name = RemoteRecipes.ElementAt(index).RawMaterial.ElementAt(i).RawMaterialName; | ||||
RecipeFinishInfo.Material[i].Material_BarrelNum = RemoteRecipes.ElementAt(index).RawMaterial.ElementAt(i).RawMaterialBarrelNum; | RecipeFinishInfo.Material[i].Material_BarrelNum = RemoteRecipes.ElementAt(index).RawMaterial.ElementAt(i).RawMaterialBarrelNum; | ||||
RecipeFinishInfo.Material[i].Material_Laying_Off_Weight = RemoteRecipes.ElementAt(index).RawMaterial.ElementAt(i).Laying_Off_Weight; | |||||
RecipeFinishInfo.Material[i].Material_Laying_Off_Weight = RemoteRecipes.ElementAt(index).RawMaterial.ElementAt(i).Laying_Off_Weight * (float)0.001; | |||||
} | } | ||||
for (int i = 0; i < RemoteRecipes.ElementAt(index).WindSend.Count; i++) | for (int i = 0; i < RemoteRecipes.ElementAt(index).WindSend.Count; i++) | ||||
{ | { | ||||
RecipeFinishInfo.Powder[i].Powder_Weight = RemoteRecipes.ElementAt(index).WindSend.ElementAt(i).DosingCompleWeight; | |||||
} | } | ||||
if (GVL_SmallStation.SiemensSendRecipeStatus == 6) | if (GVL_SmallStation.SiemensSendRecipeStatus == 6) | ||||
{ | { | ||||
double a = DateTime.Now.Subtract(GVL_SmallStation.GetInstance.time1).TotalSeconds; | |||||
GVL_SmallStation.SiemensSendRecipeStatus = 7; | GVL_SmallStation.SiemensSendRecipeStatus = 7; | ||||
RecipeFinishInfo.Ask_For_Finish = true; | RecipeFinishInfo.Ask_For_Finish = true; | ||||
RecipeFinishInfo.DosingTime = Convert.ToInt16(a); | |||||
SiemensDevice.Siemens_PLC_S7.WriteClass<XL_Finish_DB>(RecipeFinishInfo, 2261); | SiemensDevice.Siemens_PLC_S7.WriteClass<XL_Finish_DB>(RecipeFinishInfo, 2261); | ||||
} | } | ||||
} | } | ||||
@@ -984,7 +1063,7 @@ namespace BPASmartClient.JXJFoodSmallStation.Model | |||||
} | } | ||||
} | } | ||||
} | } | ||||
if (RecipeQueueTray2.Count > 0) | |||||
if (RecipeQueueTray2.Count > 0 && GVL_SmallStation.Station2HaveTray) | |||||
{ | { | ||||
int index = Array.FindIndex(RemoteRecipes.ToArray(), p => p.RecipeCode == RecipeQueueTray2.ElementAt(0)); | int index = Array.FindIndex(RemoteRecipes.ToArray(), p => p.RecipeCode == RecipeQueueTray2.ElementAt(0)); | ||||
if (index >= 0 && index < RemoteRecipes.Count) | if (index >= 0 && index < RemoteRecipes.Count) | ||||
@@ -1004,7 +1083,6 @@ namespace BPASmartClient.JXJFoodSmallStation.Model | |||||
HKDevice.HK_PLC_S7.Write("DB4.DBX1.4", true); | HKDevice.HK_PLC_S7.Write("DB4.DBX1.4", true); | ||||
GVL_SmallStation.GetInstance.RecipeStatusIDTray2 = 1; | GVL_SmallStation.GetInstance.RecipeStatusIDTray2 = 1; | ||||
MessageNotify.GetInstance.ShowRunLog($"托盘2,配方:{recipeName},下发完成"); | MessageNotify.GetInstance.ShowRunLog($"托盘2,配方:{recipeName},下发完成"); | ||||
HKDevice.HK_PLC_S7.Write("DB3.DBX1.4", true); | |||||
} | } | ||||
if (HKDevice.HK_PLC_S7.Read<bool>("DB3.DBX1.4") && GVL_SmallStation.GetInstance.RecipeStatusIDTray2 == 1) | if (HKDevice.HK_PLC_S7.Read<bool>("DB3.DBX1.4") && GVL_SmallStation.GetInstance.RecipeStatusIDTray2 == 1) | ||||
@@ -1021,14 +1099,12 @@ namespace BPASmartClient.JXJFoodSmallStation.Model | |||||
MessageNotify.GetInstance.ShowRunLog($"托盘2,配方:{recipeName},1号桶,{res}料仓,允许配料"); | MessageNotify.GetInstance.ShowRunLog($"托盘2,配方:{recipeName},1号桶,{res}料仓,允许配料"); | ||||
if (res > 0 && res is float loc) | if (res > 0 && res is float loc) | ||||
{ | { | ||||
//int decimalNum = Convert.ToInt32(loc.ToString().Substring(loc.ToString().IndexOf(".") + 1)); | |||||
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); | ||||
double weight = RemoteRecipes.ElementAt(index).RawMaterial.ElementAt(loc_index).RawMaterialWeight; | double weight = RemoteRecipes.ElementAt(index).RawMaterial.ElementAt(loc_index).RawMaterialWeight; | ||||
if (loc_index >= 0) | if (loc_index >= 0) | ||||
{ | { | ||||
DeviceInquire.GetInstance.GetDevice((int)loc)?.Start((uint)weight);//根据料仓编号 启动并写入每个原料重量 | DeviceInquire.GetInstance.GetDevice((int)loc)?.Start((uint)weight);//根据料仓编号 启动并写入每个原料重量 | ||||
GVL_SmallStation.GetInstance.StockInIsWork = (int)loc; | GVL_SmallStation.GetInstance.StockInIsWork = (int)loc; | ||||
//HKDevice.HK_PLC_S7.Write("DB3.DBX50.0", false); | |||||
} | } | ||||
GVL_SmallStation.GetInstance.DosingTray2 = true; | GVL_SmallStation.GetInstance.DosingTray2 = true; | ||||
GVL_SmallStation.GetInstance.DosingTray2Loc = (int)loc; | GVL_SmallStation.GetInstance.DosingTray2Loc = (int)loc; | ||||
@@ -1047,7 +1123,6 @@ namespace BPASmartClient.JXJFoodSmallStation.Model | |||||
{ | { | ||||
DeviceInquire.GetInstance.GetDevice((int)loc)?.Start((uint)weight);//启动并写入每个原料重量 | DeviceInquire.GetInstance.GetDevice((int)loc)?.Start((uint)weight);//启动并写入每个原料重量 | ||||
GVL_SmallStation.GetInstance.StockInIsWork = (int)loc; | GVL_SmallStation.GetInstance.StockInIsWork = (int)loc; | ||||
//HKDevice.HK_PLC_S7.Write("DB3.DBX50.5", false); | |||||
} | } | ||||
GVL_SmallStation.GetInstance.DosingTray2 = true; | GVL_SmallStation.GetInstance.DosingTray2 = true; | ||||
GVL_SmallStation.GetInstance.DosingTray2Loc = (int)loc; | GVL_SmallStation.GetInstance.DosingTray2Loc = (int)loc; | ||||
@@ -1066,7 +1141,6 @@ namespace BPASmartClient.JXJFoodSmallStation.Model | |||||
{ | { | ||||
DeviceInquire.GetInstance.GetDevice((int)loc)?.Start((uint)weight);//启动并写入每个原料重量 | DeviceInquire.GetInstance.GetDevice((int)loc)?.Start((uint)weight);//启动并写入每个原料重量 | ||||
GVL_SmallStation.GetInstance.StockInIsWork = (int)loc; | GVL_SmallStation.GetInstance.StockInIsWork = (int)loc; | ||||
//HKDevice.HK_PLC_S7.Write("DB3.DBX50.6", false); | |||||
} | } | ||||
GVL_SmallStation.GetInstance.DosingTray2 = true; | GVL_SmallStation.GetInstance.DosingTray2 = true; | ||||
GVL_SmallStation.GetInstance.DosingTray2Loc = (int)loc; | GVL_SmallStation.GetInstance.DosingTray2Loc = (int)loc; | ||||
@@ -1085,7 +1159,6 @@ namespace BPASmartClient.JXJFoodSmallStation.Model | |||||
{ | { | ||||
DeviceInquire.GetInstance.GetDevice((int)loc)?.Start((uint)weight);//启动并写入每个原料重量 | DeviceInquire.GetInstance.GetDevice((int)loc)?.Start((uint)weight);//启动并写入每个原料重量 | ||||
GVL_SmallStation.GetInstance.StockInIsWork = (int)loc; | GVL_SmallStation.GetInstance.StockInIsWork = (int)loc; | ||||
//HKDevice.HK_PLC_S7.Write("DB3.DBX50.7", false); | |||||
} | } | ||||
GVL_SmallStation.GetInstance.DosingTray2 = true; | GVL_SmallStation.GetInstance.DosingTray2 = true; | ||||
GVL_SmallStation.GetInstance.DosingTray2Loc = (int)loc; | GVL_SmallStation.GetInstance.DosingTray2Loc = (int)loc; | ||||
@@ -1099,7 +1172,7 @@ namespace BPASmartClient.JXJFoodSmallStation.Model | |||||
{ | { | ||||
MessageNotify.GetInstance.ShowRunLog($"柔性味魔方,托盘2,配方:{recipeName},{i}号仓,配料完成"); | MessageNotify.GetInstance.ShowRunLog($"柔性味魔方,托盘2,配方:{recipeName},{i}号仓,配料完成"); | ||||
int res = Array.FindIndex(RemoteRecipes.ElementAt(index).RawMaterial.ToArray(), p => p.RawMaterialLocation == i); | int res = Array.FindIndex(RemoteRecipes.ElementAt(index).RawMaterial.ToArray(), p => p.RawMaterialLocation == i); | ||||
RemoteRecipes.ElementAt(index).RawMaterial.ElementAt(res).Laying_Off_Weight = DeviceInquire.GetInstance.GetDevice(i).deviceStatus.CutWeightFeedback; | |||||
RemoteRecipes.ElementAt(index).RawMaterial.ElementAt(res).Laying_Off_Weight = DeviceInquire.GetInstance.GetDevice(i).deviceStatus.NowWeightFeedback; | |||||
bool info = DeviceInquire.GetInstance.GetDevice(i).StatusReset(); | bool info = DeviceInquire.GetInstance.GetDevice(i).StatusReset(); | ||||
if (info) | if (info) | ||||
{ | { | ||||
@@ -1184,7 +1257,7 @@ namespace BPASmartClient.JXJFoodSmallStation.Model | |||||
} | } | ||||
private void testData() | private void testData() | ||||
{ | { | ||||
RawMaterialsNamePos.Add("0041", 1); | |||||
/*RawMaterialsNamePos.Add("0041", 1); | |||||
RawMaterialsNamePos.Add("0042", 2); | RawMaterialsNamePos.Add("0042", 2); | ||||
RawMaterialsNamePos.Add("0043", 3); | RawMaterialsNamePos.Add("0043", 3); | ||||
RawMaterialsNamePos.Add("0044", 4); | RawMaterialsNamePos.Add("0044", 4); | ||||
@@ -1203,7 +1276,24 @@ namespace BPASmartClient.JXJFoodSmallStation.Model | |||||
RawMaterialsNamePos.Add("0057", 15); | RawMaterialsNamePos.Add("0057", 15); | ||||
RawMaterialsNamePos.Add("0058", 15); | RawMaterialsNamePos.Add("0058", 15); | ||||
RawMaterialsNamePos.Add("0059", 15); | RawMaterialsNamePos.Add("0059", 15); | ||||
RawMaterialsNamePos.Add("0060", 15); | |||||
RawMaterialsNamePos.Add("0060", 15);*/ | |||||
RawMaterialsNamePos.Add("0051", 3); | |||||
RawMaterialsNamePos.Add("0052", 4); | |||||
RawMaterialsNamePos.Add("0054", 5); | |||||
RawMaterialsNamePos.Add("0057", 6); | |||||
RawMaterialsNamePos.Add("0050", 8); | |||||
RawMaterialsNamePos.Add("0048", 13); | |||||
} | |||||
public short SetBitValue(short data, byte offset, bool val) | |||||
{ | |||||
if (offset > 16 || offset < 1) | |||||
{ | |||||
return data; | |||||
} | |||||
short num = (short)(1 << offset - 1); | |||||
return (short)(val ? (data | num) : (data & ~num)); | |||||
} | } | ||||
} | } | ||||
} | } |
@@ -11,6 +11,7 @@ using System.Linq; | |||||
using System.Net.NetworkInformation; | using System.Net.NetworkInformation; | ||||
using System.Threading; | using System.Threading; | ||||
using System.Threading.Tasks; | using System.Threading.Tasks; | ||||
using System.Configuration; | |||||
namespace BPASmartClient.JXJFoodSmallStation.Model | namespace BPASmartClient.JXJFoodSmallStation.Model | ||||
{ | { | ||||
@@ -20,9 +21,9 @@ namespace BPASmartClient.JXJFoodSmallStation.Model | |||||
public static DeviceInquire GetInstance => _Instance ?? (_Instance = new DeviceInquire()); | public static DeviceInquire GetInstance => _Instance ?? (_Instance = new DeviceInquire()); | ||||
private DeviceInquire() { } | private DeviceInquire() { } | ||||
string IPSegment = "192.168.0."; | |||||
string IPSegment = "107.107.2."; | |||||
ConcurrentDictionary<string, DeviceStatus> DeviceLists = new ConcurrentDictionary<string, DeviceStatus>(); | |||||
ConcurrentDictionary<string, DeviceStatus> DeviceLists = new ConcurrentDictionary<string, DeviceStatus>(); | |||||
List<string> InvalidIP = new List<string>();//无效 IP 集合 | List<string> InvalidIP = new List<string>();//无效 IP 集合 | ||||
List<string> IPLists = new List<string>();//启动 Ping 任务IP集合 | List<string> IPLists = new List<string>();//启动 Ping 任务IP集合 | ||||
ConcurrentQueue<string> IPQueues = new ConcurrentQueue<string>();//pincomplete 完成队列 | ConcurrentQueue<string> IPQueues = new ConcurrentQueue<string>();//pincomplete 完成队列 | ||||
@@ -102,8 +103,8 @@ namespace BPASmartClient.JXJFoodSmallStation.Model | |||||
{ | { | ||||
//AlarmHelper<AlarmInfo>.Init(); | //AlarmHelper<AlarmInfo>.Init(); | ||||
//AlarmHelper<AlarmInfo>.Alarm.EStop1 = true; | //AlarmHelper<AlarmInfo>.Alarm.EStop1 = true; | ||||
TestData(); | |||||
//IPSegment = ConfigurationManager.AppSettings["RawMaterial_IP"]; | |||||
//TestData(); | |||||
IpAddressLines(); | IpAddressLines(); | ||||
DeviceDataInit(); | DeviceDataInit(); | ||||
ThreadManage.GetInstance().StartLong(new Action(() => | ThreadManage.GetInstance().StartLong(new Action(() => | ||||
@@ -152,13 +153,18 @@ namespace BPASmartClient.JXJFoodSmallStation.Model | |||||
{ | { | ||||
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}")) | |||||
{ | |||||
IPLists.Add($"{IPSegment}{i}"); | |||||
} | |||||
}*/ | |||||
for (int i = 0; i < 15; i++) | |||||
{ | { | ||||
if (!InvalidIP.Contains($"{IPSegment}{i}") && !DeviceLists.ContainsKey($"{IPSegment}{i}")) | |||||
{ | |||||
IPLists.Add($"{IPSegment}{i}"); | |||||
} | |||||
IPLists.Add($"{IPSegment}{i + 69}"); | |||||
} | } | ||||
IPLists.ForEach((item) => | IPLists.ForEach((item) => | ||||
{ | { | ||||
@@ -260,7 +266,12 @@ namespace BPASmartClient.JXJFoodSmallStation.Model | |||||
})); | })); | ||||
} | } | ||||
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(() => | ||||
@@ -317,8 +328,8 @@ namespace BPASmartClient.JXJFoodSmallStation.Model | |||||
// if (ushortValue.Length >= 1) deviceStatus.RunStatus = ushortValue[0]; | // if (ushortValue.Length >= 1) deviceStatus.RunStatus = ushortValue[0]; | ||||
//} | //} | ||||
deviceStatus.RunStatus = (ushort)this.modbusTcp.ReadShort(DeviceAddress.RunStatus); //获取设备运行状态 | deviceStatus.RunStatus = (ushort)this.modbusTcp.ReadShort(DeviceAddress.RunStatus); //获取设备运行状态 | ||||
deviceStatus.WeightFeedback = (Int16)this.modbusTcp.GetUint(DeviceAddress.WeightFeedback);//获取设备料仓剩余重量 | |||||
deviceStatus.NowWeightFeedback = (float)this.modbusTcp.GetUint(DeviceAddress.CutWeightFeedback);//获取下料重量 | |||||
deviceStatus.WeightFeedback = this.modbusTcp.ReadShort(DeviceAddress.WeightFeedback);//获取设备料仓剩余重量 | |||||
deviceStatus.NowWeightFeedback = this.modbusTcp.GetReal(DeviceAddress.CutWeightFeedback);//获取下料重量 | |||||
deviceStatus.DeviceNum = (ushort)this.modbusTcp.ReadShort(DeviceAddress.DeviceNum);//获取设备编号 | deviceStatus.DeviceNum = (ushort)this.modbusTcp.ReadShort(DeviceAddress.DeviceNum);//获取设备编号 | ||||
deviceStatus.DeviceAlarmCode = (ushort)this.modbusTcp.ReadShort(DeviceAddress.DeviceAlarmCode);//获取设备故障编码 | deviceStatus.DeviceAlarmCode = (ushort)this.modbusTcp.ReadShort(DeviceAddress.DeviceAlarmCode);//获取设备故障编码 | ||||
AlarmHelper<AlarmInfo>.GetInstance(DeviceName).EStop1 = deviceStatus.DeviceAlarmCode.Get16bitValue(1); | AlarmHelper<AlarmInfo>.GetInstance(DeviceName).EStop1 = deviceStatus.DeviceAlarmCode.Get16bitValue(1); | ||||
@@ -354,16 +365,6 @@ namespace BPASmartClient.JXJFoodSmallStation.Model | |||||
{ | { | ||||
if (modbusTcp.Connected) | if (modbusTcp.Connected) | ||||
{ | { | ||||
modbusTcp.SetReal(DeviceAddress.WeightSet, Value);//写入配方量 | |||||
bool returnValue = modbusTcp.Write(DeviceAddress.Start, (ushort)1);//设备启动写入 | |||||
if (returnValue) | |||||
{ | |||||
MessageNotify.GetInstance.ShowRunLog($"发送成功" + DeviceAddress.Start); | |||||
} | |||||
else | |||||
{ | |||||
MessageNotify.GetInstance.ShowRunLog($"发送失败" + DeviceAddress.Start); | |||||
} | |||||
//配料设备参数写入 | //配料设备参数写入 | ||||
var res = Json<DevicePar>.Data.deviceParModels.FirstOrDefault(p => p.MaterialName == DeviceName); | var res = Json<DevicePar>.Data.deviceParModels.FirstOrDefault(p => p.MaterialName == DeviceName); | ||||
if (res != null) | if (res != null) | ||||
@@ -378,6 +379,17 @@ namespace BPASmartClient.JXJFoodSmallStation.Model | |||||
modbusTcp.SetUint(DeviceAddress.StirringSpeed, (uint)res.StirringSpeed * 100); | modbusTcp.SetUint(DeviceAddress.StirringSpeed, (uint)res.StirringSpeed * 100); | ||||
MessageNotify.GetInstance.ShowRunLog($"{res.MaterialName},参数下发完成"); | MessageNotify.GetInstance.ShowRunLog($"{res.MaterialName},参数下发完成"); | ||||
} | } | ||||
Thread.Sleep(100); | |||||
modbusTcp.SetReal(DeviceAddress.WeightSet, Value);//写入配方量 | |||||
bool returnValue = modbusTcp.Write(DeviceAddress.Start, (ushort)1);//设备启动写入 | |||||
if (returnValue) | |||||
{ | |||||
MessageNotify.GetInstance.ShowRunLog($"发送成功" + DeviceAddress.Start); | |||||
} | |||||
else | |||||
{ | |||||
MessageNotify.GetInstance.ShowRunLog($"发送失败" + DeviceAddress.Start); | |||||
} | |||||
} | } | ||||
} | } | ||||
} | } | ||||
@@ -15,7 +15,7 @@ namespace BPASmartClient.JXJFoodSmallStation.Model.Siemens | |||||
public SiemensHelper Siemens_PLC_S7 = new SiemensHelper(); | public SiemensHelper Siemens_PLC_S7 = new SiemensHelper(); | ||||
public bool IsConnected => Siemens_PLC_S7.IsConnected; | public bool IsConnected => Siemens_PLC_S7.IsConnected; | ||||
public XL_Status_DB XL_Status = new XL_Status_DB(); | public XL_Status_DB XL_Status = new XL_Status_DB(); | ||||
bool test; | |||||
public XL_DataColl_DB DataColl = new XL_DataColl_DB(); | |||||
public void Init() | public void Init() | ||||
{ | { | ||||
if (IsConnected) | if (IsConnected) | ||||
@@ -25,15 +25,15 @@ namespace BPASmartClient.JXJFoodSmallStation.Model.Siemens | |||||
var Start = this.Siemens_PLC_S7.ReadClass<XL_Start_DB>(2201); | var Start = this.Siemens_PLC_S7.ReadClass<XL_Start_DB>(2201); | ||||
var Status = this.Siemens_PLC_S7.ReadClass<XL_Status_DB>(2231); | var Status = this.Siemens_PLC_S7.ReadClass<XL_Status_DB>(2231); | ||||
var Finish = this.Siemens_PLC_S7.ReadClass<XL_Finish_DB>(2261); | var Finish = this.Siemens_PLC_S7.ReadClass<XL_Finish_DB>(2261); | ||||
var DataColl = this.Siemens_PLC_S7.ReadClass<XL_DataColl_DB>(2291); | |||||
//var DataColl = this.Siemens_PLC_S7.ReadClass<XL_DataColl_DB>(2291); | |||||
if (Start != null && Start is XL_Start_DB st) | if (Start != null && Start is XL_Start_DB st) | ||||
{ | { | ||||
if (RTrig.GetInstance("DB2201.DBX450.0").Start(GVL_SmallStation.IsAllowSiemensSendRecipe) && GVL_SmallStation.SiemensSendRecipeStatus == 0) | |||||
if (GVL_SmallStation.IsAllowSiemensSendRecipe && GVL_SmallStation.SiemensSendRecipeStatus == 0) | |||||
{ | { | ||||
GVL_SmallStation.SiemensSendRecipeStatus = 1; | GVL_SmallStation.SiemensSendRecipeStatus = 1; | ||||
this.Siemens_PLC_S7.Write("DB2201.DBX450.0", true); | this.Siemens_PLC_S7.Write("DB2201.DBX450.0", true); | ||||
} | } | ||||
if (RTrig.GetInstance("Order_Request_ACK").Start(Start.Order_Request_ACK) && GVL_SmallStation.SiemensSendRecipeStatus == 1) | |||||
if (Start.Order_Request_ACK && GVL_SmallStation.SiemensSendRecipeStatus == 1) | |||||
{ | { | ||||
if (!string.IsNullOrEmpty(st.RecipeCode)) | if (!string.IsNullOrEmpty(st.RecipeCode)) | ||||
{ | { | ||||
@@ -42,16 +42,15 @@ namespace BPASmartClient.JXJFoodSmallStation.Model.Siemens | |||||
this.Siemens_PLC_S7.Write("DB2201.DBX450.0", false); | this.Siemens_PLC_S7.Write("DB2201.DBX450.0", false); | ||||
} | } | ||||
} | } | ||||
if (TTrig.GetInstance("Order_Request_ACK_").Start(Start.Order_Request_ACK) && GVL_SmallStation.SiemensSendRecipeStatus == 2) | |||||
if (Start.Order_Request_ACK == false && GVL_SmallStation.SiemensSendRecipeStatus == 2) | |||||
{ | { | ||||
GVL_SmallStation.IsAllowSiemensSendRecipe = false; | GVL_SmallStation.IsAllowSiemensSendRecipe = false; | ||||
GVL_SmallStation.SiemensSendRecipeStatus = 3; | GVL_SmallStation.SiemensSendRecipeStatus = 3; | ||||
//需要等待请求信号复位才能认为接收配方完成 | |||||
} | } | ||||
} | } | ||||
if (Finish != null && Finish is XL_Finish_DB FinishData) | if (Finish != null && Finish is XL_Finish_DB FinishData) | ||||
{ | { | ||||
if (RTrig.GetInstance("Ask_For_Finish_PLC").Start(FinishData.Ask_For_Finish_PLC) && GVL_SmallStation.SiemensSendRecipeStatus == 7) | |||||
if (FinishData.Ask_For_Finish_PLC && GVL_SmallStation.SiemensSendRecipeStatus == 7) | |||||
{ | { | ||||
FinishData.Order_No = ""; | FinishData.Order_No = ""; | ||||
FinishData.Product_Code = ""; | FinishData.Product_Code = ""; | ||||
@@ -77,21 +76,24 @@ namespace BPASmartClient.JXJFoodSmallStation.Model.Siemens | |||||
XL_Status.Powder[i] = new PowderStatus(); | XL_Status.Powder[i] = new PowderStatus(); | ||||
} | } | ||||
XL_Status = state; | XL_Status = state; | ||||
if (RTrig.GetInstance("Allow_AGV_Put[0]").Start(Status.AgvRequestPut)) | |||||
{ | |||||
ActionManage.GetInstance.Send("AGV放货架到位", Status); | |||||
Status.AgvRequestPut = false; | |||||
this.Siemens_PLC_S7.WriteClass<XL_Status_DB>(Status, 2); | |||||
} | |||||
} | } | ||||
if (Status != null && RTrig.GetInstance("Allow_AGV_Put[1]").Start(Status.AgvRequestGet)) | |||||
var res = ProcessControl.GetInstance.HKDevice.DeviceStatus; | |||||
if (res != null) | |||||
{ | { | ||||
ActionManage.GetInstance.Send("AGV取货架到位", Status); | |||||
Status.AgvRequestGet = false; | |||||
this.Siemens_PLC_S7.WriteClass<XL_Status_DB>(Status, 2); | |||||
DataColl.HeartBeatWithPLC = res.HeartBeat; | |||||
DataColl.SystemStart = res.DeviceRun; | |||||
DataColl.SystemStop = res.DeviceStop; | |||||
DataColl.SystemPause = res.DevicePause; | |||||
DataColl.SystemEStop = res.DeviceEStop; | |||||
DataColl.Mode = res.Mode; | |||||
DataColl.Alarm = res.Alarm; | |||||
this.Siemens_PLC_S7.WriteClass<XL_DataColl_DB>(DataColl, 2291); | |||||
} | } | ||||
Thread.Sleep(10); | Thread.Sleep(10); | ||||
}),"监听服务数据"); | |||||
}),"监听服务数据",true); | |||||
} | } | ||||
} | } | ||||
} | } | ||||
@@ -7,12 +7,12 @@ using System.Threading.Tasks; | |||||
namespace BPASmartClient.JXJFoodSmallStation.Model.Siemens | namespace BPASmartClient.JXJFoodSmallStation.Model.Siemens | ||||
{ | { | ||||
internal class XL_DataColl_DB | |||||
public class XL_DataColl_DB | |||||
{ | { | ||||
[Siemens(16)] | [Siemens(16)] | ||||
public string RecipeCode { get; set; } | |||||
public string RecipeCode { get; set; } = ""; | |||||
[Siemens(16)] | [Siemens(16)] | ||||
public string RecipeName { get; set; } | |||||
public string RecipeName { get; set; } = ""; | |||||
public bool RawMaterialLack { get; set; } | public bool RawMaterialLack { get; set; } | ||||
/// <summary> | /// <summary> | ||||
/// 上游缺料 | /// 上游缺料 | ||||
@@ -13,7 +13,7 @@ namespace BPASmartClient.JXJFoodSmallStation.Model.Siemens | |||||
/// 配料完成信号确认 | /// 配料完成信号确认 | ||||
/// </summary> | /// </summary> | ||||
public bool Ask_For_Finish_PLC { get; set; } | public bool Ask_For_Finish_PLC { get; set; } | ||||
public short[] StandbyFinish { get; set; }=new short[4]; | |||||
public short[] StandbyFinish { get; set; } = new short[4]; | |||||
[Siemens(16)] | [Siemens(16)] | ||||
/// <summary> | /// <summary> | ||||
@@ -41,30 +41,35 @@ namespace BPASmartClient.JXJFoodSmallStation.Model.Siemens | |||||
/// <summary> | /// <summary> | ||||
/// 生产工单 | /// 生产工单 | ||||
/// </summary> | /// </summary> | ||||
public string Order_No { get; set; } | |||||
public string Order_No { get; set; } = ""; | |||||
/// <summary> | /// <summary> | ||||
/// 配料开始 | /// 配料开始 | ||||
/// </summary> | /// </summary> | ||||
public bool Dosing_Start { get; set; } | public bool Dosing_Start { get; set; } | ||||
/// <summary> | /// <summary> | ||||
/// 工位允许取货架 | |||||
/// </summary> | |||||
public bool StationAllowGet { get; set; } | |||||
/// <summary> | |||||
/// 工位允许放货架 | /// 工位允许放货架 | ||||
/// </summary> | /// </summary> | ||||
public bool StationAllowPut { get; set; } | public bool StationAllowPut { get; set; } | ||||
/// <summary> | /// <summary> | ||||
/// 工位允许取货架 | |||||
/// </summary> | |||||
public bool StationAllowGet { get; set; } | |||||
/// <summary> | |||||
/// 工位允许取空货架 | /// 工位允许取空货架 | ||||
/// </summary> | /// </summary> | ||||
public bool StationAllowGetEmpty { get; set; } | public bool StationAllowGetEmpty { get; set; } | ||||
/// <summary> | |||||
/// 允许AGV到工站取放粉料 | |||||
/// </summary> | |||||
public bool Allow_AGV_Put_Get_FL { get; set; } | |||||
public PowderStatus[] Powder { get; set; } = new PowderStatus[10]; | public PowderStatus[] Powder { get; set; } = new PowderStatus[10]; | ||||
/// <summary> | /// <summary> | ||||
/// 托盘占用情况 | /// 托盘占用情况 | ||||
/// </summary> | /// </summary> | ||||
public short TrayUse { get; set; } | public short TrayUse { get; set; } | ||||
/// <summary> | /// <summary> | ||||
/// 托盘占用情况 | |||||
/// 托盘使用情况 | |||||
/// </summary> | /// </summary> | ||||
public short Permit_Pos { get; set; } | public short Permit_Pos { get; set; } | ||||
/// <summary> | /// <summary> | ||||
@@ -17,15 +17,68 @@ namespace BPASmartClient.JXJFoodSmallStation.Model | |||||
{ | { | ||||
public SiemensHelper Siemens_PLC_S7 = new SiemensHelper(); | public SiemensHelper Siemens_PLC_S7 = new SiemensHelper(); | ||||
public bool IsConnected => Siemens_PLC_S7.IsConnected; | public bool IsConnected => Siemens_PLC_S7.IsConnected; | ||||
public bool test; | |||||
public void Init() | public void Init() | ||||
{ | { | ||||
if (IsConnected) | |||||
ThreadManage.GetInstance().StartLong(new Action(() => | |||||
{ | { | ||||
ThreadManage.GetInstance().StartLong(new Action(() => | |||||
if (IsConnected) | |||||
{ | { | ||||
/*var res = this.Siemens_PLC_S7.ReadClass<XL_WindSendData_DB>(5); | |||||
if(RTrig.GetInstance("CurrentCompleteSign").Start(res.CurrentCompleteSign)) | |||||
var res1 = this.Siemens_PLC_S7.ReadClass<WindSend_Read>(94); | |||||
/*if (res1 != null && res1 is WindSend_Read readData) | |||||
{ | |||||
GVL_SmallStation.WindSendAllowAGVPutGet = readData.HoodLiftInPlace; | |||||
Siemens_PLC_S7.Write<bool>("DB95.DBX38.2", GVL_SmallStation.Station1HaveTray);//工站1有托盘 | |||||
if (res1.RecipeReceiveFinish) | |||||
{ | |||||
Siemens_PLC_S7.Write<bool>("DB95.DBX38.0", false); | |||||
} | |||||
if (RTrig.GetInstance("CurrentCompleteSign").Start(readData.CurrentCompleteSign)) | |||||
{ | |||||
GVL_SmallStation.WindSendDosingComple = true; | |||||
Siemens_PLC_S7.Write("DB95.DBX38.1", true); | |||||
} | |||||
if (TTrig.GetInstance("CurrentCompleteSign").Start(readData.CurrentCompleteSign)) | |||||
{ | |||||
Siemens_PLC_S7.Write("DB95.DBX38.1", false); | |||||
} | |||||
}*/ | |||||
//测试 | |||||
var res = this.Siemens_PLC_S7.ReadClass<WindSend_Write>(95); | |||||
if (res != null && res is WindSend_Write write) | |||||
{ | |||||
if (res1.SystemRunStatus == 1 && test) | |||||
{ | |||||
test = false; | |||||
write.RawMaterial1_SetWeight = 1.5f; | |||||
write.RawMaterial2_SetWeight = 1.5f; | |||||
write.RawMaterial3_SetWeight = 1.5f; | |||||
write.RawMaterial4_SetWeight = 1.5f; | |||||
write.RawMaterial5_SetWeight = 1.5f; | |||||
write.TargetRecipeCode = "qwe123"; | |||||
write.Station1HaveSign = true; | |||||
write.IsAllowDosing = true; | |||||
Siemens_PLC_S7.WriteClass<WindSend_Write>(write, 95); | |||||
} | |||||
if (res1.RecipeReceiveFinish) | |||||
{ | |||||
write.IsAllowDosing = false; | |||||
Siemens_PLC_S7.WriteClass<WindSend_Write>(write, 95); | |||||
} | |||||
} | |||||
if (res1 != null && res1 is WindSend_Read read) | |||||
{ | |||||
if (RTrig.GetInstance("CurrentCompleteSign").Start(read.CurrentCompleteSign)) | |||||
{ | |||||
Siemens_PLC_S7.Write("DB95.DBX38.1", true); | |||||
} | |||||
if (TTrig.GetInstance("CurrentCompleteSign").Start(read.CurrentCompleteSign)) | |||||
{ | |||||
Siemens_PLC_S7.Write("DB95.DBX38.1", false); | |||||
} | |||||
} | |||||
/*if (RTrig.GetInstance("CurrentCompleteSign").Start(res.CurrentCompleteSign)) | |||||
{ | { | ||||
ActionManage.GetInstance.Send("WindSendDosingFinish"); | ActionManage.GetInstance.Send("WindSendDosingFinish"); | ||||
} | } | ||||
@@ -34,7 +87,7 @@ namespace BPASmartClient.JXJFoodSmallStation.Model | |||||
float weightAlarmStockBin3 = Json<WindSendDevicePar>.Data.WindSendPar.ElementAt(2).LowerLimitWeight + Json<WindSendDevicePar>.Data.WindSendPar.ElementAt(2).LowerLimitWeightOffset; | float weightAlarmStockBin3 = Json<WindSendDevicePar>.Data.WindSendPar.ElementAt(2).LowerLimitWeight + Json<WindSendDevicePar>.Data.WindSendPar.ElementAt(2).LowerLimitWeightOffset; | ||||
float weightAlarmStockBin4 = Json<WindSendDevicePar>.Data.WindSendPar.ElementAt(3).LowerLimitWeight + Json<WindSendDevicePar>.Data.WindSendPar.ElementAt(3).LowerLimitWeightOffset; | float weightAlarmStockBin4 = Json<WindSendDevicePar>.Data.WindSendPar.ElementAt(3).LowerLimitWeight + Json<WindSendDevicePar>.Data.WindSendPar.ElementAt(3).LowerLimitWeightOffset; | ||||
float weightAlarmStockBin5 = Json<WindSendDevicePar>.Data.WindSendPar.ElementAt(4).LowerLimitWeight + Json<WindSendDevicePar>.Data.WindSendPar.ElementAt(4).LowerLimitWeightOffset; | float weightAlarmStockBin5 = Json<WindSendDevicePar>.Data.WindSendPar.ElementAt(4).LowerLimitWeight + Json<WindSendDevicePar>.Data.WindSendPar.ElementAt(4).LowerLimitWeightOffset; | ||||
if (res.RawMaterial1_StockBinWeight < weightAlarmStockBin1) | |||||
if (res.RawMaterial1_StockBinWeight < weightAlarmStockBin1) | |||||
{ | { | ||||
NoticeDemoViewModel.OpenMsg(EnumPromptType.Warn, App.MainWindow, "警告", $"料仓1缺料!"); | NoticeDemoViewModel.OpenMsg(EnumPromptType.Warn, App.MainWindow, "警告", $"料仓1缺料!"); | ||||
} | } | ||||
@@ -53,18 +106,19 @@ namespace BPASmartClient.JXJFoodSmallStation.Model | |||||
if (res.RawMaterial5_StockBinWeight < weightAlarmStockBin5) | if (res.RawMaterial5_StockBinWeight < weightAlarmStockBin5) | ||||
{ | { | ||||
NoticeDemoViewModel.OpenMsg(EnumPromptType.Warn, App.MainWindow, "警告", $"料仓5缺料!"); | NoticeDemoViewModel.OpenMsg(EnumPromptType.Warn, App.MainWindow, "警告", $"料仓5缺料!"); | ||||
}*/ | |||||
Thread.Sleep(10); | |||||
}),"监听服务数据"); | |||||
} | |||||
} | |||||
Thread.Sleep(10);*/ | |||||
} | |||||
}),"监听服务数据"); | |||||
} | } | ||||
} | } | ||||
enum DeviceName | enum DeviceName | ||||
{ | { | ||||
原料1, | |||||
原料2, | |||||
原料3, | |||||
原料4, | |||||
原料5 | |||||
味精, | |||||
白糖, | |||||
食盐, | |||||
芽菜香料粉, | |||||
香料A | |||||
} | } | ||||
} | } |
@@ -19,5 +19,10 @@ namespace BPASmartClient.JXJFoodSmallStation.Model | |||||
/// </summary> | /// </summary> | ||||
public float RawMaterialWeight { get { return _mRawMaterialWeight; } set { _mRawMaterialWeight = value; OnPropertyChanged(); } } | public float RawMaterialWeight { get { return _mRawMaterialWeight; } set { _mRawMaterialWeight = value; OnPropertyChanged(); } } | ||||
private float _mRawMaterialWeight; | private float _mRawMaterialWeight; | ||||
/// <summary> | |||||
/// 需要原料重量 | |||||
/// </summary> | |||||
public float DosingCompleWeight { get { return _mDosingCompleWeight; } set { _mDosingCompleWeight = value; OnPropertyChanged(); } } | |||||
private float _mDosingCompleWeight; | |||||
} | } | ||||
} | } |
@@ -7,42 +7,29 @@ using System.Threading.Tasks; | |||||
namespace BPASmartClient.JXJFoodSmallStation.Model.WindSend | namespace BPASmartClient.JXJFoodSmallStation.Model.WindSend | ||||
{ | { | ||||
public class XL_WindSendData_DB | |||||
internal class WindSend_Read | |||||
{ | { | ||||
/// <summary> | /// <summary> | ||||
/// 目标配方编码 | |||||
/// 吸风罩提升到位 | |||||
/// </summary> | /// </summary> | ||||
[Siemens(6)] | |||||
public string TargetRecipeCode { get; set; } | |||||
public bool HoodLiftInPlace { get; set; } | |||||
/// <summary> | /// <summary> | ||||
/// 当前配方编码 | |||||
/// 配方接收完成 | |||||
/// </summary> | /// </summary> | ||||
[Siemens(6)] | |||||
public string CurrentRecipeCode { get; set; } | |||||
public bool RecipeReceiveFinish { get; set; } | |||||
/// <summary> | /// <summary> | ||||
/// 当前制作完成信号 | |||||
/// 制作完成信号 | |||||
/// </summary> | /// </summary> | ||||
public bool CurrentCompleteSign { get; set; } | public bool CurrentCompleteSign { get; set; } | ||||
/// <summary> | /// <summary> | ||||
/// 原料1设定重量 | |||||
/// </summary> | |||||
public float RawMaterial1_SetWeight { get; set; } | |||||
/// <summary> | |||||
/// 原料2设定重量 | |||||
/// </summary> | |||||
public float RawMaterial2_SetWeight { get; set; } | |||||
/// <summary> | |||||
/// 原料3设定重量 | |||||
/// </summary> | |||||
public float RawMaterial3_SetWeight { get; set; } | |||||
/// <summary> | |||||
/// 原料4设定重量 | |||||
/// 当前配方编码 | |||||
/// </summary> | /// </summary> | ||||
public float RawMaterial4_SetWeight { get; set; } | |||||
[Siemens(16)] | |||||
public string CurrentRecipeCode { get; set; } = ""; | |||||
/// <summary> | /// <summary> | ||||
/// 原料5设定重量 | |||||
/// 系统状态 | |||||
/// </summary> | /// </summary> | ||||
public float RawMaterial5_SetWeight { get; set; } | |||||
public short SystemRunStatus { get; set; } | |||||
/// <summary> | /// <summary> | ||||
/// 原料1下料完成重量 | /// 原料1下料完成重量 | ||||
/// </summary> | /// </summary> | ||||
@@ -63,45 +50,27 @@ namespace BPASmartClient.JXJFoodSmallStation.Model.WindSend | |||||
/// 原料5下料完成重量 | /// 原料5下料完成重量 | ||||
/// </summary> | /// </summary> | ||||
public float RawMaterial5_FinishWeight { get; set; } | public float RawMaterial5_FinishWeight { get; set; } | ||||
/// <summary> | /// <summary> | ||||
/// 原料1当前出料重量 | |||||
/// </summary> | |||||
public float RawMaterial1_CurrentWeight { get; set; } | |||||
/// <summary> | |||||
/// 原料2当前出料重量 | |||||
/// </summary> | |||||
public float RawMaterial2_CurrentWeight { get; set; } | |||||
/// <summary> | |||||
/// 原料3当前出料重量 | |||||
/// </summary> | |||||
public float RawMaterial3_CurrentWeight { get; set; } | |||||
/// <summary> | |||||
/// 原料4当前出料重量 | |||||
/// </summary> | |||||
public float RawMaterial4_CurrentWeight { get; set; } | |||||
/// <summary> | |||||
/// 原料5当前出料重量 | |||||
/// </summary> | |||||
public float RawMaterial5_CurrentWeight { get; set; } | |||||
/// <summary> | |||||
/// 原料1当前出料重量 | |||||
/// 原料1料仓重量 | |||||
/// </summary> | /// </summary> | ||||
public float RawMaterial1_StockBinWeight { get; set; } | public float RawMaterial1_StockBinWeight { get; set; } | ||||
/// <summary> | /// <summary> | ||||
/// 原料2料仓剩余重量 | |||||
/// 原料2料仓重量 | |||||
/// </summary> | /// </summary> | ||||
public float RawMaterial2_StockBinWeight { get; set; } | public float RawMaterial2_StockBinWeight { get; set; } | ||||
/// <summary> | /// <summary> | ||||
/// 原料3料仓剩余重量 | |||||
/// 原料3料仓重量 | |||||
/// </summary> | /// </summary> | ||||
public float RawMaterial3_StockBinWeight { get; set; } | public float RawMaterial3_StockBinWeight { get; set; } | ||||
/// <summary> | /// <summary> | ||||
/// 原料4料仓剩余重量 | |||||
/// 原料4料仓重量 | |||||
/// </summary> | /// </summary> | ||||
public float RawMaterial4_StockBinWeight { get; set; } | public float RawMaterial4_StockBinWeight { get; set; } | ||||
/// <summary> | /// <summary> | ||||
/// 原料5料仓剩余重量 | |||||
/// 原料5料仓重量 | |||||
/// </summary> | /// </summary> | ||||
public float RawMaterial5_StockBinWeight { get; set; } | public float RawMaterial5_StockBinWeight { get; set; } | ||||
} | } | ||||
} | } |
@@ -0,0 +1,50 @@ | |||||
using BPASmartClient.S7Net; | |||||
using System; | |||||
using System.Collections.Generic; | |||||
using System.Linq; | |||||
using System.Text; | |||||
using System.Threading.Tasks; | |||||
namespace BPASmartClient.JXJFoodSmallStation.Model.WindSend | |||||
{ | |||||
public class WindSend_Write | |||||
{ | |||||
/// <summary> | |||||
/// 原料1设定重量 | |||||
/// </summary> | |||||
public float RawMaterial1_SetWeight { get; set; } | |||||
/// <summary> | |||||
/// 原料2设定重量 | |||||
/// </summary> | |||||
public float RawMaterial2_SetWeight { get; set; } | |||||
/// <summary> | |||||
/// 原料3设定重量 | |||||
/// </summary> | |||||
public float RawMaterial3_SetWeight { get; set; } | |||||
/// <summary> | |||||
/// 原料4设定重量 | |||||
/// </summary> | |||||
public float RawMaterial4_SetWeight { get; set; } | |||||
/// <summary> | |||||
/// 原料5设定重量 | |||||
/// </summary> | |||||
public float RawMaterial5_SetWeight { get; set; } | |||||
/// <summary> | |||||
/// 目标配方编码 | |||||
/// </summary> | |||||
[Siemens(16)] | |||||
public string TargetRecipeCode { get; set; } | |||||
/// <summary> | |||||
/// 允许配料 | |||||
/// </summary> | |||||
public bool IsAllowDosing { get; set; } | |||||
/// <summary> | |||||
/// 配方制作完成接收 | |||||
/// </summary> | |||||
public bool RecipeCompleRec { get; set; } | |||||
/// <summary> | |||||
/// 工位1有信号 | |||||
/// </summary> | |||||
public bool Station1HaveSign { get; set; } | |||||
} | |||||
} |
@@ -0,0 +1,94 @@ | |||||
<UserControl x:Class="BPASmartClient.JXJFoodSmallStation.View.ManualFlowView" | |||||
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.DataContext> | |||||
<vm:ManualFlowViewModel /> | |||||
</UserControl.DataContext> | |||||
<Grid Margin="10"> | |||||
<Grid.RowDefinitions> | |||||
<RowDefinition Height="100" /> | |||||
<RowDefinition Height="100" /> | |||||
<RowDefinition Height="1*" /> | |||||
</Grid.RowDefinitions> | |||||
<!--#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> | |||||
</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> | |||||
</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 ManualFlowView : UserControl | |||||
{ | |||||
public ManualFlowView() | |||||
{ | |||||
InitializeComponent(); | |||||
} | |||||
} | |||||
} |
@@ -171,7 +171,7 @@ | |||||
<TextBlock Text="原料桶号" HorizontalAlignment="Center" /> | <TextBlock Text="原料桶号" HorizontalAlignment="Center" /> | ||||
<Border BorderThickness="1,0,1,0" Cursor="SizeWE" /> | <Border BorderThickness="1,0,1,0" Cursor="SizeWE" /> | ||||
</Grid> | </Grid> | ||||
<TextBlock Grid.Column="3" Text="原料重量" HorizontalAlignment="Center" /> | |||||
<TextBlock Grid.Column="3" Text="原料重量(kg)" HorizontalAlignment="Center" /> | |||||
<Grid Grid.Column="4"> | <Grid Grid.Column="4"> | ||||
<TextBlock Text="功能操作" HorizontalAlignment="Center" /> | <TextBlock Text="功能操作" HorizontalAlignment="Center" /> | ||||
<Border BorderThickness="1,0,1,0" Cursor="SizeWE" /> | <Border BorderThickness="1,0,1,0" Cursor="SizeWE" /> | ||||
@@ -104,10 +104,12 @@ | |||||
<ColumnDefinition Width="2*"/> | <ColumnDefinition Width="2*"/> | ||||
<ColumnDefinition Width="2*"/> | <ColumnDefinition Width="2*"/> | ||||
<ColumnDefinition Width="2*"/> | <ColumnDefinition Width="2*"/> | ||||
<ColumnDefinition Width="2*"/> | |||||
</Grid.ColumnDefinitions> | </Grid.ColumnDefinitions> | ||||
<TextBlock FontSize="16" Grid.Column="0" HorizontalAlignment="Center" VerticalAlignment="Top">原料位置</TextBlock> | |||||
<TextBlock FontSize="16" Grid.Column="1" HorizontalAlignment="Center" VerticalAlignment="Top">原料桶号</TextBlock> | |||||
<TextBlock FontSize="16" Grid.Column="2" HorizontalAlignment="Center" VerticalAlignment="Top">原料重量</TextBlock> | |||||
<TextBlock FontSize="16" Grid.Column="0" HorizontalAlignment="Center" VerticalAlignment="Top">原料名称</TextBlock> | |||||
<TextBlock FontSize="16" Grid.Column="1" HorizontalAlignment="Center" VerticalAlignment="Top">原料位置</TextBlock> | |||||
<TextBlock FontSize="16" Grid.Column="2" HorizontalAlignment="Center" VerticalAlignment="Top">原料桶号</TextBlock> | |||||
<TextBlock FontSize="16" Grid.Column="3" HorizontalAlignment="Center" VerticalAlignment="Top">原料重量</TextBlock> | |||||
</Grid> | </Grid> | ||||
<ScrollViewer Grid.Row="1" HorizontalScrollBarVisibility="Hidden" > | <ScrollViewer Grid.Row="1" HorizontalScrollBarVisibility="Hidden" > | ||||
<ItemsControl ItemsSource="{Binding RawMaterialsInfo}" Width="548" > | <ItemsControl ItemsSource="{Binding RawMaterialsInfo}" Width="548" > | ||||
@@ -118,10 +120,12 @@ | |||||
<ColumnDefinition Width="2*"/> | <ColumnDefinition Width="2*"/> | ||||
<ColumnDefinition Width="2*"/> | <ColumnDefinition Width="2*"/> | ||||
<ColumnDefinition Width="2*"/> | <ColumnDefinition Width="2*"/> | ||||
<ColumnDefinition Width="2*"/> | |||||
</Grid.ColumnDefinitions> | </Grid.ColumnDefinitions> | ||||
<TextBlock Grid.Column="0" HorizontalAlignment="Center" VerticalAlignment="Top" FontSize="20" Foreground="#FF2AB2E7" Text="{Binding RawMaterialLocation}"></TextBlock> | |||||
<TextBlock Grid.Column="1" HorizontalAlignment="Center" VerticalAlignment="Top" FontSize="20" Foreground="#FF2AB2E7" Text="{Binding RawMaterialBarrelNum}"></TextBlock> | |||||
<TextBlock Grid.Column="2" HorizontalAlignment="Center" VerticalAlignment="Top" FontSize="20" Foreground="#FF2AB2E7" Text="{Binding RawMaterialWeight}"></TextBlock> | |||||
<TextBlock Grid.Column="0" HorizontalAlignment="Center" VerticalAlignment="Top" FontSize="20" Foreground="#FF2AB2E7" Text="{Binding RawMaterialName}"></TextBlock> | |||||
<TextBlock Grid.Column="1" HorizontalAlignment="Center" VerticalAlignment="Top" FontSize="20" Foreground="#FF2AB2E7" Text="{Binding RawMaterialLocation}"></TextBlock> | |||||
<TextBlock Grid.Column="2" HorizontalAlignment="Center" VerticalAlignment="Top" FontSize="20" Foreground="#FF2AB2E7" Text="{Binding RawMaterialBarrelNum}"></TextBlock> | |||||
<TextBlock Grid.Column="3" HorizontalAlignment="Center" VerticalAlignment="Top" FontSize="20" Foreground="#FF2AB2E7" Text="{Binding RawMaterialWeight}"></TextBlock> | |||||
</Grid> | </Grid> | ||||
<DataTemplate.Triggers> | <DataTemplate.Triggers> | ||||
<Trigger Property="IsMouseOver" Value="true"> | <Trigger Property="IsMouseOver" Value="true"> | ||||
@@ -40,12 +40,16 @@ namespace BPASmartClient.JXJFoodSmallStation.ViewModel | |||||
Describe = $"托盘2_{i-3}#桶位置反馈", | Describe = $"托盘2_{i-3}#桶位置反馈", | ||||
}); | }); | ||||
} | } | ||||
} | } | ||||
SetParCommand = new RelayCommand<object>((o) => | |||||
{ | |||||
}); | |||||
} | } | ||||
public ObservableCollection<PlcManualComm> PlcInfo { get; set; } = new ObservableCollection<PlcManualComm>(); | public ObservableCollection<PlcManualComm> PlcInfo { get; set; } = new ObservableCollection<PlcManualComm>(); | ||||
public RelayCommand<object> SetParCommand { get; set; } | public RelayCommand<object> SetParCommand { get; set; } | ||||
public RelayCommand Connect { get; set; } | public RelayCommand Connect { get; set; } | ||||
@@ -0,0 +1,64 @@ | |||||
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; | |||||
namespace BPASmartClient.JXJFoodSmallStation.ViewModel | |||||
{ | |||||
public class ManualFlowViewModel:ObservableObject | |||||
{ | |||||
public ManualFlowViewModel() | |||||
{ | |||||
Test1Command = new RelayCommand(() => | |||||
{ | |||||
GVL_SmallStation.AGV_PutTray1Finish = true; | |||||
}); | |||||
Test2Command = new RelayCommand(() => | |||||
{ | |||||
GVL_SmallStation.WindSendDosingComple = true; | |||||
}); | |||||
Test3Command = new RelayCommand(() => | |||||
{ | |||||
GVL_SmallStation.AGV_GetTray1Finish = true; | |||||
}); | |||||
Test4Command = new RelayCommand(() => | |||||
{ | |||||
GVL_SmallStation.CylinderReset = true; | |||||
}); | |||||
CLearRecipeInfo = new RelayCommand(() => | |||||
{ | |||||
ActionManage.GetInstance.Send("CLearRecipeInfo"); | |||||
}); | |||||
SystemReset = new RelayCommand(() => | |||||
{ | |||||
ActionManage.GetInstance.Send("SystemReset"); | |||||
}); | |||||
ThreadManage.GetInstance().StartLong(new Action(() => | |||||
{ | |||||
Heartbeat = GVL_SmallStation.GetInstance.HeartBeatFromPlc; | |||||
Thread.Sleep(100); | |||||
}), "流程手动设备状态读取",true); | |||||
} | |||||
public RelayCommand Test1Command { get; set; } | |||||
public RelayCommand Test2Command { get; set; } | |||||
public RelayCommand Test3Command { get; set; } | |||||
public RelayCommand Test4Command { get; set; } | |||||
public bool Heartbeat { get { return _mHeartbeat; } set { _mHeartbeat = value; OnPropertyChanged(); } } | |||||
private bool _mHeartbeat; | |||||
public RelayCommand CLearRecipeInfo { get; set; } | |||||
public RelayCommand SystemReset { get; set; } | |||||
} | |||||
} |
@@ -93,7 +93,7 @@ namespace BPASmartClient.JXJFoodSmallStation.ViewModel | |||||
} | } | ||||
Thread.Sleep(100); | Thread.Sleep(100); | ||||
}), "启动配方下发"); | |||||
}), "启动配方下发",true); | |||||
ThreadManage.GetInstance().StartLong(new Action(() => | ThreadManage.GetInstance().StartLong(new Action(() => | ||||
@@ -110,8 +110,8 @@ namespace BPASmartClient.JXJFoodSmallStation.ViewModel | |||||
RawMaterials.Add(new RemoteRecipeRawMaterial() | RawMaterials.Add(new RemoteRecipeRawMaterial() | ||||
{ | { | ||||
RawMaterialName = "原料" + i, | RawMaterialName = "原料" + i, | ||||
RawMaterialWeight = new Random().Next(200, 300), | |||||
RawMaterialBarrelNum = (short)new Random().Next(1, 5), | |||||
RawMaterialWeight = (float)Math.Round(new Random().Next(200, 300) * 0.001 ,3), | |||||
RawMaterialBarrelNum = (short)new Random().Next(1, 4), | |||||
RawMaterialLocation = i, | RawMaterialLocation = i, | ||||
}); | }); | ||||
} | } | ||||
@@ -117,6 +117,12 @@ namespace BPASmartClient.S7Net | |||||
var bytes = S7.Net.Types.S7String.ToByteArray(txt, temp.Length); | var bytes = S7.Net.Types.S7String.ToByteArray(txt, temp.Length); | ||||
myPlc.WriteBytes(DataType.DataBlock, db, startAddress, bytes); | myPlc.WriteBytes(DataType.DataBlock, db, startAddress, bytes); | ||||
} | |||||
public void WriteInt16(int db, short txt, int startAddress = 0) | |||||
{ | |||||
var bytes =BitConverter.GetBytes(txt); | |||||
myPlc.WriteBytes(DataType.DataBlock, db, startAddress, bytes); | |||||
} | } | ||||
public TResult ReadClass<TResult>(int db, int startByteAdr = 0) where TResult : class, new() | public TResult ReadClass<TResult>(int db, int startByteAdr = 0) where TResult : class, new() | ||||
{ | { | ||||
@@ -1,4 +1,5 @@ | |||||
using BPA.Helper; | using BPA.Helper; | ||||
using BPASmartClient.CustomResource.Pages.Model; | |||||
using System; | using System; | ||||
using System.Collections.Generic; | using System.Collections.Generic; | ||||
using System.Linq; | using System.Linq; | ||||
@@ -21,10 +22,10 @@ namespace BPASmartClient.DosingSystem | |||||
set | set | ||||
{ | { | ||||
_mSpeed = value; | _mSpeed = value; | ||||
if (Num >= 1 && Num <= 32) | |||||
{ | |||||
SiemensDevice.GetInstance.MySiemens.Write($"DB4.DBW{Num * 2 + 132}", value); | |||||
} | |||||
SiemensDevice.GetInstance.MySiemens.Write($"DB4.DBW{Num * 2 + 132}", (short)value); | |||||
//SiemensDevice.GetInstance.MySiemens.WriteInt16(4, (short)value, (Num * 2 + 132)); | |||||
MessageNotify.GetInstance.ShowRunLog($"DB4.DBW{Num * 2 + 132},{value}"); | |||||
OnPropertyChanged(); | OnPropertyChanged(); | ||||
} | } | ||||
} | } | ||||
@@ -39,7 +40,8 @@ namespace BPASmartClient.DosingSystem | |||||
if (Num >= 1 && Num <= 32) | if (Num >= 1 && Num <= 32) | ||||
{ | { | ||||
var add = SiemensDevice.GetInstance.GetSiemensBitSingleAdd("DB5.DBX", Num, 6); | var add = SiemensDevice.GetInstance.GetSiemensBitSingleAdd("DB5.DBX", Num, 6); | ||||
SiemensDevice.GetInstance.MySiemens.Write(add, !value); | |||||
SiemensDevice.GetInstance.MySiemens.Write(add, value); | |||||
MessageNotify.GetInstance.ShowRunLog($"{add},{value}"); | |||||
} | } | ||||
OnPropertyChanged(); | OnPropertyChanged(); | ||||
} | } | ||||
@@ -114,7 +114,7 @@ namespace BPASmartClient.DosingSystem | |||||
{ | { | ||||
if (!string.IsNullOrEmpty(Json<DevicePar>.Data.BaseParModel.NetworkSegAddress)) IPSegment = Json<DevicePar>.Data.BaseParModel.NetworkSegAddress; | if (!string.IsNullOrEmpty(Json<DevicePar>.Data.BaseParModel.NetworkSegAddress)) IPSegment = Json<DevicePar>.Data.BaseParModel.NetworkSegAddress; | ||||
else Json<DevicePar>.Data.BaseParModel.NetworkSegAddress = IPSegment; | else Json<DevicePar>.Data.BaseParModel.NetworkSegAddress = IPSegment; | ||||
TestData(); | |||||
//TestData(); | |||||
IpAddressLines(); | IpAddressLines(); | ||||
SiemensDevice.GetInstance.Connect(Json<DevicePar>.Data.BaseParModel.DeviceAddress); | SiemensDevice.GetInstance.Connect(Json<DevicePar>.Data.BaseParModel.DeviceAddress); | ||||
DeviceDataInit(); | DeviceDataInit(); | ||||
@@ -19,7 +19,7 @@ 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 void Connect(string ip) | public void Connect(string ip) | ||||
{ | { | ||||
try | try | ||||
@@ -35,12 +35,11 @@ namespace BPASmartClient.DosingSystem | |||||
} | } | ||||
IsConnect = MySiemens.IsConnected; | IsConnect = MySiemens.IsConnected; | ||||
bool tempValue = false; | |||||
ThreadManage.GetInstance().StartLong(new Action(() => | ThreadManage.GetInstance().StartLong(new Action(() => | ||||
{ | { | ||||
if (IsConnect) MySiemens.Write("DB4.DBX0.0", tempValue);//设备心跳 | if (IsConnect) MySiemens.Write("DB4.DBX0.0", tempValue);//设备心跳 | ||||
tempValue = !tempValue; | tempValue = !tempValue; | ||||
Thread.Sleep(1); | |||||
Thread.Sleep(100); | |||||
}), "设备心跳", true); | }), "设备心跳", true); | ||||
ThreadManage.GetInstance().StartLong(new Action(() => | ThreadManage.GetInstance().StartLong(new Action(() => | ||||
@@ -55,6 +54,7 @@ namespace BPASmartClient.DosingSystem | |||||
} | } | ||||
GlobalDevice.MotorControl = MySiemens.Read<uint>("DB5.DBD6");//获取输送带控制信号 | GlobalDevice.MotorControl = MySiemens.Read<uint>("DB5.DBD6");//获取输送带控制信号 | ||||
//GlobalDevice.MotorControlFeedback = MySiemens.Read<uint>("DB3.DBD0");//获取当前输送带运行状态 | //GlobalDevice.MotorControlFeedback = MySiemens.Read<uint>("DB3.DBD0");//获取当前输送带运行状态 | ||||
GlobalDevice.MotorControl = (uint)(GlobalDevice.MotorControl.ToBytes(BPA.Helper.DataFormat.ABCD)).ToInt(); | |||||
Thread.Sleep(50); | Thread.Sleep(50); | ||||
} | } | ||||
}), "读取输送线设备数据", true); | }), "读取输送线设备数据", true); | ||||
@@ -8,7 +8,7 @@ | |||||
xmlns:vm="clr-namespace:BPASmartClient.DosingSystem.ViewModel" | xmlns:vm="clr-namespace:BPASmartClient.DosingSystem.ViewModel" | ||||
Title="NewRecipeView" | Title="NewRecipeView" | ||||
Width="550" | Width="550" | ||||
Height="450" | |||||
Height="600" | |||||
AllowsTransparency="True" | AllowsTransparency="True" | ||||
Background="{x:Null}" | Background="{x:Null}" | ||||
Topmost="True" | Topmost="True" | ||||
@@ -362,23 +362,29 @@ | |||||
Grid.RowSpan="5" | Grid.RowSpan="5" | ||||
Source="/BPASmartClient.CustomResource;component/Image/配方背景/竖背景框.png" | Source="/BPASmartClient.CustomResource;component/Image/配方背景/竖背景框.png" | ||||
Stretch="Fill" /> | Stretch="Fill" /> | ||||
<TextBlock | <TextBlock | ||||
Grid.Row="0" | Grid.Row="0" | ||||
Margin="2,5,0,0" | |||||
HorizontalAlignment="Center" | |||||
VerticalAlignment="Top" | |||||
FontSize="18" | |||||
Margin="5,0,0,0" | |||||
VerticalAlignment="Center" | |||||
Foreground="#FF2AB2E7" | Foreground="#FF2AB2E7" | ||||
Text="{Binding RecipeName}" /> | |||||
Text="配方信息:" /> | |||||
<TextBlock | <TextBlock | ||||
Grid.Row="1" | Grid.Row="1" | ||||
Margin="5,0,0,0" | |||||
VerticalAlignment="Top" | |||||
Margin="20,0,0,0" | |||||
HorizontalAlignment="Left" | |||||
VerticalAlignment="Center" | |||||
FontSize="12" | |||||
Foreground="#FF2AB2E7" | Foreground="#FF2AB2E7" | ||||
Text="配方信息:" /> | |||||
Text="配方名称:" /> | |||||
<TextBlock | |||||
Grid.Row="1" | |||||
Margin="100,0,0,0" | |||||
HorizontalAlignment="Left" | |||||
VerticalAlignment="Center" | |||||
FontSize="12" | |||||
Foreground="#FF2AB2E7" | |||||
Text="{Binding RecipeName}" /> | |||||
<ScrollViewer | <ScrollViewer | ||||
Grid.Row="2" | Grid.Row="2" | ||||
VerticalAlignment="Top" | VerticalAlignment="Top" | ||||
@@ -407,7 +413,7 @@ | |||||
</ItemsControl.ItemTemplate> | </ItemsControl.ItemTemplate> | ||||
</ItemsControl> | </ItemsControl> | ||||
<ItemsControl Grid.Column="1" ItemsSource="{Binding RawMaterials}"> | |||||
<!--<ItemsControl Grid.Column="1" ItemsSource="{Binding RawMaterials}"> | |||||
<ItemsControl.ItemTemplate> | <ItemsControl.ItemTemplate> | ||||
<DataTemplate> | <DataTemplate> | ||||
<StackPanel Orientation="Horizontal"> | <StackPanel Orientation="Horizontal"> | ||||
@@ -436,7 +442,7 @@ | |||||
</StackPanel> | </StackPanel> | ||||
</DataTemplate> | </DataTemplate> | ||||
</ItemsControl.ItemTemplate> | </ItemsControl.ItemTemplate> | ||||
</ItemsControl> | |||||
</ItemsControl>--> | |||||
</Grid> | </Grid> | ||||
@@ -812,7 +818,7 @@ | |||||
<Grid.ColumnDefinitions> | <Grid.ColumnDefinitions> | ||||
<ColumnDefinition Width="50" /> | <ColumnDefinition Width="50" /> | ||||
<ColumnDefinition /> | <ColumnDefinition /> | ||||
<ColumnDefinition Width="100" /> | |||||
<ColumnDefinition Width="70" /> | |||||
</Grid.ColumnDefinitions> | </Grid.ColumnDefinitions> | ||||
<TextBlock | <TextBlock | ||||
@@ -103,14 +103,14 @@ namespace BPASmartClient.DosingSystem.ViewModel | |||||
SystemStart = new BPARelayCommand(() => | SystemStart = new BPARelayCommand(() => | ||||
{ | { | ||||
SiemensDevice.GetInstance.MySiemens.Write("M10.0", SystemControlText == "停止" ? false : true); | SiemensDevice.GetInstance.MySiemens.Write("M10.0", SystemControlText == "停止" ? false : true); | ||||
var res = SiemensDevice.GetInstance.MySiemens.Read<bool>("M10.0"); | |||||
SystemControlText = res ? "停止" : "启动"; | |||||
/*var res = SiemensDevice.GetInstance.MySiemens.Read<bool>("M10.0"); | |||||
SystemControlText = res ? "停止" : "启动";*/ | |||||
}); | }); | ||||
ModelSwitch = new BPARelayCommand(() => | ModelSwitch = new BPARelayCommand(() => | ||||
{ | { | ||||
SiemensDevice.GetInstance.MySiemens.Write("M10.1", ModelSwitchText == "手动" ? true : false); | SiemensDevice.GetInstance.MySiemens.Write("M10.1", ModelSwitchText == "手动" ? true : false); | ||||
var res = SiemensDevice.GetInstance.MySiemens.Read<bool>("M10.1"); | |||||
ModelSwitchText = res ? "自动" : "手动"; | |||||
/*var res = SiemensDevice.GetInstance.MySiemens.Read<bool>("M10.1"); | |||||
ModelSwitchText = res ? "自动" : "手动";*/ | |||||
}); | }); | ||||
ThreadManage.GetInstance().StartLong(new Action(() => | ThreadManage.GetInstance().StartLong(new Action(() => | ||||
@@ -130,8 +130,8 @@ namespace BPASmartClient.DosingSystem.ViewModel | |||||
OtherHandCylinders.ElementAt(1).RightTog = GlobalDevice.PlcData.UnderCylinderDetection.HomeSignal; | OtherHandCylinders.ElementAt(1).RightTog = GlobalDevice.PlcData.UnderCylinderDetection.HomeSignal; | ||||
OtherHandCylinders.ElementAt(1).LeftTog = GlobalDevice.PlcData.UnderCylinderDetection.InPlaceSignal; | OtherHandCylinders.ElementAt(1).LeftTog = GlobalDevice.PlcData.UnderCylinderDetection.InPlaceSignal; | ||||
//SystemControlText = GlobalDevice.PlcData.SystemStartOrStop ? "停止系统" : "启动系统"; | |||||
//ModelSwitchText = GlobalDevice.PlcData.HandOrAuto ? "自动" : "手动"; | |||||
SystemControlText = GlobalDevice.PlcData.SystemStartOrStop ? "停止" : "启动"; | |||||
ModelSwitchText = GlobalDevice.PlcData.HandOrAuto ? "自动" : "手动"; | |||||
Thread.Sleep(100); | Thread.Sleep(100); | ||||
}), "手动气缸状态监控"); | }), "手动气缸状态监控"); | ||||
@@ -44,7 +44,6 @@ namespace BPASmartClient.DosingSystem.ViewModel | |||||
{ | { | ||||
await Task.Factory.StartNew(new Action(() => | await Task.Factory.StartNew(new Action(() => | ||||
{ | { | ||||
Recipes.ElementAt(index).IsEnable = true; | Recipes.ElementAt(index).IsEnable = true; | ||||
Json<LocaPar>.Data.Recipes.ElementAt(index).IsEnable = true; | Json<LocaPar>.Data.Recipes.ElementAt(index).IsEnable = true; | ||||
Recipes.ElementAt(index).Are.Set(); | Recipes.ElementAt(index).Are.Set(); | ||||
@@ -434,7 +433,8 @@ namespace BPASmartClient.DosingSystem.ViewModel | |||||
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(); | int item = test1.ToInt(); | ||||
SiemensDevice.GetInstance.MySiemens.Write("DB4.DBD130", item); | |||||
string res = SiemensDevice.GetInstance.MySiemens.Write("DB4.DBD130", item,2); | |||||
MessageNotify.GetInstance.ShowRunLog($"{res}"); | |||||
MessageNotify.GetInstance.ShowRunLog($"DB4.DBD130:{item.ToBinString()}"); | MessageNotify.GetInstance.ShowRunLog($"DB4.DBD130:{item.ToBinString()}"); | ||||
MessageNotify.GetInstance.ShowRunLog($"柔性味魔方{Recipes.ElementAt(i).RawMaterials.ElementAt(loc).DeviceIp},出料完成,状态复位"); | MessageNotify.GetInstance.ShowRunLog($"柔性味魔方{Recipes.ElementAt(i).RawMaterials.ElementAt(loc).DeviceIp},出料完成,状态复位"); | ||||
} | } | ||||
@@ -485,7 +485,8 @@ namespace BPASmartClient.DosingSystem.ViewModel | |||||
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(); | int item = test1.ToInt(); | ||||
SiemensDevice.GetInstance.MySiemens.Write("DB4.DBD130", item, 5); | |||||
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.ToBinString()}"); | ||||
MessageNotify.GetInstance.ShowRunLog($"DB4.DBD130:{item}"); | MessageNotify.GetInstance.ShowRunLog($"DB4.DBD130:{item}"); | ||||
MessageNotify.GetInstance.ShowRunLog($"柔性味魔方{Recipes.ElementAt(i).RawMaterials.ElementAt(loc).DeviceIp},出料完成,状态复位"); | MessageNotify.GetInstance.ShowRunLog($"柔性味魔方{Recipes.ElementAt(i).RawMaterials.ElementAt(loc).DeviceIp},出料完成,状态复位"); | ||||
@@ -535,7 +536,8 @@ namespace BPASmartClient.DosingSystem.ViewModel | |||||
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(); | int item = test1.ToInt(); | ||||
SiemensDevice.GetInstance.MySiemens.Write("DB4.DBD130", item); | |||||
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.ToBinString()}"); | ||||
MessageNotify.GetInstance.ShowRunLog($"柔性味魔方{Recipes.ElementAt(i).RawMaterials.ElementAt(loc).DeviceIp},出料完成,状态复位"); | MessageNotify.GetInstance.ShowRunLog($"柔性味魔方{Recipes.ElementAt(i).RawMaterials.ElementAt(loc).DeviceIp},出料完成,状态复位"); | ||||
} | } | ||||
@@ -194,7 +194,7 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BPASmartClient.ScreenLib", | |||||
EndProject | EndProject | ||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "WpfTest", "WpfTest\WpfTest.csproj", "{CD43FABA-D1ED-4524-AC51-60ECDE2EAD44}" | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "WpfTest", "WpfTest\WpfTest.csproj", "{CD43FABA-D1ED-4524-AC51-60ECDE2EAD44}" | ||||
EndProject | EndProject | ||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WpfApp1", "WpfApp1\WpfApp1.csproj", "{81D03688-7361-45B8-A3EB-9B0A9222A338}" | |||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "WpfApp1", "WpfApp1\WpfApp1.csproj", "{81D03688-7361-45B8-A3EB-9B0A9222A338}" | |||||
EndProject | EndProject | ||||
Global | Global | ||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution | GlobalSection(SolutionConfigurationPlatforms) = preSolution | ||||