Browse Source

180更新

样式分支
taoye 1 year ago
parent
commit
4cd7e914bb
23 changed files with 2125 additions and 577 deletions
  1. +7
    -3
      BPASmartClient.Helper/TTrig.cs
  2. +1
    -0
      BPASmartClient.Modbus/ModbusTcp.cs
  3. +3
    -2
      FryPot_DosingSystem/App.xaml.cs
  4. +17
    -22
      FryPot_DosingSystem/Control/DeviceOperate.cs
  5. +1301
    -300
      FryPot_DosingSystem/Control/DosingLogicControl.cs
  6. +82
    -3
      FryPot_DosingSystem/Control/GlobalVariable.cs
  7. +49
    -27
      FryPot_DosingSystem/FryPotStatus/PotFiveStatus.cs
  8. +49
    -27
      FryPot_DosingSystem/FryPotStatus/PotFourStatus.cs
  9. +44
    -23
      FryPot_DosingSystem/FryPotStatus/PotOneStatus.cs
  10. +50
    -28
      FryPot_DosingSystem/FryPotStatus/PotThreeStatus.cs
  11. +46
    -24
      FryPot_DosingSystem/FryPotStatus/PotTwoStatus.cs
  12. +28
    -16
      FryPot_DosingSystem/Model/FlowProcessModel.cs
  13. +4
    -2
      FryPot_DosingSystem/Model/FlowProcessNames.cs
  14. +79
    -22
      FryPot_DosingSystem/View/FlowProcessView.xaml
  15. +91
    -3
      FryPot_DosingSystem/View/FlowProcessView.xaml.cs
  16. +47
    -0
      FryPot_DosingSystem/View/NewFryPotMaterial.xaml
  17. +37
    -0
      FryPot_DosingSystem/View/NewFryPotMaterial.xaml.cs
  18. +2
    -2
      FryPot_DosingSystem/View/NewRecipeView.xaml
  19. +88
    -50
      FryPot_DosingSystem/View/NewRecipeView.xaml.cs
  20. +18
    -10
      FryPot_DosingSystem/View/SqliteDataView.xaml
  21. +23
    -13
      FryPot_DosingSystem/ViewModel/FlowProcessSetViewModel.cs
  22. +58
    -0
      FryPot_DosingSystem/ViewModel/NewFryPotMaterialViewModel.cs
  23. +1
    -0
      FryPot_DosingSystem/ViewModel/NewRecipeViewModel.cs

+ 7
- 3
BPASmartClient.Helper/TTrig.cs View File

@@ -11,11 +11,15 @@ namespace BPASmartClient.Helper
public class TTrig
{
private volatile static ConcurrentDictionary<string, TTrig> _Instance;
private static readonly object Lock = new object();
public static TTrig GetInstance(string name)
{
if (_Instance == null) _Instance = new ConcurrentDictionary<string, TTrig>();
if (!_Instance.ContainsKey(name)) _Instance.TryAdd(name, new TTrig());
return _Instance[name];
lock (Lock)
{
if (_Instance == null) _Instance = new ConcurrentDictionary<string, TTrig>();
if (!_Instance.ContainsKey(name)) _Instance.TryAdd(name, new TTrig());
return _Instance[name];
}
}
private TTrig() { }



+ 1
- 0
BPASmartClient.Modbus/ModbusTcp.cs View File

@@ -151,6 +151,7 @@ namespace BPASmartClient.Modbus
{
try
{
//D1001
string head = (Convert.ToInt32(address.Substring(1, 1))).ToString();
int num = Convert.ToInt32(address.Substring(2, 3));
int len = num.ToString().Length;


+ 3
- 2
FryPot_DosingSystem/App.xaml.cs View File

@@ -32,6 +32,7 @@ namespace FryPot_DosingSystem
SystemHelper.GetInstance.CreateDesktopShortcut();
MenuInite();
LoginDataInite();
Json<FlowProcessNames>.Read();
MainView mv = new MainView();
LoginView lv = new LoginView();
var res = lv.ShowDialog();
@@ -48,10 +49,10 @@ namespace FryPot_DosingSystem
MessageNotify.GetInstance.ShowRunLog("下位机PLC连接失败,请检查无误后重启上位机");
}
//开启实时PLC数据读取
DosingLogicControl logigControl = DosingLogicControl.GetInstance;//开启逻辑控制任务程序
DosingLogicControl logigControl = DosingLogicControl.GetInstance;//开启逻辑控制任务程序
AlarmHelper<AlarmInfo>.Init();//报警实时监控
HubHelper.GetInstance.Connect("172.16.12.100", 8089);
}
else
mv.Close();


+ 17
- 22
FryPot_DosingSystem/Control/DeviceOperate.cs View File

@@ -54,15 +54,11 @@ namespace FryPot_DosingSystem.Control
Init();
Connect();
ReadData();
ConnectStatusMonitor();
}

private void ConnectStatusMonitor()
{


}


public void Init()
{
Variables.Clear();
@@ -181,11 +177,11 @@ namespace FryPot_DosingSystem.Control
switch (DeviceName)
{
case "滚筒输送线": modbus.ModbusTcpConnect(Ip, Convert.ToInt32(Port)); MessageNotify.GetInstance.ShowRunLog("滚筒线PLC连接成功"); break;
//case "炒锅1": fryOneModbus.ModbusTcpConnect(Ip, Convert.ToInt32(Port)); MessageLog.GetInstance.ShowRunLog("1号炒锅PLC连接成功"); break;
//case "炒锅2": fryTwoModbus.ModbusTcpConnect(Ip, Convert.ToInt32(Port)); MessageLog.GetInstance.ShowRunLog("2号炒锅PLC连接成功"); break;
//case "炒锅3": fryThreeModbus.ModbusTcpConnect(Ip, Convert.ToInt32(Port)); MessageLog.GetInstance.ShowRunLog("3号炒锅PLC连接成功"); break;
//case "炒锅4": fryFourModbus.ModbusTcpConnect(Ip, Convert.ToInt32(Port)); MessageLog.GetInstance.ShowRunLog("4号炒锅PLC连接成功"); break;
//case "炒锅5": fryFiveModbus.ModbusTcpConnect(Ip, Convert.ToInt32(Port)); MessageLog.GetInstance.ShowRunLog("5号炒锅PLC连接成功"); break;
case "炒锅1": fryOneModbus.ModbusTcpConnect(Ip, Convert.ToInt32(Port)); MessageNotify.GetInstance.ShowRunLog("1号炒锅PLC连接成功"); break;
case "炒锅2": fryTwoModbus.ModbusTcpConnect(Ip, Convert.ToInt32(Port)); MessageNotify.GetInstance.ShowRunLog("2号炒锅PLC连接成功"); break;
case "炒锅3": fryThreeModbus.ModbusTcpConnect(Ip, Convert.ToInt32(Port)); MessageNotify.GetInstance.ShowRunLog("3号炒锅PLC连接成功"); break;
case "炒锅4": fryFourModbus.ModbusTcpConnect(Ip, Convert.ToInt32(Port)); MessageNotify.GetInstance.ShowRunLog("4号炒锅PLC连接成功"); break;
case "炒锅5": fryFiveModbus.ModbusTcpConnect(Ip, Convert.ToInt32(Port)); MessageNotify.GetInstance.ShowRunLog("5号炒锅PLC连接成功"); break;
}

}
@@ -414,19 +410,18 @@ namespace FryPot_DosingSystem.Control
/// </summary>
/// <param name="address"></param>
/// <param name="value"></param>
public void WritePotOnePlcData(string address,object value )
{
public void WritePotOnePlcData(string address,ushort value )
{
fryOneModbus.Write(address,value);
}
/// <summary>
/// 炒锅2工艺数据
/// </summary>
/// <param name="address"></param>
/// <param name="value"></param>
public void WritePotTwoPlcData(string address, object value)
public void WritePotTwoPlcData(string address, ushort value)
{
fryTwoModbus.Write(address, value);

}
/// <summary>
@@ -434,9 +429,9 @@ namespace FryPot_DosingSystem.Control
/// </summary>
/// <param name="address"></param>
/// <param name="value"></param>
public void WritePotThreePlcData(string address, object value)
public void WritePotThreePlcData(string address, ushort value)
{
fryThreeModbus.Write(address, value);

}
/// <summary>
@@ -444,10 +439,10 @@ namespace FryPot_DosingSystem.Control
/// </summary>
/// <param name="address"></param>
/// <param name="value"></param>
public void WritePotFourPlcData(string address, object value)
public void WritePotFourPlcData(string address, ushort value)
{

fryFourModbus.Write(address,value);
}
/// <summary>
/// 炒锅5工艺数据
@@ -456,7 +451,7 @@ namespace FryPot_DosingSystem.Control
/// <param name="value"></param>
public void WritePotFivePlcData(string address, object value)
{
fryFiveModbus.Write(address, value);

}
public ConcurrentDictionary<string, object> GetAllData()


+ 1301
- 300
FryPot_DosingSystem/Control/DosingLogicControl.cs
File diff suppressed because it is too large
View File


+ 82
- 3
FryPot_DosingSystem/Control/GlobalVariable.cs View File

@@ -158,7 +158,7 @@ namespace FryPot_DosingSystem.Control
#endregion
#region AGV视图显示变量
public int LOneMaterialNum { get; set; } = 0;
public int LOneFryPotSerial { get; set; } = 1;
public int LOneFryPotSerial { get; set; } = 0;
public int LOneCurrentCookingStep { get; set; } = 0;
public bool agvArriveUpLoad { get; set; }
public bool agvArriveUnLoad { get; set; }
@@ -167,7 +167,7 @@ namespace FryPot_DosingSystem.Control
public bool agvLineOneLoadCom { get; set; }//线体1上料完成

public int LTwoMaterialNum { get; set; } = 0;
public int LTwoFryPotSerial { get; set; } = 2;
public int LTwoFryPotSerial { get; set; } =0;
public int LTwoCurrentCookingStep { get; set; } = 0;
public bool agvArriveLTwoUpLoad { get; set; }
public bool LTwoagvArriveUnLoad { get; set; }
@@ -175,7 +175,7 @@ namespace FryPot_DosingSystem.Control
public bool agvLineTwoLoadCom { get; set; }//线体2上料完成

public int LThreeMaterialNum { get; set; } = 0;
public int LThreeFryPotSerial { get; set; } = 3;
public int LThreeFryPotSerial { get; set; } = 0;
public int LThreeCurrentCookingStep { get; set; } = 0;
public bool agvArriveLThreeUpLoad { get; set; }
public bool LThreeagvArriveUnLoad { get; set; }
@@ -202,6 +202,34 @@ namespace FryPot_DosingSystem.Control
/// </summary>
public bool AllowNextEmptyRollerToClean { get; set; } = true;



#endregion

#region AGV任务号对应的AGV故障信号
/// <summary>
/// 线体1到炒锅1,4 AGV故障
/// </summary>
public bool LineOneRobotTaskError { get; set; }

public bool LineTwoRobotTaskError { get; set; }

public bool LineThreeRobotTaskError { get; set; }

public bool LineFourRobotTaskError { get; set; }

public bool LineFiveRobotTaskError { get; set; }

public bool LineSixRobotTaskError { get; set; }

public bool LineSevenRobotTaskError { get; set; }

public bool LineEightRobotTaskError { get; set; }

public bool LineNineRobotTaskError { get; set; }

public bool LineTenRobotTaskError { get; set; }
#endregion
}
/// <summary>
@@ -309,6 +337,8 @@ namespace FryPot_DosingSystem.Control
/// </summary>
public ushort WashRollerArriveSignal { get; set; }


}
/// <summary>
/// 滚筒线2相关变量
@@ -608,6 +638,15 @@ namespace FryPot_DosingSystem.Control
/// 当前配方用油量
/// </summary>
public double OilCapacity { get; set; }

