@@ -20,7 +20,7 @@ | |||
</ItemGroup> | |||
<ItemGroup> | |||
<PackageReference Include="BPA.Helper" Version="1.0.17" /> | |||
<PackageReference Include="BPA.Helper" Version="1.0.21" /> | |||
</ItemGroup> | |||
<ItemGroup> | |||
@@ -8,7 +8,7 @@ | |||
</PropertyGroup> | |||
<ItemGroup> | |||
<PackageReference Include="BPA.Helper" Version="1.0.17" /> | |||
<PackageReference Include="BPA.Helper" Version="1.0.21" /> | |||
</ItemGroup> | |||
<ItemGroup> | |||
@@ -9,7 +9,7 @@ | |||
<ItemGroup> | |||
<PackageReference Include="BPA.Communication" Version="1.0.19" /> | |||
<PackageReference Include="BPA.Helper" Version="1.0.17" /> | |||
<PackageReference Include="BPA.Helper" Version="1.0.21" /> | |||
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="6.0.9" /> | |||
</ItemGroup> | |||
@@ -30,7 +30,7 @@ | |||
<ItemGroup> | |||
<PackageReference Include="BPA.Communication" Version="1.0.19" /> | |||
<PackageReference Include="BPA.Helper" Version="1.0.17" /> | |||
<PackageReference Include="BPA.Helper" Version="1.0.21" /> | |||
</ItemGroup> | |||
<ItemGroup> | |||
@@ -201,6 +201,7 @@ | |||
<None Remove="Image\组合边框1.1.png" /> | |||
<None Remove="Image\组合边框1.png" /> | |||
<None Remove="Image\组合边框2.1.png" /> | |||
<None Remove="Image\组合边框2.png" /> | |||
<None Remove="Image\维护.png" /> | |||
<None Remove="Image\背景.png" /> | |||
<None Remove="Image\背景2.png" /> | |||
@@ -362,6 +363,7 @@ | |||
<Resource Include="Image\组合边框1.1.png" /> | |||
<Resource Include="Image\组合边框1.png" /> | |||
<Resource Include="Image\组合边框2.1.png" /> | |||
<Resource Include="Image\组合边框2.png" /> | |||
<Resource Include="Image\背景2.png" /> | |||
<Resource Include="Image\背景3.jpg" /> | |||
<Resource Include="Image\背景框.png" /> | |||
@@ -407,7 +409,7 @@ | |||
</ItemGroup> | |||
<ItemGroup> | |||
<PackageReference Include="BPA.Helper" Version="1.0.17" /> | |||
<PackageReference Include="BPA.Helper" Version="1.0.21" /> | |||
<PackageReference Include="BPA.Message" Version="1.0.46" /> | |||
<PackageReference Include="MahApps.Metro.IconPacks.FontAwesome" Version="4.11.0" /> | |||
<PackageReference Include="Microsoft.Toolkit.Mvvm" Version="7.1.2" /> | |||
@@ -0,0 +1,28 @@ | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Globalization; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
using System.Windows.Data; | |||
using System.Windows.Media; | |||
namespace BPASmartClient.CustomResource.Converters | |||
{ | |||
public class BoolToFillColorConverter : IValueConverter | |||
{ | |||
public object Convert(object value, Type targetType, object parameter, CultureInfo culture) | |||
{ | |||
if (value != null && value is bool tempBool) | |||
{ | |||
return tempBool ? Brushes.Green : Brushes.Gray; | |||
} | |||
return Brushes.Gray; | |||
} | |||
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) | |||
{ | |||
throw new NotImplementedException(); | |||
} | |||
} | |||
} |
@@ -0,0 +1,33 @@ | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Collections.ObjectModel; | |||
using System.Globalization; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
using System.Windows; | |||
using System.Windows.Data; | |||
namespace BPASmartClient.CustomResource.Converters | |||
{ | |||
public class CountIsVisiableConvert : IValueConverter | |||
{ | |||
public object Convert(object value, Type targetType, object parameter, CultureInfo culture) | |||
{ | |||
if (value != null) | |||
{ | |||
var count = value?.GetType()?.GetProperty("Count")?.GetValue(value); | |||
if (count != null && count is int tempCount) | |||
{ | |||
if (tempCount > 0) return Visibility.Visible; | |||
} | |||
} | |||
return Visibility.Collapsed; | |||
} | |||
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) | |||
{ | |||
throw new NotImplementedException(); | |||
} | |||
} | |||
} |
@@ -10,6 +10,7 @@ | |||
Height="200" | |||
AllowsTransparency="True" | |||
Background="{x:Null}" | |||
Topmost="True" | |||
WindowStartupLocation="CenterScreen" | |||
WindowStyle="None" | |||
mc:Ignorable="d"> | |||
@@ -54,7 +55,7 @@ | |||
Name="infoType" | |||
Grid.Column="1" | |||
VerticalAlignment="Top" | |||
FontSize="16" | |||
FontSize="15" | |||
Foreground="DeepSkyBlue" /> | |||
<TextBlock | |||
Name="icon" | |||
@@ -69,6 +70,7 @@ | |||
Grid.Column="2" | |||
Margin="10,0,0,0" | |||
VerticalAlignment="Top" | |||
FontSize="15" | |||
Foreground="DeepSkyBlue" | |||
Text="警告:" | |||
TextWrapping="Wrap" /> | |||
@@ -102,27 +102,19 @@ | |||
</Grid> | |||
</Viewbox> | |||
<ControlTemplate.Triggers> | |||
<!--<Trigger Property="IsPressed" Value="true"> | |||
<Setter Property="Background" Value="#FFd2e7f4" /> | |||
</Trigger>--> | |||
<!-- 控件选中 --> | |||
<Trigger Property="IsChecked" Value="true"> | |||
<!--<Setter Property="Foreground" Value="#ff1002E9" />--> | |||
<Setter TargetName="ell" Property="HorizontalAlignment" Value="Right" /> | |||
<Setter TargetName="border2" Property="Background" Value="#00c2f4" /> | |||
<Setter TargetName="tb" Property="Text" Value="关" /> | |||
<Setter TargetName="tb" Property="Margin" Value="0,0,15,0" /> | |||
<!--<Setter TargetName="ell" Property="Fill" Value="#ff1002E9"/>--> | |||
</Trigger> | |||
<!-- 控件未选中 --> | |||
<Trigger Property="IsChecked" Value="false"> | |||
<!--<Setter Property="Foreground" Value="#ff2AB2E7" />--> | |||
<Setter TargetName="border2" Property="Background" Value="gray" /> | |||
<Setter TargetName="tb" Property="Text" Value="开" /> | |||
<Setter TargetName="tb" Property="Margin" Value="15,0,0,0" /> | |||
<!--<Setter TargetName="ell" Property="Fill" Value="#ddd"/>--> | |||
</Trigger> | |||
<!-- 鼠标进入 --> | |||
@@ -12,10 +12,10 @@ | |||
<Viewbox HorizontalAlignment="Center" VerticalAlignment="Center"> | |||
<Canvas | |||
Background="Transparent" | |||
Width="{Binding ElementName=br, Path=ActualWidth}" | |||
Height="{Binding ElementName=br, Path=ActualHeight}" | |||
Margin="5"> | |||
Margin="5" | |||
Background="Transparent"> | |||
<Rectangle | |||
Canvas.Top="20" | |||
@@ -47,41 +47,44 @@ namespace BPASmartClient.Helper | |||
/// <param name="key"></param> | |||
public void StartLong(Action action, string key, bool IsRestart = false, Action RunComplete = null) | |||
{ | |||
CancellationTokenSources.TryAdd(guid + key, new CancellationTokenSource()); | |||
bool result = Threads.TryAdd(guid + key, Task.Factory.StartNew(new Action(() => | |||
{ | |||
Thread.CurrentThread.Name = key; | |||
ReStart: | |||
try | |||
{ | |||
while (!CancellationTokenSources[guid + key].IsCancellationRequested) | |||
{ | |||
if (action != null) action(); | |||
} | |||
} | |||
catch (Exception ex) | |||
{ | |||
MessageLog.GetInstance.ShowEx(ex.ToString()); | |||
if (IsRestart) | |||
{ | |||
Thread.Sleep(2000); | |||
MessageLog.GetInstance.Show($"线程 【{key}】运行发生异常,已重启"); | |||
goto ReStart; | |||
} | |||
else | |||
{ | |||
CancellationTokenSources.TryRemove(guid + key, out CancellationTokenSource temp); | |||
Threads.TryRemove(guid + key, out Task temp1); | |||
MessageLog.GetInstance.Show($"线程 【{key}】运行发生异常,已退出"); | |||
} | |||
} | |||
}), CancellationTokenSources[guid + key].Token).ContinueWith(new Action<Task, object>((t, o) => | |||
{ | |||
ThreadStatus(t, o.ToString()); | |||
if (RunComplete != null) RunComplete(); | |||
}), guid + key)); | |||
MessageLog.GetInstance.Show($"启动线程 【{key}】"); | |||
if (!result) MessageLog.GetInstance.Show($"【{key}】任务已存在,请检查 TaskName"); | |||
if (!Threads.ContainsKey(guid + key)) | |||
{ | |||
CancellationTokenSources.TryAdd(guid + key, new CancellationTokenSource()); | |||
bool result = Threads.TryAdd(guid + key, Task.Factory.StartNew(new Action(() => | |||
{ | |||
Thread.CurrentThread.Name = key; | |||
MessageLog.GetInstance.Show($"启动线程 【{key}】"); | |||
ReStart: | |||
try | |||
{ | |||
while (!CancellationTokenSources[guid + key].IsCancellationRequested) | |||
{ | |||
if (action != null) action(); | |||
} | |||
} | |||
catch (Exception ex) | |||
{ | |||
MessageLog.GetInstance.ShowEx(ex.ToString()); | |||
if (IsRestart) | |||
{ | |||
Thread.Sleep(2000); | |||
MessageLog.GetInstance.Show($"线程 【{key}】运行发生异常,已重启"); | |||
goto ReStart; | |||
} | |||
else | |||
{ | |||
CancellationTokenSources.TryRemove(guid + key, out CancellationTokenSource temp); | |||
Threads.TryRemove(guid + key, out Task temp1); | |||
MessageLog.GetInstance.Show($"线程 【{key}】运行发生异常,已退出"); | |||
} | |||
} | |||
}), CancellationTokenSources[guid + key].Token).ContinueWith(new Action<Task, object>((t, o) => | |||
{ | |||
ThreadStatus(t, o.ToString()); | |||
if (RunComplete != null) RunComplete(); | |||
}), guid + key)); | |||
} | |||
else MessageLog.GetInstance.Show($"【{key}】任务已存在,请检查 TaskName"); | |||
} | |||
@@ -93,35 +96,38 @@ namespace BPASmartClient.Helper | |||
/// <param name="key"></param> | |||
public void Start(Action action, string key, bool isRestart = false) | |||
{ | |||
CancellationTokenSources.TryAdd(guid + key, new CancellationTokenSource()); | |||
bool result = Threads.TryAdd(guid + key, Task.Factory.StartNew(new Action(() => | |||
if (!Threads.ContainsKey(guid + key)) | |||
{ | |||
Thread.CurrentThread.Name = key; | |||
try | |||
{ | |||
if (action != null) action(); | |||
} | |||
catch (Exception ex) | |||
CancellationTokenSources.TryAdd(guid + key, new CancellationTokenSource()); | |||
bool result = Threads.TryAdd(guid + key, Task.Factory.StartNew(new Action(() => | |||
{ | |||
MessageLog.GetInstance.ShowEx(ex.ToString()); | |||
if (isRestart) | |||
Thread.CurrentThread.Name = key; | |||
MessageLog.GetInstance.Show($"启动线程 【{key}】"); | |||
try | |||
{ | |||
MessageLog.GetInstance.Show($"线程 【{key}】正在重启"); | |||
CancellationTokenSources.TryRemove(guid + key, out CancellationTokenSource item1); | |||
Threads.TryRemove(guid + key, out Task item2); | |||
Start(action, key, isRestart); | |||
if (action != null) action(); | |||
} | |||
else | |||
catch (Exception ex) | |||
{ | |||
MessageLog.GetInstance.Show($"线程 【{key}】运行发生异常"); | |||
MessageLog.GetInstance.ShowEx(ex.ToString()); | |||
if (isRestart) | |||
{ | |||
MessageLog.GetInstance.Show($"线程 【{key}】正在重启"); | |||
CancellationTokenSources.TryRemove(guid + key, out CancellationTokenSource item1); | |||
Threads.TryRemove(guid + key, out Task item2); | |||
Start(action, key, isRestart); | |||
} | |||
else | |||
{ | |||
MessageLog.GetInstance.Show($"线程 【{key}】运行发生异常"); | |||
} | |||
} | |||
} | |||
}), CancellationTokenSources[guid + key].Token).ContinueWith(new Action<Task, object>((t, o) => | |||
{ | |||
ThreadStatus(t, o.ToString()); | |||
}), guid + key)); | |||
MessageLog.GetInstance.Show($"启动线程 【{key}】"); | |||
if (!result) MessageLog.GetInstance.Show($"【{key}】任务已存在,请检查 TaskName"); | |||
}), CancellationTokenSources[guid + key].Token).ContinueWith(new Action<Task, object>((t, o) => | |||
{ | |||
ThreadStatus(t, o.ToString()); | |||
}), guid + key)); | |||
} | |||
else MessageLog.GetInstance.Show($"【{key}】任务已存在,请检查 TaskName"); | |||
} | |||
private void ThreadStatus(Task task, string key) | |||
@@ -2,6 +2,6 @@ | |||
<configuration> | |||
<appSettings> | |||
<add key="HKPlc_IP" value="107.107.2.17"/> | |||
<add key="Siemens_IP" value="192.168.0.30"/> | |||
<add key="Siemens_IP" value="107.107.2.200"/> | |||
</appSettings> | |||
</configuration> |
@@ -79,7 +79,6 @@ namespace BPASmartClient.JXJFoodBigStation.Model.HK_PLC | |||
public float Bareel1Bin13SetWeight { get; set; } | |||
public float Bareel1Bin14SetWeight { get; set; } | |||
public float Bareel2Bin1SetWeight { get; set; } | |||
public float Bareel2Bin2SetWeight { get; set; } | |||
public float Bareel2Bin3SetWeight { get; set; } | |||
@@ -94,7 +93,6 @@ namespace BPASmartClient.JXJFoodBigStation.Model.HK_PLC | |||
public float Bareel2Bin12SetWeight { get; set; } | |||
public float Bareel2Bin13SetWeight { get; set; } | |||
public float Bareel2Bin14SetWeight { get; set; } | |||
public float Bareel4Bin1SetWeight { get; set; } | |||
public float Bareel4Bin2SetWeight { get; set; } | |||
@@ -110,6 +108,7 @@ namespace BPASmartClient.JXJFoodBigStation.Model.HK_PLC | |||
public float Bareel4Bin12SetWeight { get; set; } | |||
public float Bareel4Bin13SetWeight { get; set; } | |||
public float Bareel4Bin14SetWeight { get; set; } | |||
public float Bareel5Bin1SetWeight { get; set; } | |||
public float Bareel5Bin2SetWeight { get; set; } | |||
public float Bareel5Bin3SetWeight { get; set; } | |||
@@ -17,7 +17,7 @@ namespace BPASmartClient.JXJFoodBigStation.Model.HK_PLC | |||
public bool IsConnected => HK_PLC_S7.IsConnected; | |||
public DB_Write PlcWrite = new DB_Write(); | |||
public DB_Read PlcRead = new DB_Read(); | |||
public StockBinName StockBinName = new StockBinName(); | |||
public void Init() | |||
{ | |||
if (IsConnected) | |||
@@ -26,11 +26,15 @@ namespace BPASmartClient.JXJFoodBigStation.Model.HK_PLC | |||
{ | |||
HK_PLC_S7.WriteClass<DB_Write>(PlcWrite, 99); | |||
var res1 = HK_PLC_S7.ReadClass<DB_Read>(98); | |||
var res2 = HK_PLC_S7.ReadClass<Test1>(97); | |||
var res2 = HK_PLC_S7.ReadClass<StockBinName>(97); | |||
if (res1 != null && res1 is DB_Read data1) | |||
{ | |||
PlcRead = data1; | |||
} | |||
if (res2 != null && res2 is StockBinName data2) | |||
{ | |||
StockBinName = data2; | |||
} | |||
Thread.Sleep(10); | |||
}),"信号收发处理"); | |||
} | |||
@@ -264,7 +268,7 @@ namespace BPASmartClient.JXJFoodBigStation.Model.HK_PLC | |||
} | |||
else | |||
{ | |||
MessageLog.GetInstance.ShowRunLog($"桶号:{barrel},位置:{loc},重量:{recipe.RawMaterial.ElementAt(index).RawMaterialWeight}"); | |||
MessageNotify.GetInstance.ShowRunLog($"配方编号:{recipe.RecipeCode},托盘编号:{recipe.TrayCode},桶号:{barrel},位置:{loc},重量:{recipe.RawMaterial.ElementAt(index).RawMaterialWeight}"); | |||
switch (barrel) | |||
{ | |||
case 1: | |||
@@ -470,7 +474,7 @@ namespace BPASmartClient.JXJFoodBigStation.Model.HK_PLC | |||
default: | |||
break; | |||
} | |||
} | |||
} | |||
} | |||
} | |||
} | |||
@@ -7,7 +7,7 @@ using System.Threading.Tasks; | |||
namespace BPASmartClient.JXJFoodBigStation.Model.HK_PLC | |||
{ | |||
internal class Test1 | |||
public class StockBinName | |||
{ | |||
[Siemens(6)] | |||
public string RawMaterialName1 { get; set; } |
@@ -48,27 +48,11 @@ namespace BPASmartClient.JXJFoodBigStation.Model | |||
public ConcurrentQueue<string> RecipeQueue4 = new ConcurrentQueue<string>(); | |||
public ConcurrentQueue<string> RecipeQueue5 = new ConcurrentQueue<string>(); | |||
/// <summary> | |||
/// AGV到达工站队列 | |||
/// </summary> | |||
public ConcurrentQueue<string> AGVToWorkStationQueue = new ConcurrentQueue<string>(); | |||
/// <summary> | |||
/// 接收原料数据 | |||
/// </summary> | |||
public RecipeRawMaterial RawMaterial; | |||
public void Init() | |||
{ | |||
RawMaterialsNamePos.Add("1", 1); | |||
RawMaterialsNamePos.Add("2", 2); | |||
RawMaterialsNamePos.Add("3", 3); | |||
RawMaterialsNamePos.Add("4", 4); | |||
RawMaterialsNamePos.Add("5", 5); | |||
RawMaterialsNamePos.Add("6", 6); | |||
RawMaterialsNamePos.Add("7", 7); | |||
RawMaterialsNamePos.Add("8", 8); | |||
RawMaterialsNamePos.Add("9", 9); | |||
RawMaterialsNamePos.Add("10", 10); | |||
RawMaterialsNamePos.Add("11", 11); | |||
RawMaterialsNamePos.Add("12", 12); | |||
ActionManage.GetInstance.Register(new Action<object>((res) => | |||
{ | |||
ObservableCollection<RawMaterial> RawMaterials = new ObservableCollection<RawMaterial>(); | |||
@@ -87,7 +71,7 @@ namespace BPASmartClient.JXJFoodBigStation.Model | |||
RawMaterialBarrelNum = recipe.Material[i].Material_BarrelNum, | |||
RawMaterialWeight = recipe.Material[i].Material_Weight, | |||
RawMaterialLocation = (int)RawMaterialsNamePos[recipe.Material[i].Material_Name] | |||
}); | |||
}); | |||
} | |||
else | |||
{ | |||
@@ -99,7 +83,7 @@ namespace BPASmartClient.JXJFoodBigStation.Model | |||
RecipeName = recipe.RecipeName, | |||
RecipeCode = recipe.RecipeCode, | |||
RawMaterial = RawMaterials, | |||
TrayCode = recipe.TrayCode | |||
//TrayCode = recipe.Order_No, | |||
}); | |||
} | |||
} | |||
@@ -108,7 +92,7 @@ namespace BPASmartClient.JXJFoodBigStation.Model | |||
string Siemens_PLC_IP = ConfigurationManager.AppSettings["Siemens_IP"]; | |||
try | |||
{ | |||
HKDevice.HK_PLC_S7.Connect(S7.Net.CpuType.S71500, HK_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) | |||
{ | |||
@@ -138,136 +122,16 @@ namespace BPASmartClient.JXJFoodBigStation.Model | |||
item.RawMaterialLocation = Convert.ToInt32(item.RawMaterialName); | |||
} | |||
} | |||
MessageNotify.GetInstance.ShowAlarmLog("海科plc连接失败"); | |||
} | |||
}), "ManualSendRecipe", true); | |||
RecipeQueue1.Clear(); | |||
//Json<RemoteRecipeDataColl>.Data.Recipes = TestData.GetInstance.Recipes;//添加测试数据 | |||
ThreadManage.GetInstance().StartLong(new Action(() => | |||
{ | |||
//ReadPLCDeviceInfo(); | |||
ReceviceData(); | |||
RecipeInfoToHKPLC(); | |||
Thread.Sleep(10); | |||
}), "流程处理", true); | |||
ThreadManage.GetInstance().StartLong(new Action(() => | |||
{ | |||
if (HKDevice.IsConnected && SiemensDevice.IsConnected) | |||
{ | |||
AgvGetInOut(); | |||
} | |||
Thread.Sleep(10); | |||
}), "AGV进站送取货", true); | |||
ThreadManage.GetInstance().StartLong(new Action(() => | |||
{ | |||
ReadSiemensCommData(); | |||
ReadHKPLCCommData(); | |||
Thread.Sleep(10); | |||
}), "读取西门子和海科PLC的数据", true); | |||
} | |||
/// <summary> | |||
/// AGV送货 | |||
/// </summary> | |||
/// <param name="bitNum"></param> | |||
private void AGV_Delivery(int bitNum) | |||
{ | |||
if ((ReadSiemens("M4002." + bitNum) is bool) && BigStation.AgvDeliveryPosition == 0) | |||
{ | |||
BigStation.AgvDeliveryPosition = 1; | |||
WriteHKPLC("M4002." + bitNum, true); | |||
WriteSiemens("M4002." + bitNum, false); | |||
} | |||
else if (ReadHK("M5002." + bitNum) is bool && BigStation.AgvDeliveryPosition == 1) | |||
{ | |||
BigStation.AgvDeliveryPosition = 2; | |||
WriteSiemens("M5002." + bitNum, true); | |||
WriteHKPLC("M5002." + bitNum, false); | |||
} | |||
else if (ReadSiemens("M4004." + bitNum) is bool && BigStation.AgvDeliveryPosition == 2) | |||
{ | |||
BigStation.AgvDeliveryPosition = 3; | |||
WriteHKPLC("M4004." + bitNum, true); | |||
WriteSiemens("M4004." + bitNum, false); | |||
} | |||
else if (ReadHK("M5004." + bitNum) is bool && BigStation.AgvDeliveryPosition == 3) | |||
{ | |||
BigStation.AgvDeliveryPosition = 4; | |||
WriteSiemens("M5004." + bitNum, true); | |||
WriteHKPLC("M5004." + bitNum, false); | |||
} | |||
else if (ReadSiemens("M4005." + bitNum) is bool && BigStation.AgvDeliveryPosition == 4) | |||
{ | |||
BigStation.AgvDeliveryPosition = 5; | |||
WriteHKPLC("M4005." + bitNum, true); | |||
WriteSiemens("M4005." + bitNum, false); | |||
} | |||
else if (ReadHK("M5005." + bitNum) is bool && BigStation.AgvDeliveryPosition == 5) | |||
{ | |||
WriteSiemens("M5005." + bitNum, true); | |||
WriteHKPLC("M5005." + bitNum, false); | |||
} | |||
} | |||
/// <summary> | |||
/// AGV取货 | |||
/// </summary> | |||
/// <param name="bitNum"></param> | |||
private void AGV_Pick(int bitNum) | |||
{ | |||
if (ReadSiemens("M4003" + bitNum) is bool && BigStation.AgvPickUpPosition == 0) | |||
{ | |||
BigStation.AgvPickUpPosition = 1; | |||
WriteHKPLC("M4003." + bitNum, true); | |||
WriteSiemens("M4003." + bitNum, false); | |||
} | |||
if (ReadHK("M5003" + bitNum) is bool && BigStation.AgvPickUpPosition == 1) | |||
{ | |||
BigStation.AgvPickUpPosition = 2; | |||
WriteSiemens("M5003" + bitNum, true); | |||
WriteHKPLC("M5003" + bitNum, false); | |||
} | |||
if (ReadSiemens("M4006." + bitNum) is bool && BigStation.AgvPickUpPosition == 2) | |||
{ | |||
BigStation.AgvPickUpPosition = 3; | |||
WriteHKPLC("M4006." + bitNum, true); | |||
WriteSiemens("M4006." + bitNum, false); | |||
} | |||
if (ReadHK("M5006." + bitNum) is bool && BigStation.AgvPickUpPosition == 3) | |||
{ | |||
WriteSiemens("M5006." + bitNum, true); | |||
WriteHKPLC("M5006." + bitNum, false); | |||
} | |||
} | |||
/// <summary> | |||
/// AGV进站送货 | |||
/// </summary> | |||
private void AgvGetInOut() | |||
{ | |||
//获取工位上是否有小车 | |||
SiemensDevice.Siemens_PLC_S7.Write<bool>(SiemensCommAddress.StationIsExistCar, (bool) | |||
HKDevice.HK_PLC_S7.Read<bool>("M4007.0")); | |||
//检测AGV到站信号 | |||
if (AGVToWorkStationQueue.Count > 0) | |||
{ | |||
int index = Array.FindIndex(RemoteRecipes.ToArray(), p => p.RecipeCode == AGVToWorkStationQueue.ElementAt(0)); | |||
int TrayLocation = RemoteRecipes.ElementAt(index).TrayCode;//根据配方编号,找到托盘的ID 托盘ID1-6 | |||
string RecipeCode = (string)RemoteRecipes.ElementAt(index).RecipeCode; | |||
if (TrayLocation > 0 && TrayLocation < 7) | |||
{ | |||
AGV_Delivery(TrayLocation - 1); | |||
if (BigStation.AgvDeliveryPosition == 5) | |||
{ | |||
BigStation.AgvDeliveryPosition = 0; | |||
} | |||
AGV_Pick(TrayLocation - 1); | |||
if (BigStation.AgvPickUpPosition == 3) | |||
{ | |||
BigStation.AgvPickUpPosition = 0; | |||
AGVToWorkStationQueue.TryDequeue(out RecipeCode); | |||
} | |||
} | |||
} | |||
} | |||
private void ReceviceData() | |||
{ | |||
@@ -318,6 +182,10 @@ namespace BPASmartClient.JXJFoodBigStation.Model | |||
RecipeQueue4.Clear(); | |||
RecipeQueue5.Clear(); | |||
BigStation.Recipe1DosingStatus = 0; | |||
BigStation.Recipe2DosingStatus = 0; | |||
BigStation.Recipe3DosingStatus = 0; | |||
BigStation.Recipe4DosingStatus = 0; | |||
BigStation.Recipe5DosingStatus = 0; | |||
} | |||
} | |||
private void RecipeInfoToHKPLC() | |||
@@ -333,23 +201,20 @@ namespace BPASmartClient.JXJFoodBigStation.Model | |||
{ | |||
HKDevice.StockBinPar(RemoteRecipes.ElementAt(index)); | |||
HKDevice.PlcWrite.Recipe1IssuedFinish = true; | |||
//HKDevice.HK_PLC_S7.Write<bool>("DB98.DBX0.1", false);//复位允许下发配方1信号 | |||
BigStation.Recipe1DosingStatus = 1; | |||
MessageLog.GetInstance.ShowRunLog($"配方状态:{code}下发完成"); | |||
MessageNotify.GetInstance.ShowRunLog($"配方编号:{code},托盘编号:{trayCode},下发完成"); | |||
} | |||
if (HKDevice.PlcRead.ReceiveFinishRecipe1 && BigStation.Recipe1DosingStatus == 1) | |||
{ | |||
BigStation.Recipe1DosingStatus = 2; | |||
HKDevice.PlcWrite.Recipe1IssuedFinish = false; | |||
HKDevice.PlcWrite.RecipeCode = 0; | |||
HKDevice.PlcWrite.TrayCode = 0; | |||
WeightReset(); | |||
MessageLog.GetInstance.ShowRunLog($"配方状态:{code}配方配料"); | |||
StockBinParReset(); | |||
MessageNotify.GetInstance.ShowRunLog($"配方编号:{code},托盘编号:{trayCode},PLC接收配方完成"); | |||
} | |||
if (BigStation.Recipe1DosingStatus == 2 && HKDevice.PlcRead.Recipe1DosingFinish) | |||
{ | |||
BigStation.Recipe1DosingStatus = 3; | |||
MessageLog.GetInstance.ShowRunLog($"配方状态:{code}配料完成"); | |||
MessageNotify.GetInstance.ShowRunLog($"配方状态:{code}配料完成"); | |||
if (HKDevice.PlcRead.Recipe1TrayCode == 1) | |||
{ | |||
foreach (var item in RemoteRecipes.ElementAt(index).RawMaterial) | |||
@@ -425,7 +290,6 @@ namespace BPASmartClient.JXJFoodBigStation.Model | |||
{ | |||
SiemensDevice.Siemens_PLC_S7.WriteClass<DL_Finish_DB>(FinishData, 3); | |||
} | |||
//HKDevice.HK_PLC_S7.Write<bool>("DB98.DBX1.1",false); | |||
RecipeQueue1.TryDequeue(out code); | |||
IssuedComplete.Add(RemoteRecipes.ElementAt(index));//将该配方添加到下 | |||
if (!BigStation.IsAllowManual) | |||
@@ -453,21 +317,19 @@ namespace BPASmartClient.JXJFoodBigStation.Model | |||
HKDevice.StockBinPar(RemoteRecipes.ElementAt(index)); | |||
HKDevice.PlcWrite.Recipe2IssuedFinish = true; | |||
BigStation.Recipe2DosingStatus = 1; | |||
MessageLog.GetInstance.ShowRunLog($"配方状态:{code}下发完成"); | |||
MessageNotify.GetInstance.ShowRunLog($"配方状态:{code}下发完成"); | |||
} | |||
if (HKDevice.PlcRead.ReceiveFinishRecipe2 && BigStation.Recipe2DosingStatus == 1) | |||
{ | |||
BigStation.Recipe2DosingStatus = 2; | |||
HKDevice.PlcWrite.Recipe2IssuedFinish = false; | |||
HKDevice.PlcWrite.RecipeCode = 0; | |||
HKDevice.PlcWrite.TrayCode = 0; | |||
WeightReset(); | |||
MessageLog.GetInstance.ShowRunLog($"配方状态:{code}配方配料"); | |||
StockBinParReset(); | |||
MessageNotify.GetInstance.ShowRunLog($"配方状态:{code}配方配料"); | |||
} | |||
if (BigStation.Recipe2DosingStatus == 2 && HKDevice.PlcRead.Recipe2DosingFinish) | |||
{ | |||
BigStation.Recipe2DosingStatus = 3; | |||
MessageLog.GetInstance.ShowRunLog($"配方状态:{code}配料完成"); | |||
MessageNotify.GetInstance.ShowRunLog($"配方状态:{code}配料完成"); | |||
if (HKDevice.PlcRead.Recipe2TrayCode > 0) | |||
{ | |||
foreach (var item in RemoteRecipes.ElementAt(index).RawMaterial) | |||
@@ -529,7 +391,6 @@ namespace BPASmartClient.JXJFoodBigStation.Model | |||
item.Laying_Off_Weight = HKDevice.PlcRead.StockBin14ActualWeight; | |||
} | |||
} | |||
FinishData.Order_No = RemoteRecipes.ElementAt(index).RecipeCode; | |||
FinishData.Product_Code = RemoteRecipes.ElementAt(index).RecipeName; | |||
for (int i = 0; i < RemoteRecipes.ElementAt(index).RawMaterial.Count; i++) | |||
@@ -539,11 +400,11 @@ namespace BPASmartClient.JXJFoodBigStation.Model | |||
FinishData.Material[i].Material_BarrelNum = (short)RemoteRecipes.ElementAt(index).RawMaterial.ElementAt(i).RawMaterialBarrelNum; | |||
FinishData.Material[i].Material_Laying_Off_Weight = RemoteRecipes.ElementAt(index).RawMaterial.ElementAt(i).Laying_Off_Weight; | |||
} | |||
} | |||
if (SiemensDevice.IsConnected) | |||
{ | |||
SiemensDevice.Siemens_PLC_S7.WriteClass<DL_Finish_DB>(FinishData, 3); | |||
MessageNotify.GetInstance.ShowRunLog($"配方配料完成,将信号反馈给西门子"); | |||
} | |||
RecipeQueue2.TryDequeue(out code); | |||
IssuedComplete.Add(RemoteRecipes.ElementAt(index));//将该配方添加到下 | |||
@@ -556,7 +417,6 @@ namespace BPASmartClient.JXJFoodBigStation.Model | |||
Json<LocalRecipeDataColl>.Data.Recipes.RemoveAt(index);//制作完成,移除当前配方 | |||
} | |||
BigStation.Recipe2DosingStatus = 0; | |||
} | |||
} | |||
} | |||
@@ -572,20 +432,18 @@ namespace BPASmartClient.JXJFoodBigStation.Model | |||
HKDevice.StockBinPar(RemoteRecipes.ElementAt(index)); | |||
HKDevice.PlcWrite.Recipe3IssuedFinish = true; | |||
BigStation.Recipe3DosingStatus = 1; | |||
MessageLog.GetInstance.ShowRunLog($"配方状态:{code}下发完成"); | |||
MessageNotify.GetInstance.ShowRunLog($"配方状态:{code}下发完成"); | |||
} | |||
if (HKDevice.PlcRead.ReceiveFinishRecipe3 && BigStation.Recipe3DosingStatus == 1) | |||
{ | |||
BigStation.Recipe3DosingStatus = 2; | |||
HKDevice.PlcWrite.RecipeCode = 0; | |||
HKDevice.PlcWrite.TrayCode = 0; | |||
WeightReset(); | |||
MessageLog.GetInstance.ShowRunLog($"配方状态:{code}配方配料"); | |||
StockBinParReset(); | |||
MessageNotify.GetInstance.ShowRunLog($"配方状态:{code}配方配料"); | |||
} | |||
if (HKDevice.PlcRead.Recipe3DosingFinish && BigStation.Recipe3DosingStatus == 2) | |||
{ | |||
BigStation.Recipe3DosingStatus = 3; | |||
MessageLog.GetInstance.ShowRunLog($"配方状态:{code}配料完成"); | |||
MessageNotify.GetInstance.ShowRunLog($"配方状态:{code}配料完成"); | |||
if (HKDevice.PlcRead.Recipe3TrayCode > 0) | |||
{ | |||
foreach (var item in RemoteRecipes.ElementAt(index).RawMaterial) | |||
@@ -691,21 +549,19 @@ namespace BPASmartClient.JXJFoodBigStation.Model | |||
HKDevice.StockBinPar(RemoteRecipes.ElementAt(index)); | |||
HKDevice.PlcWrite.Recipe4IssuedFinish = true; | |||
BigStation.Recipe4DosingStatus = 1; | |||
MessageLog.GetInstance.ShowRunLog($"配方状态:{code}下发完成"); | |||
MessageNotify.GetInstance.ShowRunLog($"配方状态:{code}下发完成"); | |||
} | |||
if (HKDevice.PlcRead.ReceiveFinishRecipe4 && BigStation.Recipe4DosingStatus == 1) | |||
{ | |||
BigStation.Recipe4DosingStatus = 2; | |||
HKDevice.PlcWrite.Recipe4IssuedFinish = false; | |||
HKDevice.PlcWrite.RecipeCode = 0; | |||
HKDevice.PlcWrite.TrayCode = 0; | |||
WeightReset(); | |||
MessageLog.GetInstance.ShowRunLog($"配方状态:{code}配方配料"); | |||
StockBinParReset(); | |||
MessageNotify.GetInstance.ShowRunLog($"配方状态:{code}配方配料"); | |||
} | |||
if (BigStation.Recipe4DosingStatus == 2 && HKDevice.PlcRead.Recipe4DosingFinish) | |||
{ | |||
BigStation.Recipe4DosingStatus = 3; | |||
MessageLog.GetInstance.ShowRunLog($"配方状态:{code}配料完成"); | |||
MessageNotify.GetInstance.ShowRunLog($"配方状态:{code}配料完成"); | |||
if (HKDevice.PlcRead.Recipe4TrayCode > 0) | |||
{ | |||
foreach (var item in RemoteRecipes.ElementAt(index).RawMaterial) | |||
@@ -799,128 +655,15 @@ namespace BPASmartClient.JXJFoodBigStation.Model | |||
} | |||
} | |||
} | |||
public ConcurrentDictionary<string, Object> ReadHKPLCData = new ConcurrentDictionary<string, object>(); | |||
public ConcurrentDictionary<string, Object> ReadSiemensData = new ConcurrentDictionary<string, object>(); | |||
private void ReadSiemensCommData() | |||
{ | |||
if (SiemensDevice.IsConnected) | |||
{ | |||
GetSiemensStatus("", new Action<object>((obj) => | |||
{ | |||
if (obj is bool[] bools && bools.Length > 0) | |||
{ | |||
} | |||
})); | |||
} | |||
} | |||
private void ReadHKPLCCommData() | |||
{ | |||
if (HKDevice.IsConnected) | |||
{ | |||
GetHKStatus("", new Action<object>((obj) => | |||
{ | |||
if (obj is bool[] bools && bools.Length > 0) | |||
{ | |||
} | |||
})); | |||
} | |||
} | |||
private void GetHKStatus(string key, Action<object> action) | |||
{ | |||
if (ReadHKPLCData.ContainsKey(key)) | |||
{ | |||
if (ReadHKPLCData[key] != null) | |||
{ | |||
action?.Invoke(ReadHKPLCData[key]); | |||
} | |||
} | |||
} | |||
private void GetSiemensStatus(string key, Action<object> action) | |||
{ | |||
if (ReadSiemensData.ContainsKey(key)) | |||
{ | |||
if (ReadSiemensData[key] != null) | |||
{ | |||
action?.Invoke(ReadSiemensData[key]); | |||
} | |||
} | |||
} | |||
private void WriteSiemens(string Address, object Value) | |||
{ | |||
if (SiemensDevice.IsConnected) | |||
{ | |||
SiemensDevice.Siemens_PLC_S7.Write<object>(Address, Value); | |||
} | |||
} | |||
private void WriteHKPLC(string Address, object Value) | |||
{ | |||
HKDevice.HK_PLC_S7.Write<object>(Address, Value); | |||
} | |||
private object ReadSiemens(string Address) | |||
{ | |||
if (SiemensDevice.IsConnected) | |||
{ | |||
return SiemensDevice.Siemens_PLC_S7.Read<object>(Address); | |||
} | |||
else | |||
{ | |||
return null; | |||
} | |||
} | |||
private bool[] ReadBoolsSiemens(int address, int count) | |||
{ | |||
if (SiemensDevice.IsConnected) | |||
{ | |||
return SiemensDevice.Siemens_PLC_S7.ReadBools(address, count); | |||
} | |||
else | |||
{ | |||
return null; | |||
} | |||
} | |||
private object ReadHK(string Address) | |||
{ | |||
if (HKDevice.IsConnected) | |||
{ | |||
return HKDevice.HK_PLC_S7.Read<object>(Address); | |||
} | |||
else | |||
{ | |||
return null; | |||
} | |||
} | |||
private bool[] ReadBoolsHK(int address, int count) | |||
{ | |||
if (HKDevice.IsConnected) | |||
{ | |||
return HKDevice.HK_PLC_S7.ReadBools(address, count); | |||
} | |||
else | |||
{ | |||
return null; | |||
} | |||
} | |||
/// <summary> | |||
/// 获取料仓的原料名称和原料位置 | |||
/// 下发配方的数据复位 | |||
/// </summary> | |||
private void ReadPLCDeviceInfo() | |||
{ | |||
/*for (int i = 0; i < 12; i++) | |||
{ | |||
string RawMaterialName = HKDevice.HK_PLC_S7.Read<string>(""); | |||
short RawMaterialLocation = HKDevice.HK_PLC_S7.Read<short>(""); | |||
if (RawMaterialsNamePos.ContainsKey(RawMaterialName)) | |||
RawMaterialsNamePos.Add(RawMaterialName, RawMaterialLocation); | |||
}*/ | |||
} | |||
private void WeightReset() | |||
private void StockBinParReset() | |||
{ | |||
HKDevice.PlcWrite.RecipeCode = 0; | |||
HKDevice.PlcWrite.TrayCode = 0; | |||
HKDevice.PlcWrite.Bareel1Bin1SetWeight = 0; | |||
HKDevice.PlcWrite.Bareel1Bin2SetWeight = 0; | |||
HKDevice.PlcWrite.Bareel1Bin3SetWeight = 0; | |||
@@ -982,5 +725,82 @@ namespace BPASmartClient.JXJFoodBigStation.Model | |||
HKDevice.PlcWrite.Bareel5Bin13SetWeight = 0; | |||
HKDevice.PlcWrite.Bareel5Bin14SetWeight = 0; | |||
} | |||
private void testData() | |||
{ | |||
RawMaterialsNamePos.Clear(); | |||
if (!HKDevice.IsConnected) | |||
{ | |||
HKDevice.StockBinName.RawMaterialName1 = "1"; | |||
HKDevice.StockBinName.RawMaterialName2 = "2"; | |||
HKDevice.StockBinName.RawMaterialName3 = "3"; | |||
HKDevice.StockBinName.RawMaterialName4 = "4"; | |||
HKDevice.StockBinName.RawMaterialName5 = "5"; | |||
HKDevice.StockBinName.RawMaterialName6 = "6"; | |||
HKDevice.StockBinName.RawMaterialName7 = "7"; | |||
HKDevice.StockBinName.RawMaterialName8 = "8"; | |||
HKDevice.StockBinName.RawMaterialName9 = "9"; | |||
HKDevice.StockBinName.RawMaterialName10 = "10"; | |||
HKDevice.StockBinName.RawMaterialName11 = "11"; | |||
HKDevice.StockBinName.RawMaterialName12 = "12"; | |||
HKDevice.StockBinName.RawMaterialName13 = "13"; | |||
HKDevice.StockBinName.RawMaterialName14 = "14"; | |||
} | |||
if (!RawMaterialsNamePos.ContainsKey(HKDevice.StockBinName.RawMaterialName1)) | |||
{ | |||
RawMaterialsNamePos.Add(HKDevice.StockBinName.RawMaterialName1, 1); | |||
} | |||
if (!RawMaterialsNamePos.ContainsKey(HKDevice.StockBinName.RawMaterialName2)) | |||
{ | |||
RawMaterialsNamePos.Add(HKDevice.StockBinName.RawMaterialName2, 2); | |||
} | |||
if (!RawMaterialsNamePos.ContainsKey(HKDevice.StockBinName.RawMaterialName3)) | |||
{ | |||
RawMaterialsNamePos.Add(HKDevice.StockBinName.RawMaterialName3, 3); | |||
} | |||
if (!RawMaterialsNamePos.ContainsKey(HKDevice.StockBinName.RawMaterialName4)) | |||
{ | |||
RawMaterialsNamePos.Add(HKDevice.StockBinName.RawMaterialName4, 4); | |||
} | |||
if (!RawMaterialsNamePos.ContainsKey(HKDevice.StockBinName.RawMaterialName5)) | |||
{ | |||
RawMaterialsNamePos.Add(HKDevice.StockBinName.RawMaterialName5, 5); | |||
} | |||
if (!RawMaterialsNamePos.ContainsKey(HKDevice.StockBinName.RawMaterialName6)) | |||
{ | |||
RawMaterialsNamePos.Add(HKDevice.StockBinName.RawMaterialName6, 6); | |||
} | |||
if (!RawMaterialsNamePos.ContainsKey(HKDevice.StockBinName.RawMaterialName7)) | |||
{ | |||
RawMaterialsNamePos.Add(HKDevice.StockBinName.RawMaterialName7, 7); | |||
} | |||
if (!RawMaterialsNamePos.ContainsKey(HKDevice.StockBinName.RawMaterialName8)) | |||
{ | |||
RawMaterialsNamePos.Add(HKDevice.StockBinName.RawMaterialName8, 8); | |||
} | |||
if (!RawMaterialsNamePos.ContainsKey(HKDevice.StockBinName.RawMaterialName9)) | |||
{ | |||
RawMaterialsNamePos.Add(HKDevice.StockBinName.RawMaterialName9, 9); | |||
} | |||
if (!RawMaterialsNamePos.ContainsKey(HKDevice.StockBinName.RawMaterialName10)) | |||
{ | |||
RawMaterialsNamePos.Add(HKDevice.StockBinName.RawMaterialName10, 10); | |||
} | |||
if (!RawMaterialsNamePos.ContainsKey(HKDevice.StockBinName.RawMaterialName11)) | |||
{ | |||
RawMaterialsNamePos.Add(HKDevice.StockBinName.RawMaterialName11, 11); | |||
} | |||
if (!RawMaterialsNamePos.ContainsKey(HKDevice.StockBinName.RawMaterialName12)) | |||
{ | |||
RawMaterialsNamePos.Add(HKDevice.StockBinName.RawMaterialName12, 12); | |||
} | |||
if (!RawMaterialsNamePos.ContainsKey(HKDevice.StockBinName.RawMaterialName13)) | |||
{ | |||
RawMaterialsNamePos.Add(HKDevice.StockBinName.RawMaterialName13, 13); | |||
} | |||
if (!RawMaterialsNamePos.ContainsKey(HKDevice.StockBinName.RawMaterialName14)) | |||
{ | |||
RawMaterialsNamePos.Add(HKDevice.StockBinName.RawMaterialName14, 14); | |||
} | |||
} | |||
} | |||
} |
@@ -0,0 +1,39 @@ | |||
using BPASmartClient.S7Net; | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
namespace BPASmartClient.JXJFoodBigStation.Model.Siemens | |||
{ | |||
public class DL_DataColl_DB | |||
{ | |||
[Siemens(16)] | |||
public string RecipeCode { get; set; } | |||
[Siemens(16)] | |||
public string RecipeName { get; set; } | |||
public bool var1 { get; set; } | |||
public bool var2 { get; set; } | |||
public bool var3 { get; set; } | |||
public bool var4 { get; set; } | |||
public bool var5 { get; set; } | |||
public bool var6 { get; set; } | |||
public bool var7 { get; set; } | |||
public bool var8 { get; set; } | |||
public bool var9 { get; set; } | |||
public short Mode { get; set; } | |||
public bool[] Alarm { get; set; } = new bool[24]; | |||
public int Reserved1 { get; set; } | |||
public int Reserved2 { get; set; } | |||
} | |||
} |
@@ -1,4 +1,5 @@ | |||
using System; | |||
using BPASmartClient.S7Net; | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Text; | |||
@@ -8,32 +9,42 @@ namespace BPASmartClient.JXJFoodBigStation.Model.Siemens | |||
{ | |||
internal class DL_Finish_DB | |||
{ | |||
/// <summary> | |||
/// 配料完成信号确认 | |||
/// </summary> | |||
public bool Ask_For_Finish_PLC { get; set; } | |||
public short[] StandbyFinish { get; set; } = new short[4]; | |||
[Siemens(16)] | |||
/// <summary> | |||
/// 生产工单编码 | |||
/// </summary> | |||
public string Order_No; | |||
public string Order_No{get; set; } | |||
[Siemens(16)] | |||
/// <summary> | |||
/// 产品名称 | |||
/// </summary> | |||
public string Product_Code; | |||
public string Product_Code { get; set; } | |||
public short job_No { get; set; } | |||
/// <summary> | |||
/// 原料信息 | |||
/// </summary> | |||
public UDT1[] Material = new UDT1[20]; | |||
public UDT1[] Material { get; set; } = new UDT1[20]; | |||
public short ProcessTime { get; set; } | |||
/// <summary> | |||
/// 配料完成信号 | |||
/// </summary> | |||
public bool Ask_For_Finish; | |||
/// <summary> | |||
/// 配料完成信号确认 | |||
/// </summary> | |||
public bool Ask_For_Finish_PLC; | |||
public bool Ask_For_Finish { get; set; } | |||
public short[] StandbyFinish1 { get; set; } = new short[4]; | |||
} | |||
public class UDT1 | |||
{ | |||
public string Material_Name; | |||
public float Material_Laying_Off_Weight; | |||
public short Material_BarrelNum; | |||
[Siemens(6)] | |||
public string Material_Name { get; set; } | |||
public float Material_Laying_Off_Weight { get; set; } | |||
public short Material_BarrelNum { get; set; } | |||
} | |||
} |
@@ -1,4 +1,5 @@ | |||
using System; | |||
using BPASmartClient.S7Net; | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Text; | |||
@@ -8,44 +9,46 @@ namespace BPASmartClient.JXJFoodBigStation.Model.Siemens | |||
{ | |||
internal class DL_Start_DB | |||
{ | |||
[Siemens(16)] | |||
/// <summary> | |||
/// 配方编码 | |||
/// </summary> | |||
public string RecipeCode; | |||
public string RecipeCode { get; set; } | |||
[Siemens(16)] | |||
/// <summary> | |||
/// 配发名称 | |||
/// </summary> | |||
public string RecipeName; | |||
public string RecipeName { get; set; } | |||
public short Order_No { get; set; } | |||
public short Pallet_No { get; set; } | |||
/// <summary> | |||
/// 物料信息 | |||
/// </summary> | |||
public UDT[] Material = new UDT[20]; | |||
/// <summary> | |||
/// 托盘编号 | |||
/// </summary> | |||
public int TrayCode; | |||
public UDT[] Material { get; set; } = new UDT[20]; | |||
public bool Order_Type { get; set; } | |||
public bool Order_Request_Ack { get; set; } | |||
public short[] Standby { get; set; } = new short[4]; | |||
/// <summary> | |||
/// 配方发送请求 | |||
/// </summary> | |||
public bool Ask_For_Send_Bit; | |||
/// <summary> | |||
/// 上位机确认配方接收完成 | |||
/// </summary> | |||
public bool Ack_Ask_For_Send_Bit; | |||
public bool Ask_For_Send_Bit { get; set; } | |||
public short[] Standby1 { get; set; } = new short[4]; | |||
} | |||
public class UDT | |||
{ | |||
[Siemens(6)] | |||
/// <summary> | |||
/// 原料名称 | |||
/// </summary> | |||
public string Material_Name; | |||
public string Material_Name { get; set; } | |||
/// <summary> | |||
/// 原料重量 | |||
/// </summary> | |||
public float Material_Weight; | |||
public float Material_Weight { get; set; } | |||
/// <summary> | |||
/// 原料桶号 | |||
/// </summary> | |||
public short Material_BarrelNum; | |||
public short Material_BarrelNum { get; set; } | |||
} | |||
} |
@@ -1,4 +1,5 @@ | |||
using System; | |||
using BPASmartClient.S7Net; | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Text; | |||
@@ -8,53 +9,36 @@ namespace BPASmartClient.JXJFoodBigStation.Model.Siemens | |||
{ | |||
internal class DL_Status_DB | |||
{ | |||
/// <summary> | |||
/// 生产工单 | |||
/// </summary> | |||
public string RecipeCode; | |||
/// <summary> | |||
/// 配料开始 | |||
/// </summary> | |||
public bool Dosing_Start; | |||
public bool Dosing_Start { get; set; } | |||
/// <summary> | |||
/// 配料开始确认 | |||
/// </summary> | |||
public bool Dosing_Confirm; | |||
/// <summary> | |||
/// 托盘占位情况 | |||
/// </summary> | |||
public bool[] Pallet_Position_Occ = new bool[16]; | |||
/// <summary> | |||
/// 工位允许放货架 | |||
/// </summary> | |||
public bool[] Allow_AGV_Put = new bool[16]; | |||
/// <summary> | |||
/// 工位允许取货架 | |||
/// </summary> | |||
public bool[] Allow_AGV_Get = new bool[16]; | |||
/// <summary> | |||
/// AGV请求放货架 | |||
/// </summary> | |||
public bool[] AGV_Request_Put = new bool[16]; | |||
/// <summary> | |||
/// AGV请求取货架 | |||
/// </summary> | |||
public bool[] AGV_Request_Get = new bool[16]; | |||
/// <summary> | |||
/// AGV放托盘完成 | |||
/// </summary> | |||
public bool[] AGV_Put_Done = new bool[16]; | |||
/// <summary> | |||
/// 托盘号 | |||
/// </summary> | |||
public short[] Pan_No = new short[16]; | |||
/// <summary> | |||
/// 配料时间 | |||
/// </summary> | |||
public int DosingTime; | |||
public bool Dosing_Confirm { get; set; } | |||
public bool Dosing_Cancel { get; set; } | |||
public bool Dosing_Cancel2 { get; set; } | |||
public bool Dosing_Cancel3 { get; set; } | |||
public short a { get; set; } | |||
public short[] Standby { get; set; } = new short[3]; | |||
[Siemens(16)] | |||
/// <summary> | |||
/// 备用 | |||
/// 生产工单 | |||
/// </summary> | |||
public byte Reserve; | |||
public string RecipeCode { get; set; } | |||
public bool Dosing_Cancel4 { get; set; } | |||
public bool Dosing_Cancel5 { get; set; } | |||
public bool Dosing_Cancel6 { get; set; } | |||
public bool Dosing_Cancel7 { get; set; } | |||
public short Dosing_Cancel8 { get; set; } | |||
public short[] Standby2 { get; set; } = new short[4]; | |||
} | |||
} |
@@ -21,21 +21,22 @@ namespace BPASmartClient.JXJFoodBigStation.Model.Siemens | |||
{ | |||
ThreadManage.GetInstance().StartLong(new Action(() => | |||
{ | |||
var res = this.Siemens_PLC_S7.ReadClass<DL_Start_DB>(1); | |||
var res1 = this.Siemens_PLC_S7.ReadClass<DL_Status_DB>(2); | |||
var res2 = this.Siemens_PLC_S7.ReadClass<DL_Finish_DB>(3); | |||
if (res != null && RTrig.GetInstance("RecipeTrig").Start(res.Ask_For_Send_Bit)) | |||
var res = this.Siemens_PLC_S7.ReadClass<DL_Start_DB>(2301); | |||
var res1 = this.Siemens_PLC_S7.ReadClass<DL_Status_DB>(2331); | |||
var res2 = this.Siemens_PLC_S7.ReadClass<DL_Finish_DB>(2361); | |||
var res3 = this.Siemens_PLC_S7.ReadClass<DL_DataColl_DB>(2391); | |||
/*if (res != null && RTrig.GetInstance("RecipeTrig").Start(res.Ask_For_Send_Bit)) | |||
{ | |||
ActionManage.GetInstance.Send("SiemensSendRecipe", res); | |||
res.Ask_For_Send_Bit = false;//接受配方信号复位 | |||
res.Ack_Ask_For_Send_Bit = true;//配方接受完成 | |||
//res.Ack_Ask_For_Send_Bit = true;//配方接受完成 | |||
this.Siemens_PLC_S7.WriteClass<DL_Start_DB>(res, 1); | |||
} | |||
if (res1 != null && RTrig.GetInstance("Allow_AGV_Put[0]").Start(res1.Allow_AGV_Put[0])) | |||
if (res1 != null && RTrig.GetInstance("Allow_AGV_Put[0]").Start(res1.)) | |||
{ | |||
ActionManage.GetInstance.Send("AGVToStation1Sign", res1); | |||
res1.Allow_AGV_Put[0] = false; | |||
//res1.Allow_AGV_Put[0] = false; | |||
this.Siemens_PLC_S7.WriteClass<DL_Status_DB>(res1, 2); | |||
} | |||
if (res1 != null && RTrig.GetInstance("Allow_AGV_Put[1]").Start(res1.Allow_AGV_Put[1])) | |||
@@ -68,7 +69,7 @@ namespace BPASmartClient.JXJFoodBigStation.Model.Siemens | |||
res1.Allow_AGV_Put[5] = false; | |||
this.Siemens_PLC_S7.WriteClass<DL_Status_DB>(res1, 2); | |||
} | |||
*/ | |||
if (res2 != null && res2.Ask_For_Finish_PLC) | |||
{ | |||
ActionManage.GetInstance.Send("配料完成信号确认完成"); | |||
@@ -80,7 +80,7 @@ namespace BPASmartClient.JXJFoodSmallStation.Model | |||
} | |||
else | |||
{ | |||
MessageNotify.GetInstance.AlarmLog("配方名称与本地不符合"); | |||
//MessageNotify.GetInstance.AlarmLog("配方名称与本地不符合"); | |||
} | |||
} | |||
Json<RemoteRecipeDataColl>.Data.Recipes.Add(new RemoteRecipeData() | |||
@@ -112,7 +112,7 @@ namespace BPASmartClient.JXJFoodSmallStation.Model | |||
try | |||
{ | |||
//HKDevice.HK_PLC_S7.Connect(S7.Net.CpuType.S71200, HK_PLC_IP); | |||
SiemensDevice.Siemens_PLC_S7.Connect(S7.Net.CpuType.S71500, Siemens_PLC_IP); | |||
//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) | |||
{ | |||
@@ -272,7 +272,6 @@ namespace BPASmartClient.JXJFoodSmallStation.Model | |||
break; | |||
default: | |||
break; | |||
} | |||
} | |||
else if (o.ToString().Contains("阻挡气缸")) | |||
@@ -327,7 +326,6 @@ namespace BPASmartClient.JXJFoodSmallStation.Model | |||
break; | |||
default: | |||
break; | |||
} | |||
} | |||
else if (o.ToString().Contains("进料桶顶升气缸")) | |||
@@ -24,6 +24,7 @@ namespace BPASmartClient.JXJFoodSmallStation.Model.Siemens | |||
var res = this.Siemens_PLC_S7.ReadClass<XL_Start_DB>(2201); | |||
var res1 = this.Siemens_PLC_S7.ReadClass<XL_Status_DB>(2231); | |||
var res2 = this.Siemens_PLC_S7.ReadClass<XL_Finish_DB>(2261); | |||
var res4 = this.Siemens_PLC_S7.ReadClass<XL_DataColl_DB>(2291); | |||
if (res != null && res.Order_Request_ACK == false && GVL_SmallStation.GetInstance.IsAllowSiemensSendRecipe) | |||
{ | |||
res.Order_Request_ACK = true; | |||
@@ -0,0 +1,39 @@ | |||
using BPASmartClient.S7Net; | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
namespace BPASmartClient.JXJFoodSmallStation.Model.Siemens | |||
{ | |||
internal class XL_DataColl_DB | |||
{ | |||
[Siemens(16)] | |||
public string RecipeCode { get; set; } | |||
[Siemens(16)] | |||
public string RecipeName { get; set; } | |||
public bool var1 { get; set; } | |||
public bool var2 { get; set; } | |||
public bool var3 { get; set; } | |||
public bool var4 { get; set; } | |||
public bool var5 { get; set; } | |||
public bool var6 { get; set; } | |||
public bool var7 { get; set; } | |||
public bool var8 { get; set; } | |||
public bool var9 { get; set; } | |||
public short Mode { get; set; } | |||
public bool[] Alarm { get; set; } = new bool[24]; | |||
public int Reserved1 { get; set; } | |||
public int Reserved2 { get; set; } | |||
} | |||
} |
@@ -9,33 +9,37 @@ namespace BPASmartClient.JXJFoodSmallStation.Model.Siemens | |||
{ | |||
internal class XL_Finish_DB | |||
{ | |||
[Siemens(6)] | |||
/// <summary> | |||
/// 配料完成信号确认 | |||
/// </summary> | |||
public bool Ask_For_Finish_PLC { get; set; } | |||
public short[] StandbyFinish { get; set; }=new short[4]; | |||
[Siemens(16)] | |||
/// <summary> | |||
/// 生产工单编码 | |||
/// </summary | |||
public string Order_No { get; set; } | |||
[Siemens(6)] | |||
[Siemens(16)] | |||
/// <summary> | |||
/// 产品名称 | |||
/// </summary> | |||
public string Product_Code { get; set; } | |||
public short Job_No { get; set; } | |||
public UDT2[] Powder = new UDT2[10]; | |||
public UDT2[] Powder { get; set; } = new UDT2[10]; | |||
/// <summary> | |||
/// 原料信息 | |||
/// </summary> | |||
public UDT1[] Material = new UDT1[20]; | |||
public UDT1[] Material { get; set; } = new UDT1[20]; | |||
public short DosingTime { get; set; } | |||
/// <summary> | |||
/// 配料完成信号 | |||
/// </summary> | |||
public bool Ask_For_Finish { get; set; } | |||
/// <summary> | |||
/// 配料完成信号确认 | |||
/// </summary> | |||
public bool Ask_For_Finish_PLC { get; set; } | |||
public short[] StandbyFinish2 { get; set; } = new short[4]; | |||
} | |||
public class UDT1 | |||
{ | |||
@@ -23,19 +23,19 @@ namespace BPASmartClient.JXJFoodSmallStation.Model.Siemens | |||
public short StockCode { get; set; } | |||
public short TrayCode { get; set; } | |||
public UDT2Start[] Powder = new UDT2Start[10]; | |||
public UDT2Start[] Powder { get; set; } = new UDT2Start[10]; | |||
/// <summary> | |||
/// 物料信息 | |||
/// </summary> | |||
public UDTStart[] Material = new UDTStart[20]; | |||
public UDTStart[] Material { get; set; } = new UDTStart[20]; | |||
/// <summary> | |||
/// plc确认配方接收完成 | |||
/// </summary> | |||
public bool Order_Request_ACK { get; set; } | |||
public short[] Standby = new short[4]; | |||
public short[] Standby { get; set; } = new short[4]; | |||
public bool Order_Request { get; set; } | |||
public short[] Standby1 = new short[4]; | |||
public short[] Standby1 { get; set; } = new short[4]; | |||
} | |||
public class UDTStart | |||
@@ -7,8 +7,16 @@ using System.Threading.Tasks; | |||
namespace BPASmartClient.JXJFoodSmallStation.Model.Siemens | |||
{ | |||
internal class XL_Status_DB | |||
public class XL_Status_DB | |||
{ | |||
public bool Dosing_Confirm { get; set; } | |||
public bool Agv1 { get; set; } | |||
public bool Agv2 { get; set; } | |||
public bool Agv3 { get; set; } | |||
public bool Agv4 { get; set; } | |||
public short AgvPos { get; set; } | |||
public short[] Standby { get; set; } = new short[3]; | |||
[Siemens(16)] | |||
/// <summary> | |||
/// 生产工单 | |||
@@ -18,23 +26,14 @@ namespace BPASmartClient.JXJFoodSmallStation.Model.Siemens | |||
/// 配料开始 | |||
/// </summary> | |||
public bool Dosing_Start { get; set; } | |||
/// <summary> | |||
/// 配料开始确认 | |||
/// </summary> | |||
public bool Dosing_Confirm; | |||
public bool Agv1 { get; set; } | |||
public bool Agv2 { get; set; } | |||
public bool Agv3 { get; set; } | |||
public bool Agv4 { get; set; } | |||
public short AgvPos { get; set; } | |||
public UDTStatus[] Powder = new UDTStatus[10]; | |||
public bool Agv5{ get; set; } | |||
public bool Agv5 { get; set; } | |||
public bool Agv6 { get; set; } | |||
public bool Agv7 { get; set; } | |||
public int Agv8 { get; set; } | |||
public UDTStatus[] Powder { get; set; } = new UDTStatus[10]; | |||
public short AgvUse { get; set; } | |||
public short[] StandbyStatus { get; set; } = new short[4]; | |||
} | |||
public class UDTStatus | |||
{ | |||
@@ -0,0 +1,15 @@ | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
namespace BPASmartClient.Model | |||
{ | |||
public enum Status | |||
{ | |||
等待配料, | |||
正在配料, | |||
配料完成 | |||
} | |||
} |
@@ -1,6 +1,7 @@ | |||
using Microsoft.Toolkit.Mvvm.ComponentModel; | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Drawing; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
@@ -97,6 +98,9 @@ namespace BPASmartClient.Model | |||
public float UpLimtWeightFeedback { get { return _mUpLimtWeightFeedback; } set { _mUpLimtWeightFeedback = value; OnPropertyChanged(); } } | |||
private float _mUpLimtWeightFeedback; | |||
/// <summary> | |||
/// 原料设备执行状态 | |||
/// 1:等待配料 | |||
@@ -104,7 +108,26 @@ namespace BPASmartClient.Model | |||
/// 3:下料完成 | |||
/// </summary> | |||
[Newtonsoft.Json.JsonIgnore] | |||
public ushort RecipeStatus { get { return _mRecipeStatus; } set { _mRecipeStatus = value; OnPropertyChanged(); } } | |||
public ushort RecipeStatus | |||
{ | |||
get { return _mRecipeStatus; } | |||
set | |||
{ | |||
_mRecipeStatus = value; | |||
if (value == 1) Status = Status.等待配料; | |||
else if (value == 2) Status = Status.正在配料; | |||
else if (value == 3) Status = Status.配料完成; | |||
OnPropertyChanged(); | |||
} | |||
} | |||
private ushort _mRecipeStatus = 1; | |||
/// <summary> | |||
/// 配料状态名称 | |||
/// </summary> | |||
[Newtonsoft.Json.JsonIgnore] | |||
public Status Status { get { return _mStatus; } set { _mStatus = value; OnPropertyChanged(); } } | |||
private Status _mStatus; | |||
} | |||
} |
@@ -52,13 +52,13 @@ namespace BPASmartClient.S7Net | |||
return default; | |||
} | |||
private object Read(DataType dataType, int db, int address, VarType varType, int count) | |||
public object Read(DataType dataType, int db, int address, VarType varType, int count) | |||
{ | |||
if (!IsConnected) return default; | |||
return myPlc?.Read(dataType, db, address, varType, count); | |||
} | |||
public string Write<TValue>(string address, TValue value,int Retries = 1) | |||
public string Write<TValue>(string address, TValue value, int Retries = 1) | |||
{ | |||
if (IsConnected) | |||
{ | |||
@@ -68,7 +68,7 @@ namespace BPASmartClient.S7Net | |||
myPlc?.Write(address, value); | |||
return $"成功,地址:{address},值:{value}"; | |||
} | |||
else | |||
else | |||
{ | |||
while (count < Retries) | |||
{ | |||
@@ -83,7 +83,7 @@ namespace BPASmartClient.S7Net | |||
return $"成功,发送了{count}次,地址:{address},值:{value}"; | |||
} | |||
} | |||
else | |||
else | |||
{ | |||
return $"失败,地址:{address},值:{value},断开连接"; | |||
} | |||
@@ -22,7 +22,7 @@ | |||
<ItemGroup> | |||
<PackageReference Include="BPA.Communication" Version="1.0.19" /> | |||
<PackageReference Include="BPA.Helper" Version="1.0.17" /> | |||
<PackageReference Include="BPA.Helper" Version="1.0.21" /> | |||
<PackageReference Include="Microsoft.Toolkit.Mvvm" Version="7.1.2" /> | |||
</ItemGroup> | |||
@@ -10,7 +10,7 @@ | |||
<ItemGroup> | |||
<PackageReference Include="BPA.Communication" Version="1.0.19" /> | |||
<PackageReference Include="BPA.Helper" Version="1.0.17" /> | |||
<PackageReference Include="BPA.Helper" Version="1.0.21" /> | |||
</ItemGroup> | |||
<ItemGroup> | |||
@@ -26,6 +26,8 @@ | |||
<con:StatusConverter x:Key="StatusConverter" /> | |||
<con:StringToIconConverter x:Key="StringToIconConverter" /> | |||
<con:BoolToVisibilityConvert x:Key="BoolToVisibilityConvert" /> | |||
<con:CountIsVisiableConvert x:Key="CountIsVisiableConvert" /> | |||
<con:BoolToFillColorConverter x:Key="BoolToFillColorConverter" /> | |||
</ResourceDictionary> | |||
<ResourceDictionary> | |||
@@ -96,7 +96,7 @@ namespace BPASmartClient.DosingSystem | |||
ParSet.Add(new SubMenumodel() | |||
{ | |||
SubMenuName = "通讯参数设置", | |||
SubMenuName = "设备控制参数设置", | |||
SubMenuPermission = new Permission[] { Permission.管理员 }, | |||
AssemblyName = "BPASmartClient.DosingSystem", | |||
ToggleWindowPath = "View.CommParSetView" | |||
@@ -123,18 +123,26 @@ namespace BPASmartClient.DosingSystem | |||
ObservableCollection<SubMenumodel> ManualControl = new ObservableCollection<SubMenumodel>(); | |||
ManualControl.Add(new SubMenumodel() | |||
{ | |||
SubMenuName = "手动控制", | |||
SubMenuName = "气缸手动控制", | |||
SubMenuPermission = new Permission[] { Permission.管理员, Permission.操作员, Permission.技术员 }, | |||
AssemblyName = "BPASmartClient.DosingSystem", | |||
ToggleWindowPath = "View.ManualControlView" | |||
}); | |||
ManualControl.Add(new SubMenumodel() | |||
{ | |||
SubMenuName = "料仓控制", | |||
SubMenuName = "输送带手动控制", | |||
SubMenuPermission = new Permission[] { Permission.管理员, Permission.操作员, Permission.技术员 }, | |||
AssemblyName = "BPASmartClient.DosingSystem", | |||
ToggleWindowPath = "View.StockControlView" | |||
ToggleWindowPath = "View.ConveyerBeltManualView" | |||
}); | |||
//ManualControl.Add(new SubMenumodel() | |||
//{ | |||
// SubMenuName = "料仓控制", | |||
// SubMenuPermission = new Permission[] { Permission.管理员, Permission.操作员, Permission.技术员 }, | |||
// AssemblyName = "BPASmartClient.DosingSystem", | |||
// ToggleWindowPath = "View.StockControlView" | |||
//}); | |||
MenuManage.GetInstance.menuModels.Add(new MenuModel() | |||
{ | |||
MainMenuIcon = "", | |||
@@ -16,9 +16,8 @@ | |||
</ItemGroup> | |||
<ItemGroup> | |||
<PackageReference Include="BPA.Helper" Version="1.0.17" /> | |||
<PackageReference Include="BPA.Helper" Version="1.0.22" /> | |||
<PackageReference Include="BPA.Message" Version="1.0.46" /> | |||
<PackageReference Include="Microsoft.Toolkit.Mvvm" Version="7.1.2" /> | |||
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" /> | |||
</ItemGroup> | |||
@@ -0,0 +1,52 @@ | |||
using BPA.Helper; | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
namespace BPASmartClient.DosingSystem | |||
{ | |||
public class ConveyerBeltModel : NotifyBase | |||
{ | |||
public string Name { get { return _mName; } set { _mName = value; OnPropertyChanged(); } } | |||
private string _mName; | |||
public int Num { get { return _mNum; } set { _mNum = value; OnPropertyChanged(); } } | |||
private int _mNum; | |||
public int Speed | |||
{ | |||
get { return _mSpeed; } | |||
set | |||
{ | |||
_mSpeed = value; | |||
if (Num >= 1 && Num <= 32) | |||
{ | |||
SiemensDevice.GetInstance.MySiemens.Write($"DB4.DBW{Num * 2 + 132}", value); | |||
} | |||
OnPropertyChanged(); | |||
} | |||
} | |||
private int _mSpeed; | |||
public bool ConveyerBeltWork | |||
{ | |||
get { return _mConveyerBeltWork; } | |||
set | |||
{ | |||
_mConveyerBeltWork = value; | |||
if (Num >= 1 && Num <= 32) | |||
{ | |||
var add = SiemensDevice.GetInstance.GetSiemensBitSingleAdd("DB5.DBX", Num, 6); | |||
SiemensDevice.GetInstance.MySiemens.Write(add, !value); | |||
} | |||
OnPropertyChanged(); | |||
} | |||
} | |||
private bool _mConveyerBeltWork; | |||
public bool Control { get; set; } | |||
} | |||
} |
@@ -3,11 +3,11 @@ using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
using Microsoft.Toolkit.Mvvm.ComponentModel; | |||
using BPA.Helper; | |||
namespace BPASmartClient.DosingSystem | |||
{ | |||
public class CylinderStatusModel : ObservableObject | |||
public class CylinderStatusModel : NotifyBase | |||
{ | |||
/// <summary> | |||
/// 气缸原点信号 | |||
@@ -4,11 +4,11 @@ using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
using System.Windows; | |||
using Microsoft.Toolkit.Mvvm.ComponentModel; | |||
using BPA.Helper; | |||
namespace BPASmartClient.DosingSystem | |||
{ | |||
public class DeviceCurrentStatus : ObservableObject | |||
public class DeviceCurrentStatus : NotifyBase | |||
{ | |||
/// <summary> | |||
/// 当前料仓重量反馈 | |||
@@ -17,13 +17,26 @@ namespace BPASmartClient.DosingSystem | |||
private double _mWeight; | |||
/// <summary> | |||
/// 是否正在下料 | |||
/// 重量设置 | |||
/// </summary> | |||
public bool IsLayOff { get { return _mIsLayOff; } set { _mIsLayOff = value; OnPropertyChanged(); } } | |||
private bool _mIsLayOff; | |||
public float SetWeight { get { return _mSetWeight; } set { _mSetWeight = value; OnPropertyChanged(); } } | |||
private float _mSetWeight; | |||
///// <summary> | |||
///// 下料控制 | |||
///// </summary> | |||
//public bool IsLayOff { get { return _mIsLayOff; } set { _mIsLayOff = value; OnPropertyChanged(); } } | |||
//private bool _mIsLayOff; | |||
/// <summary> | |||
/// 下料控制 | |||
/// </summary> | |||
public bool BaitingControl { get { return _mBaitingControl; } set { _mBaitingControl = value; OnPropertyChanged(); } } | |||
private bool _mBaitingControl; | |||
/// <summary> | |||
/// 设备是否在线 | |||
/// 设备运行状态 | |||
/// </summary> | |||
public bool RunStatus { get { return _mRunStatus; } set { _mRunStatus = value; OnPropertyChanged(); } } | |||
private bool _mRunStatus; | |||
@@ -52,6 +65,13 @@ namespace BPASmartClient.DosingSystem | |||
public bool IsFault { get { return _mIsFault; } set { _mIsFault = value; OnPropertyChanged(); } } | |||
private bool _mIsFault; | |||
/// <summary> | |||
/// 桶到位检测 | |||
/// </summary> | |||
public bool BucketFlagbit { get { return _mBucketFlagbit; } set { _mBucketFlagbit = value; OnPropertyChanged(); } } | |||
private bool _mBucketFlagbit; | |||
} | |||
@@ -81,6 +81,7 @@ namespace BPASmartClient.DosingSystem | |||
devices.Add(new Devices() | |||
{ | |||
DeviceName = $"测试设备{i + 1}", | |||
DeviceNum = i + 1, | |||
IpAddress = $"192.168.1.{i + 1}", | |||
}); | |||
} | |||
@@ -102,6 +103,7 @@ namespace BPASmartClient.DosingSystem | |||
devices.Add(new Devices() | |||
{ | |||
DeviceName = $"测试设备{i + 1}", | |||
DeviceNum = i + 1, | |||
IpAddress = $"192.168.1.{i + 1}", | |||
}); | |||
} | |||
@@ -109,11 +111,11 @@ namespace BPASmartClient.DosingSystem | |||
public void Init() | |||
{ | |||
if (!string.IsNullOrEmpty(Json<DevicePar>.Data.Address)) IPSegment = Json<DevicePar>.Data.Address; | |||
else Json<DevicePar>.Data.Address = IPSegment; | |||
if (!string.IsNullOrEmpty(Json<DevicePar>.Data.BaseParModel.NetworkSegAddress)) IPSegment = Json<DevicePar>.Data.BaseParModel.NetworkSegAddress; | |||
else Json<DevicePar>.Data.BaseParModel.NetworkSegAddress = IPSegment; | |||
TestData(); | |||
IpAddressLines(); | |||
DeviceDataInit(); | |||
//DeviceDataInit(); | |||
ThreadManage.GetInstance().StartLong(new Action(() => | |||
{ | |||
if (IPQueues.Count >= IPLists.Count) | |||
@@ -12,5 +12,21 @@ namespace BPASmartClient.DosingSystem | |||
/// PLC 设备数据 | |||
/// </summary> | |||
public static PlcToComputer PlcData { get; set; } = new PlcToComputer(); | |||
/// <summary> | |||
/// 电机速度 | |||
/// </summary> | |||
public static ushort[] MotorSpeed { get; set; } = new ushort[32]; | |||
/// <summary> | |||
/// 输送带控制 | |||
/// </summary> | |||
public static uint MotorControl { get; set; } | |||
/// <summary> | |||
/// 输送带控制反馈 | |||
/// </summary> | |||
public static uint MotorControlFeedback { get; set; } | |||
} | |||
} |
@@ -3,7 +3,7 @@ using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
using Microsoft.Toolkit.Mvvm.ComponentModel; | |||
using BPA.Helper; | |||
using System.Collections.ObjectModel; | |||
namespace BPASmartClient.DosingSystem | |||
@@ -11,7 +11,7 @@ namespace BPASmartClient.DosingSystem | |||
/// <summary> | |||
/// 出料口信息 | |||
/// </summary> | |||
public class OutletInfoModel : ObservableObject | |||
public class OutletInfoModel : NotifyBase | |||
{ | |||
/// <summary> | |||
/// 出料口名称 | |||
@@ -6,14 +6,14 @@ using System.Text; | |||
using System.Threading; | |||
using System.Threading.Tasks; | |||
using BPASmartClient.Model; | |||
using Microsoft.Toolkit.Mvvm.ComponentModel; | |||
using BPA.Helper; | |||
namespace BPASmartClient.DosingSystem | |||
{ | |||
/// <summary> | |||
/// 配方模块 | |||
/// </summary> | |||
public class RecipeModel : ObservableObject | |||
public class RecipeModel : NotifyBase | |||
{ | |||
[Newtonsoft.Json.JsonIgnore] | |||
public bool IsEnable { get { return _mIsEnable; } set { _mIsEnable = value; OnPropertyChanged(); } } | |||
@@ -3,11 +3,11 @@ using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
using Microsoft.Toolkit.Mvvm.ComponentModel; | |||
using BPA.Helper; | |||
namespace BPASmartClient.DosingSystem | |||
{ | |||
public class RecipeProcess : ObservableObject | |||
public class RecipeProcess : NotifyBase | |||
{ | |||
public string RawMaterialName { get { return _mRawMaterialName; } set { _mRawMaterialName = value; OnPropertyChanged(); } } | |||
private string _mRawMaterialName; | |||
@@ -11,33 +11,41 @@ namespace BPASmartClient.DosingSystem | |||
/// </summary> | |||
public class PlcToComputer | |||
{ | |||
public PlcToComputer() | |||
{ | |||
for (int i = 0; i < cylinderFlagBitStatus.Length; i++) | |||
{ | |||
cylinderFlagBitStatus[i] = new CylinderFlagBitStatus(); | |||
} | |||
} | |||
/// <summary> | |||
/// 心跳 | |||
/// </summary> | |||
public bool Heartbeat { get; set; } | |||
/// <summary> | |||
/// 接收完成 | |||
/// 接收配方完成 | |||
/// </summary> | |||
public bool ResComplete { get; set; } | |||
/// <summary> | |||
/// 系统系统或停止 | |||
/// 系统启动或停止状态 | |||
/// </summary> | |||
public bool SystemStartOrStop { get; set; } | |||
/// <summary> | |||
/// 手自动切换 | |||
/// 手自动状态 | |||
/// </summary> | |||
public bool HandOrAuto { get; set; } | |||
/// <summary> | |||
/// 桶位置反馈 | |||
/// </summary> | |||
public int[] LocationFeedback { get; set; } = new int[32]; | |||
public short[] LocationFeedback { get; set; } = new short[32]; | |||
/// <summary> | |||
/// 是否允许配料 | |||
/// 桶是否允许配料 | |||
/// </summary> | |||
public bool[] IsAllowIngredients { get; set; } = new bool[32]; | |||
@@ -45,5 +53,61 @@ namespace BPASmartClient.DosingSystem | |||
/// 报警信息 | |||
/// </summary> | |||
public bool[] ArrayInfo { get; set; } = new bool[32]; | |||
/// <summary> | |||
/// 本地急停 | |||
/// </summary> | |||
public bool LocalEStop { get; set; } | |||
/// <summary> | |||
/// 远程急停 | |||
/// </summary> | |||
public bool RemoteEStop { get; set; } | |||
/// <summary> | |||
/// 上桶工位检测 | |||
/// </summary> | |||
public bool OnDetection { get; set; } | |||
/// <summary> | |||
/// 下桶工位检测 | |||
/// </summary> | |||
public bool UnderDetection { get; set; } | |||
/// <summary> | |||
/// 上桶工位气缸检测 | |||
/// </summary> | |||
public CylinderFlagBitStatus OnCylinderDetection { get; set; } = new CylinderFlagBitStatus(); | |||
/// <summary> | |||
/// 下桶工位气缸检测 | |||
/// </summary> | |||
public CylinderFlagBitStatus UnderCylinderDetection { get; set; } = new CylinderFlagBitStatus(); | |||
/// <summary> | |||
/// 工位光电检测 | |||
/// </summary> | |||
public bool[] StationDetection { get; set; } = new bool[32]; | |||
/// <summary> | |||
/// 气缸状态信号 | |||
/// </summary> | |||
public CylinderFlagBitStatus[] cylinderFlagBitStatus = new CylinderFlagBitStatus[32]; | |||
} | |||
/// <summary> | |||
/// 气缸到位检测类 | |||
/// </summary> | |||
public class CylinderFlagBitStatus | |||
{ | |||
/// <summary> | |||
/// 气缸原点信号 | |||
/// </summary> | |||
public bool HomeSignal { get; set; } | |||
/// <summary> | |||
/// 气缸到位信号 | |||
/// </summary> | |||
public bool InPlaceSignal { get; set; } | |||
} | |||
} |
@@ -1,4 +1,4 @@ | |||
using Microsoft.Toolkit.Mvvm.ComponentModel; | |||
using BPA.Helper; | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
@@ -7,31 +7,32 @@ using System.Threading.Tasks; | |||
namespace BPASmartClient.DosingSystem | |||
{ | |||
public class StockStatusModel : ObservableObject | |||
public class StockStatusModel : NotifyBase | |||
{ | |||
/// <summary> | |||
/// 料仓物料重量 | |||
/// </summary> | |||
private double _materialWeight; | |||
public double MaterialWeight { get { return _materialWeight; } set { _materialWeight = value; OnPropertyChanged(); } } | |||
private double _materialWeight; | |||
/// <summary> | |||
/// 料仓物料名称 | |||
/// </summary> | |||
private string _materialName; | |||
public string MaterialName { get { return _materialName; } set { _materialName = value; OnPropertyChanged(); } } | |||
private string _materialName; | |||
/// <summary> | |||
/// 是否真在运行 | |||
/// </summary> | |||
private bool _isRunning; | |||
public bool IsRunning { get { return _isRunning; } set { _isRunning = value; OnPropertyChanged(); } } | |||
private bool _isRunning; | |||
/// <summary> | |||
/// 是否正在下料 | |||
/// </summary> | |||
private bool _isLayOff; | |||
public bool IsLayOff { get { return _isLayOff; } set { _isLayOff = value; OnPropertyChanged(); } } | |||
private bool _isLayOff; | |||
/// <summary> | |||
/// 打开状态 | |||
/// 是否开盖 | |||
/// </summary> | |||
public bool IsOpen { get { return _mIsOpen; } set { _mIsOpen = value; OnPropertyChanged(); } } | |||
private bool _mIsOpen; | |||
@@ -39,8 +40,18 @@ namespace BPASmartClient.DosingSystem | |||
/// <summary> | |||
/// 是否故障报警 | |||
/// </summary> | |||
public bool IsFault { get { return _isFault; } set { _isFault = value; OnPropertyChanged(); } } | |||
private bool _isFault; | |||
public bool IsFault { get { return _isFault; } set { _isFault = value; OnPropertyChanged(); } } | |||
/// <summary> | |||
/// 下料状态 0:未出料 1:出料指令下发 2:出料完成 | |||
/// </summary> | |||
public int IssueStatus { get { return _isIssueStatus; } set { _isIssueStatus = value; OnPropertyChanged(); } } | |||
private int _isIssueStatus; | |||
/// <summary> | |||
/// 下料重量 | |||
/// </summary> | |||
public double IssueWeight { get { return _IssueWeight; } set { _IssueWeight = value; OnPropertyChanged(); } } | |||
private double _IssueWeight; | |||
} | |||
} |
@@ -3,13 +3,13 @@ using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
using Microsoft.Toolkit.Mvvm.ComponentModel; | |||
using Microsoft.Toolkit.Mvvm.Input; | |||
using BPA.Helper; | |||
using System.Collections.ObjectModel; | |||
namespace BPASmartClient.DosingSystem | |||
{ | |||
public class ViewModelBase : ObservableObject | |||
public class ViewModelBase : NotifyBase | |||
{ | |||
public int Index { get; set; } = -1; | |||
public RelayCommand AddCommand { get; set; }//添加 | |||
@@ -0,0 +1,78 @@ | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Collections.ObjectModel; | |||
using System.Diagnostics; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
using BPA.Helper; | |||
namespace BPASmartClient.DosingSystem | |||
{ | |||
/// <summary> | |||
/// 基础参数 | |||
/// </summary> | |||
public class BasePar : NotifyBase | |||
{ | |||
/// <summary> | |||
/// 设备扫描网段 | |||
/// </summary> | |||
public string NetworkSegAddress { get { return _mNetworkSegAddress; } set { _mNetworkSegAddress = value; OnPropertyChanged(); } } | |||
private string _mNetworkSegAddress = "192.168.0."; | |||
/// <summary> | |||
/// 输送带设备 PLC IP 地址 | |||
/// </summary> | |||
public string DeviceAddress { get { return _mDeviceAddress; } set { _mDeviceAddress = value; OnPropertyChanged(); } } | |||
private string _mDeviceAddress = "192.168.0.1"; | |||
/// <summary> | |||
/// 输送带数量 | |||
/// </summary> | |||
public int ConveyerBeltCount | |||
{ | |||
get { return _mConveyerBeltCount; } | |||
set | |||
{ | |||
_mConveyerBeltCount = value; | |||
//var temp = ConveyerBeltModels; | |||
//App.Current.Dispatcher.Invoke(() => { ConveyerBeltModels.Clear(); }); | |||
//for (int i = 0; i < value; i++) | |||
//{ | |||
// App.Current.Dispatcher.Invoke(() => | |||
// { | |||
// ConveyerBeltModels.Add(new ConveyerBeltModel() | |||
// { | |||
// Name = $"输送带{i + 1}速度", | |||
// Num = i + 1, | |||
// Speed = (i >= 0 && i < temp.Count) ? temp.ElementAt(i).Speed : 0 | |||
// }); | |||
// }); | |||
//} | |||
OnPropertyChanged(); | |||
} | |||
} | |||
private int _mConveyerBeltCount = 0; | |||
/// <summary> | |||
/// 升降气缸数量 | |||
/// </summary> | |||
public int LiftCylinderCount { get { return _mLiftCylinderCount; } set { _mLiftCylinderCount = value; OnPropertyChanged(); } } | |||
private int _mLiftCylinderCount = 0; | |||
/// <summary> | |||
/// 阻挡气缸数量 | |||
/// </summary> | |||
public int BlockCylinderCount { get { return _mBlockCylinderCount; } set { _mBlockCylinderCount = value; OnPropertyChanged(); } } | |||
private int _mBlockCylinderCount = 0; | |||
/// <summary> | |||
/// 托盘气缸数量 | |||
/// </summary> | |||
public int PalletCylinderCount { get { return _mPalletCylinderCount; } set { _mPalletCylinderCount = value; OnPropertyChanged(); } } | |||
private int _mPalletCylinderCount = 0; | |||
//public ObservableCollection<ConveyerBeltModel> ConveyerBeltModels { get; set; } = new ObservableCollection<ConveyerBeltModel>(); | |||
} | |||
} |
@@ -3,12 +3,12 @@ using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
using Microsoft.Toolkit.Mvvm.ComponentModel; | |||
using System.Collections.ObjectModel; | |||
using BPA.Helper; | |||
namespace BPASmartClient.DosingSystem | |||
{ | |||
public class DevicePar | |||
public class DevicePar : NotifyBase | |||
{ | |||
/// <summary> | |||
/// 配料设备参数 | |||
@@ -17,30 +17,9 @@ namespace BPASmartClient.DosingSystem | |||
public ObservableCollection<OutletInfoModel> OutletInfoModels { get; set; } = new ObservableCollection<OutletInfoModel>(); | |||
/// <summary> | |||
/// 设备扫描网段 | |||
/// </summary> | |||
public string Address { get; set; } = string.Empty; | |||
/// <summary> | |||
/// 设备端口号 | |||
/// </summary> | |||
public int Port { get; set; } = 502; | |||
/// <summary> | |||
/// 升降气缸数量 | |||
/// </summary> | |||
public int LiftCylinderCount { get; set; } | |||
/// <summary> | |||
/// 阻挡气缸数量 | |||
/// </summary> | |||
public int BlockCylinderCount { get; set; } | |||
/// <summary> | |||
/// 托盘气缸数量 | |||
/// </summary> | |||
public int PalletCylinderCount { get; set; } | |||
public BasePar BaseParModel { get { return _mBaseParModel; } set { _mBaseParModel = value; OnPropertyChanged(); } } | |||
private BasePar _mBaseParModel = new BasePar(); | |||
} | |||
} |
@@ -3,11 +3,11 @@ using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
using Microsoft.Toolkit.Mvvm.ComponentModel; | |||
using BPA.Helper; | |||
namespace BPASmartClient.DosingSystem | |||
{ | |||
public class DeviceParModel : ObservableObject | |||
public class DeviceParModel : NotifyBase | |||
{ | |||
/// <summary> | |||
/// 原料名称 | |||
@@ -6,6 +6,7 @@ using System.Threading; | |||
using System.Threading.Tasks; | |||
using BPASmartClient.S7Net; | |||
using BPA.Helper; | |||
using S7.Net; | |||
namespace BPASmartClient.DosingSystem | |||
{ | |||
@@ -30,18 +31,54 @@ namespace BPASmartClient.DosingSystem | |||
bool tempValue = false; | |||
ThreadManage.GetInstance().StartLong(new Action(() => | |||
{ | |||
if (IsConnect) MySiemens.Write("DB4.DBX0.0", !tempValue); | |||
if (IsConnect) MySiemens.Write("DB4.DBX0.0", tempValue);//设备心跳 | |||
tempValue = !tempValue; | |||
Thread.Sleep(1); | |||
}), "设备心跳", true); | |||
ThreadManage.GetInstance().StartLong(new Action(() => | |||
{ | |||
GlobalDevice.PlcData = MySiemens.ReadClass<PlcToComputer>(3); | |||
//GlobalDevice.PlcData = MySiemens.ReadClass<PlcToComputer>(3);//获取PLC到上位机的数据 | |||
var res = MySiemens.Read(DataType.DataBlock, 4, 134, VarType.Word, 32); | |||
if (res != null && res is ushort[] ushorts && ushorts.Length == 32) | |||
{ | |||
GlobalDevice.MotorSpeed = ushorts; | |||
} | |||
GlobalDevice.MotorControl = MySiemens.Read<uint>("DB5.DBD6");//获取输送带控制信号 | |||
//GlobalDevice.MotorControlFeedback = MySiemens.Read<uint>("DB3.DBD0");//获取当前输送带运行状态 | |||
Thread.Sleep(50); | |||
}), "读取输送线设备数据", true); | |||
} | |||
/// <summary> | |||
/// 通过顺序编号获取西门子数据地址 | |||
/// </summary> | |||
/// <param name="Prefix">地址标头</param> | |||
/// <param name="num">编号</param> | |||
/// <param name="StartAdd">起始地址</param> | |||
/// <returns></returns> | |||
public string GetSiemensBitSingleAdd(string Prefix, int num, int StartAdd = 0) | |||
{ | |||
if (num > 0) | |||
{ | |||
string Add = string.Empty; | |||
var FirstAdd = num / 8; | |||
var EndAdd = (num % 8); | |||
if (EndAdd == 0) | |||
{ | |||
FirstAdd--; | |||
EndAdd = 7; | |||
} | |||
else EndAdd--; | |||
Add = $"{Prefix}{FirstAdd + StartAdd}.{EndAdd}"; | |||
return Add; | |||
} | |||
return default; | |||
} | |||
} | |||
@@ -22,94 +22,200 @@ | |||
</Grid.RowDefinitions> | |||
<Grid.ColumnDefinitions> | |||
<ColumnDefinition/> | |||
<ColumnDefinition/> | |||
<ColumnDefinition/> | |||
<ColumnDefinition/> | |||
<ColumnDefinition /> | |||
<ColumnDefinition /> | |||
<ColumnDefinition /> | |||
<ColumnDefinition /> | |||
</Grid.ColumnDefinitions> | |||
<Button | |||
Width="120" | |||
Grid.Column="3" | |||
Width="120" | |||
Height="30" | |||
HorizontalAlignment="Left" | |||
Margin="5,0,5,0" | |||
HorizontalAlignment="Left" | |||
Command="{Binding SaveCommand}" | |||
Content="保存参数" | |||
FontSize="20" | |||
Style="{StaticResource ImageButtonStyle}" /> | |||
<Grid Grid.ColumnSpan="4" Grid.Row="1"> | |||
<Grid.ColumnDefinitions> | |||
<ColumnDefinition /> | |||
<ColumnDefinition /> | |||
<ColumnDefinition /> | |||
<ColumnDefinition /> | |||
</Grid.ColumnDefinitions> | |||
<Grid.RowDefinitions> | |||
<RowDefinition /> | |||
<RowDefinition /> | |||
<RowDefinition /> | |||
<RowDefinition /> | |||
<RowDefinition /> | |||
<RowDefinition /> | |||
<RowDefinition /> | |||
</Grid.RowDefinitions> | |||
<TextBlock | |||
Margin="10,0,0,0" | |||
HorizontalAlignment="Right" | |||
Style="{StaticResource TextBlockStyle}" | |||
Text="配料设备网段地址:" /> | |||
<TextBox | |||
<WrapPanel Grid.Row="1" Grid.ColumnSpan="4"> | |||
<Grid Width="350" Margin="5"> | |||
<Grid.ColumnDefinitions> | |||
<ColumnDefinition /> | |||
<ColumnDefinition /> | |||
</Grid.ColumnDefinitions> | |||
<TextBlock | |||
Margin="0,0,2,0" | |||
HorizontalAlignment="Right" | |||
Style="{StaticResource TextBlockStyle}" | |||
Text="配料设备网段:" /> | |||
<TextBox | |||
Grid.Column="1" | |||
Width="170" | |||
Height="35" | |||
HorizontalAlignment="Right" | |||
FontSize="20" | |||
Style="{StaticResource TextBoxStyle}" | |||
Text="{Binding CommBaseParModel.NetworkSegAddress, UpdateSourceTrigger=PropertyChanged}" /> | |||
</Grid> | |||
<Grid Width="350" Margin="5"> | |||
<Grid.ColumnDefinitions> | |||
<ColumnDefinition /> | |||
<ColumnDefinition /> | |||
</Grid.ColumnDefinitions> | |||
<TextBlock | |||
Margin="0,0,2,0" | |||
HorizontalAlignment="Right" | |||
Style="{StaticResource TextBlockStyle}" | |||
Text="输送带PLC地址:" /> | |||
<TextBox | |||
Grid.Column="1" | |||
Width="170" | |||
Height="35" | |||
HorizontalAlignment="Right" | |||
FontSize="20" | |||
Style="{StaticResource TextBoxStyle}" | |||
Text="{Binding CommBaseParModel.DeviceAddress, UpdateSourceTrigger=PropertyChanged}" /> | |||
</Grid> | |||
<Grid Width="350" Margin="5"> | |||
<Grid.ColumnDefinitions> | |||
<ColumnDefinition /> | |||
<ColumnDefinition /> | |||
</Grid.ColumnDefinitions> | |||
<TextBlock | |||
Margin="0,0,2,0" | |||
HorizontalAlignment="Right" | |||
Style="{StaticResource TextBlockStyle}" | |||
Text="升降气缸数量:" /> | |||
<TextBox | |||
Grid.Column="1" | |||
Width="170" | |||
Height="35" | |||
HorizontalAlignment="Right" | |||
FontSize="20" | |||
Style="{StaticResource TextBoxStyle}" | |||
Text="{Binding CommBaseParModel.LiftCylinderCount, UpdateSourceTrigger=PropertyChanged}" /> | |||
</Grid> | |||
<Grid Width="350" Margin="5"> | |||
<Grid.ColumnDefinitions> | |||
<ColumnDefinition /> | |||
<ColumnDefinition /> | |||
</Grid.ColumnDefinitions> | |||
<TextBlock | |||
Margin="0,0,2,0" | |||
HorizontalAlignment="Right" | |||
Style="{StaticResource TextBlockStyle}" | |||
Text="阻挡气缸数量:" /> | |||
<TextBox | |||
Grid.Column="1" | |||
Width="170" | |||
Height="35" | |||
HorizontalAlignment="Right" | |||
FontSize="20" | |||
Style="{StaticResource TextBoxStyle}" | |||
Text="{Binding CommBaseParModel.BlockCylinderCount, UpdateSourceTrigger=PropertyChanged}" /> | |||
</Grid> | |||
<Grid Background="Transparent" Width="350" Margin="5"> | |||
<Grid.ColumnDefinitions> | |||
<ColumnDefinition /> | |||
<ColumnDefinition /> | |||
</Grid.ColumnDefinitions> | |||
<TextBlock | |||
Margin="0,0,2,0" | |||
HorizontalAlignment="Right" | |||
Style="{StaticResource TextBlockStyle}" | |||
Text="托盘气缸数量:" /> | |||
<TextBox | |||
Grid.Column="1" | |||
Width="170" | |||
Height="35" | |||
HorizontalAlignment="Right" | |||
FontSize="20" | |||
Style="{StaticResource TextBoxStyle}" | |||
Text="{Binding CommBaseParModel.PalletCylinderCount, UpdateSourceTrigger=PropertyChanged}" /> | |||
</Grid> | |||
<Grid Background="Transparent" Width="350" Margin="5"> | |||
<Grid.ColumnDefinitions> | |||
<ColumnDefinition /> | |||
<ColumnDefinition /> | |||
</Grid.ColumnDefinitions> | |||
<TextBlock | |||
Margin="0,0,2,0" | |||
HorizontalAlignment="Right" | |||
Style="{StaticResource TextBlockStyle}" | |||
Text="输送带数量:" /> | |||
<TextBox | |||
Grid.Column="1" | |||
Width="170" | |||
Height="35" | |||
HorizontalAlignment="Right" | |||
FontSize="20" | |||
Style="{StaticResource TextBoxStyle}" | |||
Text="{Binding CommBaseParModel.ConveyerBeltCount, UpdateSourceTrigger=PropertyChanged}" /> | |||
</Grid> | |||
</WrapPanel> | |||
<!--<Grid Grid.Row="2" Grid.ColumnSpan="4"> | |||
<ListView | |||
Grid.Column="1" | |||
Width="180" | |||
Height="35" | |||
Margin="0,0,0,0" | |||
HorizontalAlignment="Left" | |||
FontSize="20" | |||
Style="{StaticResource TextBoxStyle}" | |||
Text="{Binding Address}" /> | |||
<TextBlock | |||
Grid.Column="2" | |||
Margin="10,0,0,0" | |||
HorizontalAlignment="Right" | |||
Style="{StaticResource TextBlockStyle}" | |||
Text="输送带PLC地址:" /> | |||
<TextBox | |||
Grid.Column="3" | |||
Width="180" | |||
Height="35" | |||
Margin="0,0,0,0" | |||
HorizontalAlignment="Left" | |||
FontSize="20" | |||
Style="{StaticResource TextBoxStyle}" | |||
Text="{Binding Address}" /> | |||
<TextBlock | |||
Grid.Row="1" | |||
Grid.Column="0" | |||
Margin="10,0,0,0" | |||
HorizontalAlignment="Right" | |||
Style="{StaticResource TextBlockStyle}" | |||
Text="输送带PLC地址:" /> | |||
<TextBox | |||
Grid.Row="1" | |||
Grid.Column="1" | |||
Width="180" | |||
Height="35" | |||
Margin="0,0,0,0" | |||
HorizontalAlignment="Left" | |||
FontSize="20" | |||
Style="{StaticResource TextBoxStyle}" | |||
Text="{Binding Address}" /> | |||
</Grid> | |||
Background="Transparent" | |||
BorderBrush="#00BEFA" | |||
BorderThickness="0" | |||
ItemsSource="{Binding CommBaseParModel.ConveyerBeltModels}" | |||
ScrollViewer.HorizontalScrollBarVisibility="Disabled"> | |||
<ListView.ItemsPanel> | |||
<ItemsPanelTemplate> | |||
<WrapPanel Orientation="Horizontal" /> | |||
</ItemsPanelTemplate> | |||
</ListView.ItemsPanel> | |||
<ListView.ItemTemplate> | |||
<DataTemplate> | |||
<Grid | |||
Width="350" | |||
Margin="5" | |||
Background="Transparent"> | |||
<Grid.ColumnDefinitions> | |||
<ColumnDefinition /> | |||
<ColumnDefinition /> | |||
</Grid.ColumnDefinitions> | |||
<StackPanel HorizontalAlignment="Right" Orientation="Horizontal"> | |||
<TextBlock Style="{StaticResource TextBlockStyle}" Text="{Binding Name}" /> | |||
<TextBlock | |||
Margin="0,0,2,0" | |||
Style="{StaticResource TextBlockStyle}" | |||
Text=":" /> | |||
</StackPanel> | |||
<TextBox | |||
Grid.Column="1" | |||
Width="170" | |||
Height="35" | |||
HorizontalAlignment="Right" | |||
FontSize="20" | |||
Style="{StaticResource TextBoxStyle}" | |||
Text="{Binding Speed, UpdateSourceTrigger=PropertyChanged}" /> | |||
</Grid> | |||
</DataTemplate> | |||
</ListView.ItemTemplate> | |||
</ListView> | |||
</Grid>--> | |||
</Grid> | |||
@@ -1,4 +1,5 @@ | |||
using System; | |||
using BPA.Helper; | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Text; | |||
@@ -23,6 +24,7 @@ namespace BPASmartClient.DosingSystem.View | |||
public CommParSetView() | |||
{ | |||
InitializeComponent(); | |||
this.Unloaded += (o, e) => { Json<DevicePar>.Save(); }; | |||
} | |||
} | |||
} |
@@ -0,0 +1,132 @@ | |||
<UserControl | |||
x:Class="BPASmartClient.DosingSystem.View.ConveyerBeltManualView" | |||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | |||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | |||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" | |||
xmlns:local="clr-namespace:BPASmartClient.DosingSystem.View" | |||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" | |||
xmlns:pry="clr-namespace:BPASmartClient.CustomResource.UserControls;assembly=BPASmartClient.CustomResource" | |||
xmlns:vm="clr-namespace:BPASmartClient.DosingSystem.ViewModel" | |||
d:DesignHeight="450" | |||
d:DesignWidth="800" | |||
mc:Ignorable="d"> | |||
<UserControl.Resources> | |||
<Style x:Key="radioButtonStyle" TargetType="RadioButton"> | |||
<Setter Property="Template"> | |||
<Setter.Value> | |||
<ControlTemplate TargetType="RadioButton"> | |||
<Grid Name="gr" Opacity="0.8"> | |||
<ContentControl | |||
Margin="{TemplateBinding Margin}" | |||
HorizontalAlignment="Center" | |||
VerticalAlignment="Center" | |||
HorizontalContentAlignment="Center" | |||
VerticalContentAlignment="Center" | |||
Content="{TemplateBinding Content}" | |||
FontSize="{TemplateBinding FontSize}" | |||
Foreground="{TemplateBinding Foreground}" /> | |||
<Image | |||
Name="image" | |||
Source="/BPASmartClient.CustomResource;component/Image/边框线.png" | |||
Stretch="Fill" /> | |||
</Grid> | |||
<ControlTemplate.Triggers> | |||
<Trigger Property="IsChecked" Value="False"> | |||
<Setter TargetName="image" Property="Source" Value="/BPASmartClient.CustomResource;component/Image/边框线.png" /> | |||
</Trigger> | |||
<Trigger Property="IsChecked" Value="True"> | |||
<Setter TargetName="image" Property="Source" Value="/BPASmartClient.CustomResource;component/Image/透明背景.png" /> | |||
</Trigger> | |||
<Trigger Property="IsMouseOver" Value="True"> | |||
<Setter TargetName="gr" Property="Opacity" Value="1" /> | |||
</Trigger> | |||
</ControlTemplate.Triggers> | |||
</ControlTemplate> | |||
</Setter.Value> | |||
</Setter> | |||
</Style> | |||
</UserControl.Resources> | |||
<UserControl.DataContext> | |||
<vm:ConveyerBeltManualViewModel /> | |||
</UserControl.DataContext> | |||
<ScrollViewer HorizontalScrollBarVisibility="Disabled" VerticalScrollBarVisibility="Hidden"> | |||
<ItemsControl ItemsSource="{Binding ConveyerBeltModels}"> | |||
<ItemsControl.ItemTemplate> | |||
<DataTemplate> | |||
<Grid Margin="8"> | |||
<Grid | |||
Name="cy" | |||
Grid.Row="0" | |||
Margin="5"> | |||
<pry:ImageBorder | |||
Grid.RowSpan="2" | |||
Width="{Binding ElementName=cy, Path=ActualWidth}" | |||
Height="{Binding ElementName=cy, Path=ActualHeight}" /> | |||
<StackPanel Background="Transparent"> | |||
<Grid Height="40"> | |||
<Image | |||
Margin="2,3,0,0" | |||
HorizontalAlignment="Left" | |||
VerticalAlignment="Top" | |||
Source="/BPASmartClient.CustomResource;component/Image/标签.png" /> | |||
<TextBlock | |||
Margin="10,10,0,0" | |||
VerticalAlignment="Top" | |||
FontSize="16" | |||
Foreground="Aqua" | |||
Text="{Binding Name}" /> | |||
<StackPanel | |||
Margin="0,0,20,0" | |||
HorizontalAlignment="Right" | |||
Orientation="Horizontal"> | |||
<TextBlock | |||
Margin="0,0,2,0" | |||
Style="{StaticResource TextBlockStyle}" | |||
Text="输送带速度:" /> | |||
<TextBox | |||
Width="170" | |||
Height="35" | |||
HorizontalAlignment="Right" | |||
FontSize="20" | |||
Style="{StaticResource TextBoxStyle}" | |||
Text="{Binding Speed, UpdateSourceTrigger=PropertyChanged}" /> | |||
<TextBlock | |||
Margin="20,0,5,0" | |||
VerticalAlignment="Center" | |||
FontSize="20" | |||
Foreground="#00c2f4" | |||
Text="输送带控制" /> | |||
<ToggleButton | |||
Width="80" | |||
Height="30" | |||
Margin="5,0,5,0" | |||
Background="Transparent" | |||
FontSize="20" | |||
IsChecked="{Binding ConveyerBeltWork}" | |||
Style="{StaticResource SwitchToggleButtonStyle}" /> | |||
</StackPanel> | |||
</Grid> | |||
<Grid Name="gr" Height="200"> | |||
<pry:ConveyBelt2 | |||
Grid.RowSpan="4" | |||
Margin="-12,0,10,0" | |||
BeltDashThickess="50" | |||
BeltHeight="{Binding ElementName=gr, Path=ActualHeight}" | |||
BeltWidth="{Binding ElementName=gr, Path=ActualWidth}" | |||
IsRun="{Binding ConveyerBeltWork}" /> | |||
</Grid> | |||
</StackPanel> | |||
</Grid> | |||
</Grid> | |||
</DataTemplate> | |||
</ItemsControl.ItemTemplate> | |||
</ItemsControl> | |||
</ScrollViewer> | |||
</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.DosingSystem.View | |||
{ | |||
/// <summary> | |||
/// ConveyerBeltManualView.xaml 的交互逻辑 | |||
/// </summary> | |||
public partial class ConveyerBeltManualView : UserControl | |||
{ | |||
public ConveyerBeltManualView() | |||
{ | |||
InitializeComponent(); | |||
} | |||
} | |||
} |
@@ -31,6 +31,7 @@ | |||
Background="Transparent" | |||
BorderThickness="0" | |||
ItemsSource="{Binding TopDeviceCurrentStatuses}" | |||
ScrollViewer.VerticalScrollBarVisibility="Disabled" | |||
ScrollViewer.HorizontalScrollBarVisibility="Disabled"> | |||
<ListView.ItemsPanel> | |||
<ItemsPanelTemplate> | |||
@@ -46,7 +47,7 @@ | |||
<ListView.ItemTemplate> | |||
<DataTemplate> | |||
<Border Margin="5" Background="Transparent"> | |||
<Grid Height="270" Background="Transparent"> | |||
<Grid Background="Transparent"> | |||
<Grid.RowDefinitions> | |||
<RowDefinition /> | |||
<RowDefinition /> | |||
@@ -97,28 +98,40 @@ | |||
</StackPanel> | |||
<StackPanel Grid.Row="2" Orientation="Horizontal"> | |||
<StackPanel> | |||
<ToggleButton | |||
Width="80" | |||
<Grid Grid.Row="2"> | |||
<Grid.ColumnDefinitions> | |||
<ColumnDefinition /> | |||
<ColumnDefinition /> | |||
</Grid.ColumnDefinitions> | |||
<StackPanel Background="Transparent"> | |||
<Ellipse | |||
Width="30" | |||
Height="30" | |||
Margin="5,0,5,0" | |||
HorizontalAlignment="Center" | |||
VerticalAlignment="Center" | |||
Background="Transparent" | |||
FontSize="20" | |||
IsChecked="{Binding IsOpen}" | |||
Style="{StaticResource SwitchToggleButtonStyle}" /> | |||
Fill="{Binding BucketFlagbit, Converter={StaticResource BoolToFillColorConverter}}" | |||
RenderTransformOrigin="0.5,0.5"> | |||
<Ellipse.OpacityMask> | |||
<RadialGradientBrush> | |||
<GradientStop Offset="0" Color="Transparent" /> | |||
<GradientStop Offset="1" Color="#00c2f4" /> | |||
</RadialGradientBrush> | |||
</Ellipse.OpacityMask> | |||
<!--<Ellipse.RenderTransform> | |||
<ScaleTransform x:Name="Scale" /> | |||
</Ellipse.RenderTransform>--> | |||
</Ellipse> | |||
<TextBlock | |||
Margin="0,5,0,0" | |||
HorizontalAlignment="Center" | |||
FontSize="16" | |||
Foreground="#00c2f4" | |||
Text="仓盖控制" /> | |||
Text="到位检测" /> | |||
</StackPanel> | |||
<StackPanel> | |||
<StackPanel Name="skp" Grid.Column="1"> | |||
<ToggleButton | |||
Width="80" | |||
Height="30" | |||
@@ -126,8 +139,10 @@ | |||
HorizontalAlignment="Center" | |||
VerticalAlignment="Center" | |||
Background="Transparent" | |||
Command="{Binding DataContext.RecipeControlCommand, RelativeSource={RelativeSource AncestorType=ListView, Mode=FindAncestor}}" | |||
CommandParameter="{Binding}" | |||
FontSize="20" | |||
IsChecked="{Binding IsLayOff}" | |||
IsChecked="{Binding BaitingControl}" | |||
Style="{StaticResource SwitchToggleButtonStyle}" /> | |||
<TextBlock | |||
Margin="0,5,0,0" | |||
@@ -137,7 +152,7 @@ | |||
Text="出料控制" /> | |||
</StackPanel> | |||
</StackPanel> | |||
</Grid> | |||
<Image | |||
Margin="20,30,20,0" | |||
@@ -145,7 +160,7 @@ | |||
Stretch="Fill" | |||
Visibility="{Binding IsOpen, Converter={StaticResource BoolToVisibilityConvert}}" /> | |||
<Image Source="/BPASmartClient.CustomResource;component/Image/荧光/29.png" Visibility="{Binding IsLayOff, Converter={StaticResource BoolToVisibilityConvert}}" /> | |||
<Image Source="/BPASmartClient.CustomResource;component/Image/荧光/29.png" Visibility="{Binding BaitingControl, Converter={StaticResource BoolToVisibilityConvert}}" /> | |||
<Image | |||
Grid.RowSpan="2" | |||
@@ -171,7 +186,7 @@ | |||
CaretBrush="#009dff" | |||
FontSize="20" | |||
Foreground="#009dff" | |||
Text="{Binding Weight}" /> | |||
Text="{Binding SetWeight}" /> | |||
</Grid> | |||
</Grid> | |||
@@ -206,15 +221,81 @@ | |||
<RowDefinition /> | |||
</Grid.RowDefinitions> | |||
<Grid Grid.Row="2"> | |||
<Grid.ColumnDefinitions> | |||
<ColumnDefinition /> | |||
<ColumnDefinition /> | |||
<ColumnDefinition /> | |||
<ColumnDefinition /> | |||
<ColumnDefinition /> | |||
<ColumnDefinition /> | |||
</Grid.ColumnDefinitions> | |||
<Ellipse | |||
Width="30" | |||
Height="30" | |||
HorizontalAlignment="Center" | |||
VerticalAlignment="Bottom" | |||
Fill="{Binding OnDetection, Converter={StaticResource BoolToFillColorConverter}}" | |||
RenderTransformOrigin="0.5,0.5"> | |||
<Ellipse.OpacityMask> | |||
<RadialGradientBrush> | |||
<GradientStop Offset="0" Color="Transparent" /> | |||
<GradientStop Offset="1" Color="#00c2f4" /> | |||
</RadialGradientBrush> | |||
</Ellipse.OpacityMask> | |||
</Ellipse> | |||
<Ellipse | |||
Grid.Column="5" | |||
Width="30" | |||
Height="30" | |||
HorizontalAlignment="Center" | |||
VerticalAlignment="Bottom" | |||
Fill="{Binding UnderDetection, Converter={StaticResource BoolToFillColorConverter}}" | |||
RenderTransformOrigin="0.5,0.5"> | |||
<Ellipse.OpacityMask> | |||
<RadialGradientBrush> | |||
<GradientStop Offset="0" Color="Transparent" /> | |||
<GradientStop Offset="1" Color="#00c2f4" /> | |||
</RadialGradientBrush> | |||
</Ellipse.OpacityMask> | |||
</Ellipse> | |||
</Grid> | |||
<Grid Grid.Row="3"> | |||
<Grid.ColumnDefinitions> | |||
<ColumnDefinition /> | |||
<ColumnDefinition /> | |||
<ColumnDefinition /> | |||
<ColumnDefinition /> | |||
<ColumnDefinition /> | |||
<ColumnDefinition /> | |||
</Grid.ColumnDefinitions> | |||
<TextBlock | |||
Margin="0,5,0,0" | |||
HorizontalAlignment="Center" | |||
FontSize="16" | |||
Foreground="#00c2f4" | |||
Text="上桶工位检测" /> | |||
<TextBlock | |||
Grid.Column="5" | |||
Margin="0,5,0,0" | |||
HorizontalAlignment="Center" | |||
FontSize="16" | |||
Foreground="#00c2f4" | |||
Text="下桶工位检测" /> | |||
</Grid> | |||
<pry:ConveyBelt2 | |||
Grid.RowSpan="4" | |||
Margin="-12,0,10,0" | |||
BeltDashThickess="50" | |||
BeltHeight="{Binding ElementName=gr, Path=ActualHeight}" | |||
BeltWidth="{Binding ElementName=gr, Path=ActualWidth}" | |||
IsRun="{Binding ConveyerBeltWork}" /> | |||
IsRun="{Binding ConveyerBeltStatus}" /> | |||
<StackPanel | |||
<!--<StackPanel | |||
Grid.Row="1" | |||
Margin="20,0,0,0" | |||
HorizontalAlignment="Left" | |||
@@ -233,7 +314,7 @@ | |||
FontSize="20" | |||
IsChecked="{Binding ConveyerBeltWork}" | |||
Style="{StaticResource SwitchToggleButtonStyle}" /> | |||
</StackPanel> | |||
</StackPanel>--> | |||
</Grid> | |||
<!--#endregion--> | |||
@@ -311,23 +392,31 @@ | |||
</StackPanel> | |||
<StackPanel Grid.Row="2" Orientation="Horizontal"> | |||
<StackPanel> | |||
<ToggleButton | |||
Width="80" | |||
<StackPanel Background="Transparent"> | |||
<Ellipse | |||
Width="30" | |||
Height="30" | |||
Margin="5,0,5,0" | |||
HorizontalAlignment="Center" | |||
VerticalAlignment="Center" | |||
Background="Transparent" | |||
FontSize="20" | |||
IsChecked="{Binding IsOpen}" | |||
Style="{StaticResource SwitchToggleButtonStyle}" /> | |||
Fill="{Binding BucketFlagbit, Converter={StaticResource BoolToFillColorConverter}}" | |||
RenderTransformOrigin="0.5,0.5"> | |||
<Ellipse.OpacityMask> | |||
<RadialGradientBrush> | |||
<GradientStop Offset="0" Color="Transparent" /> | |||
<GradientStop Offset="1" Color="#00c2f4" /> | |||
</RadialGradientBrush> | |||
</Ellipse.OpacityMask> | |||
<!--<Ellipse.RenderTransform> | |||
<ScaleTransform x:Name="Scale" /> | |||
</Ellipse.RenderTransform>--> | |||
</Ellipse> | |||
<TextBlock | |||
Margin="0,5,0,0" | |||
HorizontalAlignment="Center" | |||
FontSize="16" | |||
Foreground="#00c2f4" | |||
Text="仓盖控制" /> | |||
Text="到位检测" /> | |||
</StackPanel> | |||
@@ -340,7 +429,7 @@ | |||
VerticalAlignment="Center" | |||
Background="Transparent" | |||
FontSize="20" | |||
IsChecked="{Binding IsLayOff}" | |||
IsChecked="{Binding BaitingControl}" | |||
Style="{StaticResource SwitchToggleButtonStyle}" /> | |||
<TextBlock | |||
Margin="0,5,0,0" | |||
@@ -358,7 +447,7 @@ | |||
Stretch="Fill" | |||
Visibility="{Binding IsOpen, Converter={StaticResource BoolToVisibilityConvert}}" /> | |||
<Image Source="/BPASmartClient.CustomResource;component/Image/荧光/29.png" Visibility="{Binding IsLayOff, Converter={StaticResource BoolToVisibilityConvert}}" /> | |||
<Image Source="/BPASmartClient.CustomResource;component/Image/荧光/29.png" Visibility="{Binding BaitingControl, Converter={StaticResource BoolToVisibilityConvert}}" /> | |||
<Image | |||
Grid.RowSpan="2" | |||
@@ -384,7 +473,7 @@ | |||
CaretBrush="#009dff" | |||
FontSize="20" | |||
Foreground="#009dff" | |||
Text="{Binding Weight}" /> | |||
Text="{Binding SetWeight}" /> | |||
</Grid> | |||
</Grid> | |||
@@ -1,4 +1,5 @@ | |||
using System; | |||
using BPA.Helper; | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Text; | |||
@@ -23,6 +24,7 @@ namespace BPASmartClient.DosingSystem.View | |||
public HardwareStatusView() | |||
{ | |||
InitializeComponent(); | |||
this.Unloaded += (o, e) => { ThreadManage.GetInstance().StopTask("输送带料仓状态监控"); }; | |||
} | |||
} | |||
} |
@@ -52,14 +52,15 @@ | |||
<UserControl.DataContext> | |||
<vm:ManualControlViewModel /> | |||
</UserControl.DataContext> | |||
<ScrollViewer> | |||
<ScrollViewer HorizontalScrollBarVisibility="Disabled" VerticalScrollBarVisibility="Hidden"> | |||
<StackPanel Margin="8"> | |||
<!--#region 升降气缸--> | |||
<Grid | |||
Name="cy" | |||
Grid.Row="0" | |||
Margin="5"> | |||
Margin="5" | |||
Visibility="{Binding cylinderModels, Converter={StaticResource CountIsVisiableConvert}}"> | |||
<pry:ImageBorder | |||
Grid.RowSpan="2" | |||
Width="{Binding ElementName=cy, Path=ActualWidth}" | |||
@@ -90,7 +91,7 @@ | |||
ScrollViewer.HorizontalScrollBarVisibility="Disabled"> | |||
<ListView.ItemsPanel> | |||
<ItemsPanelTemplate> | |||
<WrapPanel Orientation="Horizontal" /> | |||
<WrapPanel Orientation="Horizontal" ScrollViewer.HorizontalScrollBarVisibility="Disabled" /> | |||
</ItemsPanelTemplate> | |||
</ListView.ItemsPanel> | |||
@@ -161,7 +162,8 @@ | |||
<Grid | |||
Name="zd" | |||
Grid.Row="1" | |||
Margin="5"> | |||
Margin="5" | |||
Visibility="{Binding BlockCylinders, Converter={StaticResource CountIsVisiableConvert}}"> | |||
<pry:ImageBorder Width="{Binding ElementName=zd, Path=ActualWidth}" Height="{Binding ElementName=zd, Path=ActualHeight}" /> | |||
<StackPanel> | |||
<Grid Height="40"> | |||
@@ -259,7 +261,8 @@ | |||
<Grid | |||
Name="tp" | |||
Grid.Row="2" | |||
Margin="5"> | |||
Margin="5" | |||
Visibility="{Binding PalletCylinders, Converter={StaticResource CountIsVisiableConvert}}"> | |||
<pry:ImageBorder | |||
Grid.RowSpan="2" | |||
Width="{Binding ElementName=tp, Path=ActualWidth}" | |||
@@ -357,6 +360,109 @@ | |||
</Grid> | |||
<!--#endregion--> | |||
<!--#region 上下桶工位气缸--> | |||
<Grid | |||
Name="onGrid" | |||
Grid.Row="2" | |||
Margin="5" | |||
Visibility="{Binding OtherHandCylinders, Converter={StaticResource CountIsVisiableConvert}}"> | |||
<pry:ImageBorder | |||
Grid.RowSpan="2" | |||
Width="{Binding ElementName=onGrid, Path=ActualWidth}" | |||
Height="{Binding ElementName=onGrid, Path=ActualHeight}" /> | |||
<StackPanel> | |||
<Grid Height="40"> | |||
<Image | |||
Margin="2,3,0,0" | |||
HorizontalAlignment="Left" | |||
Source="/BPASmartClient.CustomResource;component/Image/标签.png" /> | |||
<TextBlock | |||
Margin="10,0,0,0" | |||
VerticalAlignment="Center" | |||
FontSize="16" | |||
Foreground="Aqua" | |||
Text="上下桶工位气缸控制" /> | |||
</Grid> | |||
<ListView | |||
Name="list4" | |||
Grid.Row="2" | |||
Margin="0,0,0,20" | |||
Background="Transparent" | |||
BorderBrush="#00BEFA" | |||
BorderThickness="0" | |||
ItemsSource="{Binding OtherHandCylinders}" | |||
ScrollViewer.HorizontalScrollBarVisibility="Disabled"> | |||
<ListView.ItemsPanel> | |||
<ItemsPanelTemplate> | |||
<WrapPanel Orientation="Horizontal" /> | |||
</ItemsPanelTemplate> | |||
</ListView.ItemsPanel> | |||
<ListView.ItemTemplate> | |||
<DataTemplate> | |||
<Grid | |||
Width="200" | |||
Height="100" | |||
Margin="0,0,0,15" | |||
Background="Transparent"> | |||
<Grid.RowDefinitions> | |||
<RowDefinition Height="30" /> | |||
<RowDefinition /> | |||
<RowDefinition Height="30" /> | |||
</Grid.RowDefinitions> | |||
<Grid.ColumnDefinitions> | |||
<ColumnDefinition Width="0.5*" /> | |||
<ColumnDefinition /> | |||
<ColumnDefinition /> | |||
</Grid.ColumnDefinitions> | |||
<TextBlock | |||
Grid.Column="1" | |||
Grid.ColumnSpan="2" | |||
HorizontalAlignment="Center" | |||
VerticalAlignment="Center" | |||
Foreground="Aqua" | |||
Text="{Binding Name}" /> | |||
<pry:Cylinder | |||
Grid.Row="1" | |||
Grid.ColumnSpan="3" | |||
Width="200" | |||
Height="50" | |||
HorizontalAlignment="Center" | |||
VerticalAlignment="Center" | |||
LeftTogIsChecked="{Binding LeftTog}" | |||
RightTogIsChecked="{Binding RightTog}" /> | |||
<RadioButton | |||
Grid.Row="2" | |||
Grid.Column="1" | |||
Command="{Binding DataContext.Open, RelativeSource={RelativeSource AncestorType=ListView, Mode=FindAncestor}}" | |||
CommandParameter="{Binding Name}" | |||
Content="伸出" | |||
Foreground="Aqua" | |||
IsChecked="True" | |||
Style="{StaticResource radioButtonStyle}" /> | |||
<RadioButton | |||
Grid.Row="2" | |||
Grid.Column="2" | |||
Command="{Binding DataContext.Close, RelativeSource={RelativeSource AncestorType=ListView, Mode=FindAncestor}}" | |||
CommandParameter="{Binding Name}" | |||
Content="缩回" | |||
Foreground="Aqua" | |||
IsChecked="False" | |||
Style="{StaticResource radioButtonStyle}" /> | |||
</Grid> | |||
</DataTemplate> | |||
</ListView.ItemTemplate> | |||
</ListView> | |||
</StackPanel> | |||
</Grid> | |||
<!--#endregion--> | |||
</StackPanel> | |||
</ScrollViewer> | |||
</UserControl> |
@@ -1,4 +1,5 @@ | |||
using System; | |||
using BPA.Helper; | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Text; | |||
@@ -23,7 +24,12 @@ namespace BPASmartClient.DosingSystem.View | |||
public ManualControlView() | |||
{ | |||
InitializeComponent(); | |||
this.Unloaded += (o, e) => { ThreadManage.GetInstance().StopTask("手动气缸状态监控"); }; | |||
this.SizeChanged += ManualControlView_SizeChanged; | |||
this.cy.Height = this.list1.ActualHeight + 40; | |||
this.zd.Height = this.list2.ActualHeight + 40; | |||
this.tp.Height = this.list3.ActualHeight + 40; | |||
this.onGrid.Height = this.list4.ActualHeight + 40; | |||
} | |||
private void ManualControlView_SizeChanged(object sender, SizeChangedEventArgs e) | |||
@@ -31,6 +37,7 @@ namespace BPASmartClient.DosingSystem.View | |||
this.cy.Height = this.list1.ActualHeight + 40; | |||
this.zd.Height = this.list2.ActualHeight + 40; | |||
this.tp.Height = this.list3.ActualHeight + 40; | |||
this.onGrid.Height = this.list4.ActualHeight + 40; | |||
} | |||
} | |||
} |
@@ -223,6 +223,7 @@ | |||
IsEditable="False" | |||
ItemsSource="{Binding DataContext.RawMaterialNames, RelativeSource={RelativeSource AncestorType=ItemsControl, Mode=FindAncestor}}" | |||
SelectedIndex="{Binding SelectIndex}" | |||
SelectionChanged="cb_SelectionChanged" | |||
Style="{StaticResource ComboBoxStyle}" | |||
Text="{Binding RawMaterialName}" /> | |||
@@ -28,5 +28,10 @@ namespace BPASmartClient.DosingSystem.View | |||
ActionManage.GetInstance.Register(new Action(() => { this.Close(); }), "CloseNewRecipeView", true); | |||
this.Unloaded += (o, s) => { Json<LocaPar>.Save(); }; | |||
} | |||
private void cb_SelectionChanged(object sender, SelectionChangedEventArgs e) | |||
{ | |||
ActionManage.GetInstance.SendAsync("原料选择修改", (sender as ComboBox).SelectedValue); | |||
} | |||
} | |||
} |
@@ -338,10 +338,6 @@ | |||
ScrollViewer.HorizontalScrollBarVisibility="Disabled"> | |||
<ListBox.ItemsPanel> | |||
<ItemsPanelTemplate> | |||
<!--<UniformGrid | |||
HorizontalAlignment="Left" | |||
VerticalAlignment="Top" | |||
Columns="6" />--> | |||
<WrapPanel Orientation="Horizontal" /> | |||
</ItemsPanelTemplate> | |||
</ListBox.ItemsPanel> | |||
@@ -351,8 +347,8 @@ | |||
<Grid | |||
Name="tt" | |||
Height="220" | |||
Width="180" | |||
Height="220" | |||
Margin="5"> | |||
<Grid.RowDefinitions> | |||
<RowDefinition Height="30" /> | |||
@@ -715,7 +711,7 @@ | |||
</Grid> | |||
<ScrollViewer | |||
<!--<ScrollViewer | |||
Grid.Row="1" | |||
HorizontalScrollBarVisibility="Hidden" | |||
VerticalScrollBarVisibility="Hidden"> | |||
@@ -777,27 +773,258 @@ | |||
</ItemsControl> | |||
</Grid> | |||
<!--<TreeView x:Name="repiceListMaking" ItemsSource="{Binding RecipeProcesse}" | |||
--> | |||
<!--<TreeView x:Name="repiceListMaking" ItemsSource="{Binding RecipeProcesse}" | |||
ScrollViewer.VerticalScrollBarVisibility="Disabled" HorizontalAlignment="Stretch" Background="Wheat" ItemContainerStyle="{StaticResource recipeTreeItem}"> | |||
</TreeView>--> | |||
<!-- 等待和已完成 --> | |||
<TreeView | |||
<!-- 等待和已完成 --> | |||
<!--<TreeView | |||
x:Name="repiceList" | |||
HorizontalAlignment="Stretch" | |||
Background="Transparent" | |||
BorderThickness="0" | |||
ItemContainerStyle="{StaticResource recipeTreeItem}" | |||
ItemsSource="{Binding UserTreeWait}" | |||
ScrollViewer.VerticalScrollBarVisibility="Visible" /> | |||
ScrollViewer.VerticalScrollBarVisibility="Visible" />--> | |||
<!-- | |||
</Grid> | |||
</Border> | |||
</ScrollViewer>--> | |||
<!--#region 等待制作和制作完成列表显示--> | |||
<Grid | |||
Name="WaitOrCompleteGrid" | |||
Grid.Row="1" | |||
Margin="10"> | |||
<Grid.RowDefinitions> | |||
<RowDefinition Height="30" /> | |||
<RowDefinition /> | |||
</Grid.RowDefinitions> | |||
<!--#region 表格标题栏设置--> | |||
<Grid | |||
Grid.Row="0" | |||
Margin="0,5" | |||
Background="#ff0C255F"> | |||
<Grid.ColumnDefinitions> | |||
<ColumnDefinition Width="50" /> | |||
<ColumnDefinition /> | |||
<ColumnDefinition Width="100" /> | |||
</Grid.ColumnDefinitions> | |||
<TextBlock | |||
Grid.Column="0" | |||
Style="{StaticResource TitleTextblockStyle}" | |||
Text="序号" /> | |||
<Grid Grid.Column="1"> | |||
<TextBlock Style="{StaticResource TitleTextblockStyle}" Text="配方名称" /> | |||
<Border | |||
BorderBrush="{StaticResource bordColor}" | |||
BorderThickness="1,0,1,0" | |||
Cursor="SizeWE" /> | |||
</Grid> | |||
<TextBlock | |||
Grid.Column="2" | |||
Style="{StaticResource TitleTextblockStyle}" | |||
Text="状态" /> | |||
<Border | |||
Grid.ColumnSpan="10" | |||
BorderBrush="{StaticResource bordColor}" | |||
BorderThickness="1,0,1,0" /> | |||
</Grid> | |||
<!--#endregion--> | |||
<ScrollViewer | |||
Grid.Row="1" | |||
HorizontalScrollBarVisibility="Hidden" | |||
VerticalScrollBarVisibility="Hidden"> | |||
<ItemsControl Name="Wait" ItemsSource="{Binding UserTreeWait}"> | |||
<ItemsControl.ItemTemplate> | |||
<DataTemplate> | |||
<Grid Height="30"> | |||
<Grid.ColumnDefinitions> | |||
<ColumnDefinition Width="50" /> | |||
<ColumnDefinition /> | |||
<ColumnDefinition Width="100" /> | |||
</Grid.ColumnDefinitions> | |||
<TextBlock | |||
HorizontalAlignment="Center" | |||
VerticalAlignment="Center" | |||
FontSize="16" | |||
Foreground="#FF2AB2E7" | |||
Text="{Binding SerialNum}" /> | |||
<Grid Grid.Column="1"> | |||
<TextBlock | |||
Grid.Column="1" | |||
Margin="5,0,0,0" | |||
HorizontalAlignment="Left" | |||
VerticalAlignment="Center" | |||
FontSize="16" | |||
Foreground="#FF2AB2E7" | |||
Text="{Binding RecipeName}" /> | |||
<Border | |||
BorderBrush="{StaticResource bordColor}" | |||
BorderThickness="1,0,1,0" | |||
Cursor="SizeWE" /> | |||
</Grid> | |||
<TextBlock | |||
Grid.Column="2" | |||
HorizontalAlignment="Center" | |||
VerticalAlignment="Center" | |||
FontSize="16" | |||
Foreground="Yellow" | |||
Text="等待执行" /> | |||
<Border | |||
Grid.ColumnSpan="10" | |||
BorderBrush="{StaticResource bordColor}" | |||
BorderThickness="1" /> | |||
</Grid> | |||
</DataTemplate> | |||
</ItemsControl.ItemTemplate> | |||
</ItemsControl> | |||
</ScrollViewer> | |||
</Grid> | |||
<!--#endregion--> | |||
<!--#region 制作中设备状态监视--> | |||
<Grid | |||
Name="CookingGrid" | |||
Grid.Row="1" | |||
Margin="10" | |||
Visibility="Collapsed"> | |||
<!--<Grid.RowDefinitions> | |||
<RowDefinition Height="30"/> | |||
<RowDefinition/> | |||
</Grid.RowDefinitions>--> | |||
<ItemsControl ItemsSource="{Binding recipeProcesses}"> | |||
<ItemsControl.ItemTemplate> | |||
<DataTemplate> | |||
<Grid> | |||
<Grid.RowDefinitions> | |||
<RowDefinition Height="40" /> | |||
<RowDefinition Height="40" /> | |||
<RowDefinition /> | |||
</Grid.RowDefinitions> | |||
<Image | |||
Grid.RowSpan="3" | |||
Source="/BPASmartClient.CustomResource;component/Image/组合边框2.1.png" | |||
Stretch="Fill" /> | |||
<Image | |||
Grid.RowSpan="3" | |||
Source="/BPASmartClient.CustomResource;component/Image/组合边框2.png" | |||
Stretch="Fill" /> | |||
<TextBlock | |||
Grid.Row="0" | |||
Margin="10,15,0,0" | |||
HorizontalAlignment="Left" | |||
VerticalAlignment="Center" | |||
FontSize="18" | |||
Foreground="#FF2AB2E7" | |||
Text="{Binding RecipeName}" /> | |||
<!--#region 表格标题栏设置--> | |||
<Grid | |||
Grid.Row="1" | |||
Margin="5,8" | |||
Background="#ff0C255F"> | |||
<Grid.ColumnDefinitions> | |||
<ColumnDefinition /> | |||
<ColumnDefinition /> | |||
</Grid.ColumnDefinitions> | |||
<TextBlock | |||
Grid.Column="0" | |||
Style="{StaticResource TitleTextblockStyle}" | |||
Text="原料" /> | |||
<Grid Grid.Column="1"> | |||
<TextBlock Style="{StaticResource TitleTextblockStyle}" Text="状态" /> | |||
<Border | |||
BorderBrush="{StaticResource bordColor}" | |||
BorderThickness="1,0,1,0" | |||
Cursor="SizeWE" /> | |||
</Grid> | |||
<Border | |||
Grid.ColumnSpan="10" | |||
BorderBrush="{StaticResource bordColor}" | |||
BorderThickness="1,0,1,0" /> | |||
</Grid> | |||
<!--#endregion--> | |||
<ItemsControl | |||
Grid.Row="2" | |||
Margin="0,0,0,15" | |||
ItemsSource="{Binding RawMaterials}"> | |||
<ItemsControl.ItemTemplate> | |||
<DataTemplate> | |||
<Grid Height="30"> | |||
<Grid.ColumnDefinitions> | |||
<ColumnDefinition /> | |||
<ColumnDefinition /> | |||
</Grid.ColumnDefinitions> | |||
<StackPanel | |||
Margin="0,0,5,0" | |||
HorizontalAlignment="Right" | |||
Orientation="Horizontal"> | |||
<TextBlock Style="{StaticResource TitleTextblockStyle}" Text="{Binding RawMaterialName}" /> | |||
<TextBlock Style="{StaticResource TitleTextblockStyle}" Text=":" /> | |||
</StackPanel> | |||
<StackPanel | |||
Grid.Column="1" | |||
Margin="2,0,0,0" | |||
Orientation="Horizontal"> | |||
<TextBlock | |||
Margin="0,0,5,0" | |||
Foreground="{Binding Status, Converter={StaticResource ForegroundConverter}}" | |||
Style="{StaticResource TitleTextblockStyle}" | |||
Text="{Binding Status}" /> | |||
<TextBlock | |||
FontFamily="/BPASmartClient.CustomResource;component/Fonts/#iconfont" | |||
FontSize="20" | |||
Foreground="{Binding Status, Converter={StaticResource ForegroundConverter}}" | |||
Style="{StaticResource TitleTextblockStyle}" | |||
Text="{Binding Status, Converter={StaticResource StatusIconConverter}}" /> | |||
</StackPanel> | |||
</Grid> | |||
</DataTemplate> | |||
</ItemsControl.ItemTemplate> | |||
</ItemsControl> | |||
</Grid> | |||
</DataTemplate> | |||
</ItemsControl.ItemTemplate> | |||
</ItemsControl> | |||
</Grid> | |||
<!--#endregion--> | |||
</Grid> | |||
</Border> | |||
</ScrollViewer> | |||
</Grid> | |||
</Grid> | |||
@@ -24,33 +24,39 @@ namespace BPASmartClient.DosingSystem.View | |||
public RecipeControlView() | |||
{ | |||
InitializeComponent(); | |||
RadioButtonWait_Click(null,null); | |||
RadioButtonWait_Click(null, null); | |||
} | |||
private void RadioButtonCompelete_Click(object sender, RoutedEventArgs e) | |||
{ | |||
repiceList.ItemsSource = RecipeControlViewModel.UserTreeCompelete; | |||
repiceList.Visibility = Visibility.Visible; | |||
repiceListMaking.Visibility = Visibility.Hidden; | |||
//repiceList.ItemsSource = RecipeControlViewModel.UserTreeCompelete; | |||
//repiceList.Visibility = Visibility.Visible; | |||
//repiceListMaking.Visibility = Visibility.Hidden; | |||
this.Wait.ItemsSource = RecipeControlViewModel.UserTreeCompelete; | |||
CookingGrid.Visibility = Visibility.Collapsed; | |||
WaitOrCompleteGrid.Visibility = Visibility.Visible; | |||
this.Wait.Visibility = Visibility.Visible; | |||
} | |||
private void RadioButtonWait_Click(object sender, RoutedEventArgs e) | |||
{ | |||
repiceList.ItemsSource = RecipeControlViewModel.UserTreeWait; | |||
repiceList.Visibility = Visibility.Visible; | |||
repiceListMaking.Visibility = Visibility.Hidden; | |||
//repiceList.ItemsSource = RecipeControlViewModel.UserTreeWait; | |||
//repiceList.Visibility = Visibility.Visible; | |||
//repiceListMaking.Visibility = Visibility.Hidden; | |||
this.Wait.ItemsSource = RecipeControlViewModel.UserTreeWait; | |||
CookingGrid.Visibility = Visibility.Collapsed; | |||
WaitOrCompleteGrid.Visibility = Visibility.Visible; | |||
this.Wait.Visibility = Visibility.Visible; | |||
} | |||
private void RadioButtonMaking_Click(object sender, RoutedEventArgs e) | |||
{ | |||
repiceListMaking.Visibility = Visibility.Visible; | |||
repiceList.Visibility = Visibility.Hidden; | |||
//repiceListMaking.Visibility = Visibility.Visible; | |||
//repiceList.Visibility = Visibility.Hidden; | |||
WaitOrCompleteGrid.Visibility = Visibility.Collapsed; | |||
this.Wait.Visibility = Visibility.Collapsed; | |||
CookingGrid.Visibility = Visibility.Visible; | |||
} | |||
} | |||
} |
@@ -4,8 +4,6 @@ using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
using BPA.Helper; | |||
using Microsoft.Toolkit.Mvvm.ComponentModel; | |||
using Microsoft.Toolkit.Mvvm.Input; | |||
using BPASmartClient.CustomResource.Pages.Model; | |||
namespace BPASmartClient.DosingSystem.ViewModel | |||
@@ -1,46 +1,42 @@ | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Collections.ObjectModel; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
using BPA.Helper; | |||
using BPASmartClient.CustomResource.UserControls; | |||
using BPASmartClient.CustomResource.UserControls.MessageShow; | |||
using Microsoft.Toolkit.Mvvm.ComponentModel; | |||
using Microsoft.Toolkit.Mvvm.Input; | |||
namespace BPASmartClient.DosingSystem.ViewModel | |||
{ | |||
public class CommparSetViewModel : ObservableObject | |||
public class CommparSetViewModel : NotifyBase | |||
{ | |||
public CommparSetViewModel() | |||
{ | |||
SaveCommand = new RelayCommand(() => | |||
{ | |||
if (!string.IsNullOrEmpty(Address)) | |||
if (!string.IsNullOrEmpty(CommBaseParModel.NetworkSegAddress)) | |||
{ | |||
var res = Address.Split("."); | |||
var res = CommBaseParModel.NetworkSegAddress.Split("."); | |||
if (res != null) | |||
{ | |||
StringBuilder sb = new StringBuilder(); | |||
if (res.Length >= 3) | |||
{ | |||
for (int i = 0; i < 3; i++) | |||
{ | |||
sb.Append($"{res[i]}."); | |||
} | |||
Json<DevicePar>.Data.Address = sb.ToString(); | |||
StringBuilder sb = new StringBuilder(); | |||
for (int i = 0; i < 3; i++) sb.Append($"{res[i]}."); | |||
Json<DevicePar>.Data.BaseParModel.NetworkSegAddress = sb.ToString(); | |||
Json<DevicePar>.Save(); | |||
NoticeDemoViewModel.OpenMsg(EnumPromptType.Success, App.MainWindow, "提示", $"参数保存成功!"); | |||
} | |||
} | |||
} | |||
}); | |||
Address = Json<DevicePar>.Data.Address; | |||
} | |||
public string Address { get { return _mAddress; } set { _mAddress = value; OnPropertyChanged(); } } | |||
private string _mAddress; | |||
public BasePar CommBaseParModel { get { return Json<DevicePar>.Data.BaseParModel; } set { Json<DevicePar>.Data.BaseParModel = value; OnPropertyChanged(); } } | |||
//private BasePar _mCommBaseParModel; | |||
public RelayCommand SaveCommand { get; set; } | |||
@@ -0,0 +1,29 @@ | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Collections.ObjectModel; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
using BPA.Helper; | |||
namespace BPASmartClient.DosingSystem.ViewModel | |||
{ | |||
public class ConveyerBeltManualViewModel : NotifyBase | |||
{ | |||
public ConveyerBeltManualViewModel() | |||
{ | |||
for (int i = 0; i < Json<DevicePar>.Data.BaseParModel.ConveyerBeltCount; i++) | |||
{ | |||
ConveyerBeltModels.Add(new ConveyerBeltModel() | |||
{ | |||
Name = $"输送带{i + 1}控制", | |||
Num = i + 1, | |||
Speed = GlobalDevice.MotorSpeed[i], | |||
ConveyerBeltWork = GlobalDevice.MotorControl.GetBitValue((byte)(i + 1)) | |||
}); | |||
} | |||
} | |||
public ObservableCollection<ConveyerBeltModel> ConveyerBeltModels { get; set; } = new ObservableCollection<ConveyerBeltModel>(); | |||
} | |||
} |
@@ -3,12 +3,10 @@ using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
using Microsoft.Toolkit.Mvvm.ComponentModel; | |||
using BPA.Helper; | |||
using System.Collections.Concurrent; | |||
using System.Collections.ObjectModel; | |||
using System.Windows; | |||
using BPA.Helper; | |||
using Microsoft.Toolkit.Mvvm.Input; | |||
using BPASmartClient.DosingSystem.View; | |||
@@ -36,11 +34,17 @@ namespace BPASmartClient.DosingSystem.ViewModel | |||
public ObservableCollection<Devices> devices { get; set; } | |||
} | |||
public class Devices : ObservableObject | |||
public class Devices : NotifyBase | |||
{ | |||
public string IpAddress { get { return _mIpAddress; } set { _mIpAddress = value; OnPropertyChanged(); } } | |||
private string _mIpAddress; | |||
/// <summary> | |||
/// 设备编号 | |||
/// </summary> | |||
public int DeviceNum { get { return _mDeviceNum; } set { _mDeviceNum = value; OnPropertyChanged(); } } | |||
private int _mDeviceNum; | |||
public string DeviceName { get { return _mDeviceName; } set { _mDeviceName = value; OnPropertyChanged(); } } | |||
private string _mDeviceName; | |||
@@ -3,10 +3,10 @@ using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
using Microsoft.Toolkit.Mvvm.ComponentModel; | |||
using BPA.Helper; | |||
using System.Collections.ObjectModel; | |||
using BPA.Helper; | |||
using Microsoft.Toolkit.Mvvm.Input; | |||
using BPASmartClient.CustomResource.UserControls.MessageShow; | |||
using BPASmartClient.CustomResource.UserControls; | |||
using System.Diagnostics; | |||
@@ -3,31 +3,135 @@ using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
using Microsoft.Toolkit.Mvvm.ComponentModel; | |||
using BPA.Helper; | |||
using System.Collections.Concurrent; | |||
using System.Collections.ObjectModel; | |||
using System.Windows; | |||
using BPA.Helper; | |||
using Microsoft.Toolkit.Mvvm.Input; | |||
using System.Threading; | |||
namespace BPASmartClient.DosingSystem.ViewModel | |||
{ | |||
public class HardwareStatusViewModel : ObservableObject | |||
public class HardwareStatusViewModel : NotifyBase | |||
{ | |||
public HardwareStatusViewModel() | |||
{ | |||
TopDeviceCurrentStatuses = DeviceInquire.GetInstance.TopDeviceCurrentStatuses; | |||
BottomDeviceCurrentStatuses = DeviceInquire.GetInstance.BottomDeviceCurrentStatuses; | |||
//for (int i = 0; i < Json<DevicePar>.Data.BaseParModel.ConveyerBeltCount; i++) | |||
//{ | |||
// ConveyerBeltModels.Add(new ConveyerBeltModel() { Name = $"输送带{i}", Num = i++ }); | |||
//} | |||
//ConveyerBeltControlCommand = new RelayCommand<object>(o => | |||
//{ | |||
// if (o != null && o is int tempCount) | |||
// { | |||
// string add = SiemensDevice.GetInstance.GetSiemensBitSingleAdd("DB5.DBX", tempCount, 6); | |||
// int index = ConveyerBeltModels.ToList().FindIndex(p => p.Num == tempCount); | |||
// if (index >= 0 && index < ConveyerBeltModels.Count) | |||
// { | |||
// SiemensDevice.GetInstance.MySiemens.Write(add, !ConveyerBeltModels.ElementAt(index).Control); | |||
// } | |||
// } | |||
//}); | |||
ThreadManage.GetInstance().StartLong(new Action(() => | |||
{ | |||
for (int i = 0; i < Json<DevicePar>.Data.OutletInfoModels.Count; i++) | |||
{ | |||
int count = Json<DevicePar>.Data.OutletInfoModels.ElementAt(i).SiloInfos.Count; | |||
if (count >= 1) | |||
{ | |||
for (int m = 0; m < count; m++) | |||
{ | |||
var deviceName = Json<DevicePar>.Data.OutletInfoModels.ElementAt(i).SiloInfos.ElementAt(m); | |||
int topIndex = TopDeviceCurrentStatuses.ToList().FindIndex(p => p.DeviceName == deviceName); | |||
int bottomIndex = BottomDeviceCurrentStatuses.ToList().FindIndex(p => p.DeviceName == deviceName); | |||
if (topIndex >= 0 && topIndex < TopDeviceCurrentStatuses.Count) | |||
TopDeviceCurrentStatuses.ElementAt(i).BucketFlagbit = GlobalDevice.PlcData.StationDetection[i]; | |||
if (bottomIndex >= 0 && bottomIndex < BottomDeviceCurrentStatuses.Count) | |||
BottomDeviceCurrentStatuses.ElementAt(i).BucketFlagbit = GlobalDevice.PlcData.StationDetection[i]; | |||
} | |||
} | |||
} | |||
StatusUpdate(TopDeviceCurrentStatuses); | |||
StatusUpdate(BottomDeviceCurrentStatuses); | |||
OnDetection = GlobalDevice.PlcData.OnDetection; | |||
UnderDetection = GlobalDevice.PlcData.UnderDetection; | |||
ConveyerBeltStatus = GlobalDevice.MotorControlFeedback > 0; | |||
Thread.Sleep(100); | |||
}), "输送带料仓状态监控"); | |||
RecipeControlCommand = new RelayCommand<object>((o) => | |||
{ | |||
if (o != null && o is DeviceCurrentStatus currentStatus) | |||
{ | |||
var res = DeviceInquire.GetInstance.devices.FirstOrDefault(p => p.DeviceName == currentStatus.DeviceName); | |||
if (res != null) | |||
{ | |||
DeviceInquire.GetInstance.GetDevice(res.IpAddress).Start(currentStatus.SetWeight); | |||
} | |||
} | |||
}); | |||
} | |||
private void StatusUpdate(ObservableCollection<DeviceCurrentStatus> devices) | |||
{ | |||
if (devices == null) return; | |||
for (int i = 0; i < devices.Count; i++) | |||
{ | |||
if (devices.ElementAt(i).BaitingControl) | |||
{ | |||
var res = DeviceInquire.GetInstance.devices.FirstOrDefault(p => p.DeviceName == devices.ElementAt(i).DeviceName); | |||
if (res != null) | |||
{ | |||
var runStatus = DeviceInquire.GetInstance.GetDevice(res.IpAddress).deviceStatus.RunStatus; | |||
if (runStatus == 3) | |||
{ | |||
if (TopDeviceCurrentStatuses.FirstOrDefault(p => p.DeviceName == devices.ElementAt(i).DeviceName) != null) | |||
{ | |||
TopDeviceCurrentStatuses.ElementAt(i).BaitingControl = false; | |||
} | |||
else if (BottomDeviceCurrentStatuses.FirstOrDefault(p => p.DeviceName == devices.ElementAt(i).DeviceName) != null) | |||
{ | |||
BottomDeviceCurrentStatuses.ElementAt(i).BaitingControl = false; | |||
} | |||
DeviceInquire.GetInstance.GetDevice(res.IpAddress).StatusReset(); | |||
} | |||
} | |||
} | |||
} | |||
} | |||
public ObservableCollection<DeviceCurrentStatus> TopDeviceCurrentStatuses { get; set; } | |||
public ObservableCollection<DeviceCurrentStatus> BottomDeviceCurrentStatuses { get; set; } | |||
public ObservableCollection<ConveyerBeltModel> ConveyerBeltModels { get; set; } = new ObservableCollection<ConveyerBeltModel>(); | |||
public RelayCommand<object> ConveyerBeltControlCommand { get; set; } | |||
public RelayCommand<object> RecipeControlCommand { get; set; } | |||
/// <summary> | |||
/// 输送带状态 | |||
/// </summary> | |||
public bool ConveyerBeltStatus { get { return _mConveyerBeltStatus; } set { _mConveyerBeltStatus = value; OnPropertyChanged(); } } | |||
private bool _mConveyerBeltStatus; | |||
public bool ConveyerBeltWork { get { return _mConveyerBeltWork; } set { _mConveyerBeltWork = value; OnPropertyChanged(); } } | |||
private bool _mConveyerBeltWork; | |||
/// <summary> | |||
/// 上桶工位检测 | |||
/// </summary> | |||
public bool OnDetection { get { return _mOnDetection; } set { _mOnDetection = value; OnPropertyChanged(); } } | |||
private bool _mOnDetection; | |||
/// <summary> | |||
/// 下桶工位检测 | |||
/// </summary> | |||
public bool UnderDetection { get { return _mUnderDetection; } set { _mUnderDetection = value; OnPropertyChanged(); } } | |||
private bool _mUnderDetection; | |||
} | |||
} |
@@ -3,61 +3,120 @@ using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
using Microsoft.Toolkit.Mvvm.ComponentModel; | |||
using System.Collections.ObjectModel; | |||
using Microsoft.Toolkit.Mvvm.Input; | |||
using BPA.Helper; | |||
using System.Collections.ObjectModel; | |||
using System.Threading; | |||
namespace BPASmartClient.DosingSystem.ViewModel | |||
{ | |||
public class ManualControlViewModel : ObservableObject | |||
public class ManualControlViewModel : NotifyBase | |||
{ | |||
public ManualControlViewModel() | |||
{ | |||
for (int i = 0; i < Json<DevicePar>.Data.LiftCylinderCount; i++) | |||
for (int i = 0; i < Json<DevicePar>.Data.BaseParModel.LiftCylinderCount; i++) | |||
{ | |||
cylinderModels.Add(new CylinderModel() | |||
{ | |||
Name = $"升降气缸 {i + 1}", | |||
LeftTog = false, | |||
RightTog = false, | |||
Num = i + 1, | |||
}); | |||
} | |||
for (int i = 0; i < Json<DevicePar>.Data.BlockCylinderCount; i++) | |||
for (int i = 0; i < Json<DevicePar>.Data.BaseParModel.BlockCylinderCount; i++) | |||
{ | |||
BlockCylinders.Add(new CylinderModel() | |||
{ | |||
Name = $"阻挡气缸 {i + 1}", | |||
LeftTog = false, | |||
RightTog = false, | |||
Num = i + 1, | |||
}); | |||
} | |||
for (int i = 0; i < Json<DevicePar>.Data.PalletCylinderCount; i++) | |||
for (int i = 0; i < Json<DevicePar>.Data.BaseParModel.PalletCylinderCount; i++) | |||
{ | |||
PalletCylinders.Add(new CylinderModel() | |||
{ | |||
Name = $"托盘气缸 {i + 1}", | |||
LeftTog = false, | |||
RightTog = false, | |||
Num = i + 1, | |||
}); | |||
} | |||
OtherHandCylinders.Add(new CylinderModel() { Name = "上桶工位气缸" }); | |||
OtherHandCylinders.Add(new CylinderModel() { Name = "下桶工位气缸" }); | |||
Open = new RelayCommand<object>((o) => | |||
{ | |||
int index = Array.FindIndex(cylinderModels.ToArray(), p => p.Name == o.ToString()); | |||
cylinderModels.ElementAt(index).LeftTog = true; | |||
cylinderModels.ElementAt(index).RightTog = false; | |||
if (o != null) | |||
{ | |||
if (o.ToString().Contains("升降气缸")) | |||
{ | |||
int index = Array.FindIndex(cylinderModels.ToArray(), p => p.Name == o.ToString()); | |||
if (index >= 0 && index < cylinderModels.Count) | |||
{ | |||
var addRes = SiemensDevice.GetInstance.GetSiemensBitSingleAdd("DB5.DBX", cylinderModels.ElementAt(index).Num); | |||
SiemensDevice.GetInstance.MySiemens.Write(addRes, true); | |||
} | |||
} | |||
else if (o.ToString().Contains("上桶工位气缸")) | |||
{ | |||
SiemensDevice.GetInstance.MySiemens.Write("DB5.DBX4.0", true); | |||
} | |||
else if (o.ToString().Contains("下桶工位气缸")) | |||
{ | |||
SiemensDevice.GetInstance.MySiemens.Write("DB5.DBX4.1", true); | |||
} | |||
} | |||
}); | |||
Close = new RelayCommand<object>((o) => | |||
{ | |||
int index = Array.FindIndex(cylinderModels.ToArray(), p => p.Name == o.ToString()); | |||
cylinderModels.ElementAt(index).LeftTog = false; | |||
cylinderModels.ElementAt(index).RightTog = true; | |||
if (o != null) | |||
{ | |||
if (o.ToString().Contains("升降气缸")) | |||
{ | |||
int index = Array.FindIndex(cylinderModels.ToArray(), p => p.Name == o.ToString()); | |||
if (index >= 0 && index < cylinderModels.Count) | |||
{ | |||
var addRes = SiemensDevice.GetInstance.GetSiemensBitSingleAdd("DB5.DBX", cylinderModels.ElementAt(index).Num); | |||
SiemensDevice.GetInstance.MySiemens.Write(addRes, false); | |||
} | |||
} | |||
else if (o.ToString().Contains("上桶工位气缸")) | |||
{ | |||
SiemensDevice.GetInstance.MySiemens.Write("DB5.DBX4.0", false); | |||
} | |||
else if (o.ToString().Contains("下桶工位气缸")) | |||
{ | |||
SiemensDevice.GetInstance.MySiemens.Write("DB5.DBX4.1", false); | |||
} | |||
} | |||
}); | |||
ThreadManage.GetInstance().StartLong(new Action(() => | |||
{ | |||
for (int i = 0; i < cylinderModels.Count; i++) | |||
{ | |||
//升降气缸状态 | |||
cylinderModels.ElementAt(i).RightTog = (bool)GlobalDevice.PlcData.cylinderFlagBitStatus[i]?.HomeSignal; | |||
cylinderModels.ElementAt(i).LeftTog = (bool)GlobalDevice.PlcData.cylinderFlagBitStatus[i]?.InPlaceSignal; | |||
} | |||
//上桶工位气缸状态 | |||
OtherHandCylinders.ElementAt(0).RightTog = GlobalDevice.PlcData.OnCylinderDetection.HomeSignal; | |||
OtherHandCylinders.ElementAt(0).LeftTog = GlobalDevice.PlcData.OnCylinderDetection.InPlaceSignal; | |||
//下桶工位气缸状态 | |||
OtherHandCylinders.ElementAt(1).RightTog = GlobalDevice.PlcData.UnderCylinderDetection.HomeSignal; | |||
OtherHandCylinders.ElementAt(1).LeftTog = GlobalDevice.PlcData.UnderCylinderDetection.InPlaceSignal; | |||
Thread.Sleep(100); | |||
}), "手动气缸状态监控"); | |||
} | |||
/// <summary> | |||
@@ -75,13 +134,18 @@ namespace BPASmartClient.DosingSystem.ViewModel | |||
/// </summary> | |||
public ObservableCollection<CylinderModel> PalletCylinders { get; set; } = new ObservableCollection<CylinderModel>(); | |||
/// <summary> | |||
/// 其它手动控制气缸 | |||
/// </summary> | |||
public ObservableCollection<CylinderModel> OtherHandCylinders { get; set; } = new ObservableCollection<CylinderModel>(); | |||
public RelayCommand<object> Open { get; set; } | |||
public RelayCommand<object> Close { get; set; } | |||
} | |||
public class CylinderModel : ObservableObject | |||
public class CylinderModel : NotifyBase | |||
{ | |||
public bool LeftTog { get { return _mLeftTog; } set { _mLeftTog = value; OnPropertyChanged(); } } | |||
@@ -93,7 +157,13 @@ namespace BPASmartClient.DosingSystem.ViewModel | |||
public string Name { get { return _mName; } set { _mName = value; OnPropertyChanged(); } } | |||
private string _mName; | |||
public bool Control { get { return _mControl; } set { _mControl = value; OnPropertyChanged(); } } | |||
private bool _mControl; | |||
/// <summary> | |||
/// 气缸默认编号 | |||
/// </summary> | |||
public int Num { get; set; } | |||
} | |||
} |
@@ -1,8 +1,8 @@ | |||
using BPASmartClient.CustomResource.Pages.Model; | |||
using BPA.Helper; | |||
using BPASmartClient.Model; | |||
using Microsoft.Toolkit.Mvvm.ComponentModel; | |||
using Microsoft.Toolkit.Mvvm.Input; | |||
using BPA.Helper; | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Collections.ObjectModel; | |||
@@ -5,8 +5,8 @@ using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
using BPA.Helper; | |||
using Microsoft.Toolkit.Mvvm.ComponentModel; | |||
using Microsoft.Toolkit.Mvvm.Input; | |||
using BPA.Helper; | |||
namespace BPASmartClient.DosingSystem.ViewModel | |||
{ | |||
@@ -55,8 +55,8 @@ namespace BPASmartClient.DosingSystem.ViewModel | |||
Json<DevicePar>.Data.OutletInfoModels.ElementAt(Index).OutletLoc = OutletLoc; | |||
Json<DevicePar>.Data.OutletInfoModels.ElementAt(Index).SiloInfos.Clear(); | |||
Json<DevicePar>.Data.OutletInfoModels.ElementAt(Index).SiloInfos = SileNames; | |||
//Control.GetInstance.OperationLog($"{OutletName} 编辑完成"); | |||
} | |||
//Control.GetInstance.OperationLog($"{OutletName} 编辑完成"); | |||
} | |||
else | |||
{ | |||
var res = Json<DevicePar>.Data.OutletInfoModels.FirstOrDefault(p => p.OutletName == OutletName); | |||
@@ -78,8 +78,8 @@ namespace BPASmartClient.DosingSystem.ViewModel | |||
OutletName = OutletName, | |||
SiloInfos = SileNames | |||
}); | |||
//Control.GetInstance.OperationLog($"{OutletName} 添加成功"); | |||
} | |||
//Control.GetInstance.OperationLog($"{OutletName} 添加成功"); | |||
} | |||
ActionManage.GetInstance.Send("NewOutletViewClose"); | |||
}); | |||
RemoveCommand = new RelayCommand<object>((o) => | |||
@@ -105,7 +105,7 @@ namespace BPASmartClient.DosingSystem.ViewModel | |||
} | |||
public class RawMaterialInfo : ObservableObject | |||
public class RawMaterialInfo : NotifyBase | |||
{ | |||
public string RawMaterialName { get { return _mRawMaterialName; } set { _mRawMaterialName = value; OnPropertyChanged(); } } | |||
@@ -3,10 +3,8 @@ using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
using Microsoft.Toolkit.Mvvm.ComponentModel; | |||
using System.Collections.ObjectModel; | |||
using Microsoft.Toolkit.Mvvm.Input; | |||
using BPA.Helper; | |||
using System.Collections.ObjectModel; | |||
using BPASmartClient.CustomResource.Pages.Model; | |||
using BPASmartClient.Model; | |||
using BPASmartClient.CustomResource.UserControls.MessageShow; | |||
@@ -18,6 +16,16 @@ namespace BPASmartClient.DosingSystem.ViewModel | |||
{ | |||
public NewRecipeViewModel() | |||
{ | |||
ActionManage.GetInstance.RegisterAsync(new Action<object>((o) => | |||
{ | |||
if (!string.IsNullOrEmpty(o?.ToString())) | |||
{ | |||
if (RawMaterials.FirstOrDefault(p => p.RawMaterialName == o.ToString()) != null) | |||
{ | |||
App.Current.Dispatcher.Invoke(() => { MessageNotify.GetInstance.ShowDialog("单前原料和其它原料重复,请重新选择!", DialogType.Warning); }); | |||
} | |||
} | |||
}), "原料选择修改"); | |||
ActionManage.GetInstance.Register(new Action<object>((o) => | |||
{ | |||
if (o != null && o is RecipeModel rm) | |||
@@ -35,13 +43,20 @@ namespace BPASmartClient.DosingSystem.ViewModel | |||
AddCommand = new RelayCommand(() => | |||
{ | |||
if (RawMaterials.Count >= DeviceInquire.GetInstance.devices.Count) | |||
{ | |||
MessageNotify.GetInstance.ShowDialog("原材料不足!"); | |||
return; | |||
} | |||
p: | |||
string guid = Guid.NewGuid().ToString(); | |||
if (RawMaterials.FirstOrDefault(p => p.RawMaterialId == guid) == null) | |||
{ | |||
int index = RawMaterials.Count;//<= 0 ? 0 : RawMaterials.Count - 1; | |||
RawMaterials.Add(new RawMaterialModel() | |||
{ | |||
RawMaterialId = guid | |||
RawMaterialId = guid, | |||
SelectIndex = index | |||
}); | |||
} | |||
else goto p; | |||
@@ -52,13 +67,20 @@ namespace BPASmartClient.DosingSystem.ViewModel | |||
if (obj is string rm) | |||
{ | |||
var res = RawMaterials.FirstOrDefault(p => p.RawMaterialId == rm); | |||
if (res != null) Global.DeviceRawMaterials.Remove(res); | |||
if (res != null) RawMaterials.Remove(res); | |||
} | |||
}); | |||
SaveCommand = new RelayCommand(() => | |||
{ | |||
if (string.IsNullOrEmpty(RecipeName)) { ErrorInfo = "请输入配方名称"; return; } | |||
if (string.IsNullOrEmpty(RecipeName)) { MessageNotify.GetInstance.ShowDialog("请输入配方名称!", DialogType.Warning); ErrorInfo = "请输入配方名称"; return; } | |||
var tempRes = RawMaterials.GroupBy(p => p.RawMaterialName); | |||
if (tempRes.Count() != RawMaterials.Count) | |||
{ | |||
MessageNotify.GetInstance.ShowDialog("单前原料和其它原料重复,请重新选择!", DialogType.Warning); | |||
return; | |||
} | |||
//编辑配方 | |||
if (Index >= 0 && Index < Json<LocaPar>.Data.Recipes.Count) | |||
@@ -67,6 +89,7 @@ namespace BPASmartClient.DosingSystem.ViewModel | |||
if (res >= 0 && res != Index) | |||
{ | |||
ErrorInfo = "配方名称已经存在!"; | |||
MessageNotify.GetInstance.ShowDialog("配方名称已经存在!", DialogType.Warning); | |||
return; | |||
} | |||
Json<LocaPar>.Data.Recipes.ElementAt(Index).RecipeName = RecipeName; | |||
@@ -93,6 +116,7 @@ namespace BPASmartClient.DosingSystem.ViewModel | |||
if (Json<LocaPar>.Data.Recipes.FirstOrDefault(p => p.RecipeName == RecipeName) != null) | |||
{ | |||
ErrorInfo = "配方名称已存在!"; | |||
MessageNotify.GetInstance.ShowDialog("配方名称已经存在!", DialogType.Warning); | |||
return; | |||
} | |||
@@ -168,7 +192,6 @@ namespace BPASmartClient.DosingSystem.ViewModel | |||
} | |||
private string RecipCode = string.Empty; | |||
public string RecipeName { get { return _mRecipeName; } set { _mRecipeName = value; OnPropertyChanged(); } } | |||
@@ -6,8 +6,8 @@ using System.Text; | |||
using System.Threading.Tasks; | |||
using BPA.Helper; | |||
using BPASmartClient.DosingSystem.View; | |||
using Microsoft.Toolkit.Mvvm.ComponentModel; | |||
using Microsoft.Toolkit.Mvvm.Input; | |||
using BPA.Helper; | |||
namespace BPASmartClient.DosingSystem.ViewModel | |||
{ | |||
@@ -3,62 +3,73 @@ using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
using Microsoft.Toolkit.Mvvm.ComponentModel; | |||
using BPA.Helper; | |||
using System.Collections.Concurrent; | |||
using System.Collections.ObjectModel; | |||
using System.Windows; | |||
using BPA.Helper; | |||
using Microsoft.Toolkit.Mvvm.Input; | |||
using System.Threading; | |||
using BPASmartClient.CustomResource.Pages.Model; | |||
using BPASmartClient.CustomResource.UserControls.MessageShow; | |||
using BPASmartClient.CustomResource.UserControls; | |||
using BPASmartClient.Model.柔性味魔方; | |||
using BPASmartClient.Model; | |||
using System.Diagnostics; | |||
namespace BPASmartClient.DosingSystem.ViewModel | |||
{ | |||
public class RecipeControlViewModel : ObservableObject | |||
public class RecipeControlViewModel : NotifyBase | |||
{ | |||
ConcurrentQueue<string> RecipeNames = new ConcurrentQueue<string>(); | |||
static ConcurrentQueue<string> RecipeNames = new ConcurrentQueue<string>(); | |||
static ObservableCollection<StockStatusModel> StockStatus = new ObservableCollection<StockStatusModel>(); | |||
public RecipeControlViewModel() | |||
{ | |||
StartCommand = new RelayCommand<object>((o) => | |||
StartCommand = new RelayCommand<object>(RecipeIssued); | |||
ChangeRecipeStateCommand = new RelayCommand<object>(ChangeRecipeState); | |||
RecipeRun(); | |||
RecipeStatusInquire(); | |||
} | |||
/// <summary> | |||
/// 配方下发 | |||
/// </summary> | |||
private void RecipeIssued(object o) | |||
{ | |||
if (o != null && o is string deviceName) | |||
{ | |||
if (o != null && o is string deviceName) | |||
int index = Array.FindIndex(Recipes.ToArray(), p => p.RecipeName == deviceName); | |||
if (index >= 0 && index < Recipes.Count) | |||
{ | |||
int index = Array.FindIndex(Recipes.ToArray(), p => p.RecipeName == deviceName); | |||
if (index >= 0 && index < Recipes.Count) | |||
for (int i = 0; i < Recipes.ElementAt(index).RawMaterials.Count; i++) | |||
{ | |||
for (int i = 0; i < Recipes.ElementAt(index).RawMaterials.Count; i++) | |||
if (Recipes.ElementAt(index).RawMaterials.ElementAt(i).RawMaterialSource == 1) | |||
{ | |||
if (Recipes.ElementAt(index).RawMaterials.ElementAt(i).RawMaterialSource == 1) | |||
{ | |||
string ip = Recipes.ElementAt(index).RawMaterials.ElementAt(i).DeviceIp; | |||
var device = DeviceInquire.GetInstance.GetDevice(ip); | |||
if (!device.IsConnected) | |||
{ | |||
MessageNotify.GetInstance.ShowDialog($"设备 【{device.DeviceName}】 未连接,不允许下发此配方", DialogType.Error); | |||
return; | |||
} | |||
} | |||
string ip = Recipes.ElementAt(index).RawMaterials.ElementAt(i).DeviceIp; | |||
var device = DeviceInquire.GetInstance.GetDevice(ip); | |||
//if (!device.IsConnected) | |||
//{ | |||
// MessageNotify.GetInstance.ShowDialog($"设备 【{device.DeviceName}】 未连接,不允许下发此配方", DialogType.Error); | |||
// return; | |||
//} | |||
} | |||
Recipes.ElementAt(index).IsEnable = false; | |||
} | |||
MessageNotify.GetInstance.ShowUserLog($"下发工单 {Recipes.ElementAt(index).RecipeName}"); | |||
RecipeNames.Enqueue(deviceName); | |||
var res = Recipes.FirstOrDefault(p => p.RecipeName == deviceName); | |||
UserTreeWait.Add(new RecipeModel { RecipeName = deviceName, RawMaterials = res.RawMaterials }); | |||
Recipes.ElementAt(index).IsEnable = false; | |||
Json<LocaPar>.Data.Recipes.ElementAt(index).IsEnable = false; | |||
} | |||
MessageNotify.GetInstance.ShowUserLog($"下发工单 {Recipes.ElementAt(index).RecipeName}"); | |||
RecipeNames.Enqueue(deviceName); | |||
var t = RecipeNames.GetHashCode(); | |||
var res = Recipes.FirstOrDefault(p => p.RecipeName == deviceName); | |||
UserTreeWait.Add(new RecipeModel { SerialNum = UserTreeWait.Count + 1, RecipeName = deviceName, RawMaterials = res.RawMaterials }); | |||
} | |||
NoticeDemoViewModel.OpenMsg(EnumPromptType.Success, App.MainWindow, "提示", $"配方下发成功!"); | |||
MessageNotify.GetInstance.ShowUserLog($"下发工单 {Guid.NewGuid().ToString()}"); | |||
} | |||
NoticeDemoViewModel.OpenMsg(EnumPromptType.Success, App.MainWindow, "提示", $"配方下发成功!"); | |||
MessageNotify.GetInstance.ShowUserLog($"下发工单 {Guid.NewGuid().ToString()}"); | |||
}); | |||
ChangeRecipeStateCommand = new RelayCommand<object>(ChangeRecipeState); | |||
/// <summary> | |||
/// 配方业务执行 | |||
/// </summary> | |||
private void RecipeRun() | |||
{ | |||
ThreadManage.GetInstance().StartLong(new Action(() => | |||
{ | |||
if (RecipeNames.Count > 0) | |||
@@ -68,6 +79,7 @@ namespace BPASmartClient.DosingSystem.ViewModel | |||
{ | |||
Recipes.ElementAt(index).Are.Reset(); | |||
Recipes.ElementAt(index).IsEnable = false; | |||
StockStatus.Clear(); | |||
App.Current.Dispatcher.Invoke(new Action(() => | |||
{ | |||
recipeProcesses.Clear(); | |||
@@ -75,27 +87,64 @@ namespace BPASmartClient.DosingSystem.ViewModel | |||
})); | |||
CurrentRecipeName = Recipes.ElementAt(index).RecipeName; | |||
#region 配方下发到PLC操作相关 | |||
//配方数据写入到输送机 | |||
//SiemensDevice.GetInstance.MySiemens.WriteClass | |||
foreach (var item in Recipes.ElementAt(index).RawMaterials) | |||
var res = Json<LocaPar>.Data.Recipes.FirstOrDefault(p => p.RecipeName == CurrentRecipeName); | |||
List<int> recipeData = new List<int>(); | |||
if (res != null) | |||
{ | |||
//DeviceInquire.GetInstance.GetDevice(item.DeviceIp)?.Start(item.RawMaterialWeight);//启动并写入每个原料重量 | |||
//var res = DeviceInquire.GetInstance.GetDevice(item.DeviceIp).deviceStatus.DeviceNum; | |||
App.Current.Dispatcher.Invoke(new Action(() => | |||
var tInfo = res.RawMaterials.GroupBy(p => p.Loc);//获取桶号信息 | |||
if (tInfo != null) | |||
{ | |||
recipeProcesses.Add(new RawMaterialModel() | |||
for (int i = 0; i < tInfo.Count(); i++) | |||
{ | |||
RawMaterialName = item.RawMaterialName, | |||
RecipeStatus = item.RecipeStatus, | |||
RawMaterialSource = item.RawMaterialSource, | |||
RawMaterialId = item.RawMaterialId, | |||
}); | |||
})); | |||
int data = 0; | |||
for (int m = 0; m < tInfo.ElementAt(i).Count(); m++) | |||
{ | |||
var TempName = tInfo.ElementAt(i).ElementAt(m).RawMaterialName; | |||
var tempDevice = DeviceInquire.GetInstance.devices.FirstOrDefault(p => p.DeviceName == TempName); | |||
if (tempDevice != null) | |||
{ | |||
data = data.SetBitValue((byte)tempDevice.DeviceNum, true); | |||
} | |||
} | |||
recipeData.Add(data); | |||
} | |||
} | |||
} | |||
if (recipeData.Count <= 0) | |||
{ | |||
MessageNotify.GetInstance.ShowRunLog("配方数据解析失败"); | |||
return; | |||
} | |||
int offset = 2; | |||
//写入配方数据 | |||
MessageNotify.GetInstance.ShowRunLog("开始写入配方数据"); | |||
recipeData.ForEach(item => | |||
{ | |||
SiemensDevice.GetInstance.MySiemens.Write($"DB4.DBD{offset}", item); | |||
offset = offset += 4; | |||
}); | |||
SiemensDevice.GetInstance.MySiemens.Write("DB4.DBD198", recipeData.Count);//配方使用桶数写入 | |||
SiemensDevice.GetInstance.MySiemens.Write("DB4.DBX0.1", true);//配方执行启动 | |||
Stopwatch sw = new Stopwatch(); | |||
App.Current.Dispatcher.Invoke(() => { recipeProcesses.Add(Recipes.ElementAt(index)); }); | |||
sw.Restart(); | |||
while (true) | |||
{ | |||
if (sw.ElapsedMilliseconds >= 3000 && !GlobalDevice.PlcData.ResComplete) | |||
{ | |||
MessageNotify.GetInstance.ShowRunLog("获取配方下发反馈超时"); | |||
break; | |||
} | |||
if (GlobalDevice.PlcData.ResComplete) | |||
{ | |||
SiemensDevice.GetInstance.MySiemens.Write("DB3.DBX0.1", false); | |||
break; | |||
} | |||
Thread.Sleep(100); | |||
} | |||
#endregion | |||
Recipes.ElementAt(index).Are.WaitOne();//阻塞,直到当前配方完成 | |||
RecipeNames.TryDequeue(out string deviceName); | |||
@@ -113,8 +162,13 @@ namespace BPASmartClient.DosingSystem.ViewModel | |||
} | |||
Thread.Sleep(100); | |||
}), "启动配方下发"); | |||
} | |||
/// <summary> | |||
/// 配方执行状态监听 | |||
/// </summary> | |||
private void RecipeStatusInquire() | |||
{ | |||
ThreadManage.GetInstance().StartLong(new Action(() => | |||
{ | |||
for (int i = 0; i < Recipes.Count; i++) | |||
@@ -122,66 +176,76 @@ namespace BPASmartClient.DosingSystem.ViewModel | |||
for (int m = 0; m < Recipes.ElementAt(i).RawMaterials.Count; m++) | |||
{ | |||
var RunStatus = DeviceInquire.GetInstance.GetDevice(Recipes.ElementAt(i).RawMaterials.ElementAt(m).DeviceIp).deviceStatus.RunStatus; | |||
//设备状态显示 | |||
if (Recipes.ElementAt(i).RecipeName == CurrentRecipeName) | |||
{ | |||
string deviceName = DeviceInquire.GetInstance.GetDevice(Recipes.ElementAt(i).RawMaterials.ElementAt(m).DeviceIp).DeviceName; | |||
int index = Array.FindIndex(Recipes.ElementAt(i).RawMaterials.ToArray(), p => p.RawMaterialName == deviceName); | |||
if (index >= 0 && index < recipeProcesses.Count) | |||
{ | |||
App.Current.Dispatcher.Invoke(new Action(() => { recipeProcesses.ElementAt(index).RecipeStatus = RunStatus; })); | |||
} | |||
} | |||
var proc = recipeProcesses.Where(p => p.RecipeStatus == 3).ToList(); | |||
if (proc != null && proc.Count > 0 && proc.Count == recipeProcesses.Count) | |||
{ | |||
int recipIndex = Array.FindIndex(Recipes.ToArray(), p => p.RecipeName == CurrentRecipeName); | |||
if (recipIndex >= 0 && recipIndex < Recipes.Count) | |||
string tempRawMaterialName = DeviceInquire.GetInstance.GetDevice(Recipes.ElementAt(i).RawMaterials.ElementAt(m).DeviceIp).DeviceName; | |||
int recIndex = recipeProcesses.ToList().FindIndex(p => p.RecipeName == CurrentRecipeName); | |||
if (recIndex >= 0 && recIndex < recipeProcesses.Count) | |||
{ | |||
for (int n = 0; n < recipeProcesses.Count; n++) | |||
int index = recipeProcesses.ElementAt(recIndex).RawMaterials.ToList().FindIndex(p => p.RawMaterialName == tempRawMaterialName); | |||
if (index >= 0 && index < recipeProcesses.ElementAt(recIndex).RawMaterials.Count) | |||
{ | |||
DeviceInquire.GetInstance.GetDevice(Recipes.ElementAt(recipIndex).RawMaterials.ElementAt(n).DeviceIp).StatusReset();//完成配料的设备运行状态地址写0 | |||
MessageNotify.GetInstance.ShowRunLog(Recipes.ElementAt(recipIndex).RawMaterials.ElementAt(n).DeviceIp); | |||
//recipeProcesses.ElementAt(recIndex).RawMaterials.ElementAt(index).RecipeStatus = RunStatus; | |||
} | |||
App.Current.Dispatcher.Invoke(new Action(() => { recipeProcesses.Clear(); })); | |||
Recipes.ElementAt(recipIndex).IsEnable = true; | |||
Recipes.ElementAt(recipIndex).Are.Set(); | |||
for (int j = 0; j < GlobalDevice.PlcData.IsAllowIngredients.Length; j++) | |||
{ | |||
if (GlobalDevice.PlcData.IsAllowIngredients[j]) | |||
{ | |||
int cnt = j + 1;//获取允许配料信号桶号的料仓位置 | |||
float weight = Recipes.ElementAt(i).RawMaterials.ElementAt(Array.FindIndex(Recipes.ElementAt(i).RawMaterials.ToArray(), p => p.Loc == cnt)).RawMaterialWeight; | |||
string deviceName = DeviceInquire.GetInstance.devices.ElementAt(Array.FindIndex(DeviceInquire.GetInstance.devices.ToArray(), p => p.DeviceNum == cnt)).DeviceName; | |||
int loc = Array.FindIndex(Recipes.ElementAt(i).RawMaterials.ToArray(), p => p.RawMaterialName == deviceName); | |||
if (cnt > 0 && loc >= 0 && deviceName != null && weight >= 0) | |||
{ | |||
int St_index = Array.FindIndex(StockStatus.ToArray(), p => p.MaterialName == deviceName); | |||
if (St_index < 0) | |||
{ | |||
StockStatus.Add(new StockStatusModel() | |||
{ | |||
MaterialName = deviceName, | |||
IssueWeight = weight, | |||
IssueStatus = 0, | |||
}); | |||
} | |||
St_index = Array.FindIndex(StockStatus.ToArray(), p => p.MaterialName == deviceName); | |||
if (St_index >= 0) | |||
{ | |||
if (recipeProcesses.ElementAt(recIndex).RawMaterials.ElementAt(loc).RecipeStatus == 1 && StockStatus.ElementAt(St_index).IssueStatus == 0) | |||
{ | |||
StockStatus.ElementAt(St_index).IssueStatus = 1; | |||
DeviceInquire.GetInstance.GetDevice(Recipes.ElementAt(i).RawMaterials.ElementAt(loc).DeviceIp).Start(weight); | |||
MessageNotify.GetInstance.ShowRunLog($"柔性味魔方{Recipes.ElementAt(i).RawMaterials.ElementAt(loc).DeviceIp},开始出料"); | |||
} | |||
if (recipeProcesses.ElementAt(recIndex).RawMaterials.ElementAt(loc).RecipeStatus == 3 && StockStatus.ElementAt(St_index).IssueStatus == 1) | |||
{ | |||
StockStatus.ElementAt(St_index).IssueStatus = 2; | |||
DeviceInquire.GetInstance.GetDevice(Recipes.ElementAt(i).RawMaterials.ElementAt(loc).DeviceIp).StatusReset(); | |||
SiemensDevice.GetInstance.MySiemens.Write("DB4.DBD130", 0.SetBitValue((byte)loc, true)); | |||
MessageNotify.GetInstance.ShowRunLog($"柔性味魔方{Recipes.ElementAt(i).RawMaterials.ElementAt(loc).DeviceIp},出料完成,状态复位"); | |||
} | |||
} | |||
} | |||
} | |||
} | |||
int Finish_Count = StockStatus.Where(s => s.IssueStatus == 2).Count(); | |||
if (StockStatus.Count >= Recipes.ElementAt(i).RawMaterials.Count && Finish_Count >= Recipes.ElementAt(i).RawMaterials.Count) //配方配料完成 | |||
{ | |||
StockStatus.Clear(); | |||
SiemensDevice.GetInstance.MySiemens.Write("DB4.DBX202.1", true);//配方使用桶数写入 | |||
int recipIndex = Array.FindIndex(Recipes.ToArray(), p => p.RecipeName == CurrentRecipeName); | |||
App.Current.Dispatcher.Invoke(new Action(() => { recipeProcesses.Clear(); })); | |||
Recipes.ElementAt(recipIndex).IsEnable = true; | |||
Json<LocaPar>.Data.Recipes.ElementAt(recipIndex).IsEnable = true; | |||
Recipes.ElementAt(recipIndex).Are.Set(); | |||
} | |||
} | |||
} | |||
//Recipes.ElementAt(i).RawMaterials.ElementAt(m).RecipeStatus = RunStatus; | |||
//var res = Recipes.ElementAt(i).RawMaterials.Where(p => p.RecipeStatus == 3).ToList(); | |||
//if (res != null && res.Count == Recipes.ElementAt(i).RawMaterials.Count)//配方所有配料完成下料 | |||
//{ | |||
// for (int r = 0; r < Recipes.ElementAt(i).RawMaterials.Count; r++) | |||
// { | |||
// DeviceInquire.GetInstance.GetDevice(Recipes.ElementAt(i).RawMaterials.ElementAt(r).DeviceIp).StatusReset();//完成配料的设备运行状态地址写0 | |||
// App.Current.Dispatcher.Invoke(new Action(() => { recipeProcesses.Clear(); })); | |||
// } | |||
// Recipes.ElementAt(i).IsEnable = true; | |||
// Recipes.ElementAt(i).Are.Set(); | |||
//} | |||
} | |||
} | |||
Thread.Sleep(100); | |||
}), "RecipeControlViewModelStatusInquire"); | |||
//测试数据 | |||
/* RawMaterialModel rawMaterial_1 = new RawMaterialModel { RawMaterialName = "香料_1" }; | |||
RawMaterialModel rawMaterial_2 = new RawMaterialModel { RawMaterialName = "香料_2" }; | |||
RawMaterialModel rawMaterial_3 = new RawMaterialModel { RawMaterialName = "香料_3" }; | |||
RawMaterialModel rawMaterial_4 = new RawMaterialModel { RawMaterialName = "香料_4" }; | |||
ObservableCollection<RawMaterialModel> rawMaterials = new ObservableCollection<RawMaterialModel> { rawMaterial_1, rawMaterial_2, rawMaterial_3, rawMaterial_4 }; | |||
UserTreeCompelete.Add(new RecipeModel { RecipeName = "完成的香料1", RawMaterials = rawMaterials }); | |||
UserTreeCompelete.Add(new RecipeModel { RecipeName = "完成的香料2", RawMaterials = rawMaterials });*/ | |||
} | |||
public RelayCommand<object> StartCommand { get; set; } | |||
@@ -190,18 +254,19 @@ namespace BPASmartClient.DosingSystem.ViewModel | |||
public static ObservableCollection<RecipeModel> Recipes { get; set; } = Json<LocaPar>.Data.Recipes; | |||
public string CurrentRecipeName { get { return _RecipeName; } set { _RecipeName = value; OnPropertyChanged(); } } | |||
public static string CurrentRecipeName { get { return _RecipeName; } set { _RecipeName = value; OnStaticPropertyChanged(); } } | |||
private static string _RecipeName; | |||
/// <summary> | |||
/// 当前正在制作的配方 | |||
/// </summary> | |||
public static ObservableCollection<RecipeModel> recipeProcesses { get; set; } = new ObservableCollection<RecipeModel>(); | |||
public static ObservableCollection<RawMaterialModel> recipeProcesses { get; set; } = new ObservableCollection<RawMaterialModel>(); | |||
/// <summary> | |||
/// 等待制作的配方 | |||
/// </summary> | |||
public static ObservableCollection<RecipeModel> UserTreeWait { get; set; } = new ObservableCollection<RecipeModel>(); | |||
/// <summary> | |||
/// 已完成的配方 | |||
/// </summary> | |||
@@ -213,16 +278,20 @@ namespace BPASmartClient.DosingSystem.ViewModel | |||
if (o == null) return; | |||
if (o is string id) | |||
{ | |||
var res = recipeProcesses.FirstOrDefault(p => p.RawMaterialId == id); | |||
if (res != null) | |||
var Recipe = recipeProcesses.FirstOrDefault(p => p.RecipeName == CurrentRecipeName); | |||
if (Recipe != null) | |||
{ | |||
if (res.RecipeStatus == 3) | |||
{ | |||
res.RecipeStatus = 1; | |||
} | |||
else | |||
var res = Recipe.RawMaterials.FirstOrDefault(p => p.RawMaterialId == id); | |||
if (res != null) | |||
{ | |||
res.RecipeStatus = 3; | |||
if (res.RecipeStatus == 3) | |||
{ | |||
res.RecipeStatus = 1; | |||
} | |||
else | |||
{ | |||
res.RecipeStatus = 3; | |||
} | |||
} | |||
} | |||
} | |||
@@ -3,12 +3,12 @@ using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
using Microsoft.Toolkit.Mvvm.ComponentModel; | |||
using BPA.Helper; | |||
using System.Collections.Concurrent; | |||
using System.Collections.ObjectModel; | |||
using System.Windows; | |||
using BPA.Helper; | |||
using Microsoft.Toolkit.Mvvm.Input; | |||
using BPASmartClient.DosingSystem.View; | |||
using BPASmartClient.CustomResource.UserControls; | |||
using BPASmartClient.CustomResource.UserControls.Model; | |||
@@ -20,7 +20,7 @@ using BPASmartClient.Model; | |||
namespace BPASmartClient.DosingSystem.ViewModel | |||
{ | |||
public class RecipeSettingsViewModel : ObservableObject | |||
public class RecipeSettingsViewModel : NotifyBase | |||
{ | |||
public RecipeSettingsViewModel() | |||
{ | |||
@@ -50,10 +50,17 @@ namespace BPASmartClient.DosingSystem.ViewModel | |||
if (MessageNotify.GetInstance.ShowDialog($"是否删除【{o.ToString()}】配方,删除后数据将永久丢失!无法找回", DialogType.Warning)) | |||
{ | |||
var res = Json<LocaPar>.Data.Recipes.FirstOrDefault(p => p.RecipeName == o.ToString()); | |||
if (res != null) Json<LocaPar>.Data.Recipes.Remove(res); | |||
Json<LocaPar>.Save(); | |||
NoticeDemoViewModel.OpenMsg(EnumPromptType.Success, App.MainWindow, "提示", $"配方删除成功!"); | |||
MessageNotify.GetInstance.ShowUserLog($"删除配方 {res.RecipeName}"); | |||
if (res.IsEnable) | |||
{ | |||
if (res != null) Json<LocaPar>.Data.Recipes.Remove(res); | |||
Json<LocaPar>.Save(); | |||
NoticeDemoViewModel.OpenMsg(EnumPromptType.Success, App.MainWindow, "提示", $"配方删除成功!"); | |||
MessageNotify.GetInstance.ShowUserLog($"删除配方 {res.RecipeName}"); | |||
} | |||
else | |||
{ | |||
NoticeDemoViewModel.OpenMsg(EnumPromptType.Error, App.MainWindow, "提示", $"删除【{o.ToString()}】配方失败,配方正在使用!"); | |||
} | |||
} | |||
} | |||
}); | |||
@@ -65,9 +72,16 @@ namespace BPASmartClient.DosingSystem.ViewModel | |||
var res = Json<LocaPar>.Data.Recipes.FirstOrDefault(p => p.RecipeName == o.ToString()); | |||
if (res != null) | |||
{ | |||
NewRecipeView nrv = new NewRecipeView(); | |||
ActionManage.GetInstance.Send("Details", res); | |||
nrv.ShowDialog(); | |||
if (res.IsEnable) | |||
{ | |||
NewRecipeView nrv = new NewRecipeView(); | |||
ActionManage.GetInstance.Send("Details", res); | |||
nrv.ShowDialog(); | |||
} | |||
else | |||
{ | |||
NoticeDemoViewModel.OpenMsg(EnumPromptType.Error, App.MainWindow, "提示", $"编辑【{o.ToString()}】配方失败,配方正在使用!"); | |||
} | |||
} | |||
//MessageLog.GetInstance.ShowUserLog($"编辑配方名称——{res.RecipeName}"); | |||
} | |||
@@ -5,12 +5,12 @@ using System.Collections.ObjectModel; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
using Microsoft.Toolkit.Mvvm.ComponentModel; | |||
using Microsoft.Toolkit.Mvvm.Input; | |||
using BPA.Helper; | |||
namespace BPASmartClient.DosingSystem.ViewModel | |||
{ | |||
public class StockControViewModel : ObservableObject | |||
public class StockControViewModel : NotifyBase | |||
{ | |||
public StockControViewModel() | |||
{ | |||
@@ -158,10 +158,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BeDesignerSCADA", "BeDesign | |||
EndProject | |||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BPASmart.RecipeManagement", "BPASmart.RecipeManagement\BPASmart.RecipeManagement.csproj", "{28EBFC11-184A-4B88-A7B3-84F3FD768520}" | |||
EndProject | |||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PermissionManagement", "PermissionManagement\PermissionManagement.csproj", "{BE6E7BC1-F250-4D11-8051-1B0F93AD2401}" | |||
EndProject | |||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BPASmart.SmallBatchingSystem", "BPASmart.SmallBatchingSystem\BPASmart.SmallBatchingSystem.csproj", "{DB6DC970-859C-4C63-AE9B-BA415D56CECD}" | |||
EndProject | |||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BPASmart.ConfigurationSoftware", "BPASmart.ConfigurationSoftware\BPASmart.ConfigurationSoftware.csproj", "{897F8379-3301-4CBE-9BCA-AF7FD2F963A9}" | |||
EndProject | |||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BPASmart.UserManagement", "BPASmart.UserManagement\BPASmart.UserManagement.csproj", "{06F30619-AD37-4CA0-838F-0431867E0932}" | |||
@@ -174,8 +170,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BPASmartClient.SmallBatchin | |||
EndProject | |||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BPASmartClient.MorkMOC", "BPASmartClient.MorkMOC\BPASmartClient.MorkMOC.csproj", "{D5081D7B-3EBB-42C7-8FB9-A889870D08C2}" | |||
EndProject | |||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BPASmartClient.DosingHKProject", "BPASmartClient.DosingProject\BPASmartClient.DosingHKProject.csproj", "{6763F73A-555C-41E2-91F7-ADF26C59A946}" | |||
EndProject | |||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BPASmart.MenuLoad", "BPASmart.MenuLoad\BPASmart.MenuLoad.csproj", "{7A7547D3-F2EF-4DA4-AD45-D1B49210082B}" | |||
EndProject | |||
Global | |||
@@ -1492,46 +1486,6 @@ Global | |||
{28EBFC11-184A-4B88-A7B3-84F3FD768520}.Release|x64.Build.0 = Release|Any CPU | |||
{28EBFC11-184A-4B88-A7B3-84F3FD768520}.Release|x86.ActiveCfg = Release|Any CPU | |||
{28EBFC11-184A-4B88-A7B3-84F3FD768520}.Release|x86.Build.0 = Release|Any CPU | |||
{BE6E7BC1-F250-4D11-8051-1B0F93AD2401}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | |||
{BE6E7BC1-F250-4D11-8051-1B0F93AD2401}.Debug|Any CPU.Build.0 = Debug|Any CPU | |||
{BE6E7BC1-F250-4D11-8051-1B0F93AD2401}.Debug|ARM.ActiveCfg = Debug|Any CPU | |||
{BE6E7BC1-F250-4D11-8051-1B0F93AD2401}.Debug|ARM.Build.0 = Debug|Any CPU | |||
{BE6E7BC1-F250-4D11-8051-1B0F93AD2401}.Debug|ARM64.ActiveCfg = Debug|Any CPU | |||
{BE6E7BC1-F250-4D11-8051-1B0F93AD2401}.Debug|ARM64.Build.0 = Debug|Any CPU | |||
{BE6E7BC1-F250-4D11-8051-1B0F93AD2401}.Debug|x64.ActiveCfg = Debug|Any CPU | |||
{BE6E7BC1-F250-4D11-8051-1B0F93AD2401}.Debug|x64.Build.0 = Debug|Any CPU | |||
{BE6E7BC1-F250-4D11-8051-1B0F93AD2401}.Debug|x86.ActiveCfg = Debug|Any CPU | |||
{BE6E7BC1-F250-4D11-8051-1B0F93AD2401}.Debug|x86.Build.0 = Debug|Any CPU | |||
{BE6E7BC1-F250-4D11-8051-1B0F93AD2401}.Release|Any CPU.ActiveCfg = Release|Any CPU | |||
{BE6E7BC1-F250-4D11-8051-1B0F93AD2401}.Release|Any CPU.Build.0 = Release|Any CPU | |||
{BE6E7BC1-F250-4D11-8051-1B0F93AD2401}.Release|ARM.ActiveCfg = Release|Any CPU | |||
{BE6E7BC1-F250-4D11-8051-1B0F93AD2401}.Release|ARM.Build.0 = Release|Any CPU | |||
{BE6E7BC1-F250-4D11-8051-1B0F93AD2401}.Release|ARM64.ActiveCfg = Release|Any CPU | |||
{BE6E7BC1-F250-4D11-8051-1B0F93AD2401}.Release|ARM64.Build.0 = Release|Any CPU | |||
{BE6E7BC1-F250-4D11-8051-1B0F93AD2401}.Release|x64.ActiveCfg = Release|Any CPU | |||
{BE6E7BC1-F250-4D11-8051-1B0F93AD2401}.Release|x64.Build.0 = Release|Any CPU | |||
{BE6E7BC1-F250-4D11-8051-1B0F93AD2401}.Release|x86.ActiveCfg = Release|Any CPU | |||
{BE6E7BC1-F250-4D11-8051-1B0F93AD2401}.Release|x86.Build.0 = Release|Any CPU | |||
{DB6DC970-859C-4C63-AE9B-BA415D56CECD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | |||
{DB6DC970-859C-4C63-AE9B-BA415D56CECD}.Debug|Any CPU.Build.0 = Debug|Any CPU | |||
{DB6DC970-859C-4C63-AE9B-BA415D56CECD}.Debug|ARM.ActiveCfg = Debug|Any CPU | |||
{DB6DC970-859C-4C63-AE9B-BA415D56CECD}.Debug|ARM.Build.0 = Debug|Any CPU | |||
{DB6DC970-859C-4C63-AE9B-BA415D56CECD}.Debug|ARM64.ActiveCfg = Debug|Any CPU | |||
{DB6DC970-859C-4C63-AE9B-BA415D56CECD}.Debug|ARM64.Build.0 = Debug|Any CPU | |||
{DB6DC970-859C-4C63-AE9B-BA415D56CECD}.Debug|x64.ActiveCfg = Debug|Any CPU | |||
{DB6DC970-859C-4C63-AE9B-BA415D56CECD}.Debug|x64.Build.0 = Debug|Any CPU | |||
{DB6DC970-859C-4C63-AE9B-BA415D56CECD}.Debug|x86.ActiveCfg = Debug|Any CPU | |||
{DB6DC970-859C-4C63-AE9B-BA415D56CECD}.Debug|x86.Build.0 = Debug|Any CPU | |||
{DB6DC970-859C-4C63-AE9B-BA415D56CECD}.Release|Any CPU.ActiveCfg = Release|Any CPU | |||
{DB6DC970-859C-4C63-AE9B-BA415D56CECD}.Release|Any CPU.Build.0 = Release|Any CPU | |||
{DB6DC970-859C-4C63-AE9B-BA415D56CECD}.Release|ARM.ActiveCfg = Release|Any CPU | |||
{DB6DC970-859C-4C63-AE9B-BA415D56CECD}.Release|ARM.Build.0 = Release|Any CPU | |||
{DB6DC970-859C-4C63-AE9B-BA415D56CECD}.Release|ARM64.ActiveCfg = Release|Any CPU | |||
{DB6DC970-859C-4C63-AE9B-BA415D56CECD}.Release|ARM64.Build.0 = Release|Any CPU | |||
{DB6DC970-859C-4C63-AE9B-BA415D56CECD}.Release|x64.ActiveCfg = Release|Any CPU | |||
{DB6DC970-859C-4C63-AE9B-BA415D56CECD}.Release|x64.Build.0 = Release|Any CPU | |||
{DB6DC970-859C-4C63-AE9B-BA415D56CECD}.Release|x86.ActiveCfg = Release|Any CPU | |||
{DB6DC970-859C-4C63-AE9B-BA415D56CECD}.Release|x86.Build.0 = Release|Any CPU | |||
{897F8379-3301-4CBE-9BCA-AF7FD2F963A9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | |||
{897F8379-3301-4CBE-9BCA-AF7FD2F963A9}.Debug|Any CPU.Build.0 = Debug|Any CPU | |||
{897F8379-3301-4CBE-9BCA-AF7FD2F963A9}.Debug|ARM.ActiveCfg = Debug|Any CPU | |||
@@ -1652,26 +1606,6 @@ Global | |||
{D5081D7B-3EBB-42C7-8FB9-A889870D08C2}.Release|x64.Build.0 = Release|Any CPU | |||
{D5081D7B-3EBB-42C7-8FB9-A889870D08C2}.Release|x86.ActiveCfg = Release|Any CPU | |||
{D5081D7B-3EBB-42C7-8FB9-A889870D08C2}.Release|x86.Build.0 = Release|Any CPU | |||
{6763F73A-555C-41E2-91F7-ADF26C59A946}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | |||
{6763F73A-555C-41E2-91F7-ADF26C59A946}.Debug|Any CPU.Build.0 = Debug|Any CPU | |||
{6763F73A-555C-41E2-91F7-ADF26C59A946}.Debug|ARM.ActiveCfg = Debug|Any CPU | |||
{6763F73A-555C-41E2-91F7-ADF26C59A946}.Debug|ARM.Build.0 = Debug|Any CPU | |||
{6763F73A-555C-41E2-91F7-ADF26C59A946}.Debug|ARM64.ActiveCfg = Debug|Any CPU | |||
{6763F73A-555C-41E2-91F7-ADF26C59A946}.Debug|ARM64.Build.0 = Debug|Any CPU | |||
{6763F73A-555C-41E2-91F7-ADF26C59A946}.Debug|x64.ActiveCfg = Debug|Any CPU | |||
{6763F73A-555C-41E2-91F7-ADF26C59A946}.Debug|x64.Build.0 = Debug|Any CPU | |||
{6763F73A-555C-41E2-91F7-ADF26C59A946}.Debug|x86.ActiveCfg = Debug|Any CPU | |||
{6763F73A-555C-41E2-91F7-ADF26C59A946}.Debug|x86.Build.0 = Debug|Any CPU | |||
{6763F73A-555C-41E2-91F7-ADF26C59A946}.Release|Any CPU.ActiveCfg = Release|Any CPU | |||
{6763F73A-555C-41E2-91F7-ADF26C59A946}.Release|Any CPU.Build.0 = Release|Any CPU | |||
{6763F73A-555C-41E2-91F7-ADF26C59A946}.Release|ARM.ActiveCfg = Release|Any CPU | |||
{6763F73A-555C-41E2-91F7-ADF26C59A946}.Release|ARM.Build.0 = Release|Any CPU | |||
{6763F73A-555C-41E2-91F7-ADF26C59A946}.Release|ARM64.ActiveCfg = Release|Any CPU | |||
{6763F73A-555C-41E2-91F7-ADF26C59A946}.Release|ARM64.Build.0 = Release|Any CPU | |||
{6763F73A-555C-41E2-91F7-ADF26C59A946}.Release|x64.ActiveCfg = Release|Any CPU | |||
{6763F73A-555C-41E2-91F7-ADF26C59A946}.Release|x64.Build.0 = Release|Any CPU | |||
{6763F73A-555C-41E2-91F7-ADF26C59A946}.Release|x86.ActiveCfg = Release|Any CPU | |||
{6763F73A-555C-41E2-91F7-ADF26C59A946}.Release|x86.Build.0 = Release|Any CPU | |||
{7A7547D3-F2EF-4DA4-AD45-D1B49210082B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | |||
{7A7547D3-F2EF-4DA4-AD45-D1B49210082B}.Debug|Any CPU.Build.0 = Debug|Any CPU | |||
{7A7547D3-F2EF-4DA4-AD45-D1B49210082B}.Debug|ARM.ActiveCfg = Debug|Any CPU | |||
@@ -1764,15 +1698,12 @@ Global | |||
{06F0B369-0483-46DD-82D2-70431FB505C1} = {7B0175AD-BB74-4A98-B9A7-1E289032485E} | |||
{DF8B4C38-39DE-4220-AB60-885CAE6D1E47} = {06F0B369-0483-46DD-82D2-70431FB505C1} | |||
{28EBFC11-184A-4B88-A7B3-84F3FD768520} = {CDC1E762-5E1D-4AE1-9DF2-B85761539086} | |||
{BE6E7BC1-F250-4D11-8051-1B0F93AD2401} = {CDC1E762-5E1D-4AE1-9DF2-B85761539086} | |||
{DB6DC970-859C-4C63-AE9B-BA415D56CECD} = {CDC1E762-5E1D-4AE1-9DF2-B85761539086} | |||
{897F8379-3301-4CBE-9BCA-AF7FD2F963A9} = {CDC1E762-5E1D-4AE1-9DF2-B85761539086} | |||
{06F30619-AD37-4CA0-838F-0431867E0932} = {CDC1E762-5E1D-4AE1-9DF2-B85761539086} | |||
{2DB084E8-B951-4D71-A203-FD0902EBA2C6} = {CDC1E762-5E1D-4AE1-9DF2-B85761539086} | |||
{E7CC45BF-7393-4BA7-A9AD-B1A1F5B265F3} = {CDC1E762-5E1D-4AE1-9DF2-B85761539086} | |||
{BA588F22-87FB-4124-AF62-CA8DC492ED7D} = {8712125E-14CD-4E1B-A1CE-4BDE03805942} | |||
{D5081D7B-3EBB-42C7-8FB9-A889870D08C2} = {9FB27073-61A0-4FE3-94DB-5FDDE062332F} | |||
{6763F73A-555C-41E2-91F7-ADF26C59A946} = {8712125E-14CD-4E1B-A1CE-4BDE03805942} | |||
{7A7547D3-F2EF-4DA4-AD45-D1B49210082B} = {06F0B369-0483-46DD-82D2-70431FB505C1} | |||
EndGlobalSection | |||
GlobalSection(ExtensibilityGlobals) = postSolution | |||