Pārlūkot izejas kodu

小配料系统开发

样式分支
pry pirms 2 gadiem
vecāks
revīzija
463d50f5b6
32 mainītis faili ar 2576 papildinājumiem un 94 dzēšanām
  1. +0
    -0
      BPASmart.Model/Interfaces/IRecipeMaterials.cs
  2. +2
    -3
      BPASmart.RecipeManagement/ViewModel/RecipeManagerViewModel.cs
  3. +1
    -7
      BPASmart.Server/CommunicationServer.cs
  4. +29
    -7
      BPASmartClient.SmallBatchingSystem/App.xaml.cs
  5. +18
    -0
      BPASmartClient.SmallBatchingSystem/Models/ConfigInfoModel.cs
  6. +2
    -4
      BPASmartClient.SmallBatchingSystem/Models/OutletInfoModel.cs
  7. +14
    -0
      BPASmartClient.SmallBatchingSystem/Models/PlcDataModel.cs
  8. +19
    -0
      BPASmartClient.SmallBatchingSystem/Models/RecipeInfo.cs
  9. +24
    -0
      BPASmartClient.SmallBatchingSystem/Models/RecipeRawMaterialInfo.cs
  10. +1
    -1
      BPASmartClient.SmallBatchingSystem/Models/SiloInfoModel.cs
  11. +115
    -0
      BPASmartClient.SmallBatchingSystem/Services/Control.cs
  12. +18
    -4
      BPASmartClient.SmallBatchingSystem/Services/PlcServer.cs
  13. +9
    -5
      BPASmartClient.SmallBatchingSystem/Services/SiloServer.cs
  14. +78
    -0
      BPASmartClient.SmallBatchingSystem/ViewModels/NewOutletViewModel.cs
  15. +60
    -0
      BPASmartClient.SmallBatchingSystem/ViewModels/NewRecipeViewModel.cs
  16. +45
    -0
      BPASmartClient.SmallBatchingSystem/ViewModels/OutletManagementViewModel.cs
  17. +37
    -0
      BPASmartClient.SmallBatchingSystem/ViewModels/RecipeControlViewModel.cs
  18. +72
    -0
      BPASmartClient.SmallBatchingSystem/ViewModels/RecipeViewModel.cs
  19. +20
    -1
      BPASmartClient.SmallBatchingSystem/ViewModels/SiloManagementViewModel.cs
  20. +70
    -24
      BPASmartClient.SmallBatchingSystem/Views/NewOutletView.xaml
  21. +5
    -1
      BPASmartClient.SmallBatchingSystem/Views/NewOutletView.xaml.cs
  22. +290
    -0
      BPASmartClient.SmallBatchingSystem/Views/NewRecipeView.xaml
  23. +62
    -0
      BPASmartClient.SmallBatchingSystem/Views/NewRecipeView.xaml.cs
  24. +4
    -0
      BPASmartClient.SmallBatchingSystem/Views/NewSiloView.xaml
  25. +16
    -0
      BPASmartClient.SmallBatchingSystem/Views/NewSiloView.xaml.cs
  26. +505
    -10
      BPASmartClient.SmallBatchingSystem/Views/OutletManagementView.xaml
  27. +638
    -0
      BPASmartClient.SmallBatchingSystem/Views/RecipeControlView.xaml
  28. +28
    -0
      BPASmartClient.SmallBatchingSystem/Views/RecipeControlView.xaml.cs
  29. +359
    -0
      BPASmartClient.SmallBatchingSystem/Views/RecipeView.xaml
  30. +28
    -0
      BPASmartClient.SmallBatchingSystem/Views/RecipeView.xaml.cs
  31. +6
    -26
      BPASmartClient.SmallBatchingSystem/Views/SiloManagementView.xaml
  32. +1
    -1
      DosingSystem/View/RecipeSettingsView.xaml

BPASmart.Model/IRecipeMaterials.cs → BPASmart.Model/Interfaces/IRecipeMaterials.cs Parādīt failu


+ 2
- 3
BPASmart.RecipeManagement/ViewModel/RecipeManagerViewModel.cs Parādīt failu

@@ -31,7 +31,7 @@ namespace BPASmart.RecipeManagement.ViewModel
/// <summary>
/// 配方下发
/// </summary>
public RelayCommand<object> PecipeStartCommand { get; set; }
public RelayCommand<object> PecipeStartCommand { get; set; }

private void EditRecipe(object o)
{
@@ -74,14 +74,13 @@ namespace BPASmart.RecipeManagement.ViewModel

private void PecipeStart(object o)
{

if (o == null) return;
if (o is string id)
{
var res = Json<LocalRecipes>.Data.locaRecipes.FirstOrDefault(p => p.ID == id);
if (res != null)
{
//下发配方
//下发配方

}
}


+ 1
- 7
BPASmart.Server/CommunicationServer.cs Parādīt failu

@@ -122,11 +122,6 @@ namespace BPASmart.Server

private void DeviceControl(PublishInfo publishInfo)
{
//if (msg.TryDequeue(out string s))
//{
// var res = JsonConvert.DeserializeObject<PublishInfo>(s);
// if (res != null)
// {
publishInfo.PublishModels.ForEach(item =>
{
if (CommunicationDevices.ContainsKey(item.DeviceName))
@@ -171,8 +166,7 @@ namespace BPASmart.Server

}
});
//}
//}

}

private void SetValue(Array arrays, string DeviceName, ReadDataModel readDataModel, EDataType eDataType)


+ 29
- 7
BPASmartClient.SmallBatchingSystem/App.xaml.cs Parādīt failu

@@ -6,9 +6,11 @@ using System.Data;
using System.Linq;
using System.Threading.Tasks;
using System.Windows;
using BPA.Helper;
using BPASmartClient.CustomResource.Pages.Enums;
using BPASmartClient.CustomResource.Pages.Model;
using BPASmartClient.CustomResource.Pages.View;
using BPASmartClient.SmallBatchingSystem.Models;
using BPASmartClient.SmallBatchingSystem.Services;

namespace BPASmartClient.SmallBatchingSystem
@@ -22,8 +24,10 @@ namespace BPASmartClient.SmallBatchingSystem
protected override void OnStartup(StartupEventArgs e)
{
base.OnStartup(e);
Json<ConfigInfoModel>.Read();
AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException;
MenuInit();
Control.GetInstance.Init();
SiloServer siloServer = new SiloServer();
MainView mv = new MainView();
//LoginView lv = new LoginView();
@@ -31,7 +35,7 @@ namespace BPASmartClient.SmallBatchingSystem
//if (res != null && res == true)
//{
// MessageLog.GetInstance.ShowUserLog("用户登录");
mv.Show();
mv.Show();
//}
//else
// mv.Close();
@@ -42,22 +46,40 @@ namespace BPASmartClient.SmallBatchingSystem
{
#region 配方管理菜单
ObservableCollection<SubMenumodel> RecipeManage = new ObservableCollection<SubMenumodel>();
RecipeManage.Add(new SubMenumodel()
{
SubMenuName = "料仓管理",
SubMenuVisibility = Visibility.Visible,
AssemblyName = "BPASmartClient.SmallBatchingSystem",
ToggleWindowPath = "Views.SiloManagementView"
});

RecipeManage.Add(new SubMenumodel()
{
SubMenuName = "出料口管理",
AssemblyName = "BPASmartClient.SmallBatchingSystem",
SubMenuVisibility = Visibility.Visible,
ToggleWindowPath = "Views.OutletManagementView"
});

RecipeManage.Add(new SubMenumodel()
{
SubMenuName = "配方管理",
SubMenuPermission = new Permission[] { Permission.管理员 },
AssemblyName = "BPASmartClient.DosingSystem",
ToggleWindowPath = "View.RecipeSettingsView"
AssemblyName = "BPASmartClient.SmallBatchingSystem",
SubMenuVisibility = Visibility.Visible,
ToggleWindowPath = "Views.RecipeView"
});

RecipeManage.Add(new SubMenumodel()
{
SubMenuName = "配方下发",
SubMenuPermission = new Permission[] { Permission.操作员, Permission.管理员 },
AssemblyName = "BPASmartClient.DosingSystem",
ToggleWindowPath = "View.RecipeControlView"
AssemblyName = "BPASmartClient.SmallBatchingSystem",
SubMenuVisibility = Visibility.Visible,
ToggleWindowPath = "Views.RecipeControlView"
});



MenuManage.GetInstance.menuModels.Add(new MenuModel()
{
MainMenuIcon = "&#xe683;",


+ 18
- 0
BPASmartClient.SmallBatchingSystem/Models/ConfigInfoModel.cs Parādīt failu

@@ -0,0 +1,18 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Collections.ObjectModel;

namespace BPASmartClient.SmallBatchingSystem.Models
{
public class ConfigInfoModel
{
public ObservableCollection<SiloInfoModel> SiloInfoModels { get; set; } = new ObservableCollection<SiloInfoModel>();

public ObservableCollection<OutletInfoModel> OutletInfoModels { get; set; } = new ObservableCollection<OutletInfoModel>();

public ObservableCollection<RecipeInfo> Recipes { get; set; } = new ObservableCollection<RecipeInfo>();
}
}

+ 2
- 4
BPASmartClient.SmallBatchingSystem/Models/OutletInfoModel.cs Parādīt failu

@@ -20,7 +20,7 @@ namespace BPASmartClient.SmallBatchingSystem.Models
private string _mOutletName;

/// <summary>
/// 出来哦口位置
/// 出口位置
/// </summary>
public int OutletLoc { get { return _mOutletLoc; } set { _mOutletLoc = value; OnPropertyChanged(); } }
private int _mOutletLoc;
@@ -28,9 +28,7 @@ namespace BPASmartClient.SmallBatchingSystem.Models
/// <summary>
/// 出料口对应的料仓信息
/// </summary>
public ObservableCollection<SiloInfoModel> SiloInfos { get { return _mSiloInfos; } set { _mSiloInfos = value; OnPropertyChanged(); } }
private ObservableCollection<SiloInfoModel> _mSiloInfos;

public ObservableCollection<string> SiloInfos { get; set; } = new ObservableCollection<string>();

}
}

+ 14
- 0
BPASmartClient.SmallBatchingSystem/Models/PlcDataModel.cs Parādīt failu

@@ -0,0 +1,14 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace BPASmartClient.SmallBatchingSystem.Models
{
public class PlcDataModel
{
public static bool[] TargetLocFeedback { get; set; } = new bool[16];
public static bool BatchingCompleted { get; set; }
}
}

+ 19
- 0
BPASmartClient.SmallBatchingSystem/Models/RecipeInfo.cs Parādīt failu

@@ -0,0 +1,19 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Microsoft.Toolkit.Mvvm.ComponentModel;
using System.Collections.ObjectModel;
namespace BPASmartClient.SmallBatchingSystem.Models
{
public class RecipeInfo : ObservableObject
{

public string RecipeName { get { return _mRecipeName; } set { _mRecipeName = value; OnPropertyChanged(); } }
private string _mRecipeName;

public ObservableCollection<RecipeRawMaterialInfo> SiloInfoModels { get; set; } = new ObservableCollection<RecipeRawMaterialInfo>();

}
}

+ 24
- 0
BPASmartClient.SmallBatchingSystem/Models/RecipeRawMaterialInfo.cs Parādīt failu

@@ -0,0 +1,24 @@
using Microsoft.Toolkit.Mvvm.ComponentModel;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace BPASmartClient.SmallBatchingSystem.Models
{
public class RecipeRawMaterialInfo : ObservableObject
{
/// <summary>
/// 原料名称
/// </summary>
public string SiloName { get { return _mSiloName; } set { _mSiloName = value; OnPropertyChanged(); } }
private string _mSiloName;

/// <summary>
/// 原料重量
/// </summary>
public int SiloWeight { get { return _mSiloWeight; } set { _mSiloWeight = value; OnPropertyChanged(); } }
private int _mSiloWeight;
}
}

+ 1
- 1
BPASmartClient.SmallBatchingSystem/Models/SiloInfoModel.cs Parādīt failu

@@ -13,7 +13,7 @@ namespace BPASmartClient.SmallBatchingSystem.Models
public class SiloInfoModel : ObservableObject
{
/// <summary>
/// 料仓原料名称
/// 原料名称
/// </summary>
public string SiloName { get { return _mSiloName; } set { _mSiloName = value; OnPropertyChanged(); } }
private string _mSiloName;


+ 115
- 0
BPASmartClient.SmallBatchingSystem/Services/Control.cs Parādīt failu

@@ -0,0 +1,115 @@
using BPA.Helper;
using BPASmartClient.SmallBatchingSystem.Models;
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;

namespace BPASmartClient.SmallBatchingSystem.Services
{
public class Control
{
private volatile static Control _Instance;
public static Control GetInstance => _Instance ?? (_Instance = new Control());
private Control() { }
public ConcurrentQueue<RecipeInfo> MakeOrderQueue { get; set; } = new ConcurrentQueue<RecipeInfo>();

public void Init()
{
ThreadManage.GetInstance().Start(new Action(() =>
{
PlcServer.GetInstance.Connect();

}), "设备初始化");

ThreadManage.GetInstance().StartLong(new Action(() =>
{
while (MakeOrderQueue.Count > 0)
{
if (MakeOrderQueue.TryDequeue(out RecipeInfo recipeInfo))
{
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);
});

OutletInfo.ForEach(temp =>
{
PlcServer.GetInstance.WriteData("VW302", (ushort)temp);//设置出料口位置
PlcServer.GetInstance.WriteData("M10.0", true);//定位启动
int index = temp - 1;
if (index >= 0 && index < PlcDataModel.TargetLocFeedback.Length)
{
while (!PlcDataModel.TargetLocFeedback[index]) Thread.Sleep(1);//等待定位反馈
recipeInfo.SiloInfoModels.ToList()?.ForEach(temp1 =>
{
var res = Json<ConfigInfoModel>.Data.SiloInfoModels.FirstOrDefault(p => p.SiloName == temp1.SiloName);
if (res != null)
{
PlcServer.GetInstance.WriteData(GetWeightAdd(res.SiloLoc), (ushort)temp1.SiloWeight);
PlcServer.GetInstance.WriteData(GetStartSingleAdd(res.SiloLoc), true);
while (!PlcDataModel.BatchingCompleted) Thread.Sleep(1);//等待出料完成
PlcServer.GetInstance.WriteData("M4.0", false);//复位出料完成信号
while (PlcDataModel.BatchingCompleted) Thread.Sleep(1);//等待出料完成信号复位成功
}
});
}

});
PlcServer.GetInstance.WriteData("M10.4", true);
}
}
Thread.Sleep(10);
}), "配方流程控制");
}



/// <summary>
/// 获取重量设置地址
/// </summary>
/// <param name="num"></param>
/// <returns></returns>
private string GetWeightAdd(int num)
{
if (num > 0)
{
var s = 100 + (num - 1) * 2;
return $"VW{s}";
}
return default;
}

/// <summary>
/// 获取启动信号地址
/// </summary>
/// <param name="num"></param>
/// <returns></returns>
private string GetStartSingleAdd(int num)
{
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;
}

}
}

+ 18
- 4
BPASmartClient.SmallBatchingSystem/Services/PlcServer.cs Parādīt failu

@@ -16,7 +16,7 @@ namespace BPASmartClient.SmallBatchingSystem.Services
public static PlcServer GetInstance => _Instance ?? (_Instance = new PlcServer());
private PlcServer() { }

public ModbusTcp Communication = new ModbusTcp();
public ModbusTcp Communication = new ModbusTcp();

public void Connect()
{
@@ -26,6 +26,20 @@ namespace BPASmartClient.SmallBatchingSystem.Services
MessageLog.GetInstance.Show("设备连接成功");
ThreadManage.GetInstance().StartLong(new Action(() =>
{
var res = ReadData("M20.0", 16);//到达目标位置信号
if (res != null && res is bool[] bools && bools.Length == 16)
{
for (int i = 0; i < bools.Length; i++)
{
PlcDataModel.TargetLocFeedback[i] = bools[i];
}
}

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

Thread.Sleep(10);
}), "PLC 数据监听");
@@ -39,11 +53,11 @@ namespace BPASmartClient.SmallBatchingSystem.Services
Communication.Write(address, value);
}

public object ReadData(string address,int length)
public object ReadData(string address, int length)
{
object res=null;
object res = null;
if (address != null)
res= Communication.Read(address,(ushort)length);
res = Communication.Read(address, (ushort)length);
return res;
}
}