/// <summary>
/// 当前线体配方完成信号
/// </summary>
public ushort RecipeCompleteSingle { get; set; }
/// <summary>
/// 炒股当前步数
/// </summary>
public ushort ProcessStep { get; set; }
}
/// <summary>
/// 炒锅2相关变量
@@ -642,6 +681,15 @@ namespace FryPot_DosingSystem.Control
/// 当前配方用油量
/// </summary>
public double OilCapacity { get; set; }

/// <summary>
/// 当前线体配方完成信号
/// </summary>
public ushort RecipeCompleteSingle { get; set; }
/// <summary>
/// 炒锅当前步数
/// </summary>
public ushort ProcessStep { get; set; }
}
/// <summary>
/// 炒锅3相关变量
@@ -676,6 +724,17 @@ namespace FryPot_DosingSystem.Control
/// 当前配方用油量
/// </summary>
public double OilCapacity { get; set; }


/// <summary>
/// 当前线体配方完成信号
/// </summary>
public ushort RecipeCompleteSingle { get; set; }

/// <summary>
/// 炒股当前步数
/// </summary>
public ushort ProcessStep { get; set; }
}
/// <summary>
/// 炒锅4相关变量
@@ -710,6 +769,16 @@ namespace FryPot_DosingSystem.Control
/// 当前配方用油量
/// </summary>
public double OilCapacity { get; set; }

/// <summary>
/// 当前线体配方完成信号
/// </summary>
public ushort RecipeCompleteSingle { get; set; }

/// <summary>
/// 炒股当前步数
/// </summary>
public ushort ProcessStep { get; set; }
}
/// <summary>
/// 炒锅5相关变量
@@ -744,5 +813,15 @@ namespace FryPot_DosingSystem.Control
/// 当前配方用油量
/// </summary>
public double OilCapacity { get; set; }

/// <summary>
/// 当前线体配方完成信号
/// </summary>
public ushort RecipeCompleteSingle { get; set; }

/// <summary>
/// 炒股当前步数
/// </summary>
public ushort ProcessStep { get; set; }
}
}

+ 49
- 27
FryPot_DosingSystem/FryPotStatus/PotFiveStatus.cs View File

@@ -19,66 +19,88 @@ namespace FryPot_DosingSystem.FryPotStatus
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]//自增
public int Id { get; set; }
[Column("Temperature")]
[Variable("FryPotFiveTemp","5号炒锅温度","","")]
[Variable("FryPotFiveTemp","5号炒锅温度","D258","")]
/// <summary>
/// 温度
/// </summary>
public double? Temperature { get { return temperature; } set { temperature = value; } }
private double? temperature=0;
[Column("HotPower")]
[Variable("FryPotFivePower", "5号炒锅火力", "", "")]
/// <summary>
/// 火力
/// </summary>
public string? HotPower { get { return hotPower; } set { hotPower = value; } }
private string? hotPower="0";
//[Column("HotPower")]
//[Variable("FryPotFivePower", "5号炒锅火力", "", "")]
///// <summary>
///// 火力
///// </summary>
//public string? HotPower { get { return hotPower; } set { hotPower = value; } }
//private string? hotPower="0";
[Column("Speed")]
[Variable("FryPotFiveSpeed", "5号炒锅搅拌速度", "", "")]
[Variable("FryPotFiveSpeed", "5号炒锅搅拌速度", "D2500", "")]
/// <summary>
/// 搅拌速度
/// </summary>
public double? Speed { get { return speed; } set { speed = value; } }
private double? speed=0;
[Column("FryPotWeight")]
[Variable("FryPotFiveWeight", "5号炒锅载重", "", "")]
[Variable("FryPotFiveWeight", "5号炒锅载重", "D600", "")]
/// <summary>
/// 炒锅重量
/// </summary>
public double? FryPotWeight { get { return fryPotWeight; } set { fryPotWeight = value; } }
private double? fryPotWeight=0;


[Column("ReicpeName")]
/// <summary>
/// 当前配方名称
/// </summary>
public string RecipeName { get; set; } = string.Empty;
[Column("Time")]
/// <summary>
/// 时间
/// </summary>
public string Time { get; set; } = DateTime.Now.ToShortTimeString();


[Variable("FryPotFiveProcessStep", "5号炒锅当前工艺步数", "D3000", "")]
/// <summary>
/// 当前工艺步数
/// </summary>
public ushort Step { get { return _step; } set { _step = value; } }
private ushort _step;
[Variable("FryPotFiveSmallFire", "5号炒锅小火火力", "D510", "")]
public ushort SmallFire { get { return _smallFire; } set { _smallFire = value; } }
private ushort _smallFire;
[Variable("FryPotFiveMidFire", "5号炒锅中火火力", "D512", "")]
public ushort MidFire { get { return _midFire; } set { _midFire = value; } }
private ushort _midFire;
[Variable("FryPotFiveBigFire", "5号炒锅大火火力", "D514", "")]
public ushort BigFire { get { return _bigFire; } set { _bigFire = value; } }
private ushort _bigFire;
[Variable("FryPotFiveStrongFire", "5号炒锅强火火力", "D516", "")]
public ushort StrongFire { get { return _strongFire; } set { _strongFire = value; } }
private ushort _strongFire;

[Column("OilCapacity")]
[Variable("FryPotFiveOil", "5号炒锅当前配方用油量", "", "")]
/// <summary>
/// 单次配方用油量
/// </summary>
public double? OilCapacity { get { return oilCapacity; } set { oilCapacity = value; } }
private double? oilCapacity=0;
public double? OilCapacity { get { return oilCapacity; } set { oilCapacity = value; } }
private double? oilCapacity = 0;
[Column("TotalOilCapactiy")]
[Variable("FryPotFiveTotalOil", "5号炒锅总用油量", "", "")]
/// <summary>
/// 一天总用油量
/// </summary>
public double? TotalOilCapactiy { get { return totalOilCapactiy; } set { totalOilCapactiy = value; } }
private double? totalOilCapactiy=0;
private double? totalOilCapactiy = 0;

[Column("TotalProduct")]
[Variable("FryPotFiveTotalProduct", "5号炒锅总产量", "", "")]
/// <summary>
/// 一天配方生产总量
/// </summary>
public int? TotalProduct { get { return totalProduct; } set { totalProduct = value; } }
private int? totalProduct=0;


[Column("ReicpeName")]
/// <summary>
/// 当前配方名称
/// </summary>
public string RecipeName { get; set; } = string.Empty;
[Column("Time")]
/// <summary>
/// 时间
/// </summary>
public string Time { get; set; } = DateTime.Now.ToShortTimeString();
public int? TotalProduct { get { return totalProduct; } set { totalProduct = value; } }
private int? totalProduct = 0;
}
}

+ 49
- 27
FryPot_DosingSystem/FryPotStatus/PotFourStatus.cs View File

@@ -19,65 +19,87 @@ namespace FryPot_DosingSystem.FryPotStatus
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]//自增
public int Id { get; set; }
[Column("Temperature")]
[Variable("FryPotFourTemp", "4号炒锅温度", "", "")]
[Variable("FryPotFourTemp", "4号炒锅温度", "D258", "")]
/// <summary>
/// 温度
/// </summary>
public double? Temperature { get { return temperature; } set { temperature = value; } }
private double? temperature=0;
[Column("HotPower")]
[Variable("FryPotFourPower", "4号炒锅火力", "", "")]
/// <summary>
/// 火力
/// </summary>
public string? HotPower { get { return hotPower; } set { hotPower = value; } }
private string? hotPower="0";
//[Column("HotPower")]
//[Variable("FryPotFourPower", "4号炒锅火力", "", "")]
///// <summary>
///// 火力
///// </summary>
//public string? HotPower { get { return hotPower; } set { hotPower = value; } }
//private string? hotPower="0";
[Column("Speed")]
[Variable("FryPotFourSpeed", "4号炒锅搅拌速度", "", "")]
[Variable("FryPotFourSpeed", "4号炒锅搅拌速度", "D2500", "")]
/// <summary>
/// 搅拌速度
/// </summary>
public double? Speed { get { return speed; } set { speed = value; } }
private double? speed=0;
[Column("FryPotWeight")]
[Variable("FryPotFourWeight", "4号炒锅载重", "", "")]
[Variable("FryPotFourWeight", "4号炒锅载重", "D600", "")]
/// <summary>
/// 炒锅重量
/// </summary>
public double? FryPotWeight { get { return fryPotWeight; } set { fryPotWeight = value; } }
private double? fryPotWeight=0;

[Column("ReicpeName")]
/// <summary>
/// 当前配方名称
/// </summary>
public string RecipeName { get; set; } = string.Empty;
[Column("Time")]
/// <summary>
/// 时间
/// </summary>
public string Time { get; set; } = DateTime.Now.ToShortTimeString();


