NXX преди 1 година
родител
ревизия
4822d05dd2
променени са 100 файла, в които са добавени 4487 реда и са изтрити 1606 реда
  1. +1
    -0
      BPASmart.MenuLoad/BPASmart.MenuLoad.csproj
  2. +1
    -1
      BPASmart.PageLoad/BPASmart.PageLoad.csproj
  3. +1
    -1
      BPASmart.VariableManager/ServiceCenter.cs
  4. +760
    -593
      BPASmartClient.AGV/AGVHelper.cs
  5. +9
    -9
      BPASmartClient.AGV/AGVModel.cs
  6. +1
    -1
      BPASmartClient.AGV/AGVRequestUrl.cs
  7. +4
    -4
      BPASmartClient.AGV/AGV_PointRollerJobData.cs
  8. +16
    -29
      BPASmartClient.AGV/Feedback/AGVToUpSystem.cs
  9. +53
    -0
      BPASmartClient.AGV/Feedback/EventData.cs
  10. +6
    -13
      BPASmartClient.AGV/Feedback/JobData.cs
  11. +14
    -0
      BPASmartClient.AGV/Feedback/LoadRequest.cs
  12. +14
    -0
      BPASmartClient.AGV/Feedback/TaskData.cs
  13. +25
    -0
      BPASmartClient.AGV/Feedback/TaskEventData.cs
  14. +50
    -41
      BPASmartClient.AGV/Feedback/Upstreamrequest.cs
  15. +1
    -1
      BPASmartClient.AGV/HttpResponseBodyModel.cs
  16. +2
    -2
      BPASmartClient.AGV/HttpResponseData.cs
  17. +1
    -1
      BPASmartClient.AGV/HttpResponseHeaderModel.cs
  18. +3
    -3
      BPASmartClient.AGV/HttpResponseModel.cs
  19. +33
    -17
      BPASmartClient.AgvApi/Controllers/robotjobController.cs
  20. +24
    -6
      BPASmartClient.CustomResource/BPASmartClient.CustomResource.csproj
  21. +28
    -0
      BPASmartClient.CustomResource/Converters/BoolToFillColorConverter.cs
  22. +28
    -0
      BPASmartClient.CustomResource/Converters/BoolToVisibilityConvert.cs
  23. +33
    -0
      BPASmartClient.CustomResource/Converters/CountIsVisiableConvert.cs
  24. +31
    -0
      BPASmartClient.CustomResource/Converters/DataTableRedundantConverter.cs
  25. +35
    -0
      BPASmartClient.CustomResource/Converters/ForegroundConverter.cs
  26. +48
    -0
      BPASmartClient.CustomResource/Converters/StatusIconConverter.cs
  27. Двоични данни
     
  28. Двоични данни
     
  29. Двоични данни
     
  30. Двоични данни
     
  31. Двоични данни
     
  32. Двоични данни
     
  33. Двоични данни
     
  34. Двоични данни
     
  35. Двоични данни
     
  36. Двоични данни
     
  37. +15
    -0
      BPASmartClient.CustomResource/Pages/Enums/Status.cs
  38. +161
    -16
      BPASmartClient.CustomResource/Pages/Model/AlarmHelper.cs
  39. +145
    -0
      BPASmartClient.CustomResource/Pages/Model/AlarmTest.cs
  40. +12
    -10
      BPASmartClient.CustomResource/Pages/Model/MessageNotify.cs
  41. +2
    -2
      BPASmartClient.CustomResource/Pages/View/LoginView.xaml
  42. +14
    -12
      BPASmartClient.CustomResource/Pages/View/PromptView.xaml
  43. +1
    -0
      BPASmartClient.CustomResource/Pages/View/PromptView.xaml.cs
  44. +285
    -74
      BPASmartClient.CustomResource/Pages/View/UserManagerView.xaml
  45. +2
    -2
      BPASmartClient.CustomResource/Pages/ViewModel/MainViewModel.cs
  46. +2
    -2
      BPASmartClient.CustomResource/Pages/ViewModel/NfcSetViewModel.cs
  47. +1
    -1
      BPASmartClient.CustomResource/Pages/ViewModel/RunLogViewModel.cs
  48. +1
    -1
      BPASmartClient.CustomResource/Pages/ViewModel/UserLogViewModel.cs
  49. +2
    -0
      BPASmartClient.CustomResource/Pages/ViewModel/VariableViewModel.cs
  50. +157
    -0
      BPASmartClient.CustomResource/RecDictionarys/GlobalDataTableStyle.xaml
  51. +128
    -0
      BPASmartClient.CustomResource/RecDictionarys/GlobalStyle.xaml
  52. +88
    -0
      BPASmartClient.CustomResource/RecDictionarys/RecToggleButton.xaml
  53. Двоични данни
     
  54. +77
    -49
      BPASmartClient.CustomResource/UserControls/ConveyBelt2.xaml
  55. +201
    -120
      BPASmartClient.CustomResource/UserControls/MaterialStock.xaml
  56. Двоични данни
     
  57. +0
    -9
      BPASmartClient.DATABUS/BPASmartClient.DATABUS.csproj
  58. +2
    -2
      BPASmartClient.DosingProject/App.xaml.cs
  59. +12
    -12
      BPASmartClient.DosingProject/Model/ProcessControl.cs
  60. +10
    -10
      BPASmartClient.DosingProject/Model/RawMaterial/DeviceInquire.cs
  61. +2
    -2
      BPASmartClient.DosingProject/ViewModel/NewMaterialViewModel.cs
  62. +3
    -3
      BPASmartClient.DosingProject/ViewModel/RecipeControlViewModel.cs
  63. +1
    -1
      BPASmartClient.DosingProject/ViewModel/RecipeInfosViewModel.cs
  64. +9
    -9
      BPASmartClient.DosingProject/ViewModel/RecipeReceiveViewModel.cs
  65. +4
    -4
      BPASmartClient.DosingProject/ViewModel/RecipeSettingsViewModel.cs
  66. +1
    -1
      BPASmartClient.DosingProject/ViewModel/SiemensRecipeReceiveViewModel.cs
  67. +7
    -3
      BPASmartClient.Helper/RTrig.cs
  68. +2
    -4
      BPASmartClient.JXJFoodBigStation/App.config
  69. +3
    -2
      BPASmartClient.JXJFoodBigStation/App.xaml.cs
  70. +4
    -0
      BPASmartClient.JXJFoodBigStation/BPASmartClient.JXJFoodBigStation.csproj
  71. +7
    -2
      BPASmartClient.JXJFoodBigStation/Model/GVL_BigStation.cs
  72. +46
    -0
      BPASmartClient.JXJFoodBigStation/Model/HK_PLC/DB_Read.cs
  73. +127
    -0
      BPASmartClient.JXJFoodBigStation/Model/HK_PLC/DB_Write.cs
  74. +436
    -19
      BPASmartClient.JXJFoodBigStation/Model/HK_PLC/HKDeviceStatus.cs
  75. +41
    -0
      BPASmartClient.JXJFoodBigStation/Model/HK_PLC/StockBinName.cs
  76. +607
    -255
      BPASmartClient.JXJFoodBigStation/Model/ProcessControl.cs
  77. +39
    -0
      BPASmartClient.JXJFoodBigStation/Model/Siemens/DL_DataColl_DB.cs
  78. +23
    -12
      BPASmartClient.JXJFoodBigStation/Model/Siemens/DL_Finish_DB.cs
  79. +19
    -16
      BPASmartClient.JXJFoodBigStation/Model/Siemens/DL_Start_DB.cs
  80. +25
    -41
      BPASmartClient.JXJFoodBigStation/Model/Siemens/DL_Status_DB.cs
  81. +9
    -8
      BPASmartClient.JXJFoodBigStation/Model/Siemens/SiemensDeviceStatus.cs
  82. +1
    -1
      BPASmartClient.JXJFoodBigStation/ViewModel/RecipeInfosViewModel.cs
  83. +1
    -1
      BPASmartClient.JXJFoodBigStation/ViewModel/RecipeReceiveViewModel.cs
  84. +1
    -1
      BPASmartClient.JXJFoodBigStation/ViewModel/RecipeSendDownViewModel.cs
  85. +1
    -1
      BPASmartClient.JXJFoodSmallStation/App.config
  86. +12
    -4
      BPASmartClient.JXJFoodSmallStation/App.xaml.cs
  87. +4
    -0
      BPASmartClient.JXJFoodSmallStation/BPASmartClient.JXJFoodSmallStation.csproj
  88. +2
    -0
      BPASmartClient.JXJFoodSmallStation/Model/GVL_SmallStation.cs
  89. +11
    -10
      BPASmartClient.JXJFoodSmallStation/Model/HK_PLC/HKDeviceStatus.cs
  90. +18
    -0
      BPASmartClient.JXJFoodSmallStation/Model/HK_PLC/PlcManualComm.cs
  91. +111
    -57
      BPASmartClient.JXJFoodSmallStation/Model/ProcessControl.cs
  92. +24
    -17
      BPASmartClient.JXJFoodSmallStation/Model/RawMaterial/DeviceInquire.cs
  93. +12
    -11
      BPASmartClient.JXJFoodSmallStation/Model/Siemens/SiemensDeviceStatus.cs
  94. +39
    -0
      BPASmartClient.JXJFoodSmallStation/Model/Siemens/XL_DataColl_DB.cs
  95. +32
    -13
      BPASmartClient.JXJFoodSmallStation/Model/Siemens/XL_Finish_DB.cs
  96. +32
    -19
      BPASmartClient.JXJFoodSmallStation/Model/Siemens/XL_Start_DB.cs
  97. +29
    -44
      BPASmartClient.JXJFoodSmallStation/Model/Siemens/XL_Status_DB.cs
  98. +0
    -1
      BPASmartClient.JXJFoodSmallStation/View/HardwareStatusView.xaml
  99. +173
    -0
      BPASmartClient.JXJFoodSmallStation/View/ManualCommView.xaml
  100. +29
    -0
      BPASmartClient.JXJFoodSmallStation/View/ManualCommView.xaml.cs

+ 1
- 0
BPASmart.MenuLoad/BPASmart.MenuLoad.csproj Целия файл

@@ -19,6 +19,7 @@

<ItemGroup>
<ProjectReference Include="..\BeDesignerSCADA\BeDesignerSCADA.csproj" />
<ProjectReference Include="..\BPASmart.VariableManager\BPASmart.VariableManager.csproj" />
</ItemGroup>

<ItemGroup>


+ 1
- 1
BPASmart.PageLoad/BPASmart.PageLoad.csproj Целия файл

@@ -15,7 +15,7 @@
<ProjectReference Include="..\BeDesignerSCADA\BeDesignerSCADA.csproj" />
<ProjectReference Include="..\BPASmart.Model\BPASmart.Model.csproj" />
<ProjectReference Include="..\BPASmartClient.MessageCommunication\BPASmartClient.MessageCommunication.csproj" />
<ProjectReference Include="..\BPASmartClient.MessageName\BPASmartClient.MessageName.csproj" />
<!--<ProjectReference Include="..\BPASmartClient.MessageName\BPASmartClient.MessageName.csproj" />-->
<ProjectReference Include="..\BPASmartClient.SCADAControl\BPASmartClient.SCADAControl.csproj" />
</ItemGroup>



+ 1
- 1
BPASmart.VariableManager/ServiceCenter.cs Целия файл

@@ -55,8 +55,8 @@ namespace BPASmart.VariableManager
Thread.Sleep(100);
}), "客户端管道消息控制");
pipeClient.PushCommand = new Action<string>((s) => { if (pipeClient.IsConnected) msg.Enqueue(s); });
pipeClient.StartPipeStream();
MessageLog.GetInstance.NotifyShow = new Action<string>((o) => { if (pipeClient.IsConnected) pipeClient.SendCommand(o); });
pipeClient.StartPipeStream();

}



+ 760
- 593
BPASmartClient.AGV/AGVHelper.cs
Файловите разлики са ограничени, защото са твърде много
Целия файл


+ 9
- 9
BPASmartClient.AGV/AGVModel.cs Целия файл

@@ -22,8 +22,8 @@ namespace BPASmartClient.AGV
/// 必填项
/// </summary>
public long warehouseId { get; set; }
public string? robotJobGroupId { get; set; }
public int? sequence { get; set; }
//public string? robotJobGroupId { get; set; }
//public int? sequence { get; set; }
/// <summary>
/// 必填项
/// </summary>
@@ -32,13 +32,13 @@ namespace BPASmartClient.AGV
/// 必填项
/// </summary>
public int jobPriorityType { get; set; }
public string? deadline { get; set; }
public string? agvType { get; set; }
public string? agvEndPoint { get; set; }
public bool? needOperation { get; set; }
public string? agvCode { get; set; }
public int? taskCountDown { get; set; }
public string? businessType { get; set; }
//public string? deadline { get; set; }
//public string? agvType { get; set; }
//public string? agvEndPoint { get; set; }
//public bool? needOperation { get; set; }
//public string? agvCode { get; set; }
//public int? taskCountDown { get; set; }
//public string? businessType { get; set; }
/// <summary>
/// 必填项
/// </summary>


+ 1
- 1
BPASmartClient.AGV/AGVRequestUrl.cs Целия файл

@@ -6,7 +6,7 @@
public static AGVRequestUrl GetInstance => _instance ??= new AGVRequestUrl();
public AGVRequestUrl()
{
string IpAddress = "";
string IpAddress = "172.16.12.200";
TaskSendUrl= $"http://{IpAddress}/api/quicktron/wcs/standardized.robot.job.submit";
TaskCancelUrl= $"http://{IpAddress}/api/quicktron/wcs/standardized.robot.job.cancel";
TaskCompleteUrl= $"http://{IpAddress}/api/quicktron/wcs/standardized.operation.notice";


+ 4
- 4
BPASmartClient.AGV/AGV_PointRollerJobData.cs Целия файл

@@ -13,7 +13,7 @@ namespace BPASmartClient.AGV
{
//private static AGV_PointRollerJobData _instance;
//public static AGV_PointRollerJobData GetInstance => _instance ??= new AGV_PointRollerJobData();
public string? containerCode { get; set; }
// public string? containerCode { get; set; }
public string startPoint { get; set; }
public string endPoint { get; set; }
public bool autoLoad { get; set; }
@@ -22,8 +22,8 @@ namespace BPASmartClient.AGV
public bool enableIOUnload { get; set; }
public long? loadEquipmentId { get; set; } = null;
public long? unloadEquipmentId { get; set; } = null;
public bool? loadInteractive { get; set; }
public int? loadHeight { get; set; }
public int? unloadHeight { get; set; }
//public bool? loadInteractive { get; set; }
//public int? loadHeight { get; set; }
//public int? unloadHeight { get; set; }
}
}

+ 16
- 29
BPASmartClient.AGV/Feedback/AGVToUpSystem.cs Целия файл

@@ -8,34 +8,21 @@ namespace BPASmartClient.AGV.Feedback
{
public class AGVToUpSystem
{
/// <summary>
/// 上游系统任务号,全局唯一
/// </summary>
public string robotJobId { get; set; }

/// <summary>
/// 仓库编号
/// </summary>
public int warehouseId { get; set; }

/// <summary>
/// 任务快仓系统编号
/// </summary>
public string jobId { get; set; }

/// <summary>
/// 任务状态
/// </summary>
public string state { get; set; }

/// <summary>
/// 内部任务类型
/// </summary>
public string jobType { get; set; }

/// <summary>
/// 数据字段
/// </summary>
public JobData jobData { get; set; } = new JobData();

public TaskEventData @event { get; set; }



public string id { get; set;}

public string type { get; set; }

public string ts { get; set; }

public long warehouseId { get; set; }

public string zoneCode { get; set; }
}
}

+ 53
- 0
BPASmartClient.AGV/Feedback/EventData.cs Целия файл

@@ -0,0 +1,53 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace BPASmartClient.AGV.Feedback
{
public class EventData
{
/// <summary>
/// AGV编号
/// </summary>
public string agvCode { get; set; }

/// <summary>
/// 容器编号,如果一次上/下多个容器,则多个容器用英文逗号分隔
/// </summary>
public string containerCode { get; set; }

/// <summary>
/// 上游设备ID 本字段适用于只有一个辊筒设备的时候使用
/// </summary>
public long equipmentId { get; set; }

///// <summary>
///// 上游设备ID,多个用英文逗号分隔 本字段适用于多辊筒同时上下料的时候使用
///// </summary>
//public string equipmentIds { get; set; }

/// <summary>
/// 快仓任务编号
/// </summary>
public string jobId { get; set; }

/// <summary>
/// 消息ID
/// </summary>
public string msgId { get; set; }

/// <summary>
/// 交互阶段
/// LOAD:上料阶段
/// UNLOAD:下料阶段
/// </summary>
public string command { get; set; }

///// <summary>
///// 上游任务号
///// </summary>
//public string robotJobId { get; set; }
}
}

+ 6
- 13
BPASmartClient.AGV/Feedback/JobData.cs Целия файл

@@ -18,29 +18,22 @@ namespace BPASmartClient.AGV.Feedback
/// </summary>
public string containerCode { get; set; }


public string pointCode { get; set; }

/// <summary>
/// 上料点位
/// </summary>
public string startPointCode { get; set; }

/// <summary>
/// 上料货位编号
/// </summary>
public string startSlotCode { get; set; }

/// <summary>
/// 下料点位
/// </summary>
public string targetPointCode { get; set; }

/// <summary>
/// 下料货位编号
/// </summary>
public string targetSlotCode { get; set; }

/// <summary>
/// 是否需要上料交互
/// </summary>
public bool loadInteractive { get; set; }
}
}

+ 14
- 0
BPASmartClient.AGV/Feedback/LoadRequest.cs Целия файл

@@ -0,0 +1,14 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace BPASmartClient.AGV.Feedback
{
public class LoadRequest
{
public HttpResponseHeaderModel header { get; set; }
public Upstreamrequest body { get; set; }
}
}

+ 14
- 0
BPASmartClient.AGV/Feedback/TaskData.cs Целия файл

@@ -0,0 +1,14 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace BPASmartClient.AGV.Feedback
{
public class TaskData
{
public HttpResponseHeaderModel header { get; set; }
public AGVToUpSystem body { get; set; }
}
}

+ 25
- 0
BPASmartClient.AGV/Feedback/TaskEventData.cs Целия файл

@@ -0,0 +1,25 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace BPASmartClient.AGV.Feedback
{
public class TaskEventData
{
public JobData jobData { get; set; }

public string jobId { get; set; }

public string jobType { get; set; }

public string robotJobId{get;set;}

public string state { get; set;}

public long warehouseId { get; set; }


}
}

+ 50
- 41
BPASmartClient.AGV/Feedback/Upstreamrequest.cs Целия файл

@@ -8,46 +8,55 @@ namespace BPASmartClient.AGV.Feedback
{
public class Upstreamrequest
{
/// <summary>
/// AGV编号
/// </summary>
public string agvCode { get; set; }

/// <summary>
/// 容器编号,如果一次上/下多个容器,则多个容器用英文逗号分隔
/// </summary>
public string containerCode { get; set; }

/// <summary>
/// 上游设备ID 本字段适用于只有一个辊筒设备的时候使用
/// </summary>
public long equipmentId { get; set; }

/// <summary>
/// 上游设备ID,多个用英文逗号分隔 本字段适用于多辊筒同时上下料的时候使用
/// </summary>
public string equipmentIds { get; set; }

/// <summary>
/// 快仓任务编号
/// </summary>
public string jobId { get; set; }

/// <summary>
/// 消息ID
/// </summary>
public string msgId { get; set; }

/// <summary>
/// 交互阶段
/// LOAD:上料阶段
/// UNLOAD:下料阶段
/// </summary>
public string command { get; set; }

/// <summary>
/// 上游任务号
/// </summary>
public string robotJobId { get; set; }
public EventData @event { get; set; }

public string ts { get; set; }

public string type { get; set; }

public string zoneCode { get; set; }

public long warehouseId { get; set; }
///// <summary>
///// AGV编号
///// </summary>
//public string agvCode { get; set; }

///// <summary>
///// 容器编号,如果一次上/下多个容器,则多个容器用英文逗号分隔
///// </summary>
//public string containerCode { get; set; }

///// <summary>
///// 上游设备ID 本字段适用于只有一个辊筒设备的时候使用
///// </summary>
//public long equipmentId { get; set; }

///// <summary>
///// 上游设备ID,多个用英文逗号分隔 本字段适用于多辊筒同时上下料的时候使用
///// </summary>
//public string equipmentIds { get; set; }

///// <summary>
///// 快仓任务编号
///// </summary>
//public string jobId { get; set; }

///// <summary>
///// 消息ID
///// </summary>
//public string msgId { get; set; }

///// <summary>
///// 交互阶段
///// LOAD:上料阶段
///// UNLOAD:下料阶段
///// </summary>
//public string command { get; set; }

///// <summary>
///// 上游任务号
///// </summary>
//public string robotJobId { get; set; }
}
}

+ 1
- 1
BPASmartClient.AGV/HttpResponseBodyModel.cs Целия файл

@@ -6,7 +6,7 @@ using System.Threading.Tasks;

namespace BPASmartClient.AGV
{
internal class HttpResponseBodyModel
public class HttpResponseBodyModel
{
public string code { get; set; }
public string message { get; set; }


+ 2
- 2
BPASmartClient.AGV/HttpResponseData.cs Целия файл

@@ -6,10 +6,10 @@ using System.Threading.Tasks;

namespace BPASmartClient.AGV
{
internal class HttpResponseData
public class HttpResponseData
{
public string code { get; set; }
public bool message { get; set; }
public string message { get; set; }
public string robotJobId { get; set; }
}
}

+ 1
- 1
BPASmartClient.AGV/HttpResponseHeaderModel.cs Целия файл

@@ -6,7 +6,7 @@ using System.Threading.Tasks;

namespace BPASmartClient.AGV
{
internal class HttpResponseHeaderModel
public class HttpResponseHeaderModel
{
public string? requestId { get; set; }
public string? timestamp { get; set; }


+ 3
- 3
BPASmartClient.AGV/HttpResponseModel.cs Целия файл

@@ -6,9 +6,9 @@ using System.Threading.Tasks;

namespace BPASmartClient.AGV
{
internal class HttpResponseModel
public class HttpResponseModel
{
public HttpResponseHeaderModel? Header { get; set; }
public HttpResponseBodyModel? Body { get; set; }
public HttpResponseHeaderModel? header { get; set; }
public HttpResponseBodyModel? body { get; set; }
}
}

+ 33
- 17
BPASmartClient.AgvApi/Controllers/robotjobController.cs Целия файл

@@ -1,4 +1,5 @@
using BPASmartClient.AGV.Feedback;
using BPASmartClient.AGV;
using BPASmartClient.AGV.Feedback;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.SignalR;
using Newtonsoft.Json;
@@ -28,28 +29,32 @@ namespace BPASmartClient.AgvApi.Controllers
{
string body = await reader.ReadToEndAsync();

AGVToUpSystem s = JsonConvert.DeserializeObject<AGVToUpSystem>(body);
if (s != null)
var res = JsonConvert.DeserializeObject<TaskData>(body);
var r = res.body.@event;
if (r != null)
{
await Factory.GetInstance.SendReport(s);
return "SUCCESS";
await Factory.GetInstance.SendReport(r);
return "Report SUCCESS";
}

}
//var res = JsonConvert.DeserializeObject<AGVToUpSystem>(sign);
//if (res != null)
//{
// Factory.GetInstance.SendReport(res);
// return "SUCCESS";
//}
}
catch (Exception ex)
{
return ex.ToString();
}
//var res = JsonConvert.DeserializeObject<AGVToUpSystem>(sign);
// if (res != null)
// {
// Factory.GetInstance.SendReport(res);
// return "SUCCESS";
// }
//}


// }
//}
return "Error";

}

/// <summary>
@@ -67,21 +72,32 @@ namespace BPASmartClient.AgvApi.Controllers
using (StreamReader reader = new StreamReader(Request.Body, Encoding.UTF8))
{
string body = await reader.ReadToEndAsync();
var res = JsonConvert.DeserializeObject<Upstreamrequest>(body);
if (res != null)
var res = JsonConvert.DeserializeObject<LoadRequest>(body);
var r = res.body.@event;
if (r != null)
{
await Factory.GetInstance.SendUpstreamrequest(res);
return "SUCCESS";
await Factory.GetInstance.SendUpstreamrequest(r);
//return "UpStream SUCCESS";
return JsonConvert.SerializeObject(new HttpResponseModel() { header = new HttpResponseHeaderModel { requestId = res.header.requestId,timestamp=DateTime.Now.ToString(),version="2.7" } ,body = new HttpResponseBodyModel() { success = true, code = "SUCCESS", message = "", data = null } });
}
}
//var res = JsonConvert.DeserializeObject<Upstreamrequest>(sign);
//if (res != null)
//{
// Factory.GetInstance.SendUpstreamrequest(res);
// return "SUCCESS";
//}
}
catch (Exception ex)
{
return ex.ToString();
}

// }
//}
return "Error";

}

}


+ 24
- 6
BPASmartClient.CustomResource/BPASmartClient.CustomResource.csproj Целия файл

@@ -200,6 +200,8 @@
<None Remove="Image\组 8.png" />
<None Remove="Image\组合边框1.1.png" />
<None Remove="Image\组合边框1.png" />
<None Remove="Image\组合边框2.1.png" />
<None Remove="Image\组合边框2.png" />
<None Remove="Image\维护.png" />
<None Remove="Image\背景.png" />
<None Remove="Image\背景2.png" />
@@ -213,6 +215,14 @@
<None Remove="Image\背景矢量\左下.png" />
<None Remove="Image\背景矢量\矢量智能对象.png" />
<None Remove="Image\背景边框4.png" />
<None Remove="Image\荧光\29.png" />
<None Remove="Image\荧光\发光.png" />
<None Remove="Image\荧光\向下箭头.png" />
<None Remove="Image\荧光\底座.png" />
<None Remove="Image\荧光\矩形发光.png" />
<None Remove="Image\荧光\立体三角.png" />
<None Remove="Image\荧光\蓝色提示框.png" />
<None Remove="Image\荧光\返回.png" />
<None Remove="Image\营销额.png" />
<None Remove="Image\蓝色背景.png" />
<None Remove="Image\蓝边框.png" />
@@ -269,12 +279,6 @@
</EmbeddedResource>
</ItemGroup>

<ItemGroup>
<Content Include="Videos\Login.mp4">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
</ItemGroup>

<ItemGroup>
<Resource Include="Fonts\80号-萌趣小鱼体.ttf" />
<Resource Include="Fonts\font\iconfont.ttf" />
@@ -358,10 +362,20 @@
<Resource Include="Image\组 8.png" />
<Resource Include="Image\组合边框1.1.png" />
<Resource Include="Image\组合边框1.png" />
<Resource Include="Image\组合边框2.1.png" />
<Resource Include="Image\组合边框2.png" />
<Resource Include="Image\背景2.png" />
<Resource Include="Image\背景3.jpg" />
<Resource Include="Image\背景框.png" />
<Resource Include="Image\背景边框4.png" />
<Resource Include="Image\荧光\29.png" />
<Resource Include="Image\荧光\发光.png" />
<Resource Include="Image\荧光\向下箭头.png" />
<Resource Include="Image\荧光\底座.png" />
<Resource Include="Image\荧光\矩形发光.png" />
<Resource Include="Image\荧光\立体三角.png" />
<Resource Include="Image\荧光\蓝色提示框.png" />
<Resource Include="Image\荧光\返回.png" />
<Resource Include="Image\蓝色背景.png" />
<Resource Include="Image\蓝边框.png" />
<Resource Include="Image\调味品.jpeg" />
@@ -538,4 +552,8 @@
<Resource Include="Image\黑菠萝科技.png" />
</ItemGroup>

<ItemGroup>
<Folder Include="Resources\" />
</ItemGroup>

</Project>

+ 28
- 0
BPASmartClient.CustomResource/Converters/BoolToFillColorConverter.cs Целия файл

@@ -0,0 +1,28 @@
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Data;
using System.Windows.Media;

namespace BPASmartClient.CustomResource.Converters
{
public class BoolToFillColorConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
if (value != null && value is bool tempBool)
{
return tempBool ? Brushes.Green : Brushes.Gray;
}
return Brushes.Gray;
}

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

+ 28
- 0
BPASmartClient.CustomResource/Converters/BoolToVisibilityConvert.cs Целия файл

@@ -0,0 +1,28 @@
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Data;

namespace BPASmartClient.CustomResource.Converters
{
public class BoolToVisibilityConvert : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
if (value != null && value is bool tempBool)
{
return tempBool ? Visibility.Visible : Visibility.Hidden;
}
return default;
}

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

+ 33
- 0
BPASmartClient.CustomResource/Converters/CountIsVisiableConvert.cs Целия файл

@@ -0,0 +1,33 @@
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Globalization;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Data;

namespace BPASmartClient.CustomResource.Converters
{
public class CountIsVisiableConvert : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
if (value != null)
{
var count = value?.GetType()?.GetProperty("Count")?.GetValue(value);
if (count != null && count is int tempCount)
{
if (tempCount > 0) return Visibility.Visible;
}
}
return Visibility.Collapsed;
}

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

+ 31
- 0
BPASmartClient.CustomResource/Converters/DataTableRedundantConverter.cs Целия файл

@@ -0,0 +1,31 @@
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Data;
using System.Windows.Media;

namespace BPASmartClient.CustomResource.Converters
{
public class DataTableRedundantConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
if (value != null && value is bool bit)
{
if (bit)
return new SolidColorBrush(Color.FromArgb(255, 245, 63, 98));
else
return new SolidColorBrush(Color.FromArgb(255, 42, 178, 231));
}
return default;
}

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

+ 35
- 0
BPASmartClient.CustomResource/Converters/ForegroundConverter.cs Целия файл

@@ -0,0 +1,35 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Data;
using System.Windows.Data;
using System.Globalization;
using System.Windows.Media;

namespace BPASmartClient.CustomResource.Converters
{
public class ForegroundConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
SolidColorBrush returnValue = new SolidColorBrush(Color.FromArgb(255, 0, 204, 255));
if (value != null)
{
if (value.ToString() == "等待配料")
returnValue = new SolidColorBrush(Color.FromArgb(255, 236, 187, 17));//黄 FFECBB11
else if (value.ToString() == "正在配料")
returnValue = new SolidColorBrush(Color.FromArgb(255, 22, 219, 234));//篮 FF16DBEA
else if (value.ToString() == "配料完成")
returnValue = new SolidColorBrush(Color.FromArgb(255, 43, 208, 111));//绿 FF2BD06F
}
return returnValue;
}

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

+ 48
- 0
BPASmartClient.CustomResource/Converters/StatusIconConverter.cs Целия файл

@@ -0,0 +1,48 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Data;
using System.Windows.Data;
using System.Globalization;
using System.Text.RegularExpressions;
using BPASmartClient.CustomResource.Pages.Enums;

namespace BPASmartClient.CustomResource.Converters
{
public class StatusIconConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
if (value != null)
{
if (value.ToString() == Status.等待配料.ToString())
return Regex.Unescape(StringToUnicode("&#xe616;"));
else if (value.ToString() == Status.正在配料.ToString())
return Regex.Unescape(StringToUnicode("&#xe685;"));
else if (value.ToString() == Status.配料完成.ToString())
return Regex.Unescape(StringToUnicode("&#xe62f;"));
}
return value;
}

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

/// <summary>
/// 字符串转为UniCode码字符串
/// </summary>
public static string StringToUnicode(string s)
{
if (!string.IsNullOrEmpty(s))
{
//这里把格式&#xe625; 转为 \ue625
return s.Replace(@"&#x", @"\u").Replace(";", "");
}
return s;
}
}
}

Двоични данни
Целия файл


Двоични данни
Целия файл


Двоични данни
Целия файл


Двоични данни
Целия файл


Двоични данни
Целия файл


Двоични данни
Целия файл


Двоични данни
Целия файл


Двоични данни
Целия файл


Двоични данни
Целия файл


Двоични данни
Целия файл


+ 15
- 0
BPASmartClient.CustomResource/Pages/Enums/Status.cs Целия файл

@@ -0,0 +1,15 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace BPASmartClient.CustomResource.Pages.Enums
{
public enum Status
{
等待配料,
正在配料,
配料完成
}
}

+ 161
- 16
BPASmartClient.CustomResource/Pages/Model/AlarmHelper.cs Целия файл

@@ -8,6 +8,7 @@ using System.Collections.ObjectModel;
using System.Linq;
using System.Reflection;
using System.Threading;
using System.Threading.Tasks;
using System.Windows;

namespace BPASmartClient.CustomResource.Pages.Model
@@ -15,6 +16,21 @@ namespace BPASmartClient.CustomResource.Pages.Model

