Browse Source

解决冲突

master
pengliangyang 2 years ago
parent
commit
e4950da210
88 changed files with 3902 additions and 1621 deletions
  1. +1
    -1
      BPASmart.PageLoad/BPASmart.PageLoad.csproj
  2. +760
    -593
      BPASmartClient.AGV/AGVHelper.cs
  3. +9
    -9
      BPASmartClient.AGV/AGVModel.cs
  4. +1
    -1
      BPASmartClient.AGV/AGVRequestUrl.cs
  5. +4
    -4
      BPASmartClient.AGV/AGV_PointRollerJobData.cs
  6. +16
    -29
      BPASmartClient.AGV/Feedback/AGVToUpSystem.cs
  7. +53
    -0
      BPASmartClient.AGV/Feedback/EventData.cs
  8. +6
    -13
      BPASmartClient.AGV/Feedback/JobData.cs
  9. +14
    -0
      BPASmartClient.AGV/Feedback/LoadRequest.cs
  10. +14
    -0
      BPASmartClient.AGV/Feedback/TaskData.cs
  11. +25
    -0
      BPASmartClient.AGV/Feedback/TaskEventData.cs
  12. +50
    -41
      BPASmartClient.AGV/Feedback/Upstreamrequest.cs
  13. +1
    -1
      BPASmartClient.AGV/HttpResponseBodyModel.cs
  14. +2
    -2
      BPASmartClient.AGV/HttpResponseData.cs
  15. +1
    -1
      BPASmartClient.AGV/HttpResponseHeaderModel.cs
  16. +3
    -3
      BPASmartClient.AGV/HttpResponseModel.cs
  17. +33
    -17
      BPASmartClient.AgvApi/Controllers/robotjobController.cs
  18. +8
    -4
      BPASmartClient.CustomResource/Pages/Model/AlarmHelper.cs
  19. +2
    -2
      BPASmartClient.CustomResource/Pages/View/LoginView.xaml
  20. +2
    -2
      BPASmartClient.CustomResource/Pages/ViewModel/MainViewModel.cs
  21. +2
    -0
      BPASmartClient.CustomResource/Pages/ViewModel/VariableViewModel.cs
  22. +0
    -9
      BPASmartClient.DATABUS/BPASmartClient.DATABUS.csproj
  23. +7
    -3
      BPASmartClient.Helper/RTrig.cs
  24. +1
    -1
      BPASmartClient.Modbus/ModbusTcp.cs
  25. +14
    -9
      BPASmartClient.Model/柔性味魔方/RawMaterialModel.cs
  26. +0
    -1
      BPASmartClient.SCADAControl/BPASmartClient.SCADAControl.csproj
  27. +0
    -1
      BPASmartClient.SCADAControl/CustomerControls/Silos.xaml.cs
  28. +0
    -1
      BPASmartClient.SCADAControl/CustomerControls/SwitchButton.cs
  29. +1
    -1
      BPASmartClient.SCADAControl/CustomerControls/TheAPI.xaml.cs
  30. +1
    -1
      BPASmartClient.SCADAControl/CustomerControls/TheButton.xaml.cs
  31. +1
    -1
      BPASmartClient.SCADAControl/CustomerControls/TheCheckBox.xaml.cs
  32. +1
    -1
      BPASmartClient.SCADAControl/CustomerControls/TheCylinder.xaml.cs
  33. +1
    -1
      BPASmartClient.SCADAControl/CustomerControls/TheDataGrid.xaml.cs
  34. +1
    -1
      BPASmartClient.SCADAControl/CustomerControls/TheListBox.xaml.cs
  35. +1
    -1
      BPASmartClient.SCADAControl/CustomerControls/TheMQTT.xaml.cs
  36. +1
    -1
      BPASmartClient.SCADAControl/CustomerControls/TheRedis.xaml.cs
  37. +1
    -1
      BPASmartClient.SCADAControl/CustomerControls/TheTextBlock.cs
  38. +1
    -1
      BPASmartClient.SCADAControl/CustomerControls/TheTextBox.cs
  39. +1
    -1
      BPASmartClient.SCADAControl/CustomerControls/TheToggleButton.xaml.cs
  40. +1
    -1
      BPASmartClient.SCADAControl/CustomerControls/TheWuLiaoControl.xaml.cs
  41. +15
    -7
      BPASmartClient.SCADAControl/DATABUS/Class_DataBus.cs
  42. +76
    -0
      BPASmartClient.SmallBatchingSystem/ResourcesStyle/ResourcesStyle.xaml
  43. +4
    -3
      BPASmartClient.SmallBatchingSystem/Views/NewOutletView.xaml
  44. +0
    -2
      BeDesignerSCADA/BeDesignerSCADA.csproj
  45. +0
    -1
      BeDesignerSCADA/Controls/CanvasPanelNew.xaml.cs
  46. +0
    -1
      BeDesignerSCADA/Controls/MainCanvasPanel.xaml.cs
  47. +7
    -7
      BeDesignerSCADA/Helper/SystemHelper.cs
  48. +8
    -0
      DosingSystem/App.xaml.cs
  49. +19
    -1
      DosingSystem/BPASmartClient.DosingSystem.csproj
  50. +12
    -13
      DosingSystem/Model/DeviceInquire.cs
  51. +16
    -0
      DosingSystem/Model/GlobalDevice.cs
  52. +34
    -0
      DosingSystem/Model/OutletInfoModel.cs
  53. +5
    -0
      DosingSystem/Model/RawMaterialDeviceStatus.cs
  54. +13
    -0
      DosingSystem/Model/SiemensPlc/ComputerToPlc.cs
  55. +49
    -0
      DosingSystem/Model/SiemensPlc/PlcToComputer.cs
  56. +2
    -0
      DosingSystem/Model/par/DevicePar.cs
  57. +48
    -0
      DosingSystem/Service/SiemensDevice.cs
  58. +84
    -13
      DosingSystem/View/CommParSetView.xaml
  59. +238
    -0
      DosingSystem/View/NewOutletView.xaml
  60. +29
    -0
      DosingSystem/View/NewOutletView.xaml.cs
  61. +80
    -40
      DosingSystem/View/NewRecipeView.xaml
  62. +3
    -3
      DosingSystem/View/NewRecipeView.xaml.cs
  63. +162
    -0
      DosingSystem/View/OutletManagementView.xaml
  64. +35
    -0
      DosingSystem/View/OutletManagementView.xaml.cs
  65. +4
    -2
      DosingSystem/View/RecipeControlView.xaml
  66. +119
    -0
      DosingSystem/ViewModel/NewOutletViewModel.cs
  67. +28
    -43
      DosingSystem/ViewModel/NewRecipeViewModel.cs
  68. +57
    -0
      DosingSystem/ViewModel/OutletManagementViewModel.cs
  69. +27
    -9
      DosingSystem/ViewModel/RecipeControlViewModel.cs
  70. +22
    -5
      FryPot_DosingSystem/App.config
  71. +14
    -5
      FryPot_DosingSystem/App.xaml.cs
  72. +78
    -11
      FryPot_DosingSystem/Control/DeviceOperate.cs
  73. +1072
    -506
      FryPot_DosingSystem/Control/DosingLogicControl.cs
  74. +75
    -2
      FryPot_DosingSystem/Control/GlobalVariable.cs
  75. +18
    -7
      FryPot_DosingSystem/Model/FlowProcessModel.cs
  76. +6
    -0
      FryPot_DosingSystem/Model/MaterialType.cs
  77. +17
    -2
      FryPot_DosingSystem/View/DebugView.xaml
  78. +73
    -2
      FryPot_DosingSystem/View/DebugView.xaml.cs
  79. +30
    -7
      FryPot_DosingSystem/View/FlowProcessView.xaml
  80. +41
    -82
      FryPot_DosingSystem/View/NewRecipeView.xaml
  81. +68
    -0
      FryPot_DosingSystem/View/NewRecipeView.xaml.cs
  82. +4
    -1
      FryPot_DosingSystem/ViewModel/DeviceListViewModel.cs
  83. +25
    -10
      FryPot_DosingSystem/ViewModel/FlowProcessSetViewModel.cs
  84. +36
    -36
      FryPot_DosingSystem/ViewModel/NewRecipeViewModel.cs
  85. +2
    -28
      SmartClient.sln
  86. +13
    -0
      TestDemo/Form1.Designer.cs
  87. +47
    -12
      TestDemo/Form1.cs
  88. +46
    -0
      TestDemo/PlcToComputer.cs

+ 1
- 1
BPASmart.PageLoad/BPASmart.PageLoad.csproj View File

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



+ 760
- 593
BPASmartClient.AGV/AGVHelper.cs
File diff suppressed because it is too large
View File


+ 9
- 9
BPASmartClient.AGV/AGVModel.cs View File

@@ -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 View File

@@ -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 View File

@@ -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 View File

@@ -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 View File

@@ -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 View File

@@ -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 View File

@@ -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 View File

@@ -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 View File

@@ -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 View File

@@ -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 View File

@@ -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 View File

@@ -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 View File

@@ -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 View File

@@ -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 View File

@@ -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";

}

}


+ 8
- 4
BPASmartClient.CustomResource/Pages/Model/AlarmHelper.cs View File

@@ -17,12 +17,16 @@ 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 = "")
{
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];
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() { }



+ 2
- 2
BPASmartClient.CustomResource/Pages/View/LoginView.xaml View File

@@ -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 />


+ 2
- 2
BPASmartClient.CustomResource/Pages/ViewModel/MainViewModel.cs View File

@@ -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
- 0
BPASmartClient.CustomResource/Pages/ViewModel/VariableViewModel.cs View File

@@ -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;


+ 0
- 9
BPASmartClient.DATABUS/BPASmartClient.DATABUS.csproj View File

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

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

</Project>

+ 7
- 3
BPASmartClient.Helper/RTrig.cs View File

@@ -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() { }



+ 1
- 1
BPASmartClient.Modbus/ModbusTcp.cs View File

@@ -85,7 +85,6 @@ namespace BPASmartClient.Modbus
try
{
tcpClient = new TcpClient(IPAdress, Port);

//mre.Reset();
//tcpClient.BeginConnect(IPAdress, Port, (res) => { mre.Set(); }, null);
//if (!mre.WaitOne(1500, false)) break;
@@ -117,6 +116,7 @@ namespace BPASmartClient.Modbus
if (address == null) return -1;
if (address.Length > 0)
{
address = address.Trim();
if (address.ToUpper().Contains("M") && address.Length >= 4)
{
var res = address.Substring(1).Split('.');


+ 14
- 9
BPASmartClient.Model/柔性味魔方/RawMaterialModel.cs View File

@@ -23,20 +23,32 @@ namespace BPASmartClient.Model
/// </summary>
public string DeviceIp { get; set; }

/// <summary>
/// 料筒位置
/// </summary>
public int Loc { get { return _mLoc; } set { _mLoc = value; OnPropertyChanged(); } }
private int _mLoc;


/// <summary>
/// 原料重量设置
/// </summary>
public uint RawMaterialWeight { get { return _mRawMaterialWeight; } set { _mRawMaterialWeight = value; OnPropertyChanged(); } }
private uint _mRawMaterialWeight;


/// <summary>
/// 原料来源
/// 0:本地
/// 1:设备
/// </summary>
public ushort RawMaterialSource { get { return _mRawMaterialSource; } set { _mRawMaterialSource = value; OnPropertyChanged(); } }
private ushort _mRawMaterialSource;
private ushort _mRawMaterialSource = 1;

/// <summary>
/// 原料ID
/// </summary>
public string RawMaterialId { get { return _mRawMaterialId; } set { _mRawMaterialId = value; OnPropertyChanged(); } }
private string _mRawMaterialId;


/// <summary>
@@ -85,13 +97,6 @@ namespace BPASmartClient.Model
public float UpLimtWeightFeedback { get { return _mUpLimtWeightFeedback; } set { _mUpLimtWeightFeedback = value; OnPropertyChanged(); } }
private float _mUpLimtWeightFeedback;


/// <summary>
/// 原料ID
/// </summary>
public string RawMaterialId { get { return _mRawMaterialId; } set { _mRawMaterialId = value; OnPropertyChanged(); } }
private string _mRawMaterialId;

/// <summary>
/// 原料设备执行状态
/// 1:等待配料


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

@@ -92,7 +92,6 @@

<ItemGroup>
<ProjectReference Include="..\BPASmart.Model\BPASmart.Model.csproj" />
<ProjectReference Include="..\BPASmartClient.DATABUS\BPASmartClient.DATABUS.csproj" />
</ItemGroup>

<ItemGroup>


+ 0
- 1
BPASmartClient.SCADAControl/CustomerControls/Silos.xaml.cs View File

@@ -1,5 +1,4 @@
using BPASmartClient.Compiler;
using BPASmartClient.DATABUS;
using Newtonsoft.Json;
using System;
using System.Collections;


+ 0
- 1
BPASmartClient.SCADAControl/CustomerControls/SwitchButton.cs View File

@@ -1,6 +1,5 @@
using BPASmart.Model;
using BPASmartClient.Compiler;
using BPASmartClient.DATABUS;
using Newtonsoft.Json;
using System;
using System.Collections.Generic;


+ 1
- 1
BPASmartClient.SCADAControl/CustomerControls/TheAPI.xaml.cs View File

@@ -1,6 +1,6 @@
using BPASmart.Model;
using BPASmartClient.Compiler;
using BPASmartClient.DATABUS;
using BPASmartClient.SCADAControl;
using BPASmartClient.SCADAControl.EnumClass;
using Newtonsoft.Json;


+ 1
- 1
BPASmartClient.SCADAControl/CustomerControls/TheButton.xaml.cs View File

@@ -1,5 +1,5 @@
using BPASmartClient.Compiler;
using BPASmartClient.DATABUS;
using System;
using System.Collections.Generic;
using System.ComponentModel;


+ 1
- 1
BPASmartClient.SCADAControl/CustomerControls/TheCheckBox.xaml.cs View File

@@ -1,6 +1,6 @@
using BPASmart.Model;
using BPASmartClient.Compiler;
using BPASmartClient.DATABUS;
using BPASmartClient.SCADAControl;
using Newtonsoft.Json;
using System;


+ 1
- 1
BPASmartClient.SCADAControl/CustomerControls/TheCylinder.xaml.cs View File

@@ -1,5 +1,5 @@
using BPASmartClient.Compiler;
using BPASmartClient.DATABUS;
using System;
using System.Collections.Generic;
using System.Linq;


+ 1
- 1
BPASmartClient.SCADAControl/CustomerControls/TheDataGrid.xaml.cs View File

@@ -1,5 +1,5 @@
using BPASmartClient.Compiler;
using BPASmartClient.DATABUS;
using BPASmartClient.SCADAControl.Converters;
using BPASmartClient.SCADAControl.EnumClass;
using Newtonsoft.Json;


+ 1
- 1
BPASmartClient.SCADAControl/CustomerControls/TheListBox.xaml.cs View File

@@ -1,5 +1,5 @@
using BPASmartClient.Compiler;
using BPASmartClient.DATABUS;
using BPASmartClient.SCADAControl.Converters;
using BPASmartClient.SCADAControl.EnumClass;
using Newtonsoft.Json;


+ 1
- 1
BPASmartClient.SCADAControl/CustomerControls/TheMQTT.xaml.cs View File

@@ -1,6 +1,6 @@
using BPASmart.Model;
using BPASmartClient.Compiler;
using BPASmartClient.DATABUS;
using BPASmartClient.SCADAControl;
using Newtonsoft.Json;
using StackExchange.Redis;


+ 1
- 1
BPASmartClient.SCADAControl/CustomerControls/TheRedis.xaml.cs View File

@@ -1,6 +1,6 @@
using BPASmart.Model;
using BPASmartClient.Compiler;
using BPASmartClient.DATABUS;
using BPASmartClient.SCADAControl;
using Newtonsoft.Json;
using StackExchange.Redis;


+ 1
- 1
BPASmartClient.SCADAControl/CustomerControls/TheTextBlock.cs View File

@@ -1,5 +1,5 @@
using BPASmartClient.Compiler;
using BPASmartClient.DATABUS;
using BPASmartClient.SCADAControl;
using Newtonsoft.Json;
using System;


+ 1
- 1
BPASmartClient.SCADAControl/CustomerControls/TheTextBox.cs View File

@@ -1,6 +1,6 @@
using BPASmart.Model;
using BPASmartClient.Compiler;
using BPASmartClient.DATABUS;
using BPASmartClient.SCADAControl;
using Newtonsoft.Json;
using System;


+ 1
- 1
BPASmartClient.SCADAControl/CustomerControls/TheToggleButton.xaml.cs View File

@@ -1,6 +1,6 @@
using BPASmart.Model;
using BPASmartClient.Compiler;
using BPASmartClient.DATABUS;
using BPASmartClient.SCADAControl;
using Newtonsoft.Json;
using System;


+ 1
- 1
BPASmartClient.SCADAControl/CustomerControls/TheWuLiaoControl.xaml.cs View File

@@ -1,5 +1,5 @@
using BPASmartClient.Compiler;
using BPASmartClient.DATABUS;
using Newtonsoft.Json;
using System;
using System.Collections;


BPASmartClient.DATABUS/Class_DataBus.cs → BPASmartClient.SCADAControl/DATABUS/Class_DataBus.cs View File

@@ -1,6 +1,11 @@
using System.Collections.Concurrent;
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace BPASmartClient.DATABUS
namespace BPASmartClient.SCADAControl
{
/// <summary>
/// 数据总线
@@ -29,10 +34,14 @@ namespace BPASmartClient.DATABUS
/// <summary>
/// 绑定数据
/// </summary>
public Dictionary<string, object> Dic_RedisDataBinding=new Dictionary<string, object>();
public Dictionary<string, object> Dic_RedisDataBinding = new Dictionary<string, object>();
/// <summary>
/// 刷新数据
/// </summary>
/// <param name="Name"></param>
public void refreshDataAction(string Name)
{
BindingAction?.Invoke(Name,null);
BindingAction?.Invoke(Name, null);
}
/// <summary>
/// 缓存Redis数据
@@ -42,15 +51,14 @@ namespace BPASmartClient.DATABUS
/// 缓存Redis数据相关类型
/// </summary>
public ConcurrentDictionary<string, Dictionary<string, string>> Dic_RedisDataType = new ConcurrentDictionary<string, Dictionary<string, string>>();

/// <summary>
/// API数据
/// </summary>
public ConcurrentDictionary<string,string> Dic_APIData = new ConcurrentDictionary<string,string>();
public ConcurrentDictionary<string, string> Dic_APIData = new ConcurrentDictionary<string, string>();
#endregion

#region 配置数据

#endregion
}
}
}

+ 76
- 0
BPASmartClient.SmallBatchingSystem/ResourcesStyle/ResourcesStyle.xaml View File

@@ -42,6 +42,82 @@
</Setter>
</Style>

<!--#region 用户输入框样式-->
<!--
<Style x:Key="UserTextBoxStyle" TargetType="TextBox">
<Setter Property="Background" Value="Transparent" />
<Setter Property="CaretBrush" Value="#009DFF" />
<Setter Property="Foreground" Value="#009dff" />
<Setter Property="BorderBrush" Value="#009dff" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="TextBox">
<Border
x:Name="border"
Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}"
CornerRadius="0"
Opacity="0.8"
SnapsToDevicePixels="true">
<Grid>
-->
<!--<Grid.ColumnDefinitions>
<ColumnDefinition Width="40" />
<ColumnDefinition />
</Grid.ColumnDefinitions>-->
<!--
<Image Source="/BPASmartClient.CustomResource;component/Image/textBox.png" Stretch="Fill" />


