taoye 2 лет назад
Родитель
Сommit
9dd80b6e06
11 измененных файлов: 628 добавлений и 176 удалений
  1. +42
    -42
      BPASmartClient.AGV/AGVHelper.cs
  2. +1
    -1
      BPASmartClient.CustomResource/Pages/View/VariableConfigView.xaml
  3. +397
    -81
      FryPot_DosingSystem/Control/DosingLogicControl.cs
  4. +16
    -8
      FryPot_DosingSystem/FryPotStatus/PotFiveStatus.cs
  5. +15
    -8
      FryPot_DosingSystem/FryPotStatus/PotFourStatus.cs
  6. +15
    -8
      FryPot_DosingSystem/FryPotStatus/PotOneStatus.cs
  7. +16
    -8
      FryPot_DosingSystem/FryPotStatus/PotThreeStatus.cs
  8. +15
    -8
      FryPot_DosingSystem/FryPotStatus/PotTwoStatus.cs
  9. +50
    -5
      FryPot_DosingSystem/View/SqliteDataView.xaml
  10. +4
    -1
      FryPot_DosingSystem/View/SqliteDataView.xaml.cs
  11. +57
    -6
      FryPot_DosingSystem/ViewModel/SqliteDataViewModel.cs

+ 42
- 42
BPASmartClient.AGV/AGVHelper.cs Просмотреть файл

