pry 2 년 전
부모
커밋
93ab3ffbff
44개의 변경된 파일1198개의 추가작업 그리고 326개의 파일을 삭제
  1. +2
    -0
      BPASmartClient.CustomResource/BPASmartClient.CustomResource.csproj
  2. BIN
     
  3. +4
    -4
      BPASmartClient.CustomResource/Pages/Model/Config.cs
  4. +27
    -6
      BPASmartClient.CustomResource/Pages/Model/MessageLog.cs
  5. +8
    -3
      BPASmartClient.CustomResource/Pages/Model/UserInfo.cs
  6. +14
    -6
      BPASmartClient.CustomResource/Pages/View/UserManageView.xaml
  7. +19
    -1
      BPASmartClient.CustomResource/Pages/View/UserManageView.xaml.cs
  8. +1
    -1
      BPASmartClient.CustomResource/Pages/View/VariableConfigView.xaml
  9. +2
    -6
      BPASmartClient.CustomResource/Pages/ViewModel/AlarmViewModel.cs
  10. +4
    -4
      BPASmartClient.CustomResource/Pages/ViewModel/LoginViewModel.cs
  11. +1
    -1
      BPASmartClient.CustomResource/Pages/ViewModel/RunLogViewModel.cs
  12. +32
    -2
      BPASmartClient.CustomResource/Pages/ViewModel/UserManageViewModel.cs
  13. +34
    -2
      BPASmartClient.Modbus/ModbusTcp.cs
  14. +6
    -2
      DosingSystem/App.xaml.cs
  15. +5
    -5
      DosingSystem/Model/DeviceAddress.cs
  16. +10
    -7
      DosingSystem/Model/DeviceInquire.cs
  17. +1
    -1
      DosingSystem/View/DeviceListView.xaml
  18. +1
    -1
      DosingSystem/View/RecipeControlView.xaml
  19. +4
    -3
      DosingSystem/ViewModel/NewRecipeViewModel.cs
  20. +7
    -7
      DosingSystem/ViewModel/RecipeControlViewModel.cs
  21. +7
    -2
      DosingSystem/ViewModel/RecipeSettingsViewModel.cs
  22. +13
    -4
      FryPot_DosingSystem/App.xaml.cs
  23. +1
    -0
      FryPot_DosingSystem/Control/DeviceOperate.cs
  24. +466
    -72
      FryPot_DosingSystem/Control/DosingLogicControl.cs
  25. +16
    -8
      FryPot_DosingSystem/FryPotStatus/PotFiveStatus.cs
  26. +15
    -8
      FryPot_DosingSystem/FryPotStatus/PotFourStatus.cs
  27. +15
    -8
      FryPot_DosingSystem/FryPotStatus/PotOneStatus.cs
  28. +16
    -8
      FryPot_DosingSystem/FryPotStatus/PotThreeStatus.cs
  29. +15
    -8
      FryPot_DosingSystem/FryPotStatus/PotTwoStatus.cs
  30. +1
    -0
      FryPot_DosingSystem/FryPot_DosingSystem.csproj
  31. +70
    -1
      FryPot_DosingSystem/Resources/fonts/demo_index.html
  32. BIN
     
  33. BIN
     
  34. +32
    -0
      FryPot_DosingSystem/View/LabelPrint.xaml
  35. +28
    -0
      FryPot_DosingSystem/View/LabelPrint.xaml.cs
  36. +31
    -8
      FryPot_DosingSystem/View/RecipeSendDownView.xaml
  37. +50
    -5
      FryPot_DosingSystem/View/SqliteDataView.xaml
  38. +4
    -1
      FryPot_DosingSystem/View/SqliteDataView.xaml.cs
  39. +11
    -3
      FryPot_DosingSystem/View/UserManageView.xaml
  40. +7
    -4
      FryPot_DosingSystem/View/UserManageView.xaml.cs
  41. +20
    -0
      FryPot_DosingSystem/ViewModel/LabelPrintViewModel.cs
  42. +8
    -2
      FryPot_DosingSystem/ViewModel/RecipeSetDownViewModel.cs
  43. +189
    -121
      FryPot_DosingSystem/ViewModel/SqliteDataViewModel.cs
  44. +1
    -1
      FryPot_DosingSystem/ViewModel/UserManageViewModel.cs

+ 2
- 0
BPASmartClient.CustomResource/BPASmartClient.CustomResource.csproj 파일 보기

@@ -20,6 +20,7 @@

<ItemGroup>
<None Remove="Fonts\80号-萌趣小鱼体.ttf" />
<None Remove="Fonts\font\iconfont.ttf" />
<None Remove="Fonts\iconfont.ttf" />
<None Remove="Fonts\MT\iconfont.ttf" />
<None Remove="Fonts\naicha.ttf" />
@@ -233,6 +234,7 @@

<ItemGroup>
<Resource Include="Fonts\80号-萌趣小鱼体.ttf" />
<Resource Include="Fonts\font\iconfont.ttf" />
<Resource Include="Fonts\iconfont.ttf" />
<Resource Include="Fonts\MT\iconfont.ttf" />
<Resource Include="Fonts\naicha.ttf" />



+ 4
- 4
BPASmartClient.CustomResource/Pages/Model/Config.cs 파일 보기

@@ -38,10 +38,10 @@ namespace BPASmartClient.CustomResource.Pages.Model

private void AddData()
{
Global.userManager.userInfos.Add(new UserInfo() {Id= IdProcess(), Permission = Permission.管理员, UserName = "admin", Password = "admin" }); ;
Global.userManager.userInfos.Add(new UserInfo() { Id = IdProcess(), Permission = Permission.操作员, UserName = "czy", Password = "123456" });
Global.userManager.userInfos.Add(new UserInfo() { Id = IdProcess(), Permission = Permission.观察员, UserName = "gcy", Password = "654321" });
Global.userManager.userInfos.Add(new UserInfo() { Id = IdProcess(), Permission = Permission.技术员, UserName = "jsy", Password = "88888888" });
Global.userManager.userInfos.Add(new UserInfo() {Id= IdProcess(), permission = Permission.管理员, UserName = "admin", Password = "admin" }); ;
Global.userManager.userInfos.Add(new UserInfo() { Id = IdProcess(), permission = Permission.操作员, UserName = "czy", Password = "123456" });
Global.userManager.userInfos.Add(new UserInfo() { Id = IdProcess(), permission = Permission.观察员, UserName = "gcy", Password = "654321" });
Global.userManager.userInfos.Add(new UserInfo() { Id = IdProcess(), permission = Permission.技术员, UserName = "jsy", Password = "88888888" });
SaveUser();
}



+ 27
- 6
BPASmartClient.CustomResource/Pages/Model/MessageLog.cs 파일 보기

@@ -6,6 +6,7 @@ using System.Collections.ObjectModel;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using BPASmartClient.Model;

namespace BPASmartClient.CustomResource.Pages.Model
{
@@ -16,22 +17,26 @@ namespace BPASmartClient.CustomResource.Pages.Model

public static readonly object runLock = new object();
public static readonly object userlock = new object();
public static readonly object alarmlock = new object();
private MessageLog() { }

public Action<string> UserLog { get; set; }

public Action<string> RunLog { get; set; }

public Action<string> AlarmLog { get; set; }

public ObservableCollection<RunLog> runLogs { get; set; } = new ObservableCollection<RunLog>();

public ObservableCollection<UserLog> userLogs { get; set; } = new ObservableCollection<UserLog>();

public ObservableCollection<Alarm> alarmLogs { get; set; } = new ObservableCollection<Alarm>();

public void LogSave()
{
Sqlite<UserLog>.GetInstance.Save();
Sqlite<RunLog>.GetInstance.Save();
Sqlite<Alarm>.GetInstance.Save();
}

public void ShowUserLog(string info)
@@ -42,7 +47,7 @@ namespace BPASmartClient.CustomResource.Pages.Model
{
Date = DateTime.Now.ToString("yyyy-MM-dd"),
Time = DateTime.Now.ToString("HH:mm:ss"),
Permission = Global.userInfo.Permission.ToString(),
Permission = Global.userInfo.permission.ToString(),
UserName = Global.userInfo.UserName,
LogInfo = info
};
@@ -67,9 +72,25 @@ namespace BPASmartClient.CustomResource.Pages.Model
RunLog?.Invoke(info);
}
}




int AlarmID;
public void ShowAlarmLog(string info, string AlarmNumber="_", AlarmLevel level= AlarmLevel.一般报警)
{
lock (alarmlock)
{
AlarmID++;
Alarm alarmLog = new Alarm()
{
NumId = AlarmID,
Date = DateTime.Now.ToString("yyyy-MM-dd"),
Time = DateTime.Now.ToString("HH:mm:ss"),
Info = info,
Value = AlarmNumber,
Grade = (level)+""
};
Sqlite<Alarm>.GetInstance.Base.Add(alarmLog);
Application.Current.Dispatcher.Invoke(new Action(() => { alarmLogs.Insert(0, alarmLog); }));
AlarmLog?.Invoke(info);
}
}
}
}

+ 8
- 3
BPASmartClient.CustomResource/Pages/Model/UserInfo.cs 파일 보기

@@ -10,9 +10,14 @@ namespace BPASmartClient.CustomResource.Pages.Model
{
public class UserInfo:ObservableObject
{
public Permission permission { get; set; }
public string UserName { get; set; }
public string Password { get; set; }
public string Id { get { return _id; }set { _id = value;OnPropertyChanged(); } }
private string _id;
public Permission permission { get { return _perimission; } set { _perimission = value;OnPropertyChanged(); } }
private Permission _perimission;
public string UserName { get { return _userName; } set { _userName = value;OnPropertyChanged(); } }
private string _userName;
public string Password { get { return _password; } set { _password = value;OnPropertyChanged(); } }
private string _password;
public List<string> CardId { get; set; } = new List<string>();

}


+ 14
- 6
BPASmartClient.CustomResource/Pages/View/UserManageView.xaml 파일 보기

@@ -342,7 +342,7 @@
<DataGridTextColumn FontSize="16" IsReadOnly="false" Width="0.2*" Binding="{Binding UserName}" ElementStyle="{StaticResource dgCell}">
<DataGridTextColumn.Header>
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center">
<TextBlock FontFamily="../Resources/fonts/#iconfont" Foreground="Orange" Text="&#xe6a0;" FontSize="24" VerticalAlignment="Center" Margin="0,0,8,0"/>
<TextBlock FontFamily="../../Fonts/font/#iconfont" Foreground="Orange" Text="&#xe6a0;" FontSize="20" VerticalAlignment="Center" Margin="0,0,8,0"/>
<TextBlock Text="Account" />
</StackPanel>
</DataGridTextColumn.Header>
@@ -365,21 +365,29 @@
<DataGridTextColumn FontSize="16" IsReadOnly="False" Width="0.2*" Binding="{Binding Password}" ElementStyle="{StaticResource dgCell}" >
<DataGridTextColumn.Header>
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center">
<TextBlock FontFamily="../Resources/fonts/#iconfont" Foreground="Orange" Text="&#xe62b;" VerticalAlignment="Center" Margin="0,0,8,0"/>
<TextBlock FontFamily="../../Fonts/font/#iconfont" Foreground="Orange" Text="&#xe62b;" VerticalAlignment="Center" Margin="0,0,8,0"/>
<TextBlock Text="Password"/>
</StackPanel>
</DataGridTextColumn.Header>
</DataGridTextColumn>
<DataGridTextColumn FontSize="16" IsReadOnly="True" Width="0.2*" Binding="{Binding CardId}" ElementStyle="{StaticResource dgCell}">
<DataGridTextColumn.Header>
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center">
<TextBlock FontFamily="../../Fonts/font/#iconfont" Foreground="Orange" Text="&#xe8e0;" VerticalAlignment="Center" Margin="0,0,8,0"/>
<TextBlock Text="NFC"/>
</StackPanel>
</DataGridTextColumn.Header>
</DataGridTextColumn>
<DataGridTemplateColumn Width="0.2*">
<DataGridTemplateColumn.Header>
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center">
<TextBlock FontFamily="../Resources/fonts/#iconfont" Foreground="Orange" Text="&#xe62c;" VerticalAlignment="Center" Margin="0,0,8,0"/>
<TextBlock FontFamily="../../Fonts/font/#iconfont" Foreground="Orange" Text="&#xe62c;" VerticalAlignment="Center" Margin="0,0,8,0"/>
<TextBlock Text="Authority"/>
</StackPanel>
</DataGridTemplateColumn.Header>
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<ComboBox Text="{Binding Permission}" Template="{DynamicResource ComboBoxTemplate}" ItemsSource="{Binding DataContext.Authorities, RelativeSource={RelativeSource AncestorType={x:Type DataGrid}, Mode=FindAncestor}}" IsEditable="False" Foreground="Cyan" VerticalContentAlignment="Center" Width="auto" FontSize="16" HorizontalContentAlignment="Center" >
<ComboBox Text="{Binding permission}" Template="{DynamicResource ComboBoxTemplate}" SelectedItem="{Binding permission}" Tag="{Binding Id}" ItemsSource="{Binding DataContext.Authorities, RelativeSource={RelativeSource AncestorType={x:Type DataGrid}, Mode=FindAncestor}}" SelectionChanged="ComboBox_SelectionChanged" IsEditable="False" Foreground="SkyBlue" VerticalContentAlignment="Center" Width="auto" FontSize="16" HorizontalContentAlignment="Center" >
<ComboBox.ItemContainerStyle>
<Style TargetType="{x:Type ComboBoxItem}">
<Setter Property="FontSize" Value="16"/>
@@ -395,7 +403,7 @@

<DataGridTemplateColumn.Header>
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center">
<TextBlock FontFamily="../Resources/fonts/#iconfont" Foreground="Orange" Text="&#xe979;" VerticalAlignment="Center" Margin="0,0,8,0"/>
<TextBlock FontFamily="../../Fonts/font/#iconfont" Foreground="Orange" Text="&#xe979;" VerticalAlignment="Center" Margin="0,0,8,0"/>
<TextBlock Text="Operate"/>
</StackPanel>
</DataGridTemplateColumn.Header>
@@ -410,7 +418,7 @@
<Button Command="{Binding DataContext.SaveCommand, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=DataGrid}}"
CommandParameter="{Binding UserName}" Template="{DynamicResource ButtonTemplate1}" Style="{StaticResource btnStyle}" Foreground="Cyan" Content="Save" Margin="5,0"></Button>
<!--<Button Command="{Binding DataContext.UpdateCommand, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=DataGrid}}" Template="{DynamicResource ButtonTemplate1}" Style="{StaticResource btnStyle}" Content="Update" Grid.Column="1" Margin="5,0"></Button>-->
<Button Command="{Binding DataContext.DeleteCommand, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=DataGrid}}" CommandParameter="{Binding Account}" Template="{DynamicResource ButtonTemplate1}" Style="{StaticResource btnStyle}" Content="Delete" Grid.Column="1" Foreground="Cyan" Margin="5,0"></Button>
<Button Command="{Binding DataContext.DeleteCommand, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=DataGrid}}" CommandParameter="{Binding Id}" Template="{DynamicResource ButtonTemplate1}" Style="{StaticResource btnStyle}" Content="Delete" Grid.Column="1" Foreground="Cyan" Margin="5,0"></Button>
</Grid>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>


+ 19
- 1
BPASmartClient.CustomResource/Pages/View/UserManageView.xaml.cs 파일 보기

@@ -1,4 +1,6 @@
using System;
using BPASmartClient.CustomResource.Pages.Enums;
using BPASmartClient.CustomResource.Pages.ViewModel;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
@@ -24,5 +26,21 @@ namespace BPASmartClient.CustomResource.Pages.View
{
InitializeComponent();
}

private void ComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
ComboBox cbo = sender as ComboBox;
var id = cbo.Tag;
var per = cbo.SelectedItem;
if (id == null)
{
var a = UserManageViewModel.GetInstance.usersInfo.FirstOrDefault(p => p.Id == id);
if (a != null && per != null)
{
a.permission = (Permission)Enum.Parse(typeof(Permission), per.ToString());

}
}
}
}
}

+ 1
- 1
BPASmartClient.CustomResource/Pages/View/VariableConfigView.xaml 파일 보기

@@ -100,7 +100,7 @@
<DataGridTemplateColumn IsReadOnly="True" Width="0.1*" Header="ID">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<TextBox Text="{Binding RelativeSource={RelativeSource Mode=FindAncestor,AncestorType={x:Type DataGridRow}}, Path=Header}" IsReadOnly="False" Style="{StaticResource textboxStyle}"></TextBox>
<TextBox Text="{Binding RelativeSource={RelativeSource Mode=FindAncestor,AncestorType={x:Type DataGridRow}}, Path=Header}" IsReadOnly="True" Style="{StaticResource textboxStyle}"></TextBox>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>


+ 2
- 6
BPASmartClient.CustomResource/Pages/ViewModel/AlarmViewModel.cs 파일 보기

@@ -64,13 +64,13 @@ namespace BPASmartClient.CustomResource.Pages.ViewModel
}
});

AlarmInfos = AlarmHelper<AlarmInfo>.Alarms;
AlarmInfos = MessageLog.GetInstance.alarmLogs;
}

private void GetHistoryAlarm()
{
var data = Sqlite<BPASmartClient.Model.Alarm>.GetInstance.GetData();
var data = Sqlite<Alarm>.GetInstance.GetData();
if (data != null)
{
HistoryAlarm.Clear();
@@ -133,9 +133,5 @@ namespace BPASmartClient.CustomResource.Pages.ViewModel
public ObservableCollection<Alarm> AlarmInfos { get; set; }
public ObservableCollection<Alarm> HistoryAlarm { get; set; } = new ObservableCollection<Alarm>();


}



}

+ 4
- 4
BPASmartClient.CustomResource/Pages/ViewModel/LoginViewModel.cs 파일 보기