-->
<!--<TextBlock
Name="markText"
Grid.Column="1"
Margin="10,0"
HorizontalAlignment="Left"
VerticalAlignment="Center"
FontSize="{TemplateBinding FontSize}"
Foreground="#88009dff"
Text="请输入账号名称"
Visibility="Collapsed" />-->
<!--


<ScrollViewer
x:Name="PART_ContentHost"
Grid.Column="1"
MinHeight="20"
VerticalAlignment="Center"
SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
</Grid>

</Border>

<ControlTemplate.Triggers>
<Trigger Property="IsEnabled" Value="false">
<Setter TargetName="border" Property="Opacity" Value="0.56" />
</Trigger>
<Trigger Property="IsMouseOver" Value="true">
<Setter TargetName="border" Property="Opacity" Value="1" />
</Trigger>
<Trigger Property="IsKeyboardFocused" Value="true">
<Setter TargetName="border" Property="BorderBrush" Value="#FF569DE5" />
</Trigger>
-->
<!--<DataTrigger Binding="{Binding Path=Text, RelativeSource={RelativeSource Mode=self}}" Value="">
<Setter TargetName="markText" Property="Visibility" Value="Visible" />
</DataTrigger>-->
<!--
</ControlTemplate.Triggers>

</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
-->
<!--#endregion-->

<Style x:Key="InputTextboxStyle" TargetType="TextBox">
<Setter Property="Margin" Value="5,0,0,0" />
<Setter Property="BorderThickness" Value="0" />


+ 4
- 3
BPASmartClient.SmallBatchingSystem/Views/NewOutletView.xaml View File

@@ -58,6 +58,7 @@
Name="outName"
Width="180"
Height="35"
Padding="3,0,0,0"
FontSize="20"
Style="{StaticResource TextBoxStyle}"
Text="{Binding OutletName}" />
@@ -104,7 +105,7 @@
Text="{Binding ErrorInfo}" />

<Button
Width="90"
Width="120"
Height="30"
Margin="5,0,5,0"
Command="{Binding AddCommand}"
@@ -113,7 +114,7 @@
Style="{StaticResource ImageButtonStyle}" />

<Button
Width="90"
Width="120"
Height="30"
Margin="5,0,5,0"
Command="{Binding CancelCommand}"
@@ -123,7 +124,7 @@

<Button
Grid.Column="1"
Width="90"
Width="120"
Height="30"
Margin="5,0,5,0"
Command="{Binding SaveCommand}"


+ 0
- 2
BeDesignerSCADA/BeDesignerSCADA.csproj View File

@@ -91,7 +91,6 @@
<PackageReference Include="Microsoft.Toolkit.Mvvm" Version="7.1.2" />
<PackageReference Include="MQTTnet" Version="3.1.2" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
<PackageReference Include="NPinyinPro" Version="0.3.3" />
<PackageReference Include="StackExchange.Redis" Version="2.6.66" />
</ItemGroup>

@@ -125,7 +124,6 @@
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\BPASmart.Model\BPASmart.Model.csproj" />
<ProjectReference Include="..\BPASmartClient.SCADAControl\BPASmartClient.SCADAControl.csproj" />
</ItemGroup>



+ 0
- 1
BeDesignerSCADA/Controls/CanvasPanelNew.xaml.cs View File

@@ -4,7 +4,6 @@ using Newtonsoft.Json;
using BeDesignerSCADA.ViewModel;
using BPASmart.Model;
using BPASmartClient.Compiler;
using BPASmartClient.DATABUS;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;


+ 0
- 1
BeDesignerSCADA/Controls/MainCanvasPanel.xaml.cs View File

@@ -3,7 +3,6 @@ using BeDesignerSCADA.View;
using BeDesignerSCADA.ViewModel;
using BPASmart.Model;
using BPASmartClient.Compiler;
using BPASmartClient.DATABUS;
using System;
using System.Collections.Generic;
using System.ComponentModel;


+ 7
- 7
BeDesignerSCADA/Helper/SystemHelper.cs View File

@@ -259,7 +259,7 @@ namespace BeDesignerSCADA.Helper
for (int i = 0; i < strChinese.Length; i++)
{
var chr = strChinese[i];
fullSpell.Append(GetSpell(chr));
//fullSpell.Append(GetSpell(chr));
}
return fullSpell.ToString().ToUpper();
}
@@ -286,7 +286,7 @@ namespace BeDesignerSCADA.Helper
for (int i = 0; i < strChinese.Length; i++)
{
var chr = strChinese[i];
fullSpell.Append(GetSpell(chr)[0]);
//fullSpell.Append(GetSpell(chr)[0]);
}
return fullSpell.ToString().ToUpper();
}
@@ -299,11 +299,11 @@ namespace BeDesignerSCADA.Helper
return string.Empty;
}

private static string GetSpell(char chr)
{
var coverchr = NPinyin.Pinyin.GetPinyin(chr);
return coverchr;
}
//private static string GetSpell(char chr)
//{
// var coverchr = NPinyin.Pinyin.GetPinyin(chr);
// return coverchr;
//}
}

[StructLayout(LayoutKind.Sequential)]


+ 8
- 0
DosingSystem/App.xaml.cs View File

@@ -102,6 +102,14 @@ namespace BPASmartClient.DosingSystem
ToggleWindowPath = "View.CommParSetView"
});

ParSet.Add(new SubMenumodel()
{
SubMenuName = "出料口管理设置",
SubMenuPermission = new Permission[] { Permission.管理员 },
AssemblyName = "BPASmartClient.DosingSystem",
ToggleWindowPath = "View.OutletManagementView"
});