@@ -95,49 +95,49 @@ namespace BPASmartClient.AGV
/// <returns></returns>
public string AgvToLineOneLoadRoller(string robotJobId)
{
string url = AGVRequestUrl.GetInstance.TaskSendUrl;
//请求报文头
HttpRequestHeaderModel.GetInstance.appKey = "";
HttpRequestHeaderModel.GetInstance.appSecret = "";
HttpRequestHeaderModel.GetInstance.requestId = "";
HttpRequestHeaderModel.GetInstance.timestamp = "";
HttpRequestHeaderModel.GetInstance.version = "2.8";
string head = JsonConvert.SerializeObject(HttpRequestHeaderModel.GetInstance);
//请求报文体
AGVModel.GetInstance.robotJobId = robotJobId;//上游提供
AGVModel.GetInstance.warehouseId = 123; //仓库编号
AGVModel.GetInstance.jobPriority = 1;//任务执行的优先级
AGVModel.GetInstance.jobPriorityType = 1;//0:根据优先级来执行,1:强制执行
AGVModel.GetInstance.jobType = "POINT_ROLLER_MOVE"; //SLOT_ROLLER_MOVE / POINT_ROLLER_MOVE
//详细任务数据
//点到点
AGV_PointRollerJobData.GetInstance.startPoint = "";//起点点位
AGV_PointRollerJobData.GetInstance.endPoint = "";//目的点位
AGV_PointRollerJobData.GetInstance.autoLoad = true;//是否自动上料 true:自动上料 false:人工上料
AGV_PointRollerJobData.GetInstance.enableIOLoad = true;//上料交互方式 false:接口交互 true:光电交互
AGV_PointRollerJobData.GetInstance.autoUnload = true;//是否自动下料 true:自动下料 false:人工下料
AGV_PointRollerJobData.GetInstance.enableIOUnload = true;//下料交互方式 false:接口交互 true:光电交互
AGVModel.GetInstance.jobData = AGV_PointRollerJobData.GetInstance;
string body = JsonConvert.SerializeObject(AGVModel.GetInstance);
// string newBody = String.Join(",\r\n", body.Split(','));//格式处理,看需求

//货位到货位
//AGV_SlotRollerJobData.GetInstance.startSlotCode = "";//起点槽位编号
//AGV_SlotRollerJobData.GetInstance.endSlotCode = "";//目的槽位编号
//AGV_SlotRollerJobData.GetInstance.autoLoad = true;//是否自动上料 true:自动上料 false:人工上料
//AGV_SlotRollerJobData.GetInstance.enableIOLoad = true;//上料交互方式 false:接口交互 true:光电交互
//AGV_SlotRollerJobData.GetInstance.autoUnload = true;//是否自动下料 true:自动下料 false:人工下料
//AGV_SlotRollerJobData.GetInstance.enableIOUnload = true;//下料交互方式 false:接口交互 true:光电交互
//AGVModel.GetInstance.jobData = AGV_SlotRollerJobData.GetInstance;
//string url = AGVRequestUrl.GetInstance.TaskSendUrl;
////请求报文头
//HttpRequestHeaderModel.GetInstance.appKey = "";
//HttpRequestHeaderModel.GetInstance.appSecret = "";
//HttpRequestHeaderModel.GetInstance.requestId = "";
//HttpRequestHeaderModel.GetInstance.timestamp = "";
//HttpRequestHeaderModel.GetInstance.version = "2.8";
//string head = JsonConvert.SerializeObject(HttpRequestHeaderModel.GetInstance);
////请求报文体
//AGVModel.GetInstance.robotJobId = robotJobId;//上游提供
//AGVModel.GetInstance.warehouseId = 123; //仓库编号
//AGVModel.GetInstance.jobPriority = 1;//任务执行的优先级
//AGVModel.GetInstance.jobPriorityType = 1;//0:根据优先级来执行,1:强制执行
//AGVModel.GetInstance.jobType = "POINT_ROLLER_MOVE"; //SLOT_ROLLER_MOVE / POINT_ROLLER_MOVE
////详细任务数据
////点到点
//AGV_PointRollerJobData.GetInstance.startPoint = "";//起点点位
//AGV_PointRollerJobData.GetInstance.endPoint = "";//目的点位
//AGV_PointRollerJobData.GetInstance.autoLoad = true;//是否自动上料 true:自动上料 false:人工上料
//AGV_PointRollerJobData.GetInstance.enableIOLoad = true;//上料交互方式 false:接口交互 true:光电交互
//AGV_PointRollerJobData.GetInstance.autoUnload = true;//是否自动下料 true:自动下料 false:人工下料
//AGV_PointRollerJobData.GetInstance.enableIOUnload = true;//下料交互方式 false:接口交互 true:光电交互
//AGVModel.GetInstance.jobData = AGV_PointRollerJobData.GetInstance;
//string body = JsonConvert.SerializeObject(AGVModel.GetInstance);
//启用签名
//url = url + "?sign=" + MD5Deal(body);
string data = HttpRequest(url, head, body);
object objData = JsonConvert.DeserializeObject(data);
if (objData != null && objData is HttpResponseBodyModel response)
{
return response.code;
}
//// string newBody = String.Join(",\r\n", body.Split(','));//格式处理,看需求

////货位到货位
////AGV_SlotRollerJobData.GetInstance.startSlotCode = "";//起点槽位编号
////AGV_SlotRollerJobData.GetInstance.endSlotCode = "";//目的槽位编号
////AGV_SlotRollerJobData.GetInstance.autoLoad = true;//是否自动上料 true:自动上料 false:人工上料
////AGV_SlotRollerJobData.GetInstance.enableIOLoad = true;//上料交互方式 false:接口交互 true:光电交互
////AGV_SlotRollerJobData.GetInstance.autoUnload = true;//是否自动下料 true:自动下料 false:人工下料
////AGV_SlotRollerJobData.GetInstance.enableIOUnload = true;//下料交互方式 false:接口交互 true:光电交互
////AGVModel.GetInstance.jobData = AGV_SlotRollerJobData.GetInstance;
////string body = JsonConvert.SerializeObject(AGVModel.GetInstance);
////启用签名
////url = url + "?sign=" + MD5Deal(body);
//string data = HttpRequest(url, head, body);
//object objData = JsonConvert.DeserializeObject(data);
//if (objData != null && objData is HttpResponseBodyModel response)
//{
// return response.code;
//}
return "Analysis Error";
}
/// <summary>