@@ -60,22 +60,22 @@ namespace BPASmartClient.CustomResource.Pages.ViewModel
var res = Global.userManager.userInfos.FirstOrDefault(p => p.UserName == UserName && p.Password == Password);
if (res != null)
{
Global.userInfo.Permission = res.Permission;
Global.userInfo.permission = res.permission;
Global.userInfo.UserName = res.UserName;
Global.userInfo.Password = res.Password;
for (int i = 0; i < MenuManage.GetInstance.menuModels.Count; i++)
{
if (MenuManage.GetInstance.menuModels.ElementAt(i).MainMenuPermission.Contains(res.Permission))
if (MenuManage.GetInstance.menuModels.ElementAt(i).MainMenuPermission.Contains(res.permission))
MenuManage.GetInstance.menuModels.ElementAt(i).MainMenuVisibility = Visibility.Visible;
else
MenuManage.GetInstance.menuModels.ElementAt(i).MainMenuVisibility = Visibility.Collapsed;

if (MenuManage.GetInstance.menuModels.ElementAt(i).subMenumodels.FirstOrDefault(p => p.SubMenuPermission.Contains(res.Permission)) == null)
if (MenuManage.GetInstance.menuModels.ElementAt(i).subMenumodels.FirstOrDefault(p => p.SubMenuPermission.Contains(res.permission)) == null)
MenuManage.GetInstance.menuModels.ElementAt(i).MainMenuVisibility = Visibility.Collapsed;

for (int m = 0; m < MenuManage.GetInstance.menuModels.ElementAt(i).subMenumodels.Count; m++)
{
if (MenuManage.GetInstance.menuModels.ElementAt(i).subMenumodels.ElementAt(m).SubMenuPermission.Contains(res.Permission))
if (MenuManage.GetInstance.menuModels.ElementAt(i).subMenumodels.ElementAt(m).SubMenuPermission.Contains(res.permission))
MenuManage.GetInstance.menuModels.ElementAt(i).subMenumodels.ElementAt(m).SubMenuVisibility = Visibility.Visible;
else
MenuManage.GetInstance.menuModels.ElementAt(i).subMenumodels.ElementAt(m).SubMenuVisibility = Visibility.Collapsed;


+ 1
- 1
BPASmartClient.CustomResource/Pages/ViewModel/RunLogViewModel.cs 파일 보기

@@ -106,7 +106,7 @@ namespace BPASmartClient.CustomResource.Pages.ViewModel
/// </summary>
public string ControlButText { get { return _mControlButText; } set { _mControlButText = value; OnPropertyChanged(); } }
private string _mControlButText = "报警复位";
/// <summary>
/// 开始时间
/// </summary>


+ 32
- 2
BPASmartClient.CustomResource/Pages/ViewModel/UserManageViewModel.cs 파일 보기

@@ -17,10 +17,12 @@ namespace BPASmartClient.CustomResource.Pages.ViewModel
{
internal class UserManageViewModel:ObservableObject
{
private static UserManageViewModel _instance;
public static UserManageViewModel GetInstance => _instance ??= new UserManageViewModel();
public ObservableCollection<UserInfo> usersInfo { get; set; } = new ObservableCollection<UserInfo>();

//public List<Permission> Authorities { get; set; } = new List<Permission>() { Permission.管理员, Permission.操作员, Permission.观察员, Permission.技术员 };
public List<string> Authorities { get; set; } = new List<string>();

public RelayCommand<string> SaveCommand { get; set; }
public RelayCommand<string> DeleteCommand { get; set; }
public UserManageViewModel()
@@ -28,6 +30,7 @@ namespace BPASmartClient.CustomResource.Pages.ViewModel
var userManager = JsonConvert.DeserializeObject<UserManager>(File.ReadAllText("up.hbl").AESDecrypt());
usersInfo = userManager.userInfos;
AddAuthorities();

SaveCommand = new RelayCommand<string>((str) =>
{
if (str != string.Empty && str != null)
@@ -39,9 +42,15 @@ namespace BPASmartClient.CustomResource.Pages.ViewModel
}
else
{
var res = usersInfo.FirstOrDefault(p => p.UserName == str);
if (res.Id == null || res.Id == string.Empty)
{
res.Id = IdProcess();
}
Global.userManager.userInfos = usersInfo;
File.WriteAllText("up.hbl", JsonConvert.SerializeObject(Global.userManager).AESEncrypt());
MessageBox.Show("保存成功", "提示", MessageBoxButton.OK, MessageBoxImage.Information);

}

}
@@ -50,7 +59,7 @@ namespace BPASmartClient.CustomResource.Pages.ViewModel
{
if (str != string.Empty && str != null)
{
var userInfo = usersInfo.FirstOrDefault(p => p.UserName == str);
var userInfo = usersInfo.FirstOrDefault(p => p.Id == str);
if (userInfo != null)
{
if (usersInfo.Remove(userInfo))
@@ -67,6 +76,27 @@ namespace BPASmartClient.CustomResource.Pages.ViewModel
});
}



public string IdProcess()
{
erp:
string id = Guid.NewGuid().ToString();
if (usersInfo.Count > 0)
{
var res = usersInfo.FirstOrDefault(p => p.Id == id);
if (res != null)
{
goto erp;
}
else
{
return id;
}
}
return id;
}

private void AddAuthorities()
{
foreach (Permission aut in System.Enum.GetValues(typeof(Permission)))


+ 34
- 2
BPASmartClient.Modbus/ModbusTcp.cs 파일 보기

@@ -146,8 +146,38 @@ namespace BPASmartClient.Modbus
{
try
{
string head = "4"+(Convert.ToInt32(address.Substring(1, 1)) - 1).ToString();
string tail = address.Substring(2, 3);
string head = (Convert.ToInt32(address.Substring(1, 1))).ToString();
int num = Convert.ToInt32(address.Substring(2, 3));
int len = num.ToString().Length;
string tail=string.Empty;
switch (len)
{
case 1:
if ((Convert.ToInt32(address.Substring(4, 1))).ToString().Length > 1)
{
tail = "0" + (Convert.ToInt32(address.Substring(4, 1))).ToString();
}
else
{
tail = "00" + (Convert.ToInt32(address.Substring(4, 1))).ToString();
}
break;
case 2:
if ((Convert.ToInt32(address.Substring(3, 2))).ToString().Length >2)
{
tail =(Convert.ToInt32(address.Substring(3, 2))).ToString();
}
else
{
tail = "0" + (Convert.ToInt32(address.Substring(3, 2))).ToString();
}
break;
case 3:
tail = (Convert.ToInt32(address.Substring(2, 3))).ToString();
break;
}
address = head + tail;
return Convert.ToInt32(address);
}
@@ -175,6 +205,8 @@ namespace BPASmartClient.Modbus
}
}

//public object ReadHC(stri)

public object Read(string address, ushort len = 1, byte slaveAddress = 1)
{
if (address == null || tcpClient == null) return default(object);


+ 6
- 2
DosingSystem/App.xaml.cs 파일 보기

@@ -29,14 +29,18 @@ namespace BPASmartClient.DosingSystem
base.OnStartup(e);
MenuInit();
DataInit();
DeviceInquire.GetInstance.Init();//配料机设备上线监听,设备列表初始化

MainView mv = new MainView();
//mv.Show();
LoginView lv = new LoginView();
var res = lv.ShowDialog();
if (res != null && res == true)
if (res != null && res == true)
{
MessageLog.GetInstance.ShowUserLog("用户登录");
mv.Show();
DeviceInquire.GetInstance.Init();
}
else
mv.Close();
MainWindow = mv;


+ 5
- 5
DosingSystem/Model/DeviceAddress.cs 파일 보기

@@ -16,27 +16,27 @@ namespace BPASmartClient.DosingSystem.Model
/// <summary>
/// 料仓重量反馈起始地址
/// </summary>
public static string WeightFeedback { get; set; } = "LW204";
public static string WeightFeedback { get; set; } = "LW52";//LW204

/// <summary>
/// 重量设置地址
/// </summary>
public static string WeightSet { get; set; } = "LW200";
public static string WeightSet { get; set; } = "LW21";//LW200

/// <summary>
/// 启动信号地址
/// </summary>
public static string Start { get; set; } = "LW210";
public static string Start { get; set; } = "LW20";//LW210

/// <summary>
/// 下料重量反馈地址
/// </summary>
public static string CutWeightFeedback { get; set; } = "LW202";
public static string CutWeightFeedback { get; set; } = "LW54";//LW202

/// <summary>
/// 设备运行状态地址
/// </summary>
public static string RunStatus { get; set; } = "LW206";
public static string RunStatus { get; set; } = "LW51";//LW206
}




+ 10
- 7
DosingSystem/Model/DeviceInquire.cs 파일 보기

@@ -1,5 +1,4 @@
using BPASmartClient.Helper;
using BPASmartClient.Message;
using BPASmartClient.Modbus;
using BPASmartClient.DosingSystem.ViewModel;
using System;
@@ -11,6 +10,8 @@ using System.Net.NetworkInformation;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using BPASmartClient.CustomResource.UserControls.MessageShow;
using BPASmartClient.CustomResource.Pages.Model;

namespace BPASmartClient.DosingSystem.Model
{
@@ -85,7 +86,7 @@ namespace BPASmartClient.DosingSystem.Model

DS.modbusTcp.ConnectOk = new Action(() =>
{
string DeviceName = DS.modbusTcp.GetString(DeviceAddress.DeviceName, 20);
string DeviceName = DS.modbusTcp.GetString(DeviceAddress.DeviceName, 20);//读取设备名称
if (DeviceName.Length > 0)
{
DeviceLists.TryAdd(ip, DS);
@@ -97,7 +98,7 @@ namespace BPASmartClient.DosingSystem.Model
{
DeviceName = DeviceName,
IpAddress = ip
});
});//加入连接的(有名称的)设备列表

for (int i = 0; i < Json<LocaPar>.Data.Recipes.Count; i++)
{
@@ -124,7 +125,7 @@ namespace BPASmartClient.DosingSystem.Model
DS.modbusTcp.ConnectFail = new Action(() =>
{
if (!InvalidIP.Contains(ip)) InvalidIP.Add(ip);
MessageLog.GetInstance.Show($"{ip}连接失败");
//MessageLog.GetInstance.ShowAlarmLog($"设备{ip}连接失败");
});

DS.modbusTcp.Disconnect = new Action(() =>
@@ -135,7 +136,7 @@ namespace BPASmartClient.DosingSystem.Model
App.Current.Dispatcher.Invoke(new Action(() =>
{
DeviceListViewModel.devices.Remove(res);
if (!NewRecipeViewModel.RawMaterialNames.Contains(res.DeviceName))
if (NewRecipeViewModel.RawMaterialNames.Contains(res.DeviceName))
NewRecipeViewModel.RawMaterialNames.Remove(res.DeviceName);
}));
if (DeviceLists.ContainsKey(ip)) DeviceLists[ip].Dispose();
@@ -143,7 +144,7 @@ namespace BPASmartClient.DosingSystem.Model

Task.Run(new Action(() =>
{
DS.modbusTcp.ModbusTcpConnect(ip, 502);
DS.modbusTcp.ModbusTcpConnect(ip, 502);//PLC连接
IPQueues.Enqueue(e.Reply.Address.ToString());
}));
}
@@ -165,6 +166,8 @@ namespace BPASmartClient.DosingSystem.Model
/// </summary>
public RawMaterialDeviceStatus deviceStatus { get; set; } = new RawMaterialDeviceStatus();


public ModbusTcp modbusTcp = new ModbusTcp();

public bool IsConnected => modbusTcp.Connected;
@@ -186,7 +189,7 @@ namespace BPASmartClient.DosingSystem.Model

//获取设备料仓剩余重量
deviceStatus.WeightFeedback = this.modbusTcp.GetUint(DeviceAddress.WeightFeedback) * 10;
deviceStatus.CutWeightFeedback = this.modbusTcp.GetUint(DeviceAddress.CutWeightFeedback) * 10;
Thread.Sleep(100);
}), $"{DeviceName} 开始监听", true);
}


+ 1
- 1
DosingSystem/View/DeviceListView.xaml 파일 보기

@@ -51,7 +51,7 @@
Height="500"
CurrentValue="50" />-->

<pry:MotorBottle CurrentValue="100" IsRun="True" />
<!--<pry:MotorBottle IsRun="True" CurrentValue="100"/>-->


<Grid>


+ 1
- 1
DosingSystem/View/RecipeControlView.xaml 파일 보기

@@ -97,7 +97,7 @@
VerticalAlignment="Center"
BorderThickness="0"
Command="{Binding DataContext.StartCommand, RelativeSource={RelativeSource AncestorType=ListView, Mode=FindAncestor}}"
CommandParameter="{Binding RecipCode}"
CommandParameter="{Binding RecipeName}"
Content="订单下发"
EnterBackground="Red"
FontStyle="Normal"


+ 4
- 3
DosingSystem/ViewModel/NewRecipeViewModel.cs 파일 보기

@@ -8,6 +8,7 @@ using System.Collections.ObjectModel;
using Microsoft.Toolkit.Mvvm.Input;
using BPASmartClient.Helper;
using BPASmartClient.DosingSystem.Model;
using BPASmartClient.CustomResource.Pages.Model;

namespace BPASmartClient.DosingSystem.ViewModel
{
@@ -56,10 +57,10 @@ namespace BPASmartClient.DosingSystem.ViewModel
for (int i = 0; i < RawMaterials.Count; i++)
{
var res = DeviceListViewModel.devices.FirstOrDefault(p => p.DeviceName == RawMaterials.ElementAt(i).RawMaterialName);
if (res != null) RawMaterials.ElementAt(i).DeviceIp = res.IpAddress;
if (res != null) RawMaterials.ElementAt(i).DeviceIp = res.IpAddress;//根据设备名称和原料名称的唯一匹配关系,给原料配置IP
}

if (RecipCode.Length <= 0)
if (RecipCode.Length <= 0)//新建配方
{
var res = Array.FindIndex(Json<LocaPar>.Data.Recipes.ToArray(), p => p.RecipeName == RecipeName);

@@ -72,7 +73,7 @@ namespace BPASmartClient.DosingSystem.ViewModel
AddRecipes();
}
}
else
else//修改配方
{
var res = Array.FindIndex(Json<LocaPar>.Data.Recipes.ToArray(), p => p.RecipCode == RecipCode);
if (res >= 0 && res < Json<LocaPar>.Data.Recipes.Count)


+ 7
- 7
DosingSystem/ViewModel/RecipeControlViewModel.cs 파일 보기

@@ -37,7 +37,7 @@ namespace BPASmartClient.DosingSystem.ViewModel
devices.Enqueue(deviceName);
}
NoticeDemoViewModel.OpenMsg(EnumPromptType.Success, App.MainWindow, "提示", $"配方下发成功!");
MessageLog.GetInstance.ShowUserLog($"下发工单 { Guid.NewGuid().ToString()}");
MessageLog.GetInstance.ShowUserLog($"下发工单 {Guid.NewGuid().ToString()}");
});


@@ -45,22 +45,22 @@ namespace BPASmartClient.DosingSystem.ViewModel
{
if (devices.Count > 0)
{
int index = Array.FindIndex(Recipes.ToArray(), p => p.RecipeName == devices.ElementAt(0));
int index = Array.FindIndex(Recipes.ToArray(), p => p.RecipeName == devices.ElementAt(0));///???????
if (index >= 0 && index < Recipes.Count)
{
Recipes.ElementAt(index).Are.Reset();
Recipes.ElementAt(index).IsEnable = false;
foreach (var item in Recipes.ElementAt(index).RawMaterials)
{
DeviceInquire.GetInstance.GetDevice(item.DeviceIp)?.Start(item.RawMaterialWeight);//启动写入
DeviceInquire.GetInstance.GetDevice(item.DeviceIp)?.Start(item.RawMaterialWeight);//启动写入每个原料重量
}
Recipes.ElementAt(index).Are.WaitOne();
Recipes.ElementAt(index).Are.WaitOne();//阻塞,直到当前配方完成
devices.TryDequeue(out string deviceName);
}

}
Thread.Sleep(100);
}), "启动配下发");
}), "启动配下发");


ThreadManage.GetInstance().StartLong(new Action(() =>
@@ -72,11 +72,11 @@ namespace BPASmartClient.DosingSystem.ViewModel
var RunStatus = DeviceInquire.GetInstance.GetDevice(Recipes.ElementAt(i).RawMaterials.ElementAt(m).DeviceIp).deviceStatus.RunStatus;
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)
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();
DeviceInquire.GetInstance.GetDevice(Recipes.ElementAt(i).RawMaterials.ElementAt(r).DeviceIp).StatusReset();//完成配料的设备运行状态地址写0
}
Recipes.ElementAt(i).IsEnable = true;
Recipes.ElementAt(i).Are.Set();


+ 7
- 2
DosingSystem/ViewModel/RecipeSettingsViewModel.cs 파일 보기

@@ -16,6 +16,7 @@ using BPASmartClient.CustomResource.UserControls.Model;
using BPASmartClient.CustomResource.UserControls.Enum;
using System.Windows.Media;
using BPASmartClient.CustomResource.UserControls.MessageShow;
using BPASmartClient.CustomResource.Pages.Model;

namespace BPASmartClient.DosingSystem.ViewModel
{
@@ -29,10 +30,12 @@ namespace BPASmartClient.DosingSystem.ViewModel
{
NewRecipeView nrv = new NewRecipeView();
nrv.ShowDialog();
MessageLog.GetInstance.ShowUserLog("新建配方");
});
SaveRecipe = new RelayCommand(() =>
{
Json<LocaPar>.Save();
MessageLog.GetInstance.ShowUserLog("保存配方");
NoticeDemoViewModel.OpenMsg(EnumPromptType.Success, App.MainWindow, "提示", $"配方保存成功!");
});
RemoveCommand = new RelayCommand<object>((o) =>
@@ -41,6 +44,7 @@ namespace BPASmartClient.DosingSystem.ViewModel
{
var res = Json<LocaPar>.Data.Recipes.FirstOrDefault(p => p.RecipCode == str);
if (res != null) Json<LocaPar>.Data.Recipes.Remove(res);
MessageLog.GetInstance.ShowUserLog($"删除名称——{res.RecipeName}");
}
});

@@ -50,9 +54,10 @@ namespace BPASmartClient.DosingSystem.ViewModel
{
ActionManage.GetInstance.CancelRegister("Details");
NewRecipeView nrv = new NewRecipeView();
ActionManage.GetInstance.Send("Details", Json<LocaPar>.Data.Recipes.FirstOrDefault(p => p.RecipCode == str));
var res = Json<LocaPar>.Data.Recipes.FirstOrDefault(p => p.RecipCode == str);
ActionManage.GetInstance.Send("Details",res);
nrv.ShowDialog();
MessageLog.GetInstance.ShowUserLog($"编辑配方名称——{res.RecipeName}");
}
});
}


+ 13
- 4
FryPot_DosingSystem/App.xaml.cs 파일 보기

@@ -70,6 +70,7 @@ namespace FryPot_DosingSystem
}
private void MenuInite()
{
NfcServer.GetInstance.Init();
#region 配方管理菜单
ObservableCollection<SubMenumodel> RecipeManage = new ObservableCollection<SubMenumodel>();
RecipeManage.Add(new SubMenumodel()
@@ -214,10 +215,16 @@ namespace FryPot_DosingSystem
{
SubMenuName = "账号管理",
SubMenuPermission = new Permission[] { Permission.管理员 },
AssemblyName = "FryPot_DosingSystem",
ToggleWindowPath = "View.UserManageView"
AssemblyName = "BPASmartClient.CustomResource",
ToggleWindowPath = "Pages.View.UserManageView"
});
UserManager.Add(new SubMenumodel()
{
SubMenuName = "NFC登录设置",
SubMenuPermission = new Permission[] { Permission.管理员 },
AssemblyName = "BPASmartClient.CustomResource",
ToggleWindowPath = "Pages.View.NfcSetView"
});

MenuManage.GetInstance.menuModels.Add(new MenuModel()
{
MainMenuIcon = "&#xe66d;",
@@ -227,6 +234,7 @@ namespace FryPot_DosingSystem
subMenumodels = UserManager,
});
#endregion
#region 调试界面
ObservableCollection<SubMenumodel> DebugManage = new ObservableCollection<SubMenumodel>();
DebugManage.Add(new SubMenumodel()
{
@@ -234,7 +242,8 @@ namespace FryPot_DosingSystem
SubMenuPermission = new Permission[] { Permission.管理员, Permission.技术员 },
AssemblyName = "FryPot_DosingSystem",
ToggleWindowPath = "View.DebugView"
});
});
#endregion
MenuManage.GetInstance.menuModels.Add(new MenuModel()
{
MainMenuIcon = "&#xe683;",


+ 1
- 0
FryPot_DosingSystem/Control/DeviceOperate.cs 파일 보기

@@ -92,6 +92,7 @@ namespace FryPot_DosingSystem.Control
Port = devices.Devices[0].Port;
DeviceName = devices.Devices[0].DeviceName;
Task.Run(() => { modbus.ModbusTcpConnect(Ip, Convert.ToInt32(Port)); });
// Task.Run(() => { modbus.ModbusTcpConnect(Ip, Convert.ToInt32(Port)); App.Current.Dispatcher.Invoke(new Action(() => { BPASmartClient.CustomResource.Pages.Model.MessageLog.GetInstance.RunLog("PLC连接成功"); })); });
}
}
}


