Browse Source

小配料上位机优化

master
pry 2 years ago
parent
commit
97c5805f85
12 changed files with 345 additions and 97 deletions
  1. +21
    -6
      BPASmartClient.CustomResource/Pages/View/LoginView.xaml
  2. +1
    -1
      BPASmartClient.CustomResource/RecDictionarys/RecComboBox.xaml
  3. +12
    -10
      BPASmartClient.SmallBatchingSystem/App.xaml.cs
  4. +2
    -2
      BPASmartClient.SmallBatchingSystem/Models/CommunicationPar.cs
  5. +251
    -66
      BPASmartClient.SmallBatchingSystem/Services/Control.cs
  6. +21
    -1
      BPASmartClient.SmallBatchingSystem/Services/PlcServer.cs
  7. +7
    -2
      BPASmartClient.SmallBatchingSystem/ViewModels/NewOutletViewModel.cs
  8. +14
    -0
      BPASmartClient.SmallBatchingSystem/ViewModels/NewSiloViewModel.cs
  9. +10
    -7
      BPASmartClient.SmallBatchingSystem/ViewModels/RecipeControlViewModel.cs
  10. +3
    -1
      BPASmartClient.SmallBatchingSystem/Views/NewOutletView.xaml
  11. +2
    -1
      BPASmartClient.SmallBatchingSystem/Views/NewRecipeView.xaml
  12. +1
    -0
      BPASmartClient.SmallBatchingSystem/Views/NewSiloView.xaml

+ 21
- 6
BPASmartClient.CustomResource/Pages/View/LoginView.xaml View File

@@ -8,8 +8,8 @@
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:vm="clr-namespace:BPASmartClient.CustomResource.Pages.ViewModel"
Title="LoginView"
Width="1920"
Height="1080"
Width="1366"
Height="768"
AllowsTransparency="True"
Background="{x:Null}"
Topmost="False"
@@ -194,7 +194,7 @@

<!--#region 操作按钮样式-->
<Style x:Key="ButtonStyle" TargetType="Button">
<Setter Property="Margin" Value="20,20" />
<Setter Property="Margin" Value="20,0" />
<Setter Property="Background" Value="#cc009DFF" />
<Setter Property="BorderThickness" Value="0" />
<Setter Property="FontSize" Value="30" />
@@ -236,9 +236,24 @@
VerticalAlignment="Center"
LoadedBehavior="Manual" />-->

<Grid x:Name="grid" Margin="400,180">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="0.4*" />
<ColumnDefinition />
<ColumnDefinition Width="0.4*" />
</Grid.ColumnDefinitions>

<Grid.RowDefinitions>
<RowDefinition Height="0.25*" />
<RowDefinition />
<RowDefinition Height="0.25*" />
</Grid.RowDefinitions>
<!-- Margin="400,180" -->
<Grid
x:Name="grid"
Grid.Row="1"
Grid.Column="1">
<Grid.RowDefinitions>
<RowDefinition />
<RowDefinition Height="0.8*"/>
<RowDefinition />
<RowDefinition />
<RowDefinition />
@@ -300,7 +315,7 @@
Text="请输入账号密码"
Visibility="Visible" />

<Grid Grid.Row="3">
<Grid Margin="0 20" Grid.Row="3">
<Grid.ColumnDefinitions>
<ColumnDefinition />
<ColumnDefinition />


+ 1
- 1
BPASmartClient.CustomResource/RecDictionarys/RecComboBox.xaml View File

@@ -123,7 +123,7 @@
<ContentPresenter
x:Name="ContentSite"
Margin="3,3,0,3"
HorizontalAlignment="Center"
HorizontalAlignment="{TemplateBinding HorizontalAlignment}"
VerticalAlignment="Center"
Content="{TemplateBinding SelectionBoxItem}"
ContentTemplate="{TemplateBinding SelectionBoxItemTemplate}"


+ 12
- 10
BPASmartClient.SmallBatchingSystem/App.xaml.cs View File

