Pārlūkot izejas kodu

上传

一拖四味魔方配料系统
lyw pirms 8 mēnešiem
vecāks
revīzija
3af0babd2a
7 mainītis faili ar 68 papildinājumiem un 19 dzēšanām
  1. +19
    -5
      DosingSystem/ExcuteControl .cs
  2. +2
    -0
      DosingSystem/Model/DeviceAddress.cs
  3. +13
    -10
      DosingSystem/Model/DeviceInquire.cs
  4. +4
    -1
      DosingSystem/Model/RawMaterialDeviceStatus.cs
  5. +5
    -1
      DosingSystem/Model/par/BasePar.cs
  6. +23
    -0
      DosingSystem/View/CommParSetView.xaml
  7. +2
    -2
      DosingSystem/ViewModel/RecipeControlViewModel.cs

+ 19
- 5
DosingSystem/ExcuteControl .cs Parādīt failu

@@ -547,7 +547,7 @@ namespace BPASmartClient.DosingSystem
else
{
passPail_1 = passPail - 1;
recipNameNum_1 = recipeNameNum;
recipNameNum_1 = doDeviceCount["192.168.2.170"]-1;
}
if (recipeNameNum == 0)
{
@@ -643,11 +643,14 @@ namespace BPASmartClient.DosingSystem
}

int recipecount = recipeProcesses.Count - (recipeNameNum - UserTreeCompelete.Count);
int re =-1;
int re = 0;
if (recipeNameNum - UserTreeCompelete.Count == 0)
{
re = -1;
}
if (recipecount < recipeProcesses.Count && recipecount >= 0)
{
re = recipeProcesses.ElementAt(recipecount).RawMaterials.ToList().FindIndex(a => a.RawMaterialName == DeviceInquire.GetInstance.DeviceLists[ip].DeviceName && a.Loc == DeviceInquire.GetInstance.DeviceLists[ip].deviceStatus.PassPail && a.RecipeStatus != 3);

}
if (maxPail <= passPail && recipeNameNum < RecipeNames.Count && !DeviceInquire.GetInstance.DeviceLists[ip].deviceStatus.PailArrive&&re<0&& recipNameNum_1==recipeNameNum)
{
@@ -718,8 +721,19 @@ namespace BPASmartClient.DosingSystem
}

}

#endregion
#region 正在配料记重
if (recipecount < recipeProcesses.Count && recipecount >= 0&& DeviceInquire.GetInstance.DeviceLists[ip].deviceStatus.RunStatus==2)
{
int re_1 = recipeProcesses.ElementAt(recipecount).RawMaterials.ToList().FindIndex(a => a.RawMaterialName == DeviceInquire.GetInstance.DeviceLists[ip].DeviceName && a.Loc == DeviceInquire.GetInstance.DeviceLists[ip].deviceStatus.PassPail && a.RecipeStatus == 2);
if (re_1>=0)
{
recipeProcesses.ElementAt(recipecount).RawMaterials.ElementAt(re_1).TotalWeight = DeviceInquire.GetInstance.DeviceLists[ip].deviceStatus.RealWeightFeedback;
}
}
#endregion