+ 466
- 72
FryPot_DosingSystem/Control/DosingLogicControl.cs 파일 보기

@@ -19,6 +19,9 @@ using System.Windows.Media;
using System.Windows;
using FryPot_DosingSystem.AGV;
using FryPot_DosingSystem.FryPotStatus;
using System.IO;
using System.Runtime.Serialization.Formatters.Binary;
using System.Diagnostics;

namespace FryPot_DosingSystem.Control
{
@@ -104,6 +107,11 @@ namespace FryPot_DosingSystem.Control
bool ErrorRecipe;//线体1错误配方标识
bool LTwoErrorRecipe;//线体2错误配方标识
bool LThreeErrorRecipe;//线体3错误配方标识
string fryOneRecipe = string.Empty;
string fryTwoRecipe = string.Empty;
string fryThreeRecipe = string.Empty;
string fryFourRecipe = string.Empty;
string fryFiveRecipe = string.Empty;
#endregion
#region agv临时变量
//bool agvArriveUpLoad = false;//agv是否到达线体1上料位置
@@ -246,6 +254,7 @@ namespace FryPot_DosingSystem.Control
//fryFive = new PotFiveStatus();
hardWareStatusModel = HardWareStatusViewModel.GetInstance;
DateTimeJudge();
FileRegClean();
ActionManage.GetInstance.Register(new Action<object[]>(RecipeDataParse), "RecipeSetDown");
//ActionManage.GetInstance.Register(new Action(() => { RecipeQuene.Clear(); InputMaterialQuene.Clear(); OutputMaterialQuene.Clear(); LTwoInputMaterialQuene.Clear(); LTwoOutputMaterialQuene.Clear(); LThreeInputMaterialQuene.Clear(); LThreeOutputMaterialQuene.Clear(); }), "ClearRecipes");
ActionManage.GetInstance.Register(new Action(() => { RecipeQuene.Clear(); InputMaterialQuene.Clear(); OutputMaterialQuene.Clear(); }), "ClearOneRecipes");
@@ -260,59 +269,221 @@ namespace FryPot_DosingSystem.Control
HubHelper.GetInstance.Upstreamrequest = new Action<object>(AgvFeedBackUpReportDataAnalysis);
// ResetProgram();
ReadPlcData();
SaveFryPotData();
MainTask();
CommandRegist();
}
/// <summary>
/// 时间判断,数据处
/// 文件数据定期清
/// </summary>
private void DateTimeJudge()
/// <exception cref="NotImplementedException"></exception>
private void FileRegClean()
{
if (Sqlite<PotOneStatus>.GetInstance.GetData().Count > 0)
string[] filesOne = Directory.GetFiles("AccessFile//DB//炒锅1状态数据");
if (filesOne.Count() > 0)
{

}
string[] filesTwo = Directory.GetFiles("AccessFile//DB//炒锅2状态数据");
if (filesTwo.Count() > 0)
{

}
string[] filesThree = Directory.GetFiles("AccessFile//DB//炒锅3状态数据");
if (filesThree.Count() > 0)
{

}
string[] filesFour = Directory.GetFiles("AccessFile//DB//炒锅4状态数据");
if (filesFour.Count() > 0)
{

}
string[] filesFive = Directory.GetDirectories("AccessFile//DB//炒锅5状态数据");
if (filesFive.Count() > 0)
{
string time1 = Sqlite<PotOneStatus>.GetInstance.GetData().Last().Time;
if (time1.Equals(DateTime.Now.ToShortDateString()))//和当天时间一样
foreach (var item in filesFive)
{
FryPotMonitorManage.GetInstance.fryOne.TotalOilCapactiy = Sqlite<PotOneStatus>.GetInstance.GetData().Last().TotalOilCapactiy;
FryPotMonitorManage.GetInstance.fryOne.TotalProduct = Sqlite<PotOneStatus>.GetInstance.GetData().Last().TotalProduct;
FileInfo info = new FileInfo(item);
DateTime createTime = info.CreationTime;
DateTime timeNow = DateTime.Now;
if (TimeDiff(timeNow, createTime) != 0 && TimeDiff(timeNow, createTime) > 30)
{
Directory.Delete(item);
}
}
}
if (Sqlite<PotTwoStatus>.GetInstance.GetData().Count > 0)
}
/// <summary>
/// 时间差计算
/// </summary>
/// <param name="t">当前时间</param>
/// <param name="t2">创建时间</param>
/// <returns></returns>
private int TimeDiff(DateTime t, DateTime t2)
{
long lReturn = -1;
System.TimeSpan NowValue = new TimeSpan(t.Ticks);
System.TimeSpan TimeValue = new TimeSpan(t2.Ticks);
System.TimeSpan DateDiff = TimeSpan.Zero;
try
{
//计算时间差
//DateDiff = TimeValue.Subtract(NowValue).Duration();
DateDiff = NowValue.Subtract(TimeValue);
int h= DateDiff.Hours;
int m= DateDiff.Minutes;
return DateDiff.Days;
}
catch
{
return -1;
}
}
/// <summary>
/// 炒锅数据实时保存
/// </summary>
/// <exception cref="NotImplementedException"></exception>
private void SaveFryPotData()
{
Task.Run(new Action(() =>
{
string time2 = Sqlite<PotTwoStatus>.GetInstance.GetData().Last().Time;
if (time2.Equals(DateTime.Now.ToShortDateString()))//和当天时间一样
while (true)
{
FryPotMonitorManage.GetInstance.fryTwo.TotalOilCapactiy = Sqlite<PotTwoStatus>.GetInstance.GetData().Last().TotalOilCapactiy;
FryPotMonitorManage.GetInstance.fryTwo.TotalProduct = Sqlite<PotTwoStatus>.GetInstance.GetData().Last().TotalProduct;
FryPotDataSaveToBinaryFile(); Thread.Sleep(1000);
}
}));
}

/// <summary>
/// 时间判断,数据处理
/// </summary>
private void DateTimeJudge()
{
#region sqlite数据库保存
//if (Sqlite<PotOneStatus>.GetInstance.GetData().Count > 0)
//{
// string time1 = Sqlite<PotOneStatus>.GetInstance.GetData().Last().Time;
// if (time1.Equals(DateTime.Now.ToShortDateString()))//和当天时间一样
// {
// FryPotMonitorManage.GetInstance.fryOne.TotalOilCapactiy = Sqlite<PotOneStatus>.GetInstance.GetData().Last().TotalOilCapactiy;
// FryPotMonitorManage.GetInstance.fryOne.TotalProduct = Sqlite<PotOneStatus>.GetInstance.GetData().Last().TotalProduct;
// }
//}
//if (Sqlite<PotTwoStatus>.GetInstance.GetData().Count > 0)
//{
// string time2 = Sqlite<PotTwoStatus>.GetInstance.GetData().Last().Time;
// if (time2.Equals(DateTime.Now.ToShortDateString()))//和当天时间一样
// {
// FryPotMonitorManage.GetInstance.fryTwo.TotalOilCapactiy = Sqlite<PotTwoStatus>.GetInstance.GetData().Last().TotalOilCapactiy;
// FryPotMonitorManage.GetInstance.fryTwo.TotalProduct = Sqlite<PotTwoStatus>.GetInstance.GetData().Last().TotalProduct;
// }
//}
//if (Sqlite<PotThreeStatus>.GetInstance.GetData().Count > 0)
//{
// string time3 = Sqlite<PotThreeStatus>.GetInstance.GetData().Last().Time;
// if (time3.Equals(DateTime.Now.ToShortDateString()))//和当天时间一样
// {
// FryPotMonitorManage.GetInstance.fryThree.TotalOilCapactiy = Sqlite<PotThreeStatus>.GetInstance.GetData().Last().TotalOilCapactiy;
// FryPotMonitorManage.GetInstance.fryThree.TotalProduct = Sqlite<PotThreeStatus>.GetInstance.GetData().Last().TotalProduct;
// }
//}
//if (Sqlite<PotFourStatus>.GetInstance.GetData().Count > 0)
//{
// string time4 = Sqlite<PotFourStatus>.GetInstance.GetData().Last().Time;
// if (time4.Equals(DateTime.Now.ToShortDateString()))//和当天时间一样
// {
// FryPotMonitorManage.GetInstance.fryFour.TotalOilCapactiy = Sqlite<PotFourStatus>.GetInstance.GetData().Last().TotalOilCapactiy;
// FryPotMonitorManage.GetInstance.fryFour.TotalProduct = Sqlite<PotFourStatus>.GetInstance.GetData().Last().TotalProduct;
// }
//}

//if (Sqlite<PotFiveStatus>.GetInstance.GetData().Count > 0)
//{
// string time5 = Sqlite<PotFiveStatus>.GetInstance.GetData().Last().Time;
// if (time5.Equals(DateTime.Now.ToShortDateString()))//和当天时间一样
// {
// FryPotMonitorManage.GetInstance.fryFive.TotalOilCapactiy = Sqlite<PotFiveStatus>.GetInstance.GetData().Last().TotalOilCapactiy;
// FryPotMonitorManage.GetInstance.fryFive.TotalProduct = Sqlite<PotFiveStatus>.GetInstance.GetData().Last().TotalProduct;
// }
//}
#endregion
string p1 = "AccessFile//" + "Statistic//" + "FryOne.txt";
string p2 = "AccessFile//" + "Statistic//" + "FryTwo.txt";
string p3 = "AccessFile//" + "Statistic//" + "FryThree.txt";
string p4 = "AccessFile//" + "Statistic//" + "FryFour.txt";
string p5 = "AccessFile//" + "Statistic//" + "FryFive.txt";
if (!Directory.Exists("AccessFile//" + "Statistic"))
Directory.CreateDirectory("AccessFile//" + "Statistic");
if (File.Exists(p1))
{
using (StreamReader sReader = new StreamReader(p1, Encoding.UTF8))
{
string time = sReader.ReadLine();
string statistic = sReader.ReadLine();
if (DateTime.Now.ToShortDateString() == time)
{
FryPotMonitorManage.GetInstance.fryOne.TotalProduct = Convert.ToInt32(statistic.Split('/')[0]);
FryPotMonitorManage.GetInstance.fryOne.TotalOilCapactiy = Convert.ToDouble(statistic.Split('/')[1]);

}
}
}
if (Sqlite<PotThreeStatus>.GetInstance.GetData().Count > 0)
if (File.Exists(p2))
{
string time3 = Sqlite<PotThreeStatus>.GetInstance.GetData().Last().Time;
if (time3.Equals(DateTime.Now.ToShortDateString()))//和当天时间一样
using (StreamReader sReader = new StreamReader(p2, Encoding.UTF8))
{
FryPotMonitorManage.GetInstance.fryThree.TotalOilCapactiy = Sqlite<PotThreeStatus>.GetInstance.GetData().Last().TotalOilCapactiy;
FryPotMonitorManage.GetInstance.fryThree.TotalProduct = Sqlite<PotThreeStatus>.GetInstance.GetData().Last().TotalProduct;
string time = sReader.ReadLine();
string statistic = sReader.ReadLine();
if (DateTime.Now.ToShortDateString() == time)
{
FryPotMonitorManage.GetInstance.fryTwo.TotalProduct = Convert.ToInt32(statistic.Split('/')[0]);
FryPotMonitorManage.GetInstance.fryTwo.TotalOilCapactiy = Convert.ToDouble(statistic.Split('/')[1]);

}
}
}
if (Sqlite<PotFourStatus>.GetInstance.GetData().Count > 0)
if (File.Exists(p3))
{
string time4 = Sqlite<PotFourStatus>.GetInstance.GetData().Last().Time;
if (time4.Equals(DateTime.Now.ToShortDateString()))//和当天时间一样
using (StreamReader sReader = new StreamReader(p3, Encoding.UTF8))
{
FryPotMonitorManage.GetInstance.fryFour.TotalOilCapactiy = Sqlite<PotFourStatus>.GetInstance.GetData().Last().TotalOilCapactiy;
FryPotMonitorManage.GetInstance.fryFour.TotalProduct = Sqlite<PotFourStatus>.GetInstance.GetData().Last().TotalProduct;
string time = sReader.ReadLine();
string statistic = sReader.ReadLine();
if (DateTime.Now.ToShortDateString() == time)
{
FryPotMonitorManage.GetInstance.fryThree.TotalProduct = Convert.ToInt32(statistic.Split('/')[0]);
FryPotMonitorManage.GetInstance.fryThree.TotalOilCapactiy = Convert.ToDouble(statistic.Split('/')[1]);

}
}
}
if (File.Exists(p4))
{
using (StreamReader sReader = new StreamReader(p4, Encoding.UTF8))
{
string time = sReader.ReadLine();
string statistic = sReader.ReadLine();
if (DateTime.Now.ToShortDateString() == time)
{
FryPotMonitorManage.GetInstance.fryFour.TotalProduct = Convert.ToInt32(statistic.Split('/')[0]);
FryPotMonitorManage.GetInstance.fryFour.TotalOilCapactiy = Convert.ToDouble(statistic.Split('/')[1]);

if (Sqlite<PotFiveStatus>.GetInstance.GetData().Count > 0)
}
}
}
if (File.Exists(p5))
{
string time5 = Sqlite<PotFiveStatus>.GetInstance.GetData().Last().Time;
if (time5.Equals(DateTime.Now.ToShortDateString()))//和当天时间一样
using (StreamReader sReader = new StreamReader(p5, Encoding.UTF8))
{
FryPotMonitorManage.GetInstance.fryFive.TotalOilCapactiy = Sqlite<PotFiveStatus>.GetInstance.GetData().Last().TotalOilCapactiy;
FryPotMonitorManage.GetInstance.fryFive.TotalProduct = Sqlite<PotFiveStatus>.GetInstance.GetData().Last().TotalProduct;
}
string time = sReader.ReadLine();
string statistic = sReader.ReadLine();
if (DateTime.Now.ToShortDateString() == time)
{
FryPotMonitorManage.GetInstance.fryFive.TotalProduct = Convert.ToInt32(statistic.Split('/')[0]);
FryPotMonitorManage.GetInstance.fryFive.TotalOilCapactiy = Convert.ToDouble(statistic.Split('/')[1]);

}
}
}
}

@@ -860,10 +1031,7 @@ namespace FryPot_DosingSystem.Control
}
//炒锅状态实时显示
FryPotStatusDisplay();

RollerLineStatusDisplay();

Thread.Sleep(10);
}), "MainViewReadPlcData");

@@ -911,8 +1079,201 @@ namespace FryPot_DosingSystem.Control
FryPotInfoManage.GetInstance.variableInfos.FirstOrDefault(p => p.VarName == "FryPotFiveTotalOil").CurrentValue = FryPotMonitorManage.GetInstance.fryFive.TotalOilCapactiy.ToString();
FryPotInfoManage.GetInstance.variableInfos.FirstOrDefault(p => p.VarName == "FryPotFiveTotalProduct").CurrentValue = FryPotMonitorManage.GetInstance.fryFive.TotalProduct.ToString();

