yahaha pirms 2 gadiem
vecāks
revīzija
7d38d0f45a
26 mainītis faili ar 574 papildinājumiem un 149 dzēšanām
  1. +31
    -0
      BPASmartClient.CustomResource/Converters/RecipeStatusConvert.cs
  2. +2
    -1
      BPASmartClient.JXJFoodBigStation/Model/GVL_BigStation.cs
  3. +147
    -17
      BPASmartClient.JXJFoodBigStation/Model/ProcessControl.cs
  4. +12
    -9
      BPASmartClient.JXJFoodBigStation/Model/Siemens/DL_Status_DB.cs
  5. +29
    -10
      BPASmartClient.JXJFoodBigStation/Model/Siemens/SiemensDeviceStatus.cs
  6. +2
    -0
      BPASmartClient.JXJFoodSmallStation/App.xaml.cs
  7. +6
    -2
      BPASmartClient.JXJFoodSmallStation/Model/GVL_SmallStation.cs
  8. +171
    -51
      BPASmartClient.JXJFoodSmallStation/Model/ProcessControl.cs
  9. +59
    -15
      BPASmartClient.JXJFoodSmallStation/Model/Siemens/SiemensDeviceStatus.cs
  10. +3
    -3
      BPASmartClient.JXJFoodSmallStation/Model/Siemens/XL_Finish_DB.cs
  11. +2
    -2
      BPASmartClient.JXJFoodSmallStation/Model/Siemens/XL_Start_DB.cs
  12. +1
    -1
      BPASmartClient.JXJFoodSmallStation/Model/Siemens/XL_Status_DB.cs
  13. +1
    -1
      BPASmartClient.Model/柔性味魔方/RawMaterialModel.cs
  14. +1
    -0
      BPASmartClient.MorkS/BPASmartClient.MorkS.csproj
  15. +60
    -6
      BPASmartClient.MorkS/Control_Morks.cs
  16. +11
    -4
      BPASmartClient.MorkS/DataServer.cs
  17. +1
    -2
      BPASmartClient.S7Net/EntityClassResolution.cs
  18. +8
    -0
      BPASmartClient.S7Net/SiemensHelper.cs
  19. +1
    -0
      DosingSystem/App.xaml
  20. +5
    -1
      DosingSystem/App.xaml.cs
  21. +2
    -2
      DosingSystem/Model/DeviceInquire.cs
  22. +5
    -0
      DosingSystem/Model/RecipeModel.cs
  23. +4
    -4
      DosingSystem/View/ChangeDeviceNameView.xaml.cs
  24. +2
    -2
      DosingSystem/View/RecipeControlView.xaml
  25. +0
    -9
      DosingSystem/ViewModel/ChangeDeviceNameViewModel.cs
  26. +8
    -7
      DosingSystem/ViewModel/RecipeControlViewModel.cs

+ 31
- 0
BPASmartClient.CustomResource/Converters/RecipeStatusConvert.cs Parādīt failu

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

namespace BPASmartClient.CustomResource.Converters
{
public class RecipeStatusConvert : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
if (value != null)
{
if (value.ToString() == "等待制作")
return Brushes.Yellow;
else if (value.ToString() == "制作完成")
return Brushes.Green;
}
return default;
}

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

+ 2
- 1
BPASmartClient.JXJFoodBigStation/Model/GVL_BigStation.cs Parādīt failu

@@ -39,7 +39,8 @@ namespace BPASmartClient.JXJFoodBigStation.Model
/// 订单请求
/// </summary>
public static bool Order_Request { get; set; } = false;
public static int SiemensSendRecipeStatus { get; set; } = 0;

public const int StockBinNum = 12;
public const int Max_DosingSotckBinNum = 14;
}
}

+ 147
- 17
BPASmartClient.JXJFoodBigStation/Model/ProcessControl.cs Parādīt failu