public class AlarmHelper<AlarmT> where AlarmT : class, new()
{
private volatile static ConcurrentDictionary<string, AlarmT> _Instance;
private static readonly object Obj_Lock = new object();
public static AlarmT GetInstance(string name = "")
{
lock (Obj_Lock)
{
if (string.IsNullOrEmpty(name)) name = typeof(AlarmT).Name;
if (_Instance == null) _Instance = new ConcurrentDictionary<string, AlarmT>();
if (!_Instance.ContainsKey(name)) _Instance.TryAdd(name, new AlarmT());
return _Instance[name];
}
}
private AlarmHelper() { }


public static ObservableCollection<Alarm> Alarms { get; set; } = new ObservableCollection<Alarm>();
public static List<Alarm> HistoryAlarms { get; set; } = new List<Alarm>();
static ConcurrentDictionary<string, bool> flagbit = new ConcurrentDictionary<string, bool>();
@@ -23,22 +39,29 @@ namespace BPASmartClient.CustomResource.Pages.Model
public static Action<string> RemoveAction { get; set; }
public static Action ChangeAction { get; set; }

public static AlarmT Alarm { get; set; } = new AlarmT();
//public static AlarmT Alarm { get; set; } = new AlarmT();

public static void Init()
{
AlarmViewModel.AlarmInfos = Alarms;
ThreadManage.GetInstance().StartLong(new Action(() =>
{
foreach (var item in Alarm.GetType().GetProperties())
if (_Instance != null)
{
if (item.CustomAttributes.Count() > 0)
foreach (var temp in _Instance)
{
var AlarmModel = item.GetCustomAttribute<AlarmAttribute>();
if (AlarmModel != null)
foreach (var item in temp.Value.GetType().GetProperties())
{
bool value = Convert.ToBoolean(Alarm.GetType().GetProperty(item.Name)?.GetValue(Alarm));
EdgeAlarm(value, AlarmModel.AlarmInfo, 1, AlarmModel.AlarmLevel, AlarmModel.AlarmType);
if (item.CustomAttributes.Count() > 0)
{
var AlarmModel = item.GetCustomAttribute<AlarmAttribute>();
if (AlarmModel != null)
{
bool value = Convert.ToBoolean(_Instance[temp.Key].GetType().GetProperty(item.Name)?.GetValue(_Instance[temp.Key]));
string text = typeof(AlarmT).Name == temp.Key ? AlarmModel.AlarmInfo : $"{temp.Key}:{AlarmModel.AlarmInfo}";
EdgeAlarm(value, text, 1, AlarmModel.AlarmLevel, AlarmModel.AlarmType);
}
}
}
}
}
@@ -47,15 +70,6 @@ namespace BPASmartClient.CustomResource.Pages.Model

}


//public static void AnalogAlarm(dynamic Trigger, string info, dynamic HH = null, dynamic H = 0, dynamic L = 0, dynamic LL = 0)
//{

//}




/// <summary>
/// 沿报警检测
/// </summary>
@@ -131,4 +145,135 @@ namespace BPASmartClient.CustomResource.Pages.Model
}

}

//public class AlarmHelper<AlarmT> where AlarmT : class, new()
//{


// //private volatile static ConcurrentDictionary<string, AlarmT> _Instance;
// //public static AlarmT GetInstance(string name)
// //{
// // if (_Instance == null) _Instance = new ConcurrentDictionary<string, AlarmT>();
// // if (!_Instance.ContainsKey(name)) _Instance.TryAdd(name, new AlarmT());
// // return _Instance[name];
// //}
// //private AlarmHelper() { }


// public static ObservableCollection<Alarm> Alarms { get; set; } = new ObservableCollection<Alarm>();
// public static List<Alarm> HistoryAlarms { get; set; } = new List<Alarm>();
// static ConcurrentDictionary<string, bool> flagbit = new ConcurrentDictionary<string, bool>();
// static ConcurrentDictionary<string, Delay> delays = new ConcurrentDictionary<string, Delay>();
// public static Action<string> AddAction { get; set; }
// public static Action<string> RemoveAction { get; set; }
// public static Action ChangeAction { get; set; }

// public static AlarmT Alarm { get; set; } = new AlarmT();

// public static void Init()
// {
// AlarmViewModel.AlarmInfos = Alarms;
// ThreadManage.GetInstance().StartLong(new Action(() =>
// {
// foreach (var item in Alarm.GetType().GetProperties())
// {
// if (item.CustomAttributes.Count() > 0)
// {
// var AlarmModel = item.GetCustomAttribute<AlarmAttribute>();
// if (AlarmModel != null)
// {
// bool value = Convert.ToBoolean(Alarm.GetType().GetProperty(item.Name)?.GetValue(Alarm));
// EdgeAlarm(value, AlarmModel.AlarmInfo, 1, AlarmModel.AlarmLevel, AlarmModel.AlarmType);
// }
// }
// }
// Thread.Sleep(100);
// }), $"{typeof(AlarmT).Name},报警通用模块监听");

// }


// //public static void AnalogAlarm(dynamic Trigger, string info, dynamic HH = null, dynamic H = 0, dynamic L = 0, dynamic LL = 0)
// //{

// //}




// /// <summary>
// /// 沿报警检测
// /// </summary>
// /// <param name="Trigger">触发变量</param>
// /// <param name="text">报警信息</param>
// /// <param name="edgeType">触发类型,上升沿 或 下降沿</param>
// private static void EdgeAlarm(bool Trigger, string text, int delay = 2, AlarmLevel alarmLevel = AlarmLevel.一般报警, AlarmTriggerType edgeType = AlarmTriggerType.Rising)
// {
// if (!flagbit.ContainsKey(text)) flagbit.TryAdd(text, false);
// if (!delays.ContainsKey(text)) delays.TryAdd(text, Delay.GetInstance(text));
// if (edgeType == AlarmTriggerType.Rising ? delays[text].Start(Trigger, delay) : delays[text].Start(!Trigger, delay))
// {
// if (edgeType == AlarmTriggerType.Rising ? !flagbit[text] : flagbit[text])
// {
// AddAlarm(Trigger, text, alarmLevel);
// flagbit[text] = edgeType == AlarmTriggerType.Rising ? true : false;
// }
// }
// else RemoveAlarm(text);
// if (edgeType == AlarmTriggerType.Rising ? flagbit[text] : !flagbit[text]) flagbit[text] = Trigger;
// }

// /// <summary>
// /// 添加报警信息
// /// </summary>
// /// <param name="AlarmInfo">报警信息</param>
// private static void AddAlarm(object value, string AlarmInfo, AlarmLevel alarmLevel)
// {
// Alarm tempAlarm = new Alarm()
// {
// NumId = Alarms.Count + 1,
// Date = DateTime.Now.ToString("yyyy/MM/dd"),
// Grade = alarmLevel.ToString(),
// Info = AlarmInfo,
// Value = value.ToString(),
// Time = DateTime.Now.ToString("HH:mm:ss"),
// };

// var res = Sqlite<Alarm>.GetInstance.Base.Add(tempAlarm);
// Sqlite<Alarm>.GetInstance.Save();

// if (Alarms.FirstOrDefault(p => p.Info == AlarmInfo) == null)
// {
// Application.Current.Dispatcher.Invoke(new Action(() =>
// {
// Alarms.Insert(0, tempAlarm);
// for (int i = 0; i < Alarms.Count; i++) { Alarms.ElementAt(i).NumId = i + 1; }
// }));

// AddAction?.Invoke(AlarmInfo);//添加报警通知
// ChangeAction?.Invoke();//更改报警通知
// }
// }

// /// <summary>
// /// 移除报警信息
// /// </summary>
// /// <param name="AlarmInfo">报警信息</param>
// private static void RemoveAlarm(string AlarmInfo)
// {
// var result = Alarms.FirstOrDefault(p => p.Info == AlarmInfo);
// if (result != null)
// {
// Application.Current.Dispatcher.Invoke(new Action(() =>
// {
// Alarms.Remove(result);
// for (int i = 0; i < Alarms.Count; i++) { Alarms.ElementAt(i).NumId = i + 1; }
// }));

// if (RemoveAction != null) RemoveAction(AlarmInfo);
// if (ChangeAction != null) ChangeAction();
// }
// }

//}
}

+ 145
- 0
BPASmartClient.CustomResource/Pages/Model/AlarmTest.cs Целия файл

@@ -0,0 +1,145 @@
using BPASmartClient.CustomResource.Pages.ViewModel;
using BPASmartClient.Helper;
using BPASmartClient.Model;
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Reflection;
using System.Threading;
using System.Threading.Tasks;
using System.Windows;

namespace BPASmartClient.CustomResource.Pages.Model
{
public class AlarmTest<AlarmT> where AlarmT : class, new()
{


private volatile static ConcurrentDictionary<string, AlarmT> _Instance;
public static AlarmT GetInstance(string name = "")
{
if (string.IsNullOrEmpty(name)) name = typeof(AlarmT).Name;
if (_Instance == null) _Instance = new ConcurrentDictionary<string, AlarmT>();
if (!_Instance.ContainsKey(name)) _Instance.TryAdd(name, new AlarmT());
return _Instance[name];
}
private AlarmTest() { }


public static ObservableCollection<Alarm> Alarms { get; set; } = new ObservableCollection<Alarm>();
public static List<Alarm> HistoryAlarms { get; set; } = new List<Alarm>();
static ConcurrentDictionary<string, bool> flagbit = new ConcurrentDictionary<string, bool>();
static ConcurrentDictionary<string, Delay> delays = new ConcurrentDictionary<string, Delay>();
public static Action<string> AddAction { get; set; }
public static Action<string> RemoveAction { get; set; }
public static Action ChangeAction { get; set; }

//public static AlarmT Alarm { get; set; } = new AlarmT();

public static void Init()
{
AlarmViewModel.AlarmInfos = Alarms;
ThreadManage.GetInstance().StartLong(new Action(() =>
{
if (_Instance != null)
{
foreach (var temp in _Instance)
{
foreach (var item in temp.Value.GetType().GetProperties())
{
if (item.CustomAttributes.Count() > 0)
{
var AlarmModel = item.GetCustomAttribute<AlarmAttribute>();
if (AlarmModel != null)
{
bool value = Convert.ToBoolean(_Instance[temp.Key].GetType().GetProperty(item.Name)?.GetValue(_Instance[temp.Key]));
EdgeAlarm(value, $"{temp.Key}:{AlarmModel.AlarmInfo}", 1, AlarmModel.AlarmLevel, AlarmModel.AlarmType);
}
}
}
}
}
Thread.Sleep(100);
}), $"{typeof(AlarmT).Name},报警通用模块监听");

}

/// <summary>
/// 沿报警检测
/// </summary>
/// <param name="Trigger">触发变量</param>
/// <param name="text">报警信息</param>
/// <param name="edgeType">触发类型,上升沿 或 下降沿</param>
private static void EdgeAlarm(bool Trigger, string text, int delay = 2, AlarmLevel alarmLevel = AlarmLevel.一般报警, AlarmTriggerType edgeType = AlarmTriggerType.Rising)
{
if (!flagbit.ContainsKey(text)) flagbit.TryAdd(text, false);
if (!delays.ContainsKey(text)) delays.TryAdd(text, Delay.GetInstance(text));
if (edgeType == AlarmTriggerType.Rising ? delays[text].Start(Trigger, delay) : delays[text].Start(!Trigger, delay))
{
if (edgeType == AlarmTriggerType.Rising ? !flagbit[text] : flagbit[text])
{
AddAlarm(Trigger, text, alarmLevel);
flagbit[text] = edgeType == AlarmTriggerType.Rising ? true : false;
}
}
else RemoveAlarm(text);
if (edgeType == AlarmTriggerType.Rising ? flagbit[text] : !flagbit[text]) flagbit[text] = Trigger;
}

/// <summary>
/// 添加报警信息
/// </summary>
/// <param name="AlarmInfo">报警信息</param>
private static void AddAlarm(object value, string AlarmInfo, AlarmLevel alarmLevel)
{
Alarm tempAlarm = new Alarm()
{
NumId = Alarms.Count + 1,
Date = DateTime.Now.ToString("yyyy/MM/dd"),
Grade = alarmLevel.ToString(),
Info = AlarmInfo,
Value = value.ToString(),
Time = DateTime.Now.ToString("HH:mm:ss"),
};

var res = Sqlite<Alarm>.GetInstance.Base.Add(tempAlarm);
Sqlite<Alarm>.GetInstance.Save();

if (Alarms.FirstOrDefault(p => p.Info == AlarmInfo) == null)
{
Application.Current.Dispatcher.Invoke(new Action(() =>
{
Alarms.Insert(0, tempAlarm);
for (int i = 0; i < Alarms.Count; i++) { Alarms.ElementAt(i).NumId = i + 1; }
}));

AddAction?.Invoke(AlarmInfo);//添加报警通知
ChangeAction?.Invoke();//更改报警通知
}
}

/// <summary>
/// 移除报警信息
/// </summary>
/// <param name="AlarmInfo">报警信息</param>
private static void RemoveAlarm(string AlarmInfo)
{
var result = Alarms.FirstOrDefault(p => p.Info == AlarmInfo);
if (result != null)
{
Application.Current.Dispatcher.Invoke(new Action(() =>
{
Alarms.Remove(result);
for (int i = 0; i < Alarms.Count; i++) { Alarms.ElementAt(i).NumId = i + 1; }
}));

if (RemoveAction != null) RemoveAction(AlarmInfo);
if (ChangeAction != null) ChangeAction();
}
}

}

}

BPASmartClient.CustomResource/Pages/Model/MessageLog.cs → BPASmartClient.CustomResource/Pages/Model/MessageNotify.cs Целия файл

@@ -12,15 +12,15 @@ using BPASmartClient.CustomResource.Pages.View;

namespace BPASmartClient.CustomResource.Pages.Model
{
public class MessageLog
public class MessageNotify
{
private volatile static MessageLog _Instance;
public static MessageLog GetInstance => _Instance ??= new MessageLog();
private volatile static MessageNotify _Instance;
public static MessageNotify GetInstance => _Instance ??= new MessageNotify();

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

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

@@ -102,29 +102,31 @@ namespace BPASmartClient.CustomResource.Pages.Model
public bool ShowDialog(string info, DialogType dialogType = DialogType.Information)
{
PromptView PV = new PromptView();
PV.TextBlockInfo = info;
switch (dialogType)
{
case DialogType.Warning:
PV.TextBlockIcon = "&#xe61f;";
PV.TextBlockForeground = Brushes.Yellow;
PV.TextBlockInfo = $"警告:{info}";
PV.Cancel.Visibility = Visibility.Collapsed;
PV.infoType.Text = "警告:";
//PV.Cancel.Visibility = Visibility.Collapsed;
break;
case DialogType.Error:
PV.TextBlockIcon = "&#xed1a;";
PV.TextBlockForeground = Brushes.Red;
PV.TextBlockInfo = $"错误:{info}";
PV.Cancel.Visibility = Visibility.Collapsed;
PV.infoType.Text = "错误:";
//PV.Cancel.Visibility = Visibility.Collapsed;
break;
case DialogType.Information:
PV.TextBlockIcon = "&#xe657;";
PV.TextBlockForeground = Brushes.DeepSkyBlue;
PV.TextBlockInfo = $"提示:{info}";
PV.Cancel.Visibility = Visibility.Visible;
PV.infoType.Text = "提示:";
//PV.Cancel.Visibility = Visibility.Visible;
break;
default:
break;
}
PV.infoType.Foreground = PV.TextBlockForeground;
var res = PV.ShowDialog();
return res == null ? false : (bool)res;
}

+ 2
- 2
BPASmartClient.CustomResource/Pages/View/LoginView.xaml Целия файл

@@ -253,7 +253,7 @@
Grid.Row="1"
Grid.Column="1">
<Grid.RowDefinitions>
<RowDefinition Height="0.8*"/>
<RowDefinition Height="0.8*" />
<RowDefinition />
<RowDefinition />
<RowDefinition />
@@ -315,7 +315,7 @@
Text="请输入账号密码"
Visibility="Visible" />

<Grid Margin="0 20" Grid.Row="3">
<Grid Grid.Row="3" Margin="0,20">
<Grid.ColumnDefinitions>
<ColumnDefinition />
<ColumnDefinition />


+ 14
- 12
BPASmartClient.CustomResource/Pages/View/PromptView.xaml Целия файл

@@ -29,7 +29,7 @@
</Style>
</Window.Resources>

<Grid>
<Grid Name="main">
<Grid.Background>
<ImageBrush ImageSource="/BPASmartClient.CustomResource;component/Image/弹窗.png" Stretch="Fill" />
</Grid.Background>
@@ -44,24 +44,31 @@
BorderThickness="0"
Click="Button_Click" />

<Grid>
<Grid Margin="0,40,0,0">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="0.2*" />
<ColumnDefinition Width="0.15*" />
<ColumnDefinition />
</Grid.ColumnDefinitions>

<TextBlock
Name="infoType"
Grid.Column="1"
VerticalAlignment="Top"
FontSize="16"
Foreground="DeepSkyBlue" />
<TextBlock
Name="icon"
HorizontalAlignment="Center"
VerticalAlignment="Center"
VerticalAlignment="Top"
FontFamily="../../Fonts/#iconfont"
FontSize="30"
Foreground="DeepSkyBlue"
Text="&#xe61f;" />
<TextBlock
Name="info"
Grid.Column="1"
VerticalAlignment="Center"
Grid.Column="2"
Margin="10,0,0,0"
VerticalAlignment="Top"
Foreground="DeepSkyBlue"
Text="警告:"
TextWrapping="Wrap" />
@@ -77,7 +84,7 @@
Width="90"
Height="30"
Margin="5,0,5,0"
Click="Cancel_Click"
Click="Cancel_Click"
Content="取消"
FontSize="20"
Style="{StaticResource ImageButtonStyle}" />
@@ -98,10 +105,5 @@
<RowDefinition Height="0.5*" />
</Grid.RowDefinitions>
</Grid>





</Grid>
</Window>

+ 1
- 0
BPASmartClient.CustomResource/Pages/View/PromptView.xaml.cs Целия файл

@@ -23,6 +23,7 @@ namespace BPASmartClient.CustomResource.Pages.View
public PromptView()
{
InitializeComponent();
this.main.MouseLeftButtonDown += (o, e) => { if (e.LeftButton == MouseButtonState.Pressed) this.DragMove(); };
}

public string TextBlockIcon


+ 285
- 74
BPASmartClient.CustomResource/Pages/View/UserManagerView.xaml Целия файл

@@ -1,54 +1,67 @@
<UserControl x:Class="BPASmartClient.CustomResource.Pages.View.UserManagerView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:BPASmartClient.CustomResource.Pages.View"
xmlns:vm="clr-namespace:BPASmartClient.CustomResource.Pages.ViewModel"
Width="1400"
Height="900"
Background="{x:Null}"
mc:Ignorable="d">
<UserControl
x:Class="BPASmartClient.CustomResource.Pages.View.UserManagerView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:con="clr-namespace:BPASmartClient.CustomResource.Converters"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:BPASmartClient.CustomResource.Pages.View"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:vm="clr-namespace:BPASmartClient.CustomResource.Pages.ViewModel"
Width="1400"
Height="900"
Background="{x:Null}"
mc:Ignorable="d">
<UserControl.DataContext>
<vm:UserManagerViewModel/>
<vm:UserManagerViewModel />
</UserControl.DataContext>
<UserControl.Resources>
<Style x:Key="CommonTextBlockStyle" TargetType="TextBlock">
<Setter Property="Background" Value="Transparent"/>
<Setter Property="Foreground" Value="#B1E8FF"/>
<Setter Property="HorizontalAlignment" Value="Center"/>
<Setter Property="VerticalAlignment" Value="Center"/>
<!--<Style x:Key="CommonTextBlockStyle" TargetType="TextBlock">
<Setter Property="Background" Value="Transparent" />
<Setter Property="Foreground" Value="#B1E8FF" />
<Setter Property="HorizontalAlignment" Value="Center" />
<Setter Property="VerticalAlignment" Value="Center" />
</Style>
<Style TargetType="{x:Type DataGridCell}">
<Setter Property="FocusVisualStyle" Value="{x:Null}"/>
<Style TargetType="{x:Type DataGridCell}">
<Setter Property="FocusVisualStyle" Value="{x:Null}" />
<Setter Property="TextBlock.FontSize" Value="13" />
<Setter Property="Background" Value="Transparent"/>
<Setter Property="BorderBrush" Value="#87CEFA"/>
<Setter Property="BorderThickness" Value="1"/>
<Setter Property="ToolTip" Value="{Binding RelativeSource={RelativeSource Mode=Self},Path=Content.Text}" />
<Setter Property="Background" Value="Transparent" />
<Setter Property="BorderBrush" Value="#87CEFA" />
<Setter Property="BorderThickness" Value="1" />
<Setter Property="ToolTip" Value="{Binding RelativeSource={RelativeSource Mode=Self}, Path=Content.Text}" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type DataGridCell}">
<Border BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="1" Background="{TemplateBinding Background}" SnapsToDevicePixels="True">
<!--HorizontalAlignment 可以设置内容展示位置-->
<ContentPresenter SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" VerticalAlignment="Center" HorizontalAlignment="Center"
Margin="{TemplateBinding Padding}"/>
<Border
Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="1"
SnapsToDevicePixels="True">
-->
<!-- HorizontalAlignment 可以设置内容展示位置 -->
<!--
<ContentPresenter
Margin="{TemplateBinding Padding}"
HorizontalAlignment="Center"
VerticalAlignment="Center"
SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
</Border>
</ControlTemplate>
</Setter.Value>
</Setter>
<Style.Triggers>
<Trigger Property="IsEnabled" Value="False">
<Setter Property="Opacity" Value=".56"/>
<Setter Property="Opacity" Value=".56" />
</Trigger>
</Style.Triggers>
</Style>
<Style TargetType="DataGridRow">
<Setter Property="FontSize" Value="16"/>
<Setter Property="VerticalAlignment" Value="Center"/>
<Setter Property="Margin" Value="0,5"/>
<Style TargetType="DataGridRow">
<Setter Property="FontSize" Value="16" />
<Setter Property="VerticalAlignment" Value="Center" />
<Setter Property="Margin" Value="0,5" />
<Style.Triggers>
<!-- 隔行换色 -->
-->
<!-- 隔行换色 -->
<!--
<Trigger Property="AlternationIndex" Value="0">
<Setter Property="Background" Value="Transparent" />
</Trigger>
@@ -68,7 +81,7 @@
<Setter Property="Foreground" Value="#ddd" />
<Setter Property="FontSize" Value="26" />
<Setter Property="Cursor" Value="Hand" />
<Setter Property="Background" Value="Transparent"/>
<Setter Property="Background" Value="Transparent" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="DataGridColumnHeader">
@@ -77,12 +90,27 @@
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<ContentPresenter Margin="0,0,0,0" VerticalAlignment="Center"
HorizontalAlignment="Center" />
<Path x:Name="SortArrow" Visibility="Collapsed" Data="M0,0 L1,0 0.5,1 z" Stretch="Fill"
Grid.Column="0" Width="8" Height="6" Fill="Transparent" Margin="0,0,50,0"
VerticalAlignment="Center" RenderTransformOrigin="1,1" />
<Rectangle Width="1" Fill="#87CEFA" HorizontalAlignment="Right" Grid.ColumnSpan="1" />
<ContentPresenter
Margin="0,0,0,0"
HorizontalAlignment="Center"
VerticalAlignment="Center" />
<Path
x:Name="SortArrow"
Grid.Column="0"
Width="8"
Height="6"
Margin="0,0,50,0"
VerticalAlignment="Center"
Data="M0,0 L1,0 0.5,1 z"
Fill="Transparent"
RenderTransformOrigin="1,1"
Stretch="Fill"
Visibility="Collapsed" />
<Rectangle
Grid.ColumnSpan="1"
Width="1"
HorizontalAlignment="Right"
Fill="#87CEFA" />
</Grid>

</ControlTemplate>
@@ -91,80 +119,263 @@
<Setter Property="Height" Value="25" />
</Style>
<Style x:Key="datagridButton" TargetType="Button">
<Setter Property="Background" Value="Transparent"/>
<Setter Property="BorderBrush" Value="Transparent"/>
<Setter Property="Foreground" Value="#1874CD"/>
<Setter Property="FontSize" Value="18"/>
</Style>
<Setter Property="Background" Value="Transparent" />
<Setter Property="BorderBrush" Value="Transparent" />
<Setter Property="Foreground" Value="#1874CD" />
<Setter Property="FontSize" Value="18" />
</Style>-->


<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="/BPASmartClient.CustomResource;component/RecDictionarys/GlobalDataTableStyle.xaml" />
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>


</UserControl.Resources>
<Grid>
<Grid.ColumnDefinitions>
<!--<Grid.ColumnDefinitions>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="50"/>
<RowDefinition Height="*"/>
<RowDefinition Height="100"/>
</Grid.RowDefinitions>-->

<Grid.RowDefinitions>
<RowDefinition Height="50" />
<RowDefinition Height="50" />
<RowDefinition />
</Grid.RowDefinitions>
<TextBlock Text="用户管理" FontSize="28" Style="{DynamicResource CommonTextBlockStyle}"/>
<DataGrid Grid.Row="1" Margin="30" AutoGenerateColumns="False" RowHeight="35" ItemsSource="{Binding userManager}"
Background="Transparent"
FrozenColumnCount="1"
VerticalAlignment="Top"
IsReadOnly="True"
CanUserResizeColumns="False" CanUserResizeRows="False" SelectionMode="Single"
CanUserReorderColumns="False" AlternationCount="2" RowHeaderWidth="0" CanUserAddRows="False">

<!--<TextBlock Text="用户管理" FontSize="28" Style="{DynamicResource CommonTextBlockStyle}"/>-->
<!--<DataGrid
Grid.Row="1"
Margin="30"
VerticalAlignment="Top"
AlternationCount="2"
AutoGenerateColumns="False"
Background="Transparent"
CanUserAddRows="False"
CanUserReorderColumns="False"
CanUserResizeColumns="False"
CanUserResizeRows="False"
FrozenColumnCount="1"
IsReadOnly="True"
ItemsSource="{Binding userManager}"
RowHeaderWidth="0"
RowHeight="35"
SelectionMode="Single"
Visibility="Hidden">
<DataGrid.Columns>
<DataGridTemplateColumn Header="用户名" Width="200">
<DataGridTemplateColumn Width="200" Header="用户名">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<TextBlock Text="{Binding UserName}" FontSize="20" Foreground="White"/>
<TextBlock
FontSize="20"
Foreground="White"
Text="{Binding UserName}" />
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
<DataGridTemplateColumn Header="最后登录时间" Width="300" >
<DataGridTemplateColumn Width="300" Header="最后登录时间">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<TextBlock Text="{Binding LastLogInTime}" FontSize="20" Foreground="White"/>
<TextBlock
FontSize="20"
Foreground="White"
Text="{Binding LastLogInTime}" />
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
<DataGridTemplateColumn Header="权限" Width="250">
<DataGridTemplateColumn Width="250" Header="权限">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<Button Content="权限" Style="{DynamicResource datagridButton}"
Command="{Binding DataContext.EditUserConfigCommand, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=DataGrid}}"
CommandParameter="{Binding RelativeSource={RelativeSource Mode=FindAncestor,AncestorType=DataGrid},Path=SelectedItem}"/>
<Button
Command="{Binding DataContext.EditUserConfigCommand, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=DataGrid}}"
CommandParameter="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=DataGrid}, Path=SelectedItem}"
Content="权限"
Style="{DynamicResource datagridButton}" />
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
<DataGridTemplateColumn Header="重置密码" Width="250">
<DataGridTemplateColumn Width="250" Header="重置密码">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<Button Content="重置密码" Style="{DynamicResource datagridButton}" Command="{Binding DataContext.ChangePasswardCommand, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=DataGrid}}"
CommandParameter="{Binding RelativeSource={RelativeSource Mode=FindAncestor,AncestorType=DataGrid},Path=SelectedItem}"/>
<Button
Command="{Binding DataContext.ChangePasswardCommand, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=DataGrid}}"
CommandParameter="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=DataGrid}, Path=SelectedItem}"
Content="重置密码"
Style="{DynamicResource datagridButton}" />
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
<DataGridTemplateColumn Header="删除" Width="*">
<DataGridTemplateColumn Width="*" Header="删除">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<Button Content="删除" Style="{DynamicResource datagridButton}"
Command="{Binding DataContext.DeleteUserCommand, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=DataGrid}}"
CommandParameter="{Binding RelativeSource={RelativeSource Mode=FindAncestor,AncestorType=DataGrid},Path=SelectedItem}"/>
<Button
Command="{Binding DataContext.DeleteUserCommand, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=DataGrid}}"
CommandParameter="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=DataGrid}, Path=SelectedItem}"
Content="删除"
Style="{DynamicResource datagridButton}" />
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
</DataGrid.Columns>
</DataGrid>
<Button Grid.Row="2"

</DataGrid>-->


<!--#region 列表-->
<!--#region 表格标题栏设置-->
<Grid
Grid.Row="1"
Margin="0,10,0,0"
Background="#ff0C255F">

<Grid.ColumnDefinitions>
<ColumnDefinition />
<ColumnDefinition />
<ColumnDefinition />
<ColumnDefinition />
<ColumnDefinition />
</Grid.ColumnDefinitions>


<TextBlock
Grid.Column="0"
Style="{StaticResource TitleTextblockStyle}"
Text="用户名" />

<Grid Grid.Column="1">
<TextBlock Style="{StaticResource TitleTextblockStyle}" Text="最后登录时间" />
<Border
BorderBrush="{StaticResource bordColor}"
BorderThickness="1,0,1,0"
Cursor="SizeWE" />
</Grid>

<TextBlock
Grid.Column="2"
Style="{StaticResource TitleTextblockStyle}"
Text="权限" />

<Grid Grid.Column="3">
<TextBlock Style="{StaticResource TitleTextblockStyle}" Text="重置密码" />
<Border
BorderBrush="{StaticResource bordColor}"
BorderThickness="1,0,1,0"
Cursor="SizeWE" />
</Grid>

<TextBlock
Grid.Column="4"
Style="{StaticResource TitleTextblockStyle}"
Text="删除" />

<Border
Grid.ColumnSpan="10"
BorderBrush="{StaticResource bordColor}"
BorderThickness="1,0,1,0" />

</Grid>
<!--#endregion-->

<Grid Grid.Row="2">
<ScrollViewer HorizontalScrollBarVisibility="Hidden" VerticalScrollBarVisibility="Hidden">
<ItemsControl ItemsSource="{Binding userManager}">
<ItemsControl.ItemTemplate>
<DataTemplate>
<Grid Name="gr" Height="30">
<Grid.ColumnDefinitions>
<ColumnDefinition />
<ColumnDefinition />
<ColumnDefinition />
<ColumnDefinition />
<ColumnDefinition />
</Grid.ColumnDefinitions>

<TextBlock
Grid.Column="0"
Foreground="{StaticResource tabColor}"
Style="{StaticResource DisiableTextblockStyle}"
Text="{Binding UserName}" />

<Grid Grid.Column="1">
<TextBlock
Foreground="{StaticResource tabColor}"
Style="{StaticResource DisiableTextblockStyle}"
Text="{Binding LastLogInTime}" />
<Border
BorderBrush="{StaticResource bordColor}"
BorderThickness="1,0,1,0"
Cursor="SizeWE" />
</Grid>

<Button
Grid.Column="2"
Command="{Binding DataContext.EditUserConfigCommand, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=ItemsControl}}"
CommandParameter="{Binding}"
Content="权限"
Foreground="{StaticResource tabColor}"
Style="{StaticResource ControlButtonStyle}" />

<Grid Grid.Column="3">
<Button
Command="{Binding DataContext.ChangePasswardCommand, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=ItemsControl}}"
CommandParameter="{Binding}"
Content="重置密码"
Style="{StaticResource ControlButtonStyle}" />
<Border
BorderBrush="{StaticResource bordColor}"
BorderThickness="1,0,1,0"
Cursor="SizeWE" />
</Grid>

<Button
Grid.Column="4"
Command="{Binding DataContext.DeleteUserCommand, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=ItemsControl}}"
CommandParameter="{Binding}"
Content="删除"
Style="{StaticResource RemoveButtonStyle}" />

<Border
Grid.ColumnSpan="10"
BorderBrush="{StaticResource bordColor}"
BorderThickness="1,0,1,1" />

</Grid>
<DataTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="true">
<Setter TargetName="gr" Property="Background" Value="#112AB2E7" />
</Trigger>
</DataTemplate.Triggers>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
</ScrollViewer>
</Grid>
<!--#endregion-->

<Button
Width="200"
Height="50"
Margin="10,0"
HorizontalAlignment="Right"
Command="{Binding AddNewUserCommand}"
Content="添加新用户"
FontSize="24"
Style="{StaticResource ImageButtonStyle}" />

<!--<Button Grid.Row="2"
Height="50" Width="200"
Background="#009DFF"
BorderThickness="0"
Command="{Binding AddNewUserCommand}"
Content="添加新用户"
FontSize="24"
Foreground="White" />
Foreground="White" />-->
</Grid>
</UserControl>

+ 2
- 2
BPASmartClient.CustomResource/Pages/ViewModel/MainViewModel.cs Целия файл

@@ -22,7 +22,7 @@ namespace BPASmartClient.CustomResource.Pages.ViewModel
NavChangedCommand = new RelayCommand<object>(DoNavChanged);
BPA.Helper.MessageLog.GetInstance.NotifyShow = new Action<string>((o) =>
{
Application.Current.Dispatcher.Invoke(() =>
Application.Current?.Dispatcher?.Invoke(() =>
{
//ff20aefe
var temp = new MessageModel()
@@ -38,7 +38,7 @@ namespace BPASmartClient.CustomResource.Pages.ViewModel
});
BPA.Helper.MessageLog.GetInstance.NotifyShowEx = new Action<string>((o) =>
{
Application.Current.Dispatcher.Invoke(() =>
Application.Current?.Dispatcher?.Invoke(() =>
{
//FFF53F62
var temp = new MessageModel()


+ 2
- 2
BPASmartClient.CustomResource/Pages/ViewModel/NfcSetViewModel.cs Целия файл

@@ -75,7 +75,7 @@ namespace BPASmartClient.CustomResource.Pages.ViewModel
});
Config.GetInstance.SaveUser();
Info = $"Info:ID {CardNum} 添加成功;";
MessageLog.GetInstance.ShowRunLog($" ID {CardNum} 用户添加成功");
MessageNotify.GetInstance.ShowRunLog($" ID {CardNum} 用户添加成功");
Thread.Sleep(1000);
ActionManage.GetInstance.Send("Exit");
}
@@ -96,7 +96,7 @@ namespace BPASmartClient.CustomResource.Pages.ViewModel
Global.userManager.userInfos.Remove(res);
Config.GetInstance.SaveUser();
Info = $"Info:ID {CardNum} 注销成功;";
MessageLog.GetInstance.ShowRunLog($"ID {CardNum} 用户注销成功");
MessageNotify.GetInstance.ShowRunLog($"ID {CardNum} 用户注销成功");
Thread.Sleep(1000);
ActionManage.GetInstance.Send("Exit");
}


+ 1
- 1
BPASmartClient.CustomResource/Pages/ViewModel/RunLogViewModel.cs Целия файл

@@ -121,6 +121,6 @@ namespace BPASmartClient.CustomResource.Pages.ViewModel

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

public ObservableCollection<RunLog> Log { get; set; } = MessageLog.GetInstance.runLogs;
public ObservableCollection<RunLog> Log { get; set; } = MessageNotify.GetInstance.runLogs;
}
}

+ 1
- 1
BPASmartClient.CustomResource/Pages/ViewModel/UserLogViewModel.cs Целия файл

@@ -17,7 +17,7 @@ namespace BPASmartClient.CustomResource.Pages.ViewModel
public UserLogViewModel()
{
Sqlite<UserLog>.GetInstance.Save();
UserLogs = MessageLog.GetInstance.userLogs;
UserLogs = MessageNotify.GetInstance.userLogs;
SwitchCommand = new RelayCommand(() =>
{
if (ButContent == "历史日志")


+ 2
- 0
BPASmartClient.CustomResource/Pages/ViewModel/VariableViewModel.cs Целия файл

@@ -1,4 +1,6 @@
using BPASmartClient.CustomResource.Pages.Model;
using BPASmartClient.CustomResource.UserControls;
using BPASmartClient.CustomResource.UserControls.MessageShow;
using BPASmartClient.Helper;
using Microsoft.Toolkit.Mvvm.ComponentModel;
using Microsoft.Toolkit.Mvvm.Input;


+ 157
- 0
BPASmartClient.CustomResource/RecDictionarys/GlobalDataTableStyle.xaml Целия файл

@@ -0,0 +1,157 @@
<ResourceDictionary
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:con="clr-namespace:BPASmartClient.CustomResource.Converters">
<SolidColorBrush x:Key="tabColor" Color="#FF2AB2E7" />
<!--<SolidColorBrush x:Key="bordColor" Color="#33ffffff" />-->
<SolidColorBrush x:Key="bordColor" Color="#332AB2E7" />
<con:DataTableRedundantConverter x:Key="tabConvert" />

<Style x:Key="RowRadioButtonStyle" TargetType="{x:Type RadioButton}">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type RadioButton}">
<Border
x:Name="NvaBor"
Background="Transparent"
BorderBrush="#FF2AB2E7"
BorderThickness="0">
<ContentControl
Margin="10,4"
HorizontalAlignment="Center"
VerticalAlignment="Center"
HorizontalContentAlignment="Center"
VerticalContentAlignment="Center"
Content="{TemplateBinding Content}"
FontSize="16" />
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsChecked" Value="True">
<Setter TargetName="NvaBor" Property="Background" Value="#22ffffff" />
<Setter TargetName="NvaBor" Property="BorderThickness" Value="0" />
</Trigger>
<MultiTrigger>
<MultiTrigger.Conditions>
<Condition Property="IsChecked" Value="false" />
<Condition Property="IsMouseOver" Value="True" />
</MultiTrigger.Conditions>
<MultiTrigger.Setters>
<Setter TargetName="NvaBor" Property="Background" Value="#22ffffff" />
</MultiTrigger.Setters>
</MultiTrigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>

<Style x:Key="InputTextboxStyle" TargetType="TextBox">
<Setter Property="Margin" Value="5,0,0,0" />
<Setter Property="BorderThickness" Value="0" />
<Setter Property="HorizontalAlignment" Value="Left" />
<Setter Property="Width" Value="150" />
<Setter Property="Height" Value="40" />
<Setter Property="CaretBrush" Value="{StaticResource TitleBorderColor}" />
<Setter Property="Foreground" Value="{StaticResource TitleBorderColor}" />
<Setter Property="VerticalContentAlignment" Value="Center" />
<Setter Property="FontSize" Value="14" />
<Setter Property="Background" Value="Transparent" />
<Setter Property="VerticalAlignment" Value="Center" />
</Style>

<Style x:Key="RemoveButtonStyle" TargetType="Button">
<Setter Property="Margin" Value="0" />
<Setter Property="FontSize" Value="18" />
<Setter Property="Foreground" Value="#FFF53F62" />
<Setter Property="FontWeight" Value="SemiBold" />
<Setter Property="FontFamily" Value="楷体" />
<Setter Property="VerticalContentAlignment" Value="Center" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="Button">
<Border
Name="TitleBarBr"
BorderBrush="#00c2f4"
BorderThickness="0"
CornerRadius="0"
Opacity="0.8">

<ContentPresenter
Margin="{TemplateBinding Margin}"
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
VerticalAlignment="{TemplateBinding VerticalContentAlignment}" />
<Border.Background>
<ImageBrush
ImageSource="/BPASmartClient.CustomResource;component/Image/组合边框1.1.png"
Opacity="0.8"
Stretch="Fill" />
</Border.Background>

</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="true">
<Setter TargetName="TitleBarBr" Property="Opacity" Value="1" />
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>

<Style x:Key="ControlButtonStyle" TargetType="Button">
<Setter Property="Margin" Value="0" />
<Setter Property="FontSize" Value="18" />
<Setter Property="Foreground" Value="#00c2f4" />
<Setter Property="FontWeight" Value="SemiBold" />
<Setter Property="FontFamily" Value="楷体" />
<Setter Property="VerticalContentAlignment" Value="Center" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="Button">
<Border
Name="TitleBarBr"
BorderBrush="#00c2f4"
BorderThickness="0"
CornerRadius="0"
Opacity="0.8">

<ContentPresenter
Margin="{TemplateBinding Margin}"
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
VerticalAlignment="{TemplateBinding VerticalContentAlignment}" />
<Border.Background>
<ImageBrush
ImageSource="/BPASmartClient.CustomResource;component/Image/组合边框2.1.png"
Opacity="0.8"
Stretch="Fill" />
</Border.Background>

</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="true">
<Setter TargetName="TitleBarBr" Property="Opacity" Value="1" />
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>

<Style x:Key="TitleTextblockStyle" TargetType="TextBlock">
<Setter Property="FontSize" Value="16" />
<Setter Property="HorizontalAlignment" Value="Center" />
<Setter Property="VerticalAlignment" Value="Center" />
<Setter Property="Foreground" Value="{StaticResource tabColor}" />
<Setter Property="FontFamily" Value="楷体" />
<Setter Property="FontWeight" Value="SemiBold" />
</Style>

<Style x:Key="DisiableTextblockStyle" TargetType="TextBlock">
<Setter Property="FontSize" Value="16" />
<Setter Property="HorizontalAlignment" Value="Center" />
<Setter Property="VerticalAlignment" Value="Center" />
<Setter Property="Foreground" Value="{StaticResource tabColor}" />
<Setter Property="FontFamily" Value="楷体" />
</Style>

</ResourceDictionary>

+ 128
- 0
BPASmartClient.CustomResource/RecDictionarys/GlobalStyle.xaml Целия файл

@@ -15,4 +15,132 @@
<SolidColorBrush x:Key="BorderSolid" Color="#5523CACA" />



<!--#region 颜色资源-->
<SolidColorBrush x:Key="FontColor" Color="#FF2AB2E7" />
<SolidColorBrush x:Key="tabColor" Color="#FF2AB2E7" />
<SolidColorBrush x:Key="bordColor" Color="#332AB2E7" />
<!--#endregion-->

<!--#region 值转换器-->
<con:DataTableRedundantConverter x:Key="tabConvert" />
<con:StatusIconConverter x:Key="StatusIconConverter" />
<con:ForegroundConverter x:Key="ForegroundConverter" />
<!--#endregion-->

<Style x:Key="TextBlockStyle" TargetType="TextBlock">
<Setter Property="VerticalAlignment" Value="Center" />
<Setter Property="HorizontalAlignment" Value="Right" />
<Setter Property="Foreground" Value="{StaticResource FontColor}" />
<Setter Property="FontSize" Value="20" />
</Style>

<Style x:Key="TextBoxStyle" TargetType="TextBox">
<Setter Property="FontFamily" Value="楷体" />
<Setter Property="FontSize" Value="22" />
<Setter Property="VerticalContentAlignment" Value="Center" />
<Setter Property="Width" Value="188" />
<Setter Property="Padding" Value="6,0,0,0" />
<Setter Property="Height" Value="37" />
<Setter Property="BorderThickness" Value="0" />
<Setter Property="Foreground" Value="#009dff" />
<Setter Property="BorderBrush" Value="#009dff" />
<Setter Property="CaretBrush" Value="#009dff" />
<Setter Property="VerticalAlignment" Value="Center" />
<Setter Property="Background">
<Setter.Value>
<ImageBrush ImageSource="/BPASmartClient.CustomResource;component/Image/textBox.png" Stretch="Fill" />
</Setter.Value>
</Setter>
</Style>

<Style x:Key="InputTextboxStyle" TargetType="TextBox">
<Setter Property="Margin" Value="5,0,0,0" />
<Setter Property="BorderThickness" Value="0" />
<Setter Property="HorizontalAlignment" Value="Left" />
<Setter Property="Width" Value="150" />
<Setter Property="Height" Value="40" />
<Setter Property="CaretBrush" Value="{StaticResource TitleBorderColor}" />
<Setter Property="Foreground" Value="{StaticResource TitleBorderColor}" />
<Setter Property="VerticalContentAlignment" Value="Center" />
<Setter Property="FontSize" Value="14" />
<Setter Property="Background" Value="Transparent" />
<Setter Property="VerticalAlignment" Value="Center" />
</Style>

<Style x:Key="ControlButtonStyle" TargetType="Button">
<Setter Property="Margin" Value="0" />
<Setter Property="FontSize" Value="18" />
<Setter Property="Foreground" Value="#FFF53F62" />
<Setter Property="FontWeight" Value="SemiBold" />
<Setter Property="FontFamily" Value="楷体" />
<Setter Property="VerticalContentAlignment" Value="Center" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="Button">
<Border
Name="TitleBarBr"
BorderBrush="#00c2f4"
BorderThickness="0"
CornerRadius="0"
Opacity="0.8">

<ContentPresenter
Margin="{TemplateBinding Margin}"
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
VerticalAlignment="{TemplateBinding VerticalContentAlignment}" />
<Border.Background>
<ImageBrush
ImageSource="/BPASmartClient.CustomResource;component/Image/组合边框1.1.png"
Opacity="0.8"
Stretch="Fill" />
</Border.Background>

</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="true">
<Setter TargetName="TitleBarBr" Property="Opacity" Value="1" />
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>

<Style x:Key="TitleTextblockStyle" TargetType="TextBlock">
<Setter Property="FontSize" Value="16" />
<Setter Property="HorizontalAlignment" Value="Center" />
<Setter Property="VerticalAlignment" Value="Center" />
<Setter Property="Foreground" Value="{StaticResource tabColor}" />
<Setter Property="FontFamily" Value="楷体" />
<Setter Property="FontWeight" Value="SemiBold" />
</Style>

<Style x:Key="UserItemContainerStyle" TargetType="ListBoxItem">
<Style.Resources>
<!-- SelectedItem with focus -->
<SolidColorBrush
x:Key="{x:Static SystemColors.HighlightBrushKey}"
Opacity=".4"
Color="White" />
<!-- SelectedItem without focus -->
<SolidColorBrush
x:Key="{x:Static SystemColors.ControlBrushKey}"
Opacity=".4"
Color="White" />
</Style.Resources>
<!-- 设置触发器 -->
<Style.Triggers>
<Trigger Property="IsMouseOver" Value="true">
<Setter Property="Background" Value="White" />
<Setter Property="Foreground" Value="White" />
</Trigger>
<Trigger Property="IsFocused" Value="true">
<Setter Property="Background" Value="White" />
<Setter Property="Foreground" Value="White" />
</Trigger>
</Style.Triggers>
</Style>


</ResourceDictionary>

+ 88
- 0
BPASmartClient.CustomResource/RecDictionarys/RecToggleButton.xaml Целия файл

@@ -57,4 +57,92 @@
</Setter>
</Style>
<!--#endregion-->

<!--#region 切换开关 ToggleButton 样式-->
<Style x:Key="SwitchToggleButtonStyle" TargetType="{x:Type ToggleButton}">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type ToggleButton}">
<Viewbox>
<Grid x:Name="gr" Opacity="0.8">
<Border
x:Name="border2"
Width="{TemplateBinding Width}"
Height="{TemplateBinding Height}"
HorizontalAlignment="Left"
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
Background="Red"
BorderBrush="{TemplateBinding BorderBrush}"
CornerRadius="15">
<ContentPresenter
Margin="{TemplateBinding Padding}"
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
RecognizesAccessKey="True"
SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
</Border>

<Ellipse
Name="ell"
Width="{TemplateBinding Height}"
Height="{TemplateBinding Height}"
Margin="0"
HorizontalAlignment="Left"
VerticalAlignment="Center"
Fill="#ddd" />

<TextBlock
Name="tb"
Margin="10,0,10,0"
HorizontalAlignment="Center"
VerticalAlignment="Center"
Foreground="White"
Text="开" />

</Grid>
</Viewbox>
<ControlTemplate.Triggers>
<!--<Trigger Property="IsPressed" Value="true">
<Setter Property="Background" Value="#FFd2e7f4" />
</Trigger>-->

<!-- 控件选中 -->
<Trigger Property="IsChecked" Value="true">
<!--<Setter Property="Foreground" Value="#ff1002E9" />-->
<Setter TargetName="ell" Property="HorizontalAlignment" Value="Right" />
<Setter TargetName="border2" Property="Background" Value="#00c2f4" />
<Setter TargetName="tb" Property="Text" Value="关" />
<Setter TargetName="tb" Property="Margin" Value="0,0,15,0" />
<!--<Setter TargetName="ell" Property="Fill" Value="#ff1002E9"/>-->
</Trigger>

<!-- 控件未选中 -->
<Trigger Property="IsChecked" Value="false">
<!--<Setter Property="Foreground" Value="#ff2AB2E7" />-->
<Setter TargetName="border2" Property="Background" Value="gray" />
<Setter TargetName="tb" Property="Text" Value="开" />
<Setter TargetName="tb" Property="Margin" Value="15,0,0,0" />
<!--<Setter TargetName="ell" Property="Fill" Value="#ddd"/>-->
</Trigger>

<!-- 鼠标进入 -->
<Trigger Property="IsMouseOver" Value="True">
<Setter TargetName="gr" Property="Opacity" Value="1" />
</Trigger>

<!-- 控件禁用 -->
<Trigger Property="IsEnabled" Value="false">
<Setter TargetName="gr" Property="Opacity" Value="0.5" />
</Trigger>

<!-- 控件启用 -->
<Trigger Property="IsEnabled" Value="True">
<Setter TargetName="gr" Property="Opacity" Value="0.8" />
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<!--#endregion-->
</ResourceDictionary>

Двоични данни
Целия файл


+ 77
- 49
BPASmartClient.CustomResource/UserControls/ConveyBelt2.xaml Целия файл

@@ -1,16 +1,80 @@
<UserControl x:Class="BPASmartClient.CustomResource.UserControls.ConveyBelt2"
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:BPASmartClient.CustomResource.UserControls"
mc:Ignorable="d"
d:DesignHeight="450" d:DesignWidth="800">
<Border x:Name="br" >
<UserControl
x:Class="BPASmartClient.CustomResource.UserControls.ConveyBelt2"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:BPASmartClient.CustomResource.UserControls"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
d:DesignHeight="450"
d:DesignWidth="800"
mc:Ignorable="d">
<Border x:Name="br">
<Viewbox HorizontalAlignment="Center" VerticalAlignment="Center">

<Canvas
Width="{Binding ElementName=br, Path=ActualWidth}"
Height="{Binding ElementName=br, Path=ActualHeight}"
Margin="5"
Background="Transparent">

<Rectangle
Canvas.Top="20"
Width="{Binding ElementName=br, Path=ActualWidth}"
Height="5"
HorizontalAlignment="Center"
RadiusX="1"
RadiusY="1">
<Rectangle.Fill>
<LinearGradientBrush>
<GradientStop Offset="0" Color="#00BEFA" />
<GradientStop Offset="0.3" Color="#ddd" />
<GradientStop Offset="0.7" Color="#ddd" />
<GradientStop Offset="1" Color="#00BEFA" />
</LinearGradientBrush>
</Rectangle.Fill>
</Rectangle>
<Rectangle
x:Name="recDown"
Width="{Binding ElementName=br, Path=ActualWidth}"
Height="5"
Margin="0,80,0,0"
HorizontalAlignment="Center"
RadiusX="1"
RadiusY="1">
<Rectangle.Fill>
<LinearGradientBrush>
<!--<GradientStop Offset="0" Color="LightGray" />
<GradientStop Offset="0.5" Color="White" />
<GradientStop Offset="1" Color="LightGray" />-->
<GradientStop Offset="0" Color="#00BEFA" />
<GradientStop Offset="0.3" Color="#ddd" />
<GradientStop Offset="0.7" Color="#ddd" />
<GradientStop Offset="1" Color="#00BEFA" />
</LinearGradientBrush>
</Rectangle.Fill>
</Rectangle>
<Path
x:Name="belt"
Canvas.Left="10"
Canvas.Top="20"
StrokeDashArray="2"
StrokeThickness="20">
<Path.Stroke>
<LinearGradientBrush>
<GradientStop Offset="0" Color="#00BEFA" />
<GradientStop Offset="0.3" Color="#ddd" />
<GradientStop Offset="0.7" Color="#ddd" />
<GradientStop Offset="1" Color="#00BEFA" />
</LinearGradientBrush>
</Path.Stroke>
</Path>

</Canvas>
</Viewbox>
<VisualStateManager.VisualStateGroups>
<VisualStateGroup Name="StockGroup">
<VisualState Name="RunState">
<Storyboard RepeatBehavior="Forever">
<Storyboard RepeatBehavior="Forever">
<DoubleAnimation
Storyboard.TargetName="belt"
Storyboard.TargetProperty="StrokeDashOffset"
@@ -19,12 +83,11 @@
Duration="0:0:20" />
</Storyboard>
</VisualState>
<VisualState Name="Stop">
</VisualState>
<VisualState Name="Stop" />
</VisualStateGroup>
<VisualStateGroup Name="DirectionGroup">
<VisualState Name="LeftState">
<Storyboard RepeatBehavior="Forever">
<Storyboard RepeatBehavior="Forever">
<DoubleAnimation
Storyboard.TargetName="belt"
Storyboard.TargetProperty="StrokeDashOffset"
@@ -34,7 +97,7 @@
</Storyboard>
</VisualState>
<VisualState Name="RightState">
<Storyboard RepeatBehavior="Forever">
<Storyboard RepeatBehavior="Forever">
<DoubleAnimation
Storyboard.TargetName="belt"
Storyboard.TargetProperty="StrokeDashOffset"
@@ -45,40 +108,5 @@
</VisualState>
</VisualStateGroup>
</VisualStateManager.VisualStateGroups>
<Viewbox HorizontalAlignment="Center" VerticalAlignment="Center">

<Canvas Width="{Binding ElementName=br, Path=ActualWidth}" Height="{Binding ElementName=br, Path=ActualHeight}" Margin="5">

<Rectangle HorizontalAlignment="Center" Width="{Binding ElementName=br, Path=ActualWidth}" Height="5" Canvas.Top="20" RadiusX="1" RadiusY="1">
<Rectangle.Fill>
<LinearGradientBrush >
<GradientStop Color="LightGray" Offset="0"/>
<GradientStop Color="White" Offset="0.5"/>
<GradientStop Color="LightGray" Offset="1"/>
</LinearGradientBrush>
</Rectangle.Fill>
</Rectangle>
<Rectangle HorizontalAlignment="Center" x:Name="recDown" Width="{Binding ElementName=br, Path=ActualWidth}" Height="5" RadiusX="1" RadiusY="1" Margin="0,80,0,0">
<Rectangle.Fill>
<LinearGradientBrush >
<GradientStop Color="LightGray" Offset="0"/>
<GradientStop Color="White" Offset="0.5"/>
<GradientStop Color="LightGray" Offset="1"/>
</LinearGradientBrush>
</Rectangle.Fill>
</Rectangle>
<Path x:Name="belt" Canvas.Top="20" Canvas.Left="10"
StrokeDashArray="2" StrokeThickness="20">
<Path.Stroke>
<LinearGradientBrush>
<GradientStop Color="SlateGray" Offset="0"/>
<GradientStop Color="White" Offset="0.5"/>
<GradientStop Color="SlateGray" Offset="1"/>
</LinearGradientBrush>
</Path.Stroke>
</Path>
</Canvas>
</Viewbox>
</Border>
</UserControl>

+ 201
- 120
BPASmartClient.CustomResource/UserControls/MaterialStock.xaml Целия файл

@@ -1,80 +1,25 @@
<UserControl x:Class="BPASmartClient.CustomResource.UserControls.MaterialStock"
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:BPASmartClient.CustomResource.UserControls"
mc:Ignorable="d"
d:DesignHeight="450" d:DesignWidth="800">
<UserControl
x:Class="BPASmartClient.CustomResource.UserControls.MaterialStock"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:BPASmartClient.CustomResource.UserControls"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
d:DesignHeight="450"
d:DesignWidth="800"
mc:Ignorable="d">
<UserControl.Resources>
<PathGeometry x:Key="move" Figures="M 0,0 L 0,10"/>
<PathGeometry x:Key="move" Figures="M 0,0 L 0,10" />
</UserControl.Resources>
<Border HorizontalAlignment="Center">
<VisualStateManager.VisualStateGroups>
<VisualStateGroup Name="StockGroup">
<VisualState Name="OpenState">
<Storyboard>
<DoubleAnimation Duration="00:0:1" From="0" To="200"
Storyboard.TargetProperty="Width"
Storyboard.TargetName="stock"/>
<DoubleAnimation Duration="00:0:1" From="0" To="70"
Storyboard.TargetProperty="Height"
Storyboard.TargetName="stock"/>
</Storyboard>
</VisualState>
<VisualState Name="CloseState">
<Storyboard>
<DoubleAnimation Duration="00:0:1" From="200" To="0"
Storyboard.TargetProperty="Width"
Storyboard.TargetName="stock"/>
<DoubleAnimation Duration="00:0:1" From="70" To="0"
Storyboard.TargetProperty="Height"
Storyboard.TargetName="stock"/>
</Storyboard>
</VisualState>
</VisualStateGroup>
<VisualStateGroup Name="RunStateGroup">
<VisualState Name="RunState">
<Storyboard>
<ColorAnimationUsingKeyFrames
Storyboard.TargetName="gsGreen"
Storyboard.TargetProperty="Color">
<DiscreteColorKeyFrame Value="Green" KeyTime="0"/>
</ColorAnimationUsingKeyFrames>
</Storyboard>
</VisualState>
<VisualState Name="Stop"/>
</VisualStateGroup>
<VisualStateGroup x:Name="FaultStateGroup">
<VisualState Name="FaultState">
<Storyboard>
<ColorAnimationUsingKeyFrames RepeatBehavior="Forever"
Storyboard.TargetName="gsRed1"
Storyboard.TargetProperty="Color">
<DiscreteColorKeyFrame Value="Red" KeyTime="0:0:0.5"/>
<DiscreteColorKeyFrame Value="Gray" KeyTime="0:0:1"/>
</ColorAnimationUsingKeyFrames>
</Storyboard>
</VisualState>
<VisualState Name="NormalState"/>
</VisualStateGroup>
<VisualStateGroup x:Name="LayOffStateGroup">
<VisualState Name="LayOffState">
<Storyboard>
<DoubleAnimationUsingPath Duration="0:0:1" PathGeometry="{StaticResource move}" RepeatBehavior="Forever"
Storyboard.TargetName="arrow" Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[1].(Y)" Source="Y"></DoubleAnimationUsingPath>
</Storyboard>
</VisualState>
<VisualState Name="LayStopState">
</VisualState>
</VisualStateGroup>
</VisualStateManager.VisualStateGroups>
<Viewbox VerticalAlignment="Center" HorizontalAlignment="Center">
<Viewbox HorizontalAlignment="Center" VerticalAlignment="Center">

<Canvas Width="205" Height="245" Margin="5">
<Polygon Points="0,80 20,40 205,40 185,80" Canvas.Left="67">
<Canvas
Width="205"
Height="245"
Margin="5">
<Polygon Canvas.Left="67" Points="0,80 20,40 205,40 185,80">
<Polygon.RenderTransform>
<SkewTransform AngleX="-40" />
</Polygon.RenderTransform>
@@ -84,35 +29,49 @@
<GradientStop Color="WhiteSmoke" Offset="0.85"/>
<GradientStop Color="LightGray" Offset="1"/>
</LinearGradientBrush>-->
<ImageBrush ImageSource="/BPASmartClient.CustomResource;component/Image/不锈钢纹理2.jpeg" Stretch="Fill"/>
<ImageBrush ImageSource="/BPASmartClient.CustomResource;component/Image/不锈钢纹理2.jpeg" Stretch="Fill" />
</Polygon.Fill>
</Polygon>
<Polygon Width="200" Height="70" Points="45,70 60,50 170,50 155,70" Stroke="Gray" StrokeThickness="2" Canvas.Left="67">
<Polygon
Canvas.Left="67"
Width="200"
Height="70"
Points="45,70 60,50 170,50 155,70"
Stroke="Gray"
StrokeThickness="2">
<Polygon.RenderTransform>
<SkewTransform AngleX="-40" />
</Polygon.RenderTransform>
</Polygon>
<Polygon x:Name="stock" Width="0" Height="0" Points="45,70 60,50 170,50 155,70" Canvas.Left="67" >
<Polygon
x:Name="stock"
Canvas.Left="67"
Width="0"
Height="0"
Points="45,70 60,50 170,50 155,70">
<Polygon.Fill>
<SolidColorBrush Color="DimGray"/>
<SolidColorBrush Color="DimGray" />
</Polygon.Fill>
<Polygon.RenderTransform>
<SkewTransform AngleX="-40" />
</Polygon.RenderTransform>
</Polygon>
<Polygon Points="-5,90 0,80 185,80 180,90" Panel.ZIndex="1" >
<Polygon Panel.ZIndex="1" Points="-5,90 0,80 185,80 180,90">
<Polygon.Fill>
<LinearGradientBrush>
<GradientStop Color="LightGray" Offset="0"/>
<GradientStop Color="White" Offset="0.66"/>
<GradientStop Color="LightGray" Offset="0.95"/>
<GradientStop Offset="0" Color="LightGray" />
<GradientStop Offset="0.66" Color="White" />
<GradientStop Offset="0.95" Color="LightGray" />
</LinearGradientBrush>
</Polygon.Fill>

</Polygon>
<Grid Width="185" Height="160" Canvas.Top="80">
<Grid
Canvas.Top="80"
Width="185"
Height="160">
<Grid.Background>
<ImageBrush ImageSource="/BPASmartClient.CustomResource;component/Image/不锈钢纹理.jpg" Stretch="Fill"/>
<ImageBrush ImageSource="/BPASmartClient.CustomResource;component/Image/不锈钢纹理.jpg" Stretch="Fill" />
</Grid.Background>
<!--<Grid VerticalAlignment="Bottom" Height="20" Margin="5">
<Grid.ColumnDefinitions>
@@ -134,7 +93,7 @@
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Button.Template>
</Button>
<Button Width="60" Grid.Column="1">
@@ -156,37 +115,65 @@
</Button>
</Grid>-->
</Grid>
<Grid Width="185" Height="60" Canvas.Top="90">
<Grid
Canvas.Top="90"
Width="185"
Height="60">
<Grid.Background>
<ImageBrush ImageSource="/BPASmartClient.CustomResource;component/Image/不锈钢纹理2.jpeg"/>
<ImageBrush ImageSource="/BPASmartClient.CustomResource;component/Image/不锈钢纹理2.jpeg" />
</Grid.Background>
<Grid.RenderTransform>
<TranslateTransform X="-5"/>
<TranslateTransform X="-5" />
</Grid.RenderTransform>
<TextBox x:Name="stockName" Width="58" Height="50" HorizontalAlignment="Left" HorizontalContentAlignment="Center" Background="Transparent"
BorderThickness="0" VerticalContentAlignment="Center" FontSize="13" Foreground="DarkSlateGray">
</TextBox>
<TextBox
x:Name="stockName"
Width="58"
Height="50"
HorizontalAlignment="Left"
HorizontalContentAlignment="Center"
VerticalContentAlignment="Center"
Background="Transparent"
BorderThickness="0"
FontSize="13"
Foreground="DarkSlateGray" />


<Border Width="80" Height="50" BorderBrush="DimGray " BorderThickness="2" CornerRadius="5" Margin="15,0,0,0">
<StackPanel >
<TextBlock HorizontalAlignment="Center" FontSize="12" Text="剩余重量" FontFamily="幼圆" Margin="0,2,0,5"/>
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center">
<TextBlock x:Name="stockWeight" HorizontalAlignment="Center" FontSize="16" />
<TextBlock Text="Kg" FontSize="16"/>
<Border
Width="80"
Height="50"
Margin="15,0,0,0"
BorderBrush="DimGray "
BorderThickness="2"
CornerRadius="5">
<StackPanel>
<TextBlock
Margin="0,2,0,5"
HorizontalAlignment="Center"
FontFamily="幼圆"
FontSize="12"
Text="剩余重量" />
<StackPanel HorizontalAlignment="Center" Orientation="Horizontal">
<TextBlock
x:Name="stockWeight"
HorizontalAlignment="Center"
FontSize="16" />
<TextBlock FontSize="16" Text="Kg" />
</StackPanel>
</StackPanel>
</Border>
</Grid>
<Grid Width="40" Height="60" Canvas.Top="90" Canvas.Left="180">
<Grid
Canvas.Left="180"
Canvas.Top="90"
Width="40"
Height="60">
<Grid.Background>
<ImageBrush ImageSource="/BPASmartClient.CustomResource;component/Image/不锈钢纹理3.jpeg" Stretch="UniformToFill"/>
<ImageBrush ImageSource="/BPASmartClient.CustomResource;component/Image/不锈钢纹理3.jpeg" Stretch="UniformToFill" />
</Grid.Background>
<Grid.RenderTransform>
<TransformGroup>
<ScaleTransform ScaleX="0.119"/>
<SkewTransform AngleY="-65.5"/>
<ScaleTransform ScaleX="0.119" />
<SkewTransform AngleY="-65.5" />
</TransformGroup>
</Grid.RenderTransform>
<!--<Border VerticalAlignment="Top" Height="140" BorderThickness="10">
@@ -202,35 +189,44 @@
<Border Background="#FFAAAAAA" Margin="2"/>
<Border Background="#FFAAAAAA" Margin="2" Grid.Column="1"/>
</Grid>-->
</Grid >
<Path x:Name="arrow" Canvas.Top="175" Canvas.Left="113" Visibility="Collapsed" Data="M -15,8 L 17,17 C 17,17 19,18 17,19 L 17,19 L -15,28 C -15,28 -17,28.2 -16,26 L -16,26 L -5,18 L -16,10 C -16,10 -17,8.5 -15,8 Z">
</Grid>
<Path
x:Name="arrow"
Canvas.Left="113"
Canvas.Top="175"
Data="M -15,8 L 17,17 C 17,17 19,18 17,19 L 17,19 L -15,28 C -15,28 -17,28.2 -16,26 L -16,26 L -5,18 L -16,10 C -16,10 -17,8.5 -15,8 Z"
Visibility="Collapsed">
<Path.RenderTransform>
<TransformGroup>
<RotateTransform Angle="90"/>
<TranslateTransform Y="0"/>
<RotateTransform Angle="90" />
<TranslateTransform Y="0" />
</TransformGroup>
</Path.RenderTransform>
<Path.Fill>
<LinearGradientBrush>
<LinearGradientBrush.RelativeTransform>
<RotateTransform Angle="-15"/>
<RotateTransform Angle="-15" />
</LinearGradientBrush.RelativeTransform>
<GradientStop Color="LightGray" Offset="0"/>
<GradientStop Color="White" Offset="0.4"/>
<GradientStop Color="AntiqueWhite" Offset="1"/>
<GradientStop Offset="0" Color="LightGray" />
<GradientStop Offset="0.4" Color="White" />
<GradientStop Offset="1" Color="AntiqueWhite" />
</LinearGradientBrush>
</Path.Fill>
</Path>
<!--<Path Data="M 95,190 L 95,200" Stroke="Red"/>-->

<Grid Width="185" Height="160" Canvas.Top="80" Canvas.Left="185">
<Grid
Canvas.Left="185"
Canvas.Top="80"
Width="185"
Height="160">
<Grid.Background>
<ImageBrush ImageSource="/BPASmartClient.CustomResource;component/Image/不锈钢纹理.jpg"/>
<ImageBrush ImageSource="/BPASmartClient.CustomResource;component/Image/不锈钢纹理.jpg" />
</Grid.Background>
<Grid.RenderTransform>
<TransformGroup>
<ScaleTransform ScaleX="0.288"/>
<SkewTransform AngleY="-36.8"/>
<ScaleTransform ScaleX="0.288" />
<SkewTransform AngleY="-36.8" />
</TransformGroup>
</Grid.RenderTransform>
<!--<Border VerticalAlignment="Top" Height="140" BorderThickness="10">
@@ -264,24 +260,109 @@
</Grid>-->
</Grid>

<Border Width="18" Height="18" CornerRadius="10" Canvas.Left="150" Canvas.Top="100">
<Border
Canvas.Left="150"
Canvas.Top="100"
Width="18"
Height="18"
CornerRadius="10">
<Border.Background>
<RadialGradientBrush>
<GradientStop Color="Gray" Offset="0.6" x:Name="gsGreen"/>
<GradientStop Color="White"/>
<GradientStop x:Name="gsGreen" Offset="0.6" Color="Gray" />
<GradientStop Color="White" />
</RadialGradientBrush>
</Border.Background>
</Border>
<Border Width="18" Height="18" CornerRadius="10" Canvas.Left="150" Canvas.Top="125" >
<Border
Canvas.Left="150"
Canvas.Top="125"
Width="18"
Height="18"
CornerRadius="10">
<Border.Background>
<RadialGradientBrush>
<GradientStop Color="Gray" Offset="0.6" x:Name="gsRed1"/>
<GradientStop Color="White"/>
<GradientStop x:Name="gsRed1" Offset="0.6" Color="Gray" />
<GradientStop Color="White" />
</RadialGradientBrush>
</Border.Background>
</Border>
</Canvas>
</Viewbox>
<VisualStateManager.VisualStateGroups>
<VisualStateGroup Name="StockGroup">
<VisualState Name="OpenState">
<Storyboard>
<DoubleAnimation
Storyboard.TargetName="stock"
Storyboard.TargetProperty="Width"
From="0"
To="200"
Duration="00:0:1" />
<DoubleAnimation
Storyboard.TargetName="stock"
Storyboard.TargetProperty="Height"
From="0"
To="70"
Duration="00:0:1" />
</Storyboard>
</VisualState>
<VisualState Name="CloseState">
<Storyboard>
<DoubleAnimation
Storyboard.TargetName="stock"
Storyboard.TargetProperty="Width"
From="200"
To="0"
Duration="00:0:1" />
<DoubleAnimation
Storyboard.TargetName="stock"
Storyboard.TargetProperty="Height"
From="70"
To="0"
Duration="00:0:1" />
</Storyboard>
</VisualState>
</VisualStateGroup>
<VisualStateGroup Name="RunStateGroup">
<VisualState Name="RunState">
<Storyboard>
<ColorAnimationUsingKeyFrames Storyboard.TargetName="gsGreen" Storyboard.TargetProperty="Color">
<DiscreteColorKeyFrame KeyTime="0" Value="Green" />
</ColorAnimationUsingKeyFrames>
</Storyboard>
</VisualState>
<VisualState Name="Stop" />
</VisualStateGroup>
<VisualStateGroup x:Name="FaultStateGroup">
<VisualState Name="FaultState">
<Storyboard>
<ColorAnimationUsingKeyFrames
RepeatBehavior="Forever"
Storyboard.TargetName="gsRed1"
Storyboard.TargetProperty="Color">
<DiscreteColorKeyFrame KeyTime="0:0:0.5" Value="Red" />
<DiscreteColorKeyFrame KeyTime="0:0:1" Value="Gray" />
</ColorAnimationUsingKeyFrames>
</Storyboard>
</VisualState>
<VisualState Name="NormalState" />
</VisualStateGroup>
<VisualStateGroup x:Name="LayOffStateGroup">
<VisualState Name="LayOffState">
<Storyboard>
<DoubleAnimationUsingPath
PathGeometry="{StaticResource move}"
RepeatBehavior="Forever"
Source="Y"
Storyboard.TargetName="arrow"
Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[1].(Y)"
Duration="0:0:1" />
</Storyboard>
</VisualState>
<VisualState Name="LayStopState" />

</VisualStateGroup>
</VisualStateManager.VisualStateGroups>
</Border>
</UserControl>

Двоични данни
Целия файл


+ 0
- 9
BPASmartClient.DATABUS/BPASmartClient.DATABUS.csproj Целия файл

@@ -1,9 +0,0 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>

</Project>

+ 2
- 2
BPASmartClient.DosingProject/App.xaml.cs Целия файл

@@ -32,7 +32,7 @@ namespace BPASmartClient.DosingProject
var res = lv.ShowDialog();
if (res != null && res == true)
{
MessageLog.GetInstance.ShowUserLog("用户登录");
MessageNotify.GetInstance.ShowUserLog("用户登录");
mv.Show();
}
else
@@ -44,7 +44,7 @@ namespace BPASmartClient.DosingProject
{
base.OnExit(e);
Json<LocaPar>.Save();
MessageLog.GetInstance.LogSave();
MessageNotify.GetInstance.LogSave();
ThreadManage.GetInstance().Dispose();
}



+ 12
- 12
BPASmartClient.DosingProject/Model/ProcessControl.cs Целия файл

@@ -56,7 +56,7 @@ namespace BPASmartClient.DosingHKProject.Model
if (HKDevice.IsConnected)
{
HKDevice.Init();
MessageLog.GetInstance.ShowUserLog("海科plc连接成功,并初始化完成");
MessageNotify.GetInstance.ShowUserLog("海科plc连接成功,并初始化完成");
}
}
catch(Exception ex)
@@ -346,7 +346,7 @@ namespace BPASmartClient.DosingHKProject.Model
{
HKDevice.HK_PLC_S7.Write<bool>("DB2.DBX3.0", false);
HKDevice.HK_PLC_S7.Write<bool>("DB2.DBX3.1", false);
MessageLog.GetInstance.ShowRunLog($"下料桶堵料,线体不运行");
MessageNotify.GetInstance.ShowRunLog($"下料桶堵料,线体不运行");
cnt_sensor8++;
}
else
@@ -437,7 +437,7 @@ namespace BPASmartClient.DosingHKProject.Model
if (GVL_SmallStation.GetInstance.AllowDosing_Pos[0])
{
int res = 1;
MessageLog.GetInstance.ShowRunLog($"配方:{recipeName},1号桶,{res}料仓,允许配料");
MessageNotify.GetInstance.ShowRunLog($"配方:{recipeName},1号桶,{res}料仓,允许配料");
if (res > 0 )
{
int loc_index = Array.FindIndex(RemoteRecipes.ElementAt(index).RawMaterial.ToArray(), p => p.RawMaterialLocation == res);
@@ -448,13 +448,13 @@ namespace BPASmartClient.DosingHKProject.Model
GVL_SmallStation.GetInstance.StockInIsWork = (int)res;
}
GVL_SmallStation.GetInstance.DosingTray1 = true;
MessageLog.GetInstance.ShowRunLog($"托盘1,配方:{recipeName},1号桶,{(int)res}号仓,配料完成");
MessageNotify.GetInstance.ShowRunLog($"托盘1,配方:{recipeName},1号桶,{(int)res}号仓,配料完成");
}
}
else if(RTrig.GetInstance("DB3.DBX50.1").Start(HKDevice.HK_PLC_S7.Read<bool>("DB3.DBX50.1")))
{
var res = HKDevice.HK_PLC_S7.Read<float>("DB3.DBD14");
MessageLog.GetInstance.ShowRunLog($"托盘1,配方:{recipeName},2号桶,{res}料仓,允许配料");
MessageNotify.GetInstance.ShowRunLog($"托盘1,配方:{recipeName},2号桶,{res}料仓,允许配料");
if (res > 0 && res is float loc)
{
int loc_index = Array.FindIndex(RemoteRecipes.ElementAt(index).RawMaterial.ToArray(), p => p.RawMaterialLocation == loc);
@@ -465,13 +465,13 @@ namespace BPASmartClient.DosingHKProject.Model
GVL_SmallStation.GetInstance.StockInIsWork = (int)loc;
}
GVL_SmallStation.GetInstance.DosingTray1 = true;
MessageLog.GetInstance.ShowRunLog($"托盘1,配方:{recipeName},2号桶,{(int)loc}号仓,配料完成");
MessageNotify.GetInstance.ShowRunLog($"托盘1,配方:{recipeName},2号桶,{(int)loc}号仓,配料完成");
}
}
else if (RTrig.GetInstance("DB3.DBX50.2").Start(HKDevice.HK_PLC_S7.Read<bool>("DB3.DBX50.2")))
{
var res = HKDevice.HK_PLC_S7.Read<float>("DB3.DBD18");
MessageLog.GetInstance.ShowRunLog($"托盘1,配方:{recipeName},3号桶,{res}料仓,允许配料");
MessageNotify.GetInstance.ShowRunLog($"托盘1,配方:{recipeName},3号桶,{res}料仓,允许配料");
if (res > 0 && res is float loc)
{
int loc_index = Array.FindIndex(RemoteRecipes.ElementAt(index).RawMaterial.ToArray(), p => p.RawMaterialLocation == loc);
@@ -482,13 +482,13 @@ namespace BPASmartClient.DosingHKProject.Model
GVL_SmallStation.GetInstance.StockInIsWork = (int)loc;
}
GVL_SmallStation.GetInstance.DosingTray1 = true;
MessageLog.GetInstance.ShowRunLog($"托盘1,配方:{recipeName},3号桶,{(int)loc}号仓,配料完成");
MessageNotify.GetInstance.ShowRunLog($"托盘1,配方:{recipeName},3号桶,{(int)loc}号仓,配料完成");
}
}
else if (RTrig.GetInstance("DB3.DBX50.3").Start(HKDevice.HK_PLC_S7.Read<bool>("DB3.DBX50.3")))
{
var res = HKDevice.HK_PLC_S7.Read<float>("DB3.DBD22");
MessageLog.GetInstance.ShowRunLog($"托盘1,配方:{recipeName},4号桶,{res}料仓,允许配料");
MessageNotify.GetInstance.ShowRunLog($"托盘1,配方:{recipeName},4号桶,{res}料仓,允许配料");
if (res > 0 && res is float loc)
{
int loc_index = Array.FindIndex(RemoteRecipes.ElementAt(index).RawMaterial.ToArray(), p => p.RawMaterialLocation == loc);
@@ -499,7 +499,7 @@ namespace BPASmartClient.DosingHKProject.Model
GVL_SmallStation.GetInstance.StockInIsWork = (int)loc;
}
GVL_SmallStation.GetInstance.DosingTray1 = true;
MessageLog.GetInstance.ShowRunLog($"托盘1,配方:{recipeName},4号桶,{(int)loc}号仓,配料完成");
MessageNotify.GetInstance.ShowRunLog($"托盘1,配方:{recipeName},4号桶,{(int)loc}号仓,配料完成");
}
}
if (GVL_SmallStation.GetInstance.DosingTray1)
@@ -508,7 +508,7 @@ namespace BPASmartClient.DosingHKProject.Model
{
if (RTrig.GetInstance("GetDeviceRunStatus").Start(DeviceInquire.GetInstance.GetDevice(i).deviceStatus.RunStatus == 3))
{
MessageLog.GetInstance.ShowRunLog($"柔性味魔方,托盘1,配方:{recipeName},{i}号仓,配料完成");
MessageNotify.GetInstance.ShowRunLog($"柔性味魔方,托盘1,配方:{recipeName},{i}号仓,配料完成");
int res = Array.FindIndex(RemoteRecipes.ElementAt(index).RawMaterial.ToArray(), p => p.RawMaterialLocation == i);
RemoteRecipes.ElementAt(index).RawMaterial.ElementAt(res).Laying_Off_Weight = DeviceInquire.GetInstance.GetDevice(i).deviceStatus.CutWeightFeedback;
DeviceInquire.GetInstance.GetDevice(i).StatusReset();
@@ -527,7 +527,7 @@ namespace BPASmartClient.DosingHKProject.Model
if (RTrig.GetInstance("配方配料完成").Start(HKDevice.HK_PLC_S7.Read<bool>("DB3.DBX1.1")) && (GVL_SmallStation.GetInstance.WindSendDosingFinish || !GVL_SmallStation.GetInstance.IsUseWindSend))
{
var res = Json<RemoteRecipeDataColl>.Data.Recipes.FirstOrDefault(p => p.RecipeCode == code);
MessageLog.GetInstance.ShowRunLog($"托盘1,配方{res.RecipeName},配料完成");
MessageNotify.GetInstance.ShowRunLog($"托盘1,配方{res.RecipeName},配料完成");
App.Current.Dispatcher.Invoke(() =>
{
Json<RemoteRecipeDataColl>.Data.Recipes.Remove(res);


+ 10
- 10
BPASmartClient.DosingProject/Model/RawMaterial/DeviceInquire.cs Целия файл

@@ -210,7 +210,7 @@ namespace BPASmartClient.DosingHKProject.Model
{
if (Global.DeviceRawMaterials.FirstOrDefault(p => p.RawMaterialName == DeviceName) == null)
{
Global.DeviceRawMaterials.Add(new RawMaterialModel() { RawMaterialName = DeviceName, DeviceIp = ip, RawMaterialSource = 1});
Global.DeviceRawMaterials.Add(new RawMaterialModel() { RawMaterialName = DeviceName, DeviceIp = ip, RawMaterialSource = 1 });
}
}
else
@@ -307,13 +307,13 @@ namespace BPASmartClient.DosingHKProject.Model
deviceStatus.DeviceNum = (ushort)this.modbusTcp.ReadShort(DeviceAddress.DeviceNum);//获取设备编号
deviceStatus.DeviceAlarmCode = (ushort)this.modbusTcp.ReadShort(DeviceAddress.DeviceAlarmCode);//获取设备故障编码

AlarmHelper<AlarmInfo>.Alarm.EStop1 = deviceStatus.DeviceAlarmCode.Get16bitValue(1);
AlarmHelper<AlarmInfo>.Alarm.Servo = deviceStatus.DeviceAlarmCode.Get16bitValue(2);
AlarmHelper<AlarmInfo>.Alarm.Inverter = deviceStatus.DeviceAlarmCode.Get16bitValue(3);
AlarmHelper<AlarmInfo>.Alarm.EStop2 = deviceStatus.DeviceAlarmCode.Get16bitValue(7);
AlarmHelper<AlarmInfo>.Alarm.SiloUpperLimit = deviceStatus.DeviceAlarmCode.Get16bitValue(8);
AlarmHelper<AlarmInfo>.Alarm.SiloLowerLimit = deviceStatus.DeviceAlarmCode.Get16bitValue(9);
AlarmHelper<AlarmInfo>.Alarm.EStop1 = true;
AlarmHelper<AlarmInfo>.GetInstance(DeviceName).EStop1 = deviceStatus.DeviceAlarmCode.Get16bitValue(1);
AlarmHelper<AlarmInfo>.GetInstance(DeviceName).Servo = deviceStatus.DeviceAlarmCode.Get16bitValue(2);
AlarmHelper<AlarmInfo>.GetInstance(DeviceName).Inverter = deviceStatus.DeviceAlarmCode.Get16bitValue(3);
AlarmHelper<AlarmInfo>.GetInstance(DeviceName).EStop2 = deviceStatus.DeviceAlarmCode.Get16bitValue(7);
AlarmHelper<AlarmInfo>.GetInstance(DeviceName).SiloUpperLimit = deviceStatus.DeviceAlarmCode.Get16bitValue(8);
AlarmHelper<AlarmInfo>.GetInstance(DeviceName).SiloLowerLimit = deviceStatus.DeviceAlarmCode.Get16bitValue(9);
AlarmHelper<AlarmInfo>.GetInstance(DeviceName).EStop1 = true;
Thread.Sleep(10);
}), $"{DeviceName} 开始监听", true);
}
@@ -342,7 +342,7 @@ namespace BPASmartClient.DosingHKProject.Model
{
modbusTcp.SetReal(DeviceAddress.WeightSet, Value);//写入配方量
modbusTcp.Write(DeviceAddress.Start, (ushort)1);//设备启动写入
MessageLog.GetInstance.ShowRunLog($"开始配料");
MessageNotify.GetInstance.ShowRunLog($"开始配料");
//配料设备参数写入
var res = Json<DevicePar>.Data.deviceParModels.FirstOrDefault(p => p.MaterialName == DeviceName);
if (res != null)
@@ -355,7 +355,7 @@ namespace BPASmartClient.DosingHKProject.Model
modbusTcp.SetUint(DeviceAddress.SiloUpperLimitWeight, (uint)res.SiloUpperLimitWeight);
modbusTcp.SetUint(DeviceAddress.LowerLimitWeightOfSilo, (uint)res.LowerLimitWeightOfSilo);
modbusTcp.SetUint(DeviceAddress.StirringSpeed, (uint)res.StirringSpeed * 100);
MessageLog.GetInstance.ShowRunLog($"参数下发完成");
MessageNotify.GetInstance.ShowRunLog($"参数下发完成");
}
}
}


