ZhaoGang 1 year ago
parent
commit
920c12071d
4 changed files with 262 additions and 261 deletions
  1. +12
    -2
      BPASmartClient.CustomResource/Pages/Model/AlarmHelper.cs
  2. +0
    -1
      DosingSystem/BPASmartClient.DosingSystem.csproj
  3. +2
    -2
      DosingSystem/Model/DeviceInquire.cs
  4. +248
    -256
      FryPot_DosingSystem/Control/DosingLogicControl.cs

+ 12
- 2
BPASmartClient.CustomResource/Pages/Model/AlarmHelper.cs View File

@@ -107,8 +107,18 @@ namespace BPASmartClient.CustomResource.Pages.Model
Time = DateTime.Now.ToString("HH:mm:ss"),
};

var res = Sqlite<Alarm>.GetInstance.Base.Add(tempAlarm);
Sqlite<Alarm>.GetInstance.Save();
var res = Sqlite<BPASmartClient.Model.Alarm>.GetInstance.Base.Add(tempAlarm);
try
{
Sqlite<BPASmartClient.Model.Alarm>.GetInstance.Save();
}
catch (Exception)
{

//throw;
}

if (Alarms.FirstOrDefault(p => p.Info == AlarmInfo) == null)
{


+ 0
- 1
DosingSystem/BPASmartClient.DosingSystem.csproj View File

@@ -21,7 +21,6 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="BPA.Helper" Version="1.0.54" />
<PackageReference Include="BPA.Message" Version="1.0.86" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
</ItemGroup>


+ 2
- 2
DosingSystem/Model/DeviceInquire.cs View File

@@ -197,9 +197,9 @@ namespace BPASmartClient.DosingSystem
}
}
}*/
for (int i = 0; i < 15; i++)
for (int i = 0; i < 6; i++)
{
IPLists.Add($"{IPSegment}{(i + 1) * 10}");
IPLists.Add($"{IPSegment}{(i + 1) * 10}");
}