+ 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>


+ 397
- 81
FryPot_DosingSystem/Control/DosingLogicControl.cs Просмотреть файл

@@ -21,6 +21,7 @@ using FryPot_DosingSystem.AGV;
using FryPot_DosingSystem.FryPotStatus;
using System.IO;
using System.Runtime.Serialization.Formatters.Binary;
using System.Diagnostics;

namespace FryPot_DosingSystem.Control
{
@@ -106,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上料位置
@@ -248,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");
@@ -262,58 +269,220 @@ 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 time1 = Sqlite<PotOneStatus>.GetInstance.GetData().Last().Time;
if (time1.Equals(DateTime.Now.ToShortDateString()))//和当天时间一样

}
string[] filesFive = Directory.GetDirectories("AccessFile//DB//炒锅5状态数据");
if (filesFive.Count() > 0)
{
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
{
string time2 = Sqlite<PotTwoStatus>.GetInstance.GetData().Last().Time;
if (time2.Equals(DateTime.Now.ToShortDateString()))//和当天时间一样
return -1;
}
}
/// <summary>
/// 炒锅数据实时保存
/// </summary>
/// <exception cref="NotImplementedException"></exception>
private void SaveFryPotData()
{
Task.Run(new Action(() =>
{
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]);

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


RollerLineStatusDisplay();

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

@@ -912,7 +1078,14 @@ namespace FryPot_DosingSystem.Control
FryPotInfoManage.GetInstance.variableInfos.FirstOrDefault(p => p.VarName == "FryPotFiveOil").CurrentValue = FryPotMonitorManage.GetInstance.fryFive.OilCapacity.ToString();
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();
FryPotDataSaveToBinaryFile();

//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>
/// 炒锅状态数据保存到二进制文件
@@ -927,12 +1100,12 @@ namespace FryPot_DosingSystem.Control
if (!Directory.Exists("AccessFile\\" + "DB" + "炒锅1状态数据\\" + DateTime.Now.ToShortDateString()))
Directory.CreateDirectory("AccessFile\\" + "DB\\" + "炒锅1状态数据\\" + DateTime.Now.ToShortDateString());

if (globalVar.LOneFryPotSerial == 1)
if (globalVar.LOneFryPotSerial == 1 && fryOneRecipe != string.Empty)
{
using (FileStream writeStream = new FileStream("AccessFile\\" + "DB\\" + "炒锅1状态数据\\" + DateTime.Now.ToShortDateString() + "\\" + DateTime.Now.ToString("hh:mm:ss") + "-" + globalVar.LOneCurrentRecipeName + ".bin", FileMode.OpenOrCreate, FileAccess.Write))
using (FileStream writeStream = new FileStream("AccessFile\\" + "DB\\" + "炒锅1状态数据\\" + DateTime.Now.ToShortDateString() + "\\" + DateTime.Now.ToString("hh:mm").Replace(':', '.') + fryOneRecipe + ".bin", FileMode.OpenOrCreate, FileAccess.Write))
{
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, Time = DateTime.Now.ToShortDateString() };
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);

@@ -943,12 +1116,12 @@ namespace FryPot_DosingSystem.Control
{
if (!Directory.Exists("AccessFile\\" + "DB" + "炒锅1状态数据\\" + DateTime.Now.ToShortDateString()))
Directory.CreateDirectory("AccessFile\\" + "DB\\" + "炒锅1状态数据\\" + DateTime.Now.ToShortDateString());
if (globalVar.LOneFryPotSerial == 1)
if (globalVar.LOneFryPotSerial == 1 && fryOneRecipe != string.Empty)
{
using (FileStream writeStream = new FileStream("AccessFile\\" + "DB\\" + "炒锅1状态数据\\" + DateTime.Now.ToShortDateString() + "\\" + DateTime.Now.ToString("hh:mm:ss") + "-" + globalVar.LOneCurrentRecipeName + ".bin", FileMode.OpenOrCreate, FileAccess.Write))
using (FileStream writeStream = new FileStream("AccessFile\\" + "DB\\" + "炒锅1状态数据\\" + DateTime.Now.ToShortDateString() + "\\" + DateTime.Now.ToString("hh:mm").Replace(':', '.') + fryOneRecipe + ".bin", FileMode.OpenOrCreate, FileAccess.Write))
{
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, Time = DateTime.Now.ToShortDateString() };
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);

@@ -956,18 +1129,19 @@ namespace FryPot_DosingSystem.Control
}
}
#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.LOneFryPotSerial == 2)
if (globalVar.LTwoFryPotSerial == 2 && fryTwoRecipe != string.Empty)
{
using (FileStream writeStream = new FileStream("AccessFile\\" + "DB\\" + "炒锅2状态数据\\" + DateTime.Now.ToShortDateString() + "\\" + DateTime.Now.ToString("hh:mm:ss") + "-" + globalVar.LTwoCurrentRecipeName + ".bin", FileMode.OpenOrCreate, FileAccess.Write))
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, Time = DateTime.Now.ToShortDateString() };
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);