MenuManage.GetInstance.menuModels.Add(new MenuModel()
{
MainMenuIcon = "&#xe62d;",


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

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

<ItemGroup>
<PackageReference Include="BPA.Helper" Version="1.0.17" />
<PackageReference Include="BPA.Message" Version="1.0.46" />
<PackageReference Include="Microsoft.Toolkit.Mvvm" Version="7.1.2" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
@@ -24,10 +25,27 @@
<ItemGroup>
<ProjectReference Include="..\BPASmartClient.CustomResource\BPASmartClient.CustomResource.csproj" />
<ProjectReference Include="..\BPASmartClient.Modbus\BPASmartClient.Modbus.csproj" />
<ProjectReference Include="..\BPASmartClient.S7Net\BPASmartClient.S7Net.csproj" />
</ItemGroup>

<ItemGroup>
<Folder Include="Service\" />
<Compile Update="View\NewOutletView.xaml.cs">
<SubType>Code</SubType>
</Compile>
<Compile Update="View\OutletManagementView.xaml.cs">
<SubType>Code</SubType>
</Compile>
</ItemGroup>

<ItemGroup>
<Page Update="View\NewOutletView.xaml">
<XamlRuntime>$(DefaultXamlRuntime)</XamlRuntime>
<SubType>Designer</SubType>
</Page>
<Page Update="View\OutletManagementView.xaml">
<XamlRuntime>$(DefaultXamlRuntime)</XamlRuntime>
<SubType>Designer</SubType>
</Page>
</ItemGroup>

</Project>

+ 12
- 13
DosingSystem/Model/DeviceInquire.cs View File

@@ -66,6 +66,7 @@ namespace BPASmartClient.DosingSystem
{
for (int i = 0; i < 8; i++)
{
DeviceLists.TryAdd($"192.168.1.{i + 1}", new DeviceStatus() { DeviceName = $"测试设备{i + 1}" });
TopDeviceCurrentStatuses.Add(new DeviceCurrentStatus()
{
DeviceName = $"测试设备{i + 1}",
@@ -86,6 +87,7 @@ namespace BPASmartClient.DosingSystem

for (int i = 8; i < 16; i++)
{
DeviceLists.TryAdd($"192.168.1.{i + 1}", new DeviceStatus() { DeviceName = $"测试设备{i + 1}" });
BottomDeviceCurrentStatuses.Add(new DeviceCurrentStatus()
{
DeviceName = $"测试设备{i + 1}",
@@ -129,8 +131,10 @@ namespace BPASmartClient.DosingSystem
{
if (ip != null)
{
var res = DeviceLists.Values.FirstOrDefault(p => p.IpAddress == ip);
if (res != null) return res;
if (DeviceLists.ContainsKey(ip)) return DeviceLists[ip];
else return new DeviceStatus();
//var res = DeviceLists.Values.FirstOrDefault(p => p.IpAddress == ip);
//if (res != null) return res;
}
return new DeviceStatus();
}
@@ -295,24 +299,18 @@ namespace BPASmartClient.DosingSystem

public void Init(string DeviceName)
{
modbusTcp.Show = new Action<string>((s) => { MessageNotify.GetInstance.ShowRunLog(s); });
modbusTcp.ShowEx = new Action<string>((s) => { MessageNotify.GetInstance.ShowRunLog(s); });
this.DeviceName = DeviceName;
AlarmHelper<AlarmInfo>.Init();
//AlarmHelper<AlarmInfo>.Alarm.EStop1 = true;
if (modbusTcp.Connected)
{
ThreadManage.GetInstance().StartLong(new Action(() =>
{
//获取设备运行状态
//var res = this.modbusTcp.Read(DeviceAddress.RunStatus);
//if (res != null && res is ushort[] ushortValue)
//{
// if (ushortValue.Length >= 1) deviceStatus.RunStatus = ushortValue[0];
//}


this.DeviceName = modbusTcp.GetString(DeviceAddress.DeviceName, 20).Trim()?.Replace(" ", "");
this.DeviceName = modbusTcp.GetString(DeviceAddress.DeviceName, 20)?.Trim()?.Replace(" ", "");
deviceStatus.RunStatus = (ushort)this.modbusTcp.ReadShort(DeviceAddress.RunStatus); //获取设备运行状态
deviceStatus.WeightFeedback = (float)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);//获取设备故障编码

@@ -322,7 +320,7 @@ namespace BPASmartClient.DosingSystem
AlarmHelper<AlarmInfo>.GetInstance(DeviceName).EStop2 = deviceStatus.DeviceAlarmCode.GetBitValue(7);
AlarmHelper<AlarmInfo>.GetInstance(DeviceName).SiloUpperLimit = deviceStatus.DeviceAlarmCode.GetBitValue(8);
AlarmHelper<AlarmInfo>.GetInstance(DeviceName).SiloLowerLimit = deviceStatus.DeviceAlarmCode.GetBitValue(9);
Thread.Sleep(100);
Thread.Sleep(10);
}), $"{DeviceName} 开始监听", true);
}
}
@@ -362,6 +360,7 @@ namespace BPASmartClient.DosingSystem
modbusTcp.SetUint(DeviceAddress.SiloUpperLimitWeight, (uint)res.SiloUpperLimitWeight);
modbusTcp.SetUint(DeviceAddress.LowerLimitWeightOfSilo, (uint)res.LowerLimitWeightOfSilo);
modbusTcp.SetUint(DeviceAddress.StirringSpeed, (uint)res.StirringSpeed * 100);
MessageNotify.GetInstance.ShowRunLog($"{res.MaterialName},参数下发完成");
}
}
}


+ 16
- 0
DosingSystem/Model/GlobalDevice.cs View File

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

namespace BPASmartClient.DosingSystem
{
public class GlobalDevice
{
/// <summary>
/// PLC 设备数据
/// </summary>
public static PlcToComputer PlcData { get; set; } = new PlcToComputer();
}
}

+ 34
- 0
DosingSystem/Model/OutletInfoModel.cs View File

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

namespace BPASmartClient.DosingSystem
{
/// <summary>
/// 出料口信息
/// </summary>
public class OutletInfoModel : ObservableObject
{
/// <summary>
/// 出料口名称
/// </summary>
public string OutletName { get { return _mOutletName; } set { _mOutletName = value; OnPropertyChanged(); } }
private string _mOutletName;

/// <summary>
/// 出料口位置
/// </summary>
public int OutletLoc { get { return _mOutletLoc; } set { _mOutletLoc = value; OnPropertyChanged(); } }
private int _mOutletLoc;

/// <summary>
/// 出料口对应的料仓信息
/// </summary>
public ObservableCollection<string> SiloInfos { get; set; } = new ObservableCollection<string>();

}
}

+ 5
- 0
DosingSystem/Model/RawMaterialDeviceStatus.cs View File

@@ -22,6 +22,11 @@ namespace BPASmartClient.DosingSystem
/// </summary>
public float WeightFeedback { get; set; }

/// <summary>
/// 当前出料重量反馈
/// </summary>
public float NowWeightFeedback { get; set; }

/// <summary>
/// 上限反馈
/// </summary>


+ 13
- 0
DosingSystem/Model/SiemensPlc/ComputerToPlc.cs View File

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

namespace BPASmartClient.DosingSystem.Model
{

public class ComputerToPlc
{
}
}

+ 49
- 0
DosingSystem/Model/SiemensPlc/PlcToComputer.cs View File

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

namespace BPASmartClient.DosingSystem
{
/// <summary>
/// PLC 到上位机数据
/// </summary>
public class PlcToComputer
{
/// <summary>
/// 心跳
/// </summary>
public bool Heartbeat { get; set; }

/// <summary>
/// 接收完成
/// </summary>
public bool ResComplete { get; set; }

/// <summary>
/// 系统系统或停止
/// </summary>
public bool SystemStartOrStop { get; set; }

/// <summary>
/// 手自动切换
/// </summary>
public bool HandOrAuto { get; set; }

/// <summary>
/// 桶位置反馈
/// </summary>
public int[] LocationFeedback { get; set; } = new int[32];

/// <summary>
/// 是否允许配料
/// </summary>
public bool[] IsAllowIngredients { get; set; } = new bool[32];

/// <summary>
/// 报警信息
/// </summary>
public bool[] ArrayInfo { get; set; } = new bool[32];
}
}

+ 2
- 0
DosingSystem/Model/par/DevicePar.cs View File

@@ -15,6 +15,8 @@ namespace BPASmartClient.DosingSystem
/// </summary>
public ObservableCollection<DeviceParModel> deviceParModels { get; set; } = new ObservableCollection<DeviceParModel>();

public ObservableCollection<OutletInfoModel> OutletInfoModels { get; set; } = new ObservableCollection<OutletInfoModel>();

/// <summary>
/// 设备扫描网段
/// </summary>


+ 48
- 0
DosingSystem/Service/SiemensDevice.cs View File

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

namespace BPASmartClient.DosingSystem
{
public class SiemensDevice
{
private volatile static SiemensDevice _Instance;
public static SiemensDevice GetInstance => _Instance ?? (_Instance = new SiemensDevice());
private SiemensDevice() { }

public SiemensHelper MySiemens { get; set; } = new SiemensHelper();

private bool IsConnect { get; set; }

public void Connect(string ip)
{
while (!MySiemens.IsConnected)
{
MySiemens.Connect(S7.Net.CpuType.S71200, ip);
Thread.Sleep(2000);
}
IsConnect = MySiemens.IsConnected;
bool tempValue = false;
ThreadManage.GetInstance().StartLong(new Action(() =>
{
if (IsConnect) MySiemens.Write("DB4.DBX0.0", !tempValue);
Thread.Sleep(1);
}), "设备心跳", true);

ThreadManage.GetInstance().StartLong(new Action(() =>
{
GlobalDevice.PlcData = MySiemens.ReadClass<PlcToComputer>(3);
Thread.Sleep(50);
}), "读取输送线设备数据", true);

}



}
}

+ 84
- 13
DosingSystem/View/CommParSetView.xaml View File

@@ -15,31 +15,102 @@
</UserControl.DataContext>

<Grid>
<StackPanel
Margin="0,10,0,0"
VerticalAlignment="Top"
Orientation="Horizontal">

<Grid.RowDefinitions>
<RowDefinition Height="50" />
<RowDefinition />
</Grid.RowDefinitions>

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

<Button
Width="120"
Grid.Column="3"
Height="30"
HorizontalAlignment="Left"
Margin="5,0,5,0"
Command="{Binding SaveCommand}"
Content="保存参数"
FontSize="20"
Style="{StaticResource ImageButtonStyle}" />

<Grid Grid.ColumnSpan="4" Grid.Row="1">
<Grid.ColumnDefinitions>
<ColumnDefinition />
<ColumnDefinition />
<ColumnDefinition />
<ColumnDefinition />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition />
<RowDefinition />
<RowDefinition />
<RowDefinition />
<RowDefinition />
<RowDefinition />
<RowDefinition />
</Grid.RowDefinitions>

<TextBlock
Margin="10,0,0,0"
HorizontalAlignment="Right"
Style="{StaticResource TextBlockStyle}"
Text="配料设备网段地址:" />

<TextBox
Grid.Column="1"
Width="180"
Height="35"
Margin="0,0,0,0"
HorizontalAlignment="Left"
FontSize="20"
Style="{StaticResource TextBoxStyle}"
Text="{Binding Address}" />

<TextBlock
Grid.Column="2"
Margin="10,0,0,0"
HorizontalAlignment="Right"
Style="{StaticResource TextBlockStyle}"
Text="设备网段地址设置:" />
Text="输送带PLC地址:" />

<TextBox
Grid.Column="3"
Width="180"
Height="35"
Margin="0,0,0,0"
HorizontalAlignment="Left"
FontSize="20"
Style="{StaticResource TextBoxStyle}"
Text="{Binding Address}" />
<Button
Width="90"
Height="30"
Margin="5,0,5,0"
Command="{Binding SaveCommand}"
Content="保存参数"

<TextBlock
Grid.Row="1"
Grid.Column="0"
Margin="10,0,0,0"
HorizontalAlignment="Right"
Style="{StaticResource TextBlockStyle}"
Text="输送带PLC地址:" />

<TextBox
Grid.Row="1"
Grid.Column="1"
Width="180"
Height="35"
Margin="0,0,0,0"
HorizontalAlignment="Left"
FontSize="20"
Style="{StaticResource ImageButtonStyle}" />
Style="{StaticResource TextBoxStyle}"
Text="{Binding Address}" />


</Grid>


</StackPanel>
</Grid>
</UserControl>

+ 238
- 0
DosingSystem/View/NewOutletView.xaml View File

@@ -0,0 +1,238 @@
<Window
x:Class="BPASmartClient.DosingSystem.View.NewOutletView"
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;assembly=BPASmartClient.CustomResource"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:BPASmartClient.DosingSystem.View"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:vm="clr-namespace:BPASmartClient.DosingSystem.ViewModel"
Title="NewOutletView"
Width="600"
Height="400"
AllowsTransparency="True"
Background="{x:Null}"
Topmost="True"
WindowStartupLocation="CenterScreen"
WindowStyle="None"
mc:Ignorable="d">

<Window.DataContext>
<vm:NewOutletViewModel />
</Window.DataContext>

<Grid>
<Grid.Background>
<ImageBrush ImageSource="/BPASmartClient.CustomResource;component/Image/容器边框.png" />
</Grid.Background>

<Grid.RowDefinitions>
<RowDefinition Height="0.18*" />
<RowDefinition />
</Grid.RowDefinitions>

<TextBlock
HorizontalAlignment="Center"
VerticalAlignment="Center"
FontSize="20"
Foreground="{StaticResource FontColor}"
Text="新建出料口" />

<Grid Grid.Row="1">
<Grid.RowDefinitions>
<RowDefinition Height="0.2*" />
<RowDefinition Height="0.2*" />
<RowDefinition />
</Grid.RowDefinitions>


<StackPanel Orientation="Horizontal">
<TextBlock
Margin="15,0,0,0"
HorizontalAlignment="Left"
FontSize="16"
Style="{StaticResource TextBlockStyle}"
Text="出料口名称:" />

<TextBox
Name="outName"
Width="180"
Height="35"
FontSize="20"
Style="{StaticResource TextBoxStyle}"
Text="{Binding OutletName}" />

<TextBlock
Margin="15,0,0,0"
HorizontalAlignment="Left"
FontSize="16"
Style="{StaticResource TextBlockStyle}"
Text="出料口位置:" />

<TextBox
Name="outLoc"
Width="180"
Height="35"
Margin="5,0,0,0"
FontSize="20"
Style="{StaticResource TextBoxStyle}"
Text="{Binding OutletLoc}" />
</StackPanel>



<StackPanel
Grid.Row="1"
Margin="10,0,0,0"
HorizontalAlignment="Right"
Orientation="Horizontal">

<!--<TextBox
Name="outName"
Width="180"
Height="35"
Margin="5,0,0,0"
FontSize="20"
Style="{StaticResource TextBoxStyle}" />-->

<TextBlock
Margin="0,0,5,0"
HorizontalAlignment="Center"
VerticalAlignment="Center"
FontSize="20"
Foreground="#FFF53F62"
Text="{Binding ErrorInfo}" />

<Button
Width="90"
Height="30"
Margin="5,0,5,0"
Command="{Binding AddCommand}"
Content="添加原料"
FontSize="20"
Style="{StaticResource ImageButtonStyle}" />

<Button
Width="90"
Height="30"
Margin="5,0,5,0"
Command="{Binding CancelCommand}"
Content="取消"
FontSize="20"
Style="{StaticResource ImageButtonStyle}" />

<Button
Grid.Column="1"
Width="90"
Height="30"
Margin="5,0,5,0"
Command="{Binding SaveCommand}"
Content="保存"
FontSize="20"
Style="{StaticResource ImageButtonStyle}" />
</StackPanel>

<Grid Grid.Row="2" Margin="15,0,10,10">

<Grid.RowDefinitions>
<RowDefinition Height="35" />
<RowDefinition />
</Grid.RowDefinitions>

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

<Grid.ColumnDefinitions>
<ColumnDefinition />
<ColumnDefinition Width="0.68*" />
</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>

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

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

<ScrollViewer
Grid.Row="1"
HorizontalScrollBarVisibility="Hidden"
VerticalScrollBarVisibility="Hidden">
<ItemsControl ItemsSource="{Binding SiloInfos}">
<ItemsControl.ItemTemplate>
<DataTemplate>
<!--<RadioButton Content="{Binding RawMaterialName}" Name="rb" GroupName="all">
<RadioButton.Template>
<ControlTemplate TargetType="RadioButton">-->
<Grid Name="gr" Height="30">
<Grid.ColumnDefinitions>
<ColumnDefinition />
<ColumnDefinition Width="0.68*" />
</Grid.ColumnDefinitions>

<ComboBox
Name="cb"
Grid.Column="0"
Height="{Binding ElementName=gr, Path=ActualHeight}"
VerticalAlignment="Center"
HorizontalContentAlignment="Left"
BorderBrush="#FF074B92"
BorderThickness="1"
FontFamily="楷体"
FontSize="20"
Foreground="#FF2AB2E7"
IsEditable="False"
ItemsSource="{Binding DataContext.SileName, RelativeSource={RelativeSource AncestorType=ItemsControl, Mode=FindAncestor}}"
SelectedIndex="{Binding SelectIndex}"
Style="{StaticResource ComboBoxStyle}"
Text="{Binding RawMaterialName}" />

<Button
Grid.Column="1"
Command="{Binding DataContext.RemoveCommand, RelativeSource={RelativeSource AncestorType=ItemsControl, Mode=FindAncestor}}"
CommandParameter="{Binding RawMaterialName}"
Content="删除"
FontSize="16"
Style="{StaticResource ControlButtonStyle}" />

<!--<Button
Grid.Column="1"
Width="80"
Command="{Binding DataContext.RemoveCommand, RelativeSource={RelativeSource AncestorType=ItemsControl, Mode=FindAncestor}}"
CommandParameter="{Binding RawMaterialName}"
Content="删除" />-->

</Grid>


<!--</ControlTemplate>
</RadioButton.Template>
</RadioButton>-->
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
</ScrollViewer>

</Grid>



</Grid>

</Grid>
</Window>

+ 29
- 0
DosingSystem/View/NewOutletView.xaml.cs View File

@@ -0,0 +1,29 @@
using BPA.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.Shapes;

namespace BPASmartClient.DosingSystem.View
{
/// <summary>
/// NewOutletView.xaml 的交互逻辑
/// </summary>
public partial class NewOutletView : Window
{
public NewOutletView()
{
InitializeComponent();
ActionManage.GetInstance.Register(new Action(() => { this.Close(); }), "NewOutletViewClose", true);
}
}
}

+ 80
- 40
DosingSystem/View/NewRecipeView.xaml View File

@@ -89,6 +89,7 @@
<Grid.RowDefinitions>
<RowDefinition Height="40" />
<RowDefinition Height="40" />
<RowDefinition Height="30" />
<RowDefinition />
</Grid.RowDefinitions>

@@ -143,9 +144,56 @@

</StackPanel>

<ScrollViewer
<!--#region 表格标题栏设置-->
<Grid
Grid.Row="2"
Margin="5"
Margin="5,0"
Background="#ff0C255F">

<Grid.ColumnDefinitions>
<ColumnDefinition />
<ColumnDefinition Width="0.7*" />
<ColumnDefinition Width="0.7*" />
<ColumnDefinition Width="0.7*" />
</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>

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

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

<ScrollViewer
Grid.Row="3"
Margin="5,0"
HorizontalScrollBarVisibility="Hidden"
VerticalScrollBarVisibility="Hidden">
<ItemsControl ItemsSource="{Binding RawMaterials}">
@@ -154,17 +202,18 @@
<RadioButton GroupName="all">
<RadioButton.Template>
<ControlTemplate TargetType="RadioButton">
<Grid Name="gr" Height="40">
<Grid Name="gr" Height="35">
<Grid.ColumnDefinitions>
<ColumnDefinition />
<ColumnDefinition />
<ColumnDefinition Width="0.5*" />
<ColumnDefinition Width="0.7*" />
<ColumnDefinition Width="0.7*" />
<ColumnDefinition Width="0.7*" />
</Grid.ColumnDefinitions>

<ComboBox
Name="cb"
Grid.Column="0"
Margin="3,1"
Height="{Binding ElementName=gr, Path=ActualHeight}"
VerticalAlignment="Center"
BorderBrush="#FF074B92"
BorderThickness="1"
@@ -177,48 +226,39 @@
Style="{StaticResource ComboBoxStyle}"
Text="{Binding RawMaterialName}" />

<!--<TextBox
Name="cb"
Grid.Column="0"
Margin="3,1"
<TextBox
Grid.Column="1"
Height="{Binding ElementName=gr, Path=ActualHeight}"
VerticalAlignment="Center"
BorderBrush="#FF074B92"
BorderThickness="1"
FontFamily="楷体"
FontSize="20"
Foreground="#FF2AB2E7"
Text="{Binding RawMaterialName}" />-->
<StackPanel
Grid.Column="1"
Text="{Binding Loc}" />

<TextBox
Name="tb"
Grid.Column="2"
Height="{Binding ElementName=gr, Path=ActualHeight}"
VerticalAlignment="Center"
FontSize="20"
Foreground="#FF2AB2E7"
Text="{Binding RawMaterialWeight}" />

<TextBlock
Grid.Column="2"
Margin="0,0,8,4"
HorizontalAlignment="Right"
VerticalAlignment="Center"
Orientation="Horizontal">
<TextBox
Name="tb"
Grid.Column="1"
Width="150"
Height="29"
Margin="3,1"
VerticalAlignment="Center"
FontSize="20"
Text="{Binding RawMaterialWeight}" />

<TextBlock
Grid.Column="1"
Margin="0,0,8,4"
HorizontalAlignment="Right"
VerticalAlignment="Center"
FontSize="20"
Text="g" />

</StackPanel>
FontSize="20"
Foreground="#FF2AB2E7"
Text="g" />

<Button
Grid.Column="2"
Width="80"
Margin="25,0,0,0"
Grid.Column="3"
Command="{Binding DataContext.RemoveCommand, RelativeSource={RelativeSource AncestorType=ItemsControl, Mode=FindAncestor}}"
CommandParameter="{Binding RawMaterialId}"
Content="删除" />
Content="删除"
FontSize="16"
Style="{StaticResource ControlButtonStyle}" />

</Grid>



+ 3
- 3
DosingSystem/View/NewRecipeView.xaml.cs View File

@@ -1,4 +1,4 @@
using BPASmartClient.Helper;
using BPA.Helper;
using System;
using System.Collections.Generic;
using System.Linq;
@@ -25,8 +25,8 @@ namespace BPASmartClient.DosingSystem.View
InitializeComponent();
this.btClose.Click += (o, e) => { this.Close(); };
this.br.MouseLeftButtonDown += (o, e) => { if (e.LeftButton == MouseButtonState.Pressed) this.DragMove(); };
ActionManage.GetInstance.CancelRegister("CloseNewRecipeView");
ActionManage.GetInstance.Register(new Action(() => { this.Close(); }), "CloseNewRecipeView");
ActionManage.GetInstance.Register(new Action(() => { this.Close(); }), "CloseNewRecipeView", true);
this.Unloaded += (o, s) => { Json<LocaPar>.Save(); };
}
}
}

+ 162
- 0
DosingSystem/View/OutletManagementView.xaml View File

@@ -0,0 +1,162 @@
<UserControl
x:Class="BPASmartClient.DosingSystem.View.OutletManagementView"
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;assembly=BPASmartClient.CustomResource"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:BPASmartClient.DosingSystem.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.DosingSystem.ViewModel"
d:DesignHeight="450"
d:DesignWidth="800"
mc:Ignorable="d">

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

<Grid Margin="10">
<Grid.RowDefinitions>
<RowDefinition Height="40" />
<RowDefinition />
</Grid.RowDefinitions>

<StackPanel HorizontalAlignment="Right" Orientation="Horizontal">
<Button
Width="150"
Height="40"
Margin="10,0,10,0"
Command="{Binding AddCommand}"
Content="添加出料口"
FontSize="20"
Style="{StaticResource ImageButtonStyle}" />
<Button
Width="150"
Height="40"
Margin="10,0,10,0"
Command="{Binding SaveCommand}"
Content="保存参数"
FontSize="20"
Style="{StaticResource ImageButtonStyle}" />
</StackPanel>

<Grid Grid.Row="1">
<ListView
Margin="10"
Background="Transparent"
BorderBrush="#00BEFA"
BorderThickness="0"
ItemsSource="{Binding OutletInfoModels}"
ScrollViewer.HorizontalScrollBarVisibility="Disabled">
<ListView.ItemsPanel>
<ItemsPanelTemplate>
<WrapPanel Orientation="Horizontal" />
</ItemsPanelTemplate>
</ListView.ItemsPanel>

<ListView.ItemTemplate>
<DataTemplate>
<Border
Name="ShadowElement"
Width="180"
Height="150"
Margin="10"
VerticalAlignment="Top"
BorderBrush="#00BEFA"
BorderThickness="0"
ClipToBounds="True"
CornerRadius="0">
<Border.Background>
<ImageBrush ImageSource="/BPASmartClient.CustomResource;component/Image/蓝色背景.png" Stretch="Fill" />
</Border.Background>

<Grid Margin="20,0">

<Grid.RowDefinitions>
<RowDefinition />
<RowDefinition />
<RowDefinition />
</Grid.RowDefinitions>

<TextBlock
Grid.Row="0"
Grid.ColumnSpan="2"
Margin="0,10,0,0"
VerticalAlignment="Center"
FontSize="20"
Foreground="#00BEFA"
Text="{Binding OutletName}" />

<StackPanel
Grid.Row="1"
VerticalAlignment="Center"
Orientation="Horizontal">
<TextBlock
Grid.Row="1"
FontSize="14"
Foreground="#aa00BEFA"
Text="出料口位置:" />
<TextBlock
Grid.Row="1"
FontSize="14"
Foreground="#aa00BEFA"
Text="{Binding OutletLoc}" />
</StackPanel>

<Grid
Name="gr"
Grid.Row="2"
Height="30"
Margin="0,0,0,10">
<Grid.ColumnDefinitions>
<ColumnDefinition />
<ColumnDefinition />
</Grid.ColumnDefinitions>

<pry:IcoButton
Width="{Binding ElementName=gr, Path=ActualWidth}"
Height="{Binding ElementName=gr, Path=ActualHeight}"
Margin="4,4,3,0"
HorizontalAlignment="Center"
VerticalAlignment="Center"
Background="#11F53F62"
BorderThickness="0"
Command="{Binding DataContext.RemoveCommand, RelativeSource={RelativeSource AncestorType=ListBox, Mode=FindAncestor}}"
CommandParameter="{Binding OutletName}"
Content="删除"
EnterBackground="#22F53F62"
FontStyle="Normal"
Foreground="#FFF53F62"
IcoText="&#xe68e;"
Style="{StaticResource IcoButtonStyle}" />

<pry:IcoButton
Grid.Column="1"
Width="{Binding ElementName=gr, Path=ActualWidth}"
Height="{Binding ElementName=gr, Path=ActualHeight}"
Margin="3,4,4,0"
HorizontalAlignment="Center"
VerticalAlignment="Center"
Background="#112AB2E7"
BorderThickness="0"
Command="{Binding DataContext.DetailsCommand, RelativeSource={RelativeSource AncestorType=ListBox, Mode=FindAncestor}}"
CommandParameter="{Binding OutletName}"
Content="编辑"
EnterBackground="#222AB2E7"
Foreground="#FF2AB2E7"
IcoText="&#xe636;"
Style="{StaticResource IcoButtonStyle}" />

</Grid>
</Grid>
</Border>

</DataTemplate>
</ListView.ItemTemplate>
</ListView>
</Grid>


</Grid>
</UserControl>

+ 35
- 0
DosingSystem/View/OutletManagementView.xaml.cs View File

@@ -0,0 +1,35 @@
using BPA.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.DosingSystem.View
{
/// <summary>
/// OutletManagementView.xaml 的交互逻辑
/// </summary>
public partial class OutletManagementView : UserControl
{
public OutletManagementView()
{
InitializeComponent();
this.Unloaded += OutletManagementView_Unloaded;
}

private void OutletManagementView_Unloaded(object sender, RoutedEventArgs e)
{
Json<DevicePar>.Save();
}
}
}

+ 4
- 2
DosingSystem/View/RecipeControlView.xaml View File

@@ -338,10 +338,11 @@
ScrollViewer.HorizontalScrollBarVisibility="Disabled">
<ListBox.ItemsPanel>
<ItemsPanelTemplate>
<UniformGrid
<!--<UniformGrid
HorizontalAlignment="Left"
VerticalAlignment="Top"
Columns="6" />
Columns="6" />-->
<WrapPanel Orientation="Horizontal" />
</ItemsPanelTemplate>
</ListBox.ItemsPanel>

@@ -351,6 +352,7 @@
<Grid
Name="tt"
Height="220"
Width="180"
Margin="5">
<Grid.RowDefinitions>
<RowDefinition Height="30" />


+ 119
- 0
DosingSystem/ViewModel/NewOutletViewModel.cs View File

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

namespace BPASmartClient.DosingSystem.ViewModel
{
public class NewOutletViewModel : ViewModelBase
{
public NewOutletViewModel()
{
DeviceInquire.GetInstance.devices.ToList()?.ForEach(item => { SileName.Add($"{item.DeviceName}"); });
ActionManage.GetInstance.Register(new Action<object>((o) =>
{
if (o != null && o is OutletInfoModel tempOutletInfo)
{
OutletName = tempOutletInfo.OutletName;
OutletLoc = tempOutletInfo.OutletLoc;
tempOutletInfo.SiloInfos?.ToList()?.ForEach((item =>
{
int tempIndex = Array.FindIndex(SileName.ToArray(), p => p == item);
SiloInfos.Add(new RawMaterialInfo() { RawMaterialName = item, SelectIndex = tempIndex });
}));
Index = Array.FindIndex(Json<DevicePar>.Data.OutletInfoModels.ToArray(), p => p.OutletName == tempOutletInfo.OutletName);
}
}), "OpenNewOutlet", true);
AddCommand = new RelayCommand(() => { SiloInfos.Add(new RawMaterialInfo()); });
CancelCommand = new RelayCommand(() => { ActionManage.GetInstance.Send("NewOutletViewClose"); });
SaveCommand = new RelayCommand(() =>
{
ObservableCollection<string> SileNames = new ObservableCollection<string>();
SiloInfos.ToList()?.ForEach(item => { SileNames.Add(item.RawMaterialName); });
if (Index >= 0 && Index < Json<DevicePar>.Data.OutletInfoModels.Count)
{
var array = Json<DevicePar>.Data.OutletInfoModels.ToArray();
var res = Array.FindIndex(array, p => p.OutletName == OutletName);
if (res >= 0 && res != Index)
{
ErrorInfo = "出料口名称已经存在!";
return;
}

var temp = Array.FindIndex(array, p => p.OutletLoc == OutletLoc);
if (temp >= 0 && temp != Index)
{
ErrorInfo = "出料口位置已存在!";
return;
}
Json<DevicePar>.Data.OutletInfoModels.ElementAt(Index).OutletName = OutletName;
Json<DevicePar>.Data.OutletInfoModels.ElementAt(Index).OutletLoc = OutletLoc;
Json<DevicePar>.Data.OutletInfoModels.ElementAt(Index).SiloInfos.Clear();
Json<DevicePar>.Data.OutletInfoModels.ElementAt(Index).SiloInfos = SileNames;
//Control.GetInstance.OperationLog($"{OutletName} 编辑完成");
}
else
{
var res = Json<DevicePar>.Data.OutletInfoModels.FirstOrDefault(p => p.OutletName == OutletName);
if (res != null)
{
ErrorInfo = "出料口名称已经存在!";
return;
}

var temp = Json<DevicePar>.Data.OutletInfoModels.FirstOrDefault(p => p.OutletLoc == OutletLoc);
if (temp != null)
{
ErrorInfo = "出料口位置已存在!";
return;
}
Json<DevicePar>.Data.OutletInfoModels.Add(new OutletInfoModel()
{
OutletLoc = OutletLoc,
OutletName = OutletName,
SiloInfos = SileNames
});
//Control.GetInstance.OperationLog($"{OutletName} 添加成功");
}
ActionManage.GetInstance.Send("NewOutletViewClose");
});
RemoveCommand = new RelayCommand<object>((o) =>
{
if (!string.IsNullOrEmpty(o?.ToString()))
{
var res = SiloInfos.FirstOrDefault(p => p.RawMaterialName == o.ToString());
if (res != null) SiloInfos.Remove(res);
}

});
}

public string OutletName { get { return _mOutletName; } set { _mOutletName = value; OnPropertyChanged(); } }
private string _mOutletName;

public int OutletLoc { get { return _mOutletLoc; } set { _mOutletLoc = value; OnPropertyChanged(); } }
private int _mOutletLoc;

public ObservableCollection<RawMaterialInfo> SiloInfos { get; set; } = new ObservableCollection<RawMaterialInfo>();

public ObservableCollection<string> SileName { get; set; } = new ObservableCollection<string>();
}


public class RawMaterialInfo : ObservableObject
{

public string RawMaterialName { get { return _mRawMaterialName; } set { _mRawMaterialName = value; OnPropertyChanged(); } }
private string _mRawMaterialName;

public int SelectIndex { get { return _mSelectIndex; } set { _mSelectIndex = value; OnPropertyChanged(); } }
private int _mSelectIndex;

}

}

+ 28
- 43
DosingSystem/ViewModel/NewRecipeViewModel.cs View File

@@ -73,6 +73,16 @@ namespace BPASmartClient.DosingSystem.ViewModel
Json<LocaPar>.Data.Recipes.ElementAt(Index).RawMaterials.Clear();
RawMaterials.ToList()?.ForEach(item =>
{
var res = DeviceInquire.GetInstance.devices.FirstOrDefault(p => p.DeviceName == item.RawMaterialName);
if (res != null)
{
item.DeviceIp = res.IpAddress;
item.RawMaterialSource = 1;
}
else
{
item.RawMaterialSource = 0;
}
Json<LocaPar>.Data.Recipes.ElementAt(Index).RawMaterials.Add(item);
});
Json<LocaPar>.Save();
@@ -86,57 +96,32 @@ namespace BPASmartClient.DosingSystem.ViewModel
return;
}

ObservableCollection<RawMaterialModel> TempRawMaterials = new ObservableCollection<RawMaterialModel>();
RawMaterials.ToList()?.ForEach(item =>
{
var res = DeviceInquire.GetInstance.devices.FirstOrDefault(p => p.DeviceName == item.RawMaterialName);
if (res != null)
{
item.DeviceIp = res.IpAddress;
item.RawMaterialSource = 1;
}
else
{
item.RawMaterialSource = 0;
}
TempRawMaterials.Add(item);
});

Json<LocaPar>.Data.Recipes.Add(new RecipeModel()
{
RecipeName = RecipeName,
RawMaterials = RawMaterials,
RawMaterials = TempRawMaterials,
});
Json<LocaPar>.Save();
NoticeDemoViewModel.OpenMsg(EnumPromptType.Success, App.MainWindow, "提示", $"新建配方成功!");
}

