Bladeren bron

味魔方修改

master
pry 2 jaren geleden
bovenliggende
commit
650e6fb409
12 gewijzigde bestanden met toevoegingen van 61 en 26 verwijderingen
  1. +31
    -0
      BPASmartClient.CustomResource/Converters/RecipeStatusConvert.cs
  2. +1
    -1
      BPASmartClient.Model/柔性味魔方/RawMaterialModel.cs
  3. +1
    -0
      BPASmartClient.MorkS/BPASmartClient.MorkS.csproj
  4. +1
    -0
      BPASmartClient.MorkS/DataServer.cs
  5. +1
    -0
      DosingSystem/App.xaml
  6. +5
    -1
      DosingSystem/App.xaml.cs
  7. +2
    -2
      DosingSystem/Model/DeviceInquire.cs
  8. +5
    -0
      DosingSystem/Model/RecipeModel.cs
  9. +4
    -4
      DosingSystem/View/ChangeDeviceNameView.xaml.cs
  10. +2
    -2
      DosingSystem/View/RecipeControlView.xaml
  11. +0
    -9
      DosingSystem/ViewModel/ChangeDeviceNameViewModel.cs
  12. +8
    -7
      DosingSystem/ViewModel/RecipeControlViewModel.cs

+ 31
- 0
BPASmartClient.CustomResource/Converters/RecipeStatusConvert.cs Bestand weergeven

@@ -0,0 +1,31 @@
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 RecipeStatusConvert : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
if (value != null)
{
if (value.ToString() == "等待制作")
return Brushes.Yellow;
else if (value.ToString() == "制作完成")
return Brushes.Green;
}
return default;
}

public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
throw new NotImplementedException();
}
}
}

+ 1
- 1
BPASmartClient.Model/柔性味魔方/RawMaterialModel.cs Bestand weergeven