#region 完成计重
if (DeviceInquire.GetInstance.DeviceLists[ip].deviceStatus.Finish_mt && passPail_1 == passPail - 1)
{
@@ -732,7 +746,7 @@ namespace BPASmartClient.DosingSystem
float xx = DeviceInquire.GetInstance.DeviceLists[ip].deviceStatus.CutWeightFeedback;
recipeProcesses.ElementAt(recipecount).RawMaterials.ElementAt(re_1).TotalWeight = xx;
float t = Math.Abs(recipeProcesses.ElementAt(recipecount).RawMaterials.ElementAt(re_1).TotalWeight - recipeProcesses.ElementAt(recipecount).RawMaterials.ElementAt(re_1).RawMaterialWeight);
if (t > 2)
if (t > Json<DevicePar>.Data.BaseParModel.Limit)
{
SimensSend.GetInstance.SendSimens.Write<bool>("M11.2", true);
while (!MessageNotify.GetInstance.ShowDialog($"设备{dnum}物料下料超出范围报警,请处理后点击确认!", DialogType.Warning))


+ 2
- 0
DosingSystem/Model/DeviceAddress.cs Parādīt failu

@@ -12,6 +12,8 @@ namespace BPASmartClient.DosingSystem
public static string Finish_Point { get; set; } = "LW49";

public static string WorkModel { get; set; } = "LW50";

public static string RealtimeWeight { get; set; } = "LW54";
/// <summary>
/// 料仓重量反馈起始地址
/// </summary>


+ 13
- 10
DosingSystem/Model/DeviceInquire.cs Parādīt failu

@@ -439,9 +439,7 @@ namespace BPASmartClient.DosingSystem
return Task.Factory.StartNew(() => {
if (deviceStatus.DeviceNum > 0) {
int dnum = deviceStatus.DeviceNum;
ushort reset = 0;
reset = reset.SetBitValue(1, true);
modbusTcp.Write<ushort>(DeviceAddress.Finish_Point.ToAdd(), reset);
modbusTcp.Write<ushort>(DeviceAddress.Finish_Point.ToAdd(), 1);
Thread.Sleep(100);
modbusTcp.Write<ushort>(DeviceAddress.Finish_Point.ToAdd(), 0);
modbusTcp.Write<ushort>(DeviceAddress.Start.ToAdd(), 0);
@@ -475,13 +473,11 @@ namespace BPASmartClient.DosingSystem

public void Reset1()
{
ushort reset = 0;
reset = reset.SetBitValue(1, true);
modbusTcp.Write<ushort>(DeviceAddress.Finish_Point.ToAdd(), reset);
Thread.Sleep(10);
modbusTcp.Write<ushort>(DeviceAddress.Finish_Point.ToAdd(), 0);
modbusTcp.Write<ushort>(DeviceAddress.Start.ToAdd(), 0);
modbusTcp.Write<ushort>(DeviceAddress.Finish_Point.ToAdd(), 1);
Thread.Sleep(200);
modbusTcp.Write<ushort>(DeviceAddress.Finish_Point.ToAdd(), 0);
modbusTcp.Write<ushort>(DeviceAddress.Start.ToAdd(), 0);

}

public Task UpdateState(float weight)
@@ -516,6 +512,13 @@ namespace BPASmartClient.DosingSystem
//获取设备运行状态
var rs = this.modbusTcp.Read<ushort>(DeviceAddress.RunStatus.ToAdd(), 1, BPA.Helper.DataFormat.CDAB);
if (rs.IsSuccess) deviceStatus.RunStatus = rs.Content;

var rw = this.modbusTcp.Read<float>(DeviceAddress.RealtimeWeight.ToAdd(), 2, DataFormat.CDAB);
if (rw.IsSuccess)
{
deviceStatus.RealWeightFeedback = rw.Content;
}

////获取设备料仓剩余重量
var wf = this.modbusTcp.Read<uint>(DeviceAddress.WeightFeedback.ToAdd(), 1, BPA.Helper.DataFormat.CDAB);
if (wf.IsSuccess) deviceStatus.WeightFeedback = (uint)(wf.Content);


+ 4
- 1
DosingSystem/Model/RawMaterialDeviceStatus.cs Parādīt failu

@@ -37,7 +37,10 @@ namespace BPASmartClient.DosingSystem
/// 下料重量反馈
/// </summary>
public float CutWeightFeedback { get; set; }

/// <summary>
/// 下料重量反馈
/// </summary>
public float RealWeightFeedback { get; set; }
/// <summary>
/// 设备运行状态
/// 0:未知


+ 5
- 1
DosingSystem/Model/par/BasePar.cs Parādīt failu

@@ -27,7 +27,11 @@ namespace BPASmartClient.DosingSystem
public int StockCount { get { return _stockCount; } set { _stockCount = value; OnPropertyChanged(); } }
private int _stockCount = 18;


/// <summary>
/// 料仓数量
/// </summary>
public int Limit { get { return _limit; } set { _limit = value; OnPropertyChanged(); } }
private int _limit = 2;
/// <summary>
/// 当前使用的输送线类型
/// </summary>


+ 23
- 0
DosingSystem/View/CommParSetView.xaml Parādīt failu

@@ -383,6 +383,29 @@
Text="{Binding CommBaseParModel.ConveyerBeltCount, UpdateSourceTrigger=PropertyChanged}" />
</Grid>

<Grid
Width="350"
Margin="5"
Background="Transparent">
<Grid.ColumnDefinitions>
<ColumnDefinition />
<ColumnDefinition />
</Grid.ColumnDefinitions>
<TextBlock
Margin="0,0,2,0"
HorizontalAlignment="Right"
Style="{StaticResource TextBlockStyle}"
Text="下料重量限制/g:" />

<TextBox
Grid.Column="1"
Width="170"
Height="35"
HorizontalAlignment="Right"
FontSize="20"
Style="{StaticResource TextBoxStyle}"
Text="{Binding CommBaseParModel.Limit, UpdateSourceTrigger=PropertyChanged}" />
</Grid>
</WrapPanel>

<!--<Grid Grid.Row="2" Grid.ColumnSpan="4">


+ 2
- 2
DosingSystem/ViewModel/RecipeControlViewModel.cs Parādīt failu

@@ -75,8 +75,8 @@ namespace BPASmartClient.DosingSystem.ViewModel
Clear = new BPARelayCommand(() =>
{

//DeviceInquire.GetInstance.DeviceLists["192.168.2.20"].Reset1();
//MessageNotify.GetInstance.ShowRunLog("复位LW50");
/* DeviceInquire.GetInstance.DeviceLists["192.168.2.160"].Reset1();
MessageNotify.GetInstance.ShowRunLog("复位LW50");*/

Parallel.ForEach(DeviceInquire.GetInstance.devices, item =>
{


Notiek ielāde…
Atcelt
Saglabāt