[Variable("FryPotFourProcessStep", "4号炒锅当前工艺步数", "D3000", "")]
/// <summary>
/// 当前工艺步数
/// </summary>
public ushort Step { get { return _step; } set { _step = value; } }
private ushort _step;
[Variable("FryPotFourSmallFire", "4号炒锅小火火力", "D510", "")]
public ushort SmallFire { get { return _smallFire; } set { _smallFire = value; } }
private ushort _smallFire;
[Variable("FryPotFourMidFire", "4号炒锅中火火力", "D512", "")]
public ushort MidFire { get { return _midFire; } set { _midFire = value; } }
private ushort _midFire;
[Variable("FryPotFourBigFire", "4号炒锅大火火力", "D514", "")]
public ushort BigFire { get { return _bigFire; } set { _bigFire = value; } }
private ushort _bigFire;
[Variable("FryPotFourStrongFire", "4号炒锅强火火力", "D516", "")]
public ushort StrongFire { get { return _strongFire; } set { _strongFire = value; } }
private ushort _strongFire;

[Column("OilCapacity")]
[Variable("FryPotFourOil", "4号炒锅当前配方用油量", "", "")]
/// <summary>
/// 单次配方用油量
/// </summary>
public double? OilCapacity { get { return oilCapacity; } set { oilCapacity = value; } }
private double? oilCapacity=0;
public double? OilCapacity { get { return oilCapacity; } set { oilCapacity = value; } }
private double? oilCapacity = 0;
[Column("TotalOilCapactiy")]
[Variable("FryPotFourTotalOil", "4号炒锅总用油量", "", "")]
/// <summary>
/// 一天总用油量
/// </summary>
public double? TotalOilCapactiy { get { return totalOilCapactiy; } set { totalOilCapactiy = value;; } }
private double? totalOilCapactiy=0;
public double? TotalOilCapactiy { get { return totalOilCapactiy; } set { totalOilCapactiy = value; ; } }
private double? totalOilCapactiy = 0;

[Column("TotalProduct")]
[Variable("FryPotFourTotalProduct", "4号炒锅总产量", "", "")]
/// <summary>
/// 一天配方生产总量
/// </summary>
public int? TotalProduct { get { return totalProduct; } set { totalProduct = value; } }
private int? totalProduct=0;

[Column("ReicpeName")]
/// <summary>
/// 当前配方名称
/// </summary>
public string RecipeName { get; set; } = string.Empty;
[Column("Time")]
/// <summary>
/// 时间
/// </summary>
public string Time { get; set; } = DateTime.Now.ToShortTimeString();
public int? TotalProduct { get { return totalProduct; } set { totalProduct = value; } }
private int? totalProduct = 0;
}
}

+ 44
- 23
FryPot_DosingSystem/FryPotStatus/PotOneStatus.cs View File

@@ -19,46 +19,77 @@ namespace FryPot_DosingSystem.FryPotStatus
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]//自增
public int Id { get; set; }
[Column("Temperature")]
[Variable("FryPotOneTemp", "1号炒锅温度", "", "")]
[Variable("FryPotOneTemp", "1号炒锅温度", "D258", "")]
/// <summary>
/// 温度
/// </summary>
public double? Temperature { get { return temperature; } set { temperature = value;} }
private double? temperature=0;
[Column("HotPower")]
[Variable("FryPotOnePower", "1号炒锅火力", "", "")]
/// <summary>
/// 火力
/// </summary>
public string? HotPower { get { return hotPower; } set { hotPower = value; } }
private string? hotPower="0";
//[Column("HotPower")]
//[Variable("FryPotOnePower", "1号炒锅火力", "", "")]
///// <summary>
///// 火力
///// </summary>
//public string? HotPower { get { return hotPower; } set { hotPower = value; } }
//private string? hotPower="0";
[Column("Speed")]
[Variable("FryPotOneSpeed", "1号炒锅搅拌速度", "", "")]
[Variable("FryPotOneSpeed", "1号炒锅搅拌速度", "D2500", "")]
/// <summary>
/// 搅拌速度
/// </summary>
public double? Speed { get { return speed; } set { speed = value; } }
private double? speed = 0;
[Column("FryPotWeight")]
[Variable("FryPotOneWeight", "1号炒锅载重", "", "")]
[Variable("FryPotOneWeight", "1号炒锅载重", "D600", "")]
/// <summary>
/// 炒锅重量
/// </summary>
public double? FryPotWeight { get { return fryPotWeight; } set { fryPotWeight = value; } }
private double? fryPotWeight = 0;
[Column("ReicpeName")]
/// <summary>
/// 当前配方名称
/// </summary>
public string RecipeName { get; set; } = string.Empty;
[Column("Time")]
/// <summary>
/// 时间
/// </summary>
public string Time { get; set; } = DateTime.Now.ToShortTimeString();

[Variable("FryPotOneProcessStep", "1号炒锅当前工艺步数", "D3000", "")]
/// <summary>
/// 当前工艺步数
/// </summary>
public ushort Step { get { return _step; } set { _step = value; } }
private ushort _step;
[Variable("FryPotOneSmallFire", "1号炒锅小火火力", "D510", "")]
public ushort SmallFire { get { return _smallFire; } set { _smallFire = value; } }
private ushort _smallFire;
[Variable("FryPotOneMidFire", "1号炒锅中火火力", "D512", "")]
public ushort MidFire { get { return _midFire; } set { _midFire = value; } }
private ushort _midFire;
[Variable("FryPotOneBigFire", "1号炒锅大火火力", "D514", "")]
public ushort BigFire { get { return _bigFire; } set { _bigFire = value; } }
private ushort _bigFire;
[Variable("FryPotOneStrongFire", "1号炒锅强火火力", "D516", "")]
public ushort StrongFire { get { return _strongFire; } set { _strongFire = value; } }
private ushort _strongFire;

[Column("OilCapacity")]
[Variable("FryPotOneOil", "1号炒锅当前配方用油量", "", "")]
/// <summary>
/// 单次配方用油量
/// </summary>
public double? OilCapacity { get { return oilCapacity; } set { oilCapacity = value; } }
public double? OilCapacity { get { return oilCapacity; } set { oilCapacity = value; } }
private double? oilCapacity = 0;
[Column("TotalOilCapactiy")]
[Variable("FryPotOneTotalOil", "1号炒锅总用油量", "", "")]
/// <summary>
/// 一天总用油量
/// </summary>
public double? TotalOilCapactiy { get { return totalOilCapactiy; } set { totalOilCapactiy = value; } }
public double? TotalOilCapactiy { get { return totalOilCapactiy; } set { totalOilCapactiy = value; } }
private double? totalOilCapactiy = 0;

[Column("TotalProduct")]
@@ -68,16 +99,6 @@ namespace FryPot_DosingSystem.FryPotStatus
/// </summary>
public int? TotalProduct { get { return totalProduct; } set { totalProduct = value; } }
private int? totalProduct = 0;
[Column("ReicpeName")]
/// <summary>
/// 当前配方名称
/// </summary>
public string RecipeName { get; set; } = string.Empty;
[Column("Time")]
/// <summary>
/// 时间
/// </summary>
public string Time { get; set; } = DateTime.Now.ToShortTimeString();

}
}

+ 50
- 28
FryPot_DosingSystem/FryPotStatus/PotThreeStatus.cs View File

@@ -19,66 +19,88 @@ namespace FryPot_DosingSystem.FryPotStatus
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]//自增
public int Id { get; set; }
[Column("Temperature")]
[Variable("FryPotThreeTemp", "3号炒锅温度", "", "")]
[Variable("FryPotThreeTemp", "3号炒锅温度", "D258", "")]
/// <summary>
/// 温度
/// </summary>
public double? Temperature { get { return temperature; } set { temperature = value; } }
private double? temperature=0;
[Column("HotPower")]
[Variable("FryPotThreePower", "3号炒锅火力", "", "")]
/// <summary>
/// 火力
/// </summary>
public string? HotPower { get { return hotPower; } set { hotPower = value;} }
private string? hotPower="0";
//[Column("HotPower")]
//[Variable("FryPotThreePower", "3号炒锅火力", "", "")]
///// <summary>
///// 火力
///// </summary>
//public string? HotPower { get { return hotPower; } set { hotPower = value;} }
//private string? hotPower="0";
[Column("Speed")]
[Variable("FryPotThreeSpeed", "3号炒锅搅拌速度", "", "")]
[Variable("FryPotThreeSpeed", "3号炒锅搅拌速度", "D2500", "")]
/// <summary>
/// 搅拌速度
/// </summary>
public double? Speed { get { return speed; } set { speed = value; } }
private double? speed=0;
[Column("FryPotWeight")]
[Variable("FryPotThreeWeight", "3号炒锅载重", "", "")]
[Variable("FryPotThreeWeight", "3号炒锅载重", "D600", "")]
/// <summary>
/// 炒锅重量
/// </summary>
public double? FryPotWeight { get { return fryPotWeight; } set { fryPotWeight = value; } }
private double? fryPotWeight=0;


[Column("ReicpeName")]
/// <summary>
/// 当前配方名称
/// </summary>
public string RecipeName { get; set; } = string.Empty;
[Column("Time")]
/// <summary>
/// 时间
/// </summary>
public string Time { get; set; } = DateTime.Now.ToShortTimeString();


[Variable("FryPotThreeProcessStep", "3号炒锅当前工艺步数", "D3000", "")]
/// <summary>
/// 当前工艺步数
/// </summary>
public ushort Step { get { return _step; } set { _step = value; } }
private ushort _step;
[Variable("FryPotThreeSmallFire", "3号炒锅小火火力", "D510", "")]
public ushort SmallFire { get { return _smallFire; } set { _smallFire = value; } }
private ushort _smallFire;
[Variable("FryPotThreeMidFire", "3号炒锅中火火力", "D512", "")]
public ushort MidFire { get { return _midFire; } set { _midFire = value; } }
private ushort _midFire;
[Variable("FryPotThreeBigFire", "3号炒锅大火火力", "D514", "")]
public ushort BigFire { get { return _bigFire; } set { _bigFire = value; } }
private ushort _bigFire;
[Variable("FryPotThreeStrongFire", "3号炒锅强火火力", "D516", "")]
public ushort StrongFire { get { return _strongFire; } set { _strongFire = value; } }
private ushort _strongFire;

