@@ -11,8 +11,8 @@ namespace BPASmartClient.AGV | |||
/// </summary> | |||
internal class AGVLoadInteracteModel | |||
{ | |||
private static AGVLoadInteracteModel _instance; | |||
public static AGVLoadInteracteModel GetInstance=>_instance ??= new AGVLoadInteracteModel(); | |||
//private static AGVLoadInteracteModel _instance; | |||
//public static AGVLoadInteracteModel GetInstance=>_instance ??= new AGVLoadInteracteModel(); | |||
public string agvCode { get; set;} | |||
public string jobId { get; set; } | |||
public string msgId { get; set; } | |||
@@ -11,8 +11,8 @@ namespace BPASmartClient.AGV | |||
/// </summary> | |||
internal class AGVModel | |||
{ | |||
private static AGVModel _instance; | |||
public static AGVModel GetInstance => _instance ??= new AGVModel(); | |||
//private static AGVModel _instance; | |||
//public static AGVModel GetInstance => _instance ??= new AGVModel(); | |||
/// <summary> | |||
/// 必填项 | |||
@@ -11,8 +11,8 @@ namespace BPASmartClient.AGV | |||
/// </summary> | |||
internal class AGVTaskCancelModel | |||
{ | |||
private static AGVTaskCancelModel _instance; | |||
public static AGVTaskCancelModel GetInstance => _instance ??= new AGVTaskCancelModel(); | |||
//private static AGVTaskCancelModel _instance; | |||
//public static AGVTaskCancelModel GetInstance => _instance ??= new AGVTaskCancelModel(); | |||
public string robotJobId { get; set; } | |||
public long warehouseId { get; set; } | |||
public string? executeMode { get; set; } | |||
@@ -11,8 +11,8 @@ namespace BPASmartClient.AGV | |||
/// </summary> | |||
internal class AGVTaskCompleteNotifyModel | |||
{ | |||
private static AGVTaskCompleteNotifyModel _instance; | |||
public static AGVTaskCompleteNotifyModel GetInstance=>_instance ??= new AGVTaskCompleteNotifyModel(); | |||
//private static AGVTaskCompleteNotifyModel _instance; | |||
//public static AGVTaskCompleteNotifyModel GetInstance=>_instance ??= new AGVTaskCompleteNotifyModel(); | |||
public string? robotJobId { get; set; } | |||
public string? bucketCode { get; set; } | |||
public string? bucketslotCode { get; set; } | |||
@@ -11,8 +11,8 @@ namespace BPASmartClient.AGV | |||
/// </summary> | |||
internal class AGV_PointRollerJobData:IJobData | |||
{ | |||
private static AGV_PointRollerJobData _instance; | |||
public static AGV_PointRollerJobData GetInstance => _instance ??= new AGV_PointRollerJobData(); | |||
//private static AGV_PointRollerJobData _instance; | |||
//public static AGV_PointRollerJobData GetInstance => _instance ??= new AGV_PointRollerJobData(); | |||
public string? containerCode { get; set; } | |||
public string startPoint { get; set; } | |||
public string endPoint { get; set; } | |||
@@ -11,8 +11,8 @@ namespace BPASmartClient.AGV | |||
/// </summary> | |||
internal class AGV_SlotRollerJobData:IJobData | |||
{ | |||
private static AGV_SlotRollerJobData _instance; | |||
public static AGV_SlotRollerJobData GetInstance => _instance ??= new AGV_SlotRollerJobData(); | |||
//private static AGV_SlotRollerJobData _instance; | |||
//public static AGV_SlotRollerJobData GetInstance => _instance ??= new AGV_SlotRollerJobData(); | |||
public string? containerCode { get; set; } | |||
public string startSlotCode { get; set; } | |||
public string endSlotCode { get; set; } | |||
@@ -8,8 +8,8 @@ namespace BPASmartClient.AGV | |||
{ | |||
internal class HttpRequestHeaderModel | |||
{ | |||
private static HttpRequestHeaderModel _instance; | |||
public static HttpRequestHeaderModel GetInstance => _instance ??= new HttpRequestHeaderModel(); | |||
//private static HttpRequestHeaderModel _instance; | |||
//public static HttpRequestHeaderModel GetInstance => _instance ??= new HttpRequestHeaderModel(); | |||
public string? appKey { get; set; } | |||
public string? appSecret { get; set; } | |||
public string? requestId { get; set; } | |||
@@ -30,7 +30,7 @@ namespace BPASmartClient.CustomResource.Pages.View | |||
this.WindowState = WindowState.Maximized; | |||
this.ButMin.Click += (o, e) => { this.WindowState = WindowState.Minimized; }; | |||
this.ButMax.Click += (o, e) => { this.WindowState = this.WindowState == WindowState.Maximized ? WindowState.Normal : WindowState.Maximized; }; | |||
this.ButClose.Click += (o, e) => { this.Close(); }; | |||
this.ButClose.Click += (o, e) => { this.Close(); Application.Current.Shutdown(); }; | |||
this.MoveBorder.MouseLeftButtonDown += (o, e) => | |||
{ | |||
if (e.ClickCount > 1) | |||
@@ -2,12 +2,11 @@ | |||
<configuration> | |||
<appSettings> | |||
<!--请求报文头--> | |||
<add key="appKey" value="132"/> | |||
<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"/> | |||
<!--请求报文体--> | |||
</appSettings> | |||
<!--请求报文体--> | |||
</configuration> |
@@ -69,13 +69,13 @@ namespace FryPot_DosingSystem.Control | |||
{ | |||
try | |||
{ | |||
if (Json<PlcVariableInfoManage>.Data.VariablesInfo["滚筒输送线"].Count>0) | |||
if (Json<PlcVariableInfoManage>.Data.VariablesInfo["滚筒输送线"].Count > 0) | |||
{ | |||
//foreach (var item in Json<PlcVariableInfoManage>.Data.VariablesInfo["滚筒运输线"]) | |||
//{ | |||
// Variables.Add(new PlcVariableModel { Address = item.PlcAddress, Length = (ushort)(item.Length == null ? 0 : item.Length) }); | |||
//} | |||
foreach (KeyValuePair<string,ObservableCollection<PlcVariableInfoModel>> dic in Json<PlcVariableInfoManage>.Data.VariablesInfo) | |||
foreach (KeyValuePair<string, ObservableCollection<PlcVariableInfoModel>> dic in Json<PlcVariableInfoManage>.Data.VariablesInfo) | |||
{ | |||
if (string.Equals(dic.Key, "滚筒输送线")) | |||
{ | |||
@@ -134,7 +134,7 @@ namespace FryPot_DosingSystem.Control | |||
else | |||
{ | |||
IsConfig = false; | |||
MessageLog.GetInstance.ShowRunLog("PLC变量配置失败:文件无数据,请重新配置"); | |||
MessageLog.GetInstance.ShowRunLog("PLC变量配置失败:文件无数据,请重新配置并重启软件"); | |||
} | |||
//Variables.Add(new PlcVariableModel() { Address = "D2001", Length = 8 });//1号线体滚筒工位号 | |||
//Variables.Add(new PlcVariableModel() { Address = "D2011", Length = 8 });//2号线体滚筒工位号 | |||
@@ -208,103 +208,123 @@ namespace FryPot_DosingSystem.Control | |||
Thread.Sleep(50); | |||
} | |||
//炒锅1 | |||
FryOneConnected = fryOneModbus.Connected; | |||
while (FryOneConnected) | |||
{ | |||
foreach (var item in FryOneVariables) | |||
{ | |||
var res = fryOneModbus.Read(item.Address, item.Length);//读取plc数据 | |||
if (FryOneData.ContainsKey(item.Address)) | |||
{ | |||
FryOneData[item.Address] = res; | |||
} | |||
else | |||
{ | |||
FryOneData.TryAdd(item.Address, res); | |||
} | |||
} | |||
Thread.Sleep(50); | |||
Thread.Sleep(10); | |||
}), $"滚筒线实时数据读取线程"); | |||
ThreadManage.GetInstance().StartLong(new Action(() => | |||
{ | |||
//炒锅1 | |||
FryOneConnected = fryOneModbus.Connected; | |||
while (FryOneConnected) | |||
{ | |||
foreach (var item in FryOneVariables) | |||
{ | |||
var res = fryOneModbus.Read(item.Address, item.Length);//读取plc数据 | |||
if (FryOneData.ContainsKey(item.Address)) | |||
{ | |||
FryOneData[item.Address] = res; | |||
} | |||
else | |||
{ | |||
FryOneData.TryAdd(item.Address, res); | |||
} | |||
} | |||
Thread.Sleep(50); | |||
} | |||
//炒锅2 | |||
FryTwoConnected = fryTwoModbus.Connected; | |||
while (FryTwoConnected) | |||
{ | |||
foreach (var item in FryTwoVariables) | |||
{ | |||
var res = fryTwoModbus.Read(item.Address, item.Length);//读取plc数据 | |||
if (FryTwoData.ContainsKey(item.Address)) | |||
{ | |||
FryTwoData[item.Address] = res; | |||
} | |||
else | |||
{ | |||
FryTwoData.TryAdd(item.Address, res); | |||
} | |||
} | |||
Thread.Sleep(50); | |||
} | |||
Thread.Sleep(10); | |||
}), $"炒锅1实时数据读取线程"); | |||
ThreadManage.GetInstance().StartLong(new Action(() => | |||
{ | |||
//炒锅2 | |||
FryTwoConnected = fryTwoModbus.Connected; | |||
while (FryTwoConnected) | |||
{ | |||
foreach (var item in FryTwoVariables) | |||
{ | |||
var res = fryTwoModbus.Read(item.Address, item.Length);//读取plc数据 | |||
if (FryTwoData.ContainsKey(item.Address)) | |||
{ | |||
FryTwoData[item.Address] = res; | |||
} | |||
else | |||
{ | |||
FryTwoData.TryAdd(item.Address, res); | |||
} | |||
} | |||
Thread.Sleep(50); | |||
} | |||
//炒锅3 | |||
FryThreeConnected = fryThreeModbus.Connected; | |||
while (FryThreeConnected) | |||
{ | |||
foreach (var item in FryThreeVariables) | |||
{ | |||
var res = fryThreeModbus.Read(item.Address, item.Length);//读取plc数据 | |||
if (FryThreeData.ContainsKey(item.Address)) | |||
{ | |||
FryThreeData[item.Address] = res; | |||
} | |||
else | |||
{ | |||
FryThreeData.TryAdd(item.Address, res); | |||
} | |||
} | |||
Thread.Sleep(50); | |||
} | |||
Thread.Sleep(10); | |||
}), $"炒锅2实时数据读取线程"); | |||
ThreadManage.GetInstance().StartLong(new Action(() => | |||
{ | |||
//炒锅3 | |||
FryThreeConnected = fryThreeModbus.Connected; | |||
while (FryThreeConnected) | |||
{ | |||
foreach (var item in FryThreeVariables) | |||
{ | |||
var res = fryThreeModbus.Read(item.Address, item.Length);//读取plc数据 | |||
if (FryThreeData.ContainsKey(item.Address)) | |||
{ | |||
FryThreeData[item.Address] = res; | |||
} | |||
else | |||
{ | |||
FryThreeData.TryAdd(item.Address, res); | |||
} | |||
} | |||
Thread.Sleep(50); | |||
} | |||
//炒锅4 | |||
FryFourConnected = fryFourModbus.Connected; | |||
while (FryFourConnected) | |||
{ | |||
foreach (var item in FryFourVariables) | |||
{ | |||
var res = fryFourModbus.Read(item.Address, item.Length);//读取plc数据 | |||
if (FryFourData.ContainsKey(item.Address)) | |||
{ | |||
FryFourData[item.Address] = res; | |||
} | |||
else | |||
{ | |||
FryFourData.TryAdd(item.Address, res); | |||
} | |||
} | |||
Thread.Sleep(50); | |||
} | |||
Thread.Sleep(10); | |||
}), $"炒锅3实时数据读取线程"); | |||
ThreadManage.GetInstance().StartLong(new Action(() => | |||
{ | |||
//炒锅4 | |||
FryFourConnected = fryFourModbus.Connected; | |||
while (FryFourConnected) | |||
{ | |||
foreach (var item in FryFourVariables) | |||
{ | |||
var res = fryFourModbus.Read(item.Address, item.Length);//读取plc数据 | |||
if (FryFourData.ContainsKey(item.Address)) | |||
{ | |||
FryFourData[item.Address] = res; | |||
} | |||
else | |||
{ | |||
FryFourData.TryAdd(item.Address, res); | |||
} | |||
} | |||
Thread.Sleep(50); | |||
} | |||
//炒锅5 | |||
FryFiveConnected = fryFiveModbus.Connected; | |||
while (FryFiveConnected) | |||
{ | |||
foreach (var item in FryFiveVariables) | |||
{ | |||
var res = fryFiveModbus.Read(item.Address, item.Length);//读取plc数据 | |||
if (FryFiveData.ContainsKey(item.Address)) | |||
{ | |||
FryFiveData[item.Address] = res; | |||
} | |||
else | |||
{ | |||
FryFiveData.TryAdd(item.Address, res); | |||
} | |||
} | |||
Thread.Sleep(50); | |||
} | |||
Thread.Sleep(10); | |||
}), $"炒锅4实时数据读取线程"); | |||
ThreadManage.GetInstance().StartLong(new Action(() => | |||
{ | |||
//炒锅5 | |||
FryFiveConnected = fryFiveModbus.Connected; | |||
while (FryFiveConnected) | |||
{ | |||
foreach (var item in FryFiveVariables) | |||
{ | |||
var res = fryFiveModbus.Read(item.Address, item.Length);//读取plc数据 | |||
if (FryFiveData.ContainsKey(item.Address)) | |||
{ | |||
FryFiveData[item.Address] = res; | |||
} | |||
else | |||
{ | |||
FryFiveData.TryAdd(item.Address, res); | |||
} | |||
} | |||
Thread.Sleep(50); | |||
} | |||
Thread.Sleep(500); | |||
}), $"PLC实时数据读取线程"); | |||
} | |||
Thread.Sleep(10); | |||
}), $"炒锅5实时数据读取线程"); | |||
} | |||
} | |||
public void WritePlcData(string address, ushort value) | |||
@@ -219,7 +219,7 @@ namespace FryPot_DosingSystem.Control | |||
ActionManage.GetInstance.Register(new Action(() => | |||
{ | |||
string id = Guid.NewGuid().ToString(); | |||
string errorCode = AGVHelper._Instance.AgvToLineOneLoadRoller(id); | |||
string errorCode = AGVHelper.GetInstance.AgvToLineOneLoadRoller(id); | |||
if (errorCode == "SUCCESS") | |||
{ | |||
MessageLog.GetInstance.ShowRunLog($"AGV任务下发成功"); | |||
@@ -1573,7 +1573,9 @@ namespace FryPot_DosingSystem.Control | |||
}), "MainViewReadPlcData"); | |||
} | |||
/// <summary> | |||
/// 炒锅状态实时显示 | |||
/// </summary> | |||
private void FryPotStatusDisplay() | |||
{ | |||
FryPotInfoManage.GetInstance.variableInfos.FirstOrDefault(p => p.VarName == "FryPotOneTemp").CurrentValue = FryPotMonitorManage.GetInstance.fryOne.Temperature.ToString(); | |||
@@ -1631,10 +1633,10 @@ namespace FryPot_DosingSystem.Control | |||
{ | |||
#region 炒锅1状态数据保存 | |||
if (!Directory.Exists("AccessFile\\" + "DB" + "炒锅1状态数据")) | |||
if (!Directory.Exists("AccessFile\\" + "DB\\" + "炒锅1状态数据")) | |||
{ | |||
Directory.CreateDirectory("AccessFile\\" + "DB\\" + "炒锅1状态数据"); | |||
if (!Directory.Exists("AccessFile\\" + "DB" + "炒锅1状态数据\\" + DateTime.Now.ToShortDateString())) | |||
if (!Directory.Exists("AccessFile\\" + "DB\\" + "炒锅1状态数据\\" + DateTime.Now.ToShortDateString())) | |||
Directory.CreateDirectory("AccessFile\\" + "DB\\" + "炒锅1状态数据\\" + DateTime.Now.ToShortDateString()); | |||
if (globalVar.LOneFryPotSerial == 1 && fryOneRecipe != string.Empty) | |||
@@ -1651,7 +1653,7 @@ namespace FryPot_DosingSystem.Control | |||
} | |||
else | |||
{ | |||
if (!Directory.Exists("AccessFile\\" + "DB" + "炒锅1状态数据\\" + DateTime.Now.ToShortDateString())) | |||
if (!Directory.Exists("AccessFile\\" + "DB\\" + "炒锅1状态数据\\" + DateTime.Now.ToShortDateString())) | |||
Directory.CreateDirectory("AccessFile\\" + "DB\\" + "炒锅1状态数据\\" + DateTime.Now.ToShortDateString()); | |||
if (globalVar.LOneFryPotSerial == 1 && fryOneRecipe != string.Empty) | |||
{ | |||
@@ -1667,10 +1669,10 @@ namespace FryPot_DosingSystem.Control | |||
} | |||
#endregion | |||
#region 炒锅2状态数据保存 | |||
if (!Directory.Exists("AccessFile\\" + "DB" + "炒锅2状态数据")) | |||
if (!Directory.Exists("AccessFile\\" + "DB\\" + "炒锅2状态数据")) | |||
{ | |||
Directory.CreateDirectory("AccessFile\\" + "DB\\" + "炒锅2状态数据"); | |||
if (!Directory.Exists("AccessFile\\" + "DB" + "炒锅2状态数据\\" + DateTime.Now.ToShortDateString())) | |||
if (!Directory.Exists("AccessFile\\" + "DB\\" + "炒锅2状态数据\\" + DateTime.Now.ToShortDateString())) | |||
Directory.CreateDirectory("AccessFile\\" + "DB\\" + "炒锅2状态数据\\" + DateTime.Now.ToShortDateString()); | |||
if (globalVar.LTwoFryPotSerial == 2 && fryTwoRecipe != string.Empty) | |||
@@ -1687,7 +1689,7 @@ namespace FryPot_DosingSystem.Control | |||
} | |||
else | |||
{ | |||
if (!Directory.Exists("AccessFile\\" + "DB" + "炒锅2状态数据\\" + DateTime.Now.ToShortDateString())) | |||
if (!Directory.Exists("AccessFile\\" + "DB\\" + "炒锅2状态数据\\" + DateTime.Now.ToShortDateString())) | |||
Directory.CreateDirectory("AccessFile\\" + "DB\\" + "炒锅2状态数据\\" + DateTime.Now.ToShortDateString()); | |||
if (globalVar.LTwoFryPotSerial == 2 && fryTwoRecipe != string.Empty) | |||
{ | |||
@@ -1703,10 +1705,10 @@ namespace FryPot_DosingSystem.Control | |||
} | |||
#endregion | |||
#region 炒锅3状态数据保存 | |||
if (!Directory.Exists("AccessFile\\" + "DB" + "炒锅3状态数据")) | |||
if (!Directory.Exists("AccessFile\\" + "DB\\" + "炒锅3状态数据")) | |||
{ | |||
Directory.CreateDirectory("AccessFile\\" + "DB\\" + "炒锅3状态数据"); | |||
if (!Directory.Exists("AccessFile\\" + "DB" + "炒锅3状态数据\\" + DateTime.Now.ToShortDateString())) | |||
if (!Directory.Exists("AccessFile\\" + "DB\\" + "炒锅3状态数据\\" + DateTime.Now.ToShortDateString())) | |||
Directory.CreateDirectory("AccessFile\\" + "DB\\" + "炒锅3状态数据\\" + DateTime.Now.ToShortDateString()); | |||
if (globalVar.LThreeFryPotSerial == 3 && fryThreeRecipe != string.Empty) | |||
@@ -1723,7 +1725,7 @@ namespace FryPot_DosingSystem.Control | |||
} | |||
else | |||
{ | |||
if (!Directory.Exists("AccessFile\\" + "DB" + "炒锅3状态数据\\" + DateTime.Now.ToShortDateString())) | |||
if (!Directory.Exists("AccessFile\\" + "DB\\" + "炒锅3状态数据\\" + DateTime.Now.ToShortDateString())) | |||
Directory.CreateDirectory("AccessFile\\" + "DB\\" + "炒锅3状态数据\\" + DateTime.Now.ToShortDateString()); | |||
if (globalVar.LThreeFryPotSerial == 3 && fryThreeRecipe != string.Empty) | |||
{ | |||
@@ -1739,10 +1741,10 @@ namespace FryPot_DosingSystem.Control | |||
} | |||
#endregion | |||
#region 炒锅4状态数据保存 | |||
if (!Directory.Exists("AccessFile\\" + "DB" + "炒锅4状态数据")) | |||
if (!Directory.Exists("AccessFile\\" + "DB\\" + "炒锅4状态数据")) | |||
{ | |||
Directory.CreateDirectory("AccessFile\\" + "DB\\" + "炒锅4状态数据"); | |||
if (!Directory.Exists("AccessFile\\" + "DB" + "炒锅4状态数据\\" + DateTime.Now.ToShortDateString())) | |||
if (!Directory.Exists("AccessFile\\" + "DB\\" + "炒锅4状态数据\\" + DateTime.Now.ToShortDateString())) | |||
Directory.CreateDirectory("AccessFile\\" + "DB\\" + "炒锅4状态数据\\" + DateTime.Now.ToShortDateString()); | |||
if (globalVar.LOneFryPotSerial == 4 && fryFourRecipe != string.Empty) | |||
@@ -1759,7 +1761,7 @@ namespace FryPot_DosingSystem.Control | |||
} | |||
else | |||
{ | |||
if (!Directory.Exists("AccessFile\\" + "DB" + "炒锅4状态数据\\" + DateTime.Now.ToShortDateString())) | |||
if (!Directory.Exists("AccessFile\\" + "DB\\" + "炒锅4状态数据\\" + DateTime.Now.ToShortDateString())) | |||
Directory.CreateDirectory("AccessFile\\" + "DB\\" + "炒锅4状态数据\\" + DateTime.Now.ToShortDateString()); | |||
if (globalVar.LOneFryPotSerial == 4 && fryFourRecipe != string.Empty) | |||
{ | |||
@@ -1775,10 +1777,10 @@ namespace FryPot_DosingSystem.Control | |||
} | |||
#endregion | |||
#region 炒锅5状态数据保存 | |||
if (!Directory.Exists("AccessFile\\" + "DB" + "炒锅5状态数据")) | |||
if (!Directory.Exists("AccessFile\\" + "DB\\" + "炒锅5状态数据")) | |||
{ | |||
Directory.CreateDirectory("AccessFile\\" + "DB\\" + "炒锅5状态数据"); | |||
if (!Directory.Exists("AccessFile\\" + "DB" + "炒锅5状态数据\\" + DateTime.Now.ToShortDateString())) | |||
if (!Directory.Exists("AccessFile\\" + "DB\\" + "炒锅5状态数据\\" + DateTime.Now.ToShortDateString())) | |||
Directory.CreateDirectory("AccessFile\\" + "DB\\" + "炒锅5状态数据\\" + DateTime.Now.ToShortDateString()); | |||
if (globalVar.LTwoFryPotSerial == 5 && fryFiveRecipe != string.Empty) | |||
@@ -1795,7 +1797,7 @@ namespace FryPot_DosingSystem.Control | |||
} | |||
else | |||
{ | |||
if (!Directory.Exists("AccessFile\\" + "DB" + "炒锅5状态数据\\" + DateTime.Now.ToShortDateString())) | |||
if (!Directory.Exists("AccessFile\\" + "DB\\" + "炒锅5状态数据\\" + DateTime.Now.ToShortDateString())) | |||
Directory.CreateDirectory("AccessFile\\" + "DB\\" + "炒锅5状态数据\\" + DateTime.Now.ToShortDateString()); | |||
if (globalVar.LTwoFryPotSerial == 5 && fryFiveRecipe != string.Empty) | |||
{ | |||