+ 9
- 5
BPASmartClient.SmallBatchingSystem/Services/SiloServer.cs Parādīt failu

@@ -35,7 +35,7 @@ namespace BPASmartClient.SmallBatchingSystem.Services
#endregion

#region 订单管理
public ConcurrentQueue<Recipes> MakeOrderQueue { get; set; }=new ConcurrentQueue<Recipes>();
public ConcurrentQueue<Recipes> MakeOrderQueue { get; set; } = new ConcurrentQueue<Recipes>();
#endregion

#region 业务
@@ -44,7 +44,7 @@ namespace BPASmartClient.SmallBatchingSystem.Services
/// </summary>
public void BusinessThread()
{
ThreadManage.GetInstance().Start(new Action(() =>
{
PlcServer.GetInstance.Connect();
@@ -76,7 +76,8 @@ namespace BPASmartClient.SmallBatchingSystem.Services
Json<LocalRecipes>.Read();
RecipeMaterialsDic = Json<LocalMaterails>.Data.locaMaterails;
RecipesDic = Json<LocalRecipes>.Data.locaRecipes;
RecipesDic?.ToList().ForEach(par => {
RecipesDic?.ToList().ForEach(par =>
{
par.recipeMaterials?.ToList().ForEach((recipeMaterial) =>
{
RecipeMaterials recipe = RecipeMaterialsDic?.ToList().Find(k => k.ID == recipeMaterial.ID);
@@ -129,9 +130,12 @@ namespace BPASmartClient.SmallBatchingSystem.Services
recipes?.recipeMaterials?.ToList().ForEach(recipe =>
{
//料仓位置
int recipesLoc = 1; int.TryParse(recipe.PropertyCollections?.First()?.PropertyValue, out recipesLoc);
int recipesLoc = 1;
int.TryParse(recipe.PropertyCollections?.First()?.PropertyValue, out recipesLoc);

//原料位置
int storeLoc = 1; int.TryParse(recipe.MaterialPosion, out recipesLoc);

//原料需求(g)数
int storeWeight = recipe.MaterialWeight;

@@ -144,7 +148,7 @@ namespace BPASmartClient.SmallBatchingSystem.Services
if (storeWeight > 0)
{
WriteData("VW302", recipesLoc);
WriteData("M10.0",true);
WriteData("M10.0", true);

#region 读取是否到达目标位置,超时10秒
bool IsOver = false;


+ 78
- 0
BPASmartClient.SmallBatchingSystem/ViewModels/NewOutletViewModel.cs Parādīt failu

@@ -1,17 +1,95 @@
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using BPA.Helper;
using BPASmartClient.SmallBatchingSystem.Models;
using BPASmartClient.SmallBatchingSystem.Views;
using Microsoft.Toolkit.Mvvm.ComponentModel;
using Microsoft.Toolkit.Mvvm.Input;

namespace BPASmartClient.SmallBatchingSystem.ViewModels
{
public class NewOutletViewModel : ObservableObject
{
int index = -1;
public NewOutletViewModel()
{
ActionManage.GetInstance.Register(new Action<object>((o) =>
{
if (o != null && o is OutletInfoModel tempOutletInfo)
{
OutletName = tempOutletInfo.OutletName;
OutletLoc = tempOutletInfo.OutletLoc;
tempOutletInfo.SiloInfos?.ToList()?.ForEach((item =>
{
SiloInfos.Add(new RawMaterialInfo() { RawMaterialName = item });
}));
index = Array.FindIndex(Json<ConfigInfoModel>.Data.OutletInfoModels.ToArray(), p => p.OutletName == tempOutletInfo.OutletName);
}
}), "OpenNewOutlet", true);
AddRawMaterialCommand = new RelayCommand(() => { SiloInfos.Add(new RawMaterialInfo()); });
CancelCommand = new RelayCommand(() => { ActionManage.GetInstance.Send("NewOutletViewClose"); });
SaveCommand = new RelayCommand(() =>
{
ObservableCollection<string> SileNames = new ObservableCollection<string>();
SiloInfos.ToList()?.ForEach(item => { SileNames.Add(item.RawMaterialName); });
if (index >= 0 && index < Json<ConfigInfoModel>.Data.OutletInfoModels.Count)
{
Json<ConfigInfoModel>.Data.OutletInfoModels.ElementAt(index).OutletName = OutletName;
Json<ConfigInfoModel>.Data.OutletInfoModels.ElementAt(index).OutletLoc = OutletLoc;
Json<ConfigInfoModel>.Data.OutletInfoModels.ElementAt(index).SiloInfos = SileNames;
}
else
{
Json<ConfigInfoModel>.Data.OutletInfoModels.Add(new OutletInfoModel()
{
OutletLoc = OutletLoc,
OutletName = OutletName,
SiloInfos = SileNames
});
}
ActionManage.GetInstance.Send("NewOutletViewClose");
});
RemoveCommand = new RelayCommand<object>((o) =>
{
if (!string.IsNullOrEmpty(o?.ToString()))
{
var res = SiloInfos.FirstOrDefault(p => p.RawMaterialName == o.ToString());
if (res != null) SiloInfos.Remove(res);
}

});
Json<ConfigInfoModel>.Data.SiloInfoModels.ToList()?.ForEach(item => { SileName.Add(item.SiloName); });
}




public RelayCommand AddRawMaterialCommand { get; set; }
public RelayCommand CancelCommand { get; set; }
public RelayCommand SaveCommand { get; set; }

public RelayCommand<object> RemoveCommand { get; set; }

public string OutletName { get { return _mOutletName; } set { _mOutletName = value; OnPropertyChanged(); } }
private string _mOutletName;

public int OutletLoc { get { return _mOutletLoc; } set { _mOutletLoc = value; OnPropertyChanged(); } }
private int _mOutletLoc;

public ObservableCollection<RawMaterialInfo> SiloInfos { get; set; } = new ObservableCollection<RawMaterialInfo>();

public ObservableCollection<string> SileName { get; set; } = new ObservableCollection<string>();
}

public class RawMaterialInfo : ObservableObject
{

public string RawMaterialName { get { return _mRawMaterialName; } set { _mRawMaterialName = value; OnPropertyChanged(); } }
private string _mRawMaterialName;

}
}

+ 60
- 0
BPASmartClient.SmallBatchingSystem/ViewModels/NewRecipeViewModel.cs Parādīt failu

@@ -0,0 +1,60 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Microsoft.Toolkit.Mvvm.ComponentModel;
using Microsoft.Toolkit.Mvvm.Input;
using System.Collections.ObjectModel;
using BPA.Helper;
using BPASmartClient.SmallBatchingSystem.Models;

namespace BPASmartClient.SmallBatchingSystem.ViewModels
{
public class NewRecipeViewModel : ObservableObject
{
public NewRecipeViewModel()
{
AddRawMaterialCommand = new RelayCommand(() => { SiloInfos.Add(new RecipeRawMaterialInfo()); });
CnacelCommand = new RelayCommand(() => { ActionManage.GetInstance.Send("NewRecipeViewModelClose"); });
SaveCommand = new RelayCommand(() =>
{
//ObservableCollection<RecipeRawMaterialInfo> SileNames = new ObservableCollection<string>();
//SiloInfos.ToList()?.ForEach(item => { SileNames.Add(item.RawMaterialName); });
Json<ConfigInfoModel>.Data.Recipes.Add(new RecipeInfo()
{
RecipeName = RecipeName,
SiloInfoModels = SiloInfos
});
ActionManage.GetInstance.Send("NewRecipeViewModelClose");
});

RemoveCommand = new RelayCommand<object>((o) =>
{
if (!string.IsNullOrEmpty(o?.ToString()))
{
var res = SiloInfos.FirstOrDefault(p => p.SiloName == o.ToString());
if (res != null) SiloInfos.Remove(res);
}
});

Json<ConfigInfoModel>.Data.SiloInfoModels.ToList()?.ForEach(item => { SileName.Add(item.SiloName); });
}

public string RecipeName { get { return _mRecipeName; } set { _mRecipeName = value; OnPropertyChanged(); } }
private string _mRecipeName;

public RelayCommand AddRawMaterialCommand { get; set; }

public RelayCommand CnacelCommand { get; set; }

public RelayCommand SaveCommand { get; set; }

public RelayCommand<object> RemoveCommand { get; set; }

public ObservableCollection<RecipeRawMaterialInfo> SiloInfos { get; set; } = new ObservableCollection<RecipeRawMaterialInfo>();

public ObservableCollection<string> SileName { get; set; } = new ObservableCollection<string>();

}
}

+ 45
- 0
BPASmartClient.SmallBatchingSystem/ViewModels/OutletManagementViewModel.cs Parādīt failu

@@ -1,9 +1,14 @@
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using BPA.Helper;
using BPASmartClient.SmallBatchingSystem.Models;
using BPASmartClient.SmallBatchingSystem.Views;
using Microsoft.Toolkit.Mvvm.ComponentModel;
using Microsoft.Toolkit.Mvvm.Input;

namespace BPASmartClient.SmallBatchingSystem.ViewModels
{
@@ -11,7 +16,47 @@ namespace BPASmartClient.SmallBatchingSystem.ViewModels
{
public OutletManagementViewModel()
{
AddSiloCommand = new RelayCommand(() =>
{
NewOutletView newOutletView = new NewOutletView();
newOutletView.ShowDialog();
});
SaveCommand = new RelayCommand(() => { Json<ConfigInfoModel>.Save(); });
OutletInfoModels = Json<ConfigInfoModel>.Data.OutletInfoModels;
RemoveCommand = new RelayCommand<object>((o) =>
{
if (!string.IsNullOrEmpty(o?.ToString()))
{
var res = Json<ConfigInfoModel>.Data.OutletInfoModels.FirstOrDefault(p => p.OutletName == o.ToString());
if (res != null) Json<ConfigInfoModel>.Data.OutletInfoModels.Remove(res);
}
});

DetailsCommand = new RelayCommand<object>((o) =>
{
if (!string.IsNullOrEmpty(o?.ToString()))
{
var res = Json<ConfigInfoModel>.Data.OutletInfoModels.FirstOrDefault(p => p.OutletName == o.ToString());
if (res != null)
{
NewOutletView newOutletView = new NewOutletView();
ActionManage.GetInstance.Send("OpenNewOutlet", res);
newOutletView.ShowDialog();
}
}
});
}

public RelayCommand AddSiloCommand { get; set; }

public RelayCommand SaveCommand { get; set; }

public RelayCommand<object> RemoveCommand { get; set; }

public RelayCommand<object> DetailsCommand { get; set; }

public ObservableCollection<OutletInfoModel> OutletInfoModels { get; set; }


}
}

+ 37
- 0
BPASmartClient.SmallBatchingSystem/ViewModels/RecipeControlViewModel.cs Parādīt failu

@@ -0,0 +1,37 @@
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using BPA.Helper;
using BPASmartClient.SmallBatchingSystem.Models;
using Microsoft.Toolkit.Mvvm.ComponentModel;
using Microsoft.Toolkit.Mvvm.Input;
using BPASmartClient.SmallBatchingSystem.Services;

namespace BPASmartClient.SmallBatchingSystem.ViewModels
{
public class RecipeControlViewModel : ObservableObject
{
public RecipeControlViewModel()
{
Recipes = Json<ConfigInfoModel>.Data.Recipes;
StartCommand = new RelayCommand<object>((o) =>
{
if (!string.IsNullOrEmpty(o?.ToString()))
{
int index = Array.FindIndex(Json<ConfigInfoModel>.Data.Recipes.ToArray(), p => p.RecipeName == o.ToString());
if (index >= 0 && index < Json<ConfigInfoModel>.Data.Recipes.Count)
{
Control.GetInstance.MakeOrderQueue.Enqueue(Json<ConfigInfoModel>.Data.Recipes.ElementAt(index));
}
}
});
}
public ObservableCollection<RecipeInfo> Recipes { get; set; }

public RelayCommand<object> StartCommand { get; set; }

}
}

+ 72
- 0
BPASmartClient.SmallBatchingSystem/ViewModels/RecipeViewModel.cs Parādīt failu

@@ -0,0 +1,72 @@
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using BPA.Helper;
using BPASmartClient.SmallBatchingSystem.Models;
using BPASmartClient.SmallBatchingSystem.Views;
using Microsoft.Toolkit.Mvvm.ComponentModel;
using Microsoft.Toolkit.Mvvm.Input;

namespace BPASmartClient.SmallBatchingSystem.ViewModels
{
public class RecipeViewModel : ObservableObject
{
public RecipeViewModel()
{
NewRecipeCommand = new RelayCommand(() =>
{
NewRecipeView newOutletView = new NewRecipeView();
newOutletView.ShowDialog();
});
SaveCommand = new RelayCommand(() => { Json<ConfigInfoModel>.Save(); });
RecipeInfoModels = Json<ConfigInfoModel>.Data.Recipes;
RemoveCommand = new RelayCommand<object>((o) =>
{
if (!string.IsNullOrEmpty(o?.ToString()))
{
var res = Json<ConfigInfoModel>.Data.Recipes.FirstOrDefault(p => p.RecipeName == o.ToString());
if (res != null) Json<ConfigInfoModel>.Data.Recipes.Remove(res);
}
});

DetailsCommand = new RelayCommand<object>((o) =>
{
if (!string.IsNullOrEmpty(o?.ToString()))
{
var res = Json<ConfigInfoModel>.Data.Recipes.FirstOrDefault(p => p.RecipeName == o.ToString());
if (res != null)
{
NewRecipeView newOutletView = new NewRecipeView();
newOutletView.outName.Text = o.ToString();
//res.SiloInfoModels?.ToList()?.ForEach(item => { NewRecipeViewModel.SiloInfoModels.Add(item); });
//int index = Array.FindIndex(Json<ConfigInfoModel>.Data.Recipes.ToArray(), p => p.RecipeName == o.ToString());
//if (index >= 0 && index < Json<ConfigInfoModel>.Data.Recipes.Count)
//{
// NewRecipeViewModel.SiloInfoModels = Json<ConfigInfoModel>.Data.Recipes.ElementAt(index).SiloInfoModels;
//}
newOutletView.ShowDialog();
//int index = Array.FindIndex(Json<ConfigInfoModel>.Data.Recipes.ToArray(), p => p.RecipeName == o.ToString());
//if (index >= 0 && index < Json<ConfigInfoModel>.Data.Recipes.Count)
//{
// NewRecipeViewModel.SiloInfoModels = Json<ConfigInfoModel>.Data.Recipes.ElementAt(index).SiloInfoModels;
//}

}
}
});
}

public RelayCommand NewRecipeCommand { get; set; }

public RelayCommand SaveCommand { get; set; }

public RelayCommand<object> RemoveCommand { get; set; }

public RelayCommand<object> DetailsCommand { get; set; }

public ObservableCollection<RecipeInfo> RecipeInfoModels { get; set; }
}
}

+ 20
- 1
BPASmartClient.SmallBatchingSystem/ViewModels/SiloManagementViewModel.cs Parādīt failu

@@ -4,6 +4,11 @@ using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Microsoft.Toolkit.Mvvm.ComponentModel;
using Microsoft.Toolkit.Mvvm.Input;
using BPASmartClient.SmallBatchingSystem.Views;
using BPASmartClient.SmallBatchingSystem.Models;
using System.Collections.ObjectModel;
using BPA.Helper;

namespace BPASmartClient.SmallBatchingSystem.ViewModels
{
@@ -11,9 +16,23 @@ namespace BPASmartClient.SmallBatchingSystem.ViewModels
{
public SiloManagementViewModel()
{

AddSilo = new RelayCommand(() =>
{
NewSiloView newSiloView = new NewSiloView();
if (newSiloView.ShowDialog() == true)
{
//if (newSiloView.Tag!=null && newSiloView.Tag is )
}
});
SaveData = new RelayCommand(() => { Json<ConfigInfoModel>.Save(); });
SiloInfoModels = Json<ConfigInfoModel>.Data.SiloInfoModels;
}

public RelayCommand AddSilo { get; set; }

public RelayCommand SaveData { get; set; }

public ObservableCollection<SiloInfoModel> SiloInfoModels { get; set; }

}
}

+ 70
- 24
BPASmartClient.SmallBatchingSystem/Views/NewOutletView.xaml Parādīt failu

@@ -6,14 +6,20 @@
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:BPASmartClient.SmallBatchingSystem.Views"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:vm="clr-namespace:BPASmartClient.SmallBatchingSystem.ViewModels"
Title="NewOutletView"
Width="500"
Height="300"
Width="600"
Height="400"
AllowsTransparency="True"
Background="{x:Null}"
WindowStartupLocation="CenterScreen"
WindowStyle="None"
mc:Ignorable="d">

<Window.DataContext>
<vm:NewOutletViewModel />
</Window.DataContext>

<Window.Resources>
<SolidColorBrush x:Key="FontColor" Color="#FF2AB2E7" />

@@ -122,31 +128,62 @@
<RowDefinition />
</Grid.RowDefinitions>

<TextBlock
Margin="15,0,0,0"
HorizontalAlignment="Left"
Style="{StaticResource TextBlockStyle}"
Text="出料口名称:" />

<StackPanel Orientation="Horizontal">
<TextBlock
Margin="15,0,0,0"
HorizontalAlignment="Left"
FontSize="16"
Style="{StaticResource TextBlockStyle}"
Text="出料口名称:" />

<TextBox
Name="outName"
Width="180"
Height="35"
FontSize="20"
Style="{StaticResource TextBoxStyle}"
Text="{Binding OutletName}" />

<TextBlock
Margin="15,0,0,0"
HorizontalAlignment="Left"
FontSize="16"
Style="{StaticResource TextBlockStyle}"
Text="出料口位置:" />

<TextBox
Name="outLoc"
Width="180"
Height="35"
Margin="5,0,0,0"
FontSize="20"
Style="{StaticResource TextBoxStyle}"
Text="{Binding OutletLoc}" />
</StackPanel>



<StackPanel
Grid.Row="1"
Margin="10,0,0,0"
HorizontalAlignment="Right"
Orientation="Horizontal">

<TextBox
<!--<TextBox
Name="outName"
Width="180"
Height="35"
Margin="5,0,0,0"
FontSize="20"
Style="{StaticResource TextBoxStyle}"
Text="{Binding TrayNum}" />
Style="{StaticResource TextBoxStyle}" />-->

<Button
Width="90"
Height="30"
Margin="5,0,5,0"
Command="{Binding AddCommand}"
Content="添加料仓"
Command="{Binding AddRawMaterialCommand}"
Content="添加料"
FontSize="20"
Style="{StaticResource ImageButtonStyle}" />

@@ -154,7 +191,7 @@
Width="90"
Height="30"
Margin="5,0,5,0"
Command="{Binding AddCommand}"
Command="{Binding CancelCommand}"
Content="取消"
FontSize="20"
Style="{StaticResource ImageButtonStyle}" />
@@ -164,7 +201,7 @@
Width="90"
Height="30"
Margin="5,0,5,0"
Command="{Binding AddCommand}"
Command="{Binding SaveCommand}"
Content="保存"
FontSize="20"
Style="{StaticResource ImageButtonStyle}" />
@@ -189,7 +226,7 @@
<TextBlock
Grid.Column="0"
Style="{StaticResource TitleTextblockStyle}"
Text="选择料仓" />
Text="原料" />

<Grid Grid.Column="1">
<TextBlock Style="{StaticResource TitleTextblockStyle}" Text="功能操作" />
@@ -207,15 +244,17 @@
</Grid>
<!--#endregion-->


<ScrollViewer HorizontalScrollBarVisibility="Hidden" VerticalScrollBarVisibility="Hidden">
<ItemsControl ItemsSource="{Binding RawMaterials}">
<ScrollViewer
Grid.Row="1"
HorizontalScrollBarVisibility="Hidden"
VerticalScrollBarVisibility="Hidden">
<ItemsControl ItemsSource="{Binding SiloInfos}">
<ItemsControl.ItemTemplate>
<DataTemplate>
<RadioButton GroupName="all">
<RadioButton.Template>
<ControlTemplate TargetType="RadioButton">
<Grid Name="gr" Height="40">
<Grid Name="gr" Height="30">
<Grid.ColumnDefinitions>
<ColumnDefinition />
<ColumnDefinition Width="0.68*" />
@@ -224,25 +263,32 @@
<ComboBox
Name="cb"
Grid.Column="0"
Margin="3,1"
VerticalAlignment="Center"
BorderBrush="#FF074B92"
BorderThickness="1"
FontFamily="楷体"
Height="{Binding ElementName=gr,Path=ActualHeight}"
FontSize="20"
Foreground="#FF2AB2E7"
IsEditable="False"
ItemsSource="{Binding DataContext.RawMaterialNames, RelativeSource={RelativeSource AncestorType=ItemsControl, Mode=FindAncestor}}"
SelectedIndex="0"
ItemsSource="{Binding DataContext.SileName, RelativeSource={RelativeSource AncestorType=ItemsControl, Mode=FindAncestor}}"
Style="{StaticResource ComboBoxStyle}"
Text="{Binding RawMaterialName}" />

<Button
Grid.Column="1"
Command="{Binding DataContext.RemoveCommand, RelativeSource={RelativeSource AncestorType=ItemsControl, Mode=FindAncestor}}"
CommandParameter="{Binding RawMaterialName}"
Content="删除"
FontSize="16"
Style="{StaticResource ControlButtonStyle}" />

<!--<Button
Grid.Column="1"
Width="80"
Command="{Binding DataContext.RemoveCommand, RelativeSource={RelativeSource AncestorType=ItemsControl, Mode=FindAncestor}}"
CommandParameter="{Binding RawMaterialId}"
Content="删除" />
CommandParameter="{Binding RawMaterialName}"
Content="删除" />-->

</Grid>



+ 5
- 1
BPASmartClient.SmallBatchingSystem/Views/NewOutletView.xaml.cs Parādīt failu

@@ -1,4 +1,7 @@
using System;
using BPA.Helper;
using BPASmartClient.SmallBatchingSystem.Models;
using BPASmartClient.SmallBatchingSystem.ViewModels;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
@@ -22,6 +25,7 @@ namespace BPASmartClient.SmallBatchingSystem.Views
public NewOutletView()
{
InitializeComponent();
ActionManage.GetInstance.Register(new Action(() => { this.Close(); }), "NewOutletViewClose", true);
}
}
}

+ 290
- 0
BPASmartClient.SmallBatchingSystem/Views/NewRecipeView.xaml Parādīt failu

@@ -0,0 +1,290 @@
<Window
x:Class="BPASmartClient.SmallBatchingSystem.Views.NewRecipeView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:con="clr-namespace:BPASmartClient.SmallBatchingSystem.Converter"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:BPASmartClient.SmallBatchingSystem.Views"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:vm="clr-namespace:BPASmartClient.SmallBatchingSystem.ViewModels"
Title="NewPfView"
Width="500"
Height="300"
AllowsTransparency="True"
Background="{x:Null}"
WindowStartupLocation="CenterScreen"
WindowStyle="None"
mc:Ignorable="d">

<Window.DataContext>
<vm:NewRecipeViewModel />
</Window.DataContext>

<Window.Resources>
<SolidColorBrush x:Key="FontColor" Color="#FF2AB2E7" />

<SolidColorBrush x:Key="tabColor" Color="#FF2AB2E7" />
<!--<SolidColorBrush x:Key="bordColor" Color="#33ffffff" />-->
<SolidColorBrush x:Key="bordColor" Color="#332AB2E7" />
<con:DataTableRedundantConverter x:Key="tabConvert" />

<Style x:Key="TextBlockStyle" TargetType="TextBlock">
<Setter Property="VerticalAlignment" Value="Center" />
<Setter Property="HorizontalAlignment" Value="Right" />
<Setter Property="Foreground" Value="{StaticResource FontColor}" />
<Setter Property="FontSize" Value="20" />
</Style>

<Style x:Key="TextBoxStyle" TargetType="TextBox">
<Setter Property="FontFamily" Value="楷体" />
<Setter Property="FontSize" Value="22" />
<Setter Property="VerticalContentAlignment" Value="Center" />
<Setter Property="Width" Value="188" />
<Setter Property="Padding" Value="6,0,0,0" />
<Setter Property="Height" Value="37" />
<Setter Property="BorderThickness" Value="0" />
<Setter Property="Foreground" Value="{StaticResource PoupTextblockColor}" />
<Setter Property="BorderBrush" Value="{StaticResource PoupTextblockColor}" />
<Setter Property="CaretBrush" Value="{StaticResource PoupTextblockColor}" />
<Setter Property="VerticalAlignment" Value="Center" />
<Setter Property="Background">
<Setter.Value>
<ImageBrush ImageSource="/BPASmartClient.CustomResource;component/Image/textBox.png" Stretch="Fill" />
</Setter.Value>
</Setter>
</Style>

<Style x:Key="ControlButtonStyle" TargetType="Button">
<Setter Property="Margin" Value="0" />
<Setter Property="FontSize" Value="18" />
<Setter Property="Foreground" Value="#FFF53F62" />
<Setter Property="FontWeight" Value="SemiBold" />
<Setter Property="FontFamily" Value="楷体" />
<Setter Property="VerticalContentAlignment" Value="Center" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="Button">
<Border
Name="TitleBarBr"
BorderBrush="#00c2f4"
BorderThickness="0"
CornerRadius="0"
Opacity="0.8">

<ContentPresenter
Margin="{TemplateBinding Margin}"
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
VerticalAlignment="{TemplateBinding VerticalContentAlignment}" />
<Border.Background>
<ImageBrush
ImageSource="/BPASmartClient.CustomResource;component/Image/组合边框1.1.png"
Opacity="0.8"
Stretch="Fill" />
</Border.Background>

</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="true">
<Setter TargetName="TitleBarBr" Property="Opacity" Value="1" />
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>

<Style x:Key="TitleTextblockStyle" TargetType="TextBlock">
<Setter Property="FontSize" Value="16" />
<Setter Property="HorizontalAlignment" Value="Center" />
<Setter Property="VerticalAlignment" Value="Center" />
<Setter Property="Foreground" Value="{StaticResource tabColor}" />
<Setter Property="FontFamily" Value="楷体" />
<Setter Property="FontWeight" Value="SemiBold" />
</Style>

</Window.Resources>

<Grid>
<Grid.Background>
<ImageBrush ImageSource="/BPASmartClient.CustomResource;component/Image/容器边框.png" />
</Grid.Background>

<Grid.RowDefinitions>
<RowDefinition Height="0.18*" />
<RowDefinition />
</Grid.RowDefinitions>

<TextBlock
HorizontalAlignment="Center"
VerticalAlignment="Center"
FontSize="20"
Foreground="{StaticResource FontColor}"
Text="新建配方" />

<Grid Grid.Row="1">
<Grid.RowDefinitions>
<RowDefinition Height="0.2*" />
<RowDefinition Height="0.2*" />
<RowDefinition />
</Grid.RowDefinitions>

<TextBlock
Margin="15,0,0,0"
HorizontalAlignment="Left"
Style="{StaticResource TextBlockStyle}"
Text="配方名称:" />

<StackPanel
Grid.Row="1"
Margin="10,0,0,0"
Orientation="Horizontal">

<TextBox
Name="outName"
Width="180"
Height="35"
Margin="5,0,0,0"
FontSize="20"
Style="{StaticResource TextBoxStyle}"
Text="{Binding RecipeName}" />

<Button
Width="90"
Height="30"
Margin="5,0,5,0"
Command="{Binding AddRawMaterialCommand}"
Content="添加原料"
FontSize="20"
Style="{StaticResource ImageButtonStyle}" />

<Button
Width="90"
Height="30"
Margin="5,0,5,0"
Command="{Binding CnacelCommand}"
Content="取消"
FontSize="20"
Style="{StaticResource ImageButtonStyle}" />

<Button
Grid.Column="1"
Width="90"
Height="30"
Margin="5,0,5,0"
Command="{Binding SaveCommand}"
Content="保存"
FontSize="20"
Style="{StaticResource ImageButtonStyle}" />
</StackPanel>

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

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

<!--#region 表格标题栏设置-->
<Grid Margin="0,10,0,0" Background="#ff0C255F">

<Grid.ColumnDefinitions>
<ColumnDefinition />
<ColumnDefinition />
<ColumnDefinition Width="0.68*" />
</Grid.ColumnDefinitions>


<TextBlock
Grid.Column="0"
Style="{StaticResource TitleTextblockStyle}"
Text="选择料仓" />

<Grid Grid.Column="1">
<TextBlock Style="{StaticResource TitleTextblockStyle}" Text="重量( g )" />
<Border
BorderBrush="{StaticResource bordColor}"
BorderThickness="1,0,1,0"
Cursor="SizeWE" />
</Grid>

<TextBlock
Grid.Column="2"
Style="{StaticResource TitleTextblockStyle}"
Text="功能操作" />

<Border
Grid.ColumnSpan="2"
BorderBrush="{StaticResource bordColor}"
BorderThickness="1,0,1,0" />

</Grid>
<!--#endregion-->


<ScrollViewer
Grid.Row="1"
HorizontalScrollBarVisibility="Hidden"
VerticalScrollBarVisibility="Hidden">
<ItemsControl ItemsSource="{Binding SiloInfos}">
<ItemsControl.ItemTemplate>
<DataTemplate>
<RadioButton GroupName="all">
<RadioButton.Template>
<ControlTemplate TargetType="RadioButton">
<Grid Name="gr" Height="40">
<Grid.ColumnDefinitions>
<ColumnDefinition />
<ColumnDefinition />
<ColumnDefinition Width="0.68*" />
</Grid.ColumnDefinitions>

<ComboBox
Name="cb"
Grid.Column="0"
Margin="3,1"
VerticalAlignment="Center"
BorderBrush="#FF074B92"
BorderThickness="1"
FontFamily="楷体"
FontSize="20"
Foreground="#FF2AB2E7"
IsEditable="False"
ItemsSource="{Binding DataContext.SileName, RelativeSource={RelativeSource AncestorType=ItemsControl, Mode=FindAncestor}}"
SelectedIndex="0"
Style="{StaticResource ComboBoxStyle}"
Text="{Binding SiloName}" />

<TextBox
Grid.Column="1"
Height="35"
Margin="5,0,0,0"
FontSize="20"
Style="{StaticResource TextBoxStyle}"
Text="{Binding SiloWeight}" />

<Button
Grid.Column="2"
Command="{Binding DataContext.RemoveCommand, RelativeSource={RelativeSource AncestorType=ItemsControl, Mode=FindAncestor}}"
CommandParameter="{Binding SiloName}"
Content="删除" />

</Grid>


</ControlTemplate>
</RadioButton.Template>
</RadioButton>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
</ScrollViewer>

</Grid>



</Grid>

</Grid>

</Window>

+ 62
- 0
BPASmartClient.SmallBatchingSystem/Views/NewRecipeView.xaml.cs Parādīt failu

@@ -0,0 +1,62 @@
using BPA.Helper;
using BPASmartClient.SmallBatchingSystem.Models;
using BPASmartClient.SmallBatchingSystem.ViewModels;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;

namespace BPASmartClient.SmallBatchingSystem.Views
{
/// <summary>
/// NewPfView.xaml 的交互逻辑
/// </summary>
public partial class NewRecipeView : Window
{
public NewRecipeView()
{
InitializeComponent();
ActionManage.GetInstance.Register(new Action(() => { this.Close(); }), "NewRecipeViewModelClose", true);
}

private void Button_Click_1(object sender, RoutedEventArgs e)
{
//this.Close();
}

private void Button_Click(object sender, RoutedEventArgs e)
{
//if (Json<ConfigInfoModel>.Data.Recipes.FirstOrDefault(p => p.RecipeName == this.outName.Text) == null)
//{
// Json<ConfigInfoModel>.Data.Recipes.Add(new RecipeInfo()
// {
// RecipeName = this.outName.Text,
// SiloInfoModels = NewRecipeViewModel.SiloInfoModels
// });
//}
//else
//{
// int index = Array.FindIndex(Json<ConfigInfoModel>.Data.Recipes.ToArray(), p => p.RecipeName == outName.Text);
// if (index >= 0 && index < Json<ConfigInfoModel>.Data.Recipes.Count)
// {
// Json<ConfigInfoModel>.Data.Recipes.ElementAt(index).RecipeName = outName.Text;
// Json<ConfigInfoModel>.Data.Recipes.ElementAt(index).SiloInfoModels.Clear();
// NewRecipeViewModel.SiloInfoModels.ToList().ForEach(item =>
// {
// Json<ConfigInfoModel>.Data.Recipes.ElementAt(index).SiloInfoModels.Add(item);
// });
// }
//}
//this.Close();
}
}
}

+ 4
- 0
BPASmartClient.SmallBatchingSystem/Views/NewSiloView.xaml Parādīt failu

@@ -88,6 +88,7 @@
Text="料仓原料位置:" />

<TextBox
Name="SiloName"
Grid.Column="1"
Width="250"
Height="40"
@@ -97,6 +98,7 @@
Text="{Binding SiloInfoModelObj.SiloName}" />

<TextBox
Name="SiloLoc"
Grid.Row="1"
Grid.Column="1"
Width="250"
@@ -121,6 +123,7 @@
Width="150"
Height="40"
Margin="5,0,5,0"
Click="Button_Click"
Command="{Binding CancelCommand}"
Content="取消"
FontSize="20"
@@ -132,6 +135,7 @@
Width="150"
Height="40"
Margin="5,0,5,0"
Click="Button_Click_1"
Command="{Binding OkCommand}"
Content="保存"
FontSize="20"


+ 16
- 0
BPASmartClient.SmallBatchingSystem/Views/NewSiloView.xaml.cs Parādīt failu

@@ -12,6 +12,7 @@ using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
using BPA.Helper;
using BPASmartClient.SmallBatchingSystem.Models;

namespace BPASmartClient.SmallBatchingSystem.Views
{
@@ -24,5 +25,20 @@ namespace BPASmartClient.SmallBatchingSystem.Views
{
InitializeComponent();
}

private void Button_Click(object sender, RoutedEventArgs e)
{
this.Close();
}

private void Button_Click_1(object sender, RoutedEventArgs e)
{
Json<ConfigInfoModel>.Data.SiloInfoModels.Add(new SiloInfoModel()
{
SiloLoc = Convert.ToInt32(this.SiloLoc.Text),
SiloName = this.SiloName.Text,
});
this.Close();
}
}
}

+ 505
- 10
BPASmartClient.SmallBatchingSystem/Views/OutletManagementView.xaml Parādīt failu

@@ -1,12 +1,507 @@
<UserControl x:Class="BPASmartClient.SmallBatchingSystem.Views.OutletManagementView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:BPASmartClient.SmallBatchingSystem.Views"
mc:Ignorable="d"
d:DesignHeight="450" d:DesignWidth="800">
<Grid>
<UserControl
x:Class="BPASmartClient.SmallBatchingSystem.Views.OutletManagementView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:con="clr-namespace:BPASmartClient.SmallBatchingSystem.Converter"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:BPASmartClient.SmallBatchingSystem.Views"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:pry="clr-namespace:BPASmartClient.CustomResource.UserControls;assembly=BPASmartClient.CustomResource"
xmlns:vm="clr-namespace:BPASmartClient.SmallBatchingSystem.ViewModels"
d:DesignHeight="450"
d:DesignWidth="800"
mc:Ignorable="d">

<UserControl.DataContext>
<vm:OutletManagementViewModel />
</UserControl.DataContext>

<UserControl.Resources>
<SolidColorBrush x:Key="tabColor" Color="#FF2AB2E7" />
<!--<SolidColorBrush x:Key="bordColor" Color="#33ffffff" />-->
<SolidColorBrush x:Key="bordColor" Color="#332AB2E7" />
<con:DataTableRedundantConverter x:Key="tabConvert" />

<Style x:Key="UserItemContainerStyle" TargetType="ListBoxItem">
<Style.Resources>
<!-- SelectedItem with focus -->
<SolidColorBrush
x:Key="{x:Static SystemColors.HighlightBrushKey}"
Opacity=".4"
Color="White" />
<!-- SelectedItem without focus -->
<SolidColorBrush
x:Key="{x:Static SystemColors.ControlBrushKey}"
Opacity=".4"
Color="White" />
</Style.Resources>
<!-- 设置触发器 -->
<Style.Triggers>
<Trigger Property="IsMouseOver" Value="true">
<Setter Property="Background" Value="White" />
<Setter Property="Foreground" Value="White" />
</Trigger>
<Trigger Property="IsFocused" Value="true">
<Setter Property="Background" Value="White" />
<Setter Property="Foreground" Value="White" />
</Trigger>
</Style.Triggers>
</Style>

<Style x:Key="RowRadioButtonStyle" TargetType="{x:Type RadioButton}">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type RadioButton}">
<Border
x:Name="NvaBor"
Background="Transparent"
BorderBrush="#FF2AB2E7"
BorderThickness="0">
<ContentControl
Margin="10,4"
HorizontalAlignment="Center"
VerticalAlignment="Center"
HorizontalContentAlignment="Center"
VerticalContentAlignment="Center"
Content="{TemplateBinding Content}"
FontSize="16" />
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsChecked" Value="True">
<Setter TargetName="NvaBor" Property="Background" Value="#22ffffff" />
<Setter TargetName="NvaBor" Property="BorderThickness" Value="0" />
</Trigger>
<MultiTrigger>
<MultiTrigger.Conditions>
<Condition Property="IsChecked" Value="false" />
<Condition Property="IsMouseOver" Value="True" />
</MultiTrigger.Conditions>
<MultiTrigger.Setters>
<Setter TargetName="NvaBor" Property="Background" Value="#22ffffff" />
</MultiTrigger.Setters>
</MultiTrigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>

<Style x:Key="InputTextboxStyle" TargetType="TextBox">
<Setter Property="Margin" Value="5,0,0,0" />
<Setter Property="BorderThickness" Value="0" />
<Setter Property="HorizontalAlignment" Value="Left" />
<Setter Property="Width" Value="150" />
<Setter Property="Height" Value="40" />
<Setter Property="CaretBrush" Value="{StaticResource TitleBorderColor}" />
<Setter Property="Foreground" Value="{StaticResource TitleBorderColor}" />
<Setter Property="VerticalContentAlignment" Value="Center" />
<Setter Property="FontSize" Value="14" />
<Setter Property="Background" Value="Transparent" />
<Setter Property="VerticalAlignment" Value="Center" />
</Style>

<Style x:Key="ControlButtonStyle" TargetType="Button">
<Setter Property="Margin" Value="0" />
<Setter Property="FontSize" Value="18" />
<Setter Property="Foreground" Value="#FFF53F62" />
<Setter Property="FontWeight" Value="SemiBold" />
<Setter Property="FontFamily" Value="楷体" />
<Setter Property="VerticalContentAlignment" Value="Center" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="Button">
<Border
Name="TitleBarBr"
BorderBrush="#00c2f4"
BorderThickness="0"
CornerRadius="0"
Opacity="0.8">

<ContentPresenter
Margin="{TemplateBinding Margin}"
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
VerticalAlignment="{TemplateBinding VerticalContentAlignment}" />
<Border.Background>
<ImageBrush
ImageSource="/BPASmartClient.CustomResource;component/Image/组合边框1.1.png"
Opacity="0.8"
Stretch="Fill" />
</Border.Background>

</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="true">
<Setter TargetName="TitleBarBr" Property="Opacity" Value="1" />
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>

<Style x:Key="TitleTextblockStyle" TargetType="TextBlock">
<Setter Property="FontSize" Value="16" />
<Setter Property="HorizontalAlignment" Value="Center" />
<Setter Property="VerticalAlignment" Value="Center" />
<Setter Property="Foreground" Value="{StaticResource tabColor}" />
<Setter Property="FontFamily" Value="楷体" />
<Setter Property="FontWeight" Value="SemiBold" />
</Style>

</UserControl.Resources>

<Grid Margin="10">
<Grid.RowDefinitions>
<RowDefinition Height="40" />
<RowDefinition />
</Grid.RowDefinitions>

<StackPanel HorizontalAlignment="Right" Orientation="Horizontal">
<Button
Width="150"
Height="40"
Margin="10,0,10,0"
Command="{Binding AddSiloCommand}"
Content="添加出料口"
FontSize="20"
Style="{StaticResource ImageButtonStyle}" />
<Button
Width="150"
Height="40"
Margin="10,0,10,0"
Command="{Binding SaveCommand}"
Content="保存参数"
FontSize="20"
Style="{StaticResource ImageButtonStyle}" />
</StackPanel>

<Grid Grid.Row="1">

<!--<ListBox
Margin="5"
VerticalAlignment="Top"
Background="Transparent"
BorderThickness="0"
ItemsSource="{Binding OutletInfoModels}"
ScrollViewer.HorizontalScrollBarVisibility="Disabled">
<ListBox.ItemsPanel>
<ItemsPanelTemplate>
<WrapPanel Orientation="Horizontal" />
</ItemsPanelTemplate>
</ListBox.ItemsPanel>

<ListBox.ItemTemplate>
<DataTemplate>

<Grid
Name="tt"
Height="220"
Margin="5">
<Grid.RowDefinitions>
<RowDefinition Height="30" />
<RowDefinition Height="20" />
<RowDefinition Height="128" />
<RowDefinition Height="2" />
<RowDefinition Height="40" />
</Grid.RowDefinitions>

<Image
Grid.RowSpan="5"
Source="/BPASmartClient.CustomResource;component/Image/配方背景/竖背景框.png"
Stretch="Fill" />

<StackPanel Grid.Row="0" Orientation="Horizontal">
<TextBlock
Margin="2,5,0,0"
HorizontalAlignment="Center"
VerticalAlignment="Top"
FontSize="18"
Foreground="#FF2AB2E7"
Text="出料口名称:" />
<TextBlock
Margin="2,5,0,0"
HorizontalAlignment="Center"
VerticalAlignment="Top"
FontSize="18"
Foreground="#FF2AB2E7"
Text="{Binding OutletName}" />
</StackPanel>

<StackPanel Grid.Row="1" Orientation="Horizontal">
<TextBlock
Margin="2,5,0,0"
HorizontalAlignment="Center"
VerticalAlignment="Top"
FontSize="18"
Foreground="#FF2AB2E7"
Text="出料口位置:" />
<TextBlock
Margin="2,5,0,0"
HorizontalAlignment="Center"
VerticalAlignment="Top"
FontSize="18"
Foreground="#FF2AB2E7"
Text="{Binding OutletLoc}" />
</StackPanel>

-->
<!--<TextBlock
Grid.Row="0"
Margin="2,5,0,0"
HorizontalAlignment="Center"
VerticalAlignment="Top"
FontSize="18"
Foreground="#FF2AB2E7"
Text="{Binding OutletName}" />-->
<!--

<TextBlock
Grid.Row="1"
Margin="5,0,0,0"
VerticalAlignment="Top"
Foreground="#FF2AB2E7"
Text="料仓信息:" />

<ScrollViewer
Grid.Row="2"
VerticalAlignment="Top"
Background="Transparent"
HorizontalScrollBarVisibility="Hidden"
VerticalScrollBarVisibility="Hidden">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="auto" />
<ColumnDefinition />
</Grid.ColumnDefinitions>

<ItemsControl ItemsSource="{Binding SiloInfoModels}">
<ItemsControl.ItemTemplate>
<DataTemplate>
<Grid Width="150">
<Grid.ColumnDefinitions>
<ColumnDefinition />
<ColumnDefinition Width="0.1*" />
<ColumnDefinition />
</Grid.ColumnDefinitions>

<TextBlock
Margin="5,0,0,0"
HorizontalAlignment="Right"
VerticalAlignment="Center"
Foreground="#aa2AB2E7"
Text="{Binding SiloName}" />

<TextBlock
Grid.Column="1"
Margin="1,0,0,0"
HorizontalAlignment="Center"
VerticalAlignment="Center"
Foreground="#aa2AB2E7"
Text=":" />

<TextBlock
Grid.Column="2"
Margin="5,0,0,0"
HorizontalAlignment="Left"
VerticalAlignment="Center"
Foreground="#aa2AB2E7"
Text="{Binding SiloWeight}" />
</Grid>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
</Grid>
</ScrollViewer>

<Image
Grid.Row="3"
Width="{Binding ElementName=tt, Path=ActualWidth}"
Height="2"
VerticalAlignment="Bottom"
Source="/BPASmartClient.CustomResource;component/Image/直线.png"
Stretch="Fill" />

<Grid
Name="gr"
Grid.Row="4"
Height="30"
Margin="0,0,0,10"
VerticalAlignment="Bottom"
Background="Transparent">

<pry:IcoButton
Width="{Binding ElementName=gr, Path=ActualWidth}"
Height="{Binding ElementName=gr, Path=ActualHeight}"
Margin="4,4,3,0"
HorizontalAlignment="Center"
VerticalAlignment="Center"
Background="#11F53F62"
BorderThickness="0"
Command="{Binding DataContext.RemoveCommand, RelativeSource={RelativeSource AncestorType=ListBox, Mode=FindAncestor}}"
CommandParameter="{Binding OutletName}"
Content="删除"
EnterBackground="#22F53F62"
FontStyle="Normal"
Foreground="#FFF53F62"
IcoText="&#xe68e;"
Style="{StaticResource IcoButtonStyle}" />

<pry:IcoButton
Grid.Column="1"
Width="{Binding ElementName=gr, Path=ActualWidth}"
Height="{Binding ElementName=gr, Path=ActualHeight}"
Margin="3,4,4,0"
HorizontalAlignment="Center"
VerticalAlignment="Center"
Background="#112AB2E7"
BorderThickness="0"
Command="{Binding DataContext.DetailsCommand, RelativeSource={RelativeSource AncestorType=ListBox, Mode=FindAncestor}}"
CommandParameter="{Binding OutletName}"
Content="编辑"
EnterBackground="#222AB2E7"
Foreground="#FF2AB2E7"
IcoText="&#xe636;"
Style="{StaticResource IcoButtonStyle}" />

</Grid>
</Grid>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>-->

<ListView
Margin="10"
Background="Transparent"
BorderBrush="#00BEFA"
BorderThickness="0"
ItemsSource="{Binding OutletInfoModels}"
ScrollViewer.HorizontalScrollBarVisibility="Disabled">
<ListView.ItemsPanel>
<ItemsPanelTemplate>
<WrapPanel Orientation="Horizontal" />
</ItemsPanelTemplate>
</ListView.ItemsPanel>

<ListView.ItemTemplate>
<DataTemplate>
<Border
Name="ShadowElement"
Width="180"
Height="150"
Margin="10"
VerticalAlignment="Top"
BorderBrush="#00BEFA"
BorderThickness="0"
ClipToBounds="True"
CornerRadius="0">
<Border.Background>
<ImageBrush ImageSource="/BPASmartClient.CustomResource;component/Image/蓝色背景.png" Stretch="Fill" />
</Border.Background>

<Grid Margin="20,0">

<Grid.RowDefinitions>
<RowDefinition />
<RowDefinition />
<RowDefinition />
</Grid.RowDefinitions>

<TextBlock
Grid.Row="0"
Grid.ColumnSpan="2"
Margin="0,10,0,0"
VerticalAlignment="Center"
FontSize="20"
Foreground="#00BEFA"
Text="{Binding OutletName}" />

<StackPanel
Grid.Row="1"
VerticalAlignment="Center"
Orientation="Horizontal">
<TextBlock
Grid.Row="1"
FontSize="14"
Foreground="#aa00BEFA"
Text="出料口位置:" />
<TextBlock
Grid.Row="1"
FontSize="14"
Foreground="#aa00BEFA"
Text="{Binding OutletLoc}" />
</StackPanel>

<Grid Height="30" Margin="0 0 0 10" Name="gr" Grid.Row="2">
<Grid.ColumnDefinitions>
<ColumnDefinition />
<ColumnDefinition />
</Grid.ColumnDefinitions>

<pry:IcoButton
Width="{Binding ElementName=gr, Path=ActualWidth}"
Height="{Binding ElementName=gr, Path=ActualHeight}"
Margin="4,4,3,0"
HorizontalAlignment="Center"
VerticalAlignment="Center"
Background="#11F53F62"
BorderThickness="0"
Command="{Binding DataContext.RemoveCommand, RelativeSource={RelativeSource AncestorType=ListBox, Mode=FindAncestor}}"
CommandParameter="{Binding OutletName}"
Content="删除"
EnterBackground="#22F53F62"
FontStyle="Normal"
Foreground="#FFF53F62"
IcoText="&#xe68e;"
Style="{StaticResource IcoButtonStyle}" />

<pry:IcoButton
Grid.Column="1"
Width="{Binding ElementName=gr, Path=ActualWidth}"
Height="{Binding ElementName=gr, Path=ActualHeight}"
Margin="3,4,4,0"
HorizontalAlignment="Center"
VerticalAlignment="Center"
Background="#112AB2E7"
BorderThickness="0"
Command="{Binding DataContext.DetailsCommand, RelativeSource={RelativeSource AncestorType=ListBox, Mode=FindAncestor}}"
CommandParameter="{Binding OutletName}"
Content="编辑"
EnterBackground="#222AB2E7"
Foreground="#FF2AB2E7"
IcoText="&#xe636;"
Style="{StaticResource IcoButtonStyle}" />

</Grid>


<!--<Button
Grid.Row="1"
Grid.Column="0"
Grid.ColumnSpan="2"
Foreground="#00BEFA"
Width="130"
Height="30"
Margin="0,0,0,10"
HorizontalAlignment="Left"
VerticalAlignment="Bottom"
Command="{Binding DataContext.ChangeNameCommand, RelativeSource={RelativeSource AncestorType=ListView, Mode=FindAncestor}}"
CommandParameter="{Binding IpAddress}"
Content="修改原料名称"
IsEnabled="{Binding IsEnable}">
<Button.Background>
<ImageBrush ImageSource="/BPASmartClient.CustomResource;component/Image/系统名称.png" />
</Button.Background>
</Button>-->


</Grid>
</Border>

</DataTemplate>
</ListView.ItemTemplate>
</ListView>
</Grid>


</Grid>
</UserControl>

+ 638
- 0
BPASmartClient.SmallBatchingSystem/Views/RecipeControlView.xaml Parādīt failu

@@ -0,0 +1,638 @@
<UserControl
x:Class="BPASmartClient.SmallBatchingSystem.Views.RecipeControlView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:BPASmartClient.SmallBatchingSystem.Views"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:pry="clr-namespace:BPASmartClient.CustomResource.UserControls;assembly=BPASmartClient.CustomResource"
xmlns:vm="clr-namespace:BPASmartClient.SmallBatchingSystem.ViewModels"
d:DesignHeight="450"
d:DesignWidth="800"
mc:Ignorable="d">


<UserControl.DataContext>
<vm:RecipeControlViewModel />
</UserControl.DataContext>

<UserControl.Resources>

<!--<con:RunStatusConvert x:Key="RunStatusConvert" />
<con:EnbleConvert x:Key="EnbleConvert" />
<con:IntToSourceConvert x:Key="IntToSourceConvert" />-->

<Style x:Key="UserItemContainerStyle" TargetType="ListBoxItem">
<Style.Resources>
<!-- SelectedItem with focus -->
<SolidColorBrush
x:Key="{x:Static SystemColors.HighlightBrushKey}"
Opacity=".4"
Color="White" />
<!-- SelectedItem without focus -->
<SolidColorBrush
x:Key="{x:Static SystemColors.ControlBrushKey}"
Opacity=".4"
Color="White" />
</Style.Resources>
<!-- 设置触发器 -->
<Style.Triggers>
<Trigger Property="IsMouseOver" Value="true">
<Setter Property="Background" Value="White" />
<Setter Property="Foreground" Value="White" />
</Trigger>
<Trigger Property="IsFocused" Value="true">
<Setter Property="Background" Value="White" />
<Setter Property="Foreground" Value="White" />
</Trigger>
</Style.Triggers>
</Style>

<Style x:Key="RadioState" TargetType="RadioButton">
<Setter Property="Margin" Value="1" />
<Setter Property="Background" Value="Transparent" />
<Setter Property="Foreground" Value="#ddd" />
<Setter Property="VerticalContentAlignment" Value="Bottom" />
<Setter Property="Margin" Value="2,5" />
<Setter Property="FontSize" Value="16" />
<Setter Property="FontFamily" Value="Consolas" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="RadioButton">
<Border
Name="radiobutton"
Background="{TemplateBinding Background}"
CornerRadius="5"
Opacity="0.85">
<Grid>
<ContentPresenter
HorizontalAlignment="Center"
VerticalAlignment="Center"
Content="{TemplateBinding Content}"
TextBlock.FontFamily="{TemplateBinding FontFamily}"
TextBlock.FontSize="{TemplateBinding FontSize}"
TextBlock.Foreground="{TemplateBinding Foreground}" />

<Image
Name="im"
Source="/BPASmartClient.CustomResource;component/Image/按钮/组 8.png"
Stretch="Fill" />
</Grid>
</Border>

<ControlTemplate.Triggers>
<Trigger Property="IsChecked" Value="True">
<!--<Setter TargetName="back_border" Property="BorderThickness" Value="1,0,1,1" />
<Setter TargetName="back_border" Property="CornerRadius" Value="5" />
<Setter TargetName="fore_border" Property="BorderThickness" Value="0,2,0,0" />
<Setter Property="Background" Value=" #4169E1" />-->
<Setter TargetName="im" Property="Source" Value="/BPASmartClient.CustomResource;component/Image/按钮/组 7.png" />

</Trigger>

<Trigger Property="IsChecked" Value="False">
<Setter TargetName="im" Property="Source" Value="/BPASmartClient.CustomResource;component/Image/按钮/组 8.png" />
</Trigger>

<Trigger Property="IsMouseOver" Value="True">
<!--<Setter TargetName="back_border" Property="BorderBrush" Value="white" />
<Setter TargetName="back_border" Property="BorderThickness" Value="1,1,1,1" />-->
<Setter TargetName="radiobutton" Property="Opacity" Value="1" />
<!--<Setter TargetName="im" Property="Source" Value="/BPASmartClient.CustomResource;component/Image/按钮背景蓝色.png" />-->
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>

</Setter.Value>

</Setter>

</Style>
<Style x:Key="materialMakingButton" TargetType="Button">
<Setter Property="Background" Value="Transparent" />
<Setter Property="FontSize" Value="16" />
<Setter Property="Foreground" Value="#CD5555" />
<Setter Property="BorderThickness" Value="0" />
<Setter Property="HorizontalAlignment" Value="Left" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate>
<Border
x:Name="brState"
Padding="2"
BorderBrush="White"
BorderThickness="0">
<TextBlock
x:Name="txState"
Margin="1"
HorizontalAlignment="Center"
VerticalAlignment="Center"
Text="{Binding RecipeStatus, Converter={StaticResource RunStatusConvert}}" />
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsEnabled" Value="True">
<Setter TargetName="brState" Property="BorderThickness" Value="0" />
<Setter TargetName="brState" Property="CornerRadius" Value="5" />
<Setter TargetName="brState" Property="Background" Value="#F0FFFF" />
<Setter TargetName="txState" Property="Foreground" Value="#CD5555" />
</Trigger>
<DataTrigger Binding="{Binding RecipeStatus}" Value="3">
<Setter TargetName="brState" Property="Background" Value="#F0FFFF" />
<Setter TargetName="txState" Property="Foreground" Value="#3CB371" />
</DataTrigger>
<DataTrigger Binding="{Binding RecipeStatus}" Value="2">
<Setter TargetName="txState" Property="Foreground" Value="Aqua" />
</DataTrigger>
<MultiTrigger>
<MultiTrigger.Conditions>
<Condition Property="IsMouseOver" Value="True" />
<Condition Property="IsEnabled" Value="True" />
</MultiTrigger.Conditions>
<Setter TargetName="txState" Property="FontSize" Value="17 " />
</MultiTrigger>
</ControlTemplate.Triggers>
</ControlTemplate>

</Setter.Value>
</Setter>
<Style.Triggers />

</Style>

<DataTemplate x:Key="TreeItemTemplate" DataType="TreeViewItem">
<Grid Height="28" Margin="50,0,0,0">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<TextBlock
Margin="10,0"
HorizontalAlignment="Left"
VerticalAlignment="Center"
FontSize="15"
Foreground="#aa2AB2E7"
Text="原料:" />
<TextBlock
Grid.Column="1"
Margin="10,0"
HorizontalAlignment="Left"
VerticalAlignment="Center"
FontSize="15"
Foreground="#aa2AB2E7"
Text="{Binding RawMaterialName}" />
</Grid>
</DataTemplate>

<Style x:Key="recipeTreeItem" TargetType="TreeViewItem">
<Setter Property="Background" Value="Transparent" />
<Setter Property="BorderThickness" Value="0" />
<Setter Property="IsExpanded" Value="True" />
<Setter Property="HeaderTemplate">
<Setter.Value>
<HierarchicalDataTemplate ItemTemplate="{StaticResource TreeItemTemplate}" ItemsSource="{Binding RawMaterials, Mode=TwoWay}">
<StackPanel
Height="28"
HorizontalAlignment="Left"
VerticalAlignment="Center"
Orientation="Horizontal">
<TextBlock
Margin="5,0,0,0"
VerticalAlignment="Center"
FontSize="15"
Foreground="#FF2AB2E7"
Text="配方:" />
<TextBlock
Margin="5,0,0,0"
VerticalAlignment="Center"
FontSize="15"
Foreground="#FF2AB2E7"
Text="{Binding RecipeName}" />
</StackPanel>
</HierarchicalDataTemplate>
</Setter.Value>
</Setter>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type TreeViewItem}">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition />
</Grid.RowDefinitions>
<Border
x:Name="Bd"
Grid.Column="0"
Padding="{TemplateBinding Padding}"
Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}">
<ContentPresenter
x:Name="PART_Header"
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
ContentSource="Header" />
</Border>
<ItemsPresenter
x:Name="ItemsHost"
Grid.Row="1"
Grid.Column="0"
Grid.ColumnSpan="2"
Visibility="Collapsed" />
<VisualStateManager.VisualStateGroups>
<VisualStateGroup x:Name="SelectionStates">
<VisualState x:Name="Selected">
<Storyboard>
<ColorAnimationUsingKeyFrames Storyboard.TargetName="Bd" Storyboard.TargetProperty="(Panel.Background).(SolidColorBrush.Color)">
<EasingColorKeyFrame KeyTime="0" Value="Transparent" />
</ColorAnimationUsingKeyFrames>
</Storyboard>
</VisualState>

<VisualState x:Name="Unselected" />
<VisualState x:Name="SelectedInactive">
<Storyboard>
<ColorAnimationUsingKeyFrames Storyboard.TargetName="Bd" Storyboard.TargetProperty="(Panel.Background).(SolidColorBrush.Color)">
<EasingColorKeyFrame KeyTime="0" Value="Transparent" />
</ColorAnimationUsingKeyFrames>
</Storyboard>
</VisualState>
</VisualStateGroup>
<VisualStateGroup x:Name="ExpansionStates">
<VisualState x:Name="Expanded">
<Storyboard>
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="ItemsHost" Storyboard.TargetProperty="(UIElement.Visibility)">
<DiscreteObjectKeyFrame KeyTime="0" Value="{x:Static Visibility.Visible}" />
</ObjectAnimationUsingKeyFrames>
</Storyboard>
</VisualState>
<VisualState x:Name="Collapsed" />
</VisualStateGroup>
</VisualStateManager.VisualStateGroups>
</Grid>
<ControlTemplate.Triggers>
<MultiTrigger>
<MultiTrigger.Conditions>
<Condition Property="HasHeader" Value="false" />
<Condition Property="Width" Value="Auto" />
</MultiTrigger.Conditions>
<Setter TargetName="PART_Header" Property="MinWidth" Value="75" />
</MultiTrigger>
<MultiTrigger>
<MultiTrigger.Conditions>
<Condition Property="HasHeader" Value="false" />
<Condition Property="Height" Value="Auto" />
</MultiTrigger.Conditions>
<Setter TargetName="PART_Header" Property="MinHeight" Value="19" />
</MultiTrigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>

</UserControl.Resources>

<Grid Margin="20">

<Grid.ColumnDefinitions>
<ColumnDefinition />
<ColumnDefinition Width="0.25*" />
</Grid.ColumnDefinitions>

<Grid Name="ggr" Margin="10">

<pry:ImageBorder Width="{Binding ElementName=ggr, Path=ActualWidth}" Height="{Binding ElementName=ggr, Path=ActualHeight}" />

<ListBox
Margin="5"
VerticalAlignment="Top"
Background="Transparent"
BorderThickness="0"
ItemsSource="{Binding Recipes}"
ScrollViewer.HorizontalScrollBarVisibility="Disabled">
<ListBox.ItemsPanel>
<ItemsPanelTemplate>
<UniformGrid
HorizontalAlignment="Left"
VerticalAlignment="Top"
Columns="6" />
</ItemsPanelTemplate>
</ListBox.ItemsPanel>

<ListBox.ItemTemplate>
<DataTemplate>

<Grid
Name="tt"
Height="220"
Margin="5">
<Grid.RowDefinitions>
<RowDefinition Height="30" />
<RowDefinition Height="20" />
<RowDefinition Height="128" />
<RowDefinition Height="2" />
<RowDefinition Height="40" />
</Grid.RowDefinitions>

<Image
Grid.RowSpan="5"
Source="/BPASmartClient.CustomResource;component/Image/配方背景/竖背景框.png"
Stretch="Fill" />

<TextBlock
Grid.Row="0"
Margin="2,5,0,0"
HorizontalAlignment="Center"
VerticalAlignment="Top"
FontSize="18"
Foreground="#FF2AB2E7"
Text="{Binding RecipeName}" />

<TextBlock
Grid.Row="1"
Margin="5,0,0,0"
VerticalAlignment="Top"
Foreground="#FF2AB2E7"
Text="配方信息:" />

<ScrollViewer
Grid.Row="2"
VerticalAlignment="Top"
Background="Transparent"
HorizontalScrollBarVisibility="Hidden"
VerticalScrollBarVisibility="Hidden">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="auto" />
<ColumnDefinition />
</Grid.ColumnDefinitions>

<ItemsControl ItemsSource="{Binding SiloInfoModels}">
<ItemsControl.ItemTemplate>
<DataTemplate>
<Grid Width="150">
<Grid.ColumnDefinitions>
<ColumnDefinition />
<ColumnDefinition Width="0.1*" />
<ColumnDefinition />
</Grid.ColumnDefinitions>

<TextBlock
Margin="5,0,0,0"
HorizontalAlignment="Right"
VerticalAlignment="Center"
Foreground="#aa2AB2E7"
Text="{Binding SiloName}" />

<TextBlock
Grid.Column="1"
Margin="1,0,0,0"
HorizontalAlignment="Center"
VerticalAlignment="Center"
Foreground="#aa2AB2E7"
Text=":" />

<TextBlock
Grid.Column="2"
Margin="5,0,0,0"
HorizontalAlignment="Left"
VerticalAlignment="Center"
Foreground="#aa2AB2E7"
Text="{Binding SiloWeight}" />
</Grid>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
</Grid>
</ScrollViewer>

<!--<Grid
Grid.Row="3"
Height="2"
VerticalAlignment="Bottom">
<Grid.Background>
<ImageBrush ImageSource="/BPASmartClient.CustomResource;component/Image/直线.png" Stretch="Fill" />
</Grid.Background>
</Grid>-->

<Image
Grid.Row="3"
Width="{Binding ElementName=tt, Path=ActualWidth}"
Height="2"
VerticalAlignment="Bottom"
Source="/BPASmartClient.CustomResource;component/Image/直线.png"
Stretch="Fill" />

<Grid
Name="gr"
Grid.Row="4"
Height="30"
Margin="0,0,0,10"
VerticalAlignment="Bottom"
Background="Transparent">
<!--<Grid.ColumnDefinitions>
<ColumnDefinition />
<ColumnDefinition />
</Grid.ColumnDefinitions>-->

<!--<Image
Height="2"
Grid.ColumnSpan="2"
Width="{Binding ElementName=gr, Path=ActualWidth}"
VerticalAlignment="Top"
Source="/BPASmartClient.CustomResource;component/Image/直线.png" />-->

<pry:IcoButton
Width="{Binding ElementName=gr, Path=ActualWidth}"
Height="{Binding ElementName=gr, Path=ActualHeight}"
Margin="4,4,4,0"
HorizontalAlignment="Center"
VerticalAlignment="Center"
Background="#222bd06f"
BorderThickness="0"
Command="{Binding DataContext.StartCommand, RelativeSource={RelativeSource AncestorType=ListBox, Mode=FindAncestor}}"
CommandParameter="{Binding RecipeName}"
Content="配方下发"
EnterBackground="#332bd06f"
FontStyle="Normal"
Foreground="#ff2bd06f"
IcoText="&#xe6cf;"
IsEnabled="{Binding IsEnable}"
Style="{StaticResource IcoButtonStyle}" />

<!--<pry:IcoButton
Width="{Binding ElementName=gr, Path=ActualWidth}"
Height="{Binding ElementName=gr, Path=ActualHeight}"
Margin="4,4,3,0"
HorizontalAlignment="Center"
VerticalAlignment="Center"
Background="#11F53F62"
BorderThickness="0"
Command="{Binding DataContext.RemoveCommand, RelativeSource={RelativeSource AncestorType=ListBox, Mode=FindAncestor}}"
CommandParameter="{Binding RecipCode}"
Content="删除"
EnterBackground="#22F53F62"
FontStyle="Normal"
Foreground="#FFF53F62"
IcoText="&#xe68e;"
Style="{StaticResource IcoButtonStyle}" />

<pry:IcoButton
Grid.Column="1"
Width="{Binding ElementName=gr, Path=ActualWidth}"
Height="{Binding ElementName=gr, Path=ActualHeight}"
Margin="3,4,4,0"
HorizontalAlignment="Center"
VerticalAlignment="Center"
Background="#112AB2E7"
BorderThickness="0"
Command="{Binding DataContext.DetailsCommand, RelativeSource={RelativeSource AncestorType=ListBox, Mode=FindAncestor}}"
CommandParameter="{Binding RecipCode}"
Content="编辑"
EnterBackground="#222AB2E7"
Foreground="#FF2AB2E7"
IcoText="&#xe636;"
Style="{StaticResource IcoButtonStyle}" />-->

</Grid>
<!--</StackPanel>-->
</Grid>

<!--<Grid Name="tt" Margin="5">
<Grid.RowDefinitions>
<RowDefinition Height="auto" />
<RowDefinition Height="auto" />
<RowDefinition />
<RowDefinition />
</Grid.RowDefinitions>

<Image
Grid.RowSpan="4"
Source="/BPASmartClient.CustomResource;component/Image/配方背景/竖背景框.png"
Stretch="Fill" />

<TextBlock
Grid.Row="0"
Margin="2,5,0,0"
HorizontalAlignment="Center"
VerticalAlignment="Top"
FontSize="18"
Foreground="#FF2AB2E7"
Text="{Binding RecipeName}" />


<TextBlock
Grid.Row="1"
Margin="5,0,0,5"
Foreground="#ffc000"
Text="配方信息:" />

<ScrollViewer
Grid.Row="2"
HorizontalScrollBarVisibility="Hidden"
VerticalScrollBarVisibility="Hidden">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="auto" />
<ColumnDefinition />
</Grid.ColumnDefinitions>

<ItemsControl ItemsSource="{Binding RawMaterials}">
<ItemsControl.ItemTemplate>
<DataTemplate>
<Grid>
<TextBlock
Grid.Row="1"
Margin="5,0,0,0"
HorizontalAlignment="Right"
VerticalAlignment="Center"
Foreground="#aaffc000"
Text="{Binding RawMaterialName}" />
</Grid>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>

<ItemsControl Grid.Column="1" ItemsSource="{Binding RawMaterials}">
<ItemsControl.ItemTemplate>
<DataTemplate>
<StackPanel Orientation="Horizontal">

<TextBlock
Margin="5,0,0,0"
HorizontalAlignment="Center"
VerticalAlignment="Center"
Foreground="#aaffc000"
Text=":" />

<TextBlock
Margin="5,0,0,0"
HorizontalAlignment="Center"
VerticalAlignment="Center"
Foreground="#aaffc000"
Text="{Binding RawMaterialWeight}" />

<TextBlock
Margin="5,0,0,0"
HorizontalAlignment="Center"
VerticalAlignment="Center"
Foreground="#aaffc000"
Text="g" />

</StackPanel>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>

</Grid>

</ScrollViewer>



<Grid
Name="grb"
Grid.Row="3"
Height="30"
Margin="0,0,0,10"
VerticalAlignment="Bottom"
Background="Transparent">

<Image
Width="{Binding ElementName=grb, Path=ActualWidth}"
VerticalAlignment="Top"
StretchDirection="Both"
Source="/BPASmartClient.CustomResource;component/Image/直线.png" />

<pry:IcoButton
Width="{Binding ElementName=grb, Path=ActualWidth}"
Height="{Binding ElementName=grb, Path=ActualHeight}"
Margin="4,4,4,0"
HorizontalAlignment="Center"
VerticalAlignment="Center"
Background="#222bd06f"
BorderThickness="0"
Command="{Binding DataContext.StartCommand, RelativeSource={RelativeSource AncestorType=ListBox, Mode=FindAncestor}}"
CommandParameter="{Binding RecipeName}"
Content="配方下发"
EnterBackground="#332bd06f"
FontStyle="Normal"
Foreground="#ff2bd06f"
IcoText="&#xe6cf;"
IsEnabled="{Binding IsEnable}"
Style="{StaticResource IcoButtonStyle}" />


</Grid>

</Grid>-->
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>

</Grid>
</Grid>
</UserControl>

+ 28
- 0
BPASmartClient.SmallBatchingSystem/Views/RecipeControlView.xaml.cs Parādīt failu

@@ -0,0 +1,28 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace BPASmartClient.SmallBatchingSystem.Views
{
/// <summary>
/// RecipeControlView.xaml 的交互逻辑
/// </summary>
public partial class RecipeControlView : UserControl
{
public RecipeControlView()
{
InitializeComponent();
}
}
}

+ 359
- 0
BPASmartClient.SmallBatchingSystem/Views/RecipeView.xaml Parādīt failu

@@ -0,0 +1,359 @@
<UserControl
x:Class="BPASmartClient.SmallBatchingSystem.Views.RecipeView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:con="clr-namespace:BPASmartClient.SmallBatchingSystem.Converter"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:BPASmartClient.SmallBatchingSystem.Views"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:pry="clr-namespace:BPASmartClient.CustomResource.UserControls;assembly=BPASmartClient.CustomResource"
xmlns:vm="clr-namespace:BPASmartClient.SmallBatchingSystem.ViewModels"
d:DesignHeight="450"
d:DesignWidth="800"
mc:Ignorable="d">

<UserControl.DataContext>
<vm:RecipeViewModel />
</UserControl.DataContext>

<UserControl.Resources>
<SolidColorBrush x:Key="tabColor" Color="#FF2AB2E7" />
<!--<SolidColorBrush x:Key="bordColor" Color="#33ffffff" />-->
<SolidColorBrush x:Key="bordColor" Color="#332AB2E7" />
<con:DataTableRedundantConverter x:Key="tabConvert" />

<Style x:Key="UserItemContainerStyle" TargetType="ListBoxItem">
<Style.Resources>
<!-- SelectedItem with focus -->
<SolidColorBrush
x:Key="{x:Static SystemColors.HighlightBrushKey}"
Opacity=".4"
Color="White" />
<!-- SelectedItem without focus -->
<SolidColorBrush
x:Key="{x:Static SystemColors.ControlBrushKey}"
Opacity=".4"
Color="White" />
</Style.Resources>
<!-- 设置触发器 -->
<Style.Triggers>
<Trigger Property="IsMouseOver" Value="true">
<Setter Property="Background" Value="White" />
<Setter Property="Foreground" Value="White" />
</Trigger>
<Trigger Property="IsFocused" Value="true">
<Setter Property="Background" Value="White" />
<Setter Property="Foreground" Value="White" />
</Trigger>
</Style.Triggers>
</Style>

<Style x:Key="RowRadioButtonStyle" TargetType="{x:Type RadioButton}">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type RadioButton}">
<Border
x:Name="NvaBor"
Background="Transparent"
BorderBrush="#FF2AB2E7"
BorderThickness="0">
<ContentControl
Margin="10,4"
HorizontalAlignment="Center"
VerticalAlignment="Center"
HorizontalContentAlignment="Center"
VerticalContentAlignment="Center"
Content="{TemplateBinding Content}"
FontSize="16" />
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsChecked" Value="True">
<Setter TargetName="NvaBor" Property="Background" Value="#22ffffff" />
<Setter TargetName="NvaBor" Property="BorderThickness" Value="0" />
</Trigger>
<MultiTrigger>
<MultiTrigger.Conditions>
<Condition Property="IsChecked" Value="false" />
<Condition Property="IsMouseOver" Value="True" />
</MultiTrigger.Conditions>
<MultiTrigger.Setters>
<Setter TargetName="NvaBor" Property="Background" Value="#22ffffff" />
</MultiTrigger.Setters>
</MultiTrigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>

<Style x:Key="InputTextboxStyle" TargetType="TextBox">
<Setter Property="Margin" Value="5,0,0,0" />
<Setter Property="BorderThickness" Value="0" />
<Setter Property="HorizontalAlignment" Value="Left" />
<Setter Property="Width" Value="150" />
<Setter Property="Height" Value="40" />
<Setter Property="CaretBrush" Value="{StaticResource TitleBorderColor}" />
<Setter Property="Foreground" Value="{StaticResource TitleBorderColor}" />
<Setter Property="VerticalContentAlignment" Value="Center" />
<Setter Property="FontSize" Value="14" />
<Setter Property="Background" Value="Transparent" />
<Setter Property="VerticalAlignment" Value="Center" />
</Style>

<Style x:Key="ControlButtonStyle" TargetType="Button">
<Setter Property="Margin" Value="0" />
<Setter Property="FontSize" Value="18" />
<Setter Property="Foreground" Value="#FFF53F62" />
<Setter Property="FontWeight" Value="SemiBold" />
<Setter Property="FontFamily" Value="楷体" />
<Setter Property="VerticalContentAlignment" Value="Center" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="Button">
<Border
Name="TitleBarBr"
BorderBrush="#00c2f4"
BorderThickness="0"
CornerRadius="0"
Opacity="0.8">

<ContentPresenter
Margin="{TemplateBinding Margin}"
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
VerticalAlignment="{TemplateBinding VerticalContentAlignment}" />
<Border.Background>
<ImageBrush
ImageSource="/BPASmartClient.CustomResource;component/Image/组合边框1.1.png"
Opacity="0.8"
Stretch="Fill" />
</Border.Background>

</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="true">
<Setter TargetName="TitleBarBr" Property="Opacity" Value="1" />
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>

<Style x:Key="TitleTextblockStyle" TargetType="TextBlock">
<Setter Property="FontSize" Value="16" />
<Setter Property="HorizontalAlignment" Value="Center" />
<Setter Property="VerticalAlignment" Value="Center" />
<Setter Property="Foreground" Value="{StaticResource tabColor}" />
<Setter Property="FontFamily" Value="楷体" />
<Setter Property="FontWeight" Value="SemiBold" />
</Style>

</UserControl.Resources>

<Grid Margin="10">
<Grid.RowDefinitions>
<RowDefinition Height="40" />
<RowDefinition />
</Grid.RowDefinitions>

<StackPanel HorizontalAlignment="Right" Orientation="Horizontal">
<Button
Width="150"
Height="40"
Margin="10,0,10,0"
Command="{Binding NewRecipeCommand}"
Content="新建配方"
FontSize="20"
Style="{StaticResource ImageButtonStyle}" />
<Button
Width="150"
Height="40"
Margin="10,0,10,0"
Command="{Binding SaveCommand}"
Content="保存配方"
FontSize="20"
Style="{StaticResource ImageButtonStyle}" />
</StackPanel>

<Grid Grid.Row="1">

<ListBox
Grid.Row="2"
Margin="5"
VerticalAlignment="Top"
Background="Transparent"
BorderThickness="0"
ItemsSource="{Binding RecipeInfoModels}"
ScrollViewer.HorizontalScrollBarVisibility="Disabled">
<ListBox.ItemsPanel>
<ItemsPanelTemplate>
<UniformGrid
HorizontalAlignment="Left"
VerticalAlignment="Top"
Columns="8" />
</ItemsPanelTemplate>
</ListBox.ItemsPanel>

<ListBox.ItemTemplate>
<DataTemplate>

<Grid
Name="tt"
Height="220"
Margin="5">
<Grid.RowDefinitions>
<RowDefinition Height="30" />
<RowDefinition Height="20" />
<RowDefinition Height="128" />
<RowDefinition Height="2" />
<RowDefinition Height="40" />
</Grid.RowDefinitions>

<Image
Grid.RowSpan="5"
Source="/BPASmartClient.CustomResource;component/Image/配方背景/竖背景框.png"
Stretch="Fill" />

<TextBlock
Grid.Row="0"
Margin="2,5,0,0"
HorizontalAlignment="Center"
VerticalAlignment="Top"
FontSize="18"
Foreground="#FF2AB2E7"
Text="{Binding RecipeName}" />

<TextBlock
Grid.Row="1"
Margin="5,0,0,0"
VerticalAlignment="Top"
Foreground="#FF2AB2E7"
Text="配方信息:" />

<ScrollViewer
Grid.Row="2"
VerticalAlignment="Top"
Background="Transparent"
HorizontalScrollBarVisibility="Hidden"
VerticalScrollBarVisibility="Hidden">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="auto" />
<ColumnDefinition />
</Grid.ColumnDefinitions>

<ItemsControl ItemsSource="{Binding SiloInfoModels}">
<ItemsControl.ItemTemplate>
<DataTemplate>
<Grid Width="150">
<Grid.ColumnDefinitions>
<ColumnDefinition />
<ColumnDefinition Width="0.1*" />
<ColumnDefinition />
</Grid.ColumnDefinitions>

<TextBlock
Margin="5,0,0,0"
HorizontalAlignment="Right"
VerticalAlignment="Center"
Foreground="#aa2AB2E7"
Text="{Binding SiloName}" />

<TextBlock
Grid.Column="1"
Margin="1,0,0,0"
HorizontalAlignment="Center"
VerticalAlignment="Center"
Foreground="#aa2AB2E7"
Text=":" />

<TextBlock
Grid.Column="2"
Margin="5,0,0,0"
HorizontalAlignment="Left"
VerticalAlignment="Center"
Foreground="#aa2AB2E7"
Text="{Binding SiloWeight}" />
</Grid>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
</Grid>
</ScrollViewer>

<Image
Grid.Row="3"
Width="{Binding ElementName=tt, Path=ActualWidth}"
Height="2"
VerticalAlignment="Bottom"
Source="/BPASmartClient.CustomResource;component/Image/直线.png"
Stretch="Fill" />

<Grid
Name="gr"
Grid.Row="4"
Height="30"
Margin="0,0,0,10"
VerticalAlignment="Bottom"
Background="Transparent">
<Grid.ColumnDefinitions>
<ColumnDefinition />
<ColumnDefinition />
</Grid.ColumnDefinitions>

<Image
Grid.ColumnSpan="2"
Width="{Binding ElementName=gr, Path=ActualWidth}"
Height="2"
VerticalAlignment="Top"
Source="/BPASmartClient.CustomResource;component/Image/直线.png" />

<pry:IcoButton
Width="{Binding ElementName=gr, Path=ActualWidth}"
Height="{Binding ElementName=gr, Path=ActualHeight}"
Margin="4,4,3,0"
HorizontalAlignment="Center"
VerticalAlignment="Center"
Background="#11F53F62"
BorderThickness="0"
Command="{Binding DataContext.RemoveCommand, RelativeSource={RelativeSource AncestorType=ListBox, Mode=FindAncestor}}"
CommandParameter="{Binding RecipeName}"
Content="删除"
EnterBackground="#22F53F62"
FontStyle="Normal"
Foreground="#FFF53F62"
IcoText="&#xe68e;"
Style="{StaticResource IcoButtonStyle}" />

<pry:IcoButton
Grid.Column="1"
Width="{Binding ElementName=gr, Path=ActualWidth}"
Height="{Binding ElementName=gr, Path=ActualHeight}"
Margin="3,4,4,0"
HorizontalAlignment="Center"
VerticalAlignment="Center"
Background="#112AB2E7"
BorderThickness="0"
Command="{Binding DataContext.DetailsCommand, RelativeSource={RelativeSource AncestorType=ListBox, Mode=FindAncestor}}"
CommandParameter="{Binding RecipeName}"
Content="编辑"
EnterBackground="#222AB2E7"
Foreground="#FF2AB2E7"
IcoText="&#xe636;"
Style="{StaticResource IcoButtonStyle}" />

</Grid>
<!--</StackPanel>-->
</Grid>

</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>


</Grid>


</Grid>

</UserControl>

+ 28
- 0
BPASmartClient.SmallBatchingSystem/Views/RecipeView.xaml.cs Parādīt failu

@@ -0,0 +1,28 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace BPASmartClient.SmallBatchingSystem.Views
{
/// <summary>
/// PfView.xaml 的交互逻辑
/// </summary>
public partial class RecipeView : UserControl
{
public RecipeView()
{
InitializeComponent();
}
}
}

+ 6
- 26
BPASmartClient.SmallBatchingSystem/Views/SiloManagementView.xaml Parādīt failu

@@ -160,7 +160,7 @@
Width="150"
Height="40"
Margin="10,0,10,0"
Command="{Binding AddCommand}"
Command="{Binding AddSilo}"
Content="添加料仓"
FontSize="20"
Style="{StaticResource ImageButtonStyle}" />
@@ -168,7 +168,7 @@
Width="150"
Height="40"
Margin="10,0,10,0"
Command="{Binding SaveCommand}"
Command="{Binding SaveData}"
Content="保存参数"
FontSize="20"
Style="{StaticResource ImageButtonStyle}" />
@@ -180,7 +180,7 @@
Background="Transparent"
BorderBrush="#00BEFA"
BorderThickness="0"
ItemsSource="{Binding devices}"
ItemsSource="{Binding SiloInfoModels}"
ScrollViewer.HorizontalScrollBarVisibility="Disabled">
<ListView.ItemsPanel>
<ItemsPanelTemplate>
@@ -219,7 +219,7 @@
VerticalAlignment="Center"
FontSize="20"
Foreground="#00BEFA"
Text="{Binding DeviceName}" />
Text="{Binding SiloName}" />

<StackPanel
Grid.Row="1"
@@ -229,12 +229,12 @@
Grid.Row="1"
FontSize="14"
Foreground="#aa00BEFA"
Text="设备IP:" />
Text="料仓位置:" />
<TextBlock
Grid.Row="1"
FontSize="14"
Foreground="#aa00BEFA"
Text="{Binding IpAddress}" />
Text="{Binding SiloLoc}" />
</StackPanel>

<Button
@@ -250,26 +250,6 @@
IsEnabled="{Binding IsEnable}"
Style="{StaticResource ImageButtonStyle}" />

<!--<Button
Grid.Row="1"
Grid.Column="0"
Grid.ColumnSpan="2"
Foreground="#00BEFA"
Width="130"
Height="30"
Margin="0,0,0,10"
HorizontalAlignment="Left"
VerticalAlignment="Bottom"
Command="{Binding DataContext.ChangeNameCommand, RelativeSource={RelativeSource AncestorType=ListView, Mode=FindAncestor}}"
CommandParameter="{Binding IpAddress}"
Content="修改原料名称"
IsEnabled="{Binding IsEnable}">
<Button.Background>
<ImageBrush ImageSource="/BPASmartClient.CustomResource;component/Image/系统名称.png" />
</Button.Background>
</Button>-->


</Grid>
</Border>



+ 1
- 1
DosingSystem/View/RecipeSettingsView.xaml Parādīt failu

@@ -237,9 +237,9 @@
</Grid.ColumnDefinitions>

<Image
Height="2"
Grid.ColumnSpan="2"
Width="{Binding ElementName=gr, Path=ActualWidth}"
Height="2"
VerticalAlignment="Top"
Source="/BPASmartClient.CustomResource;component/Image/直线.png" />



Notiek ielāde…
Atcelt
Saglabāt