@@ -21,7 +21,9 @@ namespace BPASmartClient.SmallBatchingSystem
public static Window MainWindow;
protected override void OnStartup(StartupEventArgs e)
{
//1366*768
base.OnStartup(e);
BPASmartClient.Helper.SystemHelper.GetInstance.CreateDesktopShortcut();
AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException;
Json<ConfigInfoModel>.Read();
Json<CommunicationPar>.Read();
@@ -29,16 +31,16 @@ namespace BPASmartClient.SmallBatchingSystem
MainView mv = new MainView();
Control.GetInstance.Init();
mv.TitleName = "黑菠萝自动化配料系统";
mv.Show();
//LoginView lv = new LoginView();
//var res = lv.ShowDialog();
//if (res != null && res == true)
//{
// Control.GetInstance.OperationLog("用户登录");
// mv.Show();
//}
//else
// mv.Close();
//mv.Show();
LoginView lv = new LoginView();
var res = lv.ShowDialog();
if (res != null && res == true)
{
Control.GetInstance.OperationLog("用户登录");
mv.Show();
}
else
mv.Close();
MainWindow = mv;
}



+ 2
- 2
BPASmartClient.SmallBatchingSystem/Models/CommunicationPar.cs View File

@@ -8,8 +8,8 @@ namespace BPASmartClient.SmallBatchingSystem
{
public class CommunicationPar
{
//public string Host { get; set; } = "192.168.6.100";
public string Host { get; set; } = "127.0.0.1";
public string Host { get; set; } = "192.168.6.100";
//public string Host { get; set; } = "127.0.0.1";
public int Port { get; set; } = 502;

}


+ 251
- 66
BPASmartClient.SmallBatchingSystem/Services/Control.cs View File

@@ -1,4 +1,6 @@
using BPA.Helper;
#define test

using BPA.Helper;
using BPASmartClient.SmallBatchingSystem;
using System;
using System.Collections.Concurrent;
@@ -36,86 +38,236 @@ namespace BPASmartClient.SmallBatchingSystem
{
if (MakeOrderQueue.TryDequeue(out RecipeInfo recipeInfo))
{
IsCancel = false;
List<int> OutletInfo = new List<int>();
recipeInfo.SiloInfoModels.ToList()?.ForEach(item =>
{
var res = Json<ConfigInfoModel>.Data.OutletInfoModels.FirstOrDefault(p => p.SiloInfos.FirstOrDefault(s => s.Contains(item.SiloName)) != null);
if (res != null) if (!OutletInfo.Contains(res.OutletLoc)) OutletInfo.Add(res.OutletLoc);
});
foreach (var temp in OutletInfo)
//ProcessOne(recipeInfo);
ProcessTwo(recipeInfo);
}
}
Thread.Sleep(10);
}), "配方流程控制");
}