//for (int i = 0; i < RawMaterials.Count; i++)
//{
// var res = DeviceInquire.GetInstance.devices.FirstOrDefault(p => p.DeviceName == RawMaterials.ElementAt(i).RawMaterialName);
// if (res != null)
// {
// RawMaterials.ElementAt(i).DeviceIp = res.IpAddress;//根据设备名称和原料名称的唯一匹配关系,给原料配置IP
// RawMaterials.ElementAt(i).RawMaterialSource = 1;
// }
// var su = Global.DeviceRawMaterials.FirstOrDefault(p => p.RawMaterialName == RawMaterials.ElementAt(i).RawMaterialName);
// if (su != null)
// {
// RawMaterials.ElementAt(i).RawMaterialSource = su.RawMaterialSource;
// }

//}

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

// if (res >= 0 && res < Json<LocaPar>.Data.Recipes.Count)
// {
// ErrorInfo = "该配方已存在,请重新输入";
// }
// else
// {
// AddRecipes();
// }
//}
//else//修改配方
//{
// var res = Array.FindIndex(Json<LocaPar>.Data.Recipes.ToArray(), p => p.RecipCode == RecipCode);
// if (res >= 0 && res < Json<LocaPar>.Data.Recipes.Count)
// {
// Json<LocaPar>.Data.Recipes.ElementAt(res).RecipeName = RecipeName;
// Json<LocaPar>.Data.Recipes.ElementAt(res).RawMaterials.Clear();
// foreach (var item in RawMaterials)
// {
// Json<LocaPar>.Data.Recipes.ElementAt(res).RawMaterials.Add(item);
// }
// }
//}

ActionManage.GetInstance.Send("CloseNewRecipeView");
});



+ 57
- 0
DosingSystem/ViewModel/OutletManagementViewModel.cs View File

@@ -0,0 +1,57 @@
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using BPA.Helper;
using BPASmartClient.DosingSystem.View;
using Microsoft.Toolkit.Mvvm.ComponentModel;
using Microsoft.Toolkit.Mvvm.Input;

namespace BPASmartClient.DosingSystem.ViewModel
{
public class OutletManagementViewModel : ViewModelBase
{
public OutletManagementViewModel()
{
AddCommand = new RelayCommand(() =>
{
NewOutletView newOutletView = new NewOutletView();
newOutletView.ShowDialog();
});
SaveCommand = new RelayCommand(() => { Json<DevicePar>.Save(); });
OutletInfoModels = Json<DevicePar>.Data.OutletInfoModels;
RemoveCommand = new RelayCommand<object>((o) =>
{
if (!string.IsNullOrEmpty(o?.ToString()))
{
var res = Json<DevicePar>.Data.OutletInfoModels.FirstOrDefault(p => p.OutletName == o.ToString());
if (res != null)
{
Json<DevicePar>.Data.OutletInfoModels.Remove(res);
//Control.GetInstance.OperationLog($"{res.OutletName} 删除成功");
}
}
});

DetailsCommand = new RelayCommand<object>((o) =>
{
if (!string.IsNullOrEmpty(o?.ToString()))
{
var res = Json<DevicePar>.Data.OutletInfoModels.FirstOrDefault(p => p.OutletName == o.ToString());
if (res != null)
{
NewOutletView newOutletView = new NewOutletView();
ActionManage.GetInstance.Send("OpenNewOutlet", res);
newOutletView.ShowDialog();
}
}
});
}

public ObservableCollection<OutletInfoModel> OutletInfoModels { get; set; }


}
}

+ 27
- 9
DosingSystem/ViewModel/RecipeControlViewModel.cs View File

