Sfoglia il codice sorgente

煮面机修改

master
pry 1 anno fa
parent
commit
25b26e8ea0
5 ha cambiato i file con 124 aggiunte e 36 eliminazioni
  1. +20
    -3
      BPASmartClient.MorkS/Control_Morks.cs
  2. +5
    -0
      BPASmartClient.MorkS/Model/MorksPar.cs
  3. +30
    -1
      BPASmartClient.MorkS/View/ParSet.xaml
  4. +7
    -1
      BPASmartClient.MorkS/ViewModel/ParSetViewModel.cs
  5. +62
    -31
      DosingSystem/Model/DeviceInquire.cs

+ 20
- 3
BPASmartClient.MorkS/Control_Morks.cs Vedi File

@@ -34,7 +34,7 @@ namespace BPASmartClient.MorkS

public override void DoMain()
{
MonitorViewModel.DeviceId = DeviceId;
MonitorViewModel.DeviceId = DeviceId;
ServerInit();
DataParse();
Json<MorksPar>.Read();
@@ -406,7 +406,7 @@ namespace BPASmartClient.MorkS
TakeBowlControl(orderLocInfo.Loc);
SetRecipeNumber(orderLocInfo.RecipeNumber);
OrderChange(mORKS.TakeBowlId, ORDER_STATUS.COOKING);
DeviceProcessLogShow($"订单【{ mORKS.TakeBowlId}】执行取碗控制,位置:[{orderLocInfo.Loc}]");
DeviceProcessLogShow($"订单【{mORKS.TakeBowlId}】执行取碗控制,位置:[{orderLocInfo.Loc}]");
mORKS.TakeBowlInterlock = true;
}
}
@@ -619,7 +619,7 @@ namespace BPASmartClient.MorkS
mORKS.OutMealName = mORKS.IngredientsCompleteName;
mORKS.IngredientsCompleteId = string.Empty;
mORKS.CookNodelId[loc] = string.Empty;
DeviceProcessLogShow($"{loc + 1} 号位置出餐控制,订单ID:{ mORKS.OutMealId}");
DeviceProcessLogShow($"{loc + 1} 号位置出餐控制,订单ID:{mORKS.OutMealId}");

mORKS.OutNoodleing = true;
}
@@ -653,6 +653,12 @@ namespace BPASmartClient.MorkS
WaitMeaLSpeak(mORKS.OutMealName);
}

//加汤
if (Delay.GetInstance("加汤延时判断").Start(mORKS.TakeMealDetect && mORKS.CookCompleteFlatBit, 1))
{
AddSoup();
}

//取餐完成逻辑处理
if (Delay.GetInstance("CompleteChange1").Start(!mORKS.TakeMealDetect, 1) && mORKS.CookCompleteFlatBit == true)
{
@@ -792,6 +798,17 @@ namespace BPASmartClient.MorkS
WriteData("VW6", loc);
}

/// <summary>
/// 加汤控制
/// </summary>
private async void AddSoup()
{
//M0.6
WriteData("M0.6", true);
await Task.Delay(Convert.ToInt32(Json<MorksPar>.Data.AddSoupTime * 1000));
WriteData("M0.6", false);
}

/// <summary>
/// 取碗控制
/// </summary>


+ 5
- 0
BPASmartClient.MorkS/Model/MorksPar.cs Vedi File

@@ -12,5 +12,10 @@ namespace BPASmartClient.MorkS.Model
internal class MorksPar
{
public ObservableCollection<ParSet> parSets { get; set; } = new ObservableCollection<ParSet>();

/// <summary>
/// 加汤时间,单位秒
/// </summary>
public float AddSoupTime { get; set; } = 2;
}
}

+ 30
- 1
BPASmartClient.MorkS/View/ParSet.xaml Vedi File

@@ -76,7 +76,12 @@

<!-- 参数放置面板 -->
<Grid Grid.Row="2">
<ItemsControl ItemsSource="{Binding parSets}">
<Grid.RowDefinitions>
<RowDefinition />
<RowDefinition Height="50" />
</Grid.RowDefinitions>

<ItemsControl Grid.Row="0" ItemsSource="{Binding parSets}">
<ItemsControl.ItemTemplate>
<DataTemplate>
<StackPanel Orientation="Horizontal">
@@ -122,6 +127,30 @@
</ItemsControl.ItemTemplate>
</ItemsControl>

<StackPanel Grid.Row="1" Orientation="Horizontal">
<TextBlock
FontSize="21"
Margin="40 0 0 0"
Style="{StaticResource TextBlockStyle}"
Text="加汤时间:" />
<TextBox
Width="100"
Margin="10,0,0,0"
VerticalAlignment="Center"
Background="Transparent"
BorderBrush="#FF23CACA"
CaretBrush="Aqua"
FontFamily="楷体"
FontSize="21"
Foreground="#ff34f7f7"
Text="{Binding AddSoup}" />
<TextBlock
FontSize="21"
Margin="10 0 0 0"
Style="{StaticResource TextBlockStyle}"
Text="(秒)" />
</StackPanel>