IPLists.ForEach((item) =>


+ 248
- 256
FryPot_DosingSystem/Control/DosingLogicControl.cs View File

@@ -455,7 +455,7 @@ namespace FryPot_DosingSystem.Control
HubHelper.GetInstance.Upstreamrequest = new Action<object>(AgvFeedBackUpReportDataAnalysis);
//ResetProgram();
ReadPlcData();
HeatBeatToPlc();
// HeatBeatToPlc();
SaveFryPotData();
MainTask();
CommandRegist();
@@ -1623,260 +1623,260 @@ namespace FryPot_DosingSystem.Control
/// </summary>
public void ReadPlcData()
{
ThreadManage.GetInstance().StartLong(new Action(() =>
{
GetAddressData("D0000", new Action<ushort[]>((data) =>
{
try
{
if (data.Count() > 0)
{
//globalVar.rollerLineOne.StationOne = data[0];
if (globalVar.LineHeartBeat!= data[0])
{
if (globalVar.LBeatStopTimes >= 10)
{
ActionManage.GetInstance.Send("HeartBeatCheck", false);
MessageNotify.GetInstance.ShowRunLog("滚筒线心跳恢复");
}
globalVar.CanPlaceOrder = true;//允许下单
globalVar.LBeatStopTimes = 0;
globalVar.LineHeartBeat = data[0];
}
else
{
//ThreadManage.GetInstance().StartLong(new Action(() =>
//{
// GetAddressData("D0000", new Action<ushort[]>((data) =>
// {
// try
// {
// if (data.Count() > 0)
// {
// //globalVar.rollerLineOne.StationOne = data[0];
// if (globalVar.LineHeartBeat!= data[0])
// {
// if (globalVar.LBeatStopTimes >= 10)
// {
// ActionManage.GetInstance.Send("HeartBeatCheck", false);
// MessageNotify.GetInstance.ShowRunLog("滚筒线心跳恢复");
// }
// globalVar.CanPlaceOrder = true;//允许下单
// globalVar.LBeatStopTimes = 0;
// globalVar.LineHeartBeat = data[0];
// }
// else
// {
globalVar.LBeatStopTimes++;
if (globalVar.LBeatStopTimes >= 10)
{
globalVar.CanPlaceOrder = false;//不允许下单
ActionManage.GetInstance.Send("HeartBeatCheck", true);
if(globalVar.LBeatStopTimes>=10&& globalVar.LBeatStopTimes<13)
MessageNotify.GetInstance.ShowRunLog("滚筒线心跳心跳异常");
}
// globalVar.LBeatStopTimes++;
// if (globalVar.LBeatStopTimes >= 10)
// {
// globalVar.CanPlaceOrder = false;//不允许下单
// ActionManage.GetInstance.Send("HeartBeatCheck", true);
// if(globalVar.LBeatStopTimes>=10&& globalVar.LBeatStopTimes<13)
// MessageNotify.GetInstance.ShowRunLog("滚筒线心跳心跳异常");
// }
}
}
}
catch (Exception)
{

// throw;
}
}));
Thread.Sleep(500);
}), "滚筒线心跳检测");
ThreadManage.GetInstance().StartLong(new Action(() =>
{
GetFryOneData("D0000", new Action<ushort[]>((data) =>
{
try
{
if (data.Count() > 0)
{
//globalVar.rollerLineOne.StationOne = data[0];
if (globalVar.PotOneHeartBeat != data[0])
{
if (globalVar.POneBeatStopTimes >= 10)
{
ActionManage.GetInstance.Send("HeartBeatCheck", false);
MessageNotify.GetInstance.ShowRunLog("1号炒锅心跳恢复");
}
globalVar.POneBeatStopTimes = 0;
globalVar.PotOneHeartBeat = data[0];
}
else
{

globalVar.POneBeatStopTimes++;
if (globalVar.POneBeatStopTimes >= 10)
{
ActionManage.GetInstance.Send("HeartBeatCheck", true);
if (globalVar.POneBeatStopTimes >= 10 && globalVar.POneBeatStopTimes < 13)
MessageNotify.GetInstance.ShowRunLog("1号炒锅心跳异常");
}

//不允许下单
}
}
}
catch (Exception)
{

// throw;
}
}));
Thread.Sleep(500);
}), "炒锅1心跳检测");

ThreadManage.GetInstance().StartLong(new Action(() =>
{
GetFryTwoData("D0000", new Action<ushort[]>((data) =>
{
try
{
if (data.Count() > 0)
{
//globalVar.rollerLineOne.StationOne = data[0];
if (globalVar.PotTwoHeartBeat != data[0])
{
if (globalVar.PTwoBeatStopTimes >= 10)
{
ActionManage.GetInstance.Send("HeartBeatCheck", false);
MessageNotify.GetInstance.ShowRunLog("2号炒锅心跳恢复");
}
globalVar.PTwoBeatStopTimes = 0;
globalVar.PotTwoHeartBeat = data[0];
}
else
{

globalVar.PTwoBeatStopTimes++;
if (globalVar.PTwoBeatStopTimes >= 10)
{
ActionManage.GetInstance.Send("HeartBeatCheck", true);
if (globalVar.PTwoBeatStopTimes >= 10 && globalVar.PTwoBeatStopTimes < 13)
MessageNotify.GetInstance.ShowRunLog("2号炒锅心跳异常");
}

//不允许下单
}
}
}
catch (Exception)
{

// throw;
}
}));
Thread.Sleep(500);
}), "炒锅2心跳检测");
ThreadManage.GetInstance().StartLong(new Action(() =>
{
GetFryThreeData("D0000", new Action<ushort[]>((data) =>
{
try
{
if (data.Count() > 0)
{
//globalVar.rollerLineOne.StationOne = data[0];
if (globalVar.PotThreeHeartBeat != data[0])
{
if (globalVar.PThreeBeatStopTimes >= 10)
{
ActionManage.GetInstance.Send("HeartBeatCheck", false);
MessageNotify.GetInstance.ShowRunLog("3号炒锅心跳恢复");
}
globalVar.PThreeBeatStopTimes = 0;
globalVar.PotThreeHeartBeat = data[0];
}
else
{

globalVar.PThreeBeatStopTimes++;
if (globalVar.PThreeBeatStopTimes >= 10)
{
ActionManage.GetInstance.Send("HeartBeatCheck", true);
if (globalVar.PThreeBeatStopTimes >= 10 && globalVar.PThreeBeatStopTimes < 13)
MessageNotify.GetInstance.ShowRunLog("3号炒锅心跳异常");
}
// }
// }
// }
// catch (Exception)
// {

//不允许下单
}
}
}
catch (Exception)
{
// // throw;
// }
// }));
// Thread.Sleep(500);
//}), "滚筒线心跳检测");
//ThreadManage.GetInstance().StartLong(new Action(() =>
//{
// GetFryOneData("D0000", new Action<ushort[]>((data) =>
// {
// try
// {
// if (data.Count() > 0)
// {
// //globalVar.rollerLineOne.StationOne = data[0];
// if (globalVar.PotOneHeartBeat != data[0])
// {
// if (globalVar.POneBeatStopTimes >= 10)
// {
// ActionManage.GetInstance.Send("HeartBeatCheck", false);
// MessageNotify.GetInstance.ShowRunLog("1号炒锅心跳恢复");
// }
// globalVar.POneBeatStopTimes = 0;
// globalVar.PotOneHeartBeat = data[0];
// }
// else
// {

// globalVar.POneBeatStopTimes++;
// if (globalVar.POneBeatStopTimes >= 10)
// {
// ActionManage.GetInstance.Send("HeartBeatCheck", true);
// if (globalVar.POneBeatStopTimes >= 10 && globalVar.POneBeatStopTimes < 13)
// MessageNotify.GetInstance.ShowRunLog("1号炒锅心跳异常");
// }

// //不允许下单
// }
// }
// }
// catch (Exception)
// {

// throw;
}
}));
Thread.Sleep(500);
}), "炒锅3心跳检测");
ThreadManage.GetInstance().StartLong(new Action(() =>
{
GetFryFourData("D0000", new Action<ushort[]>((data) =>
{
try
{
if (data.Count() > 0)
{
//globalVar.rollerLineOne.StationOne = data[0];
if (globalVar.PotFourHeartBeat != data[0])
{
if (globalVar.PFourBeatStopTimes >= 10)
{
ActionManage.GetInstance.Send("HeartBeatCheck", false);
MessageNotify.GetInstance.ShowRunLog("4号炒锅心跳恢复");
}
globalVar.PFourBeatStopTimes = 0;
globalVar.PotFourHeartBeat = data[0];
}
else
{
globalVar.PFourBeatStopTimes++;
if (globalVar.PFourBeatStopTimes >= 10)
{
ActionManage.GetInstance.Send("HeartBeatCheck", true);
if (globalVar.PFourBeatStopTimes >= 10 && globalVar.PFourBeatStopTimes < 13)
MessageNotify.GetInstance.ShowRunLog("4号炒锅心跳异常");
}
// // throw;
// }
// }));
// Thread.Sleep(500);
//}), "炒锅1心跳检测");

//不允许下单
}
}
}
catch (Exception)
{
//ThreadManage.GetInstance().StartLong(new Action(() =>
//{
// GetFryTwoData("D0000", new Action<ushort[]>((data) =>
// {
// try
// {
// if (data.Count() > 0)
// {
// //globalVar.rollerLineOne.StationOne = data[0];
// if (globalVar.PotTwoHeartBeat != data[0])
// {
// if (globalVar.PTwoBeatStopTimes >= 10)
// {
// ActionManage.GetInstance.Send("HeartBeatCheck", false);
// MessageNotify.GetInstance.ShowRunLog("2号炒锅心跳恢复");
// }
// globalVar.PTwoBeatStopTimes = 0;
// globalVar.PotTwoHeartBeat = data[0];
// }
// else
// {

// globalVar.PTwoBeatStopTimes++;
// if (globalVar.PTwoBeatStopTimes >= 10)
// {
// ActionManage.GetInstance.Send("HeartBeatCheck", true);
// if (globalVar.PTwoBeatStopTimes >= 10 && globalVar.PTwoBeatStopTimes < 13)
// MessageNotify.GetInstance.ShowRunLog("2号炒锅心跳异常");
// }

// //不允许下单
// }
// }
// }
// catch (Exception)
// {

// throw;
}
}));
Thread.Sleep(500);
}), "炒锅4心跳检测");
ThreadManage.GetInstance().StartLong(new Action(() =>
{
GetFryFiveData("D0000", new Action<ushort[]>((data) =>
{
try
{
if (data.Count() > 0)
{
//globalVar.rollerLineOne.StationOne = data[0];
if (globalVar.PotFiveHeartBeat != data[0])
{
if (globalVar.PFiveBeatStopTimes >= 10)
{
ActionManage.GetInstance.Send("HeartBeatCheck", false);
MessageNotify.GetInstance.ShowRunLog("5号炒锅心跳恢复");
}
globalVar.PFiveBeatStopTimes = 0;
globalVar.PotFiveHeartBeat = data[0];
}
else
{
// // throw;
// }
// }));
// Thread.Sleep(500);
//}), "炒锅2心跳检测");
//ThreadManage.GetInstance().StartLong(new Action(() =>
//{
// GetFryThreeData("D0000", new Action<ushort[]>((data) =>
// {
// try
// {
// if (data.Count() > 0)
// {
// //globalVar.rollerLineOne.StationOne = data[0];
// if (globalVar.PotThreeHeartBeat != data[0])
// {
// if (globalVar.PThreeBeatStopTimes >= 10)
// {
// ActionManage.GetInstance.Send("HeartBeatCheck", false);
// MessageNotify.GetInstance.ShowRunLog("3号炒锅心跳恢复");
// }
// globalVar.PThreeBeatStopTimes = 0;
// globalVar.PotThreeHeartBeat = data[0];
// }
// else
// {

// globalVar.PThreeBeatStopTimes++;
// if (globalVar.PThreeBeatStopTimes >= 10)
// {
// ActionManage.GetInstance.Send("HeartBeatCheck", true);
// if (globalVar.PThreeBeatStopTimes >= 10 && globalVar.PThreeBeatStopTimes < 13)
// MessageNotify.GetInstance.ShowRunLog("3号炒锅心跳异常");
// }

// //不允许下单
// }
// }
// }
// catch (Exception)
// {

globalVar.PFiveBeatStopTimes++;
if (globalVar.PFiveBeatStopTimes >= 10)
{
ActionManage.GetInstance.Send("HeartBeatCheck", true);
if (globalVar.PFiveBeatStopTimes >= 10 && globalVar.PFiveBeatStopTimes < 13)
MessageNotify.GetInstance.ShowRunLog("5号炒锅心跳异常");
}
// // throw;
// }
// }));
// Thread.Sleep(500);
//}), "炒锅3心跳检测");
//ThreadManage.GetInstance().StartLong(new Action(() =>
//{
// GetFryFourData("D0000", new Action<ushort[]>((data) =>
// {
// try
// {
// if (data.Count() > 0)
// {
// //globalVar.rollerLineOne.StationOne = data[0];
// if (globalVar.PotFourHeartBeat != data[0])
// {
// if (globalVar.PFourBeatStopTimes >= 10)
// {
// ActionManage.GetInstance.Send("HeartBeatCheck", false);
// MessageNotify.GetInstance.ShowRunLog("4号炒锅心跳恢复");
// }
// globalVar.PFourBeatStopTimes = 0;
// globalVar.PotFourHeartBeat = data[0];
// }
// else
// {
// globalVar.PFourBeatStopTimes++;
// if (globalVar.PFourBeatStopTimes >= 10)
// {
// ActionManage.GetInstance.Send("HeartBeatCheck", true);
// if (globalVar.PFourBeatStopTimes >= 10 && globalVar.PFourBeatStopTimes < 13)
// MessageNotify.GetInstance.ShowRunLog("4号炒锅心跳异常");
// }

// //不允许下单
// }
// }
// }
// catch (Exception)
// {

//不允许下单
}
}
}
catch (Exception)
{
// // throw;
// }
// }));
// Thread.Sleep(500);
//}), "炒锅4心跳检测");
//ThreadManage.GetInstance().StartLong(new Action(() =>
//{
// GetFryFiveData("D0000", new Action<ushort[]>((data) =>
// {
// try
// {
// if (data.Count() > 0)
// {
// //globalVar.rollerLineOne.StationOne = data[0];
// if (globalVar.PotFiveHeartBeat != data[0])
// {
// if (globalVar.PFiveBeatStopTimes >= 10)
// {
// ActionManage.GetInstance.Send("HeartBeatCheck", false);
// MessageNotify.GetInstance.ShowRunLog("5号炒锅心跳恢复");
// }
// globalVar.PFiveBeatStopTimes = 0;
// globalVar.PotFiveHeartBeat = data[0];
// }
// else
// {

// globalVar.PFiveBeatStopTimes++;
// if (globalVar.PFiveBeatStopTimes >= 10)
// {
// ActionManage.GetInstance.Send("HeartBeatCheck", true);
// if (globalVar.PFiveBeatStopTimes >= 10 && globalVar.PFiveBeatStopTimes < 13)
// MessageNotify.GetInstance.ShowRunLog("5号炒锅心跳异常");
// }

// //不允许下单
// }
// }
// }
// catch (Exception)
// {

// throw;
}
}));
Thread.Sleep(500);
}), "炒锅5心跳检测");
// // throw;
// }
// }));
// Thread.Sleep(500);
//}), "炒锅5心跳检测");
//PLC数据读取
ThreadManage.GetInstance().StartLong(new Action(() =>
{
@@ -4025,10 +4025,7 @@ namespace FryPot_DosingSystem.Control
materialType = result.materialCollection[i],
materialId = result.RecipeId
});
RollerThreeDataWrite(i, result.materialCollection[i].MaterialLoc, (ushort)(result.materialCollection[i].MaterialWeight + RollerNetweight), result.materialCollection[i].MaterialOffset * 10);//3号滚筒线桶号以及重量数据、偏差量下发



RollerThreeDataWrite(i, result.materialCollection[i].MaterialLoc, (ushort)(result.materialCollection[i].MaterialWeight*10 + RollerNetweight*10), result.materialCollection[i].MaterialOffset * 10);//3号滚筒线桶号以及重量数据、偏差量下发
}
else
{
@@ -4231,7 +4228,7 @@ namespace FryPot_DosingSystem.Control
materialType = result.materialCollection[i],
materialId = result.RecipeId
});
RollerTwoDataWrite(i, result.materialCollection[i].MaterialLoc, (ushort)(result.materialCollection[i].MaterialWeight + RollerNetweight), result.materialCollection[i].MaterialOffset*10);//2号滚筒线桶号以及重量、偏差量数据下发
RollerTwoDataWrite(i, result.materialCollection[i].MaterialLoc, (ushort)(result.materialCollection[i].MaterialWeight*10 + RollerNetweight*10), result.materialCollection[i].MaterialOffset*10);//2号滚筒线桶号以及重量、偏差量数据下发



@@ -4457,12 +4454,7 @@ namespace FryPot_DosingSystem.Control
materialType = result.materialCollection[i],
materialId = result.RecipeId
});
RollerOneDataWrite(i, result.materialCollection[i].MaterialLoc, (ushort)(result.materialCollection[i].MaterialWeight + RollerNetweight), result.materialCollection[i].MaterialOffset*10);//1号滚筒线桶号以及重量、偏差量数据下发





RollerOneDataWrite(i, result.materialCollection[i].MaterialLoc, (ushort)(result.materialCollection[i].MaterialWeight*10 + RollerNetweight*10), result.materialCollection[i].MaterialOffset*10);//1号滚筒线桶号以及重量、偏差量数据下发
}
else
{


Loading…
Cancel
Save