@@ -978,18 +1152,127 @@ namespace FryPot_DosingSystem.Control
{
if (!Directory.Exists("AccessFile\\" + "DB" + "炒锅2状态数据\\" + DateTime.Now.ToShortDateString()))
Directory.CreateDirectory("AccessFile\\" + "DB\\" + "炒锅2状态数据\\" + DateTime.Now.ToShortDateString());
if (globalVar.LOneFryPotSerial == 2)
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\\" + "炒锅2状态数据\\" + DateTime.Now.ToShortDateString() + "\\" + DateTime.Now.ToString("hh:mm:ss") + "-" + globalVar.LTwoCurrentRecipeName + ".bin", FileMode.OpenOrCreate, FileAccess.Write))
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);

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, Time = DateTime.Now.ToShortDateString() };
}
}
}
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>
/// 滚筒线运行状态显示
@@ -1234,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)//后续添加其它限制条件
@@ -1257,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()
@@ -1299,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; });
}
}

@@ -1346,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; }));
}
//将配方中原料加入新的队列
@@ -1387,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)//后续添加其它限制条件
@@ -1432,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; }));
}
//将配方中原料加入新的队列
@@ -1631,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)//炒锅滚筒无故障
{
@@ -1690,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)//炒锅滚筒无故障
{
@@ -1743,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)//炒锅滚筒无故障
{


+ 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>
/// 时间


+ 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;
}
}
}

+ 57
- 6
FryPot_DosingSystem/ViewModel/SqliteDataViewModel.cs Просмотреть файл

@@ -5,7 +5,9 @@ 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;
@@ -15,18 +17,20 @@ 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;
@@ -174,19 +178,66 @@ namespace FryPot_DosingSystem.ViewModel
// }
//}
#endregion
using (OpenFileDialog openFile = new OpenFileDialog())
{
openFile.Title = "请选择对应数据文件";
openFile.Filter = "*.BIN|*.bin";
openFile.InitialDirectory = AppDomain.CurrentDomain.BaseDirectory+"AccessFile\\"+"DB";
openFile.InitialDirectory = AppDomain.CurrentDomain.BaseDirectory + "AccessFile\\" + "DB\\";
openFile.Multiselect = false;
DialogResult res= openFile.ShowDialog();
DialogResult res = openFile.ShowDialog();
if (res == DialogResult.OK)
{
string file = openFile.FileName;
if (Path.GetExtension(file).Equals(".bin"))
{
if (Status.Count > 0)
{
Status.Clear();
}
using (FileStream readStream = new FileStream(file, FileMode.Open, FileAccess.Read))
{
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);

}
}
}
}
}
}
});
}
}


Загрузка…
Отмена
Сохранить