+ 2
- 2
BPASmartClient.DosingProject/ViewModel/NewMaterialViewModel.cs Целия файл

@@ -37,7 +37,7 @@ public class NewMaterialViewModel:ObservableObject
var res = Materials.FirstOrDefault(p=>p.RawMaterialId == id);
Materials.Remove(res);
Json<LocaMaterial>.Save();
MessageLog.GetInstance.ShowUserLog($"删除原料--{res.RawMaterialName}");
MessageNotify.GetInstance.ShowUserLog($"删除原料--{res.RawMaterialName}");
}
}

@@ -52,7 +52,7 @@ public class NewMaterialViewModel:ObservableObject
if(Json<LocaMaterial>.Data.LocalMaterails.FirstOrDefault(p=>p.RawMaterialName == MaterialName) != null) { ErrorInfo = "本地原料名称重复";return ;}
Json<LocaMaterial>.Data.LocalMaterails.Add(new RawMaterialModel { RawMaterialName = MaterialName, RawMaterialId = Guid.NewGuid().ToString() , RawMaterialSource = 0 });
Json<LocaMaterial>.Save();
MessageLog.GetInstance.ShowUserLog($"添加原料--{MaterialName}");
MessageNotify.GetInstance.ShowUserLog($"添加原料--{MaterialName}");
});
}
}