@@ -49,12 +49,12 @@ namespace BPASmartClient.JXJFoodBigStation.Model
ActionManage.GetInstance.Register(new Action<object>((res) =>
{
ObservableCollection<RawMaterial> RawMaterials = new ObservableCollection<RawMaterial>();
if (SiemensDevice.IsConnected ||true)
if (SiemensDevice.IsConnected)
{
if (res != null && res is DL_Start_DB recipe)
{
RawMaterials.Clear();
for (int i = 0; i < 12; i++)
for (int i = 0; i < GVL_BigStation.Max_DosingSotckBinNum; i++)
{
if (RawMaterialsNamePos.ContainsKey(recipe.Material[i].Material_Name))
{
@@ -71,12 +71,15 @@ namespace BPASmartClient.JXJFoodBigStation.Model
//报警,配方的原料名称下发和设备不一致
}
}
Json<RemoteRecipe>.Data.Recipes.Add(new RecipeData()
App.Current.Dispatcher.Invoke(() =>
{
RecipeName = recipe.RecipeName,
RecipeCode = recipe.RecipeCode,
RawMaterial = RawMaterials,
//TrayCode = recipe.Order_No,
Json<RemoteRecipe>.Data.Recipes.Add(new RecipeData()
{
RecipeName = recipe.RecipeName,
RecipeCode = recipe.RecipeCode,
RawMaterial = RawMaterials,
TrayCode = recipe.Job_No,
});
});
}
}
@@ -86,7 +89,7 @@ namespace BPASmartClient.JXJFoodBigStation.Model
try
{
//HKDevice.HK_PLC_S7.Connect(S7.Net.CpuType.S71500, HK_PLC_IP);
//SiemensDevice.Siemens_PLC_S7.Connect(S7.Net.CpuType.S71500, Siemens_PLC_IP);
SiemensDevice.Siemens_PLC_S7.Connect(S7.Net.CpuType.S71500, Siemens_PLC_IP);
if (HKDevice.IsConnected)
{
HKDevice.Init();
@@ -132,25 +135,134 @@ namespace BPASmartClient.JXJFoodBigStation.Model
{
foreach (var data in Recipes)
{
if (RecipeQueue1.Count == 0 && !RecipeQueue2.Contains(data.RecipeCode) && !RecipeQueue3.Contains(data.RecipeCode) && !RecipeQueue4.Contains(data.RecipeCode))
if (RecipeQueue1.Count == 0 && !RecipeQueue2.Contains(data.RecipeCode) && !RecipeQueue3.Contains(data.RecipeCode) && !RecipeQueue4.Contains(data.RecipeCode))
{
if (!(RecipeQueue1.Contains(data.RecipeCode)))
RecipeQueue1.Enqueue(data.RecipeCode);
{
if (SiemensDevice.DL_Status is DL_Status_DB status)
{
if (GVL_BigStation.SiemensSendRecipeStatus == 3)
{
GVL_BigStation.SiemensSendRecipeStatus = 4;
SiemensDevice.Siemens_PLC_S7.WriteString(2331, data.RecipeCode, 10);
SiemensDevice.Siemens_PLC_S7.Write("DB2331.DBX28.0", true);
}
if (GVL_BigStation.SiemensSendRecipeStatus == 4)
{
if (SiemensDevice.DL_Status.Dosing_Start_ACK)
{
GVL_BigStation.SiemensSendRecipeStatus = 5;
SiemensDevice.Siemens_PLC_S7.WriteString(2331, "", 10);
SiemensDevice.Siemens_PLC_S7.Write("DB2331.DBX28.0", false);
}
}
if (GVL_BigStation.SiemensSendRecipeStatus == 5)
{
if (SiemensDevice.DL_Status.Dosing_Start_ACK == false)
{
GVL_BigStation.SiemensSendRecipeStatus = 6;
RecipeQueue1.Enqueue(data.RecipeCode);
}
}
}

}
}
else if (RecipeQueue2.Count == 0 && !RecipeQueue1.Contains(data.RecipeCode) && !RecipeQueue3.Contains(data.RecipeCode) && !RecipeQueue4.Contains(data.RecipeCode))
else if (RecipeQueue2.Count == 0 && !RecipeQueue1.Contains(data.RecipeCode) && !RecipeQueue3.Contains(data.RecipeCode) && !RecipeQueue4.Contains(data.RecipeCode))
{
if (!(RecipeQueue2.Contains(data.RecipeCode)))
RecipeQueue2.Enqueue(data.RecipeCode);
{
if (SiemensDevice.DL_Status is DL_Status_DB status)
{
if (GVL_BigStation.SiemensSendRecipeStatus == 3)
{
GVL_BigStation.SiemensSendRecipeStatus = 4;
SiemensDevice.Siemens_PLC_S7.WriteString(2331, data.RecipeCode, 10);
SiemensDevice.Siemens_PLC_S7.Write("DB2331.DBX28.0", true);
}
if (GVL_BigStation.SiemensSendRecipeStatus == 4)
{
if (SiemensDevice.DL_Status.Dosing_Start_ACK)
{
GVL_BigStation.SiemensSendRecipeStatus = 5;
SiemensDevice.Siemens_PLC_S7.WriteString(2331, "", 10);
SiemensDevice.Siemens_PLC_S7.Write("DB3231.DBX28.0", false);
}
}
if (GVL_BigStation.SiemensSendRecipeStatus == 5)
{
if (SiemensDevice.DL_Status.Dosing_Start_ACK == false)
{
GVL_BigStation.SiemensSendRecipeStatus = 6;
RecipeQueue2.Enqueue(data.RecipeCode);
}
}
}
}
}
else if (RecipeQueue3.Count == 0 && !RecipeQueue1.Contains(data.RecipeCode) && !RecipeQueue2.Contains(data.RecipeCode) && !RecipeQueue4.Contains(data.RecipeCode))
{
if (!(RecipeQueue3.Contains(data.RecipeCode)))
RecipeQueue3.Enqueue(data.RecipeCode);
if (!(RecipeQueue3.Contains(data.RecipeCode)))
{
if (SiemensDevice.DL_Status is DL_Status_DB status)
{
if (GVL_BigStation.SiemensSendRecipeStatus == 3)
{
GVL_BigStation.SiemensSendRecipeStatus = 4;
SiemensDevice.Siemens_PLC_S7.WriteString(2331, data.RecipeCode, 10);
SiemensDevice.Siemens_PLC_S7.Write("DB2331.DBX28.0", true);
}
if (GVL_BigStation.SiemensSendRecipeStatus == 4)
{
if (SiemensDevice.DL_Status.Dosing_Start_ACK)
{
GVL_BigStation.SiemensSendRecipeStatus = 5;
SiemensDevice.Siemens_PLC_S7.WriteString(2331, "", 10);
SiemensDevice.Siemens_PLC_S7.Write("DB3231.DBX28.0", false);
}
}
if (GVL_BigStation.SiemensSendRecipeStatus == 5)
{
if (SiemensDevice.DL_Status.Dosing_Start_ACK == false)
{
GVL_BigStation.SiemensSendRecipeStatus = 6;
RecipeQueue3.Enqueue(data.RecipeCode);
}
}
}
}
}
else if (RecipeQueue4.Count == 0 && !RecipeQueue1.Contains(data.RecipeCode) && !RecipeQueue2.Contains(data.RecipeCode) && !RecipeQueue3.Contains(data.RecipeCode))
{
if (!(RecipeQueue4.Contains(data.RecipeCode)))
RecipeQueue4.Enqueue(data.RecipeCode);
if (!(RecipeQueue4.Contains(data.RecipeCode)))
{
if (SiemensDevice.DL_Status is DL_Status_DB status)
{
if (GVL_BigStation.SiemensSendRecipeStatus == 3)
{
GVL_BigStation.SiemensSendRecipeStatus = 4;
SiemensDevice.Siemens_PLC_S7.WriteString(2331, data.RecipeCode, 10);
SiemensDevice.Siemens_PLC_S7.Write("DB2331.DBX28.0", true);
}
if (GVL_BigStation.SiemensSendRecipeStatus == 4)
{
if (SiemensDevice.DL_Status.Dosing_Start_ACK)
{
GVL_BigStation.SiemensSendRecipeStatus = 5;
SiemensDevice.Siemens_PLC_S7.WriteString(2331, "", 10);
SiemensDevice.Siemens_PLC_S7.Write("DB3231.DBX28.0", false);
}
}
if (GVL_BigStation.SiemensSendRecipeStatus == 5)
{
if (SiemensDevice.DL_Status.Dosing_Start_ACK == false)
{
GVL_BigStation.SiemensSendRecipeStatus = 6;
RecipeQueue4.Enqueue(data.RecipeCode);
}
}
}
}
}
}
}
@@ -266,6 +378,8 @@ namespace BPASmartClient.JXJFoodBigStation.Model
}
if (SiemensDevice.IsConnected)
{
FinishData.Ask_For_Finish = true;
GVL_BigStation.SiemensSendRecipeStatus = 7;
SiemensDevice.Siemens_PLC_S7.WriteClass<DL_Finish_DB>(FinishData, 2361);
}
RecipeQueue1.TryDequeue(out code);
@@ -705,6 +819,22 @@ namespace BPASmartClient.JXJFoodBigStation.Model
RawMaterialsNamePos.Clear();
if (!HKDevice.IsConnected)
{
RawMaterialsNamePos.Add("A10", 1);
RawMaterialsNamePos.Add("A20", 2);
RawMaterialsNamePos.Add("A30", 3);
RawMaterialsNamePos.Add("A40", 4);
RawMaterialsNamePos.Add("A50", 5);
RawMaterialsNamePos.Add("A60", 6);
RawMaterialsNamePos.Add("A70", 7);
RawMaterialsNamePos.Add("A80", 8);
RawMaterialsNamePos.Add("A90", 9);
RawMaterialsNamePos.Add("A100", 10);
RawMaterialsNamePos.Add("A110", 11);
RawMaterialsNamePos.Add("A120", 12);
RawMaterialsNamePos.Add("A130", 13);
RawMaterialsNamePos.Add("A140", 14);
}
/*
HKDevice.StockBinName.RawMaterialName1 = "1";
HKDevice.StockBinName.RawMaterialName2 = "2";
HKDevice.StockBinName.RawMaterialName3 = "3";
@@ -775,7 +905,7 @@ namespace BPASmartClient.JXJFoodBigStation.Model
if (!RawMaterialsNamePos.ContainsKey(HKDevice.StockBinName.RawMaterialName14))
{
RawMaterialsNamePos.Add(HKDevice.StockBinName.RawMaterialName14, 14);
}
}*/
}
}
}

+ 12
- 9
BPASmartClient.JXJFoodBigStation/Model/Siemens/DL_Status_DB.cs Parādīt failu

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

namespace BPASmartClient.JXJFoodBigStation.Model.Siemens
{
internal class DL_Status_DB
public class DL_Status_DB
{
/// <summary>
/// 配料开始
/// 配料开始确认
/// </summary>
public bool Dosing_Start { get; set; }
public bool Dosing_Start_ACK { get; set; }
/// <summary>
/// 配料开始确认
/// </summary>
@@ -29,18 +29,21 @@ namespace BPASmartClient.JXJFoodBigStation.Model.Siemens
/// 生产工单
/// </summary>
public string RecipeCode { get; set; }
public bool Dosing_Cancel4 { get; set; }
/// <summary>
/// 配料开始
/// </summary>
public bool Dosing_Start { get; set; }

public bool Dosing_Cancel5 { get; set; }
public bool Allow_Agv_Put { get; set; }

public bool Dosing_Cancel6 { get; set; }
public bool Allow_Agv_Get { get; set; }

public bool Dosing_Cancel7 { get; set; }
public bool Allow_Agv_Get_Empty { get; set; }

public short Dosing_Cancel8 { get; set; }
public short Pallet_Position_Occ { get; set; }

public short Dosing_Cancel9 { get; set; }

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

+ 29
- 10
BPASmartClient.JXJFoodBigStation/Model/Siemens/SiemensDeviceStatus.cs Parādīt failu

@@ -15,6 +15,7 @@ namespace BPASmartClient.JXJFoodBigStation.Model.Siemens
public SiemensHelper Siemens_PLC_S7 = new SiemensHelper();
public bool IsConnected => Siemens_PLC_S7.IsConnected;

public DL_Status_DB DL_Status = new DL_Status_DB();
bool a = false;
public void Init()
{
@@ -34,7 +35,7 @@ namespace BPASmartClient.JXJFoodBigStation.Model.Siemens
start.RecipeCode = "1201";
start.Order_Request_Ack = true;

for (int i = 0; i < GVL_BigStation.StockBinNum ; i++)
for (int i = 0; i < GVL_BigStation.Max_DosingSotckBinNum ; i++)
{
start.Material[i] = new UDT();
start.Material[i].Material_Name = "" + (i +1);
@@ -42,25 +43,43 @@ namespace BPASmartClient.JXJFoodBigStation.Model.Siemens
start.Material[i].Material_BarrelNum = (short)(i + 1);
}
}
if (RTrig.GetInstance("Order_Request").Start(GVL_BigStation.Order_Request))
if (RTrig.GetInstance("Order_Request").Start(GVL_BigStation.Order_Request) && GVL_BigStation.SiemensSendRecipeStatus == 0)
{
start.Order_Request = true;
Siemens_PLC_S7.WriteClass<DL_Start_DB>(start, 2301);
GVL_BigStation.SiemensSendRecipeStatus = 1;
this.Siemens_PLC_S7.Write("DB2301.DBX330.0", true);
}
if (RTrig.GetInstance("Order_Request_Ack").Start(start.Order_Request_Ack))
if (RTrig.GetInstance("Order_Request_Ack").Start(start.Order_Request_Ack) && GVL_BigStation.SiemensSendRecipeStatus == 1)
{
GVL_BigStation.SiemensSendRecipeStatus = 2;
ActionManage.GetInstance.Send("SiemensSendRecipe", start);
this.Siemens_PLC_S7.Write("DB2301.DBX330.0", false);
}
if (TTrig.GetInstance("Order_Request_Ack").Start(start.Order_Request_Ack) && GVL_BigStation.SiemensSendRecipeStatus == 2)
{
GVL_BigStation.SiemensSendRecipeStatus = 3;
GVL_BigStation.Order_Request = false;
}
}
if (res1 != null && res1 is DL_Status_DB status)
{
DL_Status = status;
}
if (res2 != null && res2.Ask_For_Finish_PLC)
if (res2 != null && res2 is DL_Finish_DB finish)
{
ActionManage.GetInstance.Send("配料完成信号确认完成");
res2.Ask_For_Finish_PLC = false;
this.Siemens_PLC_S7.WriteClass<DL_Finish_DB>(res2, 3);
if (RTrig.GetInstance("Ask_For_Finish_PLC").Start(finish.Ask_For_Finish_PLC) && GVL_BigStation.SiemensSendRecipeStatus == 7)
{
finish.Order_No = "";
finish.Product_Code = "";
finish.job_No = 0;
for (int i = 0; i < 20; i++)
{
finish.Material[i] = new UDT1();
}
GVL_BigStation.SiemensSendRecipeStatus = 0;
finish.Ask_For_Finish = false;
finish.ProcessTime = 0;
this.Siemens_PLC_S7.WriteClass<DL_Finish_DB>(finish, 2261);
}
}
Thread.Sleep(10);
}), "监听服务数据");