</Grid>

</Grid>


+ 7
- 1
BPASmartClient.MorkS/ViewModel/ParSetViewModel.cs Vedi File

@@ -19,13 +19,19 @@ namespace BPASmartClient.MorkS.ViewModel
SaveInfoCommand = new RelayCommand(SaveSettingData);

ActionManage.GetInstance.Register(SaveSettingData, "初始化设定煮面时间");
}

public RelayCommand SaveInfoCommand { get; set; }

public ObservableCollection<ParSet> parSets { get; set; } = Json<MorksPar>.Data.parSets;

/// <summary>
/// 加汤时间设置
/// </summary>
public float AddSoup { get { return Json<MorksPar>.Data.AddSoupTime; } set { Json<MorksPar>.Data.AddSoupTime = value; OnPropertyChanged(); } }


private void SaveSettingData()
{
List<ushort> values = new List<ushort>();


+ 62
- 31
DosingSystem/Model/DeviceInquire.cs Vedi File

@@ -59,11 +59,42 @@ namespace BPASmartClient.DosingSystem
}
}
Thread.Sleep(200);
}), "设备状态监听",true);
}), "设备状态监听", true);
}

private void aa(int num, string name)
{
DeviceLists.TryAdd($"192.168.1.{num}", new DeviceStatus() { DeviceName = $"{name}" });
TopDeviceCurrentStatuses.Add(new DeviceCurrentStatus()
{
DeviceName = $"{name}",
DeviceNum = num,
Weight = new Random().Next(100, 10000) / 100.0
});
Global.DeviceRawMaterials.Add(new RawMaterialModel()
{
DeviceIp = $"192.168.1.{num}",
RawMaterialName = $"{name}",
});
devices.Add(new Devices()
{
DeviceName = $"{name}",
DeviceNum = num,
IpAddress = $"192.168.1.{num}",
});
}

private void TestData()
{

//aa(1, "盐");
//aa(2, "郫县豆瓣");
//aa(3, "芥菜");
//aa(4, "调味剂");
//aa(5, "香料");
//aa(6, "鸡精");
//aa(7, "味精");

for (int i = 0; i < 8; i++)
{
DeviceLists.TryAdd($"192.168.1.{i + 1}", new DeviceStatus() { DeviceName = $"测试设备{i + 1}" });
@@ -169,7 +200,7 @@ namespace BPASmartClient.DosingSystem
}*/
for (int i = 0; i < 15; i++)
{
IPLists.Add($"{IPSegment}{(i+1)*10}");
IPLists.Add($"{IPSegment}{(i + 1) * 10}");
}

IPLists.ForEach((item) =>
@@ -177,7 +208,7 @@ namespace BPASmartClient.DosingSystem
Ping myPing = new Ping();
myPing.PingCompleted += new PingCompletedEventHandler(_myPing_PingCompleted);
myPing.SendAsync(item, 1000, null);
});
}