+ 3
- 3
BPASmartClient.DosingProject/ViewModel/RecipeControlViewModel.cs Целия файл

@@ -35,7 +35,7 @@ namespace BPASmartClient.DosingHKProject.ViewModel
{
Recipes.ElementAt(index).IsEnable = false;
}
MessageLog.GetInstance.ShowUserLog($"下发工单 { Recipes.ElementAt(index).RecipeName}");
MessageNotify.GetInstance.ShowUserLog($"下发工单 { Recipes.ElementAt(index).RecipeName}");
devices.Enqueue(deviceName);
var res = Recipes.FirstOrDefault(p => p.RecipeName == deviceName);
UserTreeWait.Add(new RecipeModel { RecipeName = deviceName, RawMaterials = res.RawMaterials });
@@ -43,7 +43,7 @@ namespace BPASmartClient.DosingHKProject.ViewModel


NoticeDemoViewModel.OpenMsg(EnumPromptType.Success, App.MainWindow, "提示", $"配方下发成功!");
MessageLog.GetInstance.ShowUserLog($"下发工单 {Guid.NewGuid().ToString()}");
MessageNotify.GetInstance.ShowUserLog($"下发工单 {Guid.NewGuid().ToString()}");
});

ChangeRecipeStateCommand = new RelayCommand<object>(ChangeRecipeState);
@@ -128,7 +128,7 @@ namespace BPASmartClient.DosingHKProject.ViewModel
for (int n = 0; n < recipeProcesses.Count; n++)
{
DeviceInquire.GetInstance.GetDevice(Recipes.ElementAt(recipIndex).RawMaterials.ElementAt(n).DeviceIp).StatusReset();//完成配料的设备运行状态地址写0
MessageLog.GetInstance.ShowRunLog(Recipes.ElementAt(recipIndex).RawMaterials.ElementAt(n).DeviceIp);
MessageNotify.GetInstance.ShowRunLog(Recipes.ElementAt(recipIndex).RawMaterials.ElementAt(n).DeviceIp);
}
App.Current.Dispatcher.Invoke(new Action(() => { recipeProcesses.Clear(); }));
Recipes.ElementAt(recipIndex).IsEnable = true;


+ 1
- 1
BPASmartClient.DosingProject/ViewModel/RecipeInfosViewModel.cs Целия файл

@@ -24,7 +24,7 @@ namespace BPASmartClient.DosingHKProject.ViewModel
{
RecipeName = rm.RecipeName;
RecipeCode = rm.RecipeCode;
TrayCode = rm.TrayCode;
//TrayCode = rm.TrayCode;
foreach (var item in rm.RawMaterial)
{
RawMaterialsInfo.Add(item);


+ 9
- 9
BPASmartClient.DosingProject/ViewModel/RecipeReceiveViewModel.cs Целия файл

@@ -29,7 +29,7 @@ namespace BPASmartClient.DosingHKProject.ViewModel
public RecipeReceiveViewModel()
{
Recipes = Json<LocalRecipeDataColl>.Data.Recipes;
NewRecipe = new RelayCommand(() =>
{
NewLocalRecipeView NewLocalRecipe = new NewLocalRecipeView();
@@ -43,7 +43,7 @@ namespace BPASmartClient.DosingHKProject.ViewModel
if (res != null)
{
Json<LocalRecipeDataColl>.Data.Recipes.Remove(res);
MessageLog.GetInstance.ShowUserLog($"删除配方——{res.RecipeName}");
MessageNotify.GetInstance.ShowUserLog($"删除配方——{res.RecipeName}");
}
}
});
@@ -58,7 +58,7 @@ namespace BPASmartClient.DosingHKProject.ViewModel
{
ActionManage.GetInstance.Send("LocalRecipeEdit", res);
nrv.Show();
MessageLog.GetInstance.ShowUserLog($"编辑配方——{res.RecipeName}");
MessageNotify.GetInstance.ShowUserLog($"编辑配方——{res.RecipeName}");
}
}
});
@@ -70,13 +70,13 @@ namespace BPASmartClient.DosingHKProject.ViewModel
if (res != null)
{
Json<RemoteRecipeDataColl>.Data.Recipes.Add(res);
MessageLog.GetInstance.ShowUserLog($"下发配方——{res.RecipeName}");
MessageNotify.GetInstance.ShowUserLog($"下发配方——{res.RecipeName}");
}
}
});
NewSimulateRecipe = new RelayCommand(() =>
{
ObservableCollection<RemoteRecipeRawMaterial> RawMaterials = new ObservableCollection<RemoteRecipeRawMaterial>();
ObservableCollection<RemoteRecipeRawMaterial> RawMaterials = new ObservableCollection<RemoteRecipeRawMaterial>();
string recipeName = "配方" + (Json<LocalRecipeDataColl>.Data.Recipes.Count + 1) + "";
go:
string recipeCode = new Random().Next(1000, 9999).ToString();
@@ -105,21 +105,21 @@ namespace BPASmartClient.DosingHKProject.ViewModel
{
RecipeName = recipeName,
RecipeCode = recipeCode,
TrayCode = trayCode,
//TrayCode = trayCode,
RawMaterial = RawMaterials,
});
}

});
ClearAllRecipe = new RelayCommand(() =>
ClearAllRecipe = new RelayCommand(() =>
{
Json<LocalRecipeDataColl>.Data.Recipes.Clear();
});
}
}
public RelayCommand<object> DetailsCommand { get; set; }
public RelayCommand<object> IssueRecipe { get; set; }
public RelayCommand<object> RemoveRecipe { get; set; }
public RelayCommand NewSimulateRecipe { get;set; }
public RelayCommand NewSimulateRecipe { get; set; }
public RelayCommand ClearAllRecipe { get; set; }
public RelayCommand NewRecipe { get; set; }
public ObservableCollection<RemoteRecipeData> Recipes { get; set; }


+ 4
- 4
BPASmartClient.DosingProject/ViewModel/RecipeSettingsViewModel.cs Целия файл

@@ -37,12 +37,12 @@ namespace BPASmartClient.DosingHKProject.ViewModel
{
NewRecipeView nrv = new NewRecipeView();
nrv.ShowDialog();
MessageLog.GetInstance.ShowUserLog("新建配方");
MessageNotify.GetInstance.ShowUserLog("新建配方");
});
SaveRecipe = new RelayCommand(() =>
{
Json<LocaPar>.Save();
MessageLog.GetInstance.ShowUserLog("保存配方");
MessageNotify.GetInstance.ShowUserLog("保存配方");
NoticeDemoViewModel.OpenMsg(EnumPromptType.Success, App.MainWindow, "提示", $"配方保存成功!");
});
RemoveCommand = new RelayCommand<object>((o) =>
@@ -51,7 +51,7 @@ namespace BPASmartClient.DosingHKProject.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}");
MessageNotify.GetInstance.ShowUserLog($"删除名称——{res.RecipeName}");
}
});

@@ -64,7 +64,7 @@ namespace BPASmartClient.DosingHKProject.ViewModel
var res = Json<LocaPar>.Data.Recipes.FirstOrDefault(p => p.RecipCode == str);
ActionManage.GetInstance.Send("Details", res);
nrv.ShowDialog();
MessageLog.GetInstance.ShowUserLog($"编辑配方名称——{res.RecipeName}");
MessageNotify.GetInstance.ShowUserLog($"编辑配方名称——{res.RecipeName}");
}
});



+ 1
- 1
BPASmartClient.DosingProject/ViewModel/SiemensRecipeReceiveViewModel.cs Целия файл

@@ -40,7 +40,7 @@ namespace BPASmartClient.DosingHKProject.ViewModel
{
ActionManage.GetInstance.Send("RecipeInfo", res);
nrv.Show();
MessageLog.GetInstance.ShowUserLog($"查看配方——{res.RecipeName}");
MessageNotify.GetInstance.ShowUserLog($"查看配方——{res.RecipeName}");
}
}
});


+ 7
- 3
BPASmartClient.Helper/RTrig.cs Целия файл

@@ -13,11 +13,15 @@ namespace BPASmartClient.Helper
public class RTrig
{
private volatile static ConcurrentDictionary<string, RTrig> _Instance;
private static readonly object Lock = new object();
public static RTrig GetInstance(string name)
{
if (_Instance == null) _Instance = new ConcurrentDictionary<string, RTrig>();
if (!_Instance.ContainsKey(name)) _Instance.TryAdd(name, new RTrig());
return _Instance[name];
lock (Lock)
{
if (_Instance == null) _Instance = new ConcurrentDictionary<string, RTrig>();
if (!_Instance.ContainsKey(name)) _Instance.TryAdd(name, new RTrig());
return _Instance[name];
}
}
private RTrig() { }



+ 2
- 4
BPASmartClient.JXJFoodBigStation/App.config Целия файл

@@ -1,9 +1,7 @@
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<appSettings>
<add key="HKPlc_IP" value="192.168.0.20"/>
<add key="HKPlc_Port" value="502"/>
<add key="Siemens_IP" value="192.168.0.30"/>
<add key="Siemens_Port" value="502"/>
<add key="HKPlc_IP" value="107.107.2.17"/>
<add key="Siemens_IP" value="107.107.2.200"/>
</appSettings>
</configuration>

+ 3
- 2
BPASmartClient.JXJFoodBigStation/App.xaml.cs Целия файл

@@ -34,7 +34,7 @@ namespace BPASmartClient.JXJFoodBigStation
var res = lv.ShowDialog();
if (res != null && res == true)
{
MessageLog.GetInstance.ShowUserLog("用户登录");
MessageNotify.GetInstance.ShowUserLog("用户登录");
mv.Show();
}
else
@@ -45,7 +45,7 @@ namespace BPASmartClient.JXJFoodBigStation
protected override void OnExit(ExitEventArgs e)
{
base.OnExit(e);
MessageLog.GetInstance.LogSave();
MessageNotify.GetInstance.LogSave();
ThreadManage.GetInstance().Dispose();
}

@@ -169,6 +169,7 @@ namespace BPASmartClient.JXJFoodBigStation
{
//Config.GetInstance.Init();
//Json<LocaPar>.Read();
Json<LocalRecipe>.Read();
}

}


+ 4
- 0
BPASmartClient.JXJFoodBigStation/BPASmartClient.JXJFoodBigStation.csproj Целия файл

@@ -7,6 +7,10 @@
<UseWPF>true</UseWPF>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="BPA.Communication" Version="1.0.19" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\BPASmartClient.CustomResource\BPASmartClient.CustomResource.csproj" />
<ProjectReference Include="..\BPASmartClient.Modbus\BPASmartClient.Modbus.csproj" />


+ 7
- 2
BPASmartClient.JXJFoodBigStation/Model/GVL_BigStation.cs Целия файл

@@ -35,10 +35,15 @@ namespace BPASmartClient.JXJFoodBigStation.Model
/// <summary>
/// 配方下发状态 =0:配方未下发 ,1:配方下发给plc ,2:plc成功接收配方
/// </summary>
public int RecipeDosingStatus { get; set; }
public int Recipe1DosingStatus { get; set; }
public int Recipe2DosingStatus { get; set; }
public int Recipe3DosingStatus { get; set; }
public int Recipe4DosingStatus { get; set; }
public int Recipe5DosingStatus { get; set; }

/// <summary>
/// 是否处于手动下发配方
/// </summary>
public bool IsAllowManual { get; set; }
public bool IsAllowManual { get; set; } = true;
}
}

+ 46
- 0
BPASmartClient.JXJFoodBigStation/Model/HK_PLC/DB_Read.cs Целия файл

@@ -0,0 +1,46 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace BPASmartClient.JXJFoodBigStation.Model.HK_PLC
{
public class DB_Read
{
public bool HeartBeat { get; set; }
public bool IsAllowIssueRecipe1 { get; set; }

public bool IsAllowIssueRecipe2 { get; set; }
public bool IsAllowIssueRecipe3 { get; set; }
public bool IsAllowIssueRecipe4 { get; set; }
public bool ReceiveFinishRecipe1 { get; set; }
public bool ReceiveFinishRecipe2 { get; set; }
public bool ReceiveFinishRecipe3 { get; set; }
public bool ReceiveFinishRecipe4 { get; set; }

public bool Recipe1DosingFinish { get; set; }
public bool Recipe2DosingFinish { get; set; }
public bool Recipe3DosingFinish { get; set; }
public bool Recipe4DosingFinish { get; set; }
public short Recipe1TrayCode { get; set; }
public short Recipe2TrayCode { get; set; }
public short Recipe3TrayCode { get; set; }
public short Recipe4TrayCode { get; set; }

public float StockBin1ActualWeight { get; set; }
public float StockBin2ActualWeight { get; set; }
public float StockBin3ActualWeight { get; set; }
public float StockBin4ActualWeight { get; set; }
public float StockBin5ActualWeight { get; set; }
public float StockBin6ActualWeight { get; set; }
public float StockBin7ActualWeight { get; set; }
public float StockBin8ActualWeight { get; set; }
public float StockBin9ActualWeight { get; set; }
public float StockBin10ActualWeight { get; set; }
public float StockBin11ActualWeight { get; set; }
public float StockBin12ActualWeight { get; set; }
public float StockBin13ActualWeight { get; set; }
public float StockBin14ActualWeight { get; set; }
}
}

+ 127
- 0
BPASmartClient.JXJFoodBigStation/Model/HK_PLC/DB_Write.cs Целия файл

@@ -0,0 +1,127 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace BPASmartClient.JXJFoodBigStation.Model.HK_PLC
{
public class DB_Write
{
/// <summary>
/// 上位机 到 PLC的心跳
/// </summary>
public bool HeartBeat { get; set; }
/// <summary>
/// 配方锁定(暂时不使用)
/// </summary>
public bool RecipeLock { get; set; }
/// <summary>
/// 配方清零
/// </summary>
public bool RecipeReset { get; set; }
/// <summary>
/// 配方1下发完成
/// </summary>
public bool Recipe1IssuedFinish { get; set; }
/// <summary>
/// 配方2下发完成
/// </summary>
public bool Recipe2IssuedFinish { get; set; }
/// <summary>
/// 配方3下发完成
/// </summary>
public bool Recipe3IssuedFinish { get; set; }
/// <summary>
/// 配方4下发完成
/// </summary>
public bool Recipe4IssuedFinish { get; set; }
/// <summary>
/// AGV在托盘1到位
/// </summary>
public bool Tray1InPlace { get; set; }
/// <summary>
/// AGV在托盘2到位
/// </summary>
public bool Tray2InPlace { get; set; }
/// <summary>
/// AGV在托盘3到位
/// </summary>
public bool Tray3InPlace { get; set; }
/// <summary>
/// AGV在托盘4到位
/// </summary>
public bool Tray4InPlace { get; set; }
/// <summary>
/// AGV在托盘5到位
/// </summary>
public bool Tray5InPlace { get; set; }
/// <summary>
/// 配方编码
/// </summary>
public short RecipeCode { get; set; }
/// <summary>
/// 托盘编码
/// </summary>
public short TrayCode { get; set; }
public float Bareel1Bin1SetWeight { get; set; }
public float Bareel1Bin2SetWeight { get; set; }
public float Bareel1Bin3SetWeight { get; set; }
public float Bareel1Bin4SetWeight { get; set; }
public float Bareel1Bin5SetWeight { get; set; }
public float Bareel1Bin6SetWeight { get; set; }
public float Bareel1Bin7SetWeight { get; set; }
public float Bareel1Bin8SetWeight { get; set; }
public float Bareel1Bin9SetWeight { get; set; }
public float Bareel1Bin10SetWeight { get; set; }
public float Bareel1Bin11SetWeight { get; set; }
public float Bareel1Bin12SetWeight { get; set; }
public float Bareel1Bin13SetWeight { get; set; }
public float Bareel1Bin14SetWeight { get; set; }

public float Bareel2Bin1SetWeight { get; set; }
public float Bareel2Bin2SetWeight { get; set; }
public float Bareel2Bin3SetWeight { get; set; }
public float Bareel2Bin4SetWeight { get; set; }
public float Bareel2Bin5SetWeight { get; set; }
public float Bareel2Bin6SetWeight { get; set; }
public float Bareel2Bin7SetWeight { get; set; }
public float Bareel2Bin8SetWeight { get; set; }
public float Bareel2Bin9SetWeight { get; set; }
public float Bareel2Bin10SetWeight { get; set; }
public float Bareel2Bin11SetWeight { get; set; }
public float Bareel2Bin12SetWeight { get; set; }
public float Bareel2Bin13SetWeight { get; set; }
public float Bareel2Bin14SetWeight { get; set; }
public float Bareel4Bin1SetWeight { get; set; }
public float Bareel4Bin2SetWeight { get; set; }
public float Bareel4Bin3SetWeight { get; set; }
public float Bareel4Bin4SetWeight { get; set; }
public float Bareel4Bin5SetWeight { get; set; }
public float Bareel4Bin6SetWeight { get; set; }
public float Bareel4Bin7SetWeight { get; set; }
public float Bareel4Bin8SetWeight { get; set; }
public float Bareel4Bin9SetWeight { get; set; }
public float Bareel4Bin10SetWeight { get; set; }
public float Bareel4Bin11SetWeight { get; set; }
public float Bareel4Bin12SetWeight { get; set; }
public float Bareel4Bin13SetWeight { get; set; }
public float Bareel4Bin14SetWeight { get; set; }

public float Bareel5Bin1SetWeight { get; set; }
public float Bareel5Bin2SetWeight { get; set; }
public float Bareel5Bin3SetWeight { get; set; }
public float Bareel5Bin4SetWeight { get; set; }
public float Bareel5Bin5SetWeight { get; set; }
public float Bareel5Bin6SetWeight { get; set; }
public float Bareel5Bin7SetWeight { get; set; }
public float Bareel5Bin8SetWeight { get; set; }
public float Bareel5Bin9SetWeight { get; set; }
public float Bareel5Bin10SetWeight { get; set; }
public float Bareel5Bin11SetWeight { get; set; }
public float Bareel5Bin12SetWeight { get; set; }
public float Bareel5Bin13SetWeight { get; set; }
public float Bareel5Bin14SetWeight { get; set; }
}
}