+ 2
- 0
BPASmartClient.JXJFoodSmallStation/App.xaml.cs Parādīt failu

@@ -48,6 +48,7 @@ namespace BPASmartClient.JXJFoodSmallStation
base.OnExit(e);
Json<LocaPar>.Save();
Json<LocalRecipeDataColl>.Save();
Json<RemoteRecipeDataColl>.Save();
MessageNotify.GetInstance.LogSave();
ThreadManage.GetInstance().Dispose();
}
@@ -268,6 +269,7 @@ namespace BPASmartClient.JXJFoodSmallStation
Json<DevicePar>.Read();
Json<WindSendDevicePar>.Read();
Json<LocalRecipeDataColl>.Read();
Json<RemoteRecipeDataColl>.Read();
}

}


+ 6
- 2
BPASmartClient.JXJFoodSmallStation/Model/GVL_SmallStation.cs Parādīt failu

@@ -23,14 +23,17 @@ namespace BPASmartClient.JXJFoodSmallStation.Model
/// <summary>
/// 风送料仓数目
/// </summary>
public const int Max_PowderSotckBinNum = 15;
public const int Max_PowderSotckBinNum = 5;
public bool HeartBeatToPlc { get; set; } = false;
public bool HeartBeatFromPlc { get; set; } = false;
/// <summary>
/// 是否允许西门子下发配方
/// </summary>
public static bool IsAllowSiemensSendRecipe { get; set; } = false;

/// <summary>
/// 西门子下发配方状态 0:等待下发配方 1:请求下发配方 2:上位机接收配方 3:配方接收完成 4:请求配料 5:西门子开始配料确认 6:配方配料完成 7:配料完成确认
/// </summary>
public static int SiemensSendRecipeStatus { get; set; } = 0;
/// <summary>
/// 往输送带下发配方完成
/// </summary>
@@ -114,6 +117,7 @@ namespace BPASmartClient.JXJFoodSmallStation.Model
/// 是否使用本地模拟订单+风送配方
/// </summary>
public bool IsUseWindSendDosing { get; set; }
public static int test1 = 1;
#endregion
}
}

+ 171
- 51
BPASmartClient.JXJFoodSmallStation/Model/ProcessControl.cs Parādīt failu