private void ProcessOne(RecipeInfo recipeInfo)
{
IsCancel = false;
List<int> OutletInfo = new List<int>();
recipeInfo.SiloInfoModels.ToList()?.ForEach(item =>
{
var res = Json<ConfigInfoModel>.Data.OutletInfoModels.FirstOrDefault(p => p.SiloInfos.FirstOrDefault(s => s.Contains(item.SiloName)) != null);
if (res != null) if (!OutletInfo.Contains(res.OutletLoc)) OutletInfo.Add(res.OutletLoc);
});
foreach (var temp in OutletInfo)
{
PlcServer.GetInstance.WriteData("VW302", (ushort)temp);//设置出料口位置
PlcServer.GetInstance.WriteData("M10.0", true);//定位启动
RunLog($"启动定位,出料口位置:{temp}");
int index = temp - 1;
if (index >= 0)
{
RunLog("等待定位完成");
while (!PlcDataModel.TargetLocComplete && !IsCancel) Thread.Sleep(1);//等待定位反馈
if (IsCancel) break;
RunLog("定位完成");
PlcServer.GetInstance.WriteData("M20.0", false);
while (PlcDataModel.TargetLocComplete && !IsCancel) Thread.Sleep(1);
if (IsCancel) break;
RunLog("定位完成,复位成功");
foreach (var temp1 in recipeInfo.SiloInfoModels)
{
var rest = Json<ConfigInfoModel>.Data.OutletInfoModels.FirstOrDefault(p => p.SiloInfos.FirstOrDefault(s => s.Contains(temp1.SiloName)) != null);
if (rest != null && rest.OutletLoc == temp)
{
PlcServer.GetInstance.WriteData("VW302", (ushort)temp);//设置出料口位置
PlcServer.GetInstance.WriteData("M10.0", true);//定位启动
RunLog($"启动定位,出料口位置:{temp}");
int index = temp - 1;
if (index >= 0)
var res = Json<ConfigInfoModel>.Data.SiloInfoModels.FirstOrDefault(p => p.SiloName == temp1.SiloName);
if (res != null)
{
RunLog("等待定位完成");
while (!PlcDataModel.TargetLocComplete && !IsCancel) Thread.Sleep(1);//等待定位反馈
StatusNotify(res.SiloName, Status.正在配料);
RunLog($"写重量地址:{GetWeightAdd(res.SiloLoc)},重量:{temp1.SiloWeight}");
PlcServer.GetInstance.WriteData(GetWeightAdd(res.SiloLoc), (ushort)temp1.SiloWeight);
RunLog($"写启动信号地址:{GetStartSingleAdd(res.SiloLoc)}");
PlcServer.GetInstance.WriteData(GetStartSingleAdd(res.SiloLoc), true);
while (!PlcDataModel.BatchingCompleted && !IsCancel) Thread.Sleep(1);//等待出料完成
if (IsCancel) break;
RunLog("定位完成");
PlcServer.GetInstance.WriteData("M20.0", false);
while (PlcDataModel.TargetLocComplete && !IsCancel) Thread.Sleep(1);
RunLog("出料完成,复位出料完成状态");
PlcServer.GetInstance.WriteData("M4.0", false);//复位出料完成信号
while (PlcDataModel.BatchingCompleted && !IsCancel) Thread.Sleep(1);//等待出料完成信号复位成功
if (IsCancel) break;
RunLog("定位完成,复位成功");
foreach (var temp1 in recipeInfo.SiloInfoModels)
{
var rest = Json<ConfigInfoModel>.Data.OutletInfoModels.FirstOrDefault(p => p.SiloInfos.FirstOrDefault(s => s.Contains(temp1.SiloName)) != null);
if (rest != null && rest.OutletLoc == temp)
{
var res = Json<ConfigInfoModel>.Data.SiloInfoModels.FirstOrDefault(p => p.SiloName == temp1.SiloName);
if (res != null)
{
StatusNotify(res.SiloName, Status.正在配料);
RunLog($"写重量地址:{GetWeightAdd(res.SiloLoc)},重量:{temp1.SiloWeight}");
PlcServer.GetInstance.WriteData(GetWeightAdd(res.SiloLoc), (ushort)temp1.SiloWeight);
RunLog($"写启动信号地址:{GetStartSingleAdd(res.SiloLoc)}");
PlcServer.GetInstance.WriteData(GetStartSingleAdd(res.SiloLoc), true);
while (!PlcDataModel.BatchingCompleted && !IsCancel) Thread.Sleep(1);//等待出料完成
if (IsCancel) break;
RunLog("出料完成,复位出料完成状态");
PlcServer.GetInstance.WriteData("M4.0", false);//复位出料完成信号
while (PlcDataModel.BatchingCompleted && !IsCancel) Thread.Sleep(1);//等待出料完成信号复位成功
if (IsCancel) break;
RunLog("出料完成复位成功");
StatusNotify(res.SiloName, Status.配料完成);
}
}
}
if (IsCancel) return;
RunLog("出料完成复位成功");
StatusNotify(res.SiloName, Status.配料完成);
}
}
}
if (IsCancel) return;
}
}

if (!IsCancel)
{
RunLog($"写入配方执行完成信号");
PlcServer.GetInstance.WriteData("M10.4", true);
RunLog("等待配方执行完成");
while (!PlcDataModel.RecipeBatchingComplete && !IsCancel) Thread.Sleep(1);
if (IsCancel) return;
RunLog($"【{recipeInfo.RecipeName}】配方执行完成");
ActionManage.GetInstance.Send("GrindArenaceousCancel");
}
}