+ 436
- 19
BPASmartClient.JXJFoodBigStation/Model/HK_PLC/HKDeviceStatus.cs Целия файл

@@ -4,8 +4,10 @@ using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using BPASmartClient.CustomResource.Pages.Model;
using System.Threading.Tasks;
using BPASmartClient.S7Net;
using System.Threading;

namespace BPASmartClient.JXJFoodBigStation.Model.HK_PLC
{
@@ -13,13 +15,27 @@ namespace BPASmartClient.JXJFoodBigStation.Model.HK_PLC
{
public SiemensHelper HK_PLC_S7 = new SiemensHelper();
public bool IsConnected => HK_PLC_S7.IsConnected;
public DB_Write PlcWrite = new DB_Write();
public DB_Read PlcRead = new DB_Read();
public StockBinName StockBinName = new StockBinName();
public void Init()
{
if (IsConnected)
{
ThreadManage.GetInstance().StartLong(new Action(() =>
{
HK_PLC_S7.WriteClass<DB_Write>(PlcWrite, 99);
var res1 = HK_PLC_S7.ReadClass<DB_Read>(98);
var res2 = HK_PLC_S7.ReadClass<StockBinName>(97);
if (res1 != null && res1 is DB_Read data1)
{
PlcRead = data1;
}
if (res2 != null && res2 is StockBinName data2)
{
StockBinName = data2;
}
Thread.Sleep(10);
}),"信号收发处理");
}
}
@@ -32,31 +48,432 @@ namespace BPASmartClient.JXJFoodBigStation.Model.HK_PLC
{
if (recipe != null)
{
PlcWrite.RecipeCode = Convert.ToInt16(recipe.RecipeCode);
PlcWrite.TrayCode = Convert.ToInt16(recipe.TrayCode);
for (int barrel = 1; barrel < 6; barrel++)
{
for (int loc = 1; loc < 13; loc++)
if (barrel != 3)
{
int index = Array.FindIndex(recipe.RawMaterial.ToArray(), p => p.RawMaterialBarrelNum == barrel && p.RawMaterialLocation == loc);
if (barrel >= 3)//PLC没有3号桶的重量位置,故4,5号桶地址向前偏移48个位置
{
if (index != -1)
{
HK_PLC_S7.Write<float>("MD" + 4120 + (loc - 1) * 4 + (barrel - 1 - 1) * 48, recipe.RawMaterial.ElementAt(index).RawMaterialWeight);
}
else//不存在的原料信息,重量写0
{
HK_PLC_S7.Write<float>("MD" + 4120 + (loc - 1) * 4 + (barrel - 1 - 1) * 48, 0);
}
}
else
for (int loc = 1; loc < 15; loc++)
{
if (index != -1)
int index = Array.FindIndex(recipe.RawMaterial.ToArray(), p => p.RawMaterialBarrelNum == barrel && p.RawMaterialLocation == loc);
if (index == -1)
{
HK_PLC_S7.Write<float>("MD" + 4120 + (loc - 1) * 4 + (barrel - 1) * 48, recipe.RawMaterial.ElementAt(index).RawMaterialWeight);
switch (barrel)
{
case 1:
switch (loc)
{
case 1:
PlcWrite.Bareel1Bin1SetWeight = 0;
break;
case 2:
PlcWrite.Bareel1Bin2SetWeight = 0;
break;
case 3:
PlcWrite.Bareel1Bin3SetWeight = 0;
break;
case 4:
PlcWrite.Bareel1Bin4SetWeight = 0;
break;
case 5:
PlcWrite.Bareel1Bin5SetWeight = 0;
break;
case 6:
PlcWrite.Bareel1Bin6SetWeight = 0;
break;
case 7:
PlcWrite.Bareel1Bin7SetWeight = 0;
break;
case 8:
PlcWrite.Bareel1Bin8SetWeight = 0;
break;
case 9:
PlcWrite.Bareel1Bin9SetWeight = 0;
break;
case 10:
PlcWrite.Bareel1Bin10SetWeight = 0;
break;
case 11:
PlcWrite.Bareel1Bin11SetWeight = 0;
break;
case 12:
PlcWrite.Bareel1Bin12SetWeight = 0;
break;
case 13:
PlcWrite.Bareel1Bin13SetWeight = 0;
break;
case 14:
PlcWrite.Bareel1Bin14SetWeight = 0;
break;
default:
break;
}

break;
case 2:
switch (loc)
{
case 1:
PlcWrite.Bareel2Bin1SetWeight = 0;
break;
case 2:
PlcWrite.Bareel2Bin2SetWeight = 0;
break;
case 3:
PlcWrite.Bareel2Bin3SetWeight = 0;
break;
case 4:
PlcWrite.Bareel2Bin4SetWeight = 0;
break;
case 5:
PlcWrite.Bareel2Bin5SetWeight = 0;
break;
case 6:
PlcWrite.Bareel2Bin6SetWeight = 0;
break;
case 7:
PlcWrite.Bareel2Bin7SetWeight = 0;
break;
case 8:
PlcWrite.Bareel2Bin8SetWeight = 0;
break;
case 9:
PlcWrite.Bareel2Bin9SetWeight = 0;
break;
case 10:
PlcWrite.Bareel2Bin10SetWeight = 0;
break;
case 11:
PlcWrite.Bareel2Bin11SetWeight = 0;
break;
case 12:
PlcWrite.Bareel2Bin12SetWeight = 0;
break;
case 13:
PlcWrite.Bareel2Bin13SetWeight = 0;
break;
case 14:
PlcWrite.Bareel2Bin14SetWeight = 0;
break;
default:
break;
}

break;
case 4:
switch (loc)
{
case 1:
PlcWrite.Bareel4Bin1SetWeight = 0;
break;
case 2:
PlcWrite.Bareel4Bin2SetWeight = 0;
break;
case 3:
PlcWrite.Bareel4Bin3SetWeight = 0;
break;
case 4:
PlcWrite.Bareel4Bin4SetWeight = 0;
break;
case 5:
PlcWrite.Bareel4Bin5SetWeight = 0;
break;
case 6:
PlcWrite.Bareel4Bin6SetWeight = 0;
break;
case 7:
PlcWrite.Bareel4Bin7SetWeight = 0;
break;
case 8:
PlcWrite.Bareel4Bin8SetWeight = 0;
break;
case 9:
PlcWrite.Bareel4Bin9SetWeight = 0;
break;
case 10:
PlcWrite.Bareel4Bin10SetWeight = 0;
break;
case 11:
PlcWrite.Bareel4Bin11SetWeight = 0;
break;
case 12:
PlcWrite.Bareel4Bin12SetWeight = 0;
break;
case 13:
PlcWrite.Bareel4Bin13SetWeight = 0;
break;
case 14:
PlcWrite.Bareel4Bin14SetWeight = 0;
break;
default:
break;
}

break;
case 5:
switch (loc)
{
case 1:
PlcWrite.Bareel5Bin1SetWeight = 0;
break;
case 2:
PlcWrite.Bareel5Bin2SetWeight = 0;
break;
case 3:
PlcWrite.Bareel5Bin3SetWeight = 0;
break;
case 4:
PlcWrite.Bareel5Bin4SetWeight = 0;
break;
case 5:
PlcWrite.Bareel5Bin5SetWeight = 0;
break;
case 6:
PlcWrite.Bareel5Bin6SetWeight = 0;
break;
case 7:
PlcWrite.Bareel5Bin7SetWeight = 0;
break;
case 8:
PlcWrite.Bareel5Bin8SetWeight = 0;
break;
case 9:
PlcWrite.Bareel5Bin9SetWeight = 0;
break;
case 10:
PlcWrite.Bareel5Bin10SetWeight = 0;
break;
case 11:
PlcWrite.Bareel5Bin11SetWeight = 0;
break;
case 12:
PlcWrite.Bareel5Bin12SetWeight = 0;
break;
case 13:
PlcWrite.Bareel5Bin13SetWeight = 0;
break;
case 14:
PlcWrite.Bareel5Bin14SetWeight = 0;
break;
default:
break;
}

break;
default:
break;

}
}
else//不存在的原料信息,重量写0
else
{
HK_PLC_S7.Write<float>("MD" + 4120 + (loc - 1) * 4 + (barrel - 1) * 48, 0);
MessageNotify.GetInstance.ShowRunLog($"配方编号:{recipe.RecipeCode},托盘编号:{recipe.TrayCode},桶号:{barrel},位置:{loc},重量:{recipe.RawMaterial.ElementAt(index).RawMaterialWeight}");
switch (barrel)
{
case 1:
switch (loc)
{
case 1:
PlcWrite.Bareel1Bin1SetWeight = recipe.RawMaterial.ElementAt(index).RawMaterialWeight;
break;
case 2:
PlcWrite.Bareel1Bin2SetWeight = recipe.RawMaterial.ElementAt(index).RawMaterialWeight;
break;
case 3:
PlcWrite.Bareel1Bin3SetWeight = recipe.RawMaterial.ElementAt(index).RawMaterialWeight;
break;
case 4:
PlcWrite.Bareel1Bin4SetWeight = recipe.RawMaterial.ElementAt(index).RawMaterialWeight;
break;
case 5:
PlcWrite.Bareel1Bin5SetWeight = recipe.RawMaterial.ElementAt(index).RawMaterialWeight;
break;
case 6:
PlcWrite.Bareel1Bin6SetWeight = recipe.RawMaterial.ElementAt(index).RawMaterialWeight;
break;
case 7:
PlcWrite.Bareel1Bin7SetWeight = recipe.RawMaterial.ElementAt(index).RawMaterialWeight;
break;
case 8:
PlcWrite.Bareel1Bin8SetWeight = recipe.RawMaterial.ElementAt(index).RawMaterialWeight;
break;
case 9:
PlcWrite.Bareel1Bin9SetWeight = recipe.RawMaterial.ElementAt(index).RawMaterialWeight;
break;
case 10:
PlcWrite.Bareel1Bin10SetWeight = recipe.RawMaterial.ElementAt(index).RawMaterialWeight;
break;
case 11:
PlcWrite.Bareel1Bin11SetWeight = recipe.RawMaterial.ElementAt(index).RawMaterialWeight;
break;
case 12:
PlcWrite.Bareel1Bin12SetWeight = recipe.RawMaterial.ElementAt(index).RawMaterialWeight;
break;
case 13:
PlcWrite.Bareel1Bin13SetWeight = recipe.RawMaterial.ElementAt(index).RawMaterialWeight;
break;
case 14:
PlcWrite.Bareel1Bin14SetWeight = recipe.RawMaterial.ElementAt(index).RawMaterialWeight;
break;
default:
break;
}

break;
case 2:
switch (loc)
{
case 1:
PlcWrite.Bareel2Bin1SetWeight = recipe.RawMaterial.ElementAt(index).RawMaterialWeight;
break;
case 2:
PlcWrite.Bareel2Bin2SetWeight = recipe.RawMaterial.ElementAt(index).RawMaterialWeight;
break;
case 3:
PlcWrite.Bareel2Bin3SetWeight = recipe.RawMaterial.ElementAt(index).RawMaterialWeight;
break;
case 4:
PlcWrite.Bareel2Bin4SetWeight = recipe.RawMaterial.ElementAt(index).RawMaterialWeight;
break;
case 5:
PlcWrite.Bareel2Bin5SetWeight = recipe.RawMaterial.ElementAt(index).RawMaterialWeight;
break;
case 6:
PlcWrite.Bareel2Bin6SetWeight = recipe.RawMaterial.ElementAt(index).RawMaterialWeight;
break;
case 7:
PlcWrite.Bareel2Bin7SetWeight = recipe.RawMaterial.ElementAt(index).RawMaterialWeight;
break;
case 8:
PlcWrite.Bareel2Bin8SetWeight = recipe.RawMaterial.ElementAt(index).RawMaterialWeight;
break;
case 9:
PlcWrite.Bareel2Bin9SetWeight = recipe.RawMaterial.ElementAt(index).RawMaterialWeight;
break;
case 10:
PlcWrite.Bareel2Bin10SetWeight = recipe.RawMaterial.ElementAt(index).RawMaterialWeight;
break;
case 11:
PlcWrite.Bareel2Bin11SetWeight = recipe.RawMaterial.ElementAt(index).RawMaterialWeight;
break;
case 12:
PlcWrite.Bareel2Bin12SetWeight = recipe.RawMaterial.ElementAt(index).RawMaterialWeight;
break;
case 13:
PlcWrite.Bareel2Bin13SetWeight = recipe.RawMaterial.ElementAt(index).RawMaterialWeight;
break;
case 14:
PlcWrite.Bareel2Bin14SetWeight = recipe.RawMaterial.ElementAt(index).RawMaterialWeight;
break;
default:
break;
}

break;
case 4:
switch (loc)
{
case 1:
PlcWrite.Bareel4Bin1SetWeight = recipe.RawMaterial.ElementAt(index).RawMaterialWeight;
break;
case 2:
PlcWrite.Bareel4Bin2SetWeight = recipe.RawMaterial.ElementAt(index).RawMaterialWeight;
break;
case 3:
PlcWrite.Bareel4Bin3SetWeight = recipe.RawMaterial.ElementAt(index).RawMaterialWeight;
break;
case 4:
PlcWrite.Bareel4Bin4SetWeight = recipe.RawMaterial.ElementAt(index).RawMaterialWeight;
break;
case 5:
PlcWrite.Bareel4Bin5SetWeight = recipe.RawMaterial.ElementAt(index).RawMaterialWeight;
break;
case 6:
PlcWrite.Bareel4Bin6SetWeight = recipe.RawMaterial.ElementAt(index).RawMaterialWeight;
break;
case 7:
PlcWrite.Bareel4Bin7SetWeight = recipe.RawMaterial.ElementAt(index).RawMaterialWeight;
break;
case 8:
PlcWrite.Bareel4Bin8SetWeight = recipe.RawMaterial.ElementAt(index).RawMaterialWeight;
break;
case 9:
PlcWrite.Bareel4Bin9SetWeight = recipe.RawMaterial.ElementAt(index).RawMaterialWeight;
break;
case 10:
PlcWrite.Bareel4Bin10SetWeight = recipe.RawMaterial.ElementAt(index).RawMaterialWeight;
break;
case 11:
PlcWrite.Bareel4Bin11SetWeight = recipe.RawMaterial.ElementAt(index).RawMaterialWeight;
break;
case 12:
PlcWrite.Bareel4Bin12SetWeight = recipe.RawMaterial.ElementAt(index).RawMaterialWeight;
break;
case 13:
PlcWrite.Bareel4Bin13SetWeight = recipe.RawMaterial.ElementAt(index).RawMaterialWeight;
break;
case 14:
PlcWrite.Bareel4Bin14SetWeight = recipe.RawMaterial.ElementAt(index).RawMaterialWeight;
break;
default:
break;
}

break;
case 5:
switch (loc)
{
case 1:
PlcWrite.Bareel5Bin1SetWeight = recipe.RawMaterial.ElementAt(index).RawMaterialWeight;
break;
case 2:
PlcWrite.Bareel5Bin2SetWeight = recipe.RawMaterial.ElementAt(index).RawMaterialWeight;
break;
case 3:
PlcWrite.Bareel5Bin3SetWeight = recipe.RawMaterial.ElementAt(index).RawMaterialWeight;
break;
case 4:
PlcWrite.Bareel5Bin4SetWeight = recipe.RawMaterial.ElementAt(index).RawMaterialWeight;
break;
case 5:
PlcWrite.Bareel5Bin5SetWeight = recipe.RawMaterial.ElementAt(index).RawMaterialWeight;
break;
case 6:
PlcWrite.Bareel5Bin6SetWeight = recipe.RawMaterial.ElementAt(index).RawMaterialWeight;
break;
case 7:
PlcWrite.Bareel5Bin7SetWeight = recipe.RawMaterial.ElementAt(index).RawMaterialWeight;
break;
case 8:
PlcWrite.Bareel5Bin8SetWeight = recipe.RawMaterial.ElementAt(index).RawMaterialWeight;
break;
case 9:
PlcWrite.Bareel5Bin9SetWeight = recipe.RawMaterial.ElementAt(index).RawMaterialWeight;
break;
case 10:
PlcWrite.Bareel5Bin10SetWeight = recipe.RawMaterial.ElementAt(index).RawMaterialWeight;
break;
case 11:
PlcWrite.Bareel5Bin11SetWeight = recipe.RawMaterial.ElementAt(index).RawMaterialWeight;
break;
case 12:
PlcWrite.Bareel5Bin12SetWeight = recipe.RawMaterial.ElementAt(index).RawMaterialWeight;
break;
case 13:
PlcWrite.Bareel5Bin13SetWeight = recipe.RawMaterial.ElementAt(index).RawMaterialWeight;
break;
case 14:
PlcWrite.Bareel5Bin14SetWeight = recipe.RawMaterial.ElementAt(index).RawMaterialWeight;
break;
default:
break;
}

break;
default:
break;
}
}
}
}


+ 41
- 0
BPASmartClient.JXJFoodBigStation/Model/HK_PLC/StockBinName.cs Целия файл

@@ -0,0 +1,41 @@
using BPASmartClient.S7Net;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace BPASmartClient.JXJFoodBigStation.Model.HK_PLC
{
public class StockBinName
{
[Siemens(6)]
public string RawMaterialName1 { get; set; }
[Siemens(6)]
public string RawMaterialName2 { get; set; }
[Siemens(6)]
public string RawMaterialName3 { get; set; }
[Siemens(6)]
public string RawMaterialName4 { get; set; }
[Siemens(6)]
public string RawMaterialName5 { get; set; }
[Siemens(6)]
public string RawMaterialName6 { get; set; }
[Siemens(6)]
public string RawMaterialName7 { get; set; }
[Siemens(6)]
public string RawMaterialName8 { get; set; }
[Siemens(6)]
public string RawMaterialName9 { get; set; }
[Siemens(6)]
public string RawMaterialName10 { get; set; }
[Siemens(6)]
public string RawMaterialName11 { get; set; }
[Siemens(6)]
public string RawMaterialName12 { get; set; }
[Siemens(6)]
public string RawMaterialName13 { get; set; }
[Siemens(6)]
public string RawMaterialName14 { get; set; }
}
}

+ 607
- 255
BPASmartClient.JXJFoodBigStation/Model/ProcessControl.cs Целия файл

@@ -25,6 +25,7 @@ namespace BPASmartClient.JXJFoodBigStation.Model
public SiemensDeviceStatus SiemensDevice = new SiemensDeviceStatus();
public HKDeviceStatus HKDevice = new HKDeviceStatus();
GVL_BigStation BigStation = new GVL_BigStation();
DL_Finish_DB FinishData = new DL_Finish_DB();

/// <summary>
/// 配方数据
@@ -41,11 +42,11 @@ namespace BPASmartClient.JXJFoodBigStation.Model
/// <summary>
/// 配方队列
/// </summary>
public ConcurrentQueue<string> RecipeQueue = new ConcurrentQueue<string>();
/// <summary>
/// AGV到达工站队列
/// </summary>
public ConcurrentQueue<string> AGVToWorkStationQueue = new ConcurrentQueue<string>();
public ConcurrentQueue<string> RecipeQueue1 = new ConcurrentQueue<string>();
public ConcurrentQueue<string> RecipeQueue2 = new ConcurrentQueue<string>();
public ConcurrentQueue<string> RecipeQueue3 = new ConcurrentQueue<string>();
public ConcurrentQueue<string> RecipeQueue4 = new ConcurrentQueue<string>();
public ConcurrentQueue<string> RecipeQueue5 = new ConcurrentQueue<string>();
/// <summary>
/// 接收原料数据
/// </summary>
@@ -70,7 +71,7 @@ namespace BPASmartClient.JXJFoodBigStation.Model
RawMaterialBarrelNum = recipe.Material[i].Material_BarrelNum,
RawMaterialWeight = recipe.Material[i].Material_Weight,
RawMaterialLocation = (int)RawMaterialsNamePos[recipe.Material[i].Material_Name]
});
});
}
else
{
@@ -82,7 +83,7 @@ namespace BPASmartClient.JXJFoodBigStation.Model
RecipeName = recipe.RecipeName,
RecipeCode = recipe.RecipeCode,
RawMaterial = RawMaterials,
TrayCode = recipe.TrayCode
//TrayCode = recipe.Order_No,
});
}
}
@@ -96,6 +97,7 @@ namespace BPASmartClient.JXJFoodBigStation.Model
if (HKDevice.IsConnected)
{
HKDevice.Init();
MessageNotify.GetInstance.ShowRunLog("海科plc连接成功");
}
if (SiemensDevice.IsConnected)
{
@@ -106,131 +108,30 @@ namespace BPASmartClient.JXJFoodBigStation.Model
{

}
RecipeQueue.Clear();
//Json<RemoteRecipeDataColl>.Data.Recipes = TestData.GetInstance.Recipes;//添加测试数据
ActionManage.GetInstance.CancelRegister("ManualSendRecipe");
ActionManage.GetInstance.Register(new Action<Object>((o) =>
{
if (o !=null && o is RecipeData a)
{
Json<LocalRecipeDataColl>.Data.Recipes.Add(a);
for (int i = 0; i < Json<LocalRecipeDataColl>.Data.Recipes.Count; i++)
{
foreach (var item in Json<LocalRecipeDataColl>.Data.Recipes.ElementAt(i).RawMaterial)
{
item.RawMaterialLocation = Convert.ToInt32(item.RawMaterialName);
}
}
MessageNotify.GetInstance.ShowAlarmLog("海科plc连接失败");
}
}), "ManualSendRecipe", true);
RecipeQueue1.Clear();
ThreadManage.GetInstance().StartLong(new Action(() =>
{
ReadPLCDeviceInfo();
ReceviceData();
RecipeInfoToHKPLC();
Thread.Sleep(10);
}), "流程处理", true);
ThreadManage.GetInstance().StartLong(new Action(() =>
{
if (HKDevice.IsConnected && SiemensDevice.IsConnected)
{
AgvGetInOut();
}
Thread.Sleep(10);
}), "AGV进站送取货", true);
ThreadManage.GetInstance().StartLong(new Action(() =>
{
ReadSiemensCommData();
ReadHKPLCCommData();
Thread.Sleep(10);
}), "读取西门子和海科PLC的数据", true);
}
/// <summary>
/// AGV送货
/// </summary>
/// <param name="bitNum"></param>
private void AGV_Delivery(int bitNum)
{
if ((ReadSiemens("M4002." + bitNum) is bool) && BigStation.AgvDeliveryPosition == 0)
{
BigStation.AgvDeliveryPosition = 1;
WriteHKPLC("M4002." + bitNum, true);
WriteSiemens("M4002." + bitNum, false);
}
else if (ReadHK("M5002." + bitNum) is bool && BigStation.AgvDeliveryPosition == 1)
{
BigStation.AgvDeliveryPosition = 2;
WriteSiemens("M5002." + bitNum, true);
WriteHKPLC("M5002." + bitNum, false);
}
else if (ReadSiemens("M4004." + bitNum) is bool && BigStation.AgvDeliveryPosition == 2)
{
BigStation.AgvDeliveryPosition = 3;
WriteHKPLC("M4004." + bitNum, true);
WriteSiemens("M4004." + bitNum, false);
}
else if (ReadHK("M5004." + bitNum) is bool && BigStation.AgvDeliveryPosition == 3)
{
BigStation.AgvDeliveryPosition = 4;
WriteSiemens("M5004." + bitNum, true);
WriteHKPLC("M5004." + bitNum, false);
}
else if (ReadSiemens("M4005." + bitNum) is bool && BigStation.AgvDeliveryPosition == 4)
{
BigStation.AgvDeliveryPosition = 5;
WriteHKPLC("M4005." + bitNum, true);
WriteSiemens("M4005." + bitNum, false);
}
else if (ReadHK("M5005." + bitNum) is bool && BigStation.AgvDeliveryPosition == 5)
{
WriteSiemens("M5005." + bitNum, true);
WriteHKPLC("M5005." + bitNum, false);
}
}
/// <summary>
/// AGV取货
/// </summary>
/// <param name="bitNum"></param>
private void AGV_Pick(int bitNum)
{
if (ReadSiemens("M4003" + bitNum) is bool && BigStation.AgvPickUpPosition == 0)
{
BigStation.AgvPickUpPosition = 1;
WriteHKPLC("M4003." + bitNum, true);
WriteSiemens("M4003." + bitNum, false);
}
if (ReadHK("M5003" + bitNum) is bool && BigStation.AgvPickUpPosition == 1)
{
BigStation.AgvPickUpPosition = 2;
WriteSiemens("M5003" + bitNum, true);
WriteHKPLC("M5003" + bitNum, false);
}
if (ReadSiemens("M4006." + bitNum) is bool && BigStation.AgvPickUpPosition == 2)
{
BigStation.AgvPickUpPosition = 3;
WriteHKPLC("M4006." + bitNum, true);
WriteSiemens("M4006." + bitNum, false);
}
if (ReadHK("M5006." + bitNum) is bool && BigStation.AgvPickUpPosition == 3)
{
WriteSiemens("M5006." + bitNum, true);
WriteHKPLC("M5006." + bitNum, false);
}
}
/// <summary>
/// AGV进站送货
/// </summary>
private void AgvGetInOut()
{
//获取工位上是否有小车
SiemensDevice.Siemens_PLC_S7.Write<bool>(SiemensCommAddress.StationIsExistCar, (bool)
HKDevice.HK_PLC_S7.Read<bool>("M4007.0"));
//检测AGV到站信号
if (AGVToWorkStationQueue.Count > 0)
{
int index = Array.FindIndex(RemoteRecipes.ToArray(), p => p.RecipeCode == AGVToWorkStationQueue.ElementAt(0));
int TrayLocation = RemoteRecipes.ElementAt(index).TrayCode;//根据配方编号,找到托盘的ID 托盘ID1-6
string RecipeCode = (string)RemoteRecipes.ElementAt(index).RecipeCode;
if (TrayLocation > 0 && TrayLocation < 7)
{
AGV_Delivery(TrayLocation - 1);
if (BigStation.AgvDeliveryPosition == 5)
{
BigStation.AgvDeliveryPosition = 0;
}
AGV_Pick(TrayLocation - 1);
if (BigStation.AgvPickUpPosition == 3)
{
BigStation.AgvPickUpPosition = 0;
AGVToWorkStationQueue.TryDequeue(out RecipeCode);
}
}
}
}
private void ReceviceData()
{
@@ -246,208 +147,659 @@ namespace BPASmartClient.JXJFoodBigStation.Model
{
foreach (var data in RemoteRecipes)
{
if (!(RecipeQueue.Contains(data.RecipeCode)))
RecipeQueue.Enqueue(data.RecipeCode);
if (data.TrayCode == 1)
{
if (!(RecipeQueue1.Contains(data.RecipeCode)))
RecipeQueue1.Enqueue(data.RecipeCode);
}
else if (data.TrayCode == 2)
{
if (!(RecipeQueue2.Contains(data.RecipeCode)))
RecipeQueue2.Enqueue(data.RecipeCode);
}
else if (data.TrayCode == 3)
{
if (!(RecipeQueue3.Contains(data.RecipeCode)))
RecipeQueue3.Enqueue(data.RecipeCode);
}
else if (data.TrayCode == 4)
{
if (!(RecipeQueue4.Contains(data.RecipeCode)))
RecipeQueue4.Enqueue(data.RecipeCode);
}
else if (data.TrayCode == 5)
{
if (!(RecipeQueue5.Contains(data.RecipeCode)))
RecipeQueue5.Enqueue(data.RecipeCode);
}
}
}
else
{
RecipeQueue.Clear();
BigStation.RecipeDosingStatus = 0;
RecipeQueue1.Clear();
RecipeQueue2.Clear();
RecipeQueue3.Clear();
RecipeQueue4.Clear();
RecipeQueue5.Clear();
BigStation.Recipe1DosingStatus = 0;
BigStation.Recipe2DosingStatus = 0;
BigStation.Recipe3DosingStatus = 0;
BigStation.Recipe4DosingStatus = 0;
BigStation.Recipe5DosingStatus = 0;
}
}
private void RecipeInfoToHKPLC()
{
if (RecipeQueue.Count > 0)
if (RecipeQueue1.Count > 0)
{
int index = Array.FindIndex(RemoteRecipes.ToArray(), p => p.RecipeCode == RecipeQueue.ElementAt(0));
int index = Array.FindIndex(RemoteRecipes.ToArray(), p => p.RecipeCode == RecipeQueue1.ElementAt(0));
if (index >= 0 && index < RemoteRecipes.Count)
{
string code = RemoteRecipes.ElementAt(index).RecipeCode;
int trayCode = RemoteRecipes.ElementAt(index).TrayCode;
if (RTrig.GetInstance("M5001.0").Start(HKDevice.HK_PLC_S7.Read<bool>("M5001.0")) && BigStation.RecipeDosingStatus == 0)//配方1是否允许下发配发
if (HKDevice.PlcRead.IsAllowIssueRecipe1 && BigStation.Recipe1DosingStatus == 0)//配方1是否允许下发配发
{
HKDevice.StockBinPar(RemoteRecipes.ElementAt(index));
HKDevice.HK_PLC_S7.Write<bool>("M4001.0", true);//配发下发完成,to plc
HKDevice.HK_PLC_S7.Write<bool>("M5001.0", false);//复位允许下发配方1信号
BigStation.RecipeDosingStatus = 1;
MessageLog.GetInstance.ShowRunLog($"配方状态:{code}下发完成");
HKDevice.PlcWrite.Recipe1IssuedFinish = true;
BigStation.Recipe1DosingStatus = 1;
MessageNotify.GetInstance.ShowRunLog($"配方编号:{code},托盘编号:{trayCode},下发完成");
}
if (HKDevice.HK_PLC_S7.Read<bool>("M5001.4") && BigStation.RecipeDosingStatus == 1)
if (HKDevice.PlcRead.ReceiveFinishRecipe1 && BigStation.Recipe1DosingStatus == 1)
{
BigStation.RecipeDosingStatus = 2;
HKDevice.HK_PLC_S7.Write<bool>("M5001.4", false);//
MessageLog.GetInstance.ShowRunLog($"配方状态:{code}配方配料");
BigStation.Recipe1DosingStatus = 2;
HKDevice.PlcWrite.Recipe1IssuedFinish = false;
StockBinParReset();
MessageNotify.GetInstance.ShowRunLog($"配方编号:{code},托盘编号:{trayCode},PLC接收配方完成");
}
if (BigStation.RecipeDosingStatus == 2)
if (BigStation.Recipe1DosingStatus == 2 && HKDevice.PlcRead.Recipe1DosingFinish)
{
for (int i = 0; i < 12; i++)
BigStation.Recipe1DosingStatus = 3;
MessageNotify.GetInstance.ShowRunLog($"配方状态:{code}配料完成");
if (HKDevice.PlcRead.Recipe1TrayCode == 1)
{
if (i >= 0 && i < 8)
foreach (var item in RemoteRecipes.ElementAt(index).RawMaterial)
{
if (HKDevice.HK_PLC_S7.Read<bool>("M5008." + (i)))//根据配料完成信号,
if (item.RawMaterialLocation == 1)
{
int a = Array.FindIndex(RemoteRecipes.ElementAt(index).RawMaterial.ToArray(), p => p.RawMaterialLocation == (i+1));
if (a >= 0)
{
int barrelNum = RemoteRecipes.ElementAt(index).RawMaterial.ElementAt(a).RawMaterialBarrelNum;
string address = "MD" + 5060 + i * 4 + (barrelNum - 1) * 48;
RemoteRecipes.ElementAt(index).RawMaterial.ElementAt(a).Laying_Off_Weight = HKDevice.HK_PLC_S7.Read<float>(address);//料仓配料完成后的出料重量
}
item.Laying_Off_Weight = HKDevice.PlcRead.StockBin1ActualWeight;
}
}
else
{
if (HKDevice.HK_PLC_S7.Read<bool>("M5009." + (i - 8)))
else if (item.RawMaterialLocation == 2)
{
item.Laying_Off_Weight = HKDevice.PlcRead.StockBin2ActualWeight;
}
else if (item.RawMaterialLocation == 3)
{
item.Laying_Off_Weight = HKDevice.PlcRead.StockBin3ActualWeight;
}
else if (item.RawMaterialLocation == 4)
{
item.Laying_Off_Weight = HKDevice.PlcRead.StockBin4ActualWeight;
}
else if (item.RawMaterialLocation == 5)
{
item.Laying_Off_Weight = HKDevice.PlcRead.StockBin5ActualWeight;
}
else if (item.RawMaterialLocation == 6)
{
item.Laying_Off_Weight = HKDevice.PlcRead.StockBin6ActualWeight;
}
else if (item.RawMaterialLocation == 7)
{
item.Laying_Off_Weight = HKDevice.PlcRead.StockBin7ActualWeight;
}
else if (item.RawMaterialLocation == 8)
{
item.Laying_Off_Weight = HKDevice.PlcRead.StockBin8ActualWeight;
}
else if (item.RawMaterialLocation == 9)
{
item.Laying_Off_Weight = HKDevice.PlcRead.StockBin9ActualWeight;
}
else if (item.RawMaterialLocation == 10)
{
item.Laying_Off_Weight = HKDevice.PlcRead.StockBin10ActualWeight;
}
else if (item.RawMaterialLocation == 11)
{
item.Laying_Off_Weight = HKDevice.PlcRead.StockBin11ActualWeight;
}
else if (item.RawMaterialLocation == 12)
{
item.Laying_Off_Weight = HKDevice.PlcRead.StockBin12ActualWeight;
}
else if (item.RawMaterialLocation == 13)
{
item.Laying_Off_Weight = HKDevice.PlcRead.StockBin13ActualWeight;
}
else if (item.RawMaterialLocation == 14)
{
int a = Array.FindIndex(RemoteRecipes.ElementAt(index).RawMaterial.ToArray(), p => p.RawMaterialLocation == i);
if (a >= 0)
{
int barrelNum = RemoteRecipes.ElementAt(index).RawMaterial.ElementAt(a).RawMaterialBarrelNum;
string address = "MD" + 5060 + i * 4 + (barrelNum - 1) * 48;
RemoteRecipes.ElementAt(index).RawMaterial.ElementAt(a).Laying_Off_Weight = HKDevice.HK_PLC_S7.Read<float>(address);
}
item.Laying_Off_Weight = HKDevice.PlcRead.StockBin14ActualWeight;
}
}
FinishData.Order_No = RemoteRecipes.ElementAt(index).RecipeCode;
FinishData.Product_Code = RemoteRecipes.ElementAt(index).RecipeName;
for (int i = 0; i < RemoteRecipes.ElementAt(index).RawMaterial.Count; i++)
{
FinishData.Material[i] = new UDT1();
FinishData.Material[i].Material_Name = RemoteRecipes.ElementAt(index).RawMaterial.ElementAt(i).RawMaterialName;
FinishData.Material[i].Material_BarrelNum = (short)RemoteRecipes.ElementAt(index).RawMaterial.ElementAt(i).RawMaterialBarrelNum;
FinishData.Material[i].Material_Laying_Off_Weight = RemoteRecipes.ElementAt(index).RawMaterial.ElementAt(i).Laying_Off_Weight;
}
}
if (RTrig.GetInstance("StockState").Start(HKDevice.HK_PLC_S7.Read<bool>("M5007.0")))
if (SiemensDevice.IsConnected)
{
SiemensDevice.Siemens_PLC_S7.WriteClass<DL_Finish_DB>(FinishData, 3);
}
RecipeQueue1.TryDequeue(out code);
IssuedComplete.Add(RemoteRecipes.ElementAt(index));//将该配方添加到下
if (!BigStation.IsAllowManual)
{
Json<RemoteRecipe>.Data.Recipes.RemoveAt(index);//制作完成,移除当前配方
}
else
{
Json<LocalRecipeDataColl>.Data.Recipes.RemoveAt(index);//制作完成,移除当前配方
}
BigStation.Recipe1DosingStatus = 0;
}
}
}
if (RecipeQueue2.Count > 0)
{
int index = Array.FindIndex(RemoteRecipes.ToArray(), p => p.RecipeCode == RecipeQueue2.ElementAt(0));
if (index >= 0 && index < RemoteRecipes.Count)
{
string code = RemoteRecipes.ElementAt(index).RecipeCode;
int trayCode = RemoteRecipes.ElementAt(index).TrayCode;
if (HKDevice.PlcRead.IsAllowIssueRecipe2 && BigStation.Recipe2DosingStatus == 0)//配方1是否允许下发配发
{
HKDevice.StockBinPar(RemoteRecipes.ElementAt(index));
HKDevice.PlcWrite.Recipe2IssuedFinish = true;
BigStation.Recipe2DosingStatus = 1;
MessageNotify.GetInstance.ShowRunLog($"配方状态:{code}下发完成");
}
if (HKDevice.PlcRead.ReceiveFinishRecipe2 && BigStation.Recipe2DosingStatus == 1)
{
BigStation.Recipe2DosingStatus = 2;
HKDevice.PlcWrite.Recipe2IssuedFinish = false;
StockBinParReset();
MessageNotify.GetInstance.ShowRunLog($"配方状态:{code}配方配料");
}
if (BigStation.Recipe2DosingStatus == 2 && HKDevice.PlcRead.Recipe2DosingFinish)
{
BigStation.Recipe2DosingStatus = 3;
MessageNotify.GetInstance.ShowRunLog($"配方状态:{code}配料完成");
if (HKDevice.PlcRead.Recipe2TrayCode > 0)
{
BigStation.RecipeDosingStatus = 3;
MessageLog.GetInstance.ShowRunLog($"配方状态:{code}配料完成");
HKDevice.HK_PLC_S7.Write<bool>("M5007.0",false);
RecipeQueue.TryDequeue(out code);
IssuedComplete.Add(RemoteRecipes.ElementAt(index));//将该配方添加到下
if (!BigStation.IsAllowManual)
foreach (var item in RemoteRecipes.ElementAt(index).RawMaterial)
{
Json<RemoteRecipe>.Data.Recipes.RemoveAt(index);//制作完成,移除当前配方
if (item.RawMaterialLocation == 1)
{
item.Laying_Off_Weight = HKDevice.PlcRead.StockBin1ActualWeight;
}
else if (item.RawMaterialLocation == 2)
{
item.Laying_Off_Weight = HKDevice.PlcRead.StockBin2ActualWeight;
}
else if (item.RawMaterialLocation == 3)
{
item.Laying_Off_Weight = HKDevice.PlcRead.StockBin3ActualWeight;
}
else if (item.RawMaterialLocation == 4)
{
item.Laying_Off_Weight = HKDevice.PlcRead.StockBin4ActualWeight;
}
else if (item.RawMaterialLocation == 5)
{
item.Laying_Off_Weight = HKDevice.PlcRead.StockBin5ActualWeight;
}
else if (item.RawMaterialLocation == 6)
{
item.Laying_Off_Weight = HKDevice.PlcRead.StockBin6ActualWeight;
}
else if (item.RawMaterialLocation == 7)
{
item.Laying_Off_Weight = HKDevice.PlcRead.StockBin7ActualWeight;
}
else if (item.RawMaterialLocation == 8)
{
item.Laying_Off_Weight = HKDevice.PlcRead.StockBin8ActualWeight;
}
else if (item.RawMaterialLocation == 9)
{
item.Laying_Off_Weight = HKDevice.PlcRead.StockBin9ActualWeight;
}
else if (item.RawMaterialLocation == 10)
{
item.Laying_Off_Weight = HKDevice.PlcRead.StockBin10ActualWeight;
}
else if (item.RawMaterialLocation == 11)
{
item.Laying_Off_Weight = HKDevice.PlcRead.StockBin11ActualWeight;
}
else if (item.RawMaterialLocation == 12)
{
item.Laying_Off_Weight = HKDevice.PlcRead.StockBin12ActualWeight;
}
else if (item.RawMaterialLocation == 13)
{
item.Laying_Off_Weight = HKDevice.PlcRead.StockBin13ActualWeight;
}
else if (item.RawMaterialLocation == 14)
{
item.Laying_Off_Weight = HKDevice.PlcRead.StockBin14ActualWeight;
}
}
else
FinishData.Order_No = RemoteRecipes.ElementAt(index).RecipeCode;
FinishData.Product_Code = RemoteRecipes.ElementAt(index).RecipeName;
for (int i = 0; i < RemoteRecipes.ElementAt(index).RawMaterial.Count; i++)
{
Json<LocalRecipeDataColl>.Data.Recipes.RemoveAt(index);//制作完成,移除当前配方
FinishData.Material[i] = new UDT1();
FinishData.Material[i].Material_Name = RemoteRecipes.ElementAt(index).RawMaterial.ElementAt(i).RawMaterialName;
FinishData.Material[i].Material_BarrelNum = (short)RemoteRecipes.ElementAt(index).RawMaterial.ElementAt(i).RawMaterialBarrelNum;
FinishData.Material[i].Material_Laying_Off_Weight = RemoteRecipes.ElementAt(index).RawMaterial.ElementAt(i).Laying_Off_Weight;
}
BigStation.RecipeDosingStatus = 0;
}
if (SiemensDevice.IsConnected)
{
SiemensDevice.Siemens_PLC_S7.WriteClass<DL_Finish_DB>(FinishData, 3);
MessageNotify.GetInstance.ShowRunLog($"配方配料完成,将信号反馈给西门子");
}
RecipeQueue2.TryDequeue(out code);
IssuedComplete.Add(RemoteRecipes.ElementAt(index));//将该配方添加到下
if (!BigStation.IsAllowManual)
{
Json<RemoteRecipe>.Data.Recipes.RemoveAt(index);//制作完成,移除当前配方
}
else
{
Json<LocalRecipeDataColl>.Data.Recipes.RemoveAt(index);//制作完成,移除当前配方
}
BigStation.Recipe2DosingStatus = 0;
}
}
}
}
public ConcurrentDictionary<string, Object> ReadHKPLCData = new ConcurrentDictionary<string, object>();
public ConcurrentDictionary<string, Object> ReadSiemensData = new ConcurrentDictionary<string, object>();