@@ -50,6 +50,7 @@ namespace BPASmartClient.JXJFoodSmallStation.Model
public RecipeRawMaterial RawMaterial;
public void Init()
{
testData();
for (int i = 0; i < 16; i++)
{
if (DeviceInquire.GetInstance.GetDevice(i).DeviceName != null)
@@ -69,57 +70,91 @@ namespace BPASmartClient.JXJFoodSmallStation.Model
{
if (res != null && res is XL_Start_DB recipe)
{
RawMaterials.Clear();
for (int i = 0; i < GVL_SmallStation.Max_DosingSotckBinNum; i++)
{
if (!string.IsNullOrEmpty(recipe.Material[i].Material_Name))
if (!string.IsNullOrEmpty(recipe.RecipeCode)) {
RawMaterials.Clear();
for (int i = 0; i < GVL_SmallStation.Max_DosingSotckBinNum; i++)
{
if (RawMaterialsNamePos.ContainsKey(recipe.Material[i].Material_Name))
if (!string.IsNullOrEmpty(recipe.Material[i].Material_Name))
{
RawMaterials.Add(new RemoteRecipeRawMaterial()
if (RawMaterialsNamePos.ContainsKey(recipe.Material[i].Material_Name))
{
RawMaterialName = recipe.Material[i].Material_Name,
RawMaterialBarrelNum = recipe.Material[i].Material_BarrelNum,
RawMaterialWeight = recipe.Material[i].Material_Weight,
RawMaterialLocation = (int)RawMaterialsNamePos[recipe.Material[i].Material_Name]
});
RawMaterials.Add(new RemoteRecipeRawMaterial()
{
RawMaterialName = recipe.Material[i].Material_Name,
RawMaterialBarrelNum = recipe.Material[i].Material_BarrelNum,
RawMaterialWeight = recipe.Material[i].Material_Weight,
RawMaterialLocation = (int)RawMaterialsNamePos[recipe.Material[i].Material_Name]
});
}
else
{
//MessageNotify.GetInstance.AlarmLog("配方名称与本地不符合");
}
}
else
{
//MessageNotify.GetInstance.AlarmLog("配方名称与本地不符合");
break;
}
}
else
for (int i = 0; i < GVL_SmallStation.Max_PowderSotckBinNum; i++)
{
break;
if (!string.IsNullOrEmpty(recipe.Powder[i].Powder_Name))
{
WindSendData.Add(new WindSendRawMaterial()
{
RawMaterialName = recipe.Powder[i].Powder_Name,
RawMaterialWeight = recipe.Powder[i].Powder_Weight
});
}
else
{
break;
}
}
}
for (int i = 0; i < GVL_SmallStation.Max_PowderSotckBinNum; i++)
{
if (!string.IsNullOrEmpty(recipe.Powder[i].Powder_Name))
{
WindSendData.Add(new WindSendRawMaterial()
App.Current.Dispatcher.Invoke(() => {
Json<RemoteRecipeDataColl>.Data.Recipes.Add(new RemoteRecipeData()
{
RawMaterialName = recipe.Powder[i].Powder_Name,
RawMaterialWeight = recipe.Powder[i].Powder_Weight
RecipeName = recipe.RecipeName,
RecipeCode = recipe.RecipeCode,
RawMaterial = RawMaterials,
TrayCode = recipe.StockCode,
WindSend = WindSendData
});
}
else
{
break;
}
});
}
Json<RemoteRecipeDataColl>.Data.Recipes.Add(new RemoteRecipeData()
{
RecipeName = recipe.RecipeName,
RecipeCode = recipe.RecipeCode,
RawMaterial = RawMaterials,
TrayCode = recipe.TrayCode,
WindSend = WindSendData
});
}
}
}), "SiemensRecipeRecive", true);
ActionManage.GetInstance.CancelRegister("SiemensRecipeFinish");
ActionManage.GetInstance.Register(new Action<object>((res) =>
{
if (SiemensDevice.IsConnected)
{
if (res != null && res is RemoteRecipeData recipe)
{
RecipeFinishInfo.Order_No = recipe.RecipeCode;
RecipeFinishInfo.Product_Code = recipe.RecipeName;
RecipeFinishInfo.Job_No = (short)recipe.TrayCode;
for (int i = 0; i < recipe.RawMaterial.Count; i++)
{
RecipeFinishInfo.Material[i] = new UDT1();
RecipeFinishInfo.Material[i].Material_Name = recipe.RawMaterial.ElementAt(i).RawMaterialName;
RecipeFinishInfo.Material[i].Material_BarrelNum = recipe.RawMaterial.ElementAt(i).RawMaterialBarrelNum;
RecipeFinishInfo.Material[i].Material_Laying_Off_Weight = recipe.RawMaterial.ElementAt(i).Laying_Off_Weight;
}
for (int i = 0; i < recipe.WindSend.Count; i++)
{
RecipeFinishInfo.Powder[i] = new UDT2();
}
if (GVL_SmallStation.SiemensSendRecipeStatus == 6)
{
GVL_SmallStation.SiemensSendRecipeStatus = 7;
RecipeFinishInfo.Ask_For_Finish = true;
SiemensDevice.Siemens_PLC_S7.WriteClass<XL_Finish_DB>(RecipeFinishInfo, 2261);
}
}
}
}), "SiemensRecipeFinish", true);
ActionManage.GetInstance.CancelRegister("WindSendDosingFinish");
ActionManage.GetInstance.Register(new Action(() =>
{
@@ -644,7 +679,6 @@ namespace BPASmartClient.JXJFoodSmallStation.Model
GVL_SmallStation.GetInstance.HeartBeatToPlc = !GVL_SmallStation.GetInstance.HeartBeatToPlc;
HKDevice.HK_PLC_S7.Write("DB4.DBX0.0", GVL_SmallStation.GetInstance.HeartBeatToPlc);
GVL_SmallStation.GetInstance.HeartBeatFromPlc = HKDevice.HK_PLC_S7.Read<bool>("DB3.DBX0.0");

}
}
/// <summary>
@@ -661,14 +695,66 @@ namespace BPASmartClient.JXJFoodSmallStation.Model
{
if (!(RecipeQueue.Contains(data.RecipeCode)))
{
RecipeQueue.Enqueue(data.RecipeCode);
if (SiemensDevice.XL_Status is XL_Status_DB status)
{
if (GVL_SmallStation.SiemensSendRecipeStatus == 3)
{
GVL_SmallStation.SiemensSendRecipeStatus = 4;
SiemensDevice.Siemens_PLC_S7.WriteString(2231, data.RecipeCode,10);
SiemensDevice.Siemens_PLC_S7.Write("DB2231.DBX28.0",true);
}
if (GVL_SmallStation.SiemensSendRecipeStatus == 4)
{
if (SiemensDevice.XL_Status.Dosing_Confirm)
{
GVL_SmallStation.SiemensSendRecipeStatus = 5;
SiemensDevice.Siemens_PLC_S7.WriteString(2231, "", 10);
SiemensDevice.Siemens_PLC_S7.Write("DB2231.DBX28.0", false);
}
}
if (GVL_SmallStation.SiemensSendRecipeStatus == 5)
{
if (SiemensDevice.XL_Status.Dosing_Confirm == false)
{
GVL_SmallStation.SiemensSendRecipeStatus = 6;
RecipeQueue.Enqueue(data.RecipeCode);
}

}

}
}
}
else if(data.TrayCode == 2)
else if (data.TrayCode == 2)
{
if (!(RecipeQueueTray2.Contains(data.RecipeCode)))
{
RecipeQueueTray2.Enqueue(data.RecipeCode);
if (SiemensDevice.XL_Status is XL_Status_DB status)
{
if (GVL_SmallStation.SiemensSendRecipeStatus == 3)
{
GVL_SmallStation.SiemensSendRecipeStatus = 4;
SiemensDevice.Siemens_PLC_S7.WriteString(2231, data.RecipeCode, 10);
SiemensDevice.Siemens_PLC_S7.Write("DB2231.DBX28.0", true);
}
if (GVL_SmallStation.SiemensSendRecipeStatus == 4)
{
if (SiemensDevice.XL_Status.Dosing_Confirm)
{
GVL_SmallStation.SiemensSendRecipeStatus = 5;
SiemensDevice.Siemens_PLC_S7.WriteString(2231, "", 10);
SiemensDevice.Siemens_PLC_S7.Write("DB2231.DBX28.0", false);
}
}
if (GVL_SmallStation.SiemensSendRecipeStatus == 5)
{
if (SiemensDevice.XL_Status.Dosing_Confirm == false)
{
GVL_SmallStation.SiemensSendRecipeStatus = 0;
RecipeQueueTray2.Enqueue(data.RecipeCode);
}
}
}
}
}
}
@@ -851,23 +937,39 @@ namespace BPASmartClient.JXJFoodSmallStation.Model
}
}
if (RTrig.GetInstance("配方配料完成").Start(HKDevice.HK_PLC_S7.Read<bool>("DB3.DBX1.1")) && (GVL_SmallStation.GetInstance.WindSendDosingFinish || !GVL_SmallStation.GetInstance.IsUseWindSend))
if ((RTrig.GetInstance("配方配料完成").Start(HKDevice.HK_PLC_S7.Read<bool>("DB3.DBX1.1")) && (GVL_SmallStation.GetInstance.WindSendDosingFinish || !GVL_SmallStation.GetInstance.IsUseWindSend)) || GVL_SmallStation.GetInstance.RecipeStatusID == 5)
{
var res = Json<RemoteRecipeDataColl>.Data.Recipes.FirstOrDefault(p => p.RecipeCode == code);
MessageNotify.GetInstance.ShowRunLog($"托盘1,配方{res.RecipeName},配料完成");
RecipeFinishInfo.Order_No = RemoteRecipes.ElementAt(index).RecipeCode;
RecipeFinishInfo.Product_Code = RemoteRecipes.ElementAt(index).RecipeName;
for (int i = 0; i < RemoteRecipes.ElementAt(index).RawMaterial.Count; i++)
{
RecipeFinishInfo.Material[i] = new UDT1();
RecipeFinishInfo.Material[i].Material_Name = RemoteRecipes.ElementAt(index).RawMaterial.ElementAt(i).RawMaterialName;
RecipeFinishInfo.Material[i].Material_BarrelNum = RemoteRecipes.ElementAt(index).RawMaterial.ElementAt(i).RawMaterialBarrelNum;
RecipeFinishInfo.Material[i].Material_Laying_Off_Weight = RemoteRecipes.ElementAt(index).RawMaterial.ElementAt(i).Laying_Off_Weight;
}
if (SiemensDevice.IsConnected)
{
RecipeFinishInfo.Ask_For_Finish = true;
SiemensDevice.Siemens_PLC_S7.WriteClass<XL_Finish_DB>(RecipeFinishInfo, 2261);
RecipeFinishInfo.Order_No = RemoteRecipes.ElementAt(index).RecipeCode;
RecipeFinishInfo.Product_Code = RemoteRecipes.ElementAt(index).RecipeName;
RecipeFinishInfo.Job_No = (short)trayCode;
for (int i = 0; i < 20; i++)
{
RecipeFinishInfo.Material[i] = new UDT1();
}
for (int i = 0; i < 10; i++)
{
RecipeFinishInfo.Powder[i] = new UDT2();
}
for (int i = 0; i < RemoteRecipes.ElementAt(index).RawMaterial.Count; i++)
{
RecipeFinishInfo.Material[i].Material_Name = RemoteRecipes.ElementAt(index).RawMaterial.ElementAt(i).RawMaterialName;
RecipeFinishInfo.Material[i].Material_BarrelNum = RemoteRecipes.ElementAt(index).RawMaterial.ElementAt(i).RawMaterialBarrelNum;
RecipeFinishInfo.Material[i].Material_Laying_Off_Weight = RemoteRecipes.ElementAt(index).RawMaterial.ElementAt(i).Laying_Off_Weight;
}
for (int i = 0; i < RemoteRecipes.ElementAt(index).WindSend.Count; i++)
{
}
if (GVL_SmallStation.SiemensSendRecipeStatus == 6)
{
GVL_SmallStation.SiemensSendRecipeStatus = 7;
RecipeFinishInfo.Ask_For_Finish = true;
SiemensDevice.Siemens_PLC_S7.WriteClass<XL_Finish_DB>(RecipeFinishInfo, 2261);
}
}
App.Current.Dispatcher.Invoke(() =>
{
@@ -1079,5 +1181,23 @@ namespace BPASmartClient.JXJFoodSmallStation.Model
}
}
}
private void testData()
{
RawMaterialsNamePos.Add("A10", 1);
RawMaterialsNamePos.Add("A20", 2);
RawMaterialsNamePos.Add("A30", 3);
RawMaterialsNamePos.Add("A40", 4);
RawMaterialsNamePos.Add("A50", 5);
RawMaterialsNamePos.Add("A60", 6);
RawMaterialsNamePos.Add("A70", 7);
RawMaterialsNamePos.Add("A80", 8);
RawMaterialsNamePos.Add("A90", 9);
RawMaterialsNamePos.Add("A100", 10);
RawMaterialsNamePos.Add("A110", 11);
RawMaterialsNamePos.Add("A120", 12);
RawMaterialsNamePos.Add("A130", 13);
RawMaterialsNamePos.Add("A140", 14);
RawMaterialsNamePos.Add("A150", 15);
}
}
}