[Column("OilCapacity")]
[Variable("FryPotThreeOil", "3号炒锅当前配方用油量", "", "")]
/// <summary>
/// 单次配方用油量
/// </summary>
public double? OilCapacity { get { return oilCapacity; } set { oilCapacity = value; } }
private double? oilCapacity=0;
public double? OilCapacity { get { return oilCapacity; } set { oilCapacity = value; } }
private double? oilCapacity = 0;
[Column("TotalOilCapactiy")]
[Variable("FryPotThreeTotalOil", "3号炒锅总用油量", "", "")]
/// <summary>
/// 一天总用油量
/// </summary>
public double? TotalOilCapactiy { get { return totalOilCapactiy; } set { totalOilCapactiy = value; } }
private double? totalOilCapactiy=0;
public double? TotalOilCapactiy { get { return totalOilCapactiy; } set { totalOilCapactiy = value; } }
private double? totalOilCapactiy = 0;

[Column("TotalProduct")]
[Variable("FryPotThreeTotalProduct", "3号炒锅总产量", "", "")]
/// <summary>
/// 一天配方生产总量
/// </summary>
public int? TotalProduct { get { return totalProduct; } set { totalProduct = value; } }
private int? totalProduct=0;


[Column("ReicpeName")]
/// <summary>
/// 当前配方名称
/// </summary>
public string RecipeName { get; set; } = string.Empty;
[Column("Time")]
/// <summary>
/// 时间
/// </summary>
public string Time { get; set; } = DateTime.Now.ToShortTimeString();
public int? TotalProduct { get { return totalProduct; } set { totalProduct = value; } }
private int? totalProduct = 0;
}
}

+ 46
- 24
FryPot_DosingSystem/FryPotStatus/PotTwoStatus.cs View File

@@ -19,47 +19,80 @@ namespace FryPot_DosingSystem.FryPotStatus
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]//自增
public int Id { get; set; }
[Column("Temperature")]
[Variable("FryPotTwoTemp", "2号炒锅温度", "", "")]
[Variable("FryPotTwoTemp", "2号炒锅温度", "D258", "")]
/// <summary>
/// 温度
/// </summary>
public double? Temperature { get { return temperature; } set { temperature = value; } }
private double? temperature=0;
[Column("HotPower")]
[Variable("FryPotTwoPower", "2号炒锅火力", "", "")]
/// <summary>
/// 火力
/// </summary>
public string? HotPower { get { return hotPower; } set { hotPower = value; } }
private string? hotPower="0";
//[Column("HotPower")]
//[Variable("FryPotTwoPower", "2号炒锅火力", "", "")]
///// <summary>
///// 火力
///// </summary>
//public string? HotPower { get { return hotPower; } set { hotPower = value; } }
//private string? hotPower="0";
[Column("Speed")]
[Variable("FryPotTwoSpeed", "2号炒锅搅拌速度", "", "")]
[Variable("FryPotTwoSpeed", "2号炒锅搅拌速度", "D2500", "")]
/// <summary>
/// 搅拌速度
/// </summary>
public double? Speed { get { return speed; } set { speed = value; } }
private double? speed=0;
[Column("FryPotWeight")]
[Variable("FryPotTwoWeight", "2号炒锅载重", "", "")]
[Variable("FryPotTwoWeight", "2号炒锅载重", "D600", "")]
/// <summary>
/// 炒锅重量
/// </summary>
public double? FryPotWeight { get { return fryPotWeight; } set { fryPotWeight = value; } }
private double? fryPotWeight=0;

[Column("ReicpeName")]
/// <summary>
/// 当前配方名称
/// </summary>
public string RecipeName { get; set; } = string.Empty;
[Column("Time")]
/// <summary>
/// 时间
/// </summary>
public string Time { get; set; } = DateTime.Now.ToShortTimeString();


[Variable("FryPotTwoProcessStep", "2号炒锅当前工艺步数", "D3000", "")]
/// <summary>
/// 当前工艺步数
/// </summary>
public ushort Step { get { return _step; } set { _step = value; } }
private ushort _step;
[Variable("FryPotTwoSmallFire", "2号炒锅小火火力", "D510", "")]
public ushort SmallFire { get { return _smallFire; } set { _smallFire = value; } }
private ushort _smallFire;
[Variable("FryPotTwoMidFire", "2号炒锅中火火力", "D512", "")]
public ushort MidFire { get { return _midFire; } set { _midFire = value; } }
private ushort _midFire;
[Variable("FryPotTwoBigFire", "2号炒锅大火火力", "D514", "")]
public ushort BigFire { get { return _bigFire; } set { _bigFire = value; } }
private ushort _bigFire;
[Variable("FryPotTwoStrongFire", "2号炒锅强火火力", "D516", "")]
public ushort StrongFire { get { return _strongFire; } set { _strongFire = value; } }
private ushort _strongFire;

[Column("OilCapacity")]
[Variable("FryPotTwoOil", "2号炒锅当前配方用油量", "", "")]
/// <summary>
/// 单次配方用油量
/// </summary>
public double? OilCapacity { get { return oilCapacity; } set { oilCapacity = value; } }
private double? oilCapacity=0;
private double? oilCapacity = 0;
[Column("TotalOilCapactiy")]
[Variable("FryPotTwoTotalOil", "2号炒锅总用油量", "", "")]
/// <summary>
/// 一天总用油量
/// </summary>
public double? TotalOilCapactiy { get { return totalOilCapactiy; } set { totalOilCapactiy = value; } }
private double? totalOilCapactiy=0;
private double? totalOilCapactiy = 0;

[Column("TotalProduct")]
[Variable("FryPotTwoTotalProduct", "2号炒锅总产量", "", "")]
@@ -67,17 +100,6 @@ namespace FryPot_DosingSystem.FryPotStatus
/// 一天配方生产总量
/// </summary>
public int? TotalProduct { get { return totalProduct; } set { totalProduct = value; } }
private int? totalProduct=0;

[Column("ReicpeName")]
/// <summary>
/// 当前配方名称
/// </summary>
public string RecipeName { get; set; } = string.Empty;
[Column("Time")]
/// <summary>
/// 时间
/// </summary>
public string Time { get; set; } = DateTime.Now.ToShortTimeString();
private int? totalProduct = 0;
}
}

+ 28
- 16
FryPot_DosingSystem/Model/FlowProcessModel.cs View File

@@ -9,11 +9,11 @@ namespace FryPot_DosingSystem.Model
{
internal class FlowProcessModel:ObservableObject
{
/// <summary>
/// 工艺对应配方名称
/// </summary>
public string RecipeName { get { return _recipeName; }set { _recipeName = value;OnPropertyChanged(); } }
private string _recipeName;
///// <summary>
///// 工艺步骤对应名称
///// </summary>
//public string ProcessName { get { return _processName; }set { _processName = value;OnPropertyChanged(); } }
//private string _processName;
///// <summary>
///// 工艺步骤
///// </summary>
@@ -29,11 +29,11 @@ namespace FryPot_DosingSystem.Model
/// </summary>
public double FrySpeed { get { return _frySpeed; }set { _frySpeed = value;OnPropertyChanged(); } }
private double _frySpeed;
///// <summary>
///// 炒制重量
///// </summary>
//public double FryWeight { get { return _fryMaterialWeight; } set { _fryMaterialWeight = value; OnPropertyChanged(); } }
//private double _fryMaterialWeight;
/// <summary>
/// 炒制重量
/// </summary>
public double FryWeight { get { return _fryMaterialWeight; } set { _fryMaterialWeight = value; OnPropertyChanged(); } }
private double _fryMaterialWeight;
/// <summary>
/// 炒制温度
/// </summary>
@@ -45,15 +45,27 @@ namespace FryPot_DosingSystem.Model
public double FryPeriodTime { get { return _fryPeriodTime; } set { _fryPeriodTime = value;OnPropertyChanged(); } }
private double _fryPeriodTime;
/// <summary>
/// 炒制火力
/// 小火比例
/// </summary>
public double SmallFirePercent { get { return _smallFirePercent; } set { _smallFirePercent = value; OnPropertyChanged(); } }
private double _smallFirePercent;

/// <summary>
/// 中火比例
/// </summary>
public double MidFirePercent { get { return _midFirePercent; } set { _midFirePercent = value; OnPropertyChanged(); } }
private double _midFirePercent;

/// <summary>
/// 大火比例
/// </summary>
public double FryFire { get { return _fryFire; } set { _fryFire = value; OnPropertyChanged(); } }
private double _fryFire;
public double BigFirePercent { get { return _bigFirePercent; } set { _bigFirePercent = value; OnPropertyChanged(); } }
private double _bigFirePercent;

/// <summary>
/// 火力比例
/// 火比例
/// </summary>
public double FryFirePercent { get { return _fryFirePercent; } set { _fryFirePercent = value; OnPropertyChanged(); } }
private double _fryFirePercent;
public double StrongFirePercent { get { return _strongFilePercent; } set { _strongFilePercent = value; OnPropertyChanged(); } }
private double _strongFilePercent;
}
}

+ 4
- 2
FryPot_DosingSystem/Model/FlowProcessNames.cs View File

@@ -1,5 +1,6 @@
using Microsoft.Toolkit.Mvvm.ComponentModel;
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
@@ -8,10 +9,11 @@ using System.Threading.Tasks;

namespace FryPot_DosingSystem.Model
{
internal class FlowProcessNames:ObservableObject
internal class FlowProcessNames : ObservableObject
{
private static FlowProcessNames _instance;
public static FlowProcessNames GetInstance => _instance ?? (_instance = new FlowProcessNames());
public ObservableCollection<string> Names { get; set; } = new ObservableCollection<string>();
// public ObservableCollection<string> Names { get; set; } = new ObservableCollection<string>();
public ConcurrentDictionary<string, int> NameId { get; set; } = new ConcurrentDictionary<string, int>();
}
}

+ 79
- 22
FryPot_DosingSystem/View/FlowProcessView.xaml View File