if (!IsCancel)
/// <summary>
/// 计时配料
/// </summary>
/// <param name="recipeInfo"></param>
private void ProcessTwo(RecipeInfo recipeInfo)
{
IsCancel = false;
Dictionary<int, List<int>> DeviceSoilInfo = new Dictionary<int, List<int>>();
List<int> OutletInfo = new List<int>();
recipeInfo.SiloInfoModels.ToList()?.ForEach(item =>
{
var res = Json<ConfigInfoModel>.Data.OutletInfoModels.FirstOrDefault(p => p.SiloInfos.FirstOrDefault(s => s == item.SiloName) != null);
if (res != null)
{
var soliInfo = Json<ConfigInfoModel>.Data.SiloInfoModels.FirstOrDefault(p => p.SiloName == item.SiloName);
if (soliInfo != null)
{
if (!DeviceSoilInfo.ContainsKey(res.OutletLoc))
{
DeviceSoilInfo.Add(res.OutletLoc, new List<int>());
DeviceSoilInfo[res.OutletLoc].Add(soliInfo.SiloLoc);
}
else
{
RunLog($"写入配方执行完成信号");
PlcServer.GetInstance.WriteData("M10.4", true);
RunLog("等待配方执行完成");
while (!PlcDataModel.RecipeBatchingComplete && !IsCancel) Thread.Sleep(1);
if (IsCancel) break;
RunLog($"【{recipeInfo.RecipeName}】配方执行完成");
ActionManage.GetInstance.Send("GrindArenaceousCancel");
DeviceSoilInfo[res.OutletLoc].Add(soliInfo.SiloLoc);
}
}

}
Thread.Sleep(10);
}), "配方流程控制");
}
});

private bool Wait(ref bool Targger, bool IsCancel = false)
{
bool a = Targger;
while (!IsCancel)
foreach (var temp in DeviceSoilInfo)
{
if (a)
Thread.Sleep(1);
PlcServer.GetInstance.WriteData("VW302", (ushort)temp.Key);//设置出料口位置
//PlcServer.GetInstance.WriteData("M10.0", true);//定位启动
PlcServer.GetInstance.WriteData("M10.4", true);//定位启动
RunLog($"启动定位,出料口位置:{temp}");
int index = temp.Key - 1;
if (index >= 0)
{
RunLog("等待定位完成");
while (!PlcDataModel.TargetLocComplete && !IsCancel) Thread.Sleep(1);//等待定位反馈
if (IsCancel) break;
RunLog("定位完成");
PlcServer.GetInstance.WriteData("M20.0", false);
while (PlcDataModel.TargetLocComplete && !IsCancel) Thread.Sleep(1);
if (IsCancel) break;
RunLog("定位完成,复位成功");
foreach (var temp1 in temp.Value)
{
//var rest = Json<ConfigInfoModel>.Data.OutletInfoModels.FirstOrDefault(p => p.SiloInfos.FirstOrDefault(s => s.Contains(temp1.SiloName)) != null);
//if (rest != null && rest.OutletLoc == temp)
//{

var res = Json<ConfigInfoModel>.Data.SiloInfoModels.FirstOrDefault(p => p.SiloLoc == temp1);
if (res != null)
{
var tempRecipe = recipeInfo.SiloInfoModels.FirstOrDefault(p => p.SiloName == res.SiloName);
if (tempRecipe != null)
{
StatusNotify(res.SiloName, Status.正在配料);
RunLog($"写重量地址:{GetWeightAdd(res.SiloLoc)},重量:{tempRecipe.SiloWeight}");
PlcServer.GetInstance.WriteData(GetWeightAdd(res.SiloLoc), (ushort)(tempRecipe.SiloWeight * 10));
RunLog($"写启动信号地址:{GetStartSingleAdd(res.SiloLoc)}");
PlcServer.GetInstance.WriteData(GetStartSingleAdd(res.SiloLoc), true);
while (!PlcDataModel.BatchingCompleted && !IsCancel) Thread.Sleep(1);//等待出料完成
if (IsCancel) break;
RunLog("出料完成,复位出料完成状态");
#if test
PlcServer.GetInstance.WriteData("M10.0", false);//复位出料完成信号
#else
PlcServer.GetInstance.WriteData("M4.0", false);//复位出料完成信号
#endif

while (PlcDataModel.BatchingCompleted && !IsCancel) Thread.Sleep(1);//等待出料完成信号复位成功
if (IsCancel) break;
RunLog("出料完成复位成功");
StatusNotify(res.SiloName, Status.配料完成);
}
}
//}
}
if (IsCancel) return;
}
}
return !IsCancel;
}

