From 227063648defb304c69ec25583e923b8d01d9a17 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E5=A6=82=E6=84=8F=20=E5=BD=AD?= <2417589739@qq.com>
Date: Sat, 8 Oct 2022 17:32:00 +0800
Subject: [PATCH] =?UTF-8?q?=E5=B0=8F=E9=85=8D=E6=96=99=E7=AB=99=E5=8A=9F?=
=?UTF-8?q?=E8=83=BD=E4=BC=98=E5=8C=96?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../Pages/View/MainView.xaml.cs | 4 +
.../Pages/View/RunLogView.xaml | 56 +---
.../Pages/ViewModel/MainViewModel.cs | 2 -
BPASmartClient.SmallBatchingSystem/App.xaml | 1 +
.../App.xaml.cs | 7 +-
.../BPASmartClient.SmallBatchingSystem.csproj | 8 +
.../Converter/ForegroundConverter.cs | 35 +++
.../Converter/StatusIconConverter.cs | 47 +++
.../Fonts/iconfont.ttf | Bin 0 -> 9412 bytes
.../Models/CommunicationPar.cs | 3 +-
.../Models/PlcDataModel.cs | 14 +
.../Models/RecipeStatus.cs | 25 ++
.../Models/Status.cs | 15 +
.../ResourcesStyle/ResourcesStyle.xaml | 133 ++++++++
.../Services/Control.cs | 99 ++++--
.../Services/PlcServer.cs | 15 +-
.../Services/SiloServer.cs | 221 --------------
.../ViewModels/GrindArenaceousViewModel.cs | 48 +++
.../ViewModels/RecipeControlViewModel.cs | 7 +-
.../Views/GrindArenaceousView.xaml | 153 ++++++++++
.../Views/GrindArenaceousView.xaml.cs | 29 ++
.../Views/NewOutletView.xaml | 84 -----
.../Views/NewRecipeView.xaml | 98 ------
.../Views/NewSiloView.xaml | 31 --
.../Views/OutletManagementView.xaml | 134 --------
.../Views/RecipeControlView.xaml | 287 +-----------------
.../Views/RecipeView.xaml | 134 --------
.../Views/SiloManagementView.xaml | 134 --------
BPASmartClient/App.config | 14 +-
29 files changed, 637 insertions(+), 1201 deletions(-)
create mode 100644 BPASmartClient.SmallBatchingSystem/Converter/ForegroundConverter.cs
create mode 100644 BPASmartClient.SmallBatchingSystem/Converter/StatusIconConverter.cs
create mode 100644 BPASmartClient.SmallBatchingSystem/Fonts/iconfont.ttf
create mode 100644 BPASmartClient.SmallBatchingSystem/Models/RecipeStatus.cs
create mode 100644 BPASmartClient.SmallBatchingSystem/Models/Status.cs
create mode 100644 BPASmartClient.SmallBatchingSystem/ResourcesStyle/ResourcesStyle.xaml
delete mode 100644 BPASmartClient.SmallBatchingSystem/Services/SiloServer.cs
create mode 100644 BPASmartClient.SmallBatchingSystem/ViewModels/GrindArenaceousViewModel.cs
create mode 100644 BPASmartClient.SmallBatchingSystem/Views/GrindArenaceousView.xaml
create mode 100644 BPASmartClient.SmallBatchingSystem/Views/GrindArenaceousView.xaml.cs
diff --git a/BPASmartClient.CustomResource/Pages/View/MainView.xaml.cs b/BPASmartClient.CustomResource/Pages/View/MainView.xaml.cs
index 3e516b5e..d6f8e0f2 100644
--- a/BPASmartClient.CustomResource/Pages/View/MainView.xaml.cs
+++ b/BPASmartClient.CustomResource/Pages/View/MainView.xaml.cs
@@ -20,6 +20,10 @@ namespace BPASmartClient.CustomResource.Pages.View
///
public partial class MainView : Window
{
+
+ public string TitleName { get { return _mTitleName; } set { _mTitleName = value; this.tbTitle.Text = value; } }
+ private string _mTitleName;
+
public MainView()
{
InitializeComponent();
diff --git a/BPASmartClient.CustomResource/Pages/View/RunLogView.xaml b/BPASmartClient.CustomResource/Pages/View/RunLogView.xaml
index 26192229..ef67919e 100644
--- a/BPASmartClient.CustomResource/Pages/View/RunLogView.xaml
+++ b/BPASmartClient.CustomResource/Pages/View/RunLogView.xaml
@@ -51,7 +51,7 @@
-
+
@@ -160,8 +160,8 @@
-
-
+
+
@@ -243,8 +243,8 @@
-
-
+
+
@@ -260,28 +260,11 @@
-
-
-
-
+
+
@@ -323,28 +306,11 @@
-
-
+
diff --git a/BPASmartClient.SmallBatchingSystem/App.xaml.cs b/BPASmartClient.SmallBatchingSystem/App.xaml.cs
index b0e2fc31..7a7d82a6 100644
--- a/BPASmartClient.SmallBatchingSystem/App.xaml.cs
+++ b/BPASmartClient.SmallBatchingSystem/App.xaml.cs
@@ -26,8 +26,9 @@ namespace BPASmartClient.SmallBatchingSystem
AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException;
MenuInit();
Control.GetInstance.Init();
- SiloServer siloServer = new SiloServer();
+ //SiloServer siloServer = new SiloServer();
MainView mv = new MainView();
+ mv.TitleName = "黑菠萝配料系统";
//LoginView lv = new LoginView();
//var res = lv.ShowDialog();
//if (res != null && res == true)
@@ -132,6 +133,7 @@ namespace BPASmartClient.SmallBatchingSystem
SubMenuName = "操作日志",
SubMenuPermission = new Permission[] { Permission.操作员, Permission.管理员, Permission.技术员 },
AssemblyName = "BPASmartClient.CustomResource",
+ SubMenuVisibility = Visibility.Visible,
ToggleWindowPath = "Pages.View.UserLogView"
});
@@ -140,6 +142,7 @@ namespace BPASmartClient.SmallBatchingSystem
SubMenuName = "运行日志",
SubMenuPermission = new Permission[] { Permission.操作员, Permission.管理员, Permission.技术员 },
AssemblyName = "BPASmartClient.CustomResource",
+ SubMenuVisibility = Visibility.Visible,
ToggleWindowPath = "Pages.View.RunLogView"
});
@@ -148,6 +151,7 @@ namespace BPASmartClient.SmallBatchingSystem
SubMenuName = "报警记录",
SubMenuPermission = new Permission[] { Permission.操作员, Permission.管理员, Permission.技术员 },
AssemblyName = "BPASmartClient.CustomResource",
+ SubMenuVisibility = Visibility.Visible,
ToggleWindowPath = "Pages.View.AlarmView"
});
@@ -156,6 +160,7 @@ namespace BPASmartClient.SmallBatchingSystem
SubMenuName = "调试日志",
SubMenuPermission = new Permission[] { Permission.操作员, Permission.管理员, Permission.技术员, Permission.技术员 },
AssemblyName = "BPASmartClient.CustomResource",
+ SubMenuVisibility = Visibility.Visible,
ToggleWindowPath = "Pages.View.DebugLogView"
});
diff --git a/BPASmartClient.SmallBatchingSystem/BPASmartClient.SmallBatchingSystem.csproj b/BPASmartClient.SmallBatchingSystem/BPASmartClient.SmallBatchingSystem.csproj
index 2c450236..4c0eab71 100644
--- a/BPASmartClient.SmallBatchingSystem/BPASmartClient.SmallBatchingSystem.csproj
+++ b/BPASmartClient.SmallBatchingSystem/BPASmartClient.SmallBatchingSystem.csproj
@@ -7,6 +7,10 @@
true
+
+
+
+
@@ -23,4 +27,8 @@
+
+
+
+
diff --git a/BPASmartClient.SmallBatchingSystem/Converter/ForegroundConverter.cs b/BPASmartClient.SmallBatchingSystem/Converter/ForegroundConverter.cs
new file mode 100644
index 00000000..e46f2e31
--- /dev/null
+++ b/BPASmartClient.SmallBatchingSystem/Converter/ForegroundConverter.cs
@@ -0,0 +1,35 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Data;
+using System.Windows.Data;
+using System.Globalization;
+using System.Windows.Media;
+
+namespace BPASmartClient.SmallBatchingSystem.Converter
+{
+ public class ForegroundConverter : IValueConverter
+ {
+ public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
+ {
+ SolidColorBrush returnValue = new SolidColorBrush(Color.FromArgb(255, 0, 204, 255));
+ if (value != null)
+ {
+ if (value.ToString() == "等待配料")
+ returnValue = new SolidColorBrush(Color.FromArgb(255, 236, 187, 17));//黄 FFECBB11
+ else if (value.ToString() == "正在配料")
+ returnValue = new SolidColorBrush(Color.FromArgb(255, 22, 219, 234));//篮 FF16DBEA
+ else if (value.ToString() == "配料完成")
+ returnValue = new SolidColorBrush(Color.FromArgb(255, 43, 208, 111));//绿 FF2BD06F
+ }
+ return returnValue;
+ }
+
+ public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
+ {
+ throw new NotImplementedException();
+ }
+ }
+}
diff --git a/BPASmartClient.SmallBatchingSystem/Converter/StatusIconConverter.cs b/BPASmartClient.SmallBatchingSystem/Converter/StatusIconConverter.cs
new file mode 100644
index 00000000..5fc73f3c
--- /dev/null
+++ b/BPASmartClient.SmallBatchingSystem/Converter/StatusIconConverter.cs
@@ -0,0 +1,47 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Data;
+using System.Windows.Data;
+using System.Globalization;
+using System.Text.RegularExpressions;
+
+namespace BPASmartClient.SmallBatchingSystem.Converter
+{
+ public class StatusIconConverter : IValueConverter
+ {
+ public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
+ {
+ if (value != null)
+ {
+ if (value.ToString() == Status.等待配料.ToString())
+ return Regex.Unescape(StringToUnicode(""));
+ else if (value.ToString() == Status.正在配料.ToString())
+ return Regex.Unescape(StringToUnicode(""));
+ else if (value.ToString() == Status.配料完成.ToString())
+ return Regex.Unescape(StringToUnicode(""));
+ }
+ return value;
+ }
+
+ public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
+ {
+ throw new NotImplementedException();
+ }
+
+ ///
+ /// 字符串转为UniCode码字符串
+ ///
+ public static string StringToUnicode(string s)
+ {
+ if (!string.IsNullOrEmpty(s))
+ {
+ //这里把格式 转为 \ue625
+ return s.Replace(@"", @"\u").Replace(";", "");
+ }
+ return s;
+ }
+ }
+}
diff --git a/BPASmartClient.SmallBatchingSystem/Fonts/iconfont.ttf b/BPASmartClient.SmallBatchingSystem/Fonts/iconfont.ttf
new file mode 100644
index 0000000000000000000000000000000000000000..22181b32edae9e2409cc835768530c82031f988a
GIT binary patch
literal 9412
zcmd^EdvqJsnZI{Nnvpaby=J6QEbARfe#DPRwiM^#II;6+Hc1nL4S|qEb{t#5wj4ho
zPT9pgk`yQ{bh|CvQVyliEn!O^w0r33E2S(PIN3r^>2k^`G~0(LZI_<5OBYy1-rt>(
z6DM%G-GBCJrV^ln>rYMaPr-3o511}-yz45So2WcnWgzMY9{c_?O
zE6z-iI$~CDmR}0fvC>Ep^_w{qd@PrOLWxkLS}cU#MXVU>ZQNPVK4PZyHzZ3@k|S0g
z)c1IH9o}?^oT-r4rj7X^{7=ZuV7quWIM(3*U07IH+7_C|xFBVOtT4O5?KJy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?MxruZ}Va1F-aB=Yqd%!B@P4YmM&
zu?Ac5FYDDBEP$@pUV~3~8)$YXG6pz?
z1!Q?gP|py!Tgj+VY7*+F4e#Q37WrF^apLEx;bUXf@z3-Ghrw+-&e|F+
zmgTXD1JjJ5Se`4-F2T^0WeQb$hi1#y&$3DeOGjtXN?ABMJ3KW!A);p($*g#+#EMTy
zx#P2?L&ecqv?`95CQ9S8
+ /// 到达目标位置
+ ///
+ public static bool TargetLocComplete { get; set; }
+
+ ///
+ /// 通道配料完成
+ ///
public static bool BatchingCompleted { get; set; }
+
+ ///
+ /// 配方配料完成
+ ///
+ public static bool RecipeBatchingComplete { get; set; }
}
}
diff --git a/BPASmartClient.SmallBatchingSystem/Models/RecipeStatus.cs b/BPASmartClient.SmallBatchingSystem/Models/RecipeStatus.cs
new file mode 100644
index 00000000..d73da174
--- /dev/null
+++ b/BPASmartClient.SmallBatchingSystem/Models/RecipeStatus.cs
@@ -0,0 +1,25 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using Microsoft.Toolkit.Mvvm.ComponentModel;
+
+namespace BPASmartClient.SmallBatchingSystem
+{
+ public class RecipeStatus : ObservableObject
+ {
+
+ public string RawMaterialName { get { return _mRawMaterialName; } set { _mRawMaterialName = value; OnPropertyChanged(); } }
+ private string _mRawMaterialName;
+
+
+ public bool IsChecked { get { return _mIsChecked; } set { _mIsChecked = value; OnPropertyChanged(); } }
+ private bool _mIsChecked;
+
+
+ public string Status { get { return _mStatus; } set { _mStatus = value; OnPropertyChanged(); } }
+ private string _mStatus = "等待配料";
+
+ }
+}
diff --git a/BPASmartClient.SmallBatchingSystem/Models/Status.cs b/BPASmartClient.SmallBatchingSystem/Models/Status.cs
new file mode 100644
index 00000000..e3bc9d9f
--- /dev/null
+++ b/BPASmartClient.SmallBatchingSystem/Models/Status.cs
@@ -0,0 +1,15 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace BPASmartClient.SmallBatchingSystem
+{
+ public enum Status
+ {
+ 等待配料,
+ 正在配料,
+ 配料完成
+ }
+}
diff --git a/BPASmartClient.SmallBatchingSystem/ResourcesStyle/ResourcesStyle.xaml b/BPASmartClient.SmallBatchingSystem/ResourcesStyle/ResourcesStyle.xaml
new file mode 100644
index 00000000..1744800c
--- /dev/null
+++ b/BPASmartClient.SmallBatchingSystem/ResourcesStyle/ResourcesStyle.xaml
@@ -0,0 +1,133 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/BPASmartClient.SmallBatchingSystem/Services/Control.cs b/BPASmartClient.SmallBatchingSystem/Services/Control.cs
index acd3e6c8..9f840605 100644
--- a/BPASmartClient.SmallBatchingSystem/Services/Control.cs
+++ b/BPASmartClient.SmallBatchingSystem/Services/Control.cs
@@ -8,6 +8,7 @@ using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
+using BPASmartClient.CustomResource.Pages.Model;
namespace BPASmartClient.SmallBatchingSystem
{
@@ -18,12 +19,13 @@ namespace BPASmartClient.SmallBatchingSystem
private Control() { }
public ConcurrentQueue MakeOrderQueue { get; set; } = new ConcurrentQueue();
+ public bool IsCancel { get; set; }
+
public void Init()
{
ThreadManage.GetInstance().Start(new Action(() =>
{
PlcServer.GetInstance.Connect();
-
}), "设备初始化");
ThreadManage.GetInstance().StartLong(new Action(() =>
@@ -32,43 +34,84 @@ namespace BPASmartClient.SmallBatchingSystem
{
if (MakeOrderQueue.TryDequeue(out RecipeInfo recipeInfo))
{
+ IsCancel = false;
List OutletInfo = new List();
recipeInfo.SiloInfoModels.ToList()?.ForEach(item =>
{
var res = Json.Data.OutletInfoModels.FirstOrDefault(p => p.SiloInfos.FirstOrDefault(s => s.Contains(item.SiloName)) != null);
if (res != null) if (!OutletInfo.Contains(res.OutletLoc)) OutletInfo.Add(res.OutletLoc);
});
-
- OutletInfo.ForEach(temp =>
+ foreach (var temp in OutletInfo)
{
PlcServer.GetInstance.WriteData("VW302", (ushort)temp);//设置出料口位置
PlcServer.GetInstance.WriteData("M10.0", true);//定位启动
+ Message($"启动定位,出料口位置:{temp}");
int index = temp - 1;
- if (index >= 0 && index < PlcDataModel.TargetLocFeedback.Length)
+ if (index >= 0)
{
- while (!PlcDataModel.TargetLocFeedback[index]) Thread.Sleep(1);//等待定位反馈
- recipeInfo.SiloInfoModels.ToList()?.ForEach(temp1 =>
+ Message("等待定位完成");
+ while (!PlcDataModel.TargetLocComplete && !IsCancel) Thread.Sleep(1);//等待定位反馈
+ if (IsCancel) break;
+ Message("定位完成");
+ PlcServer.GetInstance.WriteData("M20.0", false);
+ while (PlcDataModel.TargetLocComplete && !IsCancel) Thread.Sleep(1);
+ if (IsCancel) break;
+ Message("定位完成,复位成功");
+ foreach (var temp1 in recipeInfo.SiloInfoModels)
{
- var res = Json.Data.SiloInfoModels.FirstOrDefault(p => p.SiloName == temp1.SiloName);
- if (res != null)
+ var rest = Json.Data.OutletInfoModels.FirstOrDefault(p => p.SiloInfos.FirstOrDefault(s => s.Contains(temp1.SiloName)) != null);
+ if (rest != null && rest.OutletLoc == temp)
{
- PlcServer.GetInstance.WriteData(GetWeightAdd(res.SiloLoc), (ushort)temp1.SiloWeight);
- PlcServer.GetInstance.WriteData(GetStartSingleAdd(res.SiloLoc), true);
- while (!PlcDataModel.BatchingCompleted) Thread.Sleep(1);//等待出料完成
- PlcServer.GetInstance.WriteData("M4.0", false);//复位出料完成信号
- while (PlcDataModel.BatchingCompleted) Thread.Sleep(1);//等待出料完成信号复位成功
+ var res = Json.Data.SiloInfoModels.FirstOrDefault(p => p.SiloName == temp1.SiloName);
+ if (res != null)
+ {
+ StatusNotify(res.SiloName, Status.正在配料);
+ Message($"写重量地址:{GetWeightAdd(res.SiloLoc)},重量:{temp1.SiloWeight}");
+ PlcServer.GetInstance.WriteData(GetWeightAdd(res.SiloLoc), (ushort)temp1.SiloWeight);
+ Message($"写启动信号地址:{GetStartSingleAdd(res.SiloLoc)}");
+ PlcServer.GetInstance.WriteData(GetStartSingleAdd(res.SiloLoc), true);
+ while (!PlcDataModel.BatchingCompleted && !IsCancel) Thread.Sleep(1);//等待出料完成
+ if (IsCancel) break;
+ Message("出料完成,复位出料完成状态");
+ PlcServer.GetInstance.WriteData("M4.0", false);//复位出料完成信号
+ while (PlcDataModel.BatchingCompleted && !IsCancel) Thread.Sleep(1);//等待出料完成信号复位成功
+ if (IsCancel) break;
+ Message("出料完成复位成功");
+ StatusNotify(res.SiloName, Status.配料完成);
+ }
}
- });
+ }
+ if (IsCancel) return;
}
+ }
- });
- PlcServer.GetInstance.WriteData("M10.4", true);
+ if (!IsCancel)
+ {
+ Message($"写入配方执行完成信号");
+ PlcServer.GetInstance.WriteData("M10.4", true);
+ Message("等待配方执行完成");
+ while (!PlcDataModel.RecipeBatchingComplete && !IsCancel) Thread.Sleep(1);
+ if (IsCancel) break;
+ Message($"【{recipeInfo.RecipeName}】配方执行完成");
+ ActionManage.GetInstance.Send("GrindArenaceousCancel");
+ }
}
}
Thread.Sleep(10);
}), "配方流程控制");
}
+ private bool Wait(ref bool Targger, bool IsCancel = false)
+ {
+ bool a = Targger;
+ while (!IsCancel)
+ {
+ if (a)
+ Thread.Sleep(1);
+ }
+ return !IsCancel;
+ }
+
///
@@ -80,12 +123,31 @@ namespace BPASmartClient.SmallBatchingSystem
{
if (num > 0)
{
- var s = 100 + (num - 1) * 2;
- return $"VW{s}";
+ int add = 0;
+ if (num >= 1 && num <= 8)
+ {
+ add = 100 + (num - 1) * 2;
+ }
+ else if (num >= 9 && num <= 18)
+ {
+ add = 102 + (num - 1) * 2;
+ }
+ return $"VW{add}";
}
return default;
}
+ private void StatusNotify(string SiloName, Status Status)
+ {
+ ActionManage.GetInstance.Send("StatusNotify", new RecipeStatus() { RawMaterialName = SiloName, Status = Status.ToString() });
+ }
+
+ private void Message(string info)
+ {
+ BPASmartClient.CustomResource.Pages.Model.MessageLog.GetInstance.ShowRunLog(info);
+ Debug.WriteLine($"{DateTime.Now.ToString("HH:mm:ss")}:{info}");
+ }
+
///
/// 获取启动信号地址
///
@@ -104,7 +166,6 @@ namespace BPASmartClient.SmallBatchingSystem
c = 7;
}
else c--;
-
Add = $"M{ t}.{c}";
return Add;
}
diff --git a/BPASmartClient.SmallBatchingSystem/Services/PlcServer.cs b/BPASmartClient.SmallBatchingSystem/Services/PlcServer.cs
index 813be047..b0b9cb46 100644
--- a/BPASmartClient.SmallBatchingSystem/Services/PlcServer.cs
+++ b/BPASmartClient.SmallBatchingSystem/Services/PlcServer.cs
@@ -26,13 +26,10 @@ namespace BPASmartClient.SmallBatchingSystem
MessageLog.GetInstance.Show("设备连接成功");
ThreadManage.GetInstance().StartLong(new Action(() =>
{
- var res = ReadData("M20.0", 16);//到达目标位置信号
- if (res != null && res is bool[] bools && bools.Length == 16)
+ var res = ReadData("M20.0", 1);//到达目标位置信号
+ if (res != null && res is bool[] bools && bools.Length == 1)
{
- for (int i = 0; i < bools.Length; i++)
- {
- PlcDataModel.TargetLocFeedback[i] = bools[i];
- }
+ PlcDataModel.TargetLocComplete = bools[0];
}
var res1 = ReadData("M4.0", 1);//通道出料完成
@@ -41,6 +38,12 @@ namespace BPASmartClient.SmallBatchingSystem
PlcDataModel.BatchingCompleted = bools1[0];
}
+ var res2 = ReadData("M13.3", 1);//配方配料完成
+ if (res2 != null && res2 is bool[] bools2 && bools2.Length == 1)
+ {
+ PlcDataModel.RecipeBatchingComplete = bools2[0];
+ }
+
Thread.Sleep(10);
}), "PLC 数据监听");
});
diff --git a/BPASmartClient.SmallBatchingSystem/Services/SiloServer.cs b/BPASmartClient.SmallBatchingSystem/Services/SiloServer.cs
deleted file mode 100644
index 570b460e..00000000
--- a/BPASmartClient.SmallBatchingSystem/Services/SiloServer.cs
+++ /dev/null
@@ -1,221 +0,0 @@
-using BPASmart.Model;
-using BPASmartClient.Helper;
-using System;
-using System.Collections.Concurrent;
-using System.Collections.Generic;
-using System.Collections.ObjectModel;
-using System.Linq;
-using System.Text;
-using System.Threading;
-using System.Threading.Tasks;
-
-namespace BPASmartClient.SmallBatchingSystem
-{
- ///
- /// 料仓服务线程
- ///
- public class SiloServer
- {
- public SiloServer()
- {
- BusinessThread();
- RefreshRecips();
- MakeToRecipsID("2d1ac4da-110b-4d4d-9e94-36aac6d67124");
- }
-
- #region 临时变量
- ///
- /// 物料数据
- ///
- public ObservableCollection RecipeMaterialsDic = new ObservableCollection();
- ///
- /// 当前配方
- ///
- public ObservableCollection RecipesDic = new ObservableCollection();
- #endregion
-
- #region 订单管理
- public ConcurrentQueue MakeOrderQueue { get; set; } = new ConcurrentQueue();
- #endregion
-
- #region 业务
- ///
- /// 业务线程
- ///
- public void BusinessThread()
- {
-
- ThreadManage.GetInstance().Start(new Action(() =>
- {
- PlcServer.GetInstance.Connect();
- }), "启动PLC", false);
-
- ThreadManage.GetInstance().StartLong(new Action(() =>
- {
- // if (PlcServer.GetInstance.Communication.Connected)
- {
- if (MakeOrderQueue.TryDequeue(out Recipes recipes))
- {
- Make(recipes);
- }
- }
- }), "配料线程启动", true);
- }
- #endregion
-
- #region 调用函数
- ///
- /// 刷新配方数据
- ///
- public void RefreshRecips()
- {
- try
- {
- //读取料仓物料数据 配方数据
- Json.Read();
- Json.Read();
- RecipeMaterialsDic = Json.Data.locaMaterails;
- RecipesDic = Json.Data.locaRecipes;
- RecipesDic?.ToList().ForEach(par =>
- {
- par.recipeMaterials?.ToList().ForEach((recipeMaterial) =>
- {
- RecipeMaterials recipe = RecipeMaterialsDic?.ToList().Find(k => k.ID == recipeMaterial.ID);
- if (recipe != null)
- {
- recipeMaterial.MaterialType = recipe.MaterialType;
- recipeMaterial.MaterialPosion = recipe.MaterialPosion;
- recipeMaterial.PropertyCollections = recipe.PropertyCollections;
- }
- });
-
- });
- }
- catch (Exception ex)
- {
-
- }
- }
-
- ///
- /// 根据配方ID制作流程
- ///
- public void MakeToRecipsID(string id)
- {
- try
- {
- //chaxun 配方
- Recipes info = RecipesDic?.ToList().Find(par => par.ID == id);
- if (info != null)
- {
- //添加到队列
- MakeOrderQueue.Enqueue(info);
- }
- }
- catch (Exception ex)
- {
-
- }
- }
-
- ///
- /// 根据配方控制流程
- ///
- ///
- public async void Make(Recipes recipes)
- {
- try
- {
- //遍历配方物料集合
- recipes?.recipeMaterials?.ToList().ForEach(recipe =>
- {
- //料仓位置
- int recipesLoc = 1;
- int.TryParse(recipe.PropertyCollections?.First()?.PropertyValue, out recipesLoc);
-
- //原料位置
- int storeLoc = 1; int.TryParse(recipe.MaterialPosion, out recipesLoc);
-
- //原料需求(g)数
- int storeWeight = recipe.MaterialWeight;
-
- //1.写PLC VW302 目标位置 -> recipesLoc M10.0 定位启动 开始运行
- //2.读取PLC M20.0 到达目标位置 <- 标志 (bool) 【等待】
- //3.写PLC VW100 料口X需求 ->写入重量 storeWeight
- //4.写PLC M0.0 启动出料口xx ->storeLoc (bool)
- //5.读PLC M4.0 通道XX出料完成<-标志 (bool) 【等待】
-
- if (storeWeight > 0)
- {
- WriteData("VW302", recipesLoc);
- WriteData("M10.0", true);
-
- #region 读取是否到达目标位置,超时10秒
- bool IsOver = false;
- int fade1 = 1000;
- while (fade1 != -1 && !IsOver)
- {
- IsOver = (bool)ReadData("M20.0", 1);
- Thread.Sleep(10);
- fade1--;
- }
- #endregion
-
- if (IsOver)//到达指定位置
- {
- //写需求
- string adder = $"VW{100 + 2 * (storeLoc - 1)}";
- WriteData(adder, storeWeight);
-
- //写启动料口
- adder = storeLoc <= 8 ? $"M0.{(storeLoc - 1)}" : $"M1.{(storeLoc - 9)}";
- WriteData(adder, true);
-
- //读取通道下料是否完成
- adder = storeLoc <= 8 ? $"M4.{(storeLoc - 1)}" : $"M5.{(storeLoc - 9)}";
- #region 通道XX出料完成,超时10秒
- bool IsXLOver = false;
- int fade1XL = 1000;
- while (fade1XL != -1 && !IsXLOver)
- {
- IsXLOver = (bool)ReadData("M20.0", 1);
- Thread.Sleep(30);
- fade1XL--;
- }
- #endregion
- }
- }
- });
-
- //6.写PLC M10.4 上位机配料完成
- WriteData("M10.4", true);
- }
- catch (Exception ex) { }
- }
- #endregion
-
- #region 调用外部PLC
- ///
- /// 写PLC
- ///
- ///
- ///
- public void WriteData(string address, object value)
- {
- //PlcServer.GetInstance.WriteData(address, value);
- }
- ///
- /// 读PLC
- ///
- ///
- ///
- ///
- public object ReadData(string address, int length)
- {
- //return PlcServer.GetInstance.ReadData(address, length);
- return null;
- }
- #endregion
-
- }
-}
diff --git a/BPASmartClient.SmallBatchingSystem/ViewModels/GrindArenaceousViewModel.cs b/BPASmartClient.SmallBatchingSystem/ViewModels/GrindArenaceousViewModel.cs
new file mode 100644
index 00000000..fd7aec69
--- /dev/null
+++ b/BPASmartClient.SmallBatchingSystem/ViewModels/GrindArenaceousViewModel.cs
@@ -0,0 +1,48 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using Microsoft.Toolkit.Mvvm.Input;
+using BPA.Helper;
+using System.Collections.ObjectModel;
+
+namespace BPASmartClient.SmallBatchingSystem.ViewModels
+{
+ public class GrindArenaceousViewModel : BaseModel
+ {
+ public GrindArenaceousViewModel()
+ {
+ ActionManage.GetInstance.Register(new Action