+ 59
- 15
BPASmartClient.JXJFoodSmallStation/Model/Siemens/SiemensDeviceStatus.cs Parādīt failu

@@ -14,34 +14,79 @@ namespace BPASmartClient.JXJFoodSmallStation.Model.Siemens
{
public SiemensHelper Siemens_PLC_S7 = new SiemensHelper();
public bool IsConnected => Siemens_PLC_S7.IsConnected;

public XL_Status_DB XL_Status = new XL_Status_DB();
bool test;
public void Init()
{
if (IsConnected)
{
ThreadManage.GetInstance().StartLong(new Action(() =>
ThreadManage.GetInstance().StartLong(new Action(() =>
{
var Start = this.Siemens_PLC_S7.ReadClass<XL_Start_DB>(2201);
var Status = this.Siemens_PLC_S7.ReadClass<XL_Status_DB>(2231);
var Finish = this.Siemens_PLC_S7.ReadClass<XL_Finish_DB>(2261);
var DataColl = this.Siemens_PLC_S7.ReadClass<XL_DataColl_DB>(2291);
if (Start != null && Start.Order_Request == false && GVL_SmallStation.IsAllowSiemensSendRecipe)
if (test)
{
Start.Order_Request = true;
this.Siemens_PLC_S7.WriteClass<XL_Start_DB>(Start, 1);
for (int i = 0; i < XL_Status.Powder.Length; i++) {

XL_Status.Powder.ElementAt(i).Powder_Name = ""+i;
}
Siemens_PLC_S7.WriteClass<XL_Status_DB>(XL_Status, 2231);
}
if (Start != null && RTrig.GetInstance("RecipeTrig").Start(Start.Order_Request_ACK))
if (Start != null && Start is XL_Start_DB st)
{
ActionManage.GetInstance.Send("SiemensRecipeRecive", Start);
Start.Order_Request_ACK = false;
this.Siemens_PLC_S7.WriteClass<XL_Start_DB>(Start, 1);
if (RTrig.GetInstance("DB2201.DBX450.0").Start(GVL_SmallStation.IsAllowSiemensSendRecipe) && GVL_SmallStation.SiemensSendRecipeStatus == 0)
{
GVL_SmallStation.SiemensSendRecipeStatus = 1;
this.Siemens_PLC_S7.Write("DB2201.DBX450.0", true);
}
if (RTrig.GetInstance("Order_Request_ACK").Start(Start.Order_Request_ACK) && GVL_SmallStation.SiemensSendRecipeStatus == 1)
{
if (!string.IsNullOrEmpty(st.RecipeCode))
{
GVL_SmallStation.SiemensSendRecipeStatus = 2;
ActionManage.GetInstance.Send("SiemensRecipeRecive", st);
this.Siemens_PLC_S7.Write("DB2201.DBX450.0", false);
}
}
if (TTrig.GetInstance("Order_Request_ACK_").Start(Start.Order_Request_ACK) && GVL_SmallStation.SiemensSendRecipeStatus == 2)
{
GVL_SmallStation.IsAllowSiemensSendRecipe = false;
GVL_SmallStation.SiemensSendRecipeStatus = 3;
//需要等待请求信号复位才能认为接收配方完成
}
}

if (Status != null && RTrig.GetInstance("Allow_AGV_Put[0]").Start(Status.AgvRequestPut))
if (Finish != null && Finish is XL_Finish_DB FinishData)
{
ActionManage.GetInstance.Send("AGV放货架到位",Status);
Status.AgvRequestPut = false;
this.Siemens_PLC_S7.WriteClass<XL_Status_DB>(Status, 2);
if (RTrig.GetInstance("Ask_For_Finish_PLC").Start(FinishData.Ask_For_Finish_PLC) && GVL_SmallStation.SiemensSendRecipeStatus == 7)
{
FinishData.Order_No = "";
FinishData.Product_Code = "";
FinishData.Job_No = 0;
for (int i = 0; i < 20; i++)
{
FinishData.Material[i] = new UDT1();
}
for (int i = 0; i < 10; i++)
{
FinishData.Powder[i] = new UDT2();
}
GVL_SmallStation.SiemensSendRecipeStatus = 0;
FinishData.Ask_For_Finish = false;
FinishData.DosingTime = 0;
this.Siemens_PLC_S7.WriteClass<XL_Finish_DB>(FinishData, 2261);
}
}
if (Status != null && Status is XL_Status_DB state)
{
XL_Status = state;
if (RTrig.GetInstance("Allow_AGV_Put[0]").Start(Status.AgvRequestPut))
{
ActionManage.GetInstance.Send("AGV放货架到位", Status);
Status.AgvRequestPut = false;
this.Siemens_PLC_S7.WriteClass<XL_Status_DB>(Status, 2);
}
}
if (Status != null && RTrig.GetInstance("Allow_AGV_Put[1]").Start(Status.AgvRequestGet))
{
@@ -49,7 +94,6 @@ namespace BPASmartClient.JXJFoodSmallStation.Model.Siemens
Status.AgvRequestGet = false;
this.Siemens_PLC_S7.WriteClass<XL_Status_DB>(Status, 2);
}
Thread.Sleep(10);
}),"监听服务数据");
}


+ 3
- 3
BPASmartClient.JXJFoodSmallStation/Model/Siemens/XL_Finish_DB.cs Parādīt failu

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

namespace BPASmartClient.JXJFoodSmallStation.Model.Siemens
{
internal class XL_Finish_DB
public class XL_Finish_DB
{
/// <summary>
/// 配料完成信号确认
@@ -52,7 +52,7 @@ namespace BPASmartClient.JXJFoodSmallStation.Model.Siemens
/// 原料名称
/// </summary>
[Siemens(6)]
public string Material_Name { get; set; }
public string Material_Name { get; set; } = "";
/// <summary>
/// 原料下料重量
/// </summary>
@@ -68,7 +68,7 @@ namespace BPASmartClient.JXJFoodSmallStation.Model.Siemens
/// 粉料仓名称
/// </summary>
[Siemens(6)]
public string Powder_Name { get; set; }
public string Powder_Name { get; set; } = "";
/// <summary>
/// 粉料仓重量
/// </summary>


+ 2
- 2
BPASmartClient.JXJFoodSmallStation/Model/Siemens/XL_Start_DB.cs Parādīt failu

@@ -51,7 +51,7 @@ namespace BPASmartClient.JXJFoodSmallStation.Model.Siemens
/// <summary>
/// 原料名称
/// </summary>
public string Material_Name { get; set; }
public string Material_Name { get; set; } = "";
/// <summary>
/// 原料重量
/// </summary>
@@ -69,7 +69,7 @@ namespace BPASmartClient.JXJFoodSmallStation.Model.Siemens
/// 粉料仓名称
/// </summary>
[Siemens(6)]
public string Powder_Name { get; set; }
public string Powder_Name { get; set; } = "";
/// <summary>
/// 粉料仓重量
/// </summary>


+ 1
- 1
BPASmartClient.JXJFoodSmallStation/Model/Siemens/XL_Status_DB.cs Parādīt failu

@@ -78,7 +78,7 @@ namespace BPASmartClient.JXJFoodSmallStation.Model.Siemens
/// 粉料名称
/// </summary>
[Siemens(6)]
public string Powder_Name { get; set; }
public string Powder_Name { get; set; } = "";
/// <summary>
/// 粉料仓剩余重量
/// </summary>


+ 1
- 1
BPASmartClient.Model/柔性味魔方/RawMaterialModel.cs Parādīt failu

@@ -114,7 +114,7 @@ namespace BPASmartClient.Model
set
{
_mRecipeStatus = value;
if (value == 1) Status = Status.等待配料;
if (value == 1 && Status != Status.配料完成) Status = Status.等待配料;
else if (value == 2) Status = Status.正在配料;
else if (value == 3) Status = Status.配料完成;
OnPropertyChanged();


+ 1
- 0
BPASmartClient.MorkS/BPASmartClient.MorkS.csproj Parādīt failu

@@ -9,6 +9,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="BPA.Message" Version="1.0.77" />
<PackageReference Include="BPA.Models" Version="1.0.34" />
<PackageReference Include="Microsoft.Toolkit.Mvvm" Version="7.1.2" />
<PackageReference Include="System.Speech" Version="6.0.0" />


+ 60
- 6
BPASmartClient.MorkS/Control_Morks.cs Parādīt failu

@@ -34,13 +34,11 @@ namespace BPASmartClient.MorkS

public override void DoMain()
{


MonitorViewModel.DeviceId = DeviceId;
ServerInit();
DataParse();

Json<MorksPar>.Read();
Json<OrderStatistics>.Read();
if (Json<MorksPar>.Data.parSets == null) Json<MorksPar>.Data.parSets = new ObservableCollection<ParSet>();
if (Json<MorksPar>.Data.parSets.Count < 6)
{
@@ -138,7 +136,43 @@ namespace BPASmartClient.MorkS
goodName = res.MorkOrder.GoodsName;
SortNum = res.MorkOrder.SortNum.ToString();
}

EventBus.EventBus.GetInstance().Publish(new OrderStatusChangedEvent() { SortNum = SortNum, GoodName = goodName, Status = oRDER_STATUS, SubOrderId = subid, deviceClientType = DeviceType });

var index = DataServer.GetInstance.morkS.MakeOrder.FindIndex(p => p.SortNum == SortNum);
if (index >= 0 && index < DataServer.GetInstance.morkS.MakeOrder.Count)
{
if (oRDER_STATUS == ORDER_STATUS.COMPLETED_COOK)
{
DataServer.GetInstance.morkS.MakeOrder.RemoveAt(index);
DataServer.GetInstance.morkS.MakeOrderOver.Add(new OrderMakeModel()
{
Status = oRDER_STATUS,
GoodName = goodName,
SortNum = SortNum,
StopTime = DateTime.Now.ToString("HH:mm:ss")
});
}
else if (oRDER_STATUS == ORDER_STATUS.COMPLETED_TAKE)
{
var temp = DataServer.GetInstance.morkS.MakeOrderOver.FirstOrDefault(p => p.SortNum == SortNum);
if (temp != null) DataServer.GetInstance.morkS.MakeOrderOver.Remove(temp);
}
else
{
DataServer.GetInstance.morkS.MakeOrder.ElementAt(index).Status = oRDER_STATUS;
}
}
else
{
DataServer.GetInstance.morkS.MakeOrder.Add(new OrderMakeModel()
{
Status = oRDER_STATUS,
GoodName = goodName,
SortNum = SortNum,
StartTime = DateTime.Now.ToString("HH:mm:ss")
});
}
}

private void GetStatus(string key, Action<object> action)
@@ -154,6 +188,16 @@ namespace BPASmartClient.MorkS

public override void ReadData()
{
DataServer.GetInstance.morkS.Alarm.Clear();
alarms.ForEach(item =>
{
DataServer.GetInstance.morkS.Alarm.Add(new AlarmModel()
{
AlarmTime = $"{item.Date} {item.Time}",
AlarmMs = item.Info
});
});

GetStatus("M230.0", new Action<object>((obj) =>
{
if (obj is bool[] bools && bools.Length > 0 && bools.Length <= 24)
@@ -215,6 +259,11 @@ namespace BPASmartClient.MorkS
mORKS.TurntableUpLimit = bools[13];
mORKS.FeedComplete = bools[14];
mORKS.TurntableMoveInPlace = bools[15];
DataServer.GetInstance.morkS.MorkS_Temp = mORKS.TemperatureReached;
DataServer.GetInstance.morkS.Morks_SiloMeasUp = mORKS.TurntableUpLimit;
DataServer.GetInstance.morkS.Morks_SiloMeasDown = mORKS.TurntableLowerLimit;
DataServer.GetInstance.morkS.MorkS_NoBowMeas1 = mORKS.MissingBowl;
DataServer.GetInstance.morkS.MorkS_NoBowMeas2 = mORKS.MissingBowlSignal2;
}

}));
@@ -247,6 +296,7 @@ namespace BPASmartClient.MorkS
for (int i = 0; i < 6; i++)
{
mORKS.CookNoodlesComplete[i] = bools[i];
DataServer.GetInstance.morkS.Morks_NoodleUpOrDown[i] = bools[i];
}
}

@@ -256,6 +306,7 @@ namespace BPASmartClient.MorkS
{
if (obj is ushort[] UshortValue && UshortValue.Length > 0 && UshortValue.Length <= 1)
mORKS.TurntableFeedbackloc = UshortValue[0];
DataServer.GetInstance.morkS.MorkS_BinLocation = mORKS.TurntableFeedbackloc;
}));
}

@@ -273,8 +324,11 @@ namespace BPASmartClient.MorkS
if (order.MorkOrder.GoodBatchings == null) return;
if (mORKS.HistorySuborderId.Contains(order.MorkOrder.SuborderId)) return;
OrderCount++;
Json<OrderStatistics>.Data.StatisticsTime=DateTime.Now;
if (DateTime.Now.Subtract(Json<OrderStatistics>.Data.StatisticsTime).Days != 0)
Json<OrderStatistics>.Data.Count = 0;
Json<OrderStatistics>.Data.StatisticsTime = DateTime.Now;
Json<OrderStatistics>.Data.Count++;
Json<OrderStatistics>.Save();
OrderChange(order.MorkOrder.SuborderId, ORDER_STATUS.WAIT);
DeviceProcessLogShow($"接收到{OrderCount}次订单,订单ID:{order.MorkOrder.SuborderId}");
mORKS.HistorySuborderId.Add(order.MorkOrder.SuborderId);
@@ -600,7 +654,7 @@ namespace BPASmartClient.MorkS
}

//取餐完成逻辑处理
if (Delay.GetInstance("CompleteChange1").Start( !mORKS.TakeMealDetect, 1)&&mORKS.CookCompleteFlatBit == true)
if (Delay.GetInstance("CompleteChange1").Start(!mORKS.TakeMealDetect, 1) && mORKS.CookCompleteFlatBit == true)
{
OrderChange(mORKS.OutMealId, ORDER_STATUS.COMPLETED_TAKE);
DeviceProcessLogShow($"订单【{mORKS.OutMealId}】取餐完成");
@@ -814,7 +868,7 @@ namespace BPASmartClient.MorkS
mORKS.TakeBowlTask.Enqueue(new OrderLocInfo() { Loc = (ushort)msm.Bowloc, SuborderId = guid });
MessageLog.GetInstance.Show($"添加订单:碗位置【{(ushort)msm.Bowloc}】");
}
}
});
}