@@ -402,35 +402,44 @@
<Button Content="向前新增" Width="100" Margin="0,0,10,0" Height="30" Background="Transparent" BorderBrush="#FF2AB2E7" Foreground="#FF2AB2E7" Cursor="Hand" FontSize="18" Command="{Binding AddFrontFlowItemCommand}" ></Button>
<Button Content="向后新增" Width="100" Margin="0,0,10,0" Height="30" Background="Transparent" BorderBrush="#FF2AB2E7" Foreground="#FF2AB2E7" Cursor="Hand" FontSize="18" Command="{Binding AddLastFlowItemCommand}" ></Button>
<Button Content="删除选项" Width="100" Margin="0,0,10,0" Height="30" Background="Transparent" BorderBrush="#FF2AB2E7" Foreground="#FF2AB2E7" Cursor="Hand" FontSize="18" Command="{Binding DeleteFlowItemCommand}" ></Button>
<Button Content="新增料品" Width="100" Margin="0,0,10,0" Height="30" Background="Transparent" BorderBrush="#FF2AB2E7" Foreground="#FF2AB2E7" Cursor="Hand" FontSize="18" Click="Button_Click"></Button>
<Button Content="保存工艺" Width="100" Margin="0,0,10,0" Height="30" Background="Transparent" BorderBrush="#FF2AB2E7" Foreground="#FF2AB2E7" Cursor="Hand" FontSize="18" Command="{Binding ConfirmCommand}" ></Button>
<Button Content="取消" Height="30" Width="100" Margin="0,0,10,0" Background="Transparent" FontSize="18" BorderBrush="#FF2AB2E7" Foreground="#FF2AB2E7" Command="{Binding CloseWindowCommand}"></Button>

</StackPanel>
<Grid Grid.Row="2" Background="#FF2AB2E7" Margin="0,0,0,8">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="100"/>
<ColumnDefinition Width="140"/>
<ColumnDefinition Width="140"/>
<ColumnDefinition Width="140"/>
<ColumnDefinition Width="140"/>
<ColumnDefinition Width="140"/>
<ColumnDefinition Width="140"/>
<ColumnDefinition Width="87"/>
<ColumnDefinition Width="120"/>
<ColumnDefinition Width="92"/>
<ColumnDefinition Width="92"/>
<ColumnDefinition Width="92"/>
<ColumnDefinition Width="92"/>
<ColumnDefinition Width="92"/>
<ColumnDefinition Width="92"/>
<ColumnDefinition Width="92"/>
<ColumnDefinition Width="92"/>
<ColumnDefinition Width="92"/>
</Grid.ColumnDefinitions>
<TextBlock Text="工艺步骤" HorizontalAlignment="Center" VerticalAlignment="Center" Foreground="white" FontSize="18"/>
<GridSplitter BorderThickness="0.2" BorderBrush="White"></GridSplitter>
<TextBlock Grid.Column="1" Text="原料/桶号设定" HorizontalAlignment="Center" VerticalAlignment="Center" Foreground="white" FontSize="18"/>
<GridSplitter Grid.Column="1" BorderThickness="0.2" BorderBrush="White"></GridSplitter>
<TextBlock Grid.Column="2" Text="速度设定" HorizontalAlignment="Center" VerticalAlignment="Center" Foreground="white" FontSize="18"/>
<!--<GridSplitter Grid.Column="2" BorderThickness="0.2" BorderBrush="White"></GridSplitter>
<TextBlock Grid.Column="3" Text="重量设定" VerticalAlignment="Center" HorizontalAlignment="Center" Foreground="white" FontSize="18"></TextBlock>-->
<GridSplitter Grid.Column="2" BorderThickness="0.2" BorderBrush="White"></GridSplitter>
<TextBlock Grid.Column="3" Text="温度设定" VerticalAlignment="Center" HorizontalAlignment="Center" Foreground="white" FontSize="18"/>
<TextBlock Grid.Column="3" Text="重量设定" VerticalAlignment="Center" HorizontalAlignment="Center" Foreground="white" FontSize="18" ></TextBlock>
<GridSplitter Grid.Column="3" BorderThickness="0.2" BorderBrush="White"></GridSplitter>
<TextBlock Grid.Column="4" Text="时间设定" VerticalAlignment="Center" HorizontalAlignment="Center" Foreground="white" FontSize="18"/>
<TextBlock Grid.Column="4" Text="温度设定" VerticalAlignment="Center" HorizontalAlignment="Center" Foreground="white" FontSize="18"/>
<GridSplitter Grid.Column="4" BorderThickness="0.2" BorderBrush="White"></GridSplitter>
<TextBlock Grid.Column="5" Text="火力设定" VerticalAlignment="Center" HorizontalAlignment="Center" Foreground="white" FontSize="18"/>
<TextBlock Grid.Column="5" Text="时间设定" VerticalAlignment="Center" HorizontalAlignment="Center" Foreground="white" FontSize="18"/>
<GridSplitter Grid.Column="5" BorderThickness="0.2" BorderBrush="White"></GridSplitter>
<TextBlock Grid.Column="6" Text="火力比例" VerticalAlignment="Center" HorizontalAlignment="Center" Foreground="white" FontSize="18"/>
<TextBlock Grid.Column="6" Text="小火比例" VerticalAlignment="Center" HorizontalAlignment="Center" Foreground="white" FontSize="18"/>
<GridSplitter Grid.Column="6" BorderThickness="0.2" BorderBrush="White"></GridSplitter>
<TextBlock Grid.Column="7" Text="中火比例" VerticalAlignment="Center" HorizontalAlignment="Center" Foreground="white" FontSize="18"/>
<GridSplitter Grid.Column="7" BorderThickness="0.2" BorderBrush="White"></GridSplitter>
<TextBlock Grid.Column="8" Text="大火比例" VerticalAlignment="Center" HorizontalAlignment="Center" Foreground="white" FontSize="18"/>
<GridSplitter Grid.Column="8" BorderThickness="0.2" BorderBrush="White"></GridSplitter>
<TextBlock Grid.Column="9" Text="强火比例" VerticalAlignment="Center" HorizontalAlignment="Center" Foreground="white" FontSize="18"/>
</Grid>
<ScrollViewer Grid.Row="3" VerticalScrollBarVisibility="Hidden">
<ItemsControl x:Name="itemcontrols" AlternationCount="{Binding flowProcessModels.Count}" ItemsSource="{Binding flowProcessModels}" Margin="0,1,0,-1">
@@ -443,20 +452,20 @@
<DataTemplate>
<StackPanel x:Name="stk" Orientation="Horizontal" >
<Label MouseLeftButtonDown="Label_MouseLeftButtonDown" Content="{Binding Path=(ItemsControl.AlternationIndex),RelativeSource={
RelativeSource TemplatedParent}}" Foreground="SkyBlue" Width="100" Height="40" VerticalContentAlignment="Center" HorizontalContentAlignment="Center" FontSize="18" Background="Transparent" BorderBrush="#FF2AB2E7" BorderThickness="1,1,0.5,1"/>
<ComboBox ItemsSource="{Binding DataContext.FlowItems, RelativeSource={RelativeSource AncestorType=ItemsControl, Mode=FindAncestor}}" Text="{Binding FryMaterialNum}" Style="{StaticResource BaseComboBoxStyle}" IsReadOnly="True" Width="140" Height="40" VerticalContentAlignment="Center" HorizontalContentAlignment="Center" Background="Transparent" Foreground="SkyBlue" FontSize="18" BorderBrush="#FF2AB2E7" BorderThickness="0.5,1,0.5,1"/>
<TextBox Text="{Binding FrySpeed}" Width="140" Height="40" VerticalContentAlignment="Center" HorizontalContentAlignment="Center" Background="Transparent" Foreground="SkyBlue" FontSize="18" BorderBrush="#FF2AB2E7" BorderThickness="0.5,1,0.5,1"/>
<!--<TextBox Text="{Binding FryWeight}" Width="140" Height="40" VerticalContentAlignment="Center" HorizontalContentAlignment="Center" Background="Transparent" Foreground="SkyBlue" FontSize="18" BorderBrush="#FF2AB2E7" BorderThickness="0.5,1,0.5,1"/>-->
<TextBox Text="{Binding FryTemperature}" Width="140" Height="40" VerticalContentAlignment="Center" HorizontalContentAlignment="Center" Background="Transparent" Foreground="SkyBlue" FontSize="18" BorderBrush="#FF2AB2E7" BorderThickness="0.5,1,0.5,1"/>
<TextBox Text="{Binding FryPeriodTime}" Width="140" Height="40" VerticalContentAlignment="Center" HorizontalContentAlignment="Center" Background="Transparent" Foreground="SkyBlue" FontSize="18" BorderBrush="#FF2AB2E7" BorderThickness="0.5,1,1,1"/>
<TextBox Text="{Binding FryFire}" Width="140" Height="40" VerticalContentAlignment="Center" HorizontalContentAlignment="Center" Background="Transparent" Foreground="SkyBlue" FontSize="18" BorderBrush="#FF2AB2E7" BorderThickness="0.5,1,1,1"/>
RelativeSource TemplatedParent}}" Foreground="SkyBlue" Width="87" Height="40" VerticalContentAlignment="Center" HorizontalContentAlignment="Center" FontSize="18" Background="Transparent" BorderBrush="#FF2AB2E7" BorderThickness="1,1,0.5,1"/>
<ComboBox ItemsSource="{Binding DataContext.FlowItems, RelativeSource={RelativeSource AncestorType=ItemsControl, Mode=FindAncestor}}" Text="{Binding FryMaterialNum}" Style="{StaticResource BaseComboBoxStyle}" IsReadOnly="True" Width="120" Height="40" VerticalContentAlignment="Center" HorizontalContentAlignment="Center" Background="Transparent" Foreground="SkyBlue" FontSize="18" BorderBrush="#FF2AB2E7" BorderThickness="0.5,1,0.5,1"/>
<TextBox Text="{Binding FrySpeed}" Width="92" Height="40" VerticalContentAlignment="Center" HorizontalContentAlignment="Center" Background="Transparent" Foreground="SkyBlue" FontSize="18" BorderBrush="#FF2AB2E7" BorderThickness="0.5,1,0.5,1" TextChanged="TextBox_TextChanged"/>
<TextBox Text="{Binding FryWeight}" Width="92" Height="40" VerticalContentAlignment="Center" HorizontalContentAlignment="Center" Background="Transparent" Foreground="SkyBlue" FontSize="18" BorderBrush="#FF2AB2E7" BorderThickness="0.5,1,0.5,1" TextChanged="TextBox_TextChanged_1"/>
<TextBox Text="{Binding FryTemperature}" Width="92" Height="40" VerticalContentAlignment="Center" HorizontalContentAlignment="Center" Background="Transparent" Foreground="SkyBlue" FontSize="18" BorderBrush="#FF2AB2E7" BorderThickness="0.5,1,0.5,1" TextChanged="TextBox_TextChanged_2"/>
<TextBox Text="{Binding FryPeriodTime}" Width="92" Height="40" VerticalContentAlignment="Center" HorizontalContentAlignment="Center" Background="Transparent" Foreground="SkyBlue" FontSize="18" BorderBrush="#FF2AB2E7" BorderThickness="0.5,1,1,1" TextChanged="TextBox_TextChanged_3"/>