private void ReadSiemensCommData()
{
if (SiemensDevice.IsConnected)
if (RecipeQueue3.Count > 0)
{
GetSiemensStatus("", new Action<object>((obj) =>
int index = Array.FindIndex(RemoteRecipes.ToArray(), p => p.RecipeCode == RecipeQueue3.ElementAt(0));
if (index >= 0 && index < RemoteRecipes.Count)
{
if (obj is bool[] bools && bools.Length > 0)
string code = RemoteRecipes.ElementAt(index).RecipeCode;
int trayCode = RemoteRecipes.ElementAt(index).TrayCode;
if (HKDevice.PlcRead.IsAllowIssueRecipe3 && BigStation.Recipe3DosingStatus == 0)//配方1是否允许下发配发
{
HKDevice.StockBinPar(RemoteRecipes.ElementAt(index));
HKDevice.PlcWrite.Recipe3IssuedFinish = true;
BigStation.Recipe3DosingStatus = 1;
MessageNotify.GetInstance.ShowRunLog($"配方状态:{code}下发完成");
}
if (HKDevice.PlcRead.ReceiveFinishRecipe3 && BigStation.Recipe3DosingStatus == 1)
{
BigStation.Recipe3DosingStatus = 2;
StockBinParReset();
MessageNotify.GetInstance.ShowRunLog($"配方状态:{code}配方配料");
}
if (HKDevice.PlcRead.Recipe3DosingFinish && BigStation.Recipe3DosingStatus == 2)
{
BigStation.Recipe3DosingStatus = 3;
MessageNotify.GetInstance.ShowRunLog($"配方状态:{code}配料完成");
if (HKDevice.PlcRead.Recipe3TrayCode > 0)
{
foreach (var item in RemoteRecipes.ElementAt(index).RawMaterial)
{
if (item.RawMaterialLocation == 1)
{
item.Laying_Off_Weight = HKDevice.PlcRead.StockBin1ActualWeight;
}
else if (item.RawMaterialLocation == 2)
{
item.Laying_Off_Weight = HKDevice.PlcRead.StockBin2ActualWeight;
}
else if (item.RawMaterialLocation == 3)
{
item.Laying_Off_Weight = HKDevice.PlcRead.StockBin3ActualWeight;
}
else if (item.RawMaterialLocation == 4)
{
item.Laying_Off_Weight = HKDevice.PlcRead.StockBin4ActualWeight;
}
else if (item.RawMaterialLocation == 5)
{
item.Laying_Off_Weight = HKDevice.PlcRead.StockBin5ActualWeight;
}
else if (item.RawMaterialLocation == 6)
{
item.Laying_Off_Weight = HKDevice.PlcRead.StockBin6ActualWeight;
}
else if (item.RawMaterialLocation == 7)
{
item.Laying_Off_Weight = HKDevice.PlcRead.StockBin7ActualWeight;
}
else if (item.RawMaterialLocation == 8)
{
item.Laying_Off_Weight = HKDevice.PlcRead.StockBin8ActualWeight;
}
else if (item.RawMaterialLocation == 9)
{
item.Laying_Off_Weight = HKDevice.PlcRead.StockBin9ActualWeight;
}
else if (item.RawMaterialLocation == 10)
{
item.Laying_Off_Weight = HKDevice.PlcRead.StockBin10ActualWeight;
}
else if (item.RawMaterialLocation == 11)
{
item.Laying_Off_Weight = HKDevice.PlcRead.StockBin11ActualWeight;
}
else if (item.RawMaterialLocation == 12)
{
item.Laying_Off_Weight = HKDevice.PlcRead.StockBin12ActualWeight;
}
else if (item.RawMaterialLocation == 13)
{
item.Laying_Off_Weight = HKDevice.PlcRead.StockBin13ActualWeight;
}
else if (item.RawMaterialLocation == 14)
{
item.Laying_Off_Weight = HKDevice.PlcRead.StockBin14ActualWeight;
}
}

FinishData.Order_No = RemoteRecipes.ElementAt(index).RecipeCode;
FinishData.Product_Code = RemoteRecipes.ElementAt(index).RecipeName;
for (int i = 0; i < RemoteRecipes.ElementAt(index).RawMaterial.Count; i++)
{
FinishData.Material[i] = new UDT1();
FinishData.Material[i].Material_Name = RemoteRecipes.ElementAt(index).RawMaterial.ElementAt(i).RawMaterialName;
FinishData.Material[i].Material_BarrelNum = (short)RemoteRecipes.ElementAt(index).RawMaterial.ElementAt(i).RawMaterialBarrelNum;
FinishData.Material[i].Material_Laying_Off_Weight = RemoteRecipes.ElementAt(index).RawMaterial.ElementAt(i).Laying_Off_Weight;
}

}
if (SiemensDevice.IsConnected)
{
SiemensDevice.Siemens_PLC_S7.WriteClass<DL_Finish_DB>(FinishData, 3);
}
HKDevice.HK_PLC_S7.Write<bool>("DB98.DBX1.1", false);
RecipeQueue3.TryDequeue(out code);
IssuedComplete.Add(RemoteRecipes.ElementAt(index));//将该配方添加到下
if (!BigStation.IsAllowManual)
{
Json<RemoteRecipe>.Data.Recipes.RemoveAt(index);//制作完成,移除当前配方
}
else
{
Json<LocalRecipeDataColl>.Data.Recipes.RemoveAt(index);//制作完成,移除当前配方
}
BigStation.Recipe3DosingStatus = 0;
}
}));
}
}
}
private void ReadHKPLCCommData()
{
if (HKDevice.IsConnected)
if (RecipeQueue4.Count > 0)
{
GetHKStatus("", new Action<object>((obj) =>
int index = Array.FindIndex(RemoteRecipes.ToArray(), p => p.RecipeCode == RecipeQueue4.ElementAt(0));
if (index >= 0 && index < RemoteRecipes.Count)
{
if (obj is bool[] bools && bools.Length > 0)
string code = RemoteRecipes.ElementAt(index).RecipeCode;
int trayCode = RemoteRecipes.ElementAt(index).TrayCode;
if (HKDevice.PlcRead.IsAllowIssueRecipe4 && BigStation.Recipe4DosingStatus == 0)//配方1是否允许下发配发
{
HKDevice.StockBinPar(RemoteRecipes.ElementAt(index));
HKDevice.PlcWrite.Recipe4IssuedFinish = true;
BigStation.Recipe4DosingStatus = 1;
MessageNotify.GetInstance.ShowRunLog($"配方状态:{code}下发完成");
}
if (HKDevice.PlcRead.ReceiveFinishRecipe4 && BigStation.Recipe4DosingStatus == 1)
{
BigStation.Recipe4DosingStatus = 2;
HKDevice.PlcWrite.Recipe4IssuedFinish = false;
StockBinParReset();
MessageNotify.GetInstance.ShowRunLog($"配方状态:{code}配方配料");
}
if (BigStation.Recipe4DosingStatus == 2 && HKDevice.PlcRead.Recipe4DosingFinish)
{
BigStation.Recipe4DosingStatus = 3;
MessageNotify.GetInstance.ShowRunLog($"配方状态:{code}配料完成");
if (HKDevice.PlcRead.Recipe4TrayCode > 0)
{
foreach (var item in RemoteRecipes.ElementAt(index).RawMaterial)
{
if (item.RawMaterialLocation == 1)
{
item.Laying_Off_Weight = HKDevice.PlcRead.StockBin1ActualWeight;
}
else if (item.RawMaterialLocation == 2)
{
item.Laying_Off_Weight = HKDevice.PlcRead.StockBin2ActualWeight;
}
else if (item.RawMaterialLocation == 3)
{
item.Laying_Off_Weight = HKDevice.PlcRead.StockBin3ActualWeight;
}
else if (item.RawMaterialLocation == 4)
{
item.Laying_Off_Weight = HKDevice.PlcRead.StockBin4ActualWeight;
}
else if (item.RawMaterialLocation == 5)
{
item.Laying_Off_Weight = HKDevice.PlcRead.StockBin5ActualWeight;
}
else if (item.RawMaterialLocation == 6)
{
item.Laying_Off_Weight = HKDevice.PlcRead.StockBin6ActualWeight;
}
else if (item.RawMaterialLocation == 7)
{
item.Laying_Off_Weight = HKDevice.PlcRead.StockBin7ActualWeight;
}
else if (item.RawMaterialLocation == 8)
{
item.Laying_Off_Weight = HKDevice.PlcRead.StockBin8ActualWeight;
}
else if (item.RawMaterialLocation == 9)
{
item.Laying_Off_Weight = HKDevice.PlcRead.StockBin9ActualWeight;
}
else if (item.RawMaterialLocation == 10)
{
item.Laying_Off_Weight = HKDevice.PlcRead.StockBin10ActualWeight;
}
else if (item.RawMaterialLocation == 11)
{
item.Laying_Off_Weight = HKDevice.PlcRead.StockBin11ActualWeight;
}
else if (item.RawMaterialLocation == 12)
{
item.Laying_Off_Weight = HKDevice.PlcRead.StockBin12ActualWeight;
}
else if (item.RawMaterialLocation == 13)
{
item.Laying_Off_Weight = HKDevice.PlcRead.StockBin13ActualWeight;
}
else if (item.RawMaterialLocation == 14)
{
item.Laying_Off_Weight = HKDevice.PlcRead.StockBin14ActualWeight;
}
}

FinishData.Order_No = RemoteRecipes.ElementAt(index).RecipeCode;
FinishData.Product_Code = RemoteRecipes.ElementAt(index).RecipeName;
for (int i = 0; i < RemoteRecipes.ElementAt(index).RawMaterial.Count; i++)
{
FinishData.Material[i] = new UDT1();
FinishData.Material[i].Material_Name = RemoteRecipes.ElementAt(index).RawMaterial.ElementAt(i).RawMaterialName;
FinishData.Material[i].Material_BarrelNum = (short)RemoteRecipes.ElementAt(index).RawMaterial.ElementAt(i).RawMaterialBarrelNum;
FinishData.Material[i].Material_Laying_Off_Weight = RemoteRecipes.ElementAt(index).RawMaterial.ElementAt(i).Laying_Off_Weight;
}

}
if (SiemensDevice.IsConnected)
{
SiemensDevice.Siemens_PLC_S7.WriteClass<DL_Finish_DB>(FinishData, 3);
}
HKDevice.HK_PLC_S7.Write<bool>("DB98.DBX1.3", false);
RecipeQueue4.TryDequeue(out code);
IssuedComplete.Add(RemoteRecipes.ElementAt(index));//将该配方添加到下
if (!BigStation.IsAllowManual)
{
Json<RemoteRecipe>.Data.Recipes.RemoveAt(index);//制作完成,移除当前配方
}
else
{
Json<LocalRecipeDataColl>.Data.Recipes.RemoveAt(index);//制作完成,移除当前配方
}
BigStation.Recipe4DosingStatus = 0;
}
}));
}
}
private void GetHKStatus(string key, Action<object> action)
{
if (ReadHKPLCData.ContainsKey(key))
{
if (ReadHKPLCData[key] != null)
{
action?.Invoke(ReadHKPLCData[key]);
}
}
}
private void GetSiemensStatus(string key, Action<object> action)
/// <summary>
/// 下发配方的数据复位
/// </summary>
private void StockBinParReset()
{

if (ReadSiemensData.ContainsKey(key))
{
if (ReadSiemensData[key] != null)
{
action?.Invoke(ReadSiemensData[key]);
}
}
HKDevice.PlcWrite.RecipeCode = 0;
HKDevice.PlcWrite.TrayCode = 0;

HKDevice.PlcWrite.Bareel1Bin1SetWeight = 0;
HKDevice.PlcWrite.Bareel1Bin2SetWeight = 0;
HKDevice.PlcWrite.Bareel1Bin3SetWeight = 0;
HKDevice.PlcWrite.Bareel1Bin4SetWeight = 0;
HKDevice.PlcWrite.Bareel1Bin5SetWeight = 0;
HKDevice.PlcWrite.Bareel1Bin6SetWeight = 0;
HKDevice.PlcWrite.Bareel1Bin7SetWeight = 0;
HKDevice.PlcWrite.Bareel1Bin8SetWeight = 0;
HKDevice.PlcWrite.Bareel1Bin9SetWeight = 0;
HKDevice.PlcWrite.Bareel1Bin10SetWeight = 0;
HKDevice.PlcWrite.Bareel1Bin11SetWeight = 0;
HKDevice.PlcWrite.Bareel1Bin12SetWeight = 0;
HKDevice.PlcWrite.Bareel1Bin13SetWeight = 0;
HKDevice.PlcWrite.Bareel1Bin14SetWeight = 0;


HKDevice.PlcWrite.Bareel2Bin1SetWeight = 0;
HKDevice.PlcWrite.Bareel2Bin2SetWeight = 0;
HKDevice.PlcWrite.Bareel2Bin3SetWeight = 0;
HKDevice.PlcWrite.Bareel2Bin4SetWeight = 0;
HKDevice.PlcWrite.Bareel2Bin5SetWeight = 0;
HKDevice.PlcWrite.Bareel2Bin6SetWeight = 0;
HKDevice.PlcWrite.Bareel2Bin7SetWeight = 0;
HKDevice.PlcWrite.Bareel2Bin8SetWeight = 0;
HKDevice.PlcWrite.Bareel2Bin9SetWeight = 0;
HKDevice.PlcWrite.Bareel2Bin10SetWeight = 0;
HKDevice.PlcWrite.Bareel2Bin11SetWeight = 0;
HKDevice.PlcWrite.Bareel2Bin12SetWeight = 0;
HKDevice.PlcWrite.Bareel2Bin13SetWeight = 0;
HKDevice.PlcWrite.Bareel2Bin14SetWeight = 0;

HKDevice.PlcWrite.Bareel4Bin1SetWeight = 0;
HKDevice.PlcWrite.Bareel4Bin2SetWeight = 0;
HKDevice.PlcWrite.Bareel4Bin3SetWeight = 0;
HKDevice.PlcWrite.Bareel4Bin4SetWeight = 0;
HKDevice.PlcWrite.Bareel4Bin5SetWeight = 0;
HKDevice.PlcWrite.Bareel4Bin6SetWeight = 0;
HKDevice.PlcWrite.Bareel4Bin7SetWeight = 0;
HKDevice.PlcWrite.Bareel4Bin8SetWeight = 0;
HKDevice.PlcWrite.Bareel4Bin9SetWeight = 0;
HKDevice.PlcWrite.Bareel4Bin10SetWeight = 0;
HKDevice.PlcWrite.Bareel4Bin11SetWeight = 0;
HKDevice.PlcWrite.Bareel4Bin12SetWeight = 0;
HKDevice.PlcWrite.Bareel4Bin13SetWeight = 0;
HKDevice.PlcWrite.Bareel4Bin14SetWeight = 0;

HKDevice.PlcWrite.Bareel5Bin1SetWeight = 0;
HKDevice.PlcWrite.Bareel5Bin2SetWeight = 0;
HKDevice.PlcWrite.Bareel5Bin3SetWeight = 0;
HKDevice.PlcWrite.Bareel5Bin4SetWeight = 0;
HKDevice.PlcWrite.Bareel5Bin5SetWeight = 0;
HKDevice.PlcWrite.Bareel5Bin6SetWeight = 0;
HKDevice.PlcWrite.Bareel5Bin7SetWeight = 0;
HKDevice.PlcWrite.Bareel5Bin8SetWeight = 0;
HKDevice.PlcWrite.Bareel5Bin9SetWeight = 0;
HKDevice.PlcWrite.Bareel5Bin10SetWeight = 0;
HKDevice.PlcWrite.Bareel5Bin11SetWeight = 0;
HKDevice.PlcWrite.Bareel5Bin12SetWeight = 0;
HKDevice.PlcWrite.Bareel5Bin13SetWeight = 0;
HKDevice.PlcWrite.Bareel5Bin14SetWeight = 0;
}
private void WriteSiemens(string Address, object Value)
private void testData()
{
if (SiemensDevice.IsConnected)
RawMaterialsNamePos.Clear();
if (!HKDevice.IsConnected)
{
SiemensDevice.Siemens_PLC_S7.Write<object>(Address, Value);
HKDevice.StockBinName.RawMaterialName1 = "1";
HKDevice.StockBinName.RawMaterialName2 = "2";
HKDevice.StockBinName.RawMaterialName3 = "3";
HKDevice.StockBinName.RawMaterialName4 = "4";
HKDevice.StockBinName.RawMaterialName5 = "5";
HKDevice.StockBinName.RawMaterialName6 = "6";
HKDevice.StockBinName.RawMaterialName7 = "7";
HKDevice.StockBinName.RawMaterialName8 = "8";
HKDevice.StockBinName.RawMaterialName9 = "9";
HKDevice.StockBinName.RawMaterialName10 = "10";
HKDevice.StockBinName.RawMaterialName11 = "11";
HKDevice.StockBinName.RawMaterialName12 = "12";
HKDevice.StockBinName.RawMaterialName13 = "13";
HKDevice.StockBinName.RawMaterialName14 = "14";
}
}
private void WriteHKPLC(string Address, object Value)
{
HKDevice.HK_PLC_S7.Write<object>(Address, Value);
}
private object ReadSiemens(string Address)
{
if (SiemensDevice.IsConnected)
if (!RawMaterialsNamePos.ContainsKey(HKDevice.StockBinName.RawMaterialName1))
{
return SiemensDevice.Siemens_PLC_S7.Read<object>(Address);
RawMaterialsNamePos.Add(HKDevice.StockBinName.RawMaterialName1, 1);
}
else
if (!RawMaterialsNamePos.ContainsKey(HKDevice.StockBinName.RawMaterialName2))
{
return null;
RawMaterialsNamePos.Add(HKDevice.StockBinName.RawMaterialName2, 2);
}
}
private bool[] ReadBoolsSiemens(int address, int count)
{
if (SiemensDevice.IsConnected)
if (!RawMaterialsNamePos.ContainsKey(HKDevice.StockBinName.RawMaterialName3))
{
return SiemensDevice.Siemens_PLC_S7.ReadBools(address, count);
RawMaterialsNamePos.Add(HKDevice.StockBinName.RawMaterialName3, 3);
}
else
if (!RawMaterialsNamePos.ContainsKey(HKDevice.StockBinName.RawMaterialName4))
{
return null;
RawMaterialsNamePos.Add(HKDevice.StockBinName.RawMaterialName4, 4);
}
}
private object ReadHK(string Address)
{
if (HKDevice.IsConnected)
if (!RawMaterialsNamePos.ContainsKey(HKDevice.StockBinName.RawMaterialName5))
{
return HKDevice.HK_PLC_S7.Read<object>(Address);
RawMaterialsNamePos.Add(HKDevice.StockBinName.RawMaterialName5, 5);
}
else
if (!RawMaterialsNamePos.ContainsKey(HKDevice.StockBinName.RawMaterialName6))
{
return null;
RawMaterialsNamePos.Add(HKDevice.StockBinName.RawMaterialName6, 6);
}
}
private bool[] ReadBoolsHK(int address, int count)
{
if (HKDevice.IsConnected)
if (!RawMaterialsNamePos.ContainsKey(HKDevice.StockBinName.RawMaterialName7))
{
return HKDevice.HK_PLC_S7.ReadBools(address, count);
RawMaterialsNamePos.Add(HKDevice.StockBinName.RawMaterialName7, 7);
}
else
if (!RawMaterialsNamePos.ContainsKey(HKDevice.StockBinName.RawMaterialName8))
{
return null;
RawMaterialsNamePos.Add(HKDevice.StockBinName.RawMaterialName8, 8);
}
}
/// <summary>
/// 获取料仓的原料名称和原料位置
/// </summary>
private void ReadPLCDeviceInfo()
{
for (int i = 0; i < 12; i++)
if (!RawMaterialsNamePos.ContainsKey(HKDevice.StockBinName.RawMaterialName9))
{
RawMaterialsNamePos.Add(HKDevice.StockBinName.RawMaterialName9, 9);
}
if (!RawMaterialsNamePos.ContainsKey(HKDevice.StockBinName.RawMaterialName10))
{
RawMaterialsNamePos.Add(HKDevice.StockBinName.RawMaterialName10, 10);
}
if (!RawMaterialsNamePos.ContainsKey(HKDevice.StockBinName.RawMaterialName11))
{
RawMaterialsNamePos.Add(HKDevice.StockBinName.RawMaterialName11, 11);
}
if (!RawMaterialsNamePos.ContainsKey(HKDevice.StockBinName.RawMaterialName12))
{
RawMaterialsNamePos.Add(HKDevice.StockBinName.RawMaterialName12, 12);
}
if (!RawMaterialsNamePos.ContainsKey(HKDevice.StockBinName.RawMaterialName13))
{
RawMaterialsNamePos.Add(HKDevice.StockBinName.RawMaterialName13, 13);
}
if (!RawMaterialsNamePos.ContainsKey(HKDevice.StockBinName.RawMaterialName14))
{
string RawMaterialName = HKDevice.HK_PLC_S7.Read<string>("");
short RawMaterialLocation = HKDevice.HK_PLC_S7.Read<short>("");
if (RawMaterialsNamePos.ContainsKey(RawMaterialName))
RawMaterialsNamePos.Add(RawMaterialName, RawMaterialLocation);
RawMaterialsNamePos.Add(HKDevice.StockBinName.RawMaterialName14, 14);
}
}
}


+ 39
- 0
BPASmartClient.JXJFoodBigStation/Model/Siemens/DL_DataColl_DB.cs Целия файл

@@ -0,0 +1,39 @@
using BPASmartClient.S7Net;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace BPASmartClient.JXJFoodBigStation.Model.Siemens
{
public class DL_DataColl_DB
{
[Siemens(16)]
public string RecipeCode { get; set; }
[Siemens(16)]
public string RecipeName { get; set; }
public bool var1 { get; set; }
public bool var2 { get; set; }

public bool var3 { get; set; }

public bool var4 { get; set; }

public bool var5 { get; set; }

public bool var6 { get; set; }

public bool var7 { get; set; }

public bool var8 { get; set; }

public bool var9 { get; set; }
public short Mode { get; set; }

public bool[] Alarm { get; set; } = new bool[24];
public int Reserved1 { get; set; }
public int Reserved2 { get; set; }

}
}

+ 23
- 12
BPASmartClient.JXJFoodBigStation/Model/Siemens/DL_Finish_DB.cs Целия файл

@@ -1,4 +1,5 @@
using System;
using BPASmartClient.S7Net;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
@@ -8,32 +9,42 @@ namespace BPASmartClient.JXJFoodBigStation.Model.Siemens
{
internal class DL_Finish_DB
{

/// <summary>
/// 配料完成信号确认
/// </summary>
public bool Ask_For_Finish_PLC { get; set; }

public short[] StandbyFinish { get; set; } = new short[4];
[Siemens(16)]
/// <summary>
/// 生产工单编码
/// </summary>
public string Order_No;
public string Order_No{get; set; }
[Siemens(16)]
/// <summary>
/// 产品名称
/// </summary>
public string Product_Code;
public string Product_Code { get; set; }
public short job_No { get; set; }
/// <summary>
/// 原料信息
/// </summary>
public UDT1[] Material = new UDT1[20];
public UDT1[] Material { get; set; } = new UDT1[20];
public short ProcessTime { get; set; }
/// <summary>
/// 配料完成信号
/// </summary>
public bool Ask_For_Finish;
/// <summary>
/// 配料完成信号确认
/// </summary>
public bool Ask_For_Finish_PLC;
public bool Ask_For_Finish { get; set; }

public short[] StandbyFinish1 { get; set; } = new short[4];

}
public class UDT1
{
public string Material_Name;
public float Material_Laying_Off_Weight;
public short Material_BarrelNum;
[Siemens(6)]
public string Material_Name { get; set; }
public float Material_Laying_Off_Weight { get; set; }
public short Material_BarrelNum { get; set; }
}
}

+ 19
- 16
BPASmartClient.JXJFoodBigStation/Model/Siemens/DL_Start_DB.cs Целия файл

@@ -1,4 +1,5 @@
using System;
using BPASmartClient.S7Net;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
@@ -8,44 +9,46 @@ namespace BPASmartClient.JXJFoodBigStation.Model.Siemens
{
internal class DL_Start_DB
{
[Siemens(16)]
/// <summary>
/// 配方编码
/// </summary>
public string RecipeCode;
public string RecipeCode { get; set; }
[Siemens(16)]
/// <summary>
/// 配发名称
/// </summary>
public string RecipeName;
public string RecipeName { get; set; }
public short Order_No { get; set; }
public short Pallet_No { get; set; }
/// <summary>
/// 物料信息
/// </summary>
public UDT[] Material = new UDT[20];
/// <summary>
/// 托盘编号
/// </summary>
public int TrayCode;
public UDT[] Material { get; set; } = new UDT[20];
public bool Order_Type { get; set; }
public bool Order_Request_Ack { get; set; }
public short[] Standby { get; set; } = new short[4];
/// <summary>
/// 配方发送请求
/// </summary>
public bool Ask_For_Send_Bit;
/// <summary>
/// 上位机确认配方接收完成
/// </summary>
public bool Ack_Ask_For_Send_Bit;
public bool Ask_For_Send_Bit { get; set; }
public short[] Standby1 { get; set; } = new short[4];
}
public class UDT
{
[Siemens(6)]
/// <summary>
/// 原料名称
/// </summary>
public string Material_Name;
public string Material_Name { get; set; }
/// <summary>
/// 原料重量
/// </summary>
public float Material_Weight;
public float Material_Weight { get; set; }
/// <summary>
/// 原料桶号
/// </summary>
public short Material_BarrelNum;
public short Material_BarrelNum { get; set; }
}
}