//FryPotMonitorManage.GetInstance.fryFive.Temperature = 10;
//FryPotMonitorManage.GetInstance.fryFive.HotPower = "9";
//FryPotMonitorManage.GetInstance.fryFive.Speed = 8;
//FryPotMonitorManage.GetInstance.fryFive.FryPotWeight=7;
//FryPotMonitorManage.GetInstance.fryFive.OilCapacity = 6;
//FryPotMonitorManage.GetInstance.fryFive.TotalOilCapactiy = 5;
//FryPotMonitorManage.GetInstance.fryFive.TotalProduct = 4;
}
/// <summary>
/// 炒锅状态数据保存到二进制文件
/// </summary>
public void FryPotDataSaveToBinaryFile()
{

#region 炒锅1状态数据保存
if (!Directory.Exists("AccessFile\\" + "DB" + "炒锅1状态数据"))
{
Directory.CreateDirectory("AccessFile\\" + "DB\\" + "炒锅1状态数据");
if (!Directory.Exists("AccessFile\\" + "DB" + "炒锅1状态数据\\" + DateTime.Now.ToShortDateString()))
Directory.CreateDirectory("AccessFile\\" + "DB\\" + "炒锅1状态数据\\" + DateTime.Now.ToShortDateString());

if (globalVar.LOneFryPotSerial == 1 && fryOneRecipe != string.Empty)
{
using (FileStream writeStream = new FileStream("AccessFile\\" + "DB\\" + "炒锅1状态数据\\" + DateTime.Now.ToShortDateString() + "\\" + DateTime.Now.ToString("hh:mm").Replace(':', '.') + fryOneRecipe + ".bin", FileMode.OpenOrCreate, FileAccess.Write))
{
writeStream.Position = writeStream.Length;
PotOneStatus p1 = new PotOneStatus { Temperature = FryPotMonitorManage.GetInstance.fryOne.Temperature, HotPower = FryPotMonitorManage.GetInstance.fryOne.HotPower, Speed = FryPotMonitorManage.GetInstance.fryOne.Speed, FryPotWeight = FryPotMonitorManage.GetInstance.fryOne.FryPotWeight, OilCapacity = FryPotMonitorManage.GetInstance.fryOne.OilCapacity, TotalOilCapactiy = FryPotMonitorManage.GetInstance.fryOne.TotalOilCapactiy, TotalProduct = FryPotMonitorManage.GetInstance.fryOne.TotalProduct, RecipeName = fryOneRecipe, Time = DateTime.Now.ToShortDateString() };
BinaryFormatter bf = new BinaryFormatter();
bf.Serialize(writeStream, p1);

}
}
}
else
{
if (!Directory.Exists("AccessFile\\" + "DB" + "炒锅1状态数据\\" + DateTime.Now.ToShortDateString()))
Directory.CreateDirectory("AccessFile\\" + "DB\\" + "炒锅1状态数据\\" + DateTime.Now.ToShortDateString());
if (globalVar.LOneFryPotSerial == 1 && fryOneRecipe != string.Empty)
{
using (FileStream writeStream = new FileStream("AccessFile\\" + "DB\\" + "炒锅1状态数据\\" + DateTime.Now.ToShortDateString() + "\\" + DateTime.Now.ToString("hh:mm").Replace(':', '.') + fryOneRecipe + ".bin", FileMode.OpenOrCreate, FileAccess.Write))
{
writeStream.Position = writeStream.Length;
PotOneStatus p1 = new PotOneStatus { Temperature = FryPotMonitorManage.GetInstance.fryOne.Temperature, HotPower = FryPotMonitorManage.GetInstance.fryOne.HotPower, Speed = FryPotMonitorManage.GetInstance.fryOne.Speed, FryPotWeight = FryPotMonitorManage.GetInstance.fryOne.FryPotWeight, OilCapacity = FryPotMonitorManage.GetInstance.fryOne.OilCapacity, TotalOilCapactiy = FryPotMonitorManage.GetInstance.fryOne.TotalOilCapactiy, TotalProduct = FryPotMonitorManage.GetInstance.fryOne.TotalProduct, RecipeName = fryOneRecipe, Time = DateTime.Now.ToShortDateString() };
BinaryFormatter bf = new BinaryFormatter();
bf.Serialize(writeStream, p1);

}
}
}
#endregion
#region 炒锅2状态数据保存
if (!Directory.Exists("AccessFile\\" + "DB" + "炒锅2状态数据"))
{
Directory.CreateDirectory("AccessFile\\" + "DB\\" + "炒锅2状态数据");
if (!Directory.Exists("AccessFile\\" + "DB" + "炒锅2状态数据\\" + DateTime.Now.ToShortDateString()))
Directory.CreateDirectory("AccessFile\\" + "DB\\" + "炒锅2状态数据\\" + DateTime.Now.ToShortDateString());

if (globalVar.LTwoFryPotSerial == 2 && fryTwoRecipe != string.Empty)
{
using (FileStream writeStream = new FileStream("AccessFile\\" + "DB\\" + "炒锅2状态数据\\" + DateTime.Now.ToShortDateString() + "\\" + DateTime.Now.ToString("hh:mm").Replace(':', '.') + fryTwoRecipe + ".bin", FileMode.OpenOrCreate, FileAccess.Write))
{

PotTwoStatus p1 = new PotTwoStatus { Temperature = FryPotMonitorManage.GetInstance.fryTwo.Temperature, HotPower = FryPotMonitorManage.GetInstance.fryTwo.HotPower, Speed = FryPotMonitorManage.GetInstance.fryTwo.Speed, FryPotWeight = FryPotMonitorManage.GetInstance.fryTwo.FryPotWeight, OilCapacity = FryPotMonitorManage.GetInstance.fryTwo.OilCapacity, TotalOilCapactiy = FryPotMonitorManage.GetInstance.fryTwo.TotalOilCapactiy, TotalProduct = FryPotMonitorManage.GetInstance.fryTwo.TotalProduct, RecipeName = fryTwoRecipe, Time = DateTime.Now.ToShortDateString() };
BinaryFormatter bf = new BinaryFormatter();
bf.Serialize(writeStream, p1);

}
}
}
else
{
if (!Directory.Exists("AccessFile\\" + "DB" + "炒锅2状态数据\\" + DateTime.Now.ToShortDateString()))
Directory.CreateDirectory("AccessFile\\" + "DB\\" + "炒锅2状态数据\\" + DateTime.Now.ToShortDateString());
if (globalVar.LTwoFryPotSerial == 2 && fryTwoRecipe != string.Empty)
{
using (FileStream writeStream = new FileStream("AccessFile\\" + "DB\\" + "炒锅2状态数据\\" + DateTime.Now.ToShortDateString() + "\\" + DateTime.Now.ToString("hh:mm").Replace(':', '.') + fryTwoRecipe + ".bin", FileMode.OpenOrCreate, FileAccess.Write))
{

PotTwoStatus p1 = new PotTwoStatus { Temperature = FryPotMonitorManage.GetInstance.fryTwo.Temperature, HotPower = FryPotMonitorManage.GetInstance.fryTwo.HotPower, Speed = FryPotMonitorManage.GetInstance.fryTwo.Speed, FryPotWeight = FryPotMonitorManage.GetInstance.fryTwo.FryPotWeight, OilCapacity = FryPotMonitorManage.GetInstance.fryTwo.OilCapacity, TotalOilCapactiy = FryPotMonitorManage.GetInstance.fryTwo.TotalOilCapactiy, TotalProduct = FryPotMonitorManage.GetInstance.fryTwo.TotalProduct, RecipeName = fryTwoRecipe, Time = DateTime.Now.ToShortDateString() };
BinaryFormatter bf = new BinaryFormatter();
bf.Serialize(writeStream, p1);

}
}
}
#endregion
#region 炒锅3状态数据保存
if (!Directory.Exists("AccessFile\\" + "DB" + "炒锅3状态数据"))
{
Directory.CreateDirectory("AccessFile\\" + "DB\\" + "炒锅3状态数据");
if (!Directory.Exists("AccessFile\\" + "DB" + "炒锅3状态数据\\" + DateTime.Now.ToShortDateString()))
Directory.CreateDirectory("AccessFile\\" + "DB\\" + "炒锅3状态数据\\" + DateTime.Now.ToShortDateString());

if (globalVar.LThreeFryPotSerial == 3 && fryThreeRecipe != string.Empty)
{
using (FileStream writeStream = new FileStream("AccessFile\\" + "DB\\" + "炒锅3状态数据\\" + DateTime.Now.ToShortDateString() + "\\" + DateTime.Now.ToString("hh:mm").Replace(':', '.') + fryThreeRecipe + ".bin", FileMode.OpenOrCreate, FileAccess.Write))
{

PotThreeStatus p1 = new PotThreeStatus { Temperature = FryPotMonitorManage.GetInstance.fryThree.Temperature, HotPower = FryPotMonitorManage.GetInstance.fryThree.HotPower, Speed = FryPotMonitorManage.GetInstance.fryThree.Speed, FryPotWeight = FryPotMonitorManage.GetInstance.fryThree.FryPotWeight, OilCapacity = FryPotMonitorManage.GetInstance.fryThree.OilCapacity, TotalOilCapactiy = FryPotMonitorManage.GetInstance.fryThree.TotalOilCapactiy, TotalProduct = FryPotMonitorManage.GetInstance.fryThree.TotalProduct, RecipeName = fryThreeRecipe, Time = DateTime.Now.ToShortDateString() };
BinaryFormatter bf = new BinaryFormatter();
bf.Serialize(writeStream, p1);

}
}
}
else
{
if (!Directory.Exists("AccessFile\\" + "DB" + "炒锅3状态数据\\" + DateTime.Now.ToShortDateString()))
Directory.CreateDirectory("AccessFile\\" + "DB\\" + "炒锅3状态数据\\" + DateTime.Now.ToShortDateString());
if (globalVar.LThreeFryPotSerial == 3 && fryThreeRecipe != string.Empty)
{
using (FileStream writeStream = new FileStream("AccessFile\\" + "DB\\" + "炒锅3状态数据\\" + DateTime.Now.ToShortDateString() + "\\" + DateTime.Now.ToString("hh:mm").Replace(':', '.') + fryThreeRecipe + ".bin", FileMode.OpenOrCreate, FileAccess.Write))
{

PotThreeStatus p1 = new PotThreeStatus { Temperature = FryPotMonitorManage.GetInstance.fryThree.Temperature, HotPower = FryPotMonitorManage.GetInstance.fryThree.HotPower, Speed = FryPotMonitorManage.GetInstance.fryThree.Speed, FryPotWeight = FryPotMonitorManage.GetInstance.fryThree.FryPotWeight, OilCapacity = FryPotMonitorManage.GetInstance.fryThree.OilCapacity, TotalOilCapactiy = FryPotMonitorManage.GetInstance.fryThree.TotalOilCapactiy, TotalProduct = FryPotMonitorManage.GetInstance.fryThree.TotalProduct, RecipeName = fryThreeRecipe, Time = DateTime.Now.ToShortDateString() };
BinaryFormatter bf = new BinaryFormatter();
bf.Serialize(writeStream, p1);

}
}
}
#endregion
#region 炒锅4状态数据保存
if (!Directory.Exists("AccessFile\\" + "DB" + "炒锅4状态数据"))
{
Directory.CreateDirectory("AccessFile\\" + "DB\\" + "炒锅4状态数据");
if (!Directory.Exists("AccessFile\\" + "DB" + "炒锅4状态数据\\" + DateTime.Now.ToShortDateString()))
Directory.CreateDirectory("AccessFile\\" + "DB\\" + "炒锅4状态数据\\" + DateTime.Now.ToShortDateString());

if (globalVar.LOneFryPotSerial == 4 && fryFourRecipe != string.Empty)
{
using (FileStream writeStream = new FileStream("AccessFile\\" + "DB\\" + "炒锅4状态数据\\" + DateTime.Now.ToShortDateString() + "\\" + DateTime.Now.ToString("hh:mm").Replace(':', '.') + fryFourRecipe + ".bin", FileMode.OpenOrCreate, FileAccess.Write))
{
writeStream.Position = writeStream.Length;
PotFourStatus p1 = new PotFourStatus { Temperature = FryPotMonitorManage.GetInstance.fryFour.Temperature, HotPower = FryPotMonitorManage.GetInstance.fryFour.HotPower, Speed = FryPotMonitorManage.GetInstance.fryFour.Speed, FryPotWeight = FryPotMonitorManage.GetInstance.fryFour.FryPotWeight, OilCapacity = FryPotMonitorManage.GetInstance.fryFour.OilCapacity, TotalOilCapactiy = FryPotMonitorManage.GetInstance.fryFour.TotalOilCapactiy, TotalProduct = FryPotMonitorManage.GetInstance.fryFour.TotalProduct, RecipeName = fryFourRecipe, Time = DateTime.Now.ToShortDateString() };
BinaryFormatter bf = new BinaryFormatter();
bf.Serialize(writeStream, p1);

}
}
}
else
{
if (!Directory.Exists("AccessFile\\" + "DB" + "炒锅4状态数据\\" + DateTime.Now.ToShortDateString()))
Directory.CreateDirectory("AccessFile\\" + "DB\\" + "炒锅4状态数据\\" + DateTime.Now.ToShortDateString());
if (globalVar.LOneFryPotSerial == 4 && fryFourRecipe != string.Empty)
{
using (FileStream writeStream = new FileStream("AccessFile\\" + "DB\\" + "炒锅4状态数据\\" + DateTime.Now.ToShortDateString() + "\\" + DateTime.Now.ToString("hh:mm").Replace(':', '.') + fryFourRecipe + ".bin", FileMode.OpenOrCreate, FileAccess.Write))
{
writeStream.Position = writeStream.Length;
PotFourStatus p1 = new PotFourStatus { Temperature = FryPotMonitorManage.GetInstance.fryFour.Temperature, HotPower = FryPotMonitorManage.GetInstance.fryFour.HotPower, Speed = FryPotMonitorManage.GetInstance.fryFour.Speed, FryPotWeight = FryPotMonitorManage.GetInstance.fryFour.FryPotWeight, OilCapacity = FryPotMonitorManage.GetInstance.fryFour.OilCapacity, TotalOilCapactiy = FryPotMonitorManage.GetInstance.fryFour.TotalOilCapactiy, TotalProduct = FryPotMonitorManage.GetInstance.fryFour.TotalProduct, RecipeName = fryFourRecipe, Time = DateTime.Now.ToShortDateString() };
BinaryFormatter bf = new BinaryFormatter();
bf.Serialize(writeStream, p1);

}
}
}
#endregion
#region 炒锅5状态数据保存
if (!Directory.Exists("AccessFile\\" + "DB" + "炒锅5状态数据"))
{
Directory.CreateDirectory("AccessFile\\" + "DB\\" + "炒锅5状态数据");
if (!Directory.Exists("AccessFile\\" + "DB" + "炒锅5状态数据\\" + DateTime.Now.ToShortDateString()))
Directory.CreateDirectory("AccessFile\\" + "DB\\" + "炒锅5状态数据\\" + DateTime.Now.ToShortDateString());

if (globalVar.LTwoFryPotSerial == 5 && fryFiveRecipe != string.Empty)
{
using (FileStream writeStream = new FileStream("AccessFile\\" + "DB\\" + "炒锅5状态数据\\" + DateTime.Now.ToShortDateString() + "\\" + DateTime.Now.ToString("hh:mm").Replace(':', '.') + fryFiveRecipe + ".bin", FileMode.OpenOrCreate, FileAccess.Write))
{
writeStream.Position = writeStream.Length;
PotFiveStatus p1 = new PotFiveStatus { Temperature = FryPotMonitorManage.GetInstance.fryFive.Temperature, HotPower = FryPotMonitorManage.GetInstance.fryFive.HotPower, Speed = FryPotMonitorManage.GetInstance.fryFive.Speed, FryPotWeight = FryPotMonitorManage.GetInstance.fryFive.FryPotWeight, OilCapacity = FryPotMonitorManage.GetInstance.fryFive.OilCapacity, TotalOilCapactiy = FryPotMonitorManage.GetInstance.fryFive.TotalOilCapactiy, TotalProduct = FryPotMonitorManage.GetInstance.fryFive.TotalProduct, RecipeName = fryFiveRecipe, Time = DateTime.Now.ToShortDateString() };
BinaryFormatter bf = new BinaryFormatter();
bf.Serialize(writeStream, p1);

}
}
}
else
{
if (!Directory.Exists("AccessFile\\" + "DB" + "炒锅5状态数据\\" + DateTime.Now.ToShortDateString()))
Directory.CreateDirectory("AccessFile\\" + "DB\\" + "炒锅5状态数据\\" + DateTime.Now.ToShortDateString());
if (globalVar.LTwoFryPotSerial == 5 && fryFiveRecipe != string.Empty)
{
using (FileStream writeStream = new FileStream("AccessFile\\" + "DB\\" + "炒锅5状态数据\\" + DateTime.Now.ToShortDateString() + "\\" + DateTime.Now.ToString("hh:mm").Replace(':', '.') + fryFiveRecipe + ".bin", FileMode.OpenOrCreate, FileAccess.Write))
{
writeStream.Position = writeStream.Length;
PotFiveStatus p1 = new PotFiveStatus { Temperature = FryPotMonitorManage.GetInstance.fryFive.Temperature, HotPower = FryPotMonitorManage.GetInstance.fryFive.HotPower, Speed = FryPotMonitorManage.GetInstance.fryFive.Speed, FryPotWeight = FryPotMonitorManage.GetInstance.fryFive.FryPotWeight, OilCapacity = FryPotMonitorManage.GetInstance.fryFive.OilCapacity, TotalOilCapactiy = FryPotMonitorManage.GetInstance.fryFive.TotalOilCapactiy, TotalProduct = FryPotMonitorManage.GetInstance.fryFive.TotalProduct, RecipeName = fryFiveRecipe, Time = DateTime.Now.ToShortDateString() };
BinaryFormatter bf = new BinaryFormatter();
bf.Serialize(writeStream, p1);

}
}
}
#endregion
}
/// <summary>
/// 滚筒线运行状态显示
/// </summary>
@@ -1156,13 +1517,19 @@ namespace FryPot_DosingSystem.Control
if (globalVar.LThreeCurrentRecipeName != string.Empty)
{
MessageLog.GetInstance.ShowUserLog($"【3】号滚筒线【{globalVar.LThreeCurrentRecipeName}】 配方制作完成");
globalVar.LThreeCurrentRecipeName = string.Empty;
if (globalVar.LThreeFryPotSerial == 3)
{
FryPotMonitorManage.GetInstance.fryThree.TotalProduct++;
Sqlite<PotThreeStatus>.GetInstance.Base.Add(new PotThreeStatus { Temperature = FryPotMonitorManage.GetInstance.fryThree.Temperature, HotPower = FryPotMonitorManage.GetInstance.fryThree.HotPower, Speed = FryPotMonitorManage.GetInstance.fryThree.Speed, FryPotWeight = FryPotMonitorManage.GetInstance.fryThree.FryPotWeight, OilCapacity = FryPotMonitorManage.GetInstance.fryThree.OilCapacity, TotalOilCapactiy = FryPotMonitorManage.GetInstance.fryThree.TotalOilCapactiy, TotalProduct = FryPotMonitorManage.GetInstance.fryThree.TotalProduct, Time = DateTime.Now.ToShortDateString() });//向表中新增数据
Sqlite<PotThreeStatus>.GetInstance.Save();//保存数据
using (StreamWriter txtWriter = new StreamWriter("AccessFile//" + "Statistic//" + "FryThree.txt", false, Encoding.UTF8))
{
txtWriter.WriteLine(DateTime.Now.ToShortDateString());
txtWriter.WriteLine(FryPotMonitorManage.GetInstance.fryThree.TotalProduct + "/" + FryPotMonitorManage.GetInstance.fryThree.TotalOilCapactiy);//炒锅1产量以及总油量记录
}
//Sqlite<PotThreeStatus>.GetInstance.Base.Add(new PotThreeStatus { Temperature = FryPotMonitorManage.GetInstance.fryThree.Temperature, HotPower = FryPotMonitorManage.GetInstance.fryThree.HotPower, Speed = FryPotMonitorManage.GetInstance.fryThree.Speed, FryPotWeight = FryPotMonitorManage.GetInstance.fryThree.FryPotWeight, OilCapacity = FryPotMonitorManage.GetInstance.fryThree.OilCapacity, TotalOilCapactiy = FryPotMonitorManage.GetInstance.fryThree.TotalOilCapactiy, TotalProduct = FryPotMonitorManage.GetInstance.fryThree.TotalProduct, Time = DateTime.Now.ToShortDateString() });//向表中新增数据
//Sqlite<PotThreeStatus>.GetInstance.Save();//保存数据
}
globalVar.LThreeCurrentRecipeName = string.Empty;
Task.Run(() => { Thread.Sleep(1500); fryThreeRecipe = string.Empty; });
}
}
if (LThreeRecipeQuene.Count > 0 && LThreeOutputMaterialQuene.Count == 0 && LThreeInputMaterialQuene.Count == 0)//后续添加其它限制条件
@@ -1179,12 +1546,14 @@ namespace FryPot_DosingSystem.Control
globalVar.LThreeMaterialNum = result.materialCollection.Count;
globalVar.LThreeFryPotSerial = headNum;
globalVar.LThreeCurrentRecipeName = result.RecipeName;

