@@ -78,6 +78,13 @@ namespace BPASmartClient.DosingHKProject.Model | |||||
public HKPlcCommRead plcRead = new HKPlcCommRead(); | public HKPlcCommRead plcRead = new HKPlcCommRead(); | ||||
public HKPlcCommWrite plcWrite = new HKPlcCommWrite(); | public HKPlcCommWrite plcWrite = new HKPlcCommWrite(); | ||||
/// <summary> | |||||
/// 0:无意义,1=load位,2=1号位,3=2号位,4=3号位,5=4号位,6=5号位,7=6号位,8=unload位 | |||||
/// </summary> | |||||
public int[] Barrel_Location = new int[MaxBarrelNum]; | |||||
public bool[] AllowDosing_Pos = new bool[MaxBarrelNum]; | |||||
public bool[] AllowDosing_Sign = new bool[MaxBarrelNum]; | |||||
public const int MaxBarrelNum = 6; | |||||
#region 本地模拟配方 | #region 本地模拟配方 | ||||
/// <summary> | /// <summary> | ||||
/// 是否使用本地模拟配方 | /// 是否使用本地模拟配方 | ||||
@@ -188,6 +188,16 @@ namespace BPASmartClient.DosingHKProject.Model | |||||
GVL_SmallStation.GetInstance.RecipeStatusID = 0; | GVL_SmallStation.GetInstance.RecipeStatusID = 0; | ||||
} | } | ||||
} | } | ||||
int cnt_sensor1 = 0; | |||||
int cnt_sensor2 = 0; | |||||
int cnt_sensor3 = 0; | |||||
int cnt_sensor4 = 0; | |||||
int cnt_sensor5 = 0; | |||||
int cnt_sensor6 = 0; | |||||
int cnt_sensor7 = 0; | |||||
int cnt_sensor8 = 0; | |||||
int barrel1 = 0; | |||||
/// <summary> | /// <summary> | ||||
/// 执行配方队列中的第一个配方 | /// 执行配方队列中的第一个配方 | ||||
/// </summary> | /// </summary> | ||||
@@ -199,12 +209,214 @@ namespace BPASmartClient.DosingHKProject.Model | |||||
if (index >= 0 && index < RemoteRecipes.Count) | if (index >= 0 && index < RemoteRecipes.Count) | ||||
{ | { | ||||
string code = RemoteRecipes.ElementAt(index).RecipeCode; | string code = RemoteRecipes.ElementAt(index).RecipeCode; | ||||
int trayCode = RemoteRecipes.ElementAt(index).TrayCode; | |||||
string recipeName = RemoteRecipes.ElementAt(index).RecipeName; | string recipeName = RemoteRecipes.ElementAt(index).RecipeName; | ||||
string windSend = RemoteRecipes.ElementAt(index).ToString(); | |||||
#region sensor处理 | |||||
if (GVL_SmallStation.GetInstance.plcRead.Sensor_Load) | |||||
{ | |||||
cnt_sensor1++; | |||||
} | |||||
else | |||||
{ | |||||
if (cnt_sensor1 >= 50) | |||||
{ | |||||
if (barrel1 >= 0 && barrel1 < GVL_SmallStation.MaxBarrelNum) | |||||
{ | |||||
if (GVL_SmallStation.GetInstance.Barrel_Location[barrel1] == 0) | |||||
{ | |||||
GVL_SmallStation.GetInstance.Barrel_Location[barrel1] = 1; | |||||
barrel1++; | |||||
} | |||||
} | |||||
else | |||||
{ | |||||
//报错,超过最大的桶号数 | |||||
} | |||||
} | |||||
cnt_sensor1 = 0; | |||||
} | |||||
if (GVL_SmallStation.GetInstance.plcRead.Sensor_Station1) | |||||
{ | |||||
cnt_sensor2++; | |||||
} | |||||
else | |||||
{ | |||||
if (cnt_sensor2 >= 50) | |||||
{ | |||||
for (int i = 0; i < GVL_SmallStation.GetInstance.Barrel_Location.Length; i++) | |||||
{ | |||||
if (GVL_SmallStation.GetInstance.Barrel_Location[i] == 1) | |||||
{ | |||||
GVL_SmallStation.GetInstance.Barrel_Location[i] = 2; | |||||
} | |||||
} | |||||
} | |||||
cnt_sensor2 = 0; | |||||
} | |||||
if (GVL_SmallStation.GetInstance.plcRead.Sensor_Station2) | |||||
{ | |||||
cnt_sensor3++; | |||||
} | |||||
else | |||||
{ | |||||
if (cnt_sensor3 >= 50) | |||||
{ | |||||
for (int i = 0; i < GVL_SmallStation.GetInstance.Barrel_Location.Length; i++) | |||||
{ | |||||
if (GVL_SmallStation.GetInstance.Barrel_Location[i] == 2) | |||||
{ | |||||
GVL_SmallStation.GetInstance.Barrel_Location[i] = 3; | |||||
} | |||||
} | |||||
} | |||||
cnt_sensor3 = 0; | |||||
} | |||||
if (GVL_SmallStation.GetInstance.plcRead.Sensor_Station3) | |||||
{ | |||||
cnt_sensor4++; | |||||
} | |||||
else | |||||
{ | |||||
if (cnt_sensor4 >= 50) | |||||
{ | |||||
for (int i = 0; i < GVL_SmallStation.GetInstance.Barrel_Location.Length; i++) | |||||
{ | |||||
if (GVL_SmallStation.GetInstance.Barrel_Location[i] == 3) | |||||
{ | |||||
GVL_SmallStation.GetInstance.Barrel_Location[i] = 4; | |||||
} | |||||
} | |||||
} | |||||
cnt_sensor4 = 0; | |||||
} | |||||
if (GVL_SmallStation.GetInstance.plcRead.Sensor_Station4) | |||||
{ | |||||
cnt_sensor5++; | |||||
} | |||||
else | |||||
{ | |||||
if (cnt_sensor5 >= 50) | |||||
{ | |||||
for (int i = 0; i < GVL_SmallStation.GetInstance.Barrel_Location.Length; i++) | |||||
{ | |||||
if (GVL_SmallStation.GetInstance.Barrel_Location[i] == 4) | |||||
{ | |||||
GVL_SmallStation.GetInstance.Barrel_Location[i] = 5; | |||||
} | |||||
} | |||||
} | |||||
cnt_sensor5 = 0; | |||||
} | |||||
if (GVL_SmallStation.GetInstance.plcRead.Sensor_Station5) | |||||
{ | |||||
cnt_sensor6++; | |||||
} | |||||
else | |||||
{ | |||||
if (cnt_sensor6 >= 50) | |||||
{ | |||||
for (int i = 0; i < GVL_SmallStation.GetInstance.Barrel_Location.Length; i++) | |||||
{ | |||||
if (GVL_SmallStation.GetInstance.Barrel_Location[i] == 5) | |||||
{ | |||||
GVL_SmallStation.GetInstance.Barrel_Location[i] = 6; | |||||
} | |||||
} | |||||
} | |||||
cnt_sensor6 = 0; | |||||
} | |||||
if (GVL_SmallStation.GetInstance.plcRead.Sensor_Station6) | |||||
{ | |||||
cnt_sensor7++; | |||||
} | |||||
else | |||||
{ | |||||
if (cnt_sensor7 >= 50) | |||||
{ | |||||
for (int i = 0; i < GVL_SmallStation.GetInstance.Barrel_Location.Length; i++) | |||||
{ | |||||
if (GVL_SmallStation.GetInstance.Barrel_Location[i] == 6) | |||||
{ | |||||
GVL_SmallStation.GetInstance.Barrel_Location[i] = 7; | |||||
} | |||||
} | |||||
} | |||||
cnt_sensor7 = 0; | |||||
} | |||||
if (GVL_SmallStation.GetInstance.plcRead.Sensor_Unload) | |||||
{ | |||||
HKDevice.HK_PLC_S7.Write<bool>("DB2.DBX3.0", false); | |||||
HKDevice.HK_PLC_S7.Write<bool>("DB2.DBX3.1", false); | |||||
MessageLog.GetInstance.ShowRunLog($"下料桶堵料,线体不运行"); | |||||
cnt_sensor8++; | |||||
} | |||||
else | |||||
{ | |||||
if (cnt_sensor8 >= 50) | |||||
{ | |||||
for (int i = 0; i < GVL_SmallStation.GetInstance.Barrel_Location.Length; i++) | |||||
{ | |||||
if (GVL_SmallStation.GetInstance.Barrel_Location[i] == 7) | |||||
{ | |||||
GVL_SmallStation.GetInstance.Barrel_Location[i] = 0; | |||||
} | |||||
} | |||||
} | |||||
cnt_sensor8 = 0; | |||||
} | |||||
#endregion | |||||
for (int i = 0; i < GVL_SmallStation.GetInstance.Barrel_Location.Length; i++) | |||||
{ | |||||
if (GVL_SmallStation.GetInstance.plcRead.Sensor_Station1 && GVL_SmallStation.GetInstance.Barrel_Location[i] == 1) | |||||
{ | |||||
foreach (var item in RemoteRecipes.ElementAt(index).RawMaterial) | |||||
{ | |||||
if ((item.RawMaterialLocation == i+1 || item.RawMaterialLocation == i+7) && item.IsDosingFinish == false && item.RawMaterialBarrelNum == i+1) | |||||
{ | |||||
GVL_SmallStation.GetInstance.AllowDosing_Pos[i] = true; | |||||
} | |||||
} | |||||
} | |||||
} | |||||
if (GVL_SmallStation.GetInstance.plcRead.Sensor_Station1 && GVL_SmallStation.GetInstance.Barrel_Location[0] == 1) | |||||
{ | |||||
foreach (var item in RemoteRecipes.ElementAt(index).RawMaterial) | |||||
{ | |||||
if ((item.RawMaterialLocation == 1 || item.RawMaterialLocation == 7) && item.IsDosingFinish == false && item.RawMaterialBarrelNum == 1) | |||||
{ | |||||
GVL_SmallStation.GetInstance.AllowDosing_Pos[0] = true; | |||||
} | |||||
} | |||||
} | |||||
if (GVL_SmallStation.GetInstance.plcRead.Sensor_Station2 && GVL_SmallStation.GetInstance.Barrel_Location[1] == 1) | |||||
{ | |||||
GVL_SmallStation.GetInstance.AllowDosing_Pos[1] = true; | |||||
} | |||||
if (GVL_SmallStation.GetInstance.plcRead.Sensor_Station3 && GVL_SmallStation.GetInstance.Barrel_Location[2] == 1) | |||||
{ | |||||
GVL_SmallStation.GetInstance.AllowDosing_Pos[2] = true; | |||||
} | |||||
if (GVL_SmallStation.GetInstance.plcRead.Sensor_Station4 && GVL_SmallStation.GetInstance.Barrel_Location[3] == 1) | |||||
{ | |||||
GVL_SmallStation.GetInstance.AllowDosing_Pos[3] = true; | |||||
} | |||||
if (GVL_SmallStation.GetInstance.plcRead.Sensor_Station5 && GVL_SmallStation.GetInstance.Barrel_Location[4] == 1) | |||||
{ | |||||
GVL_SmallStation.GetInstance.AllowDosing_Pos[4] = true; | |||||
} | |||||
if (GVL_SmallStation.GetInstance.plcRead.Sensor_Station6 && GVL_SmallStation.GetInstance.Barrel_Location[5] == 1) | |||||
{ | |||||
GVL_SmallStation.GetInstance.AllowDosing_Pos[5] = true; | |||||
} | |||||
foreach (var item in RemoteRecipes.ElementAt(index).RawMaterial) | |||||
{ | |||||
} | |||||
if (GVL_SmallStation.GetInstance.RecipeStatusID == 0) | if (GVL_SmallStation.GetInstance.RecipeStatusID == 0) | ||||
{ | { | ||||
RunInit(); | |||||
if (RunInit() == 1) | |||||
{ | |||||
GVL_SmallStation.GetInstance.RecipeStatusID = 1; | |||||
} | |||||
} | } | ||||
if (GVL_SmallStation.GetInstance.RecipeStatusID == 1) | if (GVL_SmallStation.GetInstance.RecipeStatusID == 1) | ||||
{ | { | ||||
@@ -214,28 +426,29 @@ namespace BPASmartClient.DosingHKProject.Model | |||||
} | } | ||||
if (HKDevice.HK_PLC_S7.Read<bool>("DB2.DBX3.0") && HKDevice.HK_PLC_S7.Read<bool>("DB2.DBX3.1") && GVL_SmallStation.GetInstance.RecipeStatusID == 2) | if (HKDevice.HK_PLC_S7.Read<bool>("DB2.DBX3.0") && HKDevice.HK_PLC_S7.Read<bool>("DB2.DBX3.1") && GVL_SmallStation.GetInstance.RecipeStatusID == 2) | ||||
{ | { | ||||
if (GVL_SmallStation.GetInstance.plcRead.Sensor_Load) | |||||
{ | |||||
} | |||||
GVL_SmallStation.GetInstance.RecipeStatusID = 3; | |||||
} | } | ||||
if (GVL_SmallStation.GetInstance.RecipeStatusID == 3) | if (GVL_SmallStation.GetInstance.RecipeStatusID == 3) | ||||
{ | { | ||||
if (RTrig.GetInstance("DB3.DBX50.0").Start(HKDevice.HK_PLC_S7.Read<bool>("DB3.DBX50.0"))) | |||||
for (int i = 0; i < 6; i++) | |||||
{ | { | ||||
var res = HKDevice.HK_PLC_S7.Read<float>("DB3.DBD10"); | |||||
MessageLog.GetInstance.ShowRunLog($"托盘1,配方:{recipeName},1号桶,{res}料仓,允许配料"); | |||||
if (res > 0 && res is float loc) | |||||
} | |||||
if (GVL_SmallStation.GetInstance.AllowDosing_Pos[0]) | |||||
{ | |||||
int res = 1; | |||||
MessageLog.GetInstance.ShowRunLog($"配方:{recipeName},1号桶,{res}料仓,允许配料"); | |||||
if (res > 0 ) | |||||
{ | { | ||||
int loc_index = Array.FindIndex(RemoteRecipes.ElementAt(index).RawMaterial.ToArray(), p => p.RawMaterialLocation == loc); | |||||
int loc_index = Array.FindIndex(RemoteRecipes.ElementAt(index).RawMaterial.ToArray(), p => p.RawMaterialLocation == res); | |||||
float weight = RemoteRecipes.ElementAt(index).RawMaterial.ElementAt(loc_index).RawMaterialWeight; | float weight = RemoteRecipes.ElementAt(index).RawMaterial.ElementAt(loc_index).RawMaterialWeight; | ||||
if (loc_index >= 0) | if (loc_index >= 0) | ||||
{ | { | ||||
DeviceInquire.GetInstance.GetDevice((int)loc)?.Start(weight);//根据料仓编号 启动并写入每个原料重量 | |||||
GVL_SmallStation.GetInstance.StockInIsWork = (int)loc; | |||||
DeviceInquire.GetInstance.GetDevice((int)res)?.Start(weight);//根据料仓编号 启动并写入每个原料重量 | |||||
GVL_SmallStation.GetInstance.StockInIsWork = (int)res; | |||||
} | } | ||||
GVL_SmallStation.GetInstance.DosingTray1 = true; | GVL_SmallStation.GetInstance.DosingTray1 = true; | ||||
MessageLog.GetInstance.ShowRunLog($"托盘1,配方:{recipeName},1号桶,{(int)loc}号仓,配料完成"); | |||||
MessageLog.GetInstance.ShowRunLog($"托盘1,配方:{recipeName},1号桶,{(int)res}号仓,配料完成"); | |||||
} | } | ||||
} | } | ||||
else if(RTrig.GetInstance("DB3.DBX50.1").Start(HKDevice.HK_PLC_S7.Read<bool>("DB3.DBX50.1"))) | else if(RTrig.GetInstance("DB3.DBX50.1").Start(HKDevice.HK_PLC_S7.Read<bool>("DB3.DBX50.1"))) | ||||
@@ -21,12 +21,6 @@ namespace BPASmartClient.DosingHKProject.Model | |||||
/// </summary> | /// </summary> | ||||
public string RecipeCode { get { return _mRecipeCode; } set { _mRecipeCode = value;OnPropertyChanged(); } } | public string RecipeCode { get { return _mRecipeCode; } set { _mRecipeCode = value;OnPropertyChanged(); } } | ||||
private string _mRecipeCode; | private string _mRecipeCode; | ||||
/// <summary> | |||||
/// 托盘编号 | |||||
/// </summary> | |||||
public int TrayCode { get { return _mTrayCode; } set { _mTrayCode = value; OnPropertyChanged(); } } | |||||
private int _mTrayCode; | |||||
/// <summary> | /// <summary> | ||||
/// 原料数据 | /// 原料数据 | ||||
@@ -44,5 +44,8 @@ namespace BPASmartClient.DosingHKProject.Model | |||||
/// </summary> | /// </summary> | ||||
public int RawMaterialLocation { get { return _mRawMaterialLocation; } set { _mRawMaterialLocation = value;OnPropertyChanged(); } } | public int RawMaterialLocation { get { return _mRawMaterialLocation; } set { _mRawMaterialLocation = value;OnPropertyChanged(); } } | ||||
private int _mRawMaterialLocation; | private int _mRawMaterialLocation; | ||||
public bool IsDosingFinish { get { return _mDosingFinish; } set { _mDosingFinish = value; } } | |||||
private bool _mDosingFinish; | |||||
} | } | ||||
} | } |
@@ -29,7 +29,7 @@ namespace BPASmartClient.JXJFoodSmallStation | |||||
MenuInit(); | MenuInit(); | ||||
DataInit(); | DataInit(); | ||||
DeviceInquire.GetInstance.Init();//配料机设备上线监听,设备列表初始化 | DeviceInquire.GetInstance.Init();//配料机设备上线监听,设备列表初始化 | ||||
// ProcessControl.GetInstance.Init(); | |||||
ProcessControl.GetInstance.Init(); | |||||
MainView mv = new MainView(); | MainView mv = new MainView(); | ||||
LoginView lv = new LoginView(); | LoginView lv = new LoginView(); | ||||
var res = lv.ShowDialog(); | var res = lv.ShowDialog(); | ||||
@@ -47,6 +47,7 @@ namespace BPASmartClient.JXJFoodSmallStation | |||||
{ | { | ||||
base.OnExit(e); | base.OnExit(e); | ||||
Json<LocaPar>.Save(); | Json<LocaPar>.Save(); | ||||
Json<LocalRecipeDataColl>.Save(); | |||||
MessageLog.GetInstance.LogSave(); | MessageLog.GetInstance.LogSave(); | ||||
ThreadManage.GetInstance().Dispose(); | ThreadManage.GetInstance().Dispose(); | ||||
} | } | ||||
@@ -258,6 +259,7 @@ namespace BPASmartClient.JXJFoodSmallStation | |||||
Json<LocaPar>.Read(); | Json<LocaPar>.Read(); | ||||
Json<DevicePar>.Read(); | Json<DevicePar>.Read(); | ||||
Json<WindSendDevicePar>.Read(); | Json<WindSendDevicePar>.Read(); | ||||
Json<LocalRecipeDataColl>.Read(); | |||||
} | } | ||||
} | } | ||||
@@ -7,6 +7,7 @@ using System.Text; | |||||
using System.Threading.Tasks; | using System.Threading.Tasks; | ||||
using BPASmartClient.S7Net; | using BPASmartClient.S7Net; | ||||
using BPASmartClient.CustomResource.Pages.Model; | using BPASmartClient.CustomResource.Pages.Model; | ||||
using System.Threading; | |||||
namespace BPASmartClient.JXJFoodSmallStation.Model.HK_PLC | namespace BPASmartClient.JXJFoodSmallStation.Model.HK_PLC | ||||
{ | { | ||||
@@ -20,7 +21,11 @@ namespace BPASmartClient.JXJFoodSmallStation.Model.HK_PLC | |||||
{ | { | ||||
ThreadManage.GetInstance().StartLong(new Action(() => | ThreadManage.GetInstance().StartLong(new Action(() => | ||||
{ | { | ||||
if (!IsConnected) | |||||
{ | |||||
MessageLog.GetInstance.ShowRunLog("海科PLC断开连接"); | |||||
} | |||||
Thread.Sleep(10); | |||||
}),"信号收发处理"); | }),"信号收发处理"); | ||||
} | } | ||||
} | } | ||||
@@ -752,7 +752,7 @@ namespace BPASmartClient.JXJFoodSmallStation.Model | |||||
{ | { | ||||
for (int i = 1; i < 16; i++) | for (int i = 1; i < 16; i++) | ||||
{ | { | ||||
if (RTrig.GetInstance("GetDeviceRunStatus").Start(DeviceInquire.GetInstance.GetDevice(i).deviceStatus.RunStatus == 3)) | |||||
if (RTrig.GetInstance("Tray1StatusDevice" + i).Start(DeviceInquire.GetInstance.GetDevice(i).deviceStatus.RunStatus == 3)) | |||||
{ | { | ||||
MessageLog.GetInstance.ShowRunLog($"柔性味魔方,托盘1,配方:{recipeName},{i}号仓,配料完成"); | MessageLog.GetInstance.ShowRunLog($"柔性味魔方,托盘1,配方:{recipeName},{i}号仓,配料完成"); | ||||
int res = Array.FindIndex(RemoteRecipes.ElementAt(index).RawMaterial.ToArray(), p => p.RawMaterialLocation == i); | int res = Array.FindIndex(RemoteRecipes.ElementAt(index).RawMaterial.ToArray(), p => p.RawMaterialLocation == i); | ||||
@@ -884,7 +884,6 @@ namespace BPASmartClient.JXJFoodSmallStation.Model | |||||
} | } | ||||
GVL_SmallStation.GetInstance.DosingTray2 = true; | GVL_SmallStation.GetInstance.DosingTray2 = true; | ||||
MessageLog.GetInstance.ShowRunLog($"托盘2,配方:{recipeName},3号桶,{(int)loc}号仓,配料完成"); | MessageLog.GetInstance.ShowRunLog($"托盘2,配方:{recipeName},3号桶,{(int)loc}号仓,配料完成"); | ||||
} | } | ||||
} | } | ||||
else if (RTrig.GetInstance("DB3.DBX50.7").Start(HKDevice.HK_PLC_S7.Read<bool>("DB3.DBX50.7"))) | else if (RTrig.GetInstance("DB3.DBX50.7").Start(HKDevice.HK_PLC_S7.Read<bool>("DB3.DBX50.7"))) | ||||
@@ -905,11 +904,11 @@ namespace BPASmartClient.JXJFoodSmallStation.Model | |||||
MessageLog.GetInstance.ShowRunLog($"托盘2,配方:{recipeName},4号桶,{(int)loc}号仓,配料完成"); | MessageLog.GetInstance.ShowRunLog($"托盘2,配方:{recipeName},4号桶,{(int)loc}号仓,配料完成"); | ||||
} | } | ||||
} | } | ||||
if (GVL_SmallStation.GetInstance.DosingTray2 == true) | |||||
if (GVL_SmallStation.GetInstance.DosingTray2 == true) | |||||
{ | { | ||||
for (int i = 1; i < 16; i++) | for (int i = 1; i < 16; i++) | ||||
{ | { | ||||
if (RTrig.GetInstance("柔性味魔方配料完成").Start(DeviceInquire.GetInstance.GetDevice(i).deviceStatus.RunStatus == 3)) | |||||
if (RTrig.GetInstance("Tray2StatusDevice" + i).Start(DeviceInquire.GetInstance.GetDevice(i).deviceStatus.RunStatus == 3)) | |||||
{ | { | ||||
MessageLog.GetInstance.ShowRunLog($"柔性味魔方,托盘2,配方:{recipeName},{i}号仓,配料完成"); | MessageLog.GetInstance.ShowRunLog($"柔性味魔方,托盘2,配方:{recipeName},{i}号仓,配料完成"); | ||||
int res = Array.FindIndex(RemoteRecipes.ElementAt(index).RawMaterial.ToArray(), p => p.RawMaterialLocation == i); | int res = Array.FindIndex(RemoteRecipes.ElementAt(index).RawMaterial.ToArray(), p => p.RawMaterialLocation == i); | ||||
@@ -930,7 +929,7 @@ namespace BPASmartClient.JXJFoodSmallStation.Model | |||||
if (RTrig.GetInstance("DB3.DBX1.2").Start(HKDevice.HK_PLC_S7.Read<bool>("DB3.DBX1.2"))) | if (RTrig.GetInstance("DB3.DBX1.2").Start(HKDevice.HK_PLC_S7.Read<bool>("DB3.DBX1.2"))) | ||||
{ | { | ||||
var res = Json<RemoteRecipeDataColl>.Data.Recipes.FirstOrDefault(p => p.RecipeCode == code); | var res = Json<RemoteRecipeDataColl>.Data.Recipes.FirstOrDefault(p => p.RecipeCode == code); | ||||
MessageLog.GetInstance.ShowRunLog($"托盘2配方{res.RecipeName}配料完成"); | |||||
MessageLog.GetInstance.ShowRunLog($"托盘2,配方{res.RecipeName},配料完成"); | |||||
RecipeFinishInfo.Order_No = RemoteRecipes.ElementAt(index).RecipeCode; | RecipeFinishInfo.Order_No = RemoteRecipes.ElementAt(index).RecipeCode; | ||||
RecipeFinishInfo.Product_Code = RemoteRecipes.ElementAt(index).RecipeName; | RecipeFinishInfo.Product_Code = RemoteRecipes.ElementAt(index).RecipeName; | ||||
for (int i = 0; i < RemoteRecipes.ElementAt(index).RawMaterial.Count; i++) | for (int i = 0; i < RemoteRecipes.ElementAt(index).RawMaterial.Count; i++) | ||||
@@ -958,5 +957,24 @@ namespace BPASmartClient.JXJFoodSmallStation.Model | |||||
} | } | ||||
} | } | ||||
} | } | ||||
private void DosingDevice(int Index,int DeviceID) | |||||
{ | |||||
if (RTrig.GetInstance("Tray2StatusDevice" + DeviceID).Start(DeviceInquire.GetInstance.GetDevice(DeviceID).deviceStatus.RunStatus == 3)) | |||||
{ | |||||
MessageLog.GetInstance.ShowRunLog($"柔性味魔方,托盘2,配方:{RemoteRecipes.ElementAt(Index).RecipeName},{DeviceID}号仓,配料完成"); | |||||
int res = Array.FindIndex(RemoteRecipes.ElementAt(Index).RawMaterial.ToArray(), p => p.RawMaterialLocation == DeviceID); | |||||
RemoteRecipes.ElementAt(Index).RawMaterial.ElementAt(res).Laying_Off_Weight = DeviceInquire.GetInstance.GetDevice(DeviceID).deviceStatus.CutWeightFeedback; | |||||
DeviceInquire.GetInstance.GetDevice(DeviceID).StatusReset(); | |||||
if (DeviceID >= 1 && DeviceID <= 8) | |||||
{ | |||||
HKDevice.HK_PLC_S7.Write("DB4.DBX30." + (DeviceID - 1), true); | |||||
} | |||||
else if (DeviceID >= 9 && DeviceID <= 15) | |||||
{ | |||||
HKDevice.HK_PLC_S7.Write("DB4.DBX31." + (DeviceID - 9), true); | |||||
} | |||||
} | |||||
} | |||||
} | } | ||||
} | } |
@@ -76,9 +76,16 @@ namespace BPASmartClient.JXJFoodSmallStation.ViewModel | |||||
if (o != null && o is string cnt) | if (o != null && o is string cnt) | ||||
{ | { | ||||
var res = Json<LocalRecipeDataColl>.Data.Recipes.FirstOrDefault(p => p.RecipeCode == cnt); | var res = Json<LocalRecipeDataColl>.Data.Recipes.FirstOrDefault(p => p.RecipeCode == cnt); | ||||
if (res != null) | |||||
var res1 = Json<RemoteRecipeDataColl>.Data.Recipes.FirstOrDefault(p => p.RecipeCode == cnt); | |||||
if (res1 != null) | |||||
{ | |||||
NoticeDemoViewModel.OpenMsg(EnumPromptType.Error, App.MainWindow, "错误", $"远程已经存在该配方!"); | |||||
return; | |||||
} | |||||
if (res != null && res1 ==null) | |||||
{ | { | ||||
ActionManage.GetInstance.Send("LocalSimulationRecipeIssue", res); | ActionManage.GetInstance.Send("LocalSimulationRecipeIssue", res); | ||||
NoticeDemoViewModel.OpenMsg(EnumPromptType.Success, App.MainWindow, "提示", $"{res.RecipeName}配方下发成功!"); | |||||
MessageLog.GetInstance.ShowUserLog($"下发本地模拟配方——{res.RecipeName}"); | MessageLog.GetInstance.ShowUserLog($"下发本地模拟配方——{res.RecipeName}"); | ||||
} | } | ||||
} | } | ||||
@@ -44,6 +44,10 @@ namespace BPASmartClient.JXJFoodSmallStation.ViewModel | |||||
} | } | ||||
} | } | ||||
}); | }); | ||||
ClearAllRecipe = new RelayCommand(() => | |||||
{ | |||||
Json<RemoteRecipeDataColl>.Data.Recipes.Clear(); | |||||
}); | |||||
} | } | ||||
public RelayCommand<object> DetailsCommand { get; set; } | public RelayCommand<object> DetailsCommand { get; set; } | ||||
public RelayCommand ClearAllRecipe { get; set; } | public RelayCommand ClearAllRecipe { get; set; } | ||||
@@ -60,7 +60,10 @@ namespace BPASmartClient.S7Net | |||||
public void Write<TValue>(string address, TValue value) | public void Write<TValue>(string address, TValue value) | ||||
{ | { | ||||
if (IsConnected) myPlc?.Write(address, value); | |||||
if (IsConnected) | |||||
{ | |||||
myPlc?.Write(address, value); | |||||
} | |||||
} | } | ||||
public TResult ReadClass<TResult>(int db, int startByteAdr = 0) where TResult : class, new() | public TResult ReadClass<TResult>(int db, int startByteAdr = 0) where TResult : class, new() | ||||