+ 25
- 41
BPASmartClient.JXJFoodBigStation/Model/Siemens/DL_Status_DB.cs Целия файл

@@ -1,4 +1,5 @@
using System;
using BPASmartClient.S7Net;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
@@ -8,53 +9,36 @@ namespace BPASmartClient.JXJFoodBigStation.Model.Siemens
{
internal class DL_Status_DB
{
/// <summary>
/// 生产工单
/// </summary>
public string RecipeCode;
/// <summary>
/// 配料开始
/// </summary>
public bool Dosing_Start;
public bool Dosing_Start { get; set; }
/// <summary>
/// 配料开始确认
/// </summary>
public bool Dosing_Confirm;
/// <summary>
/// 托盘占位情况
/// </summary>
public bool[] Pallet_Position_Occ = new bool[16];
/// <summary>
/// 工位允许放货架
/// </summary>
public bool[] Allow_AGV_Put = new bool[16];
/// <summary>
/// 工位允许取货架
/// </summary>
public bool[] Allow_AGV_Get = new bool[16];
/// <summary>
/// AGV请求放货架
/// </summary>
public bool[] AGV_Request_Put = new bool[16];
/// <summary>
/// AGV请求取货架
/// </summary>
public bool[] AGV_Request_Get = new bool[16];
/// <summary>
/// AGV放托盘完成
/// </summary>
public bool[] AGV_Put_Done = new bool[16];
/// <summary>
/// 托盘号
/// </summary>
public short[] Pan_No = new short[16];
/// <summary>
/// 配料时间
/// </summary>
public int DosingTime;
public bool Dosing_Confirm { get; set; }
public bool Dosing_Cancel { get; set; }
public bool Dosing_Cancel2 { get; set; }

public bool Dosing_Cancel3 { get; set; }

public short a { get; set; }
public short[] Standby { get; set; } = new short[3];
[Siemens(16)]
/// <summary>
/// 备用
/// 生产工单
/// </summary>
public byte Reserve;
public string RecipeCode { get; set; }
public bool Dosing_Cancel4 { get; set; }

public bool Dosing_Cancel5 { get; set; }

public bool Dosing_Cancel6 { get; set; }

public bool Dosing_Cancel7 { get; set; }

public short Dosing_Cancel8 { get; set; }

public short[] Standby2 { get; set; } = new short[4];
}
}

+ 9
- 8
BPASmartClient.JXJFoodBigStation/Model/Siemens/SiemensDeviceStatus.cs Целия файл

@@ -21,21 +21,22 @@ namespace BPASmartClient.JXJFoodBigStation.Model.Siemens
{
ThreadManage.GetInstance().StartLong(new Action(() =>
{
var res = this.Siemens_PLC_S7.ReadClass<DL_Start_DB>(1);
var res1 = this.Siemens_PLC_S7.ReadClass<DL_Status_DB>(2);
var res2 = this.Siemens_PLC_S7.ReadClass<DL_Finish_DB>(3);
if (res != null && RTrig.GetInstance("RecipeTrig").Start(res.Ask_For_Send_Bit))
var res = this.Siemens_PLC_S7.ReadClass<DL_Start_DB>(2301);
var res1 = this.Siemens_PLC_S7.ReadClass<DL_Status_DB>(2331);
var res2 = this.Siemens_PLC_S7.ReadClass<DL_Finish_DB>(2361);
var res3 = this.Siemens_PLC_S7.ReadClass<DL_DataColl_DB>(2391);
/*if (res != null && RTrig.GetInstance("RecipeTrig").Start(res.Ask_For_Send_Bit))
{
ActionManage.GetInstance.Send("SiemensSendRecipe", res);
res.Ask_For_Send_Bit = false;//接受配方信号复位
res.Ack_Ask_For_Send_Bit = true;//配方接受完成
//res.Ack_Ask_For_Send_Bit = true;//配方接受完成
this.Siemens_PLC_S7.WriteClass<DL_Start_DB>(res, 1);
}

if (res1 != null && RTrig.GetInstance("Allow_AGV_Put[0]").Start(res1.Allow_AGV_Put[0]))
if (res1 != null && RTrig.GetInstance("Allow_AGV_Put[0]").Start(res1.))
{
ActionManage.GetInstance.Send("AGVToStation1Sign", res1);
res1.Allow_AGV_Put[0] = false;
//res1.Allow_AGV_Put[0] = false;
this.Siemens_PLC_S7.WriteClass<DL_Status_DB>(res1, 2);
}
if (res1 != null && RTrig.GetInstance("Allow_AGV_Put[1]").Start(res1.Allow_AGV_Put[1]))
@@ -68,7 +69,7 @@ namespace BPASmartClient.JXJFoodBigStation.Model.Siemens
res1.Allow_AGV_Put[5] = false;
this.Siemens_PLC_S7.WriteClass<DL_Status_DB>(res1, 2);
}
*/
if (res2 != null && res2.Ask_For_Finish_PLC)
{
ActionManage.GetInstance.Send("配料完成信号确认完成");


+ 1
- 1
BPASmartClient.JXJFoodBigStation/ViewModel/RecipeInfosViewModel.cs Целия файл

@@ -47,7 +47,7 @@ namespace BPASmartClient.JXJFoodBigStation.ViewModel
if (name == null)
{
go:
string recipeCode = new Random().Next(10000, 99999).ToString();
string recipeCode = new Random().Next(10000, 32767).ToString();
var res = Json<LocalRecipe>.Data.Recipes.FirstOrDefault(p => p.RecipeCode == recipeCode);
if (res == null)
{


+ 1
- 1
BPASmartClient.JXJFoodBigStation/ViewModel/RecipeReceiveViewModel.cs Целия файл

@@ -37,7 +37,7 @@ namespace BPASmartClient.JXJFoodBigStation.ViewModel
var res = Json<LocalRecipe>.Data.Recipes.FirstOrDefault(p => p.RecipeCode == num);
ActionManage.GetInstance.Send("RecipeInfo", res);
nrv.Show();
MessageLog.GetInstance.ShowUserLog($"查看配方——{res.RecipeName}");
MessageNotify.GetInstance.ShowUserLog($"查看配方——{res.RecipeName}");
}
});
NewRecipe = new RelayCommand(() => {


+ 1
- 1
BPASmartClient.JXJFoodBigStation/ViewModel/RecipeSendDownViewModel.cs Целия файл

@@ -38,7 +38,7 @@ namespace BPASmartClient.JXJFoodBigStation.ViewModel
//配方下发逻辑
var res = Recipes.FirstOrDefault(p => p.RecipeName == recipeName);
if (res != null)
ActionManage.GetInstance.Send("手动下发本地配方", res);
ActionManage.GetInstance.Send("ManualSendRecipe", res);
}
});
}


+ 1
- 1
BPASmartClient.JXJFoodSmallStation/App.config Целия файл

@@ -2,7 +2,7 @@
<configuration>
<appSettings>
<add key="HKPlc_IP" value="192.168.0.15"/>
<add key="Siemens_IP" value="192.168.0.30"/>
<add key="Siemens_IP" value="107.107.2.200"/>
<add key="WindSend_IP" value="192.168.0.40"/>
</appSettings>
</configuration>

+ 12
- 4
BPASmartClient.JXJFoodSmallStation/App.xaml.cs Целия файл

@@ -28,14 +28,14 @@ namespace BPASmartClient.JXJFoodSmallStation
base.OnStartup(e);
MenuInit();
DataInit();
DeviceInquire.GetInstance.Init();//配料机设备上线监听,设备列表初始化
//DeviceInquire.GetInstance.Init();//配料机设备上线监听,设备列表初始化
ProcessControl.GetInstance.Init();
MainView mv = new MainView();
LoginView lv = new LoginView();
var res = lv.ShowDialog();
if (res != null && res == true)
{
MessageLog.GetInstance.ShowUserLog("用户登录");
MessageNotify.GetInstance.ShowUserLog("用户登录");
mv.Show();
}
else
@@ -48,7 +48,7 @@ namespace BPASmartClient.JXJFoodSmallStation
base.OnExit(e);
Json<LocaPar>.Save();
Json<LocalRecipeDataColl>.Save();
MessageLog.GetInstance.LogSave();
MessageNotify.GetInstance.LogSave();
ThreadManage.GetInstance().Dispose();
}

@@ -125,11 +125,19 @@ namespace BPASmartClient.JXJFoodSmallStation
ObservableCollection<SubMenumodel> ManualControl = new ObservableCollection<SubMenumodel>();
ManualControl.Add(new SubMenumodel()
{
SubMenuName = "手动控制",
SubMenuName = "手动控制硬件",
SubMenuPermission = new Permission[] { Permission.管理员, Permission.操作员, Permission.技术员 },
AssemblyName = "BPASmartClient.JXJFoodSmallStation",
ToggleWindowPath = "View.ManualControlView"
});
ManualControl.Add(new SubMenumodel()
{
SubMenuName = "手动控制信号",
SubMenuPermission = new Permission[] { Permission.管理员, Permission.操作员, Permission.技术员 },
AssemblyName = "BPASmartClient.JXJFoodSmallStation",
ToggleWindowPath = "View.ManualCommView"

});

MenuManage.GetInstance.menuModels.Add(new MenuModel()
{


+ 4
- 0
BPASmartClient.JXJFoodSmallStation/BPASmartClient.JXJFoodSmallStation.csproj Целия файл

@@ -26,6 +26,10 @@
<Page Update="View\DeviceListView.xaml">
<XamlRuntime>$(DefaultXamlRuntime)</XamlRuntime>
</Page>
<Page Update="View\ManualCommView.xaml">
<XamlRuntime>$(DefaultXamlRuntime)</XamlRuntime>
<SubType>Designer</SubType>
</Page>
<Page Update="View\SiemensRecipeReceiveView.xaml">
<XamlRuntime>$(DefaultXamlRuntime)</XamlRuntime>
<SubType>Designer</SubType>


+ 2
- 0
BPASmartClient.JXJFoodSmallStation/Model/GVL_SmallStation.cs Целия файл

@@ -14,6 +14,8 @@ namespace BPASmartClient.JXJFoodSmallStation.Model
private volatile static GVL_SmallStation SmallStation;
public static GVL_SmallStation GetInstance => SmallStation ?? (SmallStation = new GVL_SmallStation());
private GVL_SmallStation() { }
public bool HeartBeatToPlc { get; set; } = false;
public bool HeartBeatFromPlc { get; set; } = false;
/// <summary>
/// 是否允许西门子下发配方
/// </summary>


+ 11
- 10
BPASmartClient.JXJFoodSmallStation/Model/HK_PLC/HKDeviceStatus.cs Целия файл

@@ -19,14 +19,15 @@ namespace BPASmartClient.JXJFoodSmallStation.Model.HK_PLC
{
if (IsConnected)
{
ThreadManage.GetInstance().StartLong(new Action(() =>
/*ThreadManage.GetInstance().StartLong(new Action(() =>
{
if (!IsConnected)
{
MessageLog.GetInstance.ShowRunLog("海科PLC断开连接");
}
Thread.Sleep(10);
}),"信号收发处理");
}),"信号收发处理");*/
}
}
/// <summary>
@@ -85,7 +86,7 @@ namespace BPASmartClient.JXJFoodSmallStation.Model.HK_PLC
{
HK_PLC_S7.Write<bool>("DB4.DBX11." + (StockBinLocation - 9), true);
}
MessageLog.GetInstance.ShowRunLog($"托盘1—1号桶在料仓{StockBinLocation}配料");
MessageNotify.GetInstance.ShowRunLog($"托盘1—1号桶在料仓{StockBinLocation}配料");
}
else if (BarrelNum == 2)
{
@@ -97,7 +98,7 @@ namespace BPASmartClient.JXJFoodSmallStation.Model.HK_PLC
{
HK_PLC_S7.Write<bool>("DB4.DBX13." + (StockBinLocation - 9), true);
}
MessageLog.GetInstance.ShowRunLog($"托盘1—2号桶在料仓{StockBinLocation}配料");
MessageNotify.GetInstance.ShowRunLog($"托盘1—2号桶在料仓{StockBinLocation}配料");
}
else if (BarrelNum == 3)
{
@@ -109,7 +110,7 @@ namespace BPASmartClient.JXJFoodSmallStation.Model.HK_PLC
{
HK_PLC_S7.Write<bool>("DB4.DBX15." + (StockBinLocation - 9), true);
}
MessageLog.GetInstance.ShowRunLog($"托盘1—3号桶在料仓{StockBinLocation}配料");
MessageNotify.GetInstance.ShowRunLog($"托盘1—3号桶在料仓{StockBinLocation}配料");
}
else if (BarrelNum == 4)
{
@@ -121,7 +122,7 @@ namespace BPASmartClient.JXJFoodSmallStation.Model.HK_PLC
{
HK_PLC_S7.Write<bool>("DB4.DBX17." + (StockBinLocation - 9), true);
}
MessageLog.GetInstance.ShowRunLog($"托盘1—4号桶在料仓{StockBinLocation}配料");
MessageNotify.GetInstance.ShowRunLog($"托盘1—4号桶在料仓{StockBinLocation}配料");
}
}
}
@@ -139,7 +140,7 @@ namespace BPASmartClient.JXJFoodSmallStation.Model.HK_PLC
{
HK_PLC_S7.Write<bool>("DB4.DBX19." + (StockBinLocation - 9), true);
}
MessageLog.GetInstance.ShowRunLog($"托盘2—1号桶在料仓{StockBinLocation}配料");
MessageNotify.GetInstance.ShowRunLog($"托盘2—1号桶在料仓{StockBinLocation}配料");
}
else if (BarrelNum == 2)
{
@@ -151,7 +152,7 @@ namespace BPASmartClient.JXJFoodSmallStation.Model.HK_PLC
{
HK_PLC_S7.Write<bool>("DB4.DBX21." + (StockBinLocation - 9), true);
}
MessageLog.GetInstance.ShowRunLog($"托盘2—2号桶在料仓{StockBinLocation}配料");
MessageNotify.GetInstance.ShowRunLog($"托盘2—2号桶在料仓{StockBinLocation}配料");
}
else if (BarrelNum == 3)
{
@@ -163,7 +164,7 @@ namespace BPASmartClient.JXJFoodSmallStation.Model.HK_PLC
{
HK_PLC_S7.Write<bool>("DB4.DBX23." + (StockBinLocation - 9), true);
}
MessageLog.GetInstance.ShowRunLog($"托盘2—3号桶在料仓{StockBinLocation}配料");
MessageNotify.GetInstance.ShowRunLog($"托盘2—3号桶在料仓{StockBinLocation}配料");
}
else if (BarrelNum == 4)
{
@@ -175,7 +176,7 @@ namespace BPASmartClient.JXJFoodSmallStation.Model.HK_PLC
{
HK_PLC_S7.Write<bool>("DB4.DBX25." + (StockBinLocation - 9), true);
}
MessageLog.GetInstance.ShowRunLog($"托盘2—4号桶在料仓{StockBinLocation}配料");
MessageNotify.GetInstance.ShowRunLog($"托盘2—4号桶在料仓{StockBinLocation}配料");
}
}
}


+ 18
- 0
BPASmartClient.JXJFoodSmallStation/Model/HK_PLC/PlcManualComm.cs Целия файл

@@ -0,0 +1,18 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace BPASmartClient.JXJFoodSmallStation.Model.HK_PLC
{
public class PlcManualComm
{
public int SerialNum { get; set;}
public string Address { get; set; }
public string Describe { get; set; }
public string NowValue { get; set; }
public string SetValue { get; set; }

}
}

+ 111
- 57
BPASmartClient.JXJFoodSmallStation/Model/ProcessControl.cs Целия файл

@@ -80,7 +80,7 @@ namespace BPASmartClient.JXJFoodSmallStation.Model
}
else
{
MessageLog.GetInstance.AlarmLog("配方名称与本地不符合");
//MessageNotify.GetInstance.AlarmLog("配方名称与本地不符合");
}
}
Json<RemoteRecipeDataColl>.Data.Recipes.Add(new RemoteRecipeData()
@@ -106,7 +106,6 @@ namespace BPASmartClient.JXJFoodSmallStation.Model
Json<RemoteRecipeDataColl>.Data.Recipes.Add(recipe);
}
}), "LocalSimulationRecipeIssue", true);
string HK_PLC_IP = ConfigurationManager.AppSettings["HKPlc_IP"];
string Siemens_PLC_IP = ConfigurationManager.AppSettings["Siemens_IP"];
string WindSend_PLC_IP = ConfigurationManager.AppSettings["WindSend_IP"];
@@ -118,45 +117,77 @@ namespace BPASmartClient.JXJFoodSmallStation.Model
if (HKDevice.IsConnected)
{
HKDevice.Init();
MessageLog.GetInstance.ShowUserLog("海科plc连接成功,并初始化完成");
MessageNotify.GetInstance.ShowRunLog("海科plc连接成功,并初始化完成");
}
if (SiemensDevice.IsConnected)
{
SiemensDevice.Init();
MessageLog.GetInstance.ShowUserLog("西门子plc连接成功,并初始化完成");
MessageNotify.GetInstance.ShowRunLog("西门子plc连接成功,并初始化完成");
}
if (WindSendDevice.IsConnected)
{
WindSendDevice.Init();
MessageLog.GetInstance.ShowUserLog("风送plc连接成功,并初始化完成");
MessageNotify.GetInstance.ShowRunLog("风送plc连接成功,并初始化完成");
}
}
catch(Exception ex)
{
}
ActionManage.GetInstance.CancelRegister("SystemStart");
ActionManage.GetInstance.Register(new Action(() =>
{
HKDevice.HK_PLC_S7.Write<bool>("DB44.DBX0.0", true);
}), "SystemStart", true);
ActionManage.GetInstance.CancelRegister("SystemStop");
ActionManage.GetInstance.Register(new Action(() =>
{
HKDevice.HK_PLC_S7.Write<bool>("DB44.DBX0.0", false);
}), "SystemStop", true);
ActionManage.GetInstance.CancelRegister("SystemPause");
ActionManage.GetInstance.Register(new Action(() =>
{
HKDevice.HK_PLC_S7.Write<bool>("DB44.DBX0.2", true);
}), "SystemPause", true);
ActionManage.GetInstance.CancelRegister("SystemReset");
ActionManage.GetInstance.Register(new Action(() =>
{
HKDevice.HK_PLC_S7.Write<bool>("DB44.DBX0.2", false);
}), "SystemReset", true);