@@ -281,7 +312,7 @@ namespace BPASmartClient.DosingSystem
}
else
{
if(e.Reply !=null)
if (e.Reply != null)
IPQueues.Enqueue(e.Reply.Address.ToString());
}
}
@@ -356,39 +387,39 @@ namespace BPASmartClient.DosingSystem
var res = Json<DevicePar>.Data.deviceParModels.FirstOrDefault(p => p.MaterialName == DeviceName);
if (res != null)
{
prop1:
modbusTcp.SetReal(DeviceAddress.SlowlyAddWeight, res.SlowlyAddWeight);
var Value1 = (float)this.modbusTcp.GetReal(DeviceAddress.SlowlyAddWeight);
if (Value1 != null && Value1.ToString() != res.SlowlyAddWeight.ToString()) goto prop1;
prop1:
modbusTcp.SetReal(DeviceAddress.SlowlyAddWeight, res.SlowlyAddWeight);
var Value1 = (float)this.modbusTcp.GetReal(DeviceAddress.SlowlyAddWeight);
if (Value1 != null && Value1.ToString() != res.SlowlyAddWeight.ToString()) goto prop1;
prop2:
modbusTcp.SetReal(DeviceAddress.PreCloseValveWeight, res.PreCloseValveWeight);
var Value2 = (float)this.modbusTcp.GetReal(DeviceAddress.PreCloseValveWeight);
if (Value2 != null && Value2.ToString() != res.PreCloseValveWeight.ToString()) goto prop2;
modbusTcp.SetReal(DeviceAddress.PreCloseValveWeight, res.PreCloseValveWeight);
var Value2 = (float)this.modbusTcp.GetReal(DeviceAddress.PreCloseValveWeight);
if (Value2 != null && Value2.ToString() != res.PreCloseValveWeight.ToString()) goto prop2;
prop3:
modbusTcp.SetUint(DeviceAddress.RapidAcceleration, (uint)res.RapidAcceleration);
var Value3 = this.modbusTcp.GetUint(DeviceAddress.RapidAcceleration);
if (Value3 != null && Value3.ToString() != res.RapidAcceleration.ToString()) goto prop3;
modbusTcp.SetUint(DeviceAddress.RapidAcceleration, (uint)res.RapidAcceleration);
var Value3 = this.modbusTcp.GetUint(DeviceAddress.RapidAcceleration);
if (Value3 != null && Value3.ToString() != res.RapidAcceleration.ToString()) goto prop3;
prop4:
modbusTcp.SetUint(DeviceAddress.SlowAcceleration, (uint)res.SlowAcceleration);
var Value4 = this.modbusTcp.GetUint(DeviceAddress.SlowAcceleration);
if (Value4 != null && Value4.ToString() != res.SlowAcceleration.ToString()) goto prop4;
prop5:
modbusTcp.SetUint(DeviceAddress.ServoManualSpeed, (uint)res.ServoManualSpeed);
var Value5 = this.modbusTcp.GetUint(DeviceAddress.ServoManualSpeed);
if (Value5 != null && Value5.ToString() != res.ServoManualSpeed.ToString()) goto prop5;
modbusTcp.SetUint(DeviceAddress.SlowAcceleration, (uint)res.SlowAcceleration);
var Value4 = this.modbusTcp.GetUint(DeviceAddress.SlowAcceleration);
if (Value4 != null && Value4.ToString() != res.SlowAcceleration.ToString()) goto prop4;
prop5:
modbusTcp.SetUint(DeviceAddress.ServoManualSpeed, (uint)res.ServoManualSpeed);
var Value5 = this.modbusTcp.GetUint(DeviceAddress.ServoManualSpeed);
if (Value5 != null && Value5.ToString() != res.ServoManualSpeed.ToString()) goto prop5;
prop6:
modbusTcp.SetUint(DeviceAddress.SiloUpperLimitWeight, (uint)res.SiloUpperLimitWeight);
var Value6 = this.modbusTcp.GetUint(DeviceAddress.SiloUpperLimitWeight);
if (Value6 != null && Value6.ToString() != res.SiloUpperLimitWeight.ToString()) goto prop6;
modbusTcp.SetUint(DeviceAddress.SiloUpperLimitWeight, (uint)res.SiloUpperLimitWeight);
var Value6 = this.modbusTcp.GetUint(DeviceAddress.SiloUpperLimitWeight);
if (Value6 != null && Value6.ToString() != res.SiloUpperLimitWeight.ToString()) goto prop6;
prop7:
modbusTcp.SetUint(DeviceAddress.LowerLimitWeightOfSilo, (uint)res.LowerLimitWeightOfSilo);
var Value7 = this.modbusTcp.GetUint(DeviceAddress.LowerLimitWeightOfSilo);
if (Value7 != null && Value7.ToString() != res.LowerLimitWeightOfSilo.ToString()) goto prop7;
modbusTcp.SetUint(DeviceAddress.LowerLimitWeightOfSilo, (uint)res.LowerLimitWeightOfSilo);
var Value7 = this.modbusTcp.GetUint(DeviceAddress.LowerLimitWeightOfSilo);
if (Value7 != null && Value7.ToString() != res.LowerLimitWeightOfSilo.ToString()) goto prop7;
prop8:
modbusTcp.SetUint(DeviceAddress.StirringSpeed, (uint)res.StirringSpeed);
var Value8 = this.modbusTcp.GetUint(DeviceAddress.StirringSpeed);
if (Value8 != null && Value8.ToString() != res.StirringSpeed.ToString()) goto prop8;
MessageNotify.GetInstance.ShowRunLog($"{res.MaterialName},配料参数下发完成");
modbusTcp.SetUint(DeviceAddress.StirringSpeed, (uint)res.StirringSpeed);
var Value8 = this.modbusTcp.GetUint(DeviceAddress.StirringSpeed);
if (Value8 != null && Value8.ToString() != res.StirringSpeed.ToString()) goto prop8;
MessageNotify.GetInstance.ShowRunLog($"{res.MaterialName},配料参数下发完成");
}
//prop9:
// modbusTcp.SetReal(DeviceAddress.WeightSet, Value);//写入配方重量


Caricamento…
Annulla
Salva