@@ -29,7 +29,6 @@ namespace BPASmartClient.JXJFoodBigStation | |||||
DataInit(); | DataInit(); | ||||
ProcessControl.GetInstance.Init(); | ProcessControl.GetInstance.Init(); | ||||
MainView mv = new MainView(); | MainView mv = new MainView(); | ||||
//mv.Show(); | |||||
LoginView lv = new LoginView(); | LoginView lv = new LoginView(); | ||||
var res = lv.ShowDialog(); | var res = lv.ShowDialog(); | ||||
if (res != null && res == true) | if (res != null && res == true) | ||||
@@ -13,7 +13,9 @@ namespace BPASmartClient.JXJFoodBigStation.Model | |||||
public double Weight { get { return _mWeight; } set { _mWeight = value; OnPropertyChanged(); } } | public double Weight { get { return _mWeight; } set { _mWeight = value; OnPropertyChanged(); } } | ||||
private double _mWeight; | private double _mWeight; | ||||
/// <summary> | |||||
/// 运行状态 | |||||
/// </summary> | |||||
public bool RunStatus { get { return _mRunStatus; } set { _mRunStatus = value; OnPropertyChanged(); } } | public bool RunStatus { get { return _mRunStatus; } set { _mRunStatus = value; OnPropertyChanged(); } } | ||||
private bool _mRunStatus; | private bool _mRunStatus; | ||||
@@ -21,6 +23,9 @@ namespace BPASmartClient.JXJFoodBigStation.Model | |||||
public string DeviceName { get { return _mDeviceName; } set { _mDeviceName = value; OnPropertyChanged(); } } | public string DeviceName { get { return _mDeviceName; } set { _mDeviceName = value; OnPropertyChanged(); } } | ||||
private string _mDeviceName; | private string _mDeviceName; | ||||
/// <summary> | |||||
/// 设备编号 | |||||
/// </summary> | |||||
public int DeviceNum { get { return _mDeviceNum; } set { _mDeviceNum = value; OnPropertyChanged(); } } | public int DeviceNum { get { return _mDeviceNum; } set { _mDeviceNum = value; OnPropertyChanged(); } } | ||||
private int _mDeviceNum; | private int _mDeviceNum; | ||||
@@ -16,37 +16,30 @@ namespace BPASmartClient.JXJFoodBigStation.Model | |||||
/// </summary> | /// </summary> | ||||
public static bool HeartBeatFromPlc { get; set; } | public static bool HeartBeatFromPlc { get; set; } | ||||
/// <summary> | /// <summary> | ||||
/// 往输送带下发配方完成 | |||||
/// </summary> | |||||
public bool IssueRecipeFinish { get; set; } = false; | |||||
/// <summary> | |||||
/// 当前料仓的位置 | |||||
/// </summary> | |||||
public int StockInIsWork { get; set; } = 0; | |||||
/// <summary> | |||||
/// 单个配方执行完成标志 | |||||
/// 配方下发状态 =0:配方未下发 ,1:配方下发给plc ,2:plc成功接收配方 | |||||
/// </summary> | /// </summary> | ||||
public bool RecipeFinish { get; set; } = false; | |||||
public static int Recipe1DosingStatus { get; set; } | |||||
/// <summary> | /// <summary> | ||||
/// 记录AGV进站送货的指令顺序 | |||||
/// 配方下发状态 =0:配方未下发 ,1:配方下发给plc ,2:plc成功接收配方 | |||||
/// </summary> | /// </summary> | ||||
public int AgvDeliveryPosition { get; set; } | |||||
public static int Recipe2DosingStatus { get; set; } | |||||
/// <summary> | /// <summary> | ||||
/// 记录AGV进站取货的指令顺序 | |||||
/// 配方下发状态 =0:配方未下发 ,1:配方下发给plc ,2:plc成功接收配方 | |||||
/// </summary> | /// </summary> | ||||
public int AgvPickUpPosition { get; set; } | |||||
public static int Recipe3DosingStatus { get; set; } | |||||
/// <summary> | /// <summary> | ||||
/// 配方下发状态 =0:配方未下发 ,1:配方下发给plc ,2:plc成功接收配方 | /// 配方下发状态 =0:配方未下发 ,1:配方下发给plc ,2:plc成功接收配方 | ||||
/// </summary> | /// </summary> | ||||
public static int Recipe1DosingStatus { get; set; } | |||||
public static int Recipe2DosingStatus { get; set; } | |||||
public static int Recipe3DosingStatus { get; set; } | |||||
public static int Recipe4DosingStatus { get; set; } | public static int Recipe4DosingStatus { get; set; } | ||||
/// <summary> | /// <summary> | ||||
/// 是否处于手动下发配方 | /// 是否处于手动下发配方 | ||||
/// </summary> | /// </summary> | ||||
public static bool IsUseLocalRecipe { get; set; } = false; | public static bool IsUseLocalRecipe { get; set; } = false; | ||||
/// <summary> | |||||
/// 订单请求 | |||||
/// </summary> | |||||
public static bool Order_Request { get; set; } = false; | |||||
public const int StockBinNum = 12; | |||||
} | } | ||||
} | } |
@@ -8,20 +8,37 @@ namespace BPASmartClient.JXJFoodBigStation.Model.HK_PLC | |||||
{ | { | ||||
public class DB_Read | public class DB_Read | ||||
{ | { | ||||
/// <summary> | |||||
/// plc心跳上报 | |||||
/// </summary> | |||||
public bool HeartBeat { get; set; } | public bool HeartBeat { get; set; } | ||||
/// <summary> | |||||
/// 配方1允许下发配方 | |||||
/// </summary> | |||||
public bool IsAllowIssueRecipe1 { get; set; } | public bool IsAllowIssueRecipe1 { get; set; } | ||||
public bool IsAllowIssueRecipe2 { get; set; } | public bool IsAllowIssueRecipe2 { get; set; } | ||||
public bool IsAllowIssueRecipe3 { get; set; } | public bool IsAllowIssueRecipe3 { get; set; } | ||||
public bool IsAllowIssueRecipe4 { get; set; } | public bool IsAllowIssueRecipe4 { get; set; } | ||||
/// <summary> | |||||
/// 配方1 接收配方完成 | |||||
/// </summary> | |||||
public bool ReceiveFinishRecipe1 { get; set; } | public bool ReceiveFinishRecipe1 { get; set; } | ||||
public bool ReceiveFinishRecipe2 { get; set; } | public bool ReceiveFinishRecipe2 { get; set; } | ||||
public bool ReceiveFinishRecipe3 { get; set; } | public bool ReceiveFinishRecipe3 { get; set; } | ||||
public bool ReceiveFinishRecipe4 { get; set; } | public bool ReceiveFinishRecipe4 { get; set; } | ||||
/// <summary> | |||||
/// 配方1 配料完成 | |||||
/// </summary> | |||||
public bool Recipe1DosingFinish { get; set; } | public bool Recipe1DosingFinish { get; set; } | ||||
public bool Recipe2DosingFinish { get; set; } | public bool Recipe2DosingFinish { get; set; } | ||||
public bool Recipe3DosingFinish { get; set; } | public bool Recipe3DosingFinish { get; set; } | ||||
public bool Recipe4DosingFinish { get; set; } | public bool Recipe4DosingFinish { get; set; } | ||||
/// <summary> | |||||
/// 配方1 托盘编号 | |||||
/// </summary> | |||||
public short Recipe1TrayCode { get; set; } | public short Recipe1TrayCode { get; set; } | ||||
public short Recipe2TrayCode { get; set; } | public short Recipe2TrayCode { get; set; } | ||||
public short Recipe3TrayCode { get; set; } | public short Recipe3TrayCode { get; set; } | ||||
@@ -1,41 +0,0 @@ | |||||
using BPASmartClient.Helper; | |||||
using BPASmartClient.Modbus; | |||||
using System; | |||||
using System.Collections.Concurrent; | |||||
using System.Collections.Generic; | |||||
using System.Linq; | |||||
using System.Text; | |||||
using System.Threading.Tasks; | |||||
namespace BPASmartClient.JXJFoodBigStation.Model.HK_PLC | |||||
{ | |||||
public class DataComm | |||||
{ | |||||
public volatile static DataComm Instance; | |||||
public static DataComm GetInstance => Instance ?? (new DataComm()); | |||||
public DataComm() { } | |||||
/// <summary> | |||||
/// 是否允许配料 | |||||
/// </summary> | |||||
public bool IsAllowDosing { get { return _mIsAllowDosing; } set { _mIsAllowDosing = value; } } | |||||
private bool _mIsAllowDosing; | |||||
public bool DosingFinishToPLC { get { return _mDosingFinishToPLC; } set { _mDosingFinishToPLC = value; } } | |||||
private bool _mDosingFinishToPLC; | |||||
private int _mStockBinLocationToPLC; | |||||
public int StockBinLocationToPLC { get { return _mStockBinLocationToPLC; } set { _mStockBinLocationToPLC = value; } } | |||||
public bool StatusSignToBPA { get { return _mStatusSignToBPA; } set { _mStatusSignToBPA = value; } } | |||||
private bool _mStatusSignToBPA; | |||||
private int _mStockBinLocationToBPA; | |||||
public int StockBinLocationToBPA { get { return _mStockBinLocationToBPA; } set { _mStockBinLocationToBPA = value; } } | |||||
private int _mBarrelNumToPLC; | |||||
public int BarrelNumToPLC { get { return _mBarrelNumToPLC; } set { _mBarrelNumToPLC = value; } } | |||||
/*public ConcurrentDictionary<int, StockBinLocations> DeviceLists = new ConcurrentDictionary<int, StockBinLocations>();*/ | |||||
} | |||||
} |
@@ -52,7 +52,7 @@ namespace BPASmartClient.JXJFoodBigStation.Model.HK_PLC | |||||
PlcWrite.TrayCode = Convert.ToInt16(recipe.TrayCode); | PlcWrite.TrayCode = Convert.ToInt16(recipe.TrayCode); | ||||
for (int barrel = 1; barrel < 6; barrel++) | for (int barrel = 1; barrel < 6; barrel++) | ||||
{ | { | ||||
if (barrel != 3) | |||||
if (barrel != 3)//桶的编号不为3 只为1,2,4,5号桶 | |||||
{ | { | ||||
for (int loc = 1; loc < 15; loc++) | for (int loc = 1; loc < 15; loc++) | ||||
{ | { | ||||
@@ -20,12 +20,9 @@ namespace BPASmartClient.JXJFoodBigStation.Model | |||||
private volatile static ProcessControl _Instance; | private volatile static ProcessControl _Instance; | ||||
public static ProcessControl GetInstance => _Instance ?? (_Instance = new ProcessControl()); | public static ProcessControl GetInstance => _Instance ?? (_Instance = new ProcessControl()); | ||||
private ProcessControl() { } | private ProcessControl() { } | ||||
public SiemensDeviceStatus SiemensDevice = new SiemensDeviceStatus(); | public SiemensDeviceStatus SiemensDevice = new SiemensDeviceStatus(); | ||||
public HKDeviceStatus HKDevice = new HKDeviceStatus(); | public HKDeviceStatus HKDevice = new HKDeviceStatus(); | ||||
DL_Finish_DB FinishData = new DL_Finish_DB(); | DL_Finish_DB FinishData = new DL_Finish_DB(); | ||||
/// <summary> | /// <summary> | ||||
/// 配方数据 | /// 配方数据 | ||||
/// </summary> | /// </summary> | ||||
@@ -45,24 +42,21 @@ namespace BPASmartClient.JXJFoodBigStation.Model | |||||
public ConcurrentQueue<string> RecipeQueue2 = new ConcurrentQueue<string>(); | public ConcurrentQueue<string> RecipeQueue2 = new ConcurrentQueue<string>(); | ||||
public ConcurrentQueue<string> RecipeQueue3 = new ConcurrentQueue<string>(); | public ConcurrentQueue<string> RecipeQueue3 = new ConcurrentQueue<string>(); | ||||
public ConcurrentQueue<string> RecipeQueue4 = new ConcurrentQueue<string>(); | public ConcurrentQueue<string> RecipeQueue4 = new ConcurrentQueue<string>(); | ||||
/// <summary> | |||||
/// 接收原料数据 | |||||
/// </summary> | |||||
public RecipeRawMaterial RawMaterial; | |||||
public void Init() | public void Init() | ||||
{ | { | ||||
testData(); | |||||
ActionManage.GetInstance.CancelRegister("SiemensSendRecipe"); | ActionManage.GetInstance.CancelRegister("SiemensSendRecipe"); | ||||
ActionManage.GetInstance.Register(new Action<object>((res) => | ActionManage.GetInstance.Register(new Action<object>((res) => | ||||
{ | { | ||||
ObservableCollection<RawMaterial> RawMaterials = new ObservableCollection<RawMaterial>(); | ObservableCollection<RawMaterial> RawMaterials = new ObservableCollection<RawMaterial>(); | ||||
if (SiemensDevice.IsConnected) | |||||
if (SiemensDevice.IsConnected ||true) | |||||
{ | { | ||||
if (res != null && res is DL_Start_DB recipe) | if (res != null && res is DL_Start_DB recipe) | ||||
{ | { | ||||
RawMaterials.Clear(); | RawMaterials.Clear(); | ||||
for (int i = 0; i < 15; i++) | |||||
for (int i = 0; i < 12; i++) | |||||
{ | { | ||||
if (RawMaterialsNamePos.ContainsKey(recipe.RecipeName)) | |||||
if (RawMaterialsNamePos.ContainsKey(recipe.Material[i].Material_Name)) | |||||
{ | { | ||||
RawMaterials.Add(new RawMaterial() | RawMaterials.Add(new RawMaterial() | ||||
{ | { | ||||
@@ -98,7 +92,7 @@ namespace BPASmartClient.JXJFoodBigStation.Model | |||||
HKDevice.Init(); | HKDevice.Init(); | ||||
MessageNotify.GetInstance.ShowRunLog("海科plc连接成功"); | MessageNotify.GetInstance.ShowRunLog("海科plc连接成功"); | ||||
} | } | ||||
if (SiemensDevice.IsConnected) | |||||
if (SiemensDevice.IsConnected || true) | |||||
{ | { | ||||
SiemensDevice.Init(); | SiemensDevice.Init(); | ||||
MessageNotify.GetInstance.ShowRunLog("西门子plc连接成功"); | MessageNotify.GetInstance.ShowRunLog("西门子plc连接成功"); | ||||
@@ -108,24 +102,10 @@ namespace BPASmartClient.JXJFoodBigStation.Model | |||||
{ | { | ||||
} | } | ||||
ActionManage.GetInstance.CancelRegister("ManualSendRecipe"); | |||||
ActionManage.GetInstance.Register(new Action<Object>((o) => | |||||
{ | |||||
if (o != null && o is RecipeData a) | |||||
{ | |||||
Json<LocalRecipe>.Data.Recipes.Add(a); | |||||
for (int i = 0; i < Json<LocalRecipe>.Data.Recipes.Count; i++) | |||||
{ | |||||
foreach (var item in Json<LocalRecipe>.Data.Recipes.ElementAt(i).RawMaterial) | |||||
{ | |||||
item.RawMaterialLocation = Convert.ToInt32(item.RawMaterialName); | |||||
} | |||||
} | |||||
MessageNotify.GetInstance.ShowAlarmLog("手动下发配方完成"); | |||||
} | |||||
}), "ManualSendRecipe", true); | |||||
RecipeQueue1.Clear(); | RecipeQueue1.Clear(); | ||||
RecipeQueue2.Clear(); | |||||
RecipeQueue3.Clear(); | |||||
RecipeQueue4.Clear(); | |||||
ThreadManage.GetInstance().StartLong(new Action(() => | ThreadManage.GetInstance().StartLong(new Action(() => | ||||
{ | { | ||||
SystemStatus(); | SystemStatus(); | ||||
@@ -152,22 +132,22 @@ namespace BPASmartClient.JXJFoodBigStation.Model | |||||
{ | { | ||||
foreach (var data in Recipes) | foreach (var data in Recipes) | ||||
{ | { | ||||
if (RecipeQueue1.Count == 0) | |||||
if (RecipeQueue1.Count == 0 && !RecipeQueue2.Contains(data.RecipeCode) && !RecipeQueue3.Contains(data.RecipeCode) && !RecipeQueue4.Contains(data.RecipeCode)) | |||||
{ | { | ||||
if (!(RecipeQueue1.Contains(data.RecipeCode))) | if (!(RecipeQueue1.Contains(data.RecipeCode))) | ||||
RecipeQueue1.Enqueue(data.RecipeCode); | RecipeQueue1.Enqueue(data.RecipeCode); | ||||
} | } | ||||
else if (RecipeQueue2.Count == 0) | |||||
else if (RecipeQueue2.Count == 0 && !RecipeQueue1.Contains(data.RecipeCode) && !RecipeQueue3.Contains(data.RecipeCode) && !RecipeQueue4.Contains(data.RecipeCode)) | |||||
{ | { | ||||
if (!(RecipeQueue2.Contains(data.RecipeCode))) | if (!(RecipeQueue2.Contains(data.RecipeCode))) | ||||
RecipeQueue2.Enqueue(data.RecipeCode); | RecipeQueue2.Enqueue(data.RecipeCode); | ||||
} | } | ||||
else if (RecipeQueue3.Count == 0) | |||||
else if (RecipeQueue3.Count == 0 && !RecipeQueue1.Contains(data.RecipeCode) && !RecipeQueue2.Contains(data.RecipeCode) && !RecipeQueue4.Contains(data.RecipeCode)) | |||||
{ | { | ||||
if (!(RecipeQueue3.Contains(data.RecipeCode))) | if (!(RecipeQueue3.Contains(data.RecipeCode))) | ||||
RecipeQueue3.Enqueue(data.RecipeCode); | RecipeQueue3.Enqueue(data.RecipeCode); | ||||
} | } | ||||
else if (RecipeQueue4.Count == 0) | |||||
else if (RecipeQueue4.Count == 0 && !RecipeQueue1.Contains(data.RecipeCode) && !RecipeQueue2.Contains(data.RecipeCode) && !RecipeQueue3.Contains(data.RecipeCode)) | |||||
{ | { | ||||
if (!(RecipeQueue4.Contains(data.RecipeCode))) | if (!(RecipeQueue4.Contains(data.RecipeCode))) | ||||
RecipeQueue4.Enqueue(data.RecipeCode); | RecipeQueue4.Enqueue(data.RecipeCode); | ||||
@@ -292,11 +272,15 @@ namespace BPASmartClient.JXJFoodBigStation.Model | |||||
IssuedComplete.Add(Recipes.ElementAt(index));//将配方添加到完成列表 | IssuedComplete.Add(Recipes.ElementAt(index));//将配方添加到完成列表 | ||||
if (!GVL_BigStation.IsUseLocalRecipe) | if (!GVL_BigStation.IsUseLocalRecipe) | ||||
{ | { | ||||
Json<RemoteRecipe>.Data.Recipes.RemoveAt(index);//制作完成,移除当前配方 | |||||
App.Current.Dispatcher.Invoke(() => { | |||||
Json<RemoteRecipe>.Data.Recipes.RemoveAt(index);//制作完成,移除当前配方 | |||||
}); | |||||
} | } | ||||
else | else | ||||
{ | { | ||||
Json<LocalRecipe>.Data.Recipes.RemoveAt(index);//制作完成,移除当前配方 | |||||
App.Current.Dispatcher.Invoke(() => { | |||||
Json<LocalRecipe>.Data.Recipes.RemoveAt(index);//制作完成,移除当前配方 | |||||
}); | |||||
} | } | ||||
GVL_BigStation.Recipe1DosingStatus = 0; | GVL_BigStation.Recipe1DosingStatus = 0; | ||||
} | } | ||||
@@ -529,7 +513,6 @@ namespace BPASmartClient.JXJFoodBigStation.Model | |||||
} | } | ||||
GVL_BigStation.Recipe3DosingStatus = 0; | GVL_BigStation.Recipe3DosingStatus = 0; | ||||
} | } | ||||
} | } | ||||
} | } | ||||
if (RecipeQueue4.Count > 0) | if (RecipeQueue4.Count > 0) | ||||
@@ -653,7 +636,6 @@ namespace BPASmartClient.JXJFoodBigStation.Model | |||||
/// </summary> | /// </summary> | ||||
private void StockBinParReset() | private void StockBinParReset() | ||||
{ | { | ||||
HKDevice.PlcWrite.RecipeCode = 0; | HKDevice.PlcWrite.RecipeCode = 0; | ||||
HKDevice.PlcWrite.TrayCode = 0; | HKDevice.PlcWrite.TrayCode = 0; | ||||
@@ -32,7 +32,5 @@ namespace BPASmartClient.JXJFoodBigStation.Model | |||||
/// 原料数据 | /// 原料数据 | ||||
/// </summary> | /// </summary> | ||||
public ObservableCollection<RawMaterial> RawMaterial { get; set; } = new ObservableCollection<RawMaterial>(); | public ObservableCollection<RawMaterial> RawMaterial { get; set; } = new ObservableCollection<RawMaterial>(); | ||||
} | } | ||||
} | } |
@@ -13,25 +13,50 @@ namespace BPASmartClient.JXJFoodBigStation.Model.Siemens | |||||
public string RecipeCode { get; set; } | public string RecipeCode { get; set; } | ||||
[Siemens(16)] | [Siemens(16)] | ||||
public string RecipeName { get; set; } | public string RecipeName { get; set; } | ||||
public bool var1 { get; set; } | |||||
public bool var2 { get; set; } | |||||
public bool var3 { get; set; } | |||||
public bool var4 { get; set; } | |||||
public bool var5 { get; set; } | |||||
public bool var6 { get; set; } | |||||
public bool var7 { get; set; } | |||||
public bool var8 { get; set; } | |||||
public bool var9 { get; set; } | |||||
public short Mode { get; set; } | |||||
public bool[] Alarm { get; set; } = new bool[24]; | |||||
/// <summary> | |||||
/// 缺料本机 | |||||
/// </summary> | |||||
public bool DeviceInComplete { get; set; } | |||||
/// <summary> | |||||
/// 上游缺料 | |||||
/// </summary> | |||||
public bool TopInComple { get; set; } | |||||
/// <summary> | |||||
/// 下游堵料 | |||||
/// </summary> | |||||
public bool DownWindrow { get; set; } | |||||
/// <summary> | |||||
/// 设备启动 | |||||
/// </summary> | |||||
public bool DeviceStart { get; set; } | |||||
/// <summary> | |||||
/// 设备停止 | |||||
/// </summary> | |||||
public bool DeviceStop { get; set; } | |||||
/// <summary> | |||||
/// 设备急停 | |||||
/// </summary> | |||||
public bool DeviceEStop { get; set; } | |||||
/// <summary> | |||||
/// 设备暂停 | |||||
/// </summary> | |||||
public bool DevicePause { get; set; } | |||||
/// <summary> | |||||
/// 设备故障 | |||||
/// </summary> | |||||
public bool DeviceAlarm { get; set; } | |||||
/// <summary> | |||||
/// 上位机给plc的心跳 | |||||
/// </summary> | |||||
public bool HeartBeat { get; set; } | |||||
/// <summary> | |||||
/// 设备模式 | |||||
/// </summary> | |||||
public short DeviceMode { get; set; } | |||||
/// <summary> | |||||
/// 设备报警 | |||||
/// </summary> | |||||
public bool[] AlarmInfo { get; set; } = new bool[24]; | |||||
public int Reserved1 { get; set; } | public int Reserved1 { get; set; } | ||||
public int Reserved2 { get; set; } | public int Reserved2 { get; set; } | ||||
@@ -19,20 +19,37 @@ namespace BPASmartClient.JXJFoodBigStation.Model.Siemens | |||||
/// 配发名称 | /// 配发名称 | ||||
/// </summary> | /// </summary> | ||||
public string RecipeName { get; set; } | public string RecipeName { get; set; } | ||||
public short Order_No { get; set; } | |||||
/// <summary> | |||||
/// 工位号 | |||||
/// </summary> | |||||
public short Job_No { get; set; } | |||||
/// <summary> | |||||
/// 托盘号 | |||||
/// </summary> | |||||
public short Pallet_No { get; set; } | public short Pallet_No { get; set; } | ||||
/// <summary> | /// <summary> | ||||
/// 物料信息 | /// 物料信息 | ||||
/// </summary> | /// </summary> | ||||
public UDT[] Material { get; set; } = new UDT[20]; | public UDT[] Material { get; set; } = new UDT[20]; | ||||
/// <summary> | |||||
/// 订单类型(0.其他、 1.洗锅) | |||||
/// </summary> | |||||
public bool Order_Type { get; set; } | public bool Order_Type { get; set; } | ||||
/// <summary> | |||||
/// 订单请求确认 | |||||
/// </summary> | |||||
public bool Order_Request_Ack { get; set; } | public bool Order_Request_Ack { get; set; } | ||||
/// <summary> | |||||
/// 备用 | |||||
/// </summary> | |||||
public short[] Standby { get; set; } = new short[4]; | public short[] Standby { get; set; } = new short[4]; | ||||
/// <summary> | /// <summary> | ||||
/// 配方发送请求 | /// 配方发送请求 | ||||
/// </summary> | /// </summary> | ||||
public bool Ask_For_Send_Bit { get; set; } | |||||
public bool Order_Request { get; set; } | |||||
/// <summary> | |||||
/// 备用 | |||||
/// </summary> | |||||
public short[] Standby1 { get; set; } = new short[4]; | public short[] Standby1 { get; set; } = new short[4]; | ||||
} | } | ||||
public class UDT | public class UDT | ||||
@@ -8,380 +8,7 @@ namespace BPASmartClient.JXJFoodBigStation.Model.Siemens | |||||
{ | { | ||||
public class SiemensCommAddress | public class SiemensCommAddress | ||||
{ | { | ||||
#region 配方地址 | |||||
/// <summary> | |||||
/// 配方状态 | |||||
/// </summary> | |||||
public static string RecipeState { get; set; } = ""; | |||||
/// <summary> | |||||
/// 配方名称 | |||||
/// </summary> | |||||
public static string RecipeName { get; set; } = ""; | |||||
/// <summary> | |||||
/// 配方ID | |||||
/// </summary> | |||||
public static string RecipeID { get; set; } = ""; | |||||
/// <summary> | |||||
/// 原料信息 | |||||
/// </summary> | |||||
public static string RawMaterial { get; set; } = ""; | |||||
#endregion | |||||
#region AGV到位(与西门子PLC交互)西门子PLC ==> 上位机 | |||||
/// <summary> | |||||
/// 托盘的位置编号 | |||||
/// </summary> | |||||
public static string TrayLocationNum { get; set; } = ""; | |||||
/// <summary> | |||||
/// 配方ID | |||||
/// </summary> | |||||
public static string TrayRecipeID { get; set; } = ""; | |||||
/// <summary> | |||||
/// 状态信号 | |||||
/// </summary> | |||||
public static string StateSign { get; set; } = ""; | |||||
#endregion | |||||
#region Tray配料完成(与西门子PLC交互)上位机 ==> 西门子PLC | |||||
public static string TrayLocationNumToSiemens { get; set; } = ""; | |||||
public static string TrayRecipeIDToSiemens { get; set; } = ""; | |||||
public static string TrayStateToSiemens { get; set; } = ""; | |||||
#endregion | |||||
/*#region AGV小车进出工站1 | |||||
/// <summary> | |||||
/// Agv送货 进站申请 从西门子读取 | |||||
/// </summary> | |||||
public static string DeliveryAGVApply1 { get; set; } = ""; | |||||
/// <summary> | |||||
/// Agv送货 进站申请 写给西门子 | |||||
/// </summary> | |||||
public static string DeliveryAGVIsApply1 { get; set; } = ""; | |||||
/// <summary> | |||||
/// Agv送货 进站顶升申请 从西门子读取 | |||||
/// </summary> | |||||
public static string DeliveryAGVApplyJack1 { get; set; } = ""; | |||||
/// <summary> | |||||
/// Agv送货 进站顶升申请 写给西门子 | |||||
/// </summary> | |||||
public static string DeliveryAGVIsApplyJack1 { get; set; } = ""; | |||||
/// <summary> | |||||
/// Agv送货 送货完成 从西门子读取 | |||||
/// </summary> | |||||
public static string DeliveryAGVFinsih1{ get; set; } = ""; | |||||
/// <summary> | |||||
/// Agv送货 工位上有货架 写给西门子 | |||||
/// </summary> | |||||
public static string StationHaveCargo1 { get; set; } = ""; | |||||
/// <summary> | |||||
/// Agv送货 进站申请 从西门子读取 | |||||
/// </summary> | |||||
public static string PickAGVApply1 { get; set; } = ""; | |||||
/// <summary> | |||||
/// Agv送货 进站申请 写给西门子 | |||||
/// </summary> | |||||
public static string PickAGVIsApply1 { get; set; } = ""; | |||||
/// <summary> | |||||
/// Agv送货 取货架完成 从西门子读取 | |||||
/// </summary> | |||||
public static string PickCargoAGVFinish1 { get; set; } = ""; | |||||
/// <summary> | |||||
/// Agv送货 取料完成 写给西门子 | |||||
/// </summary> | |||||
public static string PickAGVFinish1 { get; set; } = ""; | |||||
/// <summary> | |||||
/// 工位上是否有小车 | |||||
/// </summary> | |||||
public static string StationIsExistCar1 { get; set; } = ""; | |||||
#endregion | |||||
#region AGV小车进出工站2 | |||||
/// <summary> | |||||
/// Agv送货 进站申请 从西门子读取 | |||||
/// </summary> | |||||
public static string DeliveryAGVApply2 { get; set; } = ""; | |||||
/// <summary> | |||||
/// Agv送货 进站申请 写给西门子 | |||||
/// </summary> | |||||
public static string DeliveryAGVIsApply2 { get; set; } = ""; | |||||
/// <summary> | |||||
/// Agv送货 进站顶升申请 从西门子读取 | |||||
/// </summary> | |||||
public static string DeliveryAGVApplyJack2 { get; set; } = ""; | |||||
/// <summary> | |||||
/// Agv送货 进站顶升申请 写给西门子 | |||||
/// </summary> | |||||
public static string DeliveryAGVIsApplyJack2 { get; set; } = ""; | |||||
/// <summary> | |||||
/// Agv送货 送货完成 从西门子读取 | |||||
/// </summary> | |||||
public static string DeliveryAGVFinsih2 { get; set; } = ""; | |||||
/// <summary> | |||||
/// Agv送货 工位上有货架 写给西门子 | |||||
/// </summary> | |||||
public static string StationHaveCargo2 { get; set; } = ""; | |||||
/// <summary> | |||||
/// Agv送货 进站申请 从西门子读取 | |||||
/// </summary> | |||||
public static string PickAGVApply2 { get; set; } = ""; | |||||
/// <summary> | |||||
/// Agv送货 进站申请 写给西门子 | |||||
/// </summary> | |||||
public static string PickAGVIsApply2 { get; set; } = ""; | |||||
/// <summary> | |||||
/// Agv送货 取货架完成 从西门子读取 | |||||
/// </summary> | |||||
public static string PickCargoAGVFinish2 { get; set; } = ""; | |||||
/// <summary> | |||||
/// Agv送货 取料完成 写给西门子 | |||||
/// </summary> | |||||
public static string PickAGVFinish2 { get; set; } = ""; | |||||
/// <summary> | |||||
/// 工位上是否有小车 | |||||
/// </summary> | |||||
public static string StationIsExistCar2 { get; set; } = ""; | |||||
#endregion | |||||
#region AGV小车进出工站3 | |||||
/// <summary> | |||||
/// Agv送货 进站申请 从西门子读取 | |||||
/// </summary> | |||||
public static string DeliveryAGVApply3 { get; set; } = ""; | |||||
/// <summary> | |||||
/// Agv送货 进站申请 写给西门子 | |||||
/// </summary> | |||||
public static string DeliveryAGVIsApply3 { get; set; } = ""; | |||||
/// <summary> | |||||
/// Agv送货 进站顶升申请 从西门子读取 | |||||
/// </summary> | |||||
public static string DeliveryAGVApplyJack3 { get; set; } = ""; | |||||
/// <summary> | |||||
/// Agv送货 进站顶升申请 写给西门子 | |||||
/// </summary> | |||||
public static string DeliveryAGVIsApplyJack3 { get; set; } = ""; | |||||
/// <summary> | |||||
/// Agv送货 送货完成 从西门子读取 | |||||
/// </summary> | |||||
public static string DeliveryAGVFinsih3 { get; set; } = ""; | |||||
/// <summary> | |||||
/// Agv送货 工位上有货架 写给西门子 | |||||
/// </summary> | |||||
public static string StationHaveCargo3 { get; set; } = ""; | |||||
/// <summary> | |||||
/// Agv送货 进站申请 从西门子读取 | |||||
/// </summary> | |||||
public static string PickAGVApply3 { get; set; } = ""; | |||||
/// <summary> | |||||
/// Agv送货 进站申请 写给西门子 | |||||
/// </summary> | |||||
public static string PickAGVIsApply3 { get; set; } = ""; | |||||
/// <summary> | |||||
/// Agv送货 取货架完成 从西门子读取 | |||||
/// </summary> | |||||
public static string PickCargoAGVFinish3 { get; set; } = ""; | |||||
/// <summary> | |||||
/// Agv送货 取料完成 写给西门子 | |||||
/// </summary> | |||||
public static string PickAGVFinish3 { get; set; } = ""; | |||||
/// <summary> | |||||
/// 工位上是否有小车 | |||||
/// </summary> | |||||
public static string StationIsExistCar3 { get; set; } = ""; | |||||
#endregion | |||||
#region AGV小车进出工站4 | |||||
/// <summary> | |||||
/// Agv送货 进站申请 从西门子读取 | |||||
/// </summary> | |||||
public static string DeliveryAGVApply4 { get; set; } = ""; | |||||
/// <summary> | |||||
/// Agv送货 进站申请 写给西门子 | |||||
/// </summary> | |||||
public static string DeliveryAGVIsApply4 { get; set; } = ""; | |||||
/// <summary> | |||||
/// Agv送货 进站顶升申请 从西门子读取 | |||||
/// </summary> | |||||
public static string DeliveryAGVApplyJack4 { get; set; } = ""; | |||||
/// <summary> | |||||
/// Agv送货 进站顶升申请 写给西门子 | |||||
/// </summary> | |||||
public static string DeliveryAGVIsApplyJack4 { get; set; } = ""; | |||||
/// <summary> | |||||
/// Agv送货 送货完成 从西门子读取 | |||||
/// </summary> | |||||
public static string DeliveryAGVFinsih4 { get; set; } = ""; | |||||
/// <summary> | |||||
/// Agv送货 工位上有货架 写给西门子 | |||||
/// </summary> | |||||
public static string StationHaveCargo4 { get; set; } = ""; | |||||
/// <summary> | |||||
/// Agv送货 进站申请 从西门子读取 | |||||
/// </summary> | |||||
public static string PickAGVApply4 { get; set; } = ""; | |||||
/// <summary> | |||||
/// Agv送货 进站申请 写给西门子 | |||||
/// </summary> | |||||
public static string PickAGVIsApply4 { get; set; } = ""; | |||||
/// <summary> | |||||
/// Agv送货 取货架完成 从西门子读取 | |||||
/// </summary> | |||||
public static string PickCargoAGVFinish4 { get; set; } = ""; | |||||
/// <summary> | |||||
/// Agv送货 取料完成 写给西门子 | |||||
/// </summary> | |||||
public static string PickAGVFinish4 { get; set; } = ""; | |||||
/// <summary> | |||||
/// 工位上是否有小车 | |||||
/// </summary> | |||||
public static string StationIsExistCar4 { get; set; } = ""; | |||||
#endregion | |||||
#region AGV小车进出工站5 | |||||
/// <summary> | |||||
/// Agv送货 进站申请 从西门子读取 | |||||
/// </summary> | |||||
public static string DeliveryAGVApply5 { get; set; } = ""; | |||||
/// <summary> | |||||
/// Agv送货 进站申请 写给西门子 | |||||
/// </summary> | |||||
public static string DeliveryAGVIsApply5 { get; set; } = ""; | |||||
/// <summary> | |||||
/// Agv送货 进站顶升申请 从西门子读取 | |||||
/// </summary> | |||||
public static string DeliveryAGVApplyJack5 { get; set; } = ""; | |||||
/// <summary> | |||||
/// Agv送货 进站顶升申请 写给西门子 | |||||
/// </summary> | |||||
public static string DeliveryAGVIsApplyJack5 { get; set; } = ""; | |||||
/// <summary> | |||||
/// Agv送货 送货完成 从西门子读取 | |||||
/// </summary> | |||||
public static string DeliveryAGVFinsih5 { get; set; } = ""; | |||||
/// <summary> | |||||
/// Agv送货 工位上有货架 写给西门子 | |||||
/// </summary> | |||||
public static string StationHaveCargo5 { get; set; } = ""; | |||||
/// <summary> | |||||
/// Agv送货 进站申请 从西门子读取 | |||||
/// </summary> | |||||
public static string PickAGVApply5 { get; set; } = ""; | |||||
/// <summary> | |||||
/// Agv送货 进站申请 写给西门子 | |||||
/// </summary> | |||||
public static string PickAGVIsApply5 { get; set; } = ""; | |||||
/// <summary> | |||||
/// Agv送货 取货架完成 从西门子读取 | |||||
/// </summary> | |||||
public static string PickCargoAGVFinish5 { get; set; } = ""; | |||||
/// <summary> | |||||
/// Agv送货 取料完成 写给西门子 | |||||
/// </summary> | |||||
public static string PickAGVFinish5 { get; set; } = ""; | |||||
/// <summary> | |||||
/// 工位上是否有小车 | |||||
/// </summary> | |||||
public static string StationIsExistCar5 { get; set; } = ""; | |||||
#endregion | |||||
#region AGV小车进出工站6 | |||||
/// <summary> | |||||
/// Agv送货 进站申请 从西门子读取 | |||||
/// </summary> | |||||
public static string DeliveryAGVApply6 { get; set; } = ""; | |||||
/// <summary> | |||||
/// Agv送货 进站申请 写给西门子 | |||||
/// </summary> | |||||
public static string DeliveryAGVIsApply6 { get; set; } = ""; | |||||
/// <summary> | |||||
/// Agv送货 进站顶升申请 从西门子读取 | |||||
/// </summary> | |||||
public static string DeliveryAGVApplyJack6 { get; set; } = ""; | |||||
/// <summary> | |||||
/// Agv送货 进站顶升申请 写给西门子 | |||||
/// </summary> | |||||
public static string DeliveryAGVIsApplyJack6 { get; set; } = ""; | |||||
/// <summary> | |||||
/// Agv送货 送货完成 从西门子读取 | |||||
/// </summary> | |||||
public static string DeliveryAGVFinsih6 { get; set; } = ""; | |||||
/// <summary> | |||||
/// Agv送货 工位上有货架 写给西门子 | |||||
/// </summary> | |||||
public static string StationHaveCargo6 { get; set; } = ""; | |||||
/// <summary> | |||||
/// Agv送货 进站申请 从西门子读取 | |||||
/// </summary> | |||||
public static string PickAGVApply6 { get; set; } = ""; | |||||
/// <summary> | |||||
/// Agv送货 进站申请 写给西门子 | |||||
/// </summary> | |||||
public static string PickAGVIsApply6 { get; set; } = ""; | |||||
/// <summary> | |||||
/// Agv送货 取货架完成 从西门子读取 | |||||
/// </summary> | |||||
public static string PickCargoAGVFinish6 { get; set; } = ""; | |||||
/// <summary> | |||||
/// Agv送货 取料完成 写给西门子 | |||||
/// </summary> | |||||
public static string PickAGVFinish6 { get; set; } = ""; | |||||
/// <summary> | |||||
/// 工位上是否有小车 | |||||
/// </summary> | |||||
public static string StationIsExistCar6 { get; set; } = ""; | |||||
#endregion*/ | |||||
#region AGV进出站 | |||||
/// <summary> | |||||
/// Agv送货 进站申请 | |||||
/// </summary> | |||||
public static string DeliveryAGVApply { get; set; } = "M4002"; | |||||
/// <summary> | |||||
/// Agv送货 进站申请 | |||||
/// </summary> | |||||
public static string DeliveryAGVIsApply { get; set; } = "M5002"; | |||||
/// <summary> | |||||
/// Agv送货 进站顶升申请 | |||||
/// </summary> | |||||
public static string DeliveryAGVApplyJack { get; set; } = "M4004"; | |||||
/// <summary> | |||||
/// Agv送货 进站顶升申请 | |||||
/// </summary> | |||||
public static string DeliveryAGVIsApplyJack { get; set; } = "M5004"; | |||||
/// <summary> | |||||
/// Agv送货 送货完成 | |||||
/// </summary> | |||||
public static string DeliveryAGVFinsih { get; set; } = "M4005"; | |||||
/// <summary> | |||||
/// Agv送货 工位上有货架 | |||||
/// </summary> | |||||
public static string StationHaveCargo { get; set; } = "M5005"; | |||||
/// <summary> | |||||
/// Agv送货 进站申请 | |||||
/// </summary> | |||||
public static string PickAGVApply { get; set; } = "M4003"; | |||||
/// <summary> | |||||
/// Agv送货 进站申请 | |||||
/// </summary> | |||||
public static string PickAGVIsApply { get; set; } = "M5003"; | |||||
/// <summary> | |||||
/// Agv送货 取货架完成 | |||||
/// </summary> | |||||
public static string PickCargoAGVFinish { get; set; } = "M4006"; | |||||
/// <summary> | |||||
/// Agv送货 取料完成 | |||||
/// </summary> | |||||
public static string PickAGVFinish { get; set; } = "M5006"; | |||||
/// <summary> | |||||
/// 工位上是否有小车 | |||||
/// </summary> | |||||
public static string StationIsExistCar { get; set; } = "M4007"; | |||||
#endregion | |||||
} | |||||
public class RecipeRawMaterial | |||||
{ | |||||
/// <summary> | |||||
/// 原料对应的桶号 | |||||
/// </summary> | |||||
public int[] RawMaterialBarrelNum = new int[15]; | |||||
/// <summary> | |||||
/// 需要原料重量 | |||||
/// </summary> | |||||
public double[] RawMaterialWeight = new double[15]; | |||||
/// <summary> | |||||
/// 原料对应料仓的位置 | |||||
/// </summary> | |||||
public int[] RawMaterialLocation = new int[15]; | |||||
} | } | ||||
} | } |
@@ -15,9 +15,10 @@ namespace BPASmartClient.JXJFoodBigStation.Model.Siemens | |||||
public SiemensHelper Siemens_PLC_S7 = new SiemensHelper(); | public SiemensHelper Siemens_PLC_S7 = new SiemensHelper(); | ||||
public bool IsConnected => Siemens_PLC_S7.IsConnected; | public bool IsConnected => Siemens_PLC_S7.IsConnected; | ||||
bool a = false; | |||||
public void Init() | public void Init() | ||||
{ | { | ||||
if (IsConnected) | |||||
if (IsConnected) | |||||
{ | { | ||||
ThreadManage.GetInstance().StartLong(new Action(() => | ThreadManage.GetInstance().StartLong(new Action(() => | ||||
{ | { | ||||
@@ -25,6 +26,36 @@ namespace BPASmartClient.JXJFoodBigStation.Model.Siemens | |||||
var res1 = this.Siemens_PLC_S7.ReadClass<DL_Status_DB>(2331); | var res1 = this.Siemens_PLC_S7.ReadClass<DL_Status_DB>(2331); | ||||
var res2 = this.Siemens_PLC_S7.ReadClass<DL_Finish_DB>(2361); | var res2 = this.Siemens_PLC_S7.ReadClass<DL_Finish_DB>(2361); | ||||
var res3 = this.Siemens_PLC_S7.ReadClass<DL_DataColl_DB>(2391); | var res3 = this.Siemens_PLC_S7.ReadClass<DL_DataColl_DB>(2391); | ||||
if (res != null && res is DL_Start_DB start) | |||||
{ | |||||
if (a) | |||||
{ | |||||
start.RecipeName = "配方1"; | |||||
start.RecipeCode = "1201"; | |||||
start.Order_Request_Ack = true; | |||||
for (int i = 0; i < GVL_BigStation.StockBinNum ; i++) | |||||
{ | |||||
start.Material[i] = new UDT(); | |||||
start.Material[i].Material_Name = "" + (i +1); | |||||
start.Material[i].Material_Weight = 100 + (i + 1); | |||||
start.Material[i].Material_BarrelNum = (short)(i + 1); | |||||
} | |||||
} | |||||
if (RTrig.GetInstance("Order_Request").Start(GVL_BigStation.Order_Request)) | |||||
{ | |||||
start.Order_Request = true; | |||||
Siemens_PLC_S7.WriteClass<DL_Start_DB>(start, 2301); | |||||
} | |||||
if (RTrig.GetInstance("Order_Request_Ack").Start(start.Order_Request_Ack)) | |||||
{ | |||||
ActionManage.GetInstance.Send("SiemensSendRecipe", start); | |||||
} | |||||
} | |||||
if (res1 != null && res1 is DL_Status_DB status) | |||||
{ | |||||
} | |||||
if (res2 != null && res2.Ask_For_Finish_PLC) | if (res2 != null && res2.Ask_For_Finish_PLC) | ||||
{ | { | ||||
ActionManage.GetInstance.Send("配料完成信号确认完成"); | ActionManage.GetInstance.Send("配料完成信号确认完成"); | ||||
@@ -17,96 +17,26 @@ namespace BPASmartClient.JXJFoodBigStation.Model | |||||
public ObservableCollection<RawMaterial> RawMaterials { get; set; } = new ObservableCollection<RawMaterial>(); | public ObservableCollection<RawMaterial> RawMaterials { get; set; } = new ObservableCollection<RawMaterial>(); | ||||
public TestData() | public TestData() | ||||
{ | { | ||||
string recipeName = "配方1"; | |||||
string recipeCode = "10001"; | |||||
int Traycode = 1; | |||||
float RawmaterialWeight = 10; | |||||
short RawMaterialbarrelNum = 1; | |||||
int RawMaterialLocation = 5; | |||||
float RawmaterialWeight1 = 20; | |||||
short RawMaterialbarrelNum1 = 2; | |||||
int RawMaterialLocation1 = 7; | |||||
float RawmaterialWeight2 = 30; | |||||
short RawMaterialbarrelNum2 = 3; | |||||
int RawMaterialLocation2 = 9; | |||||
RawMaterials.Add(new RawMaterial() | |||||
{ | |||||
DeviceIp = RawMaterials.Count + 1, | |||||
RawMaterialWeight = RawmaterialWeight, | |||||
RawMaterialBarrelNum = RawMaterialbarrelNum, | |||||
RawMaterialLocation = RawMaterialLocation | |||||
}); | |||||
RawMaterials.Add(new RawMaterial() | |||||
{ | |||||
DeviceIp = RawMaterials.Count + 1, | |||||
RawMaterialWeight = RawmaterialWeight1, | |||||
RawMaterialBarrelNum = RawMaterialbarrelNum1, | |||||
RawMaterialLocation = RawMaterialLocation1 | |||||
}); | |||||
RawMaterials.Add(new RawMaterial() | |||||
{ | |||||
DeviceIp = RawMaterials.Count + 1, | |||||
RawMaterialWeight = RawmaterialWeight2, | |||||
RawMaterialBarrelNum = RawMaterialbarrelNum2, | |||||
RawMaterialLocation = RawMaterialLocation2 | |||||
}); | |||||
Recipes.Add(new Model.RecipeData() | |||||
{ | |||||
RecipeName = recipeName, | |||||
RecipeCode = recipeCode, | |||||
TrayCode = Traycode, | |||||
RawMaterial = RawMaterials | |||||
}); | |||||
RawMaterials.Clear(); | |||||
string recipeName_2 = "配方2"; | |||||
string recipeCode_2 = "20001"; | |||||
int Traycode_2 = 3; | |||||
float RawmaterialWeight_2 = 10; | |||||
short RawMaterialbarrelNum_2 = 1; | |||||
int RawMaterialLocation_2 = 5; | |||||
float RawmaterialWeight1_2 = 20; | |||||
short RawMaterialbarrelNum1_2 = 2; | |||||
int RawMaterialLocation1_2 = 7; | |||||
float RawmaterialWeight2_2 = 30; | |||||
short RawMaterialbarrelNum2_2 = 3; | |||||
int RawMaterialLocation2_2 = 9; | |||||
RawMaterials.Add(new RawMaterial() | |||||
{ | |||||
DeviceIp = RawMaterials.Count + 1, | |||||
RawMaterialWeight = RawmaterialWeight_2, | |||||
RawMaterialBarrelNum = RawMaterialbarrelNum_2, | |||||
RawMaterialLocation = RawMaterialLocation_2 | |||||
}); | |||||
RawMaterials.Add(new RawMaterial() | |||||
{ | |||||
DeviceIp = RawMaterials.Count + 1, | |||||
RawMaterialWeight = RawmaterialWeight1_2, | |||||
RawMaterialBarrelNum = RawMaterialbarrelNum1_2, | |||||
RawMaterialLocation = RawMaterialLocation1_2 | |||||
}); | |||||
RawMaterials.Add(new RawMaterial() | |||||
{ | |||||
DeviceIp = RawMaterials.Count + 1, | |||||
RawMaterialWeight = RawmaterialWeight2_2, | |||||
RawMaterialBarrelNum = RawMaterialbarrelNum2_2, | |||||
RawMaterialLocation = RawMaterialLocation2_2 | |||||
}); | |||||
Recipes.Add(new Model.RecipeData() | |||||
{ | |||||
RecipeName = recipeName_2, | |||||
RecipeCode = recipeCode_2, | |||||
TrayCode = Traycode_2, | |||||
RawMaterial = RawMaterials | |||||
}); | |||||
for (int i = 0; i < 5; i++) | |||||
{ | |||||
for (int j = 0; j < 10; i++) | |||||
{ | |||||
RawMaterials.Add(new RawMaterial() | |||||
{ | |||||
DeviceIp = RawMaterials.Count + 1, | |||||
RawMaterialWeight = new Random().Next(), | |||||
RawMaterialBarrelNum = j, | |||||
RawMaterialLocation = j | |||||
}); | |||||
} | |||||
Recipes.Add(new Model.RecipeData() | |||||
{ | |||||
RecipeName = "配方" + i, | |||||
RecipeCode = new Random().Next(1000,9999) + "", | |||||
TrayCode = new Random().Next(1,3), | |||||
RawMaterial = RawMaterials | |||||
}); | |||||
} | |||||
} | } | ||||
} | } | ||||
} | } |
@@ -423,9 +423,7 @@ | |||||
</Grid.ColumnDefinitions> | </Grid.ColumnDefinitions> | ||||
<Grid Name="ggr" Margin="10"> | <Grid Name="ggr" Margin="10"> | ||||
<pry:ImageBorder Width="{Binding ElementName=ggr, Path=ActualWidth}" Height="{Binding ElementName=ggr, Path=ActualHeight}" /> | <pry:ImageBorder Width="{Binding ElementName=ggr, Path=ActualWidth}" Height="{Binding ElementName=ggr, Path=ActualHeight}" /> | ||||
<ListBox | <ListBox | ||||
Margin="5" | Margin="5" | ||||
VerticalAlignment="Top" | VerticalAlignment="Top" | ||||
@@ -444,7 +442,6 @@ | |||||
<ListBox.ItemTemplate> | <ListBox.ItemTemplate> | ||||
<DataTemplate> | <DataTemplate> | ||||
<Grid | <Grid | ||||
Name="tt" | Name="tt" | ||||
Height="220" | Height="220" | ||||
@@ -456,7 +453,6 @@ | |||||
<RowDefinition Height="2" /> | <RowDefinition Height="2" /> | ||||
<RowDefinition Height="40" /> | <RowDefinition Height="40" /> | ||||
</Grid.RowDefinitions> | </Grid.RowDefinitions> | ||||
<Image | <Image | ||||
Grid.RowSpan="5" | Grid.RowSpan="5" | ||||
Source="/BPASmartClient.CustomResource;component/Image/配方背景/竖背景框.png" | Source="/BPASmartClient.CustomResource;component/Image/配方背景/竖背景框.png" | ||||
@@ -785,10 +781,7 @@ | |||||
Content="已完成" | Content="已完成" | ||||
GroupName="state" | GroupName="state" | ||||
Style="{DynamicResource RadioState}" /> | Style="{DynamicResource RadioState}" /> | ||||
</Grid> | </Grid> | ||||
<ScrollViewer | <ScrollViewer | ||||
Grid.Row="1" | Grid.Row="1" | ||||
HorizontalScrollBarVisibility="Hidden" | HorizontalScrollBarVisibility="Hidden" | ||||
@@ -873,6 +866,5 @@ | |||||
</Border> | </Border> | ||||
</ScrollViewer> | </ScrollViewer> | ||||
</Grid> | </Grid> | ||||
</Grid> | </Grid> | ||||
</UserControl> | </UserControl> |
@@ -22,7 +22,7 @@ | |||||
<SolidColorBrush | <SolidColorBrush | ||||
x:Key="{x:Static SystemColors.HighlightBrushKey}" | x:Key="{x:Static SystemColors.HighlightBrushKey}" | ||||
Opacity=".4" | Opacity=".4" | ||||
Color="White" /> | |||||
Color="White" /> | |||||
<!-- SelectedItem without focus --> | <!-- SelectedItem without focus --> | ||||
<SolidColorBrush | <SolidColorBrush | ||||
x:Key="{x:Static SystemColors.ControlBrushKey}" | x:Key="{x:Static SystemColors.ControlBrushKey}" | ||||
@@ -337,18 +337,6 @@ | |||||
</Grid> | </Grid> | ||||
<ControlTemplate.Triggers> | <ControlTemplate.Triggers> | ||||
<!--<Trigger Property="IsPressed" Value="true"> | |||||
<Setter Property="Background" Value="#FFd2e7f4" /> | |||||
</Trigger> | |||||
<Trigger Property="IsChecked" Value="true"> | |||||
<Setter TargetName="border2" Property="Background" Value="#191E36" /> | |||||
</Trigger> | |||||
<Trigger Property="IsChecked" Value="false"> | |||||
<Setter TargetName="border2" Property="Background" Value="#191E36" /> | |||||
</Trigger>--> | |||||
<!--<Trigger Property="IsEnabled" Value="false"> | |||||
<Setter Property="Foreground" Value="White" /> | |||||
</Trigger>--> | |||||
<Trigger Property="IsMouseOver" Value="True"> | <Trigger Property="IsMouseOver" Value="True"> | ||||
<Setter TargetName="border2" Property="Background" Value="#191E36" /> | <Setter TargetName="border2" Property="Background" Value="#191E36" /> | ||||
</Trigger> | </Trigger> | ||||
@@ -419,7 +407,7 @@ | |||||
<Grid.ColumnDefinitions> | <Grid.ColumnDefinitions> | ||||
<ColumnDefinition /> | <ColumnDefinition /> | ||||
<ColumnDefinition Width="0.25*" /> | |||||
<!--<ColumnDefinition Width="0.25*" />--> | |||||
</Grid.ColumnDefinitions> | </Grid.ColumnDefinitions> | ||||
<Grid Name="ggr" Margin="10"> | <Grid Name="ggr" Margin="10"> | ||||
@@ -444,40 +432,97 @@ | |||||
<ListBox.ItemTemplate> | <ListBox.ItemTemplate> | ||||
<DataTemplate> | <DataTemplate> | ||||
<Grid | <Grid | ||||
Name="tt" | Name="tt" | ||||
Height="220" | |||||
Height="300" | |||||
Margin="5"> | Margin="5"> | ||||
<Grid.RowDefinitions> | <Grid.RowDefinitions> | ||||
<RowDefinition Height="30" /> | |||||
<RowDefinition Height="80" /> | |||||
<RowDefinition Height="20" /> | <RowDefinition Height="20" /> | ||||
<RowDefinition Height="128" /> | |||||
<RowDefinition Height="198" /> | |||||
<RowDefinition Height="2" /> | <RowDefinition Height="2" /> | ||||
<RowDefinition Height="40" /> | |||||
</Grid.RowDefinitions> | </Grid.RowDefinitions> | ||||
<Image | <Image | ||||
Grid.RowSpan="5" | Grid.RowSpan="5" | ||||
Source="/BPASmartClient.CustomResource;component/Image/配方背景/竖背景框.png" | Source="/BPASmartClient.CustomResource;component/Image/配方背景/竖背景框.png" | ||||
Stretch="Fill" /> | Stretch="Fill" /> | ||||
<TextBlock | |||||
Grid.Row="0" | |||||
Margin="2,5,0,0" | |||||
HorizontalAlignment="Center" | |||||
VerticalAlignment="Top" | |||||
FontSize="18" | |||||
Foreground="#FF2AB2E7" | |||||
Text="{Binding RecipeName}" /> | |||||
<Grid Grid.Row="0"> | |||||
<Grid.RowDefinitions> | |||||
<RowDefinition></RowDefinition> | |||||
<RowDefinition></RowDefinition> | |||||
<RowDefinition></RowDefinition> | |||||
</Grid.RowDefinitions> | |||||
<Grid.ColumnDefinitions> | |||||
<ColumnDefinition></ColumnDefinition> | |||||
<ColumnDefinition></ColumnDefinition> | |||||
</Grid.ColumnDefinitions> | |||||
<TextBlock | |||||
Grid.Row="0" | |||||
Grid.Column="0" | |||||
Margin="7,5,0,0" | |||||
HorizontalAlignment="left" | |||||
VerticalAlignment="Center" | |||||
FontSize="16" | |||||
Foreground="#FF2AB2E7" | |||||
Text="配方名称:"></TextBlock> | |||||
<TextBlock | |||||
Grid.Row="0" | |||||
Grid.Column="1" | |||||
Margin="7,5,0,0" | |||||
HorizontalAlignment="left" | |||||
VerticalAlignment="Center" | |||||
FontSize="16" | |||||
Foreground="#FF2AB2E7" | |||||
Text="{Binding RecipeName}" /> | |||||
<TextBlock | |||||
Grid.Row="1" | |||||
Grid.Column="0" | |||||
Margin="7,5,0,0" | |||||
HorizontalAlignment="left" | |||||
VerticalAlignment="Center" | |||||
FontSize="16" | |||||
Foreground="#FF2AB2E7" | |||||
Text="配方编号:"></TextBlock> | |||||
<TextBlock | |||||
Grid.Row="1" | |||||
Grid.Column="1" | |||||
Margin="7,5,0,0" | |||||
HorizontalAlignment="left" | |||||
VerticalAlignment="Center" | |||||
FontSize="16" | |||||
Foreground="#FF2AB2E7" | |||||
Text="{Binding RecipeCode}" /> | |||||
<TextBlock | |||||
Grid.Row="2" | |||||
Grid.Column="0" | |||||
Margin="7,5,0,0" | |||||
HorizontalAlignment="left" | |||||
VerticalAlignment="Center" | |||||
FontSize="16" | |||||
Foreground="#FF2AB2E7" | |||||
Text="托盘编号:"></TextBlock> | |||||
<TextBlock | |||||
Grid.Row="2" | |||||
Grid.Column="1" | |||||
Margin="7,5,0,0" | |||||
HorizontalAlignment="left" | |||||
VerticalAlignment="Center" | |||||
FontSize="16" | |||||
Foreground="#FF2AB2E7" | |||||
Text="{Binding TrayCode}" /> | |||||
</Grid> | |||||
<TextBlock | <TextBlock | ||||
Grid.Row="1" | Grid.Row="1" | ||||
FontSize="16" | FontSize="16" | ||||
Margin="5,0,0,0" | |||||
Margin="7,2,0,0" | |||||
VerticalAlignment="Top" | VerticalAlignment="Top" | ||||
Foreground="#FF2AB2E7" | Foreground="#FF2AB2E7" | ||||
Text="配方信息:" /> | |||||
Text="原料信息:" /> | |||||
<ScrollViewer | <ScrollViewer | ||||
Grid.Row="2" | Grid.Row="2" | ||||
@@ -510,7 +555,7 @@ | |||||
<Expander.Content> | <Expander.Content> | ||||
<StackPanel Margin="36,0,0,0"> | <StackPanel Margin="36,0,0,0"> | ||||
<StackPanel Orientation="Horizontal"> | <StackPanel Orientation="Horizontal"> | ||||
<TextBlock Text="托盘编号:" Foreground="#FF2AB2E7"/> | |||||
<TextBlock Text="原料桶号:" Foreground="#FF2AB2E7"/> | |||||
<TextBlock Text="{Binding RawMaterialBarrelNum}" Foreground="#FF2AB2E7"/> | <TextBlock Text="{Binding RawMaterialBarrelNum}" Foreground="#FF2AB2E7"/> | ||||
</StackPanel> | </StackPanel> | ||||
<StackPanel Orientation="Horizontal"> | <StackPanel Orientation="Horizontal"> | ||||
@@ -518,17 +563,12 @@ | |||||
<TextBlock Text="{Binding RawMaterialWeight}" Foreground="#FF2AB2E7"/> | <TextBlock Text="{Binding RawMaterialWeight}" Foreground="#FF2AB2E7"/> | ||||
</StackPanel> | </StackPanel> | ||||
</StackPanel> | </StackPanel> | ||||
</Expander.Content> | </Expander.Content> | ||||
</Expander> | </Expander> | ||||
</DataTemplate> | </DataTemplate> | ||||
</ItemsControl.ItemTemplate> | </ItemsControl.ItemTemplate> | ||||
</ItemsControl> | </ItemsControl> | ||||
</ScrollViewer> | </ScrollViewer> | ||||
<Image | <Image | ||||
Grid.Row="3" | Grid.Row="3" | ||||
Width="{Binding ElementName=tt, Path=ActualWidth}" | Width="{Binding ElementName=tt, Path=ActualWidth}" | ||||
@@ -536,343 +576,10 @@ | |||||
VerticalAlignment="Bottom" | VerticalAlignment="Bottom" | ||||
Source="/BPASmartClient.CustomResource;component/Image/直线.png" | Source="/BPASmartClient.CustomResource;component/Image/直线.png" | ||||
Stretch="Fill" /> | Stretch="Fill" /> | ||||
<Grid | |||||
Name="gr" | |||||
Grid.Row="4" | |||||
Height="30" | |||||
Margin="0,0,0,10" | |||||
VerticalAlignment="Bottom" | |||||
Background="Transparent"> | |||||
<!--<Grid.ColumnDefinitions> | |||||
<ColumnDefinition /> | |||||
<ColumnDefinition /> | |||||
</Grid.ColumnDefinitions>--> | |||||
<!--<Image | |||||
Height="2" | |||||
Grid.ColumnSpan="2" | |||||
Width="{Binding ElementName=gr, Path=ActualWidth}" | |||||
VerticalAlignment="Top" | |||||
Source="/BPASmartClient.CustomResource;component/Image/直线.png" />--> | |||||
<!--<pry:IcoButton | |||||
Width="{Binding ElementName=gr, Path=ActualWidth}" | |||||
Height="{Binding ElementName=gr, Path=ActualHeight}" | |||||
Margin="4,4,4,0" | |||||
HorizontalAlignment="Center" | |||||
VerticalAlignment="Center" | |||||
Background="#222bd06f" | |||||
BorderThickness="0" | |||||
Command="{Binding DataContext.StartCommand, RelativeSource={RelativeSource AncestorType=ListBox, Mode=FindAncestor}}" | |||||
CommandParameter="{Binding RecipeName}" | |||||
Content="配方下发" | |||||
EnterBackground="#332bd06f" | |||||
FontStyle="Normal" | |||||
Foreground="#ff2bd06f" | |||||
IcoText="" | |||||
IsEnabled="{Binding IsEnable}" | |||||
Style="{StaticResource IcoButtonStyle}" />--> | |||||
<!--<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 RecipCode}" | |||||
Content="删除" | |||||
EnterBackground="#22F53F62" | |||||
FontStyle="Normal" | |||||
Foreground="#FFF53F62" | |||||
IcoText="" | |||||
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 RecipCode}" | |||||
Content="编辑" | |||||
EnterBackground="#222AB2E7" | |||||
Foreground="#FF2AB2E7" | |||||
IcoText="" | |||||
Style="{StaticResource IcoButtonStyle}" />--> | |||||
</Grid> | |||||
<!--</StackPanel>--> | |||||
</Grid> | </Grid> | ||||
<!--<Grid Name="tt" Margin="5"> | |||||
<Grid.RowDefinitions> | |||||
<RowDefinition Height="auto" /> | |||||
<RowDefinition Height="auto" /> | |||||
<RowDefinition /> | |||||
<RowDefinition /> | |||||
</Grid.RowDefinitions> | |||||
<Image | |||||
Grid.RowSpan="4" | |||||
Source="/BPASmartClient.CustomResource;component/Image/配方背景/竖背景框.png" | |||||
Stretch="Fill" /> | |||||
<TextBlock | |||||
Grid.Row="0" | |||||
Margin="2,5,0,0" | |||||
HorizontalAlignment="Center" | |||||
VerticalAlignment="Top" | |||||
FontSize="18" | |||||
Foreground="#FF2AB2E7" | |||||
Text="{Binding RecipeName}" /> | |||||
<TextBlock | |||||
Grid.Row="1" | |||||
Margin="5,0,0,5" | |||||
Foreground="#ffc000" | |||||
Text="配方信息:" /> | |||||
<ScrollViewer | |||||
Grid.Row="2" | |||||
HorizontalScrollBarVisibility="Hidden" | |||||
VerticalScrollBarVisibility="Hidden"> | |||||
<Grid> | |||||
<Grid.ColumnDefinitions> | |||||
<ColumnDefinition Width="auto" /> | |||||
<ColumnDefinition /> | |||||
</Grid.ColumnDefinitions> | |||||
<ItemsControl ItemsSource="{Binding RawMaterials}"> | |||||
<ItemsControl.ItemTemplate> | |||||
<DataTemplate> | |||||
<Grid> | |||||
<TextBlock | |||||
Grid.Row="1" | |||||
Margin="5,0,0,0" | |||||
HorizontalAlignment="Right" | |||||
VerticalAlignment="Center" | |||||
Foreground="#aaffc000" | |||||
Text="{Binding RawMaterialName}" /> | |||||
</Grid> | |||||
</DataTemplate> | |||||
</ItemsControl.ItemTemplate> | |||||
</ItemsControl> | |||||
<ItemsControl Grid.Column="1" ItemsSource="{Binding RawMaterials}"> | |||||
<ItemsControl.ItemTemplate> | |||||
<DataTemplate> | |||||
<StackPanel Orientation="Horizontal"> | |||||
<TextBlock | |||||
Margin="5,0,0,0" | |||||
HorizontalAlignment="Center" | |||||
VerticalAlignment="Center" | |||||
Foreground="#aaffc000" | |||||
Text=":" /> | |||||
<TextBlock | |||||
Margin="5,0,0,0" | |||||
HorizontalAlignment="Center" | |||||
VerticalAlignment="Center" | |||||
Foreground="#aaffc000" | |||||
Text="{Binding RawMaterialWeight}" /> | |||||
<TextBlock | |||||
Margin="5,0,0,0" | |||||
HorizontalAlignment="Center" | |||||
VerticalAlignment="Center" | |||||
Foreground="#aaffc000" | |||||
Text="g" /> | |||||
</StackPanel> | |||||
</DataTemplate> | |||||
</ItemsControl.ItemTemplate> | |||||
</ItemsControl> | |||||
</Grid> | |||||
</ScrollViewer> | |||||
<Grid | |||||
Name="grb" | |||||
Grid.Row="3" | |||||
Height="30" | |||||
Margin="0,0,0,10" | |||||
VerticalAlignment="Bottom" | |||||
Background="Transparent"> | |||||
<Image | |||||
Width="{Binding ElementName=grb, Path=ActualWidth}" | |||||
VerticalAlignment="Top" | |||||
StretchDirection="Both" | |||||
Source="/BPASmartClient.CustomResource;component/Image/直线.png" /> | |||||
<pry:IcoButton | |||||
Width="{Binding ElementName=grb, Path=ActualWidth}" | |||||
Height="{Binding ElementName=grb, Path=ActualHeight}" | |||||
Margin="4,4,4,0" | |||||
HorizontalAlignment="Center" | |||||
VerticalAlignment="Center" | |||||
Background="#222bd06f" | |||||
BorderThickness="0" | |||||
Command="{Binding DataContext.StartCommand, RelativeSource={RelativeSource AncestorType=ListBox, Mode=FindAncestor}}" | |||||
CommandParameter="{Binding RecipeName}" | |||||
Content="配方下发" | |||||
EnterBackground="#332bd06f" | |||||
FontStyle="Normal" | |||||
Foreground="#ff2bd06f" | |||||
IcoText="" | |||||
IsEnabled="{Binding IsEnable}" | |||||
Style="{StaticResource IcoButtonStyle}" /> | |||||
</Grid> | |||||
</Grid>--> | |||||
</DataTemplate> | </DataTemplate> | ||||
</ListBox.ItemTemplate> | </ListBox.ItemTemplate> | ||||
</ListBox> | </ListBox> | ||||
</Grid> | |||||
<Grid | |||||
Name="gr" | |||||
Grid.Column="1" | |||||
Margin="10"> | |||||
<Grid.RowDefinitions> | |||||
<RowDefinition Height="50" /> | |||||
<RowDefinition /> | |||||
</Grid.RowDefinitions> | |||||
<pry:ImageBorder | |||||
Grid.RowSpan="2" | |||||
Width="{Binding ElementName=gr, Path=ActualWidth}" | |||||
Height="{Binding ElementName=gr, Path=ActualHeight}" /> | |||||
<Grid Margin="5"> | |||||
<Grid.ColumnDefinitions> | |||||
<ColumnDefinition /> | |||||
<ColumnDefinition /> | |||||
<ColumnDefinition /> | |||||
</Grid.ColumnDefinitions> | |||||
<RadioButton | |||||
Click="RadioButtonWait_Click" | |||||
Command="{Binding ChangeRecipeStateCommand}" | |||||
Content="等待中" | |||||
GroupName="state" | |||||
IsChecked="True" | |||||
Style="{DynamicResource RadioState}" /> | |||||
<RadioButton | |||||
Grid.Column="1" | |||||
Click="RadioButtonMaking_Click" | |||||
Content="执行中" | |||||
GroupName="state" | |||||
Style="{DynamicResource RadioState}" /> | |||||
<RadioButton | |||||
Grid.Column="2" | |||||
Click="RadioButtonCompelete_Click" | |||||
Content="已完成" | |||||
GroupName="state" | |||||
Style="{DynamicResource RadioState}" /> | |||||
</Grid> | |||||
<ScrollViewer | |||||
Grid.Row="1" | |||||
HorizontalScrollBarVisibility="Hidden" | |||||
VerticalScrollBarVisibility="Hidden"> | |||||
<Border> | |||||
<Grid Grid.Row="1"> | |||||
<Grid x:Name="repiceListMaking" Margin="5"> | |||||
<Grid.RowDefinitions> | |||||
<RowDefinition Height="30" /> | |||||
<RowDefinition /> | |||||
</Grid.RowDefinitions> | |||||
<TextBlock | |||||
Margin="10,0" | |||||
HorizontalAlignment="Left" | |||||
VerticalAlignment="Center" | |||||
FontSize="18" | |||||
Foreground="#FF2AB2E7" | |||||
Text="{Binding CurrentRecipeName}" /> | |||||
<ItemsControl | |||||
Grid.Row="1" | |||||
Margin="50,0" | |||||
ItemsSource="{Binding recipeProcesses}"> | |||||
<ItemsControl.ItemTemplate> | |||||
<DataTemplate> | |||||
<Grid Margin="5"> | |||||
<Grid.ColumnDefinitions> | |||||
<ColumnDefinition /> | |||||
<ColumnDefinition Width="16" /> | |||||
<ColumnDefinition /> | |||||
</Grid.ColumnDefinitions> | |||||
<TextBlock | |||||
Margin="10,0,5,0" | |||||
HorizontalAlignment="Left" | |||||
VerticalAlignment="Center" | |||||
FontSize="15" | |||||
Foreground="#AA2AB2E7" | |||||
Text="{Binding RawMaterialName}" | |||||
ToolTip="{Binding RawMaterialSource, Converter={StaticResource IntToSourceConvert}}" /> | |||||
<TextBlock | |||||
Grid.Column="1" | |||||
Margin="0,0,5,0" | |||||
HorizontalAlignment="Left" | |||||
VerticalAlignment="Center" | |||||
FontSize="15" | |||||
Foreground="#AA2AB2E7" | |||||
Text=":" /> | |||||
<Button | |||||
Grid.Column="2" | |||||
HorizontalAlignment="Center" | |||||
VerticalAlignment="Center" | |||||
Command="{Binding DataContext.ChangeRecipeStateCommand, RelativeSource={RelativeSource AncestorType=ItemsControl, Mode=FindAncestor}}" | |||||
CommandParameter="{Binding RawMaterialId}" | |||||
Content="{Binding RecipeStatus, Converter={StaticResource RunStatusConvert}}" | |||||
IsEnabled="{Binding RawMaterialSource, Converter={StaticResource EnbleConvert}}" | |||||
Style="{StaticResource materialMakingButton}" /> | |||||
</Grid> | |||||
</DataTemplate> | |||||
</ItemsControl.ItemTemplate> | |||||
</ItemsControl> | |||||
</Grid> | |||||
<!--<TreeView x:Name="repiceListMaking" ItemsSource="{Binding RecipeProcesse}" | |||||
ScrollViewer.VerticalScrollBarVisibility="Disabled" HorizontalAlignment="Stretch" Background="Wheat" ItemContainerStyle="{StaticResource recipeTreeItem}"> | |||||
</TreeView>--> | |||||
<!-- 等待和已完成 --> | |||||
<TreeView | |||||
x:Name="repiceList" | |||||
HorizontalAlignment="Stretch" | |||||
Background="Transparent" | |||||
BorderThickness="0" | |||||
ItemContainerStyle="{StaticResource recipeTreeItem}" | |||||
ItemsSource="{Binding UserTreeWait}" | |||||
ScrollViewer.VerticalScrollBarVisibility="Visible" /> | |||||
</Grid> | |||||
</Border> | |||||
</ScrollViewer> | |||||
</Grid> | </Grid> | ||||
</Grid> | </Grid> | ||||
</UserControl> | </UserControl> |
@@ -25,30 +25,5 @@ namespace BPASmartClient.JXJFoodBigStation.View | |||||
{ | { | ||||
InitializeComponent(); | InitializeComponent(); | ||||
} | } | ||||
private void RadioButtonCompelete_Click(object sender, RoutedEventArgs e) | |||||
{ | |||||
repiceList.ItemsSource = RecipeSendDownViewModel.UserTreeCompelete; | |||||
repiceList.Visibility = Visibility.Visible; | |||||
repiceListMaking.Visibility = Visibility.Hidden; | |||||
} | |||||
private void RadioButtonWait_Click(object sender, RoutedEventArgs e) | |||||
{ | |||||
repiceList.ItemsSource = RecipeSendDownViewModel.UserTreeWait; | |||||
repiceList.Visibility = Visibility.Visible; | |||||
repiceListMaking.Visibility = Visibility.Hidden; | |||||
} | |||||
private void RadioButtonMaking_Click(object sender, RoutedEventArgs e) | |||||
{ | |||||
repiceListMaking.Visibility = Visibility.Visible; | |||||
repiceList.Visibility = Visibility.Hidden; | |||||
} | |||||
} | } | ||||
} | } |
@@ -16,7 +16,7 @@ namespace BPASmartClient.JXJFoodBigStation.ViewModel | |||||
internal class DeviceManageViewModel:ObservableObject | internal class DeviceManageViewModel:ObservableObject | ||||
{ | { | ||||
public ObservableCollection<DeviceInfo> Devices { get; set; }=new ObservableCollection<DeviceInfo>() { new DeviceInfo {DeviceName="123",IpAddress="123.213.123.213." } }; | |||||
public ObservableCollection<DeviceInfo> Devices { get; set; } = new ObservableCollection<DeviceInfo>() { new DeviceInfo { DeviceName = "123", IpAddress = "123.213.123.213." } }; | |||||
public RelayCommand<object> ChangeNameCommand { get; set; } | public RelayCommand<object> ChangeNameCommand { get; set; } | ||||
@@ -25,7 +25,7 @@ namespace BPASmartClient.JXJFoodBigStation.ViewModel | |||||
TopDeviceCurrentStatuses.Add(new DeviceCurrentStatus() | TopDeviceCurrentStatuses.Add(new DeviceCurrentStatus() | ||||
{ | { | ||||
DeviceName = i.ToString(), | DeviceName = i.ToString(), | ||||
DeviceNum=i, | |||||
DeviceNum = i, | |||||
RunStatus = true, | RunStatus = true, | ||||
Weight = new Random().Next(0, 100) | Weight = new Random().Next(0, 100) | ||||
}); | }); | ||||
@@ -40,13 +40,11 @@ namespace BPASmartClient.JXJFoodBigStation.ViewModel | |||||
Weight = new Random().Next(0, 100) | Weight = new Random().Next(0, 100) | ||||
}); | }); | ||||
} | } | ||||
StartCommand = new RelayCommand<string>((deviceName) => { | |||||
//PLC控制 | |||||
//动画 | |||||
StartCommand = new RelayCommand<string>((deviceName) => | |||||
{ | |||||
if (deviceName != null) | if (deviceName != null) | ||||
{ | { | ||||
var top= TopDeviceCurrentStatuses.FirstOrDefault(p => p.DeviceName == deviceName); | |||||
var top = TopDeviceCurrentStatuses.FirstOrDefault(p => p.DeviceName == deviceName); | |||||
if (top != null) | if (top != null) | ||||
{ | { | ||||
ActionManage.GetInstance.Send("StartTopDevice", deviceName); | ActionManage.GetInstance.Send("StartTopDevice", deviceName); | ||||
@@ -58,10 +56,8 @@ namespace BPASmartClient.JXJFoodBigStation.ViewModel | |||||
} | } | ||||
} | } | ||||
}); | }); | ||||
StopCommand = new RelayCommand<string>((deviceName) => { | |||||
//PLC控制 | |||||
//动画 | |||||
StopCommand = new RelayCommand<string>((deviceName) => | |||||
{ | |||||
if (deviceName != null) | if (deviceName != null) | ||||
{ | { | ||||
var top = TopDeviceCurrentStatuses.FirstOrDefault(p => p.DeviceName == deviceName); | var top = TopDeviceCurrentStatuses.FirstOrDefault(p => p.DeviceName == deviceName); | ||||
@@ -120,7 +116,6 @@ namespace BPASmartClient.JXJFoodBigStation.ViewModel | |||||
view.ShowDialog(); | view.ShowDialog(); | ||||
}); | }); | ||||
} | } | ||||
public ObservableCollection<DeviceCurrentStatus> AllDeviceCurrentStatuses; | |||||
public ObservableCollection<DeviceCurrentStatus> TopDeviceCurrentStatuses { get; set; } = new ObservableCollection<DeviceCurrentStatus>(); | public ObservableCollection<DeviceCurrentStatus> TopDeviceCurrentStatuses { get; set; } = new ObservableCollection<DeviceCurrentStatus>(); | ||||
public ObservableCollection<DeviceCurrentStatus> BottomDeviceCurrentStatuses { get; set; } = new ObservableCollection<DeviceCurrentStatus>(); | public ObservableCollection<DeviceCurrentStatus> BottomDeviceCurrentStatuses { get; set; } = new ObservableCollection<DeviceCurrentStatus>(); | ||||
public RelayCommand<string> UpdateRawMaterName { get; set; } | public RelayCommand<string> UpdateRawMaterName { get; set; } | ||||
@@ -1,4 +1,5 @@ | |||||
using BPASmartClient.Helper; | |||||
using BPASmartClient.CustomResource.Pages.Model; | |||||
using BPASmartClient.Helper; | |||||
using BPASmartClient.JXJFoodBigStation.Model; | using BPASmartClient.JXJFoodBigStation.Model; | ||||
using Microsoft.Toolkit.Mvvm.ComponentModel; | using Microsoft.Toolkit.Mvvm.ComponentModel; | ||||
using Microsoft.Toolkit.Mvvm.Input; | using Microsoft.Toolkit.Mvvm.Input; | ||||
@@ -37,7 +38,17 @@ namespace BPASmartClient.JXJFoodBigStation.ViewModel | |||||
//配方下发逻辑 | //配方下发逻辑 | ||||
var res = Recipes.FirstOrDefault(p => p.RecipeName == recipeName); | var res = Recipes.FirstOrDefault(p => p.RecipeName == recipeName); | ||||
if (res != null) | if (res != null) | ||||
ActionManage.GetInstance.Send("ManualSendRecipe", res); | |||||
{ | |||||
Json<LocalRecipe>.Data.Recipes.Add(res); | |||||
for (int i = 0; i < Json<LocalRecipe>.Data.Recipes.Count; i++) | |||||
{ | |||||
foreach (var item in Json<LocalRecipe>.Data.Recipes.ElementAt(i).RawMaterial) | |||||
{ | |||||
item.RawMaterialLocation = Convert.ToInt32(item.RawMaterialName); | |||||
} | |||||
} | |||||
MessageNotify.GetInstance.ShowAlarmLog("手动下发配方完成"); | |||||
} | |||||
} | } | ||||
}); | }); | ||||
} | } | ||||
@@ -14,22 +14,26 @@ namespace BPASmartClient.JXJFoodBigStation.ViewModel | |||||
{ | { | ||||
internal class SiemensRecipeSendDownViewModel : ObservableObject | internal class SiemensRecipeSendDownViewModel : ObservableObject | ||||
{ | { | ||||
public ObservableCollection<RecipeData> Recipes { get; set; } = Json<RemoteRecipe>.Data.Recipes; | |||||
/// <summary> | |||||
/// 当前正在制作的配方 | |||||
/// </summary> | |||||
public static ObservableCollection<RawMaterial> recipeProcesses { get; set; } = new ObservableCollection<RawMaterial>(); | |||||
/// <summary> | |||||
/// 等待制作的配方 | |||||
/// </summary> | |||||
public static ObservableCollection<RecipeData> UserTreeWait { get; set; } = new ObservableCollection<RecipeData>(); | |||||
/// <summary> | |||||
/// 已完成的配方 | |||||
/// </summary> | |||||
public static ObservableCollection<RecipeData> UserTreeCompelete { get; set; } = new ObservableCollection<RecipeData>(); | |||||
//Json<RemoteRecipe>.Data.Recipes | |||||
public static ObservableCollection<RawMaterial> a = new ObservableCollection<RawMaterial>() | |||||
{ | |||||
new RawMaterial() { RawMaterialName= "1",RawMaterialWeight=101, RawMaterialBarrelNum=1 }, | |||||
new RawMaterial() { RawMaterialName= "2",RawMaterialWeight=102, RawMaterialBarrelNum=1 }, | |||||
new RawMaterial() { RawMaterialName= "3",RawMaterialWeight=103, RawMaterialBarrelNum=1 }, | |||||
new RawMaterial() { RawMaterialName= "4",RawMaterialWeight=104, RawMaterialBarrelNum=1 }, | |||||
new RawMaterial() { RawMaterialName= "5",RawMaterialWeight=105, RawMaterialBarrelNum=1 }, | |||||
new RawMaterial() { RawMaterialName= "6",RawMaterialWeight=106, RawMaterialBarrelNum=1 }, | |||||
new RawMaterial() { RawMaterialName= "7",RawMaterialWeight=107, RawMaterialBarrelNum=1 }, | |||||
new RawMaterial() { RawMaterialName= "8",RawMaterialWeight=108, RawMaterialBarrelNum=1 }, | |||||
new RawMaterial() { RawMaterialName= "9",RawMaterialWeight=109, RawMaterialBarrelNum=1 }, | |||||
new RawMaterial() { RawMaterialName= "10",RawMaterialWeight=110, RawMaterialBarrelNum=1 }, | |||||
new RawMaterial() { RawMaterialName= "11",RawMaterialWeight=111, RawMaterialBarrelNum=1 }, | |||||
new RawMaterial() { RawMaterialName= "12",RawMaterialWeight=112, RawMaterialBarrelNum=1 } | |||||
}; | |||||
public ObservableCollection<RecipeData> Recipes { get; set; } = Json<RemoteRecipe>.Data.Recipes; | |||||
public SiemensRecipeSendDownViewModel() | public SiemensRecipeSendDownViewModel() | ||||
{ | { | ||||
} | } | ||||
} | } | ||||
} | } |
@@ -139,7 +139,7 @@ namespace BPASmartClient.JXJFoodSmallStation.Model | |||||
try | try | ||||
{ | { | ||||
//HKDevice.HK_PLC_S7.Connect(S7.Net.CpuType.S71200, HK_PLC_IP); | //HKDevice.HK_PLC_S7.Connect(S7.Net.CpuType.S71200, 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); | |||||
//WindSendDevice.Siemens_PLC_S7.Connect(S7.Net.CpuType.S71200,WindSend_PLC_IP); | //WindSendDevice.Siemens_PLC_S7.Connect(S7.Net.CpuType.S71200,WindSend_PLC_IP); | ||||
if (HKDevice.IsConnected) | if (HKDevice.IsConnected) | ||||
{ | { | ||||
@@ -25,18 +25,18 @@ namespace BPASmartClient.JXJFoodSmallStation.Model.Siemens | |||||
var Status = this.Siemens_PLC_S7.ReadClass<XL_Status_DB>(2231); | var Status = this.Siemens_PLC_S7.ReadClass<XL_Status_DB>(2231); | ||||
var Finish = this.Siemens_PLC_S7.ReadClass<XL_Finish_DB>(2261); | var Finish = this.Siemens_PLC_S7.ReadClass<XL_Finish_DB>(2261); | ||||
var DataColl = this.Siemens_PLC_S7.ReadClass<XL_DataColl_DB>(2291); | var DataColl = this.Siemens_PLC_S7.ReadClass<XL_DataColl_DB>(2291); | ||||
if (Start != null && Start.Order_Request == false && GVL_SmallStation.IsAllowSiemensSendRecipe) | |||||
if (Start != null && Start.Order_Request == false && GVL_SmallStation.IsAllowSiemensSendRecipe) | |||||
{ | { | ||||
Start.Order_Request = true; | Start.Order_Request = true; | ||||
this.Siemens_PLC_S7.WriteClass<XL_Start_DB>(Start, 1); | this.Siemens_PLC_S7.WriteClass<XL_Start_DB>(Start, 1); | ||||
} | } | ||||
if (Start != null && RTrig.GetInstance("RecipeTrig").Start(Start.Order_Request_ACK)) | |||||
if (Start != null && RTrig.GetInstance("RecipeTrig").Start(Start.Order_Request_ACK)) | |||||
{ | { | ||||
ActionManage.GetInstance.Send("SiemensRecipeRecive", Start); | ActionManage.GetInstance.Send("SiemensRecipeRecive", Start); | ||||
Start.Order_Request_ACK = false; | Start.Order_Request_ACK = false; | ||||
this.Siemens_PLC_S7.WriteClass<XL_Start_DB>(Start, 1); | this.Siemens_PLC_S7.WriteClass<XL_Start_DB>(Start, 1); | ||||
} | } | ||||
if (Status != null && RTrig.GetInstance("Allow_AGV_Put[0]").Start(Status.AgvRequestPut)) | if (Status != null && RTrig.GetInstance("Allow_AGV_Put[0]").Start(Status.AgvRequestPut)) | ||||
{ | { | ||||
ActionManage.GetInstance.Send("AGV放货架到位",Status); | ActionManage.GetInstance.Send("AGV放货架到位",Status); | ||||
@@ -89,7 +89,14 @@ namespace BPASmartClient.MorkTSingle | |||||
{ | { | ||||
Thread.Sleep(1000); | Thread.Sleep(1000); | ||||
OrderChange(morkT.morkOrderPushesCoffee.ElementAt(0).SuborderId, BPA.Message.Enum.ORDER_STATUS.COOKING); | OrderChange(morkT.morkOrderPushesCoffee.ElementAt(0).SuborderId, BPA.Message.Enum.ORDER_STATUS.COOKING); | ||||
new KLMCoffee_MakeCoffeeEvent() { DeviceId=DeviceId, KLMDrinkFaultCode = (KLMDrinkFaultType)(morkT.morkOrderPushesCoffee.ElementAt(0).Loc) }.Publish(); //接咖啡控制 //DrCoffeeDrinksCode.热水 | |||||
if (!GVL_MORKJC.CoffeeKind) | |||||
{ | |||||
new KLMCoffee_MakeCoffeeEvent() { DeviceId = DeviceId, KLMDrinkFaultCode = (KLMDrinkFaultType)(morkT.morkOrderPushesCoffee.ElementAt(0).Loc) }.Publish(); //接咖啡控制 //DrCoffeeDrinksCode.热水 | |||||
} | |||||
else | |||||
{ | |||||
new DRCoffee_MakeCoffeeEvent() { DeviceId = DeviceId, DrinkCode = (DrCoffeeDrinksCode)int.Parse(mainMaterialLoc) }.Publish(); | |||||
} | |||||
morkT.IsCoffeeMake = true; | morkT.IsCoffeeMake = true; | ||||
} | } | ||||
else if (morkT.MakeCoffeeFinish && IsHealth && morkT.morkOrderPushesCoffee.Count > 0 && morkT.IsCoffeeMake) | else if (morkT.MakeCoffeeFinish && IsHealth && morkT.morkOrderPushesCoffee.Count > 0 && morkT.IsCoffeeMake) | ||||
@@ -233,11 +240,22 @@ namespace BPASmartClient.MorkTSingle | |||||
{ | { | ||||
if (morkT.IsCoffeeMake) | if (morkT.IsCoffeeMake) | ||||
{ | { | ||||
EventBus.EventBus.GetInstance().Subscribe<KLMCoffee_CoffeEndCookEvent>(DeviceId, delegate (IEvent @event, EventCallBackHandle callBack) | |||||
if (!GVL_MORKJC.CoffeeKind) | |||||
{ | { | ||||
bFirstTrig_Coffee = false; | |||||
morkT.MakeCoffeeFinish = true; | |||||
}); | |||||
EventBus.EventBus.GetInstance().Subscribe<KLMCoffee_CoffeEndCookEvent>(DeviceId, delegate (IEvent @event, EventCallBackHandle callBack) | |||||
{ | |||||
bFirstTrig_Coffee = false; | |||||
morkT.MakeCoffeeFinish = true; | |||||
}); | |||||
} | |||||
else | |||||
{ | |||||
EventBus.EventBus.GetInstance().Subscribe<DRCoffee_CoffeEndCookEvent>(DeviceId, delegate (IEvent @event, EventCallBackHandle callBack) | |||||
{ | |||||
bFirstTrig_Coffee = false; | |||||
morkT.MakeCoffeeFinish = true; | |||||
}); | |||||
} | |||||
if (morkT.MakeCoffeeFinish != true) | if (morkT.MakeCoffeeFinish != true) | ||||
{ | { | ||||
if (!bFirstTrig_Coffee) | if (!bFirstTrig_Coffee) | ||||
@@ -19,5 +19,9 @@ namespace BPASmartClient.MorkTSingle | |||||
/// 咖乐美咖啡机心跳 | /// 咖乐美咖啡机心跳 | ||||
/// </summary> | /// </summary> | ||||
public bool KLMCoffeeIsConnected = false; | public bool KLMCoffeeIsConnected = false; | ||||
/// <summary> | |||||
/// 咖啡种类false:咖乐美咖啡 true:咖博士 | |||||
/// </summary> | |||||
public static bool CoffeeKind { get; set; } = true; | |||||
} | } | ||||
} | } |
@@ -94,19 +94,24 @@ namespace BPASmartClient.S7Net | |||||
TResult sourceClass = new TResult(); | TResult sourceClass = new TResult(); | ||||
int num = (int)EntityClassResolution.GetClassSize(sourceClass); | int num = (int)EntityClassResolution.GetClassSize(sourceClass); | ||||
if (num <= 0) return sourceClass; | if (num <= 0) return sourceClass; | ||||
byte[] array = myPlc.ReadBytes(DataType.DataBlock, db, startByteAdr, num); | |||||
EntityClassResolution.FromBytes(sourceClass, array); | |||||
if (IsConnected) | |||||
{ | |||||
byte[] array = myPlc.ReadBytes(DataType.DataBlock, db, startByteAdr, num); | |||||
EntityClassResolution.FromBytes(sourceClass, array); | |||||
} | |||||
return sourceClass; | return sourceClass; | ||||
} | } | ||||
public void WriteClass<TWriteModel>(TWriteModel sourceClass, int db, int startAddress = 0) where TWriteModel : class, new() | public void WriteClass<TWriteModel>(TWriteModel sourceClass, int db, int startAddress = 0) where TWriteModel : class, new() | ||||
{ | { | ||||
byte[] array = new byte[(int)EntityClassResolution.GetClassSize(sourceClass)]; | |||||
EntityClassResolution.ToBytes(sourceClass, array); | |||||
myPlc.WriteBytes(DataType.DataBlock, db, startAddress, array); | |||||
if (IsConnected) | |||||
{ | |||||
byte[] array = new byte[(int)EntityClassResolution.GetClassSize(sourceClass)]; | |||||
EntityClassResolution.ToBytes(sourceClass, array); | |||||
myPlc.WriteBytes(DataType.DataBlock, db, startAddress, array); | |||||
} | |||||
} | } | ||||
//public ushort[] ReadMW(int address, int count) | //public ushort[] ReadMW(int address, int count) | ||||
//{ | //{ | ||||
// if (!IsConnected) return default; | // if (!IsConnected) return default; | ||||
@@ -12,14 +12,14 @@ | |||||
<add key ="Namespaces" value="DEV.test1.Config"/>--> | <add key ="Namespaces" value="DEV.test1.Config"/>--> | ||||
<!--开发环境--> | <!--开发环境--> | ||||
<add key="apollouri" value="http://10.2.1.21:28080/"/> | |||||
<!--<add key="apollouri" value="http://10.2.1.21:28080/"/> | |||||
<add key="AppId" value="HostComputer"/> | <add key="AppId" value="HostComputer"/> | ||||
<add key ="Namespaces" value="DEV.Config"/> | |||||
<add key ="Namespaces" value="DEV.Config"/>--> | |||||
<!--正式环境--> | <!--正式环境--> | ||||
<!--<add key="apollouri" value="http://47.108.65.220:28080/"/> | |||||
<add key="apollouri" value="http://47.108.65.220:28080/"/> | |||||
<add key="appid" value="hostcomputer"/> | <add key="appid" value="hostcomputer"/> | ||||
<add key ="namespaces" value="test1.config"/>--> | |||||
<add key ="namespaces" value="test1.config"/> | |||||
<!--阿里云上报启动方式:API 或者 LOCAL--> | <!--阿里云上报启动方式:API 或者 LOCAL--> | ||||
<!--API :通过客户端ID,调用接口查询“设备连接信息”--> | <!--API :通过客户端ID,调用接口查询“设备连接信息”--> | ||||
@@ -0,0 +1,6 @@ | |||||
<?xml version="1.0" encoding="utf-8" ?> | |||||
<configuration> | |||||
<appSettings> | |||||
<add key="IP" value="192.168.0.15"/> | |||||
</appSettings> | |||||
</configuration> |
@@ -28,12 +28,8 @@ namespace BPASmartClient.DosingSystem | |||||
BPASmartClient.Helper.SystemHelper.GetInstance.CreateDesktopShortcut(); | BPASmartClient.Helper.SystemHelper.GetInstance.CreateDesktopShortcut(); | ||||
MenuInit(); | MenuInit(); | ||||
DataInit(); | DataInit(); | ||||
string ip = "192.168.0.15"; | |||||
SiemensDevice.GetInstance.Connect(ip); | |||||
DeviceInquire.GetInstance.Init();//配料机设备上线监听,设备列表初始化 | DeviceInquire.GetInstance.Init();//配料机设备上线监听,设备列表初始化 | ||||
MainView mv = new MainView(); | MainView mv = new MainView(); | ||||
//mv.Show(); | |||||
LoginView lv = new LoginView(); | LoginView lv = new LoginView(); | ||||
var res = lv.ShowDialog(); | var res = lv.ShowDialog(); | ||||
if (res != null && res == true) | if (res != null && res == true) | ||||
@@ -57,8 +53,6 @@ namespace BPASmartClient.DosingSystem | |||||
private void MenuInit() | private void MenuInit() | ||||
{ | { | ||||
//NfcServer.GetInstance.Init(); | |||||
#region 配方管理菜单 | #region 配方管理菜单 | ||||
ObservableCollection<SubMenumodel> RecipeManage = new ObservableCollection<SubMenumodel>(); | ObservableCollection<SubMenumodel> RecipeManage = new ObservableCollection<SubMenumodel>(); | ||||
RecipeManage.Add(new SubMenumodel() | RecipeManage.Add(new SubMenumodel() | ||||
@@ -11,12 +11,17 @@ | |||||
<EnforceCodeStyleInBuild>True</EnforceCodeStyleInBuild> | <EnforceCodeStyleInBuild>True</EnforceCodeStyleInBuild> | ||||
</PropertyGroup> | </PropertyGroup> | ||||
<ItemGroup> | |||||
<None Remove="App.config" /> | |||||
<None Remove="tsconfig1.json" /> | |||||
</ItemGroup> | |||||
<ItemGroup> | <ItemGroup> | ||||
<Content Include="hbl.ico" /> | <Content Include="hbl.ico" /> | ||||
</ItemGroup> | </ItemGroup> | ||||
<ItemGroup> | <ItemGroup> | ||||
<PackageReference Include="BPA.Helper" Version="1.0.22" /> | |||||
<PackageReference Include="BPA.Helper" Version="1.0.25" /> | |||||
<PackageReference Include="BPA.Message" Version="1.0.46" /> | <PackageReference Include="BPA.Message" Version="1.0.46" /> | ||||
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" /> | <PackageReference Include="Newtonsoft.Json" Version="13.0.1" /> | ||||
</ItemGroup> | </ItemGroup> | ||||
@@ -52,10 +52,11 @@ namespace BPASmartClient.DosingSystem | |||||
BottomDeviceCurrentStatuses.ElementAt(BottomIndex).DeviceNum = DeviceLists.ElementAt(i).Value.deviceStatus.DeviceNum; | BottomDeviceCurrentStatuses.ElementAt(BottomIndex).DeviceNum = DeviceLists.ElementAt(i).Value.deviceStatus.DeviceNum; | ||||
} | } | ||||
int deviceIndex = Array.FindIndex(devices.ToArray(), p => p.IpAddress == DeviceLists.ElementAt(i).Key && p.DeviceName != DeviceLists.ElementAt(i).Value.DeviceName); | |||||
int deviceIndex = Array.FindIndex(devices.ToArray(), p => p.IpAddress == DeviceLists.ElementAt(i).Key/* && p.DeviceName != DeviceLists.ElementAt(i).Value.DeviceName && p.DeviceNum != DeviceLists.ElementAt(i).Value.deviceStatus.DeviceNum*/); | |||||
if (deviceIndex >= 0 && deviceIndex < devices.Count) | if (deviceIndex >= 0 && deviceIndex < devices.Count) | ||||
{ | { | ||||
devices.ElementAt(deviceIndex).DeviceName = DeviceLists.ElementAt(i).Value.DeviceName; | devices.ElementAt(deviceIndex).DeviceName = DeviceLists.ElementAt(i).Value.DeviceName; | ||||
devices.ElementAt(deviceIndex).DeviceNum = DeviceLists.ElementAt(i).Value.deviceStatus.DeviceNum; | |||||
} | } | ||||
} | } | ||||
Thread.Sleep(200); | Thread.Sleep(200); | ||||
@@ -113,9 +114,10 @@ namespace BPASmartClient.DosingSystem | |||||
{ | { | ||||
if (!string.IsNullOrEmpty(Json<DevicePar>.Data.BaseParModel.NetworkSegAddress)) IPSegment = Json<DevicePar>.Data.BaseParModel.NetworkSegAddress; | if (!string.IsNullOrEmpty(Json<DevicePar>.Data.BaseParModel.NetworkSegAddress)) IPSegment = Json<DevicePar>.Data.BaseParModel.NetworkSegAddress; | ||||
else Json<DevicePar>.Data.BaseParModel.NetworkSegAddress = IPSegment; | else Json<DevicePar>.Data.BaseParModel.NetworkSegAddress = IPSegment; | ||||
TestData(); | |||||
//TestData(); | |||||
IpAddressLines(); | IpAddressLines(); | ||||
//DeviceDataInit(); | |||||
SiemensDevice.GetInstance.Connect(Json<DevicePar>.Data.BaseParModel.DeviceAddress); | |||||
DeviceDataInit(); | |||||
ThreadManage.GetInstance().StartLong(new Action(() => | ThreadManage.GetInstance().StartLong(new Action(() => | ||||
{ | { | ||||
if (IPQueues.Count >= IPLists.Count) | if (IPQueues.Count >= IPLists.Count) | ||||
@@ -305,6 +307,7 @@ namespace BPASmartClient.DosingSystem | |||||
modbusTcp.ShowEx = new Action<string>((s) => { MessageNotify.GetInstance.ShowRunLog(s); }); | modbusTcp.ShowEx = new Action<string>((s) => { MessageNotify.GetInstance.ShowRunLog(s); }); | ||||
this.DeviceName = DeviceName; | this.DeviceName = DeviceName; | ||||
AlarmHelper<AlarmInfo>.Init(); | AlarmHelper<AlarmInfo>.Init(); | ||||
if (modbusTcp.Connected) | if (modbusTcp.Connected) | ||||
{ | { | ||||
ThreadManage.GetInstance().StartLong(new Action(() => | ThreadManage.GetInstance().StartLong(new Action(() => | ||||
@@ -14,11 +14,13 @@ namespace BPASmartClient.DosingSystem | |||||
/// </summary> | /// </summary> | ||||
public double MaterialWeight { get { return _materialWeight; } set { _materialWeight = value; OnPropertyChanged(); } } | public double MaterialWeight { get { return _materialWeight; } set { _materialWeight = value; OnPropertyChanged(); } } | ||||
private double _materialWeight; | private double _materialWeight; | ||||
/// <summary> | /// <summary> | ||||
/// 料仓物料名称 | /// 料仓物料名称 | ||||
/// </summary> | /// </summary> | ||||
public string MaterialName { get { return _materialName; } set { _materialName = value; OnPropertyChanged(); } } | public string MaterialName { get { return _materialName; } set { _materialName = value; OnPropertyChanged(); } } | ||||
private string _materialName; | private string _materialName; | ||||
/// <summary> | /// <summary> | ||||
/// 是否真在运行 | /// 是否真在运行 | ||||
/// </summary> | /// </summary> | ||||
@@ -48,10 +50,12 @@ namespace BPASmartClient.DosingSystem | |||||
/// </summary> | /// </summary> | ||||
public int IssueStatus { get { return _isIssueStatus; } set { _isIssueStatus = value; OnPropertyChanged(); } } | public int IssueStatus { get { return _isIssueStatus; } set { _isIssueStatus = value; OnPropertyChanged(); } } | ||||
private int _isIssueStatus; | private int _isIssueStatus; | ||||
/// <summary> | /// <summary> | ||||
/// 下料重量 | /// 下料重量 | ||||
/// </summary> | /// </summary> | ||||
public double IssueWeight { get { return _IssueWeight; } set { _IssueWeight = value; OnPropertyChanged(); } } | public double IssueWeight { get { return _IssueWeight; } set { _IssueWeight = value; OnPropertyChanged(); } } | ||||
private double _IssueWeight; | private double _IssueWeight; | ||||
} | } | ||||
} | } |
@@ -24,7 +24,7 @@ namespace BPASmartClient.DosingSystem | |||||
/// 输送带设备 PLC IP 地址 | /// 输送带设备 PLC IP 地址 | ||||
/// </summary> | /// </summary> | ||||
public string DeviceAddress { get { return _mDeviceAddress; } set { _mDeviceAddress = value; OnPropertyChanged(); } } | public string DeviceAddress { get { return _mDeviceAddress; } set { _mDeviceAddress = value; OnPropertyChanged(); } } | ||||
private string _mDeviceAddress = "192.168.0.1"; | |||||
private string _mDeviceAddress = "192.168.0.15"; | |||||
/// <summary> | /// <summary> | ||||
/// 输送带数量 | /// 输送带数量 | ||||
@@ -17,7 +17,6 @@ namespace BPASmartClient.DosingSystem | |||||
public ObservableCollection<OutletInfoModel> OutletInfoModels { get; set; } = new ObservableCollection<OutletInfoModel>(); | public ObservableCollection<OutletInfoModel> OutletInfoModels { get; set; } = new ObservableCollection<OutletInfoModel>(); | ||||
public BasePar BaseParModel { get { return _mBaseParModel; } set { _mBaseParModel = value; OnPropertyChanged(); } } | public BasePar BaseParModel { get { return _mBaseParModel; } set { _mBaseParModel = value; OnPropertyChanged(); } } | ||||
private BasePar _mBaseParModel = new BasePar(); | private BasePar _mBaseParModel = new BasePar(); | ||||
@@ -22,11 +22,17 @@ namespace BPASmartClient.DosingSystem | |||||
public void Connect(string ip) | public void Connect(string ip) | ||||
{ | { | ||||
//GlobalDevice.PlcData = MySiemens.ReadClass<PlcToComputer>(3);//获取PLC到上位机的数据 | |||||
while (!MySiemens.IsConnected) | |||||
try | |||||
{ | { | ||||
MySiemens.Connect(S7.Net.CpuType.S71200, ip); | |||||
Thread.Sleep(2000); | |||||
while (!MySiemens.IsConnected) | |||||
{ | |||||
MySiemens.Connect(S7.Net.CpuType.S71200, ip); | |||||
Thread.Sleep(2000); | |||||
} | |||||
} | |||||
catch (Exception ex) | |||||
{ | |||||
} | } | ||||
IsConnect = MySiemens.IsConnected; | IsConnect = MySiemens.IsConnected; | ||||
bool tempValue = false; | bool tempValue = false; | ||||
@@ -41,7 +47,6 @@ namespace BPASmartClient.DosingSystem | |||||
{ | { | ||||
if (IsConnect) | if (IsConnect) | ||||
{ | { | ||||
//测试使用 | |||||
GlobalDevice.PlcData = MySiemens.ReadClass<PlcToComputer>(3);//获取PLC到上位机的数据 | GlobalDevice.PlcData = MySiemens.ReadClass<PlcToComputer>(3);//获取PLC到上位机的数据 | ||||
var res = MySiemens.Read(DataType.DataBlock, 4, 134, VarType.Word, 32); | var res = MySiemens.Read(DataType.DataBlock, 4, 134, VarType.Word, 32); | ||||
if (res != null && res is ushort[] ushorts && ushorts.Length == 32) | if (res != null && res is ushort[] ushorts && ushorts.Length == 32) | ||||
@@ -80,11 +85,7 @@ namespace BPASmartClient.DosingSystem | |||||
return Add; | return Add; | ||||
} | } | ||||
return default; | return default; | ||||
} | } | ||||
} | } | ||||
} | } |
@@ -31,7 +31,7 @@ namespace BPASmartClient.DosingSystem.View | |||||
private void cb_SelectionChanged(object sender, SelectionChangedEventArgs e) | private void cb_SelectionChanged(object sender, SelectionChangedEventArgs e) | ||||
{ | { | ||||
ActionManage.GetInstance.SendAsync("原料选择修改", (sender as ComboBox).SelectedValue); | |||||
//ActionManage.GetInstance.SendAsync("原料选择修改", (sender as ComboBox).SelectedValue); | |||||
} | } | ||||
} | } | ||||
} | } |
@@ -49,7 +49,6 @@ namespace BPASmartClient.DosingSystem.ViewModel | |||||
} | } | ||||
} | } | ||||
} | } | ||||
}); | }); | ||||
} | } | ||||
@@ -23,7 +23,6 @@ namespace BPASmartClient.DosingSystem.ViewModel | |||||
}); | }); | ||||
} | } | ||||
} | } | ||||
public ObservableCollection<ConveyerBeltModel> ConveyerBeltModels { get; set; } = new ObservableCollection<ConveyerBeltModel>(); | public ObservableCollection<ConveyerBeltModel> ConveyerBeltModels { get; set; } = new ObservableCollection<ConveyerBeltModel>(); | ||||
} | } | ||||
} | } |
@@ -17,15 +17,15 @@ namespace BPASmartClient.DosingSystem.ViewModel | |||||
public NewRecipeViewModel() | public NewRecipeViewModel() | ||||
{ | { | ||||
ActionManage.GetInstance.RegisterAsync(new Action<object>((o) => | ActionManage.GetInstance.RegisterAsync(new Action<object>((o) => | ||||
{ | |||||
{ | |||||
if (!string.IsNullOrEmpty(o?.ToString())) | if (!string.IsNullOrEmpty(o?.ToString())) | ||||
{ | { | ||||
if (RawMaterials.FirstOrDefault(p => p.RawMaterialName == o.ToString()) != null) | if (RawMaterials.FirstOrDefault(p => p.RawMaterialName == o.ToString()) != null) | ||||
{ | { | ||||
App.Current.Dispatcher.Invoke(() => { MessageNotify.GetInstance.ShowDialog("单前原料和其它原料重复,请重新选择!", DialogType.Warning); }); | |||||
App.Current.Dispatcher.Invoke(() => { MessageNotify.GetInstance.ShowDialog("当前原料和其它原料重复,请重新选择!", DialogType.Warning); }); | |||||
} | } | ||||
} | } | ||||
}), "原料选择修改"); | |||||
}), "原料选择修改"); | |||||
ActionManage.GetInstance.Register(new Action<object>((o) => | ActionManage.GetInstance.Register(new Action<object>((o) => | ||||
{ | { | ||||
if (o != null && o is RecipeModel rm) | if (o != null && o is RecipeModel rm) | ||||
@@ -74,7 +74,6 @@ namespace BPASmartClient.DosingSystem.ViewModel | |||||
SaveCommand = new RelayCommand(() => | SaveCommand = new RelayCommand(() => | ||||
{ | { | ||||
if (string.IsNullOrEmpty(RecipeName)) { MessageNotify.GetInstance.ShowDialog("请输入配方名称!", DialogType.Warning); ErrorInfo = "请输入配方名称"; return; } | if (string.IsNullOrEmpty(RecipeName)) { MessageNotify.GetInstance.ShowDialog("请输入配方名称!", DialogType.Warning); ErrorInfo = "请输入配方名称"; return; } | ||||
var tempRes = RawMaterials.GroupBy(p => p.RawMaterialName); | var tempRes = RawMaterials.GroupBy(p => p.RawMaterialName); | ||||
if (tempRes.Count() != RawMaterials.Count) | if (tempRes.Count() != RawMaterials.Count) | ||||
{ | { | ||||
@@ -90,7 +90,8 @@ namespace BPASmartClient.DosingSystem.ViewModel | |||||
#region 配方下发到PLC操作相关 | #region 配方下发到PLC操作相关 | ||||
//配方数据写入到输送机 | //配方数据写入到输送机 | ||||
var res = Json<LocaPar>.Data.Recipes.FirstOrDefault(p => p.RecipeName == CurrentRecipeName); | var res = Json<LocaPar>.Data.Recipes.FirstOrDefault(p => p.RecipeName == CurrentRecipeName); | ||||
List<int> recipeData = new List<int>(); | |||||
/*List<int> recipeData = new List<int>();*/ | |||||
List<int> BarrelNum = new List<int>(); | |||||
if (res != null) | if (res != null) | ||||
{ | { | ||||
var tInfo = res.RawMaterials.GroupBy(p => p.Loc);//获取桶号信息 | var tInfo = res.RawMaterials.GroupBy(p => p.Loc);//获取桶号信息 | ||||
@@ -105,27 +106,47 @@ namespace BPASmartClient.DosingSystem.ViewModel | |||||
var tempDevice = DeviceInquire.GetInstance.devices.FirstOrDefault(p => p.DeviceName == TempName); | var tempDevice = DeviceInquire.GetInstance.devices.FirstOrDefault(p => p.DeviceName == TempName); | ||||
if (tempDevice != null) | if (tempDevice != null) | ||||
{ | { | ||||
data = data.SetBitValue((byte)tempDevice.DeviceNum, true); | |||||
/*data = data.SetBitValue((byte)tempDevice.DeviceNum, true);*/ | |||||
if (tempDevice.DeviceNum > 0) | |||||
{ | |||||
int a = data.SetBitValue((byte)tInfo.ElementAt(i).ElementAt(m).Loc, true); | |||||
byte[] test1 = a.ToBytes(BPA.Helper.DataFormat.ABCD); | |||||
int item = test1.ToInt(); | |||||
SiemensDevice.GetInstance.MySiemens.Write($"DB4.DBD{2 + (tempDevice.DeviceNum - 1) * 4}", item); | |||||
MessageNotify.GetInstance.ShowRunLog($"下发配方DB4.DBD{2 + (tempDevice.DeviceNum - 1) * 4} :{item.ToBinString()}"); | |||||
} | |||||
} | |||||
if (tInfo.ElementAt(i).ElementAt(m).Loc >0) | |||||
{ | |||||
if (!BarrelNum.Contains(tInfo.ElementAt(i).ElementAt(m).Loc)) | |||||
{ | |||||
BarrelNum.Add(tInfo.ElementAt(i).ElementAt(m).Loc); | |||||
} | |||||
} | } | ||||
} | } | ||||
recipeData.Add(data); | |||||
/*recipeData.Add(data);*/ | |||||
} | } | ||||
} | } | ||||
} | } | ||||
if (recipeData.Count <= 0) | |||||
SiemensDevice.GetInstance.MySiemens.Write("DB4.DBD198", BarrelNum.Count);//配方使用桶数写入 | |||||
/*if (recipeData.Count <= 0) | |||||
{ | { | ||||
MessageNotify.GetInstance.ShowRunLog("配方数据解析失败"); | MessageNotify.GetInstance.ShowRunLog("配方数据解析失败"); | ||||
return; | return; | ||||
} | |||||
int offset = 2; | |||||
}*/ | |||||
/*int offset = 2; | |||||
//写入配方数据 | //写入配方数据 | ||||
MessageNotify.GetInstance.ShowRunLog("开始写入配方数据"); | MessageNotify.GetInstance.ShowRunLog("开始写入配方数据"); | ||||
recipeData.ForEach(item => | recipeData.ForEach(item => | ||||
{ | { | ||||
byte[] test1 = item.ToBytes(BPA.Helper.DataFormat.ABCD); | |||||
item = test1.ToInt(); | |||||
SiemensDevice.GetInstance.MySiemens.Write($"DB4.DBD{offset}", item); | SiemensDevice.GetInstance.MySiemens.Write($"DB4.DBD{offset}", item); | ||||
MessageNotify.GetInstance.ShowRunLog($"下发配方DB4.DBD{offset} :{item.ToBinString()}"); | |||||
offset = offset += 4; | offset = offset += 4; | ||||
}); | |||||
SiemensDevice.GetInstance.MySiemens.Write("DB4.DBD198", recipeData.Count);//配方使用桶数写入 | |||||
});*/ | |||||
/*SiemensDevice.GetInstance.MySiemens.Write("DB4.DBD198", recipeData.Count);//配方使用桶数写入*/ | |||||
SiemensDevice.GetInstance.MySiemens.Write("DB4.DBX0.1", true);//配方执行启动 | SiemensDevice.GetInstance.MySiemens.Write("DB4.DBX0.1", true);//配方执行启动 | ||||
Stopwatch sw = new Stopwatch(); | Stopwatch sw = new Stopwatch(); | ||||
var recipe = Recipes.ElementAt(index); | var recipe = Recipes.ElementAt(index); | ||||
@@ -246,48 +267,244 @@ namespace BPASmartClient.DosingSystem.ViewModel | |||||
if (index >= 0 && index < recipeProcesses.ElementAt(recIndex).RawMaterials.Count) | if (index >= 0 && index < recipeProcesses.ElementAt(recIndex).RawMaterials.Count) | ||||
{ | { | ||||
//测试使用 | //测试使用 | ||||
//recipeProcesses.ElementAt(recIndex).RawMaterials.ElementAt(index).RecipeStatus = RunStatus; | |||||
recipeProcesses.ElementAt(recIndex).RawMaterials.ElementAt(index).RecipeStatus = RunStatus; | |||||
} | } | ||||
for (int j = 0; j < GlobalDevice.PlcData.IsAllowIngredients.Length; j++) | for (int j = 0; j < GlobalDevice.PlcData.IsAllowIngredients.Length; j++) | ||||
{ | { | ||||
if (GlobalDevice.PlcData.IsAllowIngredients[j]) | if (GlobalDevice.PlcData.IsAllowIngredients[j]) | ||||
{ | { | ||||
int cnt = j + 1;//获取允许配料信号桶号的料仓位置 | |||||
int Raw_Loc = Array.FindIndex(Recipes.ElementAt(i).RawMaterials.ToArray(), p => p.Loc == cnt); | |||||
int Device_Loc = Array.FindIndex(DeviceInquire.GetInstance.devices.ToArray(), p => p.DeviceNum == cnt); | |||||
if (Raw_Loc >= 0 && Device_Loc >= 0) | |||||
int barrel = j + 1;//桶号 | |||||
int cnt = GlobalDevice.PlcData.LocationFeedback[j];//允许配料的位置 0~6 | |||||
int Location1 = 0; | |||||
int Location2 = 0; | |||||
if (cnt == -1) | |||||
{ | |||||
MessageNotify.GetInstance.ShowRunLog("错误"); | |||||
return; | |||||
} | |||||
else | |||||
{ | { | ||||
float weight = Recipes.ElementAt(i).RawMaterials.ElementAt(Raw_Loc).RawMaterialWeight; | |||||
string deviceName = DeviceInquire.GetInstance.devices.ElementAt(Device_Loc).DeviceName; | |||||
int loc = Array.FindIndex(Recipes.ElementAt(i).RawMaterials.ToArray(), p => p.RawMaterialName == deviceName); | |||||
if (cnt > 0 && loc >= 0 && deviceName != null && weight >= 0) | |||||
switch (cnt) | |||||
{ | { | ||||
int St_index = Array.FindIndex(StockStatus.ToArray(), p => p.MaterialName == deviceName); | |||||
if (St_index < 0) | |||||
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) | |||||
{ | |||||
Location1 = Array.FindIndex(Recipes.ElementAt(i).RawMaterials.ToArray(), p => p.RawMaterialName == DeviceInquire.GetInstance.devices.ElementAt(a1).DeviceName && p.Loc == barrel); | |||||
} | |||||
if (b1 >= 0) | |||||
{ | |||||
Location2 = Array.FindIndex(Recipes.ElementAt(i).RawMaterials.ToArray(), p => p.RawMaterialName == DeviceInquire.GetInstance.devices.ElementAt(b1).DeviceName && p.Loc == barrel); | |||||
} | |||||
break; | |||||
case 2: | |||||
int a2 = Array.FindIndex(DeviceInquire.GetInstance.devices.ToArray(), p => p.DeviceNum == 3); | |||||
int b2 = Array.FindIndex(DeviceInquire.GetInstance.devices.ToArray(), p => p.DeviceNum == 4); | |||||
if (a2 >= 0) | |||||
{ | |||||
Location1 = Array.FindIndex(Recipes.ElementAt(i).RawMaterials.ToArray(), p => p.RawMaterialName == DeviceInquire.GetInstance.devices.ElementAt(a2).DeviceName && p.Loc == barrel); | |||||
} | |||||
if (b2 >= 0) | |||||
{ | |||||
Location2 = Array.FindIndex(Recipes.ElementAt(i).RawMaterials.ToArray(), p => p.RawMaterialName == DeviceInquire.GetInstance.devices.ElementAt(b2).DeviceName && p.Loc == barrel); | |||||
} | |||||
break; | |||||
case 3: | |||||
int a3 = Array.FindIndex(DeviceInquire.GetInstance.devices.ToArray(), p => p.DeviceNum == 5); | |||||
int b3 = Array.FindIndex(DeviceInquire.GetInstance.devices.ToArray(), p => p.DeviceNum == 6); | |||||
if (a3 >= 0) | |||||
{ | |||||
Location1 = Array.FindIndex(Recipes.ElementAt(i).RawMaterials.ToArray(), p => p.RawMaterialName == DeviceInquire.GetInstance.devices.ElementAt(a3).DeviceName && p.Loc == barrel); | |||||
} | |||||
if (b3 >= 0) | |||||
{ | |||||
Location2 = Array.FindIndex(Recipes.ElementAt(i).RawMaterials.ToArray(), p => p.RawMaterialName == DeviceInquire.GetInstance.devices.ElementAt(b3).DeviceName && p.Loc == barrel); | |||||
} | |||||
break; | |||||
case 4: | |||||
int a4 = Array.FindIndex(DeviceInquire.GetInstance.devices.ToArray(), p => p.DeviceNum == 7); | |||||
int b4 = Array.FindIndex(DeviceInquire.GetInstance.devices.ToArray(), p => p.DeviceNum == 8); | |||||
if (a4 >= 0) | |||||
{ | |||||
Location1 = Array.FindIndex(Recipes.ElementAt(i).RawMaterials.ToArray(), p => p.RawMaterialName == DeviceInquire.GetInstance.devices.ElementAt(a4).DeviceName && p.Loc == barrel); | |||||
} | |||||
if (b4 >= 0) | |||||
{ | |||||
Location2 = Array.FindIndex(Recipes.ElementAt(i).RawMaterials.ToArray(), p => p.RawMaterialName == DeviceInquire.GetInstance.devices.ElementAt(b4).DeviceName && p.Loc == barrel); | |||||
} | |||||
break; | |||||
case 5: | |||||
int a5 = Array.FindIndex(DeviceInquire.GetInstance.devices.ToArray(), p => p.DeviceNum == 9); | |||||
int b5 = Array.FindIndex(DeviceInquire.GetInstance.devices.ToArray(), p => p.DeviceNum == 10); | |||||
if (a5 >= 0) | |||||
{ | |||||
Location1 = Array.FindIndex(Recipes.ElementAt(i).RawMaterials.ToArray(), p => p.RawMaterialName == DeviceInquire.GetInstance.devices.ElementAt(a5).DeviceName && p.Loc == barrel); | |||||
} | |||||
if (b5 >= 0) | |||||
{ | |||||
Location2 = Array.FindIndex(Recipes.ElementAt(i).RawMaterials.ToArray(), p => p.RawMaterialName == DeviceInquire.GetInstance.devices.ElementAt(b5).DeviceName && p.Loc == barrel); | |||||
} | |||||
break; | |||||
case 6: | |||||
int a6 = Array.FindIndex(DeviceInquire.GetInstance.devices.ToArray(), p => p.DeviceNum == 11); | |||||
int b6 = Array.FindIndex(DeviceInquire.GetInstance.devices.ToArray(), p => p.DeviceNum == 12); | |||||
if (a6 >= 0) | |||||
{ | |||||
Location1 = Array.FindIndex(Recipes.ElementAt(i).RawMaterials.ToArray(), p => p.RawMaterialName == DeviceInquire.GetInstance.devices.ElementAt(a6).DeviceName && p.Loc == barrel); | |||||
} | |||||
if (b6 >= 0) | |||||
{ | |||||
Location2 = Array.FindIndex(Recipes.ElementAt(i).RawMaterials.ToArray(), p => p.RawMaterialName == DeviceInquire.GetInstance.devices.ElementAt(b6).DeviceName && p.Loc == barrel); | |||||
} | |||||
break; | |||||
default: | |||||
break; | |||||
} | |||||
} | |||||
if (Location1 >= 0) | |||||
{ | |||||
string RawName = Recipes.ElementAt(i).RawMaterials.ElementAt(Location1).RawMaterialName; | |||||
int abc = Array.FindIndex(DeviceInquire.GetInstance.devices.ToArray(), p => p.DeviceName == RawName); | |||||
int DeviceNum = DeviceInquire.GetInstance.devices.ElementAt(abc).DeviceNum; | |||||
if (DeviceNum > 0) | |||||
{ | |||||
float weight = Recipes.ElementAt(i).RawMaterials.ElementAt(Location1).RawMaterialWeight; | |||||
int loc = Array.FindIndex(Recipes.ElementAt(i).RawMaterials.ToArray(), p => p.RawMaterialName == RawName); | |||||
if (loc >= 0 && RawName != null && weight >= 0) | |||||
{ | { | ||||
StockStatus.Add(new StockStatusModel() | |||||
int St_index = Array.FindIndex(StockStatus.ToArray(), p => p.MaterialName == RawName); | |||||
if (St_index < 0) | |||||
{ | |||||
StockStatus.Add(new StockStatusModel() | |||||
{ | |||||
MaterialName = RawName, | |||||
IssueWeight = weight, | |||||
IssueStatus = 0, | |||||
}); | |||||
} | |||||
St_index = Array.FindIndex(StockStatus.ToArray(), p => p.MaterialName == RawName); | |||||
if (St_index >= 0) | |||||
{ | { | ||||
MaterialName = deviceName, | |||||
IssueWeight = weight, | |||||
IssueStatus = 0, | |||||
}); | |||||
if (recipeProcesses.ElementAt(recIndex).RawMaterials.ElementAt(loc).RecipeStatus == 1 && StockStatus.ElementAt(St_index).IssueStatus == 0) | |||||
{ | |||||
StockStatus.ElementAt(St_index).IssueStatus = 1; | |||||
DeviceInquire.GetInstance.GetDevice(Recipes.ElementAt(i).RawMaterials.ElementAt(loc).DeviceIp).Start(weight); | |||||
MessageNotify.GetInstance.ShowRunLog($"柔性味魔方{Recipes.ElementAt(i).RawMaterials.ElementAt(loc).DeviceIp},开始出料"); | |||||
} | |||||
if (recipeProcesses.ElementAt(recIndex).RawMaterials.ElementAt(loc).RecipeStatus == 3 && StockStatus.ElementAt(St_index).IssueStatus == 1) | |||||
{ | |||||
//GlobalDevice.PlcData.IsAllowIngredients[j] = false;//测试使用 | |||||
StockStatus.ElementAt(St_index).IssueStatus = 2; | |||||
DeviceInquire.GetInstance.GetDevice(Recipes.ElementAt(i).RawMaterials.ElementAt(loc).DeviceIp).StatusReset(); | |||||
int a = 0.SetBitValue((byte)(DeviceNum), true); | |||||
byte[] test1 = a.ToBytes(BPA.Helper.DataFormat.ABCD); | |||||
int item = test1.ToInt(); | |||||
SiemensDevice.GetInstance.MySiemens.Write("DB4.DBD130", item); | |||||
MessageNotify.GetInstance.ShowRunLog($"DB4.DBD130:{item.ToBinString()}"); | |||||
MessageNotify.GetInstance.ShowRunLog($"柔性味魔方{Recipes.ElementAt(i).RawMaterials.ElementAt(loc).DeviceIp},出料完成,状态复位"); | |||||
} | |||||
} | |||||
} | } | ||||
St_index = Array.FindIndex(StockStatus.ToArray(), p => p.MaterialName == deviceName); | |||||
if (St_index >= 0) | |||||
} | |||||
} | |||||
if (Location1 >= 0) | |||||
{ | |||||
string RawName111 = Recipes.ElementAt(i).RawMaterials.ElementAt(Location1).RawMaterialName; | |||||
int St_index111 = Array.FindIndex(StockStatus.ToArray(), p => p.MaterialName == RawName111); | |||||
if (Location2 >= 0 && ((Location1 >= 0 && StockStatus.ElementAt(St_index111).IssueStatus == 2))) | |||||
{ | |||||
string RawName = Recipes.ElementAt(i).RawMaterials.ElementAt(Location2).RawMaterialName; | |||||
int abc = Array.FindIndex(DeviceInquire.GetInstance.devices.ToArray(), p => p.DeviceName == RawName); | |||||
int DeviceNum = DeviceInquire.GetInstance.devices.ElementAt(abc).DeviceNum; | |||||
if (DeviceNum > 0) | |||||
{ | { | ||||
if (recipeProcesses.ElementAt(recIndex).RawMaterials.ElementAt(loc).RecipeStatus == 1 && StockStatus.ElementAt(St_index).IssueStatus == 0) | |||||
float weight = Recipes.ElementAt(i).RawMaterials.ElementAt(Location2).RawMaterialWeight; | |||||
int loc = Array.FindIndex(Recipes.ElementAt(i).RawMaterials.ToArray(), p => p.RawMaterialName == RawName); | |||||
if (loc >= 0 && RawName != null && weight >= 0) | |||||
{ | { | ||||
StockStatus.ElementAt(St_index).IssueStatus = 1; | |||||
DeviceInquire.GetInstance.GetDevice(Recipes.ElementAt(i).RawMaterials.ElementAt(loc).DeviceIp).Start(weight); | |||||
MessageNotify.GetInstance.ShowRunLog($"柔性味魔方{Recipes.ElementAt(i).RawMaterials.ElementAt(loc).DeviceIp},开始出料"); | |||||
int St_index = Array.FindIndex(StockStatus.ToArray(), p => p.MaterialName == RawName); | |||||
if (St_index < 0) | |||||
{ | |||||
StockStatus.Add(new StockStatusModel() | |||||
{ | |||||
MaterialName = RawName, | |||||
IssueWeight = weight, | |||||
IssueStatus = 0, | |||||
}); | |||||
} | |||||
St_index = Array.FindIndex(StockStatus.ToArray(), p => p.MaterialName == RawName); | |||||
if (St_index >= 0) | |||||
{ | |||||
if (recipeProcesses.ElementAt(recIndex).RawMaterials.ElementAt(loc).RecipeStatus == 1 && StockStatus.ElementAt(St_index).IssueStatus == 0) | |||||
{ | |||||
StockStatus.ElementAt(St_index).IssueStatus = 1; | |||||
DeviceInquire.GetInstance.GetDevice(Recipes.ElementAt(i).RawMaterials.ElementAt(loc).DeviceIp).Start(weight); | |||||
MessageNotify.GetInstance.ShowRunLog($"柔性味魔方{Recipes.ElementAt(i).RawMaterials.ElementAt(loc).DeviceIp},开始出料"); | |||||
} | |||||
if (recipeProcesses.ElementAt(recIndex).RawMaterials.ElementAt(loc).RecipeStatus == 3 && StockStatus.ElementAt(St_index).IssueStatus == 1) | |||||
{ | |||||
//GlobalDevice.PlcData.IsAllowIngredients[j] = false;//测试使用 | |||||
StockStatus.ElementAt(St_index).IssueStatus = 2; | |||||
DeviceInquire.GetInstance.GetDevice(Recipes.ElementAt(i).RawMaterials.ElementAt(loc).DeviceIp).StatusReset(); | |||||
int a = 0.SetBitValue((byte)(DeviceNum), true); | |||||
byte[] test1 = a.ToBytes(BPA.Helper.DataFormat.ABCD); | |||||
int item = test1.ToInt(); | |||||
SiemensDevice.GetInstance.MySiemens.Write("DB4.DBD130", item); | |||||
MessageNotify.GetInstance.ShowRunLog($"DB4.DBD130:{item.ToBinString()}"); | |||||
MessageNotify.GetInstance.ShowRunLog($"柔性味魔方{Recipes.ElementAt(i).RawMaterials.ElementAt(loc).DeviceIp},出料完成,状态复位"); | |||||
} | |||||
} | |||||
} | } | ||||
if (recipeProcesses.ElementAt(recIndex).RawMaterials.ElementAt(loc).RecipeStatus == 3 && StockStatus.ElementAt(St_index).IssueStatus == 1) | |||||
} | |||||
} | |||||
} | |||||
else | |||||
{ | |||||
if (Location2 >= 0) | |||||
{ | |||||
string RawName = Recipes.ElementAt(i).RawMaterials.ElementAt(Location2).RawMaterialName; | |||||
int abc = Array.FindIndex(DeviceInquire.GetInstance.devices.ToArray(), p => p.DeviceName == RawName); | |||||
int DeviceNum = DeviceInquire.GetInstance.devices.ElementAt(abc).DeviceNum; | |||||
if (DeviceNum >= 0) | |||||
{ | |||||
float weight = Recipes.ElementAt(i).RawMaterials.ElementAt(Location2).RawMaterialWeight; | |||||
int loc = Array.FindIndex(Recipes.ElementAt(i).RawMaterials.ToArray(), p => p.RawMaterialName == RawName); | |||||
if (cnt > 0 && loc >= 0 && RawName != null && weight >= 0) | |||||
{ | { | ||||
GlobalDevice.PlcData.IsAllowIngredients[j] = false;//测试使用 | |||||
StockStatus.ElementAt(St_index).IssueStatus = 2; | |||||
DeviceInquire.GetInstance.GetDevice(Recipes.ElementAt(i).RawMaterials.ElementAt(loc).DeviceIp).StatusReset(); | |||||
SiemensDevice.GetInstance.MySiemens.Write("DB4.DBD130", 0.SetBitValue((byte)loc, true)); | |||||
MessageNotify.GetInstance.ShowRunLog($"柔性味魔方{Recipes.ElementAt(i).RawMaterials.ElementAt(loc).DeviceIp},出料完成,状态复位"); | |||||
int St_index = Array.FindIndex(StockStatus.ToArray(), p => p.MaterialName == RawName); | |||||
if (St_index < 0) | |||||
{ | |||||
StockStatus.Add(new StockStatusModel() | |||||
{ | |||||
MaterialName = RawName, | |||||
IssueWeight = weight, | |||||
IssueStatus = 0, | |||||
}); | |||||
} | |||||
St_index = Array.FindIndex(StockStatus.ToArray(), p => p.MaterialName == RawName); | |||||
if (St_index >= 0) | |||||
{ | |||||
if (recipeProcesses.ElementAt(recIndex).RawMaterials.ElementAt(loc).RecipeStatus == 1 && StockStatus.ElementAt(St_index).IssueStatus == 0) | |||||
{ | |||||
StockStatus.ElementAt(St_index).IssueStatus = 1; | |||||
DeviceInquire.GetInstance.GetDevice(Recipes.ElementAt(i).RawMaterials.ElementAt(loc).DeviceIp).Start(weight); | |||||
MessageNotify.GetInstance.ShowRunLog($"柔性味魔方{Recipes.ElementAt(i).RawMaterials.ElementAt(loc).DeviceIp},开始出料"); | |||||
} | |||||
if (recipeProcesses.ElementAt(recIndex).RawMaterials.ElementAt(loc).RecipeStatus == 3 && StockStatus.ElementAt(St_index).IssueStatus == 1) | |||||
{ | |||||
//GlobalDevice.PlcData.IsAllowIngredients[j] = false;//测试使用 | |||||
StockStatus.ElementAt(St_index).IssueStatus = 2; | |||||
DeviceInquire.GetInstance.GetDevice(Recipes.ElementAt(i).RawMaterials.ElementAt(loc).DeviceIp).StatusReset(); | |||||
int a = 0.SetBitValue((byte)(DeviceNum), true); | |||||
byte[] test1 = a.ToBytes(BPA.Helper.DataFormat.ABCD); | |||||
int item = test1.ToInt(); | |||||
SiemensDevice.GetInstance.MySiemens.Write("DB4.DBD130", item); | |||||
MessageNotify.GetInstance.ShowRunLog($"DB4.DBD130:{item.ToBinString()}"); | |||||
MessageNotify.GetInstance.ShowRunLog($"柔性味魔方{Recipes.ElementAt(i).RawMaterials.ElementAt(loc).DeviceIp},出料完成,状态复位"); | |||||
} | |||||
} | |||||
} | } | ||||
} | } | ||||
} | } | ||||
@@ -298,7 +515,8 @@ namespace BPASmartClient.DosingSystem.ViewModel | |||||
if (StockStatus.Count >= Recipes.ElementAt(i).RawMaterials.Count && Finish_Count >= Recipes.ElementAt(i).RawMaterials.Count) //配方配料完成 | if (StockStatus.Count >= Recipes.ElementAt(i).RawMaterials.Count && Finish_Count >= Recipes.ElementAt(i).RawMaterials.Count) //配方配料完成 | ||||
{ | { | ||||
StockStatus.Clear(); | StockStatus.Clear(); | ||||
SiemensDevice.GetInstance.MySiemens.Write("DB4.DBX202.1", true);//配方使用桶数写入 | |||||
SiemensDevice.GetInstance.MySiemens.Write("DB4.DBX202.1", true);//配料完成 | |||||
MessageNotify.GetInstance.ShowRunLog($"配料完成"); | |||||
int recipIndex = Array.FindIndex(Recipes.ToArray(), p => p.RecipeName == CurrentRecipeName); | int recipIndex = Array.FindIndex(Recipes.ToArray(), p => p.RecipeName == CurrentRecipeName); | ||||
App.Current.Dispatcher.Invoke(new Action(() => { recipeProcesses.Clear(); })); | App.Current.Dispatcher.Invoke(new Action(() => { recipeProcesses.Clear(); })); | ||||
Recipes.ElementAt(recipIndex).IsEnable = true; | Recipes.ElementAt(recipIndex).IsEnable = true; | ||||
@@ -72,16 +72,9 @@ namespace BPASmartClient.DosingSystem.ViewModel | |||||
var res = Json<LocaPar>.Data.Recipes.FirstOrDefault(p => p.RecipeName == o.ToString()); | var res = Json<LocaPar>.Data.Recipes.FirstOrDefault(p => p.RecipeName == o.ToString()); | ||||
if (res != null) | if (res != null) | ||||
{ | { | ||||
if (res.IsEnable) | |||||
{ | |||||
NewRecipeView nrv = new NewRecipeView(); | |||||
ActionManage.GetInstance.Send("Details", res); | |||||
nrv.ShowDialog(); | |||||
} | |||||
else | |||||
{ | |||||
NoticeDemoViewModel.OpenMsg(EnumPromptType.Error, App.MainWindow, "提示", $"编辑【{o.ToString()}】配方失败,配方正在使用!"); | |||||
} | |||||
NewRecipeView nrv = new NewRecipeView(); | |||||
ActionManage.GetInstance.Send("Details", res); | |||||
nrv.ShowDialog(); | |||||
} | } | ||||
//MessageLog.GetInstance.ShowUserLog($"编辑配方名称——{res.RecipeName}"); | //MessageLog.GetInstance.ShowUserLog($"编辑配方名称——{res.RecipeName}"); | ||||
} | } | ||||
@@ -28,7 +28,6 @@ namespace BPASmartClient.DosingSystem.ViewModel | |||||
// } | // } | ||||
// }); | // }); | ||||
//}); | //}); | ||||
statusTop = DeviceInquire.GetInstance.TopDeviceCurrentStatuses; | statusTop = DeviceInquire.GetInstance.TopDeviceCurrentStatuses; | ||||
statusDown = DeviceInquire.GetInstance.BottomDeviceCurrentStatuses; | statusDown = DeviceInquire.GetInstance.BottomDeviceCurrentStatuses; | ||||
@@ -0,0 +1,13 @@ | |||||
{ | |||||
"compilerOptions": { | |||||
"noImplicitAny": false, | |||||
"noEmitOnError": true, | |||||
"removeComments": false, | |||||
"sourceMap": true, | |||||
"target": "es5" | |||||
}, | |||||
"exclude": [ | |||||
"node_modules", | |||||
"wwwroot" | |||||
] | |||||
} |