+ 11
- 4
BPASmartClient.MorkS/DataServer.cs Parādīt failu

@@ -6,6 +6,8 @@ using System.Threading;
using System.Threading.Tasks;
using BPA.Helper;
using BPASmartClient.MQTT;
using BPA.Message;
using BPASmartClient.Model;

namespace BPASmartClient.MorkS
{
@@ -16,22 +18,27 @@ namespace BPASmartClient.MorkS
public static DataServer GetInstance => _Instance ?? (_Instance = new DataServer());
private DataServer() { }

public ScreenModelMorkS morkS { get; set; } = new ScreenModelMorkS();

MQTTProxy mQTTProxy = new MQTTProxy();
public void Init()
{
MQTTProxy mQTTProxy = new MQTTProxy();
mQTTProxy.Connected = new Action(() =>
{
mQTTProxy.Subscrib("");
mQTTProxy.Subscrib(ScreenTOPIC.GetInstance.GetTopic(ScreenDeviceType.煮面机));
ThreadManage.GetInstance().StartLong(new Action(() =>
{
mQTTProxy.Publish("", "");
morkS.MorkS_OrderCount = Json<OrderStatistics>.Data.Count;
SendScreenDataModel sendScreenDataModel = new SendScreenDataModel();
sendScreenDataModel.Name = ScreenDeviceType.煮面机;
sendScreenDataModel.Value = morkS.ToJSON();
mQTTProxy.Publish(ScreenTOPIC.GetInstance.GetTopic(ScreenDeviceType.煮面机), sendScreenDataModel.ToJSON());
Thread.Sleep(100);
}), "海科食堂大屏监听");
});
mQTTProxy.Connect("UserName", "Password", "Host", 1883, $"MORKS 设备监听数据{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")}");
}