@@ -20,7 +20,7 @@ namespace BPASmartClient.DosingSystem.ViewModel
{
public class RecipeControlViewModel : ObservableObject
{
ConcurrentQueue<string> devices = new ConcurrentQueue<string>();
ConcurrentQueue<string> RecipeNames = new ConcurrentQueue<string>();

public RecipeControlViewModel()
{
@@ -31,10 +31,23 @@ namespace BPASmartClient.DosingSystem.ViewModel
int index = Array.FindIndex(Recipes.ToArray(), p => p.RecipeName == deviceName);
if (index >= 0 && index < Recipes.Count)
{
for (int i = 0; i < Recipes.ElementAt(index).RawMaterials.Count; i++)
{
if (Recipes.ElementAt(index).RawMaterials.ElementAt(i).RawMaterialSource == 1)
{
string ip = Recipes.ElementAt(index).RawMaterials.ElementAt(i).DeviceIp;
var device = DeviceInquire.GetInstance.GetDevice(ip);
if (!device.IsConnected)
{
MessageNotify.GetInstance.ShowDialog($"设备 【{device.DeviceName}】 未连接,不允许下发此配方", DialogType.Error);
return;
}
}
}
Recipes.ElementAt(index).IsEnable = false;
}
MessageNotify.GetInstance.ShowUserLog($"下发工单 {Recipes.ElementAt(index).RecipeName}");
devices.Enqueue(deviceName);
RecipeNames.Enqueue(deviceName);
var res = Recipes.FirstOrDefault(p => p.RecipeName == deviceName);
UserTreeWait.Add(new RecipeModel { RecipeName = deviceName, RawMaterials = res.RawMaterials });
}
@@ -46,13 +59,11 @@ namespace BPASmartClient.DosingSystem.ViewModel

ChangeRecipeStateCommand = new RelayCommand<object>(ChangeRecipeState);



ThreadManage.GetInstance().StartLong(new Action(() =>
{
if (devices.Count > 0)
if (RecipeNames.Count > 0)
{
int index = Array.FindIndex(Recipes.ToArray(), p => p.RecipeName == devices.ElementAt(0));
int index = Array.FindIndex(Recipes.ToArray(), p => p.RecipeName == RecipeNames.ElementAt(0));
if (index >= 0 && index < Recipes.Count)
{
Recipes.ElementAt(index).Are.Reset();
@@ -60,12 +71,19 @@ namespace BPASmartClient.DosingSystem.ViewModel
App.Current.Dispatcher.Invoke(new Action(() =>
{
recipeProcesses.Clear();
UserTreeWait.RemoveAt(0);
if (UserTreeWait.Count > 0) UserTreeWait.RemoveAt(0);
}));
CurrentRecipeName = Recipes.ElementAt(index).RecipeName;

//配方数据写入到输送机
//SiemensDevice.GetInstance.MySiemens.WriteClass

foreach (var item in Recipes.ElementAt(index).RawMaterials)
{
DeviceInquire.GetInstance.GetDevice(item.DeviceIp)?.Start(item.RawMaterialWeight);//启动并写入每个原料重量
//DeviceInquire.GetInstance.GetDevice(item.DeviceIp)?.Start(item.RawMaterialWeight);//启动并写入每个原料重量
//var res = DeviceInquire.GetInstance.GetDevice(item.DeviceIp).deviceStatus.DeviceNum;



App.Current.Dispatcher.Invoke(new Action(() =>
{
@@ -80,7 +98,7 @@ namespace BPASmartClient.DosingSystem.ViewModel
}

Recipes.ElementAt(index).Are.WaitOne();//阻塞,直到当前配方完成
devices.TryDequeue(out string deviceName);
RecipeNames.TryDequeue(out string deviceName);
App.Current.Dispatcher.Invoke(new Action(() =>
{
UserTreeCompelete.Add(Recipes.ElementAt(index));//当前配方完成后添加到已完成的配方列表


+ 22
- 5
FryPot_DosingSystem/App.config View File

@@ -1,12 +1,29 @@
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<appSettings>
<!--请求报文头-->
<add key="appKey" value="true"/>
<add key="appSecret" value="123"/>
<add key="requestId" value="123"/>
<add key="timestamp" value="123"/>
<add key ="version" value="2.8"/>
<add key="appKey" value="0123456789abcdef"/>
<add key="appSecret" value="0123456789abcdef"/>
<add key ="version" value="2.7"/>
<add key="warehouseId" value="1"/>
<add key="jobPriority" value="1"/>
<add key="jobPriorityType" value="1"/>
<add key="jobType" value="POINT_ROLLER_MOVE"/>
<add key="autoLoad" value="true"/>
<add key="enableIOLoad" value="false"/>
<add key="autoUnload" value="true"/>
<add key="enableIOUnload" value="false"/>
<add key="LineOnePoint" value="sTEwzw"/>
<add key="LineTwoPoint" value="PChS6R"/>
<add key="LineThreePoint" value="HHif8Z"/>
<add key="LineFourPoint" value="w2jZhM"/>
<add key="FryPotOnePoint" value="DXDnMJ"/>
<add key="FryPotTwoPoint" value="CDPGde"/>
<add key="FryPotThreePoint" value="biZG87"/>
<add key="FryPotFourPoint" value="naFssQ"/>
<add key="FryPotFivePoint" value="sxSX88"/>
<add key="CleanPoint" value="TitRYC"/>
</appSettings>
<!--请求报文体-->
</configuration>

+ 14
- 5
FryPot_DosingSystem/App.xaml.cs View File

@@ -14,6 +14,7 @@ using System.Configuration;
using System.Data;
using System.IO;
using System.Linq;
using System.Net.Sockets;
using System.Threading.Tasks;
using System.Windows;

@@ -25,13 +26,12 @@ namespace FryPot_DosingSystem
public partial class App : Application
{
public static Window MainWindow;
protected override async void OnStartup(StartupEventArgs e)
protected override async void OnStartup(StartupEventArgs e)
{
base.OnStartup(e);
SystemHelper.GetInstance.CreateDesktopShortcut();
MenuInite();
LoginDataInite();

MainView mv = new MainView();
LoginView lv = new LoginView();
var res = lv.ShowDialog();
@@ -39,10 +39,19 @@ namespace FryPot_DosingSystem
{
mv.Show();
MessageNotify.GetInstance.ShowUserLog("用户登录");
await Task.Run(()=> { DeviceOperate deviceOperate = DeviceOperate.GetInstance; });//开启实时PLC数据读取
try
{
await Task.Run(() => { DeviceOperate deviceOperate = DeviceOperate.GetInstance; });
}
catch (Exception)
{
MessageNotify.GetInstance.ShowRunLog("下位机PLC连接失败,请检查无误后重启上位机");
}
//开启实时PLC数据读取
DosingLogicControl logigControl = DosingLogicControl.GetInstance;//开启逻辑控制任务程序
HubHelper.GetInstance.Connect("192.168.1.20", 8089);
AlarmHelper<AlarmInfo>.Init();//报警实时监控
HubHelper.GetInstance.Connect("172.16.12.100", 8089);
}
else
mv.Close();
@@ -71,7 +80,7 @@ namespace FryPot_DosingSystem
}
private void MenuInite()
{
NfcServer.GetInstance.Init();
// NfcServer.GetInstance.Init(); //NFC刷卡
#region 配方管理菜单
ObservableCollection<SubMenumodel> RecipeManage = new ObservableCollection<SubMenumodel>();
RecipeManage.Add(new SubMenumodel()


+ 78
- 11
FryPot_DosingSystem/Control/DeviceOperate.cs View File

@@ -180,12 +180,12 @@ namespace FryPot_DosingSystem.Control
string DeviceName = devices.Devices[i].DeviceName;
switch (DeviceName)
{
case "滚筒输送线": modbus.ModbusTcpConnect(Ip, Convert.ToInt32(Port)); MessageNotify.GetInstance.ShowRunLog("滚筒线PLC连接成功"); break;
case "炒锅1": fryOneModbus.ModbusTcpConnect(Ip, Convert.ToInt32(Port)); MessageNotify.GetInstance.ShowRunLog("1号炒锅PLC连接成功"); break;
case "炒锅2": fryTwoModbus.ModbusTcpConnect(Ip, Convert.ToInt32(Port)); MessageNotify.GetInstance.ShowRunLog("2号炒锅PLC连接成功"); break;
case "炒锅3": fryThreeModbus.ModbusTcpConnect(Ip, Convert.ToInt32(Port)); MessageNotify.GetInstance.ShowRunLog("3号炒锅PLC连接成功"); break;
case "炒锅4": fryFourModbus.ModbusTcpConnect(Ip, Convert.ToInt32(Port)); MessageNotify.GetInstance.ShowRunLog("4号炒锅PLC连接成功"); break;
case "炒锅5": fryFiveModbus.ModbusTcpConnect(Ip, Convert.ToInt32(Port)); MessageNotify.GetInstance.ShowRunLog("5号炒锅PLC连接成功"); break;
case "滚筒输送线": modbus.ModbusTcpConnect(Ip, Convert.ToInt32(Port)); MessageNotify.GetInstance.ShowRunLog("滚筒线PLC连接成功"); break;
//case "炒锅1": fryOneModbus.ModbusTcpConnect(Ip, Convert.ToInt32(Port)); MessageLog.GetInstance.ShowRunLog("1号炒锅PLC连接成功"); break;
//case "炒锅2": fryTwoModbus.ModbusTcpConnect(Ip, Convert.ToInt32(Port)); MessageLog.GetInstance.ShowRunLog("2号炒锅PLC连接成功"); break;
//case "炒锅3": fryThreeModbus.ModbusTcpConnect(Ip, Convert.ToInt32(Port)); MessageLog.GetInstance.ShowRunLog("3号炒锅PLC连接成功"); break;
//case "炒锅4": fryFourModbus.ModbusTcpConnect(Ip, Convert.ToInt32(Port)); MessageLog.GetInstance.ShowRunLog("4号炒锅PLC连接成功"); break;
//case "炒锅5": fryFiveModbus.ModbusTcpConnect(Ip, Convert.ToInt32(Port)); MessageLog.GetInstance.ShowRunLog("5号炒锅PLC连接成功"); break;
}

}
@@ -259,7 +259,7 @@ namespace FryPot_DosingSystem.Control
DeviceManage devices = Json<DeviceManage>.Data;
var res = devices.Devices.FirstOrDefault(p => p.DeviceName == "炒锅1");
if (res != null)
modbus.ModbusTcpConnect(res.Ip, Convert.ToInt32(res.Port)); MessageNotify.GetInstance.ShowRunLog("1号炒锅PLC重连成功");
fryOneModbus.ModbusTcpConnect(res.Ip, Convert.ToInt32(res.Port)); MessageNotify.GetInstance.ShowRunLog("1号炒锅PLC重连成功");
}
Thread.Sleep(10);
}), $"炒锅1实时数据读取线程");
@@ -289,7 +289,7 @@ namespace FryPot_DosingSystem.Control
DeviceManage devices = Json<DeviceManage>.Data;
var res = devices.Devices.FirstOrDefault(p => p.DeviceName == "炒锅2");
if (res != null)
modbus.ModbusTcpConnect(res.Ip, Convert.ToInt32(res.Port)); MessageNotify.GetInstance.ShowRunLog("2号炒锅PLC重连成功");
fryTwoModbus.ModbusTcpConnect(res.Ip, Convert.ToInt32(res.Port)); MessageNotify.GetInstance.ShowRunLog("2号炒锅PLC重连成功");
}
Thread.Sleep(10);
}), $"炒锅2实时数据读取线程");
@@ -319,7 +319,7 @@ namespace FryPot_DosingSystem.Control
DeviceManage devices = Json<DeviceManage>.Data;
var res = devices.Devices.FirstOrDefault(p => p.DeviceName == "炒锅3");
if (res != null)
modbus.ModbusTcpConnect(res.Ip, Convert.ToInt32(res.Port)); MessageNotify.GetInstance.ShowRunLog("3号炒锅PLC重连成功");
fryThreeModbus.ModbusTcpConnect(res.Ip, Convert.ToInt32(res.Port)); MessageNotify.GetInstance.ShowRunLog("3号炒锅PLC重连成功");
}
Thread.Sleep(10);
}), $"炒锅3实时数据读取线程");
@@ -349,7 +349,7 @@ namespace FryPot_DosingSystem.Control
DeviceManage devices = Json<DeviceManage>.Data;
var res = devices.Devices.FirstOrDefault(p => p.DeviceName == "炒锅4");
if (res != null)
modbus.ModbusTcpConnect(res.Ip, Convert.ToInt32(res.Port)); MessageNotify.GetInstance.ShowRunLog("4号炒锅PLC重连成功");
fryFourModbus.ModbusTcpConnect(res.Ip, Convert.ToInt32(res.Port)); MessageNotify.GetInstance.ShowRunLog("4号炒锅PLC重连成功");
}
Thread.Sleep(10);
}), $"炒锅4实时数据读取线程");
@@ -379,18 +379,85 @@ namespace FryPot_DosingSystem.Control
DeviceManage devices = Json<DeviceManage>.Data;
var res = devices.Devices.FirstOrDefault(p => p.DeviceName == "炒锅5");
if (res != null)
modbus.ModbusTcpConnect(res.Ip, Convert.ToInt32(res.Port)); MessageNotify.GetInstance.ShowRunLog("5号炒锅PLC重连成功");
fryFiveModbus.ModbusTcpConnect(res.Ip, Convert.ToInt32(res.Port)); MessageNotify.GetInstance.ShowRunLog("5号炒锅PLC重连成功");
}
Thread.Sleep(10);
}), $"炒锅5实时数据读取线程");
}
}
/// <summary>
/// 滚筒线写ushort数据
/// </summary>
/// <param name="address"></param>
/// <param name="value"></param>
public void WritePlcData(string address, ushort value)
{
lock (this)
{
modbus.Write(address, value);
}
}
/// <summary>
/// 滚筒线写float数据
/// </summary>
/// <param name="address"></param>
/// <param name="value"></param>
public void WriteRealPlcData(string address, float value)
{
lock (this)
{
modbus.SetReal(address,value);
}
}
/// <summary>
/// 炒锅1工艺数据
/// </summary>
/// <param name="address"></param>
/// <param name="value"></param>
public void WritePotOnePlcData(string address,object value )
{
}
/// <summary>
/// 炒锅2工艺数据
/// </summary>
/// <param name="address"></param>
/// <param name="value"></param>
public void WritePotTwoPlcData(string address, object value)
{


}
/// <summary>
/// 炒锅3工艺数据
/// </summary>
/// <param name="address"></param>
/// <param name="value"></param>
public void WritePotThreePlcData(string address, object value)
{


}
/// <summary>
/// 炒锅4工艺数据
/// </summary>
/// <param name="address"></param>
/// <param name="value"></param>
public void WritePotFourPlcData(string address, object value)
{


}
/// <summary>
/// 炒锅5工艺数据
/// </summary>
/// <param name="address"></param>
/// <param name="value"></param>
public void WritePotFivePlcData(string address, object value)
{


}
public ConcurrentDictionary<string, object> GetAllData()
{


+ 1072
- 506
FryPot_DosingSystem/Control/DosingLogicControl.cs
File diff suppressed because it is too large
View File


+ 75
- 2
FryPot_DosingSystem/Control/GlobalVariable.cs View File

@@ -128,7 +128,6 @@ namespace FryPot_DosingSystem.Control
public string LThreeCurrentRecipeName { get; set; } = string.Empty;
#endregion
#region 线体1流程互锁变量

public bool LoadRoller { get; set; }

public bool AgvToFryPot { get; set; }
@@ -197,7 +196,12 @@ namespace FryPot_DosingSystem.Control
public bool agvArriveLineOneLoadCom { get; set; } //agv线体1空桶上料完成
public bool agvArriveLineTwoLoadCom { get; set; } //agv线体2空桶上料完成
public bool agvArriveLineThreeLoadCom { get; set; }//agv线体3空桶上料完成

/// <summary>
/// 允许下一个空桶去洗桶
/// </summary>
public bool AllowNextEmptyRollerToClean { get; set; } = true;

#endregion
}
/// <summary>
@@ -282,7 +286,28 @@ namespace FryPot_DosingSystem.Control
/// AGV从线体1到达清洗台
/// </summary>
public bool agvArriveCleanUnLoad { get; set; }
/// <summary>
/// 下位确认执行信号 true:执行 false:不执行
/// </summary>
public ushort ExcuteIsConfirm { get; set;} //默认为:0,确认执行:1,取消执行:2
/// <summary>
/// 线体1流程控制互锁信号
/// </summary>
public bool NextStart { get; set; }

/// <summary>
/// 下位信号判断
/// </summary>
public bool LowSignalJude { get; set; }

/// <summary>
/// 集中洗桶模式
/// </summary>
public ushort WashEmptyRollerModel { get; set; }
/// <summary>
/// 洗桶就位信号
/// </summary>
public ushort WashRollerArriveSignal { get; set; }

}
/// <summary>
@@ -364,6 +389,30 @@ namespace FryPot_DosingSystem.Control
/// AGV从线体2到达清洗台
/// </summary>
public bool agvArriveCleanUnLoad { get; set; }


/// <summary>
/// 下位确认执行信号 true:执行 false:不执行
/// </summary>
public ushort ExcuteIsConfirm { get; set; }
/// <summary>
/// 线体1流程控制互锁信号
/// </summary>
public bool NextStart { get; set; }

/// <summary>
/// 下位信号判断
/// </summary>
public bool LowSignalJude { get; set; }

/// <summary>
/// 集中洗桶模式
/// </summary>
public ushort WashEmptyRollerModel { get; set; }
/// <summary>
/// 洗桶就位信号
/// </summary>
public ushort WashRollerArriveSignal { get; set; }
}
/// <summary>
/// 滚筒线3相关变量
@@ -445,6 +494,30 @@ namespace FryPot_DosingSystem.Control
/// AGV从线体3到达清洗台
/// </summary>
public bool agvArriveCleanUnLoad { get; set; }

/// <summary>
/// 下位确认执行信号 true:执行 false:不执行
/// </summary>
public ushort ExcuteIsConfirm { get; set; }
/// <summary>
/// 线体1流程控制互锁信号
/// </summary>
public bool NextStart { get; set; }

/// <summary>
/// 下位信号判断
/// </summary>
public bool LowSignalJude { get; set; }

/// <summary>
/// 集中洗桶模式
/// </summary>
public ushort WashEmptyRollerModel { get; set; }
/// <summary>
/// 洗桶就位信号
/// </summary>
public ushort WashRollerArriveSignal { get; set; }

}
/// <summary>
/// 滚筒线4相关变量


+ 18
- 7
FryPot_DosingSystem/Model/FlowProcessModel.cs View File

