@@ -189,7 +189,7 @@ namespace BPASmartClient.JXJFoodBigStation.Model.HK_PLC | |||
} | |||
if (Math.Round(weight0, 1) != Math.Round(ReadWeight, 1)) | |||
{ | |||
MessageNotify.GetInstance.ShowRunLog($"地址:{Address},配方重量0,读取plc值{ReadWeight}"); | |||
MessageNotify.GetInstance.ShowRunLog($"地址:{Address},配方重量为0,读取plc值{ReadWeight}"); | |||
return false; | |||
} | |||
} | |||
@@ -228,6 +228,14 @@ namespace BPASmartClient.JXJFoodBigStation.Model | |||
MessageNotify.GetInstance.ShowRunLog($"配方编号:{code},托盘编号:{trayCode},订单类型为洗桶"); | |||
HKDevice.WritePlcRecipeData(LocalRecipes.ElementAt(index)); | |||
Thread.Sleep(200); | |||
if (!HKDevice.ReadPlcRecipeData(LocalRecipes.ElementAt(index))) | |||
{ | |||
App.Current.Dispatcher.Invoke(() => | |||
{ | |||
MessageNotify.GetInstance.ShowDialog($"plc配方数据和西门子配方数据不一致!", DialogType.Error); | |||
}); | |||
}; | |||
HKDevice.HK_PLC_S7.Write("DB99.DBX0.3", true); | |||
GVL_BigStation.Recipe1DosingStatus = 1; | |||
MessageNotify.GetInstance.ShowRunLog($"配方编号:{code},托盘编号:{trayCode},下发完成"); | |||
@@ -286,6 +286,13 @@ namespace BPASmartClient.JXJFoodSmallStation.Model | |||
/// </summary> | |||
public bool WindSendDosingComple { get; set; } = false; | |||
[VarComm("Global", "粉料仓配料状态")] | |||
/// <summary> | |||
/// 粉料仓配料状态(0:无意义,1:粉料仓下配方,2:plc接收配方完成,3:粉料仓配料完成,4:粉料仓配料完成信号复位,5:排料完成) | |||
/// </summary> | |||
public int WindSendDosingStatus { get; set; } = 0; | |||
[VarComm("Global", "PLC的系统模式 DB44.DBX0.1")] | |||
/// <summary> | |||
/// PLC的系统模式 DB44.DBX0.1 | |||
@@ -243,7 +243,7 @@ namespace BPASmartClient.JXJFoodSmallStation.Model | |||
if (GVL_SmallStation.GetInstance.WindSendDosingComple) | |||
{ | |||
//HKDevice.HK_PLC_S7.Write<bool>("DB4.DBX1.7", true); | |||
HKDevice.HK_PLC_S7.Write<bool>("DB4.DBX2.0", true); | |||
HKDevice.HK_PLC_S7.Write<bool>("DB4.DBX4.0", true); | |||
GVL_SmallStation.GetInstance.WindSendDosingComple = false; | |||
MessageNotify.GetInstance.ShowRunLog("风送配料完成信号,发给产线plc信号"); | |||
} | |||
@@ -528,6 +528,8 @@ namespace BPASmartClient.JXJFoodSmallStation.Model | |||
RecipeQueueTray[i].Clear(); | |||
GVL_SmallStation.GetInstance.RecipeProcessStatus[i] = 0; | |||
} | |||
GVL_SmallStation.GetInstance.WindSendDosingStatus = 0; | |||
GVL_SmallStation.GetInstance.WindSendDosing = false; | |||
} | |||
} | |||
else | |||
@@ -568,6 +570,8 @@ namespace BPASmartClient.JXJFoodSmallStation.Model | |||
RecipeQueueTray[i].Clear(); | |||
GVL_SmallStation.GetInstance.RecipeProcessStatus[i] = 0; | |||
} | |||
GVL_SmallStation.GetInstance.WindSendDosingStatus = 0; | |||
GVL_SmallStation.GetInstance.WindSendDosing = false; | |||
} | |||
} | |||
} | |||
@@ -691,41 +695,75 @@ namespace BPASmartClient.JXJFoodSmallStation.Model | |||
else | |||
{ | |||
//粉料仓下发配方 | |||
if (GVL_SmallStation.GetInstance.IsUseWindSend && GVL_SmallStation.GetInstance.Tray_AGVLogic[recipeNum] == 2 && GVL_SmallStation.GetInstance.WindSendDosing == false) | |||
if (GVL_SmallStation.GetInstance.IsUseWindSend && GVL_SmallStation.GetInstance.WindSendDosing == false /*&& GVL_SmallStation.GetInstance.Tray_AGVLogic[recipeNum] == 2*/) | |||
{ | |||
if (WindSendDevice.IsConnected) | |||
{ | |||
WindSendData.TargetRecipeCode = code; | |||
WindSendData.IsAllowDosing = true; | |||
foreach (var item in RemoteRecipes.ElementAt(index).WindSend) | |||
if (GVL_SmallStation.GetInstance.WindSendDosingStatus == 1) | |||
{ | |||
if (item.RawMaterialName == Json<DevicePar>.Data.windSendRawMaterial.ElementAt(0).RawMaterialName) | |||
WindSendReset(); | |||
WindSendData.TargetRecipeCode = code; | |||
WindSendData.IsAllowDosing = true; | |||
foreach (var item in RemoteRecipes.ElementAt(index).WindSend) | |||
{ | |||
WindSendData.RawMaterial1_SetWeight = item.RawMaterialWeight; | |||
} | |||
if (item.RawMaterialName == Json<DevicePar>.Data.windSendRawMaterial.ElementAt(1).RawMaterialName) | |||
{ | |||
WindSendData.RawMaterial2_SetWeight = item.RawMaterialWeight; | |||
} | |||
if (item.RawMaterialName == Json<DevicePar>.Data.windSendRawMaterial.ElementAt(2).RawMaterialName) | |||
{ | |||
WindSendData.RawMaterial3_SetWeight = item.RawMaterialWeight; | |||
} | |||
if (item.RawMaterialName == Json<DevicePar>.Data.windSendRawMaterial.ElementAt(3).RawMaterialName) | |||
{ | |||
WindSendData.RawMaterial4_SetWeight = item.RawMaterialWeight; | |||
} | |||
if (item.RawMaterialName == Json<DevicePar>.Data.windSendRawMaterial.ElementAt(4).RawMaterialName) | |||
{ | |||
WindSendData.RawMaterial5_SetWeight = item.RawMaterialWeight; | |||
if (item.RawMaterialName == Json<DevicePar>.Data.windSendRawMaterial.ElementAt(0).RawMaterialName || item.Location == 1) | |||
{ | |||
WindSendData.RawMaterial1_SetWeight = item.RawMaterialWeight; | |||
MessageNotify.GetInstance.ShowRunLog($"风送料仓{item.RawMaterialName},设定重量{item.RawMaterialWeight}"); | |||
} | |||
else | |||
{ | |||
WindSendData.RawMaterial1_SetWeight = 0; | |||
} | |||
if (item.RawMaterialName == Json<DevicePar>.Data.windSendRawMaterial.ElementAt(1).RawMaterialName || item.Location == 2) | |||
{ | |||
WindSendData.RawMaterial2_SetWeight = item.RawMaterialWeight; | |||
MessageNotify.GetInstance.ShowRunLog($"风送料仓{item.RawMaterialName},设定重量{item.RawMaterialWeight}"); | |||
} | |||
else | |||
{ | |||
WindSendData.RawMaterial2_SetWeight = 0; | |||
} | |||
if (item.RawMaterialName == Json<DevicePar>.Data.windSendRawMaterial.ElementAt(2).RawMaterialName || item.Location == 3) | |||
{ | |||
WindSendData.RawMaterial3_SetWeight = item.RawMaterialWeight; | |||
MessageNotify.GetInstance.ShowRunLog($"风送料仓{item.RawMaterialName},设定重量{item.RawMaterialWeight}"); | |||
} | |||
else | |||
{ | |||
WindSendData.RawMaterial3_SetWeight = 0; | |||
} | |||
if (item.RawMaterialName == Json<DevicePar>.Data.windSendRawMaterial.ElementAt(3).RawMaterialName || item.Location == 4) | |||
{ | |||
WindSendData.RawMaterial4_SetWeight = item.RawMaterialWeight; | |||
MessageNotify.GetInstance.ShowRunLog($"风送料仓{item.RawMaterialName},设定重量{item.RawMaterialWeight}"); | |||
} | |||
else | |||
{ | |||
WindSendData.RawMaterial4_SetWeight = 0; | |||
} | |||
if (item.RawMaterialName == Json<DevicePar>.Data.windSendRawMaterial.ElementAt(4).RawMaterialName || item.Location == 5) | |||
{ | |||
WindSendData.RawMaterial5_SetWeight = item.RawMaterialWeight; | |||
MessageNotify.GetInstance.ShowRunLog($"风送料仓{item.RawMaterialName},设定重量{item.RawMaterialWeight}"); | |||
} | |||
else | |||
{ | |||
WindSendData.RawMaterial5_SetWeight = 0; | |||
} | |||
} | |||
GVL_SmallStation.GetInstance.WindSendDosing = true; | |||
GVL_SmallStation.GetInstance.WindSendDosingStatus = 2; | |||
WindSendDevice.Siemens_PLC_S7.WriteClass<WindSend_Write>(WindSendData, 95); | |||
} | |||
GVL_SmallStation.GetInstance.WindSendDosing = true; | |||
WindSendDevice.Siemens_PLC_S7.WriteClass<WindSend_Write>(WindSendData, 95); | |||
} | |||
else | |||
{ | |||
MessageNotify.GetInstance.ShowRunLog($"风送设备PLC未连接"); | |||
if (Delay.GetInstance("delayTime").Start(true,60)) | |||
{ | |||
Delay.GetInstance("delayTime").Start(false, 60); | |||
MessageNotify.GetInstance.ShowRunLog($"风送设备PLC未连接"); | |||
} | |||
} | |||
} | |||
if (GVL_SmallStation.GetInstance.RecipeProcessStatus[recipeNum] == 0) | |||
@@ -1247,6 +1285,9 @@ namespace BPASmartClient.JXJFoodSmallStation.Model | |||
Json<RemoteRecipeDataColl>.Data.Recipes.Clear(); | |||
GVL_SmallStation.GetInstance.SiemensSendRecipeStatus = 0; | |||
GVL_SmallStation.GetInstance.WindSendDosingStatus = 0; | |||
GVL_SmallStation.GetInstance.WindSendDosing = false; | |||
GVL_SmallStation.GetInstance.Order_Cancel = false; | |||
GVL_SmallStation.GetInstance.Order_CancelRecipeCode = ""; | |||
GVL_SmallStation.GetInstance.OrderCancelStep = 0; | |||
@@ -1258,6 +1299,7 @@ namespace BPASmartClient.JXJFoodSmallStation.Model | |||
GVL_SmallStation.GetInstance.Tray_AGVLogic[i] = 0; | |||
} | |||
StockBinInit(); | |||
WindSendReset(); | |||
//for (int i = 0; i < GVL_SmallStation.GetInstance.StockInDosingComple.Length; i++) | |||
//{ | |||
// GVL_SmallStation.GetInstance.StockInDosingComple[i] = false; | |||
@@ -1469,6 +1511,15 @@ namespace BPASmartClient.JXJFoodSmallStation.Model | |||
} | |||
} | |||
} | |||
private void WindSendReset() | |||
{ | |||
float weight = (float)0.0; | |||
WindSendDevice.Siemens_PLC_S7.Write("DB95.DBD0", weight); | |||
WindSendDevice.Siemens_PLC_S7.Write("DB95.DBD4", weight); | |||
WindSendDevice.Siemens_PLC_S7.Write("DB95.DBD8", weight); | |||
WindSendDevice.Siemens_PLC_S7.Write("DB95.DBD12", weight); | |||
WindSendDevice.Siemens_PLC_S7.Write("DB95.DBX38.1", false); | |||
} | |||
public void RawMaterialNameWithCode() | |||
{ | |||
GVL_SmallStation.GetInstance.RawMaterialsNameCode.Clear(); | |||
@@ -28,6 +28,16 @@ namespace BPASmartClient.JXJFoodSmallStation.Model | |||
/// </summary> | |||
public static string Start { get; set; } = "LW20"; | |||
/// <summary> | |||
/// 开盖地址 | |||
/// </summary> | |||
public static string OpenLid { get; set; } = ""; | |||
/// <summary> | |||
/// 关盖地址 | |||
/// </summary> | |||
public static string CloseLid { get; set; } = ""; | |||
/// <summary> | |||
/// 下料重量反馈地址 | |||
/// </summary> | |||
@@ -385,6 +385,21 @@ namespace BPASmartClient.JXJFoodSmallStation.Model | |||
this.modbusTcp.SetString(DeviceAddress.DeviceName, name); | |||
} | |||
/// <summary> | |||
/// 开盖 | |||
/// </summary> | |||
public void OpenLid() | |||
{ | |||
//modbusTcp.Write(DeviceAddress.OpenLid, (ushort)1); | |||
} | |||
/// <summary> | |||
/// 关盖 | |||
/// </summary> | |||
public void CloseLid() | |||
{ | |||
//modbusTcp.Write(DeviceAddress.CloseLid, (ushort)1); | |||
} | |||
public bool StatusReset() | |||
{ | |||
return this.modbusTcp.Write(DeviceAddress.FinfishStatus, (ushort)1); | |||
@@ -29,19 +29,62 @@ namespace BPASmartClient.JXJFoodSmallStation.Model | |||
{ | |||
GVL_SmallStation.GetInstance.WindSendAllowAGVPutGet = readData.HoodLiftInPlace; | |||
Siemens_PLC_S7.Write<bool>("DB95.DBX38.2", GVL_SmallStation.GetInstance.Station1HaveTray);//工站1有托盘 | |||
if (res1.RecipeReceiveFinish) | |||
{ | |||
Siemens_PLC_S7.Write<bool>("DB95.DBX38.0", false); | |||
} | |||
if (RTrig.GetInstance("CurrentCompleteSign").Start(readData.CurrentCompleteSign)) | |||
switch (GVL_SmallStation.GetInstance.WindSendDosingStatus) | |||
{ | |||
GVL_SmallStation.GetInstance.WindSendDosingComple = true; | |||
Siemens_PLC_S7.Write("DB95.DBX38.1", true); | |||
} | |||
if (TTrig.GetInstance("CurrentCompleteSign").Start(readData.CurrentCompleteSign)) | |||
{ | |||
Siemens_PLC_S7.Write("DB95.DBX38.1", false); | |||
case 0: | |||
if (res1.IsAllowIssue) | |||
{ | |||
GVL_SmallStation.GetInstance.WindSendDosingStatus = 1; | |||
} | |||
break; | |||
case 2: | |||
if (res1.RecipeReceiveFinish) | |||
{ | |||
Siemens_PLC_S7.Write<bool>("DB95.DBX38.0", false); | |||
GVL_SmallStation.GetInstance.WindSendDosingStatus = 3; | |||
} | |||
break; | |||
case 3: | |||
if (readData.CurrentCompleteSign) | |||
{ | |||
Siemens_PLC_S7.Write("DB95.DBX38.1", true); | |||
GVL_SmallStation.GetInstance.WindSendDosingStatus = 4; | |||
} | |||
break; | |||
case 4: | |||
if (!readData.CurrentCompleteSign) | |||
{ | |||
Siemens_PLC_S7.Write("DB95.DBX38.1", false); | |||
GVL_SmallStation.GetInstance.WindSendDosingStatus = 5; | |||
} | |||
break; | |||
case 5: | |||
if (readData.HoodLiftInPlace && readData.DisChargeComple) | |||
{ | |||
GVL_SmallStation.GetInstance.WindSendDosingComple = true; | |||
GVL_SmallStation.GetInstance.WindSendDosingStatus = 0; | |||
} | |||
break; | |||
//case 5: | |||
// if (TTrig.GetInstance("HoodLiftInPlaceSign").Start(readData.HoodLiftInPlace)) | |||
// { | |||
// GVL_SmallStation.GetInstance.WindSendDosingStatus = 6; | |||
// } | |||
// break; | |||
//case 6: | |||
// if (RTrig.GetInstance("HoodLiftInPlaceSign").Start(readData.HoodLiftInPlace)) | |||
// { | |||
// GVL_SmallStation.GetInstance.WindSendDosingStatus = 7; | |||
// } | |||
// break; | |||
//case 7: | |||
// GVL_SmallStation.GetInstance.WindSendDosingComple = true; | |||
// GVL_SmallStation.GetInstance.WindSendDosingStatus = 0; | |||
// break; | |||
default: | |||
break; | |||
} | |||
} | |||
//测试 | |||
/*var res = this.Siemens_PLC_S7.ReadClass<WindSend_Write>(95); | |||
@@ -22,6 +22,14 @@ namespace BPASmartClient.JXJFoodSmallStation.Model.WindSend | |||
/// </summary> | |||
public bool CurrentCompleteSign { get; set; } | |||
/// <summary> | |||
/// 允许下发信号 | |||
/// </summary> | |||
public bool IsAllowIssue { get; set; } | |||
/// <summary> | |||
/// 排料完成信号 | |||
/// </summary> | |||
public bool DisChargeComple { get; set; } | |||
/// <summary> | |||
/// 当前配方编码 | |||
/// </summary> | |||
[Siemens(16)] | |||
@@ -33,7 +33,7 @@ namespace BPASmartClient.JXJFoodSmallStation.Model.WindSend | |||
/// 目标配方编码 | |||
/// </summary> | |||
[Siemens(16)] | |||
public string TargetRecipeCode { get; set; } | |||
public string TargetRecipeCode { get; set; } = ""; | |||
/// <summary> | |||
/// 允许配料 | |||
/// </summary> | |||
@@ -97,6 +97,7 @@ | |||
<RowDefinition /> | |||
<RowDefinition /> | |||
<RowDefinition /> | |||
<RowDefinition /> | |||
</Grid.RowDefinitions> | |||
<TextBlock | |||
@@ -136,6 +137,32 @@ | |||
FontSize="16" | |||
IsEnabled="{Binding IsEnable}" | |||
Style="{StaticResource ImageButtonStyle}" /> | |||
<WrapPanel Grid.Row="3"> | |||
<Button | |||
Width="65" | |||
Height="30" | |||
Margin="0,0,0,0" | |||
VerticalAlignment="Top" | |||
Command="{Binding DataContext.Open, RelativeSource={RelativeSource AncestorType=ListView, Mode=FindAncestor}}" | |||
CommandParameter="{Binding IpAddress}" | |||
Content="开盖" | |||
FontSize="16" | |||
IsEnabled="{Binding IsEnable}" | |||
Style="{StaticResource ImageButtonStyle}" /> | |||
<Button | |||
Width="65" | |||
Height="30" | |||
Margin="10,0,0,0" | |||
VerticalAlignment="Top" | |||
Command="{Binding DataContext.Close, RelativeSource={RelativeSource AncestorType=ListView, Mode=FindAncestor}}" | |||
CommandParameter="{Binding IpAddress}" | |||
Content="关盖" | |||
FontSize="16" | |||
IsEnabled="{Binding IsEnable}" | |||
Style="{StaticResource ImageButtonStyle}" /> | |||
</WrapPanel> | |||
<!--<Button | |||
Grid.Row="1" | |||
@@ -27,6 +27,23 @@ namespace BPASmartClient.JXJFoodSmallStation.ViewModel | |||
cdn.ShowDialog(); | |||
} | |||
}); | |||
Open = new RelayCommand<object>((o) => | |||
{ | |||
if (o != null && o is string str) | |||
{ | |||
DeviceInquire.GetInstance.GetDevice(str).OpenLid();//设置PLC名称 | |||
} | |||
}); | |||
Close = new RelayCommand<object>((o) => | |||
{ | |||
if (o != null && o is string str) | |||
{ | |||
DeviceInquire.GetInstance.GetDevice(str).CloseLid();//设置PLC名称 | |||
} | |||
}); | |||
devices = DeviceInquire.GetInstance.devices; | |||
/*foreach (var device in devices) | |||
{ | |||
@@ -36,6 +53,8 @@ namespace BPASmartClient.JXJFoodSmallStation.ViewModel | |||
} | |||
public RelayCommand<object> ChangeNameCommand { get; set; } | |||
public RelayCommand<object> Open { get; set; } | |||
public RelayCommand<object> Close { get; set; } | |||
//public static ObservableCollection<Devices> devices { get; set; } = new ObservableCollection<Devices>(); | |||
public ObservableCollection<Devices> devices { get; set; } | |||
@@ -38,6 +38,7 @@ namespace BPASmartClient.JXJFoodSmallStation.ViewModel | |||
RawMaterialType = "粉料", | |||
RawMaterialName = item1.RawMaterialName, | |||
RawMaterialWeight = item1.RawMaterialWeight, | |||
RawMaterialLocation = item1.Location, | |||
RawMaterialBarrelNum = 3, | |||
}); | |||
} | |||
@@ -148,15 +149,13 @@ namespace BPASmartClient.JXJFoodSmallStation.ViewModel | |||
RawMaterialWeight = item.RawMaterialWeight, | |||
}); | |||
} | |||
} | |||
foreach (var item in AllRawMaterial) | |||
{ | |||
if (item.RawMaterialType == "粉料") | |||
{ | |||
WindSendRawMaterials.Add(new WindSendRawMaterial() | |||
{ | |||
RawMaterialName = item.RawMaterialName, | |||
RawMaterialWeight = item.RawMaterialWeight, | |||
Location = item.RawMaterialLocation, | |||
}); | |||
} | |||
} | |||
@@ -182,15 +181,13 @@ namespace BPASmartClient.JXJFoodSmallStation.ViewModel | |||
RawMaterialWeight = item.RawMaterialWeight, | |||
}); | |||
} | |||
} | |||
foreach (var item in AllRawMaterial) | |||
{ | |||
if (item.RawMaterialType == "粉料") | |||
{ | |||
WindSendRawMaterials.Add(new WindSendRawMaterial() | |||
{ | |||
RawMaterialName = item.RawMaterialName, | |||
RawMaterialWeight = item.RawMaterialWeight, | |||
Location = item.RawMaterialLocation, | |||
}); | |||
} | |||
} | |||