Procházet zdrojové kódy

180更新

样式分支
taoye před 2 roky
rodič
revize
14131ccafa
10 změnil soubory, kde provedl 944 přidání a 513 odebrání
  1. +35
    -35
      BPASmartClient.AGV/AGVHelper.cs
  2. +8
    -4
      BPASmartClient.CustomResource/Pages/Model/AlarmHelper.cs
  3. +7
    -3
      BPASmartClient.Helper/RTrig.cs
  4. +4
    -3
      FryPot_DosingSystem/App.xaml.cs
  5. +6
    -6
      FryPot_DosingSystem/Control/DeviceOperate.cs
  6. +801
    -421
      FryPot_DosingSystem/Control/DosingLogicControl.cs
  7. +42
    -1
      FryPot_DosingSystem/Control/GlobalVariable.cs
  8. +3
    -2
      FryPot_DosingSystem/View/DebugView.xaml.cs
  9. +2
    -2
      FryPot_DosingSystem/ViewModel/FlowProcessSetViewModel.cs
  10. +36
    -36
      FryPot_DosingSystem/ViewModel/NewRecipeViewModel.cs

+ 35
- 35
BPASmartClient.AGV/AGVHelper.cs Zobrazit soubor

@@ -147,8 +147,8 @@ namespace BPASmartClient.AGV
//url = url + "?sign=" + MD5Deal(body);