@@ -28,12 +28,12 @@ namespace FryPot_DosingSystem.Model
/// 炒制速度
/// </summary>
public double FrySpeed { get { return _frySpeed; }set { _frySpeed = value;OnPropertyChanged(); } }
private double _frySpeed;
/// <summary>
/// 炒制重量
/// </summary>
public double FryWeight { get { return _fryMaterialWeight; }set { _fryMaterialWeight = value;OnPropertyChanged(); } }
private double _fryMaterialWeight;
private double _frySpeed;
///// <summary>
///// 炒制重量
///// </summary>
//public double FryWeight { get { return _fryMaterialWeight; } set { _fryMaterialWeight = value; OnPropertyChanged(); } }
//private double _fryMaterialWeight;
/// <summary>
/// 炒制温度
/// </summary>
@@ -43,6 +43,17 @@ namespace FryPot_DosingSystem.Model
/// 炒制时间
/// </summary>
public double FryPeriodTime { get { return _fryPeriodTime; } set { _fryPeriodTime = value;OnPropertyChanged(); } }
private double _fryPeriodTime;
private double _fryPeriodTime;
/// <summary>
/// 炒制火力
/// </summary>
public double FryFire { get { return _fryFire; } set { _fryFire = value; OnPropertyChanged(); } }
private double _fryFire;

/// <summary>
/// 火力比例
/// </summary>
public double FryFirePercent { get { return _fryFirePercent; } set { _fryFirePercent = value; OnPropertyChanged(); } }
private double _fryFirePercent;
}
}

+ 6
- 0
FryPot_DosingSystem/Model/MaterialType.cs View File

@@ -24,6 +24,12 @@ namespace FryPot_DosingSystem.Model
/// </summary>
private ushort _materialWeight;
public ushort MaterialWeight { get { return _materialWeight; }set { _materialWeight = value;OnPropertyChanged(); } }

/// <summary>
/// 原料偏差
/// </summary>
private float _materialOffset;
public float MaterialOffset { get { return _materialOffset;}set { _materialOffset = value;OnPropertyChanged(); } }
/// <summary>
/// 原料对应桶位置
/// </summary>


+ 17
- 2
FryPot_DosingSystem/View/DebugView.xaml View File

@@ -42,13 +42,28 @@
<Button Content="配方完成信号" Style="{StaticResource buttonStyle}" VerticalAlignment="Top" Command="{Binding LineOneRecipeComSignal}"/>
<Line Stroke="Aqua" StrokeThickness="2" X1="0" X2="860" Y1="0" Y2="0"/>
<Button Content="线体1任务重置" Style="{StaticResource buttonStyle}" VerticalAlignment="Top" Command="{Binding LineOneTaskExit}"></Button>
<Button Content="AGV接口调试" Style="{StaticResource buttonStyle}" VerticalAlignment="Top" Command="{Binding AgvDebug}"/>
<Button Content="空桶清洗任务重置" Width="140" Style="{StaticResource buttonStyle}" VerticalAlignment="Top" Command="{Binding EmptyRollerCleanTaskRestart}"/>
<Line Stroke="Aqua" StrokeThickness="2" X1="0" X2="860" Y1="0" Y2="0"/>
<WrapPanel Orientation="Horizontal">
<Button Content="清洗台呼叫AGV" Style="{StaticResource buttonStyle}" VerticalAlignment="Top" Command="{Binding CleanPlateCallAgv}"/>
</WrapPanel>
</WrapPanel>
<Line Stroke="Aqua" StrokeThickness="2" X1="0" X2="860" Y1="0" Y2="0"/>
<Button Content="线体1到炒锅1" Style="{StaticResource buttonStyle}" VerticalAlignment="Top" Command="{Binding AgvDebug}"/>
<Button Content="线体1到炒锅4" Style="{StaticResource buttonStyle}" VerticalAlignment="Top" Click="Button_Click"/>
<Button Content="线体2到炒锅2" Style="{StaticResource buttonStyle}" VerticalAlignment="Top" Click="Button_Click_1"/>
<Button Content="线体2到炒锅5" Style="{StaticResource buttonStyle}" VerticalAlignment="Top" Click="Button_Click_2"/>
<Button Content="线体3到炒锅3" Style="{StaticResource buttonStyle}" VerticalAlignment="Top" Click="Button_Click_3"/>
<Button Content="炒锅1到线体4" Style="{StaticResource buttonStyle}" VerticalAlignment="Top" Click="Button_Click_4"/>
<Button Content="炒锅2到线体4" Style="{StaticResource buttonStyle}" VerticalAlignment="Top" Click="Button_Click_5"/>
<Button Content="炒锅3到线体4" Style="{StaticResource buttonStyle}" VerticalAlignment="Top" Click="Button_Click_6"/>
<Button Content="炒锅4到线体4" Style="{StaticResource buttonStyle}" VerticalAlignment="Top" Click="Button_Click_7"/>
<Button Content="炒锅5到线体4" Style="{StaticResource buttonStyle}" VerticalAlignment="Top" Click="Button_Click_8"/>
<Button Content="线体1到清洗" Style="{StaticResource buttonStyle}" VerticalAlignment="Top" Click="Button_Click_9"/>
<Button Content="线体2到清洗" Style="{StaticResource buttonStyle}" VerticalAlignment="Top" Click="Button_Click_10"/>
<Button Content="线体3到清洗" Style="{StaticResource buttonStyle}" VerticalAlignment="Top" Click="Button_Click_11"/>
<Button Content="清洗到线体4" Style="{StaticResource buttonStyle}" VerticalAlignment="Top" Click="Button_Click_12"/>
</WrapPanel>
</GroupBox>


+ 73
- 2
FryPot_DosingSystem/View/DebugView.xaml.cs View File

@@ -1,4 +1,6 @@
using BPASmartClient.Helper;
using BPASmartClient.AGV;
using BPASmartClient.Helper;
using FryPot_DosingSystem.Control;
using System;
using System.Collections.Generic;
using System.Linq;
@@ -25,7 +27,7 @@ namespace FryPot_DosingSystem.View
{
InitializeComponent();
}
string taskId = string.Empty;
private void ComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
if (sender is ComboBox cbo)
@@ -58,5 +60,74 @@ namespace FryPot_DosingSystem.View
}
}
}

private void Button_Click(object sender, RoutedEventArgs e)
{
DeviceOperate.GetInstance.WritePlcData("D1060", 0);
// AGVHelper.GetInstance.AgvFromLineOneToFryFourLoadRoller(Guid.NewGuid().ToString("D"));
}

private void Button_Click_1(object sender, RoutedEventArgs e)
{
AGVHelper.GetInstance.AgvToLineTwoLoadRoller(Guid.NewGuid().ToString("D"));
}

private void Button_Click_2(object sender, RoutedEventArgs e)
{
AGVHelper.GetInstance.AgvFromLineTwoToFryFiveLoadRoller(Guid.NewGuid().ToString("D"));
}

private void Button_Click_3(object sender, RoutedEventArgs e)
{
AGVHelper.GetInstance.AgvToLineThreeLoadRoller(Guid.NewGuid().ToString("D"));
}

private void Button_Click_4(object sender, RoutedEventArgs e)
{
AGVHelper.GetInstance.AgvLeaveFryPotOne(Guid.NewGuid().ToString("D"));
}

private void Button_Click_5(object sender, RoutedEventArgs e)
{
AGVHelper.GetInstance.AgvLeaveFryPotTwo(Guid.NewGuid().ToString("D"));
}

private void Button_Click_6(object sender, RoutedEventArgs e)
{
AGVHelper.GetInstance.AgvLeaveFryPotThree(Guid.NewGuid().ToString("D"));
}

private void Button_Click_7(object sender, RoutedEventArgs e)
{
AGVHelper.GetInstance.AgvLeaveFryPotFour(Guid.NewGuid().ToString("D"));
}

private void Button_Click_8(object sender, RoutedEventArgs e)
{
AGVHelper.GetInstance.AgvLeaveFryPotFive(Guid.NewGuid().ToString("D"));
}

private void Button_Click_9(object sender, RoutedEventArgs e)
{
AGVHelper.GetInstance.AgvLeaveLOneToClean(Guid.NewGuid().ToString("D"));
}

private void Button_Click_10(object sender, RoutedEventArgs e)
{
AGVHelper.GetInstance.AgvLeaveLTwoToClean(Guid.NewGuid().ToString("D"));
}

private void Button_Click_11(object sender, RoutedEventArgs e)
{
AGVHelper.GetInstance.AgvLeaveLThreeToClean(Guid.NewGuid().ToString("D"));
}

private void Button_Click_12(object sender, RoutedEventArgs e)
{
AGVHelper.GetInstance.AgvFromCleanToLineFourUnLoadRoller(Guid.NewGuid().ToString("D"));

}

}
}

+ 30
- 7
FryPot_DosingSystem/View/FlowProcessView.xaml View File

@@ -7,7 +7,7 @@
xmlns:vm="clr-namespace:FryPot_DosingSystem.ViewModel"
xmlns:Themes1="clr-namespace:Microsoft.Windows.Themes;assembly=PresentationFramework.Classic"
mc:Ignorable="d"
Title="FlowProcessView" Height="550" Width="800" WindowStartupLocation="CenterScreen" WindowStyle="None" AllowsTransparency="True">
Title="FlowProcessView" Height="650" Width="940" WindowStartupLocation="CenterScreen" WindowStyle="None" AllowsTransparency="True">
<Window.DataContext>
<vm:FlowProcessSetViewModel/>
</Window.DataContext>
@@ -414,18 +414,23 @@
<ColumnDefinition Width="140"/>
<ColumnDefinition Width="140"/>
<ColumnDefinition Width="140"/>
<ColumnDefinition Width="140"/>
</Grid.ColumnDefinitions>
<TextBlock Text="工艺步骤" HorizontalAlignment="Center" VerticalAlignment="Center" Foreground="white" FontSize="18"/>
<GridSplitter BorderThickness="0.2" BorderBrush="White"></GridSplitter>
<TextBlock Grid.Column="1" Text="炒制原料/桶号" HorizontalAlignment="Center" VerticalAlignment="Center" Foreground="white" FontSize="18"/>
<TextBlock Grid.Column="1" Text="原料/桶号设定" HorizontalAlignment="Center" VerticalAlignment="Center" Foreground="white" FontSize="18"/>
<GridSplitter Grid.Column="1" BorderThickness="0.2" BorderBrush="White"></GridSplitter>
<TextBlock Grid.Column="2" Text="炒制速度" HorizontalAlignment="Center" VerticalAlignment="Center" Foreground="white" FontSize="18"/>
<TextBlock Grid.Column="2" Text="速度设定" HorizontalAlignment="Center" VerticalAlignment="Center" Foreground="white" FontSize="18"/>
<!--<GridSplitter Grid.Column="2" BorderThickness="0.2" BorderBrush="White"></GridSplitter>
<TextBlock Grid.Column="3" Text="重量设定" VerticalAlignment="Center" HorizontalAlignment="Center" Foreground="white" FontSize="18"></TextBlock>-->
<GridSplitter Grid.Column="2" BorderThickness="0.2" BorderBrush="White"></GridSplitter>
<TextBlock Grid.Column="3" Text="炒制重量" VerticalAlignment="Center" HorizontalAlignment="Center" Foreground="white" FontSize="18"></TextBlock>
<TextBlock Grid.Column="3" Text="温度设定" VerticalAlignment="Center" HorizontalAlignment="Center" Foreground="white" FontSize="18"/>
<GridSplitter Grid.Column="3" BorderThickness="0.2" BorderBrush="White"></GridSplitter>
<TextBlock Grid.Column="4" Text="炒制温度" VerticalAlignment="Center" HorizontalAlignment="Center" Foreground="white" FontSize="18"/>
<TextBlock Grid.Column="4" Text="时间设定" VerticalAlignment="Center" HorizontalAlignment="Center" Foreground="white" FontSize="18"/>
<GridSplitter Grid.Column="4" BorderThickness="0.2" BorderBrush="White"></GridSplitter>
<TextBlock Grid.Column="5" Text="炒制时间" VerticalAlignment="Center" HorizontalAlignment="Center" Foreground="white" FontSize="18"/>
<TextBlock Grid.Column="5" Text="火力设定" VerticalAlignment="Center" HorizontalAlignment="Center" Foreground="white" FontSize="18"/>
<GridSplitter Grid.Column="5" BorderThickness="0.2" BorderBrush="White"></GridSplitter>
<TextBlock Grid.Column="6" Text="火力比例" VerticalAlignment="Center" HorizontalAlignment="Center" Foreground="white" FontSize="18"/>
</Grid>
<ScrollViewer Grid.Row="3" VerticalScrollBarVisibility="Hidden">
<ItemsControl x:Name="itemcontrols" AlternationCount="{Binding flowProcessModels.Count}" ItemsSource="{Binding flowProcessModels}" Margin="0,1,0,-1">
@@ -441,9 +446,27 @@
RelativeSource TemplatedParent}}" Foreground="SkyBlue" Width="100" Height="40" VerticalContentAlignment="Center" HorizontalContentAlignment="Center" FontSize="18" Background="Transparent" BorderBrush="#FF2AB2E7" BorderThickness="1,1,0.5,1"/>
<ComboBox ItemsSource="{Binding DataContext.FlowItems, RelativeSource={RelativeSource AncestorType=ItemsControl, Mode=FindAncestor}}" Text="{Binding FryMaterialNum}" Style="{StaticResource BaseComboBoxStyle}" IsReadOnly="True" Width="140" Height="40" VerticalContentAlignment="Center" HorizontalContentAlignment="Center" Background="Transparent" Foreground="SkyBlue" FontSize="18" BorderBrush="#FF2AB2E7" BorderThickness="0.5,1,0.5,1"/>
<TextBox Text="{Binding FrySpeed}" Width="140" Height="40" VerticalContentAlignment="Center" HorizontalContentAlignment="Center" Background="Transparent" Foreground="SkyBlue" FontSize="18" BorderBrush="#FF2AB2E7" BorderThickness="0.5,1,0.5,1"/>
<TextBox Text="{Binding FryWeight}" Width="140" Height="40" VerticalContentAlignment="Center" HorizontalContentAlignment="Center" Background="Transparent" Foreground="SkyBlue" FontSize="18" BorderBrush="#FF2AB2E7" BorderThickness="0.5,1,0.5,1"/>
<!--<TextBox Text="{Binding FryWeight}" Width="140" Height="40" VerticalContentAlignment="Center" HorizontalContentAlignment="Center" Background="Transparent" Foreground="SkyBlue" FontSize="18" BorderBrush="#FF2AB2E7" BorderThickness="0.5,1,0.5,1"/>-->
<TextBox Text="{Binding FryTemperature}" Width="140" Height="40" VerticalContentAlignment="Center" HorizontalContentAlignment="Center" Background="Transparent" Foreground="SkyBlue" FontSize="18" BorderBrush="#FF2AB2E7" BorderThickness="0.5,1,0.5,1"/>
<TextBox Text="{Binding FryPeriodTime}" Width="140" Height="40" VerticalContentAlignment="Center" HorizontalContentAlignment="Center" Background="Transparent" Foreground="SkyBlue" FontSize="18" BorderBrush="#FF2AB2E7" BorderThickness="0.5,1,1,1"/>
<TextBox Text="{Binding FryFire}" Width="140" Height="40" VerticalContentAlignment="Center" HorizontalContentAlignment="Center" Background="Transparent" Foreground="SkyBlue" FontSize="18" BorderBrush="#FF2AB2E7" BorderThickness="0.5,1,1,1"/>

<TextBox FontSize="18" >
<TextBox.Template>
<ControlTemplate>
<Border Width="140" Height="40" BorderThickness="0.5,1,1,1" BorderBrush="#FF2AB2E7">
<StackPanel Orientation="Horizontal">
<TextBox Width="100" Height="40" VerticalAlignment="Center" BorderThickness="0" VerticalContentAlignment="Center" HorizontalContentAlignment="Right" Padding="0,0,22,0" BorderBrush="Transparent" HorizontalAlignment="Center" Background="Transparent" Foreground="SkyBlue" Text="{Binding FryFirePercent}"/>
<TextBlock Text="%" HorizontalAlignment="Right" Foreground="SkyBlue" VerticalAlignment="Center"/>
</StackPanel>
</Border>
<ControlTemplate.Triggers>
</ControlTemplate.Triggers>
</ControlTemplate>
</TextBox.Template>
</TextBox>
</StackPanel>
</DataTemplate>
</ItemsControl.ItemTemplate>


+ 41
- 82
FryPot_DosingSystem/View/NewRecipeView.xaml View File