//IsCancel = false;
//List<int> OutletInfo = new List<int>();
//recipeInfo.SiloInfoModels.ToList()?.ForEach(item =>
//{
// var res = Json<ConfigInfoModel>.Data.OutletInfoModels.FirstOrDefault(p => p.SiloInfos.FirstOrDefault(s => s.Contains(item.SiloName)) != null);
// if (res != null) if (!OutletInfo.Contains(res.OutletLoc)) OutletInfo.Add(res.OutletLoc);
//});
//foreach (var temp in OutletInfo)
//{
// PlcServer.GetInstance.WriteData("VW302", (ushort)temp);//设置出料口位置
// //PlcServer.GetInstance.WriteData("M10.0", true);//定位启动
// PlcServer.GetInstance.WriteData("M10.4", true);//定位启动
// RunLog($"启动定位,出料口位置:{temp}");
// int index = temp - 1;
// if (index >= 0)
// {
// RunLog("等待定位完成");
// while (!PlcDataModel.TargetLocComplete && !IsCancel) Thread.Sleep(1);//等待定位反馈
// if (IsCancel) break;
// RunLog("定位完成");
// PlcServer.GetInstance.WriteData("M20.0", false);
// while (PlcDataModel.TargetLocComplete && !IsCancel) Thread.Sleep(1);
// if (IsCancel) break;
// RunLog("定位完成,复位成功");
// foreach (var temp1 in recipeInfo.SiloInfoModels)
// {
// var rest = Json<ConfigInfoModel>.Data.OutletInfoModels.FirstOrDefault(p => p.SiloInfos.FirstOrDefault(s => s.Contains(temp1.SiloName)) != null);
// if (rest != null && rest.OutletLoc == temp)
// {
// var res = Json<ConfigInfoModel>.Data.SiloInfoModels.FirstOrDefault(p => p.SiloName == temp1.SiloName);
// if (res != null)
// {
// StatusNotify(res.SiloName, Status.正在配料);
// RunLog($"写重量地址:{GetWeightAdd(res.SiloLoc)},重量:{temp1.SiloWeight}");
// PlcServer.GetInstance.WriteData(GetWeightAdd(res.SiloLoc), (ushort)(temp1.SiloWeight * 10));
// RunLog($"写启动信号地址:{GetStartSingleAdd(res.SiloLoc)}");
// PlcServer.GetInstance.WriteData(GetStartSingleAdd(res.SiloLoc), true);
// while (!PlcDataModel.BatchingCompleted && !IsCancel) Thread.Sleep(1);//等待出料完成
// if (IsCancel) break;
// RunLog("出料完成,复位出料完成状态");
//#if test
// PlcServer.GetInstance.WriteData("M10.0", false);//复位出料完成信号
//#else
//PlcServer.GetInstance.WriteData("M4.0", false);//复位出料完成信号
//#endif


// while (PlcDataModel.BatchingCompleted && !IsCancel) Thread.Sleep(1);//等待出料完成信号复位成功
// if (IsCancel) break;
// RunLog("出料完成复位成功");
// StatusNotify(res.SiloName, Status.配料完成);
// }
// }
// }
// if (IsCancel) return;
// }
//}

if (!IsCancel)
{
RunLog($"写入配方执行完成信号");
//PlcServer.GetInstance.WriteData("M10.4", true);
PlcServer.GetInstance.WriteData("M10.5", true);
RunLog("等待配方执行完成");
while (!PlcDataModel.RecipeBatchingComplete && !IsCancel) Thread.Sleep(1);
if (IsCancel) return;
RunLog($"【{recipeInfo.RecipeName}】配方执行完成");
ActionManage.GetInstance.Send("GrindArenaceousCancel");
}
}

/// <summary>
/// 获取重量设置地址
/// </summary>
@@ -123,10 +275,22 @@ namespace BPASmartClient.SmallBatchingSystem
/// <returns></returns>
private string GetWeightAdd(int num)
{
#if test
if (num > 0)
{
int add = 0;
if (num >= 1 && num <= 8)
if (num >= 1 && num <= 18)
{
add = 200 + (num - 1) * 2;
}
return $"VW{add}";
}
return default;
#else
if (num > 0)
{
int add = 0;
if (num >= 1 && num <= 18)
{
add = 100 + (num - 1) * 2;
}
@@ -137,6 +301,8 @@ namespace BPASmartClient.SmallBatchingSystem
return $"VW{add}";
}
return default;
#endif

}

private void StatusNotify(string SiloName, Status Status)
@@ -176,6 +342,7 @@ namespace BPASmartClient.SmallBatchingSystem
/// <returns></returns>
private string GetStartSingleAdd(int num)
{
#if test
if (num > 0)
{
string Add = string.Empty;
@@ -187,10 +354,28 @@ namespace BPASmartClient.SmallBatchingSystem
c = 7;
}
else c--;
Add = $"M{ t}.{c}";
Add = $"M{t + 4}.{c}";
return Add;
}
return default;
#else
if (num > 0)
{
string Add = string.Empty;
var t = num / 8;
var c = (num % 8);
if (c == 0)
{
t--;
c = 7;
}
else c--;
Add = $"M{t}.{c}";
return Add;
}
return default;
#endif

}

}


