@@ -147,8 +147,8 @@ namespace BPASmartClient.AGV | |||
//url = url + "?sign=" + MD5Deal(body); | |||
string data = HttpRequest(url, head, body).Replace('[', ' ').Replace(']', ' '); | |||
object objData = JsonConvert.DeserializeObject(data); | |||
string data = HttpRequest(url, head, body).Replace("[", "").Replace("]", ""); | |||
object objData = JsonConvert.DeserializeObject<HttpResponseBodyModel>(data); | |||
if (objData != null && objData is HttpResponseBodyModel response) | |||
{ | |||
return response.code; | |||
@@ -210,8 +210,8 @@ namespace BPASmartClient.AGV | |||
//string body = JsonConvert.SerializeObject(httpModel); | |||
//启用签名 | |||
//url = url + "?sign=" + MD5Deal(body); | |||
string data = HttpRequest(url, head, body).Replace('[', ' ').Replace(']', ' '); | |||
string data = HttpRequest(url, head, body).Replace("[", "").Replace("]", ""); | |||
var objData = JsonConvert.DeserializeObject<HttpResponseBodyModel>(data); | |||
if (objData != null && objData is HttpResponseBodyModel response) | |||
{ | |||
@@ -266,8 +266,8 @@ namespace BPASmartClient.AGV | |||
//string body = JsonConvert.SerializeObject(httpModel); | |||
//启用签名 | |||
//url = url + "?sign=" + MD5Deal(body); | |||
string data = HttpRequest(url, head, body).Replace('[', ' ').Replace(']', ' '); | |||
object objData = JsonConvert.DeserializeObject(data); | |||
string data = HttpRequest(url, head, body).Replace("[", "").Replace("]", ""); | |||
object objData = JsonConvert.DeserializeObject<HttpResponseBodyModel>(data); | |||
if (objData != null && objData is HttpResponseBodyModel response) | |||
{ | |||
return response.code; | |||
@@ -321,8 +321,8 @@ namespace BPASmartClient.AGV | |||
//string body = JsonConvert.SerializeObject(httpModel); | |||
//启用签名 | |||
//url = url + "?sign=" + MD5Deal(body); | |||
string data = HttpRequest(url, head, body).Replace('[', ' ').Replace(']', ' '); | |||
object objData = JsonConvert.DeserializeObject(data); | |||
string data = HttpRequest(url, head, body).Replace("[", "").Replace("]", ""); | |||
object objData = JsonConvert.DeserializeObject<HttpResponseBodyModel>(data); | |||
if (objData != null && objData is HttpResponseBodyModel response) | |||
{ | |||
return response.code; | |||
@@ -376,8 +376,8 @@ namespace BPASmartClient.AGV | |||
//string body = JsonConvert.SerializeObject(httpModel); | |||
//启用签名 | |||
//url = url + "?sign=" + MD5Deal(body); | |||
string data = HttpRequest(url, head, body).Replace('[', ' ').Replace(']', ' '); | |||
object objData = JsonConvert.DeserializeObject(data); | |||
string data = HttpRequest(url, head, body).Replace("[","").Replace("]",""); | |||
object objData = JsonConvert.DeserializeObject<HttpResponseBodyModel>(data); | |||
if (objData != null && objData is HttpResponseBodyModel response) | |||
{ | |||
return response.code; | |||
@@ -431,8 +431,8 @@ namespace BPASmartClient.AGV | |||
//string body = JsonConvert.SerializeObject(httpModel); | |||
//启用签名 | |||
//url = url + "?sign=" + MD5Deal(body); | |||
string data = HttpRequest(url, head, body).Replace('[', ' ').Replace(']', ' '); | |||
object objData = JsonConvert.DeserializeObject(data); | |||
string data = HttpRequest(url, head, body).Replace("[", "").Replace("]", ""); | |||
object objData = JsonConvert.DeserializeObject<HttpResponseBodyModel>(data); | |||
if (objData != null && objData is HttpResponseBodyModel response) | |||
{ | |||
return response.code; | |||
@@ -486,8 +486,8 @@ namespace BPASmartClient.AGV | |||
//string body = JsonConvert.SerializeObject(httpModel); | |||
//启用签名 | |||
//url = url + "?sign=" + MD5Deal(body); | |||
string data = HttpRequest(url, head, body).Replace('[', ' ').Replace(']', ' '); | |||
object objData = JsonConvert.DeserializeObject(data); | |||
string data = HttpRequest(url, head, body).Replace("[", "").Replace("]", ""); | |||
object objData = JsonConvert.DeserializeObject<HttpResponseBodyModel>(data); | |||
if (objData != null && objData is HttpResponseBodyModel response) | |||
{ | |||
return response.code; | |||
@@ -541,8 +541,8 @@ namespace BPASmartClient.AGV | |||
//string body = JsonConvert.SerializeObject(httpModel); | |||
//启用签名 | |||
//url = url + "?sign=" + MD5Deal(body); | |||
string data = HttpRequest(url, head, body).Replace('[', ' ').Replace(']', ' '); | |||
object objData = JsonConvert.DeserializeObject(data); | |||
string data = HttpRequest(url, head, body).Replace("[", "").Replace("]", ""); | |||
object objData = JsonConvert.DeserializeObject<HttpResponseBodyModel>(data); | |||
if (objData != null && objData is HttpResponseBodyModel response) | |||
{ | |||
return response.code; | |||
@@ -596,8 +596,8 @@ namespace BPASmartClient.AGV | |||
//string body = JsonConvert.SerializeObject(httpModel); | |||
//启用签名 | |||
//url = url + "?sign=" + MD5Deal(body); | |||
string data = HttpRequest(url, head, body).Replace('[', ' ').Replace(']', ' '); | |||
object objData = JsonConvert.DeserializeObject(data); | |||
string data = HttpRequest(url, head, body).Replace("[", "").Replace("]", ""); | |||
object objData = JsonConvert.DeserializeObject<HttpResponseBodyModel>(data); | |||
if (objData != null && objData is HttpResponseBodyModel response) | |||
{ | |||
return response.code; | |||
@@ -651,8 +651,8 @@ namespace BPASmartClient.AGV | |||
//string body = JsonConvert.SerializeObject(httpModel); | |||
//启用签名 | |||
//url = url + "?sign=" + MD5Deal(body); | |||
string data = HttpRequest(url, head, body).Replace('[', ' ').Replace(']', ' '); | |||
object objData = JsonConvert.DeserializeObject(data); | |||
string data = HttpRequest(url, head, body).Replace("[", "").Replace("]", ""); | |||
object objData = JsonConvert.DeserializeObject<HttpResponseBodyModel>(data); | |||
if (objData != null && objData is HttpResponseBodyModel response) | |||
{ | |||
return response.code; | |||
@@ -706,8 +706,8 @@ namespace BPASmartClient.AGV | |||
//string body = JsonConvert.SerializeObject(httpModel); | |||
//启用签名 | |||
//url = url + "?sign=" + MD5Deal(body); | |||
string data = HttpRequest(url, head, body).Replace('[', ' ').Replace(']', ' '); | |||
object objData = JsonConvert.DeserializeObject(data); | |||
string data = HttpRequest(url, head, body).Replace("[", "").Replace("]", ""); | |||
object objData = JsonConvert.DeserializeObject<HttpResponseBodyModel>(data); | |||
if (objData != null && objData is HttpResponseBodyModel response) | |||
{ | |||
return response.code; | |||
@@ -762,8 +762,8 @@ namespace BPASmartClient.AGV | |||
//string body = JsonConvert.SerializeObject(httpModel); | |||
//启用签名 | |||
//url = url + "?sign=" + MD5Deal(body); | |||
string data = HttpRequest(url, head, body).Replace('[', ' ').Replace(']', ' '); | |||
object objData = JsonConvert.DeserializeObject(data); | |||
string data = HttpRequest(url, head, body).Replace("[", "").Replace("]", ""); | |||
object objData = JsonConvert.DeserializeObject<HttpResponseBodyModel>(data); | |||
if (objData != null && objData is HttpResponseBodyModel response) | |||
{ | |||
return response.code; | |||
@@ -802,7 +802,7 @@ namespace BPASmartClient.AGV | |||
httpJobData.autoUnload = Convert.ToBoolean(config.AppSettings.Settings["autoUnload"].Value); //是否自动下料 true:自动下料 false:人工下料 | |||
httpJobData.enableIOUnload = Convert.ToBoolean(config.AppSettings.Settings["enableIOUnload"].Value); ;//下料交互方式 false:接口交互 true:光电交互 | |||
httpJobData.loadEquipmentId = 22; | |||
httpJobData.unloadEquipmentId = 10; | |||
httpJobData.unloadEquipmentId = 20; | |||
httpModel.jobData = httpJobData; | |||
string body ="["+ JsonConvert.SerializeObject(httpModel)+"]"; | |||
//货位到货位 | |||
@@ -817,8 +817,8 @@ namespace BPASmartClient.AGV | |||
//string body = JsonConvert.SerializeObject(httpModel); | |||
//启用签名 | |||
//url = url + "?sign=" + MD5Deal(body); | |||
string data = HttpRequest(url, head, body).Replace('[', ' ').Replace(']', ' '); | |||
object objData = JsonConvert.DeserializeObject(data); | |||
string data = HttpRequest(url, head, body).Replace("[", "").Replace("]", ""); | |||
object objData = JsonConvert.DeserializeObject<HttpResponseBodyModel>(data); | |||
if (objData != null && objData is HttpResponseBodyModel response) | |||
{ | |||
return response.code; | |||
@@ -857,7 +857,7 @@ namespace BPASmartClient.AGV | |||
httpJobData.autoUnload = Convert.ToBoolean(config.AppSettings.Settings["autoUnload"].Value); //是否自动下料 true:自动下料 false:人工下料 | |||
httpJobData.enableIOUnload = Convert.ToBoolean(config.AppSettings.Settings["enableIOUnload"].Value); ;//下料交互方式 false:接口交互 true:光电交互 | |||
httpJobData.loadEquipmentId = 33; | |||
httpJobData.unloadEquipmentId = 10; | |||
httpJobData.unloadEquipmentId = 30; | |||
httpModel.jobData = httpJobData; | |||
string body ="["+ JsonConvert.SerializeObject(httpModel)+"]"; | |||
//货位到货位 | |||
@@ -872,8 +872,8 @@ namespace BPASmartClient.AGV | |||
//string body = JsonConvert.SerializeObject(httpModel); | |||
//启用签名 | |||
//url = url + "?sign=" + MD5Deal(body); | |||
string data = HttpRequest(url, head, body).Replace('[', ' ').Replace(']', ' '); | |||
object objData = JsonConvert.DeserializeObject(data); | |||
string data = HttpRequest(url, head, body).Replace("[", "").Replace("]", ""); | |||
object objData = JsonConvert.DeserializeObject<HttpResponseBodyModel>(data); | |||
if (objData != null && objData is HttpResponseBodyModel response) | |||
{ | |||
return response.code; | |||
@@ -927,8 +927,8 @@ namespace BPASmartClient.AGV | |||
//string body = JsonConvert.SerializeObject(httpModel); | |||
//启用签名 | |||
//url = url + "?sign=" + MD5Deal(body); | |||
string data = HttpRequest(url, head, body).Replace('[', ' ').Replace(']', ' '); | |||
object objData = JsonConvert.DeserializeObject(data); | |||
string data = HttpRequest(url, head, body).Replace("[", "").Replace("]", ""); | |||
object objData = JsonConvert.DeserializeObject<HttpResponseBodyModel>(data); | |||
if (objData != null && objData is HttpResponseBodyModel response) | |||
{ | |||
return response.code; | |||
@@ -987,8 +987,8 @@ namespace BPASmartClient.AGV | |||
string body = JsonConvert.SerializeObject(notify); | |||
//启用签名 | |||
//url = url + "?sign=" + MD5Deal(body); | |||
string data = HttpRequest(url, head, body).Replace('[', ' ').Replace(']', ' '); | |||
object objData = JsonConvert.DeserializeObject(data); | |||
string data = HttpRequest(url, head, body).Replace("[", "").Replace("]", ""); | |||
object objData = JsonConvert.DeserializeObject<HttpResponseBodyModel>(data); | |||
if (objData != null && objData is HttpResponseBodyModel response) | |||
{ | |||
return response.code; | |||
@@ -1023,7 +1023,7 @@ namespace BPASmartClient.AGV | |||
//启用签名 | |||
//url = url + "?sign=" + MD5Deal(body); | |||
string data = HttpRequest(url, head, body); | |||
object objData = JsonConvert.DeserializeObject(data); | |||
object objData = JsonConvert.DeserializeObject<HttpResponseBodyModel>(data); | |||
if (objData != null && objData is HttpResponseBodyModel response) | |||
{ | |||
return response.code; | |||
@@ -17,12 +17,16 @@ namespace BPASmartClient.CustomResource.Pages.Model | |||
public class AlarmHelper<AlarmT> where AlarmT : class, new() | |||
{ | |||
private volatile static ConcurrentDictionary<string, AlarmT> _Instance; | |||
private static readonly object Obj_Lock = new object(); | |||
public static AlarmT GetInstance(string name = "") | |||
{ | |||
if (string.IsNullOrEmpty(name)) name = typeof(AlarmT).Name; | |||
if (_Instance == null) _Instance = new ConcurrentDictionary<string, AlarmT>(); | |||
if (!_Instance.ContainsKey(name)) _Instance.TryAdd(name, new AlarmT()); | |||
return _Instance[name]; | |||
lock (Obj_Lock) | |||
{ | |||
if (string.IsNullOrEmpty(name)) name = typeof(AlarmT).Name; | |||
if (_Instance == null) _Instance = new ConcurrentDictionary<string, AlarmT>(); | |||
if (!_Instance.ContainsKey(name)) _Instance.TryAdd(name, new AlarmT()); | |||
return _Instance[name]; | |||
} | |||
} | |||
private AlarmHelper() { } | |||
@@ -13,11 +13,15 @@ namespace BPASmartClient.Helper | |||
public class RTrig | |||
{ | |||
private volatile static ConcurrentDictionary<string, RTrig> _Instance; | |||
private static readonly object Lock = new object(); | |||
public static RTrig GetInstance(string name) | |||
{ | |||
if (_Instance == null) _Instance = new ConcurrentDictionary<string, RTrig>(); | |||
if (!_Instance.ContainsKey(name)) _Instance.TryAdd(name, new RTrig()); | |||
return _Instance[name]; | |||
lock (Lock) | |||
{ | |||
if (_Instance == null) _Instance = new ConcurrentDictionary<string, RTrig>(); | |||
if (!_Instance.ContainsKey(name)) _Instance.TryAdd(name, new RTrig()); | |||
return _Instance[name]; | |||
} | |||
} | |||
private RTrig() { } | |||
@@ -2,6 +2,6 @@ | |||
<configuration> | |||
<appSettings> | |||
<add key="HKPlc_IP" value="107.107.2.17"/> | |||
<add key="Siemens_IP" value="192.168.0.30"/> | |||
<add key="Siemens_IP" value="107.107.2.200"/> | |||
</appSettings> | |||
</configuration> |
@@ -79,7 +79,6 @@ namespace BPASmartClient.JXJFoodBigStation.Model.HK_PLC | |||
public float Bareel1Bin13SetWeight { get; set; } | |||
public float Bareel1Bin14SetWeight { get; set; } | |||
public float Bareel2Bin1SetWeight { get; set; } | |||
public float Bareel2Bin2SetWeight { get; set; } | |||
public float Bareel2Bin3SetWeight { get; set; } | |||
@@ -94,7 +93,6 @@ namespace BPASmartClient.JXJFoodBigStation.Model.HK_PLC | |||
public float Bareel2Bin12SetWeight { get; set; } | |||
public float Bareel2Bin13SetWeight { get; set; } | |||
public float Bareel2Bin14SetWeight { get; set; } | |||
public float Bareel4Bin1SetWeight { get; set; } | |||
public float Bareel4Bin2SetWeight { get; set; } | |||
@@ -110,6 +108,7 @@ namespace BPASmartClient.JXJFoodBigStation.Model.HK_PLC | |||
public float Bareel4Bin12SetWeight { get; set; } | |||
public float Bareel4Bin13SetWeight { get; set; } | |||
public float Bareel4Bin14SetWeight { get; set; } | |||
public float Bareel5Bin1SetWeight { get; set; } | |||
public float Bareel5Bin2SetWeight { get; set; } | |||
public float Bareel5Bin3SetWeight { get; set; } | |||
@@ -17,7 +17,7 @@ namespace BPASmartClient.JXJFoodBigStation.Model.HK_PLC | |||
public bool IsConnected => HK_PLC_S7.IsConnected; | |||
public DB_Write PlcWrite = new DB_Write(); | |||
public DB_Read PlcRead = new DB_Read(); | |||
public StockBinName StockBinName = new StockBinName(); | |||
public void Init() | |||
{ | |||
if (IsConnected) | |||
@@ -26,11 +26,15 @@ namespace BPASmartClient.JXJFoodBigStation.Model.HK_PLC | |||
{ | |||
HK_PLC_S7.WriteClass<DB_Write>(PlcWrite, 99); | |||
var res1 = HK_PLC_S7.ReadClass<DB_Read>(98); | |||
var res2 = HK_PLC_S7.ReadClass<Test1>(97); | |||
var res2 = HK_PLC_S7.ReadClass<StockBinName>(97); | |||
if (res1 != null && res1 is DB_Read data1) | |||
{ | |||
PlcRead = data1; | |||
} | |||
if (res2 != null && res2 is StockBinName data2) | |||
{ | |||
StockBinName = data2; | |||
} | |||
Thread.Sleep(10); | |||
}),"信号收发处理"); | |||
} | |||
@@ -264,7 +268,7 @@ namespace BPASmartClient.JXJFoodBigStation.Model.HK_PLC | |||
} | |||
else | |||
{ | |||
MessageLog.GetInstance.ShowRunLog($"桶号:{barrel},位置:{loc},重量:{recipe.RawMaterial.ElementAt(index).RawMaterialWeight}"); | |||
MessageNotify.GetInstance.ShowRunLog($"配方编号:{recipe.RecipeCode},托盘编号:{recipe.TrayCode},桶号:{barrel},位置:{loc},重量:{recipe.RawMaterial.ElementAt(index).RawMaterialWeight}"); | |||
switch (barrel) | |||
{ | |||
case 1: | |||
@@ -470,7 +474,7 @@ namespace BPASmartClient.JXJFoodBigStation.Model.HK_PLC | |||
default: | |||
break; | |||
} | |||
} | |||
} | |||
} | |||
} | |||
} | |||
@@ -7,7 +7,7 @@ using System.Threading.Tasks; | |||
namespace BPASmartClient.JXJFoodBigStation.Model.HK_PLC | |||
{ | |||
internal class Test1 | |||
public class StockBinName | |||
{ | |||
[Siemens(6)] | |||
public string RawMaterialName1 { get; set; } |
@@ -48,27 +48,11 @@ namespace BPASmartClient.JXJFoodBigStation.Model | |||
public ConcurrentQueue<string> RecipeQueue4 = new ConcurrentQueue<string>(); | |||
public ConcurrentQueue<string> RecipeQueue5 = new ConcurrentQueue<string>(); | |||
/// <summary> | |||
/// AGV到达工站队列 | |||
/// </summary> | |||
public ConcurrentQueue<string> AGVToWorkStationQueue = new ConcurrentQueue<string>(); | |||
/// <summary> | |||
/// 接收原料数据 | |||
/// </summary> | |||
public RecipeRawMaterial RawMaterial; | |||
public void Init() | |||
{ | |||
RawMaterialsNamePos.Add("1", 1); | |||
RawMaterialsNamePos.Add("2", 2); | |||
RawMaterialsNamePos.Add("3", 3); | |||
RawMaterialsNamePos.Add("4", 4); | |||
RawMaterialsNamePos.Add("5", 5); | |||
RawMaterialsNamePos.Add("6", 6); | |||
RawMaterialsNamePos.Add("7", 7); | |||
RawMaterialsNamePos.Add("8", 8); | |||
RawMaterialsNamePos.Add("9", 9); | |||
RawMaterialsNamePos.Add("10", 10); | |||
RawMaterialsNamePos.Add("11", 11); | |||
RawMaterialsNamePos.Add("12", 12); | |||
ActionManage.GetInstance.Register(new Action<object>((res) => | |||
{ | |||
ObservableCollection<RawMaterial> RawMaterials = new ObservableCollection<RawMaterial>(); | |||
@@ -87,7 +71,7 @@ namespace BPASmartClient.JXJFoodBigStation.Model | |||
RawMaterialBarrelNum = recipe.Material[i].Material_BarrelNum, | |||
RawMaterialWeight = recipe.Material[i].Material_Weight, | |||
RawMaterialLocation = (int)RawMaterialsNamePos[recipe.Material[i].Material_Name] | |||
}); | |||
}); | |||
} | |||
else | |||
{ | |||
@@ -99,7 +83,7 @@ namespace BPASmartClient.JXJFoodBigStation.Model | |||
RecipeName = recipe.RecipeName, | |||
RecipeCode = recipe.RecipeCode, | |||
RawMaterial = RawMaterials, | |||
TrayCode = recipe.TrayCode | |||
//TrayCode = recipe.Order_No, | |||
}); | |||
} | |||
} | |||
@@ -108,7 +92,7 @@ namespace BPASmartClient.JXJFoodBigStation.Model | |||
string Siemens_PLC_IP = ConfigurationManager.AppSettings["Siemens_IP"]; | |||
try | |||
{ | |||
HKDevice.HK_PLC_S7.Connect(S7.Net.CpuType.S71500, HK_PLC_IP); | |||
//HKDevice.HK_PLC_S7.Connect(S7.Net.CpuType.S71500, HK_PLC_IP); | |||
//SiemensDevice.Siemens_PLC_S7.Connect(S7.Net.CpuType.S71500, Siemens_PLC_IP); | |||
if (HKDevice.IsConnected) | |||
{ | |||
@@ -138,136 +122,16 @@ namespace BPASmartClient.JXJFoodBigStation.Model | |||
item.RawMaterialLocation = Convert.ToInt32(item.RawMaterialName); | |||
} | |||
} | |||
MessageNotify.GetInstance.ShowAlarmLog("海科plc连接失败"); | |||
} | |||
}), "ManualSendRecipe", true); | |||
RecipeQueue1.Clear(); | |||
//Json<RemoteRecipeDataColl>.Data.Recipes = TestData.GetInstance.Recipes;//添加测试数据 | |||
ThreadManage.GetInstance().StartLong(new Action(() => | |||
{ | |||
//ReadPLCDeviceInfo(); | |||
ReceviceData(); | |||
RecipeInfoToHKPLC(); | |||
Thread.Sleep(10); | |||
}), "流程处理", true); | |||
ThreadManage.GetInstance().StartLong(new Action(() => | |||
{ | |||
if (HKDevice.IsConnected && SiemensDevice.IsConnected) | |||
{ | |||
AgvGetInOut(); | |||
} | |||
Thread.Sleep(10); | |||
}), "AGV进站送取货", true); | |||
ThreadManage.GetInstance().StartLong(new Action(() => | |||
{ | |||
ReadSiemensCommData(); | |||
ReadHKPLCCommData(); | |||
Thread.Sleep(10); | |||
}), "读取西门子和海科PLC的数据", true); | |||
} | |||
/// <summary> | |||
/// AGV送货 | |||
/// </summary> | |||
/// <param name="bitNum"></param> | |||
private void AGV_Delivery(int bitNum) | |||
{ | |||
if ((ReadSiemens("M4002." + bitNum) is bool) && BigStation.AgvDeliveryPosition == 0) | |||
{ | |||
BigStation.AgvDeliveryPosition = 1; | |||
WriteHKPLC("M4002." + bitNum, true); | |||
WriteSiemens("M4002." + bitNum, false); | |||
} | |||
else if (ReadHK("M5002." + bitNum) is bool && BigStation.AgvDeliveryPosition == 1) | |||
{ | |||
BigStation.AgvDeliveryPosition = 2; | |||
WriteSiemens("M5002." + bitNum, true); | |||
WriteHKPLC("M5002." + bitNum, false); | |||
} | |||
else if (ReadSiemens("M4004." + bitNum) is bool && BigStation.AgvDeliveryPosition == 2) | |||
{ | |||
BigStation.AgvDeliveryPosition = 3; | |||
WriteHKPLC("M4004." + bitNum, true); | |||
WriteSiemens("M4004." + bitNum, false); | |||
} | |||
else if (ReadHK("M5004." + bitNum) is bool && BigStation.AgvDeliveryPosition == 3) | |||
{ | |||
BigStation.AgvDeliveryPosition = 4; | |||
WriteSiemens("M5004." + bitNum, true); | |||
WriteHKPLC("M5004." + bitNum, false); | |||
} | |||
else if (ReadSiemens("M4005." + bitNum) is bool && BigStation.AgvDeliveryPosition == 4) | |||
{ | |||
BigStation.AgvDeliveryPosition = 5; | |||
WriteHKPLC("M4005." + bitNum, true); | |||
WriteSiemens("M4005." + bitNum, false); | |||
} | |||
else if (ReadHK("M5005." + bitNum) is bool && BigStation.AgvDeliveryPosition == 5) | |||
{ | |||
WriteSiemens("M5005." + bitNum, true); | |||
WriteHKPLC("M5005." + bitNum, false); | |||
} | |||
} | |||
/// <summary> | |||
/// AGV取货 | |||
/// </summary> | |||
/// <param name="bitNum"></param> | |||
private void AGV_Pick(int bitNum) | |||
{ | |||
if (ReadSiemens("M4003" + bitNum) is bool && BigStation.AgvPickUpPosition == 0) | |||
{ | |||
BigStation.AgvPickUpPosition = 1; | |||
WriteHKPLC("M4003." + bitNum, true); | |||
WriteSiemens("M4003." + bitNum, false); | |||
} | |||
if (ReadHK("M5003" + bitNum) is bool && BigStation.AgvPickUpPosition == 1) | |||
{ | |||
BigStation.AgvPickUpPosition = 2; | |||
WriteSiemens("M5003" + bitNum, true); | |||
WriteHKPLC("M5003" + bitNum, false); | |||
} | |||
if (ReadSiemens("M4006." + bitNum) is bool && BigStation.AgvPickUpPosition == 2) | |||
{ | |||
BigStation.AgvPickUpPosition = 3; | |||
WriteHKPLC("M4006." + bitNum, true); | |||
WriteSiemens("M4006." + bitNum, false); | |||
} | |||
if (ReadHK("M5006." + bitNum) is bool && BigStation.AgvPickUpPosition == 3) | |||
{ | |||
WriteSiemens("M5006." + bitNum, true); | |||
WriteHKPLC("M5006." + bitNum, false); | |||
} | |||
} | |||
/// <summary> | |||
/// AGV进站送货 | |||
/// </summary> | |||
private void AgvGetInOut() | |||
{ | |||
//获取工位上是否有小车 | |||
SiemensDevice.Siemens_PLC_S7.Write<bool>(SiemensCommAddress.StationIsExistCar, (bool) | |||
HKDevice.HK_PLC_S7.Read<bool>("M4007.0")); | |||
//检测AGV到站信号 | |||
if (AGVToWorkStationQueue.Count > 0) | |||
{ | |||
int index = Array.FindIndex(RemoteRecipes.ToArray(), p => p.RecipeCode == AGVToWorkStationQueue.ElementAt(0)); | |||
int TrayLocation = RemoteRecipes.ElementAt(index).TrayCode;//根据配方编号,找到托盘的ID 托盘ID1-6 | |||
string RecipeCode = (string)RemoteRecipes.ElementAt(index).RecipeCode; | |||
if (TrayLocation > 0 && TrayLocation < 7) | |||
{ | |||
AGV_Delivery(TrayLocation - 1); | |||
if (BigStation.AgvDeliveryPosition == 5) | |||
{ | |||
BigStation.AgvDeliveryPosition = 0; | |||
} | |||
AGV_Pick(TrayLocation - 1); | |||
if (BigStation.AgvPickUpPosition == 3) | |||
{ | |||
BigStation.AgvPickUpPosition = 0; | |||
AGVToWorkStationQueue.TryDequeue(out RecipeCode); | |||
} | |||
} | |||
} | |||
} | |||
private void ReceviceData() | |||
{ | |||
@@ -318,6 +182,10 @@ namespace BPASmartClient.JXJFoodBigStation.Model | |||
RecipeQueue4.Clear(); | |||
RecipeQueue5.Clear(); | |||
BigStation.Recipe1DosingStatus = 0; | |||
BigStation.Recipe2DosingStatus = 0; | |||
BigStation.Recipe3DosingStatus = 0; | |||
BigStation.Recipe4DosingStatus = 0; | |||
BigStation.Recipe5DosingStatus = 0; | |||
} | |||
} | |||
private void RecipeInfoToHKPLC() | |||
@@ -333,23 +201,20 @@ namespace BPASmartClient.JXJFoodBigStation.Model | |||
{ | |||
HKDevice.StockBinPar(RemoteRecipes.ElementAt(index)); | |||
HKDevice.PlcWrite.Recipe1IssuedFinish = true; | |||
//HKDevice.HK_PLC_S7.Write<bool>("DB98.DBX0.1", false);//复位允许下发配方1信号 | |||
BigStation.Recipe1DosingStatus = 1; | |||
MessageLog.GetInstance.ShowRunLog($"配方状态:{code}下发完成"); | |||
MessageNotify.GetInstance.ShowRunLog($"配方编号:{code},托盘编号:{trayCode},下发完成"); | |||
} | |||
if (HKDevice.PlcRead.ReceiveFinishRecipe1 && BigStation.Recipe1DosingStatus == 1) | |||
{ | |||
BigStation.Recipe1DosingStatus = 2; | |||
HKDevice.PlcWrite.Recipe1IssuedFinish = false; | |||
HKDevice.PlcWrite.RecipeCode = 0; | |||
HKDevice.PlcWrite.TrayCode = 0; | |||
WeightReset(); | |||
MessageLog.GetInstance.ShowRunLog($"配方状态:{code}配方配料"); | |||
StockBinParReset(); | |||
MessageNotify.GetInstance.ShowRunLog($"配方编号:{code},托盘编号:{trayCode},PLC接收配方完成"); | |||
} | |||
if (BigStation.Recipe1DosingStatus == 2 && HKDevice.PlcRead.Recipe1DosingFinish) | |||
{ | |||
BigStation.Recipe1DosingStatus = 3; | |||
MessageLog.GetInstance.ShowRunLog($"配方状态:{code}配料完成"); | |||
MessageNotify.GetInstance.ShowRunLog($"配方状态:{code}配料完成"); | |||
if (HKDevice.PlcRead.Recipe1TrayCode == 1) | |||
{ | |||
foreach (var item in RemoteRecipes.ElementAt(index).RawMaterial) | |||
@@ -425,7 +290,6 @@ namespace BPASmartClient.JXJFoodBigStation.Model | |||
{ | |||
SiemensDevice.Siemens_PLC_S7.WriteClass<DL_Finish_DB>(FinishData, 3); | |||
} | |||
//HKDevice.HK_PLC_S7.Write<bool>("DB98.DBX1.1",false); | |||
RecipeQueue1.TryDequeue(out code); | |||
IssuedComplete.Add(RemoteRecipes.ElementAt(index));//将该配方添加到下 | |||
if (!BigStation.IsAllowManual) | |||
@@ -453,21 +317,19 @@ namespace BPASmartClient.JXJFoodBigStation.Model | |||
HKDevice.StockBinPar(RemoteRecipes.ElementAt(index)); | |||
HKDevice.PlcWrite.Recipe2IssuedFinish = true; | |||
BigStation.Recipe2DosingStatus = 1; | |||
MessageLog.GetInstance.ShowRunLog($"配方状态:{code}下发完成"); | |||
MessageNotify.GetInstance.ShowRunLog($"配方状态:{code}下发完成"); | |||
} | |||
if (HKDevice.PlcRead.ReceiveFinishRecipe2 && BigStation.Recipe2DosingStatus == 1) | |||
{ | |||
BigStation.Recipe2DosingStatus = 2; | |||
HKDevice.PlcWrite.Recipe2IssuedFinish = false; | |||
HKDevice.PlcWrite.RecipeCode = 0; | |||
HKDevice.PlcWrite.TrayCode = 0; | |||
WeightReset(); | |||
MessageLog.GetInstance.ShowRunLog($"配方状态:{code}配方配料"); | |||
StockBinParReset(); | |||
MessageNotify.GetInstance.ShowRunLog($"配方状态:{code}配方配料"); | |||
} | |||
if (BigStation.Recipe2DosingStatus == 2 && HKDevice.PlcRead.Recipe2DosingFinish) | |||
{ | |||
BigStation.Recipe2DosingStatus = 3; | |||
MessageLog.GetInstance.ShowRunLog($"配方状态:{code}配料完成"); | |||
MessageNotify.GetInstance.ShowRunLog($"配方状态:{code}配料完成"); | |||
if (HKDevice.PlcRead.Recipe2TrayCode > 0) | |||
{ | |||
foreach (var item in RemoteRecipes.ElementAt(index).RawMaterial) | |||
@@ -529,7 +391,6 @@ namespace BPASmartClient.JXJFoodBigStation.Model | |||
item.Laying_Off_Weight = HKDevice.PlcRead.StockBin14ActualWeight; | |||
} | |||
} | |||
FinishData.Order_No = RemoteRecipes.ElementAt(index).RecipeCode; | |||
FinishData.Product_Code = RemoteRecipes.ElementAt(index).RecipeName; | |||
for (int i = 0; i < RemoteRecipes.ElementAt(index).RawMaterial.Count; i++) | |||
@@ -539,11 +400,11 @@ namespace BPASmartClient.JXJFoodBigStation.Model | |||
FinishData.Material[i].Material_BarrelNum = (short)RemoteRecipes.ElementAt(index).RawMaterial.ElementAt(i).RawMaterialBarrelNum; | |||
FinishData.Material[i].Material_Laying_Off_Weight = RemoteRecipes.ElementAt(index).RawMaterial.ElementAt(i).Laying_Off_Weight; | |||
} | |||
} | |||
if (SiemensDevice.IsConnected) | |||
{ | |||
SiemensDevice.Siemens_PLC_S7.WriteClass<DL_Finish_DB>(FinishData, 3); | |||
MessageNotify.GetInstance.ShowRunLog($"配方配料完成,将信号反馈给西门子"); | |||
} | |||
RecipeQueue2.TryDequeue(out code); | |||
IssuedComplete.Add(RemoteRecipes.ElementAt(index));//将该配方添加到下 | |||
@@ -556,7 +417,6 @@ namespace BPASmartClient.JXJFoodBigStation.Model | |||
Json<LocalRecipeDataColl>.Data.Recipes.RemoveAt(index);//制作完成,移除当前配方 | |||
} | |||
BigStation.Recipe2DosingStatus = 0; | |||
} | |||
} | |||
} | |||
@@ -572,20 +432,18 @@ namespace BPASmartClient.JXJFoodBigStation.Model | |||
HKDevice.StockBinPar(RemoteRecipes.ElementAt(index)); | |||
HKDevice.PlcWrite.Recipe3IssuedFinish = true; | |||
BigStation.Recipe3DosingStatus = 1; | |||
MessageLog.GetInstance.ShowRunLog($"配方状态:{code}下发完成"); | |||
MessageNotify.GetInstance.ShowRunLog($"配方状态:{code}下发完成"); | |||
} | |||
if (HKDevice.PlcRead.ReceiveFinishRecipe3 && BigStation.Recipe3DosingStatus == 1) | |||
{ | |||
BigStation.Recipe3DosingStatus = 2; | |||
HKDevice.PlcWrite.RecipeCode = 0; | |||
HKDevice.PlcWrite.TrayCode = 0; | |||
WeightReset(); | |||
MessageLog.GetInstance.ShowRunLog($"配方状态:{code}配方配料"); | |||
StockBinParReset(); | |||
MessageNotify.GetInstance.ShowRunLog($"配方状态:{code}配方配料"); | |||
} | |||
if (HKDevice.PlcRead.Recipe3DosingFinish && BigStation.Recipe3DosingStatus == 2) | |||
{ | |||
BigStation.Recipe3DosingStatus = 3; | |||
MessageLog.GetInstance.ShowRunLog($"配方状态:{code}配料完成"); | |||
MessageNotify.GetInstance.ShowRunLog($"配方状态:{code}配料完成"); | |||
if (HKDevice.PlcRead.Recipe3TrayCode > 0) | |||
{ | |||
foreach (var item in RemoteRecipes.ElementAt(index).RawMaterial) | |||
@@ -691,21 +549,19 @@ namespace BPASmartClient.JXJFoodBigStation.Model | |||
HKDevice.StockBinPar(RemoteRecipes.ElementAt(index)); | |||
HKDevice.PlcWrite.Recipe4IssuedFinish = true; | |||
BigStation.Recipe4DosingStatus = 1; | |||
MessageLog.GetInstance.ShowRunLog($"配方状态:{code}下发完成"); | |||
MessageNotify.GetInstance.ShowRunLog($"配方状态:{code}下发完成"); | |||
} | |||
if (HKDevice.PlcRead.ReceiveFinishRecipe4 && BigStation.Recipe4DosingStatus == 1) | |||
{ | |||
BigStation.Recipe4DosingStatus = 2; | |||
HKDevice.PlcWrite.Recipe4IssuedFinish = false; | |||
HKDevice.PlcWrite.RecipeCode = 0; | |||
HKDevice.PlcWrite.TrayCode = 0; | |||
WeightReset(); | |||
MessageLog.GetInstance.ShowRunLog($"配方状态:{code}配方配料"); | |||
StockBinParReset(); | |||
MessageNotify.GetInstance.ShowRunLog($"配方状态:{code}配方配料"); | |||
} | |||
if (BigStation.Recipe4DosingStatus == 2 && HKDevice.PlcRead.Recipe4DosingFinish) | |||
{ | |||
BigStation.Recipe4DosingStatus = 3; | |||
MessageLog.GetInstance.ShowRunLog($"配方状态:{code}配料完成"); | |||
MessageNotify.GetInstance.ShowRunLog($"配方状态:{code}配料完成"); | |||
if (HKDevice.PlcRead.Recipe4TrayCode > 0) | |||
{ | |||
foreach (var item in RemoteRecipes.ElementAt(index).RawMaterial) | |||
@@ -799,128 +655,15 @@ namespace BPASmartClient.JXJFoodBigStation.Model | |||
} | |||
} | |||
} | |||
public ConcurrentDictionary<string, Object> ReadHKPLCData = new ConcurrentDictionary<string, object>(); | |||
public ConcurrentDictionary<string, Object> ReadSiemensData = new ConcurrentDictionary<string, object>(); | |||
private void ReadSiemensCommData() | |||
{ | |||
if (SiemensDevice.IsConnected) | |||
{ | |||
GetSiemensStatus("", new Action<object>((obj) => | |||
{ | |||
if (obj is bool[] bools && bools.Length > 0) | |||
{ | |||
} | |||
})); | |||
} | |||
} | |||
private void ReadHKPLCCommData() | |||
{ | |||
if (HKDevice.IsConnected) | |||
{ | |||
GetHKStatus("", new Action<object>((obj) => | |||
{ | |||
if (obj is bool[] bools && bools.Length > 0) | |||
{ | |||
} | |||
})); | |||
} | |||
} | |||
private void GetHKStatus(string key, Action<object> action) | |||
{ | |||
if (ReadHKPLCData.ContainsKey(key)) | |||
{ | |||
if (ReadHKPLCData[key] != null) | |||
{ | |||
action?.Invoke(ReadHKPLCData[key]); | |||
} | |||
} | |||
} | |||
private void GetSiemensStatus(string key, Action<object> action) | |||
{ | |||
if (ReadSiemensData.ContainsKey(key)) | |||
{ | |||
if (ReadSiemensData[key] != null) | |||
{ | |||
action?.Invoke(ReadSiemensData[key]); | |||
} | |||
} | |||
} | |||
private void WriteSiemens(string Address, object Value) | |||
{ | |||
if (SiemensDevice.IsConnected) | |||
{ | |||
SiemensDevice.Siemens_PLC_S7.Write<object>(Address, Value); | |||
} | |||
} | |||
private void WriteHKPLC(string Address, object Value) | |||
{ | |||
HKDevice.HK_PLC_S7.Write<object>(Address, Value); | |||
} | |||
private object ReadSiemens(string Address) | |||
{ | |||
if (SiemensDevice.IsConnected) | |||
{ | |||
return SiemensDevice.Siemens_PLC_S7.Read<object>(Address); | |||
} | |||
else | |||
{ | |||
return null; | |||
} | |||
} | |||
private bool[] ReadBoolsSiemens(int address, int count) | |||
{ | |||
if (SiemensDevice.IsConnected) | |||
{ | |||
return SiemensDevice.Siemens_PLC_S7.ReadBools(address, count); | |||
} | |||
else | |||
{ | |||
return null; | |||
} | |||
} | |||
private object ReadHK(string Address) | |||
{ | |||
if (HKDevice.IsConnected) | |||
{ | |||
return HKDevice.HK_PLC_S7.Read<object>(Address); | |||
} | |||
else | |||
{ | |||
return null; | |||
} | |||
} | |||
private bool[] ReadBoolsHK(int address, int count) | |||
{ | |||
if (HKDevice.IsConnected) | |||
{ | |||
return HKDevice.HK_PLC_S7.ReadBools(address, count); | |||
} | |||
else | |||
{ | |||
return null; | |||
} | |||
} | |||
/// <summary> | |||
/// 获取料仓的原料名称和原料位置 | |||
/// 下发配方的数据复位 | |||
/// </summary> | |||
private void ReadPLCDeviceInfo() | |||
{ | |||
/*for (int i = 0; i < 12; i++) | |||
{ | |||
string RawMaterialName = HKDevice.HK_PLC_S7.Read<string>(""); | |||
short RawMaterialLocation = HKDevice.HK_PLC_S7.Read<short>(""); | |||
if (RawMaterialsNamePos.ContainsKey(RawMaterialName)) | |||
RawMaterialsNamePos.Add(RawMaterialName, RawMaterialLocation); | |||
}*/ | |||
} | |||
private void WeightReset() | |||
private void StockBinParReset() | |||
{ | |||
HKDevice.PlcWrite.RecipeCode = 0; | |||
HKDevice.PlcWrite.TrayCode = 0; | |||
HKDevice.PlcWrite.Bareel1Bin1SetWeight = 0; | |||
HKDevice.PlcWrite.Bareel1Bin2SetWeight = 0; | |||
HKDevice.PlcWrite.Bareel1Bin3SetWeight = 0; | |||
@@ -982,5 +725,82 @@ namespace BPASmartClient.JXJFoodBigStation.Model | |||
HKDevice.PlcWrite.Bareel5Bin13SetWeight = 0; | |||
HKDevice.PlcWrite.Bareel5Bin14SetWeight = 0; | |||
} | |||
private void testData() | |||
{ | |||
RawMaterialsNamePos.Clear(); | |||
if (!HKDevice.IsConnected) | |||
{ | |||
HKDevice.StockBinName.RawMaterialName1 = "1"; | |||
HKDevice.StockBinName.RawMaterialName2 = "2"; | |||
HKDevice.StockBinName.RawMaterialName3 = "3"; | |||
HKDevice.StockBinName.RawMaterialName4 = "4"; | |||
HKDevice.StockBinName.RawMaterialName5 = "5"; | |||
HKDevice.StockBinName.RawMaterialName6 = "6"; | |||
HKDevice.StockBinName.RawMaterialName7 = "7"; | |||
HKDevice.StockBinName.RawMaterialName8 = "8"; | |||
HKDevice.StockBinName.RawMaterialName9 = "9"; | |||
HKDevice.StockBinName.RawMaterialName10 = "10"; | |||
HKDevice.StockBinName.RawMaterialName11 = "11"; | |||
HKDevice.StockBinName.RawMaterialName12 = "12"; | |||
HKDevice.StockBinName.RawMaterialName13 = "13"; | |||
HKDevice.StockBinName.RawMaterialName14 = "14"; | |||
} | |||
if (!RawMaterialsNamePos.ContainsKey(HKDevice.StockBinName.RawMaterialName1)) | |||
{ | |||
RawMaterialsNamePos.Add(HKDevice.StockBinName.RawMaterialName1, 1); | |||
} | |||
if (!RawMaterialsNamePos.ContainsKey(HKDevice.StockBinName.RawMaterialName2)) | |||
{ | |||
RawMaterialsNamePos.Add(HKDevice.StockBinName.RawMaterialName2, 2); | |||
} | |||
if (!RawMaterialsNamePos.ContainsKey(HKDevice.StockBinName.RawMaterialName3)) | |||
{ | |||
RawMaterialsNamePos.Add(HKDevice.StockBinName.RawMaterialName3, 3); | |||
} | |||
if (!RawMaterialsNamePos.ContainsKey(HKDevice.StockBinName.RawMaterialName4)) | |||
{ | |||
RawMaterialsNamePos.Add(HKDevice.StockBinName.RawMaterialName4, 4); | |||
} | |||
if (!RawMaterialsNamePos.ContainsKey(HKDevice.StockBinName.RawMaterialName5)) | |||
{ | |||
RawMaterialsNamePos.Add(HKDevice.StockBinName.RawMaterialName5, 5); | |||
} | |||
if (!RawMaterialsNamePos.ContainsKey(HKDevice.StockBinName.RawMaterialName6)) | |||
{ | |||
RawMaterialsNamePos.Add(HKDevice.StockBinName.RawMaterialName6, 6); | |||
} | |||
if (!RawMaterialsNamePos.ContainsKey(HKDevice.StockBinName.RawMaterialName7)) | |||
{ | |||
RawMaterialsNamePos.Add(HKDevice.StockBinName.RawMaterialName7, 7); | |||
} | |||
if (!RawMaterialsNamePos.ContainsKey(HKDevice.StockBinName.RawMaterialName8)) | |||
{ | |||
RawMaterialsNamePos.Add(HKDevice.StockBinName.RawMaterialName8, 8); | |||
} | |||
if (!RawMaterialsNamePos.ContainsKey(HKDevice.StockBinName.RawMaterialName9)) | |||
{ | |||
RawMaterialsNamePos.Add(HKDevice.StockBinName.RawMaterialName9, 9); | |||
} | |||
if (!RawMaterialsNamePos.ContainsKey(HKDevice.StockBinName.RawMaterialName10)) | |||
{ | |||
RawMaterialsNamePos.Add(HKDevice.StockBinName.RawMaterialName10, 10); | |||
} | |||
if (!RawMaterialsNamePos.ContainsKey(HKDevice.StockBinName.RawMaterialName11)) | |||
{ | |||
RawMaterialsNamePos.Add(HKDevice.StockBinName.RawMaterialName11, 11); | |||
} | |||
if (!RawMaterialsNamePos.ContainsKey(HKDevice.StockBinName.RawMaterialName12)) | |||
{ | |||
RawMaterialsNamePos.Add(HKDevice.StockBinName.RawMaterialName12, 12); | |||
} | |||
if (!RawMaterialsNamePos.ContainsKey(HKDevice.StockBinName.RawMaterialName13)) | |||
{ | |||
RawMaterialsNamePos.Add(HKDevice.StockBinName.RawMaterialName13, 13); | |||
} | |||
if (!RawMaterialsNamePos.ContainsKey(HKDevice.StockBinName.RawMaterialName14)) | |||
{ | |||
RawMaterialsNamePos.Add(HKDevice.StockBinName.RawMaterialName14, 14); | |||
} | |||
} | |||
} | |||
} |
@@ -0,0 +1,39 @@ | |||
using BPASmartClient.S7Net; | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
namespace BPASmartClient.JXJFoodBigStation.Model.Siemens | |||
{ | |||
public class DL_DataColl_DB | |||
{ | |||
[Siemens(16)] | |||
public string RecipeCode { get; set; } | |||
[Siemens(16)] | |||
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]; | |||
public int Reserved1 { get; set; } | |||
public int Reserved2 { get; set; } | |||
} | |||
} |
@@ -1,4 +1,5 @@ | |||
using System; | |||
using BPASmartClient.S7Net; | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Text; | |||
@@ -8,32 +9,42 @@ namespace BPASmartClient.JXJFoodBigStation.Model.Siemens | |||
{ | |||
internal class DL_Finish_DB | |||
{ | |||
/// <summary> | |||
/// 配料完成信号确认 | |||
/// </summary> | |||
public bool Ask_For_Finish_PLC { get; set; } | |||
public short[] StandbyFinish { get; set; } = new short[4]; | |||
[Siemens(16)] | |||
/// <summary> | |||
/// 生产工单编码 | |||
/// </summary> | |||
public string Order_No; | |||
public string Order_No{get; set; } | |||
[Siemens(16)] | |||
/// <summary> | |||
/// 产品名称 | |||
/// </summary> | |||
public string Product_Code; | |||
public string Product_Code { get; set; } | |||
public short job_No { get; set; } | |||
/// <summary> | |||
/// 原料信息 | |||
/// </summary> | |||
public UDT1[] Material = new UDT1[20]; | |||
public UDT1[] Material { get; set; } = new UDT1[20]; | |||
public short ProcessTime { get; set; } | |||
/// <summary> | |||
/// 配料完成信号 | |||
/// </summary> | |||
public bool Ask_For_Finish; | |||
/// <summary> | |||
/// 配料完成信号确认 | |||
/// </summary> | |||
public bool Ask_For_Finish_PLC; | |||
public bool Ask_For_Finish { get; set; } | |||
public short[] StandbyFinish1 { get; set; } = new short[4]; | |||
} | |||
public class UDT1 | |||
{ | |||
public string Material_Name; | |||
public float Material_Laying_Off_Weight; | |||
public short Material_BarrelNum; | |||
[Siemens(6)] | |||
public string Material_Name { get; set; } | |||
public float Material_Laying_Off_Weight { get; set; } | |||
public short Material_BarrelNum { get; set; } | |||
} | |||
} |
@@ -1,4 +1,5 @@ | |||
using System; | |||
using BPASmartClient.S7Net; | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Text; | |||
@@ -8,44 +9,46 @@ namespace BPASmartClient.JXJFoodBigStation.Model.Siemens | |||
{ | |||
internal class DL_Start_DB | |||
{ | |||
[Siemens(16)] | |||
/// <summary> | |||
/// 配方编码 | |||
/// </summary> | |||
public string RecipeCode; | |||
public string RecipeCode { get; set; } | |||
[Siemens(16)] | |||
/// <summary> | |||
/// 配发名称 | |||
/// </summary> | |||
public string RecipeName; | |||
public string RecipeName { get; set; } | |||
public short Order_No { get; set; } | |||
public short Pallet_No { get; set; } | |||
/// <summary> | |||
/// 物料信息 | |||
/// </summary> | |||
public UDT[] Material = new UDT[20]; | |||
/// <summary> | |||
/// 托盘编号 | |||
/// </summary> | |||
public int TrayCode; | |||
public UDT[] Material { get; set; } = new UDT[20]; | |||
public bool Order_Type { get; set; } | |||
public bool Order_Request_Ack { get; set; } | |||
public short[] Standby { get; set; } = new short[4]; | |||
/// <summary> | |||
/// 配方发送请求 | |||
/// </summary> | |||
public bool Ask_For_Send_Bit; | |||
/// <summary> | |||
/// 上位机确认配方接收完成 | |||
/// </summary> | |||
public bool Ack_Ask_For_Send_Bit; | |||
public bool Ask_For_Send_Bit { get; set; } | |||
public short[] Standby1 { get; set; } = new short[4]; | |||
} | |||
public class UDT | |||
{ | |||
[Siemens(6)] | |||
/// <summary> | |||
/// 原料名称 | |||
/// </summary> | |||
public string Material_Name; | |||
public string Material_Name { get; set; } | |||
/// <summary> | |||
/// 原料重量 | |||
/// </summary> | |||
public float Material_Weight; | |||
public float Material_Weight { get; set; } | |||
/// <summary> | |||
/// 原料桶号 | |||
/// </summary> | |||
public short Material_BarrelNum; | |||
public short Material_BarrelNum { get; set; } | |||
} | |||
} |
@@ -1,4 +1,5 @@ | |||
using System; | |||
using BPASmartClient.S7Net; | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Text; | |||
@@ -8,53 +9,36 @@ namespace BPASmartClient.JXJFoodBigStation.Model.Siemens | |||
{ | |||
internal class DL_Status_DB | |||
{ | |||
/// <summary> | |||
/// 生产工单 | |||
/// </summary> | |||
public string RecipeCode; | |||
/// <summary> | |||
/// 配料开始 | |||
/// </summary> | |||
public bool Dosing_Start; | |||
public bool Dosing_Start { get; set; } | |||
/// <summary> | |||
/// 配料开始确认 | |||
/// </summary> | |||
public bool Dosing_Confirm; | |||
/// <summary> | |||
/// 托盘占位情况 | |||
/// </summary> | |||
public bool[] Pallet_Position_Occ = new bool[16]; | |||
/// <summary> | |||
/// 工位允许放货架 | |||
/// </summary> | |||
public bool[] Allow_AGV_Put = new bool[16]; | |||
/// <summary> | |||
/// 工位允许取货架 | |||
/// </summary> | |||
public bool[] Allow_AGV_Get = new bool[16]; | |||
/// <summary> | |||
/// AGV请求放货架 | |||
/// </summary> | |||
public bool[] AGV_Request_Put = new bool[16]; | |||
/// <summary> | |||
/// AGV请求取货架 | |||
/// </summary> | |||
public bool[] AGV_Request_Get = new bool[16]; | |||
/// <summary> | |||
/// AGV放托盘完成 | |||
/// </summary> | |||
public bool[] AGV_Put_Done = new bool[16]; | |||
/// <summary> | |||
/// 托盘号 | |||
/// </summary> | |||
public short[] Pan_No = new short[16]; | |||
/// <summary> | |||
/// 配料时间 | |||
/// </summary> | |||
public int DosingTime; | |||
public bool Dosing_Confirm { get; set; } | |||
public bool Dosing_Cancel { get; set; } | |||
public bool Dosing_Cancel2 { get; set; } | |||
public bool Dosing_Cancel3 { get; set; } | |||
public short a { get; set; } | |||
public short[] Standby { get; set; } = new short[3]; | |||
[Siemens(16)] | |||
/// <summary> | |||
/// 备用 | |||
/// 生产工单 | |||
/// </summary> | |||
public byte Reserve; | |||
public string RecipeCode { get; set; } | |||
public bool Dosing_Cancel4 { get; set; } | |||
public bool Dosing_Cancel5 { get; set; } | |||
public bool Dosing_Cancel6 { get; set; } | |||
public bool Dosing_Cancel7 { get; set; } | |||
public short Dosing_Cancel8 { get; set; } | |||
public short[] Standby2 { get; set; } = new short[4]; | |||
} | |||
} |
@@ -21,21 +21,22 @@ namespace BPASmartClient.JXJFoodBigStation.Model.Siemens | |||
{ | |||
ThreadManage.GetInstance().StartLong(new Action(() => | |||
{ | |||
var res = this.Siemens_PLC_S7.ReadClass<DL_Start_DB>(1); | |||
var res1 = this.Siemens_PLC_S7.ReadClass<DL_Status_DB>(2); | |||
var res2 = this.Siemens_PLC_S7.ReadClass<DL_Finish_DB>(3); | |||
if (res != null && RTrig.GetInstance("RecipeTrig").Start(res.Ask_For_Send_Bit)) | |||
var res = this.Siemens_PLC_S7.ReadClass<DL_Start_DB>(2301); | |||
var res1 = this.Siemens_PLC_S7.ReadClass<DL_Status_DB>(2331); | |||
var res2 = this.Siemens_PLC_S7.ReadClass<DL_Finish_DB>(2361); | |||
var res3 = this.Siemens_PLC_S7.ReadClass<DL_DataColl_DB>(2391); | |||
/*if (res != null && RTrig.GetInstance("RecipeTrig").Start(res.Ask_For_Send_Bit)) | |||
{ | |||
ActionManage.GetInstance.Send("SiemensSendRecipe", res); | |||
res.Ask_For_Send_Bit = false;//接受配方信号复位 | |||
res.Ack_Ask_For_Send_Bit = true;//配方接受完成 | |||
//res.Ack_Ask_For_Send_Bit = true;//配方接受完成 | |||
this.Siemens_PLC_S7.WriteClass<DL_Start_DB>(res, 1); | |||
} | |||
if (res1 != null && RTrig.GetInstance("Allow_AGV_Put[0]").Start(res1.Allow_AGV_Put[0])) | |||
if (res1 != null && RTrig.GetInstance("Allow_AGV_Put[0]").Start(res1.)) | |||
{ | |||
ActionManage.GetInstance.Send("AGVToStation1Sign", res1); | |||
res1.Allow_AGV_Put[0] = false; | |||
//res1.Allow_AGV_Put[0] = false; | |||
this.Siemens_PLC_S7.WriteClass<DL_Status_DB>(res1, 2); | |||
} | |||
if (res1 != null && RTrig.GetInstance("Allow_AGV_Put[1]").Start(res1.Allow_AGV_Put[1])) | |||
@@ -68,7 +69,7 @@ namespace BPASmartClient.JXJFoodBigStation.Model.Siemens | |||
res1.Allow_AGV_Put[5] = false; | |||
this.Siemens_PLC_S7.WriteClass<DL_Status_DB>(res1, 2); | |||
} | |||
*/ | |||
if (res2 != null && res2.Ask_For_Finish_PLC) | |||
{ | |||
ActionManage.GetInstance.Send("配料完成信号确认完成"); | |||
@@ -80,7 +80,7 @@ namespace BPASmartClient.JXJFoodSmallStation.Model | |||
} | |||
else | |||
{ | |||
MessageNotify.GetInstance.AlarmLog("配方名称与本地不符合"); | |||
//MessageNotify.GetInstance.AlarmLog("配方名称与本地不符合"); | |||
} | |||
} | |||
Json<RemoteRecipeDataColl>.Data.Recipes.Add(new RemoteRecipeData() | |||
@@ -112,7 +112,7 @@ namespace BPASmartClient.JXJFoodSmallStation.Model | |||
try | |||
{ | |||
//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); | |||
if (HKDevice.IsConnected) | |||
{ | |||
@@ -272,7 +272,6 @@ namespace BPASmartClient.JXJFoodSmallStation.Model | |||
break; | |||
default: | |||
break; | |||
} | |||
} | |||
else if (o.ToString().Contains("阻挡气缸")) | |||
@@ -327,7 +326,6 @@ namespace BPASmartClient.JXJFoodSmallStation.Model | |||
break; | |||
default: | |||
break; | |||
} | |||
} | |||
else if (o.ToString().Contains("进料桶顶升气缸")) | |||
@@ -24,6 +24,7 @@ namespace BPASmartClient.JXJFoodSmallStation.Model.Siemens | |||
var res = this.Siemens_PLC_S7.ReadClass<XL_Start_DB>(2201); | |||
var res1 = this.Siemens_PLC_S7.ReadClass<XL_Status_DB>(2231); | |||
var res2 = this.Siemens_PLC_S7.ReadClass<XL_Finish_DB>(2261); | |||
var res4 = this.Siemens_PLC_S7.ReadClass<XL_DataColl_DB>(2291); | |||
if (res != null && res.Order_Request_ACK == false && GVL_SmallStation.GetInstance.IsAllowSiemensSendRecipe) | |||
{ | |||
res.Order_Request_ACK = true; | |||
@@ -0,0 +1,39 @@ | |||
using BPASmartClient.S7Net; | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
namespace BPASmartClient.JXJFoodSmallStation.Model.Siemens | |||
{ | |||
internal class XL_DataColl_DB | |||
{ | |||
[Siemens(16)] | |||
public string RecipeCode { get; set; } | |||
[Siemens(16)] | |||
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]; | |||
public int Reserved1 { get; set; } | |||
public int Reserved2 { get; set; } | |||
} | |||
} |
@@ -9,33 +9,37 @@ namespace BPASmartClient.JXJFoodSmallStation.Model.Siemens | |||
{ | |||
internal class XL_Finish_DB | |||
{ | |||
[Siemens(6)] | |||
/// <summary> | |||
/// 配料完成信号确认 | |||
/// </summary> | |||
public bool Ask_For_Finish_PLC { get; set; } | |||
public short[] StandbyFinish { get; set; }=new short[4]; | |||
[Siemens(16)] | |||
/// <summary> | |||
/// 生产工单编码 | |||
/// </summary | |||
public string Order_No { get; set; } | |||
[Siemens(6)] | |||
[Siemens(16)] | |||
/// <summary> | |||
/// 产品名称 | |||
/// </summary> | |||
public string Product_Code { get; set; } | |||
public short Job_No { get; set; } | |||
public UDT2[] Powder = new UDT2[10]; | |||
public UDT2[] Powder { get; set; } = new UDT2[10]; | |||
/// <summary> | |||
/// 原料信息 | |||
/// </summary> | |||
public UDT1[] Material = new UDT1[20]; | |||
public UDT1[] Material { get; set; } = new UDT1[20]; | |||
public short DosingTime { get; set; } | |||
/// <summary> | |||
/// 配料完成信号 | |||
/// </summary> | |||
public bool Ask_For_Finish { get; set; } | |||
/// <summary> | |||
/// 配料完成信号确认 | |||
/// </summary> | |||
public bool Ask_For_Finish_PLC { get; set; } | |||
public short[] StandbyFinish2 { get; set; } = new short[4]; | |||
} | |||
public class UDT1 | |||
{ | |||
@@ -23,19 +23,19 @@ namespace BPASmartClient.JXJFoodSmallStation.Model.Siemens | |||
public short StockCode { get; set; } | |||
public short TrayCode { get; set; } | |||
public UDT2Start[] Powder = new UDT2Start[10]; | |||
public UDT2Start[] Powder { get; set; } = new UDT2Start[10]; | |||
/// <summary> | |||
/// 物料信息 | |||
/// </summary> | |||
public UDTStart[] Material = new UDTStart[20]; | |||
public UDTStart[] Material { get; set; } = new UDTStart[20]; | |||
/// <summary> | |||
/// plc确认配方接收完成 | |||
/// </summary> | |||
public bool Order_Request_ACK { get; set; } | |||
public short[] Standby = new short[4]; | |||
public short[] Standby { get; set; } = new short[4]; | |||
public bool Order_Request { get; set; } | |||
public short[] Standby1 = new short[4]; | |||
public short[] Standby1 { get; set; } = new short[4]; | |||
} | |||
public class UDTStart | |||
@@ -7,8 +7,16 @@ using System.Threading.Tasks; | |||
namespace BPASmartClient.JXJFoodSmallStation.Model.Siemens | |||
{ | |||
internal class XL_Status_DB | |||
public class XL_Status_DB | |||
{ | |||
public bool Dosing_Confirm { get; set; } | |||
public bool Agv1 { get; set; } | |||
public bool Agv2 { get; set; } | |||
public bool Agv3 { get; set; } | |||
public bool Agv4 { get; set; } | |||
public short AgvPos { get; set; } | |||
public short[] Standby { get; set; } = new short[3]; | |||
[Siemens(16)] | |||
/// <summary> | |||
/// 生产工单 | |||
@@ -18,23 +26,14 @@ namespace BPASmartClient.JXJFoodSmallStation.Model.Siemens | |||
/// 配料开始 | |||
/// </summary> | |||
public bool Dosing_Start { get; set; } | |||
/// <summary> | |||
/// 配料开始确认 | |||
/// </summary> | |||
public bool Dosing_Confirm; | |||
public bool Agv1 { get; set; } | |||
public bool Agv2 { get; set; } | |||
public bool Agv3 { get; set; } | |||
public bool Agv4 { get; set; } | |||
public short AgvPos { get; set; } | |||
public UDTStatus[] Powder = new UDTStatus[10]; | |||
public bool Agv5{ get; set; } | |||
public bool Agv5 { get; set; } | |||
public bool Agv6 { get; set; } | |||
public bool Agv7 { get; set; } | |||
public int Agv8 { get; set; } | |||
public UDTStatus[] Powder { get; set; } = new UDTStatus[10]; | |||
public short AgvUse { get; set; } | |||
public short[] StandbyStatus { get; set; } = new short[4]; | |||
} | |||
public class UDTStatus | |||
{ | |||
@@ -38,19 +38,20 @@ namespace FryPot_DosingSystem | |||
if (res != null && res == true) | |||
{ | |||
mv.Show(); | |||
MessageLog.GetInstance.ShowUserLog("用户登录"); | |||
MessageNotify.GetInstance.ShowUserLog("用户登录"); | |||
try | |||
{ | |||
await Task.Run(() => { DeviceOperate deviceOperate = DeviceOperate.GetInstance; }); | |||
} | |||
catch (Exception) | |||
{ | |||
MessageLog.GetInstance.ShowRunLog("下位机PLC连接失败,请检查无误后重启上位机"); | |||
MessageNotify.GetInstance.ShowRunLog("下位机PLC连接失败,请检查无误后重启上位机"); | |||
} | |||
//开启实时PLC数据读取 | |||
DosingLogicControl logigControl = DosingLogicControl.GetInstance;//开启逻辑控制任务程序 | |||
HubHelper.GetInstance.Connect("172.16.12.100", 8089); | |||
AlarmHelper<AlarmInfo>.Init();//报警实时监控 | |||
HubHelper.GetInstance.Connect("172.16.12.100", 8089); | |||
} | |||
else | |||
mv.Close(); | |||
@@ -180,7 +180,7 @@ namespace FryPot_DosingSystem.Control | |||
string DeviceName = devices.Devices[i].DeviceName; | |||
switch (DeviceName) | |||
{ | |||
case "滚筒输送线": modbus.ModbusTcpConnect(Ip, Convert.ToInt32(Port)); MessageLog.GetInstance.ShowRunLog("滚筒线PLC连接成功"); break; | |||
case "滚筒输送线": modbus.ModbusTcpConnect(Ip, Convert.ToInt32(Port)); MessageNotify.GetInstance.ShowRunLog("滚筒线PLC连接成功"); break; | |||
//case "炒锅1": fryOneModbus.ModbusTcpConnect(Ip, Convert.ToInt32(Port)); MessageLog.GetInstance.ShowRunLog("1号炒锅PLC连接成功"); break; | |||
//case "炒锅2": fryTwoModbus.ModbusTcpConnect(Ip, Convert.ToInt32(Port)); MessageLog.GetInstance.ShowRunLog("2号炒锅PLC连接成功"); break; | |||
//case "炒锅3": fryThreeModbus.ModbusTcpConnect(Ip, Convert.ToInt32(Port)); MessageLog.GetInstance.ShowRunLog("3号炒锅PLC连接成功"); break; | |||
@@ -259,7 +259,7 @@ namespace FryPot_DosingSystem.Control | |||
DeviceManage devices = Json<DeviceManage>.Data; | |||
var res = devices.Devices.FirstOrDefault(p => p.DeviceName == "炒锅1"); | |||
if (res != null) | |||
fryOneModbus.ModbusTcpConnect(res.Ip, Convert.ToInt32(res.Port)); MessageLog.GetInstance.ShowRunLog("1号炒锅PLC重连成功"); | |||
fryOneModbus.ModbusTcpConnect(res.Ip, Convert.ToInt32(res.Port)); MessageNotify.GetInstance.ShowRunLog("1号炒锅PLC重连成功"); | |||
} | |||
Thread.Sleep(10); | |||
}), $"炒锅1实时数据读取线程"); | |||
@@ -289,7 +289,7 @@ namespace FryPot_DosingSystem.Control | |||
DeviceManage devices = Json<DeviceManage>.Data; | |||
var res = devices.Devices.FirstOrDefault(p => p.DeviceName == "炒锅2"); | |||
if (res != null) | |||
fryTwoModbus.ModbusTcpConnect(res.Ip, Convert.ToInt32(res.Port)); MessageLog.GetInstance.ShowRunLog("2号炒锅PLC重连成功"); | |||
fryTwoModbus.ModbusTcpConnect(res.Ip, Convert.ToInt32(res.Port)); MessageNotify.GetInstance.ShowRunLog("2号炒锅PLC重连成功"); | |||
} | |||
Thread.Sleep(10); | |||
}), $"炒锅2实时数据读取线程"); | |||
@@ -319,7 +319,7 @@ namespace FryPot_DosingSystem.Control | |||
DeviceManage devices = Json<DeviceManage>.Data; | |||
var res = devices.Devices.FirstOrDefault(p => p.DeviceName == "炒锅3"); | |||
if (res != null) | |||
fryThreeModbus.ModbusTcpConnect(res.Ip, Convert.ToInt32(res.Port)); MessageLog.GetInstance.ShowRunLog("3号炒锅PLC重连成功"); | |||
fryThreeModbus.ModbusTcpConnect(res.Ip, Convert.ToInt32(res.Port)); MessageNotify.GetInstance.ShowRunLog("3号炒锅PLC重连成功"); | |||
} | |||
Thread.Sleep(10); | |||
}), $"炒锅3实时数据读取线程"); | |||
@@ -349,7 +349,7 @@ namespace FryPot_DosingSystem.Control | |||
DeviceManage devices = Json<DeviceManage>.Data; | |||
var res = devices.Devices.FirstOrDefault(p => p.DeviceName == "炒锅4"); | |||
if (res != null) | |||
fryFourModbus.ModbusTcpConnect(res.Ip, Convert.ToInt32(res.Port)); MessageLog.GetInstance.ShowRunLog("4号炒锅PLC重连成功"); | |||
fryFourModbus.ModbusTcpConnect(res.Ip, Convert.ToInt32(res.Port)); MessageNotify.GetInstance.ShowRunLog("4号炒锅PLC重连成功"); | |||
} | |||
Thread.Sleep(10); | |||
}), $"炒锅4实时数据读取线程"); | |||
@@ -379,7 +379,7 @@ namespace FryPot_DosingSystem.Control | |||
DeviceManage devices = Json<DeviceManage>.Data; | |||
var res = devices.Devices.FirstOrDefault(p => p.DeviceName == "炒锅5"); | |||
if (res != null) | |||
fryFiveModbus.ModbusTcpConnect(res.Ip, Convert.ToInt32(res.Port)); MessageLog.GetInstance.ShowRunLog("5号炒锅PLC重连成功"); | |||
fryFiveModbus.ModbusTcpConnect(res.Ip, Convert.ToInt32(res.Port)); MessageNotify.GetInstance.ShowRunLog("5号炒锅PLC重连成功"); | |||
} | |||
Thread.Sleep(10); | |||
}), $"炒锅5实时数据读取线程"); | |||
@@ -295,7 +295,20 @@ namespace FryPot_DosingSystem.Control | |||
/// </summary> | |||
public bool NextStart { get; set; } | |||
/// <summary> | |||
/// 下位信号判断 | |||
/// </summary> | |||
public bool LowSignalJude { get; set; } | |||
/// <summary> | |||
/// 集中洗桶模式 | |||
/// </summary> | |||
public ushort WashEmptyRollerModel { get; set; } | |||
/// <summary> | |||
/// 洗桶就位信号 | |||
/// </summary> | |||
public ushort WashRollerArriveSignal { get; set; } | |||
} | |||
/// <summary> | |||
/// 滚筒线2相关变量 | |||
@@ -386,6 +399,20 @@ namespace FryPot_DosingSystem.Control | |||
/// 线体1流程控制互锁信号 | |||
/// </summary> | |||
public bool NextStart { get; set; } | |||
/// <summary> | |||
/// 下位信号判断 | |||
/// </summary> | |||
public bool LowSignalJude { get; set; } | |||
/// <summary> | |||
/// 集中洗桶模式 | |||
/// </summary> | |||
public ushort WashEmptyRollerModel { get; set; } | |||
/// <summary> | |||
/// 洗桶就位信号 | |||
/// </summary> | |||
public ushort WashRollerArriveSignal { get; set; } | |||
} | |||
/// <summary> | |||
/// 滚筒线3相关变量 | |||
@@ -477,6 +504,20 @@ namespace FryPot_DosingSystem.Control | |||
/// </summary> | |||
public bool NextStart { get; set; } | |||
/// <summary> | |||
/// 下位信号判断 | |||
/// </summary> | |||
public bool LowSignalJude { get; set; } | |||
/// <summary> | |||
/// 集中洗桶模式 | |||
/// </summary> | |||
public ushort WashEmptyRollerModel { get; set; } | |||
/// <summary> | |||
/// 洗桶就位信号 | |||
/// </summary> | |||
public ushort WashRollerArriveSignal { get; set; } | |||
} | |||
/// <summary> | |||
/// 滚筒线4相关变量 | |||
@@ -1,5 +1,6 @@ | |||
using BPASmartClient.AGV; | |||
using BPASmartClient.Helper; | |||
using FryPot_DosingSystem.Control; | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
@@ -62,8 +63,8 @@ namespace FryPot_DosingSystem.View | |||
private void Button_Click(object sender, RoutedEventArgs e) | |||
{ | |||
AGVHelper.GetInstance.AgvFromLineOneToFryFourLoadRoller(Guid.NewGuid().ToString("D")); | |||
DeviceOperate.GetInstance.WritePlcData("D1060", 0); | |||
// AGVHelper.GetInstance.AgvFromLineOneToFryFourLoadRoller(Guid.NewGuid().ToString("D")); | |||
} | |||
private void Button_Click_1(object sender, RoutedEventArgs e) | |||
@@ -109,8 +109,8 @@ namespace FryPot_DosingSystem.ViewModel | |||
var res = flowProcessModels.Where(p => p.FryMaterialNum == item.MaterialLoc.ToString()); | |||
if (res.Count() > 1) | |||
{ | |||
// NoticeDemoViewModel.OpenMsg(EnumPromptType.Error, App.MainWindow, "提示", $"保存失败,桶号重复!"); | |||
MessageLog.GetInstance.ShowUserLog("保存失败,桶号重复"); | |||
// NoticeDemoViewModel.OpenMsg(EnumPromptType.Error, App.MainWindow, "提示", $"保存失败,桶号重复!"); | |||
MessageNotify.GetInstance.ShowUserLog("保存失败,桶号重复"); | |||
MessageBox.Show("保存失败,桶号重复","提示",MessageBoxButton.OK,MessageBoxImage.Error); | |||
return; | |||
} | |||
@@ -101,18 +101,18 @@ namespace FryPot_DosingSystem.ViewModel | |||
if (materials.Count<=8&& materials.Count> 0) | |||
{ | |||
int lineNum= materials.ElementAt(0).MaterialLoc / 100; | |||
//桶号正确性验证 | |||
for (int i = 0; i < materials.Count; i++) | |||
{ | |||
if (materials.ElementAt(i).MaterialLoc / 100 != lineNum|| materials.ElementAt(i).MaterialLoc % 100!=i+1||lineNum<=0||lineNum>5) | |||
{ | |||
MessageNotify.GetInstance.ShowUserLog($"新建配方【{RecipeName}】无效:【配方中原料桶号异常】"); | |||
NoticeDemoViewModel.OpenMsg(EnumPromptType.Error, App.MainWindow, "提示", $"新建配方【{RecipeName}】无效"); | |||
ActionManage.GetInstance.Send("CloseNewRecipeView"); | |||
return; | |||
} | |||
} | |||
//int lineNum= materials.ElementAt(0).MaterialLoc / 100; | |||
// //桶号正确性验证 | |||
// for (int i = 0; i < materials.Count; i++) | |||
// { | |||
// if (materials.ElementAt(i).MaterialLoc / 100 != lineNum|| materials.ElementAt(i).MaterialLoc % 100!=i+1||lineNum<=0||lineNum>5) | |||
// { | |||
// MessageNotify.GetInstance.ShowUserLog($"新建配方【{RecipeName}】无效:【配方中原料桶号异常】"); | |||
// NoticeDemoViewModel.OpenMsg(EnumPromptType.Error, App.MainWindow, "提示", $"新建配方【{RecipeName}】无效"); | |||
// ActionManage.GetInstance.Send("CloseNewRecipeView"); | |||
// return; | |||
// } | |||
// } | |||
prop: string recipeID = Guid.NewGuid().ToString();//配方唯一ID,后期根据实际要求更改 | |||
var res = Json<RecipeManage>.Data.Recipes.FirstOrDefault(p => p.RecipeId == recipeID); | |||
@@ -144,18 +144,18 @@ namespace FryPot_DosingSystem.ViewModel | |||
{ | |||
if (materials.Count > 0 && materials.Count <= 8) | |||
{ | |||
int lineNum = materials.ElementAt(0).MaterialLoc / 100; | |||
//桶号正确性验证 | |||
for (int i = 0; i < materials.Count; i++) | |||
{ | |||
if (materials.ElementAt(i).MaterialLoc / 100 != lineNum && materials.ElementAt(i).MaterialLoc % 100 != i + 1 || lineNum <= 0 || lineNum > 5) | |||
{ | |||
MessageNotify.GetInstance.ShowUserLog($"另存配方【{RecipeName}】无效:【配方中原料桶号异常】"); | |||
NoticeDemoViewModel.OpenMsg(EnumPromptType.Error, App.MainWindow, "提示", $"另存配方【{RecipeName}】无效"); | |||
ActionManage.GetInstance.Send("CloseNewRecipeView"); | |||
return; | |||
} | |||
} | |||
//int lineNum = materials.ElementAt(0).MaterialLoc / 100; | |||
////桶号正确性验证 | |||
//for (int i = 0; i < materials.Count; i++) | |||
//{ | |||
// if (materials.ElementAt(i).MaterialLoc / 100 != lineNum || materials.ElementAt(i).MaterialLoc % 100 != i + 1 || lineNum <= 0 || lineNum > 5) | |||
// { | |||
// MessageNotify.GetInstance.ShowUserLog($"另存配方【{RecipeName}】无效:【配方中原料桶号异常】"); | |||
// NoticeDemoViewModel.OpenMsg(EnumPromptType.Error, App.MainWindow, "提示", $"另存配方【{RecipeName}】无效"); | |||
// ActionManage.GetInstance.Send("CloseNewRecipeView"); | |||
// return; | |||
// } | |||
//} | |||
bom.materialCollection = materials; | |||
bom.RecipeName = RecipeName; | |||
bom.UpdateTime = DateTime.Now.ToShortDateString(); | |||
@@ -180,18 +180,18 @@ namespace FryPot_DosingSystem.ViewModel | |||
{ | |||
if (materials.Count>0&& materials.Count<=8)//验证配方中原料桶数 | |||
{ | |||
int lineNum = materials.ElementAt(0).MaterialLoc / 100; | |||
//桶号正确性验证 | |||
for (int i = 0; i < materials.Count; i++) | |||
{ | |||
if (materials.ElementAt(i).MaterialLoc / 100 != lineNum && materials.ElementAt(i).MaterialLoc % 100 != i + 1 || lineNum <= 0 || lineNum > 5) | |||
{ | |||
MessageNotify.GetInstance.ShowUserLog($"另存配方【{RecipeName}】无效:【配方中原料桶号异常】"); | |||
NoticeDemoViewModel.OpenMsg(EnumPromptType.Error, App.MainWindow, "提示", $"另存配方【{RecipeName}】无效"); | |||
ActionManage.GetInstance.Send("CloseNewRecipeView"); | |||
return; | |||
} | |||
} | |||
//int lineNum = materials.ElementAt(0).MaterialLoc / 100; | |||
////桶号正确性验证 | |||
//for (int i = 0; i < materials.Count; i++) | |||
//{ | |||
// if (materials.ElementAt(i).MaterialLoc / 100 != lineNum || materials.ElementAt(i).MaterialLoc % 100 != i + 1 || lineNum <= 0 || lineNum > 5) | |||
// { | |||
// MessageNotify.GetInstance.ShowUserLog($"另存配方【{RecipeName}】无效:【配方中原料桶号异常】"); | |||
// NoticeDemoViewModel.OpenMsg(EnumPromptType.Error, App.MainWindow, "提示", $"另存配方【{RecipeName}】无效"); | |||
// ActionManage.GetInstance.Send("CloseNewRecipeView"); | |||
// return; | |||
// } | |||
//} | |||
prop: string recipeID = Guid.NewGuid().ToString();//配方唯一ID,后期根据实际要求更改 | |||
var res = Json<RecipeManage>.Data.Recipes.FirstOrDefault(p => p.RecipeId == recipeID); | |||