string data = HttpRequest(url, head, body).Replace('[', ' ').Replace(']', ' ');
object objData = JsonConvert.DeserializeObject(data);
string data = HttpRequest(url, head, body).Replace("[", "").Replace("]", "");
object objData = JsonConvert.DeserializeObject<HttpResponseBodyModel>(data);
if (objData != null && objData is HttpResponseBodyModel response)
{
return response.code;
@@ -210,8 +210,8 @@ namespace BPASmartClient.AGV
//string body = JsonConvert.SerializeObject(httpModel);
//启用签名
//url = url + "?sign=" + MD5Deal(body);
string data = HttpRequest(url, head, body).Replace('[', ' ').Replace(']', ' ');
string data = HttpRequest(url, head, body).Replace("[", "").Replace("]", "");
var objData = JsonConvert.DeserializeObject<HttpResponseBodyModel>(data);
if (objData != null && objData is HttpResponseBodyModel response)
{
@@ -266,8 +266,8 @@ namespace BPASmartClient.AGV
//string body = JsonConvert.SerializeObject(httpModel);
//启用签名
//url = url + "?sign=" + MD5Deal(body);
string data = HttpRequest(url, head, body).Replace('[', ' ').Replace(']', ' ');
object objData = JsonConvert.DeserializeObject(data);
string data = HttpRequest(url, head, body).Replace("[", "").Replace("]", "");
object objData = JsonConvert.DeserializeObject<HttpResponseBodyModel>(data);
if (objData != null && objData is HttpResponseBodyModel response)
{
return response.code;
@@ -321,8 +321,8 @@ namespace BPASmartClient.AGV
//string body = JsonConvert.SerializeObject(httpModel);
//启用签名
//url = url + "?sign=" + MD5Deal(body);
string data = HttpRequest(url, head, body).Replace('[', ' ').Replace(']', ' ');
object objData = JsonConvert.DeserializeObject(data);
string data = HttpRequest(url, head, body).Replace("[", "").Replace("]", "");
object objData = JsonConvert.DeserializeObject<HttpResponseBodyModel>(data);
if (objData != null && objData is HttpResponseBodyModel response)
{
return response.code;
@@ -376,8 +376,8 @@ namespace BPASmartClient.AGV
//string body = JsonConvert.SerializeObject(httpModel);
//启用签名
//url = url + "?sign=" + MD5Deal(body);
string data = HttpRequest(url, head, body).Replace('[', ' ').Replace(']', ' ');
object objData = JsonConvert.DeserializeObject(data);
string data = HttpRequest(url, head, body).Replace("[","").Replace("]","");
object objData = JsonConvert.DeserializeObject<HttpResponseBodyModel>(data);
if (objData != null && objData is HttpResponseBodyModel response)
{
return response.code;
@@ -431,8 +431,8 @@ namespace BPASmartClient.AGV
//string body = JsonConvert.SerializeObject(httpModel);
//启用签名
//url = url + "?sign=" + MD5Deal(body);
string data = HttpRequest(url, head, body).Replace('[', ' ').Replace(']', ' ');
object objData = JsonConvert.DeserializeObject(data);
string data = HttpRequest(url, head, body).Replace("[", "").Replace("]", "");
object objData = JsonConvert.DeserializeObject<HttpResponseBodyModel>(data);
if (objData != null && objData is HttpResponseBodyModel response)
{
return response.code;
@@ -486,8 +486,8 @@ namespace BPASmartClient.AGV
//string body = JsonConvert.SerializeObject(httpModel);
//启用签名
//url = url + "?sign=" + MD5Deal(body);
string data = HttpRequest(url, head, body).Replace('[', ' ').Replace(']', ' ');
object objData = JsonConvert.DeserializeObject(data);
string data = HttpRequest(url, head, body).Replace("[", "").Replace("]", "");
object objData = JsonConvert.DeserializeObject<HttpResponseBodyModel>(data);
if (objData != null && objData is HttpResponseBodyModel response)
{
return response.code;
@@ -541,8 +541,8 @@ namespace BPASmartClient.AGV
//string body = JsonConvert.SerializeObject(httpModel);
//启用签名
//url = url + "?sign=" + MD5Deal(body);
string data = HttpRequest(url, head, body).Replace('[', ' ').Replace(']', ' ');
object objData = JsonConvert.DeserializeObject(data);
string data = HttpRequest(url, head, body).Replace("[", "").Replace("]", "");
object objData = JsonConvert.DeserializeObject<HttpResponseBodyModel>(data);
if (objData != null && objData is HttpResponseBodyModel response)
{
return response.code;
@@ -596,8 +596,8 @@ namespace BPASmartClient.AGV
//string body = JsonConvert.SerializeObject(httpModel);
//启用签名
//url = url + "?sign=" + MD5Deal(body);
string data = HttpRequest(url, head, body).Replace('[', ' ').Replace(']', ' ');
object objData = JsonConvert.DeserializeObject(data);
string data = HttpRequest(url, head, body).Replace("[", "").Replace("]", "");
object objData = JsonConvert.DeserializeObject<HttpResponseBodyModel>(data);
if (objData != null && objData is HttpResponseBodyModel response)
{
return response.code;
@@ -651,8 +651,8 @@ namespace BPASmartClient.AGV
//string body = JsonConvert.SerializeObject(httpModel);
//启用签名
//url = url + "?sign=" + MD5Deal(body);
string data = HttpRequest(url, head, body).Replace('[', ' ').Replace(']', ' ');
object objData = JsonConvert.DeserializeObject(data);
string data = HttpRequest(url, head, body).Replace("[", "").Replace("]", "");
object objData = JsonConvert.DeserializeObject<HttpResponseBodyModel>(data);
if (objData != null && objData is HttpResponseBodyModel response)
{
return response.code;
@@ -706,8 +706,8 @@ namespace BPASmartClient.AGV
//string body = JsonConvert.SerializeObject(httpModel);
//启用签名
//url = url + "?sign=" + MD5Deal(body);
string data = HttpRequest(url, head, body).Replace('[', ' ').Replace(']', ' ');
object objData = JsonConvert.DeserializeObject(data);
string data = HttpRequest(url, head, body).Replace("[", "").Replace("]", "");
object objData = JsonConvert.DeserializeObject<HttpResponseBodyModel>(data);
if (objData != null && objData is HttpResponseBodyModel response)
{
return response.code;
@@ -762,8 +762,8 @@ namespace BPASmartClient.AGV
//string body = JsonConvert.SerializeObject(httpModel);
//启用签名
//url = url + "?sign=" + MD5Deal(body);
string data = HttpRequest(url, head, body).Replace('[', ' ').Replace(']', ' ');
object objData = JsonConvert.DeserializeObject(data);
string data = HttpRequest(url, head, body).Replace("[", "").Replace("]", "");
object objData = JsonConvert.DeserializeObject<HttpResponseBodyModel>(data);
if (objData != null && objData is HttpResponseBodyModel response)
{
return response.code;
@@ -802,7 +802,7 @@ namespace BPASmartClient.AGV
httpJobData.autoUnload = Convert.ToBoolean(config.AppSettings.Settings["autoUnload"].Value); //是否自动下料 true:自动下料 false:人工下料
httpJobData.enableIOUnload = Convert.ToBoolean(config.AppSettings.Settings["enableIOUnload"].Value); ;//下料交互方式 false:接口交互 true:光电交互
httpJobData.loadEquipmentId = 22;
httpJobData.unloadEquipmentId = 10;
httpJobData.unloadEquipmentId = 20;
httpModel.jobData = httpJobData;
string body ="["+ JsonConvert.SerializeObject(httpModel)+"]";
//货位到货位
@@ -817,8 +817,8 @@ namespace BPASmartClient.AGV
//string body = JsonConvert.SerializeObject(httpModel);
//启用签名
//url = url + "?sign=" + MD5Deal(body);
string data = HttpRequest(url, head, body).Replace('[', ' ').Replace(']', ' ');
object objData = JsonConvert.DeserializeObject(data);
string data = HttpRequest(url, head, body).Replace("[", "").Replace("]", "");
object objData = JsonConvert.DeserializeObject<HttpResponseBodyModel>(data);
if (objData != null && objData is HttpResponseBodyModel response)
{
return response.code;
@@ -857,7 +857,7 @@ namespace BPASmartClient.AGV
httpJobData.autoUnload = Convert.ToBoolean(config.AppSettings.Settings["autoUnload"].Value); //是否自动下料 true:自动下料 false:人工下料
httpJobData.enableIOUnload = Convert.ToBoolean(config.AppSettings.Settings["enableIOUnload"].Value); ;//下料交互方式 false:接口交互 true:光电交互
httpJobData.loadEquipmentId = 33;
httpJobData.unloadEquipmentId = 10;
httpJobData.unloadEquipmentId = 30;
httpModel.jobData = httpJobData;
string body ="["+ JsonConvert.SerializeObject(httpModel)+"]";
//货位到货位
@@ -872,8 +872,8 @@ namespace BPASmartClient.AGV
//string body = JsonConvert.SerializeObject(httpModel);
//启用签名
//url = url + "?sign=" + MD5Deal(body);
string data = HttpRequest(url, head, body).Replace('[', ' ').Replace(']', ' ');
object objData = JsonConvert.DeserializeObject(data);
string data = HttpRequest(url, head, body).Replace("[", "").Replace("]", "");
object objData = JsonConvert.DeserializeObject<HttpResponseBodyModel>(data);
if (objData != null && objData is HttpResponseBodyModel response)
{
return response.code;
@@ -927,8 +927,8 @@ namespace BPASmartClient.AGV
//string body = JsonConvert.SerializeObject(httpModel);
//启用签名
//url = url + "?sign=" + MD5Deal(body);
string data = HttpRequest(url, head, body).Replace('[', ' ').Replace(']', ' ');
object objData = JsonConvert.DeserializeObject(data);
string data = HttpRequest(url, head, body).Replace("[", "").Replace("]", "");
object objData = JsonConvert.DeserializeObject<HttpResponseBodyModel>(data);
if (objData != null && objData is HttpResponseBodyModel response)
{
return response.code;
@@ -987,8 +987,8 @@ namespace BPASmartClient.AGV
string body = JsonConvert.SerializeObject(notify);
//启用签名
//url = url + "?sign=" + MD5Deal(body);
string data = HttpRequest(url, head, body).Replace('[', ' ').Replace(']', ' ');
object objData = JsonConvert.DeserializeObject(data);
string data = HttpRequest(url, head, body).Replace("[", "").Replace("]", "");
object objData = JsonConvert.DeserializeObject<HttpResponseBodyModel>(data);
if (objData != null && objData is HttpResponseBodyModel response)
{
return response.code;
@@ -1023,7 +1023,7 @@ namespace BPASmartClient.AGV
//启用签名
//url = url + "?sign=" + MD5Deal(body);
string data = HttpRequest(url, head, body);
object objData = JsonConvert.DeserializeObject(data);
object objData = JsonConvert.DeserializeObject<HttpResponseBodyModel>(data);
if (objData != null && objData is HttpResponseBodyModel response)
{
return response.code;


+ 8
- 4
BPASmartClient.CustomResource/Pages/Model/AlarmHelper.cs Zobrazit soubor

@@ -17,12 +17,16 @@ namespace BPASmartClient.CustomResource.Pages.Model
public class AlarmHelper<AlarmT> where AlarmT : class, new()
{
private volatile static ConcurrentDictionary<string, AlarmT> _Instance;
private static readonly object Obj_Lock = new object();
public static AlarmT GetInstance(string name = "")
{
if (string.IsNullOrEmpty(name)) name = typeof(AlarmT).Name;
if (_Instance == null) _Instance = new ConcurrentDictionary<string, AlarmT>();
if (!_Instance.ContainsKey(name)) _Instance.TryAdd(name, new AlarmT());
return _Instance[name];
lock (Obj_Lock)
{
if (string.IsNullOrEmpty(name)) name = typeof(AlarmT).Name;
if (_Instance == null) _Instance = new ConcurrentDictionary<string, AlarmT>();
if (!_Instance.ContainsKey(name)) _Instance.TryAdd(name, new AlarmT());
return _Instance[name];
}
}
private AlarmHelper() { }



+ 7
- 3
BPASmartClient.Helper/RTrig.cs Zobrazit soubor

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



+ 4
- 3
FryPot_DosingSystem/App.xaml.cs Zobrazit soubor

@@ -38,19 +38,20 @@ namespace FryPot_DosingSystem
if (res != null && res == true)
{
mv.Show();
MessageLog.GetInstance.ShowUserLog("用户登录");
MessageNotify.GetInstance.ShowUserLog("用户登录");
try
{
await Task.Run(() => { DeviceOperate deviceOperate = DeviceOperate.GetInstance; });
}
catch (Exception)
{
MessageLog.GetInstance.ShowRunLog("下位机PLC连接失败,请检查无误后重启上位机");
MessageNotify.GetInstance.ShowRunLog("下位机PLC连接失败,请检查无误后重启上位机");
}
//开启实时PLC数据读取
DosingLogicControl logigControl = DosingLogicControl.GetInstance;//开启逻辑控制任务程序
HubHelper.GetInstance.Connect("172.16.12.100", 8089);
AlarmHelper<AlarmInfo>.Init();//报警实时监控
HubHelper.GetInstance.Connect("172.16.12.100", 8089);
}
else
mv.Close();


+ 6
- 6
FryPot_DosingSystem/Control/DeviceOperate.cs Zobrazit soubor

@@ -180,7 +180,7 @@ namespace FryPot_DosingSystem.Control
string DeviceName = devices.Devices[i].DeviceName;
switch (DeviceName)
{
case "滚筒输送线": modbus.ModbusTcpConnect(Ip, Convert.ToInt32(Port)); MessageLog.GetInstance.ShowRunLog("滚筒线PLC连接成功"); break;
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;
@@ -259,7 +259,7 @@ namespace FryPot_DosingSystem.Control
DeviceManage devices = Json<DeviceManage>.Data;
var res = devices.Devices.FirstOrDefault(p => p.DeviceName == "炒锅1");
if (res != null)
fryOneModbus.ModbusTcpConnect(res.Ip, Convert.ToInt32(res.Port)); MessageLog.GetInstance.ShowRunLog("1号炒锅PLC重连成功");
fryOneModbus.ModbusTcpConnect(res.Ip, Convert.ToInt32(res.Port)); MessageNotify.GetInstance.ShowRunLog("1号炒锅PLC重连成功");
}
Thread.Sleep(10);
}), $"炒锅1实时数据读取线程");
@@ -289,7 +289,7 @@ namespace FryPot_DosingSystem.Control
DeviceManage devices = Json<DeviceManage>.Data;
var res = devices.Devices.FirstOrDefault(p => p.DeviceName == "炒锅2");
if (res != null)
fryTwoModbus.ModbusTcpConnect(res.Ip, Convert.ToInt32(res.Port)); MessageLog.GetInstance.ShowRunLog("2号炒锅PLC重连成功");
fryTwoModbus.ModbusTcpConnect(res.Ip, Convert.ToInt32(res.Port)); MessageNotify.GetInstance.ShowRunLog("2号炒锅PLC重连成功");
}
Thread.Sleep(10);
}), $"炒锅2实时数据读取线程");
@@ -319,7 +319,7 @@ namespace FryPot_DosingSystem.Control
DeviceManage devices = Json<DeviceManage>.Data;
var res = devices.Devices.FirstOrDefault(p => p.DeviceName == "炒锅3");
if (res != null)
fryThreeModbus.ModbusTcpConnect(res.Ip, Convert.ToInt32(res.Port)); MessageLog.GetInstance.ShowRunLog("3号炒锅PLC重连成功");
fryThreeModbus.ModbusTcpConnect(res.Ip, Convert.ToInt32(res.Port)); MessageNotify.GetInstance.ShowRunLog("3号炒锅PLC重连成功");
}
Thread.Sleep(10);
}), $"炒锅3实时数据读取线程");
@@ -349,7 +349,7 @@ namespace FryPot_DosingSystem.Control
DeviceManage devices = Json<DeviceManage>.Data;
var res = devices.Devices.FirstOrDefault(p => p.DeviceName == "炒锅4");
if (res != null)
fryFourModbus.ModbusTcpConnect(res.Ip, Convert.ToInt32(res.Port)); MessageLog.GetInstance.ShowRunLog("4号炒锅PLC重连成功");
fryFourModbus.ModbusTcpConnect(res.Ip, Convert.ToInt32(res.Port)); MessageNotify.GetInstance.ShowRunLog("4号炒锅PLC重连成功");
}
Thread.Sleep(10);
}), $"炒锅4实时数据读取线程");
@@ -379,7 +379,7 @@ namespace FryPot_DosingSystem.Control
DeviceManage devices = Json<DeviceManage>.Data;
var res = devices.Devices.FirstOrDefault(p => p.DeviceName == "炒锅5");
if (res != null)
fryFiveModbus.ModbusTcpConnect(res.Ip, Convert.ToInt32(res.Port)); MessageLog.GetInstance.ShowRunLog("5号炒锅PLC重连成功");
fryFiveModbus.ModbusTcpConnect(res.Ip, Convert.ToInt32(res.Port)); MessageNotify.GetInstance.ShowRunLog("5号炒锅PLC重连成功");
}
Thread.Sleep(10);
}), $"炒锅5实时数据读取线程");