//订单信息(正在制作,等待制作,制作完成)
//煮面炉上下状态(6个煮面炉上或下)
//温度状态(煮面炉温度是否到达)


+ 1
- 2
BPASmartClient.S7Net/EntityClassResolution.cs Parādīt failu

@@ -57,6 +57,7 @@ namespace BPASmartClient.S7Net
default:
numBytes = GetClassSize(Activator.CreateInstance(type), numBytes, isInnerProperty: true);
if (type.IsClass) IncrementToEven(ref numBytes);
else if (!type.IsPrimitive && !type.IsEnum && type.IsValueType) IncrementToEven(ref numBytes);
break;
}

@@ -401,7 +402,6 @@ namespace BPASmartClient.S7Net
{
break;
}

numBytes = SetBytesFromProperty(array.GetValue(i), bytes, numBytes, accessableProperty);
}
}
@@ -410,7 +410,6 @@ namespace BPASmartClient.S7Net
numBytes = SetBytesFromProperty(accessableProperty.GetValue(sourceClass, null), bytes, numBytes, accessableProperty);
}
}

return numBytes;
}



+ 8
- 0
BPASmartClient.S7Net/SiemensHelper.cs Parādīt failu

@@ -2,6 +2,7 @@
using System.Net;
using System.Text;
using BPASmartClient.S7Net;
using System.Text;

namespace BPASmartClient.S7Net
{
@@ -106,6 +107,13 @@ namespace BPASmartClient.S7Net
}
}