<TextBox FontSize="18" >
<TextBox.Template>
<ControlTemplate>
<Border Width="140" Height="40" BorderThickness="0.5,1,1,1" BorderBrush="#FF2AB2E7">
<Border Width="92" Height="40" BorderThickness="0.5,1,1,1" BorderBrush="#FF2AB2E7">
<StackPanel Orientation="Horizontal">
<TextBox Width="100" Height="40" VerticalAlignment="Center" BorderThickness="0" VerticalContentAlignment="Center" HorizontalContentAlignment="Right" Padding="0,0,22,0" BorderBrush="Transparent" HorizontalAlignment="Center" Background="Transparent" Foreground="SkyBlue" Text="{Binding FryFirePercent}"/>
<TextBox Width="60" Height="40" VerticalAlignment="Center" BorderThickness="0" VerticalContentAlignment="Center" HorizontalContentAlignment="Right" Padding="0,0,10,0" BorderBrush="Transparent" HorizontalAlignment="Center" Background="Transparent" Foreground="SkyBlue" Text="{Binding SmallFirePercent}" TextChanged="TextBox_TextChanged_4"/>
<TextBlock Text="%" HorizontalAlignment="Right" Foreground="SkyBlue" VerticalAlignment="Center"/>
</StackPanel>
</Border>
@@ -467,6 +476,54 @@ RelativeSource TemplatedParent}}" Foreground="SkyBlue" Width="100" Height="40"
</TextBox.Template>
</TextBox>
<TextBox FontSize="18" >
<TextBox.Template>
<ControlTemplate>
<Border Width="92" Height="40" BorderThickness="0.5,1,1,1" BorderBrush="#FF2AB2E7">
<StackPanel Orientation="Horizontal">
<TextBox Width="60" Height="40" VerticalAlignment="Center" BorderThickness="0" VerticalContentAlignment="Center" HorizontalContentAlignment="Right" Padding="0,0,10,0" BorderBrush="Transparent" HorizontalAlignment="Center" Background="Transparent" Foreground="SkyBlue" Text="{Binding MidFirePercent}" TextChanged="TextBox_TextChanged_5"/>
<TextBlock Text="%" HorizontalAlignment="Right" Foreground="SkyBlue" VerticalAlignment="Center"/>
</StackPanel>
</Border>
<ControlTemplate.Triggers>

</ControlTemplate.Triggers>
</ControlTemplate>

</TextBox.Template>
</TextBox>
<TextBox FontSize="18" >
<TextBox.Template>
<ControlTemplate>
<Border Width="92" Height="40" BorderThickness="0.5,1,1,1" BorderBrush="#FF2AB2E7">
<StackPanel Orientation="Horizontal">
<TextBox Width="60" Height="40" VerticalAlignment="Center" BorderThickness="0" VerticalContentAlignment="Center" HorizontalContentAlignment="Right" Padding="0,0,10,0" BorderBrush="Transparent" HorizontalAlignment="Center" Background="Transparent" Foreground="SkyBlue" Text="{Binding BigFirePercent}" TextChanged="TextBox_TextChanged_6"/>
<TextBlock Text="%" HorizontalAlignment="Right" Foreground="SkyBlue" VerticalAlignment="Center"/>
</StackPanel>
</Border>
<ControlTemplate.Triggers>

</ControlTemplate.Triggers>
</ControlTemplate>

</TextBox.Template>
</TextBox>
<TextBox FontSize="18" >
<TextBox.Template>
<ControlTemplate>
<Border Width="92" Height="40" BorderThickness="0.5,1,1,1" BorderBrush="#FF2AB2E7">
<StackPanel Orientation="Horizontal">
<TextBox Width="60" Height="40" VerticalAlignment="Center" BorderThickness="0" VerticalContentAlignment="Center" HorizontalContentAlignment="Right" Padding="0,0,10,0" BorderBrush="Transparent" HorizontalAlignment="Center" Background="Transparent" Foreground="SkyBlue" Text="{Binding StrongFirePercent}" TextChanged="TextBox_TextChanged_7"/>
<TextBlock Text="%" HorizontalAlignment="Right" Foreground="SkyBlue" VerticalAlignment="Center"/>
</StackPanel>
</Border>
<ControlTemplate.Triggers>

</ControlTemplate.Triggers>
</ControlTemplate>

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


+ 91
- 3
FryPot_DosingSystem/View/FlowProcessView.xaml.cs View File

@@ -1,9 +1,11 @@
using BPASmartClient.Helper;
using FryPot_DosingSystem.Model;
using FryPot_DosingSystem.ViewModel;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
@@ -21,7 +23,7 @@ namespace FryPot_DosingSystem.View
/// </summary>
public partial class FlowProcessView : Window
{
public FlowProcessView()
{
InitializeComponent();
@@ -31,7 +33,7 @@ namespace FryPot_DosingSystem.View
{
this.Close();
}), "CloseFlowProcessView");

}

@@ -72,6 +74,92 @@ namespace FryPot_DosingSystem.View
return null;
}

private void Button_Click(object sender, RoutedEventArgs e)
{
NewFryPotMaterial win = new NewFryPotMaterial();
win.Show();
}

public string TextLimit(string str)
{
if (Regex.IsMatch(str, @"^\d+$"))//非负整数 非零正整数^\+?[1-9][0-9]*$
{
return str;
}
else
{
return string.Empty;
}
}
/// <summary>
/// 文本输入做限定
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void TextBox_TextChanged(object sender, TextChangedEventArgs e)
{
if (sender is TextBox txt)
{
txt.Text = TextLimit(txt.Text);
}
}

private void TextBox_TextChanged_1(object sender, TextChangedEventArgs e)
{
if (sender is TextBox txt)
{
txt.Text = TextLimit(txt.Text);
}
}

private void TextBox_TextChanged_2(object sender, TextChangedEventArgs e)
{
if (sender is TextBox txt)
{
txt.Text = TextLimit(txt.Text);
}
}

private void TextBox_TextChanged_3(object sender, TextChangedEventArgs e)
{
if (sender is TextBox txt)
{
txt.Text = TextLimit(txt.Text);
}
}

private void TextBox_TextChanged_4(object sender, TextChangedEventArgs e)
{
if (sender is TextBox txt)
{
txt.Text = TextLimit(txt.Text);
}
}

private void TextBox_TextChanged_5(object sender, TextChangedEventArgs e)
{
if (sender is TextBox txt)
{
txt.Text = TextLimit(txt.Text);
}
}

private void TextBox_TextChanged_6(object sender, TextChangedEventArgs e)
{
if (sender is TextBox txt)
{
txt.Text = TextLimit(txt.Text);
}
}

private void TextBox_TextChanged_7(object sender, TextChangedEventArgs e)
{
if (sender is TextBox txt)
{
txt.Text = TextLimit(txt.Text);
}
}

//private void ComboBox_KeyUp(object sender, KeyEventArgs e)
//{
// var res = sender as ComboBox;
@@ -104,7 +192,7 @@ namespace FryPot_DosingSystem.View
// //Json<FlowProcessNames>.Data = FlowProcessNames.GetInstance;
// Json<FlowProcessNames>.Data.Names.Add(res.Text.Trim());
// Json<FlowProcessNames>.Save();
// }

// }


+ 47
- 0
FryPot_DosingSystem/View/NewFryPotMaterial.xaml View File

@@ -0,0 +1,47 @@
<Window x:Class="FryPot_DosingSystem.View.NewFryPotMaterial"
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:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:FryPot_DosingSystem.View"
xmlns:vw="clr-namespace:FryPot_DosingSystem.ViewModel"
mc:Ignorable="d"
Title="NewFryPotMaterial" Height="250" Width="600" WindowStartupLocation="CenterScreen" WindowStyle="None" AllowsTransparency="True">
<Window.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="/BPASmartClient.CustomResource;component/Themes/GenricStyle.xaml" />
<ResourceDictionary Source="/BPASmartClient.CustomResource;component/Themes/MyStyle.xaml" />
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</Window.Resources>
<Window.DataContext>
<vw:NewFryPotMaterialViewModel/>
</Window.DataContext>
<Border x:Name="br" BorderThickness="1" BorderBrush="Aqua">
<Border.Background>
<SolidColorBrush Color="#FF0B2F5F"/>
</Border.Background>
<Grid>
<Grid.RowDefinitions>
<RowDefinition/>
<RowDefinition/>
<RowDefinition/>
</Grid.RowDefinitions>

<StackPanel Orientation="Horizontal" HorizontalAlignment="Center" >
<TextBlock Text="名称:" Foreground="#FF2AB2E7" FontSize="18" VerticalAlignment="Center"/>
<TextBox Text="{Binding MaterialName}" FontSize="18" Width="300" Height="50" />
</StackPanel>
<StackPanel Grid.Row="1" Orientation="Horizontal" HorizontalAlignment="Center" >
<TextBlock Text="编号:" Foreground="#FF2AB2E7" FontSize="18" VerticalAlignment="Center"/>
<TextBox Text="{Binding Id}" FontSize="18" Width="300" Height="50"/>
</StackPanel>
<StackPanel Grid.Row="2" Orientation="Horizontal" HorizontalAlignment="Center" >
<Button Content="确定" Background="Transparent" Foreground="#FF2AB2E7" FontSize="18" Margin="40,0,20,0" Width="100" Height="50" Command="{Binding ConfimCommand}"/>
<Button Content="取消" FontSize="18" Margin="40,0,20,0" Width="100" Height="50" Click="Button_Click"/>
</StackPanel>
</Grid>

</Border>
</Window>

+ 37
- 0
FryPot_DosingSystem/View/NewFryPotMaterial.xaml.cs View File

@@ -0,0 +1,37 @@