+ 801
- 421
FryPot_DosingSystem/Control/DosingLogicControl.cs
Diff nebyl zobrazen, protože je příliš veliký
Zobrazit soubor


+ 42
- 1
FryPot_DosingSystem/Control/GlobalVariable.cs Zobrazit soubor

@@ -295,7 +295,20 @@ namespace FryPot_DosingSystem.Control
/// </summary>
public bool NextStart { get; set; }

/// <summary>
/// 下位信号判断
/// </summary>
public bool LowSignalJude { get; set; }

/// <summary>
/// 集中洗桶模式
/// </summary>
public ushort WashEmptyRollerModel { get; set; }
/// <summary>
/// 洗桶就位信号
/// </summary>
public ushort WashRollerArriveSignal { get; set; }

}
/// <summary>
/// 滚筒线2相关变量
@@ -386,6 +399,20 @@ namespace FryPot_DosingSystem.Control
/// 线体1流程控制互锁信号
/// </summary>
public bool NextStart { get; set; }

/// <summary>
/// 下位信号判断
/// </summary>
public bool LowSignalJude { get; set; }

/// <summary>
/// 集中洗桶模式
/// </summary>
public ushort WashEmptyRollerModel { get; set; }
/// <summary>
/// 洗桶就位信号
/// </summary>
public ushort WashRollerArriveSignal { get; set; }
}
/// <summary>
/// 滚筒线3相关变量
@@ -477,6 +504,20 @@ namespace FryPot_DosingSystem.Control
/// </summary>
public bool NextStart { get; set; }