@@ -363,37 +363,21 @@
Margin="0,0,0,10"
Background="#FF2AB2E7">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="210" />
<ColumnDefinition Width="225" />
<ColumnDefinition Width="225" />
<ColumnDefinition />
<ColumnDefinition Width="170"/>
<ColumnDefinition Width="170"/>
<ColumnDefinition Width="170"/>
<ColumnDefinition Width="170"/>
<ColumnDefinition/>
</Grid.ColumnDefinitions>
<TextBlock
HorizontalAlignment="Center"
VerticalAlignment="Center"
Foreground="White"
Text="原料名称" />
<GridSplitter />
<TextBlock
Grid.Column="1"
HorizontalAlignment="Center"
VerticalAlignment="Center"
Foreground="White"
Text="原料桶号" />
<GridSplitter Grid.Column="1" />
<TextBlock
Grid.Column="2"
HorizontalAlignment="Center"
VerticalAlignment="Center"
Foreground="White"
Text="原料重量" />
<GridSplitter Grid.Column="2" />
<TextBlock
Grid.Column="3"
HorizontalAlignment="Center"
VerticalAlignment="Center"
Foreground="White"
Text="操作" />
<TextBlock Text="原料名称" HorizontalAlignment="Center" VerticalAlignment="Center" Foreground="White"/>
<GridSplitter></GridSplitter>
<TextBlock Grid.Column="1" Text="原料桶号" HorizontalAlignment="Center" VerticalAlignment="Center" Foreground="White"/>
<GridSplitter Grid.Column="1"></GridSplitter>
<TextBlock Grid.Column="2" Text="原料重量" VerticalAlignment="Center" HorizontalAlignment="Center" Foreground="White"></TextBlock>
<GridSplitter Grid.Column="2"></GridSplitter>
<TextBlock Grid.Column="3" Text="原料偏差" VerticalAlignment="Center" HorizontalAlignment="Center" Foreground="White"></TextBlock>
<GridSplitter Grid.Column="3"></GridSplitter>
<TextBlock Grid.Column="4" Text="操作" VerticalAlignment="Center" HorizontalAlignment="Center" Foreground="White"/>
</Grid>
<ScrollViewer Grid.Row="3" VerticalScrollBarVisibility="Hidden">
<ItemsControl ItemsSource="{Binding materials}">
@@ -409,22 +393,14 @@
<ControlTemplate>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="210" />
<ColumnDefinition Width="170"/>

<ColumnDefinition Width="210" />
<ColumnDefinition Width="225" />
<ColumnDefinition />
<ColumnDefinition Width="170"></ColumnDefinition>
<ColumnDefinition Width="170"></ColumnDefinition>
<ColumnDefinition Width="170"></ColumnDefinition>
<ColumnDefinition></ColumnDefinition>
</Grid.ColumnDefinitions>
<ComboBox
Width="190"
Height="30"
Margin="10,0,0,10"
FontSize="14"
ItemsSource="{Binding DataContext.materialNames, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=ItemsControl}}"
KeyUp="ComboBox_KeyUp"
LostFocus="ComboBox_LostFocus"
Style="{StaticResource ComboBoxStyle1}"
Text="{Binding MaterialName}">
<ComboBox ItemsSource="{Binding DataContext.materialNames,RelativeSource={RelativeSource Mode=FindAncestor,AncestorType=ItemsControl}}" Text="{Binding MaterialName}" Margin="10,0,0,10" Width="160" FontSize="14" KeyUp="ComboBox_KeyUp" LostFocus="ComboBox_LostFocus" Style="{StaticResource ComboBoxStyle1}" Height="30">
<ComboBox.ItemContainerStyle>
<Style TargetType="{x:Type ComboBoxItem}">
<Setter Property="Background" Value="White" />
@@ -434,48 +410,31 @@
</Style>
</ComboBox.ItemContainerStyle>
</ComboBox>
<StackPanel Grid.Column="1" Orientation="Horizontal">
<TextBox
Width="170"
Height="30"
Margin="35,0,0,10"
Background="Transparent"
BorderBrush="#e69519"
FontSize="14"
Foreground="LightGray"
Text="{Binding MaterialLoc}" />
<StackPanel Grid.Column="1" Orientation="Horizontal" >
<TextBox Text="{Binding MaterialLoc}" Background="Transparent" FontSize="14" Height="30"
BorderBrush="#e69519" Foreground="LightGray" Width="160" Margin="5,0,0,10" ></TextBox>

</StackPanel>
<StackPanel Grid.Column="2" Orientation="Horizontal">
<TextBox
Width="170"
<StackPanel Orientation="Horizontal" Grid.Column="2">
<TextBox Text="{Binding MaterialWeight}" Background="Transparent" FontSize="14" Height="30" LostFocus="TextBox_LostFocus_1"
BorderBrush="#e69519" Foreground="LightGray" Width="140" Margin="5,0,0,10" ></TextBox>
<TextBlock VerticalAlignment="Center" FontSize="14" Margin="4,0,0,10" Text="Kg" Foreground="#e69519" ></TextBlock>
</StackPanel>
<StackPanel Orientation="Horizontal" Grid.Column="3">
<TextBox Text="{Binding MaterialOffset}" Background="Transparent" FontSize="14" Height="30" LostFocus="TextBox_LostFocus"
BorderBrush="#e69519" Foreground="LightGray" Width="140" Margin="5,0,0,10" ></TextBox>
<TextBlock VerticalAlignment="Center" FontSize="14" Margin="4,0,0,10" Text="Kg" Foreground="#e69519" ></TextBlock>
</StackPanel>
<Button Grid.Column="4"
Content="删除"
Width="100"
Height="30"
Margin="35,0,0,10"
Background="Transparent"
BorderBrush="#e69519"
FontSize="14"
Foreground="LightGray"
Text="{Binding MaterialWeight}" />
<TextBlock
Margin="4,0,0,10"
VerticalAlignment="Center"
FontSize="14"
Foreground="#e69519"
Text="g" />
</StackPanel>
<Button
Grid.Column="3"
Width="94"
Height="30"
Margin="0,0,20,10"
HorizontalAlignment="Right"
Background="Transparent"
BorderBrush="#e69519"
Command="{Binding DataContext.RemoveRecipe, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=ItemsControl}}"
CommandParameter="{Binding MaterialCode}"
Content="删除"
FontSize="14"
Foreground="LightGray" />
Margin="5,0,20,10"
Background="Transparent"
BorderBrush="#e69519" Foreground="LightGray" HorizontalAlignment="Center"
Command="{Binding DataContext.RemoveRecipe,RelativeSource={RelativeSource Mode=FindAncestor,AncestorType=ItemsControl}}"
CommandParameter="{Binding MaterialCode}"></Button>
</Grid>
</ControlTemplate>
</RadioButton.Template>


+ 68
- 0
FryPot_DosingSystem/View/NewRecipeView.xaml.cs View File

@@ -22,6 +22,7 @@ namespace FryPot_DosingSystem.View
/// </summary>
public partial class NewRecipeView : Window
{
int maxMaterialWeight = 250;
public NewRecipeView()
{
InitializeComponent();
@@ -85,5 +86,72 @@ namespace FryPot_DosingSystem.View
}
}
}

/// <summary>
/// 偏差值验证
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void TextBox_LostFocus(object sender, RoutedEventArgs e)
{
if(sender is TextBox)
{
try
{
TextBox text = sender as TextBox;
if (text.Text != null)
{
double offset = float.Parse((text.Text));
if (offset < 0)
{
MessageBox.Show("偏差值无效输入", "警告", MessageBoxButton.OKCancel, MessageBoxImage.Warning);
}
}
}
catch (Exception)
{

MessageBox.Show("偏差值非法输入", "警告", MessageBoxButton.OKCancel, MessageBoxImage.Warning);
}
}
}
/// <summary>
/// 料桶重量验证
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void TextBox_LostFocus_1(object sender, RoutedEventArgs e)
{
if (sender is TextBox)
{
try
{
TextBox text = sender as TextBox;
if (text != null)
{
double weight = Convert.ToDouble(text.Text);
if (weight < 0)
{
MessageBox.Show("原料重量非法输入", "警告", MessageBoxButton.OKCancel, MessageBoxImage.Warning);
}
else if (weight > maxMaterialWeight)
{
MessageBox.Show("原料重量超出上限", "警告", MessageBoxButton.OKCancel, MessageBoxImage.Warning);
}
else
{
text.Text = Math.Ceiling(weight).ToString();
}

}
}
catch (Exception)
{

MessageBox.Show("原料重量非法输入", "警告", MessageBoxButton.OKCancel, MessageBoxImage.Warning);
}
}
}
}
}

+ 4
- 1
FryPot_DosingSystem/ViewModel/DeviceListViewModel.cs View File

@@ -1,4 +1,6 @@
using BPASmartClient.Helper;
using BPASmartClient.CustomResource.UserControls;
using BPASmartClient.CustomResource.UserControls.MessageShow;
using BPASmartClient.Helper;
using FryPot_DosingSystem.Model;
using Microsoft.Toolkit.Mvvm.ComponentModel;
using Microsoft.Toolkit.Mvvm.Input;
@@ -54,6 +56,7 @@ namespace FryPot_DosingSystem.ViewModel
{
Json<DeviceManage>.Data.Devices = devices;
Json<DeviceManage>.Save();
NoticeDemoViewModel.OpenMsg(EnumPromptType.Success, App.MainWindow, "提示", $"IP设置成功!");
});
}



+ 25
- 10
FryPot_DosingSystem/ViewModel/FlowProcessSetViewModel.cs View File

@@ -1,4 +1,7 @@
using BPASmartClient.Helper;
using BPASmartClient.CustomResource.Pages.Model;
using BPASmartClient.CustomResource.UserControls;
using BPASmartClient.CustomResource.UserControls.MessageShow;
using BPASmartClient.Helper;
using FryPot_DosingSystem.Model;
using Microsoft.Toolkit.Mvvm.Input;
using System;
@@ -7,6 +10,7 @@ using System.Collections.ObjectModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;

namespace FryPot_DosingSystem.ViewModel
{
@@ -57,12 +61,12 @@ namespace FryPot_DosingSystem.ViewModel
{
foreach (var item in recipe.materialCollection)
{
if (!FlowItems.Contains(item.MaterialName))
FlowItems.Insert(0, item.MaterialName);//下拉框
if (!FlowItems.Contains(item.MaterialLoc.ToString()))
FlowItems.Add(item.MaterialLoc.ToString());//下拉框
}
foreach (var item in recipe.FlowProcess.fpModels)
{
flowProcessModels.Add(new FlowProcessModel {FryMaterialNum = item.FryMaterialNum, FrySpeed = item.FrySpeed, FryWeight = item.FryWeight, FryTemperature = item.FryTemperature, FryPeriodTime = item.FryPeriodTime });
flowProcessModels.Add(new FlowProcessModel {FryMaterialNum = item.FryMaterialNum, FrySpeed = item.FrySpeed, FryTemperature = item.FryTemperature, FryPeriodTime = item.FryPeriodTime ,FryFire=item.FryFire,FryFirePercent=item.FryFirePercent});
}

// ActionManage.GetInstance.Send("MaterialNum", recipe.materialCollection.Count);
@@ -77,8 +81,8 @@ namespace FryPot_DosingSystem.ViewModel
foreach (var item in name.materialCollection)
{

if (!FlowItems.Contains(item.MaterialName))
FlowItems.Insert(0, item.MaterialName);//下拉框
if (!FlowItems.Contains(item.MaterialLoc.ToString()))
FlowItems.Add( item.MaterialLoc.ToString());//下拉框
}
ActionManage.GetInstance.Send("MaterialNum", name.materialCollection.Count);
name.FlowProcess.fpModels = flowProcessModels;
@@ -99,21 +103,32 @@ namespace FryPot_DosingSystem.ViewModel
if (name != null)
{
name.FlowProcess.RecipeName = currentRecipeName.ToString();
//工艺桶号重复性检测
foreach (var item in name.materialCollection)
{
var res = flowProcessModels.Where(p => p.FryMaterialNum == item.MaterialLoc.ToString());
if (res.Count() > 1)
{
// NoticeDemoViewModel.OpenMsg(EnumPromptType.Error, App.MainWindow, "提示", $"保存失败,桶号重复!");
MessageNotify.GetInstance.ShowUserLog("保存失败,桶号重复");
MessageBox.Show("保存失败,桶号重复","提示",MessageBoxButton.OK,MessageBoxImage.Error);
return;
}
}
// name.FlowProcess.fpModels = flowProcessModels;
name.FlowProcess.fpModels.Clear();
foreach (var item in flowProcessModels)
{
name.FlowProcess.fpModels.Add(new FlowProcessModel { FryMaterialNum = item.FryMaterialNum, FrySpeed = item.FrySpeed, FryWeight = item.FryWeight, FryTemperature = item.FryTemperature, FryPeriodTime = item.FryPeriodTime });
name.FlowProcess.fpModels.Add(new FlowProcessModel { FryMaterialNum = item.FryMaterialNum, FrySpeed = item.FrySpeed, FryTemperature = item.FryTemperature, FryPeriodTime = item.FryPeriodTime,FryFire=item.FryFire,FryFirePercent=item.FryFirePercent });
}
foreach (var item in name.materialCollection)
{
string s= Json<FlowProcessNames>.Data.Names.FirstOrDefault(p=>p == item.MaterialName);
string s= Json<FlowProcessNames>.Data.Names.FirstOrDefault(p=>p == item.MaterialLoc.ToString());
Json<FlowProcessNames>.Data.Names.Remove(s);
}
}
Json<RecipeManage>.Save();
Json<FlowProcessNames>.Save();
ActionManage.GetInstance.Send("CloseFlowProcessView");
});


+ 36
- 36
FryPot_DosingSystem/ViewModel/NewRecipeViewModel.cs View File