+ 21
- 1
BPASmartClient.SmallBatchingSystem/Services/PlcServer.cs View File

@@ -27,13 +27,33 @@ namespace BPASmartClient.SmallBatchingSystem
MessageLog.GetInstance.Show("设备连接成功");
ThreadManage.GetInstance().StartLong(new Action(() =>
{
//带称程序
//var res = ReadData("M20.0", 1);//到达目标位置信号
//if (res != null && res is bool[] bools && bools.Length == 1)
//{
// PlcDataModel.TargetLocComplete = bools[0];
//}

//var res1 = ReadData("M4.0", 1);//通道出料完成
//if (res1 != null && res1 is bool[] bools1 && bools1.Length == 1)
//{
// PlcDataModel.BatchingCompleted = bools1[0];
//}

//var res2 = ReadData("M13.3", 1);//配方配料完成,托盘在放碗或取碗位置
//if (res2 != null && res2 is bool[] bools2 && bools2.Length == 1)
//{
// PlcDataModel.RecipeBatchingComplete = bools2[0];
//}

//定时程序
var res = ReadData("M20.0", 1);//到达目标位置信号
if (res != null && res is bool[] bools && bools.Length == 1)
{
PlcDataModel.TargetLocComplete = bools[0];
}

var res1 = ReadData("M4.0", 1);//通道出料完成
var res1 = ReadData("M10.0", 1);//通道出料完成
if (res1 != null && res1 is bool[] bools1 && bools1.Length == 1)
{
PlcDataModel.BatchingCompleted = bools1[0];


+ 7
- 2
BPASmartClient.SmallBatchingSystem/ViewModels/NewOutletViewModel.cs View File

@@ -15,7 +15,7 @@ namespace BPASmartClient.SmallBatchingSystem.ViewModels
{
public NewOutletViewModel()
{
Json<ConfigInfoModel>.Data.SiloInfoModels.ToList()?.ForEach(item => { SileName.Add(item.SiloName); });
Json<ConfigInfoModel>.Data.SiloInfoModels.ToList()?.ForEach(item => { SileName.Add($"{item.SiloName}"); });
ActionManage.GetInstance.Register(new Action<object>((o) =>
{
if (o != null && o is OutletInfoModel tempOutletInfo)
@@ -24,7 +24,7 @@ namespace BPASmartClient.SmallBatchingSystem.ViewModels
OutletLoc = tempOutletInfo.OutletLoc;
tempOutletInfo.SiloInfos?.ToList()?.ForEach((item =>
{
int tempIndex = Array.FindIndex(SileName.ToArray(), p => p.Contains(item));
int tempIndex = Array.FindIndex(SileName.ToArray(), p => p == item);
SiloInfos.Add(new RawMaterialInfo() { RawMaterialName = item, SelectIndex = tempIndex });
}));
Index = Array.FindIndex(Json<ConfigInfoModel>.Data.OutletInfoModels.ToArray(), p => p.OutletName == tempOutletInfo.OutletName);
@@ -40,6 +40,11 @@ namespace BPASmartClient.SmallBatchingSystem.ViewModels
{
Json<ConfigInfoModel>.Data.OutletInfoModels.ElementAt(Index).OutletName = OutletName;
Json<ConfigInfoModel>.Data.OutletInfoModels.ElementAt(Index).OutletLoc = OutletLoc;
Json<ConfigInfoModel>.Data.OutletInfoModels.ElementAt(Index).SiloInfos.Clear();
//SileNames.ToList()?.ForEach(temp =>
//{
// Json<ConfigInfoModel>.Data.OutletInfoModels.ElementAt(Index).SiloInfos.Add(temp);
//});
Json<ConfigInfoModel>.Data.OutletInfoModels.ElementAt(Index).SiloInfos = SileNames;
Control.GetInstance.OperationLog($"{OutletName} 编辑完成");
}


+ 14
- 0
BPASmartClient.SmallBatchingSystem/ViewModels/NewSiloViewModel.cs View File

@@ -16,6 +16,20 @@ namespace BPASmartClient.SmallBatchingSystem.ViewModels
CancelCommand = new RelayCommand(() => { ActionManage.GetInstance.Send("SiloClose"); });
SaveCommand = new RelayCommand(() =>
{
var res = Json<ConfigInfoModel>.Data.SiloInfoModels.FirstOrDefault(p => p.SiloName == SiloInfoModelObj.SiloName);
if (res != null)
{
ErrorInfo = "料仓名称已经存在!";
return;
}

var temp = Json<ConfigInfoModel>.Data.SiloInfoModels.FirstOrDefault(p => p.SiloLoc == SiloInfoModelObj.SiloLoc);
if (temp != null)
{
ErrorInfo = "料仓位置已存在!";
return;
}

if (Index >= 0 && Index < Json<ConfigInfoModel>.Data.SiloInfoModels.Count)
{
Json<ConfigInfoModel>.Data.SiloInfoModels.ElementAt(Index).SiloName = SiloInfoModelObj.SiloName;


+ 10
- 7
BPASmartClient.SmallBatchingSystem/ViewModels/RecipeControlViewModel.cs View File

@@ -29,13 +29,16 @@ namespace BPASmartClient.SmallBatchingSystem.ViewModels
int index = Array.FindIndex(Json<ConfigInfoModel>.Data.Recipes.ToArray(), p => p.RecipeName == o.ToString());
if (index >= 0 && index < Json<ConfigInfoModel>.Data.Recipes.Count)
{
var data = Json<ConfigInfoModel>.Data.Recipes.ElementAt(index);
Control.GetInstance.RunLog($"下发配方:{data.RecipeName}");
GrindArenaceousView grindArenaceousView = new GrindArenaceousView();
ActionManage.GetInstance.Send("OpenRecipeStatusMotion", data);
Control.GetInstance.MakeOrderQueue.Enqueue(data);
Control.GetInstance.NotifyPrompt("配方下发成功!");
grindArenaceousView.ShowDialog();
App.Current.Dispatcher.Invoke(() =>
{
var data = Json<ConfigInfoModel>.Data.Recipes.ElementAt(index);
Control.GetInstance.RunLog($"下发配方:{data.RecipeName}");
GrindArenaceousView grindArenaceousView = new GrindArenaceousView();
ActionManage.GetInstance.Send("OpenRecipeStatusMotion", data);
Control.GetInstance.MakeOrderQueue.Enqueue(data);
Control.GetInstance.NotifyPrompt("配方下发成功!");
grindArenaceousView.ShowDialog();
});
}
}
}


+ 3
- 1
BPASmartClient.SmallBatchingSystem/Views/NewOutletView.xaml View File

@@ -12,6 +12,7 @@
Height="400"
AllowsTransparency="True"
Background="{x:Null}"
Topmost="True"
WindowStartupLocation="CenterScreen"
WindowStyle="None"
mc:Ignorable="d">
@@ -123,7 +124,7 @@
Style="{StaticResource ImageButtonStyle}" />
</StackPanel>

<Grid Grid.Row="2" Margin="15,0,10,0">
<Grid Grid.Row="2" Margin="15,0,10,10">

<Grid.RowDefinitions>
<RowDefinition Height="35" />
@@ -181,6 +182,7 @@
Grid.Column="0"
Height="{Binding ElementName=gr, Path=ActualHeight}"
VerticalAlignment="Center"
HorizontalContentAlignment="Left"
BorderBrush="#FF074B92"
BorderThickness="1"
FontFamily="楷体"


+ 2
- 1
BPASmartClient.SmallBatchingSystem/Views/NewRecipeView.xaml View File

@@ -10,6 +10,7 @@
Title="NewPfView"
Width="500"
Height="300"
Topmost="True"
AllowsTransparency="True"
Background="{x:Null}"
WindowStartupLocation="CenterScreen"
@@ -93,7 +94,7 @@
Style="{StaticResource ImageButtonStyle}" />
</StackPanel>

<Grid Grid.Row="2" Margin="15,0,10,0">
<Grid Grid.Row="2" Margin="15,0,10,10">

<Grid.RowDefinitions>
<RowDefinition Height="35" />


+ 1
- 0
BPASmartClient.SmallBatchingSystem/Views/NewSiloView.xaml View File

@@ -11,6 +11,7 @@
Height="300"
AllowsTransparency="True"
Background="{x:Null}"
Topmost="True"
WindowStartupLocation="CenterScreen"
WindowStyle="None"
mc:Ignorable="d">


Loading…
Cancel
Save