/// <summary>
/// 下位信号判断
/// </summary>
public bool LowSignalJude { get; set; }

/// <summary>
/// 集中洗桶模式
/// </summary>
public ushort WashEmptyRollerModel { get; set; }
/// <summary>
/// 洗桶就位信号
/// </summary>
public ushort WashRollerArriveSignal { get; set; }

}
/// <summary>
/// 滚筒线4相关变量


+ 3
- 2
FryPot_DosingSystem/View/DebugView.xaml.cs Zobrazit soubor

@@ -1,5 +1,6 @@
using BPASmartClient.AGV;
using BPASmartClient.Helper;
using FryPot_DosingSystem.Control;
using System;
using System.Collections.Generic;
using System.Linq;
@@ -62,8 +63,8 @@ namespace FryPot_DosingSystem.View

private void Button_Click(object sender, RoutedEventArgs e)
{
AGVHelper.GetInstance.AgvFromLineOneToFryFourLoadRoller(Guid.NewGuid().ToString("D"));
DeviceOperate.GetInstance.WritePlcData("D1060", 0);
// AGVHelper.GetInstance.AgvFromLineOneToFryFourLoadRoller(Guid.NewGuid().ToString("D"));
}

private void Button_Click_1(object sender, RoutedEventArgs e)


+ 2
- 2
FryPot_DosingSystem/ViewModel/FlowProcessSetViewModel.cs Zobrazit soubor