@@ -101,18 +101,18 @@ namespace FryPot_DosingSystem.ViewModel
if (materials.Count<=8&& materials.Count> 0)
{
int lineNum= materials.ElementAt(0).MaterialLoc / 100;
//桶号正确性验证
for (int i = 0; i < materials.Count; i++)
{
if (materials.ElementAt(i).MaterialLoc / 100 != lineNum|| materials.ElementAt(i).MaterialLoc % 100!=i+1||lineNum<=0||lineNum>5)
{
MessageNotify.GetInstance.ShowUserLog($"新建配方【{RecipeName}】无效:【配方中原料桶号异常】");
NoticeDemoViewModel.OpenMsg(EnumPromptType.Error, App.MainWindow, "提示", $"新建配方【{RecipeName}】无效");
ActionManage.GetInstance.Send("CloseNewRecipeView");
return;
}
}
//int lineNum= materials.ElementAt(0).MaterialLoc / 100;
// //桶号正确性验证
// for (int i = 0; i < materials.Count; i++)
// {
// if (materials.ElementAt(i).MaterialLoc / 100 != lineNum|| materials.ElementAt(i).MaterialLoc % 100!=i+1||lineNum<=0||lineNum>5)
// {
// MessageNotify.GetInstance.ShowUserLog($"新建配方【{RecipeName}】无效:【配方中原料桶号异常】");
// NoticeDemoViewModel.OpenMsg(EnumPromptType.Error, App.MainWindow, "提示", $"新建配方【{RecipeName}】无效");
// ActionManage.GetInstance.Send("CloseNewRecipeView");
// return;
// }
// }

prop: string recipeID = Guid.NewGuid().ToString();//配方唯一ID,后期根据实际要求更改
var res = Json<RecipeManage>.Data.Recipes.FirstOrDefault(p => p.RecipeId == recipeID);
@@ -144,18 +144,18 @@ namespace FryPot_DosingSystem.ViewModel
{
if (materials.Count > 0 && materials.Count <= 8)
{
int lineNum = materials.ElementAt(0).MaterialLoc / 100;
//桶号正确性验证
for (int i = 0; i < materials.Count; i++)
{
if (materials.ElementAt(i).MaterialLoc / 100 != lineNum && materials.ElementAt(i).MaterialLoc % 100 != i + 1 || lineNum <= 0 || lineNum > 5)
{
MessageNotify.GetInstance.ShowUserLog($"另存配方【{RecipeName}】无效:【配方中原料桶号异常】");
NoticeDemoViewModel.OpenMsg(EnumPromptType.Error, App.MainWindow, "提示", $"另存配方【{RecipeName}】无效");
ActionManage.GetInstance.Send("CloseNewRecipeView");
return;
}
}
//int lineNum = materials.ElementAt(0).MaterialLoc / 100;
////桶号正确性验证
//for (int i = 0; i < materials.Count; i++)
//{
// if (materials.ElementAt(i).MaterialLoc / 100 != lineNum || materials.ElementAt(i).MaterialLoc % 100 != i + 1 || lineNum <= 0 || lineNum > 5)
// {
// MessageNotify.GetInstance.ShowUserLog($"另存配方【{RecipeName}】无效:【配方中原料桶号异常】");
// NoticeDemoViewModel.OpenMsg(EnumPromptType.Error, App.MainWindow, "提示", $"另存配方【{RecipeName}】无效");
// ActionManage.GetInstance.Send("CloseNewRecipeView");
// return;
// }
//}
bom.materialCollection = materials;
bom.RecipeName = RecipeName;
bom.UpdateTime = DateTime.Now.ToShortDateString();
@@ -180,18 +180,18 @@ namespace FryPot_DosingSystem.ViewModel
{
if (materials.Count>0&& materials.Count<=8)//验证配方中原料桶数
{
int lineNum = materials.ElementAt(0).MaterialLoc / 100;
//桶号正确性验证
for (int i = 0; i < materials.Count; i++)
{
if (materials.ElementAt(i).MaterialLoc / 100 != lineNum && materials.ElementAt(i).MaterialLoc % 100 != i + 1 || lineNum <= 0 || lineNum > 5)
{
MessageNotify.GetInstance.ShowUserLog($"另存配方【{RecipeName}】无效:【配方中原料桶号异常】");
NoticeDemoViewModel.OpenMsg(EnumPromptType.Error, App.MainWindow, "提示", $"另存配方【{RecipeName}】无效");
ActionManage.GetInstance.Send("CloseNewRecipeView");
return;
}
}
//int lineNum = materials.ElementAt(0).MaterialLoc / 100;
////桶号正确性验证
//for (int i = 0; i < materials.Count; i++)
//{
// if (materials.ElementAt(i).MaterialLoc / 100 != lineNum || materials.ElementAt(i).MaterialLoc % 100 != i + 1 || lineNum <= 0 || lineNum > 5)
// {
// MessageNotify.GetInstance.ShowUserLog($"另存配方【{RecipeName}】无效:【配方中原料桶号异常】");
// NoticeDemoViewModel.OpenMsg(EnumPromptType.Error, App.MainWindow, "提示", $"另存配方【{RecipeName}】无效");
// ActionManage.GetInstance.Send("CloseNewRecipeView");
// return;
// }
//}

prop: string recipeID = Guid.NewGuid().ToString();//配方唯一ID,后期根据实际要求更改
var res = Json<RecipeManage>.Data.Recipes.FirstOrDefault(p => p.RecipeId == recipeID);


+ 2
- 28
SmartClient.sln View File

@@ -136,13 +136,9 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "WPFDemo", "WPFDemo\WPFDemo.
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "0.SCADA", "0.SCADA", "{7B0175AD-BB74-4A98-B9A7-1E289032485E}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BPASmartClient.DATABUS", "BPASmartClient.DATABUS\BPASmartClient.DATABUS.csproj", "{7C1AF86E-867C-427E-90DB-6473D88F51EB}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BPASmartClient.SCADAControl", "BPASmartClient.SCADAControl\BPASmartClient.SCADAControl.csproj", "{6A3FC66D-0B89-45E8-B39B-9D81538002D1}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "1.可视化内存数据", "1.可视化内存数据", "{7BED8969-7EA7-409C-8BBC-D2777ECDA2F1}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "2.可视化控件集", "2.可视化控件集", "{5300552F-560D-474A-8D96-0A2747D08F64}"
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "可视化控件集", "可视化控件集", "{5300552F-560D-474A-8D96-0A2747D08F64}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BPASmart.VariableManager", "BPASmart.VariableManager\BPASmart.VariableManager.csproj", "{2C17B9A9-B27B-4F07-AFB0-0F56A975D501}"
EndProject
@@ -156,7 +152,7 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BPASmart.Server", "BPASmart
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ComputerTestDemo", "ComputerTestDemo\ComputerTestDemo.csproj", "{8940F1E2-693D-407E-AD03-722718860609}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "3.可视化配置工具", "3.可视化配置工具", "{06F0B369-0483-46DD-82D2-70431FB505C1}"
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "可视化配置工具", "可视化配置工具", "{06F0B369-0483-46DD-82D2-70431FB505C1}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BeDesignerSCADA", "BeDesignerSCADA\BeDesignerSCADA.csproj", "{DF8B4C38-39DE-4220-AB60-885CAE6D1E47}"
EndProject
@@ -1334,26 +1330,6 @@ Global
{A456D582-D910-4CA2-8620-6D8F63344B47}.Release|x64.Build.0 = Release|Any CPU
{A456D582-D910-4CA2-8620-6D8F63344B47}.Release|x86.ActiveCfg = Release|Any CPU
{A456D582-D910-4CA2-8620-6D8F63344B47}.Release|x86.Build.0 = Release|Any CPU
{7C1AF86E-867C-427E-90DB-6473D88F51EB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{7C1AF86E-867C-427E-90DB-6473D88F51EB}.Debug|Any CPU.Build.0 = Debug|Any CPU
{7C1AF86E-867C-427E-90DB-6473D88F51EB}.Debug|ARM.ActiveCfg = Debug|Any CPU
{7C1AF86E-867C-427E-90DB-6473D88F51EB}.Debug|ARM.Build.0 = Debug|Any CPU
{7C1AF86E-867C-427E-90DB-6473D88F51EB}.Debug|ARM64.ActiveCfg = Debug|Any CPU
{7C1AF86E-867C-427E-90DB-6473D88F51EB}.Debug|ARM64.Build.0 = Debug|Any CPU
{7C1AF86E-867C-427E-90DB-6473D88F51EB}.Debug|x64.ActiveCfg = Debug|Any CPU
{7C1AF86E-867C-427E-90DB-6473D88F51EB}.Debug|x64.Build.0 = Debug|Any CPU
{7C1AF86E-867C-427E-90DB-6473D88F51EB}.Debug|x86.ActiveCfg = Debug|Any CPU
{7C1AF86E-867C-427E-90DB-6473D88F51EB}.Debug|x86.Build.0 = Debug|Any CPU
{7C1AF86E-867C-427E-90DB-6473D88F51EB}.Release|Any CPU.ActiveCfg = Release|Any CPU
{7C1AF86E-867C-427E-90DB-6473D88F51EB}.Release|Any CPU.Build.0 = Release|Any CPU
{7C1AF86E-867C-427E-90DB-6473D88F51EB}.Release|ARM.ActiveCfg = Release|Any CPU
{7C1AF86E-867C-427E-90DB-6473D88F51EB}.Release|ARM.Build.0 = Release|Any CPU
{7C1AF86E-867C-427E-90DB-6473D88F51EB}.Release|ARM64.ActiveCfg = Release|Any CPU
{7C1AF86E-867C-427E-90DB-6473D88F51EB}.Release|ARM64.Build.0 = Release|Any CPU
{7C1AF86E-867C-427E-90DB-6473D88F51EB}.Release|x64.ActiveCfg = Release|Any CPU
{7C1AF86E-867C-427E-90DB-6473D88F51EB}.Release|x64.Build.0 = Release|Any CPU
{7C1AF86E-867C-427E-90DB-6473D88F51EB}.Release|x86.ActiveCfg = Release|Any CPU
{7C1AF86E-867C-427E-90DB-6473D88F51EB}.Release|x86.Build.0 = Release|Any CPU
{6A3FC66D-0B89-45E8-B39B-9D81538002D1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{6A3FC66D-0B89-45E8-B39B-9D81538002D1}.Debug|Any CPU.Build.0 = Debug|Any CPU
{6A3FC66D-0B89-45E8-B39B-9D81538002D1}.Debug|ARM.ActiveCfg = Debug|Any CPU
@@ -1756,9 +1732,7 @@ Global
{FA695D7E-6F12-4483-A16D-8494609FAE68} = {8712125E-14CD-4E1B-A1CE-4BDE03805942}
{D609C4CF-FA5C-4D39-B12F-07A60FFE5E40} = {8712125E-14CD-4E1B-A1CE-4BDE03805942}
{A456D582-D910-4CA2-8620-6D8F63344B47} = {8712125E-14CD-4E1B-A1CE-4BDE03805942}
{7C1AF86E-867C-427E-90DB-6473D88F51EB} = {7BED8969-7EA7-409C-8BBC-D2777ECDA2F1}
{6A3FC66D-0B89-45E8-B39B-9D81538002D1} = {5300552F-560D-474A-8D96-0A2747D08F64}
{7BED8969-7EA7-409C-8BBC-D2777ECDA2F1} = {7B0175AD-BB74-4A98-B9A7-1E289032485E}
{5300552F-560D-474A-8D96-0A2747D08F64} = {7B0175AD-BB74-4A98-B9A7-1E289032485E}
{2C17B9A9-B27B-4F07-AFB0-0F56A975D501} = {CDC1E762-5E1D-4AE1-9DF2-B85761539086}
{00C5B45D-9799-43F1-B07B-9F638AA9FF72} = {CDC1E762-5E1D-4AE1-9DF2-B85761539086}


+ 13
- 0
TestDemo/Form1.Designer.cs View File

@@ -34,6 +34,7 @@
this.button3 = new System.Windows.Forms.Button();
this.button4 = new System.Windows.Forms.Button();
this.splitContainer1 = new System.Windows.Forms.SplitContainer();
this.button5 = new System.Windows.Forms.Button();
((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit();
this.splitContainer1.SuspendLayout();
this.SuspendLayout();
@@ -95,11 +96,22 @@
this.splitContainer1.SplitterDistance = 45;
this.splitContainer1.TabIndex = 5;
//
// button5
//
this.button5.Location = new System.Drawing.Point(301, 13);
this.button5.Name = "button5";
this.button5.Size = new System.Drawing.Size(82, 40);
this.button5.TabIndex = 6;
this.button5.Text = "写文件";
this.button5.UseVisualStyleBackColor = true;
this.button5.Click += new System.EventHandler(this.button5_Click);
//
// Form1
//
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 17F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(641, 298);
this.Controls.Add(this.button5);
this.Controls.Add(this.splitContainer1);
this.Controls.Add(this.button4);
this.Controls.Add(this.button3);
@@ -123,5 +135,6 @@
private Button button3;
private Button button4;
private SplitContainer splitContainer1;
private Button button5;
}
}

+ 47
- 12
TestDemo/Form1.cs View File

@@ -11,10 +11,15 @@ namespace TestDemo
{

int count = 0;
SiemensHelper siemensHelper = new SiemensHelper();
public Form1()
{
InitializeComponent();

//ActionManage.GetInstance.Register(new Action(() =>
//{
// label1.Text = (count++).ToString();
//}), \"加数值\");
SiemensHelper siemensHelper = new SiemensHelper();
siemensHelper.Connect(S7.Net.CpuType.S71200, "192.168.101.11");
var res = siemensHelper.ReadClass<ReadClass>(1);
@@ -26,25 +31,30 @@ namespace TestDemo
label1.Text = (count++).ToString();
}), "加数值");

ActionManage.GetInstance.Register(new Action(() =>
{
Console.WriteLine("开始执行阻塞方法");
Thread.Sleep(20000);
Console.WriteLine("阻塞方法执行完成");
}), "阻塞方法");
//ActionManage.GetInstance.Register(new Action(() =>
//{
// Console.WriteLine(\"开始执行阻塞方法\");
// Thread.Sleep(20000);
// Console.WriteLine(\"阻塞方法执行完成\");
//}), \"阻塞方法\");
}

private void button1_Click(object sender, EventArgs e)
{
AGVToUpSystem aGVToUpSystem = new AGVToUpSystem();
//AGVToUpSystem aGVToUpSystem = new AGVToUpSystem();
//string value = JsonConvert.SerializeObject(aGVToUpSystem);
//string url = $"http://192.168.1.40:8089/apicallback/quicktron/robotjob/report?sign={value}";
string url = "http://192.168.1.40:8089/apicallback/quicktron/robotjob/report";
var res = APIHelper.GetInstance.HttpRequest(url, "", aGVToUpSystem, RequestType.POST);
////string url = $\"http://172.16.11.118:8089/apicallback/quicktron/robotjob/report?sign={value}\";
//string url = \"http://172.16.11.118:8089/apicallback/quicktron/robotjob/report\";
//var res = APIHelper.GetInstance.HttpRequest(url, \"\", aGVToUpSystem, RequestType.POST);
}

private void button2_Click(object sender, EventArgs e)
{
//Upstreamrequest aGVToUpSystem = new Upstreamrequest() { agvCode=\"ZT11\" };
//string value = JsonConvert.SerializeObject(aGVToUpSystem);
////string url = $\"http://172.16.11.118:8089/apicallback/quicktron/robotjob/upstreamrequest?sign={value}\";
//string url = $\"http://172.16.11.118:8089/apicallback/quicktron/robotjob/upstreamrequest\";
//var res = APIHelper.GetInstance.HttpRequest(url, \"\", aGVToUpSystem, RequestType.POST);
Upstreamrequest aGVToUpSystem = new Upstreamrequest() { agvCode = "123" };
// string value = JsonConvert.SerializeObject(aGVToUpSystem);
// string url = $"http://192.168.1.40:8089/apicallback/quicktron/robotjob/upstreamrequest?sign={value}";
@@ -55,16 +65,41 @@ namespace TestDemo

private void button3_Click(object sender, EventArgs e)
{
ActionManage.GetInstance.Send("加数值");
//ActionManage.GetInstance.Send(\"加数值\");
}

private void button4_Click(object sender, EventArgs e)
{
Task.Run(new Action(() =>
{
ActionManage.GetInstance.Send("阻塞方法");
// ActionManage.GetInstance.Send(\"阻塞方法\");
}));

}

private void button5_Click(object sender, EventArgs e)
{
//var res = siemensHelper.ReadClass<PlcToComputer>(3);

PlcToComputer tt = new PlcToComputer();
for (int i = 0; i < tt.LocationFeedback.Length; i++)
{
tt.LocationFeedback[i] = (short)i;
}
siemensHelper.WriteClass(tt, 3);
}

private void button5_Click(object sender, EventArgs e)
{
//string body =\" { \\"header\\":{ \\"requestId\\":\\"05c1124b4ec443329bbf8da7d2aba5f2\\",\\"timestamp\\":\\"2022-10-19 12:27:27\\",\\"version\\":\\"2.7\\"},\\"body\\":{ \\"event\\":{ \\"agvCode\\":\\"ZT11-21\\",\\"command\\":\\"LOAD\\",\\"containerCode\\":\\"24fefca64b65f2a\\",\\"equipmentId\\":0,\\"jobId\\":\\"SIRoller_166615364143003483\\",\\"msgId\\":\\"1666153642429\\"},\\"ts\\":1666153642429,\\"type\\":\\"REQUEST_DEVICE\\",\\"warehouseId\\":1,\\"zoneCode\\":\\"zone\\"} }\";

string body =" { \"header\":{ \"requestId\":\"471d848e19ed4696858f72c25415f0e8\",\"timestamp\":\"2022-10-19 17:29:27\",\"version\":\"2.7\"},\"body\":{ \"event\":{ \"jobData\":{ \"agvCode\":\"ZT11-24\",\"containerCode\":\"24ff16fcb707a86\",\"pointCode\":\"sxSX88\",\"startPointCode\":\"sxSX88\",\"targetPointCode\":\"naFssQ\"},\"jobId\":\"SIBucket_166617173650007811\",\"jobType\":\"POINT_ROLLER_MOVE\",\"robotJobId\":\"c981a984-91bc-4f94-9685-3a8a36629457\",\"state\":\"ROLLER_LOAD_DOING\",\"warehouseId\":1},\"id\":\"18717ed5-9e79-4f73-a6ea-176e50792696\",\"ts\":1666171767233,\"type\":\"JobReportEvent\",\"warehouseId\":1,\"zoneCode\":\"kckq\"} }";

var res = JsonConvert.DeserializeObject<TaskData>(body);
var r = res.body.@event;



}
}
}

+ 46
- 0
TestDemo/PlcToComputer.cs View File

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

namespace TestDemo
{
public class PlcToComputer
{
/// <summary>
/// 心跳
/// </summary>
public bool Heartbeat { get; set; }

/// <summary>
/// 接收完成
/// </summary>
public bool ResComplete { get; set; }

/// <summary>
/// 系统系统或停止
/// </summary>
public bool SystemStartOrStop { get; set; }

/// <summary>
/// 手自动切换
/// </summary>
public bool HandOrAuto { get; set; }

/// <summary>
/// 桶位置反馈
/// </summary>
public short[] LocationFeedback { get; set; } = new short[32];

/// <summary>
/// 是否允许配料
/// </summary>
public bool[] IsAllowIngredients { get; set; } = new bool[32];

/// <summary>
/// 报警信息
/// </summary>
public bool[] ArrayInfo { get; set; } = new bool[32];
}
}

Loading…
Cancel
Save