ActionManage.GetInstance.CancelRegister("SystemAutoMode");
ActionManage.GetInstance.Register(new Action(() =>
{
HKDevice.HK_PLC_S7.Write<bool>("DB44.DBX0.1", false);
}), "SystemAutoMode", true);
ActionManage.GetInstance.CancelRegister("SystemDebugMode");
ActionManage.GetInstance.Register(new Action(() =>
{
HKDevice.HK_PLC_S7.Write<bool>("DB44.DBX0.1", true);
}), "SystemDebugMode", true);
RecipeQueue.Clear();
//Json<RemoteRecipeDataColl>.Data.Recipes = TestData.GetInstance.Recipes;//添加测试数据
ThreadManage.GetInstance().StartLong(new Action(() =>
{
HeartHKPlc();
ReceviceData();
RecipeInfoToHKPLC();
Thread.Sleep(10);
}), "西门子配发下发流程处理", true);
ThreadManage.GetInstance().StartLong(new Action(() =>
/* ThreadManage.GetInstance().StartLong(new Action(() =>
{
if (SiemensDevice.IsConnected && HKDevice.IsConnected)
{
/*AgvGetInDelivery();
AgvGetInPickUp();*/
*//*AgvGetInDelivery();
AgvGetInPickUp();*//*
}
Thread.Sleep(10);
}), "AGV进站送取货", true);
}), "AGV进站送取货", true);*/
ThreadManage.GetInstance().StartLong(new Action(() =>
{
if (HKDevice.IsConnected)
{
GetStatus();
//GetStatus();
ManualOpen();
ManualClose();
}
@@ -172,15 +203,16 @@ namespace BPASmartClient.JXJFoodSmallStation.Model
for (int i = 0; i < 7; i++)
{
GVL_SmallStation.GetInstance.Cylinder_JackInfo[i + 8] = HKDevice.HK_PLC_S7.Read<bool>("DB5.DBX0." + i);
}
}/*
ActionManage.GetInstance.Register(new Action(() =>
{
HKDevice.HK_PLC_S7.Write<bool>("M10.0", true);
}), "ManualEStop", true);

ActionManage.GetInstance.Register(new Action(() =>
{
HKDevice.HK_PLC_S7.Write<bool>("M10.0", false);
}), "ManualEReset", true);
}), "ManualEReset", true);*/
}
private void ManualOpen()
{
@@ -240,7 +272,6 @@ namespace BPASmartClient.JXJFoodSmallStation.Model
break;
default:
break;

}
}
else if (o.ToString().Contains("阻挡气缸"))
@@ -295,7 +326,6 @@ namespace BPASmartClient.JXJFoodSmallStation.Model
break;
default:
break;

}
}
else if (o.ToString().Contains("进料桶顶升气缸"))
@@ -580,9 +610,19 @@ namespace BPASmartClient.JXJFoodSmallStation.Model
break;
}
}
/// <summary>
/// 将配方添加到配方队列中
/// </summary>
private void HeartHKPlc()
{
if (HKDevice.IsConnected)
{
GVL_SmallStation.GetInstance.HeartBeatToPlc = !GVL_SmallStation.GetInstance.HeartBeatToPlc;
HKDevice.HK_PLC_S7.Write("DB4.DBX0.0", GVL_SmallStation.GetInstance.HeartBeatToPlc);
GVL_SmallStation.GetInstance.HeartBeatFromPlc = HKDevice.HK_PLC_S7.Read<bool>("DB3.DBX0.0");

}
}
/// <summary>
/// 将配方添加到配方队列中
/// </summary>
private void ReceviceData()
{
RemoteRecipes = Json<RemoteRecipeDataColl>.Data.Recipes;
@@ -664,7 +704,7 @@ namespace BPASmartClient.JXJFoodSmallStation.Model
}
HKDevice.HK_PLC_S7.Write("DB4.DBX1.3", true);
GVL_SmallStation.GetInstance.RecipeStatusID = 1;
MessageLog.GetInstance.ShowRunLog($"托盘1,配方:{recipeName},下发完成");
MessageNotify.GetInstance.ShowRunLog($"托盘1,配方:{recipeName},下发完成");
HKDevice.HK_PLC_S7.Write("DB3.DBX1.3", true);
}
@@ -672,14 +712,14 @@ namespace BPASmartClient.JXJFoodSmallStation.Model
{
HKDevice.HK_PLC_S7.Write("DB3.DBX1.3", false);
GVL_SmallStation.GetInstance.RecipeStatusID = 2;
MessageLog.GetInstance.ShowRunLog($"托盘1,{ recipeName}plc端 配方接收完成");
MessageNotify.GetInstance.ShowRunLog($"托盘1,{ recipeName}plc端 配方接收完成");
}
if (GVL_SmallStation.GetInstance.RecipeStatusID == 2)
if (GVL_SmallStation.GetInstance.RecipeStatusID == 2)
{
if (RTrig.GetInstance("DB3.DBX50.0").Start(HKDevice.HK_PLC_S7.Read<bool>("DB3.DBX50.0")))
{
var res = HKDevice.HK_PLC_S7.Read<float>("DB3.DBD10");
MessageLog.GetInstance.ShowRunLog($"托盘1,配方:{recipeName},1号桶,{res}料仓,允许配料");
MessageNotify.GetInstance.ShowRunLog($"托盘1,配方:{recipeName},1号桶,{res}料仓,允许配料");
if (res > 0 && res is float loc)
{
int loc_index = Array.FindIndex(RemoteRecipes.ElementAt(index).RawMaterial.ToArray(), p => p.RawMaterialLocation == loc);
@@ -692,13 +732,13 @@ namespace BPASmartClient.JXJFoodSmallStation.Model
}
GVL_SmallStation.GetInstance.DosingTray1 = true;
GVL_SmallStation.GetInstance.DosingTray1Loc = (int)loc;
MessageLog.GetInstance.ShowRunLog($"托盘1,配方:{recipeName},1号桶,{(int)loc}号仓,配料完成");
MessageNotify.GetInstance.ShowRunLog($"托盘1,配方:{recipeName},1号桶,{(int)loc}号仓,配料完成");
}
}
else if(RTrig.GetInstance("DB3.DBX50.1").Start(HKDevice.HK_PLC_S7.Read<bool>("DB3.DBX50.1")))
{
var res = HKDevice.HK_PLC_S7.Read<float>("DB3.DBD14");
MessageLog.GetInstance.ShowRunLog($"托盘1,配方:{recipeName},2号桶,{res}料仓,允许配料");
MessageNotify.GetInstance.ShowRunLog($"托盘1,配方:{recipeName},2号桶,{res}料仓,允许配料");
if (res > 0 && res is float loc)
{
int loc_index = Array.FindIndex(RemoteRecipes.ElementAt(index).RawMaterial.ToArray(), p => p.RawMaterialLocation == loc);
@@ -711,13 +751,13 @@ namespace BPASmartClient.JXJFoodSmallStation.Model
}
GVL_SmallStation.GetInstance.DosingTray1 = true;
GVL_SmallStation.GetInstance.DosingTray1Loc = (int)loc;
MessageLog.GetInstance.ShowRunLog($"托盘1,配方:{recipeName},2号桶,{(int)loc}号仓,配料完成");
MessageNotify.GetInstance.ShowRunLog($"托盘1,配方:{recipeName},2号桶,{(int)loc}号仓,配料完成");
}
}
else if (RTrig.GetInstance("DB3.DBX50.2").Start(HKDevice.HK_PLC_S7.Read<bool>("DB3.DBX50.2")))
{
var res = HKDevice.HK_PLC_S7.Read<float>("DB3.DBD18");
MessageLog.GetInstance.ShowRunLog($"托盘1,配方:{recipeName},3号桶,{res}料仓,允许配料");
MessageNotify.GetInstance.ShowRunLog($"托盘1,配方:{recipeName},3号桶,{res}料仓,允许配料");
if (res > 0 && res is float loc)
{
int loc_index = Array.FindIndex(RemoteRecipes.ElementAt(index).RawMaterial.ToArray(), p => p.RawMaterialLocation == loc);
@@ -730,13 +770,13 @@ namespace BPASmartClient.JXJFoodSmallStation.Model
}
GVL_SmallStation.GetInstance.DosingTray1 = true;
GVL_SmallStation.GetInstance.DosingTray1Loc = (int)loc;
MessageLog.GetInstance.ShowRunLog($"托盘1,配方:{recipeName},3号桶,{(int)loc}号仓,配料完成");
MessageNotify.GetInstance.ShowRunLog($"托盘1,配方:{recipeName},3号桶,{(int)loc}号仓,配料完成");
}
}
else if (RTrig.GetInstance("DB3.DBX50.3").Start(HKDevice.HK_PLC_S7.Read<bool>("DB3.DBX50.3")))
{
var res = HKDevice.HK_PLC_S7.Read<float>("DB3.DBD22");
MessageLog.GetInstance.ShowRunLog($"托盘1,配方:{recipeName},4号桶,{res}料仓,允许配料");
MessageNotify.GetInstance.ShowRunLog($"托盘1,配方:{recipeName},4号桶,{res}料仓,允许配料");
if (res > 0 && res is float loc)
{
int loc_index = Array.FindIndex(RemoteRecipes.ElementAt(index).RawMaterial.ToArray(), p => p.RawMaterialLocation == loc);
@@ -749,7 +789,7 @@ namespace BPASmartClient.JXJFoodSmallStation.Model
}
GVL_SmallStation.GetInstance.DosingTray1 = true;
GVL_SmallStation.GetInstance.DosingTray1Loc = (int)loc;
MessageLog.GetInstance.ShowRunLog($"托盘1,配方:{recipeName},4号桶,{(int)loc}号仓,配料完成");
MessageNotify.GetInstance.ShowRunLog($"托盘1,配方:{recipeName},4号桶,{(int)loc}号仓,配料完成");
}
}
if (GVL_SmallStation.GetInstance.DosingTray1 && GVL_SmallStation.GetInstance.DosingTray1Loc > 0 && GVL_SmallStation.GetInstance.DosingTray1Loc < 16)
@@ -757,20 +797,27 @@ namespace BPASmartClient.JXJFoodSmallStation.Model
int i = GVL_SmallStation.GetInstance.DosingTray1Loc;
if (RTrig.GetInstance("Tray1StatusDevice" + i).Start(DeviceInquire.GetInstance.GetDevice(i).deviceStatus.RunStatus == 3))
{
MessageLog.GetInstance.ShowRunLog($"柔性味魔方,托盘1,配方:{recipeName},{i}号仓,配料完成");
MessageNotify.GetInstance.ShowRunLog($"柔性味魔方,托盘1,配方:{recipeName},{i}号仓,配料完成");
int res = Array.FindIndex(RemoteRecipes.ElementAt(index).RawMaterial.ToArray(), p => p.RawMaterialLocation == i);
RemoteRecipes.ElementAt(index).RawMaterial.ElementAt(res).Laying_Off_Weight = DeviceInquire.GetInstance.GetDevice(i).deviceStatus.CutWeightFeedback;
string info = DeviceInquire.GetInstance.GetDevice(i).StatusReset();
MessageLog.GetInstance.ShowRunLog(info);
bool info = DeviceInquire.GetInstance.GetDevice(i).StatusReset();
if (info)
{
MessageNotify.GetInstance.ShowRunLog($"柔性味魔方配料完成后复位 发送成功");
}
else
{
MessageNotify.GetInstance.ShowRunLog($"柔性味魔方配料完成后复位 发送失败");
}
if (i >= 1 && i <= 8)
{
string commInfo = HKDevice.HK_PLC_S7.Write("DB4.DBX30." + (i - 1), true);
MessageLog.GetInstance.ShowRunLog(commInfo);
string commInfo = HKDevice.HK_PLC_S7.Write("DB4.DBX30." + (i - 1), true, 4);
MessageNotify.GetInstance.ShowRunLog(commInfo);
}
else if (i >= 9 && i <= 15)
{
string commInfo1 = HKDevice.HK_PLC_S7.Write("DB4.DBX31." + (i - 9), true);
MessageLog.GetInstance.ShowRunLog(commInfo1);
string commInfo1 = HKDevice.HK_PLC_S7.Write("DB4.DBX31." + (i - 9), true, 4);
MessageNotify.GetInstance.ShowRunLog(commInfo1);
}
GVL_SmallStation.GetInstance.DosingTray1 = false;
GVL_SmallStation.GetInstance.DosingTray1Loc = 0;
@@ -780,7 +827,7 @@ namespace BPASmartClient.JXJFoodSmallStation.Model
if (RTrig.GetInstance("配方配料完成").Start(HKDevice.HK_PLC_S7.Read<bool>("DB3.DBX1.1")) && (GVL_SmallStation.GetInstance.WindSendDosingFinish || !GVL_SmallStation.GetInstance.IsUseWindSend))
{
var res = Json<RemoteRecipeDataColl>.Data.Recipes.FirstOrDefault(p => p.RecipeCode == code);
MessageLog.GetInstance.ShowRunLog($"托盘1,配方{res.RecipeName},配料完成");
MessageNotify.GetInstance.ShowRunLog($"托盘1,配方{res.RecipeName},配料完成");
RecipeFinishInfo.Order_No = RemoteRecipes.ElementAt(index).RecipeCode;
RecipeFinishInfo.Product_Code = RemoteRecipes.ElementAt(index).RecipeName;
for (int i = 0; i < RemoteRecipes.ElementAt(index).RawMaterial.Count; i++)
@@ -819,14 +866,14 @@ namespace BPASmartClient.JXJFoodSmallStation.Model
{
if (GVL_SmallStation.GetInstance.RecipeStatusIDTray2 == 0)
{
MessageLog.GetInstance.ShowRunLog($"托盘2,配方:{recipeName},初始化");
MessageNotify.GetInstance.ShowRunLog($"托盘2,配方:{recipeName},初始化");
foreach (var item in RemoteRecipes.ElementAt(index).RawMaterial)
{
HKDevice.StockBinPar((uint)item.RawMaterialBarrelNum, (ushort)item.RawMaterialLocation, 2);
}
HKDevice.HK_PLC_S7.Write("DB4.DBX1.4", true);
GVL_SmallStation.GetInstance.RecipeStatusIDTray2 = 1;
MessageLog.GetInstance.ShowRunLog($"托盘2,配方:{recipeName},下发完成");
MessageNotify.GetInstance.ShowRunLog($"托盘2,配方:{recipeName},下发完成");
HKDevice.HK_PLC_S7.Write("DB3.DBX1.4", true);
}

@@ -834,14 +881,14 @@ namespace BPASmartClient.JXJFoodSmallStation.Model
{
HKDevice.HK_PLC_S7.Write("DB3.DBX1.4", false);
GVL_SmallStation.GetInstance.RecipeStatusIDTray2 = 2;
MessageLog.GetInstance.ShowRunLog($"配方:{recipeName},plc端 配方接收完成");
MessageNotify.GetInstance.ShowRunLog($"配方:{recipeName},plc端 配方接收完成");
}
if (GVL_SmallStation.GetInstance.RecipeStatusIDTray2 == 2)
{
if (RTrig.GetInstance("DB3.DBX50.4").Start(HKDevice.HK_PLC_S7.Read<bool>("DB3.DBX50.4")))
{
var res = HKDevice.HK_PLC_S7.Read<float>("DB3.DBD26");
MessageLog.GetInstance.ShowRunLog($"托盘2,配方:{recipeName},1号桶,{res}料仓,允许配料");
MessageNotify.GetInstance.ShowRunLog($"托盘2,配方:{recipeName},1号桶,{res}料仓,允许配料");
if (res > 0 && res is float loc)
{
//int decimalNum = Convert.ToInt32(loc.ToString().Substring(loc.ToString().IndexOf(".") + 1));
@@ -855,13 +902,13 @@ namespace BPASmartClient.JXJFoodSmallStation.Model
}
GVL_SmallStation.GetInstance.DosingTray2 = true;
GVL_SmallStation.GetInstance.DosingTray2Loc = (int)loc;
MessageLog.GetInstance.ShowRunLog($"托盘2,配方:{recipeName},1号桶,{(int)loc}号仓,配料完成");
MessageNotify.GetInstance.ShowRunLog($"托盘2,配方:{recipeName},1号桶,{(int)loc}号仓,配料完成");
}
}
else if (RTrig.GetInstance("DB3.DBX50.5").Start(HKDevice.HK_PLC_S7.Read<bool>("DB3.DBX50.5")))
{
var res = HKDevice.HK_PLC_S7.Read<float>("DB3.DBD30");
MessageLog.GetInstance.ShowRunLog($"托盘2,配方:{recipeName},2号桶,{res}料仓,允许配料");
MessageNotify.GetInstance.ShowRunLog($"托盘2,配方:{recipeName},2号桶,{res}料仓,允许配料");
if (res > 0 && res is float loc)
{
int loc_index = Array.FindIndex(RemoteRecipes.ElementAt(index).RawMaterial.ToArray(), p => p.RawMaterialLocation == loc);
@@ -874,17 +921,17 @@ namespace BPASmartClient.JXJFoodSmallStation.Model
}
GVL_SmallStation.GetInstance.DosingTray2 = true;
GVL_SmallStation.GetInstance.DosingTray2Loc = (int)loc;
MessageLog.GetInstance.ShowRunLog($"托盘2,配方:{recipeName},2号桶,{(int)loc}号仓,配料完成");
MessageNotify.GetInstance.ShowRunLog($"托盘2,配方:{recipeName},2号桶,{(int)loc}号仓,配料完成");
}
}
else if (RTrig.GetInstance("DB3.DBX50.6").Start(HKDevice.HK_PLC_S7.Read<bool>("DB3.DBX50.6")))
{
var res = HKDevice.HK_PLC_S7.Read<float>("DB3.DBD34");
MessageLog.GetInstance.ShowRunLog($"托盘2,配方:{recipeName},3号桶,{res}料仓,允许配料");
MessageNotify.GetInstance.ShowRunLog($"托盘2,配方:{recipeName},3号桶,{res}料仓,允许配料");
if (res > 0 && res is float loc)
{
int loc_index = Array.FindIndex(RemoteRecipes.ElementAt(index).RawMaterial.ToArray(), p => p.RawMaterialLocation == loc);
double weight = RemoteRecipes.ElementAt(index).RawMaterial.ElementAt(loc_index).RawMaterialWeightW;
double weight = RemoteRecipes.ElementAt(index).RawMaterial.ElementAt(loc_index).RawMaterialWeight;
if (loc_index >= 0)
{
DeviceInquire.GetInstance.GetDevice((int)loc)?.Start((uint)weight);//启动并写入每个原料重量
@@ -893,13 +940,13 @@ namespace BPASmartClient.JXJFoodSmallStation.Model
}
GVL_SmallStation.GetInstance.DosingTray2 = true;
GVL_SmallStation.GetInstance.DosingTray2Loc = (int)loc;
MessageLog.GetInstance.ShowRunLog($"托盘2,配方:{recipeName},3号桶,{(int)loc}号仓,配料完成");
MessageNotify.GetInstance.ShowRunLog($"托盘2,配方:{recipeName},3号桶,{(int)loc}号仓,配料完成");
}
}
else if (RTrig.GetInstance("DB3.DBX50.7").Start(HKDevice.HK_PLC_S7.Read<bool>("DB3.DBX50.7")))
{
var res = HKDevice.HK_PLC_S7.Read<float>("DB3.DBD38");
MessageLog.GetInstance.ShowRunLog($"托盘2,配方:{recipeName},4号桶,{res}料仓,允许配料");
MessageNotify.GetInstance.ShowRunLog($"托盘2,配方:{recipeName},4号桶,{res}料仓,允许配料");
if (res > 0 && res is float loc)
{
int loc_index = Array.FindIndex(RemoteRecipes.ElementAt(index).RawMaterial.ToArray(), p => p.RawMaterialLocation == loc);
@@ -912,7 +959,7 @@ namespace BPASmartClient.JXJFoodSmallStation.Model
}
GVL_SmallStation.GetInstance.DosingTray2 = true;
GVL_SmallStation.GetInstance.DosingTray2Loc = (int)loc;
MessageLog.GetInstance.ShowRunLog($"托盘2,配方:{recipeName},4号桶,{(int)loc}号仓,配料完成");
MessageNotify.GetInstance.ShowRunLog($"托盘2,配方:{recipeName},4号桶,{(int)loc}号仓,配料完成");
}
}
if (GVL_SmallStation.GetInstance.DosingTray2 == true && GVL_SmallStation.GetInstance.DosingTray1 == false && GVL_SmallStation.GetInstance.DosingTray2Loc > 0 && GVL_SmallStation.GetInstance.DosingTray2Loc < 16)
@@ -920,20 +967,27 @@ namespace BPASmartClient.JXJFoodSmallStation.Model
int i = GVL_SmallStation.GetInstance.DosingTray2Loc;
if (RTrig.GetInstance("Tray2StatusDevice" + i).Start(DeviceInquire.GetInstance.GetDevice(i).deviceStatus.RunStatus == 3))
{
MessageLog.GetInstance.ShowRunLog($"柔性味魔方,托盘2,配方:{recipeName},{i}号仓,配料完成");
MessageNotify.GetInstance.ShowRunLog($"柔性味魔方,托盘2,配方:{recipeName},{i}号仓,配料完成");
int res = Array.FindIndex(RemoteRecipes.ElementAt(index).RawMaterial.ToArray(), p => p.RawMaterialLocation == i);
RemoteRecipes.ElementAt(index).RawMaterial.ElementAt(res).Laying_Off_Weight = DeviceInquire.GetInstance.GetDevice(i).deviceStatus.CutWeightFeedback;
string info = DeviceInquire.GetInstance.GetDevice(i).StatusReset();
MessageLog.GetInstance.ShowRunLog(info);
bool info = DeviceInquire.GetInstance.GetDevice(i).StatusReset();
if (info)
{
MessageNotify.GetInstance.ShowRunLog($"柔性味魔方配料完成后复位 发送成功");
}
else
{
MessageNotify.GetInstance.ShowRunLog($"柔性味魔方配料完成后复位 发送失败");
}
if (i >= 1 && i <= 8)
{
string commInfo = HKDevice.HK_PLC_S7.Write("DB4.DBX30." + (i - 1), true);
MessageLog.GetInstance.ShowRunLog(commInfo);
string commInfo = HKDevice.HK_PLC_S7.Write("DB4.DBX30." + (i - 1), true, 4);
MessageNotify.GetInstance.ShowRunLog(commInfo);
}
else if (i >= 9 && i <= 15)
{
string commInfo1 = HKDevice.HK_PLC_S7.Write("DB4.DBX31." + (i - 9), true);
MessageLog.GetInstance.ShowRunLog(commInfo1);
string commInfo1 = HKDevice.HK_PLC_S7.Write("DB4.DBX31." + (i - 9), true, 4);
MessageNotify.GetInstance.ShowRunLog(commInfo1);
}
GVL_SmallStation.GetInstance.DosingTray2 = false;
GVL_SmallStation.GetInstance.DosingTray2Loc = 0;
@@ -942,7 +996,7 @@ namespace BPASmartClient.JXJFoodSmallStation.Model
if (RTrig.GetInstance("DB3.DBX1.2").Start(HKDevice.HK_PLC_S7.Read<bool>("DB3.DBX1.2")))
{
var res = Json<RemoteRecipeDataColl>.Data.Recipes.FirstOrDefault(p => p.RecipeCode == code);
MessageLog.GetInstance.ShowRunLog($"托盘2,配方{res.RecipeName},配料完成");
MessageNotify.GetInstance.ShowRunLog($"托盘2,配方{res.RecipeName},配料完成");
RecipeFinishInfo.Order_No = RemoteRecipes.ElementAt(index).RecipeCode;
RecipeFinishInfo.Product_Code = RemoteRecipes.ElementAt(index).RecipeName;
for (int i = 0; i < RemoteRecipes.ElementAt(index).RawMaterial.Count; i++)
@@ -984,7 +1038,7 @@ namespace BPASmartClient.JXJFoodSmallStation.Model
{
if (RTrig.GetInstance("Tray2StatusDevice" + DeviceID).Start(DeviceInquire.GetInstance.GetDevice(DeviceID).deviceStatus.RunStatus == 3))
{
MessageLog.GetInstance.ShowRunLog($"柔性味魔方,托盘2,配方:{RemoteRecipes.ElementAt(Index).RecipeName},{DeviceID}号仓,配料完成");
MessageNotify.GetInstance.ShowRunLog($"柔性味魔方,托盘2,配方:{RemoteRecipes.ElementAt(Index).RecipeName},{DeviceID}号仓,配料完成");
int res = Array.FindIndex(RemoteRecipes.ElementAt(Index).RawMaterial.ToArray(), p => p.RawMaterialLocation == DeviceID);
RemoteRecipes.ElementAt(Index).RawMaterial.ElementAt(res).Laying_Off_Weight = DeviceInquire.GetInstance.GetDevice(DeviceID).deviceStatus.CutWeightFeedback;
DeviceInquire.GetInstance.GetDevice(DeviceID).StatusReset();


+ 24
- 17
BPASmartClient.JXJFoodSmallStation/Model/RawMaterial/DeviceInquire.cs Целия файл

@@ -45,7 +45,6 @@ namespace BPASmartClient.JXJFoodSmallStation.Model
TopDeviceCurrentStatuses.ElementAt(TopIndex).DeviceNum = DeviceLists.ElementAt(i).Value.deviceStatus.DeviceNum;
TopDeviceCurrentStatuses.ElementAt(TopIndex).RunStatus = DeviceLists.ElementAt(i).Value.deviceStatus.RunStatus;
}

if (BottomIndex >= 0 && BottomIndex < BottomDeviceCurrentStatuses.Count)
{
BottomDeviceCurrentStatuses.ElementAt(BottomIndex).Weight = DeviceLists.ElementAt(i).Value.deviceStatus.WeightFeedback;
@@ -72,7 +71,7 @@ namespace BPASmartClient.JXJFoodSmallStation.Model
DeviceNum = i + 1,
RunStatus = 1,
Weight = new Random().Next(100, 10000) / 100.0
});

devices.Add(new Devices()
@@ -101,8 +100,8 @@ namespace BPASmartClient.JXJFoodSmallStation.Model
}
public void Init()
{
AlarmHelper<AlarmInfo>.Init();
AlarmHelper<AlarmInfo>.Alarm.EStop1 = true;
//AlarmHelper<AlarmInfo>.Init();
//AlarmHelper<AlarmInfo>.Alarm.EStop1 = true;

//TestData();
IpAddressLines();
@@ -217,7 +216,7 @@ namespace BPASmartClient.JXJFoodSmallStation.Model
{
if (Global.DeviceRawMaterials.FirstOrDefault(p => p.RawMaterialName == DeviceName) == null)
{
Global.DeviceRawMaterials.Add(new RawMaterialModel() { RawMaterialName = DeviceName, DeviceIp = ip, RawMaterialSource = 1});
Global.DeviceRawMaterials.Add(new RawMaterialModel() { RawMaterialName = DeviceName, DeviceIp = ip, RawMaterialSource = 1 });
}
}
else
@@ -296,6 +295,15 @@ namespace BPASmartClient.JXJFoodSmallStation.Model

public void Init(string DeviceName)
{
modbusTcp.Show += new Action<string>((s) =>
{
if (s != null) MessageNotify.GetInstance.ShowRunLog(s);
});

modbusTcp.ShowEx += new Action<string>((s) =>
{
if (s != null) MessageNotify.GetInstance.ShowRunLog(s);
});
this.DeviceName = DeviceName;
AlarmHelper<AlarmInfo>.Init();
if (modbusTcp.Connected)
@@ -309,18 +317,17 @@ namespace BPASmartClient.JXJFoodSmallStation.Model
// if (ushortValue.Length >= 1) deviceStatus.RunStatus = ushortValue[0];
//}
deviceStatus.RunStatus = (ushort)this.modbusTcp.ReadShort(DeviceAddress.RunStatus); //获取设备运行状态
deviceStatus.WeightFeedback = (float)this.modbusTcp.GetUint(DeviceAddress.WeightFeedback);//获取设备料仓剩余重量
deviceStatus.WeightFeedback = (Int16)this.modbusTcp.GetUint(DeviceAddress.WeightFeedback);//获取设备料仓剩余重量
deviceStatus.NowWeightFeedback = (float)this.modbusTcp.GetUint(DeviceAddress.CutWeightFeedback);//获取下料重量
deviceStatus.DeviceNum = (ushort)this.modbusTcp.ReadShort(DeviceAddress.DeviceNum);//获取设备编号
deviceStatus.DeviceAlarmCode = (ushort)this.modbusTcp.ReadShort(DeviceAddress.DeviceAlarmCode);//获取设备故障编码
AlarmHelper<AlarmInfo>.GetInstance(DeviceName).EStop1 = deviceStatus.DeviceAlarmCode.Get16bitValue(1);
AlarmHelper<AlarmInfo>.GetInstance(DeviceName).Servo = deviceStatus.DeviceAlarmCode.Get16bitValue(2);
AlarmHelper<AlarmInfo>.GetInstance(DeviceName).Inverter = deviceStatus.DeviceAlarmCode.Get16bitValue(3);
AlarmHelper<AlarmInfo>.GetInstance(DeviceName).EStop2 = deviceStatus.DeviceAlarmCode.Get16bitValue(7);
AlarmHelper<AlarmInfo>.GetInstance(DeviceName).SiloUpperLimit = deviceStatus.DeviceAlarmCode.Get16bitValue(8);
AlarmHelper<AlarmInfo>.GetInstance(DeviceName).SiloLowerLimit = deviceStatus.DeviceAlarmCode.Get16bitValue(9);

AlarmHelper<AlarmInfo>.Alarm.EStop1 = deviceStatus.DeviceAlarmCode.Get16bitValue(1);
AlarmHelper<AlarmInfo>.Alarm.Servo = deviceStatus.DeviceAlarmCode.Get16bitValue(2);
AlarmHelper<AlarmInfo>.Alarm.Inverter = deviceStatus.DeviceAlarmCode.Get16bitValue(3);
AlarmHelper<AlarmInfo>.Alarm.EStop2 = deviceStatus.DeviceAlarmCode.Get16bitValue(7);
AlarmHelper<AlarmInfo>.Alarm.SiloUpperLimit = deviceStatus.DeviceAlarmCode.Get16bitValue(8);
AlarmHelper<AlarmInfo>.Alarm.SiloLowerLimit = deviceStatus.DeviceAlarmCode.Get16bitValue(9);
Thread.Sleep(10);
}), $"{DeviceName} 开始监听", true);
}
@@ -332,7 +339,7 @@ namespace BPASmartClient.JXJFoodSmallStation.Model
this.modbusTcp.SetString(DeviceAddress.DeviceName, name);
}

public string StatusReset()
public bool StatusReset()
{
return this.modbusTcp.Write(DeviceAddress.FinfishStatus, (ushort)1);
//var res = modbusTcp.Read(DeviceAddress.RunStatus);
@@ -351,11 +358,11 @@ namespace BPASmartClient.JXJFoodSmallStation.Model
bool returnValue = modbusTcp.Write(DeviceAddress.Start, (ushort)1);//设备启动写入
if (returnValue)
{
MessageLog.GetInstance.ShowRunLog("发送成功" + returnValue);
MessageNotify.GetInstance.ShowRunLog($"发送成功" + DeviceAddress.Start);
}
else
{
MessageLog.GetInstance.ShowRunLog("发送失败" + returnValue);
MessageNotify.GetInstance.ShowRunLog($"发送失败" + DeviceAddress.Start);
}
//配料设备参数写入
var res = Json<DevicePar>.Data.deviceParModels.FirstOrDefault(p => p.MaterialName == DeviceName);
@@ -369,7 +376,7 @@ namespace BPASmartClient.JXJFoodSmallStation.Model
modbusTcp.SetUint(DeviceAddress.SiloUpperLimitWeight, (uint)res.SiloUpperLimitWeight);
modbusTcp.SetUint(DeviceAddress.LowerLimitWeightOfSilo, (uint)res.LowerLimitWeightOfSilo);
modbusTcp.SetUint(DeviceAddress.StirringSpeed, (uint)res.StirringSpeed * 100);
MessageLog.GetInstance.ShowRunLog($"参数下发完成");
MessageNotify.GetInstance.ShowRunLog($"{res.MaterialName},参数下发完成");
}
}
}


+ 12
- 11
BPASmartClient.JXJFoodSmallStation/Model/Siemens/SiemensDeviceStatus.cs Целия файл

@@ -21,31 +21,32 @@ namespace BPASmartClient.JXJFoodSmallStation.Model.Siemens
{
ThreadManage.GetInstance().StartLong(new Action(() =>
{
var res = this.Siemens_PLC_S7.ReadClass<XL_Start_DB>(1);
var res1 = this.Siemens_PLC_S7.ReadClass<XL_Status_DB>(2);
var res2 = this.Siemens_PLC_S7.ReadClass<XL_Finish_DB>(3);
if (res != null && res.Ask_For_Send_Bit == false && GVL_SmallStation.GetInstance.IsAllowSiemensSendRecipe)
var res = this.Siemens_PLC_S7.ReadClass<XL_Start_DB>(2201);
var res1 = this.Siemens_PLC_S7.ReadClass<XL_Status_DB>(2231);
var res2 = this.Siemens_PLC_S7.ReadClass<XL_Finish_DB>(2261);
var res4 = this.Siemens_PLC_S7.ReadClass<XL_DataColl_DB>(2291);
if (res != null && res.Order_Request_ACK == false && GVL_SmallStation.GetInstance.IsAllowSiemensSendRecipe)
{
res.Ask_For_Send_Bit = true;
res.Order_Request_ACK = true;
this.Siemens_PLC_S7.WriteClass<XL_Start_DB>(res, 1);
}
if (res != null && RTrig.GetInstance("RecipeTrig").Start(res.Ack_Ask_For_Send_Bit))
if (res != null && RTrig.GetInstance("RecipeTrig").Start(res.Order_Request_ACK))
{
ActionManage.GetInstance.Send("SiemensRecipeRecive", res);
res.Ack_Ask_For_Send_Bit = false;
res.Order_Request_ACK = false;
this.Siemens_PLC_S7.WriteClass<XL_Start_DB>(res, 1);
}
if (res1 != null && RTrig.GetInstance("Allow_AGV_Put[0]").Start(res1.Allow_AGV_Put[0]))
if (res1 != null && RTrig.GetInstance("Allow_AGV_Put[0]").Start(res1.Agv1))
{
ActionManage.GetInstance.Send("AGV到工位1信号",res1);
res1.Allow_AGV_Put[0] = false;
res1.Agv1 = false;
this.Siemens_PLC_S7.WriteClass<XL_Status_DB>(res1, 2);
}
if (res1 != null && RTrig.GetInstance("Allow_AGV_Put[1]").Start(res1.Allow_AGV_Put[1]))
if (res1 != null && RTrig.GetInstance("Allow_AGV_Put[1]").Start(res1.Agv2))
{
ActionManage.GetInstance.Send("AGV到工位2信号",res1);
res1.Allow_AGV_Put[1] = false;
res1.Agv1 = false;
this.Siemens_PLC_S7.WriteClass<XL_Status_DB>(res1, 2);
}



+ 39
- 0
BPASmartClient.JXJFoodSmallStation/Model/Siemens/XL_DataColl_DB.cs Целия файл

@@ -0,0 +1,39 @@
using BPASmartClient.S7Net;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace BPASmartClient.JXJFoodSmallStation.Model.Siemens
{
internal class XL_DataColl_DB
{
[Siemens(16)]
public string RecipeCode { get; set; }
[Siemens(16)]
public string RecipeName { get; set; }
public bool var1 { get; set; }
public bool var2 { get; set; }

public bool var3 { get; set; }

public bool var4 { get; set; }

public bool var5 { get; set; }

public bool var6 { get; set; }

public bool var7 { get; set; }

public bool var8 { get; set; }

public bool var9 { get; set; }
public short Mode { get; set; }

public bool[] Alarm { get; set; } = new bool[24];
public int Reserved1 { get; set; }
public int Reserved2 { get; set; }

}
}

+ 32
- 13
BPASmartClient.JXJFoodSmallStation/Model/Siemens/XL_Finish_DB.cs Целия файл

@@ -1,4 +1,5 @@
using System;
using BPASmartClient.S7Net;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
@@ -8,32 +9,50 @@ namespace BPASmartClient.JXJFoodSmallStation.Model.Siemens
{
internal class XL_Finish_DB
{

/// <summary>
/// 生产工单编码
/// 配料完成信号确认
/// </summary>
public string Order_No;
public bool Ask_For_Finish_PLC { get; set; }
public short[] StandbyFinish { get; set; }=new short[4];

[Siemens(16)]
/// <summary>
/// 生产工单编码
/// </summary
public string Order_No { get; set; }

[Siemens(16)]
/// <summary>
/// 产品名称
/// </summary>
public string Product_Code;
public string Product_Code { get; set; }
public short Job_No { get; set; }
public UDT2[] Powder { get; set; } = new UDT2[10];
/// <summary>
/// 原料信息
/// </summary>
public UDT1[] Material = new UDT1[20];
public UDT1[] Material { get; set; } = new UDT1[20];
public short DosingTime { get; set; }
/// <summary>
/// 配料完成信号
/// </summary>
public bool Ask_For_Finish;
/// <summary>
/// 配料完成信号确认
/// </summary>
public bool Ask_For_Finish_PLC;
public bool Ask_For_Finish { get; set; }

public short[] StandbyFinish2 { get; set; } = new short[4];
}
public class UDT1
{
public string Material_Name;
public float Material_Laying_Off_Weight;
public short Material_BarrelNum;

[Siemens(6)]
public string Material_Name { get; set; }
public float Material_Laying_Off_Weight { get; set; }
public short Material_BarrelNum { get; set; }
}
public class UDT2
{
[Siemens(6)]
public string Powder_Name { get; set; }
public float Powder_Weight { get; set; }
}
}

+ 32
- 19
BPASmartClient.JXJFoodSmallStation/Model/Siemens/XL_Start_DB.cs Целия файл

@@ -1,4 +1,5 @@
using System;
using BPASmartClient.S7Net;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
@@ -8,45 +9,57 @@ namespace BPASmartClient.JXJFoodSmallStation.Model.Siemens
{
internal class XL_Start_DB
{
[Siemens(16)]
/// <summary>
/// 配方编码
/// </summary>
public string RecipeCode;
public string RecipeCode { get; set; }
[Siemens(16)]
/// <summary>
/// 配发名称
/// </summary>
public string RecipeName;
public string RecipeName { get; set; }

public short StockCode { get; set; }
public short TrayCode { get; set; }

public UDT2Start[] Powder { get; set; } = new UDT2Start[10];
/// <summary>
/// 物料信息
/// </summary>
public UDT[] Material = new UDT[20];
/// <summary>
/// 托盘编号
/// </summary>
public int TrayCode;
/// <summary>
/// 配方发送请求
/// </summary>
public bool Ask_For_Send_Bit;
public UDTStart[] Material { get; set; } = new UDTStart[20];
/// <summary>
/// 上位机确认配方接收完成
/// plc确认配方接收完成
/// </summary>
public bool Ack_Ask_For_Send_Bit;
public bool Order_Request_ACK { get; set; }
public short[] Standby { get; set; } = new short[4];

public bool Order_Request { get; set; }
public short[] Standby1 { get; set; } = new short[4];

}
public class UDT
public class UDTStart
{
[Siemens(6)]
/// <summary>
/// 原料名称
/// </summary>
public string Material_Name;
public string Material_Name { get; set; }
/// <summary>
/// 原料重量
/// </summary>
public float Material_Weight;
public float Material_Weight { get; set; }
/// <summary>
/// 原料桶号
/// </summary>
public short Material_BarrelNum;
public short Material_BarrelNum { get; set; }
}


public class UDT2Start
{
[Siemens(6)]
public string Powder_Name { get; set; }
public float Powder_Weight { get; set; }
}
}
}

+ 29
- 44
BPASmartClient.JXJFoodSmallStation/Model/Siemens/XL_Status_DB.cs Целия файл

@@ -1,4 +1,5 @@
using System;
using BPASmartClient.S7Net;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
@@ -6,55 +7,39 @@ using System.Threading.Tasks;

namespace BPASmartClient.JXJFoodSmallStation.Model.Siemens
{
internal class XL_Status_DB
public class XL_Status_DB
{
public bool Dosing_Confirm { get; set; }
public bool Agv1 { get; set; }
public bool Agv2 { get; set; }
public bool Agv3 { get; set; }
public bool Agv4 { get; set; }
public short AgvPos { get; set; }
public short[] Standby { get; set; } = new short[3];

[Siemens(16)]
/// <summary>
/// 生产工单
/// </summary>
public string Order_No;
public string Order_No { get; set; }
/// <summary>
/// 配料开始
/// </summary>
public bool Dosing_Start;
/// <summary>
/// 配料开始确认
/// </summary>
public bool Dosing_Confirm;
/// <summary>
/// 托盘占位情况
/// </summary>
public bool[] Pallet_Position_Occ = new bool[16];
/// <summary>
/// 工位允许放货架
/// </summary>
public bool[] Allow_AGV_Put = new bool[16];
/// <summary>
/// 工位允许取货架
/// </summary>
public bool[] Allow_AGV_Get = new bool[16];
/// <summary>
/// AGV请求放货架
/// </summary>
public bool[] AGV_Request_Put = new bool[16];
/// <summary>
/// AGV请求取货架
/// </summary>
public bool[] AGV_Request_Get = new bool[16];
/// <summary>
/// AGV放托盘完成
/// </summary>
public bool[] AGV_Put_Done = new bool[16];
/// <summary>
/// 托盘号
/// </summary>
public short[] Pan_No = new short[16];
/// <summary>
/// 配料时间
/// </summary>
public int DosingTime;
/// <summary>
/// 备用
/// </summary>
public byte Reserve;
public bool Dosing_Start { get; set; }
public bool Agv5 { get; set; }
public bool Agv6 { get; set; }
public bool Agv7 { get; set; }

public UDTStatus[] Powder { get; set; } = new UDTStatus[10];

public short AgvUse { get; set; }
public short[] StandbyStatus { get; set; } = new short[4];
}
public class UDTStatus
{
[Siemens(6)]
public string Powder_Name { get; set; }
public float Powder_Weight { get; set; }
public float Powder_LayingOff_Weight { get; set; }
}
}

+ 0
- 1
BPASmartClient.JXJFoodSmallStation/View/HardwareStatusView.xaml Целия файл

@@ -107,7 +107,6 @@
Text="{Binding RunStatus}" />

</StackPanel>

<Image
Grid.RowSpan="2"
Source="/BPASmartClient.CustomResource;component/Image/光柱.png"


+ 173
- 0
BPASmartClient.JXJFoodSmallStation/View/ManualCommView.xaml Целия файл

@@ -0,0 +1,173 @@
<UserControl
x:Class="BPASmartClient.JXJFoodSmallStation.View.ManualCommView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:BPASmartClient.JXJFoodSmallStation.View"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:pry="clr-namespace:BPASmartClient.CustomResource.UserControls;assembly=BPASmartClient.CustomResource"
xmlns:vm="clr-namespace:BPASmartClient.JXJFoodSmallStation.ViewModel"
d:DesignHeight="850"
d:DesignWidth="1200"
mc:Ignorable="d">

<UserControl.DataContext>
<vm:ManualCommViewModel />
</UserControl.DataContext>

<UserControl.Resources>
<Style x:Key="radioButtonStyle" TargetType="RadioButton">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="RadioButton">
<Grid Name="gr" Opacity="0.8">
<ContentControl
Margin="{TemplateBinding Margin}"
HorizontalAlignment="Center"
VerticalAlignment="Center"
HorizontalContentAlignment="Center"
VerticalContentAlignment="Center"
Content="{TemplateBinding Content}"
FontSize="{TemplateBinding FontSize}"
Foreground="{TemplateBinding Foreground}" />
<Image
Name="image"
Source="/BPASmartClient.CustomResource;component/Image/边框线.png"
Stretch="Fill" />

</Grid>
<ControlTemplate.Triggers>
<Trigger Property="IsChecked" Value="False">
<Setter TargetName="image" Property="Source" Value="/BPASmartClient.CustomResource;component/Image/边框线.png" />
</Trigger>
<Trigger Property="IsChecked" Value="True">
<Setter TargetName="image" Property="Source" Value="/BPASmartClient.CustomResource;component/Image/透明背景.png" />
</Trigger>
<Trigger Property="IsMouseOver" Value="True">
<Setter TargetName="gr" Property="Opacity" Value="1" />
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</UserControl.Resources>

<Grid Margin="10">
<Grid.RowDefinitions>
<RowDefinition Height="40" />
<RowDefinition />
</Grid.RowDefinitions>
<!--#region 表格标题栏设置-->
<Grid
Grid.Row="0"
Margin="0,10,0,0"
Background="#ff0C255F">

<Grid.ColumnDefinitions>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="1*"/>
</Grid.ColumnDefinitions>
<Grid Grid.Column="0">
<TextBlock Text="序号" HorizontalAlignment="Center" VerticalAlignment="Center" Foreground="Aqua"/>
<Border BorderThickness="1,0,1,0" Cursor="SizeWE" />
</Grid>
<TextBlock Grid.Column="1" Text="地址" HorizontalAlignment="Center" VerticalAlignment="Center" Foreground="Aqua" />
<Grid Grid.Column="2">
<TextBlock Text="描述" HorizontalAlignment="Center" VerticalAlignment="Center" Foreground="Aqua" />
<Border BorderThickness="1,0,1,0" Cursor="SizeWE" />
</Grid>
<TextBlock Grid.Column="3" Text="当前值" HorizontalAlignment="Center" VerticalAlignment="Center" Foreground="Aqua" />
<Grid Grid.Column="4">
<TextBlock Text="设定值" HorizontalAlignment="Center" VerticalAlignment="Center" Foreground="Aqua" />
<Border BorderThickness="1,0,1,0" Cursor="SizeWE" />
</Grid>
<TextBlock Grid.Column="5" Text="功能操作" HorizontalAlignment="Center" VerticalAlignment="Center" Foreground="Aqua" />
<Border Grid.ColumnSpan="10" BorderThickness="1,0,1,0" />
</Grid>
<Grid Grid.Row="1">
<ScrollViewer HorizontalScrollBarVisibility="Hidden" VerticalScrollBarVisibility="Hidden" >
<ItemsControl ItemsSource="{Binding PlcInfo}" Foreground="Aqua">
<ItemsControl.ItemTemplate>
<DataTemplate>
<Grid Name="gr" >
<Grid.ColumnDefinitions>
<ColumnDefinition />
<ColumnDefinition />
<ColumnDefinition />
<ColumnDefinition />
<ColumnDefinition />
<ColumnDefinition />
</Grid.ColumnDefinitions>
<Grid Grid.Column="0">
<TextBlock
HorizontalAlignment="Center"
VerticalAlignment="Center"
Text="{Binding SerialNum}" />
<Border
BorderThickness="1,0,1,0"
Cursor="SizeWE" />
</Grid>
<TextBlock
Grid.Column="1"
HorizontalAlignment="Center"
VerticalAlignment="Center"
Text="{Binding Address }" />

<Grid Grid.Column="2">
<TextBlock
HorizontalAlignment="Center"
VerticalAlignment="Center"
Text="{Binding Describe}" />
<Border
BorderThickness="1,0,1,0"
Cursor="SizeWE" />
</Grid>

<TextBlock
HorizontalAlignment="Center"
VerticalAlignment="Center"
Grid.Column="3"
Text="{Binding NowValue}" />
<Grid Grid.Column="4">
<TextBox
Text="{Binding SetValue}" />
<Border
BorderThickness="1,0,1,0"
Cursor="SizeWE" />
</Grid>
<Grid Grid.Column="5">
<pry:IcoButton
Command="{Binding EStopCommand}"
Grid.Column="0"
Margin="40,5,40,5"
Content="设置"
FontSize="20"
Foreground="Aqua"
Style="{StaticResource IcoButtonStyle}" />
<Border
BorderThickness="1,0,1,0"
Cursor="SizeWE" />
</Grid>

<Border
Grid.ColumnSpan="10"
BorderThickness="1,0,1,1" />

</Grid>
<DataTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="true">
<Setter TargetName="gr" Property="Background" Value="#112AB2E7" />
</Trigger>
</DataTemplate.Triggers>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
</ScrollViewer>
</Grid>
</Grid>
</UserControl>

+ 29
- 0
BPASmartClient.JXJFoodSmallStation/View/ManualCommView.xaml.cs Целия файл

@@ -0,0 +1,29 @@
using BPASmartClient.Helper;
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 BPASmartClient.JXJFoodSmallStation.View
{
/// <summary>
/// DeviceMaterialParView.xaml 的交互逻辑
/// </summary>
public partial class ManualCommView : UserControl
{
public ManualCommView()
{
InitializeComponent();
}
}
}

Някои файлове не бяха показани, защото твърде много файлове са промени

Зареждане…
Отказ
Запис