using BPASmartClient.Helper;
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 FryPot_DosingSystem.View
{
/// <summary>
/// NewFryPotMaterial.xaml 的交互逻辑
/// </summary>
public partial class NewFryPotMaterial : Window
{
public NewFryPotMaterial()
{
InitializeComponent();
this.br.MouseLeftButtonDown += (o, e) => { if (e.LeftButton == MouseButtonState.Pressed) this.DragMove(); };
ActionManage.GetInstance.CancelRegister("CloseNewFryPotMaterial");
ActionManage.GetInstance.Register(new Action(() => { this.Close(); }), "CloseNewFryPotMaterial");
}

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

+ 2
- 2
FryPot_DosingSystem/View/NewRecipeView.xaml View File

@@ -416,12 +416,12 @@

</StackPanel>
<StackPanel Orientation="Horizontal" Grid.Column="2">
<TextBox Text="{Binding MaterialWeight}" Background="Transparent" FontSize="14" Height="30" LostFocus="TextBox_LostFocus_1"
<TextBox Text="{Binding MaterialWeight}" Background="Transparent" FontSize="14" Height="30" LostFocus="TextBox_LostFocus_1" TextChanged="TextBox_TextChanged_1"
BorderBrush="#e69519" Foreground="LightGray" Width="140" Margin="5,0,0,10" ></TextBox>
<TextBlock VerticalAlignment="Center" FontSize="14" Margin="4,0,0,10" Text="Kg" Foreground="#e69519" ></TextBlock>
</StackPanel>
<StackPanel Orientation="Horizontal" Grid.Column="3">
<TextBox Text="{Binding MaterialOffset}" Background="Transparent" FontSize="14" Height="30" LostFocus="TextBox_LostFocus"
<TextBox Text="{Binding MaterialOffset}" Background="Transparent" FontSize="14" Height="30" LostFocus="TextBox_LostFocus" TextChanged="TextBox_TextChanged_2"
BorderBrush="#e69519" Foreground="LightGray" Width="140" Margin="5,0,0,10" ></TextBox>
<TextBlock VerticalAlignment="Center" FontSize="14" Margin="4,0,0,10" Text="Kg" Foreground="#e69519" ></TextBlock>
</StackPanel>


+ 88
- 50
FryPot_DosingSystem/View/NewRecipeView.xaml.cs View File

@@ -28,7 +28,7 @@ namespace FryPot_DosingSystem.View
InitializeComponent();
this.br.MouseLeftButtonDown += (o, e) => { if (e.LeftButton == MouseButtonState.Pressed) this.DragMove(); };
ActionManage.GetInstance.CancelRegister("CloseNewRecipeView");
ActionManage.GetInstance.Register(new Action(() => { this.Close();}), "CloseNewRecipeView");
ActionManage.GetInstance.Register(new Action(() => { this.Close(); }), "CloseNewRecipeView");
}

private void Button_Click(object sender, RoutedEventArgs e)
@@ -37,14 +37,14 @@ namespace FryPot_DosingSystem.View
}

private void ComboBox_KeyUp(object sender, KeyEventArgs e)
{
{
var res = sender as ComboBox;
Json<MaterialNames>.Read();
if (res.Text != null && res.Text != String.Empty)
{
var datas = Json<MaterialNames>.Data.Names.Where(s => s.Contains(res.Text.Trim()));
// var datas = Json<MaterialNames>.Data.Names.ToList().FindAll(s => s.Contains(res.Text.Trim()));
var datas = Json<MaterialNames>.Data.Names.Where(s => s.Contains(res.Text.Trim()));
// var datas = Json<MaterialNames>.Data.Names.ToList().FindAll(s => s.Contains(res.Text.Trim()));
if (datas.Count() > 0)
{
res.ItemsSource = datas;
@@ -68,7 +68,7 @@ namespace FryPot_DosingSystem.View
Json<MaterialNames>.Data = MaterialNames.GetInstance;
Json<MaterialNames>.Save();
}
}
}

@@ -81,8 +81,8 @@ namespace FryPot_DosingSystem.View

}
else
{
txt.Text=string.Empty;
{
txt.Text = string.Empty;
}
}
}
@@ -94,27 +94,28 @@ namespace FryPot_DosingSystem.View
/// <param name="e"></param>
private void TextBox_LostFocus(object sender, RoutedEventArgs e)
{
if(sender is TextBox)
{
try
{
TextBox text = sender as TextBox;
if (text.Text != null)
{
double offset = float.Parse((text.Text));
if (offset < 0)
{
MessageBox.Show("偏差值无效输入", "警告", MessageBoxButton.OKCancel, MessageBoxImage.Warning);
}
}
}
catch (Exception)
{
//if (sender is TextBox)
//{
// try
// {
// TextBox text = sender as TextBox;
// if (text.Text != null)
// {
// double offset = float.Parse((text.Text));
// if (offset < 0)
// {
// MessageBox.Show("偏差值无效输入", "警告", MessageBoxButton.OKCancel, MessageBoxImage.Warning);
// }
// }
// }
// catch (Exception)
// {

// MessageBox.Show("偏差值非法输入", "警告", MessageBoxButton.OKCancel, MessageBoxImage.Warning);
// }
//}

MessageBox.Show("偏差值非法输入", "警告", MessageBoxButton.OKCancel, MessageBoxImage.Warning);
}
}
}
/// <summary>
/// 料桶重量验证
@@ -123,34 +124,71 @@ namespace FryPot_DosingSystem.View
/// <param name="e"></param>
private void TextBox_LostFocus_1(object sender, RoutedEventArgs e)
{
if (sender is TextBox)
//if (sender is TextBox)
//{
// try
// {
// TextBox text = sender as TextBox;
// if (text != null)
// {
// double weight = Convert.ToDouble(text.Text);
// if (weight < 0)
// {
// MessageBox.Show("原料重量非法输入", "警告", MessageBoxButton.OKCancel, MessageBoxImage.Warning);
// }
// else if (weight > maxMaterialWeight)
// {
// MessageBox.Show("原料重量超出上限", "警告", MessageBoxButton.OKCancel, MessageBoxImage.Warning);
// }
// else
// {
// text.Text = Math.Ceiling(weight).ToString();
// }

// }
// }
// catch (Exception)
// {

// MessageBox.Show("原料重量非法输入", "警告", MessageBoxButton.OKCancel, MessageBoxImage.Warning);
// }
//}
}

private void TextBox_TextChanged_1(object sender, TextChangedEventArgs e)
{
if (sender is TextBox txtbox)
{
try
if (Regex.IsMatch(txtbox.Text, @"^\+?[1-9][0-9]*$"))//非零正整数
{
txtbox.Text = txtbox.Text.Trim();

}
else
{
TextBox text = sender as TextBox;
if (text != null)
{
double weight = Convert.ToDouble(text.Text);
if (weight < 0)
{
MessageBox.Show("原料重量非法输入", "警告", MessageBoxButton.OKCancel, MessageBoxImage.Warning);
}
else if (weight > maxMaterialWeight)
{
MessageBox.Show("原料重量超出上限", "警告", MessageBoxButton.OKCancel, MessageBoxImage.Warning);
}
else
{
text.Text = Math.Ceiling(weight).ToString();
}

}
// MessageBox.Show("原料重量非法输入", "警告", MessageBoxButton.OKCancel, MessageBoxImage.Warning);
txtbox.Text = string.Empty;
}
catch (Exception)

}
}

private void TextBox_TextChanged_2(object sender, TextChangedEventArgs e)
{
if (sender is TextBox txtbox)
{
if (Regex.IsMatch(txtbox.Text, @"^[0-9]+(.[1-9]{0,1})?$"))//验证整数或1位小数
{
txtbox.Text = txtbox.Text.Trim();

MessageBox.Show("原料重量非法输入", "警告", MessageBoxButton.OKCancel, MessageBoxImage.Warning);
}
else
{
// MessageBox.Show("原料重量非法输入", "警告", MessageBoxButton.OKCancel, MessageBoxImage.Warning);
txtbox.Text = string.Empty;
}

}
}
}


+ 18
- 10
FryPot_DosingSystem/View/SqliteDataView.xaml View File