@@ -109,8 +109,8 @@ namespace FryPot_DosingSystem.ViewModel
var res = flowProcessModels.Where(p => p.FryMaterialNum == item.MaterialLoc.ToString());
if (res.Count() > 1)
{
// NoticeDemoViewModel.OpenMsg(EnumPromptType.Error, App.MainWindow, "提示", $"保存失败,桶号重复!");
MessageLog.GetInstance.ShowUserLog("保存失败,桶号重复");
// NoticeDemoViewModel.OpenMsg(EnumPromptType.Error, App.MainWindow, "提示", $"保存失败,桶号重复!");
MessageNotify.GetInstance.ShowUserLog("保存失败,桶号重复");
MessageBox.Show("保存失败,桶号重复","提示",MessageBoxButton.OK,MessageBoxImage.Error);
return;
}


+ 36
- 36
FryPot_DosingSystem/ViewModel/NewRecipeViewModel.cs Zobrazit soubor

@@ -101,18 +101,18 @@ namespace FryPot_DosingSystem.ViewModel
if (materials.Count<=8&& materials.Count> 0)
{
int lineNum= materials.ElementAt(0).MaterialLoc / 100;
//桶号正确性验证
for (int i = 0; i < materials.Count; i++)
{
if (materials.ElementAt(i).MaterialLoc / 100 != lineNum|| materials.ElementAt(i).MaterialLoc % 100!=i+1||lineNum<=0||lineNum>5)
{
MessageNotify.GetInstance.ShowUserLog($"新建配方【{RecipeName}】无效:【配方中原料桶号异常】");
NoticeDemoViewModel.OpenMsg(EnumPromptType.Error, App.MainWindow, "提示", $"新建配方【{RecipeName}】无效");
ActionManage.GetInstance.Send("CloseNewRecipeView");
return;
}
}
//int lineNum= materials.ElementAt(0).MaterialLoc / 100;
// //桶号正确性验证
// for (int i = 0; i < materials.Count; i++)
// {
// if (materials.ElementAt(i).MaterialLoc / 100 != lineNum|| materials.ElementAt(i).MaterialLoc % 100!=i+1||lineNum<=0||lineNum>5)
// {
// MessageNotify.GetInstance.ShowUserLog($"新建配方【{RecipeName}】无效:【配方中原料桶号异常】");
// NoticeDemoViewModel.OpenMsg(EnumPromptType.Error, App.MainWindow, "提示", $"新建配方【{RecipeName}】无效");
// ActionManage.GetInstance.Send("CloseNewRecipeView");
// return;
// }
// }

prop: string recipeID = Guid.NewGuid().ToString();//配方唯一ID,后期根据实际要求更改
var res = Json<RecipeManage>.Data.Recipes.FirstOrDefault(p => p.RecipeId == recipeID);
@@ -144,18 +144,18 @@ namespace FryPot_DosingSystem.ViewModel
{
if (materials.Count > 0 && materials.Count <= 8)
{
int lineNum = materials.ElementAt(0).MaterialLoc / 100;
//桶号正确性验证
for (int i = 0; i < materials.Count; i++)
{
if (materials.ElementAt(i).MaterialLoc / 100 != lineNum && materials.ElementAt(i).MaterialLoc % 100 != i + 1 || lineNum <= 0 || lineNum > 5)
{
MessageNotify.GetInstance.ShowUserLog($"另存配方【{RecipeName}】无效:【配方中原料桶号异常】");
NoticeDemoViewModel.OpenMsg(EnumPromptType.Error, App.MainWindow, "提示", $"另存配方【{RecipeName}】无效");
ActionManage.GetInstance.Send("CloseNewRecipeView");
return;
}
}
//int lineNum = materials.ElementAt(0).MaterialLoc / 100;
////桶号正确性验证
//for (int i = 0; i < materials.Count; i++)
//{
// if (materials.ElementAt(i).MaterialLoc / 100 != lineNum || materials.ElementAt(i).MaterialLoc % 100 != i + 1 || lineNum <= 0 || lineNum > 5)
// {
// MessageNotify.GetInstance.ShowUserLog($"另存配方【{RecipeName}】无效:【配方中原料桶号异常】");
// NoticeDemoViewModel.OpenMsg(EnumPromptType.Error, App.MainWindow, "提示", $"另存配方【{RecipeName}】无效");
// ActionManage.GetInstance.Send("CloseNewRecipeView");
// return;
// }
//}
bom.materialCollection = materials;
bom.RecipeName = RecipeName;
bom.UpdateTime = DateTime.Now.ToShortDateString();
@@ -180,18 +180,18 @@ namespace FryPot_DosingSystem.ViewModel
{
if (materials.Count>0&& materials.Count<=8)//验证配方中原料桶数
{
int lineNum = materials.ElementAt(0).MaterialLoc / 100;
//桶号正确性验证
for (int i = 0; i < materials.Count; i++)
{
if (materials.ElementAt(i).MaterialLoc / 100 != lineNum && materials.ElementAt(i).MaterialLoc % 100 != i + 1 || lineNum <= 0 || lineNum > 5)
{
MessageNotify.GetInstance.ShowUserLog($"另存配方【{RecipeName}】无效:【配方中原料桶号异常】");
NoticeDemoViewModel.OpenMsg(EnumPromptType.Error, App.MainWindow, "提示", $"另存配方【{RecipeName}】无效");
ActionManage.GetInstance.Send("CloseNewRecipeView");
return;
}
}
//int lineNum = materials.ElementAt(0).MaterialLoc / 100;
////桶号正确性验证
//for (int i = 0; i < materials.Count; i++)
//{
// if (materials.ElementAt(i).MaterialLoc / 100 != lineNum || materials.ElementAt(i).MaterialLoc % 100 != i + 1 || lineNum <= 0 || lineNum > 5)
// {
// MessageNotify.GetInstance.ShowUserLog($"另存配方【{RecipeName}】无效:【配方中原料桶号异常】");
// NoticeDemoViewModel.OpenMsg(EnumPromptType.Error, App.MainWindow, "提示", $"另存配方【{RecipeName}】无效");
// ActionManage.GetInstance.Send("CloseNewRecipeView");
// return;
// }
//}

prop: string recipeID = Guid.NewGuid().ToString();//配方唯一ID,后期根据实际要求更改
var res = Json<RecipeManage>.Data.Recipes.FirstOrDefault(p => p.RecipeId == recipeID);


Načítá se…
Zrušit
Uložit