public void WriteString(int db,string txt, int startAddress = 0)
{
var temp = Encoding.ASCII.GetBytes(txt);
var bytes = S7.Net.Types.S7String.ToByteArray(txt, temp.Length);
myPlc.WriteBytes(DataType.DataBlock,db, startAddress, bytes);

}
public TResult ReadClass<TResult>(int db, int startByteAdr = 0) where TResult : class, new()
{
TResult sourceClass = new TResult();


+ 1
- 0
DosingSystem/App.xaml Parādīt failu

@@ -28,6 +28,7 @@
<con:BoolToVisibilityConvert x:Key="BoolToVisibilityConvert" />
<con:CountIsVisiableConvert x:Key="CountIsVisiableConvert" />
<con:BoolToFillColorConverter x:Key="BoolToFillColorConverter" />
<con:RecipeStatusConvert x:Key="RecipeStatusConvert" />
</ResourceDictionary>

<ResourceDictionary>


+ 5
- 1
DosingSystem/App.xaml.cs Parādīt failu

@@ -28,8 +28,12 @@ namespace BPASmartClient.DosingSystem
BPASmartClient.Helper.SystemHelper.GetInstance.CreateDesktopShortcut();
MenuInit();
DataInit();
DeviceInquire.GetInstance.Init();//配料机设备上线监听,设备列表初始化
ThreadManage.GetInstance().Start(new Action(() =>
{
DeviceInquire.GetInstance.Init();//配料机设备上线监听,设备列表初始化
}), "设备初始化");
MainView mv = new MainView();
mv.TitleName = "味魔方管理系统软件[简称:味魔方] 1.0.1";
LoginView lv = new LoginView();
var res = lv.ShowDialog();
if (res != null && res == true)


+ 2
- 2
DosingSystem/Model/DeviceInquire.cs Parādīt failu

@@ -307,7 +307,7 @@ namespace BPASmartClient.DosingSystem
modbusTcp.ShowEx = new Action<string>((s) => { MessageNotify.GetInstance.ShowRunLog(s); });
this.DeviceName = DeviceName;
AlarmHelper<AlarmInfo>.Init();
if (modbusTcp.Connected)
{
ThreadManage.GetInstance().StartLong(new Action(() =>
@@ -364,7 +364,7 @@ namespace BPASmartClient.DosingSystem
modbusTcp.SetUint(DeviceAddress.ServoManualSpeed, (uint)res.ServoManualSpeed);
modbusTcp.SetUint(DeviceAddress.SiloUpperLimitWeight, (uint)res.SiloUpperLimitWeight);
modbusTcp.SetUint(DeviceAddress.LowerLimitWeightOfSilo, (uint)res.LowerLimitWeightOfSilo);
modbusTcp.SetUint(DeviceAddress.StirringSpeed, (uint)res.StirringSpeed * 100);
modbusTcp.SetUint(DeviceAddress.StirringSpeed, (uint)res.StirringSpeed);
MessageNotify.GetInstance.ShowRunLog($"{res.MaterialName},参数下发完成");
}
}


+ 5
- 0
DosingSystem/Model/RecipeModel.cs Parādīt failu

@@ -40,6 +40,11 @@ namespace BPASmartClient.DosingSystem
[Newtonsoft.Json.JsonIgnore]
public AutoResetEvent Are { get; set; } = new AutoResetEvent(false);

[Newtonsoft.Json.JsonIgnore]
public string RecipStatus { get { return _mRecipStatus; } set { _mRecipStatus = value; OnPropertyChanged(); } }
private string _mRecipStatus;


/// <summary>
/// 原料集合
/// </summary>


+ 4
- 4
DosingSystem/View/ChangeDeviceNameView.xaml.cs Parādīt failu

@@ -1,5 +1,4 @@
using BPASmartClient.Helper;
using System;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
@@ -12,6 +11,7 @@ using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
using BPA.Helper;

namespace BPASmartClient.DosingSystem.View
{
@@ -23,8 +23,8 @@ namespace BPASmartClient.DosingSystem.View
public ChangeDeviceNameView()
{
InitializeComponent();
ActionManage.GetInstance.CancelRegister("ChangeDeviceNameViewClose");
ActionManage.GetInstance.Register(new Action(() => { this.Close(); }), "ChangeDeviceNameViewClose");
//ActionManage.GetInstance.CancelRegister("ChangeDeviceNameViewClose");
ActionManage.GetInstance.Register(new Action(() => { this.Close(); }), "ChangeDeviceNameViewClose", true);
this.br.MouseLeftButtonDown += (o, e) => { if (e.LeftButton == MouseButtonState.Pressed) this.DragMove(); };
}
}


+ 2
- 2
DosingSystem/View/RecipeControlView.xaml Parādīt failu

@@ -880,8 +880,8 @@
HorizontalAlignment="Center"
VerticalAlignment="Center"
FontSize="16"
Foreground="Yellow"
Text="等待执行" />
Foreground="{Binding RecipStatus,Converter={StaticResource RecipeStatusConvert}}"
Text="{Binding RecipStatus}" />
<Border
Grid.ColumnSpan="10"
BorderBrush="{StaticResource bordColor}"


+ 0
- 9
DosingSystem/ViewModel/ChangeDeviceNameViewModel.cs Parādīt failu

@@ -54,15 +54,6 @@ namespace BPASmartClient.DosingSystem.ViewModel

private static string IpAddress = string.Empty;

//public BPARelayCommand ConfirmCommand { get; set; }

//public BPARelayCommand CancleCommand { get; set; }


//public string ErrorInfo { get { return _mErrorInfo; } set { _mErrorInfo = value; OnPropertyChanged(); } }
//private string _mErrorInfo;


public string DeviceName { get { return _mDeviceName; } set { _mDeviceName = value; OnPropertyChanged(); } }
private string _mDeviceName;



+ 8
- 7
DosingSystem/ViewModel/RecipeControlViewModel.cs Parādīt failu

@@ -59,7 +59,7 @@ namespace BPASmartClient.DosingSystem.ViewModel
RecipeNames.Enqueue(deviceName);
var t = RecipeNames.GetHashCode();
var res = Recipes.FirstOrDefault(p => p.RecipeName == deviceName);
UserTreeWait.Add(new RecipeModel { SerialNum = UserTreeWait.Count + 1, RecipeName = deviceName, RawMaterials = res.RawMaterials });
UserTreeWait.Add(new RecipeModel { RecipStatus = "等待制作", SerialNum = UserTreeWait.Count + 1, RecipeName = deviceName, RawMaterials = res.RawMaterials });
}
NoticeDemoViewModel.OpenMsg(EnumPromptType.Success, App.MainWindow, "提示", $"配方下发成功!");
MessageNotify.GetInstance.ShowUserLog($"下发工单 {Guid.NewGuid().ToString()}");
@@ -107,7 +107,7 @@ namespace BPASmartClient.DosingSystem.ViewModel
if (tempDevice != null)
{
/*data = data.SetBitValue((byte)tempDevice.DeviceNum, true);*/
if (tempDevice.DeviceNum > 0)
if (tempDevice.DeviceNum > 0)
{
int a = data.SetBitValue((byte)tInfo.ElementAt(i).ElementAt(m).Loc, true);
byte[] test1 = a.ToBytes(BPA.Helper.DataFormat.ABCD);
@@ -116,9 +116,9 @@ namespace BPASmartClient.DosingSystem.ViewModel
MessageNotify.GetInstance.ShowRunLog($"下发配方DB4.DBD{2 + (tempDevice.DeviceNum - 1) * 4} :{item.ToBinString()}");
}
}
if (tInfo.ElementAt(i).ElementAt(m).Loc >0)
if (tInfo.ElementAt(i).ElementAt(m).Loc > 0)
{
if (!BarrelNum.Contains(tInfo.ElementAt(i).ElementAt(m).Loc))
if (!BarrelNum.Contains(tInfo.ElementAt(i).ElementAt(m).Loc))
{
BarrelNum.Add(tInfo.ElementAt(i).ElementAt(m).Loc);
}
@@ -232,6 +232,7 @@ namespace BPASmartClient.DosingSystem.ViewModel
RecipeName = recipeComple.RecipeName,
SerialNum = UserTreeCompelete.Count + 1,
RecipCode = recipeComple.RecipCode,
RecipStatus = "制作完成"
});
});
App.Current.Dispatcher.Invoke(new Action(() =>
@@ -283,14 +284,14 @@ namespace BPASmartClient.DosingSystem.ViewModel
MessageNotify.GetInstance.ShowRunLog("错误");
return;
}
else
else
{
switch (cnt)
{
case 1:
int a1 = Array.FindIndex(DeviceInquire.GetInstance.devices.ToArray(), p => p.DeviceNum == 1);
int b1 = Array.FindIndex(DeviceInquire.GetInstance.devices.ToArray(), p => p.DeviceNum == 2);
if (a1 >= 0)
if (a1 >= 0)
{
Location1 = Array.FindIndex(Recipes.ElementAt(i).RawMaterials.ToArray(), p => p.RawMaterialName == DeviceInquire.GetInstance.devices.ElementAt(a1).DeviceName && p.Loc == barrel);
}
@@ -461,7 +462,7 @@ namespace BPASmartClient.DosingSystem.ViewModel
}
}
}
else
else
{
if (Location2 >= 0)
{


Notiek ielāde…
Atcelt
Saglabāt