@@ -114,7 +114,7 @@ namespace BPASmartClient.Model
set
{
_mRecipeStatus = value;
if (value == 1) Status = Status.等待配料;
if (value == 1 && Status != Status.配料完成) Status = Status.等待配料;
else if (value == 2) Status = Status.正在配料;
else if (value == 3) Status = Status.配料完成;
OnPropertyChanged();


+ 1
- 0
BPASmartClient.MorkS/BPASmartClient.MorkS.csproj Bestand weergeven

@@ -9,6 +9,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="BPA.Message" Version="1.0.72" />
<PackageReference Include="BPA.Models" Version="1.0.34" />
<PackageReference Include="Microsoft.Toolkit.Mvvm" Version="7.1.2" />
<PackageReference Include="System.Speech" Version="6.0.0" />


+ 1
- 0
BPASmartClient.MorkS/DataServer.cs Bestand weergeven

@@ -6,6 +6,7 @@ using System.Threading;
using System.Threading.Tasks;
using BPA.Helper;
using BPASmartClient.MQTT;
using BPA.Message;

namespace BPASmartClient.MorkS
{


+ 1
- 0
DosingSystem/App.xaml Bestand weergeven

@@ -28,6 +28,7 @@
<con:BoolToVisibilityConvert x:Key="BoolToVisibilityConvert" />
<con:CountIsVisiableConvert x:Key="CountIsVisiableConvert" />
<con:BoolToFillColorConverter x:Key="BoolToFillColorConverter" />
<con:RecipeStatusConvert x:Key="RecipeStatusConvert" />
</ResourceDictionary>

<ResourceDictionary>


+ 5
- 1
DosingSystem/App.xaml.cs Bestand weergeven

@@ -28,8 +28,12 @@ namespace BPASmartClient.DosingSystem
BPASmartClient.Helper.SystemHelper.GetInstance.CreateDesktopShortcut();
MenuInit();
DataInit();
DeviceInquire.GetInstance.Init();//配料机设备上线监听,设备列表初始化
ThreadManage.GetInstance().Start(new Action(() =>
{
DeviceInquire.GetInstance.Init();//配料机设备上线监听,设备列表初始化
}), "设备初始化");
MainView mv = new MainView();
mv.TitleName = "味魔方管理系统软件[简称:味魔方] 1.0.1";
LoginView lv = new LoginView();
var res = lv.ShowDialog();
if (res != null && res == true)


+ 2
- 2
DosingSystem/Model/DeviceInquire.cs Bestand weergeven

@@ -307,7 +307,7 @@ namespace BPASmartClient.DosingSystem
modbusTcp.ShowEx = new Action<string>((s) => { MessageNotify.GetInstance.ShowRunLog(s); });
this.DeviceName = DeviceName;
AlarmHelper<AlarmInfo>.Init();
if (modbusTcp.Connected)
{
ThreadManage.GetInstance().StartLong(new Action(() =>
@@ -364,7 +364,7 @@ namespace BPASmartClient.DosingSystem
modbusTcp.SetUint(DeviceAddress.ServoManualSpeed, (uint)res.ServoManualSpeed);
modbusTcp.SetUint(DeviceAddress.SiloUpperLimitWeight, (uint)res.SiloUpperLimitWeight);
modbusTcp.SetUint(DeviceAddress.LowerLimitWeightOfSilo, (uint)res.LowerLimitWeightOfSilo);
modbusTcp.SetUint(DeviceAddress.StirringSpeed, (uint)res.StirringSpeed * 100);
modbusTcp.SetUint(DeviceAddress.StirringSpeed, (uint)res.StirringSpeed);
MessageNotify.GetInstance.ShowRunLog($"{res.MaterialName},参数下发完成");
}
}


+ 5
- 0
DosingSystem/Model/RecipeModel.cs Bestand weergeven

@@ -40,6 +40,11 @@ namespace BPASmartClient.DosingSystem
[Newtonsoft.Json.JsonIgnore]
public AutoResetEvent Are { get; set; } = new AutoResetEvent(false);

[Newtonsoft.Json.JsonIgnore]
public string RecipStatus { get { return _mRecipStatus; } set { _mRecipStatus = value; OnPropertyChanged(); } }
private string _mRecipStatus;


/// <summary>
/// 原料集合
/// </summary>


+ 4
- 4
DosingSystem/View/ChangeDeviceNameView.xaml.cs Bestand weergeven

@@ -1,5 +1,4 @@
using BPASmartClient.Helper;
using System;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
@@ -12,6 +11,7 @@ using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
using BPA.Helper;

namespace BPASmartClient.DosingSystem.View
{
@@ -23,8 +23,8 @@ namespace BPASmartClient.DosingSystem.View
public ChangeDeviceNameView()
{
InitializeComponent();
ActionManage.GetInstance.CancelRegister("ChangeDeviceNameViewClose");
ActionManage.GetInstance.Register(new Action(() => { this.Close(); }), "ChangeDeviceNameViewClose");
//ActionManage.GetInstance.CancelRegister("ChangeDeviceNameViewClose");
ActionManage.GetInstance.Register(new Action(() => { this.Close(); }), "ChangeDeviceNameViewClose", true);
this.br.MouseLeftButtonDown += (o, e) => { if (e.LeftButton == MouseButtonState.Pressed) this.DragMove(); };
}
}


+ 2
- 2
DosingSystem/View/RecipeControlView.xaml Bestand weergeven

@@ -880,8 +880,8 @@
HorizontalAlignment="Center"
VerticalAlignment="Center"
FontSize="16"
Foreground="Yellow"
Text="等待执行" />
Foreground="{Binding RecipStatus,Converter={StaticResource RecipeStatusConvert}}"
Text="{Binding RecipStatus}" />
<Border
Grid.ColumnSpan="10"
BorderBrush="{StaticResource bordColor}"


+ 0
- 9
DosingSystem/ViewModel/ChangeDeviceNameViewModel.cs Bestand weergeven

@@ -54,15 +54,6 @@ namespace BPASmartClient.DosingSystem.ViewModel

private static string IpAddress = string.Empty;

//public BPARelayCommand ConfirmCommand { get; set; }

//public BPARelayCommand CancleCommand { get; set; }


//public string ErrorInfo { get { return _mErrorInfo; } set { _mErrorInfo = value; OnPropertyChanged(); } }
//private string _mErrorInfo;


public string DeviceName { get { return _mDeviceName; } set { _mDeviceName = value; OnPropertyChanged(); } }
private string _mDeviceName;



+ 8
- 7
DosingSystem/ViewModel/RecipeControlViewModel.cs Bestand weergeven

@@ -59,7 +59,7 @@ namespace BPASmartClient.DosingSystem.ViewModel
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 });
UserTreeWait.Add(new RecipeModel { RecipStatus = "等待制作", SerialNum = UserTreeWait.Count + 1, RecipeName = deviceName, RawMaterials = res.RawMaterials });
}
NoticeDemoViewModel.OpenMsg(EnumPromptType.Success, App.MainWindow, "提示", $"配方下发成功!");
MessageNotify.GetInstance.ShowUserLog($"下发工单 {Guid.NewGuid().ToString()}");
@@ -107,7 +107,7 @@ namespace BPASmartClient.DosingSystem.ViewModel
if (tempDevice != null)
{
/*data = data.SetBitValue((byte)tempDevice.DeviceNum, true);*/
if (tempDevice.DeviceNum > 0)
if (tempDevice.DeviceNum > 0)
{
int a = data.SetBitValue((byte)tInfo.ElementAt(i).ElementAt(m).Loc, true);
byte[] test1 = a.ToBytes(BPA.Helper.DataFormat.ABCD);
@@ -116,9 +116,9 @@ namespace BPASmartClient.DosingSystem.ViewModel
MessageNotify.GetInstance.ShowRunLog($"下发配方DB4.DBD{2 + (tempDevice.DeviceNum - 1) * 4} :{item.ToBinString()}");
}
}
if (tInfo.ElementAt(i).ElementAt(m).Loc >0)
if (tInfo.ElementAt(i).ElementAt(m).Loc > 0)
{
if (!BarrelNum.Contains(tInfo.ElementAt(i).ElementAt(m).Loc))
if (!BarrelNum.Contains(tInfo.ElementAt(i).ElementAt(m).Loc))
{
BarrelNum.Add(tInfo.ElementAt(i).ElementAt(m).Loc);
}
@@ -232,6 +232,7 @@ namespace BPASmartClient.DosingSystem.ViewModel
RecipeName = recipeComple.RecipeName,
SerialNum = UserTreeCompelete.Count + 1,
RecipCode = recipeComple.RecipCode,
RecipStatus = "制作完成"
});
});
App.Current.Dispatcher.Invoke(new Action(() =>
@@ -283,14 +284,14 @@ namespace BPASmartClient.DosingSystem.ViewModel
MessageNotify.GetInstance.ShowRunLog("错误");
return;
}
else
else
{
switch (cnt)
{
case 1:
int a1 = Array.FindIndex(DeviceInquire.GetInstance.devices.ToArray(), p => p.DeviceNum == 1);
int b1 = Array.FindIndex(DeviceInquire.GetInstance.devices.ToArray(), p => p.DeviceNum == 2);
if (a1 >= 0)
if (a1 >= 0)
{
Location1 = Array.FindIndex(Recipes.ElementAt(i).RawMaterials.ToArray(), p => p.RawMaterialName == DeviceInquire.GetInstance.devices.ElementAt(a1).DeviceName && p.Loc == barrel);
}
@@ -461,7 +462,7 @@ namespace BPASmartClient.DosingSystem.ViewModel
}
}
}
else
else
{
if (Location2 >= 0)
{


Laden…
Annuleren
Opslaan