@@ -487,30 +487,38 @@
AutoGenerateColumns="False" IsReadOnly="True" Style="{StaticResource dataGrid}"
ColumnHeaderStyle="{StaticResource ColumHeaderStyle}" RowStyle="{StaticResource rowStyle}" CellStyle="{StaticResource cellStyle}">
<DataGrid.Columns>
<DataGridTemplateColumn IsReadOnly="True" Width="0.1*" Header="ID">
<DataGridTemplateColumn IsReadOnly="True" Width="0.05*" Header="ID">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<TextBox Text="{Binding RelativeSource={RelativeSource Mode=FindAncestor,AncestorType={x:Type DataGridRow}}, Path=Header}" IsReadOnly="True" Style="{StaticResource textboxStyle}"></TextBox>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
<DataGridTextColumn Width="0.2*" Header="温度" Binding="{Binding Temperature}" ElementStyle="{StaticResource dgCellstyle }">
<DataGridTextColumn Width="0.1*" Header="温度" Binding="{Binding Temperature}" ElementStyle="{StaticResource dgCellstyle }">
</DataGridTextColumn>
<DataGridTextColumn Width="0.2*" Header="火力" Binding="{Binding HotPower}" ElementStyle="{StaticResource dgCellstyle }">
<DataGridTextColumn Width="0.1*" Header="搅拌速度" Binding="{Binding Speed}" ElementStyle="{StaticResource dgCellstyle }">
</DataGridTextColumn>
<DataGridTextColumn Width="0.2*" Header="搅拌速度" Binding="{Binding Speed}" ElementStyle="{StaticResource dgCellstyle }">
<DataGridTextColumn Width="0.1*" Header="炒锅载重" Binding="{Binding FryPotWeight}" ElementStyle="{StaticResource dgCellstyle }">
</DataGridTextColumn>
<DataGridTextColumn Width="0.2*" Header="炒锅载重" Binding="{Binding FryPotWeight}" ElementStyle="{StaticResource dgCellstyle }">
<DataGridTextColumn Width="0.1*" Header="小火比例" Binding="{Binding SmallFire}" ElementStyle="{StaticResource dgCellstyle }">
</DataGridTextColumn>
<DataGridTextColumn Width="0.2*" Header="配方名称" Binding="{Binding RecipeName}" ElementStyle="{StaticResource dgCellstyle }">
<DataGridTextColumn Width="0.1*" Header="中火比例" Binding="{Binding MidFire}" ElementStyle="{StaticResource dgCellstyle }">
</DataGridTextColumn>
<DataGridTextColumn Width="0.2*" Header="配方用油量" Binding="{Binding OilCapacity}" ElementStyle="{StaticResource dgCellstyle }">
<DataGridTextColumn Width="0.1*" Header="大火比例" Binding="{Binding BigFire}" ElementStyle="{StaticResource dgCellstyle }">
</DataGridTextColumn>
<DataGridTextColumn Width="0.2*" Header="总用油量" Binding="{Binding TotalOilCapactiy}" ElementStyle="{StaticResource dgCellstyle }">
<DataGridTextColumn Width="0.1*" Header="强火比例" Binding="{Binding StrongFire}" ElementStyle="{StaticResource dgCellstyle }">
</DataGridTextColumn>
<DataGridTextColumn Width="0.2*" Header="产量" Binding="{Binding TotalProduct}" ElementStyle="{StaticResource dgCellstyle }">
<DataGridTextColumn Width="0.1*" Header="步数" Binding="{Binding Step}" ElementStyle="{StaticResource dgCellstyle }">
</DataGridTextColumn>
<DataGridTextColumn Width="0.2*" Header="时间" Binding="{Binding Time}" ElementStyle="{StaticResource dgCellstyle }">
<DataGridTextColumn Width="0.1*" Header="配方名称" Binding="{Binding RecipeName}" ElementStyle="{StaticResource dgCellstyle }">
</DataGridTextColumn>
<DataGridTextColumn Width="0.1*" Header="配方用油量" Binding="{Binding OilCapacity}" ElementStyle="{StaticResource dgCellstyle }">
</DataGridTextColumn>
<DataGridTextColumn Width="0.1*" Header="总用油量" Binding="{Binding TotalOilCapactiy}" ElementStyle="{StaticResource dgCellstyle }">
</DataGridTextColumn>
<DataGridTextColumn Width="0.1*" Header="产量" Binding="{Binding TotalProduct}" ElementStyle="{StaticResource dgCellstyle }">
</DataGridTextColumn>
<DataGridTextColumn Width="0.15*" Header="时间" Binding="{Binding Time}" ElementStyle="{StaticResource dgCellstyle }">
</DataGridTextColumn>
<!--<DataGridTemplateColumn IsReadOnly="False" Width="0.45*" Header="地址">
<DataGridTemplateColumn.CellTemplate>


+ 23
- 13
FryPot_DosingSystem/ViewModel/FlowProcessSetViewModel.cs View File

@@ -16,6 +16,7 @@ namespace FryPot_DosingSystem.ViewModel
{
internal class FlowProcessSetViewModel
{

public int Id { get; set; } = 0;
public static int materialNum { get; set; }
public ObservableCollection<FlowProcessModel> flowProcessModels { get; set; } = new ObservableCollection<FlowProcessModel>();
@@ -29,11 +30,17 @@ namespace FryPot_DosingSystem.ViewModel
public RelayCommand AddLastFlowItemCommand { get; set; }
public RelayCommand AddFrontFlowItemCommand { get; set; }
public RelayCommand DeleteFlowItemCommand { get; set; }


public FlowProcessSetViewModel()
{
Json<FlowProcessNames>.Read();
// FlowProcessNames.GetInstance.Names = Json<FlowProcessNames>.Data.Names;
FlowItems = Json<FlowProcessNames>.Data.Names;
// FlowItems = Json<FlowProcessNames>.Data.NameId;
foreach (KeyValuePair<string, int> item in Json<FlowProcessNames>.Data.NameId)
{
FlowItems.Add(item.Key);
}
ActionManage.GetInstance.Register(new Action<object>((obj) =>
{
if (obj != null)
@@ -66,10 +73,10 @@ namespace FryPot_DosingSystem.ViewModel
}
foreach (var item in recipe.FlowProcess.fpModels)
{
flowProcessModels.Add(new FlowProcessModel {FryMaterialNum = item.FryMaterialNum, FrySpeed = item.FrySpeed, FryTemperature = item.FryTemperature, FryPeriodTime = item.FryPeriodTime ,FryFire=item.FryFire,FryFirePercent=item.FryFirePercent});
flowProcessModels.Add(new FlowProcessModel { FryMaterialNum = item.FryMaterialNum, FrySpeed = item.FrySpeed, FryWeight = item.FryWeight, FryTemperature = item.FryTemperature, FryPeriodTime = item.FryPeriodTime, SmallFirePercent = item.SmallFirePercent, MidFirePercent = item.MidFirePercent, BigFirePercent = item.BigFirePercent, StrongFirePercent = item.StrongFirePercent });
}

// ActionManage.GetInstance.Send("MaterialNum", recipe.materialCollection.Count);
// ActionManage.GetInstance.Send("MaterialNum", recipe.materialCollection.Count);
}
else//创建新工艺
{
@@ -82,7 +89,7 @@ namespace FryPot_DosingSystem.ViewModel
{

if (!FlowItems.Contains(item.MaterialLoc.ToString()))
FlowItems.Add( item.MaterialLoc.ToString());//下拉框
FlowItems.Add(item.MaterialLoc.ToString());//下拉框
}
ActionManage.GetInstance.Send("MaterialNum", name.materialCollection.Count);
name.FlowProcess.fpModels = flowProcessModels;
@@ -111,7 +118,7 @@ namespace FryPot_DosingSystem.ViewModel
{
// NoticeDemoViewModel.OpenMsg(EnumPromptType.Error, App.MainWindow, "提示", $"保存失败,桶号重复!");
MessageNotify.GetInstance.ShowUserLog("保存失败,桶号重复");
MessageBox.Show("保存失败,桶号重复","提示",MessageBoxButton.OK,MessageBoxImage.Error);
MessageBox.Show("保存失败,桶号重复", "提示", MessageBoxButton.OK, MessageBoxImage.Error);
return;
}
}
@@ -119,14 +126,14 @@ namespace FryPot_DosingSystem.ViewModel
name.FlowProcess.fpModels.Clear();
foreach (var item in flowProcessModels)
{
name.FlowProcess.fpModels.Add(new FlowProcessModel { FryMaterialNum = item.FryMaterialNum, FrySpeed = item.FrySpeed, FryTemperature = item.FryTemperature, FryPeriodTime = item.FryPeriodTime,FryFire=item.FryFire,FryFirePercent=item.FryFirePercent });
}
foreach (var item in name.materialCollection)
{
string s= Json<FlowProcessNames>.Data.Names.FirstOrDefault(p=>p == item.MaterialLoc.ToString());
Json<FlowProcessNames>.Data.Names.Remove(s);
name.FlowProcess.fpModels.Add(new FlowProcessModel { FryMaterialNum = item.FryMaterialNum, FrySpeed = item.FrySpeed, FryWeight = item.FryWeight, FryTemperature = item.FryTemperature, FryPeriodTime = item.FryPeriodTime, SmallFirePercent = item.SmallFirePercent, MidFirePercent = item.MidFirePercent, BigFirePercent = item.BigFirePercent, StrongFirePercent = item.StrongFirePercent });
}

//foreach (var item in name.materialCollection)
//{
// string s= Json<FlowProcessNames>.Data.Names.FirstOrDefault(p=>p == item.MaterialLoc.ToString());
// Json<FlowProcessNames>.Data.Names.Remove(s);
//}
}
Json<RecipeManage>.Save();
Json<FlowProcessNames>.Save();
@@ -175,7 +182,7 @@ namespace FryPot_DosingSystem.ViewModel
catch (Exception)
{

// throw;
// throw;
}
});
DeleteFlowItemCommand = new RelayCommand(() =>
@@ -184,6 +191,9 @@ namespace FryPot_DosingSystem.ViewModel
flowProcessModels.RemoveAt(currentItemId);
currentItemId = 0;
});



}
}
}

+ 58
- 0
FryPot_DosingSystem/ViewModel/NewFryPotMaterialViewModel.cs View File

@@ -0,0 +1,58 @@
using BPASmartClient.CustomResource.Pages.Model;
using BPASmartClient.CustomResource.UserControls;
using BPASmartClient.CustomResource.UserControls.MessageShow;
using BPASmartClient.Helper;
using FryPot_DosingSystem.Model;
using Microsoft.Toolkit.Mvvm.ComponentModel;
using Microsoft.Toolkit.Mvvm.Input;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace FryPot_DosingSystem.ViewModel
{
internal class NewFryPotMaterialViewModel : ObservableObject
{
public RelayCommand ConfimCommand { get; set; }
private string _materialName;
public string MaterialName { get { return _materialName; } set { _materialName = value; OnPropertyChanged(); } }

private int _id;
public int Id { get { return _id; } set { _id = value; OnPropertyChanged(); } }

public NewFryPotMaterialViewModel()
{
Json<FlowProcessNames>.Read();
ConfimCommand = new RelayCommand(() =>
{
if (Id > 0 && MaterialName != String.Empty)
{
if (Json<FlowProcessNames>.Data.NameId.ContainsKey(MaterialName))
{
//已存在相同的炒锅工艺物料
NoticeDemoViewModel.OpenMsg(EnumPromptType.Error, App.MainWindow, "提示", $"保存失败,已存在相同工艺项");
}
else
{
if (Json<FlowProcessNames>.Data.NameId.TryAdd(MaterialName, Id))
{
Json<FlowProcessNames>.Save();
MessageNotify.GetInstance.ShowUserLog($"用户新增【{MaterialName}】炒锅工艺项");
ActionManage.GetInstance.Send("CloseNewFryPotMaterial");
}
else
{
NoticeDemoViewModel.OpenMsg(EnumPromptType.Error, App.MainWindow, "提示", $"保存失败,请检查格式是否输入正确");
}


}
}

});

}
}
}

+ 1
- 0
FryPot_DosingSystem/ViewModel/NewRecipeViewModel.cs View File

@@ -43,6 +43,7 @@ namespace FryPot_DosingSystem.ViewModel
public RelayCommand SaveAs { get; set; }
public NewRecipeViewModel()
{
Json<RecipeManage>.Read();
Json<MaterialNames>.Read();
MaterialNames.GetInstance.Names = Json<MaterialNames>.Data.Names;
materialNames = Json<MaterialNames>.Data.Names;


Loading…
Cancel
Save