AgvViewModel.GetInstance().Set滚筒线上数量(3, globalVar.LThreeMaterialNum.ToString());
MessageLog.GetInstance.ShowUserLog($"【3】号滚筒线开始制作【{result.RecipeName}】 配方");
for (int i = 0; i < result.materialCollection.Count; i++) //遍历单个配方中所有物料
{
if (result.materialCollection[i].MaterialLoc % 100 == i + 1 && result.materialCollection[i].MaterialLoc / 100 == headNum && headNum == 3)
{
fryThreeRecipe = result.RecipeName;//炒锅状态开始记录
Application.Current.Dispatcher.Invoke(new Action(() => { AgvViewModel.GetInstance().wokModel_3.goodsName = result.RecipeName; }));
//将配方中原料加入新的队列
LThreeInputMaterialQuene.Enqueue(new MaterialInfo()
@@ -1221,19 +1590,30 @@ namespace FryPot_DosingSystem.Control
if (globalVar.LTwoCurrentRecipeName != string.Empty)
{
MessageLog.GetInstance.ShowUserLog($"【2】号滚筒线【{globalVar.LTwoCurrentRecipeName}】 配方制作完成");
globalVar.LTwoCurrentRecipeName = string.Empty;
if (globalVar.LTwoFryPotSerial == 2)
{
FryPotMonitorManage.GetInstance.fryTwo.TotalProduct++;
Sqlite<PotTwoStatus>.GetInstance.Base.Add(new PotTwoStatus { Temperature = FryPotMonitorManage.GetInstance.fryTwo.Temperature, HotPower = FryPotMonitorManage.GetInstance.fryTwo.HotPower, Speed = FryPotMonitorManage.GetInstance.fryTwo.Speed, FryPotWeight = FryPotMonitorManage.GetInstance.fryTwo.FryPotWeight, OilCapacity = FryPotMonitorManage.GetInstance.fryTwo.OilCapacity, TotalOilCapactiy = FryPotMonitorManage.GetInstance.fryTwo.TotalOilCapactiy, TotalProduct = FryPotMonitorManage.GetInstance.fryTwo.TotalProduct, Time = DateTime.Now.ToShortDateString() });//向表中新增数据
Sqlite<PotTwoStatus>.GetInstance.Save();//保存数据
using (StreamWriter txtWriter = new StreamWriter("AccessFile//" + "Statistic//" + "FryTwo.txt", false, Encoding.UTF8))
{
txtWriter.WriteLine(DateTime.Now.ToShortDateString());
txtWriter.WriteLine(FryPotMonitorManage.GetInstance.fryTwo.TotalProduct + "/" + FryPotMonitorManage.GetInstance.fryTwo.TotalOilCapactiy);//炒锅1产量以及总油量记录
}
//Sqlite<PotTwoStatus>.GetInstance.Base.Add(new PotTwoStatus { Temperature = FryPotMonitorManage.GetInstance.fryTwo.Temperature, HotPower = FryPotMonitorManage.GetInstance.fryTwo.HotPower, Speed = FryPotMonitorManage.GetInstance.fryTwo.Speed, FryPotWeight = FryPotMonitorManage.GetInstance.fryTwo.FryPotWeight, OilCapacity = FryPotMonitorManage.GetInstance.fryTwo.OilCapacity, TotalOilCapactiy = FryPotMonitorManage.GetInstance.fryTwo.TotalOilCapactiy, TotalProduct = FryPotMonitorManage.GetInstance.fryTwo.TotalProduct, Time = DateTime.Now.ToShortDateString() });//向表中新增数据
//Sqlite<PotTwoStatus>.GetInstance.Save();//保存数据
}
if (globalVar.LTwoFryPotSerial == 5)
{
FryPotMonitorManage.GetInstance.fryFive.TotalProduct++;
Sqlite<PotFiveStatus>.GetInstance.Base.Add(new PotFiveStatus { Temperature = FryPotMonitorManage.GetInstance.fryFive.Temperature, HotPower = FryPotMonitorManage.GetInstance.fryFive.HotPower, Speed = FryPotMonitorManage.GetInstance.fryFive.Speed, FryPotWeight = FryPotMonitorManage.GetInstance.fryFive.FryPotWeight, OilCapacity = FryPotMonitorManage.GetInstance.fryFive.OilCapacity, TotalOilCapactiy = FryPotMonitorManage.GetInstance.fryFive.TotalOilCapactiy, TotalProduct = FryPotMonitorManage.GetInstance.fryFive.TotalProduct, Time = DateTime.Now.ToShortDateString() });//向表中新增数据
Sqlite<PotFiveStatus>.GetInstance.Save();//保存数据
using (StreamWriter txtWriter = new StreamWriter("AccessFile//" + "Statistic//" + "FryFive.txt", false, Encoding.UTF8))
{
txtWriter.WriteLine(DateTime.Now.ToShortDateString());
txtWriter.WriteLine(FryPotMonitorManage.GetInstance.fryFive.TotalProduct + "/" + FryPotMonitorManage.GetInstance.fryFive.TotalOilCapactiy);//炒锅1产量以及总油量记录
}
//Sqlite<PotFiveStatus>.GetInstance.Base.Add(new PotFiveStatus { Temperature = FryPotMonitorManage.GetInstance.fryFive.Temperature, HotPower = FryPotMonitorManage.GetInstance.fryFive.HotPower, Speed = FryPotMonitorManage.GetInstance.fryFive.Speed, FryPotWeight = FryPotMonitorManage.GetInstance.fryFive.FryPotWeight, OilCapacity = FryPotMonitorManage.GetInstance.fryFive.OilCapacity, TotalOilCapactiy = FryPotMonitorManage.GetInstance.fryFive.TotalOilCapactiy, TotalProduct = FryPotMonitorManage.GetInstance.fryFive.TotalProduct, Time = DateTime.Now.ToShortDateString() });//向表中新增数据
//Sqlite<PotFiveStatus>.GetInstance.Save();//保存数据
}
globalVar.LTwoCurrentRecipeName = string.Empty;
Task.Run(() => { Thread.Sleep(2000); fryTwoRecipe = string.Empty; fryFiveRecipe = string.Empty; });
}
}

@@ -1268,10 +1648,12 @@ namespace FryPot_DosingSystem.Control
{
if (headNum == 1)//炒锅2
{
fryTwoRecipe = result.RecipeName;//炒锅状态开始记录
Application.Current.Dispatcher.Invoke(new Action(() => { AgvViewModel.GetInstance().wokModel_2.goodsName = result.RecipeName; }));
}
else//炒锅5
{
fryFiveRecipe = result.RecipeName;//炒锅状态开始记录
Application.Current.Dispatcher.Invoke(new Action(() => { AgvViewModel.GetInstance().wokModel_5.goodsName = result.RecipeName; }));
}
//将配方中原料加入新的队列
@@ -1309,20 +1691,30 @@ namespace FryPot_DosingSystem.Control
if (globalVar.LOneCurrentRecipeName != string.Empty)
{
MessageLog.GetInstance.ShowUserLog($"【1】号滚筒线【{globalVar.LOneCurrentRecipeName}】 配方制作完成");
globalVar.LOneCurrentRecipeName = string.Empty;
if (globalVar.LOneFryPotSerial == 1)
{
FryPotMonitorManage.GetInstance.fryOne.TotalProduct++;
Sqlite<PotOneStatus>.GetInstance.Base.Add(new PotOneStatus { Temperature = FryPotMonitorManage.GetInstance.fryOne.Temperature, HotPower = FryPotMonitorManage.GetInstance.fryOne.HotPower, Speed = FryPotMonitorManage.GetInstance.fryOne.Speed, FryPotWeight = FryPotMonitorManage.GetInstance.fryOne.FryPotWeight, OilCapacity = FryPotMonitorManage.GetInstance.fryOne.OilCapacity, TotalOilCapactiy = FryPotMonitorManage.GetInstance.fryOne.TotalOilCapactiy, TotalProduct = FryPotMonitorManage.GetInstance.fryOne.TotalProduct, Time = DateTime.Now.ToShortDateString() });//向表中新增数据
Sqlite<PotOneStatus>.GetInstance.Save();//保存数据
using (StreamWriter txtWriter = new StreamWriter("AccessFile//" + "Statistic//" + "FryOne.txt", false, Encoding.UTF8))
{
txtWriter.WriteLine(DateTime.Now.ToShortDateString());
txtWriter.WriteLine(FryPotMonitorManage.GetInstance.fryOne.TotalProduct + "/" + FryPotMonitorManage.GetInstance.fryOne.TotalOilCapactiy);//炒锅1产量以及总油量记录
}
//Sqlite<PotOneStatus>.GetInstance.Base.Add(new PotOneStatus { Temperature = FryPotMonitorManage.GetInstance.fryOne.Temperature, HotPower = FryPotMonitorManage.GetInstance.fryOne.HotPower, Speed = FryPotMonitorManage.GetInstance.fryOne.Speed, FryPotWeight = FryPotMonitorManage.GetInstance.fryOne.FryPotWeight, OilCapacity = FryPotMonitorManage.GetInstance.fryOne.OilCapacity, TotalOilCapactiy = FryPotMonitorManage.GetInstance.fryOne.TotalOilCapactiy, TotalProduct = FryPotMonitorManage.GetInstance.fryOne.TotalProduct, Time = DateTime.Now.ToShortDateString() });//向表中新增数据
//Sqlite<PotOneStatus>.GetInstance.Save();//保存数据
}
if (globalVar.LOneFryPotSerial == 4)
{
FryPotMonitorManage.GetInstance.fryFour.TotalProduct++;
Sqlite<PotFourStatus>.GetInstance.Base.Add(new PotFourStatus { Temperature = FryPotMonitorManage.GetInstance.fryFour.Temperature, HotPower = FryPotMonitorManage.GetInstance.fryFour.HotPower, Speed = FryPotMonitorManage.GetInstance.fryFour.Speed, FryPotWeight = FryPotMonitorManage.GetInstance.fryFour.FryPotWeight, OilCapacity = FryPotMonitorManage.GetInstance.fryFour.OilCapacity, TotalOilCapactiy = FryPotMonitorManage.GetInstance.fryFour.TotalOilCapactiy, TotalProduct = FryPotMonitorManage.GetInstance.fryFour.TotalProduct, Time = DateTime.Now.ToShortDateString() });//向表中新增数据
Sqlite<PotFourStatus>.GetInstance.Save();//保存数据
using (StreamWriter txtWriter = new StreamWriter("AccessFile//" + "Statistic//" + "FryFour.txt", false, Encoding.UTF8))
{
txtWriter.WriteLine(DateTime.Now.ToShortDateString());
txtWriter.WriteLine(FryPotMonitorManage.GetInstance.fryFour.TotalProduct + "/" + FryPotMonitorManage.GetInstance.fryFour.TotalOilCapactiy);//炒锅1产量以及总油量记录
}
//Sqlite<PotFourStatus>.GetInstance.Base.Add(new PotFourStatus { Temperature = FryPotMonitorManage.GetInstance.fryFour.Temperature, HotPower = FryPotMonitorManage.GetInstance.fryFour.HotPower, Speed = FryPotMonitorManage.GetInstance.fryFour.Speed, FryPotWeight = FryPotMonitorManage.GetInstance.fryFour.FryPotWeight, OilCapacity = FryPotMonitorManage.GetInstance.fryFour.OilCapacity, TotalOilCapactiy = FryPotMonitorManage.GetInstance.fryFour.TotalOilCapactiy, TotalProduct = FryPotMonitorManage.GetInstance.fryFour.TotalProduct, Time = DateTime.Now.ToShortDateString() });//向表中新增数据
//Sqlite<PotFourStatus>.GetInstance.Save();//保存数据
}

globalVar.LOneCurrentRecipeName = string.Empty;
Task.Run(() => { Thread.Sleep(1500); fryOneRecipe = string.Empty; fryFourRecipe = string.Empty; });
}
}
if (RecipeQuene.Count > 0 && OutputMaterialQuene.Count == 0 && InputMaterialQuene.Count == 0)//后续添加其它限制条件
@@ -1354,10 +1746,12 @@ namespace FryPot_DosingSystem.Control
{
if (headNum == 1)//炒锅1
{
fryOneRecipe = result.RecipeName;//炒锅状态开始记录
Application.Current.Dispatcher.Invoke(new Action(() => { AgvViewModel.GetInstance().wokModel_1.goodsName = result.RecipeName; }));
}
else//炒锅4
{
fryFourRecipe = result.RecipeName;//炒锅状态开始记录
Application.Current.Dispatcher.Invoke(new Action(() => { AgvViewModel.GetInstance().wokModel_4.goodsName = result.RecipeName; }));
}
//将配方中原料加入新的队列
@@ -1553,16 +1947,16 @@ namespace FryPot_DosingSystem.Control
{
if (!globalVar.InOrOutputLock && (globalVar.fryPotOne.InputMaterialArrivedSingle == 1 || globalVar.fryPotFour.InputMaterialArrivedSingle == 1) && globalVar.PotOneInputMaterialArrive && OutputMaterialQuene.Count > 0 && !globalVar.PotOneOutputRollerArrive)
{
if (globalVar.LOneFryPotSerial == 1)
{
Sqlite<PotOneStatus>.GetInstance.Base.Add(new PotOneStatus {Temperature= FryPotMonitorManage.GetInstance.fryOne.Temperature,HotPower= FryPotMonitorManage.GetInstance.fryOne.HotPower,Speed=FryPotMonitorManage.GetInstance.fryOne.Speed,FryPotWeight=FryPotMonitorManage.GetInstance.fryOne.FryPotWeight,OilCapacity=FryPotMonitorManage.GetInstance.fryOne.OilCapacity,TotalOilCapactiy=FryPotMonitorManage.GetInstance.fryOne.TotalOilCapactiy,TotalProduct=FryPotMonitorManage.GetInstance.fryOne.TotalProduct,Time=DateTime.Now.ToShortDateString() });//向表中新增数据
Sqlite<PotOneStatus>.GetInstance.Save();//保存数据
}
else
{
Sqlite<PotFourStatus>.GetInstance.Base.Add(new PotFourStatus { Temperature = FryPotMonitorManage.GetInstance.fryFour.Temperature, HotPower = FryPotMonitorManage.GetInstance.fryFour.HotPower, Speed = FryPotMonitorManage.GetInstance.fryFour.Speed, FryPotWeight = FryPotMonitorManage.GetInstance.fryFour.FryPotWeight, OilCapacity = FryPotMonitorManage.GetInstance.fryFour.OilCapacity, TotalOilCapactiy = FryPotMonitorManage.GetInstance.fryFour.TotalOilCapactiy, TotalProduct = FryPotMonitorManage.GetInstance.fryFour.TotalProduct, Time = DateTime.Now.ToShortDateString() });//向表中新增数据
Sqlite<PotFourStatus>.GetInstance.Save();//保存数据
}
//if (globalVar.LOneFryPotSerial == 1)
//{
// Sqlite<PotOneStatus>.GetInstance.Base.Add(new PotOneStatus { Temperature = FryPotMonitorManage.GetInstance.fryOne.Temperature, HotPower = FryPotMonitorManage.GetInstance.fryOne.HotPower, Speed = FryPotMonitorManage.GetInstance.fryOne.Speed, FryPotWeight = FryPotMonitorManage.GetInstance.fryOne.FryPotWeight, OilCapacity = FryPotMonitorManage.GetInstance.fryOne.OilCapacity, TotalOilCapactiy = FryPotMonitorManage.GetInstance.fryOne.TotalOilCapactiy, TotalProduct = FryPotMonitorManage.GetInstance.fryOne.TotalProduct, Time = DateTime.Now.ToShortDateString() });//向表中新增数据
// Sqlite<PotOneStatus>.GetInstance.Save();//保存数据
//}
//else
//{
// Sqlite<PotFourStatus>.GetInstance.Base.Add(new PotFourStatus { Temperature = FryPotMonitorManage.GetInstance.fryFour.Temperature, HotPower = FryPotMonitorManage.GetInstance.fryFour.HotPower, Speed = FryPotMonitorManage.GetInstance.fryFour.Speed, FryPotWeight = FryPotMonitorManage.GetInstance.fryFour.FryPotWeight, OilCapacity = FryPotMonitorManage.GetInstance.fryFour.OilCapacity, TotalOilCapactiy = FryPotMonitorManage.GetInstance.fryFour.TotalOilCapactiy, TotalProduct = FryPotMonitorManage.GetInstance.fryFour.TotalProduct, Time = DateTime.Now.ToShortDateString() });//向表中新增数据
// Sqlite<PotFourStatus>.GetInstance.Save();//保存数据
//}
FryPotOneRollerTroubleCheck();
if (FryPotAlarm == 1 || FryPotFourAlarm == 1)//炒锅滚筒无故障
{
@@ -1612,16 +2006,16 @@ namespace FryPot_DosingSystem.Control
{
if (!globalVar.LTwoInOrOutputLock && (globalVar.fryPotTwo.InputMaterialArrivedSingle == 1 || globalVar.fryPotFive.InputMaterialArrivedSingle == 1) && globalVar.LTwoPotInputMaterialArrive && LTwoOutputMaterialQuene.Count > 0 && !globalVar.LTwoPotOutputRollerArrive)
{
if (globalVar.LTwoFryPotSerial == 2)
{
Sqlite<PotTwoStatus>.GetInstance.Base.Add(new PotTwoStatus { Temperature = FryPotMonitorManage.GetInstance.fryTwo.Temperature, HotPower = FryPotMonitorManage.GetInstance.fryTwo.HotPower, Speed = FryPotMonitorManage.GetInstance.fryTwo.Speed, FryPotWeight = FryPotMonitorManage.GetInstance.fryTwo.FryPotWeight, OilCapacity = FryPotMonitorManage.GetInstance.fryTwo.OilCapacity, TotalOilCapactiy = FryPotMonitorManage.GetInstance.fryTwo.TotalOilCapactiy, TotalProduct = FryPotMonitorManage.GetInstance.fryTwo.TotalProduct, Time = DateTime.Now.ToShortDateString() });//向表中新增数据
Sqlite<PotTwoStatus>.GetInstance.Save();//保存数据
}
else
{
Sqlite<PotFiveStatus>.GetInstance.Base.Add(new PotFiveStatus { Temperature = FryPotMonitorManage.GetInstance.fryFive.Temperature, HotPower = FryPotMonitorManage.GetInstance.fryFive.HotPower, Speed = FryPotMonitorManage.GetInstance.fryFive.Speed, FryPotWeight = FryPotMonitorManage.GetInstance.fryFive.FryPotWeight, OilCapacity = FryPotMonitorManage.GetInstance.fryFive.OilCapacity, TotalOilCapactiy = FryPotMonitorManage.GetInstance.fryFive.TotalOilCapactiy, TotalProduct = FryPotMonitorManage.GetInstance.fryFive.TotalProduct, Time = DateTime.Now.ToShortDateString() });//向表中新增数据
Sqlite<PotFiveStatus>.GetInstance.Save();//保存数据
}
//if (globalVar.LTwoFryPotSerial == 2)
//{
// Sqlite<PotTwoStatus>.GetInstance.Base.Add(new PotTwoStatus { Temperature = FryPotMonitorManage.GetInstance.fryTwo.Temperature, HotPower = FryPotMonitorManage.GetInstance.fryTwo.HotPower, Speed = FryPotMonitorManage.GetInstance.fryTwo.Speed, FryPotWeight = FryPotMonitorManage.GetInstance.fryTwo.FryPotWeight, OilCapacity = FryPotMonitorManage.GetInstance.fryTwo.OilCapacity, TotalOilCapactiy = FryPotMonitorManage.GetInstance.fryTwo.TotalOilCapactiy, TotalProduct = FryPotMonitorManage.GetInstance.fryTwo.TotalProduct, Time = DateTime.Now.ToShortDateString() });//向表中新增数据
// Sqlite<PotTwoStatus>.GetInstance.Save();//保存数据
//}
//else
//{
// Sqlite<PotFiveStatus>.GetInstance.Base.Add(new PotFiveStatus { Temperature = FryPotMonitorManage.GetInstance.fryFive.Temperature, HotPower = FryPotMonitorManage.GetInstance.fryFive.HotPower, Speed = FryPotMonitorManage.GetInstance.fryFive.Speed, FryPotWeight = FryPotMonitorManage.GetInstance.fryFive.FryPotWeight, OilCapacity = FryPotMonitorManage.GetInstance.fryFive.OilCapacity, TotalOilCapactiy = FryPotMonitorManage.GetInstance.fryFive.TotalOilCapactiy, TotalProduct = FryPotMonitorManage.GetInstance.fryFive.TotalProduct, Time = DateTime.Now.ToShortDateString() });//向表中新增数据
// Sqlite<PotFiveStatus>.GetInstance.Save();//保存数据
//}
FryPotTwoRollerTroubleCheck();
if (FryPotTwoAlarm == 1 || FryPotFiveAlarm == 1)//炒锅滚筒无故障
{
@@ -1665,8 +2059,8 @@ namespace FryPot_DosingSystem.Control
{
if (!globalVar.LThreeInOrOutputLock && globalVar.fryPotThree.InputMaterialArrivedSingle == 1 && globalVar.LThreePotInputMaterialArrive && LThreeOutputMaterialQuene.Count > 0 && !globalVar.LThreePotOutputRollerArrive)
{
Sqlite<PotThreeStatus>.GetInstance.Base.Add(new PotThreeStatus { Temperature = FryPotMonitorManage.GetInstance.fryThree.Temperature, HotPower = FryPotMonitorManage.GetInstance.fryThree.HotPower, Speed = FryPotMonitorManage.GetInstance.fryThree.Speed, FryPotWeight = FryPotMonitorManage.GetInstance.fryThree.FryPotWeight, OilCapacity = FryPotMonitorManage.GetInstance.fryThree.OilCapacity, TotalOilCapactiy = FryPotMonitorManage.GetInstance.fryThree.TotalOilCapactiy, TotalProduct = FryPotMonitorManage.GetInstance.fryThree.TotalProduct, Time = DateTime.Now.ToShortDateString() });//向表中新增数据
Sqlite<PotThreeStatus>.GetInstance.Save();//保存数据
//Sqlite<PotThreeStatus>.GetInstance.Base.Add(new PotThreeStatus { Temperature = FryPotMonitorManage.GetInstance.fryThree.Temperature, HotPower = FryPotMonitorManage.GetInstance.fryThree.HotPower, Speed = FryPotMonitorManage.GetInstance.fryThree.Speed, FryPotWeight = FryPotMonitorManage.GetInstance.fryThree.FryPotWeight, OilCapacity = FryPotMonitorManage.GetInstance.fryThree.OilCapacity, TotalOilCapactiy = FryPotMonitorManage.GetInstance.fryThree.TotalOilCapactiy, TotalProduct = FryPotMonitorManage.GetInstance.fryThree.TotalProduct, Time = DateTime.Now.ToShortDateString() });//向表中新增数据
//Sqlite<PotThreeStatus>.GetInstance.Save();//保存数据
FryPotThreeRollerTroubleCheck();
if (FryPotThreeAlarm == 1)//炒锅滚筒无故障
{
@@ -1986,14 +2380,14 @@ namespace FryPot_DosingSystem.Control
// Thread.Sleep(5); if (globalVar.ExitMainTask)
// return;
//}
MessageLog.GetInstance.ShowRunLog($"炒锅【1】原料:{OutputMaterialQuene.ElementAt(0).materialType.MaterialName}已到进料位置,准备倒料"); break;
MessageLog.GetInstance.ShowRunLog($"炒锅【1】:{OutputMaterialQuene.ElementAt(0).materialType.MaterialLoc}】号桶已到进料位置,准备倒料"); break;
case 4:
//while (globalVar.fryPotFour.InputMaterialArrivedSingle == 0)
//{
// Thread.Sleep(5); if (globalVar.ExitMainTask)
// return;
//}
MessageLog.GetInstance.ShowRunLog($"炒锅【4】原料:{OutputMaterialQuene.ElementAt(0).materialType.MaterialName}已到进料位置,准备倒料"); break;
MessageLog.GetInstance.ShowRunLog($"炒锅【4】:{OutputMaterialQuene.ElementAt(0).materialType.MaterialLoc}】号桶已到进料位置,准备倒料"); break;
}
}
/// <summary>
@@ -2009,14 +2403,14 @@ namespace FryPot_DosingSystem.Control
// Thread.Sleep(5); if (globalVar.ExitMainTask)
// return;
//}
MessageLog.GetInstance.ShowRunLog($"炒锅【2】原料:{LTwoOutputMaterialQuene.ElementAt(0).materialType.MaterialName}已到进料位置,准备倒料"); break;
MessageLog.GetInstance.ShowRunLog($"炒锅【2】:{LTwoOutputMaterialQuene.ElementAt(0).materialType.MaterialLoc}】号桶已到进料位置,准备倒料"); break;
case 5:
//while (globalVar.fryPotFive.InputMaterialArrivedSingle == 0)
//{
// Thread.Sleep(5); if (globalVar.ExitMainTask)
// return;
//}
MessageLog.GetInstance.ShowRunLog($"炒锅【5】原料:{LTwoOutputMaterialQuene.ElementAt(0).materialType.MaterialName}已到进料位置,准备倒料"); break;
MessageLog.GetInstance.ShowRunLog($"炒锅【5】:{LTwoOutputMaterialQuene.ElementAt(0).materialType.MaterialLoc}】号桶已到进料位置,准备倒料"); break;
}
}
public void FryPotThreeInputMaterialRollerOperate()
@@ -2026,7 +2420,7 @@ namespace FryPot_DosingSystem.Control
// Thread.Sleep(5); if (globalVar.ExitMainTask)
// return;
//}
MessageLog.GetInstance.ShowRunLog($"炒锅【3】原料:{LThreeOutputMaterialQuene.ElementAt(0).materialType.MaterialName}已到进料位置,准备倒料");
MessageLog.GetInstance.ShowRunLog($"炒锅【3】:{LThreeOutputMaterialQuene.ElementAt(0).materialType.MaterialLoc}】号桶已到进料位置,准备倒料");
}
/// <summary>
/// 炒锅滚筒空桶出桶处理


+ 16
- 8
FryPot_DosingSystem/FryPotStatus/PotFiveStatus.cs 파일 보기

@@ -11,7 +11,8 @@ using System.Threading.Tasks;
namespace FryPot_DosingSystem.FryPotStatus
{
[Table("TbfryPotFive")]
internal class PotFiveStatus:ObservableObject
[Serializable]
internal class PotFiveStatus
{
[Key]
[Column("Id")]
@@ -22,42 +23,42 @@ namespace FryPot_DosingSystem.FryPotStatus
/// <summary>
/// 温度
/// </summary>
public double? Temperature { get { return temperature; } set { temperature = value; OnPropertyChanged(); } }
public double? Temperature { get { return temperature; } set { temperature = value; } }
private double? temperature=0;
[Column("HotPower")]
[Variable("FryPotFivePower", "5号炒锅火力", "", "")]
/// <summary>
/// 火力
/// </summary>
public string? HotPower { get { return hotPower; } set { hotPower = value; OnPropertyChanged(); } }
public string? HotPower { get { return hotPower; } set { hotPower = value; } }
private string? hotPower="0";
[Column("Speed")]
[Variable("FryPotFiveSpeed", "5号炒锅搅拌速度", "", "")]
/// <summary>
/// 搅拌速度
/// </summary>
public double? Speed { get { return speed; } set { speed = value; OnPropertyChanged(); } }
public double? Speed { get { return speed; } set { speed = value; } }
private double? speed=0;
[Column("FryPotWeight")]
[Variable("FryPotFiveWeight", "5号炒锅载重", "", "")]
/// <summary>
/// 炒锅重量
/// </summary>
public double? FryPotWeight { get { return fryPotWeight; } set { fryPotWeight = value; OnPropertyChanged(); } }
public double? FryPotWeight { get { return fryPotWeight; } set { fryPotWeight = value; } }
private double? fryPotWeight=0;
[Column("OilCapacity")]
[Variable("FryPotFiveOil", "5号炒锅当前配方用油量", "", "")]
/// <summary>
/// 单次配方用油量
/// </summary>
public double? OilCapacity { get { return oilCapacity; } set { oilCapacity = value; OnPropertyChanged(); } }
public double? OilCapacity { get { return oilCapacity; } set { oilCapacity = value; } }
private double? oilCapacity=0;
[Column("TotalOilCapactiy")]
[Variable("FryPotFiveTotalOil", "5号炒锅总用油量", "", "")]
/// <summary>
/// 一天总用油量
/// </summary>
public double? TotalOilCapactiy { get { return totalOilCapactiy; } set { totalOilCapactiy = value; OnPropertyChanged(); } }
public double? TotalOilCapactiy { get { return totalOilCapactiy; } set { totalOilCapactiy = value; } }
private double? totalOilCapactiy=0;

[Column("TotalProduct")]
@@ -65,8 +66,15 @@ namespace FryPot_DosingSystem.FryPotStatus
/// <summary>
/// 一天配方生产总量
/// </summary>
public int? TotalProduct { get { return totalProduct; } set { totalProduct = value; OnPropertyChanged(); } }
public int? TotalProduct { get { return totalProduct; } set { totalProduct = value; } }
private int? totalProduct=0;


[Column("ReicpeName")]
/// <summary>
/// 当前配方名称
/// </summary>
public string RecipeName { get; set; } = string.Empty;
[Column("Time")]
/// <summary>
/// 时间


+ 15
- 8
FryPot_DosingSystem/FryPotStatus/PotFourStatus.cs 파일 보기

@@ -11,7 +11,8 @@ using System.Threading.Tasks;
namespace FryPot_DosingSystem.FryPotStatus
{
[Table("TbfryPotOne")]
internal class PotFourStatus:ObservableObject
[Serializable]
internal class PotFourStatus
{
[Key]
[Column("Id")]
@@ -22,42 +23,42 @@ namespace FryPot_DosingSystem.FryPotStatus
/// <summary>
/// 温度
/// </summary>
public double? Temperature { get { return temperature; } set { temperature = value; OnPropertyChanged(); } }
public double? Temperature { get { return temperature; } set { temperature = value; } }
private double? temperature=0;
[Column("HotPower")]
[Variable("FryPotFourPower", "4号炒锅火力", "", "")]
/// <summary>
/// 火力
/// </summary>
public string? HotPower { get { return hotPower; } set { hotPower = value; OnPropertyChanged(); } }
public string? HotPower { get { return hotPower; } set { hotPower = value; } }
private string? hotPower="0";
[Column("Speed")]
[Variable("FryPotFourSpeed", "4号炒锅搅拌速度", "", "")]
/// <summary>
/// 搅拌速度
/// </summary>
public double? Speed { get { return speed; } set { speed = value; OnPropertyChanged(); } }
public double? Speed { get { return speed; } set { speed = value; } }
private double? speed=0;
[Column("FryPotWeight")]
[Variable("FryPotFourWeight", "4号炒锅载重", "", "")]
/// <summary>
/// 炒锅重量
/// </summary>
public double? FryPotWeight { get { return fryPotWeight; } set { fryPotWeight = value; OnPropertyChanged(); } }
public double? FryPotWeight { get { return fryPotWeight; } set { fryPotWeight = value; } }
private double? fryPotWeight=0;
[Column("OilCapacity")]
[Variable("FryPotFourOil", "4号炒锅当前配方用油量", "", "")]
/// <summary>
/// 单次配方用油量
/// </summary>
public double? OilCapacity { get { return oilCapacity; } set { oilCapacity = value; OnPropertyChanged(); } }
public double? OilCapacity { get { return oilCapacity; } set { oilCapacity = value; } }
private double? oilCapacity=0;
[Column("TotalOilCapactiy")]
[Variable("FryPotFourTotalOil", "4号炒锅总用油量", "", "")]
/// <summary>
/// 一天总用油量
/// </summary>
public double? TotalOilCapactiy { get { return totalOilCapactiy; } set { totalOilCapactiy = value; OnPropertyChanged(); } }
public double? TotalOilCapactiy { get { return totalOilCapactiy; } set { totalOilCapactiy = value;; } }
private double? totalOilCapactiy=0;

[Column("TotalProduct")]
@@ -65,8 +66,14 @@ namespace FryPot_DosingSystem.FryPotStatus
/// <summary>
/// 一天配方生产总量
/// </summary>
public int? TotalProduct { get { return totalProduct; } set { totalProduct = value; OnPropertyChanged(); } }
public int? TotalProduct { get { return totalProduct; } set { totalProduct = value; } }
private int? totalProduct=0;

[Column("ReicpeName")]
/// <summary>
/// 当前配方名称
/// </summary>
public string RecipeName { get; set; } = string.Empty;
[Column("Time")]
/// <summary>
/// 时间


+ 15
- 8
FryPot_DosingSystem/FryPotStatus/PotOneStatus.cs 파일 보기

@@ -11,7 +11,8 @@ using System.Threading.Tasks;
namespace FryPot_DosingSystem.FryPotStatus
{
[Table("TbfryPotOne")]
internal class PotOneStatus:ObservableObject
[Serializable]
internal class PotOneStatus
{
[Key]
[Column("Id")]
@@ -22,42 +23,42 @@ namespace FryPot_DosingSystem.FryPotStatus
/// <summary>
/// 温度
/// </summary>
public double? Temperature { get { return temperature; } set { temperature = value; OnPropertyChanged(); } }
public double? Temperature { get { return temperature; } set { temperature = value;} }
private double? temperature=0;
[Column("HotPower")]
[Variable("FryPotOnePower", "1号炒锅火力", "", "")]
/// <summary>
/// 火力
/// </summary>
public string? HotPower { get { return hotPower; } set { hotPower = value; OnPropertyChanged(); } }
public string? HotPower { get { return hotPower; } set { hotPower = value; } }
private string? hotPower="0";
[Column("Speed")]
[Variable("FryPotOneSpeed", "1号炒锅搅拌速度", "", "")]
/// <summary>
/// 搅拌速度
/// </summary>
public double? Speed { get { return speed; } set { speed = value; OnPropertyChanged(); } }
public double? Speed { get { return speed; } set { speed = value; } }
private double? speed = 0;
[Column("FryPotWeight")]
[Variable("FryPotOneWeight", "1号炒锅载重", "", "")]
/// <summary>
/// 炒锅重量
/// </summary>
public double? FryPotWeight { get { return fryPotWeight; } set { fryPotWeight = value; OnPropertyChanged(); } }
public double? FryPotWeight { get { return fryPotWeight; } set { fryPotWeight = value; } }
private double? fryPotWeight = 0;
[Column("OilCapacity")]
[Variable("FryPotOneOil", "1号炒锅当前配方用油量", "", "")]
/// <summary>
/// 单次配方用油量
/// </summary>
public double? OilCapacity { get { return oilCapacity; } set { oilCapacity = value; OnPropertyChanged(); } }
public double? OilCapacity { get { return oilCapacity; } set { oilCapacity = value; } }
private double? oilCapacity = 0;
[Column("TotalOilCapactiy")]
[Variable("FryPotOneTotalOil", "1号炒锅总用油量", "", "")]
/// <summary>
/// 一天总用油量
/// </summary>
public double? TotalOilCapactiy { get { return totalOilCapactiy; } set { totalOilCapactiy = value; OnPropertyChanged(); } }
public double? TotalOilCapactiy { get { return totalOilCapactiy; } set { totalOilCapactiy = value; } }
private double? totalOilCapactiy = 0;

[Column("TotalProduct")]
@@ -65,12 +66,18 @@ namespace FryPot_DosingSystem.FryPotStatus
/// <summary>
/// 一天配方生产总量
/// </summary>
public int? TotalProduct { get { return totalProduct; } set { totalProduct = value; OnPropertyChanged(); } }
public int? TotalProduct { get { return totalProduct; } set { totalProduct = value; } }
private int? totalProduct = 0;
[Column("ReicpeName")]
/// <summary>
/// 当前配方名称
/// </summary>
public string RecipeName { get; set; } = string.Empty;
[Column("Time")]
/// <summary>
/// 时间
/// </summary>
public string Time { get; set; } = DateTime.Now.ToShortTimeString();
}
}

+ 16
- 8
FryPot_DosingSystem/FryPotStatus/PotThreeStatus.cs 파일 보기

@@ -11,7 +11,8 @@ using System.Threading.Tasks;
namespace FryPot_DosingSystem.FryPotStatus
{
[Table("TbfryPotThree")]
internal class PotThreeStatus:ObservableObject
[Serializable]
internal class PotThreeStatus
{
[Key]
[Column("Id")]
@@ -22,42 +23,42 @@ namespace FryPot_DosingSystem.FryPotStatus
/// <summary>
/// 温度
/// </summary>
public double? Temperature { get { return temperature; } set { temperature = value; OnPropertyChanged(); } }
public double? Temperature { get { return temperature; } set { temperature = value; } }
private double? temperature=0;
[Column("HotPower")]
[Variable("FryPotThreePower", "3号炒锅火力", "", "")]
/// <summary>
/// 火力
/// </summary>
public string? HotPower { get { return hotPower; } set { hotPower = value; OnPropertyChanged(); } }
public string? HotPower { get { return hotPower; } set { hotPower = value;} }
private string? hotPower="0";
[Column("Speed")]
[Variable("FryPotThreeSpeed", "3号炒锅搅拌速度", "", "")]
/// <summary>
/// 搅拌速度
/// </summary>
public double? Speed { get { return speed; } set { speed = value; OnPropertyChanged(); } }
public double? Speed { get { return speed; } set { speed = value; } }
private double? speed=0;
[Column("FryPotWeight")]
[Variable("FryPotThreeWeight", "3号炒锅载重", "", "")]
/// <summary>
/// 炒锅重量
/// </summary>
public double? FryPotWeight { get { return fryPotWeight; } set { fryPotWeight = value; OnPropertyChanged(); } }
public double? FryPotWeight { get { return fryPotWeight; } set { fryPotWeight = value; } }
private double? fryPotWeight=0;
[Column("OilCapacity")]
[Variable("FryPotThreeOil", "3号炒锅当前配方用油量", "", "")]
/// <summary>
/// 单次配方用油量
/// </summary>
public double? OilCapacity { get { return oilCapacity; } set { oilCapacity = value; OnPropertyChanged(); } }
public double? OilCapacity { get { return oilCapacity; } set { oilCapacity = value; } }
private double? oilCapacity=0;
[Column("TotalOilCapactiy")]
[Variable("FryPotThreeTotalOil", "3号炒锅总用油量", "", "")]
/// <summary>
/// 一天总用油量
/// </summary>
public double? TotalOilCapactiy { get { return totalOilCapactiy; } set { totalOilCapactiy = value; OnPropertyChanged(); } }
public double? TotalOilCapactiy { get { return totalOilCapactiy; } set { totalOilCapactiy = value; } }
private double? totalOilCapactiy=0;

[Column("TotalProduct")]
@@ -65,8 +66,15 @@ namespace FryPot_DosingSystem.FryPotStatus
/// <summary>
/// 一天配方生产总量
/// </summary>
public int? TotalProduct { get { return totalProduct; } set { totalProduct = value; OnPropertyChanged(); } }
public int? TotalProduct { get { return totalProduct; } set { totalProduct = value; } }
private int? totalProduct=0;


[Column("ReicpeName")]
/// <summary>
/// 当前配方名称
/// </summary>
public string RecipeName { get; set; } = string.Empty;
[Column("Time")]
/// <summary>
/// 时间


+ 15
- 8
FryPot_DosingSystem/FryPotStatus/PotTwoStatus.cs 파일 보기

@@ -11,7 +11,8 @@ using System.Threading.Tasks;
namespace FryPot_DosingSystem.FryPotStatus
{
[Table("TbfryPotTwo")]
internal class PotTwoStatus:ObservableObject
[Serializable]
internal class PotTwoStatus
{
[Key]
[Column("Id")]
@@ -22,42 +23,42 @@ namespace FryPot_DosingSystem.FryPotStatus
/// <summary>
/// 温度
/// </summary>
public double? Temperature { get { return temperature; } set { temperature = value; OnPropertyChanged(); } }
public double? Temperature { get { return temperature; } set { temperature = value; } }
private double? temperature=0;
[Column("HotPower")]
[Variable("FryPotTwoPower", "2号炒锅火力", "", "")]
/// <summary>
/// 火力
/// </summary>
public string? HotPower { get { return hotPower; } set { hotPower = value; OnPropertyChanged(); } }
public string? HotPower { get { return hotPower; } set { hotPower = value; } }
private string? hotPower="0";
[Column("Speed")]
[Variable("FryPotTwoSpeed", "2号炒锅搅拌速度", "", "")]
/// <summary>
/// 搅拌速度
/// </summary>
public double? Speed { get { return speed; } set { speed = value; OnPropertyChanged(); } }
public double? Speed { get { return speed; } set { speed = value; } }
private double? speed=0;
[Column("FryPotWeight")]
[Variable("FryPotTwoWeight", "2号炒锅载重", "", "")]
/// <summary>
/// 炒锅重量
/// </summary>
public double? FryPotWeight { get { return fryPotWeight; } set { fryPotWeight = value; OnPropertyChanged(); } }
public double? FryPotWeight { get { return fryPotWeight; } set { fryPotWeight = value; } }
private double? fryPotWeight=0;
[Column("OilCapacity")]
[Variable("FryPotTwoOil", "2号炒锅当前配方用油量", "", "")]
/// <summary>
/// 单次配方用油量
/// </summary>
public double? OilCapacity { get { return oilCapacity; } set { oilCapacity = value; OnPropertyChanged(); } }
public double? OilCapacity { get { return oilCapacity; } set { oilCapacity = value; } }
private double? oilCapacity=0;
[Column("TotalOilCapactiy")]
[Variable("FryPotTwoTotalOil", "2号炒锅总用油量", "", "")]
/// <summary>
/// 一天总用油量
/// </summary>
public double? TotalOilCapactiy { get { return totalOilCapactiy; } set { totalOilCapactiy = value; OnPropertyChanged(); } }
public double? TotalOilCapactiy { get { return totalOilCapactiy; } set { totalOilCapactiy = value; } }
private double? totalOilCapactiy=0;

[Column("TotalProduct")]
@@ -65,8 +66,14 @@ namespace FryPot_DosingSystem.FryPotStatus
/// <summary>
/// 一天配方生产总量
/// </summary>
public int? TotalProduct { get { return totalProduct; } set { totalProduct = value; OnPropertyChanged(); } }
public int? TotalProduct { get { return totalProduct; } set { totalProduct = value; } }
private int? totalProduct=0;

[Column("ReicpeName")]
/// <summary>
/// 当前配方名称
/// </summary>
public string RecipeName { get; set; } = string.Empty;
[Column("Time")]
/// <summary>
/// 时间


+ 1
- 0
FryPot_DosingSystem/FryPot_DosingSystem.csproj 파일 보기

@@ -11,6 +11,7 @@
<ItemGroup>
<None Remove="hbl.ico" />
<None Remove="Resources\fonts\iconfont.ttf" />
<None Remove="Resources\fonts\iconfont2.ttf" />
</ItemGroup>

<ItemGroup>


+ 70
- 1
FryPot_DosingSystem/Resources/fonts/demo_index.html 파일 보기

@@ -52,6 +52,12 @@
<div class="content unicode" style="display: block;">
<ul class="icon_lists dib-box">
<li class="dib">
<span class="icon iconfont">&#xe622;</span>
<div class="name">下载</div>
<div class="code-name">&amp;#xe622;</div>
</li>
<li class="dib">
<span class="icon iconfont">&#xe668;</span>
<div class="name">账号信息</div>
@@ -76,6 +82,12 @@
<div class="code-name">&amp;#xe62c;</div>
</li>
<li class="dib">
<span class="icon iconfont">&#xe63f;</span>
<div class="name">下载</div>
<div class="code-name">&amp;#xe63f;</div>
</li>
<li class="dib">
<span class="icon iconfont">&#xe669;</span>
<div class="name">close</div>
@@ -106,6 +118,12 @@
<div class="code-name">&amp;#xe6b7;</div>
</li>
<li class="dib">
<span class="icon iconfont">&#xe8e0;</span>
<div class="name">166-NFC</div>
<div class="code-name">&amp;#xe8e0;</div>
</li>
</ul>
<div class="article markdown">
<h2 id="unicode-">Unicode 引用</h2>
@@ -124,7 +142,7 @@
<pre><code class="language-css"
>@font-face {
font-family: 'iconfont';
src: url('iconfont.ttf?t=1658305362348') format('truetype');
src: url('iconfont.ttf?t=1659497763775') format('truetype');
}
</code></pre>
<h3 id="-iconfont-">第二步:定义使用 iconfont 的样式</h3>
@@ -150,6 +168,15 @@
<div class="content font-class">
<ul class="icon_lists dib-box">
<li class="dib">
<span class="icon iconfont icon-xiazai"></span>
<div class="name">
下载
</div>
<div class="code-name">.icon-xiazai
</div>
</li>
<li class="dib">
<span class="icon iconfont icon-zhanghaoxinxi"></span>
<div class="name">
@@ -186,6 +213,15 @@
</div>
</li>
<li class="dib">
<span class="icon iconfont icon-xiazai1"></span>
<div class="name">
下载
</div>
<div class="code-name">.icon-xiazai1
</div>
</li>
<li class="dib">
<span class="icon iconfont icon-close"></span>
<div class="name">
@@ -231,6 +267,15 @@
</div>
</li>
<li class="dib">
<span class="icon iconfont icon-a-166-NFC"></span>
<div class="name">
166-NFC
</div>
<div class="code-name">.icon-a-166-NFC
</div>
</li>
</ul>
<div class="article markdown">
<h2 id="font-class-">font-class 引用</h2>
@@ -258,6 +303,14 @@
<div class="content symbol">
<ul class="icon_lists dib-box">
<li class="dib">
<svg class="icon svg-icon" aria-hidden="true">
<use xlink:href="#icon-xiazai"></use>
</svg>
<div class="name">下载</div>
<div class="code-name">#icon-xiazai</div>
</li>
<li class="dib">
<svg class="icon svg-icon" aria-hidden="true">
<use xlink:href="#icon-zhanghaoxinxi"></use>
@@ -290,6 +343,14 @@
<div class="code-name">#icon-quanxianpeizhi</div>
</li>
<li class="dib">
<svg class="icon svg-icon" aria-hidden="true">
<use xlink:href="#icon-xiazai1"></use>
</svg>
<div class="name">下载</div>
<div class="code-name">#icon-xiazai1</div>
</li>
<li class="dib">
<svg class="icon svg-icon" aria-hidden="true">
<use xlink:href="#icon-close"></use>
@@ -330,6 +391,14 @@
<div class="code-name">#icon-mianxingmima</div>
</li>
<li class="dib">
<svg class="icon svg-icon" aria-hidden="true">
<use xlink:href="#icon-a-166-NFC"></use>
</svg>
<div class="name">166-NFC</div>
<div class="code-name">#icon-a-166-NFC</div>
</li>
</ul>
<div class="article markdown">
<h2 id="symbol-">Symbol 引用</h2>




+ 32
- 0
FryPot_DosingSystem/View/LabelPrint.xaml 파일 보기

@@ -0,0 +1,32 @@
<UserControl x:Class="FryPot_DosingSystem.View.LabelPrint"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:FryPot_DosingSystem.View"
xmlns:vm="clr-namespace:FryPot_DosingSystem.ViewModel"
mc:Ignorable="d"
d:DesignHeight="450" d:DesignWidth="800">
<UserControl.DataContext>
<vm:LabelPrintViewModel/>
</UserControl.DataContext>
<Grid>
<Grid.RowDefinitions>
<RowDefinition/>
<RowDefinition/>
</Grid.RowDefinitions>
<Image Source="../Resources/pictures/战斗机.jpeg"></Image>
<Button Grid.Row="1" Width="200" Height="100" Command="{Binding PrintCommand}" >
<Button.Template>
<ControlTemplate TargetType="{x:Type Button}">
<Border Background="LightSeaGreen">
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center" VerticalAlignment="Center">
<TextBlock Text="图标" FontSize="24" Foreground="White"></TextBlock>
<TextBlock Text="打印" FontSize="24" Foreground="White"></TextBlock>
</StackPanel>
</Border>
</ControlTemplate>
</Button.Template>
</Button>
</Grid>
</UserControl>

+ 28
- 0
FryPot_DosingSystem/View/LabelPrint.xaml.cs 파일 보기

@@ -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 FryPot_DosingSystem.View
{
/// <summary>
/// LabelPrint.xaml 的交互逻辑
/// </summary>
public partial class LabelPrint : UserControl
{
public LabelPrint()
{
InitializeComponent();
}
}
}

+ 31
- 8
FryPot_DosingSystem/View/RecipeSendDownView.xaml 파일 보기

@@ -36,7 +36,7 @@
</ItemsControl.ItemsPanel>
<ItemsControl.ItemTemplate>
<DataTemplate>
<Border BorderBrush="Aqua" BorderThickness="2" CornerRadius="14" Height="120" Margin="5,5">
<Border BorderBrush="Aqua" BorderThickness="2" CornerRadius="14" Height="120" Margin="5,5,10,5">
<RadioButton>
<RadioButton.Template>
<ControlTemplate>
@@ -46,20 +46,23 @@
<ColumnDefinition Width="0.01*"></ColumnDefinition>

<ColumnDefinition Width="4*"></ColumnDefinition>
<ColumnDefinition Width="1.2*"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<Grid>
<!--<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="70"></RowDefinition>
<RowDefinition></RowDefinition>
</Grid.RowDefinitions>
<Viewbox Stretch="Fill" HorizontalAlignment="Center" Width="200">
<TextBlock Text="{Binding RecipeName}" HorizontalAlignment="Center"></TextBlock>
<TextBlock Text="{Binding RecipeName}" HorizontalAlignment="Center" ></TextBlock>
</Viewbox>
<Button Grid.Row="1" Width="100" Content="配方下发" Command="{Binding DataContext.RecipeSetDownCommand,RelativeSource={RelativeSource Mode=FindAncestor,AncestorType=ItemsControl}}"
CommandParameter="{Binding RecipeId}" Cursor="Hand"></Button>
--><!--<Button Grid.Row="1" Width="100" Content="配方下发" Command="{Binding DataContext.RecipeSetDownCommand,RelativeSource={RelativeSource Mode=FindAncestor,AncestorType=ItemsControl}}"
CommandParameter="{Binding RecipeId}" Cursor="Hand"></Button>--><!--
</Grid>
</Grid>-->
<Viewbox Stretch="Uniform" HorizontalAlignment="Center" Width="200">
<TextBlock Text="{Binding RecipeName}" HorizontalAlignment="Center" VerticalAlignment="Center"></TextBlock>
</Viewbox>
<Line StrokeThickness="3" Grid.Column="1" HorizontalAlignment="Left" Stroke="LawnGreen" X1="0" Y1="5" X2="0" Y2="110"></Line>
<Grid Grid.Column="2">
<!--后续添加内容-->
@@ -112,7 +115,27 @@
<ColumnDefinition/>
</Grid.ColumnDefinitions>
<Line StrokeThickness="3" Grid.Column="0" HorizontalAlignment="Left" Stroke="LawnGreen" X1="0" Y1="5" X2="0" Y2="110"></Line>
<TextBlock Grid.Column="1" FontSize="16" Text="{Binding RecipeSetInfo}" VerticalAlignment="Center" HorizontalAlignment="Center"></TextBlock>
<StackPanel Grid.Column="1" HorizontalAlignment="Center" VerticalAlignment="Center">
<Button Margin="0,0,0,5" Height="27" Command="{Binding DataContext.RecipeSetDownCommand,RelativeSource={RelativeSource Mode=FindAncestor,AncestorType=ItemsControl}}" CommandParameter="{Binding RecipeId}" Cursor="Hand" >
<Button.Template>
<ControlTemplate TargetType="{x:Type Button}">
<StackPanel Orientation="Horizontal" >
<TextBlock Name="title" FontFamily="../Resources/fonts/#iconfont" Text="&#xe622;" FontSize="21" VerticalAlignment="Bottom"></TextBlock>
<TextBlock Name="text" Text="配方下发" Height="Auto" FontSize="24"></TextBlock>
</StackPanel>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter TargetName="title" Property="Foreground" Value="Cyan"/>
<Setter TargetName="text" Property="Foreground" Value="Cyan"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Button.Template>
</Button>
<TextBlock FontSize="16" Text="{Binding RecipeSetInfo}" VerticalAlignment="Center" HorizontalAlignment="Center"></TextBlock>
</StackPanel>
</Grid>
</Grid>



+ 50
- 5
FryPot_DosingSystem/View/SqliteDataView.xaml 파일 보기

@@ -479,18 +479,18 @@
<RowDefinition/>
</Grid.RowDefinitions>
<StackPanel Orientation="Horizontal" HorizontalAlignment="Right">
<DatePicker Margin="50,0" Height="35" Style="{StaticResource PickerStyle}" SelectedDate="{Binding SelectedDate}"></DatePicker>
<ComboBox Style="{DynamicResource ComboBoxStyle1}" ItemsSource="{Binding list}" Height="35" Width="150" VerticalContentAlignment="Center" HorizontalContentAlignment="Center" FontSize="18" Foreground="#FF2AB2E7" SelectedValue="{Binding cboSelectedValue}" Margin="0,0,50,0"></ComboBox>
<Button Width="150" Height="35" Content="查询" FontSize="20" Foreground="#FF2AB2E7" Background="Transparent" BorderBrush="#FF2AB2E7" BorderThickness="1" Command="{Binding SelectCommand}"></Button>
<!--<DatePicker Margin="50,0" Height="35" Style="{StaticResource PickerStyle}" SelectedDate="{Binding SelectedDate}"></DatePicker>
<ComboBox Style="{DynamicResource ComboBoxStyle1}" ItemsSource="{Binding list}" Height="35" Width="150" VerticalContentAlignment="Center" HorizontalContentAlignment="Center" FontSize="18" Foreground="#FF2AB2E7" SelectedValue="{Binding cboSelectedValue}" Margin="0,0,50,0"></ComboBox>-->
<Button Width="150" Height="35" Content="查询" FontSize="20" Foreground="#FF2AB2E7" Background="Transparent" BorderBrush="#FF2AB2E7" BorderThickness="1" Margin="0,0,10,0" Command="{Binding SelectCommand}"></Button>
</StackPanel>
<DataGrid Grid.Row="1" x:Name="fryOne" Visibility="{Binding fryOneDataVisible}" ItemsSource="{Binding StatusOne}" GridLinesVisibility="All" Background="Transparent"
<DataGrid Grid.Row="1" x:Name="fryPot" ItemsSource="{Binding Status}" GridLinesVisibility="All" Background="Transparent" LoadingRow="fryPot_LoadingRow"
AutoGenerateColumns="False" IsReadOnly="True" Style="{StaticResource dataGrid}"
ColumnHeaderStyle="{StaticResource ColumHeaderStyle}" RowStyle="{StaticResource rowStyle}" CellStyle="{StaticResource cellStyle}">
<DataGrid.Columns>
<DataGridTemplateColumn IsReadOnly="True" Width="0.1*" Header="ID">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<TextBox Text="{Binding Id}" IsReadOnly="False" Style="{StaticResource textboxStyle}"></TextBox>
<TextBox Text="{Binding RelativeSource={RelativeSource Mode=FindAncestor,AncestorType={x:Type DataGridRow}}, Path=Header}" IsReadOnly="True" Style="{StaticResource textboxStyle}"></TextBox>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
@@ -502,6 +502,8 @@
</DataGridTextColumn>
<DataGridTextColumn Width="0.2*" Header="炒锅载重" Binding="{Binding FryPotWeight}" ElementStyle="{StaticResource dgCellstyle }">
</DataGridTextColumn>
<DataGridTextColumn Width="0.2*" Header="配方名称" Binding="{Binding RecipeName}" ElementStyle="{StaticResource dgCellstyle }">
</DataGridTextColumn>
<DataGridTextColumn Width="0.2*" Header="配方用油量" Binding="{Binding OilCapacity}" ElementStyle="{StaticResource dgCellstyle }">
</DataGridTextColumn>
<DataGridTextColumn Width="0.2*" Header="总用油量" Binding="{Binding TotalOilCapactiy}" ElementStyle="{StaticResource dgCellstyle }">
@@ -526,6 +528,49 @@
</DataGridTemplateColumn>-->
</DataGrid.Columns>
</DataGrid>
<!--<DataGrid Grid.Row="1" x:Name="fryOne" Visibility="{Binding fryOneDataVisible}" ItemsSource="{Binding StatusOne}" GridLinesVisibility="All" Background="Transparent"
AutoGenerateColumns="False" IsReadOnly="True" Style="{StaticResource dataGrid}"
ColumnHeaderStyle="{StaticResource ColumHeaderStyle}" RowStyle="{StaticResource rowStyle}" CellStyle="{StaticResource cellStyle}">
<DataGrid.Columns>
<DataGridTemplateColumn IsReadOnly="True" Width="0.1*" Header="ID">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<TextBox Text="{Binding Id}" IsReadOnly="False" Style="{StaticResource textboxStyle}"></TextBox>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
<DataGridTextColumn Width="0.2*" Header="温度" Binding="{Binding Temperature}" ElementStyle="{StaticResource dgCellstyle }">
</DataGridTextColumn>
<DataGridTextColumn Width="0.2*" Header="火力" Binding="{Binding HotPower}" ElementStyle="{StaticResource dgCellstyle }">
</DataGridTextColumn>
<DataGridTextColumn Width="0.2*" Header="搅拌速度" Binding="{Binding Speed}" ElementStyle="{StaticResource dgCellstyle }">
</DataGridTextColumn>
<DataGridTextColumn Width="0.2*" Header="炒锅载重" Binding="{Binding FryPotWeight}" ElementStyle="{StaticResource dgCellstyle }">
</DataGridTextColumn>
<DataGridTextColumn Width="0.2*" Header="配方用油量" Binding="{Binding OilCapacity}" ElementStyle="{StaticResource dgCellstyle }">
</DataGridTextColumn>
<DataGridTextColumn Width="0.2*" Header="总用油量" Binding="{Binding TotalOilCapactiy}" ElementStyle="{StaticResource dgCellstyle }">
</DataGridTextColumn>
<DataGridTextColumn Width="0.2*" Header="产量" Binding="{Binding TotalProduct}" ElementStyle="{StaticResource dgCellstyle }">
</DataGridTextColumn>
<DataGridTextColumn Width="0.2*" Header="时间" Binding="{Binding Time}" ElementStyle="{StaticResource dgCellstyle }">
</DataGridTextColumn>
--><!--<DataGridTemplateColumn IsReadOnly="False" Width="0.45*" Header="地址">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<TextBox Text="{Binding PlcAddress}" Style="{StaticResource textboxStyle}"></TextBox>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>-->
<!--<DataGridTemplateColumn IsReadOnly="False" Width="0.45*" Header="地址长度">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<TextBox Text="{Binding Length}" Style="{StaticResource textboxStyle}"></TextBox>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>--><!--
</DataGrid.Columns>
</DataGrid>-->
<DataGrid x:Name="fryTwo" Grid.Row="1" Visibility="{Binding fryTwoDataVisible}" ItemsSource="{Binding StatusTwo}" GridLinesVisibility="All" Background="Transparent"
AutoGenerateColumns="False" IsReadOnly="True" Style="{StaticResource dataGrid}"
ColumnHeaderStyle="{StaticResource ColumHeaderStyle}" RowStyle="{StaticResource rowStyle}" CellStyle="{StaticResource cellStyle}">


+ 4
- 1
FryPot_DosingSystem/View/SqliteDataView.xaml.cs 파일 보기

@@ -25,6 +25,9 @@ namespace FryPot_DosingSystem.View
InitializeComponent();
}

private void fryPot_LoadingRow(object sender, DataGridRowEventArgs e)
{
e.Row.Header = e.Row.GetIndex() + 1;
}
}
}

+ 11
- 3
FryPot_DosingSystem/View/UserManageView.xaml 파일 보기

@@ -441,7 +441,7 @@
<DataGridTextColumn FontSize="16" IsReadOnly="false" Width="0.2*" Binding="{Binding UserName}" ElementStyle="{StaticResource dgCell}">
<DataGridTextColumn.Header>
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center">
<TextBlock FontFamily="../Resources/fonts/#iconfont" Foreground="Orange" Text="&#xe6a0;" FontSize="24" VerticalAlignment="Center" Margin="0,0,8,0"/>
<TextBlock FontFamily="../Resources/fonts/#iconfont" Foreground="Orange" Text="&#xe6a0;" FontSize="18" VerticalAlignment="Center" Margin="0,0,8,0"/>
<TextBlock Text="Account" />
</StackPanel>
</DataGridTextColumn.Header>
@@ -469,6 +469,14 @@
</StackPanel>
</DataGridTextColumn.Header>
</DataGridTextColumn>
<DataGridTextColumn FontSize="16" IsReadOnly="True" Width="0.2*" Binding="{Binding CardId}" ElementStyle="{StaticResource dgCell}">
<DataGridTextColumn.Header>
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center">
<TextBlock FontFamily="../Resources/fonts/#iconfont" Foreground="Orange" Text="&#xe8e0;" VerticalAlignment="Center" Margin="0,0,8,0"/>
<TextBlock Text="NFC"/>
</StackPanel>
</DataGridTextColumn.Header>
</DataGridTextColumn>
<DataGridTemplateColumn Width="0.2*">
<DataGridTemplateColumn.Header>
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center">
@@ -478,7 +486,7 @@
</DataGridTemplateColumn.Header>
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<ComboBox Style="{StaticResource ComboBoxStyle1}" Text="{Binding Permission}" Tag="{Binding Id}" SelectedItem="{Binding Permission}" SelectionChanged="ComboBox_SelectionChanged" ItemsSource="{Binding DataContext.Authorities, RelativeSource={RelativeSource AncestorType=DataGrid, Mode=FindAncestor}}" Foreground="SkyBlue" VerticalContentAlignment="Center" HorizontalContentAlignment="Center" FontSize="16">
<ComboBox Style="{StaticResource ComboBoxStyle1}" Text="{Binding permission}" Tag="{Binding Id}" SelectedItem="{Binding permission}" SelectionChanged="ComboBox_SelectionChanged" ItemsSource="{Binding DataContext.Authorities, RelativeSource={RelativeSource AncestorType=DataGrid, Mode=FindAncestor}}" Foreground="SkyBlue" VerticalContentAlignment="Center" HorizontalContentAlignment="Center" FontSize="16">
<ComboBox.ItemContainerStyle>
<Style TargetType="{x:Type ComboBoxItem}">
@@ -510,7 +518,7 @@
<Button Command="{Binding DataContext.SaveCommand, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=DataGrid}}"
CommandParameter="{Binding UserName}" Template="{DynamicResource ButtonTemplate1}" Style="{StaticResource btnStyle}" Foreground="Cyan" Content="Save" Margin="5,0"></Button>
<!--<Button Command="{Binding DataContext.UpdateCommand, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=DataGrid}}" Template="{DynamicResource ButtonTemplate1}" Style="{StaticResource btnStyle}" Content="Update" Grid.Column="1" Margin="5,0"></Button>-->
<Button Command="{Binding DataContext.DeleteCommand, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=DataGrid}}" CommandParameter="{Binding Account}" Template="{DynamicResource ButtonTemplate1}" Style="{StaticResource btnStyle}" Content="Delete" Grid.Column="1" Foreground="Cyan" Margin="5,0"></Button>
<Button Command="{Binding DataContext.DeleteCommand, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=DataGrid}}" CommandParameter="{Binding Id}" Template="{DynamicResource ButtonTemplate1}" Style="{StaticResource btnStyle}" Content="Delete" Grid.Column="1" Foreground="Cyan" Margin="5,0"></Button>
</Grid>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>


+ 7
- 4
FryPot_DosingSystem/View/UserManageView.xaml.cs 파일 보기

@@ -36,12 +36,15 @@ namespace FryPot_DosingSystem.View
ComboBox cbo = sender as ComboBox;
var id = cbo.Tag;
var per = cbo.SelectedItem;
var a = UserManageViewModel.GetInstance.usersInfo.FirstOrDefault(p=>p.Id==id);

if (a != null && per != null)
if (id != null)
{
a.Permission = (Permission)Enum.Parse(typeof(Permission), per.ToString());
var a = UserManageViewModel.GetInstance.usersInfo.FirstOrDefault(p => p.Id == id);

if (a != null && per != null)
{
a.permission = (Permission)Enum.Parse(typeof(Permission), per.ToString());

}
}
}
}


+ 20
- 0
FryPot_DosingSystem/ViewModel/LabelPrintViewModel.cs 파일 보기

@@ -0,0 +1,20 @@
using Microsoft.Toolkit.Mvvm.ComponentModel;
using Microsoft.Toolkit.Mvvm.Input;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace FryPot_DosingSystem.ViewModel
{
internal class LabelPrintViewModel:ObservableObject
{
public RelayCommand PrintCommand { get; set; }

public LabelPrintViewModel()
{
}
}
}

+ 8
- 2
FryPot_DosingSystem/ViewModel/RecipeSetDownViewModel.cs 파일 보기

@@ -38,9 +38,15 @@ namespace FryPot_DosingSystem.ViewModel
if (res != null)
{
RecipeSetDown(new NewRecipeModel[] { res });
res.RecipeSetInfo = "配方下发成功";
Task.Run(() => { Thread.Sleep(1500); res.RecipeSetInfo = string.Empty; });
}
res.RecipeSetInfo = "配方下发成功";
Task.Run(() => { Thread.Sleep(1500);res.RecipeSetInfo = string.Empty; });
else
{
res.RecipeSetInfo = "配方下发失败";
Task.Run(() => { Thread.Sleep(1500); res.RecipeSetInfo = string.Empty; });
}
}
});
AllRecipeSetDownCommand = new RelayCommand(() =>


+ 189
- 121
FryPot_DosingSystem/ViewModel/SqliteDataViewModel.cs 파일 보기

@@ -5,26 +5,32 @@ using Microsoft.Toolkit.Mvvm.Input;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.IO;
using System.Linq;
using System.Runtime.Serialization.Formatters.Binary;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Forms;

namespace FryPot_DosingSystem.ViewModel
{
internal class SqliteDataViewModel : ObservableObject
{

public ObservableCollection<PotOneStatus> StatusOne { get; set; } = new ObservableCollection<PotOneStatus>();
public ObservableCollection<PotTwoStatus> StatusTwo { get; set; } = new ObservableCollection<PotTwoStatus>();
public ObservableCollection<PotThreeStatus> StatusThree { get; set; } = new ObservableCollection<PotThreeStatus>();
public ObservableCollection<PotFourStatus> StatusFour { get; set; } = new ObservableCollection<PotFourStatus>();
public ObservableCollection<PotFiveStatus> StatusFive { get; set; } = new ObservableCollection<PotFiveStatus>();

public ObservableCollection<object> Status { get; set; } = new ObservableCollection<object>();

public Visibility fryOneDataVisible { get { return _fryOneDataVisible; } set { _fryOneDataVisible = value; OnPropertyChanged(); } }
private Visibility _fryOneDataVisible=Visibility.Visible;
private Visibility _fryOneDataVisible = Visibility.Visible;

public Visibility fryTwoDataVisible { get { return _fryTwoDataVisible; } set { _fryTwoDataVisible = value; OnPropertyChanged(); } }
private Visibility _fryTwoDataVisible=Visibility.Collapsed;
private Visibility _fryTwoDataVisible = Visibility.Collapsed;

public Visibility fryThreeDataVisible { get { return _fryThreeDataVisible; } set { _fryThreeDataVisible = value; OnPropertyChanged(); } }
private Visibility _fryThreeDataVisible = Visibility.Collapsed;
@@ -41,135 +47,197 @@ namespace FryPot_DosingSystem.ViewModel
{
SelectCommand = new RelayCommand(() =>
{
if (SelectedDate != string.Empty && SelectedDate != "" && SelectedDate != null && cboSelectedValue != null && cboSelectedValue != string.Empty && cboSelectedValue != "")
#region 旧版本
//if (SelectedDate != string.Empty && SelectedDate != "" && SelectedDate != null && cboSelectedValue != null && cboSelectedValue != string.Empty && cboSelectedValue != "")
//{
// if (cboSelectedValue == "1号炒锅")
// {
// List<PotOneStatus> listOne = Sqlite<PotOneStatus>.GetInstance.Base.ToList();
// var list = listOne.Where(p => p.Time.Equals(Convert.ToDateTime(SelectedDate).ToShortDateString()));
// if (list != null && list.Count() != 0)
// {
// if (StatusOne.Count > 0)
// {
// StatusOne.Clear();
// }
// foreach (var item in list)
// {
// StatusOne.Add(item);
// }
// fryOneDataVisible = Visibility.Visible;
// fryTwoDataVisible = Visibility.Collapsed;
// fryThreeDataVisible = Visibility.Collapsed;
// fryFourDataVisible = Visibility.Collapsed;
// fryFiveDataVisible = Visibility.Collapsed;
// }
// else
// {
// MessageBox.Show("未找到对应数据", "提示", MessageBoxButton.OK, MessageBoxImage.Information);
// }

// }
// if (cboSelectedValue == "2号炒锅")
// {
// List<PotTwoStatus> listTwo = Sqlite<PotTwoStatus>.GetInstance.Base.ToList();
// var list = listTwo.Where(p => p.Time.Equals(Convert.ToDateTime(SelectedDate).ToShortDateString()));
// if (list != null && list.Count() != 0)
// {
// if (StatusTwo.Count > 0)
// {
// StatusTwo.Clear();
// }
// foreach (var item in list)
// {
// StatusTwo.Add(item);
// }
// fryOneDataVisible = Visibility.Collapsed;
// fryTwoDataVisible = Visibility.Visible;
// fryThreeDataVisible = Visibility.Collapsed;
// fryFourDataVisible = Visibility.Collapsed;
// fryFiveDataVisible = Visibility.Collapsed;
// }
// else
// {
// MessageBox.Show("未找到对应数据", "提示", MessageBoxButton.OK, MessageBoxImage.Information);
// }
// }
// if (cboSelectedValue == "3号炒锅")
// {
// List<PotThreeStatus> listThree = Sqlite<PotThreeStatus>.GetInstance.Base.ToList();
// var list = listThree.Where(p => p.Time.Equals(Convert.ToDateTime(SelectedDate).ToShortDateString()));
// if (list != null && list.Count() != 0)
// {
// if (StatusThree.Count > 0)
// {
// StatusThree.Clear();
// }
// foreach (var item in list)
// {
// StatusThree.Add(item);
// }
// fryOneDataVisible = Visibility.Collapsed;
// fryTwoDataVisible = Visibility.Collapsed;
// fryThreeDataVisible = Visibility.Visible;
// fryFourDataVisible = Visibility.Collapsed;
// fryFiveDataVisible = Visibility.Collapsed;
// }
// else
// {
// MessageBox.Show("未找到对应数据", "提示", MessageBoxButton.OK, MessageBoxImage.Information);
// }
// }
// if (cboSelectedValue == "4号炒锅")
// {
// List<PotFourStatus> listFour = Sqlite<PotFourStatus>.GetInstance.Base.ToList();
// var list = listFour.Where(p => p.Time.Equals(Convert.ToDateTime(SelectedDate).ToShortDateString()));
// if (list != null && list.Count() != 0)
// {
// if (StatusFour.Count > 0)
// {
// StatusFour.Clear();
// }
// foreach (var item in list)
// {
// StatusFour.Add(item);
// }
// fryOneDataVisible = Visibility.Collapsed;
// fryTwoDataVisible = Visibility.Collapsed;
// fryThreeDataVisible = Visibility.Collapsed;
// fryFourDataVisible = Visibility.Visible;
// fryFiveDataVisible = Visibility.Collapsed;
// }
// else
// {
// MessageBox.Show("未找到对应数据", "提示", MessageBoxButton.OK, MessageBoxImage.Information);
// }
// }
// if (cboSelectedValue == "5号炒锅")
// {
// List<PotFiveStatus> listFive = Sqlite<PotFiveStatus>.GetInstance.Base.ToList();
// var list = listFive.Where(p => p.Time.Equals(Convert.ToDateTime(SelectedDate).ToShortDateString()));
// if (list != null && list.Count() != 0)
// {
// if (StatusFive.Count > 0)
// {
// StatusFive.Clear();
// }
// foreach (var item in list)
// {
// StatusFive.Add(item);
// }
// fryOneDataVisible = Visibility.Collapsed;
// fryTwoDataVisible = Visibility.Collapsed;
// fryThreeDataVisible = Visibility.Collapsed;
// fryFourDataVisible = Visibility.Collapsed;
// fryFiveDataVisible = Visibility.Visible;
// }
// else
// {
// MessageBox.Show("未找到对应数据", "提示", MessageBoxButton.OK, MessageBoxImage.Information);
// }
// }
//}
#endregion
using (OpenFileDialog openFile = new OpenFileDialog())
{
if (cboSelectedValue == "1号炒锅")
{
List<PotOneStatus> listOne = Sqlite<PotOneStatus>.GetInstance.Base.ToList();
var list = listOne.Where(p => p.Time.Equals(Convert.ToDateTime(SelectedDate).ToShortDateString()));
if (list != null && list.Count() != 0)
{
if (StatusOne.Count > 0)
{
StatusOne.Clear();
}
foreach (var item in list)
{
StatusOne.Add(item);
}
fryOneDataVisible = Visibility.Visible;
fryTwoDataVisible = Visibility.Collapsed;
fryThreeDataVisible = Visibility.Collapsed;
fryFourDataVisible = Visibility.Collapsed;
fryFiveDataVisible = Visibility.Collapsed;
}
else
{
MessageBox.Show("未找到对应数据","提示",MessageBoxButton.OK,MessageBoxImage.Information);
}
}
if (cboSelectedValue == "2号炒锅")
{
List<PotTwoStatus> listTwo = Sqlite<PotTwoStatus>.GetInstance.Base.ToList();
var list = listTwo.Where(p => p.Time.Equals(Convert.ToDateTime(SelectedDate).ToShortDateString()));
if (list != null && list.Count() != 0)
{
if (StatusTwo.Count > 0)
{
StatusTwo.Clear();
}
foreach (var item in list)
{
StatusTwo.Add(item);
}
fryOneDataVisible = Visibility.Collapsed;
fryTwoDataVisible = Visibility.Visible;
fryThreeDataVisible = Visibility.Collapsed;
fryFourDataVisible = Visibility.Collapsed;
fryFiveDataVisible = Visibility.Collapsed;
}
else
{
MessageBox.Show("未找到对应数据", "提示", MessageBoxButton.OK, MessageBoxImage.Information);
}
}
if (cboSelectedValue == "3号炒锅")
{
List<PotThreeStatus> listThree = Sqlite<PotThreeStatus>.GetInstance.Base.ToList();
var list = listThree.Where(p => p.Time.Equals(Convert.ToDateTime(SelectedDate).ToShortDateString()));
if (list != null && list.Count() != 0)
{
if (StatusThree.Count > 0)
{
StatusThree.Clear();
}
foreach (var item in list)
{
StatusThree.Add(item);
}
fryOneDataVisible = Visibility.Collapsed;
fryTwoDataVisible = Visibility.Collapsed;
fryThreeDataVisible = Visibility.Visible;
fryFourDataVisible = Visibility.Collapsed;
fryFiveDataVisible = Visibility.Collapsed;
}
else
{
MessageBox.Show("未找到对应数据", "提示", MessageBoxButton.OK, MessageBoxImage.Information);
}
}
if (cboSelectedValue == "4号炒锅")
{
List<PotFourStatus> listFour = Sqlite<PotFourStatus>.GetInstance.Base.ToList();
var list = listFour.Where(p => p.Time.Equals(Convert.ToDateTime(SelectedDate).ToShortDateString()));
if (list != null&&list.Count()!=0)
{
if (StatusFour.Count > 0)
{
StatusFour.Clear();
}
foreach (var item in list)
{
StatusFour.Add(item);
}
fryOneDataVisible = Visibility.Collapsed;
fryTwoDataVisible = Visibility.Collapsed;
fryThreeDataVisible = Visibility.Collapsed;
fryFourDataVisible = Visibility.Visible;
fryFiveDataVisible = Visibility.Collapsed;
}
else
{
MessageBox.Show("未找到对应数据", "提示", MessageBoxButton.OK, MessageBoxImage.Information);
}
}
if (cboSelectedValue == "5号炒锅")
openFile.Title = "请选择对应数据文件";
openFile.Filter = "*.BIN|*.bin";
openFile.InitialDirectory = AppDomain.CurrentDomain.BaseDirectory + "AccessFile\\" + "DB\\";
openFile.Multiselect = false;
DialogResult res = openFile.ShowDialog();
if (res == DialogResult.OK)
{
List<PotFiveStatus> listFive = Sqlite<PotFiveStatus>.GetInstance.Base.ToList();
var list = listFive.Where(p => p.Time.Equals(Convert.ToDateTime(SelectedDate).ToShortDateString()));
if (list != null && list.Count() != 0)
string file = openFile.FileName;
if (Path.GetExtension(file).Equals(".bin"))
{
if (StatusFive.Count > 0)
if (Status.Count > 0)
{
StatusFive.Clear();
Status.Clear();
}
foreach (var item in list)
using (FileStream readStream = new FileStream(file, FileMode.Open, FileAccess.Read))
{
StatusFive.Add(item);
readStream.Position = 0;
while (readStream.Position < readStream.Length)
{
BinaryFormatter bf = new BinaryFormatter();
object a = bf.Deserialize(readStream);
if (a is PotOneStatus p1)
{

Status.Add(p1);

}
if (a is PotTwoStatus p2)
{

Status.Add(p2);

}
if (a is PotThreeStatus p3)
{

Status.Add(p3);

}
if (a is PotFourStatus p4)
{

Status.Add(p4);

}
if (a is PotFiveStatus p5)
{

Status.Add(p5);

}
}
}
fryOneDataVisible = Visibility.Collapsed;
fryTwoDataVisible = Visibility.Collapsed;
fryThreeDataVisible = Visibility.Collapsed;
fryFourDataVisible = Visibility.Collapsed;
fryFiveDataVisible = Visibility.Visible;
}
else
{
MessageBox.Show("未找到对应数据", "提示", MessageBoxButton.OK, MessageBoxImage.Information);
}
}
}

});
}
}


+ 1
- 1
FryPot_DosingSystem/ViewModel/UserManageViewModel.cs 파일 보기

@@ -59,7 +59,7 @@ namespace FryPot_DosingSystem.ViewModel
{
if (str != string.Empty && str != null)
{
var userInfo = usersInfo.FirstOrDefault(p => p.UserName == str);
var userInfo = usersInfo.FirstOrDefault(p => p.Id == str);
if (userInfo != null)
{
if (usersInfo.Remove(userInfo))


불러오는 중...
취소
저장